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 = execution.getVariable("serviceType")
253 String orderItemId = "1"
254 String action = "delete" //for delete
255 String serviceState = "active"
256 String serviceName = ""
257 String serviceId = execution.getVariable(Prefix + "ServiceInstanceId")
259 Map<String, String> valueMap = new HashMap<>()
260 valueMap.put("externalId", '"' + externalId + '"')
261 valueMap.put("category", '"' + category + '"')
262 valueMap.put("description", '"' + description + '"')
263 valueMap.put("requestedStartDate", '"' + requestedStartDate + '"')
264 valueMap.put("requestedCompletionDate", '"' + requestedCompletionDate + '"')
265 valueMap.put("priority", '"'+ priority + '"')
266 valueMap.put("subscriberId", '"' + subscriberId + '"')
267 valueMap.put("customerRole", '"' + customerRole + '"')
268 valueMap.put("subscriberName", '"' + subscriberName + '"')
269 valueMap.put("referredType", '"' + referredType + '"')
270 valueMap.put("orderItemId", '"' + orderItemId + '"')
271 valueMap.put("action", '"' + action + '"')
272 valueMap.put("serviceState", '"' + serviceState + '"')
273 valueMap.put("serviceName", '"' + serviceName + '"')
274 valueMap.put("serviceId", '"' + serviceId + '"')
276 ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this)
278 valueMap.put("_requestInputs_", "")
280 String payload = externalAPIUtil.setTemplate(ExternalAPIUtil.PostServiceOrderRequestsTemplate, valueMap)
281 execution.setVariable(Prefix + "Payload", payload)
282 utils.log("INFO", "Exit " + prepare3rdONAPRequest, isDebugEnabled)
285 public void doDeleteE2ESIin3rdONAP(DelegateExecution execution) {
286 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
287 utils.log("INFO"," ***** Started doDeleteE2ESIin3rdONAP *****", isDebugEnabled)
289 String extAPIPath = execution.getVariable("ExternalAPIURL")
290 String payload = execution.getVariable(Prefix + "Payload")
292 ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this)
294 APIResponse response = externalAPIUtil.executeExternalAPIPostCall(execution, extAPIPath, payload)
296 int responseCode = response.getStatusCode()
297 execution.setVariable(Prefix + "postServiceOrderResponseCode", responseCode)
298 utils.log("DEBUG", "Post ServiceOrder response code is: " + responseCode, isDebugEnabled)
300 String extApiResponse = response.getResponseBodyAsString()
301 JSONObject responseObj = new JSONObject(extApiResponse)
302 execution.setVariable(Prefix + "postServiceOrderResponse", extApiResponse)
304 if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
305 //200 OK 201 CREATED 202 ACCEPTED
307 utils.log("DEBUG", "Post ServiceOrder Received a Good Response", isDebugEnabled)
308 String serviceOrderId = responseObj.get("ServiceOrderId")
309 execution.setVariable(Prefix + "SuccessIndicator", true)
310 execution.setVariable("serviceOrderId", serviceOrderId)
313 utils.log("DEBUG", "Post ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode, isDebugEnabled)
314 exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Post ServiceOrder Received a bad response from 3rdONAP External API")
317 utils.log("INFO", "Exit " + doDeleteE2ESIin3rdONAP, isDebugEnabled)
321 public void getE2ESIProgressin3rdONAP(DelegateExecution execution) {
322 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
323 utils.log("INFO"," ***** Started getE2ESIProgressin3rdONAP *****", isDebugEnabled)
325 String extAPIPath = execution.getVariable("ExternalAPIURL")
326 extAPIPath += "/" + execution.getVariable("ServiceOrderId")
328 ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this)
330 APIResponse response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath)
332 int responseCode = response.getStatusCode()
333 execution.setVariable(Prefix + "getServiceOrderResponseCode", responseCode)
334 utils.log("DEBUG", "Get ServiceOrder response code is: " + responseCode, isDebugEnabled)
336 String extApiResponse = response.getResponseBodyAsString()
337 JSONObject responseObj = new JSONObject(extApiResponse)
338 execution.setVariable(Prefix + "getServiceOrderResponse", extApiResponse)
340 //Process Response //200 OK 201 CREATED 202 ACCEPTED
341 if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
343 utils.log("DEBUG", "Get ServiceOrder Received a Good Response", isDebugEnabled)
344 String serviceOrderState = responseObj.get("State")
345 execution.setVariable(Prefix + "SuccessIndicator", true)
346 execution.setVariable("serviceOrderState", serviceOrderState)
348 // Get serviceOrder State and process progress
349 if("ACKNOWLEDGED".equalsIgnoreCase(serviceOrderState)) {
350 execution.setVariable("progress", 15)
351 execution.setVariable("status", "processing")
353 if("INPROGRESS".equalsIgnoreCase(serviceOrderState)) {
354 execution.setVariable("progress", 40)
355 execution.setVariable("status", "processing")
357 if("COMPLETED".equalsIgnoreCase(serviceOrderState)) {
358 execution.setVariable("progress", 100)
359 execution.setVariable("status", "finished")
361 if("FAILED".equalsIgnoreCase(serviceOrderState)) {
362 execution.setVariable("progress", 100)
363 execution.setVariable("status", "error")
366 execution.setVariable("progress", 100)
367 execution.setVariable("status", "error")
368 execution.setVariable("statusDescription", "Delete Service Order Status is unknown")
370 execution.setVariable("statusDescription", "Delete Service Order Status is " + serviceOrderState)
373 utils.log("DEBUG", "Get ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode, isDebugEnabled)
374 execution.setVariable("progress", 100)
375 execution.setVariable("status", "error")
376 execution.setVariable("statusDescription", "Get ServiceOrder Received a bad response")
377 exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get ServiceOrder Received a bad response from 3rdONAP External API")
380 utils.log("INFO", "Exit " + getE2ESIProgressin3rdONAP, isDebugEnabled)
386 public void timeDelay(DelegateExecution execution) {
387 def isDebugEnabled= execution.getVariable("isDebugLogEnabled")
390 } catch(InterruptedException e) {
391 utils.log("ERROR", "Time Delay exception" + e , isDebugEnabled)
395 private void getSPPartnerInAAI(DelegateExecution execution) {
396 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
397 utils.log("INFO"," ***** Started postDeleteE2ESIin3rdONAP *****", isDebugEnabled)
399 AaiUtil aaiUriUtil = new AaiUtil(this)
400 String serviceAaiPath = execution.getVariable(Prefix + "serviceAaiPath")
401 APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceAaiPath)
402 int responseCode = response.getStatusCode()
403 execution.setVariable(Prefix + "GetSppartnerResponseCode", responseCode)
404 utils.log("DEBUG", " Get sppartner response code is: " + responseCode, isDebugEnabled)
406 String aaiResponse = response.getResponseBodyAsString()
407 aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
408 aaiResponse = aaiResponse.replaceAll("&", "&")
409 execution.setVariable(Prefix + "GetSppartnerResponse", aaiResponse)
412 if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
413 //200 OK 201 CREATED 202 ACCEPTED
415 utils.log("DEBUG", "GET sppartner Received a Good Response", isDebugEnabled)
416 execution.setVariable(Prefix + "SuccessIndicator", true)
417 execution.setVariable(Prefix + "FoundIndicator", true)
419 String sppartnerId = utils.getNodeText1(aaiResponse, "sppartner-id")
420 execution.setVariable(Prefix + "SppartnerId", sppartnerId)
421 utils.log("DEBUG", " SppartnerId is: " + sppartnerId, isDebugEnabled)
422 String sppartnerUrl = utils.getNodeText1(aaiResponse, "sppartner-url")
423 execution.setVariable(Prefix + "SppartnerUrl", sppartnerUrl)
424 utils.log("DEBUG", " SppartnerUrl is: " + sppartnerUrl, isDebugEnabled)
425 String callSource = utils.getNodeText1(aaiResponse, "sppartner-callsource")
426 execution.setVariable(Prefix + "CallSource", callSource)
427 utils.log("DEBUG", " CallSource is: " + callSource, isDebugEnabled)
428 String sppartnerVersion = utils.getNodeText1(aaiResponse, "resource-version")
429 execution.setVariable(Prefix + "SppartnerVersion", sppartnerVersion)
430 utils.log("DEBUG", " Resource Version is: " + sppartnerVersion, isDebugEnabled)
434 utils.log("DEBUG", "Get sppartner Received a Bad Response Code. Response Code is: " + responseCode, isDebugEnabled)
435 exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
436 throw new BpmnError("MSOWorkflowException")
439 utils.log("INFO", "Exit " + deleteSPPartnerInAAI, isDebugEnabled)
442 public void deleteSPPartnerInAAI(DelegateExecution execution) {
443 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
444 utils.log("INFO"," ***** Started postDeleteE2ESIin3rdONAP *****", isDebugEnabled)
446 String sppartnerId = execution.getVariable(Prefix + "SppartnerId")
447 String sppartnerUrl = execution.getVariable(Prefix + "sppartnerUrl")
448 String sppartnerVersion = execution.getVariable(Prefix + "sppartnerVersion")
450 AaiUtil aaiUriUtil = new AaiUtil(this)
451 String serviceAaiPath = execution.getVariable(Prefix + "serviceAaiPath") + "/${sppartnerVersion}"
452 APIResponse response = aaiUriUtil.executeAAIDeleteCall(execution, serviceAaiPath)
453 int responseCode = response.getStatusCode()
454 execution.setVariable(Prefix + "DeleteSppartnerResponseCode", responseCode)
455 utils.log("DEBUG", " Get sppartner response code is: " + responseCode, isDebugEnabled)
457 String aaiResponse = response.getResponseBodyAsString()
458 aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
459 execution.setVariable(Prefix + "DeleteSppartnerResponse", aaiResponse)
462 if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
463 //200 OK 201 CREATED 202 ACCEPTED
465 utils.log("DEBUG", "Delete sppartner Received a Good Response", isDebugEnabled)
466 execution.setVariable(Prefix + "SuccessIndicator", true)
468 else if(responseCode == 404){
469 utils.log("DEBUG", " Delete sppartner Received a Not Found (404) Response", isDebugEnabled)
470 execution.setVariable(Prefix + "FoundIndicator", false)
474 utils.log("DEBUG", "Delete sppartner Received a Bad Response Code. Response Code is: " + responseCode, isDebugEnabled)
475 exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
476 throw new BpmnError("MSOWorkflowException")
479 utils.log("INFO", "Exit " + deleteSPPartnerInAAI, isDebugEnabled)
482 private void setProgressUpdateVariables(DelegateExecution execution, String body) {
483 def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint")
484 execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
485 execution.setVariable("CVFMI_updateResOperStatusRequest", body)
488 public void postProcess(DelegateExecution execution){
489 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
490 utils.log("INFO"," ***** Started postProcess *****", isDebugEnabled)
491 String responseCode = execution.getVariable(Prefix + "putSppartnerResponseCode")
492 String responseObj = execution.getVariable(Prefix + "putSppartnerResponse")
494 utils.log("INFO","response from AAI for put sppartner, response code :" + responseCode + " response object :" + responseObj, isDebugEnabled)
495 utils.log("INFO"," ***** Exit postProcess *****", isDebugEnabled)
498 public void sendSyncResponse (DelegateExecution execution) {
499 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
500 utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled)
503 String operationStatus = "finished"
504 // RESTResponse for main flow
505 String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()
506 utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled)
507 sendWorkflowResponse(execution, 202, resourceOperationResp)
508 execution.setVariable("sentSyncResponse", true)
510 } catch (Exception ex) {
511 String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
512 utils.log("DEBUG", msg, isDebugEnabled)
513 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
515 utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled)