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


Java Action.removeAllActionConditions方法代码示例

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


在下文中一共展示了Action.removeAllActionConditions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testActionConditions

import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
public void testActionConditions()
{
    ActionCondition cond1 = new ActionConditionImpl(ID_COND1, NAME_COND1, this.paramValues);
    ActionCondition cond2 = new ActionConditionImpl(ID_COND2, NAME_COND2, this.paramValues);
    ActionCondition cond3 = new ActionConditionImpl(ID_COND3, NAME_COND3, this.paramValues);
    
    Action action = (Action)create();
    
    // Check has no conditions
    assertFalse(action.hasActionConditions());
    List<ActionCondition> noConditions = action.getActionConditions();
    assertNotNull(noConditions);
    assertEquals(0, noConditions.size());

    // Add the conditions to the action
    action.addActionCondition(cond1);
    action.addActionCondition(cond2);
    action.addActionCondition(cond3);
    
    // Check that the conditions are there and in the correct order
    assertTrue(action.hasActionConditions());
    List<ActionCondition> actionConditions = action.getActionConditions();
    assertNotNull(actionConditions);
    assertEquals(3, actionConditions.size());
    int counter = 0;
    for (ActionCondition condition : actionConditions)
    {
        if (counter == 0)
        {
            assertEquals(cond1, condition);
        }
        else if (counter == 1)
        {
            assertEquals(cond2, condition);
        }
        else if (counter == 2)
        {
            assertEquals(cond3, condition);
        }
        counter+=1;
    }        
    assertEquals(cond1, action.getActionCondition(0));
    assertEquals(cond2, action.getActionCondition(1));
    assertEquals(cond3, action.getActionCondition(2));
    
    // Check remove
    action.removeActionCondition(cond3);
    assertEquals(2, action.getActionConditions().size());
    
    // Check set
    action.setActionCondition(1, cond3);
    assertEquals(cond1, action.getActionCondition(0));
    assertEquals(cond3, action.getActionCondition(1));
    
    // Check index of
    assertEquals(0, action.indexOfActionCondition(cond1));
    assertEquals(1, action.indexOfActionCondition(cond3));
    
    // Test insert
    action.addActionCondition(1, cond2);
    assertEquals(3, action.getActionConditions().size());
    assertEquals(cond1, action.getActionCondition(0));
    assertEquals(cond2, action.getActionCondition(1));
    assertEquals(cond3, action.getActionCondition(2));
    
    // Check remote all
    action.removeAllActionConditions();
    assertFalse(action.hasActionConditions());
    assertEquals(0, action.getActionConditions().size());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:71,代码来源:ActionImplTest.java


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