Class JcrDataVersionStorage
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.repository.migration.jcr.data.JcrDataVersionStorage
-
- All Implemented Interfaces:
VersionStorage
,LogEnabled
,Serviceable
public class JcrDataVersionStorage extends AbstractLogEnabled implements VersionStorage, Serviceable
JCR implementation ofVersionStorage
, to manage the list of versions in a repository
-
-
Field Summary
Fields Modifier and Type Field Description protected MigrationExtensionPoint
_migrationEP
The migration extension pointprotected AmetysObjectResolver
_resolver
The Ametys object resolverprotected VersionsRootHelper
_versionsRootHelper
The versions root helper
-
Constructor Summary
Constructors Constructor Description JcrDataVersionStorage()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private VersionComponentAmetysObject
_createComponentObject(String componentId)
private VersionComponentAmetysObject
_getComponentObject(String componentId, boolean create)
private Optional<Version>
_getCurrentVersion(String versionHandlerId, String componentId)
void
addVersion(Version version)
Add a versionList<Version>
getAllVersions(String componentIdentifier, VersionConfiguration configuration, String versionHandlerId)
Get the history of all versions for a component identifierVersionConfiguration
getConfiguration(String componentId, Configuration versionConfiguration)
Create a specific object containing usefull data for the handler/storageVersion
getCurrentVersion(String componentIdentifier, VersionConfiguration configuration, String versionHandlerId)
Find the current version for a component identifiervoid
removeAllVersions(String componentIdentifier, VersionConfiguration configuration)
Remove all versions for a component identifiervoid
service(ServiceManager manager)
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_resolver
protected AmetysObjectResolver _resolver
The Ametys object resolver
-
_migrationEP
protected MigrationExtensionPoint _migrationEP
The migration extension point
-
_versionsRootHelper
protected VersionsRootHelper _versionsRootHelper
The versions root helper
-
-
Constructor Detail
-
JcrDataVersionStorage
public JcrDataVersionStorage()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getCurrentVersion
public Version getCurrentVersion(String componentIdentifier, VersionConfiguration configuration, String versionHandlerId) throws MigrationException
Description copied from interface:VersionStorage
Find the current version for a component identifier- Specified by:
getCurrentVersion
in interfaceVersionStorage
- Parameters:
componentIdentifier
- component to look forconfiguration
- configuration to useversionHandlerId
- id of theVersionHandler
- Returns:
- the current version for this component (can have a versionId null if no version is found), or null if it is impossible to determine the version (e.g. safe mode).
- Throws:
MigrationException
- Something went wrongNotMigrableInSafeModeException
- Impossible to determine the version
-
getAllVersions
public List<Version> getAllVersions(String componentIdentifier, VersionConfiguration configuration, String versionHandlerId) throws MigrationException
Description copied from interface:VersionStorage
Get the history of all versions for a component identifier- Specified by:
getAllVersions
in interfaceVersionStorage
- Parameters:
componentIdentifier
- component to look forconfiguration
- configuration to useversionHandlerId
- id of theVersionHandler
- Returns:
- list of all versions for this component
- Throws:
MigrationException
- Something went wrongNotMigrableInSafeModeException
- Impossible to determine the version
-
addVersion
public void addVersion(Version version) throws MigrationException
Description copied from interface:VersionStorage
Add a version- Specified by:
addVersion
in interfaceVersionStorage
- Parameters:
version
- Version to store (contains the component identifier)- Throws:
MigrationException
- Something went wrong
-
removeAllVersions
public void removeAllVersions(String componentIdentifier, VersionConfiguration configuration) throws MigrationException
Description copied from interface:VersionStorage
Remove all versions for a component identifier- Specified by:
removeAllVersions
in interfaceVersionStorage
- Parameters:
componentIdentifier
- component to clearconfiguration
- configuration to use- Throws:
MigrationException
- Something went wrong
-
_getCurrentVersion
private Optional<Version> _getCurrentVersion(String versionHandlerId, String componentId)
-
_getComponentObject
private VersionComponentAmetysObject _getComponentObject(String componentId, boolean create)
-
_createComponentObject
private VersionComponentAmetysObject _createComponentObject(String componentId)
-
getConfiguration
public VersionConfiguration getConfiguration(String componentId, Configuration versionConfiguration) throws ConfigurationException
Description copied from interface:VersionStorage
Create a specific object containing usefull data for the handler/storage- Specified by:
getConfiguration
in interfaceVersionStorage
- Parameters:
componentId
- id of the componentversionConfiguration
- configuration from the plugin.xml- Returns:
- the confuguration object
- Throws:
ConfigurationException
- something wrong in the configuration
-
-