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


Java CompositeAction.addAction方法代码示例

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


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

示例1: getAction

import org.alfresco.service.cmr.action.CompositeAction; //导入方法依赖的package包/类
/**
 * Build the composite action in the context of the given node.
 * @param nodeRef  NodeRef
 * @return - the contextualised action.
 * 
 */
public Action getAction(NodeRef nodeRef)
{
    CompositeAction compositeAction = getActionService().createCompositeAction();
    for(TemplateActionDefinition tad : templateActionDefinitions)
    {   
        compositeAction.addAction(tad.getAction(nodeRef));
    }
    
    if (getCompensatingTemplateCompositeActionDefinition() != null)
    {
        compositeAction.setCompensatingAction(getCompensatingTemplateCompositeActionDefinition().getAction(nodeRef));
    }

    return compositeAction;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:CompositeTemplateActionDefinition.java

示例2: createScriptAction

import org.alfresco.service.cmr.action.CompositeAction; //导入方法依赖的package包/类
private Action createScriptAction()
{
    // get script nodeRef
    NodeRef storeRootNodeRef = nodeService.getRootNode(new StoreRef("workspace://SpacesStore"));
    NodeRef scriptRef = searchService.selectNodes(storeRootNodeRef, "/app:company_home/app:dictionary/app:scripts/cm:nothingToDo.js", null, namespaceService, false).get(0);
    assertNotNull("NodeRef script is null", scriptRef);

    // create action
    CompositeAction compositeAction = actionService.createCompositeAction();

    // add the action to the rule
    Action action = actionService.createAction("script");
    Map<String, Serializable> repoActionParams = new HashMap<String, Serializable>();
    repoActionParams.put("script-ref", scriptRef);
    action.setParameterValues(repoActionParams);
    compositeAction.addAction(action);
    
    return compositeAction;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:RuleServiceImplTest.java

示例3: populateCompositeAction

import org.alfresco.service.cmr.action.CompositeAction; //导入方法依赖的package包/类
/**
 * Populates a composite action from a composite action node reference
 * 
 * @param compositeNodeRef the composite action node reference
 * @param compositeAction the composite action
 */
public void populateCompositeAction(NodeRef compositeNodeRef, CompositeAction compositeAction)
{
    populateAction(compositeNodeRef, compositeAction);

    List<ChildAssociationRef> actions = this.nodeService.getChildAssocs(compositeNodeRef,
                RegexQNamePattern.MATCH_ALL, ActionModel.ASSOC_ACTIONS);
    for (ChildAssociationRef action : actions)
    {
        NodeRef actionNodeRef = action.getChildRef();
        compositeAction.addAction(createAction(actionNodeRef));
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:ActionServiceImpl.java

示例4: 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

示例5: testAsyncCompositeActionExecute

import org.alfresco.service.cmr.action.CompositeAction; //导入方法依赖的package包/类
/**
 * Test async composite action execution
 */
public void testAsyncCompositeActionExecute()
{
    // Create the composite action
    Action action1 = this.actionService.createAction(AddFeaturesActionExecuter.NAME);
    action1.setParameterValue(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, ContentModel.ASPECT_LOCKABLE);
    Action action2 = this.actionService.createAction(AddFeaturesActionExecuter.NAME);
    action2.setParameterValue(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, ContentModel.ASPECT_VERSIONABLE);        
    CompositeAction compAction = this.actionService.createCompositeAction();
    compAction.setTitle("title");
    compAction.setDescription("description");
    compAction.addAction(action1);
    compAction.addAction(action2);
    compAction.setExecuteAsynchronously(true);
    
    // Execute the composite action
    this.actionService.executeAction(compAction, this.nodeRef);
    
    setComplete();
    endTransaction();
    
    final NodeService finalNodeService = this.nodeService;
    final NodeRef finalNodeRef = this.nodeRef;
    
    postAsyncActionTest(
            this.transactionService,
            1000, 
            10, 
            new AsyncTest()
            {
                public String executeTest() 
                {
                    boolean result = finalNodeService.hasAspect(finalNodeRef, ContentModel.ASPECT_VERSIONABLE) &&
                    finalNodeService.hasAspect(finalNodeRef, ContentModel.ASPECT_LOCKABLE);
                    return result ? null : "Expected aspects Versionable & Lockable";
                };
            });
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:41,代码来源:ActionServiceImplTest.java

示例6: testAsyncCompositeActionExecute

import org.alfresco.service.cmr.action.CompositeAction; //导入方法依赖的package包/类
/**
 * Test async composite action execution
 */
public void testAsyncCompositeActionExecute()
{
    // Create the composite action
    Action action1 = this.actionService.createAction(AddFeaturesActionExecuter.NAME);
    action1.setParameterValue(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, ContentModel.ASPECT_LOCKABLE);
    Action action2 = this.actionService.createAction(AddFeaturesActionExecuter.NAME);
    action2.setParameterValue(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, ContentModel.ASPECT_VERSIONABLE);        
    CompositeAction compAction = this.actionService.createCompositeAction();
    compAction.setTitle("title");
    compAction.setDescription("description");
    compAction.addAction(action1);
    compAction.addAction(action2);
    compAction.setExecuteAsynchronously(true);
    
    // Execute the composite action
    this.actionService.executeAction(compAction, this.nodeRef);
    
    setComplete();
    endTransaction();
    
    final NodeService finalNodeService = this.nodeService;
    final NodeRef finalNodeRef = this.nodeRef;
    
    postAsyncActionTest(
            this.transactionService,
            1000, 
            10, 
            new AsyncTest()
            {
                public String executeTest() 
                {
                	boolean result = finalNodeService.hasAspect(finalNodeRef, ContentModel.ASPECT_VERSIONABLE) &&
                    finalNodeService.hasAspect(finalNodeRef, ContentModel.ASPECT_LOCKABLE);
                	return result ? null : "Expected aspects Versionable & Lockable";
                };
            });
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:41,代码来源:ActionServiceImplTest.java

示例7: testExecuteAction

import org.alfresco.service.cmr.action.CompositeAction; //导入方法依赖的package包/类
/**
 * Test execute action
 */
public void testExecuteAction()
{
    assertFalse(this.nodeService.hasAspect(this.nodeRef, ContentModel.ASPECT_VERSIONABLE));
    
    Action action = this.actionService.createAction(AddFeaturesActionExecuter.NAME);
    action.setParameterValue(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, ContentModel.ASPECT_VERSIONABLE);
    
    this.actionService.executeAction(action, this.nodeRef);
    assertTrue(this.nodeService.hasAspect(this.nodeRef, ContentModel.ASPECT_VERSIONABLE));
    
    this.nodeService.removeAspect(this.nodeRef, ContentModel.ASPECT_VERSIONABLE);
    assertFalse(this.nodeService.hasAspect(this.nodeRef, ContentModel.ASPECT_VERSIONABLE));
    
    ActionCondition condition = this.actionService.createActionCondition(ComparePropertyValueEvaluator.NAME);
    condition.setParameterValue(ComparePropertyValueEvaluator.PARAM_VALUE, "*.doc");
    action.addActionCondition(condition);
            
    this.actionService.executeAction(action, this.nodeRef);
    assertFalse(this.nodeService.hasAspect(this.nodeRef, ContentModel.ASPECT_VERSIONABLE));
    
    this.actionService.executeAction(action, this.nodeRef, true);
    assertFalse(this.nodeService.hasAspect(this.nodeRef, ContentModel.ASPECT_VERSIONABLE));
    
    this.actionService.executeAction(action, this.nodeRef, false);
    assertTrue(this.nodeService.hasAspect(this.nodeRef, ContentModel.ASPECT_VERSIONABLE));
    
    this.nodeService.removeAspect(this.nodeRef, ContentModel.ASPECT_VERSIONABLE);
    assertFalse(this.nodeService.hasAspect(this.nodeRef, ContentModel.ASPECT_VERSIONABLE));
    
    this.nodeService.setProperty(this.nodeRef, ContentModel.PROP_NAME, "myDocument.doc");
    this.actionService.executeAction(action, this.nodeRef);
    assertTrue(this.nodeService.hasAspect(this.nodeRef, ContentModel.ASPECT_VERSIONABLE));
    
    this.nodeService.removeAspect(this.nodeRef, ContentModel.ASPECT_VERSIONABLE);
    assertFalse(this.nodeService.hasAspect(this.nodeRef, ContentModel.ASPECT_VERSIONABLE));
    
    this.nodeService.removeAspect(this.nodeRef, ContentModel.ASPECT_VERSIONABLE);
    assertFalse(this.nodeService.hasAspect(this.nodeRef, ContentModel.ASPECT_VERSIONABLE));
    
    // Create the composite action
    Action action1 = this.actionService.createAction(AddFeaturesActionExecuter.NAME);
    action1.setParameterValue(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, ContentModel.ASPECT_LOCKABLE);
    Action action2 = this.actionService.createAction(AddFeaturesActionExecuter.NAME);
    action2.setParameterValue(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, ContentModel.ASPECT_VERSIONABLE);        
    CompositeAction compAction = this.actionService.createCompositeAction();
    compAction.setTitle("title");
    compAction.setDescription("description");
    compAction.addAction(action1);
    compAction.addAction(action2);
    
    // Execute the composite action
    this.actionService.executeAction(compAction, this.nodeRef);
    
    assertTrue(this.nodeService.hasAspect(this.nodeRef, ContentModel.ASPECT_LOCKABLE));
    assertTrue(this.nodeService.hasAspect(this.nodeRef, ContentModel.ASPECT_VERSIONABLE));
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:60,代码来源:ActionServiceImplTest.java

示例8: testSyncFailureBehaviour

import org.alfresco.service.cmr.action.CompositeAction; //导入方法依赖的package包/类
/**
 * Test sync failure behaviour
 */
public void testSyncFailureBehaviour()
{
    // Create an action that is going to fail
    Action action = createFailingMoveAction(true);
    
    try
    {
        this.actionService.executeAction(action, this.nodeRef);
        
        // Fail if we get there since the exception should have been raised
        fail("An exception should have been raised.");
    }
    catch (RuntimeException exception)
    {
        // Good!  The exception was raised correctly
    }
    
    // Test what happens when a element of a composite action fails (should raise and bubble up to parent bahviour)        
    // Create the composite action
    Action action1 = this.actionService.createAction(AddFeaturesActionExecuter.NAME);
    action1.setParameterValue(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, ContentModel.ASPECT_LOCKABLE);
    Action action2 = this.actionService.createAction(AddFeaturesActionExecuter.NAME);
    action2.setParameterValue(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, QName.createQName("{test}badDogAspect"));        
    CompositeAction compAction = this.actionService.createCompositeAction();
    compAction.setTitle("title");
    compAction.setDescription("description");
    compAction.addAction(action1);
    compAction.addAction(action2);
    
    try
    {
        // Execute the composite action
        this.actionService.executeAction(compAction, this.nodeRef);
        
        fail("An exception should have been raised here !!");
    }
    catch (RuntimeException runtimeException)
    {
        // Good! The exception was raised
    }        
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:45,代码来源:ActionServiceImplTest.java

示例9: 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

示例10: 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.addAction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。