本文整理汇总了Java中org.alfresco.service.cmr.action.ParameterConstraint.getAllowableValues方法的典型用法代码示例。如果您正苦于以下问题:Java ParameterConstraint.getAllowableValues方法的具体用法?Java ParameterConstraint.getAllowableValues怎么用?Java ParameterConstraint.getAllowableValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.service.cmr.action.ParameterConstraint
的用法示例。
在下文中一共展示了ParameterConstraint.getAllowableValues方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processActionConstraints
import org.alfresco.service.cmr.action.ParameterConstraint; //导入方法依赖的package包/类
/**
* This method creates a list of {@link FieldConstraint field constraints}, if there are any.
*
* @return a List<FieldConstraint> if there are any, else Collections.emptyList()
*/
private List<FieldConstraint> processActionConstraints(ParameterDefinition parameterDef,
ActionService actionService)
{
List<FieldConstraint> fieldConstraints = Collections.emptyList();
String paramConstraintName = parameterDef.getParameterConstraintName();
if (paramConstraintName != null)
{
ParameterConstraint paramConstraint = actionService.getParameterConstraint(paramConstraintName);
if (paramConstraint == null)
{
throw new FormException("ParameterConstraint name '" + paramConstraintName + "' not recognised.");
}
else
{
// This map is of allowedValue : display label for that value.
Map<String, String> allowableValuesMap = paramConstraint.getAllowableValues();
// We need to concatenate each key-value entry into a String like "value|displaylabel"
// Then the FormService can display the labels but deal with the values as the underlying data.
List<String> pipeSeparatedAllowedValues = new ArrayList<String>(allowableValuesMap.size());
for (Map.Entry<String, String> entry : allowableValuesMap.entrySet())
{
pipeSeparatedAllowedValues.add(entry.getKey() + "|" + entry.getValue());
}
Map<String, Object> params = new HashMap<String, Object>();
params.put("allowedValues", pipeSeparatedAllowedValues);
// Finally wrap it up in a parameter map.
fieldConstraints = new ArrayList<FieldConstraint>(allowableValuesMap.size());
fieldConstraints.add(new FieldConstraint("LIST", params));
}
}
return fieldConstraints;
}
示例2: testCompareOperationsConstraint
import org.alfresco.service.cmr.action.ParameterConstraint; //导入方法依赖的package包/类
public void testCompareOperationsConstraint()
{
ParameterConstraint constraint = actionService.getParameterConstraint(COMPARE_OP);
assertNotNull(constraint);
assertEquals(COMPARE_OP, constraint.getName());
assertEquals("Ends With", constraint.getValueDisplayLabel(ComparePropertyValueOperation.ENDS.toString()));
Map<String, String> values = constraint.getAllowableValues();
for (Map.Entry<String, String> entry : values.entrySet())
{
System.out.println(entry.getKey() + " - " + entry.getValue());
}
}
示例3: testConstraint
import org.alfresco.service.cmr.action.ParameterConstraint; //导入方法依赖的package包/类
private void testConstraint(String name)
{
ParameterConstraint constraint = actionService.getParameterConstraint(name);
assertNotNull(constraint);
assertEquals(name, constraint.getName());
Map<String, String> values = constraint.getAllowableValues();
assertTrue(values.size()>0);
System.out.println("== " + name + " ==\n");
for (Map.Entry<String, String> entry : values.entrySet())
{
System.out.println(entry.getKey() + " - " + entry.getValue());
}
}