diff options
Diffstat (limited to 'sdc-workflow-designer-server')
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;
}
}
|