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
-
-
Field Summary
Fields Modifier and Type Field Description private Map<String,Object>_additionalValuesprivate String_commentprivate String_componentIdprivate Instant_executionInstantprivate String_versionHandlerIdprivate String_versionNumber
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractVersion(String versionHandlerId, String componentId)Create a version to be storedprotectedAbstractVersion(String versionHandlerId, String componentId, String versionNumber, Instant executionInstant, String comment)Create a version to be storedprotectedAbstractVersion(ActionData actionData)Create a version from the data of anActionDataand its associated version.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectaddAdditionalValue(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 scriptStringgetComment()Get the comment about this versionStringgetComponentId()Get the component idInstantgetExecutionInstant()Get the time when the version was createdStringgetVersionHandlerId()Get the version handler ID of this versionStringgetVersionNumber()Get the number of the version (null means that initialization is needed)voidsetComment(String comment)Change the comment of the versionvoidsetExecutionInstant(Instant executionInstant)Set the execution date of this version (only to be used when creating a new version after cloning an old version)voidsetVersionNumber(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)StringtoString()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
-
-
-
-
Field Detail
-
_versionHandlerId
private String _versionHandlerId
-
_componentId
private String _componentId
-
_versionNumber
private String _versionNumber
-
_executionInstant
private Instant _executionInstant
-
_additionalValues
private Map<String,Object> _additionalValues
-
-
Constructor Detail
-
AbstractVersion
protected AbstractVersion(String versionHandlerId, String componentId)
Create a version to be stored- Parameters:
versionHandlerId- id of theVersionHandlercomponentId- 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 theVersionHandlercomponentId- 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 anActionDataand its associated version.- Parameters:
actionData- The action data
-
-
Method Detail
-
getVersionHandlerId
public String getVersionHandlerId()
Description copied from interface:VersionGet the version handler ID of this version- Specified by:
getVersionHandlerIdin interfaceVersion- Returns:
- The version handler ID of this version
-
getComponentId
public String getComponentId()
Description copied from interface:VersionGet the component id- Specified by:
getComponentIdin interfaceVersion- Returns:
- The component id
-
getVersionNumber
public String getVersionNumber()
Description copied from interface:VersionGet the number of the version (null means that initialization is needed)- Specified by:
getVersionNumberin interfaceVersion- Returns:
- The number of the version
-
getExecutionInstant
public Instant getExecutionInstant()
Description copied from interface:VersionGet the time when the version was created- Specified by:
getExecutionInstantin interfaceVersion- Returns:
- The time when the version was created
-
getComment
public String getComment()
Description copied from interface:VersionGet the comment about this version- Specified by:
getCommentin interfaceVersion- Returns:
- The comment about this version
-
setVersionNumber
public void setVersionNumber(String versionNumber)
Description copied from interface:VersionSet 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:
setVersionNumberin interfaceVersion- Parameters:
versionNumber- number to set for this version
-
setExecutionInstant
public void setExecutionInstant(Instant executionInstant)
Description copied from interface:VersionSet the execution date of this version (only to be used when creating a new version after cloning an old version)- Specified by:
setExecutionInstantin interfaceVersion- Parameters:
executionInstant- instant to set
-
setComment
public void setComment(String comment)
Description copied from interface:VersionChange the comment of the version- Specified by:
setCommentin interfaceVersion- Parameters:
comment- comment to set
-
addAdditionalValue
public Object addAdditionalValue(String key, Object value)
Description copied from interface:VersionAdd a parameter that will be replaced in the script with the value- Specified by:
addAdditionalValuein 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:VersionGet the map of values to replace in the script- Specified by:
getAdditionalValuesin interfaceVersion- Returns:
- the map of keys to replace in the script
-
-