org.alfresco.service.cmr.action.Action Java Examples
The following examples show how to use
org.alfresco.service.cmr.action.Action.
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: AbstractRenderingEngine.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
protected void executeRenditionImpl(Action action, NodeRef sourceNode) { if (logger.isDebugEnabled()) { StringBuilder msg = new StringBuilder(); msg.append("Executing rendering engine; name:") .append(this.name).append(", class:") .append(this.getClass().getName()); logger.debug(msg.toString()); } checkParameterValues(action); RenditionDefinition renditionDefinition = checkActionIsRenditionDefinition(action); checkSourceNodeExists(sourceNode); QName targetContentProp = getRenditionContentProperty(renditionDefinition); RenderingContext context = new RenderingContext(sourceNode, renditionDefinition, targetContentProp); render(context); // This is a workaround for the fact that actions don't have return // values. action.getParameterValues().put(PARAM_RESULT, context.getChildAssociationRef()); }
Example #2
Source File: RuleServiceImplTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
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; }
Example #3
Source File: AbstractMailActionExecuterTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Test public void testUnknownRecipientUnknownSender_ToMany() throws IOException, MessagingException { // PARAM_TO_MANY variant - this code path currently has separate validation FIXME fix this. Action mailAction = ACTION_SERVICE.createAction(MailActionExecuter.NAME); mailAction.setParameterValue(MailActionExecuter.PARAM_FROM, "[email protected]"); mailAction.setParameterValue(MailActionExecuter.PARAM_TO_MANY, "[email protected]"); mailAction.setParameterValue(MailActionExecuter.PARAM_SUBJECT, "Testing"); mailAction.setParameterValue(MailActionExecuter.PARAM_TEMPLATE, "alfresco/templates/mail/test.txt.ftl"); mailAction.setParameterValue(MailActionExecuter.PARAM_TEMPLATE_MODEL, (Serializable) getModel()); ACTION_SERVICE.executeAction(mailAction, null); MimeMessage message = ACTION_EXECUTER.retrieveLastTestMessage(); Assert.assertNotNull(message); Assert.assertEquals("Hello Jan 1, 1970", (String) message.getContent()); }
Example #4
Source File: CompositeTemplateActionDefinition.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * 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; }
Example #5
Source File: ErrorProneActionExecutor.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Send an email message * * @throws AlfrescoRuntimeException */ @Override protected void executeImpl( final Action ruleAction, final NodeRef actionedUponNodeRef) { NodeRef failingPersonNodeRef = (NodeRef)ruleAction.getParameterValue(PARAM_FAILING_PERSON_NODEREF); NodeRef personNodeRef = (NodeRef)ruleAction.getParameterValue(PARAM_PERSON_NODEREF); String userName = (String)ruleAction.getParameterValue(PARAM_USERNAME); System.out.println("userName = " + userName); if(personNodeRef.equals(failingPersonNodeRef)) { numFailed.incrementAndGet(); throw new AlfrescoRuntimeException(""); } numSuccessful.incrementAndGet(); }
Example #6
Source File: RenditionDefinitionPersisterImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
public List<RenditionDefinition> loadRenditionDefinitions() { checkRenderingActionRootNodeExists(); // Note that in the call to getChildAssocs below, only the specified // types are included. // Subtypes of the type action:action will not be returned. Set<QName> actionTypes = new HashSet<QName>(); actionTypes.add(ActionModel.TYPE_ACTION); List<ChildAssociationRef> childAssocs = nodeService.getChildAssocs(RENDERING_ACTION_ROOT_NODE_REF, actionTypes); List<RenditionDefinition> renderingActions = new ArrayList<RenditionDefinition>(childAssocs.size()); for (ChildAssociationRef actionAssoc : childAssocs) { Action nextAction = runtimeActionService.createAction(actionAssoc.getChildRef()); renderingActions.add(new RenditionDefinitionImpl(nextAction)); } return renderingActions; }
Example #7
Source File: RuleServiceTest.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 6 votes |
public void testGetRuleset() throws Exception { JSONObject parentRule = createRule(testWorkNodeRef); String[] parentRuleIds = new String[] { parentRule.getJSONObject("data").getString("id") }; JSONObject jsonRule = createRule(testNodeRef); String[] ruleIds = new String[] { jsonRule.getJSONObject("data").getString("id") }; Action linkRulesAction = actionService.createAction(LinkRules.NAME); linkRulesAction.setParameterValue(LinkRules.PARAM_LINK_FROM_NODE, testNodeRef); actionService.executeAction(linkRulesAction, testNodeRef2); Response linkedFromResponse = sendRequest(new GetRequest(formatRulesetUrl(testNodeRef)), 200); JSONObject linkedFromResult = new JSONObject(linkedFromResponse.getContentAsString()); checkRuleset(linkedFromResult, 1, ruleIds, 1, parentRuleIds, true, false); Response linkedToResponse = sendRequest(new GetRequest(formatRulesetUrl(testNodeRef2)), 200); JSONObject linkedToResult = new JSONObject(linkedToResponse.getContentAsString()); checkRuleset(linkedToResult, 1, ruleIds, 1, parentRuleIds, false, true); }
Example #8
Source File: CounterIncrementActionExecuter.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) */ protected void executeImpl(Action action, NodeRef actionedUponNodeRef) { // add the cm:countable aspect as required if (this.nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_COUNTABLE) == false) { // set the value to 1 by default Map<QName, Serializable> props = new HashMap<QName, Serializable>(1); props.put(ContentModel.PROP_COUNTER, 1); this.nodeService.addAspect(actionedUponNodeRef, ContentModel.ASPECT_COUNTABLE, props); } else { // increment the value and handle possibility that no value has been set yet int resultValue = 1; Integer value = (Integer)this.nodeService.getProperty(actionedUponNodeRef, ContentModel.PROP_COUNTER); if (value != null) { resultValue = value.intValue() + 1; } this.nodeService.setProperty(actionedUponNodeRef, ContentModel.PROP_COUNTER, resultValue); } }
Example #9
Source File: InviteNominatedSender.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void sendMail(String emailTemplateXpath, String emailSubjectKey, Map<String, String> properties) { checkProperties(properties); ParameterCheck.mandatory("Properties", properties); NodeRef inviter = personService.getPerson(properties.get(wfVarInviterUserName)); String inviteeName = properties.get(wfVarInviteeUserName); NodeRef invitee = personService.getPerson(inviteeName); Action mail = actionService.createAction(MailActionExecuter.NAME); mail.setParameterValue(MailActionExecuter.PARAM_FROM, getEmail(inviter)); mail.setParameterValue(MailActionExecuter.PARAM_TO, getEmail(invitee)); mail.setParameterValue(MailActionExecuter.PARAM_SUBJECT, emailSubjectKey); mail.setParameterValue(MailActionExecuter.PARAM_SUBJECT_PARAMS, new Object[] { ModelUtil.getProductName(repoAdminService), getSiteName(properties) }); mail.setParameterValue(MailActionExecuter.PARAM_TEMPLATE, getEmailTemplateNodeRef(emailTemplateXpath)); mail.setParameterValue(MailActionExecuter.PARAM_TEMPLATE_MODEL, (Serializable) buildMailTextModel(properties)); mail.setParameterValue(MailActionExecuter.PARAM_IGNORE_SEND_FAILURE, true); actionService.executeAction(mail, getWorkflowPackage(properties)); }
Example #10
Source File: ActionFormProcessor.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Override protected Object makeItemData(ActionDefinition item) { ActionItemData actionItemData = null; try { Action action = actionService.createAction(item.getName()); actionItemData = new ActionItemData(item, action); } catch (NoSuchBeanDefinitionException nsbdx) { throw new FormException("Failed to create action '" + item.getName() + "'", nsbdx); } return actionItemData; }
Example #11
Source File: ActionServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * @see org.alfresco.service.cmr.action.ActionService#executeAction(org.alfresco.service.cmr.action.Action, * org.alfresco.service.cmr.repository.NodeRef, boolean) */ public void executeAction(Action action, NodeRef actionedUponNodeRef, boolean checkConditions, boolean executeAsychronously) { Set<String> actionChain = this.currentActionChain.get(); if (executeAsychronously == false) { executeActionImpl(action, actionedUponNodeRef, checkConditions, false, actionChain); } else { // Add to the post transaction pending action list addPostTransactionPendingAction(action, actionedUponNodeRef, checkConditions, actionChain); } }
Example #12
Source File: ActionServiceImplTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Test remove action */ @Test public void testRemove() { assertEquals(0, this.actionService.getActions(this.nodeRef).size()); Action action1 = this.actionService.createAction(AddFeaturesActionExecuter.NAME); this.actionService.saveAction(this.nodeRef, action1); Action action2 = this.actionService.createAction(CheckInActionExecuter.NAME); this.actionService.saveAction(this.nodeRef, action2); assertEquals(2, this.actionService.getActions(this.nodeRef).size()); this.actionService.removeAction(this.nodeRef, action1); assertEquals(1, this.actionService.getActions(this.nodeRef).size()); this.actionService.removeAllActions(this.nodeRef); assertEquals(0, this.actionService.getActions(this.nodeRef).size()); }
Example #13
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 #14
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 #15
Source File: CheckInActionExecuter.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * @see org.alfresco.repo.action.executer.ActionExecuter#execute(Action, org.alfresco.service.cmr.repository.NodeRef) */ public void executeImpl(Action ruleAction, NodeRef actionedUponNodeRef) { // First ensure that the actionedUponNodeRef is a workingCopy if (this.nodeService.exists(actionedUponNodeRef) == true && this.nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY) == true) { // Get the version description String description = (String)ruleAction.getParameterValue(PARAM_DESCRIPTION); Map<String, Serializable> versionProperties = new HashMap<String, Serializable>(1); versionProperties.put(Version.PROP_DESCRIPTION, description); // determine whether the change is minor or major Boolean minorChange = (Boolean)ruleAction.getParameterValue(PARAM_MINOR_CHANGE); if (minorChange != null && minorChange.booleanValue() == false) { versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR); } else { versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); } // TODO determine whether the document should be kept checked out // Check the node in this.cociService.checkin(actionedUponNodeRef, versionProperties); } }
Example #16
Source File: ImapContentPolicy.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * Called when the imap:imapContent aspect is applied * * @param nodeRef The node the aspect is being applied to * @param aspectTypeQName The type of aspect being applied (should be imap:imapContent) */ public void onAddAspect(NodeRef nodeRef, QName aspectTypeQName) { // ensure the aspect is the one we expect if (aspectTypeQName.equals(ImapModel.ASPECT_IMAP_CONTENT)) { Action action = getActionService().createAction(ContentMetadataExtracter.EXECUTOR_NAME); if(action != null) { getActionService().executeAction(action, nodeRef); } } }
Example #17
Source File: RepositoryExporterActionExecuter.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * @see org.alfresco.repo.action.executer.ActionExecuter#execute(Action, NodeRef) */ public void executeImpl(Action ruleAction, NodeRef actionedUponNodeRef) { String packageName = (String)ruleAction.getParameterValue(PARAM_PACKAGE_NAME); NodeRef repoDestination = (NodeRef)ruleAction.getParameterValue(PARAM_DESTINATION_FOLDER); exporterService.export(repoDestination, packageName); }
Example #18
Source File: SimpleWorkflowActionExecuter.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(Action, org.alfresco.service.cmr.repository.NodeRef) */ @Override protected void executeImpl( Action ruleAction, NodeRef actionedUponNodeRef) { if (this.nodeService.exists(actionedUponNodeRef) == true && this.nodeService.hasAspect(actionedUponNodeRef, ApplicationModel.ASPECT_SIMPLE_WORKFLOW) == false) { // Get the parameter values String approveStep = (String)ruleAction.getParameterValue(PARAM_APPROVE_STEP); NodeRef approveFolder = (NodeRef)ruleAction.getParameterValue(PARAM_APPROVE_FOLDER); Boolean approveMove = (Boolean)ruleAction.getParameterValue(PARAM_APPROVE_MOVE); String rejectStep = (String)ruleAction.getParameterValue(PARAM_REJECT_STEP); NodeRef rejectFolder = (NodeRef)ruleAction.getParameterValue(PARAM_REJECT_FOLDER); Boolean rejectMove = (Boolean)ruleAction.getParameterValue(PARAM_REJECT_MOVE); // Set the property values Map<QName, Serializable> propertyValues = new HashMap<QName, Serializable>(); propertyValues.put(ApplicationModel.PROP_APPROVE_STEP, approveStep); propertyValues.put(ApplicationModel.PROP_APPROVE_FOLDER, approveFolder); if (approveMove != null) { propertyValues.put(ApplicationModel.PROP_APPROVE_MOVE, approveMove.booleanValue()); } propertyValues.put(ApplicationModel.PROP_REJECT_STEP, rejectStep); propertyValues.put(ApplicationModel.PROP_REJECT_FOLDER, rejectFolder); if (rejectMove != null) { propertyValues.put(ApplicationModel.PROP_REJECT_MOVE, rejectMove.booleanValue()); } // Apply the simple workflow aspect to the node this.nodeService.addAspect(actionedUponNodeRef, ApplicationModel.ASPECT_SIMPLE_WORKFLOW, propertyValues); } }
Example #19
Source File: ImporterActionExecuterTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Test public void testImportArchiveWithSuspiciousPaths() throws IOException { final RetryingTransactionHelper retryingTransactionHelper = serviceRegistry.getRetryingTransactionHelper(); retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback<Void>() { public Void execute() { NodeRef rootNodeRef = nodeService.getRootNode(storeRef); NodeRef zipFileNodeRef = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("http://www.alfresco.org/test/ImporterActionExecuterTest", "testAssocQName1"), ContentModel.TYPE_CONTENT).getChildRef(); NodeRef targetFolderNodeRef = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("http://www.alfresco.org/test/ImporterActionExecuterTest", "testAssocQName2"), ContentModel.TYPE_FOLDER).getChildRef(); putContent(zipFileNodeRef, FILE_NAME); Action action = createAction(zipFileNodeRef, "ImporterActionExecuterTestActionDefinition", targetFolderNodeRef); try { importerActionExecuter.execute(action, zipFileNodeRef); fail("An AlfrescoRuntimeException should have occured."); } catch (AlfrescoRuntimeException e) { assertTrue(e.getMessage().contains(ImporterActionExecuter.ARCHIVE_CONTAINS_SUSPICIOUS_PATHS_ERROR)); } finally { nodeService.deleteNode(targetFolderNodeRef); nodeService.deleteNode(zipFileNodeRef); } return null; } }); }
Example #20
Source File: CheckOutActionExecuter.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * @see org.alfresco.repo.action.executer.ActionExecuter#execute(Action, org.alfresco.service.cmr.repository.NodeRef) */ public void executeImpl(Action ruleAction, NodeRef actionedUponNodeRef) { if (this.nodeService.exists(actionedUponNodeRef) == true && this.nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY) == false && isApplicableType(actionedUponNodeRef) == true) { // Get the destination details NodeRef destinationParent = (NodeRef)ruleAction.getParameterValue(PARAM_DESTINATION_FOLDER); QName destinationAssocTypeQName = (QName)ruleAction.getParameterValue(PARAM_ASSOC_TYPE_QNAME); QName destinationAssocQName = (QName)ruleAction.getParameterValue(PARAM_ASSOC_QNAME); if (destinationParent == null || destinationAssocTypeQName == null || destinationAssocQName == null) { // Check the node out to the current location this.cociService.checkout(actionedUponNodeRef); } else { // Check the node out to the specified location this.cociService.checkout( actionedUponNodeRef, destinationParent, destinationAssocTypeQName, destinationAssocQName); } } }
Example #21
Source File: ImageTransformActionExecuter.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Override protected TransformationOptions newTransformationOptions(Action ruleAction, NodeRef sourceNodeRef) { ImageTransformationOptions options = new ImageTransformationOptions(); options.setSourceNodeRef(sourceNodeRef); options.setSourceContentProperty(ContentModel.PROP_NAME); options.setTargetContentProperty(ContentModel.PROP_NAME); String convertCommand = (String) ruleAction.getParameterValue(PARAM_CONVERT_COMMAND); options.setCommandOptions(convertCommand); return options; }
Example #22
Source File: CountChildrenActionExecuter.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * @see org.alfresco.repo.action.executer.ActionExecuter#execute(Action, NodeRef) */ public void executeImpl(Action ruleAction, NodeRef actionedUponNodeRef) { if (this.nodeService.exists(actionedUponNodeRef) == true) { // Get the parent node int count = this.nodeService.getChildAssocs(actionedUponNodeRef).size(); ruleAction.setParameterValue(PARAM_RESULT, Integer.valueOf(count)); } }
Example #23
Source File: CompositeActionExecuter.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * @see org.alfresco.repo.action.executer.ActionExecuter#execute(Action, NodeRef) */ public void executeImpl(Action action, NodeRef actionedUponNodeRef) { if (action instanceof CompositeAction) { for (Action subAction : ((CompositeAction)action).getActions()) { // We don't check the conditions of sub-actions and they don't have an execution history this.actionService.directActionExecution(subAction, actionedUponNodeRef); } } }
Example #24
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 #25
Source File: InviteModeratedSenderTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * Mocks up an ActionService which returns the mailAction field when * createAction() is called. * * @return ActionService */ private ActionService mockActionService() { mailAction = mock(Action.class); ActionService actionService = mock(ActionService.class); when(actionService.createAction(MailActionExecuter.NAME)).thenReturn(mailAction); return actionService; }
Example #26
Source File: ActionServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * @see org.alfresco.service.cmr.action.ActionService#removeAction(org.alfresco.service.cmr.repository.NodeRef, * org.alfresco.service.cmr.action.Action) */ public void removeAction(NodeRef nodeRef, Action action) { if (this.nodeService.exists(nodeRef) == true && this.nodeService.hasAspect(nodeRef, ActionModel.ASPECT_ACTIONS) == true) { NodeRef actionNodeRef = getActionNodeRefFromId(nodeRef, action.getId()); if (actionNodeRef != null) { this.nodeService.removeChild(getSavedActionFolderRef(nodeRef), actionNodeRef); } } }
Example #27
Source File: ActionServiceMonitor.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * Called by the {@link ActionServiceImpl} when an action is started. * * Adds the action to the list of currently running actions. * * @param action The action being started * @return A {@link RunningAction} object used to track the status of the running action. */ public RunningAction actionStarted(Action action) { RunningAction runningAction = new RunningAction(action); this.runningActions.put(runningAction.getId(), runningAction); return runningAction; }
Example #28
Source File: SetPropertyValueActionExecuter.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * @see org.alfresco.repo.action.executer.ActionExecuter#execute(Action, NodeRef) */ public void executeImpl(Action ruleAction, NodeRef actionedUponNodeRef) { if (this.nodeService.exists(actionedUponNodeRef) == true) { // Set the value of the property this.nodeService.setProperty( actionedUponNodeRef, (QName)ruleAction.getParameterValue(PARAM_PROPERTY), ruleAction.getParameterValue(PARAM_VALUE)); } }
Example #29
Source File: AbstractMailActionExecuterTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * Test for MNT-10874 * @throws Exception */ @Test public void testUserWithNonExistingTenant() throws Exception { final String USER_WITH_NON_EXISTING_TENANT = "test_user_non_tenant@non_existing_tenant.com"; try { createUser(USER_WITH_NON_EXISTING_TENANT, USER_WITH_NON_EXISTING_TENANT); final Action mailAction = ACTION_SERVICE.createAction(MailActionExecuter.NAME); mailAction.setParameterValue(MailActionExecuter.PARAM_TO, USER_WITH_NON_EXISTING_TENANT); mailAction.setParameterValue(MailActionExecuter.PARAM_SUBJECT, "Testing"); mailAction.setParameterValue(MailActionExecuter.PARAM_TEXT, "This is a test message."); // run as non admin and non system AuthenticationUtil.setFullyAuthenticatedUser(BRITISH_USER.getUsername()); TRANSACTION_SERVICE.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() { @Override public Void execute() throws Throwable { ACTION_EXECUTER.executeImpl(mailAction, null); return null; } }); } finally { // restore system user as current user AuthenticationUtil.setRunAsUserSystem(); // tidy up PERSON_SERVICE.deletePerson(USER_WITH_NON_EXISTING_TENANT); AuthenticationUtil.clearCurrentSecurityContext(); } }
Example #30
Source File: ActionServiceImplTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
protected static Action createWorkingSleepAction(String id, ActionService actionService) throws Exception { Action workingAction = new CancellableSleepAction(actionService.createAction(SleepActionExecuter.NAME)); workingAction.setTrackStatus(Boolean.TRUE); if(id != null) { Field idF = ParameterizedItemImpl.class.getDeclaredField("id"); idF.setAccessible(true); idF.set(workingAction, id); } return workingAction; }