mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merge 1.4 to HEAD (excl records management)
svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4306 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4307 . rm -rf root/projects/records-mgmt git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4637 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -28,6 +28,7 @@ import org.alfresco.model.ContentModel;
|
|||||||
import org.alfresco.repo.domain.PropertyValue;
|
import org.alfresco.repo.domain.PropertyValue;
|
||||||
import org.alfresco.repo.node.NodeServicePolicies.BeforeAddAspectPolicy;
|
import org.alfresco.repo.node.NodeServicePolicies.BeforeAddAspectPolicy;
|
||||||
import org.alfresco.repo.node.NodeServicePolicies.BeforeCreateChildAssociationPolicy;
|
import org.alfresco.repo.node.NodeServicePolicies.BeforeCreateChildAssociationPolicy;
|
||||||
|
import org.alfresco.repo.node.NodeServicePolicies.BeforeCreateNodeAssociationPolicy;
|
||||||
import org.alfresco.repo.node.NodeServicePolicies.BeforeCreateNodePolicy;
|
import org.alfresco.repo.node.NodeServicePolicies.BeforeCreateNodePolicy;
|
||||||
import org.alfresco.repo.node.NodeServicePolicies.BeforeCreateStorePolicy;
|
import org.alfresco.repo.node.NodeServicePolicies.BeforeCreateStorePolicy;
|
||||||
import org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteChildAssociationPolicy;
|
import org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteChildAssociationPolicy;
|
||||||
@@ -37,6 +38,7 @@ import org.alfresco.repo.node.NodeServicePolicies.BeforeUpdateNodePolicy;
|
|||||||
import org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy;
|
import org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy;
|
||||||
import org.alfresco.repo.node.NodeServicePolicies.OnCreateAssociationPolicy;
|
import org.alfresco.repo.node.NodeServicePolicies.OnCreateAssociationPolicy;
|
||||||
import org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy;
|
import org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy;
|
||||||
|
import org.alfresco.repo.node.NodeServicePolicies.OnCreateNodeAssociationPolicy;
|
||||||
import org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy;
|
import org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy;
|
||||||
import org.alfresco.repo.node.NodeServicePolicies.OnCreateStorePolicy;
|
import org.alfresco.repo.node.NodeServicePolicies.OnCreateStorePolicy;
|
||||||
import org.alfresco.repo.node.NodeServicePolicies.OnDeleteAssociationPolicy;
|
import org.alfresco.repo.node.NodeServicePolicies.OnDeleteAssociationPolicy;
|
||||||
@@ -110,6 +112,8 @@ public abstract class AbstractNodeServiceImpl implements NodeService
|
|||||||
private ClassPolicyDelegate<OnAddAspectPolicy> onAddAspectDelegate;
|
private ClassPolicyDelegate<OnAddAspectPolicy> onAddAspectDelegate;
|
||||||
private ClassPolicyDelegate<BeforeRemoveAspectPolicy> beforeRemoveAspectDelegate;
|
private ClassPolicyDelegate<BeforeRemoveAspectPolicy> beforeRemoveAspectDelegate;
|
||||||
private ClassPolicyDelegate<OnRemoveAspectPolicy> onRemoveAspectDelegate;
|
private ClassPolicyDelegate<OnRemoveAspectPolicy> onRemoveAspectDelegate;
|
||||||
|
private AssociationPolicyDelegate<BeforeCreateNodeAssociationPolicy> beforeCreateNodeAssociationDelegate;
|
||||||
|
private AssociationPolicyDelegate<OnCreateNodeAssociationPolicy> onCreateNodeAssociationDelegate;
|
||||||
private AssociationPolicyDelegate<BeforeCreateChildAssociationPolicy> beforeCreateChildAssociationDelegate;
|
private AssociationPolicyDelegate<BeforeCreateChildAssociationPolicy> beforeCreateChildAssociationDelegate;
|
||||||
private AssociationPolicyDelegate<OnCreateChildAssociationPolicy> onCreateChildAssociationDelegate;
|
private AssociationPolicyDelegate<OnCreateChildAssociationPolicy> onCreateChildAssociationDelegate;
|
||||||
private AssociationPolicyDelegate<BeforeDeleteChildAssociationPolicy> beforeDeleteChildAssociationDelegate;
|
private AssociationPolicyDelegate<BeforeDeleteChildAssociationPolicy> beforeDeleteChildAssociationDelegate;
|
||||||
@@ -183,6 +187,8 @@ public abstract class AbstractNodeServiceImpl implements NodeService
|
|||||||
beforeRemoveAspectDelegate = policyComponent.registerClassPolicy(NodeServicePolicies.BeforeRemoveAspectPolicy.class);
|
beforeRemoveAspectDelegate = policyComponent.registerClassPolicy(NodeServicePolicies.BeforeRemoveAspectPolicy.class);
|
||||||
onRemoveAspectDelegate = policyComponent.registerClassPolicy(NodeServicePolicies.OnRemoveAspectPolicy.class);
|
onRemoveAspectDelegate = policyComponent.registerClassPolicy(NodeServicePolicies.OnRemoveAspectPolicy.class);
|
||||||
|
|
||||||
|
beforeCreateNodeAssociationDelegate = policyComponent.registerAssociationPolicy(NodeServicePolicies.BeforeCreateNodeAssociationPolicy.class);
|
||||||
|
onCreateNodeAssociationDelegate = policyComponent.registerAssociationPolicy(NodeServicePolicies.OnCreateNodeAssociationPolicy.class);
|
||||||
beforeCreateChildAssociationDelegate = policyComponent.registerAssociationPolicy(NodeServicePolicies.BeforeCreateChildAssociationPolicy.class);
|
beforeCreateChildAssociationDelegate = policyComponent.registerAssociationPolicy(NodeServicePolicies.BeforeCreateChildAssociationPolicy.class);
|
||||||
onCreateChildAssociationDelegate = policyComponent.registerAssociationPolicy(NodeServicePolicies.OnCreateChildAssociationPolicy.class);
|
onCreateChildAssociationDelegate = policyComponent.registerAssociationPolicy(NodeServicePolicies.OnCreateChildAssociationPolicy.class);
|
||||||
beforeDeleteChildAssociationDelegate = policyComponent.registerAssociationPolicy(NodeServicePolicies.BeforeDeleteChildAssociationPolicy.class);
|
beforeDeleteChildAssociationDelegate = policyComponent.registerAssociationPolicy(NodeServicePolicies.BeforeDeleteChildAssociationPolicy.class);
|
||||||
@@ -393,6 +399,34 @@ public abstract class AbstractNodeServiceImpl implements NodeService
|
|||||||
policy.onRemoveAspect(nodeRef, aspectTypeQName);
|
policy.onRemoveAspect(nodeRef, aspectTypeQName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see NodeServicePolicies.BeforeCreateNodeAssociationPolicy#beforeCreateChildAssociation(NodeRef,
|
||||||
|
* NodeRef, QName, QName)
|
||||||
|
*/
|
||||||
|
protected void invokeBeforeCreateNodeAssociation(NodeRef parentNodeRef, QName assocTypeQName, QName assocQName)
|
||||||
|
{
|
||||||
|
// get qnames to invoke against
|
||||||
|
Set<QName> qnames = getTypeAndAspectQNames(parentNodeRef);
|
||||||
|
// execute policy for node type
|
||||||
|
NodeServicePolicies.BeforeCreateNodeAssociationPolicy policy = beforeCreateNodeAssociationDelegate.get(parentNodeRef, qnames, assocTypeQName);
|
||||||
|
policy.beforeCreateNodeAssociation(parentNodeRef, assocTypeQName, assocQName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see NodeServicePolicies.OnCreateNodeAssociationPolicy#onCreateChildAssociation(ChildAssociationRef)
|
||||||
|
*/
|
||||||
|
protected void invokeOnCreateNodeAssociation(ChildAssociationRef childAssocRef)
|
||||||
|
{
|
||||||
|
// Get the parent reference and the assoc type qName
|
||||||
|
NodeRef parentNodeRef = childAssocRef.getParentRef();
|
||||||
|
QName assocTypeQName = childAssocRef.getTypeQName();
|
||||||
|
// get qnames to invoke against
|
||||||
|
Set<QName> qnames = getTypeAndAspectQNames(parentNodeRef);
|
||||||
|
// execute policy for node type and aspects
|
||||||
|
NodeServicePolicies.OnCreateNodeAssociationPolicy policy = onCreateNodeAssociationDelegate.get(parentNodeRef, qnames, assocTypeQName);
|
||||||
|
policy.onCreateNodeAssociation(childAssocRef);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see NodeServicePolicies.BeforeCreateChildAssociationPolicy#beforeCreateChildAssociation(NodeRef,
|
* @see NodeServicePolicies.BeforeCreateChildAssociationPolicy#beforeCreateChildAssociation(NodeRef,
|
||||||
* NodeRef, QName, QName)
|
* NodeRef, QName, QName)
|
||||||
|
@@ -201,6 +201,31 @@ public interface NodeServicePolicies
|
|||||||
public void onRemoveAspect(NodeRef nodeRef, QName aspectTypeQName);
|
public void onRemoveAspect(NodeRef nodeRef, QName aspectTypeQName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface BeforeCreateNodeAssociationPolicy extends AssociationPolicy
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Called before a new node is created with the details of the new child association.
|
||||||
|
*
|
||||||
|
* @param parentNodeRef
|
||||||
|
* @param assocTypeQName the type of the association
|
||||||
|
* @param assocQName the name of the association
|
||||||
|
*/
|
||||||
|
public void beforeCreateNodeAssociation(
|
||||||
|
NodeRef parentNodeRef,
|
||||||
|
QName assocTypeQName,
|
||||||
|
QName assocQName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnCreateNodeAssociationPolicy extends AssociationPolicy
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Called after a node is created with the created association details
|
||||||
|
*
|
||||||
|
* @param childAssocRef the child association that has been created
|
||||||
|
*/
|
||||||
|
public void onCreateNodeAssociation(ChildAssociationRef childAssocRef);
|
||||||
|
}
|
||||||
|
|
||||||
public interface BeforeCreateChildAssociationPolicy extends AssociationPolicy
|
public interface BeforeCreateChildAssociationPolicy extends AssociationPolicy
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@@ -267,6 +267,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
// Invoke policy behaviour
|
// Invoke policy behaviour
|
||||||
invokeBeforeUpdateNode(parentRef);
|
invokeBeforeUpdateNode(parentRef);
|
||||||
invokeBeforeCreateNode(parentRef, assocTypeQName, assocQName, nodeTypeQName);
|
invokeBeforeCreateNode(parentRef, assocTypeQName, assocQName, nodeTypeQName);
|
||||||
|
invokeBeforeCreateNodeAssociation(parentRef, assocTypeQName, assocQName);
|
||||||
|
|
||||||
// get the store that the parent belongs to
|
// get the store that the parent belongs to
|
||||||
StoreRef storeRef = parentRef.getStoreRef();
|
StoreRef storeRef = parentRef.getStoreRef();
|
||||||
@@ -318,6 +319,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
|
|
||||||
// Invoke policy behaviour
|
// Invoke policy behaviour
|
||||||
invokeOnCreateNode(childAssocRef);
|
invokeOnCreateNode(childAssocRef);
|
||||||
|
invokeOnCreateNodeAssociation(childAssocRef);
|
||||||
invokeOnUpdateNode(parentRef);
|
invokeOnUpdateNode(parentRef);
|
||||||
if (propertiesAfter != null)
|
if (propertiesAfter != null)
|
||||||
{
|
{
|
||||||
|
@@ -31,15 +31,18 @@ public class AssociationPolicyRegistration extends PolicyRegistration
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void register()
|
public void register()
|
||||||
|
{
|
||||||
|
for (QName policyName : this.policyNames)
|
||||||
{
|
{
|
||||||
// Register the association behaviour
|
// Register the association behaviour
|
||||||
if (this.associationType == null)
|
if (this.associationType == null)
|
||||||
{
|
{
|
||||||
this.policyComponent.bindAssociationBehaviour(this.policyName, this.className, this.behaviour);
|
this.policyComponent.bindAssociationBehaviour(policyName, this.className, this.behaviour);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.policyComponent.bindAssociationBehaviour(this.policyName, this.className, this.associationType, this.behaviour);
|
this.policyComponent.bindAssociationBehaviour(policyName, this.className, this.associationType, this.behaviour);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3,6 +3,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.repo.policy.registration;
|
package org.alfresco.repo.policy.registration;
|
||||||
|
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deal with the registration of a class policy
|
* Deal with the registration of a class policy
|
||||||
*
|
*
|
||||||
@@ -16,9 +18,12 @@ public class ClassPolicyRegistration extends PolicyRegistration
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void register()
|
public void register()
|
||||||
|
{
|
||||||
|
for (QName policyName : this.policyNames)
|
||||||
{
|
{
|
||||||
// Register the class behaviour
|
// Register the class behaviour
|
||||||
this.policyComponent.bindClassBehaviour(this.policyName, this.className, this.behaviour);
|
this.policyComponent.bindClassBehaviour(policyName, this.className, this.behaviour);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -3,6 +3,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.repo.policy.registration;
|
package org.alfresco.repo.policy.registration;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.alfresco.repo.policy.Behaviour;
|
import org.alfresco.repo.policy.Behaviour;
|
||||||
import org.alfresco.repo.policy.PolicyComponent;
|
import org.alfresco.repo.policy.PolicyComponent;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
@@ -17,8 +20,8 @@ public abstract class PolicyRegistration
|
|||||||
/** The policy componenet **/
|
/** The policy componenet **/
|
||||||
protected PolicyComponent policyComponent;
|
protected PolicyComponent policyComponent;
|
||||||
|
|
||||||
/** The policy name **/
|
/** The policy names **/
|
||||||
protected QName policyName;
|
protected List<QName> policyNames;
|
||||||
|
|
||||||
/** The class name **/
|
/** The class name **/
|
||||||
protected QName className;
|
protected QName className;
|
||||||
@@ -43,7 +46,22 @@ public abstract class PolicyRegistration
|
|||||||
*/
|
*/
|
||||||
public void setPolicyName(String policyName)
|
public void setPolicyName(String policyName)
|
||||||
{
|
{
|
||||||
this.policyName = QName.createQName(policyName);
|
this.policyNames = new ArrayList<QName>(1);
|
||||||
|
this.policyNames.add(QName.createQName(policyName));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the policy names. The behaviour will be added for each for the policies.
|
||||||
|
*
|
||||||
|
* @param policyNames the policy names
|
||||||
|
*/
|
||||||
|
public void setPolicyNames(List<String> policyNames)
|
||||||
|
{
|
||||||
|
this.policyNames = new ArrayList<QName>(policyNames.size());
|
||||||
|
for (String policyName : policyNames)
|
||||||
|
{
|
||||||
|
this.policyNames.add(QName.createQName(policyName));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user