Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
viewer-wicket-1.6.0
-
None
Description
This broke in 1.6.0 because of https://issues.apache.org/jira/browse/ISIS-837
There are two conflicting requirements. In some cases we want a derived property to appear to be editable... so that it udpates other stuff. In other cases the derived property is not editable, so we should do nothing.
In https://github.com/apache/isis/blob/1b10065e7fefc591e7e510ecb7a5ea6dba17f485/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/update/PropertySetAndClearFacetFactory.java#L78 we go looking for setters and clears. But if there is no setter, we install a NotPersistedFacetInferred.
The stuff about the NotPersistedFacet etc is, in fact, irrelevant. We do still need this facet, but it's all to do with persistence and transactions. For example, "isNotPersisted" on OneToOneAssociation in several places (eg IsisTransaction#enlist..., and PersistedAlgorithmDefault) in order to ensure we only deal with properties that have "backing" data.
And that means the fix in ISIS-837 is correct so far as it goes... EntityModel#apply shouldn't pay any attentino to the NotPersistedFacet, because as the comment from ISIS-837 and the first use case says, in these cases we DO want to flush the changes into the Isis runtime.
However, ISIS-837 didn't go far enough .... EntityModel#apply must also account for the property being disabled and in these cases do nothing. Note that the DisabledFacet is added to the OneToOneAssociation by virtue of DisabledFacetOnPropertyInferredFacetFactory. (See also the comment that is in PropertySetAndClearFacetFactory that shows that the facet used to be installed there, but was moved for other reasons).