Package org.activiti.bpmn.model

Examples of org.activiti.bpmn.model.ServiceTask


      Object bo = getBusinessObject(pe);
      // the filter assured, that it is a EClass
      if (bo == null)
        return;

      ServiceTask mailTask = (ServiceTaskbo;
      String to = getFieldString("mail.parameters.to", mailTask);
      toText.setText(to == null ? "" : to);
      String toMany = getFieldString("mail.parameters.to_many", mailTask);
      toManyText.setText(toMany == null ? "" : toMany);
      String from = getFieldString("mail.parameters.from", mailTask);
View Full Code Here


      Object bo = getBusinessObject(pe);
      // the filter assured, that it is a EClass
      if (bo == null)
        return;
     
      ServiceTask scriptTask = (ServiceTask) bo;
     
      String script = getFieldString("script", scriptTask);
      scriptText.setText(script == null ? "" : script);
      String runAs = getFieldString("runAs", scriptTask);
      runAsText.setText(runAs == null ? "" : runAs);
View Full Code Here

            parentObject instanceof SubProcess || parentObject instanceof Lane);
  }

  @Override
  public Object[] create(ICreateContext context) {
    ServiceTask newMailTask = new ServiceTask();
    newMailTask.setImplementation(AlfrescoScriptTask.ALFRESCO_SCRIPT_DELEGATE);
    newMailTask.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_CLASS);
    newMailTask.setId(getNextId(newMailTask));
    newMailTask.setName("Alfresco Mail Task");
    FieldExtension fieldExtension = new FieldExtension();
    fieldExtension.setFieldName("script");
    fieldExtension.setStringValue("var mail = actions.create(\"mail\");\nmail.execute(bpm_package);");
    newMailTask.getFieldExtensions().add(fieldExtension);
   
    Object parentObject = getBusinessObjectForPictogramElement(context.getTargetContainer());
    if (parentObject instanceof SubProcess) {
      ((SubProcess) parentObject).addFlowElement(newMailTask);
     
    } else if (parentObject instanceof Lane) {
      final Lane lane = (Lane) parentObject;
      lane.getFlowReferences().add(newMailTask.getId());
      lane.getParentProcess().addFlowElement(newMailTask);
     
    } else {
      Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(getDiagram()));
      if (model.getBpmnModel().getMainProcess() == null) {
View Full Code Here

            parentObject instanceof SubProcess || parentObject instanceof Lane);
  }

  @Override
  public Object[] create(ICreateContext context) {
    ServiceTask newScriptTask = new ServiceTask();
    newScriptTask.setImplementation(AlfrescoScriptTask.ALFRESCO_SCRIPT_DELEGATE);
    newScriptTask.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_CLASS);
    newScriptTask.setId(getNextId(newScriptTask));
    newScriptTask.setName("Alfresco Script Task");

    Object parentObject = getBusinessObjectForPictogramElement(context.getTargetContainer());
    if (parentObject instanceof SubProcess) {
      ((SubProcess) parentObject).addFlowElement(newScriptTask);
     
    } else if (parentObject instanceof Lane) {
      final Lane lane = (Lane) parentObject;
      lane.getFlowReferences().add(newScriptTask.getId());
      lane.getParentProcess().addFlowElement(newScriptTask);
     
    } else {
      Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(getDiagram()));
      if (model.getBpmnModel().getMainProcess() == null) {
View Full Code Here

    this.shapesArrayNode = shapesArrayNode;
    GraphicInfo graphicInfo = model.getGraphicInfo(flowElement.getId());
   
    String stencilId = null;
    if (flowElement instanceof ServiceTask) {
      ServiceTask serviceTask = (ServiceTask) flowElement;
      if ("mail".equalsIgnoreCase(serviceTask.getType())) {
        stencilId = STENCIL_TASK_MAIL;
      } else {
        stencilId = getStencilId(flowElement);
      }
    } else {
View Full Code Here

    return STENCIL_TASK_JENKINS;
  }

  @Override
  protected void convertElementToJson(ObjectNode propertiesNode, FlowElement flowElement) {
      ServiceTask serviceTask = (ServiceTask)flowElement;
     
    for (FieldExtension extension : serviceTask.getFieldExtensions()) {
      ObjectNode propertyItemNode = objectMapper.createObjectNode();
      String fn = extension.getFieldName();
      String val = extension.getStringValue();
     
      // TODO should have a better way to map these attributes!
View Full Code Here

    }
  }

  @Override
  protected FlowElement convertJsonToElement(JsonNode elementNode, JsonNode modelNode, Map<String, JsonNode> shapeMap) {
    ServiceTask task = new ServiceTask();
   
      task.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_CLASS);
      task.setImplementation(XML_JENKINSTASK_DELEGATE_CLASS);
     
      String jobName = getPropertyValueAsString(JSON_JENKINSTASK_JOB_NAME, elementNode);
    if (StringUtils.isNotEmpty(jobName)) {
      FieldExtension f1 = new FieldExtension();
            f1.setFieldName(XML_JENKINSTASK_JOB_NAME);
            f1.setStringValue(jobName);
            task.getFieldExtensions().add(f1);
      }     
   
    FieldExtension f2 = new FieldExtension();
        f2.setFieldName(XML_JENKINSTASK_MANUAL_LAUNCH_MODE);
        f2.setStringValue(Boolean.toString(getPropertyValueAsBoolean(JSON_JENKINSTASK_MANUAL_LAUNCH_MODE, elementNode)));
        task.getFieldExtensions().add(f2);

        convertJsonToFormProperties(elementNode, task);
    return task;
  }
View Full Code Here

  private void validateModel(BpmnModel model) {
    FlowElement flowElement = model.getMainProcess().getFlowElementMap().get("servicetask");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof ServiceTask);
    assertEquals("servicetask", flowElement.getId());
    ServiceTask serviceTask = (ServiceTask) flowElement;
    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()));
    assertEquals("org.test.TestClass", listener.getImplementation());
    assertEquals("start", listener.getEvent());
View Full Code Here

  }
    return STENCIL_TASK_SERVICE;
  }
 
  protected void convertElementToJson(ObjectNode propertiesNode, FlowElement flowElement) {
    ServiceTask serviceTask = (ServiceTask) flowElement;
   
    if ("mail".equalsIgnoreCase(serviceTask.getType())) {
     
      setPropertyFieldValue(PROPERTY_MAILTASK_TO, serviceTask, propertiesNode);
      setPropertyFieldValue(PROPERTY_MAILTASK_FROM, serviceTask, propertiesNode);
      setPropertyFieldValue(PROPERTY_MAILTASK_SUBJECT, serviceTask, propertiesNode);
      setPropertyFieldValue(PROPERTY_MAILTASK_CC, serviceTask, propertiesNode);
      setPropertyFieldValue(PROPERTY_MAILTASK_BCC, serviceTask, propertiesNode);
      setPropertyFieldValue(PROPERTY_MAILTASK_TEXT, serviceTask, propertiesNode);
      setPropertyFieldValue(PROPERTY_MAILTASK_HTML, serviceTask, propertiesNode);
      setPropertyFieldValue(PROPERTY_MAILTASK_CHARSET, serviceTask, propertiesNode);
     
    } else {
   
      if (ImplementationType.IMPLEMENTATION_TYPE_CLASS.equals(serviceTask.getImplementationType())) {
        propertiesNode.put(PROPERTY_SERVICETASK_CLASS, serviceTask.getImplementation());
      } else if (ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION.equals(serviceTask.getImplementationType())) {
        propertiesNode.put(PROPERTY_SERVICETASK_EXPRESSION, serviceTask.getImplementation());
      } else if (ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION.equals(serviceTask.getImplementationType())) {
        propertiesNode.put(PROPERTY_SERVICETASK_DELEGATE_EXPRESSION, serviceTask.getImplementation());
      }
     
      addFieldExtensions(serviceTask.getFieldExtensions(), propertiesNode);
    }
   
  // TODO should have a better mapper in place
    if (JenkinsTaskJsonConverter.XML_JENKINSTASK_DELEGATE_CLASS.equals(serviceTask.getImplementation())){
      new JenkinsTaskJsonConverter().convertElementToJson(propertiesNode,flowElement);
    }
  }
View Full Code Here

      new JenkinsTaskJsonConverter().convertElementToJson(propertiesNode,flowElement);
    }
  }
 
  protected FlowElement convertJsonToElement(JsonNode elementNode, JsonNode modelNode, Map<String, JsonNode> shapeMap) {
    ServiceTask task = new ServiceTask();
    if (StringUtils.isNotEmpty(getPropertyValueAsString(PROPERTY_SERVICETASK_CLASS, elementNode))) {
      task.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_CLASS);
      task.setImplementation(getPropertyValueAsString(PROPERTY_SERVICETASK_CLASS, elementNode));
     
    } else if (StringUtils.isNotEmpty(getPropertyValueAsString(PROPERTY_SERVICETASK_EXPRESSION, elementNode))) {
      task.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION);
      task.setImplementation(getPropertyValueAsString(PROPERTY_SERVICETASK_EXPRESSION, elementNode));
     
    } else if (StringUtils.isNotEmpty(getPropertyValueAsString(PROPERTY_SERVICETASK_DELEGATE_EXPRESSION, elementNode))) {
      task.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION);
      task.setImplementation(getPropertyValueAsString(PROPERTY_SERVICETASK_DELEGATE_EXPRESSION, elementNode));
    }
   
    JsonNode fieldsNode = getProperty(PROPERTY_SERVICETASK_FIELDS, elementNode);
    if (fieldsNode != null) {
      JsonNode itemsArrayNode = fieldsNode.get(EDITOR_PROPERTIES_GENERAL_ITEMS);
      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

TOP

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

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.