Package org.activiti.bpmn.model

Examples of org.activiti.bpmn.model.FieldExtension


    assertEquals("servicetask", serviceTask.getId());
    assertEquals("Service task", serviceTask.getName());
   
    List<FieldExtension> fields = serviceTask.getFieldExtensions();
    assertEquals(2, fields.size());
    FieldExtension field = (FieldExtension) fields.get(0);
    assertEquals("testField", field.getFieldName());
    assertEquals("test", field.getStringValue());
    field = (FieldExtension) fields.get(1);
    assertEquals("testField2", field.getFieldName());
    assertEquals("${test}", field.getExpression());
   
    List<ActivitiListener> listeners = serviceTask.getExecutionListeners();
    assertEquals(3, listeners.size());
    ActivitiListener listener = (ActivitiListener) listeners.get(0);
    assertTrue(ImplementationType.IMPLEMENTATION_TYPE_CLASS.equals(listener.getImplementationType()));
View Full Code Here


   
    return task;
  }
 
  protected void addField(String name, JsonNode elementNode, ServiceTask task) {
    FieldExtension field = new FieldExtension();
    field.setFieldName(name.substring(8));
    String value = getPropertyValueAsString(name, elementNode);
    if (StringUtils.isNotEmpty(value)) {
      if ((value.contains("${") || value.contains("#{")) && value.contains("}")) {
        field.setExpression(value);
      } else {
        field.setStringValue(value);
      }
      task.getFieldExtensions().add(field);
    }
  }
View Full Code Here

    assertEquals("servicetask", serviceTask.getId());
    assertEquals("Service task", serviceTask.getName());
   
    List<FieldExtension> fields = serviceTask.getFieldExtensions();
    assertEquals(2, fields.size());
    FieldExtension field = fields.get(0);
    assertEquals("testField", field.getFieldName());
    assertEquals("test", field.getStringValue());
    field = fields.get(1);
    assertEquals("testField2", field.getFieldName());
    assertEquals("${test}", field.getExpression());
   
    List<ActivitiListener> listeners = serviceTask.getExecutionListeners();
    assertEquals(3, listeners.size());
    ActivitiListener listener = listeners.get(0);
    assertTrue(ImplementationType.IMPLEMENTATION_TYPE_CLASS.equals(listener.getImplementationType()));
View Full Code Here

              List<FieldExtension> fields = new ArrayList<FieldExtension>();
              if (listenerFieldsArrayNode != null) {
                for (JsonNode fieldNode : listenerFieldsArrayNode){
                  JsonNode fieldNameNode = fieldNode.get(listenerFieldName);
                  if (fieldNameNode != null && StringUtils.isNotEmpty(fieldNameNode.asText())){
                    FieldExtension field = new FieldExtension();
                    field.setFieldName(fieldNameNode.asText());
                    field.setStringValue(getValueAsString(listenerFieldValue, fieldNode));
                    field.setExpression(getValueAsString(listenerFieldExpression, fieldNode));
                    fields.add(field);
                  }
                }
              }
              listener.setFieldExtensions(fields);
View Full Code Here

      ActivitiListener taskListener = new ActivitiListener();
      taskListener.setEvent("complete");
      taskListener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_CLASS);
      taskListener.setImplementation("org.activiti.engine.impl.bpmn.listener.ScriptTaskListener");
     
      FieldExtension languageField = new FieldExtension();
      languageField.setFieldName("language");
      languageField.setStringValue("JavaScript");
     
      FieldExtension scriptField = new FieldExtension();
      scriptField.setFieldName("script");
     
      StringBuilder script = new StringBuilder();
      if (JvmUtil.isJDK8()) {
        script.append("load(\"nashorn:mozilla_compat.js\");");
      }
      script.append("importPackage (java.util); var feedbackProviders = new ArrayList();" + System.getProperty("line.separator"));
      for (String feedbackProvider : feedbackStepDefinition.getFeedbackProviders()) {
        script.append("feedbackProviders.add('" + feedbackProvider + "');" + System.getProperty("line.separator"));
      }
      script.append("task.getExecution().setVariable('" + VARIABLE_FEEDBACK_PROVIDERS + "', feedbackProviders);" + System.getProperty("line.separator"));
      scriptField.setStringValue(script.toString());

      taskListener.setFieldExtensions(Arrays.asList(languageField, scriptField));
     
      selectPeopleUserTask.getTaskListeners().add(taskListener);
    }
View Full Code Here

  public void parseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model) throws Exception {
   
    if (parentElement instanceof ActivitiListener == false && parentElement instanceof ServiceTask == false &&
        parentElement instanceof SendTask == false) return;
   
    FieldExtension extension = new FieldExtension();
    BpmnXMLUtil.addXMLLocation(extension, xtr);
    extension.setFieldName(xtr.getAttributeValue(null, ATTRIBUTE_FIELD_NAME));
   
    if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_FIELD_STRING))) {
      extension.setStringValue(xtr.getAttributeValue(null, ATTRIBUTE_FIELD_STRING));

    } else if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_FIELD_EXPRESSION))) {
      extension.setExpression(xtr.getAttributeValue(null, ATTRIBUTE_FIELD_EXPRESSION));

    } else {
      boolean readyWithFieldExtension = false;
      try {
        while (readyWithFieldExtension == false && xtr.hasNext()) {
          xtr.next();
          if (xtr.isStartElement() && ELEMENT_FIELD_STRING.equalsIgnoreCase(xtr.getLocalName())) {
            extension.setStringValue(xtr.getElementText().trim());

          } else if (xtr.isStartElement() && ATTRIBUTE_FIELD_EXPRESSION.equalsIgnoreCase(xtr.getLocalName())) {
            extension.setExpression(xtr.getElementText().trim());

          } else if (xtr.isEndElement() && getElementName().equalsIgnoreCase(xtr.getLocalName())) {
            readyWithFieldExtension = true;
          }
        }
View Full Code Here

    assertEquals("servicetask", serviceTask.getId());
    assertEquals("Service task", serviceTask.getName());
   
    List<FieldExtension> fields = serviceTask.getFieldExtensions();
    assertEquals(2, fields.size());
    FieldExtension field = (FieldExtension) fields.get(0);
    assertEquals("testField", field.getFieldName());
    assertEquals("test", field.getStringValue());
    field = (FieldExtension) fields.get(1);
    assertEquals("testField2", field.getFieldName());
    assertEquals("${test}", field.getExpression());
   
    listeners = serviceTask.getExecutionListeners();
    validateExecutionListeners(listeners);
   
    extensionElementMap = serviceTask.getExtensionElements();
View Full Code Here

      if (itemsArrayNode != null) {
        for (JsonNode itemNode : itemsArrayNode) {
          JsonNode nameNode = itemNode.get(PROPERTY_SERVICETASK_FIELD_NAME);
          if (nameNode != null && StringUtils.isNotEmpty(nameNode.asText())) {
           
            FieldExtension field = new FieldExtension();
            field.setFieldName(nameNode.asText());
            if (StringUtils.isNotEmpty(getValueAsString(PROPERTY_SERVICETASK_FIELD_VALUE, itemNode))) {
              field.setStringValue(getValueAsString(PROPERTY_SERVICETASK_FIELD_VALUE, itemNode));
            } else if (StringUtils.isNotEmpty(getValueAsString(PROPERTY_SERVICETASK_FIELD_EXPRESSION, itemNode))) {
              field.setExpression(getValueAsString(PROPERTY_SERVICETASK_FIELD_EXPRESSION, itemNode));
            }
            task.getFieldExtensions().add(field);
          }
        }
      }
View Full Code Here

            List<FieldExtension> fields = new ArrayList<FieldExtension>();
            if (listenerFieldsArrayNode != null) {
              for (JsonNode fieldNode : listenerFieldsArrayNode){
                JsonNode fieldNameNode = fieldNode.get(PROPERTY_EXECUTION_LISTENER_FIELD_NAME);
                if (fieldNameNode != null && StringUtils.isNotEmpty(fieldNameNode.asText())){
                  FieldExtension field = new FieldExtension();
                  field.setFieldName(fieldNameNode.asText());
                  field.setStringValue(getValueAsString(PROPERTY_EXECUTION_LISTENER_FIELD_VALUE, fieldNode));
                  field.setExpression(getValueAsString(PROPERTY_EXECUTION_LISTENER_EXPRESSION, fieldNode));
                  fields.add(field);
                }
              }
            }
            listener.setFieldExtensions(fields);
View Full Code Here

    this.runAs = runAs;
  }
 
  public ServiceTask build() {
    if(serviceTask == null) {
      FieldExtension scriptFieldElement = new FieldExtension();
      scriptFieldElement.setFieldName(AlfrescoConversionConstants.SCRIPT_DELEGATE_SCRIPT_FIELD_NAME);
      scriptFieldElement.setExpression(finalScript.toString());
     
      serviceTask = new ServiceTask();
      serviceTask.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_CLASS);
      serviceTask.setImplementation(AlfrescoConversionConstants.CLASSNAME_SCRIPT_DELEGATE);
      serviceTask.getFieldExtensions().add(scriptFieldElement);
     
      if(runAs != null) {
        scriptFieldElement = new FieldExtension();
        scriptFieldElement.setFieldName(AlfrescoConversionConstants.SCRIPT_DELEGATE_RUN_AS_FIELD_NAME);
        scriptFieldElement.setExpression(runAs);
        serviceTask.getFieldExtensions().add(scriptFieldElement);
      }
    }
    return serviceTask;
  }
View Full Code Here

TOP

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

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.