diff options
author | Einat Vinouze <einat.vinouze@intl.att.com> | 2019-07-16 17:17:36 +0300 |
---|---|---|
committer | Ittay Stern <ittay.stern@att.com> | 2019-07-30 06:01:44 +0300 |
commit | e601bbdc43bae9a08e2e10c5139a6f76b47860d7 (patch) | |
tree | 1913f0b369ead3f2ea5557e5649d8281eca9871c /vid-app-common/src/main/java/org/onap/vid/controller/MsoController.java | |
parent | 76c6ee4a697617ec4cdee2f3b48bc83136c858c5 (diff) |
Implant vid-app-common org.onap.vid.job (main and test)
Issue-ID: VID-378
Change-Id: I41b0bdc2c4e3635f3f3319b1cd63cefc61912dfc
Signed-off-by: Einat Vinouze <einat.vinouze@intl.att.com>
Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-app-common/src/main/java/org/onap/vid/controller/MsoController.java')
-rw-r--r-- | vid-app-common/src/main/java/org/onap/vid/controller/MsoController.java | 35 |
1 files changed, 23 insertions, 12 deletions
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 db3a21910..fc718f0d2 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 @@ -20,9 +20,9 @@ package org.onap.vid.controller; +import static org.onap.vid.utils.KotlinUtilsKt.JACKSON_OBJECT_MAPPER; import static org.onap.vid.utils.Logging.getMethodName; -import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; import java.util.LinkedHashMap; import java.util.List; @@ -31,10 +31,14 @@ import javax.servlet.http.HttpServletResponse; import org.onap.portalsdk.core.controller.RestrictedBaseController; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.vid.model.ExceptionResponse; +import org.onap.vid.model.RequestReferencesContainer; import org.onap.vid.model.SoftDeleteRequest; import org.onap.vid.mso.MsoBusinessLogic; import org.onap.vid.mso.MsoResponseWrapper; import org.onap.vid.mso.MsoResponseWrapper2; +import org.onap.vid.mso.RestMsoImplementation; +import org.onap.vid.mso.RestObject; +import org.onap.vid.mso.rest.MsoRestClientNew; import org.onap.vid.mso.rest.Request; import org.onap.vid.mso.rest.RequestDetails; import org.onap.vid.mso.rest.RequestDetailsWrapper; @@ -82,11 +86,13 @@ public class MsoController extends RestrictedBaseController { public static final String START_LOG = " start"; private final MsoBusinessLogic msoBusinessLogic; + private final RestMsoImplementation restMso; private final CloudOwnerService cloudOwnerService; @Autowired - public MsoController(MsoBusinessLogic msoBusinessLogic, CloudOwnerService cloudOwnerService) { + public MsoController(MsoBusinessLogic msoBusinessLogic, MsoRestClientNew msoClientInterface, CloudOwnerService cloudOwnerService) { this.msoBusinessLogic = msoBusinessLogic; + this.restMso = msoClientInterface; this.cloudOwnerService = cloudOwnerService; } @@ -678,30 +684,35 @@ public class MsoController extends RestrictedBaseController { @RequestMapping(value = "/mso_activate_fabric_configuration/{serviceInstanceId}", method = RequestMethod.POST) public MsoResponseWrapper2 activateFabricConfiguration( - @PathVariable("serviceInstanceId") String serviceInstanceId, - @RequestBody RequestDetails requestDetails) { + @PathVariable("serviceInstanceId") String serviceInstanceId , + @RequestBody RequestDetails requestDetails) { String methodName = "activateFabricConfiguration"; LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG); - return msoBusinessLogic.activateFabricConfiguration(serviceInstanceId, requestDetails); + String path = msoBusinessLogic.getActivateFabricConfigurationPath(serviceInstanceId); + RestObject<RequestReferencesContainer> msoResponse = restMso.PostForObject(requestDetails, path, RequestReferencesContainer.class); + + return new MsoResponseWrapper2<>(msoResponse); } @RequestMapping(value = "/mso_vfmodule_soft_delete/{serviceInstanceId}/{vnfInstanceId}/{vfModuleInstanceId}", method = RequestMethod.POST) public MsoResponseWrapper2 deactivateAndCloudDelete( - @PathVariable("serviceInstanceId") String serviceInstanceId, - @PathVariable("vnfInstanceId") String vnfInstanceId, - @PathVariable("vfModuleInstanceId") String vfModuleInstanceId, - @RequestBody SoftDeleteRequest softDeleteRequest) { + @PathVariable("serviceInstanceId") String serviceInstanceId, + @PathVariable("vnfInstanceId") String vnfInstanceId, + @PathVariable("vfModuleInstanceId") String vfModuleInstanceId, + @RequestBody SoftDeleteRequest softDeleteRequest) { String methodName = "deactivateAndCloudDelete"; LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG); + String path = msoBusinessLogic.getDeactivateAndCloudDeletePath(serviceInstanceId, vnfInstanceId, vfModuleInstanceId); RequestDetails requestDetails = msoBusinessLogic.buildRequestDetailsForSoftDelete(softDeleteRequest); cloudOwnerService.enrichRequestWithCloudOwner(requestDetails); - return msoBusinessLogic - .deactivateAndCloudDelete(serviceInstanceId, vnfInstanceId, vfModuleInstanceId, requestDetails); + RestObject<RequestReferencesContainer> msoResponse = restMso.PostForObject(new org.onap.vid.changeManagement.RequestDetailsWrapper<>(requestDetails), path, RequestReferencesContainer.class); + + return new MsoResponseWrapper2<>(msoResponse); } /** @@ -723,7 +734,7 @@ public class MsoController extends RestrictedBaseController { exceptionResponse.setException(e.getClass().toString().replaceFirst("^.*\\.", "")); exceptionResponse.setMessage(e.getMessage()); - response.getWriter().write(new ObjectMapper().writeValueAsString(exceptionResponse)); + response.getWriter().write(JACKSON_OBJECT_MAPPER.writeValueAsString(exceptionResponse)); response.flushBuffer(); } |