Package org.alfresco.repo.copy
Class CompoundCopyBehaviourCallback
java.lang.Object
org.alfresco.repo.copy.AbstractCopyBehaviourCallback
org.alfresco.repo.copy.CompoundCopyBehaviourCallback
- All Implemented Interfaces:
CopyBehaviourCallback
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
- 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 TypeMethodDescriptionvoidaddBehaviour(CopyBehaviourCallback callback) getAssociationCopyAction(QName classQName, CopyDetails copyDetails, CopyBehaviourCallback.CopyAssociationDetails assocCopyDetails) Determine the copy behaviour associated with a given peer association.getChildAssociationCopyAction(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.getChildAssociationRecurseAction(QName classQName, CopyDetails copyDetails, CopyBehaviourCallback.CopyChildAssociationDetails childAssocCopyDetails) Uses the ChildAssocRecurseAction ordering to drive recursive copy behaviour.getCopyProperties(QName classQName, CopyDetails copyDetails, Map<QName, Serializable> properties) The lowest common denominator applies here.booleangetMustCopy(QName classQName, CopyDetails copyDetails) Individual callbacks effectively have a veto on the copy i.e. if one of the callbacks returns false forCopyBehaviourCallback.getMustCopy(org.alfresco.service.namespace.QName, org.alfresco.repo.copy.CopyDetails), then the copy will NOT proceed.toString()Methods inherited from class org.alfresco.repo.copy.AbstractCopyBehaviourCallback
isTopLevelCanBeRenamed, recordNodeRefsForRepointing, repointNodeRefs, throwExceptionForUnexpectedBehaviour
-
Constructor Details
-
CompoundCopyBehaviourCallback
- Parameters:
classQName- the
-
-
Method Details
-
addBehaviour
-
toString
-
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- Overrides:
getAssociationCopyActionin classAbstractCopyBehaviourCallback- 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
-
getMustCopy
Individual callbacks effectively have a veto on the copy i.e. if one of the callbacks returns false forCopyBehaviourCallback.getMustCopy(org.alfresco.service.namespace.QName, org.alfresco.repo.copy.CopyDetails), 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 forcopyDetails- 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(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 forcopyDetails- the source node's copy details for quick referencechildAssocCopyDetails- all other details relating to the child association- Returns:
- Returns the most lively choice of action
-
getChildAssociationRecurseAction
public CopyBehaviourCallback.ChildAssocRecurseAction getChildAssociationRecurseAction(QName classQName, CopyDetails copyDetails, CopyBehaviourCallback.CopyChildAssociationDetails childAssocCopyDetails) Uses the ChildAssocRecurseAction ordering to drive recursive copy behaviour.- Specified by:
getChildAssociationRecurseActionin interfaceCopyBehaviourCallback- Overrides:
getChildAssociationRecurseActionin classAbstractCopyBehaviourCallback- 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 the most lively choice of action
- See Also:
-
getCopyProperties
public Map<QName,Serializable> getCopyProperties(QName classQName, CopyDetails copyDetails, Map<QName, Serializable> 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 forcopyDetails- the source node's copy details for quick referenceproperties- 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
-