Search in sources :

Example 91 with FieldExtension

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);
    }
}
Also used : FieldExtension(org.activiti.bpmn.model.FieldExtension)

Example 92 with FieldExtension

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);
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) FieldExtension(org.activiti.bpmn.model.FieldExtension) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) ActivitiListener(org.activiti.bpmn.model.ActivitiListener)

Example 93 with FieldExtension

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;
}
Also used : ServiceTask(org.activiti.bpmn.model.ServiceTask) FieldExtension(org.activiti.bpmn.model.FieldExtension) JsonNode(com.fasterxml.jackson.databind.JsonNode)

Example 94 with FieldExtension

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);
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) FieldExtension(org.activiti.bpmn.model.FieldExtension) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode)

Aggregations

FieldExtension (org.activiti.bpmn.model.FieldExtension)94 ArrayList (java.util.ArrayList)68 Test (org.junit.Test)67 Parameter (org.finra.herd.model.api.xml.Parameter)64 HashMap (java.util.HashMap)55 BusinessObjectDataKey (org.finra.herd.model.api.xml.BusinessObjectDataKey)24 BusinessObjectDataAttribute (org.finra.herd.model.api.xml.BusinessObjectDataAttribute)12 Job (org.finra.herd.model.api.xml.Job)11 ServiceTask (org.activiti.bpmn.model.ServiceTask)10 HistoricProcessInstance (org.activiti.engine.history.HistoricProcessInstance)10 BusinessObjectDataAttributeEntity (org.finra.herd.model.jpa.BusinessObjectDataAttributeEntity)9 AbstractServiceTest (org.finra.herd.service.AbstractServiceTest)9 ActivitiListener (org.activiti.bpmn.model.ActivitiListener)8 FieldDeclaration (org.activiti.engine.impl.bpmn.parser.FieldDeclaration)4 BusinessObjectDataStorageUnitKey (org.finra.herd.model.api.xml.BusinessObjectDataStorageUnitKey)4 JsonNode (com.fasterxml.jackson.databind.JsonNode)3 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)3 FlowElement (org.activiti.bpmn.model.FlowElement)3 Attribute (org.finra.herd.model.api.xml.Attribute)3 BusinessObjectDataAttributeKeys (org.finra.herd.model.api.xml.BusinessObjectDataAttributeKeys)3