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;
}
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);
}
}
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;
}
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;
}
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;
}
Aggregations