public class PolicyComponentImpl extends Object implements PolicyComponent
Constructor and Description |
---|
PolicyComponentImpl(org.alfresco.service.cmr.dictionary.DictionaryService dictionary)
Construct
|
Modifier and Type | Method and Description |
---|---|
BehaviourDefinition<ServiceBehaviourBinding> |
bindAssociationBehaviour(org.alfresco.service.namespace.QName policy,
Object service,
Behaviour behaviour)
Bind a Service specific behaviour to an Association-level Policy
|
BehaviourDefinition<ClassFeatureBehaviourBinding> |
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<ClassFeatureBehaviourBinding> |
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<ServiceBehaviourBinding> |
bindClassBehaviour(org.alfresco.service.namespace.QName policy,
Object service,
Behaviour behaviour)
Bind a Service behaviour to a Class-level Policy
|
BehaviourDefinition<ClassBehaviourBinding> |
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<ServiceBehaviourBinding> |
bindPropertyBehaviour(org.alfresco.service.namespace.QName policy,
Object service,
Behaviour behaviour)
Bind a Service specific behaviour to a Property-level Policy
|
BehaviourDefinition<ClassFeatureBehaviourBinding> |
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<ClassFeatureBehaviourBinding> |
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
|
Collection<PolicyDefinition> |
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
|
<P extends AssociationPolicy> |
registerAssociationPolicy(Class<P> policy)
Register a Association-level Policy
|
<P extends ClassPolicy> |
registerClassPolicy(Class<P> policy)
Register a Class-level Policy
|
<P extends PropertyPolicy> |
registerPropertyPolicy(Class<P> policy)
Register a Property-level Policy
|
void |
removeClassDefinition(BehaviourDefinition<ClassBehaviourBinding> definition)
Unbind behaviour
|
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
|
void |
setTryLockTimeout(long tryLockTimeout) |
public PolicyComponentImpl(org.alfresco.service.cmr.dictionary.DictionaryService dictionary)
dictionary
- dictionary servicepublic void setTryLockTimeout(long tryLockTimeout)
public void setBehaviourFilter(BehaviourFilter filter)
filter
- BehaviourFilterpublic void setTenantService(org.alfresco.repo.tenant.TenantService tenantService)
tenantService
- TenantServicepublic void setTransactionInvocationHandlerFactory(TransactionInvocationHandlerFactory factory)
factory
- TransactionInvocationHandlerFactorypublic <P extends ClassPolicy> ClassPolicyDelegate<P> registerClassPolicy(Class<P> policy)
PolicyComponent
registerClassPolicy
in interface PolicyComponent
P
- the policy interfacepolicy
- the policy interface classpublic void removeClassDefinition(BehaviourDefinition<ClassBehaviourBinding> definition)
PolicyComponent
removeClassDefinition
in interface PolicyComponent
public <P extends PropertyPolicy> PropertyPolicyDelegate<P> registerPropertyPolicy(Class<P> policy)
PolicyComponent
registerPropertyPolicy
in interface PolicyComponent
P
- the policy interfacepolicy
- the policy interface classpublic <P extends AssociationPolicy> AssociationPolicyDelegate<P> registerAssociationPolicy(Class<P> policy)
PolicyComponent
registerAssociationPolicy
in interface PolicyComponent
P
- the policy interfacepolicy
- the policy interface classpublic Collection<PolicyDefinition> getRegisteredPolicies()
PolicyComponent
getRegisteredPolicies
in interface PolicyComponent
public PolicyDefinition getRegisteredPolicy(PolicyType policyType, org.alfresco.service.namespace.QName policy)
PolicyComponent
getRegisteredPolicy
in interface PolicyComponent
policyType
- the policy typepolicy
- the policy namepublic boolean isRegisteredPolicy(PolicyType policyType, org.alfresco.service.namespace.QName policy)
PolicyComponent
isRegisteredPolicy
in interface PolicyComponent
policyType
- the policy typepolicy
- the fully qualified name of the policypublic BehaviourDefinition<ClassBehaviourBinding> bindClassBehaviour(org.alfresco.service.namespace.QName policy, org.alfresco.service.namespace.QName classRef, Behaviour behaviour)
PolicyComponent
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"));
bindClassBehaviour
in interface PolicyComponent
policy
- the fully qualified policy nameclassRef
- the qualified name of a type or aspect that the policy is bound tobehaviour
- the behaviour. What gets executed by the policypublic BehaviourDefinition<ServiceBehaviourBinding> bindClassBehaviour(org.alfresco.service.namespace.QName policy, Object service, Behaviour behaviour)
PolicyComponent
bindClassBehaviour
in interface PolicyComponent
policy
- the fully qualified policy nameservice
- the service (any object, in fact)behaviour
- the behaviour. What gets executed by the policypublic BehaviourDefinition<ClassFeatureBehaviourBinding> bindPropertyBehaviour(org.alfresco.service.namespace.QName policy, org.alfresco.service.namespace.QName className, org.alfresco.service.namespace.QName propertyName, Behaviour behaviour)
PolicyComponent
bindPropertyBehaviour
in interface PolicyComponent
policy
- the fully qualified policy nameclassName
- the qualified name of the class (type or aspect) to bind againstpropertyName
- the name of the property to bind againstbehaviour
- the behaviour. What gets executed by the policypublic BehaviourDefinition<ClassFeatureBehaviourBinding> bindPropertyBehaviour(org.alfresco.service.namespace.QName policy, org.alfresco.service.namespace.QName className, Behaviour behaviour)
PolicyComponent
bindPropertyBehaviour
in interface PolicyComponent
policy
- the fully qualified policy nameclassName
- the name of the class (type or aspect) to bind againstbehaviour
- the behaviour, what gets executed by the policypublic BehaviourDefinition<ServiceBehaviourBinding> bindPropertyBehaviour(org.alfresco.service.namespace.QName policy, Object service, Behaviour behaviour)
PolicyComponent
bindPropertyBehaviour
in interface PolicyComponent
policy
- the fully qualified policy nameservice
- the binding servicebehaviour
- the behaviourpublic BehaviourDefinition<ClassFeatureBehaviourBinding> bindAssociationBehaviour(org.alfresco.service.namespace.QName policy, org.alfresco.service.namespace.QName className, org.alfresco.service.namespace.QName assocName, Behaviour behaviour)
PolicyComponent
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"));
bindAssociationBehaviour
in interface PolicyComponent
policy
- the policy nameclassName
- the name of the class (type or aspect) to bind againstassocName
- the name of the association to bind againstbehaviour
- the behaviour. What gets executed by the policypublic BehaviourDefinition<ClassFeatureBehaviourBinding> bindAssociationBehaviour(org.alfresco.service.namespace.QName policy, org.alfresco.service.namespace.QName className, Behaviour behaviour)
PolicyComponent
bindAssociationBehaviour
in interface PolicyComponent
policy
- the policy nameclassName
- the name of the class (type or aspect) to bind againstbehaviour
- the behaviour. What gets executed by the policypublic BehaviourDefinition<ServiceBehaviourBinding> bindAssociationBehaviour(org.alfresco.service.namespace.QName policy, Object service, Behaviour behaviour)
PolicyComponent
bindAssociationBehaviour
in interface PolicyComponent
policy
- the policy nameservice
- the binding servicebehaviour
- the behaviour. What gets executed by the policyCopyright © 2005–2017 Alfresco Software. All rights reserved.