import com.google.common.base.MoreObjects;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
-import org.onap.portalsdk.core.controller.RestrictedBaseController;
-import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.vid.changeManagement.RequestDetailsWrapper;
import org.onap.vid.model.ExceptionResponse;
import org.onap.vid.model.RequestReferencesContainer;
import org.onap.vid.mso.rest.MsoRestClientNew;
import org.onap.vid.mso.rest.OperationalEnvironment.OperationEnvironmentRequestDetails;
import org.onap.vid.mso.rest.RequestDetails;
+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.MissingServletRequestParameterException;
import static org.onap.vid.utils.Logging.getMethodCallerName;
import static org.onap.vid.utils.Logging.getMethodName;
-import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
@RestController
@RequestMapping("operationalEnvironment")
-public class OperationalEnvironmentController extends RestrictedBaseController {
+public class OperationalEnvironmentController extends VidRestrictedBaseController {
- private static final EELFLoggerDelegate LOGGER = EELFLoggerDelegate.getLogger(OperationalEnvironmentController.class);
private final RestMsoImplementation restMso;
private final MsoBusinessLogic msoBusinessLogic;
}
@RequestMapping(value = "/create", method = RequestMethod.POST)
- public MsoResponseWrapper2 createOperationalEnvironment(HttpServletRequest request, @RequestBody OperationalEnvironmentCreateBody operationalEnvironment) throws Exception {
- LOGGER.debug(EELFLoggerDelegate.debugLogger, "start {}({})", getMethodName(), operationalEnvironment);
+ public MsoResponseWrapper2 createOperationalEnvironment(HttpServletRequest request, @RequestBody OperationalEnvironmentCreateBody operationalEnvironment) {
+ debugStart(operationalEnvironment);
String userId = ControllersUtils.extractUserId(request);
RequestDetailsWrapper<OperationEnvironmentRequestDetails> requestDetailsWrapper = msoBusinessLogic.convertParametersToRequestDetails(operationalEnvironment, userId);
String path = msoBusinessLogic.getOperationalEnvironmentCreationPath();
@RequestMapping(value = "/activate", method = RequestMethod.POST)
public MsoResponseWrapper2 activate(HttpServletRequest request,
@RequestParam("operationalEnvironment") String operationalEnvironmentId,
- @RequestBody OperationalEnvironmentActivateBody activateRequest) throws Exception {
+ @RequestBody OperationalEnvironmentActivateBody activateRequest) throws MissingServletRequestParameterException {
verifyIsNotEmpty(operationalEnvironmentId, "operationalEnvironment");
@RequestMapping(value = "/deactivate", method = RequestMethod.POST)
public MsoResponseWrapper2 deactivate(HttpServletRequest request,
@RequestParam("operationalEnvironment") String operationalEnvironmentId,
- @RequestBody Map deactivationRequest) throws Exception {
+ @RequestBody Map deactivationRequest) throws MissingServletRequestParameterException {
verifyIsNotEmpty(operationalEnvironmentId, "operationalEnvironment");
}
@RequestMapping(value = "/requestStatus", method = RequestMethod.GET)
- public MsoResponseWrapper2 status(HttpServletRequest request, @RequestParam("requestId") String requestId) throws Exception {
+ public MsoResponseWrapper2 status(HttpServletRequest request, @RequestParam("requestId") String requestId) throws MissingServletRequestParameterException {
- LOGGER.debug(EELFLoggerDelegate.debugLogger, "start {}({})", getMethodName(), requestId);
+ debugStart(requestId);
verifyIsNotEmpty(requestId, "requestId");
String path = msoBusinessLogic.getCloudResourcesRequestsStatusPath(requestId);
return new MsoResponseWrapper2<>(msoResponse);
}
- @ExceptionHandler(Exception.class)
- @ResponseStatus(value=INTERNAL_SERVER_ERROR)
- private ExceptionResponse exceptionHandler(Exception e) {
- return ControllersUtils.handleException(e, LOGGER);
- }
-
@ExceptionHandler({
org.springframework.web.bind.MissingServletRequestParameterException.class,
BadManifestException.class