From 329da0d034a4645685ac0fe7f8e61d24e435d5dc Mon Sep 17 00:00:00 2001 From: rameshiyer27 Date: Wed, 19 Aug 2020 10:22:20 +0100 Subject: Picking workflow names dynamically for schema update procedure Issue-ID: SO-3147 Signed-off-by: zrrmmua Change-Id: I4c9de93ea7b51657c2bc6ee24b4bb52e2068cf5a --- .../java/org/onap/so/db/catalog/client/CatalogDbClient.java | 10 +++++++++- .../onap/so/db/catalog/data/repository/WorkflowRepository.java | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'mso-catalog-db/src/main/java/org') 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 8d342b673d..ef90dd6984 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 @@ -20,6 +20,7 @@ package org.onap.so.db.catalog.client; +import com.google.common.base.Strings; import java.net.URI; import java.util.ArrayList; import java.util.Iterator; @@ -83,7 +84,6 @@ import org.springframework.stereotype.Component; import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.RestTemplate; import org.springframework.web.util.UriComponentsBuilder; -import com.google.common.base.Strings; import uk.co.blackpepper.bowman.Client; import uk.co.blackpepper.bowman.ClientFactory; import uk.co.blackpepper.bowman.Configuration; @@ -162,6 +162,7 @@ public class CatalogDbClient { protected static final String SOURCE = "source"; protected static final String RESOURCE_TARGET = "resourceTarget"; protected static final String FLAG = "flag"; + protected static final String OPERATION_NAME = "operationName"; private static final String TARGET_ENTITY = "SO:CatalogDB"; private static final String ASTERISK = "*"; @@ -215,6 +216,7 @@ public class CatalogDbClient { "/findBBNameSelectionReferenceByControllerActorAndScopeAndAction"; private String findWorkflowByResourceTarget = "/findByResourceTarget"; private String findProcessingFlagsByFlag = "/findByFlag"; + private String findWorkflowByOperationName = "/findByOperationName"; private String serviceURI; private String vfModuleURI; @@ -365,6 +367,7 @@ public class CatalogDbClient { + findBBNameSelectionReferenceByControllerActorAndScopeAndAction; findProcessingFlagsByFlag = endpoint + PROCESSING_FLAGS + SEARCH + findProcessingFlagsByFlag; + findWorkflowByOperationName = endpoint + WORKFLOW + SEARCH + findWorkflowByOperationName; serviceURI = endpoint + SERVICE + URI_SEPARATOR; vfModuleURI = endpoint + VFMODULE + URI_SEPARATOR; @@ -1106,6 +1109,11 @@ public class CatalogDbClient { .queryParam(RESOURCE_TARGET, resourceTarget).build().toString())); } + public List findWorkflowByOperationName(String operationName) { + return this.getMultipleResources(workflowClient, getUri(UriBuilder.fromUri(findWorkflowByOperationName) + .queryParam(OPERATION_NAME, operationName).build().toString())); + } + public ProcessingFlags findProcessingFlagsByFlag(String flag) { return this.getSingleResource(processingFlagsClient, getUri(UriBuilder.fromUri(findProcessingFlagsByFlag).queryParam(FLAG, flag).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 93ec54a2eb..74843e5531 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 @@ -35,6 +35,8 @@ public interface WorkflowRepository extends JpaRepository { List findByResourceTarget(String resourceTarget); + List findByOperationName(String operationName); + /** * Used to fetch the @{link Workflow} by the Model UUID. * -- cgit 1.2.3-korg