summaryrefslogtreecommitdiffstats
path: root/mso-catalog-db/src/main/java/org
diff options
context:
space:
mode:
authorsubhash kumar singh <subhash.kumar.singh@huawei.com>2018-05-17 08:52:36 +0000
committersubhash kumar singh <subhash.kumar.singh@huawei.com>2018-05-17 08:52:36 +0000
commit79a0dd38e0d1150e734d04e5ab999764a655af34 (patch)
tree94096534f872c8c5306b5dc26ba70362b66ba00e /mso-catalog-db/src/main/java/org
parentfe588ed137686e562a2039c3d4901dbbd456c05f (diff)
Fix resource population to DB
Fix resource population to DB. Change-Id: Iae25ce2f15fa121a45a55559458fcbbd217f2c7d Issue-ID: SO-624 Signed-off-by: subhash kumar singh <subhash.kumar.singh@huawei.com>
Diffstat (limited to 'mso-catalog-db/src/main/java/org')
-rw-r--r--mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java16
1 files changed, 16 insertions, 0 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 4fb5ebc1f8..91c19dd97f 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
@@ -3826,6 +3826,22 @@ public class CatalogDatabase implements Closeable {
LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveOrUpdateAllottedResourceCustomization", null);
}
}
+
+ public void saveVnfResource (VnfResource vnfResource) {
+ long startTime = System.currentTimeMillis ();
+ LOGGER.debug ("Catalog database - save vnf Resource with Name " + vnfResource.getModelName());
+ try {
+ VnfResource existing = this.getVnfResourceByModelUuid(vnfResource.getModelUuid());
+ if (existing == null) {
+ this.getSession().save(vnfResource);
+ } else {
+ LOGGER.debug("Found existing vnfResource with this modelUuid - no need to save");
+ }
+
+ } finally {
+ LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveOrUpdateVnfResourceCustomization", null);
+ }
+ }
public void saveNetworkResource (NetworkResource networkResource) throws RecordNotFoundException {
long startTime = System.currentTimeMillis ();