summaryrefslogtreecommitdiffstats
path: root/sdc-workflow-designer-server
diff options
context:
space:
mode:
authorLvbo163 <lv.bo163@zte.com.cn>2017-09-26 09:35:43 +0800
committerLvbo163 <lv.bo163@zte.com.cn>2017-09-26 09:35:43 +0800
commit2f4f12caf3bf04249ed3a0427e36c6b0693c74dd (patch)
tree2cdc39f1d03e426f990677ed6577ae1d7bc7180a /sdc-workflow-designer-server
parentc48747269ff30e101835877cb57d4df87bdead3c (diff)
Support start and end event
Support convert start and end event json object Issue-ID: SDC-396 Change-Id: I70d55908b0bd95f38e90a9bdda0a748cdcd3b08e Signed-off-by: Lvbo163 <lv.bo163@zte.com.cn>
Diffstat (limited to 'sdc-workflow-designer-server')
-rw-r--r--sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/EndEvent.java15
-rw-r--r--sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/StartEvent.java15
-rw-r--r--sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/parser/Bpmn4ToscaJsonParser.java21
3 files changed, 49 insertions, 2 deletions
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/EndEvent.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/EndEvent.java
new file mode 100644
index 00000000..86b1c8fc
--- /dev/null
+++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/EndEvent.java
@@ -0,0 +1,15 @@
+/**
+ * Copyright (c) 2017 ZTE Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.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 EndEvent extends Element {
+}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/StartEvent.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/StartEvent.java
new file mode 100644
index 00000000..963d332b
--- /dev/null
+++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/StartEvent.java
@@ -0,0 +1,15 @@
+/**
+ * Copyright (c) 2017 ZTE Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.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 StartEvent extends Element {
+}
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 64bff27b..a7511482 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
@@ -19,8 +19,10 @@ import java.util.Iterator;
import java.util.List;
import org.onap.sdc.workflowdesigner.model.Element;
+import org.onap.sdc.workflowdesigner.model.EndEvent;
import org.onap.sdc.workflowdesigner.model.Process;
import org.onap.sdc.workflowdesigner.model.SequenceFlow;
+import org.onap.sdc.workflowdesigner.model.StartEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -96,8 +98,23 @@ public class Bpmn4ToscaJsonParser {
}
protected Element createElementFromJson(JsonNode jsonNode) throws JsonParseException, JsonMappingException, IOException {
- String jsonObject = jsonNode.toString();
- return MAPPER.readValue(jsonObject, Element.class);
+ String jsonObject = jsonNode.toString();
+ Element element;
+
+ String nodeType = getValueFromJsonNode(jsonNode, "type");
+ switch (nodeType) {
+ case "startEvent":
+ element = MAPPER.readValue(jsonObject, StartEvent.class);
+ break;
+ case "endEvent":
+ element = MAPPER.readValue(jsonObject, EndEvent.class);
+ break;
+ default:
+ log.warn("Ignoring node: type '" + nodeType + "' is unkown");
+ return null;
+ }
+
+ return element;
}
}