本文整理汇总了Java中org.alfresco.service.cmr.action.ParameterDefinition.getParameterConstraintName方法的典型用法代码示例。如果您正苦于以下问题:Java ParameterDefinition.getParameterConstraintName方法的具体用法?Java ParameterDefinition.getParameterConstraintName怎么用?Java ParameterDefinition.getParameterConstraintName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.service.cmr.action.ParameterDefinition
的用法示例。
在下文中一共展示了ParameterDefinition.getParameterConstraintName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processActionConstraints
import org.alfresco.service.cmr.action.ParameterDefinition; //导入方法依赖的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: testCheckParamDefintionWithConstraint
import org.alfresco.service.cmr.action.ParameterDefinition; //导入方法依赖的package包/类
public void testCheckParamDefintionWithConstraint()
{
ActionConditionDefinition def = evaluator.getActionConditionDefintion();
assertEquals(ComparePropertyValueEvaluator.NAME, def.getName());
ParameterDefinition paramDef = def.getParameterDefintion(ComparePropertyValueEvaluator.PARAM_OPERATION);
assertNotNull(paramDef);
assertEquals(ComparePropertyValueEvaluator.PARAM_OPERATION, paramDef.getName());
String constraintName = paramDef.getParameterConstraintName();
assertNotNull(constraintName);
ParameterConstraint paramConstraint = actionService.getParameterConstraint(constraintName);
assertNotNull(paramConstraint);
assertEquals("ac-compare-operations", paramConstraint.getName());
}
示例3: toModel
import org.alfresco.service.cmr.action.ParameterDefinition; //导入方法依赖的package包/类
private ActionDefinition.ParameterDefinition toModel(ParameterDefinition p)
{
return new ActionDefinition.ParameterDefinition(
p.getName(),
toShortQName(p.getType()),
p.isMultiValued(),
p.isMandatory(),
p.getDisplayLabel(),
p.getParameterConstraintName()
);
}