2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ============LICENSE_END=========================================================
\r
21 package org.openecomp.mso.bpmn.common.workflow.service;
\r
23 import java.util.HashMap;
\r
24 import java.util.Map;
\r
26 import javax.jws.WebMethod;
\r
27 import javax.jws.WebParam;
\r
28 import javax.jws.WebResult;
\r
29 import javax.jws.WebService;
\r
30 import javax.ws.rs.core.Context;
\r
31 import javax.xml.ws.WebServiceContext;
\r
33 import org.camunda.bpm.BpmPlatform;
\r
34 import org.camunda.bpm.engine.MismatchingMessageCorrelationException;
\r
35 import org.camunda.bpm.engine.ProcessEngineServices;
\r
36 import org.camunda.bpm.engine.RuntimeService;
\r
37 import org.camunda.bpm.engine.runtime.ExecutionQuery;
\r
38 import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterCallbackRequest;
\r
39 import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterResponse;
\r
40 import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCCallbackAdapterPortType;
\r
41 import org.openecomp.mso.bpmn.core.PropertyConfiguration;
\r
42 import org.openecomp.mso.logger.MessageEnum;
\r
43 import org.openecomp.mso.logger.MsoLogger;
\r
46 * Implementation of SDNCAdapterCallbackService.
\r
48 @WebService(serviceName="SDNCAdapterCallbackService", targetNamespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1")
\r
49 public class SDNCAdapterCallbackServiceImpl extends AbstractCallbackService implements SDNCCallbackAdapterPortType {
\r
51 private final String logMarker = "[SDNC-CALLBACK]";
\r
53 @Context WebServiceContext wsContext;
\r
55 @WebMethod(operationName = "SDNCAdapterCallback")
\r
56 @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse")
\r
57 public SDNCAdapterResponse sdncAdapterCallback(
\r
58 @WebParam(name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackRequest")
\r
59 SDNCAdapterCallbackRequest sdncAdapterCallbackRequest) {
\r
61 String method = "sdncAdapterCallback";
\r
62 Object message = sdncAdapterCallbackRequest;
\r
63 String messageEventName = "sdncAdapterCallbackRequest";
\r
64 String messageVariable = "sdncAdapterCallbackRequest";
\r
65 String correlationVariable = "SDNCA_requestId";
\r
66 String correlationValue = sdncAdapterCallbackRequest.getCallbackHeader().getRequestId();
\r
68 MsoLogger.setServiceName("MSO." + method);
\r
69 MsoLogger.setLogContext(correlationValue, "N/A");
\r
71 CallbackResult result = handleCallback(method, message, messageEventName,
\r
72 messageVariable, correlationVariable, correlationValue, logMarker);
\r
74 if (result instanceof CallbackError) {
\r
75 return new SDNCAdapterErrorResponse(((CallbackError)result).getErrorMessage());
\r
77 return new SDNCAdapterResponse();
\r
81 // This subclass allows unit tests to extract the error
\r
82 public class SDNCAdapterErrorResponse extends SDNCAdapterResponse {
\r
83 private String error;
\r
85 public SDNCAdapterErrorResponse(String error) {
\r
89 public String getError() {
\r