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 javax.ws.rs.core.MediaType;
import javax.xml.transform.TransformerException;
-import org.camunda.bpm.engine.RuntimeService;
import org.onap.clamp.clds.dao.CldsDao;
import org.onap.clamp.clds.model.CldsTemplate;
import org.onap.clamp.clds.model.ValueItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
-import com.att.ajsc.common.AjscService;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-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;
-
/**
* Service to save and retrieve the CLDS model attributes.
*/
@Path("/cldsTempate")
public class CldsTemplateService extends SecureServiceBase {
- protected static final EELFLogger logger = EELFManager.getInstance().getLogger(CldsTemplateService.class);
- protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
-
- private static final String collectorKey = "Collector";
- private static final String stringMatchKey = "StringMatch";
- private static final String policyKey = "Policy";
+ private static final String POLICY_KEY = "Policy";
@Value("${CLDS_PERMISSION_TYPE_TEMPLATE:permission-type-template}")
private String cldsPermissionTypeTemplate;
@Autowired
private CldsDao cldsDao;
- @Autowired
- private RuntimeService runtimeService;
+
@Autowired
private XslTransformer cldsBpmnTransformer;
logger.info("value of elementIds:" + bpmnElementIds);
logger.info("value of prop text:" + propText);
Map<String, String> bpmnIoIdsMap = new HashMap<>();
- if (bpmnElementIds != null && bpmnElementIds.size() > 0) {
+ if (bpmnElementIds != null && !bpmnElementIds.isEmpty()) {
ObjectMapper objectMapper = new ObjectMapper();
ObjectNode root = objectMapper.readValue(propText, ObjectNode.class);
Iterator<Entry<String, JsonNode>> entryItr = root.fields();
if (keyPropName != null && keyPropName.equalsIgnoreCase(currElementId)) {
ArrayNode arrayNode = (ArrayNode) entry.getValue();
// process each id/from object, like:
- // {"id":"Collector_11r50j1", "from":"StartEvent_1"}
+ // {"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(collectorKey)) {
- valueNode = collectorKey + "_" + valueNode;
- } else if (keyPropName.startsWith(stringMatchKey)) {
- valueNode = stringMatchKey + "_" + valueNode;
- } else if (keyPropName.startsWith(policyKey)) {
- valueNode = policyKey + "_" + valueNode;
+ if (keyPropName.startsWith(POLICY_KEY)) {
+ valueNode = POLICY_KEY + "_" + valueNode;
}
bpmnIoIdsMap.put(keyPropName, valueNode);
}