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


Java Action.setExecuteAsynchronously方法代码示例

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


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

示例1: testSimpleProperties

import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
public void testSimpleProperties()
{
    Action action = (Action)create();
    
    // Check the default values
    assertFalse(action.getExecuteAsychronously());
    assertNull(action.getCompensatingAction());
    
    // Set some values
    action.setTitle("title");
    action.setDescription("description");
    action.setExecuteAsynchronously(true);
    Action compensatingAction = new ActionImpl(null, GUID.generate(), "actionDefintionName", null);
    action.setCompensatingAction(compensatingAction);
    
    // Check the values have been set
    assertEquals("title", action.getTitle());
    assertEquals("description", action.getDescription());
    assertTrue(action.getExecuteAsychronously());
    assertEquals(compensatingAction, action.getCompensatingAction());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:ActionImplTest.java

示例2: 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);        
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:ActionServiceImplTest.java

示例3: xtestAsyncLoadTest

import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
public void xtestAsyncLoadTest()
{
    // TODO this is very weak .. how do we improve this ???
    
    Action action = this.actionService.createAction(AddFeaturesActionExecuter.NAME);
    action.setParameterValue(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, ContentModel.ASPECT_VERSIONABLE);
    action.setExecuteAsynchronously(true);
    
    for (int i = 0; i < 1000; i++)
    {
        this.actionService.executeAction(action, this.nodeRef);
    }        
    
    setComplete();
    endTransaction();
    
    // TODO how do we assess whether the large number of actions stacked cause a problem ??
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:ActionServiceImplTest.java

示例4: executeAction

import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
@Override
public void executeAction(NodeRef downloadNode)
{
    Action action = localActionService.createAction("createDownloadArchiveAction");
    action.setExecuteAsynchronously(true);
    
    localActionService.executeAction(action, downloadNode);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:9,代码来源:LocalActionServiceHelper.java

示例5: 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
     */
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:37,代码来源:RepoTransferReceiverImpl.java

示例6: populateActionProperties

import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
/**
 * Populates the action properties from the node reference
 * 
 * @param actionNodeRef the action node reference
 * @param action the action
 */
private void populateActionProperties(NodeRef actionNodeRef, Action action)
{
    Map<QName, Serializable> props = this.nodeService.getProperties(actionNodeRef);

    action.setTitle((String) props.get(ActionModel.PROP_ACTION_TITLE));
    action.setDescription((String) props.get(ActionModel.PROP_ACTION_DESCRIPTION));

    Boolean trackStatusObj = (Boolean) props.get(ActionModel.PROP_TRACK_STATUS);
    action.setTrackStatus(trackStatusObj);              // Allowed to be null

    Boolean executeAsynchObj = (Boolean) props.get(ActionModel.PROP_EXECUTE_ASYNCHRONOUSLY);
    boolean executeAsynch = executeAsynchObj == null ? false : executeAsynchObj.booleanValue();
    action.setExecuteAsynchronously(executeAsynch);

    ((ActionImpl) action).setCreator((String) props.get(ContentModel.PROP_CREATOR));
    ((ActionImpl) action).setCreatedDate((Date) props.get(ContentModel.PROP_CREATED));
    ((ActionImpl) action).setModifier((String) props.get(ContentModel.PROP_MODIFIER));
    ((ActionImpl) action).setModifiedDate((Date) props.get(ContentModel.PROP_MODIFIED));
    
    ((ActionImpl) action).setExecutionStartDate((Date) props.get(ActionModel.PROP_EXECUTION_START_DATE));
    ((ActionImpl) action).setExecutionEndDate((Date) props.get(ActionModel.PROP_EXECUTION_END_DATE));
    ((ActionImpl) action).setExecutionStatus(ActionStatus.valueOf(props.get(ActionModel.PROP_EXECUTION_ACTION_STATUS)));
    ((ActionImpl) action).setExecutionFailureMessage((String) props.get(ActionModel.PROP_EXECUTION_FAILURE_MESSAGE));

    // Get the compensating action
    List<ChildAssociationRef> assocs = this.nodeService.getChildAssocs(actionNodeRef, RegexQNamePattern.MATCH_ALL,
                ActionModel.ASSOC_COMPENSATING_ACTION);
    if (assocs.size() != 0)
    {
        Action compensatingAction = createAction(assocs.get(0).getChildRef());
        action.setCompensatingAction(compensatingAction);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:40,代码来源:ActionServiceImpl.java

示例7: testAsyncExecuteAction

import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
/**
 * Test asynchronous execute action
 */
public void testAsyncExecuteAction()
{
    assertFalse(this.nodeService.hasAspect(this.nodeRef, ContentModel.ASPECT_VERSIONABLE));
    
    Action action = this.actionService.createAction(AddFeaturesActionExecuter.NAME);
    action.setParameterValue(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, ContentModel.ASPECT_CLASSIFIABLE);
    action.setExecuteAsynchronously(true);
    
    this.actionService.executeAction(action, this.nodeRef);
    
    setComplete();
    endTransaction();
    
    final NodeService finalNodeService = this.nodeService;
    final NodeRef finalNodeRef = this.nodeRef;
    
    postAsyncActionTest(
            this.transactionService,
            1000l, 
            10, 
            new AsyncTest()
            {
                public String executeTest() 
                {
                    boolean result = finalNodeService.hasAspect(finalNodeRef, ContentModel.ASPECT_CLASSIFIABLE);
                    return result ? null : "Expected aspect Classifiable";
                };
            });
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:33,代码来源:ActionServiceImplTest.java

示例8: executeAction

import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
@Override
public void executeAction(NodeRef downloadNode) {
	Action action = localActionService.createAction(actionName);
	action.setExecuteAsynchronously(true);

	localActionService.executeAction(action, downloadNode);
}
 
开发者ID:Vitezslav-Sliz,项目名称:tieto-alfresco-repository_monitor,代码行数:8,代码来源:LocalActionServiceHelper.java

示例9: rejectModeratedInvitation

import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
@Override
public void rejectModeratedInvitation(String siteName, String invitee, String role, String reviewer, String resourceType, String reviewComments)
{
    // Do nothing if emails disabled.
    if (isSendEmails() == false)
    {
        return;
    }

    // send email to the invitee if possible - but don't fail the rejection if email cannot be sent
    try
    {
        // Build our model
        Map<String, Serializable> model = new HashMap<String, Serializable>(8, 1.0f);
        model.put("resourceName", siteName);
        model.put("resourceType", resourceType);
        model.put("inviteeRole", role);
        model.put("reviewComments", reviewComments);
        model.put("reviewer", reviewer);
        model.put("inviteeUserName", invitee);

        // Process the template
        // Note - because we use a classpath template, rather than a Data Dictionary
        // one, we can't have the MailActionExecutor do the template for us
        String emailMsg = templateService.processTemplate("freemarker", REJECT_TEMPLATE, model);

        // Send
        Action emailAction = actionService.createAction("mail");
        emailAction.setParameterValue(MailActionExecuter.PARAM_TO, nodeService.getProperty(personService.getPerson(invitee), ContentModel.PROP_EMAIL));
        emailAction.setParameterValue(MailActionExecuter.PARAM_FROM, nodeService.getProperty(personService.getPerson(reviewer), ContentModel.PROP_EMAIL));
        // TODO Localize this.
        emailAction.setParameterValue(MailActionExecuter.PARAM_SUBJECT, "Rejected invitation to web site:" + siteName);
        emailAction.setParameterValue(MailActionExecuter.PARAM_TEXT, emailMsg);
        emailAction.setExecuteAsynchronously(true);
        actionService.executeAction(emailAction, null);
    }
    catch (Exception e)
    {
        // Swallow exception
        logger.error("unable to send reject email", e);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:43,代码来源:InvitationServiceImpl.java


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