aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java/org
diff options
context:
space:
mode:
authorBartosz Gardziejewski <bartosz.gardziejewski@nokia.com>2019-03-25 10:07:38 +0100
committerBartosz Gardziejewski <bartosz.gardziejewski@nokia.com>2019-04-01 15:58:25 +0200
commit30794f9184dc2220a557ba5610a434c2a2bac801 (patch)
tree31831476e0bbee7f9cd85ff20b30723c456905fd /vid-app-common/src/main/java/org
parent92c875958080d6e3039952b3ea3f8deab704ea51 (diff)
Sending workflow data from UI to SO
Change-Id: I39c78584c61eb317d4eaf2861ece810c1b60ab01 Issue-ID: VID-401 Signed-off-by: Bartosz Gardziejewski <bartosz.gardziejewski@nokia.com>
Diffstat (limited to 'vid-app-common/src/main/java/org')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/changeManagement/RequestParameters.java37
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/changeManagement/UIWorkflowsRequest.java35
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/changeManagement/WorkflowRequestDetail.java49
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/MsoController.java1
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java3
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/WorkflowsController.java17
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogic.java4
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java24
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/MsoInterface.java5
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/MsoProperties.java3
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java16
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/ChangeManagementService.java5
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/ChangeManagementServiceImpl.java14
14 files changed, 212 insertions, 3 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/changeManagement/RequestParameters.java b/vid-app-common/src/main/java/org/onap/vid/changeManagement/RequestParameters.java
new file mode 100644
index 000000000..dd6923569
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/changeManagement/RequestParameters.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2019 Nokia Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.vid.changeManagement;
+
+import java.util.List;
+import java.util.Map;
+
+public class RequestParameters {
+
+ private List<Map<String,String>> userParams;
+
+
+ public List<Map<String, String>> getUserParams() {
+ return userParams;
+ }
+
+ public void setUserParams(List<Map<String, String>> userParams) {
+ this.userParams = userParams;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/changeManagement/UIWorkflowsRequest.java b/vid-app-common/src/main/java/org/onap/vid/changeManagement/UIWorkflowsRequest.java
new file mode 100644
index 000000000..97eee3045
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/changeManagement/UIWorkflowsRequest.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2019 Nokia Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.vid.changeManagement;
+
+public class UIWorkflowsRequest {
+
+ private WorkflowRequestDetail requestDetails;
+
+
+ public WorkflowRequestDetail getRequestDetails() {
+ return requestDetails;
+ }
+
+ public void setRequestDetails(WorkflowRequestDetail requestDetails) {
+ this.requestDetails = requestDetails;
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/changeManagement/WorkflowRequestDetail.java b/vid-app-common/src/main/java/org/onap/vid/changeManagement/WorkflowRequestDetail.java
new file mode 100644
index 000000000..2ebebdd68
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/changeManagement/WorkflowRequestDetail.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2019 Nokia Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.vid.changeManagement;
+
+import org.onap.vid.mso.model.CloudConfiguration;
+
+public class WorkflowRequestDetail {
+
+
+ private CloudConfiguration cloudConfiguration;
+
+ private RequestParameters requestParameters;
+
+
+ public CloudConfiguration getCloudConfiguration() {
+ return cloudConfiguration;
+ }
+
+ public void setCloudConfiguration(CloudConfiguration cloudConfiguration) {
+ this.cloudConfiguration = cloudConfiguration;
+ }
+
+
+ public RequestParameters getRequestParameters() {
+ return requestParameters;
+ }
+
+ public void setRequestParameters(RequestParameters requestParameters) {
+ this.requestParameters = requestParameters;
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/MsoController.java b/vid-app-common/src/main/java/org/onap/vid/controller/MsoController.java
index 290400432..00f9db246 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/MsoController.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/MsoController.java
@@ -74,6 +74,7 @@ public class MsoController extends RestrictedBaseController {
* The Constant VNF_INSTANCE_ID.
*/
public static final String VNF_INSTANCE_ID = "<vnf_instance_id>";
+ public static final String WORKFLOW_ID = "<workflow_UUID>";
public static final String START_LOG = " start";
private final MsoBusinessLogic msoBusinessLogic;
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java b/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java
index 987bffa34..543aa9432 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java
@@ -24,6 +24,7 @@ package org.onap.vid.controller;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.module.kotlin.KotlinModule;
import io.joshworks.restclient.http.mapper.ObjectMapper;
+import org.onap.portalsdk.core.util.SystemProperties;
import org.onap.vid.aai.*;
import org.onap.vid.aai.model.PortDetailsTranslator;
import org.onap.vid.aai.util.*;
@@ -163,7 +164,7 @@ public class WebConfig {
}
@Bean
- public AaiOverTLSClientInterface aaiOverTLSClient(ObjectMapper unirestObjectMapper){
+ public AaiOverTLSClientInterface aaiOverTLSClient(ObjectMapper unirestObjectMapper, SystemProperties systemProperties){
return new AaiOverTLSClient(new SyncRestClient(unirestObjectMapper), new AaiOverTLSPropertySupplier());
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/WorkflowsController.java b/vid-app-common/src/main/java/org/onap/vid/controller/WorkflowsController.java
index f413d5658..a6ad92321 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/WorkflowsController.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/WorkflowsController.java
@@ -21,18 +21,26 @@
package org.onap.vid.controller;
import java.util.List;
+import java.util.UUID;
+
+import org.onap.vid.changeManagement.UIWorkflowsRequest;
import org.onap.vid.model.LocalWorkflowParameterDefinitions;
import org.onap.vid.model.SOWorkflow;
import org.onap.vid.model.SOWorkflowParameterDefinitions;
+import org.onap.vid.mso.MsoResponseWrapper;
+import org.onap.vid.services.ChangeManagementService;
import org.onap.vid.services.ExternalWorkflowsService;
import org.onap.vid.services.LocalWorkflowsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
+import javax.servlet.http.HttpServletRequest;
+
@RestController
@RequestMapping(WorkflowsController.WORKFLOWS_MANAGEMENT)
public class WorkflowsController extends VidRestrictedBaseController {
@@ -40,11 +48,13 @@ public class WorkflowsController extends VidRestrictedBaseController {
private ExternalWorkflowsService externalWorkflowsService;
private LocalWorkflowsService localWorkflowsService;
+ private ChangeManagementService changeManagementService;
@Autowired
- public WorkflowsController(ExternalWorkflowsService externalWorkflowsService, LocalWorkflowsService localWorkflowsService) {
+ public WorkflowsController(ExternalWorkflowsService externalWorkflowsService, LocalWorkflowsService localWorkflowsService,ChangeManagementService changeManagementService) {
this.externalWorkflowsService = externalWorkflowsService;
this.localWorkflowsService = localWorkflowsService;
+ this.changeManagementService = changeManagementService;
}
@RequestMapping(value = "workflows", method = RequestMethod.GET)
@@ -62,5 +72,10 @@ public class WorkflowsController extends VidRestrictedBaseController {
return localWorkflowsService.getWorkflowParameterDefinitions(name);
}
+ @RequestMapping(value = "{serviceInstanceId}/{vnfInstanceId}/{workflow_UUID}", method = RequestMethod.POST)
+ public MsoResponseWrapper getWorkflowFromUI(HttpServletRequest request, @PathVariable("serviceInstanceId") UUID serviceInstanceId, @PathVariable("vnfInstanceId") UUID vnfInstanceId, @PathVariable("workflow_UUID") UUID workflow_UUID, @RequestBody UIWorkflowsRequest requestBody) {
+ return changeManagementService.invokeVnfWorkflow(request,requestBody.getRequestDetails(), serviceInstanceId, vnfInstanceId, workflow_UUID);
+ }
+
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogic.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogic.java
index 633acbcb8..1ff30f03c 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogic.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogic.java
@@ -21,6 +21,7 @@
package org.onap.vid.mso;
import org.onap.vid.changeManagement.RequestDetailsWrapper;
+import org.onap.vid.changeManagement.WorkflowRequestDetail;
import org.onap.vid.controller.OperationalEnvironmentController;
import org.onap.vid.model.SoftDeleteRequest;
import org.onap.vid.mso.model.OperationalEnvironmentActivateInfo;
@@ -31,6 +32,7 @@ import org.onap.vid.mso.rest.RequestDetails;
import org.onap.vid.mso.rest.Task;
import java.util.List;
+import java.util.UUID;
public interface MsoBusinessLogic {
@@ -51,6 +53,8 @@ public interface MsoBusinessLogic {
MsoResponseWrapper scaleOutVfModuleInstance(org.onap.vid.changeManagement.RequestDetails requestDetails, String serviceInstanceId, String vnfInstanceId);
+ MsoResponseWrapper invokeVnfWorkflow(WorkflowRequestDetail request, String userId, UUID serviceInstanceId, UUID vnfInstanceId, UUID workflow_UUID);
+
MsoResponseWrapper createConfigurationInstance(org.onap.vid.mso.rest.RequestDetailsWrapper requestDetailsWrapper, String serviceInstanceId);
MsoResponseWrapper deleteSvcInstance(RequestDetails requestDetails, String serviceInstanceId, String serviceStatus);
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java
index ec1c5479f..ad07eacae 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java
@@ -30,6 +30,9 @@ import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.portalsdk.core.util.SystemProperties;
import org.onap.vid.changeManagement.ChangeManagementRequest;
import org.onap.vid.changeManagement.RequestDetailsWrapper;
+import org.onap.vid.changeManagement.UIWorkflowsRequest;
+import org.onap.vid.changeManagement.WorkflowRequestDetail;
+import org.onap.vid.controller.ControllersUtils;
import org.onap.vid.controller.OperationalEnvironmentController;
import org.onap.vid.exceptions.GenericUncheckedException;
import org.onap.vid.model.RequestReferencesContainer;
@@ -181,6 +184,27 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
}
@Override
+ public MsoResponseWrapper invokeVnfWorkflow(WorkflowRequestDetail request, String userId, UUID serviceInstanceId, UUID vnfInstanceId, UUID workflow_UUID) {
+ logInvocationInDebug("invokeVnfWorkflow");
+
+ String endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_WORKFLOW_INSTANCE);
+
+ String final_endpoint = endpoint
+ .replaceFirst(SVC_INSTANCE_ID, serviceInstanceId.toString())
+ .replaceFirst(WORKFLOW_ID, workflow_UUID.toString())
+ .replaceFirst(VNF_INSTANCE_ID, vnfInstanceId.toString());
+
+ Map<String,String> extraHeaders = new HashMap<>();
+
+ UUID requestId = UUID.randomUUID();
+ extraHeaders.put("X-ONAP-RequestID",requestId.toString());
+ extraHeaders.put("X-ONAP-PartnerName","VID");
+ extraHeaders.put("X-RequestorID",userId);
+
+ return msoClientInterface.invokeWorkflow(request,final_endpoint,extraHeaders);
+ }
+
+ @Override
public MsoResponseWrapper createConfigurationInstance(org.onap.vid.mso.rest.RequestDetailsWrapper requestDetailsWrapper, String serviceInstanceId) {
logInvocationInDebug("createConfigurationInstance");
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoInterface.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoInterface.java
index 31063c62b..904ba13e4 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoInterface.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoInterface.java
@@ -22,8 +22,11 @@ package org.onap.vid.mso;
import io.joshworks.restclient.http.HttpResponse;
import org.onap.vid.changeManagement.RequestDetailsWrapper;
+import org.onap.vid.changeManagement.WorkflowRequestDetail;
import org.onap.vid.mso.rest.RequestDetails;
+import java.util.Map;
+
/**
* Created by pickjonathan on 21/06/2017.
*/
@@ -111,6 +114,8 @@ public interface MsoInterface {
MsoResponseWrapper addRelationshipToServiceInstance(RequestDetails requestDetails, String addRelationshipsPath);
+ MsoResponseWrapper invokeWorkflow(WorkflowRequestDetail requestDetails,String invokeWorkflowsPath, Map<String, String> extraHeaders);
+
<T> HttpResponse<T> get(String path, Class<T> responseClass);
<T> HttpResponse<T> post(String path, RequestDetailsWrapper<?> requestDetailsWrapper,
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoProperties.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoProperties.java
index 3dc1ddcd3..47cb95f2f 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoProperties.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoProperties.java
@@ -97,6 +97,9 @@ public class MsoProperties extends SystemProperties {
public static final String MSO_REST_API_VF_MODULE_SCALE_OUT = "mso.restapi.vf.module.scaleout";
+ /** The Constant MSO_REST_API_WORKFLOW_INSTANCE. */
+ public static final String MSO_REST_API_WORKFLOW_INSTANCE = "mso.restapi.workflow.invoke";
+
/** The Constant MSO_REST_API_VOLUME_GROUP_INSTANCE. */
public static final String MSO_REST_API_VOLUME_GROUP_INSTANCE = "mso.restapi.volume.group.instance";
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java
index 8dac0ce1b..ff7acffcf 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java
@@ -22,6 +22,7 @@ package org.onap.vid.mso.rest;
import com.google.common.collect.ImmutableMap;
import io.joshworks.restclient.http.HttpResponse;
+import io.joshworks.restclient.http.JsonNode;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
@@ -36,6 +37,7 @@ import org.onap.portalsdk.core.util.SystemProperties;
import org.onap.vid.aai.util.HttpsAuthClient;
import org.onap.vid.changeManagement.MsoRequestDetails;
import org.onap.vid.changeManagement.RequestDetailsWrapper;
+import org.onap.vid.changeManagement.WorkflowRequestDetail;
import org.onap.vid.client.SyncRestClient;
import org.onap.vid.model.RequestReferencesContainer;
import org.onap.vid.mso.MsoInterface;
@@ -444,6 +446,20 @@ public class MsoRestClientNew extends RestMsoImplementation implements MsoInterf
}
@Override
+ public MsoResponseWrapper invokeWorkflow(WorkflowRequestDetail workflowRequestDetail, String invokeWorkflowsPath, Map<String, String> extraHeaders) {
+ String path = baseUrl + invokeWorkflowsPath;
+ Map<String, String> finalHeader = new HashMap<>();
+
+ finalHeader.putAll(commonHeaders);
+ finalHeader.putAll(extraHeaders);
+
+ RequestDetailsWrapper<WorkflowRequestDetail> requestDetailsWrapper = new RequestDetailsWrapper<>(workflowRequestDetail);
+
+ HttpResponse<JsonNode> response = client.post(path, finalHeader, requestDetailsWrapper);
+ return MsoUtil.wrapResponse(response);
+ }
+
+ @Override
public <T> HttpResponse<T> get(String endpoint, Class<T> responseClass) {
String path = baseUrl + endpoint;
return client.get(path, commonHeaders, new HashMap<>(), responseClass);
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java b/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java
index 142bf73ec..83757f2fb 100644
--- a/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java
+++ b/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java
@@ -320,6 +320,8 @@ public class AaiServiceImpl implements AaiService {
return aaiClient.getPNFData(globalCustomerId, serviceType, modelVersionId, modelInvariantId, cloudRegion, equipVendor, equipModel);
}
+
+
@Override
public AaiResponse getServices(RoleValidator roleValidator) {
AaiResponse<GetServicesAAIRespone> subscriberResponse = aaiClient.getServices();
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/ChangeManagementService.java b/vid-app-common/src/main/java/org/onap/vid/services/ChangeManagementService.java
index 0047396d1..603e1f7be 100644
--- a/vid-app-common/src/main/java/org/onap/vid/services/ChangeManagementService.java
+++ b/vid-app-common/src/main/java/org/onap/vid/services/ChangeManagementService.java
@@ -23,13 +23,16 @@ package org.onap.vid.services;
import com.fasterxml.jackson.databind.node.ArrayNode;
import org.apache.commons.lang3.tuple.Pair;
import org.onap.vid.changeManagement.*;
+import org.onap.vid.mso.MsoResponseWrapper;
import org.onap.vid.mso.RestObjectWithRequestInfo;
import org.onap.vid.mso.rest.Request;
import org.springframework.http.ResponseEntity;
import org.springframework.web.multipart.MultipartFile;
+import javax.servlet.http.HttpServletRequest;
import java.util.Collection;
import java.util.List;
+import java.util.UUID;
public interface ChangeManagementService {
Collection<Request> getMSOChangeManagements();
@@ -49,4 +52,6 @@ public interface ChangeManagementService {
VnfWorkflowRelationAllResponse getAllVnfWorkflowRelations();
String uploadConfigUpdateFile(MultipartFile file);
+ MsoResponseWrapper invokeVnfWorkflow(HttpServletRequest request, WorkflowRequestDetail requestBody, UUID serviceInstanceId, UUID vnfInstanceId, UUID workflow_UUID);
+
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/ChangeManagementServiceImpl.java b/vid-app-common/src/main/java/org/onap/vid/services/ChangeManagementServiceImpl.java
index a20164c9e..fc5a85c04 100644
--- a/vid-app-common/src/main/java/org/onap/vid/services/ChangeManagementServiceImpl.java
+++ b/vid-app-common/src/main/java/org/onap/vid/services/ChangeManagementServiceImpl.java
@@ -30,17 +30,20 @@ import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.portalsdk.core.service.DataAccessService;
import org.onap.portalsdk.core.util.SystemProperties;
import org.onap.vid.changeManagement.*;
+import org.onap.vid.controller.ControllersUtils;
import org.onap.vid.exceptions.GenericUncheckedException;
import org.onap.vid.exceptions.NotFoundException;
import org.onap.vid.model.VNFDao;
import org.onap.vid.model.VidWorkflow;
import org.onap.vid.mso.MsoBusinessLogic;
+import org.onap.vid.mso.MsoResponseWrapper;
import org.onap.vid.mso.MsoResponseWrapperInterface;
import org.onap.vid.mso.RestObject;
import org.onap.vid.mso.RestObjectWithRequestInfo;
import org.onap.vid.mso.rest.Request;
import org.onap.vid.scheduler.SchedulerProperties;
import org.onap.vid.scheduler.SchedulerRestInterfaceIfc;
+import org.onap.vid.utils.SystemPropertiesWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -48,6 +51,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
+import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.BadRequestException;
import java.io.IOException;
import java.util.*;
@@ -64,16 +68,18 @@ public class ChangeManagementServiceImpl implements ChangeManagementService {
private MsoBusinessLogic msoBusinessLogic;
private final SchedulerRestInterfaceIfc restClient;
private final CloudOwnerService cloudOwnerService;
+ private final SystemPropertiesWrapper systemPropertiesWrapper;
@Autowired
private CsvService csvService;
@Autowired
- public ChangeManagementServiceImpl(DataAccessService dataAccessService, MsoBusinessLogic msoBusinessLogic, SchedulerRestInterfaceIfc schedulerRestInterface, CloudOwnerService cloudOwnerService) {
+ public ChangeManagementServiceImpl(DataAccessService dataAccessService, MsoBusinessLogic msoBusinessLogic, SchedulerRestInterfaceIfc schedulerRestInterface, CloudOwnerService cloudOwnerService, SystemPropertiesWrapper systemPropertiesWrapper) {
this.dataAccessService = dataAccessService;
this.msoBusinessLogic = msoBusinessLogic;
this.restClient = schedulerRestInterface;
this.cloudOwnerService = cloudOwnerService;
+ this.systemPropertiesWrapper = systemPropertiesWrapper;
}
@Override
@@ -327,6 +333,12 @@ public class ChangeManagementServiceImpl implements ChangeManagementService {
return json.toString();
}
+ @Override
+ public MsoResponseWrapper invokeVnfWorkflow(HttpServletRequest request,WorkflowRequestDetail requestBody, UUID serviceInstanceId, UUID vnfInstanceId, UUID workflow_UUID) {
+ String userId = new ControllersUtils(systemPropertiesWrapper).extractUserId(request);
+ return msoBusinessLogic.invokeVnfWorkflow(requestBody, userId, serviceInstanceId, vnfInstanceId, workflow_UUID);
+ }
+
private boolean validateJsonOutput(org.json.JSONObject json) {
if (!json.has(PRIMARY_KEY) || !json.getJSONObject(PRIMARY_KEY).keySet().containsAll(REQUIRED_KEYS))
return false;