mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ALF-3885: find multiple class behaviours through (super-)class hierarchy (not just first) - warning: pls review/test your registered (super-)class behaviours
Merged BRANCHES/DEV/WORKP1 to HEAD 21224: ALF-3885: find multiple class behaviours through type hierarchy (not just first) 21249: ALF-3885: follow-on to r21224 (to fix PersonServiceTest.testSplitDuplicates) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21253 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -38,6 +38,7 @@ import org.alfresco.repo.node.NodeServicePolicies;
|
||||
import org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy;
|
||||
import org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy;
|
||||
import org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy;
|
||||
import org.alfresco.repo.policy.BehaviourFilter;
|
||||
import org.alfresco.repo.policy.JavaBehaviour;
|
||||
import org.alfresco.repo.policy.PolicyComponent;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationException;
|
||||
@@ -114,6 +115,8 @@ public class PersonServiceImpl extends TransactionListenerAdapter implements Per
|
||||
private HomeFolderManager homeFolderManager;
|
||||
|
||||
private PolicyComponent policyComponent;
|
||||
|
||||
private BehaviourFilter policyBehaviourFilter;
|
||||
|
||||
private boolean createMissingPeople;
|
||||
|
||||
@@ -133,9 +136,6 @@ public class PersonServiceImpl extends TransactionListenerAdapter implements Per
|
||||
|
||||
private PermissionsManager permissionsManager;
|
||||
|
||||
// Behaviours
|
||||
JavaBehaviour onUpdatePropertiesBehaviour;
|
||||
|
||||
/** a transactionally-safe cache to be injected */
|
||||
private SimpleCache<String, Set<NodeRef>> personCache;
|
||||
|
||||
@@ -185,22 +185,21 @@ public class PersonServiceImpl extends TransactionListenerAdapter implements Per
|
||||
PropertyCheck.mandatory(this, "personCache", personCache);
|
||||
PropertyCheck.mandatory(this, "aclDao", aclDao);
|
||||
PropertyCheck.mandatory(this, "homeFolderManager", homeFolderManager);
|
||||
|
||||
|
||||
this.policyComponent.bindClassBehaviour(
|
||||
OnCreateNodePolicy.QNAME,
|
||||
ContentModel.TYPE_PERSON,
|
||||
new JavaBehaviour(this, "onCreateNode"));
|
||||
|
||||
this.policyComponent.bindClassBehaviour(
|
||||
BeforeDeleteNodePolicy.QNAME,
|
||||
ContentModel.TYPE_PERSON,
|
||||
new JavaBehaviour(this, "beforeDeleteNode"));
|
||||
|
||||
onUpdatePropertiesBehaviour = new JavaBehaviour(this, "onUpdateProperties");
|
||||
|
||||
this.policyComponent.bindClassBehaviour(
|
||||
OnUpdatePropertiesPolicy.QNAME,
|
||||
ContentModel.TYPE_PERSON,
|
||||
onUpdatePropertiesBehaviour);
|
||||
new JavaBehaviour(this, "onUpdateProperties"));
|
||||
}
|
||||
|
||||
public UserNameMatcher getUserNameMatcher()
|
||||
@@ -461,7 +460,7 @@ public class PersonServiceImpl extends TransactionListenerAdapter implements Per
|
||||
{
|
||||
try
|
||||
{
|
||||
onUpdatePropertiesBehaviour.disable();
|
||||
policyBehaviourFilter.disableBehaviour(ContentModel.TYPE_PERSON);
|
||||
|
||||
if (duplicateMode.equalsIgnoreCase(SPLIT))
|
||||
{
|
||||
@@ -485,7 +484,7 @@ public class PersonServiceImpl extends TransactionListenerAdapter implements Per
|
||||
}
|
||||
finally
|
||||
{
|
||||
onUpdatePropertiesBehaviour.enable();
|
||||
policyBehaviourFilter.enableBehaviour(ContentModel.TYPE_PERSON);
|
||||
}
|
||||
|
||||
// Done
|
||||
@@ -954,6 +953,11 @@ public class PersonServiceImpl extends TransactionListenerAdapter implements Per
|
||||
{
|
||||
this.policyComponent = policyComponent;
|
||||
}
|
||||
|
||||
public void setPolicyBehaviourFilter(BehaviourFilter policyBehaviourFilter)
|
||||
{
|
||||
this.policyBehaviourFilter = policyBehaviourFilter;
|
||||
}
|
||||
|
||||
public void setStoreUrl(String storeUrl)
|
||||
{
|
||||
|
Reference in New Issue
Block a user