org.alfresco.repo.policy
Class PolicyComponentImpl

java.lang.Object
  extended by org.alfresco.repo.policy.PolicyComponentImpl
All Implemented Interfaces:
PolicyComponent

public class PolicyComponentImpl
extends java.lang.Object
implements PolicyComponent

Policy Component Implementation.


Constructor Summary
PolicyComponentImpl(org.alfresco.service.cmr.dictionary.DictionaryService dictionary)
          Construct
 
Method Summary
 BehaviourDefinition bindAssociationBehaviour(org.alfresco.service.namespace.QName policy, java.lang.Object service, Behaviour behaviour)
          Bind a Service specific behaviour to an Association-level Policy
 BehaviourDefinition bindAssociationBehaviour(org.alfresco.service.namespace.QName policy, org.alfresco.service.namespace.QName className, Behaviour behaviour)
          Bind an Association specific behaviour to an Association-level Policy (for all associations of a Class)
 BehaviourDefinition bindAssociationBehaviour(org.alfresco.service.namespace.QName policy, org.alfresco.service.namespace.QName className, org.alfresco.service.namespace.QName assocName, Behaviour behaviour)
          Bind an Association specific behaviour to an Association-level Policy
 BehaviourDefinition bindClassBehaviour(org.alfresco.service.namespace.QName policy, java.lang.Object service, Behaviour behaviour)
          Bind a Service behaviour to a Class-level Policy
 BehaviourDefinition bindClassBehaviour(org.alfresco.service.namespace.QName policy, org.alfresco.service.namespace.QName classRef, Behaviour behaviour)
          Bind a Class specific behaviour to a Class-level Policy.
 BehaviourDefinition bindPropertyBehaviour(org.alfresco.service.namespace.QName policy, java.lang.Object service, Behaviour behaviour)
          Bind a Service specific behaviour to a Property-level Policy
 BehaviourDefinition bindPropertyBehaviour(org.alfresco.service.namespace.QName policy, org.alfresco.service.namespace.QName className, Behaviour behaviour)
          Bind a Property specific behaviour to a Property-level Policy (for all properties of a Class)
 BehaviourDefinition bindPropertyBehaviour(org.alfresco.service.namespace.QName policy, org.alfresco.service.namespace.QName className, org.alfresco.service.namespace.QName propertyName, Behaviour behaviour)
          Bind a Property specific behaviour to a Property-level Policy
 java.util.Collection getRegisteredPolicies()
          Gets all registered Policies
 PolicyDefinition getRegisteredPolicy(PolicyType policyType, org.alfresco.service.namespace.QName policy)
          Gets the specified registered Policy
 boolean isRegisteredPolicy(PolicyType policyType, org.alfresco.service.namespace.QName policy)
          Determine if the specified policy has been registered
 AssociationPolicyDelegate registerAssociationPolicy(java.lang.Class policy)
          Register a Association-level Policy
 ClassPolicyDelegate registerClassPolicy(java.lang.Class policy)
          Register a Class-level Policy
 PropertyPolicyDelegate registerPropertyPolicy(java.lang.Class policy)
          Register a Property-level Policy
 void setBehaviourFilter(BehaviourFilter filter)
          Sets the behaviour filter
 void setTenantService(org.alfresco.repo.tenant.TenantService tenantService)
          Sets the tenant service
 void setTransactionInvocationHandlerFactory(TransactionInvocationHandlerFactory factory)
          Sets the transaction-based policy invocation handler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolicyComponentImpl

public PolicyComponentImpl(org.alfresco.service.cmr.dictionary.DictionaryService dictionary)
Construct

Parameters:
dictionary - dictionary service
behaviourFilter - behaviour filter
Method Detail

setBehaviourFilter

public void setBehaviourFilter(BehaviourFilter filter)
Sets the behaviour filter

Parameters:
filter -

setTenantService

public void setTenantService(org.alfresco.repo.tenant.TenantService tenantService)
Sets the tenant service

Parameters:
tenantService -

setTransactionInvocationHandlerFactory

public void setTransactionInvocationHandlerFactory(TransactionInvocationHandlerFactory factory)
Sets the transaction-based policy invocation handler

Parameters:
factory -

registerClassPolicy

public ClassPolicyDelegate registerClassPolicy(java.lang.Class policy)
Description copied from interface: PolicyComponent
Register a Class-level Policy

Specified by:
registerClassPolicy in interface PolicyComponent
Parameters:
policy - the policy interface class
Returns:
A delegate for the class-level policy (typed by the policy interface)

registerPropertyPolicy

public PropertyPolicyDelegate registerPropertyPolicy(java.lang.Class policy)
Description copied from interface: PolicyComponent
Register a Property-level Policy

Specified by:
registerPropertyPolicy in interface PolicyComponent
Parameters:
policy - the policy interface class
Returns:
A delegate for the property-level policy (typed by the policy interface)

registerAssociationPolicy

public AssociationPolicyDelegate registerAssociationPolicy(java.lang.Class policy)
Description copied from interface: PolicyComponent
Register a Association-level Policy

Specified by:
registerAssociationPolicy in interface PolicyComponent
Parameters:
policy - the policy interface class
Returns:
A delegate for the association-level policy (typed by the policy interface)

getRegisteredPolicies

public java.util.Collection getRegisteredPolicies()
Description copied from interface: PolicyComponent
Gets all registered Policies

Specified by:
getRegisteredPolicies in interface PolicyComponent
Returns:
the collection of registered policy definitions

getRegisteredPolicy

public PolicyDefinition getRegisteredPolicy(PolicyType policyType,
                                            org.alfresco.service.namespace.QName policy)
Description copied from interface: PolicyComponent
Gets the specified registered Policy

Specified by:
getRegisteredPolicy in interface PolicyComponent
Parameters:
policyType - the policy type
policy - the policy name
Returns:
the policy definition (or null, if it has not been registered)

isRegisteredPolicy

public boolean isRegisteredPolicy(PolicyType policyType,
                                  org.alfresco.service.namespace.QName policy)
Description copied from interface: PolicyComponent
Determine if the specified policy has been registered

Specified by:
isRegisteredPolicy in interface PolicyComponent
Parameters:
policyType - the policy type
policy - the fully qualified name of the policy
Returns:
true => registered, false => not yet

bindClassBehaviour

public BehaviourDefinition bindClassBehaviour(org.alfresco.service.namespace.QName policy,
                                              org.alfresco.service.namespace.QName classRef,
                                              Behaviour behaviour)
Description copied from interface: PolicyComponent
Bind a Class specific behaviour to a Class-level Policy.

So when the named policy, happens on the specified aspect or type, the specified behaviour is executed.

Example of calling this method

         this.policyComponent.bindClassBehaviour(
           NodeServicePolicies.BeforeUpdateNodePolicy.QNAME,
           ContentModel.ASPECT_LOCKABLE,
           new JavaBehaviour(this, "beforeUpdateNode"));
 

Specified by:
bindClassBehaviour in interface PolicyComponent
Parameters:
policy - the fully qualified policy name
classRef - the qualified name of a type or aspect that the policy is bound to
behaviour - the behaviour. What gets executed by the policy
Returns:
the registered behaviour definition

bindClassBehaviour

public BehaviourDefinition bindClassBehaviour(org.alfresco.service.namespace.QName policy,
                                              java.lang.Object service,
                                              Behaviour behaviour)
Description copied from interface: PolicyComponent
Bind a Service behaviour to a Class-level Policy

Specified by:
bindClassBehaviour in interface PolicyComponent
Parameters:
policy - the fully qualified policy name
service - the service (any object, in fact)
behaviour - the behaviour. What gets executed by the policy
Returns:
the registered behaviour definition

bindPropertyBehaviour

public BehaviourDefinition bindPropertyBehaviour(org.alfresco.service.namespace.QName policy,
                                                 org.alfresco.service.namespace.QName className,
                                                 org.alfresco.service.namespace.QName propertyName,
                                                 Behaviour behaviour)
Description copied from interface: PolicyComponent
Bind a Property specific behaviour to a Property-level Policy

Specified by:
bindPropertyBehaviour in interface PolicyComponent
Parameters:
policy - the fully qualified policy name
className - the qualified name of the class (type or aspect) to bind against
propertyName - the name of the property to bind against
behaviour - the behaviour. What gets executed by the policy
Returns:
the registered behaviour definition

bindPropertyBehaviour

public BehaviourDefinition bindPropertyBehaviour(org.alfresco.service.namespace.QName policy,
                                                 org.alfresco.service.namespace.QName className,
                                                 Behaviour behaviour)
Description copied from interface: PolicyComponent
Bind a Property specific behaviour to a Property-level Policy (for all properties of a Class)

Specified by:
bindPropertyBehaviour in interface PolicyComponent
Parameters:
policy - the fully qualified policy name
className - the name of the class (type or aspect) to bind against
behaviour - the behaviour, what gets executed by the policy
Returns:
the registered behaviour definition

bindPropertyBehaviour

public BehaviourDefinition bindPropertyBehaviour(org.alfresco.service.namespace.QName policy,
                                                 java.lang.Object service,
                                                 Behaviour behaviour)
Description copied from interface: PolicyComponent
Bind a Service specific behaviour to a Property-level Policy

Specified by:
bindPropertyBehaviour in interface PolicyComponent
Parameters:
policy - the fully qualified policy name
service - the binding service
behaviour - the behaviour
Returns:
the registered behaviour definition

bindAssociationBehaviour

public BehaviourDefinition bindAssociationBehaviour(org.alfresco.service.namespace.QName policy,
                                                    org.alfresco.service.namespace.QName className,
                                                    org.alfresco.service.namespace.QName assocName,
                                                    Behaviour behaviour)
Description copied from interface: PolicyComponent
Bind an Association specific behaviour to an Association-level Policy

For example, before a rule folder association is created.

         policyComponent.bindAssociationBehaviour(
           NodeServicePolicies.OnCreateChildAssociationPolicy.QNAME,
           RuleModel.ASPECT_RULES,
           RuleModel.ASSOC_RULE_FOLDER,
           new JavaBehaviour(this, "OnCreateChildAssociation"));
 

Specified by:
bindAssociationBehaviour in interface PolicyComponent
Parameters:
policy - the policy name
className - the name of the class (type or aspect) to bind against
assocName - the name of the association to bind against
behaviour - the behaviour. What gets executed by the policy
Returns:
the registered behaviour definition

bindAssociationBehaviour

public BehaviourDefinition bindAssociationBehaviour(org.alfresco.service.namespace.QName policy,
                                                    org.alfresco.service.namespace.QName className,
                                                    Behaviour behaviour)
Description copied from interface: PolicyComponent
Bind an Association specific behaviour to an Association-level Policy (for all associations of a Class)

Specified by:
bindAssociationBehaviour in interface PolicyComponent
Parameters:
policy - the policy name
className - the name of the class (type or aspect) to bind against
behaviour - the behaviour. What gets executed by the policy
Returns:
the registered behaviour definition

bindAssociationBehaviour

public BehaviourDefinition bindAssociationBehaviour(org.alfresco.service.namespace.QName policy,
                                                    java.lang.Object service,
                                                    Behaviour behaviour)
Description copied from interface: PolicyComponent
Bind a Service specific behaviour to an Association-level Policy

Specified by:
bindAssociationBehaviour in interface PolicyComponent
Parameters:
policy - the policy name
service - the binding service
behaviour - the behaviour. What gets executed by the policy
Returns:
the registered behaviour definition


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.