aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-catalog-db-adapter/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-catalog-db-adapter/src/main')
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java14
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java5
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java5
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java7
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcs.java8
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql4
6 files changed, 36 insertions, 7 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java
index edec48dc95..a98778bf5d 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java
@@ -21,6 +21,7 @@
package org.onap.so.adapters.catalogdb.catalogrest;
+import java.io.IOException;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -95,4 +96,17 @@ public abstract class CatalogQuery {
return smartToJSON();
}
+
+ protected boolean isJSONValid(String jsonInString) {
+ try {
+ if (jsonInString == null) {
+ return false;
+ }
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.readValue(jsonInString, String.class);
+ return true;
+ } catch (IOException e) {
+ return false;
+ }
+ }
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java
index c1acc319f7..afcb2d5761 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java
@@ -123,7 +123,10 @@ public class QueryAllottedResourceCustomization extends CatalogQuery {
put(valueMap, "PROVIDING_SERVICE_MODEL_INVARIANT_UUID", o.getProvidingServiceModelInvariantUUID());
put(valueMap, "PROVIDING_SERVICE_MODEL_UUID", o.getProvidingServiceModelUUID());
put(valueMap, "PROVIDING_SERVICE_MODEL_NAME", o.getProvidingServiceModelName());
- put(valueMap, "RESOURCE_INPUT", o.getResourceInput());
+
+ if (isJSONValid(o.getResourceInput())) {
+ put(valueMap, "RESOURCE_INPUT", o.getResourceInput());
+ }
sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
sep = ",\n";
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
index 5573b23a8d..129718241c 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
@@ -116,7 +116,10 @@ public class QueryServiceNetworks extends CatalogQuery {
put(valueMap, "NETWORK_ROLE", o.getNetworkRole());
put(valueMap, "NETWORK_SCOPE", o.getNetworkScope());
put(valueMap, "NETWORK_TECHNOLOGY", o.getNetworkTechnology());
- put(valueMap, "RESOURCE_INPUT", o.getResourceInput());
+
+ if (isJSONValid(o.getResourceInput())) {
+ put(valueMap, "RESOURCE_INPUT", o.getResourceInput());
+ }
sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
sep = ",\n";
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
index 0b8de60a81..d6e7415a77 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
@@ -23,6 +23,7 @@
package org.onap.so.adapters.catalogdb.catalogrest;
/* should be called QueryVnfResource.java */
+import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -32,6 +33,7 @@ import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.fasterxml.jackson.databind.ObjectMapper;
@XmlRootElement(name = "serviceVnfs")
public class QueryServiceVnfs extends CatalogQuery {
@@ -120,7 +122,9 @@ public class QueryServiceVnfs extends CatalogQuery {
put(valueMap, "NF_NAMING_CODE", o.getNfNamingCode());
put(valueMap, "VNFC_INSTANCE_GROUP_ORDER", o.getVnfcInstanceGroupOrder());
put(valueMap, "MULTI_STEP_DESIGN", o.getMultiStageDesign());
- put(valueMap, "RESOURCE_INPUT", o.getResourceInput());
+ if (isJSONValid(o.getResourceInput())) {
+ put(valueMap, "RESOURCE_INPUT", o.getResourceInput());
+ }
String subitem = new QueryVfModule(vrNull ? null : o.getVfModuleCustomizations()).JSON2(true, true);
valueMap.put("_VFMODULES_", subitem.replaceAll("(?m)^", "\t\t"));
@@ -142,4 +146,5 @@ public class QueryServiceVnfs extends CatalogQuery {
sb.append("}");
return sb.toString();
}
+
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcs.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcs.java
index dc73fe904d..24c07d6d3e 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcs.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcs.java
@@ -20,12 +20,12 @@
package org.onap.so.adapters.catalogdb.catalogrest;
-import org.onap.so.db.catalog.beans.VnfcCustomization;
-import javax.xml.bind.annotation.XmlRootElement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import javax.xml.bind.annotation.XmlRootElement;
+import org.onap.so.db.catalog.beans.VnfcCustomization;
@XmlRootElement(name = "vnfcs")
public class QueryVnfcs extends CatalogQuery {
@@ -105,8 +105,10 @@ public class QueryVnfcs extends CatalogQuery {
put(valueMap, "MODEL_INVARIANT_ID", o.getModelInvariantUUID());
put(valueMap, "MODEL_VERSION", o.getModelVersion());
put(valueMap, "MODEL_CUSTOMIZATION_UUID", o.getModelCustomizationUUID());
- put(valueMap, "RESOURCE_INPUT", o.getResourceInput());
+ if (isJSONValid(o.getResourceInput())) {
+ put(valueMap, "RESOURCE_INPUT", o.getResourceInput());
+ }
sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
sep = ",\n";
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql
index 137f73cf65..42df1adf13 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql
@@ -202,4 +202,6 @@ INSERT INTO `workflow` (`ARTIFACT_UUID`,`ARTIFACT_NAME`,`NAME`,`OPERATION_NAME`,
VALUES
('9d45cd30-1a89-4993-87c1-6dd09c1696cf','VFModule-ScaleOut','VNF Scale Out','ScaleOut',1.0,'native static workflow to support ScaleOut','vfModule','native'),
('da6478e4-ea33-3346-ac12-ab121284a333','VnfInPlaceUpdate.bpmn','VnfInPlaceUpdate','inPlaceSoftwareUpdate',1.0,'native static workflow to support inPlaceSoftwareUpdate','vnf','native'),
-('fdb3ac48-70f9-4584-bd92-253bdbdec1e1','VnfConfigUpdate.bpmn','VnfConfigUpdate','applyConfigModify',1.0,'native static workflow to support applyConfigModify','vnf','native');
+('fdb3ac48-70f9-4584-bd92-253bdbdec1e1','VnfConfigUpdate.bpmn','VnfConfigUpdate','applyConfigModify',1.0,'native static workflow to support applyConfigModify','vnf','native'),
+('b2fd5627-55e4-4f4f-8064-9e6f443e9152','DummyPnfWorkflow','Dummy Pnf Workflow','DummyPnfWorkflow',1.0,'Dummy Pnf Workflow to test custom Pnf workflow','pnf','native');
+