当前位置: 首页>>代码示例>>Java>>正文


Java ParameterDefinition.getParameterConstraintName方法代码示例

本文整理汇总了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;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:42,代码来源:ActionParameterField.java

示例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());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:14,代码来源:ComparePropertyValueEvaluatorTest.java

示例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()
    );
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:12,代码来源:ActionsImpl.java


注:本文中的org.alfresco.service.cmr.action.ParameterDefinition.getParameterConstraintName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。