Package org.activiti.workflow.simple.alfresco.conversion.script

Examples of org.activiti.workflow.simple.alfresco.conversion.script.ScriptServiceTaskBuilder


  @Override
  protected ServiceTask createProcessArtifact(AlfrescoEmailStepDefinition stepDefinition,
    WorkflowDefinitionConversion conversion) {
   
    ScriptServiceTaskBuilder builder = new ScriptServiceTaskBuilder();
    builder.addLine("var mail = actions.create('mail');");
    addMailActionParameter("to", getSafeJsString(stepDefinition.getTo()), builder);
    addMailActionParameter("cc", getSafeJsString(stepDefinition.getCc()), builder);
    addMailActionParameter("from", getSafeJsString(stepDefinition.getFrom()), builder);
    addMailActionParameter("subject", getSafeJsString(stepDefinition.getSubject()), builder);
    addMailActionParameter("text", getSafeJsString(stepDefinition.getBody()), builder);
    builder.addLine("mail.execute(bpm_package);");
   
    // Build the actual task and add it to the process
    ServiceTask serviceTask = builder.build();
    serviceTask.setName(stepDefinition.getName());
    serviceTask.setId(conversion.getUniqueNumberedId(ConversionConstants.SERVICE_TASK_ID_PREFIX));
    addFlowElement(conversion, serviceTask, true);
    return serviceTask;
  }
View Full Code Here


    return ScriptStepDefinition.class;
  }

  @Override
  protected ServiceTask createProcessArtifact(ScriptStepDefinition stepDefinition, WorkflowDefinitionConversion conversion) {
    ScriptServiceTaskBuilder builder = new ScriptServiceTaskBuilder();
    builder.add(stepDefinition.getScript());
   
    if(stepDefinition.getParameters() != null && stepDefinition.getParameters().containsKey(AlfrescoConversionConstants.PARAMETER_SCRIPT_TASK_RUNAS)) {
      builder.setRunAs((String) stepDefinition.getParameters().get(AlfrescoConversionConstants.PARAMETER_SCRIPT_TASK_RUNAS));
    }
   
    ServiceTask serviceTask = builder.build();
    serviceTask.setName(stepDefinition.getName());
    serviceTask.setDefaultFlow(stepDefinition.getDescription());
    serviceTask.setId(conversion.getUniqueNumberedId(ConversionConstants.SERVICE_TASK_ID_PREFIX));
   
    addFlowElement(conversion, serviceTask, true);
View Full Code Here

    if(stepDefinition.getAssignmentType() == HumanStepAssignmentType.USER) {
      reviewTask.setAssignee(new PropertyReference(stepDefinition.getAssignmentPropertyName()).getPlaceholder());
    }
   
    // Add a script-task that initializes the correct variables for the review
    ScriptServiceTaskBuilder builder = new ScriptServiceTaskBuilder();
    builder.setExecutionVariable(getCountVariableName(id, namespacePrefix), "0");
   
    String requiredCount = null;
    if(stepDefinition.getRequiredApprovalCount() != null) {
      if(PropertyReference.isPropertyReference(stepDefinition.getRequiredApprovalCount())) {
        PropertyReference reference = PropertyReference.createReference(stepDefinition.getRequiredApprovalCount());
        requiredCount = reference.getVariableReference(namespacePrefix);
        AlfrescoConversionUtil.getPropertyReferences(conversion).add(reference);
      } else {
        // No reference, use explicit value
        requiredCount = stepDefinition.getRequiredApprovalCount();
      }
    } else {
      requiredCount = "1";
    }
    builder.setExecutionVariable(getRequiredCountVariableName(id, namespacePrefix), requiredCount);
   
    ServiceTask serviceTask = builder.build();
    serviceTask.setName("Review initialization");
    serviceTask.setId(conversion.getUniqueNumberedId(ConversionConstants.SERVICE_TASK_ID_PREFIX));
   
    addFlowElement(conversion, serviceTask, true);
View Full Code Here

TOP

Related Classes of org.activiti.workflow.simple.alfresco.conversion.script.ScriptServiceTaskBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.