summaryrefslogtreecommitdiffstats
path: root/mso-catalog-db
diff options
context:
space:
mode:
Diffstat (limited to 'mso-catalog-db')
-rw-r--r--mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java94
-rw-r--r--mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ArRecipe.java46
-rw-r--r--mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkRecipe.java10
-rw-r--r--mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Recipe.java18
-rw-r--r--mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponentsRecipe.java10
-rw-r--r--mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfRecipe.java10
-rw-r--r--mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioning.java29
-rw-r--r--mso-catalog-db/src/main/resources/ArRecipe.hbm.xml62
-rw-r--r--mso-catalog-db/src/main/resources/NetworkRecipe.hbm.xml2
-rw-r--r--mso-catalog-db/src/main/resources/VnfComponentsRecipe.hbm.xml2
-rw-r--r--mso-catalog-db/src/main/resources/VnfRecipe.hbm.xml2
-rw-r--r--mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkRecipeTest.java4
-rw-r--r--mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfRecipeTest.java4
13 files changed, 197 insertions, 96 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 534b5a38c9..7cf8c2190c 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
@@ -205,7 +205,7 @@ public class CatalogDatabase implements Closeable {
LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. No template found", "CatalogDB", "getHeatTemplate", null);
return null;
}
- Collections.sort(resultList, new MavenLikeVersioningComparator());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse(resultList);
LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getHeatTemplate", null);
@@ -366,7 +366,7 @@ public class CatalogDatabase implements Closeable {
LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Service not found", "CatalogDB", "getServiceByName", null);
return null;
}
- Collections.sort (resultList, new MavenLikeVersioningComparator ());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse (resultList);
LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getServiceByName", null);
@@ -528,7 +528,7 @@ public class CatalogDatabase implements Closeable {
LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Service not found", "CatalogDB", "getServiceByModelName", null);
return null;
}
- Collections.sort(resultList, new MavenLikeVersioningComparator ());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse(resultList);
LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getServiceByModelName", null);
@@ -600,7 +600,7 @@ public class CatalogDatabase implements Closeable {
return null;
}
- Collections.sort (resultList, new MavenLikeVersioningComparator ());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse (resultList);
LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getServiceRecipe", null);
@@ -644,7 +644,7 @@ public class CatalogDatabase implements Closeable {
return null;
}
- Collections.sort(resultList, new MavenLikeVersioningComparator());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse(resultList);
LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getServiceRecipe", null);
@@ -671,7 +671,7 @@ public class CatalogDatabase implements Closeable {
return Collections.EMPTY_LIST;
}
- Collections.sort(resultList, new MavenLikeVersioningComparator());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse(resultList);
LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getServiceRecipes", null);
@@ -748,7 +748,7 @@ public class CatalogDatabase implements Closeable {
LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF not found", "CatalogDB", "getVnfResource", null);
return null;
}
- Collections.sort(resultList, new MavenLikeVersioningComparator());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse(resultList);
LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfResource", null);
@@ -874,7 +874,7 @@ public class CatalogDatabase implements Closeable {
return null;
}
- Collections.sort(resultList, new MavenLikeVersioningComparator());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse(resultList);
LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfResourceCustomizationByModelCustomizationName", null);
@@ -975,7 +975,7 @@ public class CatalogDatabase implements Closeable {
LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VF not found", "CatalogDB", "getVfModuleModelName", null);
return null;
}
- Collections.sort(resultList, new MavenLikeVersioningComparator());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse(resultList);
LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVfModuleModelName", null);
@@ -1073,7 +1073,7 @@ public class CatalogDatabase implements Closeable {
return null;
}
- Collections.sort(resultList, new MavenLikeVersioningComparator());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse(resultList);
LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getNetworkResource", null);
return resultList.get(0);
@@ -1122,7 +1122,7 @@ public class CatalogDatabase implements Closeable {
return null;
}
- Collections.sort(resultList, new MavenLikeVersioningComparator());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse(resultList);
LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfRecipe", null);
@@ -1156,7 +1156,7 @@ public class CatalogDatabase implements Closeable {
return null;
}
- Collections.sort(resultList, new MavenLikeVersioningComparator());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse(resultList);
LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfRecipe", null);
@@ -1189,7 +1189,7 @@ public class CatalogDatabase implements Closeable {
return null;
}
- Collections.sort(resultList, new MavenLikeVersioningComparator());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse(resultList);
LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF Recipe Entry found", "CatalogDB", "getVnfRecipeByVfModuleId", null);
@@ -1246,7 +1246,7 @@ public class CatalogDatabase implements Closeable {
LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VF not found", "CatalogDB", "getVfModuleType", null);
return null;
}
- Collections.sort (resultList, new MavenLikeVersioningComparator ());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse (resultList);
LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVfModuleType", null);
@@ -1373,7 +1373,7 @@ public class CatalogDatabase implements Closeable {
VfModule module = null;
if (modules != null && ! modules.isEmpty()) {
- Collections.sort (modules, new MavenLikeVersioningComparator ());
+ modules.sort(new MavenLikeVersioningComparator());
Collections.reverse (modules);
module = modules.get(0);
}
@@ -1829,7 +1829,7 @@ public class CatalogDatabase implements Closeable {
return null;
}
- Collections.sort (resultList, new MavenLikeVersioningComparator ());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse (resultList);
LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionId", null);
@@ -2186,7 +2186,7 @@ public class CatalogDatabase implements Closeable {
return new ArrayList<>();
}
- Collections.sort (serviceList, new MavenLikeVersioningComparator ());
+ serviceList.sort(new MavenLikeVersioningComparator());
Collections.reverse (serviceList);
Service service = serviceList.get(0);
@@ -2214,7 +2214,7 @@ public class CatalogDatabase implements Closeable {
return new ArrayList<>();
}
- Collections.sort (serviceList, new MavenLikeVersioningComparator ());
+ serviceList.sort(new MavenLikeVersioningComparator());
Collections.reverse (serviceList);
Service service = serviceList.get(0);
@@ -2317,7 +2317,7 @@ public class CatalogDatabase implements Closeable {
return new ArrayList<>();
}
- Collections.sort (serviceList, new MavenLikeVersioningComparator ());
+ serviceList.sort(new MavenLikeVersioningComparator());
Collections.reverse (serviceList);
// Step 2 - Now query to get the related VnfResourceCustomizations
@@ -2351,7 +2351,7 @@ public class CatalogDatabase implements Closeable {
if (resultList.isEmpty()) {
return new ArrayList<>();
}
- Collections.sort (resultList, new MavenLikeVersioningComparator ());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse (resultList);
Service service = resultList.get(0);
//now just call the method that takes the version - the service object will have the highest version
@@ -2372,7 +2372,7 @@ public class CatalogDatabase implements Closeable {
if (resultList.isEmpty()) {
return new ArrayList<>();
}
- Collections.sort (resultList, new MavenLikeVersioningComparator ());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse (resultList);
Service service = resultList.get(0);
LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllVnfsByServiceModelInvariantUuid", null);
@@ -2412,7 +2412,7 @@ public class CatalogDatabase implements Closeable {
if (resultList.isEmpty()) {
return Collections.EMPTY_LIST;
}
- Collections.sort (resultList, new MavenLikeVersioningComparator ());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse (resultList);
Service service = resultList.get(0);
@@ -2484,7 +2484,7 @@ public class CatalogDatabase implements Closeable {
return new ArrayList<>();
}
- Collections.sort (serviceList, new MavenLikeVersioningComparator ());
+ serviceList.sort(new MavenLikeVersioningComparator());
Collections.reverse (serviceList);
Service service = serviceList.get(0);
@@ -2510,7 +2510,7 @@ public class CatalogDatabase implements Closeable {
return new ArrayList<>();
}
- Collections.sort (serviceList, new MavenLikeVersioningComparator ());
+ serviceList.sort(new MavenLikeVersioningComparator());
Collections.reverse (serviceList);
Service service = serviceList.get(0);
@@ -2582,7 +2582,7 @@ public class CatalogDatabase implements Closeable {
return new ServiceMacroHolder();
}
- Collections.sort (serviceList, new MavenLikeVersioningComparator ());
+ serviceList.sort(new MavenLikeVersioningComparator());
Collections.reverse (serviceList);
Service service = serviceList.get(0);
@@ -2612,7 +2612,7 @@ public class CatalogDatabase implements Closeable {
return new ServiceMacroHolder();
}
- Collections.sort (serviceList, new MavenLikeVersioningComparator ());
+ serviceList.sort(new MavenLikeVersioningComparator());
Collections.reverse (serviceList);
Service service = serviceList.get(0);
@@ -2645,7 +2645,7 @@ public class CatalogDatabase implements Closeable {
return new ServiceMacroHolder();
}
- Collections.sort (serviceList, new MavenLikeVersioningComparator ());
+ serviceList.sort(new MavenLikeVersioningComparator());
Collections.reverse (serviceList);
Service service = serviceList.get(0);
@@ -2747,7 +2747,7 @@ public class CatalogDatabase implements Closeable {
return null;
}
- Collections.sort (resultList, new MavenLikeVersioningComparator ());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse (resultList);
VfModule vfMod = resultList.get(0);
@@ -2772,7 +2772,7 @@ public class CatalogDatabase implements Closeable {
return null;
}
- Collections.sort (resultList1, new MavenLikeVersioningComparator ());
+ resultList1.sort(new MavenLikeVersioningComparator());
Collections.reverse (resultList1);
LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe found", "CatalogDB", "getVfModuleRecipe", null);
@@ -2839,7 +2839,7 @@ public class CatalogDatabase implements Closeable {
return null;
}
- Collections.sort (resultList, new MavenLikeVersioningComparator ());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse (resultList);
VfModule vfMod = resultList.get(0);
@@ -2864,7 +2864,7 @@ public class CatalogDatabase implements Closeable {
return null;
}
- Collections.sort (resultList1, new MavenLikeVersioningComparator ());
+ resultList1.sort(new MavenLikeVersioningComparator());
Collections.reverse (resultList1);
LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe found", "CatalogDB", "getVnfComponentsRecipe", null);
@@ -2894,7 +2894,7 @@ public class CatalogDatabase implements Closeable {
return null;
}
- Collections.sort (resultList, new MavenLikeVersioningComparator ());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse (resultList);
VfModule vfMod = resultList.get(0);
@@ -2919,7 +2919,7 @@ public class CatalogDatabase implements Closeable {
return null;
}
- Collections.sort (resultList1, new MavenLikeVersioningComparator ());
+ resultList1.sort(new MavenLikeVersioningComparator());
Collections.reverse (resultList1);
LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe found", "CatalogDB", "getVnfComponentsRecipe", null);
@@ -4081,7 +4081,7 @@ public class CatalogDatabase implements Closeable {
newVnfRecipe.setDescription(vfRecipe.getDescription());
newVnfRecipe.setOrchestrationUri(vfRecipe.getOrchestrationUri());
newVnfRecipe.setRecipeTimeout(vfRecipe.getRecipeTimeout());
- newVnfRecipe.setVnfComponentParamXSD(vfRecipe.getVnfComponentParamXSD());
+ newVnfRecipe.setParamXSD(vfRecipe.getParamXSD());
newVnfRecipe.setVfModuleModelUUId(newRecipe.getModelUUID());
newVnfRecipe.setVersion(vfRecipe.getVersion());
newVnfRecipe.setVnfComponentType(vfRecipe.getVnfComponentType());
@@ -4383,7 +4383,7 @@ public class CatalogDatabase implements Closeable {
return null;
}
- Collections.sort (resultList, new MavenLikeVersioningComparator ());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse (resultList);
return resultList.get (0);
@@ -4434,7 +4434,7 @@ public class CatalogDatabase implements Closeable {
return null;
}
- Collections.sort (resultList, new MavenLikeVersioningComparator ());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse (resultList);
return resultList.get (0);
@@ -4473,7 +4473,7 @@ public class CatalogDatabase implements Closeable {
return null;
}
- Collections.sort (resultList, new MavenLikeVersioningComparator ());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse (resultList);
return resultList.get (0);
@@ -4507,7 +4507,7 @@ public class CatalogDatabase implements Closeable {
return null;
}
- Collections.sort (resultList, new MavenLikeVersioningComparator ());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse (resultList);
return resultList.get (0);
@@ -4564,7 +4564,7 @@ public class CatalogDatabase implements Closeable {
if (resultList.isEmpty ()) {
return null;
}
- Collections.sort (resultList, new MavenLikeVersioningComparator ());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse (resultList);
return resultList.get (0);
@@ -4607,7 +4607,7 @@ public class CatalogDatabase implements Closeable {
if (resultList.isEmpty ()) {
return null;
}
- Collections.sort (resultList, new MavenLikeVersioningComparator ());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse (resultList);
return resultList.get (0);
@@ -4636,7 +4636,7 @@ public class CatalogDatabase implements Closeable {
return Collections.EMPTY_LIST;
}
- Collections.sort (resultList, new MavenLikeVersioningComparator ());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse (resultList);
LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVfModuleRecipes", null);
@@ -4686,7 +4686,7 @@ public class CatalogDatabase implements Closeable {
if (resultList.isEmpty ()) {
return null;
}
- Collections.sort (resultList, new MavenLikeVersioningComparator ());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse (resultList);
return resultList.get (0);
@@ -4720,7 +4720,7 @@ public class CatalogDatabase implements Closeable {
if (resultList.isEmpty ()) {
return null;
}
- Collections.sort (resultList, new MavenLikeVersioningComparator ());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse (resultList);
return resultList.get (0);
@@ -4761,7 +4761,7 @@ public class CatalogDatabase implements Closeable {
LOGGER.debug("Catalog database - recipeResultList is null");
return null;
}
- Collections.sort(recipeResultList, new MavenLikeVersioningComparator());
+ recipeResultList.sort(new MavenLikeVersioningComparator());
Collections.reverse(recipeResultList);
LOGGER.debug("Catalog database - recipeResultList contains " + recipeResultList.get(0).toString());
@@ -4833,7 +4833,7 @@ public class CatalogDatabase implements Closeable {
LOGGER.debug("Catalog database - recipeResultList is null");
return null;
}
- Collections.sort(recipeResultList, new MavenLikeVersioningComparator());
+ recipeResultList.sort(new MavenLikeVersioningComparator());
Collections.reverse(recipeResultList);
LOGGER.debug("Catalog database - recipeResultList contains " + recipeResultList.get(0).toString());
@@ -4881,7 +4881,7 @@ public class CatalogDatabase implements Closeable {
LOGGER.debug("Catalog database - modelResultList is null");
return null;
}
- Collections.sort(modelResultList, new MavenLikeVersioningComparator());
+ modelResultList.sort(new MavenLikeVersioningComparator());
Collections.reverse(modelResultList);
LOGGER.debug("Catalog database - modelResultList contains " + modelResultList.get(0).toString());
@@ -4898,7 +4898,7 @@ public class CatalogDatabase implements Closeable {
LOGGER.debug("Catalog database - recipeResultList is null");
return null;
}
- Collections.sort(recipeResultList, new MavenLikeVersioningComparator());
+ recipeResultList.sort(new MavenLikeVersioningComparator());
Collections.reverse(recipeResultList);
LOGGER.debug("Catalog database - recipeResultList contains " + recipeResultList.get(0).toString());
diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ArRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ArRecipe.java
new file mode 100644
index 0000000000..b4c1f0594f
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ArRecipe.java
@@ -0,0 +1,46 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.db.catalog.beans;
+
+
+import java.io.Serializable;
+
+public class ArRecipe extends Recipe implements Serializable {
+ private static final long serialVersionUID = 768026109321305392L;
+ private String modelName;
+ public ArRecipe() {}
+
+ public String getModelName() {
+ return modelName;
+ }
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+
+ @Override
+ public String toString () {
+ StringBuilder sb = new StringBuilder();
+ sb.append(super.toString());
+ sb.append(",modelName=").append(modelName);
+ sb.append(",arParamXSD=").append(getParamXSD());
+ return sb.toString();
+ }
+}
diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkRecipe.java
index f25a99ca2d..4e905b62c8 100644
--- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkRecipe.java
+++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkRecipe.java
@@ -26,7 +26,6 @@ import java.io.Serializable;
public class NetworkRecipe extends Recipe implements Serializable {
private static final long serialVersionUID = 768026109321305392L;
private String modelName;
- private String networkParamXSD;
public NetworkRecipe() {}
public String getModelName() {
@@ -36,19 +35,12 @@ public class NetworkRecipe extends Recipe implements Serializable {
this.modelName = modelName;
}
- public String getNetworkParamXSD() {
- return networkParamXSD;
- }
- public void setNetworkParamXSD(String networkParamXSD) {
- this.networkParamXSD = networkParamXSD;
- }
-
@Override
public String toString () {
StringBuilder sb = new StringBuilder();
sb.append(super.toString());
sb.append(",modelName=").append(modelName);
- sb.append(",networkParamXSD=").append(networkParamXSD);
+ sb.append(",networkParamXSD=").append(getParamXSD());
return sb.toString();
}
}
diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Recipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Recipe.java
index a425c1e96a..58c24412dc 100644
--- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Recipe.java
+++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Recipe.java
@@ -37,7 +37,7 @@ public class Recipe extends MavenLikeVersioning implements Serializable {
protected String orchestrationUri;
private int recipeTimeout;
private String serviceType;
-
+ private String paramXSD;
private Timestamp created;
public Recipe () {
@@ -100,7 +100,21 @@ public class Recipe extends MavenLikeVersioning implements Serializable {
this.created = created;
}
- @Override
+ /**
+ * @return Returns the paramXSD.
+ */
+ public String getParamXSD() {
+ return paramXSD;
+ }
+
+ /**
+ * @param paramXSD The paramXSD to set.
+ */
+ public void setParamXSD(String paramXSD) {
+ this.paramXSD = paramXSD;
+ }
+
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("RECIPE: ").append(action);
diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponentsRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponentsRecipe.java
index 8867170ba7..6eac5a23ea 100644
--- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponentsRecipe.java
+++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponentsRecipe.java
@@ -27,7 +27,6 @@ public class VnfComponentsRecipe extends Recipe implements Serializable {
private static final long serialVersionUID = 768026109321305392L;
private String vnfType;
- private String vnfComponentParamXSD;
private String vnfComponentType;
private String vfModuleModelUUId;
@@ -39,13 +38,6 @@ public class VnfComponentsRecipe extends Recipe implements Serializable {
public void setVnfType(String vnfType) {
this.vnfType = vnfType;
}
-
- public String getVnfComponentParamXSD() {
- return vnfComponentParamXSD;
- }
- public void setVnfComponentParamXSD(String vnfComponentParamXSD) {
- this.vnfComponentParamXSD = vnfComponentParamXSD;
- }
public String getVnfComponentType() {
return vnfComponentType;
@@ -66,7 +58,7 @@ public class VnfComponentsRecipe extends Recipe implements Serializable {
public String toString () {
StringBuilder sb = new StringBuilder();
sb.append(super.toString());
- sb.append(",vnfComponentParamXSD=").append(vnfComponentParamXSD);
+ sb.append(",vnfComponentParamXSD=").append(getParamXSD());
sb.append(",serviceType=").append(getServiceType());
sb.append(",vnfComponentType=").append(getVnfComponentType());
sb.append(",vfModuleId=").append(getVfModuleModelUUId());
diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfRecipe.java
index 49865e8e9d..46017c2205 100644
--- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfRecipe.java
+++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfRecipe.java
@@ -27,7 +27,6 @@ public class VnfRecipe extends Recipe implements Serializable {
private static final long serialVersionUID = 768026109321305392L;
private String vnfType;
- private String vnfParamXSD;
private String vfModuleId;
public VnfRecipe() {}
@@ -38,13 +37,6 @@ public class VnfRecipe extends Recipe implements Serializable {
public void setVnfType(String vnfType) {
this.vnfType = vnfType;
}
-
- public String getVnfParamXSD() {
- return vnfParamXSD;
- }
- public void setVnfParamXSD(String vnfParamXSD) {
- this.vnfParamXSD = vnfParamXSD;
- }
public String getVfModuleId() {
return vfModuleId;
@@ -58,7 +50,7 @@ public class VnfRecipe extends Recipe implements Serializable {
public String toString () {
StringBuilder sb = new StringBuilder();
sb.append(super.toString());
- sb.append(",vnfParamXSD=").append(vnfParamXSD);
+ sb.append(",vnfParamXSD=").append(getParamXSD());
sb.append(",serviceType=").append(getServiceType());
sb.append(",vfModuleId=").append(getVfModuleId());
return sb.toString();
diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioning.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioning.java
index 564fd5a019..e42f734a64 100644
--- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioning.java
+++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioning.java
@@ -51,29 +51,32 @@ public class MavenLikeVersioning implements Serializable {
*
*/
public boolean isMoreRecentThan (String versionToCompare) {
- if (versionToCompare == null || versionToCompare.trim().equals("") || this.version == null || this.version.trim().equals("")) {
+ if (versionToCompare == null || versionToCompare.trim().isEmpty() || this.version == null || this.version.trim().isEmpty()) {
return false;
}
- String [] currentVersionArray = this.version.split("\\.");
- String [] specifiedVersionArray = versionToCompare.split("\\.");
+ String[] currentVersionArray = this.version.split("\\.");
+ String[] specifiedVersionArray = versionToCompare.split("\\.");
- int smalestStringLength = Math.min(currentVersionArray.length, specifiedVersionArray.length);
+ int smalestStringLength = Math.min(currentVersionArray.length, specifiedVersionArray.length);
- for (int currentVersionIndex=0;currentVersionIndex < smalestStringLength;++currentVersionIndex) {
+ for (int currentVersionIndex = 0; currentVersionIndex < smalestStringLength; ++currentVersionIndex) {
- if (Integer.parseInt(currentVersionArray[currentVersionIndex]) < Integer.parseInt(specifiedVersionArray[currentVersionIndex])) {
+ if (Integer.parseInt(currentVersionArray[currentVersionIndex]) < Integer
+ .parseInt(specifiedVersionArray[currentVersionIndex])) {
return false;
- } else if (Integer.parseInt(currentVersionArray[currentVersionIndex]) > Integer.parseInt(specifiedVersionArray[currentVersionIndex])) {
+ } else if (Integer.parseInt(currentVersionArray[currentVersionIndex]) > Integer
+ .parseInt(specifiedVersionArray[currentVersionIndex])) {
return true;
}
}
-
- // Even if versionToCompare has more digits, it means versionToCompare is more recent
- if (Integer.parseInt(currentVersionArray[smalestStringLength-1]) == Integer.parseInt(specifiedVersionArray[smalestStringLength-1])) {
- return currentVersionArray.length > specifiedVersionArray.length;
+ try {
+ // Even if versionToCompare has more digits, it means versionToCompare is more recent
+ return Integer.parseInt(currentVersionArray[smalestStringLength - 1]) != Integer
+ .parseInt(specifiedVersionArray[smalestStringLength - 1])
+ || currentVersionArray.length > specifiedVersionArray.length;
+ } catch (NumberFormatException e) {
+ return false;
}
-
- return true;
}
/**
diff --git a/mso-catalog-db/src/main/resources/ArRecipe.hbm.xml b/mso-catalog-db/src/main/resources/ArRecipe.hbm.xml
new file mode 100644
index 0000000000..fedfe31551
--- /dev/null
+++ b/mso-catalog-db/src/main/resources/ArRecipe.hbm.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+ -->
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="org.openecomp.mso.db.catalog.beans">
+ <class name="ArRecipe" table="AR_RECIPE">
+ <meta attribute="class-description">
+ This class describes a AR recipe
+ </meta>
+
+ <id name="id" type="int" column="id">
+ <generator class="native"/>
+ </id>
+
+ <properties name="uk_ar_recipe" unique="true">
+ <property name="modelName" type="string" >
+ <column name="MODEL_NAME" not-null="true" length="20"/>
+ </property>
+ <property name="action" type="string" >
+ <column name="ACTION" not-null="true" length="20"/>
+ </property>
+ <property name="version" type="string">
+ <column name="VERSION_STR" not-null="true" length="20"/>
+ </property>
+
+ </properties>
+
+ <property name="serviceType" type="string" length="45">
+ <column name="SERVICE_TYPE" not-null="false" length="45"/>
+ </property>
+ <property name="description" column="DESCRIPTION" type="string" length="1200"/>
+ <property name="orchestrationUri" type="string">
+ <column name="ORCHESTRATION_URI" not-null="true" length="256"/>
+ </property>
+ <property name="paramXSD" column="AR_PARAM_XSD" type="string" length="2048"/>
+ <property name="recipeTimeout" column="RECIPE_TIMEOUT" type="int"/>
+ <property name="created" type="timestamp" generated="insert" update="false" insert="false" not-null="true">
+ <column name="CREATION_TIMESTAMP" default="CURRENT_TIMESTAMP"/>
+ </property>
+ </class>
+
+</hibernate-mapping> \ No newline at end of file
diff --git a/mso-catalog-db/src/main/resources/NetworkRecipe.hbm.xml b/mso-catalog-db/src/main/resources/NetworkRecipe.hbm.xml
index 1ed9c7c392..4490dbadd0 100644
--- a/mso-catalog-db/src/main/resources/NetworkRecipe.hbm.xml
+++ b/mso-catalog-db/src/main/resources/NetworkRecipe.hbm.xml
@@ -51,7 +51,7 @@
<property name="orchestrationUri" type="string">
<column name="ORCHESTRATION_URI" not-null="true" length="256"/>
</property>
- <property name="networkParamXSD" column="NETWORK_PARAM_XSD" type="string" length="2048"/>
+ <property name="paramXSD" column="NETWORK_PARAM_XSD" type="string" length="2048"/>
<property name="recipeTimeout" column="RECIPE_TIMEOUT" type="int"/>
<property name="created" type="timestamp" generated="insert" update="false" insert="false" not-null="true">
<column name="CREATION_TIMESTAMP" default="CURRENT_TIMESTAMP"/>
diff --git a/mso-catalog-db/src/main/resources/VnfComponentsRecipe.hbm.xml b/mso-catalog-db/src/main/resources/VnfComponentsRecipe.hbm.xml
index 20b9cab252..d2ca635c9a 100644
--- a/mso-catalog-db/src/main/resources/VnfComponentsRecipe.hbm.xml
+++ b/mso-catalog-db/src/main/resources/VnfComponentsRecipe.hbm.xml
@@ -46,7 +46,7 @@
<property name="orchestrationUri" type="string">
<column name="ORCHESTRATION_URI" not-null="true" length="256"/>
</property>
- <property name="vnfComponentParamXSD" column="VNF_COMPONENT_PARAM_XSD" type="string" length="2048"/>
+ <property name="paramXSD" column="VNF_COMPONENT_PARAM_XSD" type="string" length="2048"/>
<property name="recipeTimeout" column="RECIPE_TIMEOUT" type="int"/>
<property name="created" type="timestamp" generated="insert" update="false" insert="false" not-null="true">
<column name="CREATION_TIMESTAMP" default="CURRENT_TIMESTAMP"/>
diff --git a/mso-catalog-db/src/main/resources/VnfRecipe.hbm.xml b/mso-catalog-db/src/main/resources/VnfRecipe.hbm.xml
index 4dc7f968b4..910cb9bf5c 100644
--- a/mso-catalog-db/src/main/resources/VnfRecipe.hbm.xml
+++ b/mso-catalog-db/src/main/resources/VnfRecipe.hbm.xml
@@ -59,7 +59,7 @@
<column name="ORCHESTRATION_URI" not-null="true" length="256"/>
</property>
- <property name="vnfParamXSD" column="VNF_PARAM_XSD" type="string" length="2048"/>
+ <property name="paramXSD" column="VNF_PARAM_XSD" type="string" length="2048"/>
<property name="recipeTimeout" column="RECIPE_TIMEOUT" type="int"/>
<property name="created" type="timestamp" generated="insert" update="false" insert="false" not-null="true">
<column name="CREATION_TIMESTAMP" default="CURRENT_TIMESTAMP"/>
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkRecipeTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkRecipeTest.java
index 97eadb3f1d..c17b50e738 100644
--- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkRecipeTest.java
+++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkRecipeTest.java
@@ -46,8 +46,8 @@ public class NetworkRecipeTest {
assertTrue(networkRecipe.getId() == 1);
networkRecipe.setModelName("modelName");
assertTrue(networkRecipe.getModelName().equalsIgnoreCase("modelName"));
- networkRecipe.setNetworkParamXSD("networkParamXSD");
- assertTrue(networkRecipe.getNetworkParamXSD().equalsIgnoreCase("networkParamXSD"));
+ networkRecipe.setParamXSD("networkParamXSD");
+ assertTrue(networkRecipe.getParamXSD().equalsIgnoreCase("networkParamXSD"));
networkRecipe.setOrchestrationUri("orchestrationUri");
assertTrue(networkRecipe.getOrchestrationUri().equalsIgnoreCase("orchestrationUri"));
networkRecipe.setRecipeTimeout(1);
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfRecipeTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfRecipeTest.java
index 95e45f7b52..3f707871a6 100644
--- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfRecipeTest.java
+++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfRecipeTest.java
@@ -52,8 +52,8 @@ public class VnfRecipeTest {
assertTrue(vnfRecipe.getServiceType().equalsIgnoreCase("serviceType"));
vnfRecipe.setVersion("version");
assertTrue(vnfRecipe.getVersion().equalsIgnoreCase("version"));
- vnfRecipe.setVnfParamXSD("vnfParamXSD");
- assertTrue(vnfRecipe.getVnfParamXSD().equalsIgnoreCase("vnfParamXSD"));
+ vnfRecipe.setParamXSD("vnfParamXSD");
+ assertTrue(vnfRecipe.getParamXSD().equalsIgnoreCase("vnfParamXSD"));
vnfRecipe.setVfModuleId("vfModuleId");
assertTrue(vnfRecipe.getVfModuleId().equalsIgnoreCase("vfModuleId"));
// assertTrue(vnfRecipe.toString() == null);