Merged BRANCHES/V3.2 to HEAD:

19177: (RECORD ONLY) Updated record-only entries for V3.1 branch
   19321: (RECORD ONLY) Removed deep svn:mergeinfo
   19331: (RECORD ONLY) Merged HEAD to BRANCHES/V3.2:
        19324: Follow-up on ALF-765 by upgrading EHCache to 2.0.0Performing merge across the whole of the branch
   19526: Moved ContentServicePolicy static QNames onto policy classes
   19539: (RECORD ONLY) Merged HEAD to V3.2
         19538: Build fix - fix build speed
   19541: Added extraction of custom, mapped metadata from PDF documents
   19543: (RECORD ONLY) Removed deep svn:mergeinfo
   19598: (RECORD ONLY) Backported (merge not possible) HEAD rev 18790 for IndexInfo fixes
   19626: Fix for ALF-732:  Possible memory leak using the .getNodeRefs() method against a ResultSet ...
   19629: (RECORD ONLY) Merged HEAD to V3.2
        19625: Fix to allow Share logo to swapped out for a different one without having to modify the header CSS.
        19628: Corrected Share header component height.
   19649: ALF-885: Cannot retrieve cm:title from an AVM node in FreeMarker (if persisted with actual type set to MLText)
   19694: (RECORD ONLY) Merged V3.2 to HEAD: r19310 bad back merge - record-only
   19713: (RECORD ONLY) Removed svn:mergeinfo


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19719 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2010-04-01 01:05:03 +00:00
parent f11ce22967
commit f27434f2c6
10 changed files with 562 additions and 513 deletions

View File

@@ -1,4 +1,4 @@
/*
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
*
* This file is part of Alfresco
@@ -14,127 +14,127 @@
* 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 <http://www.gnu.org/licenses/>.
*/
package org.alfresco.repo.workflow;
import java.io.Serializable;
import java.util.Map;
import org.alfresco.repo.content.ContentServicePolicies;
import org.alfresco.repo.node.NodeServicePolicies;
import org.alfresco.repo.policy.JavaBehaviour;
import org.alfresco.repo.policy.PolicyComponent;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
/**
* Workflow Definition type behaviour.
*
* @author JanV
*/
public class WorkflowDefinitionType implements ContentServicePolicies.OnContentUpdatePolicy,
NodeServicePolicies.OnUpdatePropertiesPolicy,
NodeServicePolicies.BeforeDeleteNodePolicy
{
/** The policy component */
private PolicyComponent policyComponent;
/** The workflow deployer / undeployer */
private WorkflowDeployer workflowDeployer;
/**
* Set the policy component
*
* @param policyComponent the policy component
*/
public void setPolicyComponent(PolicyComponent policyComponent)
{
this.policyComponent = policyComponent;
}
/**
* Set the workflow deployer / undeployer
*
* @param workflowDeployer the workflow deployer / undeployer
*/
public void setWorkflowDeployer(WorkflowDeployer workflowDeployer)
{
this.workflowDeployer = workflowDeployer;
}
/**
* The initialise method
*/
public void init()
{
// Register interest in the onContentUpdate policy for the workflow definition type
policyComponent.bindClassBehaviour(
ContentServicePolicies.ON_CONTENT_UPDATE,
WorkflowModel.TYPE_WORKFLOW_DEF,
new JavaBehaviour(this, "onContentUpdate"));
// Register interest in the onPropertyUpdate policy for the workflow definition type
policyComponent.bindClassBehaviour(
QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"),
WorkflowModel.TYPE_WORKFLOW_DEF,
new JavaBehaviour(this, "onUpdateProperties"));
// Register interest in the node delete policy
policyComponent.bindClassBehaviour(
QName.createQName(NamespaceService.ALFRESCO_URI, "beforeDeleteNode"),
WorkflowModel.TYPE_WORKFLOW_DEF,
new JavaBehaviour(this, "beforeDeleteNode"));
}
/**
* On content update behaviour implementation
*
* @param nodeRef the node reference whose content has been updated
*/
public void onContentUpdate(NodeRef nodeRef, boolean newContent)
{
workflowDeployer.deploy(nodeRef, true);
}
/**
* On update properties behaviour implementation
*
* @param nodeRef the node reference
* @param before the values of the properties before update
* @param after the values of the properties after the update
*/
public void onUpdateProperties(
NodeRef nodeRef,
Map<QName, Serializable> before,
Map<QName, Serializable> after)
{
Boolean beforeValue = (Boolean)before.get(WorkflowModel.PROP_WORKFLOW_DEF_DEPLOYED);
Boolean afterValue = (Boolean)after.get(WorkflowModel.PROP_WORKFLOW_DEF_DEPLOYED);
if (afterValue != null &&
(beforeValue == null || (beforeValue != null && afterValue != null && beforeValue.equals(afterValue) == false)))
{
if (afterValue.booleanValue() == true)
{
workflowDeployer.deploy(nodeRef, true);
}
else
{
workflowDeployer.undeploy(nodeRef);
}
}
else if (afterValue == null && beforeValue != null)
{
// Undeploy the definition since the value has been cleared
workflowDeployer.undeploy(nodeRef);
}
}
public void beforeDeleteNode(NodeRef nodeRef)
{
workflowDeployer.undeploy(nodeRef);
}
}
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.repo.workflow;
import java.io.Serializable;
import java.util.Map;
import org.alfresco.repo.content.ContentServicePolicies;
import org.alfresco.repo.node.NodeServicePolicies;
import org.alfresco.repo.policy.JavaBehaviour;
import org.alfresco.repo.policy.PolicyComponent;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
/**
* Workflow Definition type behaviour.
*
* @author JanV
*/
public class WorkflowDefinitionType implements ContentServicePolicies.OnContentUpdatePolicy,
NodeServicePolicies.OnUpdatePropertiesPolicy,
NodeServicePolicies.BeforeDeleteNodePolicy
{
/** The policy component */
private PolicyComponent policyComponent;
/** The workflow deployer / undeployer */
private WorkflowDeployer workflowDeployer;
/**
* Set the policy component
*
* @param policyComponent the policy component
*/
public void setPolicyComponent(PolicyComponent policyComponent)
{
this.policyComponent = policyComponent;
}
/**
* Set the workflow deployer / undeployer
*
* @param workflowDeployer the workflow deployer / undeployer
*/
public void setWorkflowDeployer(WorkflowDeployer workflowDeployer)
{
this.workflowDeployer = workflowDeployer;
}
/**
* The initialise method
*/
public void init()
{
// Register interest in the onContentUpdate policy for the workflow definition type
policyComponent.bindClassBehaviour(
ContentServicePolicies.OnContentUpdatePolicy.QNAME,
WorkflowModel.TYPE_WORKFLOW_DEF,
new JavaBehaviour(this, "onContentUpdate"));
// Register interest in the onPropertyUpdate policy for the workflow definition type
policyComponent.bindClassBehaviour(
QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"),
WorkflowModel.TYPE_WORKFLOW_DEF,
new JavaBehaviour(this, "onUpdateProperties"));
// Register interest in the node delete policy
policyComponent.bindClassBehaviour(
QName.createQName(NamespaceService.ALFRESCO_URI, "beforeDeleteNode"),
WorkflowModel.TYPE_WORKFLOW_DEF,
new JavaBehaviour(this, "beforeDeleteNode"));
}
/**
* On content update behaviour implementation
*
* @param nodeRef the node reference whose content has been updated
*/
public void onContentUpdate(NodeRef nodeRef, boolean newContent)
{
workflowDeployer.deploy(nodeRef, true);
}
/**
* On update properties behaviour implementation
*
* @param nodeRef the node reference
* @param before the values of the properties before update
* @param after the values of the properties after the update
*/
public void onUpdateProperties(
NodeRef nodeRef,
Map<QName, Serializable> before,
Map<QName, Serializable> after)
{
Boolean beforeValue = (Boolean)before.get(WorkflowModel.PROP_WORKFLOW_DEF_DEPLOYED);
Boolean afterValue = (Boolean)after.get(WorkflowModel.PROP_WORKFLOW_DEF_DEPLOYED);
if (afterValue != null &&
(beforeValue == null || (beforeValue != null && afterValue != null && beforeValue.equals(afterValue) == false)))
{
if (afterValue.booleanValue() == true)
{
workflowDeployer.deploy(nodeRef, true);
}
else
{
workflowDeployer.undeploy(nodeRef);
}
}
else if (afterValue == null && beforeValue != null)
{
// Undeploy the definition since the value has been cleared
workflowDeployer.undeploy(nodeRef);
}
}
public void beforeDeleteNode(NodeRef nodeRef)
{
workflowDeployer.undeploy(nodeRef);
}
}