org.silverpeas.persistence.model
Interface Entity<ENTITY extends Entity<ENTITY,IDENTIFIER_TYPE>,IDENTIFIER_TYPE>

Type Parameters:
ENTITY - specify the class name of the entity itself which is handled by a repository manager.
IDENTIFIER_TYPE - the identifier class name used by ENTITY for its primary key definition.
All Superinterfaces:
Serializable
All Known Implementing Classes:
AbstractEntity, AbstractJpaEntity, AbstractPeriodDateAsLongJpaEntity, PersistentResourceDateReminder

public interface Entity<ENTITY extends Entity<ENTITY,IDENTIFIER_TYPE>,IDENTIFIER_TYPE>
extends Serializable

This interface must be implemented by all Silverpeas entity definitions that have to be persisted. It provides signatures for the following technical data :

Author:
Yohann Chastagnier

Method Summary
 String getComponentInstanceId()
          Gets the identifier of the component instance which the entity is attached.
 Date getCreateDate()
          Gets the date of the entity creation (in the persistence environment).
 String getCreatedBy()
          Gets the free "created by" data.
 UserDetail getCreator()
          Gets the user which has created the entity (in the persistence environment).
 String getId()
          Gets the id of the entity.
 Date getLastUpdateDate()
          Gets the last date and time of the entity update (in the persistence environment).
 String getLastUpdatedBy()
          Gets the free "last updated by" data.
 UserDetail getLastUpdater()
          Gets the last user which has updated the entity (in the persistence environment).
 Long getVersion()
          Gets the version of the entity (in the persistence environment).
 boolean hasBeenModified()
          Indicates if the entity has been modified at least one time.
 boolean isPersisted()
          Indicates if the entity is persisted (commonly if the entity has an id)
 void markAsModified()
          By default, if no functional data is changed, last update date, last updated by and version technical data are not automatically updated on entity save operation.
 ENTITY setCreator(UserDetail creator)
          Sets the user which has created the entity (in the persistence environment).
 ENTITY setLastUpdater(UserDetail updater)
          Sets the last user which has updated the entity (in the persistence environment).
 

Method Detail

getId

String getId()
Gets the id of the entity.

Returns:

getComponentInstanceId

String getComponentInstanceId()
Gets the identifier of the component instance which the entity is attached.

Returns:
the identifier of the component instance which the entity is attached.

getCreateDate

Date getCreateDate()
Gets the date of the entity creation (in the persistence environment).

Returns:

getCreatedBy

String getCreatedBy()
Gets the free "created by" data.

Returns:

getCreator

UserDetail getCreator()
Gets the user which has created the entity (in the persistence environment). (if "created by" is a known user id)

Returns:

setCreator

ENTITY setCreator(UserDetail creator)
Sets the user which has created the entity (in the persistence environment).

Parameters:
creator -
Returns:

getLastUpdateDate

Date getLastUpdateDate()
Gets the last date and time of the entity update (in the persistence environment).

Returns:

getLastUpdatedBy

String getLastUpdatedBy()
Gets the free "last updated by" data.

Returns:

getLastUpdater

UserDetail getLastUpdater()
Gets the last user which has updated the entity (in the persistence environment). (if "last updated by" is a known user id)

Returns:

setLastUpdater

ENTITY setLastUpdater(UserDetail updater)
Sets the last user which has updated the entity (in the persistence environment).

Parameters:
updater -
Returns:

getVersion

Long getVersion()
Gets the version of the entity (in the persistence environment).

Returns:

isPersisted

boolean isPersisted()
Indicates if the entity is persisted (commonly if the entity has an id)

Returns:

hasBeenModified

boolean hasBeenModified()
Indicates if the entity has been modified at least one time.

Returns:

markAsModified

void markAsModified()
By default, if no functional data is changed, last update date, last updated by and version technical data are not automatically updated on entity save operation. But in some cases, it could be useful that this three above technical data are updated, even if functional data are not changed. So, calling this method ensures that last update date, last updated by and version will be updated.



Copyright © 2016 Silverpeas. All Rights Reserved.