aboutsummaryrefslogtreecommitdiffstats
path: root/mso-catalog-db/src
diff options
context:
space:
mode:
Diffstat (limited to 'mso-catalog-db/src')
-rw-r--r--mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java27
1 files changed, 15 insertions, 12 deletions
diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java
index 91c19dd97f..1ef1313158 100644
--- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java
+++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java
@@ -95,7 +95,9 @@ public class CatalogDatabase implements Closeable {
private static final String MODEL_CUSTOMIZATION_UUID = "modelCustomizationUuid";
private static final String VF_MODULE_MODEL_UUID = "vfModuleModelUUId";
private static final String NETWORK_SERVICE = "network service";
-
+ private static final String TEMPLATE_NAME = "template_name";
+ private static final String GET_VNF_RECIPE = "getVnfRecipe";
+
protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
protected Session session = null;
@@ -123,6 +125,7 @@ public class CatalogDatabase implements Closeable {
return session;
}
+
/**
* Close an open Catalog Database session.
* This method should always be called when a client is finished using a
@@ -198,7 +201,7 @@ public class CatalogDatabase implements Closeable {
String hql = "FROM HeatTemplate WHERE templateName = :template_name";
Query query = getSession().createQuery (hql);
- query.setParameter("template_name", templateName);
+ query.setParameter(TEMPLATE_NAME, templateName);
@SuppressWarnings("unchecked")
List <HeatTemplate> resultList = query.list();
@@ -231,7 +234,7 @@ public class CatalogDatabase implements Closeable {
String hql = "FROM HeatTemplate WHERE templateName = :template_name AND version = :version";
Query query = getSession().createQuery(hql);
- query.setParameter("template_name", templateName);
+ query.setParameter(TEMPLATE_NAME,templateName);
query.setParameter("version", version);
@SuppressWarnings("unchecked")
@@ -1121,14 +1124,14 @@ public class CatalogDatabase implements Closeable {
List <VnfRecipe> resultList = query.list();
if (resultList.isEmpty()) {
- LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe not found", "CatalogDB", "getVnfRecipe", null);
+ LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe not found", "CatalogDB", GET_VNF_RECIPE, null);
return null;
}
resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse(resultList);
- LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfRecipe", null);
+ LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", GET_VNF_RECIPE, null);
return resultList.get(0);
}
@@ -1156,14 +1159,14 @@ public class CatalogDatabase implements Closeable {
List <VnfRecipe> resultList = query.list();
if (resultList.isEmpty()) {
- LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe not found", "CatalogDB", "getVnfRecipe", null);
+ LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe not found", "CatalogDB", GET_VNF_RECIPE, null);
return null;
}
resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse(resultList);
- LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfRecipe", null);
+ LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", GET_VNF_RECIPE, null);
return resultList.get(0);
}
@@ -1189,14 +1192,14 @@ public class CatalogDatabase implements Closeable {
List <VnfRecipe> resultList = query.list();
if (resultList.isEmpty()) {
- LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe not found", "CatalogDB", "getVnfRecipe", null);
+ LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe not found", "CatalogDB", GET_VNF_RECIPE, null);
return null;
}
resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse(resultList);
- LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfRecipe", null);
+ LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", GET_VNF_RECIPE, null);
return resultList.get(0);
}
@@ -1237,11 +1240,11 @@ public class CatalogDatabase implements Closeable {
List <VnfRecipe> resultList = query.list();
if (resultList.isEmpty()) {
- LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe not found", "CatalogDB", "getVnfRecipe", null);
+ LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe not found", "CatalogDB", GET_VNF_RECIPE, null);
return null;
}
- LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfRecipe", null);
+ LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", GET_VNF_RECIPE, null);
return resultList.get(0);
}
@@ -3490,7 +3493,7 @@ public class CatalogDatabase implements Closeable {
String hql = "FROM HeatTemplate WHERE templateName = :template_name AND version = :version AND asdcResourceName = :asdcResourceName";
Query query = getSession ().createQuery (hql);
- query.setParameter ("template_name", templateName);
+ query.setParameter (TEMPLATE_NAME, templateName);
query.setParameter ("version", version);
query.setParameter ("asdcResourceName", asdcResourceName);