From fd4d683baf4344b058090e0b0203929103cacedf Mon Sep 17 00:00:00 2001 From: Elena Kuleshov Date: Mon, 8 Apr 2019 22:08:29 -0400 Subject: Query CatalogDB for WorkflowSpecifications Query CatalogDB for WorkflowSpecifications fron APIH Change-Id: I5eef5ba9b49c0a7420ef93a5425121bfe7225b1b Issue-ID: SO-1727 Signed-off-by: Kuleshov, Elena --- .../org/onap/so/db/catalog/client/CatalogDbClient.java | 7 +++++++ .../db/catalog/data/repository/WorkflowRepository.java | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) (limited to 'mso-catalog-db/src/main') 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 f75ccf0b2f..a2ca4a3814 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 @@ -190,6 +190,7 @@ public class CatalogDbClient { private String findServiceByServiceInstanceId = "/findServiceByServiceInstanceId"; private String findPnfResourceCustomizationByModelUuid = "/findPnfResourceCustomizationByModelUuid"; private String findWorkflowByArtifactUUID = "/findByArtifactUUID"; + private String findWorkflowByModelUUID = "/findWorkflowByModelUUID"; private String serviceURI; private String vfModuleURI; @@ -330,6 +331,7 @@ public class CatalogDbClient { endpoint + PNF_RESOURCE_CUSTOMIZATION + SEARCH + findPnfResourceCustomizationByModelUuid; findWorkflowByArtifactUUID = endpoint + WORKFLOW + SEARCH + findWorkflowByArtifactUUID; + findWorkflowByModelUUID = endpoint + WORKFLOW + SEARCH + findWorkflowByModelUUID; serviceURI = endpoint + SERVICE + URI_SEPARATOR; vfModuleURI = endpoint + VFMODULE + URI_SEPARATOR; @@ -872,4 +874,9 @@ public class CatalogDbClient { return this.getSingleResource(workflowClient, getUri(UriBuilder.fromUri(findWorkflowByArtifactUUID) .queryParam(ARTIFACT_UUID, artifactUUID).build().toString())); } + + public List findWorkflowByModelUUID(String vnfResourceModelUUID) { + return this.getMultipleResources(workflowClient, getUri(UriBuilder.fromUri(findWorkflowByModelUUID) + .queryParam(VNF_RESOURCE_MODEL_UUID, vnfResourceModelUUID).build().toString())); + } } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.java index b73896ac5c..fb5f202cbc 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.java @@ -20,11 +20,28 @@ package org.onap.so.db.catalog.data.repository; +import java.util.List; import org.onap.so.db.catalog.beans.Workflow; 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; @RepositoryRestResource(collectionResourceRel = "workflow", path = "workflow") public interface WorkflowRepository extends JpaRepository { + Workflow findByArtifactUUID(String artifactUUID); + + /** + * Used to fetch the @{link Workflow} by the Model UUID. + * + * This operation is required by {@link org.onap.so.db.catalog.client.CatalogDbClient} to provide Workflow based on + * model UUID without projection. + * + * @param vnfResourceModelUUIDmodel UUID + * @return List of Workflow + */ + @Query(value = "select b.* from vnf_resource_to_workflow a join workflow b where a.WORKFLOW_ID = b.ID and a.VNF_RESOURCE_MODEL_UUID = ?1", + nativeQuery = true) + List findWorkflowByModelUUID(String vnfResourceModelUUID); } -- cgit 1.2.3-korg