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


Java Action.addActionCondition方法代码示例

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


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

示例1: populateAction

import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
/**
 * Populate the details of the action from the node reference
 * 
 * @param actionNodeRef the action node reference
 * @param action the action
 */
private void populateAction(NodeRef actionNodeRef, Action action)
{
    // Populate the action properties
    populateActionProperties(actionNodeRef, action);

    // Set the parameters
    populateParameters(actionNodeRef, action);

    // Set the conditions
    List<ChildAssociationRef> conditions = this.nodeService.getChildAssocs(actionNodeRef,
                RegexQNamePattern.MATCH_ALL, ActionModel.ASSOC_CONDITIONS);

    if (logger.isDebugEnabled())
        logger.debug("Retrieving " + (conditions == null ? " null" : conditions.size()) + " conditions");

    if (conditions != null)
    {
        for (ChildAssociationRef condition : conditions)
        {
            NodeRef conditionNodeRef = condition.getChildRef();
            action.addActionCondition(createActionCondition(conditionNodeRef));
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:31,代码来源:ActionServiceImpl.java

示例2: createCopyRule

import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
protected Rule createCopyRule(NodeRef targetNode, boolean isAppliedToChildren)
{
    Rule rule = new Rule();
    rule.setRuleType(RuleType.INBOUND);
    String title = "rule title " + System.currentTimeMillis();
    rule.setTitle(title);
    rule.setDescription(title);
    rule.applyToChildren(isAppliedToChildren);

    Map<String, Serializable> params = new HashMap<String, Serializable>(1);
    params.put(MoveActionExecuter.PARAM_DESTINATION_FOLDER, targetNode);

    Action action = actionService.createAction(CopyActionExecuter.NAME, params);
    ActionCondition condition = actionService.createActionCondition(NoConditionEvaluator.NAME);
    action.addActionCondition(condition);
    rule.setAction(action);

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

示例3: createRule

import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
private Rule createRule(
		String ruleTypeName, 
		String actionName, 
		Map<String, Serializable> actionParams, 
		String conditionName, 
		Map<String, Serializable> conditionParams)
{
	Rule rule = new Rule();
       rule.setRuleType(ruleTypeName);        
       
       Action action = this.actionService.createAction(actionName, actionParams);        
       ActionCondition condition = this.actionService.createActionCondition(conditionName, conditionParams);
       action.addActionCondition(condition);
       rule.setAction(action);  
       
       return rule;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:RuleServiceCoverageTest.java

示例4: testEvaluateAction

import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
/**
 * Evaluate action
 */
public void testEvaluateAction()
{
    Action action = this.actionService.createAction(AddFeaturesActionExecuter.NAME);
    assertTrue(this.actionService.evaluateAction(action, this.nodeRef));
    
    ActionCondition condition = this.actionService.createActionCondition(ComparePropertyValueEvaluator.NAME);
    condition.setParameterValue(ComparePropertyValueEvaluator.PARAM_VALUE, "*.doc");
    action.addActionCondition(condition);
    
    assertFalse(this.actionService.evaluateAction(action, this.nodeRef));
    this.nodeService.setProperty(this.nodeRef, ContentModel.PROP_NAME, "myDocument.doc");
    assertTrue(this.actionService.evaluateAction(action, this.nodeRef));
    
    ActionCondition condition2 = this.actionService.createActionCondition(ComparePropertyValueEvaluator.NAME);
    condition2.setParameterValue(ComparePropertyValueEvaluator.PARAM_VALUE, "my");
    action.addActionCondition(condition2);
    assertTrue(this.actionService.evaluateAction(action, this.nodeRef));
    
    this.nodeService.setProperty(this.nodeRef, ContentModel.PROP_NAME, "document.doc");
    assertFalse(this.actionService.evaluateAction(action, this.nodeRef));
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:ActionServiceImplTest.java

示例5: decorateAction

import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
private static void decorateAction(ThumbnailDefinition thumbnailDef, Action action, ActionService actionService)
{
    final FailureHandlingOptions failureOptions = thumbnailDef.getFailureHandlingOptions();
    long retryPeriod = failureOptions == null ? FailureHandlingOptions.DEFAULT_PERIOD : failureOptions.getRetryPeriod() * 1000l;
    int retryCount = failureOptions == null ? FailureHandlingOptions.DEFAULT_RETRY_COUNT : failureOptions.getRetryCount();
    long quietPeriod = failureOptions == null ? FailureHandlingOptions.DEFAULT_PERIOD : failureOptions.getQuietPeriod() * 1000l;
    boolean quietPeriodRetriesEnabled = failureOptions == null ?
            FailureHandlingOptions.DEFAULT_QUIET_PERIOD_RETRIES_ENABLED : failureOptions.getQuietPeriodRetriesEnabled();
    
    // The thumbnail/action should only be run if it is eligible.
    Map<String, Serializable> failedThumbnailConditionParams = new HashMap<String, Serializable>();
    failedThumbnailConditionParams.put(NodeEligibleForRethumbnailingEvaluator.PARAM_THUMBNAIL_DEFINITION_NAME, thumbnailDef.getName());
    failedThumbnailConditionParams.put(NodeEligibleForRethumbnailingEvaluator.PARAM_RETRY_PERIOD, retryPeriod);
    failedThumbnailConditionParams.put(NodeEligibleForRethumbnailingEvaluator.PARAM_RETRY_COUNT, retryCount);
    failedThumbnailConditionParams.put(NodeEligibleForRethumbnailingEvaluator.PARAM_QUIET_PERIOD, quietPeriod);
    failedThumbnailConditionParams.put(NodeEligibleForRethumbnailingEvaluator.PARAM_QUIET_PERIOD_RETRIES_ENABLED, quietPeriodRetriesEnabled);
    
    ActionCondition thumbnailCondition = actionService.createActionCondition(NodeEligibleForRethumbnailingEvaluator.NAME, failedThumbnailConditionParams);
    

    // If it is run and if it fails, then we want a compensating action to run which will mark
    // the source node as having failed to produce a thumbnail.
    Action applyBrokenThumbnail = actionService.createAction("add-failed-thumbnail");
    applyBrokenThumbnail.setParameterValue(AddFailedThumbnailActionExecuter.PARAM_THUMBNAIL_DEFINITION_NAME, thumbnailDef.getName());
    applyBrokenThumbnail.setParameterValue(AddFailedThumbnailActionExecuter.PARAM_FAILURE_DATETIME, new Date());

    action.addActionCondition(thumbnailCondition);
    action.setCompensatingAction(applyBrokenThumbnail);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:30,代码来源:ThumbnailHelper.java

示例6: createTestRule

import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
protected Rule createTestRule(boolean isAppliedToChildren, String title)
{
    // Rule properties
    Map<String, Serializable> conditionProps = new HashMap<String, Serializable>();
    conditionProps.put(COND_PROP_NAME_1, COND_PROP_VALUE_1);

    Map<String, Serializable> actionProps = new HashMap<String, Serializable>();
    actionProps.put(ACTION_PROP_NAME_1, ACTION_PROP_VALUE_1);
    
    List<String> ruleTypes = new ArrayList<String>(1);
    ruleTypes.add(this.ruleType.getName());
    
    // Create the action
    Action action = this.actionService.createAction(CONDITION_DEF_NAME);
    action.setParameterValues(conditionProps);
    
    ActionCondition actionCondition = this.actionService.createActionCondition(CONDITION_DEF_NAME);
    actionCondition.setParameterValues(conditionProps);
    action.addActionCondition(actionCondition);
    
    // Create the rule
    Rule rule = new Rule();
    rule.setRuleTypes(ruleTypes);
    rule.setTitle(title);
    rule.setDescription(DESCRIPTION);
    rule.applyToChildren(isAppliedToChildren);        
    rule.setAction(action);

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

示例7: createTestRule

import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
protected Rule createTestRule(boolean isAppliedToChildren, String title)
{
    // Rule properties
    Map<String, Serializable> conditionProps = new HashMap<String, Serializable>();
    conditionProps.put(COND_PROP_NAME_1, COND_PROP_VALUE_1);

    Map<String, Serializable> actionProps = new HashMap<String, Serializable>();
    actionProps.put(ACTION_PROP_NAME_1, ACTION_PROP_VALUE_1);
    
    List<String> ruleTypes = new ArrayList<String>(1);
    ruleTypes.add(RULE_TYPE_NAME);
    
    // Create the action
    Action action = this.actionService.createAction(CONDITION_DEF_NAME);
    action.setParameterValues(conditionProps);
    
    ActionCondition actionCondition = this.actionService.createActionCondition(CONDITION_DEF_NAME);
    actionCondition.setParameterValues(conditionProps);
    action.addActionCondition(actionCondition);
    
    // Create the rule
    Rule rule = new Rule();
    rule.setRuleTypes(ruleTypes);
    rule.setTitle(title);
    rule.setDescription("bob");
    rule.applyToChildren(isAppliedToChildren);        
    rule.setAction(action);

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

示例8: testConditionOrder

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

示例9: testRuleExecutionOnFailedThumbnailChild

import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
/**
 * Inbound rule must not be applied on failed thumbnail
 * 
 * @see MNT-10914
 */
public void testRuleExecutionOnFailedThumbnailChild() throws Exception
{
    // create inbound rule on folder
    Map<String, Serializable> params = new HashMap<String, Serializable>(1);
    params.put("aspect-name", ContentModel.ASPECT_GEN_CLASSIFIABLE);
    Rule rule = new Rule();
    rule.setRuleType(RuleType.INBOUND);
    Action action = this.actionService.createAction(AddFeaturesActionExecuter.NAME, params);
    ActionCondition condition = this.actionService.createActionCondition(NoConditionEvaluator.NAME, null);
    action.addActionCondition(condition);
    rule.setAction(action);
    rule.applyToChildren(true);
    services.getRuleService().saveRule(folder, rule);

    setComplete();
    endTransaction();

    final NodeRef corruptNode = transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<NodeRef>()
    {
        public NodeRef execute() throws Throwable
        {
            return createCorruptedContent(folder);
        }
    });
    // Make sure the source node is correctly set up before we start
    // It should not be renditioned and should not be marked as having any failed thumbnails.
    assertFalse(secureNodeService.hasAspect(corruptNode, ContentModel.ASPECT_FAILED_THUMBNAIL_SOURCE));

    // Attempt to perform a thumbnail that we know will fail.
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
    {
        public Void execute() throws Throwable
        {
            ThumbnailDefinition thumbnailDef = thumbnailService.getThumbnailRegistry().getThumbnailDefinition("doclib");
            Action createThumbnailAction = ThumbnailHelper.createCreateThumbnailAction(thumbnailDef, services);
            actionService.executeAction(createThumbnailAction, corruptNode, true, true);
            return null;
        }
    });
    // The thumbnail attempt has now failed. But a compensating action should have been scheduled that will mark the
    // source node with a failure aspect. As that is an asynchronous action, we need to wait for that to complete.

    Thread.sleep(3000); // This should be long enough for the compensating action to run.

    final NodeRef failedThumbnailNode = transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<NodeRef>()
    {
        public NodeRef execute() throws Throwable
        {
            assertTrue("corrupt node should have failed thumbnails aspect", secureNodeService.hasAspect(corruptNode, ContentModel.ASPECT_FAILED_THUMBNAIL_SOURCE));

            Map<String, FailedThumbnailInfo> failedThumbnails = thumbnailService.getFailedThumbnails(corruptNode);
            assertEquals("Wrong number of failed thumbnails", 1, failedThumbnails.size());

            assertTrue("Missing QName for failed thumbnail", failedThumbnails.containsKey("doclib"));
            final FailedThumbnailInfo doclibFailureInfo = failedThumbnails.get("doclib");
            assertNotNull("Failure info was null", doclibFailureInfo);

            return doclibFailureInfo.getFailedThumbnailNode();
        }
    });

    assertTrue("Rule must not be executed on document", secureNodeService.hasAspect(corruptNode, ContentModel.ASPECT_GEN_CLASSIFIABLE));
    assertFalse("Rule must not be executed on failed thumbnail", secureNodeService.hasAspect(failedThumbnailNode, ContentModel.ASPECT_GEN_CLASSIFIABLE));
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:70,代码来源:ThumbnailServiceImplTest.java

示例10: testCopyNodeWithRules

import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
public void testCopyNodeWithRules()
    {
        // Create a new rule and add it to the source noderef
        Rule rule = new Rule();
        rule.setRuleType(RuleType.INBOUND);
        
        Map<String, Serializable> props = new HashMap<String, Serializable>(1);
        props.put(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, ContentModel.ASPECT_VERSIONABLE);
        Action action = actionService.createAction(AddFeaturesActionExecuter.NAME, props);
        rule.setAction(action);
        
        ActionCondition actionCondition = actionService.createActionCondition(NoConditionEvaluator.NAME);
        action.addActionCondition(actionCondition);
        
        ruleService.saveRule(sourceNodeRef, rule);
        assertNotNull(rule.getNodeRef());
        assertEquals(sourceNodeRef, ruleService.getOwningNodeRef(rule));
        
        //System.out.println(
        //        NodeStoreInspector.dumpNodeStore(nodeService, storeRef));
        //System.out.println(" ------------------------------ ");
        
        // Now copy the node that has rules associated with it
        NodeRef copy = copyService.copy(
                sourceNodeRef,
                rootNodeRef,
                ContentModel.ASSOC_CHILDREN,
                QName.createQName("{test}withRulesCopy"),
                true);
        
        //System.out.println(
         //          NodeStoreInspector.dumpNodeStore(nodeService, storeRef));
        
        checkCopiedNode(sourceNodeRef, copy, true, true, true);   
        
        assertTrue(nodeService.hasAspect(copy, RuleModel.ASPECT_RULES));
        assertTrue(ruleService.hasRules(copy));
        assertTrue(ruleService.rulesEnabled(copy));
        
        List<Rule> copiedRules = ruleService.getRules(copy);
        assertEquals(1, copiedRules.size());
        Rule copiedRule = copiedRules.get(0);
        
        assertNotNull(copiedRule.getNodeRef());
        assertFalse(copiedRule.getNodeRef().equals(rule.getNodeRef()));
        assertEquals(rule.getTitle(), copiedRule.getTitle());
        assertEquals(rule.getDescription(), copiedRule.getDescription());
        assertEquals(copy, ruleService.getOwningNodeRef(copiedRule));
        assertEquals(rule.getAction().getActionDefinitionName(), copiedRule.getAction().getActionDefinitionName());
        
        // Now copy the node without copying the children and check that the rules have been copied
        NodeRef copy2 = copyService.copy(
                sourceNodeRef,
                rootNodeRef,
                ContentModel.ASSOC_CHILDREN,
                QName.createQName("{test}withRuleCopyNoChildren"),
                false);
        
//      System.out.println(
        //         NodeStoreInspector.dumpNodeStore(nodeService, storeRef));        
        
        checkCopiedNode(sourceNodeRef, copy2, true, true, false);
        
        //assertTrue(configurableService.isConfigurable(copy2));
        //assertNotNull(configurableService.getConfigurationFolder(copy2));
        //assertFalse(configurableService.getConfigurationFolder(sourceNodeRef) == configurableService.getConfigurationFolder(copy2));
        
        assertTrue(nodeService.hasAspect(copy2, RuleModel.ASPECT_RULES));
        assertTrue(ruleService.hasRules(copy2));
        assertTrue(ruleService.rulesEnabled(copy2));
        List<Rule> copiedRules2 = ruleService.getRules(copy2);
        assertEquals(1, copiedRules.size());
        Rule copiedRule2 = copiedRules2.get(0);
        assertFalse(rule.getNodeRef().equals(copiedRule2.getNodeRef()));
        assertEquals(rule.getTitle(), copiedRule2.getTitle());
        assertEquals(rule.getDescription(), copiedRule2.getDescription());
        assertEquals(ruleService.getOwningNodeRef(copiedRule2), copy2);
        assertEquals(rule.getAction().getActionDefinitionName(), copiedRule2.getAction().getActionDefinitionName());                                
    }
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:80,代码来源:CopyServiceImplTest.java

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

示例12: testExecuteAction

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


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