org.alfresco.repo.copy
Class AbstractCopyBehaviourCallback

java.lang.Object
  extended by org.alfresco.repo.copy.AbstractCopyBehaviourCallback
All Implemented Interfaces:
CopyBehaviourCallback
Direct Known Subclasses:
CompoundCopyBehaviourCallback, DefaultCopyBehaviourCallback, DoNothingCopyBehaviourCallback

public abstract class AbstractCopyBehaviourCallback
extends java.lang.Object
implements CopyBehaviourCallback

Abstract implementation to allow for easier migration if the interface changes.

Since:
3.2

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
AbstractCopyBehaviourCallback()
           
 
Method Summary
 org.alfresco.util.Pair getAssociationCopyAction(org.alfresco.service.namespace.QName classQName, CopyDetails copyDetails, CopyBehaviourCallback.CopyAssociationDetails assocCopyDetails)
          Determine the copy behaviour associated with a given peer association.
 CopyBehaviourCallback.ChildAssocRecurseAction getChildAssociationRecurseAction(org.alfresco.service.namespace.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.
 void recordNodeRefsForRepointing(org.alfresco.service.cmr.repository.NodeRef sourceNodeRef, java.util.Map properties, org.alfresco.service.namespace.QName propertyQName)
          Helper method to transactionally record NodeRef properties so that they can later be fixed up to point to the relative, after-copy locations.
 void repointNodeRefs(org.alfresco.service.cmr.repository.NodeRef sourceNodeRef, org.alfresco.service.cmr.repository.NodeRef targetNodeRef, org.alfresco.service.namespace.QName propertyQName, java.util.Map copyMap, org.alfresco.service.cmr.repository.NodeService nodeService)
          The second stage of the NodeRef repointing.
protected  void throwExceptionForUnexpectedBehaviour(CopyDetails copyDetails, java.lang.String[] otherDetails)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.alfresco.repo.copy.CopyBehaviourCallback
getChildAssociationCopyAction, getCopyProperties, getMustCopy
 

Constructor Detail

AbstractCopyBehaviourCallback

public AbstractCopyBehaviourCallback()
Method Detail

getAssociationCopyAction

public org.alfresco.util.Pair getAssociationCopyAction(org.alfresco.service.namespace.QName classQName,
                                                       CopyDetails copyDetails,
                                                       CopyBehaviourCallback.CopyAssociationDetails assocCopyDetails)
Description copied from interface: CopyBehaviourCallback
Determine the copy behaviour associated with a given peer association.

Specified by:
getAssociationCopyAction in interface CopyBehaviourCallback
Parameters:
classQName - the name of the class that this is being invoked for
copyDetails - the source node's copy details for quick reference
assocCopyDetails - all other details relating to the association
Returns:
Returns CopyBehaviourCallback.AssocCopySourceAction.COPY_REMOVE_EXISTING and CopyBehaviourCallback.AssocCopyTargetAction.USE_COPIED_TARGET

getChildAssociationRecurseAction

public CopyBehaviourCallback.ChildAssocRecurseAction getChildAssociationRecurseAction(org.alfresco.service.namespace.QName classQName,
                                                                                      CopyDetails copyDetails,
                                                                                      CopyBehaviourCallback.CopyChildAssociationDetails childAssocCopyDetails)
Description copied from interface: CopyBehaviourCallback
Once 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:
getChildAssociationRecurseAction in interface CopyBehaviourCallback
Parameters:
classQName - the name of the class that this is being invoked for
copyDetails - the source node's copy details for quick reference
childAssocCopyDetails - all other details relating to the child association
Returns:
Returns ChildAssocRecurseAction#RESPECT_RECURSE_FLAG
See Also:
#getChildAssociationCopyAction(QName, CopyDetails, ChildAssociationRef, boolean)

throwExceptionForUnexpectedBehaviour

protected void throwExceptionForUnexpectedBehaviour(CopyDetails copyDetails,
                                                    java.lang.String[] otherDetails)
Throws:
java.lang.IllegalStateException - always

recordNodeRefsForRepointing

public void recordNodeRefsForRepointing(org.alfresco.service.cmr.repository.NodeRef sourceNodeRef,
                                        java.util.Map properties,
                                        org.alfresco.service.namespace.QName propertyQName)
Helper method to transactionally record NodeRef properties 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 copied
properties - the node properties being copied
propertyQName - the qualified name of the property to check
See Also:
#repointNodeRefs(NodeRef, QName, Map, NodeService)

repointNodeRefs

public void repointNodeRefs(org.alfresco.service.cmr.repository.NodeRef sourceNodeRef,
                            org.alfresco.service.cmr.repository.NodeRef targetNodeRef,
                            org.alfresco.service.namespace.QName propertyQName,
                            java.util.Map copyMap,
                            org.alfresco.service.cmr.repository.NodeService nodeService)
The second stage of the NodeRef repointing. Call this method to have any NodeRef properties 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 node
propertyQName - the target node i.e. the copy of the source node
copyMap - the full hierarchy copy map of source to copies
See Also:
AbstractCopyBehaviourCallback.recordNodeRefsForRepointing(NodeRef, Map, QName)


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.