Define constant instead of literal getVnfRecipe 59/51159/1
authorPraneta Paithankar <praneta.paithankar@intel.com>
Mon, 11 Jun 2018 11:42:03 +0000 (04:42 -0700)
committerPraneta Paithankar <praneta.paithankar@intel.com>
Mon, 11 Jun 2018 11:45:13 +0000 (04:45 -0700)
Constant GET_VNF_RECIPE is defined and used instead of duplicating
literal "getVnfRecipe".

Issue-ID: SO-666

Change-Id: Ia82aa03dd6381c7d70942f718c35d39a36e6ea25
Signed-off-by: Praneta Paithankar <praneta.paithankar@intel.com>
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java

index 98f5329..1ef1313 100644 (file)
@@ -96,7 +96,8 @@ public class CatalogDatabase implements Closeable {
     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;
@@ -124,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
@@ -1122,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);
     }
 
@@ -1157,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);
     }
     
@@ -1190,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);
     }
     
@@ -1238,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);
     }