mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-1098: Refactor RM behaviours
* added BehaviourRegister interface and provided access to behaviour objects when named git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@58608 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -11,8 +11,8 @@
|
|||||||
<property name="namespaceService" ref="NamespaceService" />
|
<property name="namespaceService" ref="NamespaceService" />
|
||||||
<property name="dictionaryService" ref="DictionaryService" />
|
<property name="dictionaryService" ref="DictionaryService" />
|
||||||
<property name="nodeService" ref="NodeService" />
|
<property name="nodeService" ref="NodeService" />
|
||||||
<property name="policyComponent" ref="policyComponent" />
|
|
||||||
<property name="dispositionService" ref="dispositionService" />
|
<property name="dispositionService" ref="dispositionService" />
|
||||||
|
<property name="behaviourFilter" ref="policyBehaviourFilter" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="disposition.properties.cutoffdate" parent="disposition.properties.base">
|
<bean id="disposition.properties.cutoffdate" parent="disposition.properties.base">
|
||||||
|
@@ -100,6 +100,7 @@
|
|||||||
<bean id="rma.record" class="org.alfresco.module.org_alfresco_module_rm.model.rma.aspect.RecordAspect" parent="rm.baseBehaviour">
|
<bean id="rma.record" class="org.alfresco.module.org_alfresco_module_rm.model.rma.aspect.RecordAspect" parent="rm.baseBehaviour">
|
||||||
<property name="scriptService" ref="ScriptService" />
|
<property name="scriptService" ref="ScriptService" />
|
||||||
<property name="extendedSecurityService" ref="ExtendedSecurityService" />
|
<property name="extendedSecurityService" ref="ExtendedSecurityService" />
|
||||||
|
<property name="recordService" ref="RecordService" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="rma.recordComponentIdentifier" class="org.alfresco.module.org_alfresco_module_rm.model.rma.aspect.RecordComponentIdentifierAspect" parent="rm.baseBehaviour">
|
<bean id="rma.recordComponentIdentifier" class="org.alfresco.module.org_alfresco_module_rm.model.rma.aspect.RecordComponentIdentifierAspect" parent="rm.baseBehaviour">
|
||||||
|
@@ -1196,6 +1196,7 @@
|
|||||||
<property name="vitalRecordService" ref="VitalRecordService" />
|
<property name="vitalRecordService" ref="VitalRecordService" />
|
||||||
<property name="filePlanRoleService" ref="FilePlanRoleService" />
|
<property name="filePlanRoleService" ref="FilePlanRoleService" />
|
||||||
<property name="permissionService" ref="permissionService" />
|
<property name="permissionService" ref="permissionService" />
|
||||||
|
<property name="recordAspect" ref="rma.record" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="RecordService" class="org.springframework.aop.framework.ProxyFactoryBean">
|
<bean id="RecordService" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||||
|
@@ -1,5 +1,20 @@
|
|||||||
/**
|
/*
|
||||||
*
|
* Copyright (C) 2005-2013 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.alfresco.module.org_alfresco_module_rm.disposition.property;
|
package org.alfresco.module.org_alfresco_module_rm.disposition.property;
|
||||||
|
|
||||||
@@ -12,48 +27,38 @@ import org.alfresco.error.AlfrescoRuntimeException;
|
|||||||
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction;
|
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition;
|
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService;
|
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean;
|
||||||
import org.alfresco.repo.node.NodeServicePolicies;
|
import org.alfresco.repo.node.NodeServicePolicies;
|
||||||
import org.alfresco.repo.policy.JavaBehaviour;
|
|
||||||
import org.alfresco.repo.policy.PolicyComponent;
|
|
||||||
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
|
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
|
||||||
|
import org.alfresco.repo.policy.annotation.Behaviour;
|
||||||
|
import org.alfresco.repo.policy.annotation.BehaviourBean;
|
||||||
|
import org.alfresco.repo.policy.annotation.BehaviourKind;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
|
||||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
|
||||||
import org.alfresco.service.cmr.repository.Period;
|
import org.alfresco.service.cmr.repository.Period;
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Disposition property implementation bean.
|
||||||
|
*
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
*/
|
*/
|
||||||
public class DispositionProperty implements NodeServicePolicies.OnUpdatePropertiesPolicy,
|
@BehaviourBean
|
||||||
RecordsManagementModel
|
public class DispositionProperty extends BaseBehaviourBean
|
||||||
|
implements NodeServicePolicies.OnUpdatePropertiesPolicy
|
||||||
{
|
{
|
||||||
/** Property QName */
|
/** Property QName */
|
||||||
private QName propertyName;
|
private QName propertyName;
|
||||||
|
|
||||||
/** Behaviour */
|
|
||||||
private JavaBehaviour behaviour;
|
|
||||||
|
|
||||||
/** Namespace service */
|
/** Namespace service */
|
||||||
private NamespaceService namespaceService;
|
private NamespaceService namespaceService;
|
||||||
|
|
||||||
/** Disposition service */
|
/** Disposition service */
|
||||||
private DispositionService dispositionService;
|
private DispositionService dispositionService;
|
||||||
|
|
||||||
/** Policy component */
|
|
||||||
private PolicyComponent policyComponent;
|
|
||||||
|
|
||||||
/** Dictionary service */
|
|
||||||
private DictionaryService dictionaryService;
|
|
||||||
|
|
||||||
/** Node service */
|
|
||||||
private NodeService nodeService;
|
|
||||||
|
|
||||||
/** Indicates whether this disposition property applies to a folder level disposition */
|
/** Indicates whether this disposition property applies to a folder level disposition */
|
||||||
private boolean appliesToFolderLevel = true;
|
private boolean appliesToFolderLevel = true;
|
||||||
|
|
||||||
@@ -79,30 +84,6 @@ public class DispositionProperty implements NodeServicePolicies.OnUpdateProperti
|
|||||||
this.dispositionService = dispositionService;
|
this.dispositionService = dispositionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param policyComponent policy component
|
|
||||||
*/
|
|
||||||
public void setPolicyComponent(PolicyComponent policyComponent)
|
|
||||||
{
|
|
||||||
this.policyComponent = policyComponent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param dictionaryService dictionary service
|
|
||||||
*/
|
|
||||||
public void setDictionaryService(DictionaryService dictionaryService)
|
|
||||||
{
|
|
||||||
this.dictionaryService = dictionaryService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param nodeService node service
|
|
||||||
*/
|
|
||||||
public void setNodeService(NodeService nodeService)
|
|
||||||
{
|
|
||||||
this.nodeService = nodeService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param propertyName property name (as string)
|
* @param propertyName property name (as string)
|
||||||
*/
|
*/
|
||||||
@@ -157,14 +138,7 @@ public class DispositionProperty implements NodeServicePolicies.OnUpdateProperti
|
|||||||
public void init()
|
public void init()
|
||||||
{
|
{
|
||||||
// register with disposition service
|
// register with disposition service
|
||||||
dispositionService.registerDispositionProperty(this);
|
dispositionService.registerDispositionProperty(this);
|
||||||
|
|
||||||
// register interest in the update properties policy for disposition
|
|
||||||
behaviour = new JavaBehaviour(this, "onUpdateProperties", NotificationFrequency.TRANSACTION_COMMIT);
|
|
||||||
policyComponent.bindClassBehaviour(
|
|
||||||
NodeServicePolicies.OnUpdatePropertiesPolicy.QNAME,
|
|
||||||
ASPECT_DISPOSITION_LIFECYCLE,
|
|
||||||
behaviour);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -201,6 +175,12 @@ public class DispositionProperty implements NodeServicePolicies.OnUpdateProperti
|
|||||||
* @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map)
|
* @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Behaviour
|
||||||
|
(
|
||||||
|
kind = BehaviourKind.CLASS,
|
||||||
|
type = "rma:dispositionLifecycle",
|
||||||
|
notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT
|
||||||
|
)
|
||||||
public void onUpdateProperties(
|
public void onUpdateProperties(
|
||||||
final NodeRef nodeRef,
|
final NodeRef nodeRef,
|
||||||
final Map<QName, Serializable> before,
|
final Map<QName, Serializable> before,
|
||||||
@@ -210,57 +190,49 @@ public class DispositionProperty implements NodeServicePolicies.OnUpdateProperti
|
|||||||
{
|
{
|
||||||
// has the property we care about changed?
|
// has the property we care about changed?
|
||||||
if (isPropertyUpdated(before, after) == true)
|
if (isPropertyUpdated(before, after) == true)
|
||||||
{
|
{
|
||||||
behaviour.disable();
|
AuthenticationUtil.runAs(new RunAsWork<Void>()
|
||||||
try
|
{
|
||||||
{
|
@Override
|
||||||
AuthenticationUtil.runAs(new RunAsWork<Void>()
|
public Void doWork() throws Exception
|
||||||
{
|
{
|
||||||
@Override
|
Date updatedDateValue = (Date)after.get(propertyName);
|
||||||
public Void doWork() throws Exception
|
if (updatedDateValue != null)
|
||||||
{
|
{
|
||||||
Date updatedDateValue = (Date)after.get(propertyName);
|
DispositionAction dispositionAction = dispositionService.getNextDispositionAction(nodeRef);
|
||||||
if (updatedDateValue != null)
|
if (dispositionAction != null)
|
||||||
{
|
{
|
||||||
DispositionAction dispositionAction = dispositionService.getNextDispositionAction(nodeRef);
|
DispositionActionDefinition daDefinition = dispositionAction.getDispositionActionDefinition();
|
||||||
if (dispositionAction != null)
|
if (daDefinition != null)
|
||||||
{
|
{
|
||||||
DispositionActionDefinition daDefinition = dispositionAction.getDispositionActionDefinition();
|
// check whether the next disposition action matches this disposition property
|
||||||
if (daDefinition != null)
|
if (propertyName.equals(daDefinition.getPeriodProperty()) == true)
|
||||||
{
|
{
|
||||||
// check whether the next disposition action matches this disposition property
|
Period period = daDefinition.getPeriod();
|
||||||
if (propertyName.equals(daDefinition.getPeriodProperty()) == true)
|
Date updatedAsOf = period.getNextDate(updatedDateValue);
|
||||||
{
|
|
||||||
Period period = daDefinition.getPeriod();
|
// update asOf date on the disposition action based on the new property value
|
||||||
Date updatedAsOf = period.getNextDate(updatedDateValue);
|
NodeRef daNodeRef = dispositionAction.getNodeRef();
|
||||||
|
nodeService.setProperty(daNodeRef, PROP_DISPOSITION_AS_OF, updatedAsOf);
|
||||||
// update asOf date on the disposition action based on the new property value
|
|
||||||
NodeRef daNodeRef = dispositionAction.getNodeRef();
|
|
||||||
nodeService.setProperty(daNodeRef, PROP_DISPOSITION_AS_OF, updatedAsOf);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// throw an exception if the property is being 'cleared'
|
||||||
|
if (before.get(propertyName) != null)
|
||||||
{
|
{
|
||||||
// throw an exception if the property is being 'cleared'
|
throw new AlfrescoRuntimeException(
|
||||||
if (before.get(propertyName) != null)
|
"Error updating property " + propertyName.toPrefixString(namespaceService) +
|
||||||
{
|
" to null, because property is being used to determine a disposition date.");
|
||||||
throw new AlfrescoRuntimeException(
|
|
||||||
"Error updating property " + propertyName.toPrefixString(namespaceService) +
|
|
||||||
" to null, because property is being used to determine a disposition date.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}, AuthenticationUtil.getSystemUserName());
|
return null;
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
}, AuthenticationUtil.getSystemUserName());
|
||||||
behaviour.enable();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -3,7 +3,12 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.module.org_alfresco_module_rm.model;
|
package org.alfresco.module.org_alfresco_module_rm.model;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.repo.policy.BehaviourFilter;
|
import org.alfresco.repo.policy.BehaviourFilter;
|
||||||
|
import org.alfresco.repo.policy.annotation.BehaviourRegistry;
|
||||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
@@ -18,7 +23,8 @@ import org.apache.commons.logging.LogFactory;
|
|||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
* @since 2.2
|
* @since 2.2
|
||||||
*/
|
*/
|
||||||
public abstract class BaseBehaviourBean implements RecordsManagementModel
|
public abstract class BaseBehaviourBean implements RecordsManagementModel,
|
||||||
|
BehaviourRegistry
|
||||||
{
|
{
|
||||||
/** Logger */
|
/** Logger */
|
||||||
protected static Log logger = LogFactory.getLog(BaseBehaviourBean.class);
|
protected static Log logger = LogFactory.getLog(BaseBehaviourBean.class);
|
||||||
@@ -32,6 +38,9 @@ public abstract class BaseBehaviourBean implements RecordsManagementModel
|
|||||||
/** behaviour filter */
|
/** behaviour filter */
|
||||||
protected BehaviourFilter behaviourFilter;
|
protected BehaviourFilter behaviourFilter;
|
||||||
|
|
||||||
|
/** behaviour map */
|
||||||
|
protected Map<String, org.alfresco.repo.policy.Behaviour> behaviours = new HashMap<String, org.alfresco.repo.policy.Behaviour>(7);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param nodeService node service
|
* @param nodeService node service
|
||||||
*/
|
*/
|
||||||
@@ -76,4 +85,27 @@ public abstract class BaseBehaviourBean implements RecordsManagementModel
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.repo.policy.annotation.BehaviourRegistry#registerBehaviour(java.lang.String, org.alfresco.repo.policy.Behaviour)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void registerBehaviour(String name, org.alfresco.repo.policy.Behaviour behaviour)
|
||||||
|
{
|
||||||
|
if (behaviours.containsKey(name) == true)
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException("Can not register behaviour, because name " + name + "has already been used.");
|
||||||
|
}
|
||||||
|
|
||||||
|
behaviours.put(name, behaviour);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.repo.policy.annotation.BehaviourRegistry#getBehaviour(java.lang.String)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public org.alfresco.repo.policy.Behaviour getBehaviour(String name)
|
||||||
|
{
|
||||||
|
return behaviours.get(name);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect;
|
package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -28,6 +29,8 @@ import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies;
|
|||||||
import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean;
|
import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel;
|
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RecordsManagementSearchBehaviour;
|
import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RecordsManagementSearchBehaviour;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.model.security.ModelAccessDeniedException;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService;
|
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService;
|
||||||
import org.alfresco.repo.copy.CopyBehaviourCallback;
|
import org.alfresco.repo.copy.CopyBehaviourCallback;
|
||||||
import org.alfresco.repo.copy.CopyDetails;
|
import org.alfresco.repo.copy.CopyDetails;
|
||||||
@@ -43,6 +46,7 @@ import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
|||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.ScriptService;
|
import org.alfresco.service.cmr.repository.ScriptService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
|
import org.alfresco.util.EqualsHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* rma:record behaviour bean
|
* rma:record behaviour bean
|
||||||
@@ -58,7 +62,8 @@ public class RecordAspect extends BaseBehaviourBean
|
|||||||
implements NodeServicePolicies.OnCreateChildAssociationPolicy,
|
implements NodeServicePolicies.OnCreateChildAssociationPolicy,
|
||||||
RecordsManagementPolicies.OnCreateReference,
|
RecordsManagementPolicies.OnCreateReference,
|
||||||
RecordsManagementPolicies.OnRemoveReference,
|
RecordsManagementPolicies.OnRemoveReference,
|
||||||
NodeServicePolicies.OnMoveNodePolicy
|
NodeServicePolicies.OnMoveNodePolicy,
|
||||||
|
NodeServicePolicies.OnUpdatePropertiesPolicy
|
||||||
{
|
{
|
||||||
/** Well-known location of the scripts folder. */
|
/** Well-known location of the scripts folder. */
|
||||||
// TODO make configurable
|
// TODO make configurable
|
||||||
@@ -70,6 +75,9 @@ public class RecordAspect extends BaseBehaviourBean
|
|||||||
/** script service */
|
/** script service */
|
||||||
protected ScriptService scriptService;
|
protected ScriptService scriptService;
|
||||||
|
|
||||||
|
/** record service */
|
||||||
|
protected RecordService recordService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param extendedSecurityService extended security service
|
* @param extendedSecurityService extended security service
|
||||||
*/
|
*/
|
||||||
@@ -86,6 +94,14 @@ public class RecordAspect extends BaseBehaviourBean
|
|||||||
this.scriptService = scriptService;
|
this.scriptService = scriptService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param recordService record service
|
||||||
|
*/
|
||||||
|
public void setRecordService(RecordService recordService)
|
||||||
|
{
|
||||||
|
this.recordService = recordService;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Behaviour to ensure renditions have the appropriate extended security.
|
* Behaviour to ensure renditions have the appropriate extended security.
|
||||||
*
|
*
|
||||||
@@ -236,6 +252,66 @@ public class RecordAspect extends BaseBehaviourBean
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensure that the user only updates record properties that they have permission to.
|
||||||
|
*
|
||||||
|
* @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Behaviour
|
||||||
|
(
|
||||||
|
name = "onUpdateProperties",
|
||||||
|
kind = BehaviourKind.CLASS
|
||||||
|
)
|
||||||
|
public void onUpdateProperties(final NodeRef nodeRef, final Map<QName, Serializable> before, final Map<QName, Serializable> after)
|
||||||
|
{
|
||||||
|
if (AuthenticationUtil.getFullyAuthenticatedUser() != null &&
|
||||||
|
AuthenticationUtil.isRunAsUserTheSystemUser() == false &&
|
||||||
|
nodeService.exists(nodeRef) == true)
|
||||||
|
{
|
||||||
|
if (recordService.isRecord(nodeRef) == true)
|
||||||
|
{
|
||||||
|
for (QName property : after.keySet())
|
||||||
|
{
|
||||||
|
Serializable beforeValue = null;
|
||||||
|
if (before != null)
|
||||||
|
{
|
||||||
|
beforeValue = before.get(property);
|
||||||
|
}
|
||||||
|
|
||||||
|
Serializable afterValue = null;
|
||||||
|
if (after != null)
|
||||||
|
{
|
||||||
|
afterValue = after.get(property);
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean propertyUnchanged = false;
|
||||||
|
if (beforeValue != null && afterValue != null &&
|
||||||
|
beforeValue instanceof Date && afterValue instanceof Date)
|
||||||
|
{
|
||||||
|
// deal with date values
|
||||||
|
propertyUnchanged = (((Date)beforeValue).compareTo((Date)afterValue) == 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// otherwise
|
||||||
|
propertyUnchanged = EqualsHelper.nullSafeEquals(beforeValue, afterValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (propertyUnchanged == false &&
|
||||||
|
recordService.isPropertyEditable(nodeRef, property) == false)
|
||||||
|
{
|
||||||
|
// the user can't edit the record property
|
||||||
|
throw new ModelAccessDeniedException(
|
||||||
|
"The user " + AuthenticationUtil.getFullyAuthenticatedUser() +
|
||||||
|
" does not have the permission to edit the record property " + property.toString() +
|
||||||
|
" on the node " + nodeRef.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes a reference script if present
|
* Executes a reference script if present
|
||||||
*
|
*
|
||||||
|
@@ -41,7 +41,7 @@ import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
|
|||||||
import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService;
|
import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel;
|
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.model.security.ModelAccessDeniedException;
|
import org.alfresco.module.org_alfresco_module_rm.model.rma.aspect.RecordAspect;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.notification.RecordsManagementNotificationHelper;
|
import org.alfresco.module.org_alfresco_module_rm.notification.RecordsManagementNotificationHelper;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService;
|
import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
|
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
|
||||||
@@ -52,6 +52,9 @@ import org.alfresco.repo.node.NodeServicePolicies;
|
|||||||
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
|
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
|
||||||
import org.alfresco.repo.policy.JavaBehaviour;
|
import org.alfresco.repo.policy.JavaBehaviour;
|
||||||
import org.alfresco.repo.policy.PolicyComponent;
|
import org.alfresco.repo.policy.PolicyComponent;
|
||||||
|
import org.alfresco.repo.policy.annotation.Behaviour;
|
||||||
|
import org.alfresco.repo.policy.annotation.BehaviourBean;
|
||||||
|
import org.alfresco.repo.policy.annotation.BehaviourKind;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||||
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
||||||
@@ -79,7 +82,6 @@ import org.alfresco.service.cmr.security.PermissionService;
|
|||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||||
import org.alfresco.util.EqualsHelper;
|
|
||||||
import org.alfresco.util.ParameterCheck;
|
import org.alfresco.util.ParameterCheck;
|
||||||
import org.apache.commons.lang.ArrayUtils;
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
@@ -93,11 +95,11 @@ import org.springframework.extensions.surf.util.I18NUtil;
|
|||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
* @since 2.1
|
* @since 2.1
|
||||||
*/
|
*/
|
||||||
|
@BehaviourBean
|
||||||
public class RecordServiceImpl implements RecordService,
|
public class RecordServiceImpl implements RecordService,
|
||||||
RecordsManagementModel,
|
RecordsManagementModel,
|
||||||
RecordsManagementCustomModel,
|
RecordsManagementCustomModel,
|
||||||
NodeServicePolicies.OnCreateChildAssociationPolicy,
|
NodeServicePolicies.OnCreateChildAssociationPolicy,
|
||||||
NodeServicePolicies.OnUpdatePropertiesPolicy,
|
|
||||||
NodeServicePolicies.OnAddAspectPolicy,
|
NodeServicePolicies.OnAddAspectPolicy,
|
||||||
NodeServicePolicies.OnRemoveAspectPolicy
|
NodeServicePolicies.OnRemoveAspectPolicy
|
||||||
{
|
{
|
||||||
@@ -194,6 +196,9 @@ public class RecordServiceImpl implements RecordService,
|
|||||||
|
|
||||||
/** Permission service */
|
/** Permission service */
|
||||||
private PermissionService permissionService;
|
private PermissionService permissionService;
|
||||||
|
|
||||||
|
/** Record aspect */
|
||||||
|
private RecordAspect recordAspect;
|
||||||
|
|
||||||
/** List of available record meta-data aspects */
|
/** List of available record meta-data aspects */
|
||||||
private Set<QName> recordMetaDataAspects;
|
private Set<QName> recordMetaDataAspects;
|
||||||
@@ -203,10 +208,6 @@ public class RecordServiceImpl implements RecordService,
|
|||||||
this,
|
this,
|
||||||
"onCreateChildAssociation",
|
"onCreateChildAssociation",
|
||||||
NotificationFrequency.FIRST_EVENT);
|
NotificationFrequency.FIRST_EVENT);
|
||||||
private JavaBehaviour onUpdateProperties = new JavaBehaviour(
|
|
||||||
this,
|
|
||||||
"onUpdateProperties",
|
|
||||||
NotificationFrequency.EVERY_EVENT);
|
|
||||||
private JavaBehaviour onDeleteDeclaredRecordLink = new JavaBehaviour(
|
private JavaBehaviour onDeleteDeclaredRecordLink = new JavaBehaviour(
|
||||||
this,
|
this,
|
||||||
"onDeleteDeclaredRecordLink",
|
"onDeleteDeclaredRecordLink",
|
||||||
@@ -347,6 +348,14 @@ public class RecordServiceImpl implements RecordService,
|
|||||||
{
|
{
|
||||||
this.permissionService = permissionService;
|
this.permissionService = permissionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param recordAspect record aspect
|
||||||
|
*/
|
||||||
|
public void setRecordAspect(RecordAspect recordAspect)
|
||||||
|
{
|
||||||
|
this.recordAspect = recordAspect;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init method
|
* Init method
|
||||||
@@ -358,31 +367,23 @@ public class RecordServiceImpl implements RecordService,
|
|||||||
TYPE_RECORD_FOLDER,
|
TYPE_RECORD_FOLDER,
|
||||||
ContentModel.ASSOC_CONTAINS,
|
ContentModel.ASSOC_CONTAINS,
|
||||||
onCreateChildAssociation);
|
onCreateChildAssociation);
|
||||||
policyComponent.bindClassBehaviour(
|
|
||||||
NodeServicePolicies.OnUpdatePropertiesPolicy.QNAME,
|
|
||||||
ASPECT_RECORD,
|
|
||||||
onUpdateProperties);
|
|
||||||
policyComponent.bindAssociationBehaviour(
|
policyComponent.bindAssociationBehaviour(
|
||||||
NodeServicePolicies.BeforeDeleteChildAssociationPolicy.QNAME,
|
NodeServicePolicies.BeforeDeleteChildAssociationPolicy.QNAME,
|
||||||
ContentModel.TYPE_FOLDER,
|
ContentModel.TYPE_FOLDER,
|
||||||
ContentModel.ASSOC_CONTAINS,
|
ContentModel.ASSOC_CONTAINS,
|
||||||
onDeleteDeclaredRecordLink);
|
onDeleteDeclaredRecordLink);
|
||||||
|
|
||||||
// Handle the special case when we are dealing with new records that are being added via a file protocol
|
|
||||||
policyComponent.bindClassBehaviour(
|
|
||||||
NodeServicePolicies.OnAddAspectPolicy.QNAME,
|
|
||||||
ContentModel.ASPECT_NO_CONTENT,
|
|
||||||
new JavaBehaviour(this, "onAddAspect", NotificationFrequency.EVERY_EVENT));
|
|
||||||
policyComponent.bindClassBehaviour(
|
|
||||||
NodeServicePolicies.OnRemoveAspectPolicy.QNAME,
|
|
||||||
ContentModel.ASPECT_NO_CONTENT,
|
|
||||||
new JavaBehaviour(this, "onRemoveAspect", NotificationFrequency.EVERY_EVENT));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.repo.node.NodeServicePolicies.OnRemoveAspectPolicy#onRemoveAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
|
* @see org.alfresco.repo.node.NodeServicePolicies.OnRemoveAspectPolicy#onRemoveAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Behaviour
|
||||||
|
(
|
||||||
|
kind = BehaviourKind.CLASS,
|
||||||
|
type = "sys:noContent"
|
||||||
|
)
|
||||||
public void onRemoveAspect(NodeRef nodeRef, QName aspect)
|
public void onRemoveAspect(NodeRef nodeRef, QName aspect)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -411,6 +412,11 @@ public class RecordServiceImpl implements RecordService,
|
|||||||
* @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
|
* @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Behaviour
|
||||||
|
(
|
||||||
|
kind = BehaviourKind.CLASS,
|
||||||
|
type = "sys:noContent"
|
||||||
|
)
|
||||||
public void onAddAspect(NodeRef nodeRef, QName aspect)
|
public void onAddAspect(NodeRef nodeRef, QName aspect)
|
||||||
{
|
{
|
||||||
switchNames(nodeRef);
|
switchNames(nodeRef);
|
||||||
@@ -509,69 +515,6 @@ public class RecordServiceImpl implements RecordService,
|
|||||||
}, AuthenticationUtil.getSystemUserName());
|
}, AuthenticationUtil.getSystemUserName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Ensure that the user only updates record properties that they have permission to.
|
|
||||||
*
|
|
||||||
* @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void onUpdateProperties(final NodeRef nodeRef, final Map<QName, Serializable> before, final Map<QName, Serializable> after)
|
|
||||||
{
|
|
||||||
onUpdateProperties.disable();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (AuthenticationUtil.getFullyAuthenticatedUser() != null &&
|
|
||||||
AuthenticationUtil.isRunAsUserTheSystemUser() == false &&
|
|
||||||
nodeService.exists(nodeRef) == true)
|
|
||||||
{
|
|
||||||
if (isRecord(nodeRef) == true)
|
|
||||||
{
|
|
||||||
for (QName property : after.keySet())
|
|
||||||
{
|
|
||||||
Serializable beforeValue = null;
|
|
||||||
if (before != null)
|
|
||||||
{
|
|
||||||
beforeValue = before.get(property);
|
|
||||||
}
|
|
||||||
|
|
||||||
Serializable afterValue = null;
|
|
||||||
if (after != null)
|
|
||||||
{
|
|
||||||
afterValue = after.get(property);
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean propertyUnchanged = false;
|
|
||||||
if (beforeValue != null && afterValue != null &&
|
|
||||||
beforeValue instanceof Date && afterValue instanceof Date)
|
|
||||||
{
|
|
||||||
// deal with date values
|
|
||||||
propertyUnchanged = (((Date)beforeValue).compareTo((Date)afterValue) == 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// otherwise
|
|
||||||
propertyUnchanged = EqualsHelper.nullSafeEquals(beforeValue, afterValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (propertyUnchanged == false &&
|
|
||||||
isPropertyEditable(nodeRef, property) == false)
|
|
||||||
{
|
|
||||||
// the user can't edit the record property
|
|
||||||
throw new ModelAccessDeniedException(
|
|
||||||
"The user " + AuthenticationUtil.getFullyAuthenticatedUser() +
|
|
||||||
" does not have the permission to edit the record property " + property.toString() +
|
|
||||||
" on the node " + nodeRef.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
onUpdateProperties.enable();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Looking specifically at linked content that was declared a record from a non-rm site.
|
* Looking specifically at linked content that was declared a record from a non-rm site.
|
||||||
* When the site or the folder that the link was declared in is deleted we need to remove
|
* When the site or the folder that the link was declared in is deleted we need to remove
|
||||||
@@ -599,7 +542,7 @@ public class RecordServiceImpl implements RecordService,
|
|||||||
@Override
|
@Override
|
||||||
public void disablePropertyEditableCheck()
|
public void disablePropertyEditableCheck()
|
||||||
{
|
{
|
||||||
onUpdateProperties.disable();
|
recordAspect.getBehaviour("onUpdateProperties").disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -608,7 +551,7 @@ public class RecordServiceImpl implements RecordService,
|
|||||||
@Override
|
@Override
|
||||||
public void enablePropertyEditableCheck()
|
public void enablePropertyEditableCheck()
|
||||||
{
|
{
|
||||||
onUpdateProperties.enable();
|
recordAspect.getBehaviour("onUpdateProperties").enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -88,9 +88,10 @@ public class AnnotatedBehaviourPostProcessor implements BeanPostProcessor
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Register behaviours.
|
||||||
*
|
*
|
||||||
* @param bean
|
* @param bean bean
|
||||||
* @param beanName
|
* @param beanName bean name
|
||||||
*/
|
*/
|
||||||
private void registerBehaviours(Object bean, String beanName)
|
private void registerBehaviours(Object bean, String beanName)
|
||||||
{
|
{
|
||||||
@@ -115,11 +116,12 @@ public class AnnotatedBehaviourPostProcessor implements BeanPostProcessor
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Register behaviour.
|
||||||
*
|
*
|
||||||
* @param behaviourBean
|
* @param behaviourBean behaviour bean annotation
|
||||||
* @param bean
|
* @param bean bean
|
||||||
* @param beanName
|
* @param beanName bean name
|
||||||
* @param method
|
* @param method method
|
||||||
*/
|
*/
|
||||||
private void registerBehaviour(BehaviourBean behaviourBean, Object bean, String beanName, Method method)
|
private void registerBehaviour(BehaviourBean behaviourBean, Object bean, String beanName, Method method)
|
||||||
{
|
{
|
||||||
@@ -138,13 +140,13 @@ public class AnnotatedBehaviourPostProcessor implements BeanPostProcessor
|
|||||||
{
|
{
|
||||||
if (behaviour.isService() == false)
|
if (behaviour.isService() == false)
|
||||||
{
|
{
|
||||||
logger.debug(" ... registering " + behaviour.kind() + " behaviour for " + beanName + "." + method.getName() +
|
logger.debug(" ... binding " + behaviour.kind() + " behaviour for " + beanName + "." + method.getName() +
|
||||||
" for policy " + policy.toString() +
|
" for policy " + policy.toString() +
|
||||||
" and type " + type.toString());
|
" and type " + type.toString());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
logger.debug(" ... registering " + behaviour.kind() + " service behaviour for " + beanName + "." + method.getName() +
|
logger.debug(" ... binding " + behaviour.kind() + " service behaviour for " + beanName + "." + method.getName() +
|
||||||
" for policy " + policy.toString());
|
" for policy " + policy.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -152,6 +154,17 @@ public class AnnotatedBehaviourPostProcessor implements BeanPostProcessor
|
|||||||
// create java behaviour object
|
// create java behaviour object
|
||||||
JavaBehaviour javaBehaviour = new JavaBehaviour(bean, method.getName(), behaviour.notificationFrequency());
|
JavaBehaviour javaBehaviour = new JavaBehaviour(bean, method.getName(), behaviour.notificationFrequency());
|
||||||
|
|
||||||
|
// determine whether we should register the behaviour
|
||||||
|
if (bean instanceof BehaviourRegistry && behaviour.name().isEmpty() == false)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled() == true)
|
||||||
|
{
|
||||||
|
logger.debug(" ... adding behaviour to registry with name " + behaviour.name());
|
||||||
|
}
|
||||||
|
|
||||||
|
((BehaviourRegistry)bean).registerBehaviour(behaviour.name(), javaBehaviour);
|
||||||
|
}
|
||||||
|
|
||||||
// deal with class behaviours
|
// deal with class behaviours
|
||||||
if (BehaviourKind.CLASS.equals(behaviour.kind()) == true)
|
if (BehaviourKind.CLASS.equals(behaviour.kind()) == true)
|
||||||
{
|
{
|
||||||
|
@@ -34,6 +34,9 @@ import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
|
|||||||
@Retention(value = RetentionPolicy.RUNTIME)
|
@Retention(value = RetentionPolicy.RUNTIME)
|
||||||
public @interface Behaviour
|
public @interface Behaviour
|
||||||
{
|
{
|
||||||
|
/** lookup name of the behaviour, if none specified behaviour is not recorded in the registry */
|
||||||
|
String name() default "";
|
||||||
|
|
||||||
/** kind of behaviour */
|
/** kind of behaviour */
|
||||||
BehaviourKind kind();
|
BehaviourKind kind();
|
||||||
|
|
||||||
|
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2013 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.policy.annotation;
|
||||||
|
|
||||||
|
import org.alfresco.repo.policy.Behaviour;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for a behaviour registry.
|
||||||
|
*
|
||||||
|
* @author Roy Wetherall
|
||||||
|
* @since 2.2
|
||||||
|
*/
|
||||||
|
public interface BehaviourRegistry
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Register a behaviour against a given name.
|
||||||
|
*
|
||||||
|
* @param behaviour behaviour
|
||||||
|
*/
|
||||||
|
void registerBehaviour(String name, org.alfresco.repo.policy.Behaviour behaviour);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the behaviour for a given name.
|
||||||
|
*
|
||||||
|
* @param name behaviour name
|
||||||
|
* @return {@link Behaviour} behaviour, null otherwise
|
||||||
|
*/
|
||||||
|
org.alfresco.repo.policy.Behaviour getBehaviour(String name);
|
||||||
|
}
|
Reference in New Issue
Block a user