提交 874c9bed 编写于 作者: T Tijs Rademakers

Made it working for execution listeners as well

上级 ceb28292
......@@ -120,11 +120,10 @@ public interface StencilConstants {
final String PROPERTY_EXECUTION_LISTENER_CLASS = "execution_listener_class";
final String PROPERTY_EXECUTION_LISTENER_EXPRESSION = "execution_listener_expression";
final String PROPERTY_EXECUTION_LISTENER_DELEGATEEXPRESSION = "execution_listener_delegate_expression";
final String PROPERTY_EXECUTION_LISTENER_FIELDS = "execution_listener_fields";
final String PROPERTY_EXECUTION_LISTENER_FIELD_NAME = "execution_listener_field_name";
final String PROPERTY_EXECUTION_LISTENER_FIELD_VALUE = "execution_listener_field_value";
final String PROPERTY_EXECUTION_LISTENER_FIELD_EXPRESSION = "execution_listener_field_expression";
final String PROPERTY_EXECUTION_LISTENER_FIELDS = "execution_listener_fields";
final String PROPERTY_EXECUTION_LISTENER_FIELD_NAME = "execution_listener_field_name";
final String PROPERTY_EXECUTION_LISTENER_FIELD_VALUE = "execution_listener_field_value";
final String PROPERTY_EXECUTION_LISTENER_FIELD_EXPRESSION = "execution_listener_field_expression";
final String PROPERTY_EVENT_LISTENERS = "eventlisteners";
final String PROPERTY_EVENT_LISTENER_EVENTS = "event_listener_events";
......
......@@ -314,10 +314,8 @@ public abstract class BaseBpmnJsonConverter implements EditorJsonConstants, Sten
if (ImplementationType.IMPLEMENTATION_TYPE_CLASS.equals(listener.getImplementationType())) {
propertyItemNode.put(listenerClass, listener.getImplementation());
// If this is a Task Listener then add field extensions
if(!isExecutionListener ) {
addTaskFieldExtensions(listener.getFieldExtensions(), propertyItemNode);
}
addFieldExtensions(listener.getFieldExtensions(), propertyItemNode, isExecutionListener);
} else if (ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION.equals(listener.getImplementationType())) {
propertyItemNode.put(listenerExpression, listener.getImplementation());
} else if (ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION.equals(listener.getImplementationType())) {
......@@ -332,24 +330,41 @@ public abstract class BaseBpmnJsonConverter implements EditorJsonConstants, Sten
propertiesNode.put(propertyName, listenersNode);
}
protected void addTaskFieldExtensions(List<FieldExtension> extensions, ObjectNode propertiesNode) {
ObjectNode fieldExtensionsNode = objectMapper.createObjectNode();
ArrayNode itemsNode = objectMapper.createArrayNode();
for (FieldExtension extension : extensions) {
ObjectNode propertyItemNode = objectMapper.createObjectNode();
propertyItemNode.put(PROPERTY_TASK_LISTENER_FIELD_NAME, extension.getFieldName());
if (StringUtils.isNotEmpty(extension.getStringValue())) {
propertyItemNode.put(PROPERTY_TASK_LISTENER_FIELD_VALUE, extension.getStringValue());
}
if (StringUtils.isNotEmpty(extension.getExpression())) {
propertyItemNode.put(PROPERTY_TASK_LISTENER_FIELD_EXPRESSION, extension.getExpression());
}
itemsNode.add(propertyItemNode);
protected void addFieldExtensions(List<FieldExtension> extensions, ObjectNode propertiesNode, boolean isExecutionListener) {
String fieldNameProperty = null;
String fieldValueProperty = null;
String fieldExpressionProperty = null;
String fieldProperty = null;
if (isExecutionListener) {
fieldNameProperty = PROPERTY_EXECUTION_LISTENER_FIELD_NAME;
fieldValueProperty = PROPERTY_EXECUTION_LISTENER_FIELD_VALUE;
fieldExpressionProperty = PROPERTY_EXECUTION_LISTENER_FIELD_EXPRESSION;
fieldProperty = PROPERTY_EXECUTION_LISTENER_FIELDS;
} else {
fieldNameProperty = PROPERTY_TASK_LISTENER_FIELD_NAME;
fieldValueProperty = PROPERTY_TASK_LISTENER_FIELD_VALUE;
fieldExpressionProperty = PROPERTY_TASK_LISTENER_FIELD_EXPRESSION;
fieldProperty = PROPERTY_TASK_LISTENER_FIELDS;
}
ObjectNode fieldExtensionsNode = objectMapper.createObjectNode();
ArrayNode itemsNode = objectMapper.createArrayNode();
for (FieldExtension extension : extensions) {
ObjectNode propertyItemNode = objectMapper.createObjectNode();
propertyItemNode.put(fieldNameProperty, extension.getFieldName());
if (StringUtils.isNotEmpty(extension.getStringValue())) {
propertyItemNode.put(fieldValueProperty, extension.getStringValue());
}
if (StringUtils.isNotEmpty(extension.getExpression())) {
propertyItemNode.put(fieldExpressionProperty, extension.getExpression());
}
itemsNode.add(propertyItemNode);
}
fieldExtensionsNode.put("totalCount", itemsNode.size());
fieldExtensionsNode.put(EDITOR_PROPERTIES_GENERAL_ITEMS, itemsNode);
propertiesNode.put(PROPERTY_TASK_LISTENER_FIELDS, fieldExtensionsNode.toString());
fieldExtensionsNode.put("totalCount", itemsNode.size());
fieldExtensionsNode.put(EDITOR_PROPERTIES_GENERAL_ITEMS, itemsNode);
propertiesNode.put(fieldProperty, fieldExtensionsNode.toString());
}
protected void addFieldExtensions(List<FieldExtension> extensions, ObjectNode propertiesNode) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册