Package org.ametys.cms.workflow.purge
Class PurgeVersionsManager
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.cms.workflow.purge.PurgeVersionsManager
-
- All Implemented Interfaces:
Component
,LogEnabled
,Serviceable
public class PurgeVersionsManager extends AbstractLogEnabled implements Component, Serviceable
Component which purges content old versions.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
PurgeVersionsManager.VersionInfo
Version information.
-
Constructor Summary
Constructors Constructor Description PurgeVersionsManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<PurgeVersionsManager.VersionInfo>
getAllVersions(VersionHistory versionHistory)
Get all versions of a version history.int
purgeContent(WorkflowAwareContent content, long validationStepId, int firstVersionsToKeep)
Purge a content.protected int
purgeContent(WorkflowAwareContent content, VersionHistory versionHistory, Version baseVersion, long validationStepId, int firstVersionsToKeep)
Purge a content version history.void
service(ServiceManager manager)
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Constructor Detail
-
PurgeVersionsManager
public PurgeVersionsManager()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
purgeContent
public int purgeContent(WorkflowAwareContent content, long validationStepId, int firstVersionsToKeep)
Purge a content.- Parameters:
content
- the content to purge.validationStepId
- the ID of the validation step for this content.firstVersionsToKeep
- the count of first versions to keep.- Returns:
- the count of removed versions.
-
purgeContent
protected int purgeContent(WorkflowAwareContent content, VersionHistory versionHistory, Version baseVersion, long validationStepId, int firstVersionsToKeep) throws RepositoryException
Purge a content version history.- Parameters:
content
- the content.versionHistory
- the version history to purge.baseVersion
- the content base version, must be kept.validationStepId
- the ID of the validation step for this content.firstVersionsToKeep
- the count of first versions to keep.- Returns:
- the count of removed versions.
- Throws:
RepositoryException
- if an error occurs.
-
getAllVersions
protected List<PurgeVersionsManager.VersionInfo> getAllVersions(VersionHistory versionHistory) throws RepositoryException
Get all versions of a version history.- Parameters:
versionHistory
- the version history to purge.- Returns:
- all the version infos.
- Throws:
RepositoryException
- if an error occurs.
-
-