org.alfresco.repo.copy
Class CompoundCopyBehaviourCallback

java.lang.Object
  extended by org.alfresco.repo.copy.AbstractCopyBehaviourCallback
      extended by org.alfresco.repo.copy.CompoundCopyBehaviourCallback
All Implemented Interfaces:
CopyBehaviourCallback

public class CompoundCopyBehaviourCallback
extends AbstractCopyBehaviourCallback

Handles compound behavioural callbacks for the same dictionary class (type or aspect).

When multiple policy handlers register callback for the same model class, an instance of this class is used to resolve the calls. The behaviour is sometimes able to resolve conflicts and sometimes not. Look at the individual callback methods to see how conflicts are handled.

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
CompoundCopyBehaviourCallback(org.alfresco.service.namespace.QName classQName)
           
 
Method Summary
 void addBehaviour(CopyBehaviourCallback callback)
           
 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.ChildAssocCopyAction getChildAssociationCopyAction(org.alfresco.service.namespace.QName classQName, CopyDetails copyDetails, CopyBehaviourCallback.CopyChildAssociationDetails childAssocCopyDetails)
          Uses the ChildAssocCopyAction ordering to drive priority i.e.
 CopyBehaviourCallback.ChildAssocRecurseAction getChildAssociationRecurseAction(org.alfresco.service.namespace.QName classQName, CopyDetails copyDetails, CopyBehaviourCallback.CopyChildAssociationDetails childAssocCopyDetails)
          Uses the ChildAssocRecurseAction ordering to drive recursive copy behaviour.
 java.util.Map getCopyProperties(org.alfresco.service.namespace.QName classQName, CopyDetails copyDetails, java.util.Map properties)
          The lowest common denominator applies here.
 boolean getMustCopy(org.alfresco.service.namespace.QName classQName, CopyDetails copyDetails)
          Individual callbacks effectively have a veto on the copy i.e.
 java.lang.String toString()
           
 
Methods inherited from class org.alfresco.repo.copy.AbstractCopyBehaviourCallback
recordNodeRefsForRepointing, repointNodeRefs, throwExceptionForUnexpectedBehaviour
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompoundCopyBehaviourCallback

public CompoundCopyBehaviourCallback(org.alfresco.service.namespace.QName classQName)
Parameters:
classQName - the
Method Detail

addBehaviour

public void addBehaviour(CopyBehaviourCallback callback)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

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
Overrides:
getAssociationCopyAction in class AbstractCopyBehaviourCallback
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

getMustCopy

public boolean getMustCopy(org.alfresco.service.namespace.QName classQName,
                           CopyDetails copyDetails)
Individual callbacks effectively have a veto on the copy i.e. if one of the callbacks returns false for CopyBehaviourCallback#mustCopy(NodeRef), then the copy will NOT proceed. However, a warning is generated indicating that there is a conflict in the defined behaviour.

Parameters:
classQName - the name of the class that this is being invoked for
copyDetails - the source node's copy details for quick reference
Returns:
Returns true if all registered callbacks return true or false if any of the registered callbacks return false.

getChildAssociationCopyAction

public CopyBehaviourCallback.ChildAssocCopyAction getChildAssociationCopyAction(org.alfresco.service.namespace.QName classQName,
                                                                                CopyDetails copyDetails,
                                                                                CopyBehaviourCallback.CopyChildAssociationDetails childAssocCopyDetails)
Uses the ChildAssocCopyAction ordering to drive priority i.e. a vote to copy will override a vote NOT to copy.

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 the most lively choice of action

getChildAssociationRecurseAction

public CopyBehaviourCallback.ChildAssocRecurseAction getChildAssociationRecurseAction(org.alfresco.service.namespace.QName classQName,
                                                                                      CopyDetails copyDetails,
                                                                                      CopyBehaviourCallback.CopyChildAssociationDetails childAssocCopyDetails)
Uses the ChildAssocRecurseAction ordering to drive recursive copy behaviour.

Specified by:
getChildAssociationRecurseAction in interface CopyBehaviourCallback
Overrides:
getChildAssociationRecurseAction in class AbstractCopyBehaviourCallback
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 the most lively choice of action
See Also:
#getChildAssociationCopyAction(QName, CopyDetails, ChildAssociationRef, boolean)

getCopyProperties

public java.util.Map getCopyProperties(org.alfresco.service.namespace.QName classQName,
                                       CopyDetails copyDetails,
                                       java.util.Map properties)
The lowest common denominator applies here. The properties are passed to each callback in turn. The resulting map is then passed to the next callback and so on. If any callback removes or alters properties, these will not be recoverable.

Parameters:
classQName - the name of the class that this is being invoked for
copyDetails - the source node's copy details for quick reference
properties - the type- or aspect-specific properties that can be copied. The map can be manipulated and returned as required.
Returns:
Returns the least properties assigned for the copy by any individual callback handler


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