Powered By Blogger

Saturday, September 24, 2011

Policy and Behaviour

We can trigger same policy for 2 contents in 2 different classes

EX:
public class UsageQuotaProtector implements NodeServicePolicies.OnUpdatePropertiesPolicy


public void init()
{
if (contentUsageService.getEnabled())
{
// Register interest in the onUpdateProperties policy
policyComponent.bindClassBehaviour(
QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"),
ContentModel.TYPE_PERSON,
new JavaBehaviour(this, "onUpdateProperties"));
}
}


Similarly we can have
public class RepositoryAuthenticationDao implements MutableAuthenticationDao, InitializingBean, OnUpdatePropertiesPolicy, BeforeDeleteNodePolicy



*/
public void afterPropertiesSet() throws Exception
{
this.policyComponent.bindClassBehaviour(
OnUpdatePropertiesPolicy.QNAME,
ContentModel.TYPE_PERSON,
new JavaBehaviour(this, "onUpdateProperties"));

No comments:

Post a Comment