Java Code Examples for org.alfresco.service.cmr.action.Action#addActionCondition()
The following examples show how to use
org.alfresco.service.cmr.action.Action#addActionCondition() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActionServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * 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)); } } }
Example 2
Source File: BulkImportTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
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; }
Example 3
Source File: RuleServiceCoverageTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
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; }
Example 4
Source File: ActionServiceImplTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Evaluate action */ @Test 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)); }
Example 5
Source File: ThumbnailHelper.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
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); }
Example 6
Source File: BaseRuleTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
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; }
Example 7
Source File: RuleLinkTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
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; }
Example 8
Source File: ActionServiceImplTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Test 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)); }
Example 9
Source File: ThumbnailServiceImplTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
/** * Inbound rule must not be applied on failed thumbnail * * see MNT-10914 */ @Test 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); TestTransaction.flagForCommit(); TestTransaction.end(); 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)); }
Example 10
Source File: RuleServiceImplTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
@Commit @Test public void testCyclicAsyncRules() throws Exception { NodeRef nodeRef = createNewNode(this.rootNodeRef); // Create the first rule Map<String, Serializable> conditionProps = new HashMap<String, Serializable>(); conditionProps.put(ComparePropertyValueEvaluator.PARAM_VALUE, "*.jpg"); Map<String, Serializable> actionProps = new HashMap<String, Serializable>(); actionProps.put(ImageTransformActionExecuter.PARAM_MIME_TYPE, MimetypeMap.MIMETYPE_IMAGE_GIF); actionProps.put(ImageTransformActionExecuter.PARAM_DESTINATION_FOLDER, nodeRef); actionProps.put(ImageTransformActionExecuter.PARAM_ASSOC_TYPE_QNAME, ContentModel.ASSOC_CHILDREN); actionProps.put(ImageTransformActionExecuter.PARAM_ASSOC_QNAME, ContentModel.ASSOC_CHILDREN); Rule rule = new Rule(); rule.setRuleType(this.ruleType.getName()); rule.setTitle("Convert from *.jpg to *.gif"); rule.setExecuteAsynchronously(true); Action action = this.actionService.createAction(ImageTransformActionExecuter.NAME); action.setParameterValues(actionProps); ActionCondition actionCondition = this.actionService.createActionCondition(ComparePropertyValueEvaluator.NAME); actionCondition.setParameterValues(conditionProps); action.addActionCondition(actionCondition); rule.setAction(action); // Create the next rule Map<String, Serializable> conditionProps2 = new HashMap<String, Serializable>(); conditionProps2.put(ComparePropertyValueEvaluator.PARAM_VALUE, "*.gif"); Map<String, Serializable> actionProps2 = new HashMap<String, Serializable>(); actionProps2.put(ImageTransformActionExecuter.PARAM_MIME_TYPE, MimetypeMap.MIMETYPE_IMAGE_JPEG); actionProps2.put(ImageTransformActionExecuter.PARAM_DESTINATION_FOLDER, nodeRef); actionProps2.put(ImageTransformActionExecuter.PARAM_ASSOC_QNAME, ContentModel.ASSOC_CHILDREN); Rule rule2 = new Rule(); rule2.setRuleType(this.ruleType.getName()); rule2.setTitle("Convert from *.gif to *.jpg"); rule2.setExecuteAsynchronously(true); Action action2 = this.actionService.createAction(ImageTransformActionExecuter.NAME); action2.setParameterValues(actionProps2); ActionCondition actionCondition2 = this.actionService.createActionCondition(ComparePropertyValueEvaluator.NAME); actionCondition2.setParameterValues(conditionProps2); action2.addActionCondition(actionCondition2); rule2.setAction(action2); // Save the rules this.ruleService.saveRule(nodeRef, rule); this.ruleService.saveRule(nodeRef, rule); // Now create new content NodeRef contentNode = this.nodeService.createNode(nodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("{test}testnode"), ContentModel.TYPE_CONTENT).getChildRef(); this.nodeService.setProperty(contentNode, ContentModel.PROP_NAME, "myFile.jpg"); File file = AbstractContentTransformerTest.loadQuickTestFile("jpg"); ContentWriter writer = this.contentService.getWriter(contentNode, ContentModel.PROP_CONTENT, true); writer.setEncoding("UTF-8"); writer.setMimetype(MimetypeMap.MIMETYPE_IMAGE_JPEG); writer.putContent(file); //final NodeRef finalNodeRef = nodeRef; // Check to see what has happened // ActionServiceImplTest.postAsyncActionTest( // this.transactionService, // 10000, // 10, // new AsyncTest() // { // public boolean executeTest() // { // List<ChildAssociationRef> assocs = RuleServiceImplTest.this.nodeService.getChildAssocs(finalNodeRef); // for (ChildAssociationRef ref : assocs) // { // NodeRef child = ref.getChildRef(); // System.out.println("Child name: " + RuleServiceImplTest.this.nodeService.getProperty(child, ContentModel.PROP_NAME)); // } // // return true; // }; // }); }
Example 11
Source File: CopyServiceImplTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
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()); }
Example 12
Source File: ActionImplTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
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()); }
Example 13
Source File: ActionServiceImplTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
/** * Test execute action */ @Test 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)); }