mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged DEV to HEAD
31489: Fix MT NodeRef translation in policy filter (ALF-10178) 31452: Sync DEV branch with HEAD 30312: Reintegrated HEAD 30281: Comprehensive DEBUG logging to track behaviour enable/disable states for transactions - Part of ALF-10178: BehaviourFilter fails when nesting disable/enable calls 30280: Fixed importer's use of behaviour filter - The change in the BehaviourFilter contract means that all disable calls must be matched with an equivalent enable call. Enabling globally no longer wipes out vetos put in place by other code. - Part of ALF-10178: BehaviourFilter fails when nesting disable/enable calls 30279: Removed unnecessary behaviour enablement checks is VersionService (ALF-10178) 30278: Fixed behaviour re-enabling for StoreSelectorAspectContentStore (ALF-10178) 30240: Fixed ALF-10178: BehaviourFilter fails when nesting disable/enable calls - Behaviour enable/disable now uses reference counting to check the state of different behaviour levels - Added unit test to test - Re-enabled test for ALF-10177: Test disabled: CheckOutCheckInServiceImplTest.testalfrescoCheckoutDoesntModifyNode but renamed to CheckOutCheckInServiceImplTest.testAlfrescoCheckoutDoesNotModifyNode - Going into DEV branch to run through tests 30236: Branch for fixing BehaviourFilter nesting git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31619 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -20,7 +20,9 @@ package org.alfresco.repo.audit;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.policy.BehaviourFilter;
|
||||
@@ -32,7 +34,7 @@ import org.aopalliance.intercept.MethodInvocation;
|
||||
/**
|
||||
* An interceptor that disables and then enables ASPECT_AUDITABLE behaviours
|
||||
* around method calls.
|
||||
*
|
||||
* <ul>
|
||||
* <li>The name of the method must match a supplied list (See
|
||||
* {@link #setMethodNames(List)}).</li>
|
||||
* <li>For this interceptor to disable and enable policy behaviour, the first
|
||||
@@ -42,16 +44,18 @@ import org.aopalliance.intercept.MethodInvocation;
|
||||
* values (See {@link #setArgumentValues(List)}. The second argument must be
|
||||
* a QName. If a list is not supplied the second argument is not checked.</li>
|
||||
* <li>The BehaviourFilter to be enabled or disabled must be set (See
|
||||
* {@link #setBehaviourFilter(BehaviourFilter)}).
|
||||
* {@link #setBehaviourFilter(BehaviourFilter)}).</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Stas Sokolovsky
|
||||
*/
|
||||
public class DisableAuditableBehaviourInterceptor implements MethodInterceptor
|
||||
{
|
||||
private BehaviourFilter behaviourFilter;
|
||||
private List<String> methodNames;
|
||||
private List<String> argumentValues;
|
||||
private Set<String> methodNames = new HashSet<String>(0);
|
||||
private Set<QName> argumentQNameValues = new HashSet<QName>(0);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object invoke(MethodInvocation methodInvocation) throws Throwable
|
||||
{
|
||||
String methodName = methodInvocation.getMethod().getName();
|
||||
@@ -77,7 +81,7 @@ public class DisableAuditableBehaviourInterceptor implements MethodInterceptor
|
||||
|
||||
if (behaviourFilter != null &&
|
||||
methodNames.contains(methodName) &&
|
||||
(arg1 == null || argumentValues.contains(arg1.toString())))
|
||||
(arg1 == null || argumentQNameValues.contains(arg1)))
|
||||
{
|
||||
for (NodeRef nodeRef : nodes)
|
||||
{
|
||||
@@ -108,11 +112,16 @@ public class DisableAuditableBehaviourInterceptor implements MethodInterceptor
|
||||
|
||||
public void setMethodNames(List<String> methodNames)
|
||||
{
|
||||
this.methodNames = methodNames;
|
||||
this.methodNames = new HashSet<String>(methodNames);
|
||||
}
|
||||
|
||||
public void setArgumentValues(List<String> argumentValues)
|
||||
{
|
||||
this.argumentValues = argumentValues;
|
||||
this.argumentQNameValues = new HashSet<QName>(argumentValues.size()*2+1);
|
||||
for (String argumentValue : argumentValues)
|
||||
{
|
||||
QName argumentQNameValue = QName.createQName(argumentValue);
|
||||
argumentQNameValues.add(argumentQNameValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user