本文整理汇总了Java中org.alfresco.service.cmr.action.Action.setParameterValue方法的典型用法代码示例。如果您正苦于以下问题:Java Action.setParameterValue方法的具体用法?Java Action.setParameterValue怎么用?Java Action.setParameterValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.service.cmr.action.Action
的用法示例。
在下文中一共展示了Action.setParameterValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testUnknownRecipientUnknownSender_ToMany
import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
@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());
}
示例2: sendMessage
import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
protected MimeMessage sendMessage(String from, String subject, String template, final Action mailAction)
{
if (from != null)
{
mailAction.setParameterValue(MailActionExecuter.PARAM_FROM, from);
}
mailAction.setParameterValue(MailActionExecuter.PARAM_SUBJECT, subject);
mailAction.setParameterValue(MailActionExecuter.PARAM_TEMPLATE, template);
mailAction.setParameterValue(MailActionExecuter.PARAM_TEMPLATE_MODEL, getModel());
RetryingTransactionHelper txHelper = APP_CONTEXT_INIT.getApplicationContext().getBean("retryingTransactionHelper", RetryingTransactionHelper.class);
return txHelper.doInTransaction(new RetryingTransactionCallback<MimeMessage>()
{
@Override
public MimeMessage execute() throws Throwable
{
ACTION_SERVICE.executeAction(mailAction, null);
return ACTION_EXECUTER.retrieveLastTestMessage();
}
}, true);
}
示例3: sendMail
import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
@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));
}
示例4: testGetRuleset
import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
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);
}
示例5: testOwningNodeRef
import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
public void testOwningNodeRef()
{
// Create the action
Action action = this.actionService.createAction(AddFeaturesActionExecuter.NAME);
String actionId = action.getId();
// Set the parameters of the action
action.setParameterValue(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, ContentModel.ASPECT_VERSIONABLE);
// Set the title and description of the action
action.setTitle("title");
action.setDescription("description");
action.setExecuteAsynchronously(true);
// Check the owning node ref
//assertNull(action.getOwningNodeRef());
// Save the action
this.actionService.saveAction(this.nodeRef, action);
// Get the action
this.actionService.getAction(this.nodeRef, actionId);
}
示例6: 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);
}
示例7: testALF5027
import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
/**
* http://issues.alfresco.com/jira/browse/ALF-5027
*/
public void testALF5027() throws Exception
{
String userName = "bob" + GUID.generate();
createUser(userName);
PermissionService permissionService = (PermissionService)applicationContext.getBean("PermissionService");
permissionService.setPermission(rootNodeRef, userName, PermissionService.COORDINATOR, true);
AuthenticationUtil.setRunAsUser(userName);
NodeRef myNodeRef = nodeService.createNode(
this.rootNodeRef,
ContentModel.ASSOC_CHILDREN,
QName.createQName("{test}myTestNode" + GUID.generate()),
ContentModel.TYPE_CONTENT).getChildRef();
CheckOutCheckInService coci = (CheckOutCheckInService)applicationContext.getBean("CheckoutCheckinService");
NodeRef workingcopy = coci.checkout(myNodeRef);
assertNotNull(workingcopy);
assertFalse(nodeService.hasAspect(myNodeRef, ContentModel.ASPECT_DUBLINCORE));
Action action1 = this.actionService.createAction(AddFeaturesActionExecuter.NAME);
action1.setParameterValue(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, ContentModel.ASPECT_DUBLINCORE);
actionService.executeAction(action1, myNodeRef);
// The action should have been ignored since the node is locked
assertFalse(nodeService.hasAspect(myNodeRef, ContentModel.ASPECT_DUBLINCORE));
coci.checkin(workingcopy, null);
actionService.executeAction(action1, myNodeRef);
assertTrue(nodeService.hasAspect(myNodeRef, ContentModel.ASPECT_DUBLINCORE));
}
示例8: testUserWithNonExistingTenant
import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
/**
* Test for MNT-10874
* @throws Exception
*/
@Test
public void testUserWithNonExistingTenant() throws Exception
{
final String USER_WITH_NON_EXISTING_TENANT = "[email protected]_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();
}
}
示例9: commitAsync
import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
public void commitAsync(String transferId)
{
/**
* A side-effect of checking the lock here is that the lock timeout is suspended.
*
*/
Lock lock = checkLock(transferId);
try
{
progressMonitor.updateStatus(transferId, Status.COMMIT_REQUESTED);
Action commitAction = actionService.createAction(TransferCommitActionExecuter.NAME);
commitAction.setParameterValue(TransferCommitActionExecuter.PARAM_TRANSFER_ID, transferId);
commitAction.setExecuteAsynchronously(true);
actionService.executeAction(commitAction, new NodeRef(transferId));
if (log.isDebugEnabled())
{
log.debug("Registered transfer commit for asynchronous execution: " + transferId);
}
}
catch (Exception error)
{
/**
* Error somewhere in the action service?
*/
//TODO consider whether the methods in this class should be retried/retryable..
// need to re-enable the lock timeout otherwise we will hold the lock forever...
lock.enableLockTimeout();
throw new TransferException(MSG_ERROR_WHILE_COMMITTING_TRANSFER, new Object[]{transferId}, error);
}
/**
* Lock intentionally not re-enabled here
*/
}
示例10: testActionResult
import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
/**
* Test the action result parameter
*/
public void testActionResult()
{
// Create the script node reference
NodeRef script = this.nodeService.createNode(
this.folder,
ContentModel.ASSOC_CONTAINS,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "testScript.js"),
ContentModel.TYPE_CONTENT).getChildRef();
this.nodeService.setProperty(script, ContentModel.PROP_NAME, "testScript.js");
ContentWriter contentWriter = this.contentService.getWriter(script, ContentModel.PROP_CONTENT, true);
contentWriter.setMimetype("text/plain");
contentWriter.setEncoding("UTF-8");
contentWriter.putContent("\"VALUE\";");
// Create the action
Action action1 = this.actionService.createAction(ScriptActionExecuter.NAME);
action1.setParameterValue(ScriptActionExecuter.PARAM_SCRIPTREF, script);
// Execute the action
this.actionService.executeAction(action1, this.nodeRef);
// Get the result
String result = (String)action1.getParameterValue(ActionExecuter.PARAM_RESULT);
assertNotNull(result);
assertEquals("VALUE", result);
}
示例11: testALF17549
import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
/**
* https://issues.alfresco.com/jira/browse/ALF-17549
*/
public void testALF17549() throws Exception
{
permissionService.setPermission(rootNodeRef, USER_1, PermissionService.COORDINATOR, true);
AuthenticationUtil.setRunAsUser(USER_1);
String sourceName = "sourceNode.txt";
Map<QName, Serializable> props = new HashMap<QName, Serializable>();
props.put(ContentModel.PROP_NAME, sourceName);
NodeRef sourceNodeRef = nodeService.createNode(this.rootNodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName("{test}" + sourceName), ContentModel.TYPE_CONTENT, props)
.getChildRef();
ContentWriter writer = contentService.getWriter(sourceNodeRef, ContentModel.PROP_CONTENT, true);
writer.setEncoding("UTF-8");
writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
writer.putContent("This is sample text content for unit test.");
NodeRef targetNodeRef = nodeService.createNode(this.rootNodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName("{test}targetNode"), ContentModel.TYPE_FOLDER)
.getChildRef();
List<ChildAssociationRef> childAssoc = nodeService.getChildAssocs(targetNodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName("{test}sourceNode.html"));
assertEquals(0, childAssoc.size());
Action action = this.actionService.createAction(TransformActionExecuter.NAME);
action.setParameterValue(TransformActionExecuter.PARAM_MIME_TYPE, MimetypeMap.MIMETYPE_HTML);
action.setParameterValue(TransformActionExecuter.PARAM_DESTINATION_FOLDER, targetNodeRef);
action.setParameterValue(TransformActionExecuter.PARAM_ASSOC_QNAME, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "copy"));
action.setParameterValue(TransformActionExecuter.PARAM_ASSOC_TYPE_QNAME, ContentModel.ASSOC_CONTAINS);
actionService.executeAction(action, sourceNodeRef);
childAssoc = nodeService.getChildAssocs(targetNodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName("{test}sourceNode.html"));
assertEquals(1, childAssoc.size());
}
示例12: testSendingToListOfCarbonCopyAndBlindCarbonCopyUsers
import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
/**
* ALF-21948
*/
@Test
public void testSendingToListOfCarbonCopyAndBlindCarbonCopyUsers() throws MessagingException
{
List<String> ccList = new ArrayList<String>();
ccList.add("[email protected]");
ccList.add("[email protected]");
List<String> bccList = new ArrayList<String>();
bccList.add("[email protected]");
bccList.add("[email protected]");
bccList.add("[email protected]");
Action mailAction = ACTION_SERVICE.createAction(MailActionExecuter.NAME);
mailAction.setParameterValue(MailActionExecuter.PARAM_FROM, "[email protected]");
mailAction.setParameterValue(MailActionExecuter.PARAM_TO, "[email protected]");
mailAction.setParameterValue(MailActionExecuter.PARAM_CC, (Serializable) ccList);
mailAction.setParameterValue(MailActionExecuter.PARAM_BCC, (Serializable) bccList);
mailAction.setParameterValue(MailActionExecuter.PARAM_SUBJECT, "Testing (BLIND) CARBON COPY");
mailAction.setParameterValue(MailActionExecuter.PARAM_TEXT, "mail body here");
ACTION_EXECUTER.resetTestSentCount();
ACTION_SERVICE.executeAction(mailAction, null);
MimeMessage message = ACTION_EXECUTER.retrieveLastTestMessage();
Assert.assertNotNull(message);
Address[] all = message.getAllRecipients();
Address[] ccs = message.getRecipients(RecipientType.CC);
Address[] bccs = message.getRecipients(RecipientType.BCC);
Assert.assertEquals(6, all.length);
Assert.assertEquals(2, ccs.length);
Assert.assertEquals(3, bccs.length);
Assert.assertTrue(ccs[0].toString().contains("cc_user1") && ccs[1].toString().contains("cc_user2"));
Assert.assertTrue(bccs[0].toString().contains("bcc_user3") && bccs[1].toString().contains("bcc_user4")
&& bccs[2].toString().contains("bcc_user5"));
}
示例13: everyoneSending
import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
private void everyoneSending()
{
Action mailAction = ACTION_SERVICE.createAction(MailActionExecuter.NAME);
mailAction.setParameterValue(MailActionExecuter.PARAM_FROM, "[email protected]");
ArrayList<String> toMany = new ArrayList<String>();
toMany.add(PERMISSION_SERVICE.getAllAuthorities());
mailAction.setParameterValue(MailActionExecuter.PARAM_TO_MANY, toMany);
mailAction.setParameterValue(MailActionExecuter.PARAM_SUBJECT, "Testing MNT-12464");
mailAction.setParameterValue(MailActionExecuter.PARAM_TEMPLATE, "alfresco/templates/mail/test.txt.ftl");
mailAction.setParameterValue(MailActionExecuter.PARAM_TEMPLATE_MODEL, (Serializable) getModel());
ACTION_EXECUTER.resetTestSentCount();
ACTION_SERVICE.executeAction(mailAction, null);
}
示例14: executeImpl
import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
/**
* @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));
}
}
示例15: updateTagScope
import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
/**
* Triggers an async update of all the relevant tag scopes when a tag is
* added or removed from a node.
* Uses the audit service as a persisted queue to hold the list of changes,
* and triggers an sync action to work on the entries in the queue for us.
* This should avoid contention problems and race conditions.
*
* @param nodeRef node reference
* @param updates Map<String, Boolean>
*/
private void updateTagScope(NodeRef nodeRef, Map<String, Boolean> updates)
{
// First up, locate all the tag scopes for this node
// (Need to do a recursive search up to the root)
ArrayList<NodeRef> tagScopeNodeRefs = new ArrayList<NodeRef>(3);
getTagScopes(nodeRef, tagScopeNodeRefs);
if(tagScopeNodeRefs.size() == 0)
{
if(logger.isDebugEnabled())
{
logger.debug("No tag scopes found for " + nodeRef + " so no scope updates needed");
}
return;
}
// Turn from tag+yes/no into tag+1/-1
// (Later we may roll things up better to be tag+#/-#)
HashMap<String,Integer> changes = new HashMap<String, Integer>(updates.size());
for(String tag : updates.keySet())
{
int val = -1;
if(updates.get(tag))
val = 1;
changes.put(tag, val);
}
// Next, queue the updates for each tag scope
for(NodeRef tagScopeNode : tagScopeNodeRefs)
{
Map<String,Serializable> auditValues = new HashMap<String, Serializable>();
auditValues.put(TAGGING_AUDIT_KEY_TAGS, changes);
auditValues.put(TAGGING_AUDIT_KEY_NODEREF, tagScopeNode.toString());
auditComponent.recordAuditValues(TAGGING_AUDIT_ROOT_PATH, auditValues);
}
if(logger.isDebugEnabled())
{
logger.debug("Queueing async tag scope updates to tag scopes " + tagScopeNodeRefs + " of " + changes);
}
// Finally, trigger the action to process the updates
// This will happen asynchronously
Action action = this.actionService.createAction(UpdateTagScopesActionExecuter.NAME);
action.setParameterValue(UpdateTagScopesActionExecuter.PARAM_TAG_SCOPES, tagScopeNodeRefs);
this.actionService.executeAction(action, null, false, true);
}