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 java.lang.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
Fields Modifier and Type Field Description static java.lang.StringALIASABLE_ATTRIBUTE_KEY_1The first "key" into the attribute table - identifies that the attribute is for this classstatic java.lang.StringALIASABLE_ATTRIBUTE_KEY_2The second "key" into the attribute table - identifies that the attribute is an alias-
Fields inherited from interface org.alfresco.repo.copy.CopyServicePolicies.OnCopyNodePolicy
ARG_0, ARG_1, QNAME
-
Fields inherited from interface org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy
QNAME
-
Fields inherited from interface org.alfresco.repo.node.NodeServicePolicies.BeforeRemoveAspectPolicy
QNAME
-
Fields inherited from interface org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy
QNAME
-
Fields inherited from interface org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy
ARG_0, ARG_1, ARG_2, QNAME
-
-
Constructor Summary
Constructors Constructor Description AliasableAspect()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAlias(org.alfresco.service.cmr.repository.NodeRef nodeRef, java.lang.String alias)Set the email alias for the specified node.voidbeforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef nodeRef)Called before a node is deleted.voidbeforeRemoveAspect(org.alfresco.service.cmr.repository.NodeRef nodeRef, org.alfresco.service.namespace.QName aspectTypeQName)Called before an aspect is removed from a nodeAttributeServicegetAttributeService()org.alfresco.service.cmr.repository.NodeRefgetByAlias(java.lang.String alias)Get a node ref by its email aliasCopyBehaviourCallbackgetCopyCallback(org.alfresco.service.namespace.QName classRef, CopyDetails copyDetails)Called for all types and aspects before copying a node.voidinit()Spring initilaise method used to register the policy behavioursstatic java.lang.StringnormaliseAlias(java.lang.String value)method to normalise an email alias.voidonAddAspect(org.alfresco.service.cmr.repository.NodeRef nodeRef, org.alfresco.service.namespace.QName aspectTypeQName)Called after an aspect has been added to a nodevoidonUpdateProperties(org.alfresco.service.cmr.repository.NodeRef nodeRef, java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> before, java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> after)Called after a node's properties have been changed.voidremoveAlias(java.lang.String alias)remove the specified aliasvoidsetAttributeService(AttributeService attributeService)voidsetNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)voidsetPolicyComponent(PolicyComponent policyComponent)
-
-
-
Field Detail
-
ALIASABLE_ATTRIBUTE_KEY_1
public static final java.lang.String ALIASABLE_ATTRIBUTE_KEY_1
The first "key" into the attribute table - identifies that the attribute is for this class- See Also:
- Constant Field Values
-
ALIASABLE_ATTRIBUTE_KEY_2
public static final java.lang.String ALIASABLE_ATTRIBUTE_KEY_2
The second "key" into the attribute table - identifies that the attribute is an alias- See Also:
- Constant Field Values
-
-
Method Detail
-
setNodeService
public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
- Parameters:
nodeService- Alfresco Node Service
-
setPolicyComponent
public void setPolicyComponent(PolicyComponent policyComponent)
- Parameters:
policyComponent- Alfresco Policy Component
-
init
public void init()
Spring initilaise method used to register the policy behaviours
-
normaliseAlias
public static java.lang.String normaliseAlias(java.lang.String value)
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
public void addAlias(org.alfresco.service.cmr.repository.NodeRef nodeRef, java.lang.String alias)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
public void removeAlias(java.lang.String alias)
remove the specified alias- Parameters:
alias- to remove
-
getByAlias
public org.alfresco.service.cmr.repository.NodeRef getByAlias(java.lang.String alias)
Get a node ref by its email alias- Returns:
- the node ref, or null if there is no node for that alias
-
onAddAspect
public void onAddAspect(org.alfresco.service.cmr.repository.NodeRef nodeRef, org.alfresco.service.namespace.QName aspectTypeQName)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:
NodeServicePolicies.OnAddAspectPolicy.onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
-
onUpdateProperties
public void onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef nodeRef, java.util.Map<org.alfresco.service.namespace.QName,java.io.Serializable> before, java.util.Map<org.alfresco.service.namespace.QName,java.io.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:
NodeServicePolicies.OnUpdatePropertiesPolicy.onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map)
-
beforeRemoveAspect
public void beforeRemoveAspect(org.alfresco.service.cmr.repository.NodeRef nodeRef, org.alfresco.service.namespace.QName aspectTypeQName)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
public void beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Description copied from interface:NodeServicePolicies.BeforeDeleteNodePolicyCalled before a node is deleted.- Specified by:
beforeDeleteNodein interfaceNodeServicePolicies.BeforeDeleteNodePolicy- Parameters:
nodeRef- the node reference
-
getCopyCallback
public CopyBehaviourCallback getCopyCallback(org.alfresco.service.namespace.QName classRef, CopyDetails copyDetails)
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:
CopyServicePolicies
-
setAttributeService
public void setAttributeService(AttributeService attributeService)
-
getAttributeService
public AttributeService getAttributeService()
-
-