Package org.alfresco.email.server
Class AliasableAspect
java.lang.Object
org.alfresco.email.server.AliasableAspect
- All Implemented Interfaces:
CopyServicePolicies.OnCopyNodePolicy,NodeServicePolicies.BeforeDeleteNodePolicy,NodeServicePolicies.BeforeRemoveAspectPolicy,NodeServicePolicies.OnAddAspectPolicy,NodeServicePolicies.OnUpdatePropertiesPolicy,ClassPolicy,Policy
public class AliasableAspect
extends Object
implements NodeServicePolicies.OnAddAspectPolicy, NodeServicePolicies.BeforeRemoveAspectPolicy, NodeServicePolicies.OnUpdatePropertiesPolicy, NodeServicePolicies.BeforeDeleteNodePolicy, CopyServicePolicies.OnCopyNodePolicy
Class that supports functionality of email aliasable aspect.
- Since:
- 2.2
- Author:
- mrogers
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.alfresco.repo.policy.Policy
Policy.Arg -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe first "key" into the attribute table - identifies that the attribute is for this classstatic final StringThe second "key" into the attribute table - identifies that the attribute is an aliasFields inherited from interface org.alfresco.repo.copy.CopyServicePolicies.OnCopyNodePolicy
ARG_0, ARG_1, QNAMEFields inherited from interface org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy
QNAMEFields inherited from interface org.alfresco.repo.node.NodeServicePolicies.BeforeRemoveAspectPolicy
QNAMEFields inherited from interface org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy
QNAMEFields inherited from interface org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy
ARG_0, ARG_1, ARG_2, QNAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidSet the email alias for the specified node.voidbeforeDeleteNode(NodeRef nodeRef) Called before a node is deleted.voidbeforeRemoveAspect(NodeRef nodeRef, QName aspectTypeQName) Called before an aspect is removed from a nodegetByAlias(String alias) Get a node ref by its email aliasgetCopyCallback(QName classRef, CopyDetails copyDetails) Called for all types and aspects before copying a node.voidinit()Spring initilaise method used to register the policy behavioursstatic StringnormaliseAlias(String value) method to normalise an email alias.voidonAddAspect(NodeRef nodeRef, QName aspectTypeQName) Called after an aspect has been added to a nodevoidonUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after) Called after a node's properties have been changed.voidremoveAlias(String alias) remove the specified aliasvoidsetAttributeService(AttributeService attributeService) voidsetNodeService(NodeService nodeService) voidsetPolicyComponent(PolicyComponent policyComponent)
-
Field Details
-
ALIASABLE_ATTRIBUTE_KEY_1
The first "key" into the attribute table - identifies that the attribute is for this class- See Also:
-
ALIASABLE_ATTRIBUTE_KEY_2
The second "key" into the attribute table - identifies that the attribute is an alias- See Also:
-
-
Constructor Details
-
AliasableAspect
public AliasableAspect()
-
-
Method Details
-
setNodeService
- Parameters:
nodeService- Alfresco Node Service
-
setPolicyComponent
- Parameters:
policyComponent- Alfresco Policy Component
-
init
public void init()Spring initilaise method used to register the policy behaviours -
normaliseAlias
method to normalise an email alias. Currently this involves trimmimg and lower casing, but it may change in future- Parameters:
value-- Returns:
- the normalised value.
-
addAlias
Set the email alias for the specified node. If the rule is broken, AlfrescoRuntimeException will be thrown.- Parameters:
nodeRef- Reference to target nodealias- Alias that we want to set to the target node- Throws:
org.alfresco.error.AlfrescoRuntimeException- if the alias property is duplicated by another node.
-
removeAlias
remove the specified alias- Parameters:
alias- to remove
-
getByAlias
Get a node ref by its email alias- Returns:
- the node ref, or null if there is no node for that alias
-
onAddAspect
Description copied from interface:NodeServicePolicies.OnAddAspectPolicyCalled after an aspect has been added to a node- Specified by:
onAddAspectin interfaceNodeServicePolicies.OnAddAspectPolicy- Parameters:
nodeRef- the node to which the aspect was addedaspectTypeQName- the type of the aspect- Throws:
org.alfresco.error.AlfrescoRuntimeException- Throws if the alias property is duplicated.- See Also:
-
onUpdateProperties
public void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after) Description copied from interface:NodeServicePolicies.OnUpdatePropertiesPolicyCalled after a node's properties have been changed.- Specified by:
onUpdatePropertiesin interfaceNodeServicePolicies.OnUpdatePropertiesPolicy- Parameters:
nodeRef- reference to the updated nodebefore- the node's properties before the changeafter- the node's properties after the change- Throws:
org.alfresco.error.AlfrescoRuntimeException- Throws if the alias property is duplicated.- See Also:
-
beforeRemoveAspect
Description copied from interface:NodeServicePolicies.BeforeRemoveAspectPolicyCalled before an aspect is removed from a node- Specified by:
beforeRemoveAspectin interfaceNodeServicePolicies.BeforeRemoveAspectPolicy- Parameters:
nodeRef- the node from which the aspect will be removedaspectTypeQName- the type of the aspect
-
beforeDeleteNode
Description copied from interface:NodeServicePolicies.BeforeDeleteNodePolicyCalled before a node is deleted.- Specified by:
beforeDeleteNodein interfaceNodeServicePolicies.BeforeDeleteNodePolicy- Parameters:
nodeRef- the node reference
-
getCopyCallback
Description copied from interface:CopyServicePolicies.OnCopyNodePolicyCalled for all types and aspects before copying a node.- Specified by:
getCopyCallbackin interfaceCopyServicePolicies.OnCopyNodePolicy- Parameters:
classRef- the type or aspect qualified namecopyDetails- the details of the impending copy- Returns:
- Return the callback that will be used to modify the copy behaviour for this dictionary class. Return null to assume the default.
- See Also:
-
setAttributeService
-
getAttributeService
-