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


Java ParameterConstraint类代码示例

本文整理汇总了Java中org.alfresco.service.cmr.action.ParameterConstraint的典型用法代码示例。如果您正苦于以下问题:Java ParameterConstraint类的具体用法?Java ParameterConstraint怎么用?Java ParameterConstraint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ParameterConstraint类属于org.alfresco.service.cmr.action包,在下文中一共展示了ParameterConstraint类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: executeImpl

import org.alfresco.service.cmr.action.ParameterConstraint; //导入依赖的package包/类
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
{
    Map<String, Object> model = new HashMap<String, Object>();

    // get request parameters
    Map<String, String> templateVars = req.getServiceMatch().getTemplateVars();
    String name = templateVars.get("name");

    // get specified parameter constraint
    ParameterConstraint parameterConstraint = actionService.getParameterConstraint(name);

    if (parameterConstraint == null)
    {
        throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find parameter constraint with name: " + name);
    }

    model.put("actionConstraint", parameterConstraint);

    return model;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:22,代码来源:ActionConstraintGet.java

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

示例3: testGetConstraints

import org.alfresco.service.cmr.action.ParameterConstraint; //导入依赖的package包/类
public void testGetConstraints()
{
    List<ParameterConstraint> constraints =  actionService.getParameterConstraints();
    
    assertNotNull(constraints);
    assertFalse(constraints.isEmpty());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:8,代码来源:ActionParameterConstraintTest.java

示例4: testGetConstraint

import org.alfresco.service.cmr.action.ParameterConstraint; //导入依赖的package包/类
public void testGetConstraint()
{
    ParameterConstraint constraint = actionService.getParameterConstraint("junk");        
    assertNull(constraint);
    
    constraint = actionService.getParameterConstraint(COMPARE_OP);        
    assertNotNull(constraint);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:9,代码来源:ActionParameterConstraintTest.java

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

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

示例7: testCheckParamDefintionWithConstraint

import org.alfresco.service.cmr.action.ParameterConstraint; //导入依赖的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

示例8: testParameterConstraints

import org.alfresco.service.cmr.action.ParameterConstraint; //导入依赖的package包/类
@Test
public void testParameterConstraints() throws Exception
{
    List<ParameterConstraint> constraints = actionService.getParameterConstraints();
    assertNotNull(constraints);
    if (constraints.size() > 0)
    {
        ParameterConstraint parameterConstraint = constraints.get(0);
        ParameterConstraint pConstraintAgain = actionService.getParameterConstraint(parameterConstraint.getName());
        Assert.assertEquals(parameterConstraint, pConstraintAgain);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:13,代码来源:ActionServiceImpl2Test.java

示例9: executeImpl

import org.alfresco.service.cmr.action.ParameterConstraint; //导入依赖的package包/类
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
{
    Map<String, Object> model = new HashMap<String, Object>();

    // get request parameters
    String[] names = req.getParameterValues("name");

    List<ParameterConstraint> parameterConstraints = null;

    if (names != null && names.length > 0)
    {
        // filter is present in request
        parameterConstraints = new ArrayList<ParameterConstraint>();

        // find specified parameter constraints
        for (String name : names)
        {
            ParameterConstraint parameterConstraint = actionService.getParameterConstraint(name);

            if (parameterConstraint != null)
            {
                parameterConstraints.add(parameterConstraint);
            }
        }
    }
    else
    {
        // no filter was provided, return all parameter constraints
        parameterConstraints = actionService.getParameterConstraints();
    }

    model.put("actionConstraints", parameterConstraints);

    return model;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:37,代码来源:ActionConstraintsGet.java

示例10: getParameterConstraint

import org.alfresco.service.cmr.action.ParameterConstraint; //导入依赖的package包/类
/**
 * @see org.alfresco.service.cmr.action.ActionService#getParameterConstraint(java.lang.String)
 */
public ParameterConstraint getParameterConstraint(String name)
{
    return this.parameterConstraints.get(name);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:8,代码来源:ActionServiceImpl.java

示例11: getParameterConstraints

import org.alfresco.service.cmr.action.ParameterConstraint; //导入依赖的package包/类
/**
 * @see org.alfresco.service.cmr.action.ActionService#getParameterConstraints()
 */
public List<ParameterConstraint> getParameterConstraints()
{
    return new ArrayList<ParameterConstraint>(this.parameterConstraints.values());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:8,代码来源:ActionServiceImpl.java

示例12: registerParameterConstraint

import org.alfresco.service.cmr.action.ParameterConstraint; //导入依赖的package包/类
/**
 * @see org.alfresco.repo.action.RuntimeActionService#registerParameterConstraint(org.alfresco.service.cmr.action.ParameterConstraint)
 */
public void registerParameterConstraint(ParameterConstraint parameterConstraint)
{
    this.parameterConstraints.put(parameterConstraint.getName(), parameterConstraint);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:8,代码来源:ActionServiceImpl.java

示例13: testGetActionConstraint

import org.alfresco.service.cmr.action.ParameterConstraint; //导入依赖的package包/类
public void testGetActionConstraint() throws Exception
{

    List<ParameterConstraint> constraints = actionService.getParameterConstraints();

    if (constraints.size() == 0)
    {
        return;
    }

    String name = constraints.get(0).getName();

    Response response = sendRequest(new GetRequest(formateActionConstraintUrl(name)), 200);
    JSONObject result = new JSONObject(response.getContentAsString());

    assertNotNull(result);

    assertTrue(result.has("data"));

    JSONObject data = result.getJSONObject("data");

    assertTrue(data.has("name"));
    assertTrue(data.has("values"));

    JSONArray values = data.getJSONArray("values");

    for (int i = 0; i < values.length(); i++)
    {
        JSONObject value = values.getJSONObject(i);

        assertTrue(value.has("value"));
        assertTrue(value.has("displayLabel"));
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:35,代码来源:RuleServiceTest.java

示例14: registerParameterConstraint

import org.alfresco.service.cmr.action.ParameterConstraint; //导入依赖的package包/类
/**
 * Register parameter constraint
 *     
 * @param parameterConstraint  parameter constraint
 */
void registerParameterConstraint(ParameterConstraint parameterConstraint);
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:7,代码来源:RuntimeActionService.java


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