Class SilverpeasJpaEntity<E extends Entity<E,​I>,​I extends EntityIdentifier>

    • Constructor Detail

      • SilverpeasJpaEntity

        public SilverpeasJpaEntity()
    • Method Detail

      • hasBeenModified

        public boolean hasBeenModified()
        Description copied from interface: Entity
        Indicates if the entity has been modified at least one time.
        Specified by:
        hasBeenModified in interface Entity<E extends Entity<E,​I>,​I extends EntityIdentifier>
        Returns:
        true if this entity was modified since its first fetching from the database. False otherwise.
      • getCreator

        public final User getCreator()
        Description copied from interface: Entity
        Gets the user which has created the entity (in the persistence environment). (if "created by" is a known user id)
        Specified by:
        getCreator in interface Entity<E extends Entity<E,​I>,​I extends EntityIdentifier>
        Returns:
        the creator.
      • createdBy

        public E createdBy​(User creator)
        Description copied from interface: Entity
        Sets explicitly the user who has created the entity (in the persistence context). The creation date will be set at now.

        The Silverpeas persistence system sets automatically the creator from the operation context in the current thread and it sets automatically the creation date at the date the entity is persisted. By using this method, you overrides this behaviour.

        Specified by:
        createdBy in interface Entity<E extends Entity<E,​I>,​I extends EntityIdentifier>
        Parameters:
        creator - the creator of this entity.
        Returns:
        itself.
      • createdBy

        public E createdBy​(User creator,
                           Date creationDate)
        Description copied from interface: Entity
        sets the user who has created the entity (in the persistence environment) with the date of the creation.

        The Silverpeas persistence system sets automatically the creator from the operation context in the current thread and it sets automatically the creation date at the date the entity is persisted. By using this method, you overrides this behaviour.

        Specified by:
        createdBy in interface Entity<E extends Entity<E,​I>,​I extends EntityIdentifier>
        Parameters:
        creator - the creator of this entity.
        creationDate - the date at which the entity is created.
        Returns:
        itself.
      • getLastUpdater

        public final User getLastUpdater()
        Description copied from interface: Entity
        Gets the last user which has updated the entity (in the persistence context). If the entity hasn't yet been updated since its inception, then the creator is considered the last user that touched the entity and hence it is returned.
        Specified by:
        getLastUpdater in interface Entity<E extends Entity<E,​I>,​I extends EntityIdentifier>
        Returns:
        the last updater.
      • updatedBy

        public E updatedBy​(User updater)
        Description copied from interface: Entity
        Sets explicitly the last user who has updated the entity (in the persistence context). The last update date will be set at now.

        The Silverpeas persistence system sets automatically the updater from the operation context in the current thread and it sets automatically the update date at the date the entity is updated in the persistence context. By using this method, you overrides this behaviour.

        Specified by:
        updatedBy in interface Entity<E extends Entity<E,​I>,​I extends EntityIdentifier>
        Parameters:
        updater - the last updater to set.
        Returns:
        itself.
      • updatedBy

        public E updatedBy​(User updater,
                           Date updateDate)
        Description copied from interface: Entity
        sets the user who has updated the entity (in the persistence context) with the date of the update.

        The Silverpeas persistence system sets automatically the updater from the operation context in the current thread and it sets automatically the update date at the date the entity is updated in the persistence cotnext. By using this method, you overrides this behaviour.

        Specified by:
        updatedBy in interface Entity<E extends Entity<E,​I>,​I extends EntityIdentifier>
        Parameters:
        updater - the user who updates this entity.
        updateDate - the date at which the entity is updated.
        Returns:
        itself.
      • getCreatorId

        public String getCreatorId()
        Gets the identifier of the user that has persisted this entity the first time.

        Don't override this method. It cannot be final to be proxied by the JPA implementation in lazy loadings.

        Specified by:
        getCreatorId in interface Entity<E extends Entity<E,​I>,​I extends EntityIdentifier>
        Returns:
        the unique identifier of the creator.
      • createdBy

        public E createdBy​(String creatorId)
        Sets the identifier of the user that has persisted this entity the first time.

        Don't override this method. It cannot be final to be proxied by the JPA implementation in lazy loadings.

        Parameters:
        creatorId - the unique identifier of the user that has created this entity.
        Returns:
        the entity itself.
      • getCreationDate

        public Date getCreationDate()
        Gets the date at which this entity has been persisted into the data store the first time.

        Don't override this method. It cannot be final to be proxied by the JPA implementation in lazy loadings.

        Specified by:
        getCreationDate in interface Entity<E extends Entity<E,​I>,​I extends EntityIdentifier>
        Returns:
        the entity's creation date.
      • setCreationDate

        protected SilverpeasJpaEntity<E,​I> setCreationDate​(Date creationDate)
        Sets the date at which this entity has been persisted the first time.

        Don't override this method. It cannot be final to be proxied by the JPA implementation in lazy loadings.

        Parameters:
        creationDate - the creation date
        Returns:
        the entity itself.
      • setCreator

        protected SilverpeasJpaEntity<E,​I> setCreator​(User creator)
        Sets the user that has created this entity.

        Don't override this method. It cannot be final to be proxied by the JPA implementation in lazy loadings.

        Parameters:
        creator - the user that has created this entity.
        Returns:
        the entity itself.
      • getLastUpdateDate

        public Date getLastUpdateDate()
        Description copied from interface: Entity
        Gets the last date and time of the entity update (in the persistence context). If the entity wasn't yet updated since its inception, then the creation date is returned.
        Specified by:
        getLastUpdateDate in interface Entity<E extends Entity<E,​I>,​I extends EntityIdentifier>
        Returns:
        the last date at which this entity was updated.
      • setLastUpdateDate

        protected SilverpeasJpaEntity<E,​I> setLastUpdateDate​(Date lastUpdateDate)
        Sets the date at which this entity has been updated the last time.

        Don't override this method. It cannot be final to be proxied by the JPA implementation in lazy loadings.

        Parameters:
        lastUpdateDate - the date of the last update.
        Returns:
        the entity itself.
      • setLastUpdater

        protected SilverpeasJpaEntity<E,​I> setLastUpdater​(User updater)
        Sets the user that has updated this entity the last time.

        Don't override this method. It cannot be final to be proxied by the JPA implementation in lazy loadings.

        Parameters:
        updater - the user that has updated this entity.
        Returns:
        the entity itself.
      • getLastUpdaterId

        public String getLastUpdaterId()
        Gets the identifier of the user that has updated this entity the last time.

        Don't override this method. It cannot be final to be proxied by the JPA implementation in lazy loadings.

        Specified by:
        getLastUpdaterId in interface Entity<E extends Entity<E,​I>,​I extends EntityIdentifier>
        Returns:
        the unique identifier of the user that has updated lastly this entity.
      • lastUpdatedBy

        public E lastUpdatedBy​(String lastUpdaterId)
        Sets the identifier of the user that has updated this entity the last time.

        Don't override this method. It cannot be final to be proxied by the JPA implementation in lazy loadings.

        Parameters:
        lastUpdaterId - the unique identifier of the user that has updated this entity.
        Returns:
        the entity itself.
      • getVersion

        public Long getVersion()
        Gets the version of this entity. To be used for optimistic locking in update.

        Don't override this method. It cannot be final to be proxied by the JPA implementation in lazy loadings.

        Specified by:
        getVersion in interface Entity<E extends Entity<E,​I>,​I extends EntityIdentifier>
        Returns:
        the entity version.
      • setVersion

        protected E setVersion​(Long version)
        Sets the version of this entity in the data source.

        Don't override this method. It cannot be final to be proxied by the JPA implementation in lazy loadings.

        Parameters:
        version - the version of the entity.
        Returns:
        the entity itself.
      • markAsModified

        public final void markAsModified()
        Description copied from interface: Entity
        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.
        Specified by:
        markAsModified in interface Entity<E extends Entity<E,​I>,​I extends EntityIdentifier>