Package fr.becpg.repo.admin
Class BeCPGTrashcanCleaner
java.lang.Object
org.alfresco.trashcan.TrashcanCleaner
fr.becpg.repo.admin.BeCPGTrashcanCleaner
public class BeCPGTrashcanCleaner
extends org.alfresco.trashcan.TrashcanCleaner
This class is capable of cleaning the trashcan without depending on searches
over the archive store. So the corresponding index core could be deactivated
with no impact on its execution. It will
clean() the trashcan according
to defined deleteBatchCount and keepPeriod properties.
deleteBatchCount: It will set how many nodes in trashcan to delete at
maximum during clean() execution. By default the value is 1000.
keepPeriod: The time period (in Duration format) for which documents in
trashcan are kept. Any nodes archived less than the value specified won't be deleted during clean() execution.
- Author:
- Rui Fernandes, sglover
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate final intprivate final Durationprivate static final org.apache.commons.logging.Logprivate org.alfresco.repo.node.archive.NodeArchiveServiceprivate final org.alfresco.service.cmr.repository.NodeServiceprivate final org.alfresco.service.transaction.TransactionServiceprivate List<org.alfresco.service.cmr.repository.NodeRef> -
Constructor Summary
ConstructorsConstructorDescriptionBeCPGTrashcanCleaner(org.alfresco.service.cmr.repository.NodeService nodeService, org.alfresco.service.transaction.TransactionService transactionService, int deleteBatchCount, String keepPeriod, org.alfresco.repo.node.archive.NodeArchiveService nodeArchiveService) Constructor for BeCPGTrashcanCleaner. -
Method Summary
Modifier and TypeMethodDescriptionvoidclean()The method that will clean the specified archiveStoreUrl to the limits defined by the values set for deleteBatchCount and keepPeriod.private intdeleteNodes(List<org.alfresco.service.cmr.repository.NodeRef> nodes) It deletes theListofNodeRefreceived as argument.private List<org.alfresco.service.cmr.repository.NodeRef>It returns theListofNodeRefof the archive store set to be deleted according to configuration for deleteBatchCount and keepPeriod.longIt returns the number of nodes present on trashcan.private List<org.alfresco.service.cmr.repository.ChildAssociationRef>It will return the firstdeleteBatchCountChildAssociationRefs of typeContentModel.ASSOC_CHILDREN from the archive store set.private booleanolderThanDaysToKeep(org.alfresco.service.cmr.repository.NodeRef node) It checks if the archived node has been archived since longer than keepPeriod.
-
Field Details
-
logger
private static final org.apache.commons.logging.Log logger -
nodeService
private final org.alfresco.service.cmr.repository.NodeService nodeService -
transactionService
private final org.alfresco.service.transaction.TransactionService transactionService -
archiveStoreUrl
- See Also:
-
deleteBatchCount
private final int deleteBatchCount -
keepPeriod
-
trashcanNodes
-
nodeArchiveService
private org.alfresco.repo.node.archive.NodeArchiveService nodeArchiveService
-
-
Constructor Details
-
BeCPGTrashcanCleaner
public BeCPGTrashcanCleaner(org.alfresco.service.cmr.repository.NodeService nodeService, org.alfresco.service.transaction.TransactionService transactionService, int deleteBatchCount, String keepPeriod, org.alfresco.repo.node.archive.NodeArchiveService nodeArchiveService) Constructor for BeCPGTrashcanCleaner.
- Parameters:
nodeService- aNodeServiceobjecttransactionService- aTransactionServiceobjectdeleteBatchCount- a intkeepPeriod- aStringobjectnodeArchiveService- aNodeArchiveServiceobject
-
-
Method Details
-
deleteNodes
It deletes theListofNodeRefreceived as argument.- Parameters:
nodes- return The number of deleted nodes
-
getBatchToDelete
It returns theListofNodeRefof the archive store set to be deleted according to configuration for deleteBatchCount and keepPeriod.- Returns:
-
getTrashcanChildAssocs
It will return the firstdeleteBatchCountChildAssociationRefs of typeContentModel.ASSOC_CHILDREN from the archive store set.- Returns:
-
olderThanDaysToKeep
private boolean olderThanDaysToKeep(org.alfresco.service.cmr.repository.NodeRef node) It checks if the archived node has been archived since longer than keepPeriod. If keepPeriod is 0 or negative it will return always true.- Parameters:
node-- Returns:
-
getNumberOfNodesInTrashcan
public long getNumberOfNodesInTrashcan()It returns the number of nodes present on trashcan.- Overrides:
getNumberOfNodesInTrashcanin classorg.alfresco.trashcan.TrashcanCleaner- Returns:
- a long
-
clean
public void clean()The method that will clean the specified archiveStoreUrl to the limits defined by the values set for deleteBatchCount and keepPeriod.- Overrides:
cleanin classorg.alfresco.trashcan.TrashcanCleaner
-