summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2018-12-20 13:28:43 +0100
committersebdet <sebastien.determe@intl.att.com>2018-12-20 13:28:43 +0100
commitb650caf4fbed4615eaacd84ba1cc2d6da573f32c (patch)
treeff32ee280d7dc9d6850af1c6cde3f9f24addd8f1 /src/main
parentda1d57b1870726437149949d1228848ac37da165 (diff)
Remove useless code
Removal of code not used at all, coming from Amsterdam release Issue-ID: CLAMP-252 Change-Id: I88e864c15f7efc079fbfe73dfd653e19f613ad6e Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/onap/clamp/clds/dao/CldsDao.java55
-rw-r--r--src/main/java/org/onap/clamp/clds/service/CldsService.java113
2 files changed, 1 insertions, 167 deletions
diff --git a/src/main/java/org/onap/clamp/clds/dao/CldsDao.java b/src/main/java/org/onap/clamp/clds/dao/CldsDao.java
index 622b61743..b6e27c5e1 100644
--- a/src/main/java/org/onap/clamp/clds/dao/CldsDao.java
+++ b/src/main/java/org/onap/clamp/clds/dao/CldsDao.java
@@ -32,7 +32,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.stream.Collectors;
import javax.sql.DataSource;
@@ -47,8 +46,6 @@ import org.onap.clamp.clds.model.CldsMonitoringDetails;
import org.onap.clamp.clds.model.CldsServiceData;
import org.onap.clamp.clds.model.CldsTemplate;
import org.onap.clamp.clds.model.CldsToscaModel;
-import org.onap.clamp.clds.model.CldsToscaModelDetails;
-import org.onap.clamp.clds.model.CldsToscaModelRevision;
import org.onap.clamp.clds.model.ValueItem;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
@@ -545,58 +542,6 @@ public class CldsDao {
return cldsToscaModels;
}
- // Retrieve Tosca Models & its revisions by policy Type.
- private List<CldsToscaModelDetails> getAllToscaModelVersion(String toscaModelName, String policyType,
- String version) {
- SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yyyy HH:mm:ss");
- List<CldsToscaModelDetails> cldsToscaModelDetailsList = new ArrayList<>();
- String toscaModelSql = "SELECT tm.tosca_model_name, tm.tosca_model_id, tm.policy_type, tmr.tosca_model_revision_id, tmr.version, tmr.user_id, tmr.createdTimestamp, tmr.lastUpdatedTimestamp "
- + "FROM tosca_model tm, tosca_model_revision tmr " + "WHERE tmr.tosca_model_id = tm.tosca_model_id "
- + ((policyType != null) ? (" AND tm.policy_type = '" + policyType + "'") : " ")
- + ((toscaModelName != null) ? (" AND tm.tosca_model_name = '" + toscaModelName + "'") : " ")
- + ((version != null) ? (" AND tmr.version = '" + version + "'") : "");
-
- List<Map<String, Object>> rows = jdbcTemplateObject.queryForList(toscaModelSql);
-
- if (rows != null && !rows.isEmpty()) {
- // Get list of all available modelIds
- List<String> listofModelIds = new ArrayList<>();
- for (Map<String, Object> r : rows) {
- if (r != null) {
- listofModelIds.add((String) r.get("tosca_model_id"));
- }
- }
- // Filter Distinct elements using streams
- listofModelIds = listofModelIds.stream().distinct().collect(Collectors.toList());
-
- // TODO change logic using java8
- for (String modelId : listofModelIds) {
- CldsToscaModelDetails cldsToscaModelDetails = new CldsToscaModelDetails();
- List<CldsToscaModelRevision> revisions = new ArrayList<>();
- for (Map<String, Object> row : rows) {
- String id = (String) row.get("tosca_model_id");
- if (modelId.equalsIgnoreCase(id)) {
- cldsToscaModelDetails.setId(id);
- cldsToscaModelDetails.setPolicyType((String) row.get("policy_type"));
- cldsToscaModelDetails.setToscaModelName((String) row.get("tosca_model_name"));
- cldsToscaModelDetails.setUserId((String) row.get("user_id"));
-
- CldsToscaModelRevision modelRevision = new CldsToscaModelRevision();
- modelRevision.setRevisionId((String) row.get("tosca_model_revision_id"));
- modelRevision.setVersion(((Double) row.get("version")));
- modelRevision.setUserId((String) row.get("user_id"));
- modelRevision.setCreatedDate(sdf.format(row.get("createdTimestamp")));
- modelRevision.setLastUpdatedDate(sdf.format(row.get("lastUpdatedTimestamp")));
- revisions.add(modelRevision);
- }
- }
- cldsToscaModelDetails.setToscaModelRevisions(revisions);
- cldsToscaModelDetailsList.add(cldsToscaModelDetails);
- }
- }
- return cldsToscaModelDetailsList;
- }
-
/**
* Method to upload a new version of Tosca Model Yaml in Database
*
diff --git a/src/main/java/org/onap/clamp/clds/service/CldsService.java b/src/main/java/org/onap/clamp/clds/service/CldsService.java
index e895519fd..206a4246b 100644
--- a/src/main/java/org/onap/clamp/clds/service/CldsService.java
+++ b/src/main/java/org/onap/clamp/clds/service/CldsService.java
@@ -52,7 +52,6 @@ import org.onap.clamp.clds.client.DcaeInventoryServices;
import org.onap.clamp.clds.client.req.sdc.SdcCatalogServices;
import org.onap.clamp.clds.config.ClampProperties;
import org.onap.clamp.clds.dao.CldsDao;
-import org.onap.clamp.clds.exception.CldsConfigException;
import org.onap.clamp.clds.exception.policy.PolicyClientException;
import org.onap.clamp.clds.exception.sdc.SdcCommunicationException;
import org.onap.clamp.clds.model.CldsDbServiceCache;
@@ -67,8 +66,6 @@ import org.onap.clamp.clds.model.DcaeEvent;
import org.onap.clamp.clds.model.ValueItem;
import org.onap.clamp.clds.model.properties.AbstractModelElement;
import org.onap.clamp.clds.model.properties.ModelProperties;
-import org.onap.clamp.clds.model.sdc.SdcResource;
-import org.onap.clamp.clds.model.sdc.SdcServiceDetail;
import org.onap.clamp.clds.model.sdc.SdcServiceInfo;
import org.onap.clamp.clds.sdc.controller.installer.CsarInstallerImpl;
import org.onap.clamp.clds.transform.XslTransformer;
@@ -503,7 +500,7 @@ public class CldsService extends SecureServiceBase {
* In case of issues
*/
public String getSdcProperties() throws IOException {
- return createPropertiesObjectByUUID("{}");
+ return ((ObjectNode) refProp.getJsonTemplate(GLOBAL_PROPERTIES_KEY)).toString();
}
/**
@@ -603,114 +600,6 @@ public class CldsService extends SecureServiceBase {
return serviceNode.toString();
}
- private String createPropertiesObjectByUUID(String cldsResponseStr) throws IOException {
- ObjectMapper mapper = JacksonUtils.getObjectMapperInstance();
- SdcServiceDetail cldsSdcServiceDetail = mapper.readValue(cldsResponseStr, SdcServiceDetail.class);
- ObjectNode globalPropsJson = (ObjectNode) refProp.getJsonTemplate(GLOBAL_PROPERTIES_KEY);
- if (cldsSdcServiceDetail != null && cldsSdcServiceDetail.getUuid() != null) {
- /**
- * to create json with vf, alarm and locations
- */
- ObjectNode serviceObjectNode = createEmptyVfAlarmObject();
- ObjectNode vfObjectNode = mapper.createObjectNode();
- /**
- * to create json with vf and vfresourceId
- */
- createVfObjectNode(vfObjectNode, cldsSdcServiceDetail.getResources());
- serviceObjectNode.putPOJO(cldsSdcServiceDetail.getInvariantUUID(), vfObjectNode);
- ObjectNode byServiceBasicObjetNode = mapper.createObjectNode();
- byServiceBasicObjetNode.putPOJO("byService", serviceObjectNode);
- /**
- * to create json with VFC Node
- */
- ObjectNode emptyvfcobjectNode = createByVFCObjectNode(cldsSdcServiceDetail.getResources());
- byServiceBasicObjetNode.putPOJO("byVf", emptyvfcobjectNode);
- globalPropsJson.putPOJO("shared", byServiceBasicObjetNode);
- logger.info("valuie of objNode: {}", globalPropsJson);
- }
- return globalPropsJson.toString();
- }
-
- private ObjectNode createEmptyVfAlarmObject() {
- ObjectMapper mapper = JacksonUtils.getObjectMapperInstance();
- ObjectNode emptyObjectNode = mapper.createObjectNode();
- emptyObjectNode.put("", "");
- ObjectNode vfObjectNode = mapper.createObjectNode();
- vfObjectNode.putPOJO("vf", emptyObjectNode);
- vfObjectNode.putPOJO("location", emptyObjectNode);
- vfObjectNode.putPOJO("alarmCondition", emptyObjectNode);
- ObjectNode emptyServiceObjectNode = mapper.createObjectNode();
- emptyServiceObjectNode.putPOJO("", vfObjectNode);
- return emptyServiceObjectNode;
- }
-
- private void createVfObjectNode(ObjectNode vfObjectNode2, List<SdcResource> rawCldsSdcResourceList) {
- ObjectMapper mapper = JacksonUtils.getObjectMapperInstance();
- ObjectNode vfNode = mapper.createObjectNode();
- vfNode.put("", "");
- // To remove repeated resource instance name from
- // resourceInstanceList
- List<SdcResource> cldsSdcResourceList = sdcCatalogServices
- .removeDuplicateSdcResourceInstances(rawCldsSdcResourceList);
- /**
- * Creating vf resource node using cldsSdcResource Object
- */
- if (cldsSdcResourceList != null && !cldsSdcResourceList.isEmpty()) {
- for (SdcResource cldsSdcResource : cldsSdcResourceList) {
- if (cldsSdcResource != null && "VF".equalsIgnoreCase(cldsSdcResource.getResoucreType())) {
- vfNode.put(cldsSdcResource.getResourceUUID(), cldsSdcResource.getResourceName());
- }
- }
- }
- vfObjectNode2.putPOJO("vf", vfNode);
- /**
- * creating location json object using properties file value
- */
- ObjectNode locationJsonNode;
- try {
- locationJsonNode = (ObjectNode) mapper.readValue(refProp.getStringValue("ui.location.default"),
- JsonNode.class);
- } catch (IOException e) {
- logger.error("Unable to load ui.location.default JSON in clds-references.properties properly", e);
- throw new CldsConfigException(
- "Unable to load ui.location.default JSON in clds-references.properties properly", e);
- }
- vfObjectNode2.putPOJO("location", locationJsonNode);
- /**
- * creating alarm json object using properties file value
- */
- String alarmStringValue = refProp.getStringValue("ui.alarm.default");
- logger.info("value of alarm: {}", alarmStringValue);
- ObjectNode alarmStringJsonNode;
- try {
- alarmStringJsonNode = (ObjectNode) mapper.readValue(alarmStringValue, JsonNode.class);
- } catch (IOException e) {
- logger.error("Unable to ui.alarm.default JSON in clds-references.properties properly", e);
- throw new CldsConfigException("Unable to load ui.alarm.default JSON in clds-references.properties properly",
- e);
- }
- vfObjectNode2.putPOJO("alarmCondition", alarmStringJsonNode);
- }
-
- private ObjectNode createByVFCObjectNode(List<SdcResource> cldsSdcResourceList) {
- ObjectMapper mapper = JacksonUtils.getObjectMapperInstance();
- ObjectNode emptyObjectNode = mapper.createObjectNode();
- ObjectNode emptyvfcobjectNode = mapper.createObjectNode();
- ObjectNode vfCObjectNode = mapper.createObjectNode();
- vfCObjectNode.putPOJO("vfC", emptyObjectNode);
- ObjectNode subVfCObjectNode = mapper.createObjectNode();
- subVfCObjectNode.putPOJO("vfc", emptyObjectNode);
- if (cldsSdcResourceList != null && !cldsSdcResourceList.isEmpty()) {
- for (SdcResource cldsSdcResource : cldsSdcResourceList) {
- if (cldsSdcResource != null && "VF".equalsIgnoreCase(cldsSdcResource.getResoucreType())) {
- vfCObjectNode.putPOJO(cldsSdcResource.getResourceUUID(), subVfCObjectNode);
- }
- }
- }
- emptyvfcobjectNode.putPOJO("", vfCObjectNode);
- return emptyvfcobjectNode;
- }
-
public ResponseEntity<CldsModel> deployModel(String modelName, CldsModel model) {
util.entering(request, "CldsService: Deploy model");
Date startTime = new Date();