summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-requests-db
diff options
context:
space:
mode:
authorHarry Huang <huangxiangyu5@huawei.com>2020-02-12 17:21:28 +0800
committerHarry Huang <huangxiangyu5@huawei.com>2020-02-19 10:59:53 +0800
commit71870a575f65f1c0a984fcd15533b73cc176d68d (patch)
treeff61417e7e85f7ce852413da2aaf4f1d0ed8da30 /mso-api-handlers/mso-requests-db
parent3c83d49d9b70d8dd371ad5bf4dfc22a070344102 (diff)
Modify requestDbClient to add methods for OrchestrationTask
Issue-ID: SO-2368 Add methods to handle OrchestrationTask Change-Id: I4595c5a1099977e5dba259bfbf77d666b1db699c Signed-off-by: Harry Huang <huangxiangyu5@huawei.com>
Diffstat (limited to 'mso-api-handlers/mso-requests-db')
-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<>();