Class AbstractVersion

java.lang.Object
org.ametys.core.migration.version.AbstractVersion
All Implemented Interfaces:
Version
Direct Known Subclasses:
JcrDataVersion, SqlVersion

public abstract class AbstractVersion extends Object implements Version
Representation of a version Each upgrade create a new version
  • Constructor Details

    • AbstractVersion

      protected AbstractVersion(String versionHandlerId, String componentId)
      Create a version to be stored
      Parameters:
      versionHandlerId - id of the VersionHandler
      componentId - id of the component
    • AbstractVersion

      protected AbstractVersion(String versionHandlerId, String componentId, String versionNumber, Instant executionInstant, String comment)
      Create a version to be stored
      Parameters:
      versionHandlerId - id of the VersionHandler
      componentId - id of the component
      versionNumber - version number of the upgrade that created this version
      executionInstant - time of the application of this version
      comment - comment stored about this version
    • AbstractVersion

      protected AbstractVersion(ActionData actionData)
      Create a version from the data of an ActionData and its associated version.
      Parameters:
      actionData - The action data
  • Method Details

    • toString

      public String toString()
      Build a readable log for this Version
      Overrides:
      toString in class Object
      Returns:
      a readable log
    • getVersionHandlerId

      Description copied from interface: Version
      Get the version handler ID of this version
      Specified by:
      getVersionHandlerId in interface Version
      Returns:
      The version handler ID of this version
    • getComponentId

      Description copied from interface: Version
      Get the component id
      Specified by:
      getComponentId in interface Version
      Returns:
      The component id
    • getVersionNumber

      Description copied from interface: Version
      Get the number of the version (null means that initialization is needed)
      Specified by:
      getVersionNumber in interface Version
      Returns:
      The number of the version
    • getExecutionInstant

      Description copied from interface: Version
      Get the time when the version was created
      Specified by:
      getExecutionInstant in interface Version
      Returns:
      The time when the version was created
    • getComment

      public String getComment()
      Description copied from interface: Version
      Get the comment about this version
      Specified by:
      getComment in interface Version
      Returns:
      The comment about this version
    • setVersionNumber

      public void setVersionNumber(String versionNumber)
      Description copied from interface: Version
      Set the number of the version Should only be used in initialization actions, so the version contains the version to reach, not the version to start (which should be null in the case of initialization)
      Specified by:
      setVersionNumber in interface Version
      Parameters:
      versionNumber - number to set for this version
    • setExecutionInstant

      public void setExecutionInstant(Instant executionInstant)
      Description copied from interface: Version
      Set the execution date of this version (only to be used when creating a new version after cloning an old version)
      Specified by:
      setExecutionInstant in interface Version
      Parameters:
      executionInstant - instant to set
    • setComment

      public void setComment(String comment)
      Description copied from interface: Version
      Change the comment of the version
      Specified by:
      setComment in interface Version
      Parameters:
      comment - comment to set
    • addAdditionalValue

      public Object addAdditionalValue(String key, Object value)
      Description copied from interface: Version
      Add a parameter that will be replaced in the script with the value
      Specified by:
      addAdditionalValue in interface Version
      Parameters:
      key - key to replace
      value - value that will be inserted
      Returns:
      the previous value associated with key, or null if there was no mapping for key.
    • getAdditionalValues

      Description copied from interface: Version
      Get the map of values to replace in the script
      Specified by:
      getAdditionalValues in interface Version
      Returns:
      the map of keys to replace in the script