use of org.activiti.bpmn.model.FieldExtension in project Activiti by Activiti.
the class BaseBpmnJsonConverter method addField.
protected void addField(String name, String propertyName, JsonNode elementNode, ServiceTask task) {
FieldExtension field = new FieldExtension();
field.setFieldName(name);
String value = getPropertyValueAsString(propertyName, elementNode);
if (StringUtils.isNotEmpty(value)) {
if ((value.contains("${") || value.contains("#{")) && value.contains("}")) {
field.setExpression(value);
} else {
field.setStringValue(value);
}
task.getFieldExtensions().add(field);
}
}
use of org.activiti.bpmn.model.FieldExtension in project Activiti by Activiti.
the class BpmnJsonConverterUtil method convertListenersToJson.
public static void convertListenersToJson(List<ActivitiListener> listeners, boolean isExecutionListener, ObjectNode propertiesNode) {
String propertyName = null;
String valueName = null;
if (isExecutionListener) {
propertyName = PROPERTY_EXECUTION_LISTENERS;
valueName = "executionListeners";
} else {
propertyName = PROPERTY_TASK_LISTENERS;
valueName = "taskListeners";
}
ObjectNode listenersNode = objectMapper.createObjectNode();
ArrayNode itemsNode = objectMapper.createArrayNode();
for (ActivitiListener listener : listeners) {
ObjectNode propertyItemNode = objectMapper.createObjectNode();
propertyItemNode.put(PROPERTY_LISTENER_EVENT, listener.getEvent());
if (ImplementationType.IMPLEMENTATION_TYPE_CLASS.equals(listener.getImplementationType())) {
propertyItemNode.put(PROPERTY_LISTENER_CLASS_NAME, listener.getImplementation());
} else if (ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION.equals(listener.getImplementationType())) {
propertyItemNode.put(PROPERTY_LISTENER_EXPRESSION, listener.getImplementation());
} else if (ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION.equals(listener.getImplementationType())) {
propertyItemNode.put(PROPERTY_LISTENER_DELEGATE_EXPRESSION, listener.getImplementation());
}
if (CollectionUtils.isNotEmpty(listener.getFieldExtensions())) {
ArrayNode fieldsArray = objectMapper.createArrayNode();
for (FieldExtension fieldExtension : listener.getFieldExtensions()) {
ObjectNode fieldNode = objectMapper.createObjectNode();
fieldNode.put(PROPERTY_FIELD_NAME, fieldExtension.getFieldName());
if (StringUtils.isNotEmpty(fieldExtension.getStringValue())) {
fieldNode.put(PROPERTY_FIELD_STRING_VALUE, fieldExtension.getStringValue());
}
if (StringUtils.isNotEmpty(fieldExtension.getExpression())) {
fieldNode.put(PROPERTY_FIELD_EXPRESSION, fieldExtension.getExpression());
}
fieldsArray.add(fieldNode);
}
propertyItemNode.set(PROPERTY_LISTENER_FIELDS, fieldsArray);
}
itemsNode.add(propertyItemNode);
}
listenersNode.set(valueName, itemsNode);
propertiesNode.set(propertyName, listenersNode);
}
use of org.activiti.bpmn.model.FieldExtension in project Activiti by Activiti.
the class DecisionTaskJsonConverter method convertJsonToElement.
protected FlowElement convertJsonToElement(JsonNode elementNode, JsonNode modelNode, Map<String, JsonNode> shapeMap) {
ServiceTask serviceTask = new ServiceTask();
serviceTask.setType(ServiceTask.DMN_TASK);
JsonNode decisionTableReferenceNode = getProperty(PROPERTY_DECISIONTABLE_REFERENCE, elementNode);
if (decisionTableReferenceNode != null && decisionTableReferenceNode.has("id") && !(decisionTableReferenceNode.get("id").isNull())) {
String decisionTableId = decisionTableReferenceNode.get("id").asText();
if (decisionTableMap != null) {
String decisionTableKey = decisionTableMap.get(decisionTableId);
FieldExtension decisionTableKeyField = new FieldExtension();
decisionTableKeyField.setFieldName(PROPERTY_DECISIONTABLE_REFERENCE_KEY);
decisionTableKeyField.setStringValue(decisionTableKey);
serviceTask.getFieldExtensions().add(decisionTableKeyField);
}
}
return serviceTask;
}
use of org.activiti.bpmn.model.FieldExtension in project Activiti by Activiti.
the class BaseBpmnJsonConverter method addFieldExtensions.
protected void addFieldExtensions(List<FieldExtension> extensions, ObjectNode propertiesNode) {
ObjectNode fieldExtensionsNode = objectMapper.createObjectNode();
ArrayNode itemsNode = objectMapper.createArrayNode();
for (FieldExtension extension : extensions) {
ObjectNode propertyItemNode = objectMapper.createObjectNode();
propertyItemNode.put(PROPERTY_SERVICETASK_FIELD_NAME, extension.getFieldName());
if (StringUtils.isNotEmpty(extension.getStringValue())) {
propertyItemNode.put(PROPERTY_SERVICETASK_FIELD_STRING_VALUE, extension.getStringValue());
}
if (StringUtils.isNotEmpty(extension.getExpression())) {
propertyItemNode.put(PROPERTY_SERVICETASK_FIELD_EXPRESSION, extension.getExpression());
}
itemsNode.add(propertyItemNode);
}
fieldExtensionsNode.set("fields", itemsNode);
propertiesNode.set(PROPERTY_SERVICETASK_FIELDS, fieldExtensionsNode);
}
Aggregations