Hi,
I am requesting a vote for adding the following clirr difference:
<difference>
<className>com/xpn/xwiki/objects/ListProperty</className>
<field>list</field>
<differenceType>6006</differenceType>
<justification>Elemenents must be added to the wrapping
NotifyOnUpdateList to ensure that the property is marked 'dirty' when
updated. To avoid that this mechanism is circumvented, the field is made
final.</justification>
</difference>
The flag isContentDirty in XWikiDocument is currently always true when a
document is loaded from the database. This means that a script that
just load and save a document without modifying it will generate a new
version, and the point of the flag is completely lost. It is also a
blocker for my work in the feature-authorization-context branch.
Fixing this was non-trivial. It is assumed everywhere that the content
dirty will be set, not only when the document content changes, but also
when a property, the xclass or any attachment changes. But there were
no code that actually set the flag on updates (because it was always
true anyway). What's worse is that we have API methods that returns
lists that are live updateable. I have added a wrapper list class to
detect the updates in these lists.
Hibernate refuse to store elements from my wrapper list for some reason
which forced me to add a workaround for hibernate.
Surprisingly, Clirr doesn't require any exception for the below methods
which I have added, but I will list them here for your information:
In BaseClass:
public void setOwnerDocument(XWikiDocument ownerDocument)
public void setDirty(boolean isDirty)
In BaseProperty:
public boolean isValueDirty()
protected void setValueDirty(Object newValue)
public void setValueDirty(boolean valueDirty)
public void setOwnerDocument(XWikiDocument ownerDocument)
In ListProperty:
public void setUseHibernateWorkaround(boolean useHibernateWorkaround)
In XWikiAttachmentContent:
public void setOwnerDocument(XWikiDocument ownerDocument)
New class: AbstractNotifyOnUpdateList<E>
Best Regards,
/Andreas