* Copyright (C) 2017 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END============================================
* ===================================================================
* limitations under the License.
* ============LICENSE_END============================================
* ===================================================================
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
- * Example json: {"collector":[{"id":"Collector_11r50j1", "from":"StartEvent_1"}],"stringMatch":[{"id":"StringMatch_0h6cbdv"}],"policy":[{"id":"Policy_0oxeocn", "from":"StringMatch_0h6cbdv"}]}
+ * Example json: {"policy"
+ * :[{"id":"Policy_0oxeocn", "from":"StartEvent_1"}]}
- private static final Logger logger = Logger.getLogger(ModelBpmn.class.getName());
+ protected static final EELFLogger logger = EELFManager.getInstance()
+ .getLogger(CldsService.class);
+ protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
// for each type, an array of entries
private final Map<String, List<ModelBpmnEntry>> entriesByType = new HashMap<>();
// for each type, an array of entries
private final Map<String, List<ModelBpmnEntry>> entriesByType = new HashMap<>();
ModelBpmn modelBpmn = new ModelBpmn();
ObjectMapper objectMapper = new ObjectMapper();
ObjectNode root = objectMapper.readValue(modelBpmnPropText, ObjectNode.class);
ModelBpmn modelBpmn = new ModelBpmn();
ObjectMapper objectMapper = new ObjectMapper();
ObjectNode root = objectMapper.readValue(modelBpmnPropText, ObjectNode.class);
Iterator<Entry<String, JsonNode>> entryItr = root.fields();
List<String> bpmnElementIdList = new ArrayList<>();
while (entryItr.hasNext()) {
Iterator<Entry<String, JsonNode>> entryItr = root.fields();
List<String> bpmnElementIdList = new ArrayList<>();
while (entryItr.hasNext()) {
Entry<String, JsonNode> entry = entryItr.next();
String type = entry.getKey();
ArrayNode arrayNode = (ArrayNode) entry.getValue();
Entry<String, JsonNode> entry = entryItr.next();
String type = entry.getKey();
ArrayNode arrayNode = (ArrayNode) entry.getValue();
- // process each id/from object, like: {"id":"Collector_11r50j1","from":"StartEvent_1"}
+ // process each id/from object, like:
+ // {"id":"Policy","from":"StartEvent_1"}
for (JsonNode anArrayNode : arrayNode) {
ObjectNode node = (ObjectNode) anArrayNode;
String id = node.get("id").asText();
for (JsonNode anArrayNode : arrayNode) {
ObjectNode node = (ObjectNode) anArrayNode;
String id = node.get("id").asText();
- return entriesByType.get(type).get(0).getFromId();
+ String modelElementFromIdId = "";
+ if (entriesByType.get(type) != null) {
+ modelElementFromIdId = entriesByType.get(type).get(0).getFromId();
+ }
+ return modelElementFromIdId;