aboutsummaryrefslogtreecommitdiffstats
path: root/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java
diff options
context:
space:
mode:
Diffstat (limited to 'mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java')
-rw-r--r--mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java43
1 files changed, 23 insertions, 20 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..af0ea101f4 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,8 +234,8 @@ 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("version", version);
+ query.setParameter(TEMPLATE_NAME, templateName);
+ query.setParameter(MODEL_VERSION, version);
@SuppressWarnings("unchecked")
List <HeatTemplate> resultList = query.list();
@@ -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);
}
@@ -1342,7 +1345,7 @@ public class CatalogDatabase implements Closeable {
String hql = "FROM VfModule WHERE type = :type and version = :version";
Query query = getSession().createQuery(hql);
query.setParameter ("type", type);
- query.setParameter ("version", version);
+ query.setParameter (MODEL_VERSION, version);
VfModule module = null;
try {
module = (VfModule) query.uniqueResult ();
@@ -2867,7 +2870,7 @@ public class CatalogDatabase implements Closeable {
query = getSession ().createQuery (hql.toString ());
query.setParameter ("modelCustomizationUuid", modelCustomizationUuid);
- query.setParameter ("version", asdcServiceModelVersion);
+ query.setParameter (MODEL_VERSION, asdcServiceModelVersion);
}else{
hql = new StringBuilder ("FROM VfModule WHERE type = :type AND version = :version AND modelVersion = :modelVersion");
@@ -2875,7 +2878,7 @@ public class CatalogDatabase implements Closeable {
query = getSession ().createQuery (hql.toString ());
query.setParameter (TYPE, vfModuleType);
- query.setParameter ("version", asdcServiceModelVersion);
+ query.setParameter (MODEL_VERSION, asdcServiceModelVersion);
query.setParameter ("modelVersion", modelVersion);
}
@@ -3490,8 +3493,8 @@ 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 ("version", version);
+ query.setParameter (TEMPLATE_NAME, templateName);
+ query.setParameter (MODEL_VERSION, version);
query.setParameter ("asdcResourceName", asdcResourceName);
@SuppressWarnings("unchecked")
@@ -3603,7 +3606,7 @@ public class CatalogDatabase implements Closeable {
String hql = "FROM HeatEnvironment WHERE name=:name AND version=:version AND asdcResourceName=:asdcResourceName";
Query query = getSession ().createQuery (hql);
query.setParameter ("name", name);
- query.setParameter ("version", version);
+ query.setParameter (MODEL_VERSION, version);
query.setParameter ("asdcResourceName", asdcResourceName);
HeatEnvironment env = null;
try {
@@ -3645,7 +3648,7 @@ public class CatalogDatabase implements Closeable {
String hql = "FROM HeatEnvironment WHERE artifactUuid=:artifactUuid AND version=:version";
Query query = getSession ().createQuery (hql);
query.setParameter ("artifactUuid", artifactUuid);
- query.setParameter ("version", version);
+ query.setParameter (MODEL_VERSION, version);
HeatEnvironment env = null;
try {
env = (HeatEnvironment) query.uniqueResult ();
@@ -4283,7 +4286,7 @@ public class CatalogDatabase implements Closeable {
query.setParameter ("fileName", fileName);
query.setParameter ("vnfResourceId", vnfResourceId);
query.setParameter ("asdcResourceName", asdcResourceName);
- query.setParameter ("version", version);
+ query.setParameter (MODEL_VERSION, version);
@SuppressWarnings("unchecked")