From 9157c0834b771964597da1f2a259b737fc86e1f7 Mon Sep 17 00:00:00 2001 From: "Determe, Sebastien (sd378r)" Date: Fri, 6 Oct 2017 14:07:37 +0200 Subject: Remove useless code This code was always returning an empty map so it has been removed Change-Id: I7691d2a52b2ea50d4cb8586b2e66b6ecfdd6fe13 Issue-ID: CLAMP-54 Signed-off-by: Determe, Sebastien (sd378r) --- .../clamp/clds/service/CldsTemplateService.java | 64 ---------------------- 1 file changed, 64 deletions(-) (limited to 'src/main/java/org') diff --git a/src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java b/src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java index e29b18879..73b593c37 100644 --- a/src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java +++ b/src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java @@ -26,18 +26,10 @@ package org.onap.clamp.clds.service; import com.att.ajsc.common.AjscService; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; import java.io.IOException; import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; import java.util.List; -import java.util.Map; -import java.util.Map.Entry; import javax.annotation.PostConstruct; import javax.ws.rs.Consumes; @@ -52,7 +44,6 @@ import javax.xml.transform.TransformerException; import org.onap.clamp.clds.dao.CldsDao; import org.onap.clamp.clds.model.CldsTemplate; import org.onap.clamp.clds.model.ValueItem; -import org.onap.clamp.clds.model.prop.ModelBpmn; import org.onap.clamp.clds.transform.XslTransformer; import org.onap.clamp.clds.util.LoggingUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -65,8 +56,6 @@ import org.springframework.beans.factory.annotation.Value; @Path("/cldsTempate") public class CldsTemplateService extends SecureServiceBase { - private static final String POLICY_KEY = "Policy"; - @Value("${CLDS_PERMISSION_TYPE_TEMPLATE:permission-type-template}") private String cldsPermissionTypeTemplate; @@ -244,14 +233,6 @@ public class CldsTemplateService extends SecureServiceBase { String bpmnText = cldsTemplate.getBpmnText(); String imageText = cldsTemplate.getImageText(); String propText = cldsTemplate.getPropText(); - Map newBpmnIdsMap = getNewBpmnIdsMap(bpmnText, cldsTemplate.getPropText()); - for (String currBpmnId : newBpmnIdsMap.keySet()) { - if (currBpmnId != null && newBpmnIdsMap.get(currBpmnId) != null) { - bpmnText = bpmnText.replace(currBpmnId, newBpmnIdsMap.get(currBpmnId)); - imageText = imageText.replace(currBpmnId, newBpmnIdsMap.get(currBpmnId)); - propText = propText.replace(currBpmnId, newBpmnIdsMap.get(currBpmnId)); - } - } cldsTemplate.setBpmnText(bpmnText); cldsTemplate.setImageText(imageText); cldsTemplate.setPropText(propText); @@ -288,49 +269,4 @@ public class CldsTemplateService extends SecureServiceBase { auditLogger.info("GET template names completed"); return names; } - - private Map getNewBpmnIdsMap(String bpmnText, String propText) - throws TransformerException, IOException { - /** - * Test sample code start - */ - String bpmnJson = cldsBpmnTransformer.doXslTransformToString(bpmnText); - ModelBpmn templateBpmn = ModelBpmn.create(bpmnJson); - List bpmnElementIds = templateBpmn.getBpmnElementIds(); - logger.info("value of elementIds:" + bpmnElementIds); - logger.info("value of prop text:" + propText); - Map bpmnIoIdsMap = new HashMap<>(); - if (bpmnElementIds != null && !bpmnElementIds.isEmpty()) { - ObjectMapper objectMapper = new ObjectMapper(); - ObjectNode root = objectMapper.readValue(propText, ObjectNode.class); - Iterator> entryItr = root.fields(); - while (entryItr.hasNext()) { - // process the entry - Entry entry = entryItr.next(); - String keyPropName = entry.getKey(); - for (String currElementId : bpmnElementIds) { - if (keyPropName != null && keyPropName.equalsIgnoreCase(currElementId)) { - ArrayNode arrayNode = (ArrayNode) entry.getValue(); - // process each id/from object, like: - // {"id":"Policy_11r50j1", "from":"StartEvent_1"} - for (JsonNode anArrayNode : arrayNode) { - ObjectNode node = (ObjectNode) anArrayNode; - String valueNode = node.get("value").asText(); - logger.info("value of node:" + valueNode); - if (keyPropName.startsWith(POLICY_KEY)) { - valueNode = POLICY_KEY + "_" + valueNode; - } - bpmnIoIdsMap.put(keyPropName, valueNode); - } - break; - } - } - } - } - logger.info("value of hashmap:" + bpmnIoIdsMap); - /** - * Test sample code end - */ - return bpmnIoIdsMap; - } } -- cgit 1.2.3-korg