2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.vid.controllers;
24 import com.fasterxml.jackson.databind.ObjectMapper;
25 import org.onap.vid.model.ExceptionResponse;
26 import org.onap.vid.mso.MsoBusinessLogic;
27 import org.onap.vid.mso.MsoResponseWrapper;
28 import org.onap.vid.mso.rest.Request;
29 import org.onap.vid.mso.rest.RequestDetails;
30 import org.onap.vid.mso.rest.RequestDetailsWrapper;
31 import org.onap.vid.mso.rest.Task;
32 import org.onap.portalsdk.core.controller.RestrictedBaseController;
33 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
34 import org.springframework.beans.factory.annotation.Autowired;
35 import org.springframework.http.HttpStatus;
36 import org.springframework.http.ResponseEntity;
37 import org.springframework.web.bind.annotation.*;
39 import javax.servlet.http.HttpServletRequest;
40 import javax.servlet.http.HttpServletResponse;
41 import java.io.IOException;
42 import java.io.PrintWriter;
43 import java.io.StringWriter;
44 import java.text.DateFormat;
45 import java.text.SimpleDateFormat;
46 import java.util.Date;
47 import java.util.LinkedHashMap;
48 import java.util.List;
50 import static org.onap.vid.utils.Logging.getMethodName;
52 //import java.util.UUID;
53 //import org.springframework.http.ResponseEntity;
54 //import org.springframework.http.RequestEntity;
57 * The Class MsoController.
60 @RequestMapping("mso")
61 public class MsoController extends RestrictedBaseController {
66 private static final EELFLoggerDelegate LOGGER = EELFLoggerDelegate.getLogger(MsoController.class);
69 * The Constant dateFormat.
71 private final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
74 * The Constant SVC_INSTANCE_ID.
76 public final static String SVC_INSTANCE_ID = "<service_instance_id>";
77 public final static String REQUEST_TYPE = "<request_type>";
80 * The Constant CONFIGURATION_ID
82 public final static String CONFIGURATION_ID = "<configuration_id>";
85 * The Constant VNF_INSTANCE_ID.
87 public final static String VNF_INSTANCE_ID = "<vnf_instance_id>";
89 private final MsoBusinessLogic msoBusinessLogic;
92 public MsoController(MsoBusinessLogic msoBusinessLogic) {
93 this.msoBusinessLogic = msoBusinessLogic;
97 * Creates the svc instance.
99 * @param request the request
100 * @return the response entity
101 * @throws Exception the exception
103 @RequestMapping(value = "/mso_create_svc_instance", method = RequestMethod.POST)
104 public ResponseEntity<String> createSvcInstance(HttpServletRequest request, @RequestBody RequestDetails mso_request) {
105 String methodName = "createSvcInstance";
107 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
109 // always return OK, the MSO status code is embedded in the body
111 MsoResponseWrapper w = msoBusinessLogic.createSvcInstance(mso_request);
113 return (new ResponseEntity<>(w.getResponse(), HttpStatus.OK));
118 * Creates the e2e svc instance.
120 * @param request the request
121 * @return the response entity
122 * @throws Exception the exception
124 @RequestMapping(value = "/mso_create_e2e_svc_instance", method = RequestMethod.POST)
125 public ResponseEntity<String> createE2eSvcInstance(HttpServletRequest request, @RequestBody LinkedHashMap<String, Object> mso_request) {
126 String methodName = "createE2eSvcInstance";
128 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
130 // always return OK, the MSO status code is embedded in the body
132 MsoResponseWrapper w = msoBusinessLogic.createE2eSvcInstance(mso_request.get("requestDetails"));
134 return (new ResponseEntity<>(w.getResponse(), HttpStatus.OK));
141 * @param serviceInstanceId the service instance id
142 * @param request the request
143 * @return the response entity
144 * @throws Exception the exception
146 @RequestMapping(value = "/mso_create_vnf_instance/{serviceInstanceId}", method = RequestMethod.POST)
147 public ResponseEntity<String> createVnf(@PathVariable("serviceInstanceId") String serviceInstanceId, HttpServletRequest request, @RequestBody RequestDetails mso_request) {
149 MsoResponseWrapper w = msoBusinessLogic.createVnf(mso_request, serviceInstanceId);
151 // always return OK, the MSO status code is embedded in the body
153 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
158 * Creates the nw instance.
160 * @param serviceInstanceId the service instance id
161 * @param request the request
162 * @return the response entity
163 * @throws Exception the exception
165 @RequestMapping(value = "/mso_create_nw_instance/{serviceInstanceId}", method = RequestMethod.POST)
166 public ResponseEntity<String> createNwInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, HttpServletRequest request, @RequestBody RequestDetails mso_request) {
167 String methodName = "createNwInstance";
168 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start, serviceInstanceId = " + serviceInstanceId);
170 MsoResponseWrapper w = msoBusinessLogic.createNwInstance(mso_request, serviceInstanceId);
172 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
177 * Creates the volume group instance.
179 * @param serviceInstanceId the service instance id
180 * @param vnfInstanceId the vnf instance id
181 * @param request the request
182 * @return the response entity
183 * @throws Exception the exception
185 @RequestMapping(value = "/mso_create_volumegroup_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
186 public ResponseEntity<String> createVolumeGroupInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId,
187 HttpServletRequest request, @RequestBody RequestDetails mso_request) {
188 String methodName = "createVolumeGroupInstance";
189 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
191 MsoResponseWrapper w = msoBusinessLogic.createVolumeGroupInstance(mso_request, serviceInstanceId, vnfInstanceId);
193 // always return OK, the MSO status code is embedded in the body
194 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
198 * Creates the vf module instance.
200 * @param serviceInstanceId the service instance id
201 * @param vnfInstanceId the vnf instance id
202 * @param request the request
203 * @return the response entity
204 * @throws Exception the exception
206 @RequestMapping(value = "/mso_create_vfmodule_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
207 public ResponseEntity<String> createVfModuleInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
208 @PathVariable("vnfInstanceId") String vnfInstanceId, HttpServletRequest request, @RequestBody RequestDetails mso_request) {
209 String methodName = "createVfModuleInstance";
211 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
213 MsoResponseWrapper w = msoBusinessLogic.createVfModuleInstance(mso_request, serviceInstanceId, vnfInstanceId);
215 // always return OK, the MSO status code is embedded in the body
217 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
221 * Creates a configuration instance.
223 * @param serviceInstanceId the service instance id
224 * @param request the request
225 * @return the response entity
226 * @throws Exception the exception
228 @RequestMapping(value = "/mso_create_configuration_instance/{serviceInstanceId}/configurations/", method = RequestMethod.POST)
229 public ResponseEntity<String> createConfigurationInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
230 HttpServletRequest request, @RequestBody RequestDetailsWrapper mso_request) {
231 String methodName = "createConfigurationInstance";
232 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
234 MsoResponseWrapper w = msoBusinessLogic.createConfigurationInstance(mso_request, serviceInstanceId);
236 // always return OK, the MSO status code is embedded in the body
238 return (new ResponseEntity<>(w.getResponse(), HttpStatus.OK));
242 * Delete E2e svc instance.
244 * @param serviceInstanceId the service instance id
245 * @param request the request
246 * @return the response entity
247 * @throws Exception the exception
249 @RequestMapping(value = "/mso_delete_e2e_svc_instance/{serviceInstanceId}", method = RequestMethod.POST)
250 public ResponseEntity<String> deleteE2eSvcInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
251 HttpServletRequest request, @RequestBody LinkedHashMap<String, Object> mso_request) {
253 String methodName = "deleteE2eSvcInstance";
254 LOGGER.debug(EELFLoggerDelegate.debugLogger, "start {}({})", getMethodName(), mso_request);
256 MsoResponseWrapper w = msoBusinessLogic.deleteE2eSvcInstance(mso_request.get("requestDetails"), serviceInstanceId);
258 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());
259 // always return OK, the MSO status code is embedded in the body
261 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
266 * Delete svc instance.
268 * @param serviceInstanceId the service instance id
269 * @param request the request
270 * @return the response entity
271 * @throws Exception the exception
274 @RequestMapping(value = "/mso_delete_svc_instance/{serviceInstanceId}", method = RequestMethod.POST)
275 public String deleteSvcInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
276 HttpServletRequest request, @RequestBody RequestDetails mso_request,
277 @RequestParam(value = "serviceStatus") String serviceStatus) {
279 String methodName = "deleteSvcInstance";
280 LOGGER.debug(EELFLoggerDelegate.debugLogger, "start {}({})", getMethodName(), mso_request);
281 MsoResponseWrapper w = msoBusinessLogic.deleteSvcInstance(mso_request, serviceInstanceId, serviceStatus);
282 // always return OK, the MSO status code is embedded in the body
284 return w.getResponse();
290 * @param serviceInstanceId the service instance id
291 * @param vnfInstanceId the vnf instance id
292 * @param request the request
293 * @return the response entity
294 * @throws Exception the exception
296 @RequestMapping(value = "/mso_delete_vnf_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
298 public ResponseEntity<String> deleteVnf(@PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId,
299 HttpServletRequest request, @RequestBody RequestDetails mso_request) {
300 String methodName = "deleteVnf";
302 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
304 MsoResponseWrapper w = msoBusinessLogic.deleteVnf(mso_request, serviceInstanceId, vnfInstanceId);
306 // always return OK, the MSO status code is embedded in the body
307 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
312 * Delete configuration instance
313 * @param serviceInstanceId the service instance id
314 * @param configurationId the configuration id
315 * @param mso_request the request
316 * @return the response entity
317 * @throws Exception the exception
319 @RequestMapping(value = "mso_delete_configuration/{serviceInstanceId}/configurations/{configurationId}",
320 method = RequestMethod.POST)
321 public ResponseEntity<String> deleteConfiguration(
322 @PathVariable("serviceInstanceId") String serviceInstanceId,
323 @PathVariable ("configurationId") String configurationId,
324 @RequestBody RequestDetailsWrapper mso_request) {
326 String methodName = "deleteConfiguration";
327 LOGGER.debug(EELFLoggerDelegate.debugLogger,
328 dateFormat.format(new Date()) + "<== " + methodName + " start");
330 MsoResponseWrapper w = msoBusinessLogic.deleteConfiguration(mso_request, serviceInstanceId, configurationId);
332 // always return OK, the MSO status code is embedded in the body
333 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
337 * Activate configuration instance
338 * @param serviceInstanceId the service instace id
339 * @param configurationId the configuration id
340 * @param mso_request the request
341 * @return the response entity
342 * @throws Exception the exception
344 @RequestMapping(value = "mso_activate_configuration/{serviceInstanceId}/configurations/{configurationId}",
345 method = RequestMethod.POST)
346 public ResponseEntity<String> activateConfiguration(
347 @PathVariable("serviceInstanceId") String serviceInstanceId,
348 @PathVariable("configurationId") String configurationId,
349 @RequestBody RequestDetails mso_request) {
351 MsoResponseWrapper w = msoBusinessLogic.setConfigurationActiveStatus(mso_request, serviceInstanceId, configurationId, true);
353 // always return OK, the MSO status code is embedded in the body
354 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
358 * Deactivate configuration instance
359 * @param serviceInstanceId the service instace id
360 * @param configurationId the configuration id
361 * @param mso_request the request
362 * @return the response entity
363 * @throws Exception the exception
365 @RequestMapping(value = "mso_deactivate_configuration/{serviceInstanceId}/configurations/{configurationId}",
366 method = RequestMethod.POST)
367 public ResponseEntity<String> deactivateConfiguration(
368 @PathVariable("serviceInstanceId") String serviceInstanceId,
369 @PathVariable("configurationId") String configurationId,
370 @RequestBody RequestDetails mso_request) {
372 MsoResponseWrapper w = msoBusinessLogic.setConfigurationActiveStatus(mso_request, serviceInstanceId, configurationId, false);
374 // always return OK, the MSO status code is embedded in the body
375 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
379 * Disable port on configuration instance
380 * @param serviceInstanceId the service instance id
381 * @param configurationId the configuration instance id
382 * @param mso_request the request
383 * @return the response entity
384 * @throws Exception the exception
386 @RequestMapping(value = "mso_disable_port_configuration/{serviceInstanceId}/configurations/{configurationId}",
387 method = RequestMethod.POST)
388 public ResponseEntity<String> disablePortOnConfiguration(
389 @PathVariable("serviceInstanceId") String serviceInstanceId,
390 @PathVariable("configurationId") String configurationId,
391 @RequestBody RequestDetails mso_request) {
393 MsoResponseWrapper w = msoBusinessLogic.setPortOnConfigurationStatus(mso_request, serviceInstanceId, configurationId, false);
395 // always return OK, the MSO status code is embedded in the body
396 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
400 * Enable port on configuration instance
401 * @param serviceInstanceId the service instance id
402 * @param configurationId the configuration instance id
403 * @param mso_request the request
404 * @return the response entity
405 * @throws Exception the exception
407 @RequestMapping(value = "mso_enable_port_configuration/{serviceInstanceId}/configurations/{configurationId}",
408 method = RequestMethod.POST)
409 public ResponseEntity<String> enablePortOnConfiguration(
410 @PathVariable("serviceInstanceId") String serviceInstanceId,
411 @PathVariable("configurationId") String configurationId,
412 @RequestBody RequestDetails mso_request) {
414 MsoResponseWrapper w = msoBusinessLogic.setPortOnConfigurationStatus(mso_request, serviceInstanceId, configurationId, true);
416 // always return OK, the MSO status code is embedded in the body
417 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
423 * @param serviceInstanceId the service instance id
424 * @param vnfInstanceId the vnf instance id
425 * @param vfModuleId the vf module id
426 * @param request the request
427 * @return the response entity
428 * @throws Exception the exception
430 //mso_delete_vf_module/bc305d54-75b4-431b-adb2-eb6b9e546014/vnfs/fe9000-0009-9999/vfmodules/abeeee-abeeee-abeeee
431 @RequestMapping(value = "/mso_delete_vfmodule_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfModuleId}", method = RequestMethod.POST)
432 public ResponseEntity<String> deleteVfModule(
433 @PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId,
434 @PathVariable("vfModuleId") String vfModuleId, HttpServletRequest request, @RequestBody RequestDetails mso_request) {
436 String methodName = "deleteVfModule";
437 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
439 MsoResponseWrapper w = msoBusinessLogic.deleteVfModule(mso_request, serviceInstanceId, vnfInstanceId, vfModuleId);
441 // always return OK, the MSO status code is embedded in the body
442 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
446 * Delete volume group instance.
448 * @param serviceInstanceId the service instance id
449 * @param vnfInstanceId the vnf instance id
450 * @param volumeGroupId the volume group id
451 * @param request the request
452 * @return the response entity
453 * @throws Exception the exception
455 @RequestMapping(value = "/mso_delete_volumegroup_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupId}", method = RequestMethod.POST)
456 public ResponseEntity<String> deleteVolumeGroupInstance(
457 @PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId, @PathVariable("volumeGroupId") String volumeGroupId,
458 HttpServletRequest request, @RequestBody RequestDetails mso_request) {
459 String methodName = "deleteVolumeGroupInstance";
460 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
462 MsoResponseWrapper w = msoBusinessLogic.deleteVolumeGroupInstance(mso_request, serviceInstanceId, vnfInstanceId, volumeGroupId);
464 // always return OK, the MSO status code is embedded in the body
465 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
469 * Delete nw instance.
471 * @param serviceInstanceId the service instance id
472 * @param networkInstanceId the network instance id
473 * @param request the request
474 * @return the response entity
475 * @throws Exception the exception
477 @RequestMapping(value = "/mso_delete_nw_instance/{serviceInstanceId}/networks/{networkInstanceId}", method = RequestMethod.POST)
478 public ResponseEntity<String> deleteNwInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
479 @PathVariable("networkInstanceId") String networkInstanceId, HttpServletRequest request, @RequestBody RequestDetails mso_request) {
480 String methodName = "deleteNwInstance";
481 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
483 MsoResponseWrapper w = msoBusinessLogic.deleteNwInstance(mso_request, serviceInstanceId, networkInstanceId);
485 // always return OK, the MSO status code is embedded in the body
486 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
490 * Gets the orchestration request.
492 * @param requestId the request id
493 * @param request the request
494 * @return the orchestration request
495 * @throws Exception the exception
497 @RequestMapping(value = "/mso_get_orch_req/{requestId}", method = RequestMethod.GET)
498 public ResponseEntity<String> getOrchestrationRequest(@PathVariable("requestId") String requestId,
499 HttpServletRequest request) {
501 String methodName = "getOrchestrationRequest";
502 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
505 MsoResponseWrapper w = msoBusinessLogic.getOrchestrationRequest(requestId);
507 // always return OK, the MSO status code is embedded in the body
508 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
512 * Gets the orchestration requests.
514 * @param filterString the filter string
515 * @param request the request
516 * @return the orchestration requests
517 * @throws Exception the exception
519 @RequestMapping(value = "/mso_get_orch_reqs/{filterString}", method = RequestMethod.GET)
520 public ResponseEntity<String> getOrchestrationRequests(@PathVariable("filterString") String filterString,
521 HttpServletRequest request) {
523 String methodName = "getOrchestrationRequests";
524 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
527 MsoResponseWrapper w = msoBusinessLogic.getOrchestrationRequests(filterString);
529 // always return OK, the MSO status code is embedded in the body
530 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
534 * activate to a pnf instance.
536 * @param serviceInstanceId the id of the service.
537 * @param requestDetails the body of the request.
538 * @return the response entity
539 * @throws Exception the exception
541 @RequestMapping(value = "/mso_activate_service_instance/{serviceInstanceId}", method = RequestMethod.POST)
542 public ResponseEntity<String> activateServiceInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, @RequestBody RequestDetails requestDetails) {
543 String methodName = "activateServiceInstance";
544 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
546 MsoResponseWrapper w = msoBusinessLogic.setServiceInstanceStatus(requestDetails, serviceInstanceId, true);
547 return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
551 * deactivate a service instance.
553 * @param serviceInstanceId the id of the service.
554 * @param requestDetails the body of the request.
555 * @return the response entity
556 * @throws Exception the exception
558 @RequestMapping(value = "/mso_deactivate_service_instance/{serviceInstanceId}", method = RequestMethod.POST)
559 public ResponseEntity<String> deactivateServiceInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, @RequestBody RequestDetails requestDetails) {
560 String methodName = "deactivateServiceInstance";
561 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
563 MsoResponseWrapper w = msoBusinessLogic.setServiceInstanceStatus(requestDetails, serviceInstanceId, false);
564 return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
568 * Gets the orchestration requests for the dashboard.
569 * currently its all the orchestration requests with RequestType updateInstance or replaceInstance.
570 * @return the orchestration requests
571 * @throws Exception the exception
573 @RequestMapping(value = "/mso_get_orch_reqs/dashboard", method = RequestMethod.GET)
574 public List<Request> getOrchestrationRequestsForDashboard() {
576 String methodName = "getOrchestrationRequestsForDashboard";
577 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
580 return msoBusinessLogic.getOrchestrationRequestsForDashboard();
584 * Gets the Manual Tasks for the given request id.
586 * @param originalRequestId the id of the original request.
588 * @throws Exception the exception
590 @RequestMapping(value = "/mso_get_man_task/{originalRequestId}", method = RequestMethod.GET)
591 public List<Task> getManualTasksByRequestId(@PathVariable("originalRequestId") String originalRequestId) {
593 String methodName = "getManualTasksByRequestId";
594 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
596 return msoBusinessLogic.getManualTasksByRequestId(originalRequestId);
600 * Complete the manual task.
602 * @param taskId the id of the task to complete.
603 * @param requestDetails the body of the request.
604 * @return the response entity
605 * @throws Exception the exception
607 @RequestMapping(value = "/mso_post_man_task/{taskId}", method = RequestMethod.POST)
608 public ResponseEntity<String> manualTaskComplete(@PathVariable("taskId") String taskId , @RequestBody RequestDetails requestDetails) {
610 String methodName = "manualTaskComplete";
611 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
613 MsoResponseWrapper w = msoBusinessLogic.completeManualTask(requestDetails, taskId);
614 return new ResponseEntity<String>(w.getResponse(), HttpStatus.OK);
617 @RequestMapping(value = "/mso_remove_relationship/{serviceInstanceId}", method = RequestMethod.POST)
618 public ResponseEntity<String> removeRelationshipFromServiceInstance(@PathVariable("serviceInstanceId") String serviceInstanceId ,
619 @RequestBody RequestDetails requestDetails) {
621 String methodName = "removeRelationshipFromServiceInstance";
622 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
624 MsoResponseWrapper w;
626 w = msoBusinessLogic.removeRelationshipFromServiceInstance(requestDetails, serviceInstanceId);
627 } catch (Exception e){
628 LOGGER.error("Internal error when calling MSO controller logic for {}", methodName, e);
629 return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
631 return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
634 @RequestMapping(value = "/mso_add_relationship/{serviceInstanceId}", method = RequestMethod.POST)
635 public ResponseEntity<String> addRelationshipToServiceInstance(@PathVariable("serviceInstanceId") String serviceInstanceId ,
636 @RequestBody RequestDetails requestDetails) {
638 String methodName = "addRelationshipToServiceInstance";
639 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
641 MsoResponseWrapper w;
643 w = msoBusinessLogic.addRelationshipToServiceInstance(requestDetails, serviceInstanceId);
644 } catch (Exception e){
645 LOGGER.error("Internal error when calling MSO controller logic for {}", methodName, e);
646 return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
648 return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
655 * @param response the response
656 * @throws IOException Signals that an I/O exception has occurred.
658 @ExceptionHandler(Exception.class)
659 private void exceptionHandler(Exception e, HttpServletResponse response) throws IOException {
662 * The following "logger.error" lines "should" be sufficient for logging the exception.
663 * However, the console output in my Eclipse environment is NOT showing ANY of the
664 * logger statements in this class. Thus the temporary "e.printStackTrace" statement
668 String methodName = "exceptionHandler";
669 LOGGER.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
670 StringWriter sw = new StringWriter();
671 e.printStackTrace(new PrintWriter(sw));
672 LOGGER.error(EELFLoggerDelegate.errorLogger, sw.toString());
675 * Temporary - IF the above mentioned "logger.error" glitch is resolved ...
676 * this statement could be removed since it would then likely result in duplicate
679 e.printStackTrace(System.err);
681 response.setContentType("application/json; charset=UTF-8");
682 response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
684 ExceptionResponse exceptionResponse = new ExceptionResponse();
685 exceptionResponse.setException(e.getClass().toString().replaceFirst("^.*\\.", ""));
686 exceptionResponse.setMessage(e.getMessage());
688 response.getWriter().write(new ObjectMapper().writeValueAsString(exceptionResponse));
690 response.flushBuffer();