summaryrefslogtreecommitdiffstats
path: root/mso-catalog-db/src/main
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2019-02-08 15:21:47 +0000
committerGerrit Code Review <gerrit@onap.org>2019-02-08 15:21:47 +0000
commitb3bc8b2a2cde4a72fae4d8f702b9fc87f6f138f1 (patch)
treed96281c1290c4ecbe9b3d59f10dc404428b38d46 /mso-catalog-db/src/main
parent3f0d58fab3b6c7d4c1b5441de0670d4e656360cd (diff)
parentf73e27f96ee88bee8f95da6470d5b7693efd2100 (diff)
Merge "provide correct custIds"
Diffstat (limited to 'mso-catalog-db/src/main')
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java19
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepository.java6
2 files changed, 10 insertions, 15 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 828b2ff920..ac123b280d 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
@@ -223,7 +223,7 @@ public class CatalogDbClient {
private final Client<CloudifyManager> cloudifyManagerClient;
- private Client<CvnfcCustomization> cvnfcCustomizationClient;
+ private final Client<CvnfcCustomization> cvnfcCustomizationClient;
private final Client<ControllerSelectionReference> controllerSelectionReferenceClient;
@@ -695,18 +695,11 @@ public class CatalogDbClient {
}
public List<CvnfcCustomization> getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID(String vnfCustomizationUUID, String vfModuleCustomizationUUID){
- return this.getMultipleVnfcCustomizations(
- UriBuilder.fromUri(endpoint + "/vnfcCustomization/search/findByVnfCustomizationUUIDAndVfModuleCustomizationUUID")
- .queryParam("VNF_CUSTOMIZATION_UUID", vnfCustomizationUUID)
- .queryParam("VFMODULE_CUSTOMIZATION_UUID", vfModuleCustomizationUUID).build());
- }
-
- private List<CvnfcCustomization> getMultipleVnfcCustomizations(URI uri) {
- Iterable<CvnfcCustomization> vnfcIterator = cvnfcCustomizationClient.getAll(uri);
- List<CvnfcCustomization> vnfcList = new ArrayList<>();
- Iterator<CvnfcCustomization> it = vnfcIterator.iterator();
- it.forEachRemaining(vnfcList::add);
- return vnfcList;
+
+ return this.getMultipleResources(cvnfcCustomizationClient,getUri(UriBuilder
+ .fromUri(endpoint + "/cvnfcCustomization/search/findByVnfResourceCustomizationAndVfModuleCustomization")
+ .queryParam("VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID", vnfCustomizationUUID)
+ .queryParam("VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID", vfModuleCustomizationUUID).build().toString()));
}
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepository.java
index 0c82b84c0f..a4281aea6c 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepository.java
@@ -24,6 +24,7 @@ import java.util.List;
import org.onap.so.db.catalog.beans.CvnfcCustomization;
import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@@ -31,6 +32,7 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource;
public interface CvnfcCustomizationRepository extends JpaRepository<CvnfcCustomization, String> {
CvnfcCustomization findOneByModelCustomizationUUID(String modelCustomizationUuid);
List<CvnfcCustomization> findByModelCustomizationUUID(String modelCustomizationUUID);
- List<CvnfcCustomization> findByVnfResourceCustomizationAndVfModuleCustomization (@Param("VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID") String vnfResourceCustomization,
- @Param("VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID") String vfModuleCustomization);
+
+ @Query(value = "SELECT * FROM cvnfc_customization WHERE VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID = ?1 AND VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID = ?2", nativeQuery = true)
+ List<CvnfcCustomization> findByVnfResourceCustomizationAndVfModuleCustomization (@Param("VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID") String vnfResourceCustomization,@Param("VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID") String vfModuleCustomization);
} \ No newline at end of file