Package org.alfresco.repo.copy
Class AbstractCopyBehaviourCallback
java.lang.Object
org.alfresco.repo.copy.AbstractCopyBehaviourCallback
- All Implemented Interfaces:
CopyBehaviourCallback
- Direct Known Subclasses:
CompoundCopyBehaviourCallback,DefaultCopyBehaviourCallback,DoNothingCopyBehaviourCallback
Abstract implementation to allow for easier migration if the interface changes.
- Since:
- 3.2
- Author:
- Derek Hulley
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.alfresco.repo.copy.CopyBehaviourCallback
CopyBehaviourCallback.AssocCopySourceAction, CopyBehaviourCallback.AssocCopyTargetAction, CopyBehaviourCallback.ChildAssocCopyAction, CopyBehaviourCallback.ChildAssocRecurseAction, CopyBehaviourCallback.CopyAssociationDetails, CopyBehaviourCallback.CopyChildAssociationDetails -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAssociationCopyAction(QName classQName, CopyDetails copyDetails, CopyBehaviourCallback.CopyAssociationDetails assocCopyDetails) Determine the copy behaviour associated with a given peer association.getChildAssociationRecurseAction(QName classQName, CopyDetails copyDetails, CopyBehaviourCallback.CopyChildAssociationDetails childAssocCopyDetails) Once the child association copy action has been chosen, the policy callback can dictate whether or not to force further recursion.booleanisTopLevelCanBeRenamed(QName classQName, CopyDetails copyDetails) By default it is forbidden for top-level nodes to be renamedvoidrecordNodeRefsForRepointing(NodeRef sourceNodeRef, Map<QName, Serializable> properties, QName propertyQName) Helper method to transactionally recordNodeRefproperties so that they can later be fixed up to point to the relative, after-copy locations.voidrepointNodeRefs(NodeRef sourceNodeRef, NodeRef targetNodeRef, QName propertyQName, Map<NodeRef, NodeRef> copyMap, NodeService nodeService) The second stage of theNodeRefrepointing.protected voidthrowExceptionForUnexpectedBehaviour(CopyDetails copyDetails, String... otherDetails) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.alfresco.repo.copy.CopyBehaviourCallback
getChildAssociationCopyAction, getCopyProperties, getMustCopy
-
Constructor Details
-
AbstractCopyBehaviourCallback
public AbstractCopyBehaviourCallback()
-
-
Method Details
-
getAssociationCopyAction
public Pair<CopyBehaviourCallback.AssocCopySourceAction,CopyBehaviourCallback.AssocCopyTargetAction> getAssociationCopyAction(QName classQName, CopyDetails copyDetails, CopyBehaviourCallback.CopyAssociationDetails assocCopyDetails) Description copied from interface:CopyBehaviourCallbackDetermine the copy behaviour associated with a given peer association.- Specified by:
getAssociationCopyActionin interfaceCopyBehaviourCallback- Parameters:
classQName- the name of the class that this is being invoked forcopyDetails- the source node's copy details for quick referenceassocCopyDetails- all other details relating to the association- Returns:
- Returns
CopyBehaviourCallback.AssocCopySourceAction.COPY_REMOVE_EXISTINGandCopyBehaviourCallback.AssocCopyTargetAction.USE_COPIED_TARGET
-
getChildAssociationRecurseAction
public CopyBehaviourCallback.ChildAssocRecurseAction getChildAssociationRecurseAction(QName classQName, CopyDetails copyDetails, CopyBehaviourCallback.CopyChildAssociationDetails childAssocCopyDetails) Description copied from interface:CopyBehaviourCallbackOnce the child association copy action has been chosen, the policy callback can dictate whether or not to force further recursion. This cannot prevent behaviour further down the hierarchy from stopping the copy.- Specified by:
getChildAssociationRecurseActionin interfaceCopyBehaviourCallback- Parameters:
classQName- the name of the class that this is being invoked forcopyDetails- the source node's copy details for quick referencechildAssocCopyDetails- all other details relating to the child association- Returns:
- Returns ChildAssocRecurseAction.RESPECT_RECURSE_FLAG
- See Also:
-
throwExceptionForUnexpectedBehaviour
protected void throwExceptionForUnexpectedBehaviour(CopyDetails copyDetails, String... otherDetails) - Throws:
IllegalStateException- always
-
recordNodeRefsForRepointing
public void recordNodeRefsForRepointing(NodeRef sourceNodeRef, Map<QName, Serializable> properties, QName propertyQName) Helper method to transactionally recordNodeRefproperties so that they can later be fixed up to point to the relative, after-copy locations.When the copy has been completed, the second stage of the process can be applied.
- Parameters:
sourceNodeRef- the node that is being copiedproperties- the node properties being copiedpropertyQName- the qualified name of the property to check- See Also:
-
repointNodeRefs
public void repointNodeRefs(NodeRef sourceNodeRef, NodeRef targetNodeRef, QName propertyQName, Map<NodeRef, NodeRef> copyMap, NodeService nodeService) The second stage of theNodeRefrepointing. Call this method to have anyNodeRefproperties readjusted to reflect the copied node hierarchy. Only use this method if it a requirement for the particular type or aspect that you are coding for.- Parameters:
sourceNodeRef- the source nodepropertyQName- the target node i.e. the copy of the source nodecopyMap- the full hierarchy copy map of source to copies- See Also:
-
isTopLevelCanBeRenamed
By default it is forbidden for top-level nodes to be renamed- Specified by:
isTopLevelCanBeRenamedin interfaceCopyBehaviourCallback- Parameters:
classQName- the name of the class that this is being invoked forcopyDetails- the source node's copy details for quick reference- Returns:
- true if the top-level node with type or aspect can be renamed during copy.
-