summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-requests-db/src/main
diff options
context:
space:
mode:
authorMnushkin, Dmitry <dmitry.mnushkin@att.com>2019-06-26 11:14:28 -0400
committerMax Benjamin <max.benjamin@att.com>2019-06-27 21:02:12 +0000
commit9306c021d9434f4ce8d0dfa9dd9ecb63974f11e6 (patch)
tree38cf4d19007101ad651fcde376b2f23592308f26 /mso-api-handlers/mso-requests-db/src/main
parent8e42b4e3fd9c00d73d371ccdbe2147733821bb56 (diff)
enhance workflowaction to handle resume func
init code for RESUME with junit passing overwrite URI on resume op from original request Change-Id: I1eee2bd66aa20804ba4a2834d269b5947565b9dc Issue-ID: SO-2055 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'mso-api-handlers/mso-requests-db/src/main')
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
index 9ab0f3b680..c0ce59dc66 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
@@ -72,6 +72,8 @@ public class RequestsDbClient {
private static final String REQUEST_ID = "REQUEST_ID";
private static final String OPERATIONAL_ENVIRONMENT_ID = "OPERATIONAL_ENV_ID";
private static final String SERVICE_MODEL_VERSION_ID = "SERVICE_MODEL_VERSION_ID";
+ private static final String FLOW_EXECUTION_PATH = "flowExecutionPath";
+ private static final String BPMN_EXECUTION_DATA_TAG = "BPMNExecutionData";
@Value("${mso.adapters.requestDb.endpoint:#{null}}")
protected String endpoint;
@@ -95,6 +97,8 @@ public class RequestsDbClient {
private String findOneByServiceIdAndOperationIdURI = "/findOneByServiceIdAndOperationId";
+ private String findOneByRequestId = "/infraActiveRequests/search/findOneByRequestId";
+
private String findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestIdURI =
"/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId";
@@ -110,6 +114,8 @@ public class RequestsDbClient {
private static final String findBySoRequestIdAndGroupIdAndName =
"/requestProcessingData/search/findOneBySoRequestIdAndGroupingIdAndName";
+ private static final String findBySoRequestIdAndName = "/requestProcessingData/search/findOneBySoRequestIdAndName";
+
private static final String findBySoRequestIdOrderByGroupingIdDesc =
"/requestProcessingData/search/findBySoRequestIdOrderByGroupingIdDesc";
@@ -136,6 +142,7 @@ public class RequestsDbClient {
+ findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestIdURI;
findAllByOperationalEnvIdAndRequestIdURI =
endpoint + OPERATIONAL_ENV_SERVICE_MODEL_STATUS_SEARCH + findAllByOperationalEnvIdAndRequestIdURI;
+ findOneByRequestId = endpoint + findOneByRequestId;
}
private ClientFactory getClientFactory() {
@@ -361,6 +368,27 @@ public class RequestsDbClient {
.queryParam(GROUPING_ID, groupingId).build().toString()));
}
+ public RequestProcessingData getRequestProcessingDataBySoRequestIdAndName(String soRequestId, String name) {
+ return getClientFactory().create(RequestProcessingData.class)
+ .get(getUri(UriBuilder.fromUri(endpoint + findBySoRequestIdAndName)
+ .queryParam(SO_REQUEST_ID, soRequestId).queryParam(NAME, name).build().toString()));
+ }
+
+
+ public void persistProcessingData(String flowExecutionPath, String requestId) {
+
+ HttpHeaders headers = getHttpHeaders();
+ URI uri = getUri(requestProcessingDataURI);
+ RequestProcessingData rpd = new RequestProcessingData();
+ rpd.setName(FLOW_EXECUTION_PATH);
+ rpd.setSoRequestId(requestId);
+ rpd.setValue(flowExecutionPath);
+ rpd.setTag(BPMN_EXECUTION_DATA_TAG);
+
+ HttpEntity<RequestProcessingData> entity = new HttpEntity<>(rpd, headers);
+ restTemplate.postForLocation(uri, entity);
+ }
+
private List<RequestProcessingData> getRequestProcessingData(URI uri) {
Iterable<RequestProcessingData> requestProcessingDataIterator =
getClientFactory().create(RequestProcessingData.class).getAll(uri);
@@ -370,6 +398,20 @@ public class RequestsDbClient {
return requestProcessingDataList;
}
+ public InfraActiveRequests findOneByRequestId(String requestId) {
+ try {
+ HttpEntity<?> entity = getHttpEntity();
+ return restTemplate.exchange(
+ getUri(UriBuilder.fromUri(findOneByRequestId).queryParam(REQUEST_ID, requestId).build().toString()),
+ HttpMethod.GET, entity, InfraActiveRequests.class).getBody();
+ } catch (HttpClientErrorException e) {
+ if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+ return null;
+ }
+ throw e;
+ }
+ }
+
// From and To are defaulted to ignore start/endtime on query to database
public List<InfraActiveRequests> getRequest(final Map<String, String[]> filters) {
String url = UriBuilder.fromUri(getUri(getInfraActiveRequests)).queryParam("from", "0")