Package org.activiti.bpmn.model

Examples of org.activiti.bpmn.model.ScriptTask


  private void validateModel(BpmnModel model) {
    FlowElement flowElement = model.getFlowElement("_5");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof ScriptTask);
    assertEquals("_5", flowElement.getId());
    ScriptTask scriptTask = (ScriptTask) flowElement;
    assertEquals("_5", scriptTask.getId());
    assertEquals("Send Hello Message", scriptTask.getName());
  }
View Full Code Here


  }

  @Override
  protected ScriptTask createProcessArtifact(ScriptStepDefinition stepDefinition, WorkflowDefinitionConversion conversion) {
   
    ScriptTask scriptTask = new ScriptTask();
    scriptTask.setId(conversion.getUniqueNumberedId(ConversionConstants.SCRIPT_TASK_ID_PREFIX));
    scriptTask.setName(stepDefinition.getName());
    scriptTask.setScript(stepDefinition.getScript());
   
    if (stepDefinition.getScriptLanguage() != null) {
      scriptTask.setScriptFormat(stepDefinition.getScriptLanguage());
    } else {
      scriptTask.setScriptFormat("JavaScript");
    }
   
    addFlowElement(conversion, scriptTask, true);
   
    return scriptTask;
View Full Code Here

    return ELEMENT_TASK_SCRIPT;
  }
 
  @Override
  protected BaseElement convertXMLToElement(XMLStreamReader xtr, BpmnModel model) throws Exception {
    ScriptTask scriptTask = new ScriptTask();
    BpmnXMLUtil.addXMLLocation(scriptTask, xtr);
    scriptTask.setScriptFormat(xtr.getAttributeValue(null, ATTRIBUTE_TASK_SCRIPT_FORMAT));
    scriptTask.setResultVariable(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_SCRIPT_RESULTVARIABLE));
    if (StringUtils.isEmpty(scriptTask.getResultVariable())) {
      scriptTask.setResultVariable(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_SERVICE_RESULTVARIABLE));
    }
    String autoStoreVariables = xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_SCRIPT_AUTO_STORE_VARIABLE);
    if (StringUtils.isNotEmpty(autoStoreVariables)) {
      scriptTask.setAutoStoreVariables(Boolean.valueOf(autoStoreVariables));
    }
    parseChildElements(getXMLElementName(), scriptTask, childParserMap, model, xtr);
    return scriptTask;
  }
View Full Code Here

    return scriptTask;
  }

  @Override
  protected void writeAdditionalAttributes(BaseElement element, BpmnModel model, XMLStreamWriter xtw) throws Exception {
    ScriptTask scriptTask = (ScriptTask) element;
    writeDefaultAttribute(ATTRIBUTE_TASK_SCRIPT_FORMAT, scriptTask.getScriptFormat(), xtw);
    writeQualifiedAttribute(ATTRIBUTE_TASK_SCRIPT_RESULTVARIABLE, scriptTask.getResultVariable(), xtw);
    writeQualifiedAttribute(ATTRIBUTE_TASK_SCRIPT_AUTO_STORE_VARIABLE, String.valueOf(scriptTask.isAutoStoreVariables()), xtw);
  }
View Full Code Here

    writeQualifiedAttribute(ATTRIBUTE_TASK_SCRIPT_AUTO_STORE_VARIABLE, String.valueOf(scriptTask.isAutoStoreVariables()), xtw);
  }
 
  @Override
  protected void writeAdditionalChildElements(BaseElement element, BpmnModel model, XMLStreamWriter xtw) throws Exception {
    ScriptTask scriptTask = (ScriptTask) element;
    if (StringUtils.isNotEmpty(scriptTask.getScript())) {
      xtw.writeStartElement(ATTRIBUTE_TASK_SCRIPT_TEXT);
      xtw.writeCharacters(scriptTask.getScript());
      xtw.writeEndElement();
    }
  }
View Full Code Here

  protected String getStencilId(FlowElement flowElement) {
    return STENCIL_TASK_SCRIPT;
  }
 
  protected void convertElementToJson(ObjectNode propertiesNode, FlowElement flowElement) {
    ScriptTask scriptTask = (ScriptTask) flowElement;
    propertiesNode.put(PROPERTY_SCRIPT_FORMAT, scriptTask.getScriptFormat());
    propertiesNode.put(PROPERTY_SCRIPT_TEXT, scriptTask.getScript());
  }
View Full Code Here

    propertiesNode.put(PROPERTY_SCRIPT_FORMAT, scriptTask.getScriptFormat());
    propertiesNode.put(PROPERTY_SCRIPT_TEXT, scriptTask.getScript());
  }
 
  protected FlowElement convertJsonToElement(JsonNode elementNode, JsonNode modelNode, Map<String, JsonNode> shapeMap) {
    ScriptTask task = new ScriptTask();
    task.setScriptFormat(getPropertyValueAsString(PROPERTY_SCRIPT_FORMAT, elementNode));
    task.setScript(getPropertyValueAsString(PROPERTY_SCRIPT_TEXT, elementNode));
    return task;
  }
View Full Code Here

    super(fp, "ScriptTask", "Add script task");
  }

  @Override
  public Object[] create(ICreateContext context) {
    ScriptTask newScriptTask = new ScriptTask();
    addObjectToContainer(context, newScriptTask, "Script Task");

    return new Object[] { newScriptTask };
  }
View Full Code Here

    final List<Object> scriptTasks = processNodes.get(ScriptTask.class.getCanonicalName());

    if (scriptTasks != null && !scriptTasks.isEmpty()) {
      for (final Object object : scriptTasks) {

        final ScriptTask scriptTask = (ScriptTask) object;
        if (scriptTask.getScriptFormat() == null || scriptTask.getScriptFormat().length() == 0) {
          result.add(new ProcessValidationWorkerMarker(IMarker.SEVERITY_ERROR, String.format(NO_FORMAT_EXCEPTION_MESSAGE_PATTERN, scriptTask.getName()),
                  scriptTask.getId(), ValidationCode.VAL_002));
        }
        if (scriptTask.getScript() == null || scriptTask.getScript().length() == 0) {
          result.add(new ProcessValidationWorkerMarker(IMarker.SEVERITY_ERROR, String.format(NO_SCRIPT_EXCEPTION_MESSAGE_PATTERN, scriptTask.getName()),
                  scriptTask.getId(), ValidationCode.VAL_003));
        }
      }
    }

    return result;
View Full Code Here

    return ELEMENT_TASK_SCRIPT;
  }
 
  @Override
  protected BaseElement convertXMLToElement(XMLStreamReader xtr) throws Exception {
    ScriptTask scriptTask = new ScriptTask();
    scriptTask.setScriptFormat(xtr.getAttributeValue(null, ATTRIBUTE_TASK_SCRIPT_FORMAT));
    parseChildElements(getXMLElementName(), scriptTask, xtr);
    return scriptTask;
  }
View Full Code Here

TOP

Related Classes of org.activiti.bpmn.model.ScriptTask

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.