Class AbstractVersionedEntityObject

    • Constructor Detail

      • AbstractVersionedEntityObject

        public AbstractVersionedEntityObject()
    • Method Detail

      • getVersion

        public int getVersion()
        Description copied from interface: Versioned
        Return the version number of this version of the object. Version numbers are integers in ascending chronological order from 1 (the first version). Clients must not assume if two versions x and y exist, that any integer versions between x and y also exist.
        Specified by:
        getVersion in interface Versioned
        Returns:
        the version number of this version of the object
      • setVersion

        public void setVersion​(int version)
        Description copied from interface: Versioned
        Set the version number of this version of the object. Only call this method if you are creating a new version.
        Specified by:
        setVersion in interface Versioned
        Parameters:
        version - the new version number for this version of the object.
      • isNew

        public boolean isNew()
        Description copied from interface: Versioned
        Is this the first version of this object?
        Specified by:
        isNew in interface Versioned
        Returns:
        true if this is the first version of this versioned object, false if it is a later version.
      • setOriginalVersion

        public void setOriginalVersion​(Versioned originalVersion)
        Description copied from interface: Versioned
        Set the current version of this object. After this method is called, this object will become an historical version of the object passed in.
        Specified by:
        setOriginalVersion in interface Versioned
        Parameters:
        originalVersion - the current version of this object.
      • getLatestVersion

        public Versioned getLatestVersion()
        Description copied from interface: Versioned
        Get the latest, current version of this versioned object. If this object is the current version, return this object.

        Note that drafts are a special version of a ContentEntityObject so for drafts this method should return the ContentEntityObject the drafts points to if it exists and the draft itself otherwise.

        Specified by:
        getLatestVersion in interface Versioned
        Returns:
        the current version of this object.
        See Also:
        ContentEntityObject.DRAFT
      • convertToHistoricalVersion

        public void convertToHistoricalVersion()
        Description copied from interface: Versioned
        Remove all data from the object that does not need to be saved by historical versions. For versioned objects that are persisted, this includes removing associations with other persisted objects that may otherwise cause us to break the expected arity of the database relations.

        When using Hibernate to persist versioned objects, take special care to null any field that might contain a Hibernate-persisted collection, as Hibernate does not allow two different persistent objects to refer to the same persisted collection at the same time.

        Specified by:
        convertToHistoricalVersion in interface Versioned
      • isLatestVersion

        public boolean isLatestVersion()
        Specified by:
        isLatestVersion in interface Versioned
        Returns:
        true if this is the latest (current) version of the object, false if it is an historical version.
      • getConfluenceRevision

        protected String getConfluenceRevision()