[
https://issues.apache.org/jira/browse/ISIS-3068?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17545560#comment-17545560
]
Andi Huber commented on ISIS-3068:
----------------------------------
What currently seems to be the case is, if the class has no explicit nature and
is not a JAXB viewmodel and is not Serializable and is not implementing the
ViewModel interface, its ObjectSpecification ends up not getting a
ViewModelFacet.
In other words: the class needs some indication, that its a viewmodel.
Otherwise the framework does not know what to do.
But we can improve on that and say, if the class annotated with @DomainObject
has no indication of being a ViewModel but is not an entity and also not
abstract, than we infer its a ViewModel.
Idea is to maybe also add a ViewModelFacetForDomainObjectAnnotation even if the
nature is NOT_SPECIFIED, but if the BeanTypeClassifier already classified the
class as sort VIEW_MODEL.
> NPE When ViewModel Invokes Method on Another ViewModel
> ------------------------------------------------------
>
> Key: ISIS-3068
> URL: https://issues.apache.org/jira/browse/ISIS-3068
> Project: Isis
> Issue Type: Improvement
> Components: Isis Core
> Affects Versions: 2.0.0-M7
> Reporter: Jörg Rade
> Assignee: Andi Huber
> Priority: Major
> Fix For: 2.0.0-RC1
>
> Attachments: NPE.txt
>
>
> I get a NPE in MangedObjects.refreshViewModel (viewModelFacet is null).
> C.f. https://the-asf.slack.com/archives/CFC42LWBV/p1654177074469069
> Comparisons (uppermost VM) calls a method in ConfigComparisons (another VM).
> {code:java}
> @DomainService(nature = NatureOfService.VIEW)
> @Named("knife.Comparisons")
> @RequiredArgsConstructor(onConstructor_ = {@Inject})
> public class Comparisons {
> private final ReleaseComparisons releaseComparisons;
> private final ConfigComparisons configComparisons;
> [...]
> {code}
> {code:java}
> @DomainService(nature = NatureOfService.VIEW)
> @Named("knife.ConfigComparisons")
> @RequiredArgsConstructor(onConstructor_ = {@Inject})
> @Slf4j
> public class ConfigComparisons {
> private final MessageService messageService;
> private final Configurations configurations;
> private final Stages stages;
> private final com.kn.ife.Properties properties;
> [...]
> {code}
> {code:java}
> @DomainObject(logicalTypeName = "knife.ConfigComparison")
> public class ConfigComparison implements Comparable<ConfigComparison> {
> [...]
> {code}
--
This message was sent by Atlassian Jira
(v8.20.7#820007)