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)
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:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2014 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -61,6 +61,7 @@ public class ComparePropertyValueEvaluatorTest extends BaseSpringTest
|
||||
private static final QName PROP_INT = QName.createQName(TEST_TYPE_NAMESPACE, "propInt");
|
||||
private static final QName PROP_DATETIME = QName.createQName(TEST_TYPE_NAMESPACE, "propDatetime");
|
||||
private static final QName PROP_NODEREF = QName.createQName(TEST_TYPE_NAMESPACE, "propNodeRef");
|
||||
private static final QName PROP_MULTI_VALUE = QName.createQName(TEST_TYPE_NAMESPACE, "propMultiValue");
|
||||
|
||||
private static final String TEXT_VALUE = "myDocument.doc";
|
||||
private static final int INT_VALUE = 100;
|
||||
@@ -122,6 +123,7 @@ public class ComparePropertyValueEvaluatorTest extends BaseSpringTest
|
||||
props.put(PROP_INT, INT_VALUE);
|
||||
props.put(PROP_DATETIME, this.dateValue);
|
||||
props.put(PROP_NODEREF, this.nodeValue);
|
||||
props.put(PROP_MULTI_VALUE, TEXT_VALUE);
|
||||
|
||||
// Create the node used for tests
|
||||
this.nodeRef = this.nodeService.createNode(
|
||||
@@ -492,6 +494,21 @@ public class ComparePropertyValueEvaluatorTest extends BaseSpringTest
|
||||
assertFalse(this.evaluator.evaluate(condition, this.nodeRef));
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void testMultiValuedPropertyComparisons()
|
||||
{
|
||||
ActionConditionImpl condition = new ActionConditionImpl(GUID.generate(), ComparePropertyValueEvaluator.NAME);
|
||||
condition.setParameterValue(ComparePropertyValueEvaluator.PARAM_PROPERTY, PROP_MULTI_VALUE);
|
||||
|
||||
condition.setParameterValue(ComparePropertyValueEvaluator.PARAM_OPERATION, ComparePropertyValueOperation.CONTAINS.toString());
|
||||
|
||||
condition.setParameterValue(ComparePropertyValueEvaluator.PARAM_VALUE, "Document");
|
||||
assertTrue(this.evaluator.evaluate(condition, this.nodeRef));
|
||||
|
||||
condition.setParameterValue(ComparePropertyValueEvaluator.PARAM_VALUE, "bobbins");
|
||||
assertFalse(this.evaluator.evaluate(condition, this.nodeRef));
|
||||
|
||||
}
|
||||
|
||||
private void createTestModel()
|
||||
@@ -524,7 +541,12 @@ public class ComparePropertyValueEvaluatorTest extends BaseSpringTest
|
||||
prop4.setMandatory(false);
|
||||
prop4.setType("d:" + DataTypeDefinition.NODE_REF.getLocalName());
|
||||
prop4.setMultiValued(false);
|
||||
|
||||
|
||||
M2Property prop5 = testType.createProperty("test:" + PROP_MULTI_VALUE.getLocalName());
|
||||
prop5.setMandatory(false);
|
||||
prop5.setType("d:" + DataTypeDefinition.TEXT.getLocalName());
|
||||
prop5.setMultiValued(true);
|
||||
|
||||
dictionaryDAO.putModel(model);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user