/*
* Copyright (C) 2005-2010 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
* 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. * * * * @see org.alfresco.repo.policy.BehaviourFilter * * @see org.alfresco.repo.node.NodeServicePolicies * * * @author David Caruana * */ public interface PolicyComponent { /** * Register a Class-level Policy * * @param
the policy interface * @param policy the policy interface class * @return A delegate for the class-level policy (typed by the policy interface) */ public
ClassPolicyDelegate
registerClassPolicy(Class
policy); /** * Register a Property-level Policy * * @param
the policy interface * @param policy the policy interface class * @return A delegate for the property-level policy (typed by the policy interface) */ public
PropertyPolicyDelegate
registerPropertyPolicy(Class
policy); /** * Register a Association-level Policy * * @param
the policy interface * @param policy the policy interface class * @return A delegate for the association-level policy (typed by the policy interface) */ public
AssociationPolicyDelegate
registerAssociationPolicy(Class
policy);
/**
* Gets all registered Policies
*
* @return the collection of registered policy definitions
*/
public Collection
* So when the named policy, happens on the specified aspect or type,
* the specified behaviour is executed.
*
* Example of calling this method
*
* For example, before a rule folder association is created.
*
* this.policyComponent.bindClassBehaviour(
* NodeServicePolicies.BeforeUpdateNodePolicy.QNAME,
* ContentModel.ASPECT_LOCKABLE,
* new JavaBehaviour(this, "beforeUpdateNode"));
*
* @param policy the fully qualified policy name
* @param className the qualified name of a type or aspect that the policy is bound to
* @param behaviour the behaviour. What gets executed by the policy
* @return the registered behaviour definition
*/
public BehaviourDefinition
* policyComponent.bindAssociationBehaviour(
* NodeServicePolicies.OnCreateChildAssociationPolicy.QNAME,
* RuleModel.ASPECT_RULES,
* RuleModel.ASSOC_RULE_FOLDER,
* new JavaBehaviour(this, "OnCreateChildAssociation"));
*
*
* @param policy the policy name
* @param className the name of the class (type or aspect) to bind against
* @param assocName the name of the association to bind against
* @param behaviour the behaviour. What gets executed by the policy
* @return the registered behaviour definition
*/
public BehaviourDefinition