mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)
90837: Merged V4.2-BUG-FIX (4.2.5) to HEAD-BUG-FIX (5.0/Cloud) 90751: Merged V4.2.4 (4.2.4) to V4.2-BUG-FIX (4.2.5) 90739: Merged DEV to PATCHES/V4.2.4 (4.2.4) 60205: MNT-9885: Rules not firing on some content saved in Alfresco drive - Incorrect RuleTrigger behavior is fixed. Rules that were ignored for content with sys:temporary aspect are now fired when this aspect is removed. - Required Unit tests were added. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@94724 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -18,7 +18,9 @@
|
||||
*/
|
||||
package org.alfresco.repo.rule.ruletrigger;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
@@ -43,8 +45,7 @@ public abstract class RuleTriggerAbstractBase implements RuleTrigger
|
||||
{
|
||||
/** the types (hardcoded) to ignore generally */
|
||||
private static final Set<QName> IGNORE_TYPES;
|
||||
/** the aspects (hardcoded) to ignore generally */
|
||||
private static final Set<QName> IGNORE_ASPECTS;
|
||||
|
||||
static
|
||||
{
|
||||
IGNORE_TYPES = new HashSet<QName>(13);
|
||||
@@ -54,15 +55,13 @@ public abstract class RuleTriggerAbstractBase implements RuleTrigger
|
||||
// Workaround to prevent rules running on cm:rating nodes (which happened for 'liked' folders ALF-8308 & ALF-8382)
|
||||
IGNORE_TYPES.add(ContentModel.TYPE_RATING);
|
||||
IGNORE_TYPES.add(ContentModel.TYPE_SYSTEM_FOLDER);
|
||||
|
||||
IGNORE_ASPECTS = new HashSet<QName>(13);
|
||||
IGNORE_ASPECTS.add(ContentModel.ASPECT_TEMPORARY);
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of the rule types that are interested in this trigger
|
||||
*/
|
||||
private Set<RuleType> ruleTypes = new HashSet<RuleType>();
|
||||
private Set<QName> ignoredAspects = Collections.emptySet();
|
||||
|
||||
protected PolicyComponent policyComponent;
|
||||
protected NodeService nodeService;
|
||||
@@ -183,7 +182,7 @@ public abstract class RuleTriggerAbstractBase implements RuleTrigger
|
||||
* @param actionedUponNodeRef actioned upon node reference
|
||||
* @return boolean true if the trigger should be ignored, false otherwise
|
||||
*/
|
||||
private boolean ignoreTrigger(NodeRef actionedUponNodeRef)
|
||||
protected boolean ignoreTrigger(NodeRef actionedUponNodeRef)
|
||||
{
|
||||
boolean result = false;
|
||||
QName typeQName = nodeService.getType(actionedUponNodeRef);
|
||||
@@ -191,7 +190,7 @@ public abstract class RuleTriggerAbstractBase implements RuleTrigger
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
for (QName aspectToIgnore : IGNORE_ASPECTS)
|
||||
for (QName aspectToIgnore : getIgnoredAspects())
|
||||
{
|
||||
if (nodeService.hasAspect(actionedUponNodeRef, aspectToIgnore))
|
||||
{
|
||||
@@ -200,4 +199,28 @@ public abstract class RuleTriggerAbstractBase implements RuleTrigger
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public Set<QName> getIgnoredAspects()
|
||||
{
|
||||
return ignoredAspects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converting String Aspects from Spring context to QNames
|
||||
*
|
||||
* @param ignoredAspects List of ignoredAspects
|
||||
*/
|
||||
public void setIgnoredAspectsStr(List<String> ignoredAspects)
|
||||
{
|
||||
this.ignoredAspects = new HashSet<>(13);
|
||||
|
||||
// MNT-9885 fix.
|
||||
// Converts String Aspects to QNames and adds it to ignoredAspects.
|
||||
// If afterDictionaryInit#DictionaryListener is used for setting up ignored Aspects from Spring context the
|
||||
// registerRuleTrigger#CreateNodeRuleTrigger is initialized before afterDictionaryInit#DictionaryListener
|
||||
for (String ignoredAspectStr : ignoredAspects)
|
||||
{
|
||||
this.ignoredAspects.add(QName.createQName(ignoredAspectStr));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user