2  * ============LICENSE_START=======================================================
 
   4  * ================================================================================
 
   5  * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved.
 
   6  * ================================================================================
 
   7  * Modifications Copyright (c) 2019 Samsung
 
   8  * ================================================================================
 
   9  * Licensed under the Apache License, Version 2.0 (the "License")
 
  10  * you may not use this file except in compliance with the License.
 
  11  * You may obtain a copy of the License at
 
  13  *      http://www.apache.org/licenses/LICENSE-2.0
 
  15  * Unless required by applicable law or agreed to in writing, software
 
  16  * distributed under the License is distributed on an "AS IS" BASIS,
 
  17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  18  * See the License for the specific language governing permissions and
 
  19  * limitations under the License.
 
  20  * ============LICENSE_END=========================================================
 
  23 package org.onap.so.bpmn.infrastructure.scripts
 
  25 import org.onap.so.bpmn.common.scripts.ExternalAPIUtilFactory
 
  27 import javax.ws.rs.NotFoundException
 
  28 import javax.ws.rs.core.Response
 
  30 import org.apache.commons.lang3.StringUtils
 
  31 import static org.apache.commons.lang3.StringUtils.*
 
  32 import org.camunda.bpm.engine.delegate.BpmnError
 
  33 import org.camunda.bpm.engine.delegate.DelegateExecution
 
  34 import org.json.JSONArray
 
  35 import org.json.JSONObject
 
  36 import org.onap.aai.domain.yang.SpPartner
 
  37 import org.onap.so.bpmn.common.recipe.ResourceInput
 
  38 import org.onap.so.bpmn.common.resource.ResourceRequestBuilder
 
  39 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
 
  40 import org.onap.so.bpmn.common.scripts.ExceptionUtil
 
  41 import org.onap.so.bpmn.common.scripts.ExternalAPIUtil
 
  42 import org.onap.so.bpmn.core.json.JsonUtils
 
  43 import org.onap.so.bpmn.core.UrnPropertiesReader
 
  44 import org.onap.so.client.aai.AAIObjectType
 
  45 import org.onap.so.client.aai.AAIResourcesClient
 
  46 import org.onap.so.client.aai.entities.uri.AAIResourceUri
 
  47 import org.onap.so.client.aai.entities.uri.AAIUriFactory
 
  48 import org.slf4j.Logger
 
  49 import org.slf4j.LoggerFactory
 
  52  * This groovy class supports the <class>Delete3rdONAPE2EServiceInstance.bpmn</class> process.
 
  53  * flow for Delete 3rdONAPE2EServiceInstance in 3rdONAP
 
  55 public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcessor {
 
  57         String Prefix = "CRE3rdONAPESI_"
 
  59         ExceptionUtil exceptionUtil = new ExceptionUtil()
 
  61         JsonUtils jsonUtil = new JsonUtils()
 
  63     private static final Logger logger = LoggerFactory.getLogger( Delete3rdONAPE2EServiceInstance.class)
 
  65         public void checkSPPartnerInfoFromAAI (DelegateExecution execution) {
 
  66                 logger.info(" ***** Started checkSPPartnerInfo *****")
 
  68                         //get bpmn inputs from resource request.
 
  69                         String requestId = execution.getVariable("mso-request-id")
 
  70                         String requestAction = execution.getVariable("requestAction")
 
  71                         logger.info("The requestAction is: " + requestAction)
 
  72                         String recipeParamsFromRequest = execution.getVariable("recipeParams")
 
  73                         logger.info("The recipeParams is: " + recipeParamsFromRequest)
 
  74                         String resourceInput = execution.getVariable("resourceInput")
 
  75                         logger.info("The resourceInput is: " + resourceInput)
 
  76                         //Get ResourceInput Object
 
  77                         ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class)
 
  78                         // set local resourceInput
 
  79                         execution.setVariable(Prefix + "ResourceInput", resourceInputObj)
 
  81                         String resourceInstanceId = resourceInputObj.getResourceInstancenUuid()
 
  82                         String sppartnerId = resourceInstanceId
 
  83                         execution.setVariable(Prefix + "SppartnerId", sppartnerId)
 
  85                         // Get Sppartner from AAI
 
  86                         getSPPartnerInAAI(execution)
 
  88                         String callSource = "UUI"
 
  89                         String sppartnerUrl = ""
 
  90                         if(execution.hasVariable(Prefix + "CallSource")) {
 
  91                                 callSource = execution.getVariable(Prefix + "CallSource")
 
  92                                 sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl")
 
  95                         boolean is3rdONAPExist = false
 
  96                         if(!isBlank(sppartnerUrl)) {
 
 100                         execution.setVariable("Is3rdONAPExist", is3rdONAPExist)
 
 101                         execution.setVariable(Prefix + "ServiceInstanceId", resourceInputObj.getServiceInstanceId())
 
 102                         execution.setVariable("mso-request-id", requestId)
 
 103                         execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId())
 
 105                 } catch (Exception ex){
 
 106                         String msg = "Exception in checkSPPartnerInfoFromAAI " + ex.getMessage()
 
 108 //                      exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
 
 112         public void checkLocallCall (DelegateExecution execution) {
 
 113                 logger.info(" ***** Started checkLocallCall *****")
 
 115                 boolean isLocalCall = true
 
 116                 String callSource = execution.getVariable(Prefix + "CallSource")
 
 117                 if("ExternalAPI".equalsIgnoreCase(callSource)) {
 
 120                 execution.setVariable("IsLocalCall", isLocalCall)
 
 123         public void preProcessRequest(DelegateExecution execution){
 
 124                 logger.info(" ***** Started preProcessRequest *****")
 
 128                         ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput")
 
 130                         String globalSubscriberId = resourceInputObj.getGlobalSubscriberId()
 
 131                         if (isBlank(globalSubscriberId)) {
 
 132                                 msg = "Input globalSubscriberId is null"
 
 136                         execution.setVariable("globalSubscriberId", globalSubscriberId)
 
 137                         logger.info( "globalSubscriberId:" + globalSubscriberId)
 
 139                         String serviceType = resourceInputObj.getServiceType()
 
 140                         if (isBlank(serviceType)) {
 
 141                                 msg = "Input serviceType is null"
 
 144                         execution.setVariable("serviceType", serviceType)
 
 145                         logger.info( "serviceType:" + serviceType)
 
 147                         String operationId = resourceInputObj.getOperationId()
 
 148                         if (isBlank(operationId)) {
 
 149                                 msg = "Input operationId is null"
 
 152                         execution.setVariable("operationId", operationId)
 
 153                         logger.info( "operationId:" + operationId)
 
 155                         String resourceName = resourceInputObj.getResourceInstanceName()
 
 156                         if (isBlank(resourceName)) {
 
 157                                 msg = "Input resourceName is null"
 
 160                         execution.setVariable("resourceName", resourceName)
 
 161                         logger.info("resourceName:" + resourceName)
 
 163                         String resourceTemplateId = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
 
 164                         if (isBlank(resourceTemplateId)) {
 
 165                                 msg = "Input resourceTemplateId is null"
 
 168                         execution.setVariable("resourceTemplateId", resourceTemplateId)
 
 169                         logger.info( "resourceTemplateId:" + resourceTemplateId)
 
 171                 } catch (Exception ex){
 
 172                         msg = "Exception in preProcessRequest " + ex.getMessage()
 
 174 //                      exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
 
 178         public void prepareUpdateProgress(DelegateExecution execution) {
 
 179                 logger.info(" ***** Started prepareUpdateProgress *****")
 
 180                 ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput")
 
 181                 String operType = resourceInputObj.getOperationType()
 
 182                 String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
 
 183                 String ServiceInstanceId = resourceInputObj.getServiceInstanceId()
 
 184                 String modelName = resourceInputObj.getResourceModelInfo().getModelName()
 
 185                 String operationId = resourceInputObj.getOperationId()
 
 186                 String progress = execution.getVariable("progress")
 
 187                 String status = execution.getVariable("status")
 
 188                 String statusDescription = execution.getVariable("statusDescription")
 
 191                 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
 
 192                         xmlns:ns="http://org.onap.so/requestsdb">
 
 195                     <ns:updateResourceOperationStatus>
 
 196                                <operType>${operType}</operType>
 
 197                                <operationId>${operationId}</operationId>
 
 198                                <progress>${progress}</progress>
 
 199                                <resourceTemplateUUID>${resourceCustomizationUuid}</resourceTemplateUUID>
 
 200                                <serviceId>${ServiceInstanceId}</serviceId>
 
 201                                <status>${status}</status>
 
 202                                <statusDescription>${statusDescription}</statusDescription>
 
 203                     </ns:updateResourceOperationStatus>
 
 205                 </soapenv:Envelope>"""
 
 207                 setProgressUpdateVariables(execution, body)
 
 208                 logger.info(" ***** End prepareUpdateProgress *****")
 
 211         public void prepare3rdONAPRequest(DelegateExecution execution) {
 
 212                 logger.info(" ***** Started prepare3rdONAPRequest *****")
 
 214                 String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl")
 
 215                 String extAPIPath = sppartnerUrl + '/serviceOrder'
 
 216                 execution.setVariable("ExternalAPIURL", extAPIPath)
 
 218                 // ExternalAPI message format
 
 219                 String externalId = execution.getVariable("resourceName")
 
 220                 String serviceType = execution.getVariable("serviceType")
 
 221                 String category = "E2E Service"
 
 222                 String description = "Service Order from SPPartner"
 
 223                 String requestedStartDate = utils.generateCurrentTimeInUtc()
 
 224                 String requestedCompletionDate = utils.generateCurrentTimeInUtc()
 
 225                 String priority = "1" // 0-4 0:highest
 
 226                 String subscriberId = execution.getVariable("globalSubscriberId")
 
 227                 String customerRole = "ONAPcustomer"
 
 228                 // Below SO will pass serviceType as subscriberName and externalAPI will use
 
 229                 // the same serviceType in another domain instead of model name
 
 230                 String subscriberName = serviceType
 
 231                 String referredType = "Consumer"
 
 232                 String orderItemId = "1"
 
 233                 String action = "delete" //for delete
 
 234                 String serviceState = "active"
 
 235                 String serviceName = ""
 
 236                 String serviceId = execution.getVariable(Prefix + "SppartnerId")
 
 238                 queryServicefrom3rdONAP(execution)
 
 239                 String serviceSpecificationId = execution.getVariable(Prefix + "ServiceSpecificationId")
 
 241                 Map<String, String> valueMap = new HashMap<>()
 
 242                 valueMap.put("externalId", '"' + externalId + '"')
 
 243                 valueMap.put("category", '"' + category + '"')
 
 244                 valueMap.put("description", '"' + description + '"')
 
 245                 valueMap.put("requestedStartDate", '"' + requestedStartDate + '"')
 
 246                 valueMap.put("requestedCompletionDate", '"' + requestedCompletionDate + '"')
 
 247                 valueMap.put("priority", '"'+ priority + '"')
 
 248                 valueMap.put("subscriberId", '"' + subscriberId + '"')
 
 249                 valueMap.put("customerRole", '"' + customerRole + '"')
 
 250                 valueMap.put("subscriberName", '"' + subscriberName + '"')
 
 251                 valueMap.put("referredType", '"' + referredType + '"')
 
 252                 valueMap.put("orderItemId", '"' + orderItemId + '"')
 
 253                 valueMap.put("action", '"' + action + '"')
 
 254                 valueMap.put("serviceState", '"' + serviceState + '"')
 
 255                 valueMap.put("serviceId", '"' + serviceId + '"')
 
 256                 valueMap.put("serviceName", "null")
 
 257                 valueMap.put("serviceUuId", '"' + serviceSpecificationId + '"')
 
 259                 ExternalAPIUtil externalAPIUtil = new ExternalAPIUtilFactory().create()
 
 261                 valueMap.put("_requestInputs_",  "")
 
 263                 String payload = externalAPIUtil.setTemplate(ExternalAPIUtil.PostServiceOrderRequestsTemplate, valueMap)
 
 264                 execution.setVariable(Prefix + "Payload", payload)
 
 265                 logger.info( "***** Exit prepare3rdONAPRequest *****")
 
 268         private void queryServicefrom3rdONAP(DelegateExecution execution)
 
 270                 logger.info(" ***** Started queryServicefrom3rdONAP *****")
 
 273                 String globalSubscriberId = execution.getVariable("globalSubscriberId")
 
 274                 String SppartnerServiceId = execution.getVariable(Prefix + "SppartnerId")
 
 276                 //https://{api_url}/nbi/api/v1/service?relatedParty.id=${globalSubscriberId}
 
 277                 String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl")
 
 278                 String extAPIPath = sppartnerUrl + "/service?relatedParty.id=" + globalSubscriberId
 
 279                 logger.debug("queryServicefrom3rdONAP externalAPIURL is: " + extAPIPath)
 
 281                 ExternalAPIUtil externalAPIUtil = new ExternalAPIUtilFactory().create()
 
 283                 Response response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath)
 
 285                 int responseCode = response.getStatus()
 
 286                 execution.setVariable(Prefix + "GetServiceResponseCode", responseCode)
 
 287                 logger.debug("Get Service response code is: " + responseCode)
 
 289                 String extApiResponse = response.readEntity(String.class)
 
 291                 execution.setVariable(Prefix + "GetServiceResponse", extApiResponse)
 
 292                 logger.debug("queryServicefrom3rdONAP response body is: " + extApiResponse)
 
 294                 //Process Response //200 OK 201 CREATED 202 ACCEPTED
 
 295                 if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
 
 297                         logger.debug("Get Service Received a Good Response")
 
 298                         JSONArray responseList = new JSONArray(extApiResponse)
 
 299                         for(int i=0; i< responseList.length(); i++) {
 
 300                                 JSONObject obj = responseList.getJSONObject(i)
 
 301                                 String svcId  = obj.get("id")
 
 302                                 if(StringUtils.equalsIgnoreCase(SppartnerServiceId, svcId)) {
 
 303                                         JSONObject serviceSpecification = obj.get("serviceSpecification")
 
 304                                         String serviceUuid = serviceSpecification.get("id")
 
 305                                         execution.setVariable(Prefix + "ServiceSpecificationId", serviceUuid)
 
 311                         logger.error("Get Service Received a Bad Response Code. Response Code is: " + responseCode)
 
 312 //                      exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get Service Received a bad response from 3rdONAP External API")
 
 314         }catch(Exception e) {
 
 315             logger.error("queryServicefrom3rdONAP exception:" + e.getMessage())
 
 317                 logger.info( "***** Exit queryServicefrom3rdONAP *****")
 
 320         public void doDeleteE2ESIin3rdONAP(DelegateExecution execution) {
 
 321                 logger.info(" ***** Started doDeleteE2ESIin3rdONAP *****")
 
 323                 String extAPIPath = execution.getVariable("ExternalAPIURL")
 
 324                 String payload = execution.getVariable(Prefix + "Payload")
 
 325                 logger.debug("doDeleteE2ESIin3rdONAP externalAPIURL is: " + extAPIPath)
 
 326                 logger.debug("doDeleteE2ESIin3rdONAP payload is: " + payload)
 
 328                 ExternalAPIUtil externalAPIUtil = new ExternalAPIUtilFactory().create()
 
 329                 execution.setVariable("ServiceOrderId", "")
 
 331                 Response response = externalAPIUtil.executeExternalAPIPostCall(execution, extAPIPath, payload)
 
 333                 int responseCode = response.getStatus()
 
 334                 execution.setVariable(Prefix + "PostServiceOrderResponseCode", responseCode)
 
 335                 logger.debug("Post ServiceOrder response code is: " + responseCode)
 
 337                 String extApiResponse = response.readEntity(String.class)
 
 338                 JSONObject responseObj = new JSONObject(extApiResponse)
 
 339                 execution.setVariable(Prefix + "PostServiceOrderResponse", extApiResponse)
 
 341                 logger.debug("doDeleteE2ESIin3rdONAP response body is: " + extApiResponse)
 
 344                 if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
 
 345                         //200 OK 201 CREATED 202 ACCEPTED
 
 347                         logger.debug("Post ServiceOrder Received a Good Response")
 
 348                         String serviceOrderId = responseObj.get("id")
 
 349                         execution.setVariable(Prefix + "SuccessIndicator", true)
 
 350                         execution.setVariable("ServiceOrderId", serviceOrderId)
 
 351                         logger.info("Post ServiceOrderid is: " + serviceOrderId)
 
 354                         logger.error("Post ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode)
 
 355 //                      exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Post ServiceOrder Received a bad response from 3rdONAP External API")
 
 357                 }catch(Exception e) {
 
 358                         logger.error("doDeleteE2ESIin3rdONAP exception:" + e.getMessage())
 
 360                 logger.info( "***** Exit doDeleteE2ESIin3rdONAP *****")
 
 364         public void getE2ESIProgressin3rdONAP(DelegateExecution execution) {
 
 365                 logger.info(" ***** Started getE2ESIProgressin3rdONAP *****")
 
 368                 String extAPIPath = execution.getVariable("ExternalAPIURL")
 
 369                 extAPIPath += "/" + execution.getVariable("ServiceOrderId")
 
 370                 logger.debug("getE2ESIProgressin3rdONAP delete externalAPIURL is: " + extAPIPath)
 
 372                 ExternalAPIUtil externalAPIUtil = new ExternalAPIUtilFactory().create()
 
 374                 Response response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath)
 
 376                 int responseCode = response.getStatus()
 
 377                 execution.setVariable(Prefix + "GetServiceOrderResponseCode", responseCode)
 
 378                 logger.debug("Get ServiceOrder response code is: " + responseCode)
 
 380                 String extApiResponse = response.readEntity(String.class)
 
 381                 JSONObject responseObj = new JSONObject(extApiResponse)
 
 382                 execution.setVariable(Prefix + "GetServiceOrderResponse", extApiResponse)
 
 384                 logger.debug( "getE2ESIProgressin3rdONAP delete response body is: " + extApiResponse)
 
 386                 //Process Response //200 OK 201 CREATED 202 ACCEPTED
 
 387                 if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
 
 389                         logger.debug("Get ServiceOrder Received a Good Response")
 
 391                         String orderState = responseObj.get("state")
 
 392                         if("REJECTED".equalsIgnoreCase(orderState)) {
 
 393                                 execution.setVariable("progress", 100)
 
 394                                 execution.setVariable("status", "error")
 
 395                                 execution.setVariable("statusDescription", "Delete Service Order Status is REJECTED")
 
 399                         JSONArray items = responseObj.getJSONArray("orderItem")
 
 400                         JSONObject item = items[0]
 
 401                         JSONObject service = item.get("service")
 
 402                         String sppartnerServiceId = service.get("id")
 
 403                         if(sppartnerServiceId == null || sppartnerServiceId.equals("null")) {
 
 404                                 execution.setVariable("progress", 100)
 
 405                                 execution.setVariable("status", "error")
 
 406                                 execution.setVariable("statusDescription", "Delete Service Order Status get null sppartnerServiceId")
 
 407                                 logger.error("null sppartnerServiceId while getting progress from externalAPI")
 
 410                         execution.setVariable(Prefix + "SppartnerServiceId", sppartnerServiceId)
 
 412                         String serviceOrderState = item.get("state")
 
 413                         execution.setVariable(Prefix + "SuccessIndicator", true)
 
 414                         execution.setVariable("ServiceOrderState", serviceOrderState)
 
 416                         // Get serviceOrder State and process progress
 
 417                         if("ACKNOWLEDGED".equalsIgnoreCase(serviceOrderState)) {
 
 418                                 execution.setVariable("progress", 15)
 
 419                                 execution.setVariable("status", "processing")
 
 420                                 execution.setVariable("statusDescription", "Delete Service Order Status is " + serviceOrderState)
 
 422                         else if("INPROGRESS".equalsIgnoreCase(serviceOrderState)) {
 
 423                                 execution.setVariable("progress", 40)
 
 424                                 execution.setVariable("status", "processing")
 
 425                                 execution.setVariable("statusDescription", "Delete Service Order Status is " + serviceOrderState)
 
 427                         else if("COMPLETED".equalsIgnoreCase(serviceOrderState)) {
 
 428                                 execution.setVariable("progress", 100)
 
 429                                 execution.setVariable("status", "finished")
 
 430                                 execution.setVariable("statusDescription", "Delete Service Order Status is " + serviceOrderState)
 
 432                         else if("FAILED".equalsIgnoreCase(serviceOrderState)) {
 
 433                                 execution.setVariable("progress", 100)
 
 434                                 execution.setVariable("status", "error")
 
 435                                 execution.setVariable("statusDescription", "Delete Service Order Status is " + serviceOrderState)
 
 438                                 execution.setVariable("progress", 100)
 
 439                                 execution.setVariable("status", "error")
 
 440                                 execution.setVariable("statusDescription", "Delete Service Order Status is unknown")
 
 444                         logger.debug("Get ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode)
 
 445                         execution.setVariable("progress", 100)
 
 446                         execution.setVariable("status", "error")
 
 447                         execution.setVariable("statusDescription", "Get Delete ServiceOrder Received a bad response")
 
 448 //                      exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get Delete ServiceOrder Received a bad response from 3rdONAP External API")
 
 450         }catch(Exception e) {
 
 451             execution.setVariable("progress", 100)
 
 452             execution.setVariable("status", "error")
 
 453             execution.setVariable("statusDescription", "Get Delete ServiceOrder Exception")
 
 454             logger.error("getE2ESIProgressin3rdONAP exception:" + e.getMessage())
 
 456                 logger.info( "***** Exit getE2ESIProgressin3rdONAP *****")
 
 462         public void timeDelay(DelegateExecution execution) {
 
 465                 } catch(InterruptedException e) {
 
 466                         logger.error("Time Delay exception" + e )
 
 470         private void getSPPartnerInAAI(DelegateExecution execution) {
 
 471                 logger.info(" ***** Started getSPPartnerInAAI *****")
 
 473                 String id = execution.getVariable(Prefix + "SppartnerId")
 
 475                 AAIResourcesClient client = new AAIResourcesClient()
 
 476                 AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SP_PARTNER, id)
 
 477                 SpPartner sp = client.get(uri).asBean(SpPartner.class).get()
 
 479                 logger.debug("GET sppartner Received a Good Response")
 
 480                 execution.setVariable(Prefix + "SuccessIndicator", true)
 
 481                 execution.setVariable(Prefix + "FoundIndicator", true)
 
 483 //              String sppartnerId = sp.getSpPartnerId()
 
 484 //              execution.setVariable(Prefix + "SppartnerId", sppartnerId)
 
 485 //              logger.debug(" SppartnerId is: " + sppartnerId)
 
 486                 String sppartnerUrl = sp.getUrl()
 
 487                 execution.setVariable(Prefix + "SppartnerUrl", sppartnerUrl)
 
 488                 logger.debug(" SppartnerUrl is: " + sppartnerUrl)
 
 489                 String callSource = sp.getCallsource()
 
 490                 execution.setVariable(Prefix + "CallSource", callSource)
 
 491                 logger.debug(" CallSource is: " + callSource)
 
 492                 String sppartnerVersion = sp.getResourceVersion()
 
 493                 execution.setVariable(Prefix + "SppartnerVersion", sppartnerVersion)
 
 494                 logger.debug(" Resource Version is: " + sppartnerVersion)
 
 495         } catch (Exception ex) {
 
 496             String msg = "Exception in Delete3rdONAPE2EServiceInstance.saveSPPartnerInAAI. " + ex.getMessage()
 
 498 //            throw new BpmnError("MSOWorkflowException")
 
 501                 logger.info( "***** Exit getSPPartnerInAAI *****")
 
 504         public void deleteSPPartnerInAAI(DelegateExecution execution) {
 
 505                 logger.info(" ***** Started deleteSPPartnerInAAI *****")
 
 508                 String sppartnerId = execution.getVariable(Prefix + "SppartnerId")
 
 510                 AAIResourcesClient client = new AAIResourcesClient()
 
 511                 AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SP_PARTNER, sppartnerId)
 
 513                 logger.debug("Delete sppartner Received a Good Response")
 
 514                 execution.setVariable(Prefix + "SuccessIndicator", true)
 
 515         } catch (Exception ex) {
 
 516             String msg = "Exception in Delete3rdONAPE2EServiceInstance.deleteSPPartnerInAAI. " + ex.getMessage()
 
 518 //            throw new BpmnError("MSOWorkflowException")
 
 522                 logger.info( "**** Exit deleteSPPartnerInAAI ****")
 
 525         private void setProgressUpdateVariables(DelegateExecution execution, String body) {
 
 526                 def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
 
 527                 execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
 
 528                 execution.setVariable("CVFMI_updateResOperStatusRequest", body)
 
 531         public void postProcess(DelegateExecution execution){
 
 532                 logger.info(" ***** Started postProcess *****")
 
 533                 String responseCode = execution.getVariable(Prefix + "PutSppartnerResponseCode")
 
 534                 String responseObj = execution.getVariable(Prefix + "PutSppartnerResponse")
 
 536                 logger.info("response from AAI for put sppartner, response code :" + responseCode + "  response object :" + responseObj)
 
 537                 logger.info(" ***** Exit postProcess *****")
 
 540         public void sendSyncResponse (DelegateExecution execution) {
 
 541                 logger.debug(" *** sendSyncResponse *** ")
 
 544                         String operationStatus = "finished"
 
 545                         // RESTResponse for main flow
 
 546                         String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()
 
 547                         logger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
 
 548                         sendWorkflowResponse(execution, 202, resourceOperationResp)
 
 549                         execution.setVariable("sentSyncResponse", true)
 
 551                 } catch (Exception ex) {
 
 552                         String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
 
 554 //                      exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
 
 556                 logger.debug(" ***** Exit sendSyncResopnse *****")