Package org.alfresco.repo.node.archive
Class NodeArchiveServiceImpl
- java.lang.Object
-
- org.alfresco.repo.node.archive.NodeArchiveServiceImpl
-
- All Implemented Interfaces:
NodeArchiveService
public class NodeArchiveServiceImpl extends java.lang.Object implements NodeArchiveService
Implementation of the node archive abstraction.- Author:
- Derek Hulley, Jamal Kaabi-Mofrad
-
-
Field Summary
Fields Modifier and Type Field Description protected org.alfresco.service.cmr.repository.NodeServicenodeService-
Fields inherited from interface org.alfresco.repo.node.archive.NodeArchiveService
QNAME_ARCHIVED_ITEM
-
-
Constructor Summary
Constructors Constructor Description NodeArchiveServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.alfresco.service.cmr.repository.NodeRefgetArchivedNode(org.alfresco.service.cmr.repository.NodeRef originalNodeRef)Get the likely node reference for the original node.org.alfresco.service.cmr.repository.NodeRefgetStoreArchiveNode(org.alfresco.service.cmr.repository.StoreRef originalStoreRef)Get the parent node that holds all nodes archived from the given store.protected java.util.Set<org.alfresco.service.namespace.QName>getTypeAndAspectQNames(org.alfresco.service.cmr.repository.NodeRef nodeRef)Get all aspect and node type qualified namesprotected booleanhasAdminAccess(java.lang.String userID)booleanhasFullAccess(org.alfresco.service.cmr.repository.NodeRef nodeRef)Check if the current user has authority to access the archived node.voidinit()protected voidinvokeBeforePurgeNode(org.alfresco.service.cmr.repository.NodeRef nodeRef)protected voidinvokeBeforeRestoreArchivedNode(org.alfresco.service.cmr.repository.NodeRef nodeRef)protected voidinvokeOnRestoreArchivedNode(org.alfresco.service.cmr.repository.NodeRef nodeRef)org.alfresco.query.PagingResults<org.alfresco.service.cmr.repository.NodeRef>listArchivedNodes(ArchivedNodesCannedQueryBuilder cannedQueryBuilder)Get the archived nodes deleted by the current user.voidpurgeAllArchivedNodes(org.alfresco.service.cmr.repository.StoreRef originalStoreRef)Uses batch processing and job locking to purge all archived nodesvoidpurgeArchivedNode(org.alfresco.service.cmr.repository.NodeRef archivedNodeRef)This is the primary purge methd that all purge methods fall back on.voidpurgeArchivedNodes(java.util.List<org.alfresco.service.cmr.repository.NodeRef> archivedNodes)Permanently delete the archived nodes.RestoreNodeReportrestoreArchivedNode(org.alfresco.service.cmr.repository.NodeRef archivedNodeRef)Attempt to restore the given archived node into its original location.RestoreNodeReportrestoreArchivedNode(org.alfresco.service.cmr.repository.NodeRef archivedNodeRef, org.alfresco.service.cmr.repository.NodeRef destinationNodeRef, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName)This is the primary restore method that allrestoremethods fall back on.java.util.List<RestoreNodeReport>restoreArchivedNodes(java.util.List<org.alfresco.service.cmr.repository.NodeRef> archivedNodeRefs)Attempt to restore a list of archived nodes into their original locations, using the original association types and names.java.util.List<RestoreNodeReport>restoreArchivedNodes(java.util.List<org.alfresco.service.cmr.repository.NodeRef> archivedNodeRefs, org.alfresco.service.cmr.repository.NodeRef destinationNodeRef, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName)Attempt to restore a list of archived nodes into a new location.voidsetAuthorityService(AuthorityService authorityService)voidsetCannedQueryRegistry(org.alfresco.util.registry.NamedObjectRegistry<org.alfresco.query.CannedQueryFactory<ArchivedNodeEntity>> cannedQueryRegistry)voidsetJobLockService(JobLockService jobLockService)voidsetNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)voidsetPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService)voidsetPolicyComponent(PolicyComponent policyComponent)voidsetTenantService(org.alfresco.repo.tenant.TenantService tenantService)voidsetTransactionService(TransactionService transactionService)voidsetUserNamesAreCaseSensitive(boolean userNamesAreCaseSensitive)
-
-
-
Method Detail
-
setPolicyComponent
public void setPolicyComponent(PolicyComponent policyComponent)
-
setNodeService
public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
-
setPermissionService
public void setPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService)
-
setTransactionService
public void setTransactionService(TransactionService transactionService)
-
getStoreArchiveNode
public org.alfresco.service.cmr.repository.NodeRef getStoreArchiveNode(org.alfresco.service.cmr.repository.StoreRef originalStoreRef)
Description copied from interface:NodeArchiveServiceGet the parent node that holds all nodes archived from the given store.- Specified by:
getStoreArchiveNodein interfaceNodeArchiveService- Parameters:
originalStoreRef- the original store of the archived nodes. This is the store where the currently archived nodes could originally be found.- Returns:
- Returns the parent of the archived nodes, or null if archiving is not configured for the store
-
setJobLockService
public void setJobLockService(JobLockService jobLockService)
-
init
public void init()
-
setAuthorityService
public void setAuthorityService(AuthorityService authorityService)
-
setCannedQueryRegistry
public void setCannedQueryRegistry(org.alfresco.util.registry.NamedObjectRegistry<org.alfresco.query.CannedQueryFactory<ArchivedNodeEntity>> cannedQueryRegistry)
-
setTenantService
public void setTenantService(org.alfresco.repo.tenant.TenantService tenantService)
-
setUserNamesAreCaseSensitive
public void setUserNamesAreCaseSensitive(boolean userNamesAreCaseSensitive)
-
getArchivedNode
public org.alfresco.service.cmr.repository.NodeRef getArchivedNode(org.alfresco.service.cmr.repository.NodeRef originalNodeRef)
Description copied from interface:NodeArchiveServiceGet the likely node reference for the original node. There is no guarantee that the node exists in the archive store.- Specified by:
getArchivedNodein interfaceNodeArchiveService- Parameters:
originalNodeRef- the original node reference- Returns:
- Returns the node ref of the node if it was archived.
-
restoreArchivedNode
public RestoreNodeReport restoreArchivedNode(org.alfresco.service.cmr.repository.NodeRef archivedNodeRef, org.alfresco.service.cmr.repository.NodeRef destinationNodeRef, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName)
This is the primary restore method that allrestoremethods fall back on. It executes the restore for the node in a separate transaction and attempts to catch the known conditions that can be reported back to the client.- Specified by:
restoreArchivedNodein interfaceNodeArchiveService- Parameters:
archivedNodeRef- the node's reference in the archive. This must be valid.destinationNodeRef- the parent of the restored node, or null to use the original parent node referenceassocTypeQName- the type of the primary association to link the restored node to the destination parent, or null to use the orginal association typeassocQName- the name of the primary association to be created, or null to use the original association name- Returns:
- Returns the results of the restore operation
-
restoreArchivedNode
public RestoreNodeReport restoreArchivedNode(org.alfresco.service.cmr.repository.NodeRef archivedNodeRef)
Description copied from interface:NodeArchiveServiceAttempt to restore the given archived node into its original location.TRANSACTIONS: This method will execute in a new transaction.
- Specified by:
restoreArchivedNodein interfaceNodeArchiveService- Parameters:
archivedNodeRef- the node's reference in the archive- Returns:
- Returns the results of the restore operation
- See Also:
restoreArchivedNode(NodeRef, NodeRef, QName, QName)
-
restoreArchivedNodes
public java.util.List<RestoreNodeReport> restoreArchivedNodes(java.util.List<org.alfresco.service.cmr.repository.NodeRef> archivedNodeRefs)
Description copied from interface:NodeArchiveServiceAttempt to restore a list of archived nodes into their original locations, using the original association types and names.TRANSACTIONS: This method will execute in a new transaction.
- Specified by:
restoreArchivedNodesin interfaceNodeArchiveService- Parameters:
archivedNodeRefs- the nodes' references in the archive. These must be valid.- Returns:
- Returns the results of the each attempted restore operation
- See Also:
restoreArchivedNodes(List, NodeRef, QName, QName)
-
restoreArchivedNodes
public java.util.List<RestoreNodeReport> restoreArchivedNodes(java.util.List<org.alfresco.service.cmr.repository.NodeRef> archivedNodeRefs, org.alfresco.service.cmr.repository.NodeRef destinationNodeRef, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName)
Description copied from interface:NodeArchiveServiceAttempt to restore a list of archived nodes into a new location.TRANSACTIONS: This method will execute in a new transaction.
- Specified by:
restoreArchivedNodesin interfaceNodeArchiveService- Parameters:
archivedNodeRefs- the nodes' references in the archive. These must be valid.destinationNodeRef- the parent of the restored nodes, or null to use the original parent node referencesassocTypeQName- the type of the primary associations to link the restored node to the destination parent, or null to use the orginal association typesassocQName- the name of the primary associations to be created, or null to use the original association names- Returns:
- Returns the results of the each attempted restore operation
- See Also:
restoreArchivedNode(NodeRef, NodeRef, QName, QName)
-
invokeBeforeRestoreArchivedNode
protected void invokeBeforeRestoreArchivedNode(org.alfresco.service.cmr.repository.NodeRef nodeRef)
-
invokeOnRestoreArchivedNode
protected void invokeOnRestoreArchivedNode(org.alfresco.service.cmr.repository.NodeRef nodeRef)
-
purgeArchivedNode
public void purgeArchivedNode(org.alfresco.service.cmr.repository.NodeRef archivedNodeRef)
This is the primary purge methd that all purge methods fall back on. It isolates the delete work in a new transaction.- Specified by:
purgeArchivedNodein interfaceNodeArchiveService- Parameters:
archivedNodeRef- the archived node to delete.- See Also:
NodeService.deleteNode(NodeRef)
-
purgeArchivedNodes
public void purgeArchivedNodes(java.util.List<org.alfresco.service.cmr.repository.NodeRef> archivedNodes)
Description copied from interface:NodeArchiveServicePermanently delete the archived nodes.- Specified by:
purgeArchivedNodesin interfaceNodeArchiveService- Parameters:
archivedNodes- the archived nodes to delete.- See Also:
purgeArchivedNode(NodeRef)
-
purgeAllArchivedNodes
public void purgeAllArchivedNodes(org.alfresco.service.cmr.repository.StoreRef originalStoreRef)
Uses batch processing and job locking to purge all archived nodes- Specified by:
purgeAllArchivedNodesin interfaceNodeArchiveService- Parameters:
originalStoreRef- the store that the items originally came from
-
listArchivedNodes
public org.alfresco.query.PagingResults<org.alfresco.service.cmr.repository.NodeRef> listArchivedNodes(ArchivedNodesCannedQueryBuilder cannedQueryBuilder)
Get the archived nodes deleted by the current user. If the current user is an Administrator, then all the deleted nodes are fetched.- Specified by:
listArchivedNodesin interfaceNodeArchiveService- Parameters:
cannedQueryBuilder- the object that holds the required and optional parameters to perform the canned query- Returns:
- the results of the attempted search
-
hasFullAccess
public boolean hasFullAccess(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Check if the current user has authority to access the archived node.- Specified by:
hasFullAccessin interfaceNodeArchiveService- Parameters:
nodeRef- NodeRef- Returns:
- true if the currently authenticated user has authority to access the archived node, otherwise false.
-
hasAdminAccess
protected boolean hasAdminAccess(java.lang.String userID)
-
invokeBeforePurgeNode
protected void invokeBeforePurgeNode(org.alfresco.service.cmr.repository.NodeRef nodeRef)
-
getTypeAndAspectQNames
protected java.util.Set<org.alfresco.service.namespace.QName> getTypeAndAspectQNames(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Get all aspect and node type qualified names- Parameters:
nodeRef- the node we are interested in- Returns:
- Returns a set of qualified names containing the node type and all the node aspects, or null if the node no longer exists
-
-