Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)

90995: Merged V4.2-BUG-FIX (4.2.5) to HEAD-BUG-FIX (5.0/Cloud)
      90951: Merged DEV (4.2.2) to V4.2-BUG-FIX (4.2.5)
         64813: MNT-10944 : Rules doesnt work with multiple custom property
         Added code to property value comparator to support multi valued properties.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@94758 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2015-01-31 11:10:16 +00:00
parent f3b20655c4
commit c10e66fae2
2 changed files with 45 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
* Copyright (C) 2005-2014 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -19,6 +19,7 @@
package org.alfresco.repo.action.evaluator;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -258,8 +259,25 @@ public class ComparePropertyValueEvaluator extends ActionConditionEvaluatorAbstr
PropertyValueComparator comparator = this.comparators.get(propertyTypeQName);
if (comparator != null)
{
// Call the comparator for the property type
result = comparator.compare(propertyValue, compareValue, operation);
// Figure out if property is multivalued, compare all of the entries till finding a match
PropertyDefinition propertyDef = dictionaryService.getProperty(propertyQName);
if (propertyDef.isMultiValued())
{
for(Serializable value : ((ArrayList<Serializable>) propertyValue))
{
boolean success = comparator.compare(value, compareValue, operation);
if (success)
{
result = true;
break;
}
}
}
else
{
// Call the comparator for the property type
result = comparator.compare(propertyValue, compareValue, operation);
}
}
else
{