Project

General

Profile

Actions

bug #7155

closed

VersionableEntity.equals() should take updated timestamp into account

Added by Andreas Kohlbecker over 6 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Highest
Category:
cdmlib
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Severity:
normal
Found in Version:
Tags:

Description

The equals() as implemented in VersionableEntity is just a copy of the equals in CdmBase. It does not implement further functionality except of a null check of the UUID. That is, it completely misses comparing the updated timestamps. This however is crucial, since otherwise for example an older entity derived from the auditing tables would be equal to the current version of the entity.

I stumbled over this in the context of the vaadin com.vaadin.ui.AbstractField.setValue(T newFieldValue, boolean repaintIsNotNeeded, boolean ignoreReadOnly) method in which the equals comparison is used to determine if the supplied newFieldValue is different from the current field value. Since VersionableEntity.equals() is ignoring the updated timestamp updated cdm entities can not be set as field value in order to update the UI with the new persistence state. The obvious workaround to first set the field value to null is awkward and not without nasty side effects.

Most lines of the VersionableEntity.equals() implementation can furthermore be replaced by a super.equals() call which would make this method much more clear.
If we won't change the VersionableEntity.equals() we should remove it, since it does exactly the same as the method it overrides.


Related issues

Related to EDIT - feature request #7198: Implement equals() forCategoricalDataRejectedPatrick Plitzner

Actions
Related to EDIT - feature request #7199: Implement equals() for QuantitativeDataRejectedPatrick Plitzner

Actions
Related to EDIT - task #7201: [DISCUSS] Should we remove created comparison from CdmBase.equals?ClosedAndreas Müller

Actions
Copied to EDIT - task #7202: [DISCUSS] Can we remove equals override from some classes directly inheriting from CdmBase NewAndreas Kohlbecker

Actions
Actions

Also available in: Atom PDF