summaryrefslogtreecommitdiffstats
path: root/mso-catalog-db
diff options
context:
space:
mode:
Diffstat (limited to 'mso-catalog-db')
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResource.java3
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java10
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.java2
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java11
4 files changed, 25 insertions, 1 deletions
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResource.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResource.java
index 19e875f8bc..3827c0e19f 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResource.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResource.java
@@ -38,6 +38,8 @@ import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import com.openpojo.business.annotation.BusinessKey;
+import org.hibernate.annotations.NotFound;
+import org.hibernate.annotations.NotFoundAction;
import uk.co.blackpepper.bowman.annotation.LinkedResource;
import uk.co.blackpepper.bowman.annotation.RemoteResource;
@@ -76,6 +78,7 @@ public class AllottedResource implements Serializable {
private Date created;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "allottedResource")
+ @NotFound(action = NotFoundAction.IGNORE)
private Set<AllottedResourceCustomization> allotedResourceCustomization;
@Override
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<Workflow> 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<Workflow, Integer> {
List<Workflow> findByResourceTarget(String resourceTarget);
+ List<Workflow> findByOperationName(String operationName);
+
/**
* Used to fetch the @{link Workflow} by the Model UUID.
*
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
index 79e3cbcc08..6a5daa601a 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
@@ -204,4 +204,15 @@ public class CatalogDbClientTest {
.queryParam(CatalogDbClient.RESOURCE_TARGET, pnf_resource).build()));
}
+ @Test
+ public final void testFindWorkFlowByOperationName() {
+ final String operationName = "PNFSoftwareUpgrade";
+ doReturn(new ArrayList()).when(catalogDbClient).getMultipleResources(any(), any());
+ catalogDbClient.findWorkflowByOperationName(operationName);
+
+ // verify
+ verify(catalogDbClient).getMultipleResources(any(Client.class), eq(UriBuilder.fromUri("/findByOperationName")
+ .queryParam(CatalogDbClient.OPERATION_NAME, operationName).build()));
+ }
+
}