diff options
Diffstat (limited to 'vid-app-common/src/main/java/org/onap/vid/controller')
12 files changed, 120 insertions, 93 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/AaiController.java b/vid-app-common/src/main/java/org/onap/vid/controller/AaiController.java index a8e1e2b02..3aff7fea7 100644 --- a/vid-app-common/src/main/java/org/onap/vid/controller/AaiController.java +++ b/vid-app-common/src/main/java/org/onap/vid/controller/AaiController.java @@ -3,6 +3,7 @@ * VID * ================================================================================ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nokia. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +21,19 @@ package org.onap.vid.controller; +import static org.onap.vid.utils.Logging.getMethodName; + import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.stream.Collectors; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.QueryParam; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Response; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; import org.onap.portalsdk.core.controller.RestrictedBaseController; @@ -41,30 +54,21 @@ import org.onap.vid.roles.Role; import org.onap.vid.roles.RoleProvider; import org.onap.vid.roles.RoleValidator; import org.onap.vid.services.AaiService; +import org.onap.vid.utils.SystemPropertiesWrapper; import org.onap.vid.utils.Unchecked; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; +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 org.springframework.web.servlet.HandlerMapping; import org.springframework.web.servlet.ModelAndView; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.QueryParam; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Response; -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.stream.Collectors; - -import static org.onap.vid.utils.Logging.getMethodName; - /** * Controller to handle a&ai requests. */ @@ -72,33 +76,25 @@ import static org.onap.vid.utils.Logging.getMethodName; @RestController public class AaiController extends RestrictedBaseController { - /** - * The from app id. - */ - private String fromAppId = "VidAaiController"; - /** - * The logger. - */ private static final EELFLoggerDelegate LOGGER = EELFLoggerDelegate.getLogger(AaiController.class); - /** - * The model. - */ - private Map<String, Object> model = new HashMap<>(); - /** - * The servlet context. - */ - @Autowired - private ServletContext servletContext; - /** - * aai service - */ - @Autowired + private static final String FROM_APP_ID = "VidAaiController"; + private AaiService aaiService; - @Autowired + private AAIRestInterface aaiRestInterface; private RoleProvider roleProvider; + private SystemPropertiesWrapper systemPropertiesWrapper; @Autowired - private AAIRestInterface aaiRestInterface; + public AaiController(AaiService aaiService, + AAIRestInterface aaiRestInterface, + RoleProvider roleProvider, + SystemPropertiesWrapper systemPropertiesWrapper) { + + this.aaiService = aaiService; + this.aaiRestInterface = aaiRestInterface; + this.roleProvider = roleProvider; + this.systemPropertiesWrapper = systemPropertiesWrapper; + } /** * Welcome method. @@ -140,7 +136,7 @@ public class AaiController extends RestrictedBaseController { @RequestMapping(value = {"/getuserID"}, method = RequestMethod.GET) public ResponseEntity<String> getUserID(HttpServletRequest request) { - String userId = ControllersUtils.extractUserId(request); + String userId = new ControllersUtils(systemPropertiesWrapper).extractUserId(request); return new ResponseEntity<>(userId, HttpStatus.OK); } @@ -153,7 +149,7 @@ public class AaiController extends RestrictedBaseController { */ @RequestMapping(value = "/aai_get_services", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<String> doGetServices(HttpServletRequest request) throws IOException { - RoleValidator roleValidator = new RoleValidator(roleProvider.getUserRoles(request)); + RoleValidator roleValidator = RoleValidator.by(roleProvider.getUserRoles(request)); AaiResponse subscriberList = aaiService.getServices(roleValidator); return aaiResponseToResponseEntity(subscriberList); @@ -277,7 +273,7 @@ public class AaiController extends RestrictedBaseController { public ResponseEntity<String> getFullSubscriberList(HttpServletRequest request) throws IOException { ObjectMapper objectMapper = new ObjectMapper(); ResponseEntity<String> responseEntity; - RoleValidator roleValidator = new RoleValidator(roleProvider.getUserRoles(request)); + RoleValidator roleValidator = RoleValidator.by(roleProvider.getUserRoles(request)); SubscriberFilteredResults subscriberList = aaiService.getFullSubscriberList(roleValidator); if (subscriberList.getHttpCode() == 200) { responseEntity = new ResponseEntity<>(objectMapper.writeValueAsString(subscriberList.getSubscriberList()), HttpStatus.OK); @@ -340,7 +336,7 @@ public class AaiController extends RestrictedBaseController { ObjectMapper objectMapper = new ObjectMapper(); ResponseEntity responseEntity; List<Role> roles = roleProvider.getUserRoles(request); - RoleValidator roleValidator = new RoleValidator(roles); + RoleValidator roleValidator = RoleValidator.by(roles); AaiResponse subscriberData = aaiService.getSubscriberData(subscriberId, roleValidator); String httpMessage = subscriberData.getT() != null ? objectMapper.writeValueAsString(subscriberData.getT()) : @@ -369,7 +365,7 @@ public class AaiController extends RestrictedBaseController { ResponseEntity responseEntity; List<Role> roles = roleProvider.getUserRoles(request); - RoleValidator roleValidator = new RoleValidator(roles); + RoleValidator roleValidator = RoleValidator.by(roles); AaiResponse<ServiceInstancesSearchResults> searchResult = aaiService.getServiceInstanceSearchResults(subscriberId, instanceIdentifier, roleValidator, owningEntities, projects); @@ -531,7 +527,7 @@ public class AaiController extends RestrictedBaseController { try { ObjectMapper objectMapper = new ObjectMapper(); List<Role> roles = roleProvider.getUserRoles(request); - RoleValidator roleValidator = new RoleValidator(roles); + RoleValidator roleValidator = RoleValidator.by(roles); AaiResponse<GetTenantsResponse[]> response = aaiService.getTenants(globalCustomerId, serviceType, roleValidator); if (response.getHttpCode() == 200) { responseEntity = new ResponseEntity<String>(objectMapper.writeValueAsString(response.getT()), HttpStatus.OK); @@ -618,7 +614,7 @@ public class AaiController extends RestrictedBaseController { try { - resp = aaiRestInterface.RestGet(fromAppId, transId, Unchecked.toURI(uri), xml).getResponse(); + resp = aaiRestInterface.RestGet(FROM_APP_ID, transId, Unchecked.toURI(uri), xml).getResponse(); } catch (WebApplicationException e) { final String message = e.getResponse().readEntity(String.class); @@ -647,7 +643,7 @@ public class AaiController extends RestrictedBaseController { Response resp = null; try { - resp = aaiRestInterface.RestPost(fromAppId, uri, payload, xml); + resp = aaiRestInterface.RestPost(FROM_APP_ID, uri, payload, xml); } catch (Exception e) { LOGGER.info(EELFLoggerDelegate.errorLogger, "<== " + "." + methodName + e.toString()); diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java b/vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java index a204d3a9a..081e3c640 100644 --- a/vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java +++ b/vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java @@ -31,6 +31,7 @@ import org.onap.vid.model.serviceInstantiation.ServiceInstantiation; import org.onap.vid.mso.MsoResponseWrapper2; import org.onap.vid.services.AsyncInstantiationBusinessLogic; import org.onap.vid.services.AuditService; +import org.onap.vid.utils.SystemPropertiesWrapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -48,6 +49,7 @@ public class AsyncInstantiationController extends VidRestrictedBaseController { public static final String ASYNC_INSTANTIATION = "asyncInstantiation"; protected final AsyncInstantiationBusinessLogic asyncInstantiationBL; + private final SystemPropertiesWrapper systemPropertiesWrapper; protected ObjectMapper objectMapper = new ObjectMapper(); @@ -55,8 +57,9 @@ public class AsyncInstantiationController extends VidRestrictedBaseController { protected AuditService auditService; @Autowired - public AsyncInstantiationController(AsyncInstantiationBusinessLogic asyncInstantiationBL) { + public AsyncInstantiationController(AsyncInstantiationBusinessLogic asyncInstantiationBL, SystemPropertiesWrapper systemPropertiesWrapper) { this.asyncInstantiationBL = asyncInstantiationBL; + this.systemPropertiesWrapper = systemPropertiesWrapper; } @ExceptionHandler(OperationNotAllowedException.class) @@ -84,7 +87,7 @@ public class AsyncInstantiationController extends VidRestrictedBaseController { catch (Exception e) { LOGGER.error(EELFLoggerDelegate.errorLogger, "failed to log incoming ServiceInstantiation request ", e); } - String userId = ControllersUtils.extractUserId(httpServletRequest); + String userId = new ControllersUtils(systemPropertiesWrapper).extractUserId(httpServletRequest); List<UUID> uuids = asyncInstantiationBL.pushBulkJob(request, userId); return new MsoResponseWrapper2(200, uuids); diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/ControllersUtils.java b/vid-app-common/src/main/java/org/onap/vid/controller/ControllersUtils.java index 7139b29fb..befbe0320 100644 --- a/vid-app-common/src/main/java/org/onap/vid/controller/ControllersUtils.java +++ b/vid-app-common/src/main/java/org/onap/vid/controller/ControllersUtils.java @@ -3,13 +3,14 @@ * VID * ================================================================================ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nokia. 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. @@ -20,35 +21,26 @@ package org.onap.vid.controller; +import static org.onap.vid.utils.Logging.getMethodCallerName; + +import java.util.Optional; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import javax.ws.rs.WebApplicationException; import org.apache.commons.lang3.exception.ExceptionUtils; import org.onap.portalsdk.core.domain.User; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.portalsdk.core.util.SystemProperties; import org.onap.vid.model.ExceptionResponse; +import org.onap.vid.utils.SystemPropertiesWrapper; import org.springframework.http.ResponseEntity; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; -import javax.ws.rs.WebApplicationException; - -import static org.onap.vid.utils.Logging.getMethodCallerName; +public final class ControllersUtils { -public class ControllersUtils { + private final SystemPropertiesWrapper systemPropertiesWrapper; - - public static String extractUserId(HttpServletRequest request) { - String userId = ""; - HttpSession session = request.getSession(); - if (session != null) { - User user = (User) session.getAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME)); - if (user != null) { - //userId = user.getHrid(); - userId = user.getLoginId(); - if (userId == null) - userId = user.getOrgUserId(); - } - } - return userId; + public ControllersUtils(SystemPropertiesWrapper systemPropertiesWrapper) { + this.systemPropertiesWrapper = systemPropertiesWrapper; } public static ExceptionResponse handleException(Exception e, EELFLoggerDelegate logger) { @@ -62,4 +54,12 @@ public class ControllersUtils { return ResponseEntity.status(e.getResponse().getStatus()).body(ControllersUtils.handleException(e, logger)); } + public String extractUserId(HttpServletRequest request) { + Optional<User> user = Optional.ofNullable(request.getSession()) + .map((HttpSession he) -> (User) he + .getAttribute(systemPropertiesWrapper.getProperty(SystemProperties.USER_ATTRIBUTE_NAME))); + + return user.map(User::getLoginId).isPresent() + ? user.map(User::getLoginId).orElse("") : user.map(User::getOrgUserId).orElse(""); + } } diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/MsoConfig.java b/vid-app-common/src/main/java/org/onap/vid/controller/MsoConfig.java index a472268a3..8d5fbbdbb 100644 --- a/vid-app-common/src/main/java/org/onap/vid/controller/MsoConfig.java +++ b/vid-app-common/src/main/java/org/onap/vid/controller/MsoConfig.java @@ -30,10 +30,10 @@ import org.onap.vid.mso.MsoBusinessLogic; import org.onap.vid.mso.MsoBusinessLogicImpl; import org.onap.vid.mso.MsoInterface; import org.onap.vid.mso.MsoProperties; -import org.onap.vid.mso.rest.MockedWorkflowsRestClient; import org.onap.vid.mso.rest.MsoRestClientNew; import org.onap.vid.services.CloudOwnerService; import org.onap.vid.services.CloudOwnerServiceImpl; +import org.onap.vid.utils.SystemPropertiesWrapper; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.togglz.core.manager.FeatureManager; @@ -48,16 +48,12 @@ public class MsoConfig { } @Bean - public MsoRestClientNew msoClient(ObjectMapper unirestObjectMapper, HttpsAuthClient httpsAuthClient){ + public MsoRestClientNew msoClient(ObjectMapper unirestObjectMapper, HttpsAuthClient httpsAuthClient, SystemPropertiesWrapper systemPropertiesWrapper){ // Satisfy both interfaces -- MsoInterface and RestMsoImplementation return new MsoRestClientNew(new SyncRestClient(unirestObjectMapper), SystemProperties.getProperty( - MsoProperties.MSO_SERVER_URL),httpsAuthClient); + MsoProperties.MSO_SERVER_URL),httpsAuthClient, systemPropertiesWrapper); } - @Bean - public MockedWorkflowsRestClient mockedWorkflowsClient(ObjectMapper unirestObjectMapper){ - return new MockedWorkflowsRestClient(new SyncRestClient(unirestObjectMapper), "http://vid-simulator:1080/"); - } @Bean public MsoBusinessLogic getMsoBusinessLogic(MsoInterface msoClient, FeatureManager featureManager){ 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/OperationalEnvironmentController.java b/vid-app-common/src/main/java/org/onap/vid/controller/OperationalEnvironmentController.java index fe94dfd80..a6778ad0c 100644 --- a/vid-app-common/src/main/java/org/onap/vid/controller/OperationalEnvironmentController.java +++ b/vid-app-common/src/main/java/org/onap/vid/controller/OperationalEnvironmentController.java @@ -37,6 +37,7 @@ import org.onap.vid.mso.model.OperationalEnvironmentActivateInfo; import org.onap.vid.mso.model.OperationalEnvironmentDeactivateInfo; import org.onap.vid.mso.rest.OperationalEnvironment.OperationEnvironmentRequestDetails; import org.onap.vid.mso.rest.RequestDetails; +import org.onap.vid.utils.SystemPropertiesWrapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.MissingServletRequestParameterException; @@ -60,20 +61,22 @@ public class OperationalEnvironmentController extends VidRestrictedBaseControlle private final MsoInterface restMso; private final MsoBusinessLogic msoBusinessLogic; + private final SystemPropertiesWrapper systemPropertiesWrapper; private static final Pattern RECOVERY_ACTION_MESSAGE_PATTERN = Pattern.compile("from String \"(.*)\": value not"); @Autowired - public OperationalEnvironmentController(MsoBusinessLogic msoBusinessLogic, MsoInterface msoClientInterface) { + public OperationalEnvironmentController(MsoBusinessLogic msoBusinessLogic, MsoInterface msoClientInterface, SystemPropertiesWrapper systemPropertiesWrapper) { this.restMso = msoClientInterface; this.msoBusinessLogic = msoBusinessLogic; + this.systemPropertiesWrapper = systemPropertiesWrapper; } @RequestMapping(value = "/create", method = RequestMethod.POST) public MsoResponseWrapper2 createOperationalEnvironment(HttpServletRequest request, @RequestBody OperationalEnvironmentCreateBody operationalEnvironment) { debugStart(operationalEnvironment); - String userId = ControllersUtils.extractUserId(request); + String userId = new ControllersUtils(systemPropertiesWrapper).extractUserId(request); RequestDetailsWrapper<OperationEnvironmentRequestDetails> requestDetailsWrapper = msoBusinessLogic.convertParametersToRequestDetails(operationalEnvironment, userId); String path = msoBusinessLogic.getOperationalEnvironmentCreationPath(); @@ -94,7 +97,7 @@ public class OperationalEnvironmentController extends VidRestrictedBaseControlle throw new BadManifestException("Manifest structure is wrong"); } - String userId = ControllersUtils.extractUserId(request); + String userId = new ControllersUtils(systemPropertiesWrapper).extractUserId(request); OperationalEnvironmentActivateInfo activateInfo = new OperationalEnvironmentActivateInfo(activateRequest, userId, operationalEnvironmentId); debugStart(activateInfo); @@ -115,7 +118,7 @@ public class OperationalEnvironmentController extends VidRestrictedBaseControlle verifyIsNotEmpty(operationalEnvironmentId, "operationalEnvironment"); - String userId = ControllersUtils.extractUserId(request); + String userId = new ControllersUtils(systemPropertiesWrapper).extractUserId(request); OperationalEnvironmentDeactivateInfo deactivateInfo = new OperationalEnvironmentDeactivateInfo(userId, operationalEnvironmentId); debugStart(deactivateInfo); 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..e00c2d7a5 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.*; @@ -41,11 +42,18 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.togglz.core.manager.FeatureManager; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + import javax.servlet.ServletContext; import java.io.File; import java.io.IOException; +@EnableSwagger2 @Configuration public class WebConfig { @@ -163,7 +171,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()); } @@ -192,4 +200,12 @@ public class WebConfig { } + @Bean + public Docket api(){ + return new Docket(DocumentationType.SWAGGER_2) + .select() + .apis(RequestHandlerSelectors.basePackage("org.onap.vid.controller.open")) + .paths(PathSelectors.any()) + .build(); + } } 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 a94481b9e..1d0ff95bc 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,27 +48,30 @@ 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) - public List<SOWorkflow> getWorkflows(@RequestParam(value = "vnfName") String vnfName){ - return externalWorkflowsService.getWorkflows(vnfName); + public List<SOWorkflow> getWorkflows(@RequestParam(value = "vnfModelId") String vnfModelId){ + return externalWorkflowsService.getWorkflows(vnfModelId); } - @RequestMapping(value = "remote-workflow-parameters/{id}", method = RequestMethod.GET) - SOWorkflowParameterDefinitions getParameters(@PathVariable Long id) { - return externalWorkflowsService.getWorkflowParameterDefinitions(id); - } @RequestMapping(value = "local-workflow-parameters/{name}", method = RequestMethod.GET) LocalWorkflowParameterDefinitions getParameters(@PathVariable String name) { 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/controller/HealthCheckController.java b/vid-app-common/src/main/java/org/onap/vid/controller/open/HealthCheckController.java index 04d5babcc..92e1a1802 100644 --- a/vid-app-common/src/main/java/org/onap/vid/controller/HealthCheckController.java +++ b/vid-app-common/src/main/java/org/onap/vid/controller/open/HealthCheckController.java @@ -18,11 +18,12 @@ * ============LICENSE_END========================================================= */ -package org.onap.vid.controller; +package org.onap.vid.controller.open; import org.onap.portalsdk.core.controller.UnRestrictedBaseController; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.portalsdk.core.util.SystemProperties; +import org.onap.vid.controller.HealthStatus; import org.onap.vid.dao.FnAppDoaImpl; import org.onap.vid.model.GitRepositoryState; import org.springframework.beans.factory.annotation.Autowired; diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/MaintenanceController.java b/vid-app-common/src/main/java/org/onap/vid/controller/open/MaintenanceController.java index dfba4e31a..d1004401a 100644 --- a/vid-app-common/src/main/java/org/onap/vid/controller/MaintenanceController.java +++ b/vid-app-common/src/main/java/org/onap/vid/controller/open/MaintenanceController.java @@ -1,4 +1,4 @@ -package org.onap.vid.controller; +package org.onap.vid.controller.open; /*- * ============LICENSE_START======================================================= diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/RoleGeneratorController.java b/vid-app-common/src/main/java/org/onap/vid/controller/open/RoleGeneratorController.java index 107142d7f..7b57df2c7 100644 --- a/vid-app-common/src/main/java/org/onap/vid/controller/RoleGeneratorController.java +++ b/vid-app-common/src/main/java/org/onap/vid/controller/open/RoleGeneratorController.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.vid.controller; +package org.onap.vid.controller.open; import static org.springframework.http.HttpStatus.OK; diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/VersionController.java b/vid-app-common/src/main/java/org/onap/vid/controller/open/VersionController.java index aa15f0fa3..0a4d6f5ac 100644 --- a/vid-app-common/src/main/java/org/onap/vid/controller/VersionController.java +++ b/vid-app-common/src/main/java/org/onap/vid/controller/open/VersionController.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.vid.controller; +package org.onap.vid.controller.open; import com.fasterxml.jackson.core.type.TypeReference; |