summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArundathi Patil <arundpil@in.ibm.com>2018-11-27 11:06:07 +0530
committerIBM602-PC0F1E3C\Arundathi <arundpil@in.ibm.com>2018-11-27 11:06:36 +0530
commitc82cfd45b03b932cebd1b4a7f000f29f8d78e1dc (patch)
tree3f7637ef749aa552162cf1522487f427d970dce8
parent5a80eff8240087798f05da8bc7340873d6954b8c (diff)
Sonar Fix: DataBaseInitService.java
Fixed sonar issues/code-smells across this file Issue-ID: CCSDK-751 Change-Id: Id23ba470761de5470b37a5b52830b064fbbf934b Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java
index a4eb2ae7..a1a9b9ca 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java
@@ -63,6 +63,7 @@ public class DataBaseInitService {
private ModelTypeService modelTypeService;
private ResourceDictionaryService resourceDictionaryService;
private ConfigModelService configModelService;
+ private String updateBySystem = "System";
@Value("${load.dataTypePath}")
private String dataTypePath;
@@ -105,8 +106,6 @@ public class DataBaseInitService {
loadModelType();
loadResourceDictionary();
- // TODO("Enable after Multi file Service Template Repository implementation in place")
- //loadBlueprints();
}
private void loadModelType() {
@@ -188,6 +187,7 @@ public class DataBaseInitService {
throw new BluePrintException("couldn't get dictionary from content information");
}
} catch (Exception e) {
+ log.error("Exception", e);
errorBuilder.appendln("Dictionary loading Errors : " + file.getFilename() + ":" + e.getMessage());
}
}
@@ -223,6 +223,7 @@ public class DataBaseInitService {
log.info("Loaded service template successfully: {}", fileName);
} catch (Exception e) {
+ log.error("Exception", e);
errorBuilder.appendln("load config model " + fileName + " error : " + e.getMessage());
}
}
@@ -250,12 +251,13 @@ public class DataBaseInitService {
modelType.setDefinition(JacksonUtils.jsonNode(definitionContent));
modelType.setModelName(nodeKey);
modelType.setVersion(nodeType.getVersion());
- modelType.setUpdatedBy("System");
+ modelType.setUpdatedBy(updateBySystem);
modelType.setTags(nodeKey + "," + BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE + ","
+ nodeType.getDerivedFrom());
modelTypeService.saveModel(modelType);
log.trace("Loaded Node Type successfully : {}", file.getFilename());
} catch (Exception e) {
+ log.error("Exception", e);
errorBuilder.appendln("Node type loading error : " + file.getFilename() + ":" + e.getMessage());
}
}
@@ -274,12 +276,13 @@ public class DataBaseInitService {
modelType.setDefinition(JacksonUtils.jsonNode(definitionContent));
modelType.setModelName(dataKey);
modelType.setVersion(dataType.getVersion());
- modelType.setUpdatedBy("System");
+ modelType.setUpdatedBy(updateBySystem);
modelType.setTags(dataKey + "," + dataType.getDerivedFrom() + ","
+ BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);
modelTypeService.saveModel(modelType);
log.trace(" Loaded Data Type successfully : {}", file.getFilename());
} catch (Exception e) {
+ log.error("Exception", e);
errorBuilder.appendln("Data type loading error : " + file.getFilename() + ":" + e.getMessage());
}
}
@@ -298,12 +301,13 @@ public class DataBaseInitService {
modelType.setDefinition(JacksonUtils.jsonNode(definitionContent));
modelType.setModelName(dataKey);
modelType.setVersion(artifactType.getVersion());
- modelType.setUpdatedBy("System");
+ modelType.setUpdatedBy(updateBySystem);
modelType.setTags(dataKey + "," + artifactType.getDerivedFrom() + ","
+ BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE);
modelTypeService.saveModel(modelType);
log.trace("Loaded Artifact Type successfully : {}", file.getFilename());
} catch (Exception e) {
+ log.error("Exception", e);
errorBuilder.appendln("Artifact type loading error : " + file.getFilename() + ":" + e.getMessage());
}
}