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.Task;
31 import org.onap.portalsdk.core.controller.RestrictedBaseController;
32 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
33 import org.springframework.beans.factory.annotation.Autowired;
34 import org.springframework.http.HttpStatus;
35 import org.springframework.http.ResponseEntity;
36 import org.springframework.web.bind.annotation.*;
38 import javax.servlet.http.HttpServletRequest;
39 import javax.servlet.http.HttpServletResponse;
40 import java.io.IOException;
41 import java.io.PrintWriter;
42 import java.io.StringWriter;
43 import java.text.DateFormat;
44 import java.text.SimpleDateFormat;
45 import java.util.Date;
46 import java.util.LinkedHashMap;
47 import java.util.List;
49 //import java.util.UUID;
50 //import org.springframework.http.ResponseEntity;
51 //import org.springframework.http.RequestEntity;
54 * The Class MsoController.
57 @RequestMapping("mso")
58 public class MsoController extends RestrictedBaseController {
63 private static final EELFLoggerDelegate LOGGER = EELFLoggerDelegate.getLogger(MsoController.class);
66 * The Constant dateFormat.
68 final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
71 * The Constant SVC_INSTANCE_ID.
73 public final static String SVC_INSTANCE_ID = "<service_instance_id>";
74 public final static String REQUEST_TYPE = "<request_type>";
77 * The Constant CONFIGURATION_ID
79 public final static String CONFIGURATION_ID = "<configuration_id>";
82 * The Constant VNF_INSTANCE_ID.
84 public final static String VNF_INSTANCE_ID = "<vnf_instance_id>";
86 private final MsoBusinessLogic msoBusinessLogic;
89 public MsoController(MsoBusinessLogic msoBusinessLogic) {
90 this.msoBusinessLogic = msoBusinessLogic;
94 * Creates the svc instance.
96 * @param request the request
97 * @return the response entity
98 * @throws Exception the exception
100 @RequestMapping(value = "/mso_create_svc_instance", method = RequestMethod.POST)
101 public ResponseEntity<String> createSvcInstance(HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
102 String methodName = "createSvcInstance";
104 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
106 // always return OK, the MSO status code is embedded in the body
108 MsoResponseWrapper w = msoBusinessLogic.createSvcInstance(mso_request);
110 return (new ResponseEntity<>(w.getResponse(), HttpStatus.OK));
115 * Creates the e2e svc instance.
117 * @param request the request
118 * @return the response entity
119 * @throws Exception the exception
121 @RequestMapping(value = "/mso_create_e2e_svc_instance", method = RequestMethod.POST)
122 public ResponseEntity<String> createE2eSvcInstance(HttpServletRequest request, @RequestBody LinkedHashMap<String, Object> mso_request) throws Exception {
123 String methodName = "createE2eSvcInstance";
125 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
127 // always return OK, the MSO status code is embedded in the body
129 MsoResponseWrapper w = msoBusinessLogic.createE2eSvcInstance(mso_request.get("requestDetails"));
131 return (new ResponseEntity<>(w.getResponse(), HttpStatus.OK));
138 * @param serviceInstanceId the service instance id
139 * @param request the request
140 * @return the response entity
141 * @throws Exception the exception
143 @RequestMapping(value = "/mso_create_vnf_instance/{serviceInstanceId}", method = RequestMethod.POST)
144 public ResponseEntity<String> createVnf(@PathVariable("serviceInstanceId") String serviceInstanceId, HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
146 MsoResponseWrapper w = msoBusinessLogic.createVnf(mso_request, serviceInstanceId);
148 // always return OK, the MSO status code is embedded in the body
150 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
155 * Creates the nw instance.
157 * @param serviceInstanceId the service instance id
158 * @param request the request
159 * @return the response entity
160 * @throws Exception the exception
162 @RequestMapping(value = "/mso_create_nw_instance/{serviceInstanceId}", method = RequestMethod.POST)
163 public ResponseEntity<String> createNwInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
164 String methodName = "createNwInstance";
165 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start, serviceInstanceId = " + serviceInstanceId);
167 MsoResponseWrapper w = msoBusinessLogic.createNwInstance(mso_request, serviceInstanceId);
169 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
174 * Creates the volume group instance.
176 * @param serviceInstanceId the service instance id
177 * @param vnfInstanceId the vnf instance id
178 * @param request the request
179 * @return the response entity
180 * @throws Exception the exception
182 @RequestMapping(value = "/mso_create_volumegroup_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
183 public ResponseEntity<String> createVolumeGroupInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId,
184 HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
185 String methodName = "createVolumeGroupInstance";
186 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
188 MsoResponseWrapper w = msoBusinessLogic.createVolumeGroupInstance(mso_request, serviceInstanceId, vnfInstanceId);
190 // always return OK, the MSO status code is embedded in the body
191 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
195 * Creates the vf module instance.
197 * @param serviceInstanceId the service instance id
198 * @param vnfInstanceId the vnf instance id
199 * @param request the request
200 * @return the response entity
201 * @throws Exception the exception
203 @RequestMapping(value = "/mso_create_vfmodule_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
204 public ResponseEntity<String> createVfModuleInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
205 @PathVariable("vnfInstanceId") String vnfInstanceId, HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
206 String methodName = "createVfModuleInstance";
208 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
210 MsoResponseWrapper w = msoBusinessLogic.createVfModuleInstance(mso_request, serviceInstanceId, vnfInstanceId);
212 // always return OK, the MSO status code is embedded in the body
214 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
218 * Creates a configuration instance.
220 * @param serviceInstanceId the service instance id
221 * @param request the request
222 * @return the response entity
223 * @throws Exception the exception
225 @RequestMapping(value = "/mso_create_configuration_instance/{serviceInstanceId}/configurations/", method = RequestMethod.POST)
226 public ResponseEntity<String> createConfigurationInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
227 HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
228 String methodName = "createConfigurationInstance";
229 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
231 MsoResponseWrapper w = msoBusinessLogic.createConfigurationInstance(mso_request, serviceInstanceId);
233 // always return OK, the MSO status code is embedded in the body
235 return (new ResponseEntity<>(w.getResponse(), HttpStatus.OK));
239 * Delete svc instance.
241 * @param serviceInstanceId the service instance id
242 * @param request the request
243 * @return the response entity
244 * @throws Exception the exception
246 @RequestMapping(value = "/mso_delete_svc_instance/{serviceInstanceId}", method = RequestMethod.POST)
247 public ResponseEntity<String> deleteSvcInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
248 HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
250 String methodName = "deleteSvcInstance";
251 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
253 MsoResponseWrapper w = msoBusinessLogic.deleteSvcInstance(mso_request, serviceInstanceId);
255 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());
256 // always return OK, the MSO status code is embedded in the body
258 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
265 * @param serviceInstanceId the service instance id
266 * @param vnfInstanceId the vnf instance id
267 * @param request the request
268 * @return the response entity
269 * @throws Exception the exception
271 @RequestMapping(value = "/mso_delete_vnf_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
273 public ResponseEntity<String> deleteVnf(@PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId,
274 HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
275 String methodName = "deleteVnf";
277 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
279 MsoResponseWrapper w = msoBusinessLogic.deleteVnf(mso_request, serviceInstanceId, vnfInstanceId);
281 // always return OK, the MSO status code is embedded in the body
282 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
287 * Delete configuration instance
288 * @param serviceInstanceId the service instance id
289 * @param configurationId the configuration id
290 * @param mso_request the request
291 * @return the response entity
292 * @throws Exception the exception
294 @RequestMapping(value = "mso_delete_configuration/{serviceInstanceId}/configurations/{configurationId}",
295 method = RequestMethod.POST)
296 public ResponseEntity<String> deleteConfiguration(
297 @PathVariable("serviceInstanceId") String serviceInstanceId,
298 @PathVariable ("configurationId") String configurationId,
299 @RequestBody RequestDetails mso_request) throws Exception {
301 String methodName = "deleteConfiguration";
302 LOGGER.debug(EELFLoggerDelegate.debugLogger,
303 dateFormat.format(new Date()) + "<== " + methodName + " start");
305 MsoResponseWrapper w = msoBusinessLogic.deleteConfiguration(mso_request, serviceInstanceId, configurationId);
307 // always return OK, the MSO status code is embedded in the body
308 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
312 * Activate configuration instance
313 * @param serviceInstanceId the service instace 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_activate_configuration/{serviceInstanceId}/configurations/{configurationId}",
320 method = RequestMethod.POST)
321 public ResponseEntity<String> activateConfiguration(
322 @PathVariable("serviceInstanceId") String serviceInstanceId,
323 @PathVariable("configurationId") String configurationId,
324 @RequestBody RequestDetails mso_request) throws Exception {
326 MsoResponseWrapper w = msoBusinessLogic.setConfigurationActiveStatus(mso_request, serviceInstanceId, configurationId, true);
328 // always return OK, the MSO status code is embedded in the body
329 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
333 * Deactivate configuration instance
334 * @param serviceInstanceId the service instace id
335 * @param configurationId the configuration id
336 * @param mso_request the request
337 * @return the response entity
338 * @throws Exception the exception
340 @RequestMapping(value = "mso_deactivate_configuration/{serviceInstanceId}/configurations/{configurationId}",
341 method = RequestMethod.POST)
342 public ResponseEntity<String> deactivateConfiguration(
343 @PathVariable("serviceInstanceId") String serviceInstanceId,
344 @PathVariable("configurationId") String configurationId,
345 @RequestBody RequestDetails mso_request) throws Exception {
347 MsoResponseWrapper w = msoBusinessLogic.setConfigurationActiveStatus(mso_request, serviceInstanceId, configurationId, false);
349 // always return OK, the MSO status code is embedded in the body
350 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
354 * Disable port on configuration instance
355 * @param serviceInstanceId the service instance id
356 * @param configurationId the configuration instance id
357 * @param mso_request the request
358 * @return the response entity
359 * @throws Exception the exception
361 @RequestMapping(value = "mso_disable_port_configuration/{serviceInstanceId}/configurations/{configurationId}",
362 method = RequestMethod.POST)
363 public ResponseEntity<String> disablePortOnConfiguration(
364 @PathVariable("serviceInstanceId") String serviceInstanceId,
365 @PathVariable("configurationId") String configurationId,
366 @RequestBody RequestDetails mso_request) throws Exception {
368 MsoResponseWrapper w = msoBusinessLogic.setPortOnConfigurationStatus(mso_request, serviceInstanceId, configurationId, false);
370 // always return OK, the MSO status code is embedded in the body
371 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
375 * Enable port on configuration instance
376 * @param serviceInstanceId the service instance id
377 * @param configurationId the configuration instance id
378 * @param mso_request the request
379 * @return the response entity
380 * @throws Exception the exception
382 @RequestMapping(value = "mso_enable_port_configuration/{serviceInstanceId}/configurations/{configurationId}",
383 method = RequestMethod.POST)
384 public ResponseEntity<String> enablePortOnConfiguration(
385 @PathVariable("serviceInstanceId") String serviceInstanceId,
386 @PathVariable("configurationId") String configurationId,
387 @RequestBody RequestDetails mso_request) throws Exception {
389 MsoResponseWrapper w = msoBusinessLogic.setPortOnConfigurationStatus(mso_request, serviceInstanceId, configurationId, true);
391 // always return OK, the MSO status code is embedded in the body
392 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
398 * @param serviceInstanceId the service instance id
399 * @param vnfInstanceId the vnf instance id
400 * @param vfModuleId the vf module id
401 * @param request the request
402 * @return the response entity
403 * @throws Exception the exception
405 //mso_delete_vf_module/bc305d54-75b4-431b-adb2-eb6b9e546014/vnfs/fe9000-0009-9999/vfmodules/abeeee-abeeee-abeeee
406 @RequestMapping(value = "/mso_delete_vfmodule_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfModuleId}", method = RequestMethod.POST)
407 public ResponseEntity<String> deleteVfModule(
408 @PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId,
409 @PathVariable("vfModuleId") String vfModuleId, HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
411 String methodName = "deleteVfModule";
412 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
414 MsoResponseWrapper w = msoBusinessLogic.deleteVfModule(mso_request, serviceInstanceId, vnfInstanceId, vfModuleId);
416 // always return OK, the MSO status code is embedded in the body
417 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
422 * Delete volume group instance.
424 * @param serviceInstanceId the service instance id
425 * @param vnfInstanceId the vnf instance id
426 * @param volumeGroupId the volume group id
427 * @param request the request
428 * @return the response entity
429 * @throws Exception the exception
431 @RequestMapping(value = "/mso_delete_volumegroup_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupId}", method = RequestMethod.POST)
432 public ResponseEntity<String> deleteVolumeGroupInstance(
433 @PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId, @PathVariable("volumeGroupId") String volumeGroupId,
434 HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
435 String methodName = "deleteVolumeGroupInstance";
436 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
438 MsoResponseWrapper w = msoBusinessLogic.deleteVolumeGroupInstance(mso_request, serviceInstanceId, vnfInstanceId, volumeGroupId);
440 // always return OK, the MSO status code is embedded in the body
441 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
445 * Delete nw instance.
447 * @param serviceInstanceId the service instance id
448 * @param networkInstanceId the network instance id
449 * @param request the request
450 * @return the response entity
451 * @throws Exception the exception
453 @RequestMapping(value = "/mso_delete_nw_instance/{serviceInstanceId}/networks/{networkInstanceId}", method = RequestMethod.POST)
454 public ResponseEntity<String> deleteNwInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
455 @PathVariable("networkInstanceId") String networkInstanceId, HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
456 String methodName = "deleteNwInstance";
457 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
459 MsoResponseWrapper w = msoBusinessLogic.deleteNwInstance(mso_request, serviceInstanceId, networkInstanceId);
461 // always return OK, the MSO status code is embedded in the body
462 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
467 * Gets the orchestration request.
469 * @param requestId the request id
470 * @param request the request
471 * @return the orchestration request
472 * @throws Exception the exception
474 @RequestMapping(value = "/mso_get_orch_req/{requestId}", method = RequestMethod.GET)
475 public ResponseEntity<String> getOrchestrationRequest(@PathVariable("requestId") String requestId,
476 HttpServletRequest request) throws Exception {
478 String methodName = "getOrchestrationRequest";
479 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
482 MsoResponseWrapper w = msoBusinessLogic.getOrchestrationRequest(requestId);
484 // always return OK, the MSO status code is embedded in the body
485 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
490 * Gets the orchestration requests.
492 * @param filterString the filter string
493 * @param request the request
494 * @return the orchestration requests
495 * @throws Exception the exception
497 @RequestMapping(value = "/mso_get_orch_reqs/{filterString}", method = RequestMethod.GET)
498 public ResponseEntity<String> getOrchestrationRequests(@PathVariable("filterString") String filterString,
499 HttpServletRequest request) throws Exception {
501 String methodName = "getOrchestrationRequests";
502 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
505 MsoResponseWrapper w = msoBusinessLogic.getOrchestrationRequests(filterString);
507 // always return OK, the MSO status code is embedded in the body
508 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
513 * activate to a pnf instance.
515 * @param serviceInstanceId the id of the service.
516 * @param requestDetails the body of the request.
517 * @return the response entity
518 * @throws Exception the exception
520 @RequestMapping(value = "/mso_activate_service_instance/{serviceInstanceId}", method = RequestMethod.POST)
521 public ResponseEntity<String> activateServiceInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, @RequestBody RequestDetails requestDetails) throws Exception {
522 String methodName = "activateServiceInstance";
523 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
525 MsoResponseWrapper w = msoBusinessLogic.setServiceInstanceStatus(requestDetails, serviceInstanceId, true);
526 return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
530 * deactivate a service instance.
532 * @param serviceInstanceId the id of the service.
533 * @param requestDetails the body of the request.
534 * @return the response entity
535 * @throws Exception the exception
537 @RequestMapping(value = "/mso_deactivate_service_instance/{serviceInstanceId}", method = RequestMethod.POST)
538 public ResponseEntity<String> deactivateServiceInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, @RequestBody RequestDetails requestDetails) throws Exception {
539 String methodName = "deactivateServiceInstance";
540 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
542 MsoResponseWrapper w = msoBusinessLogic.setServiceInstanceStatus(requestDetails, serviceInstanceId, false);
543 return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
548 * Gets the orchestration requests for the dashboard.
549 * currently its all the orchestration requests with RequestType updateInstance or replaceInstance.
550 * @return the orchestration requests
551 * @throws Exception the exception
553 @RequestMapping(value = "/mso_get_orch_reqs/dashboard", method = RequestMethod.GET)
554 public List<Request> getOrchestrationRequestsForDashboard() throws Exception {
556 String methodName = "getOrchestrationRequestsForDashboard";
557 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
560 return msoBusinessLogic.getOrchestrationRequestsForDashboard();
564 * Gets the Manual Tasks for the given request id.
566 * @param originalRequestId the id of the original request.
568 * @throws Exception the exception
570 @RequestMapping(value = "/mso_get_man_task/{originalRequestId}", method = RequestMethod.GET)
571 public List<Task> getManualTasksByRequestId(@PathVariable("originalRequestId") String originalRequestId) throws Exception {
573 String methodName = "getManualTasksByRequestId";
574 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
576 return msoBusinessLogic.getManualTasksByRequestId(originalRequestId);
582 * Complete the manual task.
584 * @param taskId the id of the task to complete.
585 * @param requestDetails the body of the request.
586 * @return the response entity
587 * @throws Exception the exception
589 @RequestMapping(value = "/mso_post_man_task/{taskId}", method = RequestMethod.POST)
590 public ResponseEntity<String> manualTaskComplete(@PathVariable("taskId") String taskId , @RequestBody RequestDetails requestDetails) throws Exception {
592 String methodName = "manualTaskComplete";
593 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
595 MsoResponseWrapper w = msoBusinessLogic.completeManualTask(requestDetails, taskId);
596 return new ResponseEntity<String>(w.getResponse(), HttpStatus.OK);
599 @RequestMapping(value = "/mso_remove_relationship/{serviceInstanceId}", method = RequestMethod.POST)
600 public ResponseEntity<String> removeRelationshipFromServiceInstance(@PathVariable("serviceInstanceId") String serviceInstanceId ,
601 @RequestBody RequestDetails requestDetails) throws Exception {
603 String methodName = "removeRelationshipFromServiceInstance";
604 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
606 MsoResponseWrapper w;
608 w = msoBusinessLogic.removeRelationshipFromServiceInstance(requestDetails, serviceInstanceId);
609 } catch (Exception e){
610 LOGGER.error("Internal error when calling MSO controller logic for {}", methodName, e);
611 return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
613 return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
616 @RequestMapping(value = "/mso_add_relationship/{serviceInstanceId}", method = RequestMethod.POST)
617 public ResponseEntity<String> addRelationshipToServiceInstance(@PathVariable("serviceInstanceId") String serviceInstanceId ,
618 @RequestBody RequestDetails requestDetails) throws Exception {
620 String methodName = "addRelationshipToServiceInstance";
621 LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
623 MsoResponseWrapper w;
625 w = msoBusinessLogic.addRelationshipToServiceInstance(requestDetails, serviceInstanceId);
626 } catch (Exception e){
627 LOGGER.error("Internal error when calling MSO controller logic for {}", methodName, e);
628 return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
630 return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
638 * @param response the response
639 * @throws IOException Signals that an I/O exception has occurred.
641 @ExceptionHandler(Exception.class)
642 private void exceptionHandler(Exception e, HttpServletResponse response) throws IOException {
645 * The following "logger.error" lines "should" be sufficient for logging the exception.
646 * However, the console output in my Eclipse environment is NOT showing ANY of the
647 * logger statements in this class. Thus the temporary "e.printStackTrace" statement
651 String methodName = "exceptionHandler";
652 LOGGER.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
653 StringWriter sw = new StringWriter();
654 e.printStackTrace(new PrintWriter(sw));
655 LOGGER.error(EELFLoggerDelegate.errorLogger, sw.toString());
658 * Temporary - IF the above mentioned "logger.error" glitch is resolved ...
659 * this statement could be removed since it would then likely result in duplicate
662 e.printStackTrace(System.err);
664 response.setContentType("application/json; charset=UTF-8");
665 response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
667 ExceptionResponse exceptionResponse = new ExceptionResponse();
668 exceptionResponse.setException(e.getClass().toString().replaceFirst("^.*\\.", ""));
669 exceptionResponse.setMessage(e.getMessage());
671 response.getWriter().write(new ObjectMapper().writeValueAsString(exceptionResponse));
673 response.flushBuffer();