Interface RevisionedEntity<ID>
-
- Type Parameters:
ID- is the type of theprimary key.
- All Superinterfaces:
GenericEntity<ID>,Serializable
- All Known Subinterfaces:
RevisionedPersistenceEntity<ID>
- All Known Implementing Classes:
RevisionedEto
public interface RevisionedEntity<ID> extends GenericEntity<ID>
This is the interface for aGenericEntitythat is (potentially) revision-controlled. Frameworks likehibernate-envers(look for@Auditedannotation onJPA entities) orbi-temporalcan manage such entities so all changes are stored in the database as a revision history. An instance of this interface represents therevisionof theentity. There are two cases to distinguish:latest revision
ARevisionedEntitypointing toLATEST_REVISION(null) represents the latest state of the entity and can be modified.- historic
revision
If the object isrevision controlled, it has a history of modifications. ARevisionedEntitycan represent a historicrevisionout of this history. It therefore is immutable so operations to modify theRevisionedEntitywill typically fail.
- Since:
- 3.0.0
-
-
Field Summary
Fields Modifier and Type Field Description static NumberLATEST_REVISION
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description NumbergetRevision()This method gets the revision of this entity.voidsetRevision(Number revision)This method sets therevisionof this entity.-
Methods inherited from interface com.devonfw.module.basic.common.api.entity.GenericEntity
getId, getModificationCounter, setId, setModificationCounter
-
-
-
-
Field Detail
-
LATEST_REVISION
static final Number LATEST_REVISION
-
-
Method Detail
-
getRevision
Number getRevision()
This method gets the revision of this entity. Thelatest revisionof an entity will always returnnull. Otherwise this object is a historic entity and it will be read-only so modifications are NOT permitted.- Returns:
- the revision or
LATEST_REVISION(null) if this is the latest revision.
-
setRevision
void setRevision(Number revision)
This method sets therevisionof this entity.
ATTENTION:
This operation should only be used in specific cases and if you are aware of what you are doing as this attribute is managed by the persistence. However, for final freedom we decided to add this method to the API (e.g. to copy from transfer-object to persistent-entity and vice-versa).- Parameters:
revision- is the new value ofgetRevision().
-
-