Class Version

java.lang.Object
org.ametys.core.migration.version.Version

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

    • Version

      public Version(MigrationEngine.MigrationComponent component, String componentId, VersionStorage storage, VersionConfiguration configuration, String versionNumber, Instant executionInstant, String comment)
      Create a version to be stored
      Parameters:
      component - the context component
      componentId - id of the component
      storage - the VersionStorage associated with this Version
      configuration - the storage configuration
      versionNumber - version number of the upgrade that created this version
      executionInstant - time of the application of this version
      comment - comment stored about this version
  • Method Details

    • toString

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getComponent

      Get the context component
      Returns:
      The context component
    • getComponentId

      Get the component id
      Returns:
      The component id
    • getStorage

      Get the storage for this version
      Returns:
      the associated storage
    • getStorageConfiguration

      Get the configuration for the associated storage
      Returns:
      the configuration
    • getVersionNumber

      Get the number of the version (null means that initialization is needed)
      Returns:
      The number of the version
    • getExecutionInstant

      Get the time when the version was created
      Returns:
      The time when the version was created
    • getComment

      public String getComment()
      Get the comment about this version
      Returns:
      The comment about this version
    • setVersionNumber

      public void setVersionNumber(String versionNumber)
      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)
      Parameters:
      versionNumber - number to set for this version
    • setExecutionInstant

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

      public void setComment(String comment)
      Change the comment of the version
      Parameters:
      comment - comment to set
    • addAdditionalValue

      public Object addAdditionalValue(String key, Object value)
      Add a parameter that will be used by upgrade actions
      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

      Get the values that will be used by upgrade actions
      Returns:
      the values