summaryrefslogtreecommitdiffstats
path: root/mso-catalog-db/src/main
diff options
context:
space:
mode:
authorUbuntu <sunshine.wang@huawei.com>2020-01-07 22:08:38 +0800
committerUbuntu <sunshine.wang@huawei.com>2020-01-07 22:15:15 +0800
commit8c02dcc9057a300c08a7fc22265c45c3c771226e (patch)
treeaf0bde6ae3429aa0e1103ae79bfbd7efb148173e /mso-catalog-db/src/main
parent8f37667d999101c2e4e395d810376173a5714794 (diff)
find workflow by pnf model uuid with CatalogDbClient
Issue-ID: SO-2558 Signed-off-by: Yaoguang Wang <sunshine.wang@huawei.com> Change-Id: I62d9ae70befdd870d217de64cca36fe04a69e96e
Diffstat (limited to 'mso-catalog-db/src/main')
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java8
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.java15
2 files changed, 22 insertions, 1 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 8754673f40..7873d70bd4 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
@@ -133,6 +133,7 @@ public class CatalogDbClient {
private static final String MODEL_VERSION = "modelVersion";
private static final String MODEL_INVARIANT_UUID = "modelInvariantUUID";
private static final String VNF_RESOURCE_MODEL_UUID = "vnfResourceModelUUID";
+ private static final String PNF_RESOURCE_MODEL_UUID = "pnfResourceModelUUID";
private static final String NF_ROLE = "nfRole";
private static final String VF_MODULE_MODEL_UUID = "vfModuleModelUUID";
private static final String VNF_COMPONENT_TYPE = "vnfComponentType";
@@ -201,6 +202,7 @@ public class CatalogDbClient {
private String findPnfResourceCustomizationByModelUuid = "/findPnfResourceCustomizationByModelUuid";
private String findWorkflowByArtifactUUID = "/findByArtifactUUID";
private String findWorkflowByModelUUID = "/findWorkflowByModelUUID";
+ private String findWorkflowByPnfModelUUID = "/findWorkflowByPnfModelUUID";
private String findWorkflowBySource = "/findBySource";
private String findVnfResourceCustomizationByModelUuid = "/findVnfResourceCustomizationByModelUuid";
@@ -338,6 +340,7 @@ public class CatalogDbClient {
findWorkflowByArtifactUUID = endpoint + WORKFLOW + SEARCH + findWorkflowByArtifactUUID;
findWorkflowByModelUUID = endpoint + WORKFLOW + SEARCH + findWorkflowByModelUUID;
+ findWorkflowByPnfModelUUID = endpoint + WORKFLOW + SEARCH + findWorkflowByPnfModelUUID;
findWorkflowBySource = endpoint + WORKFLOW + SEARCH + findWorkflowBySource;
findVnfResourceCustomizationByModelUuid =
@@ -998,6 +1001,11 @@ public class CatalogDbClient {
.queryParam(VNF_RESOURCE_MODEL_UUID, vnfResourceModelUUID).build().toString()));
}
+ public List<Workflow> findWorkflowByPnfModelUUID(String pnfResourceModelUUID) {
+ return this.getMultipleResources(workflowClient, getUri(UriBuilder.fromUri(findWorkflowByPnfModelUUID)
+ .queryParam(PNF_RESOURCE_MODEL_UUID, pnfResourceModelUUID).build().toString()));
+ }
+
public List<Workflow> findWorkflowBySource(String source) {
return this.getMultipleResources(workflowClient,
getUri(UriBuilder.fromUri(findWorkflowBySource).queryParam(SOURCE, source).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 8bcc60c8be..f1b399325e 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
@@ -39,10 +39,23 @@ public interface WorkflowRepository extends JpaRepository<Workflow, Integer> {
* 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
+ * @param vnfResourceModelUUID 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);
+
+ /**
+ * Used to fetch the @{link Workflow} by the Pnf Model UUID.
+ *
+ * This operation is required by {@link org.onap.so.db.catalog.client.CatalogDbClient} to provide Workflow based on
+ * pnf model UUID without projection.
+ *
+ * @param pnfResourceModelUUID UUID
+ * @return List of Workflow
+ */
+ @Query(value = "select b.* from pnf_resource_to_workflow a join workflow b where a.WORKFLOW_ID = b.ID and a.PNF_RESOURCE_MODEL_UUID = ?1",
+ nativeQuery = true)
+ List<Workflow> findWorkflowByPnfModelUUID(String pnfResourceModelUUID);
}