aboutsummaryrefslogtreecommitdiffstats
path: root/mso-catalog-db/src/main
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2019-06-07 17:39:21 +0000
committerGerrit Code Review <gerrit@onap.org>2019-06-07 17:39:21 +0000
commit2df391a041a85a0187a5eaad082d3a8f2fbaeaec (patch)
tree80bf94f905b3db5238de676fb87af6292e5479cc /mso-catalog-db/src/main
parent83bd49d1f3576be61173b426fc899d687f9f34fa (diff)
parent37b23b4d859eda7fab5af1366f9688d882b8427a (diff)
Merge "Handle when model cust uuid is null from sdnc"
Diffstat (limited to 'mso-catalog-db/src/main')
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java26
1 files changed, 19 insertions, 7 deletions
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
index f502c34e20..2bfa2856d2 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
@@ -823,9 +823,14 @@ public class CatalogDbClient {
public VnfResourceCustomization findVnfResourceCustomizationInList(String vnfCustomizationUUID,
List<VnfResourceCustomization> vnfResourceCusts) {
- List<VnfResourceCustomization> filtered = vnfResourceCusts.stream()
- .filter(vnfCustRes -> vnfCustomizationUUID.equals(vnfCustRes.getModelCustomizationUUID()))
- .collect(Collectors.toList());
+ if (vnfCustomizationUUID == null) {
+ throw new EntityNotFoundException(
+ "a NULL UUID was provided in query to search for VnfResourceCustomization");
+ }
+ List<VnfResourceCustomization> filtered =
+ vnfResourceCusts.stream().filter(v -> v.getModelCustomizationUUID() != null)
+ .filter(vnfCustRes -> vnfCustomizationUUID.equals(vnfCustRes.getModelCustomizationUUID()))
+ .collect(Collectors.toList());
if (filtered != null && !filtered.isEmpty() && filtered.size() == 1) {
return filtered.get(0);
} else
@@ -833,9 +838,12 @@ public class CatalogDbClient {
"Unable to find VnfResourceCustomization ModelCustomizationUUID:" + vnfCustomizationUUID);
}
- private VfModuleCustomization findVfModuleCustomizationInList(String vfModuleCustomizationUUID,
+ protected VfModuleCustomization findVfModuleCustomizationInList(String vfModuleCustomizationUUID,
List<VfModuleCustomization> vfModuleList) {
- List<VfModuleCustomization> filtered = vfModuleList.stream()
+ if (vfModuleCustomizationUUID == null) {
+ throw new EntityNotFoundException("a NULL UUID was provided in query to search for VfModuleCustomization");
+ }
+ List<VfModuleCustomization> filtered = vfModuleList.stream().filter(v -> v.getModelCustomizationUUID() != null)
.filter(vfModuleCust -> vfModuleCustomizationUUID.equals(vfModuleCust.getModelCustomizationUUID()))
.collect(Collectors.toList());
if (filtered != null && !filtered.isEmpty() && filtered.size() == 1) {
@@ -845,9 +853,13 @@ public class CatalogDbClient {
"Unable to find VfModuleCustomization ModelCustomizationUUID:" + vfModuleCustomizationUUID);
}
- private CvnfcCustomization findCvnfcCustomizationInAList(String cvnfcCustomizationUuid,
+ protected CvnfcCustomization findCvnfcCustomizationInAList(String cvnfcCustomizationUuid,
List<CvnfcCustomization> cvnfcCustomList) {
- List<CvnfcCustomization> filtered = cvnfcCustomList.stream()
+ if (cvnfcCustomizationUuid == null) {
+ throw new EntityNotFoundException(
+ "a NULL UUID was provided in query to search for CvnfcCustomization" + cvnfcCustomizationUuid);
+ }
+ List<CvnfcCustomization> filtered = cvnfcCustomList.stream().filter(c -> c.getModelCustomizationUUID() != null)
.filter(cvnfc -> cvnfcCustomizationUuid.equals(cvnfc.getModelCustomizationUUID()))
.collect(Collectors.toList());
if (filtered != null && !filtered.isEmpty() && filtered.size() == 1) {