--- /dev/null
+/**\r
+ * Copyright (c) 2017 ZTE Corporation.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * and the Apache License 2.0 which both accompany this distribution,\r
+ * and are available at http://www.eclipse.org/legal/epl-v10.html\r
+ * and http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Contributors:\r
+ * ZTE - initial API and implementation and/or initial documentation\r
+ */\r
+package org.onap.sdc.workflowdesigner.model;\r
+\r
+public class EndEvent extends Element {\r
+}\r
--- /dev/null
+/**\r
+ * Copyright (c) 2017 ZTE Corporation.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * and the Apache License 2.0 which both accompany this distribution,\r
+ * and are available at http://www.eclipse.org/legal/epl-v10.html\r
+ * and http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Contributors:\r
+ * ZTE - initial API and implementation and/or initial documentation\r
+ */\r
+package org.onap.sdc.workflowdesigner.model;\r
+\r
+public class StartEvent extends Element {\r
+}\r
import java.util.List;\r
\r
import org.onap.sdc.workflowdesigner.model.Element;\r
+import org.onap.sdc.workflowdesigner.model.EndEvent;\r
import org.onap.sdc.workflowdesigner.model.Process;\r
import org.onap.sdc.workflowdesigner.model.SequenceFlow;\r
+import org.onap.sdc.workflowdesigner.model.StartEvent;\r
import org.slf4j.Logger;\r
import org.slf4j.LoggerFactory;\r
\r
}\r
\r
protected Element createElementFromJson(JsonNode jsonNode) throws JsonParseException, JsonMappingException, IOException {\r
- String jsonObject = jsonNode.toString();\r
- return MAPPER.readValue(jsonObject, Element.class);\r
+ String jsonObject = jsonNode.toString();\r
+ Element element;\r
+ \r
+ String nodeType = getValueFromJsonNode(jsonNode, "type");\r
+ switch (nodeType) {\r
+ case "startEvent":\r
+ element = MAPPER.readValue(jsonObject, StartEvent.class);\r
+ break;\r
+ case "endEvent":\r
+ element = MAPPER.readValue(jsonObject, EndEvent.class);\r
+ break;\r
+ default:\r
+ log.warn("Ignoring node: type '" + nodeType + "' is unkown");\r
+ return null;\r
+ }\r
+\r
+ return element;\r
}\r
\r
}\r