aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChuanyu Chen <chenchuanyu@huawei.com>2020-02-19 08:02:28 +0000
committerGerrit Code Review <gerrit@onap.org>2020-02-19 08:02:28 +0000
commit493477ef59ce12d082683f188e0253fe2d34bdff (patch)
treec930463ab693895c03f18ce4bc0849f3e19783b4
parent662f2cdcb69c7ec2264493a8c329f946001c1020 (diff)
parent71870a575f65f1c0a984fcd15533b73cc176d68d (diff)
Merge "Modify requestDbClient to add methods for OrchestrationTask"
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java38
1 files changed, 38 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 334eb73da4..7b642ab831 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
@@ -45,6 +45,7 @@ import org.onap.so.db.request.beans.SiteStatus;
import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus;
import org.onap.so.db.request.beans.WatchdogDistributionStatus;
import org.onap.so.db.request.beans.WatchdogServiceModVerIdLookup;
+import org.onap.so.db.request.beans.OrchestrationTask;
import org.onap.so.db.request.data.controller.InstanceNameDuplicateCheckRequest;
import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
import org.springframework.beans.factory.annotation.Autowired;
@@ -119,6 +120,8 @@ public class RequestsDbClient {
private String getInProgressVolumeGroupsAndVfModules = "/infraActiveRequests/getInProgressVolumeGroupsAndVfModules";
+ private String orchestrationTasksURI = "/orchestrationTask";
+
private static final String findBySoRequestIdAndGroupIdAndName =
"/requestProcessingData/search/findOneBySoRequestIdAndGroupingIdAndName";
@@ -156,6 +159,7 @@ public class RequestsDbClient {
findAllByOperationalEnvIdAndRequestIdURI =
endpoint + OPERATIONAL_ENV_SERVICE_MODEL_STATUS_SEARCH + findAllByOperationalEnvIdAndRequestIdURI;
findOneByRequestId = endpoint + findOneByRequestId;
+ orchestrationTasksURI = endpoint + orchestrationTasksURI;
}
protected String getEndpoint() {
@@ -520,6 +524,40 @@ public class RequestsDbClient {
.getBody();
}
+ public List<OrchestrationTask> getAllOrchestrationTasks() {
+ String url = UriBuilder.fromUri(getUri(orchestrationTasksURI)).build().toString();
+ HttpEntity<?> entity = getHttpEntity();
+ return restTemplate
+ .exchange(url, HttpMethod.GET, entity, new ParameterizedTypeReference<List<OrchestrationTask>>() {})
+ .getBody();
+ }
+
+ public OrchestrationTask getOrchestrationTask(String taskId) {
+ String url = UriBuilder.fromUri(getUri(orchestrationTasksURI + "/" + taskId)).build().toString();
+ HttpEntity<?> entity = getHttpEntity();
+ return restTemplate.exchange(url, HttpMethod.GET, entity, OrchestrationTask.class).getBody();
+ }
+
+ public OrchestrationTask createOrchestrationTask(OrchestrationTask orchestrationTask) {
+ String url = UriBuilder.fromUri(getUri(orchestrationTasksURI + "/")).build().toString();
+ HttpHeaders headers = getHttpHeaders();
+ HttpEntity<OrchestrationTask> entity = new HttpEntity<>(orchestrationTask, headers);
+ return restTemplate.exchange(url, HttpMethod.POST, entity, OrchestrationTask.class).getBody();
+ }
+
+ public OrchestrationTask updateOrchestrationTask(String taskId, OrchestrationTask orchestrationTask) {
+ String url = getUri(orchestrationTasksURI + "/" + taskId).toString();
+ HttpHeaders headers = getHttpHeaders();
+ HttpEntity<OrchestrationTask> entity = new HttpEntity<>(orchestrationTask, headers);
+ return restTemplate.exchange(url, HttpMethod.PUT, entity, OrchestrationTask.class).getBody();
+ }
+
+ public void deleteOrchestrationTask(String taskId) {
+ String url = getUri(orchestrationTasksURI + "/" + taskId).toString();
+ HttpEntity<?> entity = getHttpEntity();
+ restTemplate.exchange(url, HttpMethod.DELETE, entity, Void.class).getBody();
+ }
+
@Component
static class ClassURLMapper {
private static final Map<Class, String> classURLMap = new HashMap<>();