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


Java CompositeAction.removeAction方法代码示例

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


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

示例1: testActionOrder

import org.alfresco.service.cmr.action.CompositeAction; //导入方法依赖的package包/类
public void testActionOrder()
{
    CompositeAction action = this.actionService.createCompositeAction();
    String actionId = action.getId();
    
    Action action1 = this.actionService.createAction(AddFeaturesActionExecuter.NAME);
    Action action2 = this.actionService.createAction(AddFeaturesActionExecuter.NAME);
    
    action.addAction(action1);
    action.addAction(action2);
    
    this.actionService.saveAction(this.nodeRef, action);
    CompositeAction savedAction = (CompositeAction)this.actionService.getAction(this.nodeRef, actionId);
    
    // Check that the conditions have been retrieved in the correct order
    assertNotNull(savedAction);
    assertEquals(action1, savedAction.getAction(0));
    assertEquals(action2, savedAction.getAction(1));
    
    Action action3 = this.actionService.createAction(AddFeaturesActionExecuter.NAME);
    Action action4 = this.actionService.createAction(AddFeaturesActionExecuter.NAME);
    
    // Update the conditions on the action
    savedAction.removeAction(action1);
    savedAction.addAction(action3);
    savedAction.addAction(action4);
    
    this.actionService.saveAction(this.nodeRef, savedAction);
    CompositeAction savedAction2 = (CompositeAction)this.actionService.getAction(this.nodeRef, actionId);
    
    // Check that the conditions are still in the correct order
    assertNotNull(savedAction2);
    assertEquals(action2, savedAction2.getAction(0));
    assertEquals(action3, savedAction2.getAction(1));
    assertEquals(action4, savedAction2.getAction(2));
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:37,代码来源:ActionServiceImplTest.java

示例2: testActions

import org.alfresco.service.cmr.action.CompositeAction; //导入方法依赖的package包/类
public void testActions()
{
    Action action1 = new ActionImpl(null, ACTION1_ID, ACTION1_NAME, null);
    Action action2 = new ActionImpl(null, ACTION2_ID, ACTION2_NAME, null);
    Action action3 = new ActionImpl(null, ACTION3_ID, ACTION3_NAME, null);
    
    CompositeAction compositeAction = new CompositeActionImpl(null, ID);
    
    // Check has no action
    assertFalse(compositeAction.hasActions());
    List<Action> noActions = compositeAction.getActions();
    assertNotNull(noActions);
    assertEquals(0, noActions.size());

    // Add actions
    compositeAction.addAction(action1);
    compositeAction.addAction(action2);
    compositeAction.addAction(action3);
    
    // Check that the actions that are there and in the correct order
    assertTrue(compositeAction.hasActions());
    List<Action> actions = compositeAction.getActions();
    assertNotNull(actions);
    assertEquals(3, actions.size());
    int counter = 0;
    for (Action action : actions)
    {
        if (counter == 0)
        {
            assertEquals(action1, action);
        }
        else if (counter == 1)
        {
            assertEquals(action2, action);
        }
        else if (counter == 2)
        {
            assertEquals(action3, action);
        }
        counter+=1;
    }        
    assertEquals(action1, compositeAction.getAction(0));
    assertEquals(action2, compositeAction.getAction(1));
    assertEquals(action3, compositeAction.getAction(2));
    
    // Check remove
    compositeAction.removeAction(action3);
    assertEquals(2, compositeAction.getActions().size());
    
    // Check set
    compositeAction.setAction(1, action3);
    assertEquals(action1, compositeAction.getAction(0));
    assertEquals(action3, compositeAction.getAction(1));
    
    // Check index of
    assertEquals(0, compositeAction.indexOfAction(action1));
    assertEquals(1, compositeAction.indexOfAction(action3));
    
    // Test insert
    compositeAction.addAction(1, action2);
    assertEquals(3, compositeAction.getActions().size());
    assertEquals(action1, compositeAction.getAction(0));
    assertEquals(action2, compositeAction.getAction(1));
    assertEquals(action3, compositeAction.getAction(2));
    
    // Check remote all
    compositeAction.removeAllActions();
    assertFalse(compositeAction.hasActions());
    assertEquals(0, compositeAction.getActions().size());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:71,代码来源:CompositeActionImplTest.java

示例3: testActions

import org.alfresco.service.cmr.action.CompositeAction; //导入方法依赖的package包/类
public void testActions()
  {
  	Action action1 = new ActionImpl(null, ACTION1_ID, ACTION1_NAME, null);
  	Action action2 = new ActionImpl(null, ACTION2_ID, ACTION2_NAME, null);
  	Action action3 = new ActionImpl(null, ACTION3_ID, ACTION3_NAME, null);

CompositeAction compositeAction = new CompositeActionImpl(null, ID);
  	
  	// Check has no action
  	assertFalse(compositeAction.hasActions());
  	List<Action> noActions = compositeAction.getActions();
  	assertNotNull(noActions);
  	assertEquals(0, noActions.size());
  
  	// Add actions
  	compositeAction.addAction(action1);
  	compositeAction.addAction(action2);
  	compositeAction.addAction(action3);
  	
  	// Check that the actions that are there and in the correct order
  	assertTrue(compositeAction.hasActions());
  	List<Action> actions = compositeAction.getActions();
  	assertNotNull(actions);
  	assertEquals(3, actions.size());
  	int counter = 0;
  	for (Action action : actions)
{
	if (counter == 0)
	{
		assertEquals(action1, action);
	}
	else if (counter == 1)
	{
		assertEquals(action2, action);
	}
	else if (counter == 2)
	{
		assertEquals(action3, action);
	}
	counter+=1;
}    	
  	assertEquals(action1, compositeAction.getAction(0));
  	assertEquals(action2, compositeAction.getAction(1));
  	assertEquals(action3, compositeAction.getAction(2));
  	
  	// Check remove
  	compositeAction.removeAction(action3);
  	assertEquals(2, compositeAction.getActions().size());
  	
  	// Check set
  	compositeAction.setAction(1, action3);
  	assertEquals(action1, compositeAction.getAction(0));
  	assertEquals(action3, compositeAction.getAction(1));
  	
  	// Check index of
  	assertEquals(0, compositeAction.indexOfAction(action1));
  	assertEquals(1, compositeAction.indexOfAction(action3));
  	
  	// Test insert
  	compositeAction.addAction(1, action2);
  	assertEquals(3, compositeAction.getActions().size());
  	assertEquals(action1, compositeAction.getAction(0));
  	assertEquals(action2, compositeAction.getAction(1));
  	assertEquals(action3, compositeAction.getAction(2));
  	
  	// Check remote all
  	compositeAction.removeAllActions();
  	assertFalse(compositeAction.hasActions());
  	assertEquals(0, compositeAction.getActions().size());
  }
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:71,代码来源:CompositeActionImplTest.java


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