summaryrefslogtreecommitdiffstats
path: root/mso-catalog-db/src/main/java
diff options
context:
space:
mode:
authorElena Kuleshov <evn@att.com>2019-04-08 22:08:29 -0400
committerElena Kuleshov <evn@att.com>2019-04-09 02:21:13 -0400
commitfd4d683baf4344b058090e0b0203929103cacedf (patch)
tree6502f61ed2ea62545cd93156856cc3d7876b0e7f /mso-catalog-db/src/main/java
parented66a29ce8e0068740466e13fa6517791cce9aeb (diff)
Query CatalogDB for WorkflowSpecifications
Query CatalogDB for WorkflowSpecifications fron APIH Change-Id: I5eef5ba9b49c0a7420ef93a5425121bfe7225b1b Issue-ID: SO-1727 Signed-off-by: Kuleshov, Elena <evn@att.com>
Diffstat (limited to 'mso-catalog-db/src/main/java')
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java7
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.java17
2 files changed, 24 insertions, 0 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 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<Workflow> 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, String> {
+
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<Workflow> findWorkflowByModelUUID(String vnfResourceModelUUID);
}