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


Java Action类代码示例

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


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

示例1: createScriptAction

import org.alfresco.service.cmr.action.Action; //导入依赖的package包/类
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;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:RuleServiceImplTest.java

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

示例3: loadRenditionDefinition

import org.alfresco.service.cmr.action.Action; //导入依赖的package包/类
public RenditionDefinition loadRenditionDefinition(QName renditionDefinitionName)
{
    NodeRef actionNode = findActionNode(renditionDefinitionName);
    if (actionNode != null)
    {
        Action action = runtimeActionService.createAction(actionNode);
        if (action instanceof CompositeAction)
        {
            CompositeAction compAction = (CompositeAction) action;
            return new CompositeRenditionDefinitionImpl(compAction);
        }
        else
        {
            return new RenditionDefinitionImpl(action);
        }
    }
    else
        return null;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:RenditionDefinitionPersisterImpl.java

示例4: CompositeRenditionDefinitionImpl

import org.alfresco.service.cmr.action.Action; //导入依赖的package包/类
public CompositeRenditionDefinitionImpl(CompositeAction compositeAction)
{
    super(compositeAction, CompositeRenderingEngine.NAME);
    for (Action action : compositeAction.getActions())
    {
        RenditionDefinition subDefinition;
        if (action instanceof CompositeAction)
        {
            CompositeAction compAction = (CompositeAction) action;
            subDefinition = new CompositeRenditionDefinitionImpl(compAction);
        }
        else
        {
            subDefinition = new RenditionDefinitionImpl(action);
        }
        addAction(subDefinition);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:CompositeRenditionDefinitionImpl.java

示例5: testUnknownRecipientUnknownSender

import org.alfresco.service.cmr.action.Action; //导入依赖的package包/类
@Test
public void testUnknownRecipientUnknownSender() throws IOException, MessagingException
{
    // PARAM_TO variant
    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_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());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:AbstractMailActionExecuterTest.java

示例6: checkParameterValues

import org.alfresco.service.cmr.action.Action; //导入依赖的package包/类
@Override
protected void checkParameterValues(Action action)
{
    // Some numerical parameters should not be zero or negative.
    checkNumericalParameterIsPositive(action, PARAM_RESIZE_WIDTH);
    checkNumericalParameterIsPositive(action, PARAM_RESIZE_HEIGHT);
    checkNumericalParameterIsPositive(action, CropSourceOptionsSerializer.PARAM_CROP_HEIGHT);
    checkNumericalParameterIsPositive(action, CropSourceOptionsSerializer.PARAM_CROP_WIDTH);
    
    // Target mime type should only be an image MIME type
    String mimeTypeParam = (String)action.getParameterValue(PARAM_MIME_TYPE);
    if (mimeTypeParam != null && !mimeTypeParam.startsWith("image"))
    {
        StringBuilder msg = new StringBuilder();
        msg.append("Parameter ").append(PARAM_MIME_TYPE)
            .append(" had illegal non-image MIME type: ").append(mimeTypeParam);
        throw new IllegalArgumentException(msg.toString());
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:ImageRenderingEngine.java

示例7: createFailingMoveAction

import org.alfresco.service.cmr.action.Action; //导入依赖的package包/类
/**
 * This method returns an {@link Action} which will fail when executed.
 * 
 * @param isFatal if <code>false</code> this will give an action which throws
 *                a {@link ActionServiceTransientException non-fatal action exception}.
 */
protected Action createFailingMoveAction(boolean isFatal) {
    Action failingAction;
    if (isFatal)
    {
        failingAction = this.actionService.createAction(MoveActionExecuter.NAME);
        
        // Create a bad node ref
        NodeRef badNodeRef = new NodeRef(this.storeRef, "123123");
        failingAction.setParameterValue(MoveActionExecuter.PARAM_DESTINATION_FOLDER, badNodeRef);
    }
    else
    {
        failingAction = this.actionService.createAction(TransientFailActionExecuter.NAME);
    }
    
    return failingAction;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:ActionServiceImplTest.java

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

示例9: testRemove

import org.alfresco.service.cmr.action.Action; //导入依赖的package包/类
/**
 * Test remove action
 */
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());        
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:ActionServiceImplTest.java

示例10: ActionExecutionWrapper

import org.alfresco.service.cmr.action.Action; //导入依赖的package包/类
/**
 * @param actionService                     the action service
 * @param action                            the action to perform
 * @param actionedUponNodeRef               the node to perform the action on
 * @param checkConditions                   the check conditions
 * @param actionChain                       the action chain
 * @param executedRules                     list of executions done to helps to prevent loop scenarios with async rules
 */
public ActionExecutionWrapper(
        RuntimeActionService actionService,
        Action action,
        NodeRef actionedUponNodeRef,
        boolean checkConditions,
        Set<String> actionChain,
        Set<RuleServiceImpl.ExecutedRuleData> executedRules)
{
    this.actionService = actionService;
    this.actionedUponNodeRef = actionedUponNodeRef;
    this.action = action;
    this.checkConditions = checkConditions;
    this.actionChain = actionChain;
    this.executedRules = executedRules;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:AsynchronousActionExecutionQueueImpl.java

示例11: executeAction

import org.alfresco.service.cmr.action.Action; //导入依赖的package包/类
/**
 * @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);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:ActionServiceImpl.java

示例12: buildModel

import org.alfresco.service.cmr.action.Action; //导入依赖的package包/类
@Override
protected Map<String, Object> buildModel(
      RunningActionModelBuilder modelBuilder, WebScriptRequest req,
      Status status, Cache cache) {
   List<ExecutionSummary> actions = null;
   
   // Do they want all actions, or only certain ones?
   String type = req.getParameter("type");
   String nodeRef = req.getParameter("nodeRef");
   
   if(type != null) {
      actions = actionTrackingService.getExecutingActions(type);
   } else if(nodeRef != null) {
      NodeRef actionNodeRef = new NodeRef(nodeRef);
      Action action = runtimeActionService.createAction(actionNodeRef);
      actions = actionTrackingService.getExecutingActions(action); 
   } else {
      actions = actionTrackingService.getAllExecutingActions();
   }
   
   // Build the model list
   return modelBuilder.buildSimpleList(actions);
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:24,代码来源:RunningActionsGet.java

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

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

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


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