JsonNode rootNode = MAPPER.readValue(jsonFileUrl.toURL(), JsonNode.class);\r
\r
log.debug("Creating Process models...");\r
- JsonNode nodes = rootNode.get("nodes");\r
+ JsonNode nodes = rootNode.get(JsonKeys.NODES);\r
if (nodes == null) {\r
return process;\r
}\r
\r
private List<SequenceFlow> getSequenceFlows(JsonNode jsonNode) {\r
List<SequenceFlow> flowList = new ArrayList<SequenceFlow>();\r
- JsonNode sequenceFlowNodes = jsonNode.get("sequenceFlows");\r
+ JsonNode sequenceFlowNodes = jsonNode.get(JsonKeys.SEQUENCE_FLOWS);\r
\r
Iterator<JsonNode> iter = sequenceFlowNodes.iterator();\r
while (iter.hasNext()) {\r
JsonNode connectionEntry = (JsonNode) iter.next();\r
- String sourceRef = getValueFromJsonNode(connectionEntry, "sourceRef");\r
- String targetRef = getValueFromJsonNode(connectionEntry, "targetRef");\r
- String condition = getValueFromJsonNode(connectionEntry, "condition");\r
+ String sourceRef = getValueFromJsonNode(connectionEntry, JsonKeys.SOURCE_REF);\r
+ String targetRef = getValueFromJsonNode(connectionEntry, JsonKeys.TARGET_REF);\r
+ String condition = getValueFromJsonNode(connectionEntry, JsonKeys.CONDITION);\r
SequenceFlow flow = new SequenceFlow();\r
flow.setId(sourceRef + targetRef);\r
flow.setSourceRef(sourceRef);\r
String jsonObject = jsonNode.toString();\r
Element element;\r
\r
- String nodeType = getValueFromJsonNode(jsonNode, "type");\r
+ String nodeType = getValueFromJsonNode(jsonNode, JsonKeys.TYPE);\r
switch (nodeType) {\r
case "startEvent":\r
element = MAPPER.readValue(jsonObject, StartEvent.class);\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 Apache License, Version 2.0\r
+ * and the Eclipse Public License v1.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.parser;\r
+\r
+public class JsonKeys {\r
+ // workflow keys\r
+ public static final String NODES = "nodes";\r
+ public static final String CONFIGS = "configs";\r
+ \r
+ // configs keys\r
+ public static final String REST_CONFIGS = "restConfigs";\r
+ public static final String TYPE = "type";\r
+ \r
+ // workflow node keys\r
+ public static final String SEQUENCE_FLOWS = "sequenceFlows";\r
+ \r
+ // sequence flow keys\r
+ public static final String SOURCE_REF = "sourceRef";\r
+ public static final String TARGET_REF = "targetRef";\r
+ public static final String CONDITION = "condition";\r
+ \r
+ \r
+}\r