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 Summary
Constructors Modifier Constructor Description protected
AbstractVersion(String versionHandlerId, String componentId)
Create a version to be storedprotected
AbstractVersion(String versionHandlerId, String componentId, String versionNumber, Instant executionInstant, String comment)
Create a version to be storedprotected
AbstractVersion(ActionData actionData)
Create a version from the data of anActionData
and its associated version.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
addAdditionalValue(String key, Object value)
Add a parameter that will be replaced in the script with the valueMap<String,Object>
getAdditionalValues()
Get the map of values to replace in the scriptString
getComment()
Get the comment about this versionString
getComponentId()
Get the component idInstant
getExecutionInstant()
Get the time when the version was createdString
getVersionHandlerId()
Get the version handler ID of this versionString
getVersionNumber()
Get the number of the version (null means that initialization is needed)void
setComment(String comment)
Change the comment of the versionvoid
setExecutionInstant(Instant executionInstant)
Set the execution date of this version (only to be used when creating a new version after cloning an old version)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)String
toString()
Build a readable log for this Version-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.ametys.core.migration.version.Version
copyFromActionData
-
-
-
-
Constructor Detail
-
AbstractVersion
protected AbstractVersion(String versionHandlerId, String componentId)
Create a version to be stored- Parameters:
versionHandlerId
- id of theVersionHandler
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 theVersionHandler
componentId
- id of the componentversionNumber
- version number of the upgrade that created this versionexecutionInstant
- time of the application of this versioncomment
- comment stored about this version
-
AbstractVersion
protected AbstractVersion(ActionData actionData)
Create a version from the data of anActionData
and its associated version.- Parameters:
actionData
- The action data
-
-
Method Detail
-
getVersionHandlerId
public String getVersionHandlerId()
Description copied from interface:Version
Get the version handler ID of this version- Specified by:
getVersionHandlerId
in interfaceVersion
- Returns:
- The version handler ID of this version
-
getComponentId
public String getComponentId()
Description copied from interface:Version
Get the component id- Specified by:
getComponentId
in interfaceVersion
- Returns:
- The component id
-
getVersionNumber
public String getVersionNumber()
Description copied from interface:Version
Get the number of the version (null means that initialization is needed)- Specified by:
getVersionNumber
in interfaceVersion
- Returns:
- The number of the version
-
getExecutionInstant
public Instant getExecutionInstant()
Description copied from interface:Version
Get the time when the version was created- Specified by:
getExecutionInstant
in interfaceVersion
- 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 interfaceVersion
- 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 interfaceVersion
- 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 interfaceVersion
- 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 interfaceVersion
- 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 interfaceVersion
- Parameters:
key
- key to replacevalue
- value that will be inserted- Returns:
- the previous value associated with key, or null if there was no mapping for key.
-
getAdditionalValues
public Map<String,Object> getAdditionalValues()
Description copied from interface:Version
Get the map of values to replace in the script- Specified by:
getAdditionalValues
in interfaceVersion
- Returns:
- the map of keys to replace in the script
-
-