Search in sources :

Example 16 with ServiceTask

use of org.activiti.bpmn.model.ServiceTask in project Activiti by Activiti.

the class MuleTaskJsonConverter method convertJsonToElement.

protected FlowElement convertJsonToElement(JsonNode elementNode, JsonNode modelNode, Map<String, JsonNode> shapeMap) {
    ServiceTask task = new ServiceTask();
    task.setType("mule");
    addField("endpointUrl", PROPERTY_MULETASK_ENDPOINT_URL, elementNode, task);
    addField("language", PROPERTY_MULETASK_LANGUAGE, elementNode, task);
    addField("payloadExpression", PROPERTY_MULETASK_PAYLOAD_EXPRESSION, elementNode, task);
    addField("resultVariable", PROPERTY_MULETASK_RESULT_VARIABLE, elementNode, task);
    return task;
}
Also used : ServiceTask(org.activiti.bpmn.model.ServiceTask)

Example 17 with ServiceTask

use of org.activiti.bpmn.model.ServiceTask in project Activiti by Activiti.

the class ServiceTaskJsonConverter method convertElementToJson.

protected void convertElementToJson(ObjectNode propertiesNode, BaseElement baseElement) {
    ServiceTask serviceTask = (ServiceTask) baseElement;
    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 ("camel".equalsIgnoreCase(serviceTask.getType())) {
        setPropertyFieldValue(PROPERTY_CAMELTASK_CAMELCONTEXT, "camelContext", serviceTask, propertiesNode);
    } else if ("mule".equalsIgnoreCase(serviceTask.getType())) {
        setPropertyFieldValue(PROPERTY_MULETASK_ENDPOINT_URL, "endpointUrl", serviceTask, propertiesNode);
        setPropertyFieldValue(PROPERTY_MULETASK_LANGUAGE, "language", serviceTask, propertiesNode);
        setPropertyFieldValue(PROPERTY_MULETASK_PAYLOAD_EXPRESSION, "payloadExpression", serviceTask, propertiesNode);
        setPropertyFieldValue(PROPERTY_MULETASK_RESULT_VARIABLE, "resultVariable", 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());
        }
        if (StringUtils.isNotEmpty(serviceTask.getResultVariableName())) {
            propertiesNode.put(PROPERTY_SERVICETASK_RESULT_VARIABLE, serviceTask.getResultVariableName());
        }
        addFieldExtensions(serviceTask.getFieldExtensions(), propertiesNode);
    }
}
Also used : ServiceTask(org.activiti.bpmn.model.ServiceTask)

Example 18 with ServiceTask

use of org.activiti.bpmn.model.ServiceTask in project Activiti by Activiti.

the class ServiceTaskJsonConverter method convertJsonToElement.

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));
    }
    if (StringUtils.isNotEmpty(getPropertyValueAsString(PROPERTY_SERVICETASK_RESULT_VARIABLE, elementNode))) {
        task.setResultVariableName(getPropertyValueAsString(PROPERTY_SERVICETASK_RESULT_VARIABLE, elementNode));
    }
    JsonNode fieldsNode = getProperty(PROPERTY_SERVICETASK_FIELDS, elementNode);
    if (fieldsNode != null) {
        JsonNode itemsArrayNode = fieldsNode.get("fields");
        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_STRING_VALUE, itemNode))) {
                        field.setStringValue(getValueAsString(PROPERTY_SERVICETASK_FIELD_STRING_VALUE, itemNode));
                    } else if (StringUtils.isNotEmpty(getValueAsString(PROPERTY_SERVICETASK_FIELD_STRING, itemNode))) {
                        field.setStringValue(getValueAsString(PROPERTY_SERVICETASK_FIELD_STRING, itemNode));
                    } else if (StringUtils.isNotEmpty(getValueAsString(PROPERTY_SERVICETASK_FIELD_EXPRESSION, itemNode))) {
                        field.setExpression(getValueAsString(PROPERTY_SERVICETASK_FIELD_EXPRESSION, itemNode));
                    }
                    task.getFieldExtensions().add(field);
                }
            }
        }
    }
    return task;
}
Also used : ServiceTask(org.activiti.bpmn.model.ServiceTask) FieldExtension(org.activiti.bpmn.model.FieldExtension) JsonNode(com.fasterxml.jackson.databind.JsonNode)

Example 19 with ServiceTask

use of org.activiti.bpmn.model.ServiceTask in project Activiti by Activiti.

the class CamelTaskJsonConverter method convertJsonToElement.

protected FlowElement convertJsonToElement(JsonNode elementNode, JsonNode modelNode, Map<String, JsonNode> shapeMap) {
    ServiceTask task = new ServiceTask();
    task.setType("camel");
    addField("camelContext", PROPERTY_CAMELTASK_CAMELCONTEXT, elementNode, task);
    return task;
}
Also used : ServiceTask(org.activiti.bpmn.model.ServiceTask)

Example 20 with ServiceTask

use of org.activiti.bpmn.model.ServiceTask in project Activiti by Activiti.

the class MailTaskJsonConverter method convertJsonToElement.

protected FlowElement convertJsonToElement(JsonNode elementNode, JsonNode modelNode, Map<String, JsonNode> shapeMap) {
    ServiceTask task = new ServiceTask();
    task.setType(ServiceTask.MAIL_TASK);
    addField(PROPERTY_MAILTASK_TO, elementNode, task);
    addField(PROPERTY_MAILTASK_FROM, elementNode, task);
    addField(PROPERTY_MAILTASK_SUBJECT, elementNode, task);
    addField(PROPERTY_MAILTASK_CC, elementNode, task);
    addField(PROPERTY_MAILTASK_BCC, elementNode, task);
    addField(PROPERTY_MAILTASK_TEXT, elementNode, task);
    addField(PROPERTY_MAILTASK_HTML, elementNode, task);
    addField(PROPERTY_MAILTASK_CHARSET, elementNode, task);
    return task;
}
Also used : ServiceTask(org.activiti.bpmn.model.ServiceTask)

Aggregations

ServiceTask (org.activiti.bpmn.model.ServiceTask)21 FlowElement (org.activiti.bpmn.model.FlowElement)9 FieldExtension (org.activiti.bpmn.model.FieldExtension)6 ActivitiListener (org.activiti.bpmn.model.ActivitiListener)4 UserTask (org.activiti.bpmn.model.UserTask)3 ScriptServiceTaskBuilder (org.activiti.workflow.simple.alfresco.conversion.script.ScriptServiceTaskBuilder)3 BoundaryEvent (org.activiti.bpmn.model.BoundaryEvent)2 MultiInstanceLoopCharacteristics (org.activiti.bpmn.model.MultiInstanceLoopCharacteristics)2 Process (org.activiti.bpmn.model.Process)2 SequenceFlow (org.activiti.bpmn.model.SequenceFlow)2 PropertyReference (org.activiti.workflow.simple.alfresco.conversion.script.PropertyReference)2 M2Model (org.activiti.workflow.simple.alfresco.model.M2Model)2 M2Type (org.activiti.workflow.simple.alfresco.model.M2Type)2 Test (org.junit.Test)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 List (java.util.List)1 Activity (org.activiti.bpmn.model.Activity)1 Artifact (org.activiti.bpmn.model.Artifact)1