Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

org.alfresco.repo.policy
Interface PolicyComponent

@org.alfresco.api.AlfrescoPublicApi
public interface PolicyComponent
Policy Component for managing Policies and Behaviours.

This component provides the ability to:

A behaviour may be bound to a Policy before the Policy is registered. In this case, the behaviour is not validated (i.e. checked to determine if it supports the policy interface) until the Policy is registered. Otherwise, the behaviour is validated at bind-time. Policies may be selectively "turned off" by the Behaviour Filter.

Author:
David Caruana
See Also:
BehaviourFilter, NodeServicePolicies

Method Summary
bindAssociationBehaviour(QName policy, Object service, Behaviour behaviour)
          Bind a Service specific behaviour to an Association-level Policy
bindAssociationBehaviour(QName policy, QName className, Behaviour behaviour)
          Bind an Association specific behaviour to an Association-level Policy (for all associations of a Class)
bindAssociationBehaviour(QName policy, QName className, QName assocName, Behaviour behaviour)
          Bind an Association specific behaviour to an Association-level Policy
bindClassBehaviour(QName policy, Object service, Behaviour behaviour)
          Bind a Service behaviour to a Class-level Policy
bindClassBehaviour(QName policy, QName className, Behaviour behaviour)
          Bind a Class specific behaviour to a Class-level Policy.
bindPropertyBehaviour(QName policy, Object service, Behaviour behaviour)
          Bind a Service specific behaviour to a Property-level Policy
bindPropertyBehaviour(QName policy, QName className, Behaviour behaviour)
          Bind a Property specific behaviour to a Property-level Policy (for all properties of a Class)
bindPropertyBehaviour(QName policy, QName className, QName propertyName, Behaviour behaviour)
          Bind a Property specific behaviour to a Property-level Policy
getRegisteredPolicies()
          Gets all registered Policies
getRegisteredPolicy(PolicyType policyType, QName policy)
          Gets the specified registered Policy
boolean
isRegisteredPolicy(PolicyType policyType, QName policy)
          Determine if the specified policy has been registered
registerAssociationPolicy(Class<P> policy)
          Register a Association-level Policy
registerClassPolicy(Class<P> policy)
          Register a Class-level Policy
registerPropertyPolicy(Class<P> policy)
          Register a Property-level Policy
void
removeClassDefinition(BehaviourDefinition<ClassBehaviourBinding> definition)
          Unbind behaviour
Method Detail
registerClassPolicy
<P extends ClassPolicyClassPolicyDelegate<P> registerClassPolicy(Class<P> policy)
Register a Class-level Policy
Type Parameters:
P - the policy interface
Parameters:
policy - the policy interface class
Returns:
A delegate for the class-level policy (typed by the policy interface)

registerPropertyPolicy
<P extends PropertyPolicyPropertyPolicyDelegate<P> registerPropertyPolicy(Class<P> policy)
Register a Property-level Policy
Type Parameters:
P - the policy interface
Parameters:
policy - the policy interface class
Returns:
A delegate for the property-level policy (typed by the policy interface)

registerAssociationPolicy
<P extends AssociationPolicyAssociationPolicyDelegate<P> registerAssociationPolicy(Class<P> policy)
Register a Association-level Policy
Type Parameters:
P - the policy interface
Parameters:
policy - the policy interface class
Returns:
A delegate for the association-level policy (typed by the policy interface)

getRegisteredPolicies
Collection<PolicyDefinitiongetRegisteredPolicies()
Gets all registered Policies
Returns:
the collection of registered policy definitions

getRegisteredPolicy
PolicyDefinition<PolicygetRegisteredPolicy(PolicyType policyType,
                                             QName policy)
Gets the specified registered Policy
Parameters:
policyType - the policy type
policy - the policy name
Returns:
the policy definition (or null, if it has not been registered)

isRegisteredPolicy
boolean isRegisteredPolicy(PolicyType policyType,
                           QName policy)
Determine if the specified policy has been registered
Parameters:
policyType - the policy type
policy - the fully qualified name of the policy
Returns:
true => registered, false => not yet

bindClassBehaviour
BehaviourDefinition<ClassBehaviourBindingbindClassBehaviour(QName policy,
                                                              QName className,
                                                              Behaviour behaviour)
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"));
 
Parameters:
policy - the fully qualified policy name
className - 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
BehaviourDefinition<ServiceBehaviourBindingbindClassBehaviour(QName policy,
                                                                Object service,
                                                                Behaviour behaviour)
Bind a Service behaviour to a Class-level Policy
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
BehaviourDefinition<ClassFeatureBehaviourBindingbindPropertyBehaviour(QName policy,
                                                                        QName className,
                                                                        QName propertyName,
                                                                        Behaviour behaviour)
Bind a Property specific behaviour to a Property-level Policy
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
BehaviourDefinition<ClassFeatureBehaviourBindingbindPropertyBehaviour(QName policy,
                                                                        QName className,
                                                                        Behaviour behaviour)
Bind a Property specific behaviour to a Property-level Policy (for all properties of a Class)
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
BehaviourDefinition<ServiceBehaviourBindingbindPropertyBehaviour(QName policy,
                                                                   Object service,
                                                                   Behaviour behaviour)
Bind a Service specific behaviour to a Property-level Policy
Parameters:
policy - the fully qualified policy name
service - the binding service
behaviour - the behaviour
Returns:
the registered behaviour definition

bindAssociationBehaviour
BehaviourDefinition<ClassFeatureBehaviourBindingbindAssociationBehaviour(QName policy,
                                                                           QName className,
                                                                           QName assocName,
                                                                           Behaviour behaviour)
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"));
 
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
BehaviourDefinition<ClassFeatureBehaviourBindingbindAssociationBehaviour(QName policy,
                                                                           QName className,
                                                                           Behaviour behaviour)
Bind an Association specific behaviour to an Association-level Policy (for all associations of a Class)
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
BehaviourDefinition<ServiceBehaviourBindingbindAssociationBehaviour(QName policy,
                                                                      Object service,
                                                                      Behaviour behaviour)
Bind a Service specific behaviour to an Association-level Policy
Parameters:
policy - the policy name
service - the binding service
behaviour - the behaviour. What gets executed by the policy
Returns:
the registered behaviour definition

removeClassDefinition
void removeClassDefinition(BehaviourDefinition<ClassBehaviourBinding> definition)
Unbind behaviour

Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005–2018 Alfresco Software. All rights reserved.

Java API documentation generated with DocFlex/Javadoc 1.6.1 using JavadocPro template set.