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.JSONArray
24 import org.json.JSONObject
27 import static org.apache.commons.lang3.StringUtils.*
28 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.infrastructure.workflow.service.ServicePluginFactory
42 import org.onap.so.logger.MsoLogger
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 3rdONAPE2EServiceInstance in 3rdONAP
57 public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcessor {
59 String Prefix = "CRE3rdONAPESI_"
61 ExceptionUtil exceptionUtil = new ExceptionUtil()
63 JsonUtils jsonUtil = new JsonUtils()
65 private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, Delete3rdONAPE2EServiceInstance.class)
67 public void checkSPPartnerInfoFromAAI (DelegateExecution execution) {
68 msoLogger.info(" ***** Started checkSPPartnerInfo *****")
70 //get bpmn inputs from resource request.
71 String requestId = execution.getVariable("mso-request-id")
72 String requestAction = execution.getVariable("requestAction")
73 msoLogger.info("The requestAction is: " + requestAction)
74 String recipeParamsFromRequest = execution.getVariable("recipeParams")
75 msoLogger.info("The recipeParams is: " + recipeParamsFromRequest)
76 String resourceInput = execution.getVariable("resourceInput")
77 msoLogger.info("The resourceInput is: " + resourceInput)
78 //Get ResourceInput Object
79 ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class)
80 // set local resourceInput
81 execution.setVariable(Prefix + "ResourceInput", resourceInputObj)
83 String resourceInstanceId = resourceInputObj.getResourceInstancenUuid()
84 String sppartnerId = resourceInstanceId
85 execution.setVariable(Prefix + "SppartnerId", sppartnerId)
87 // Get Sppartner from AAI
88 AaiUtil aaiUriUtil = new AaiUtil()
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 if(execution.hasVariable(Prefix + "CallSource")) {
100 callSource = execution.getVariable(Prefix + "CallSource")
101 sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl")
104 boolean is3rdONAPExist = false
105 if(!isBlank(sppartnerUrl)) {
106 is3rdONAPExist = true
109 execution.setVariable("Is3rdONAPExist", is3rdONAPExist)
110 execution.setVariable(Prefix + "ServiceInstanceId", resourceInputObj.getServiceInstanceId())
111 execution.setVariable("mso-request-id", requestId)
112 execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId())
114 } catch (BpmnError e) {
116 } catch (Exception ex){
117 String msg = "Exception in checkSPPartnerInfoFromAAI " + ex.getMessage()
119 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
123 public void checkLocallCall (DelegateExecution execution) {
124 msoLogger.info(" ***** Started checkLocallCall *****")
126 boolean isLocalCall = true
127 String callSource = execution.getVariable(Prefix + "CallSource")
128 if("ExternalAPI".equalsIgnoreCase(callSource)) {
131 execution.setVariable("IsLocalCall", isLocalCall)
134 public void preProcessRequest(DelegateExecution execution){
135 msoLogger.info(" ***** Started preProcessRequest *****")
139 ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput")
141 String globalSubscriberId = resourceInputObj.getGlobalSubscriberId()
142 if (isBlank(globalSubscriberId)) {
143 msg = "Input globalSubscriberId is null"
144 msoLogger.error( msg)
147 execution.setVariable("globalSubscriberId", globalSubscriberId)
148 msoLogger.info( "globalSubscriberId:" + globalSubscriberId)
150 String serviceType = resourceInputObj.getServiceType()
151 if (isBlank(serviceType)) {
152 msg = "Input serviceType is null"
153 msoLogger.error( msg)
155 execution.setVariable("serviceType", serviceType)
156 msoLogger.info( "serviceType:" + serviceType)
158 String operationId = resourceInputObj.getOperationId()
159 if (isBlank(operationId)) {
160 msg = "Input operationId is null"
161 msoLogger.error( msg)
163 execution.setVariable("operationId", operationId)
164 msoLogger.info( "operationId:" + operationId)
166 String resourceName = resourceInputObj.getResourceInstanceName()
167 if (isBlank(resourceName)) {
168 msg = "Input resourceName is null"
169 msoLogger.error( msg)
171 execution.setVariable("resourceName", resourceName)
172 msoLogger.info("resourceName:" + resourceName)
174 String resourceTemplateId = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
175 if (isBlank(resourceTemplateId)) {
176 msg = "Input resourceTemplateId is null"
177 msoLogger.error( msg)
179 execution.setVariable("resourceTemplateId", resourceTemplateId)
180 msoLogger.info( "resourceTemplateId:" + resourceTemplateId)
182 } catch (BpmnError e) {
184 } catch (Exception ex){
185 msg = "Exception in preProcessRequest " + ex.getMessage()
187 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
191 public void prepareUpdateProgress(DelegateExecution execution) {
192 msoLogger.info(" ***** Started prepareUpdateProgress *****")
193 ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput")
194 String operType = resourceInputObj.getOperationType()
195 String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
196 String ServiceInstanceId = resourceInputObj.getServiceInstanceId()
197 String modelName = resourceInputObj.getResourceModelInfo().getModelName()
198 String operationId = resourceInputObj.getOperationId()
199 String progress = execution.getVariable("progress")
200 String status = execution.getVariable("status")
201 String statusDescription = execution.getVariable("statusDescription")
204 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
205 xmlns:ns="http://org.openecomp.mso/requestsdb">
208 <ns:updateResourceOperationStatus>
209 <operType>${operType}</operType>
210 <operationId>${operationId}</operationId>
211 <progress>${progress}</progress>
212 <resourceTemplateUUID>${resourceCustomizationUuid}</resourceTemplateUUID>
213 <serviceId>${ServiceInstanceId}</serviceId>
214 <status>${status}</status>
215 <statusDescription>${statusDescription}</statusDescription>
216 </ns:updateResourceOperationStatus>
218 </soapenv:Envelope>"""
220 setProgressUpdateVariables(execution, body)
221 msoLogger.info(" ***** End prepareUpdateProgress *****")
224 public void prepare3rdONAPRequest(DelegateExecution execution) {
225 msoLogger.info(" ***** Started prepare3rdONAPRequest *****")
227 String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl")
228 String extAPIPath = sppartnerUrl + '/serviceOrder'
229 execution.setVariable("ExternalAPIURL", extAPIPath)
231 // ExternalAPI message format
232 String externalId = execution.getVariable("resourceName")
233 String category = "E2E Service"
234 String description = "Service Order from SPPartner"
235 String requestedStartDate = utils.generateCurrentTimeInUtc()
236 String requestedCompletionDate = utils.generateCurrentTimeInUtc()
237 String priority = "1" // 0-4 0:highest
238 String subscriberId = execution.getVariable("globalSubscriberId")
239 String customerRole = "ONAPcustomer"
240 String subscriberName = subscriberId
241 String referredType = "Consumer"
242 String orderItemId = "1"
243 String action = "delete" //for delete
244 String serviceState = "active"
245 String serviceName = ""
246 String serviceType = execution.getVariable("serviceType")
247 String serviceId = execution.getVariable(Prefix + "SppartnerId")
249 queryServicefrom3rdONAP(execution)
250 String serviceSpecificationId = execution.getVariable(Prefix + "ServiceSpecificationId")
252 Map<String, String> valueMap = new HashMap<>()
253 valueMap.put("externalId", '"' + externalId + '"')
254 valueMap.put("category", '"' + category + '"')
255 valueMap.put("description", '"' + description + '"')
256 valueMap.put("requestedStartDate", '"' + requestedStartDate + '"')
257 valueMap.put("requestedCompletionDate", '"' + requestedCompletionDate + '"')
258 valueMap.put("priority", '"'+ priority + '"')
259 valueMap.put("subscriberId", '"' + subscriberId + '"')
260 valueMap.put("customerRole", '"' + customerRole + '"')
261 valueMap.put("subscriberName", '"' + subscriberName + '"')
262 valueMap.put("referredType", '"' + referredType + '"')
263 valueMap.put("orderItemId", '"' + orderItemId + '"')
264 valueMap.put("action", '"' + action + '"')
265 valueMap.put("serviceState", '"' + serviceState + '"')
266 valueMap.put("serviceId", '"' + serviceId + '"')
267 valueMap.put("serviceName", "null")
268 valueMap.put("serviceUuId", '"' + serviceSpecificationId + '"')
270 ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil()
272 valueMap.put("_requestInputs_", "")
274 String payload = externalAPIUtil.setTemplate(ExternalAPIUtil.PostServiceOrderRequestsTemplate, valueMap)
275 execution.setVariable(Prefix + "Payload", payload)
276 msoLogger.info( "Exit " + prepare3rdONAPRequest)
279 private void queryServicefrom3rdONAP(DelegateExecution execution)
281 msoLogger.info(" ***** Started queryServicefrom3rdONAP *****")
283 String globalSubscriberId = execution.getVariable("globalSubscriberId")
284 String SppartnerServiceId = execution.getVariable(Prefix + "SppartnerId")
286 //https://{api_url}/nbi/api/v1/service?relatedParty.id=${globalSubscriberId}
287 String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl")
288 String extAPIPath = sppartnerUrl + "/service?relatedParty.id=" + globalSubscriberId
289 msoLogger.debug("queryServicefrom3rdONAP externalAPIURL is: " + extAPIPath)
291 ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil()
293 APIResponse response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath)
295 int responseCode = response.getStatusCode()
296 execution.setVariable(Prefix + "GetServiceResponseCode", responseCode)
297 msoLogger.debug("Get Service response code is: " + responseCode)
299 String extApiResponse = response.getResponseBodyAsString()
301 execution.setVariable(Prefix + "GetServiceResponse", extApiResponse)
302 msoLogger.debug("queryServicefrom3rdONAP response body is: " + extApiResponse)
304 //Process Response //200 OK 201 CREATED 202 ACCEPTED
305 if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
307 msoLogger.debug("Get Service Received a Good Response")
308 JSONArray responseList = new JSONArray(extApiResponse)
309 for(JSONObject obj : responseList) {
310 String svcId = obj.get("id")
311 if(StringUtils.equalsIgnoreCase(SppartnerServiceId, svcId)) {
312 JSONObject serviceSpecification = obj.get("serviceSpecification")
313 String serviceUuid = serviceSpecification.get("id")
314 execution.setVariable(Prefix + "ServiceSpecificationId", serviceUuid)
320 msoLogger.error("Get Service Received a Bad Response Code. Response Code is: " + responseCode)
321 // exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get Service Received a bad response from 3rdONAP External API")
324 msoLogger.info( "Exit " + queryServicefrom3rdONAP)
327 public void doDeleteE2ESIin3rdONAP(DelegateExecution execution) {
328 msoLogger.info(" ***** Started doDeleteE2ESIin3rdONAP *****")
330 String extAPIPath = execution.getVariable("ExternalAPIURL")
331 String payload = execution.getVariable(Prefix + "Payload")
332 msoLogger.debug("doDeleteE2ESIin3rdONAP externalAPIURL is: " + extAPIPath)
333 msoLogger.debug("doDeleteE2ESIin3rdONAP payload is: " + payload)
335 ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil()
337 APIResponse response = externalAPIUtil.executeExternalAPIPostCall(execution, extAPIPath, payload)
339 int responseCode = response.getStatusCode()
340 execution.setVariable(Prefix + "PostServiceOrderResponseCode", responseCode)
341 msoLogger.debug("Post ServiceOrder response code is: " + responseCode)
343 String extApiResponse = response.getResponseBodyAsString()
344 JSONObject responseObj = new JSONObject(extApiResponse)
345 execution.setVariable(Prefix + "PostServiceOrderResponse", extApiResponse)
347 msoLogger.debug("doDeleteE2ESIin3rdONAP response body is: " + extApiResponse)
350 if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
351 //200 OK 201 CREATED 202 ACCEPTED
353 msoLogger.debug("Post ServiceOrder Received a Good Response")
354 String serviceOrderId = responseObj.get("id")
355 execution.setVariable(Prefix + "SuccessIndicator", true)
356 execution.setVariable("ServiceOrderId", serviceOrderId)
357 msoLogger.info("Post ServiceOrderid is: " + serviceOrderId)
360 msoLogger.error("Post ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode)
361 exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Post ServiceOrder Received a bad response from 3rdONAP External API")
364 msoLogger.info( "Exit " + doDeleteE2ESIin3rdONAP)
368 public void getE2ESIProgressin3rdONAP(DelegateExecution execution) {
369 msoLogger.info(" ***** Started getE2ESIProgressin3rdONAP *****")
371 String extAPIPath = execution.getVariable("ExternalAPIURL")
372 extAPIPath += "/" + execution.getVariable("ServiceOrderId")
373 msoLogger.debug("getE2ESIProgressin3rdONAP delete externalAPIURL is: " + extAPIPath)
375 ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil()
377 APIResponse response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath)
379 int responseCode = response.getStatusCode()
380 execution.setVariable(Prefix + "GetServiceOrderResponseCode", responseCode)
381 msoLogger.debug("Get ServiceOrder response code is: " + responseCode)
383 String extApiResponse = response.getResponseBodyAsString()
384 JSONObject responseObj = new JSONObject(extApiResponse)
385 execution.setVariable(Prefix + "GetServiceOrderResponse", extApiResponse)
387 utils.log("DEBUG", "getE2ESIProgressin3rdONAP delete response body is: " + extApiResponse, isDebugEnabled)
389 //Process Response //200 OK 201 CREATED 202 ACCEPTED
390 if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
392 msoLogger.debug("Get ServiceOrder Received a Good Response")
394 String orderState = responseObj.get("state")
395 if("REJECTED".equalsIgnoreCase(orderState)) {
396 execution.setVariable("progress", 100)
397 execution.setVariable("status", "error")
398 execution.setVariable("statusDescription", "Delete Service Order Status is REJECTED")
402 JSONArray items = responseObj.getJSONArray("orderItem")
403 JSONObject item = items[0]
404 JSONObject service = item.get("service")
405 String sppartnerServiceId = service.get("id")
406 if(sppartnerServiceId == null || sppartnerServiceId.equals("null")) {
407 execution.setVariable("progress", 100)
408 execution.setVariable("status", "error")
409 execution.setVariable("statusDescription", "Delete Service Order Status get null sppartnerServiceId")
410 msoLogger.error("null sppartnerServiceId while getting progress from externalAPI")
413 execution.setVariable(Prefix + "SppartnerServiceId", sppartnerServiceId)
415 String serviceOrderState = item.get("state")
416 execution.setVariable(Prefix + "SuccessIndicator", true)
417 execution.setVariable("ServiceOrderState", serviceOrderState)
419 // Get serviceOrder State and process progress
420 if("ACKNOWLEDGED".equalsIgnoreCase(serviceOrderState)) {
421 execution.setVariable("progress", 15)
422 execution.setVariable("status", "processing")
423 execution.setVariable("statusDescription", "Delete Service Order Status is " + serviceOrderState)
425 else if("INPROGRESS".equalsIgnoreCase(serviceOrderState)) {
426 execution.setVariable("progress", 40)
427 execution.setVariable("status", "processing")
428 execution.setVariable("statusDescription", "Delete Service Order Status is " + serviceOrderState)
430 else if("COMPLETED".equalsIgnoreCase(serviceOrderState)) {
431 execution.setVariable("progress", 100)
432 execution.setVariable("status", "finished")
433 execution.setVariable("statusDescription", "Delete Service Order Status is " + serviceOrderState)
435 else if("FAILED".equalsIgnoreCase(serviceOrderState)) {
436 execution.setVariable("progress", 100)
437 execution.setVariable("status", "error")
438 execution.setVariable("statusDescription", "Delete Service Order Status is " + serviceOrderState)
441 execution.setVariable("progress", 100)
442 execution.setVariable("status", "error")
443 execution.setVariable("statusDescription", "Delete Service Order Status is unknown")
447 msoLogger.debug("Get ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode)
448 execution.setVariable("progress", 100)
449 execution.setVariable("status", "error")
450 execution.setVariable("statusDescription", "Get Delete ServiceOrder Received a bad response")
451 exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get Delete ServiceOrder Received a bad response from 3rdONAP External API")
454 msoLogger.info( "Exit " + getE2ESIProgressin3rdONAP)
460 public void timeDelay(DelegateExecution execution) {
463 } catch(InterruptedException e) {
464 msoLogger.error("Time Delay exception" + e )
468 private void getSPPartnerInAAI(DelegateExecution execution) {
469 msoLogger.info(" ***** Started getSPPartnerInAAI *****")
471 AaiUtil aaiUriUtil = new AaiUtil()
472 String serviceAaiPath = execution.getVariable(Prefix + "ServiceAaiPath")
473 APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceAaiPath)
474 int responseCode = response.getStatusCode()
475 execution.setVariable(Prefix + "GetSppartnerResponseCode", responseCode)
476 msoLogger.debug(" Get sppartner response code is: " + responseCode)
478 String aaiResponse = response.getResponseBodyAsString()
479 aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
480 aaiResponse = aaiResponse.replaceAll("&", "&")
481 execution.setVariable(Prefix + "GetSppartnerResponse", aaiResponse)
484 if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
485 //200 OK 201 CREATED 202 ACCEPTED
487 msoLogger.debug("GET sppartner Received a Good Response")
488 execution.setVariable(Prefix + "SuccessIndicator", true)
489 execution.setVariable(Prefix + "FoundIndicator", true)
491 String sppartnerId = utils.getNodeText1(aaiResponse, "sp-partner-id")
492 execution.setVariable(Prefix + "SppartnerId", sppartnerId)
493 msoLogger.debug(" SppartnerId is: " + sppartnerId)
494 String sppartnerUrl = utils.getNodeText1(aaiResponse, "url")
495 execution.setVariable(Prefix + "SppartnerUrl", sppartnerUrl)
496 msoLogger.debug(" SppartnerUrl is: " + sppartnerUrl)
497 String callSource = utils.getNodeText1(aaiResponse, "callsource")
498 execution.setVariable(Prefix + "CallSource", callSource)
499 msoLogger.debug(" CallSource is: " + callSource)
500 String sppartnerVersion = utils.getNodeText1(aaiResponse, "resource-version")
501 execution.setVariable(Prefix + "SppartnerVersion", sppartnerVersion)
502 msoLogger.debug(" Resource Version is: " + sppartnerVersion)
506 msoLogger.debug("Get sppartner Received a Bad Response Code. Response Code is: " + responseCode)
507 // exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
508 // throw new BpmnError("MSOWorkflowException")
511 msoLogger.info( "Exit " + getSPPartnerInAAI)
514 public void deleteSPPartnerInAAI(DelegateExecution execution) {
515 msoLogger.info(" ***** Started deleteSPPartnerInAAI *****")
517 String sppartnerId = execution.getVariable(Prefix + "SppartnerId")
518 String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl")
519 String sppartnerVersion = execution.getVariable(Prefix + "SppartnerVersion")
521 AaiUtil aaiUriUtil = new AaiUtil()
522 String serviceAaiPath = execution.getVariable(Prefix + "ServiceAaiPath") + "?resource-version=${sppartnerVersion}"
523 APIResponse response = aaiUriUtil.executeAAIDeleteCall(execution, serviceAaiPath)
524 int responseCode = response.getStatusCode()
525 execution.setVariable(Prefix + "DeleteSppartnerResponseCode", responseCode)
526 msoLogger.debug(" Get sppartner response code is: " + responseCode)
528 String aaiResponse = response.getResponseBodyAsString()
529 aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
530 execution.setVariable(Prefix + "DeleteSppartnerResponse", aaiResponse)
533 if(responseCode == 200 || responseCode == 204 )
535 msoLogger.debug("Delete sppartner Received a Good Response")
536 execution.setVariable(Prefix + "SuccessIndicator", true)
538 else if(responseCode == 404){
539 msoLogger.debug(" Delete sppartner Received a Not Found (404) Response")
540 execution.setVariable(Prefix + "FoundIndicator", false)
544 msoLogger.debug("Delete sppartner Received a Bad Response Code. Response Code is: " + responseCode)
545 // exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
546 // throw new BpmnError("MSOWorkflowException")
549 msoLogger.info( "Exit " + deleteSPPartnerInAAI)
552 private void setProgressUpdateVariables(DelegateExecution execution, String body) {
553 def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint")
554 execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
555 execution.setVariable("CVFMI_updateResOperStatusRequest", body)
558 public void postProcess(DelegateExecution execution){
559 msoLogger.info(" ***** Started postProcess *****")
560 String responseCode = execution.getVariable(Prefix + "PutSppartnerResponseCode")
561 String responseObj = execution.getVariable(Prefix + "PutSppartnerResponse")
563 msoLogger.info("response from AAI for put sppartner, response code :" + responseCode + " response object :" + responseObj)
564 msoLogger.info(" ***** Exit postProcess *****")
567 public void sendSyncResponse (DelegateExecution execution) {
568 msoLogger.debug(" *** sendSyncResponse *** ")
571 String operationStatus = "finished"
572 // RESTResponse for main flow
573 String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()
574 msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
575 sendWorkflowResponse(execution, 202, resourceOperationResp)
576 execution.setVariable("sentSyncResponse", true)
578 } catch (Exception ex) {
579 String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
581 // exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
583 msoLogger.debug(" ***** Exit sendSyncResopnse *****")