aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/DataObject.java42
-rw-r--r--sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/Process.java8
-rw-r--r--sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/parser/Bpmn4ToscaJsonParser.java31
3 files changed, 77 insertions, 4 deletions
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/DataObject.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/DataObject.java
new file mode 100644
index 00000000..0ae76b5b
--- /dev/null
+++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/DataObject.java
@@ -0,0 +1,42 @@
+/**
+ * Copyright (c) 2017 ZTE Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the Apache License, Version 2.0
+ * and the Eclipse Public License v1.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * ZTE - initial API and implementation and/or initial documentation
+ */
+package org.onap.sdc.workflowdesigner.model;
+
+public class DataObject {
+ private String id;
+ private String name;
+ private String value;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/Process.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/Process.java
index c229c291..6413ad67 100644
--- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/Process.java
+++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/Process.java
@@ -19,6 +19,7 @@ public class Process {
private boolean isExecutable;
private List<Element> elementList = new ArrayList<Element>();
private List<SequenceFlow> sequenceFlowList = new ArrayList<SequenceFlow>();
+ private List<DataObject> dataObjectList = new ArrayList<DataObject>();
public Process(String id) {
this.id = id;
@@ -56,4 +57,11 @@ public class Process {
this.sequenceFlowList = sequenceFlowList;
}
+ public List<DataObject> getDataObjectList() {
+ return dataObjectList;
+ }
+
+ public void setDataObjectList(List<DataObject> dataObjectList) {
+ this.dataObjectList = dataObjectList;
+ }
}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/parser/Bpmn4ToscaJsonParser.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/parser/Bpmn4ToscaJsonParser.java
index 8cad4d8c..390dc0b9 100644
--- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/parser/Bpmn4ToscaJsonParser.java
+++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/parser/Bpmn4ToscaJsonParser.java
@@ -18,8 +18,10 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import org.onap.sdc.workflowdesigner.model.DataObject;
import org.onap.sdc.workflowdesigner.model.Element;
import org.onap.sdc.workflowdesigner.model.EndEvent;
+import org.onap.sdc.workflowdesigner.model.Parameter;
import org.onap.sdc.workflowdesigner.model.Process;
import org.onap.sdc.workflowdesigner.model.SequenceFlow;
import org.onap.sdc.workflowdesigner.model.StartEvent;
@@ -67,12 +69,33 @@ public class Bpmn4ToscaJsonParser {
// get sequence flows
List<SequenceFlow> flowList = getSequenceFlows(jsonNode);
process.getSequenceFlowList().addAll(flowList);
+
+ // add dataObject
+ if (element instanceof StartEvent) {
+ List<DataObject> dataObjects = this.getDataObject((StartEvent) element);
+ process.getDataObjectList().addAll(dataObjects);
+ }
}
return process;
}
+ private List<DataObject> getDataObject(StartEvent startEvent) {
+ List<DataObject> dataObjects = new ArrayList<DataObject>();
+
+ for (Parameter parameter : startEvent.getParameters()) {
+ DataObject dataObject = new DataObject();
+ dataObject.setId(parameter.getName());
+ dataObject.setName(parameter.getName());
+ dataObject.setValue((String) parameter.getValue());
+
+ dataObjects.add(dataObject);
+ }
+
+ return dataObjects;
+ }
+
private List<SequenceFlow> getSequenceFlows(JsonNode jsonNode) {
List<SequenceFlow> flowList = new ArrayList<SequenceFlow>();
JsonNode sequenceFlowNodes = jsonNode.get(JsonKeys.SEQUENCE_FLOWS);
@@ -94,10 +117,6 @@ public class Bpmn4ToscaJsonParser {
return flowList;
}
- private String getValueFromJsonNode(JsonNode jsonNode, String key) {
- return jsonNode.get(key) == null ? null : jsonNode.get(key).asText();
- }
-
protected Element createElementFromJson(JsonNode jsonNode)
throws JsonParseException, JsonMappingException, IOException {
String jsonObject = jsonNode.toString();
@@ -119,4 +138,8 @@ public class Bpmn4ToscaJsonParser {
return element;
}
+ private String getValueFromJsonNode(JsonNode jsonNode, String key) {
+ return jsonNode.get(key) == null ? null : jsonNode.get(key).asText();
+ }
+
}