2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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.so.bpmn.infrastructure.scripts
23 import org.json.JSONObject
26 import static org.apache.commons.lang3.StringUtils.*
27 import groovy.xml.XmlUtil
29 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
30 import org.onap.so.bpmn.common.scripts.ExceptionUtil
31 import org.onap.so.bpmn.common.scripts.ExternalAPIUtil
32 import org.onap.so.bpmn.common.scripts.AaiUtil
33 import org.onap.so.bpmn.common.scripts.MsoUtils
34 import org.onap.so.bpmn.common.recipe.ResourceInput
35 import org.onap.so.bpmn.common.resource.ResourceRequestBuilder
36 import org.onap.so.bpmn.core.WorkflowException
37 import org.onap.so.bpmn.core.json.JsonUtils
38 import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder
39 import org.onap.so.rest.APIResponse
40 import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
41 import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory
44 import org.camunda.bpm.engine.runtime.Execution
45 import org.camunda.bpm.engine.delegate.BpmnError
46 import org.camunda.bpm.engine.delegate.DelegateExecution
47 import org.apache.commons.lang3.*
48 import org.apache.commons.codec.binary.Base64
49 import org.springframework.web.util.UriUtils
50 import org.onap.so.rest.RESTClient
51 import org.onap.so.rest.RESTConfig
54 * This groovy class supports the <class>Delete3rdONAPE2EServiceInstance.bpmn</class> process.
55 * flow for Delete E2EServiceInstance in 3rdONAP
57 public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcessor {
59 String Prefix = "CRE3rdONAPESI_"
61 ExceptionUtil exceptionUtil = new ExceptionUtil()
63 JsonUtils jsonUtil = new JsonUtils()
65 public void checkSPPartnerInfoFromAAI (DelegateExecution execution) {
66 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
67 utils.log("INFO"," ***** Started checkSPPartnerInfo *****", isDebugEnabled)
69 //get bpmn inputs from resource request.
70 String requestId = execution.getVariable("mso-request-id")
71 String requestAction = execution.getVariable("requestAction")
72 utils.log("INFO","The requestAction is: " + requestAction, isDebugEnabled)
73 String recipeParamsFromRequest = execution.getVariable("recipeParams")
74 utils.log("INFO","The recipeParams is: " + recipeParamsFromRequest, isDebugEnabled)
75 String resourceInput = execution.getVariable("resourceInput")
76 utils.log("INFO","The resourceInput is: " + resourceInput, isDebugEnabled)
77 //Get ResourceInput Object
78 ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class)
79 // set local resourceInput
80 execution.setVariable(Prefix + "ResourceInput", resourceInputObj)
82 String resourceInstanceId = resourceInputObj.getResourceInstancenUuid()
83 String sppartnerId = resourceInstanceId
84 execution.setVariable(Prefix + "SppartnerId", sppartnerId)
85 utils.log("INFO", "sppartnerId:" + sppartnerId, isDebugEnabled)
87 // Get Sppartner from AAI
88 AaiUtil aaiUriUtil = new AaiUtil(this)
89 String aai_uri = aaiUriUtil.getBusinessSPPartnerUri(execution)
90 String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri)
91 String aai_endpoint = execution.getVariable("URN_aai_endpoint")
92 String serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(sppartnerId,"UTF-8")
93 execution.setVariable(Prefix + "serviceAaiPath", serviceAaiPath)
95 getSPPartnerInAAI(execution)
97 String callSource = "UUI"
98 String sppartnerUrl = ""
99 String sppartnerVersion = ""
100 if(execution.getVariable(Prefix + "SuccessIndicator")) {
101 callSource = execution.getVariable(Prefix + "CallSource")
102 sppartnerId = execution.getVariable(Prefix + "SppartnerId")
103 sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl")
104 sppartnerVersion = execution.getVariable(Prefix + "SppartnerVersion")
107 boolean is3rdONAPExist = false
108 if(!isBlank(sppartnerUrl)) {
109 is3rdONAPExist = true
112 execution.setVariable("Is3rdONAPExist", is3rdONAPExist)
113 execution.setVariable(Prefix + "ServiceInstanceId", resourceInputObj.getServiceInstanceId())
114 execution.setVariable("mso-request-id", requestId)
115 execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId())
117 } catch (BpmnError e) {
119 } catch (Exception ex){
120 String msg = "Exception in checkSPPartnerInfoFromAAI " + ex.getMessage()
121 utils.log("DEBUG", msg, isDebugEnabled)
122 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
126 public void checkLocallCall (DelegateExecution execution) {
127 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
128 utils.log("INFO"," ***** Started checkLocallCall *****", isDebugEnabled)
130 boolean isLocalCall = true
131 String callSource = execution.getVariable(Prefix + "CallSource")
132 if("ExternalAPI".equalsIgnoreCase(callSource)) {
135 execution.setVariable("IsLocalCall", isLocalCall)
138 public void preProcessRequest(DelegateExecution execution){
139 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
140 utils.log("INFO"," ***** Started preProcessRequest *****", isDebugEnabled)
142 ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput")
145 String globalSubscriberId = resourceInputObj.getGlobalSubscriberId()
146 if (isBlank(globalSubscriberId)) {
147 msg = "Input globalSubscriberId is null"
148 utils.log("INFO", msg, isDebugEnabled)
149 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
152 execution.setVariable("globalSubscriberId", globalSubscriberId)
153 utils.log("INFO", "globalSubscriberId:" + globalSubscriberId, isDebugEnabled)
155 String serviceType = resourceInputObj.getServiceType()
156 if (isBlank(serviceType)) {
157 msg = "Input serviceType is null"
158 utils.log("INFO", msg, isDebugEnabled)
159 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
161 execution.setVariable("serviceType", serviceType)
162 utils.log("INFO", "serviceType:" + serviceType, isDebugEnabled)
164 String operationId = resourceInputObj.getOperationId()
165 if (isBlank(operationId)) {
166 msg = "Input operationId is null"
167 utils.log("INFO", msg, isDebugEnabled)
168 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
170 execution.setVariable("operationId", operationId)
171 utils.log("INFO", "operationId:" + operationId, isDebugEnabled)
173 String resourceName = resourceInputObj.getResourceInstanceName()
174 if (isBlank(resourceName)) {
175 msg = "Input resourceName is null"
176 utils.log("INFO", msg, isDebugEnabled)
177 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
179 execution.setVariable("resourceName", resourceName)
180 utils.log("INFO", "resourceInstanceId:" + resourceName, isDebugEnabled)
182 String resourceTemplateId = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
183 if (isBlank(resourceTemplateId)) {
184 msg = "Input resourceTemplateId is null"
185 utils.log("INFO", msg, isDebugEnabled)
186 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
188 execution.setVariable("resourceTemplateId", resourceTemplateId)
189 utils.log("INFO", "resourceTemplateId:" + resourceTemplateId, isDebugEnabled)
191 } catch (BpmnError e) {
193 } catch (Exception ex){
194 String msg = "Exception in preProcessRequest " + ex.getMessage()
195 utils.log("DEBUG", msg, isDebugEnabled)
196 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
200 public void prepareUpdateProgress(DelegateExecution execution) {
201 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
202 utils.log("INFO"," ***** Started prepareUpdateProgress *****", isDebugEnabled)
203 ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput")
204 String operType = resourceInputObj.getOperationType()
205 String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
206 String ServiceInstanceId = resourceInputObj.getServiceInstanceId()
207 String modelName = resourceInputObj.getResourceModelInfo().getModelName()
208 String operationId = resourceInputObj.getOperationId()
209 String progress = execution.getVariable("progress")
210 String status = execution.getVariable("status")
211 String statusDescription = execution.getVariable("statusDescription")
214 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
215 xmlns:ns="http://org.openecomp.mso/requestsdb">
218 <ns:updateResourceOperationStatus>
219 <operType>${operType}</operType>
220 <operationId>${operationId}</operationId>
221 <progress>${progress}</progress>
222 <resourceTemplateUUID>${resourceCustomizationUuid}</resourceTemplateUUID>
223 <serviceId>${ServiceInstanceId}</serviceId>
224 <status>${status}</status>
225 <statusDescription>${statusDescription}</statusDescription>
226 </ns:updateResourceOperationStatus>
228 </soapenv:Envelope>"""
230 setProgressUpdateVariables(execution, body)
231 utils.log("INFO"," ***** End prepareUpdateProgress *****", isDebugEnabled)
234 public void prepare3rdONAPRequest(DelegateExecution execution) {
235 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
236 utils.log("INFO"," ***** Started prepare3rdONAPRequest *****", isDebugEnabled)
238 String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl")
239 String extAPIPath = sppartnerUrl + 'serviceOrder'
240 execution.setVariable("ExternalAPIURL", extAPIPath)
242 // ExternalAPI message format
243 String externalId = execution.getVariable("resourceName")
244 String category = "E2E Service"
245 String description = "Service Order from SPPartner"
246 String requestedStartDate = utils.generateCurrentTimeInUtc()
247 String requestedCompletionDate = utils.generateCurrentTimeInUtc()
248 String priority = "1" // 0-4 0:highest
249 String subscriberId = execution.getVariable("globalSubscriberId")
250 String customerRole = ""
251 String subscriberName = ""
252 String referredType = "Consumer"
253 String orderItemId = "1"
254 String action = "delete" //for delete
255 String serviceState = "active"
256 String serviceName = ""
257 String serviceType = execution.getVariable("serviceType")
258 String serviceId = execution.getVariable(Prefix + "ServiceInstanceId")
260 Map<String, String> valueMap = new HashMap<>()
261 valueMap.put("externalId", '"' + externalId + '"')
262 valueMap.put("category", '"' + category + '"')
263 valueMap.put("description", '"' + description + '"')
264 valueMap.put("requestedStartDate", '"' + requestedStartDate + '"')
265 valueMap.put("requestedCompletionDate", '"' + requestedCompletionDate + '"')
266 valueMap.put("priority", '"'+ priority + '"')
267 valueMap.put("subscriberId", '"' + subscriberId + '"')
268 valueMap.put("customerRole", '"' + customerRole + '"')
269 valueMap.put("subscriberName", '"' + subscriberName + '"')
270 valueMap.put("referredType", '"' + referredType + '"')
271 valueMap.put("orderItemId", '"' + orderItemId + '"')
272 valueMap.put("action", '"' + action + '"')
273 valueMap.put("serviceState", '"' + serviceState + '"')
274 valueMap.put("serviceName", '"' + serviceName + '"')
275 valueMap.put("serviceType", '"' + serviceType + '"')
276 valueMap.put("serviceId", '"' + serviceId + '"')
278 ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this)
280 valueMap.put("_requestInputs_", "")
282 String payload = externalAPIUtil.setTemplate(ExternalAPIUtil.PostServiceOrderRequestsTemplate, valueMap)
283 execution.setVariable(Prefix + "Payload", payload)
284 utils.log("INFO", "Exit " + prepare3rdONAPRequest, isDebugEnabled)
287 public void doDeleteE2ESIin3rdONAP(DelegateExecution execution) {
288 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
289 utils.log("INFO"," ***** Started doDeleteE2ESIin3rdONAP *****", isDebugEnabled)
291 String extAPIPath = execution.getVariable("ExternalAPIURL")
292 String payload = execution.getVariable(Prefix + "Payload")
294 ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this)
296 APIResponse response = externalAPIUtil.executeExternalAPIPostCall(execution, extAPIPath, payload)
298 int responseCode = response.getStatusCode()
299 execution.setVariable(Prefix + "postServiceOrderResponseCode", responseCode)
300 utils.log("DEBUG", "Post ServiceOrder response code is: " + responseCode, isDebugEnabled)
302 String extApiResponse = response.getResponseBodyAsString()
303 JSONObject responseObj = new JSONObject(extApiResponse)
304 execution.setVariable(Prefix + "postServiceOrderResponse", extApiResponse)
306 if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
307 //200 OK 201 CREATED 202 ACCEPTED
309 utils.log("DEBUG", "Post ServiceOrder Received a Good Response", isDebugEnabled)
310 String serviceOrderId = responseObj.get("ServiceOrderId")
311 execution.setVariable(Prefix + "SuccessIndicator", true)
312 execution.setVariable("serviceOrderId", serviceOrderId)
315 utils.log("DEBUG", "Post ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode, isDebugEnabled)
316 exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Post ServiceOrder Received a bad response from 3rdONAP External API")
319 utils.log("INFO", "Exit " + doDeleteE2ESIin3rdONAP, isDebugEnabled)
323 public void getE2ESIProgressin3rdONAP(DelegateExecution execution) {
324 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
325 utils.log("INFO"," ***** Started getE2ESIProgressin3rdONAP *****", isDebugEnabled)
327 String extAPIPath = execution.getVariable("ExternalAPIURL")
328 extAPIPath += "/" + execution.getVariable("ServiceOrderId")
330 ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this)
332 APIResponse response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath)
334 int responseCode = response.getStatusCode()
335 execution.setVariable(Prefix + "getServiceOrderResponseCode", responseCode)
336 utils.log("DEBUG", "Get ServiceOrder response code is: " + responseCode, isDebugEnabled)
338 String extApiResponse = response.getResponseBodyAsString()
339 JSONObject responseObj = new JSONObject(extApiResponse)
340 execution.setVariable(Prefix + "getServiceOrderResponse", extApiResponse)
342 //Process Response //200 OK 201 CREATED 202 ACCEPTED
343 if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
345 utils.log("DEBUG", "Get ServiceOrder Received a Good Response", isDebugEnabled)
346 String serviceOrderState = responseObj.get("State")
347 execution.setVariable(Prefix + "SuccessIndicator", true)
348 execution.setVariable("serviceOrderState", serviceOrderState)
350 // Get serviceOrder State and process progress
351 if("ACKNOWLEDGED".equalsIgnoreCase(serviceOrderState)) {
352 execution.setVariable("progress", 15)
353 execution.setVariable("status", "processing")
355 if("INPROGRESS".equalsIgnoreCase(serviceOrderState)) {
356 execution.setVariable("progress", 40)
357 execution.setVariable("status", "processing")
359 if("COMPLETED".equalsIgnoreCase(serviceOrderState)) {
360 execution.setVariable("progress", 100)
361 execution.setVariable("status", "finished")
363 if("FAILED".equalsIgnoreCase(serviceOrderState)) {
364 execution.setVariable("progress", 100)
365 execution.setVariable("status", "error")
368 execution.setVariable("progress", 100)
369 execution.setVariable("status", "error")
370 execution.setVariable("statusDescription", "Delete Service Order Status is unknown")
372 execution.setVariable("statusDescription", "Delete Service Order Status is " + serviceOrderState)
375 utils.log("DEBUG", "Get ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode, isDebugEnabled)
376 execution.setVariable("progress", 100)
377 execution.setVariable("status", "error")
378 execution.setVariable("statusDescription", "Get ServiceOrder Received a bad response")
379 exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get ServiceOrder Received a bad response from 3rdONAP External API")
382 utils.log("INFO", "Exit " + getE2ESIProgressin3rdONAP, isDebugEnabled)
388 public void timeDelay(DelegateExecution execution) {
389 def isDebugEnabled= execution.getVariable("isDebugLogEnabled")
392 } catch(InterruptedException e) {
393 utils.log("ERROR", "Time Delay exception" + e , isDebugEnabled)
397 private void getSPPartnerInAAI(DelegateExecution execution) {
398 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
399 utils.log("INFO"," ***** Started postDeleteE2ESIin3rdONAP *****", isDebugEnabled)
401 AaiUtil aaiUriUtil = new AaiUtil(this)
402 String serviceAaiPath = execution.getVariable(Prefix + "serviceAaiPath")
403 APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceAaiPath)
404 int responseCode = response.getStatusCode()
405 execution.setVariable(Prefix + "GetSppartnerResponseCode", responseCode)
406 utils.log("DEBUG", " Get sppartner response code is: " + responseCode, isDebugEnabled)
408 String aaiResponse = response.getResponseBodyAsString()
409 aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
410 aaiResponse = aaiResponse.replaceAll("&", "&")
411 execution.setVariable(Prefix + "GetSppartnerResponse", aaiResponse)
414 if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
415 //200 OK 201 CREATED 202 ACCEPTED
417 utils.log("DEBUG", "GET sppartner Received a Good Response", isDebugEnabled)
418 execution.setVariable(Prefix + "SuccessIndicator", true)
419 execution.setVariable(Prefix + "FoundIndicator", true)
421 String sppartnerId = utils.getNodeText1(aaiResponse, "sppartner-id")
422 execution.setVariable(Prefix + "SppartnerId", sppartnerId)
423 utils.log("DEBUG", " SppartnerId is: " + sppartnerId, isDebugEnabled)
424 String sppartnerUrl = utils.getNodeText1(aaiResponse, "sppartner-url")
425 execution.setVariable(Prefix + "SppartnerUrl", sppartnerUrl)
426 utils.log("DEBUG", " SppartnerUrl is: " + sppartnerUrl, isDebugEnabled)
427 String callSource = utils.getNodeText1(aaiResponse, "sppartner-callsource")
428 execution.setVariable(Prefix + "CallSource", callSource)
429 utils.log("DEBUG", " CallSource is: " + callSource, isDebugEnabled)
430 String sppartnerVersion = utils.getNodeText1(aaiResponse, "resource-version")
431 execution.setVariable(Prefix + "SppartnerVersion", sppartnerVersion)
432 utils.log("DEBUG", " Resource Version is: " + sppartnerVersion, isDebugEnabled)
436 utils.log("DEBUG", "Get sppartner Received a Bad Response Code. Response Code is: " + responseCode, isDebugEnabled)
437 exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
438 throw new BpmnError("MSOWorkflowException")
441 utils.log("INFO", "Exit " + deleteSPPartnerInAAI, isDebugEnabled)
444 public void deleteSPPartnerInAAI(DelegateExecution execution) {
445 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
446 utils.log("INFO"," ***** Started postDeleteE2ESIin3rdONAP *****", isDebugEnabled)
448 String sppartnerId = execution.getVariable(Prefix + "SppartnerId")
449 String sppartnerUrl = execution.getVariable(Prefix + "sppartnerUrl")
450 String sppartnerVersion = execution.getVariable(Prefix + "sppartnerVersion")
452 AaiUtil aaiUriUtil = new AaiUtil(this)
453 String serviceAaiPath = execution.getVariable(Prefix + "serviceAaiPath") + "?resource-version=${sppartnerVersion}"
454 APIResponse response = aaiUriUtil.executeAAIDeleteCall(execution, serviceAaiPath)
455 int responseCode = response.getStatusCode()
456 execution.setVariable(Prefix + "DeleteSppartnerResponseCode", responseCode)
457 utils.log("DEBUG", " Get sppartner response code is: " + responseCode, isDebugEnabled)
459 String aaiResponse = response.getResponseBodyAsString()
460 aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
461 execution.setVariable(Prefix + "DeleteSppartnerResponse", aaiResponse)
464 if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
465 //200 OK 201 CREATED 202 ACCEPTED
467 utils.log("DEBUG", "Delete sppartner Received a Good Response", isDebugEnabled)
468 execution.setVariable(Prefix + "SuccessIndicator", true)
470 else if(responseCode == 404){
471 utils.log("DEBUG", " Delete sppartner Received a Not Found (404) Response", isDebugEnabled)
472 execution.setVariable(Prefix + "FoundIndicator", false)
476 utils.log("DEBUG", "Delete sppartner Received a Bad Response Code. Response Code is: " + responseCode, isDebugEnabled)
477 exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
478 throw new BpmnError("MSOWorkflowException")
481 utils.log("INFO", "Exit " + deleteSPPartnerInAAI, isDebugEnabled)
484 private void setProgressUpdateVariables(DelegateExecution execution, String body) {
485 def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint")
486 execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
487 execution.setVariable("CVFMI_updateResOperStatusRequest", body)
490 public void postProcess(DelegateExecution execution){
491 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
492 utils.log("INFO"," ***** Started postProcess *****", isDebugEnabled)
493 String responseCode = execution.getVariable(Prefix + "putSppartnerResponseCode")
494 String responseObj = execution.getVariable(Prefix + "putSppartnerResponse")
496 utils.log("INFO","response from AAI for put sppartner, response code :" + responseCode + " response object :" + responseObj, isDebugEnabled)
497 utils.log("INFO"," ***** Exit postProcess *****", isDebugEnabled)
500 public void sendSyncResponse (DelegateExecution execution) {
501 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
502 utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled)
505 String operationStatus = "finished"
506 // RESTResponse for main flow
507 String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()
508 utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled)
509 sendWorkflowResponse(execution, 202, resourceOperationResp)
510 execution.setVariable("sentSyncResponse", true)
512 } catch (Exception ex) {
513 String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
514 utils.log("DEBUG", msg, isDebugEnabled)
515 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
517 utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled)