2  * ============LICENSE_START=======================================================
 
   4  * ================================================================================
 
   5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
 
   6  * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
 
   7  * ================================================================================
 
   8  * Modifications Copyright (c) 2019 Samsung
 
   9  * ================================================================================
 
  10  * Licensed under the Apache License, Version 2.0 (the "License");
 
  11  * you may not use this file except in compliance with the License.
 
  12  * You may obtain a copy of the License at
 
  14  *      http://www.apache.org/licenses/LICENSE-2.0
 
  16  * Unless required by applicable law or agreed to in writing, software
 
  17  * distributed under the License is distributed on an "AS IS" BASIS,
 
  18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  19  * See the License for the specific language governing permissions and
 
  20  * limitations under the License.
 
  21  * ============LICENSE_END=========================================================
 
  23 package org.onap.so.bpmn.infrastructure.scripts
 
  25 import org.onap.so.logger.LoggingAnchor
 
  26 import org.onap.aai.domain.yang.AllottedResource
 
  27 import org.onap.logging.filter.base.ErrorCode
 
  29 import javax.ws.rs.core.UriBuilder
 
  31 import static org.apache.commons.lang3.StringUtils.*;
 
  33 import org.apache.commons.lang3.*
 
  34 import org.camunda.bpm.engine.delegate.BpmnError
 
  35 import org.camunda.bpm.engine.delegate.DelegateExecution
 
  36 import org.json.JSONArray
 
  37 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
 
  38 import org.onap.so.bpmn.common.scripts.ExceptionUtil
 
  39 import org.onap.so.bpmn.common.scripts.MsoUtils
 
  40 import org.onap.so.bpmn.core.json.JsonUtils
 
  41 import org.onap.so.bpmn.core.UrnPropertiesReader
 
  42 import org.onap.so.logger.MessageEnum
 
  43 import org.slf4j.Logger
 
  44 import org.slf4j.LoggerFactory
 
  46 import org.springframework.web.util.UriUtils;
 
  47 import org.onap.aaiclient.client.aai.AAIResourcesClient
 
  48 import org.onap.aaiclient.client.aai.AAIObjectType
 
  49 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 
  50 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
 
  51 import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
 
  52 import org.json.JSONObject
 
  53 import javax.ws.rs.NotFoundException
 
  59  * This groovy class supports the <class>DoDeleteE2EServiceInstance.bpmn</class> process.
 
  62  * @param - msoRequestId
 
  63  * @param - globalSubscriberId - O
 
  64  * @param - subscriptionServiceType - O
 
  65  * @param - serviceInstanceId
 
  66  * @param - serviceInstanceName - O
 
  67  * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM)
 
  68  * @param - sdncVersion
 
  69  * @param - failNotFound - TODO
 
  70  * @param - serviceInputParams - TODO
 
  73  * @param - WorkflowException
 
  77 public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProcessor {
 
  78     private static final Logger logger = LoggerFactory.getLogger( DoCustomDeleteE2EServiceInstanceV2.class);
 
  81         String Prefix="DDELSI_"
 
  82         private static final String DebugFlag = "isDebugEnabled"
 
  83         ExceptionUtil exceptionUtil = new ExceptionUtil()
 
  84         JsonUtils jsonUtil = new JsonUtils()
 
  86         public void preProcessRequest (DelegateExecution execution) {
 
  88                 def method = getClass().getSimpleName() + '.buildAPPCRequest(' +'execution=' + execution.getId() +')'
 
  89                 logger.info("Entered " + method)
 
  90                 logger.trace("preProcessRequest ")
 
  94                         String requestId = execution.getVariable("msoRequestId")
 
  95                         execution.setVariable("prefix",Prefix)
 
  98                         //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology
 
  99                         String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId
 
 100                         if (globalSubscriberId == null)
 
 102                                 execution.setVariable("globalSubscriberId", "")
 
 105                         //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology
 
 106                         String serviceType = execution.getVariable("serviceType")
 
 107                         if (serviceType == null)
 
 109                                 execution.setVariable("serviceType", "")
 
 112                         //Generated in parent for AAI PUT
 
 113                         String serviceInstanceId = execution.getVariable("serviceInstanceId")
 
 114                         if (isBlank(serviceInstanceId)){
 
 115                                 msg = "Input serviceInstanceId is null"
 
 117                                 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
 
 120                         String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback')
 
 121                         if (isBlank(sdncCallbackUrl)) {
 
 122                                 msg = "URN_mso_workflow_sdncadapter_callback is null"
 
 124                                 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
 
 126                         execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
 
 127                         logger.info("SDNC Callback URL: " + sdncCallbackUrl)
 
 129                         StringBuilder sbParams = new StringBuilder()
 
 130                         Map<String, String> paramsMap = execution.getVariable("serviceInputParams")
 
 131                         if (paramsMap != null)
 
 133                                 sbParams.append("<service-input-parameters>")
 
 134                                 for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
 
 136                                         String paramName = entry.getKey()
 
 137                                         String paramValue = entry.getValue()
 
 140                                                         <name>${MsoUtils.xmlEscape(paramName)}</name>
 
 141                                                         <value>${MsoUtils.xmlEscape(paramValue)}</value>
 
 144                                         sbParams.append(paramsXml)
 
 146                                 sbParams.append("</service-input-parameters>")
 
 148                         String siParamsXml = sbParams.toString()
 
 149                         if (siParamsXml == null)
 
 151                         execution.setVariable("siParamsXml", siParamsXml)
 
 152                         execution.setVariable("operationStatus", "Waiting delete resource...")
 
 153                         execution.setVariable("progress", "0")
 
 155                 } catch (BpmnError e) {
 
 157                 } catch (Exception ex){
 
 158                         msg = "Exception in preProcessRequest " + ex.getMessage()
 
 160                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
 
 162                 logger.info("Exited " + method)
 
 166          * Gets the service instance and its relationships from aai
 
 170         public void getServiceInstance(DelegateExecution execution) {
 
 172                         String serviceInstanceId = execution.getVariable('serviceInstanceId')
 
 173                         String globalSubscriberId = execution.getVariable('globalSubscriberId')
 
 174                         String serviceType = execution.getVariable('serviceType')
 
 176                         AAIResourcesClient resourceClient = new AAIResourcesClient()
 
 177                         AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId)
 
 178                         AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class)
 
 179                         String json = wrapper.getJson()
 
 181                         execution.setVariable("serviceInstance", json)
 
 183                 }catch(BpmnError e) {
 
 185                 }catch(NotFoundException e) {
 
 186                         logger.info("SI not found in aai. Silent Success ")
 
 187                 }catch(Exception ex) {
 
 188                         String msg = "Internal Error in getServiceInstance: " + ex.getMessage()
 
 189                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
 
 193         private void loadResourcesProperties(DelegateExecution execution) {
 
 194                 def method = getClass().getSimpleName() + '.loadResourcesProperties(' +'execution=' + execution.getId() +')'
 
 195                 def isDebugEnabled = execution.getVariable("isDebugEnabled")
 
 196                 logger.info("Entered " + method)
 
 197                 String loadFilePath = "/etc/mso/config.d/reources.json"
 
 199                         def jsonPayload = new File(loadFilePath).text
 
 200                         logger.info("jsonPayload: " + jsonPayload)
 
 202                         String resourcesProperties = jsonUtil.prettyJson(jsonPayload.toString())
 
 203                         logger.info("resourcesProperties: " + resourcesProperties)
 
 205                         String createResourceSort = jsonUtil.getJsonValue(resourcesProperties, "CreateResourceSort")
 
 206                         logger.info("createResourceSort: " + createResourceSort)
 
 207                         execution.setVariable("createResourceSort", createResourceSort)
 
 209                         String deleteResourceSort = jsonUtil.getJsonValue(resourcesProperties, "DeleteResourceSort")
 
 210                         logger.info("deleteResourceSort: " + deleteResourceSort)
 
 211                         execution.setVariable("deleteResourceSort", deleteResourceSort)
 
 214                         String resourceControllerType = jsonUtil.getJsonValue(resourcesProperties, "ResourceControllerType")
 
 215                         logger.info("resourceControllerType: " + resourceControllerType)
 
 216                         execution.setVariable("resourceControllerType", resourceControllerType)
 
 219                 }catch(Exception ex){
 
 220             // try error in method block
 
 221                         String exceptionMessage = "Bpmn error encountered in " + method + " - " + ex.getMessage()
 
 222                         logger.debug(exceptionMessage)
 
 223                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
 
 225             logger.info("Exited " + method)
 
 227         private void sortDeleteResource(DelegateExecution execution) {
 
 228                 def method = getClass().getSimpleName() + '.sortDeleteResource(' +'execution=' + execution.getId() +')'
 
 229                 def isDebugEnabled = execution.getVariable("isDebugEnabled")
 
 230                 logger.info("Entered " + method)
 
 231                 String deleteResourceSortDef = """[
 
 233                     "resourceType":"GRE_SAR"
 
 236                     "resourceType":"VPN_SAR"
 
 239                     "resourceType":"APN_AAR"
 
 242                     "resourceType":"GRE_AAR"
 
 245                     "resourceType":"Overlay"
 
 248                     "resourceType":"Underlay"
 
 251                     "resourceType":"vIMS"
 
 254                     "resourceType":"vCPE"
 
 260                     "resourceType":"vEPC"
 
 267                         loadResourcesProperties(execution)
 
 268                         String deleteResourceSort = execution.getVariable("deleteResourceSort")
 
 269                         if (isBlank(deleteResourceSort)) {
 
 270                                 deleteResourceSort = deleteResourceSortDef;
 
 273                         List<String> sortResourceList = jsonUtil.StringArrayToList(execution, deleteResourceSort)
 
 274                 logger.info("sortResourceList : " + sortResourceList)
 
 276                         JSONArray newResourceList      = new JSONArray()
 
 277                         int resSortCount = sortResourceList.size()
 
 279                         for ( int currentResource = 0 ; currentResource < resSortCount ; currentResource++ ) {
 
 280                                 String currentSortResource = sortResourceList[currentResource]
 
 281                                 String sortResourceType = jsonUtil.getJsonValue(currentSortResource, "resourceType")
 
 282                                 List<String> resourceList = execution.getVariable(Prefix+"resourceList")
 
 284                                 for (String resource : resourceList) {
 
 285                                         logger.info("resource : " + resource)
 
 286                                         String resourceType = jsonUtil.getJsonValue(resource, "resourceType")
 
 288                                         if (StringUtils.containsIgnoreCase(resourceType, sortResourceType)) {
 
 289                                                 JSONObject jsonObj = new JSONObject(resource)
 
 290                                                 newResourceList.put(jsonObj)
 
 292                                         logger.info("Get next sort type " )
 
 296             String newResourceStr = newResourceList.toString()
 
 297             List<String> newResourceListStr = jsonUtil.StringArrayToList(execution, newResourceStr)
 
 299                         execution.setVariable(Prefix+"resourceList", newResourceListStr)
 
 300                         logger.info("newResourceList : " + newResourceListStr)
 
 302                 }catch(Exception ex){
 
 303             // try error in method block
 
 304                         String exceptionMessage = "Bpmn error encountered in " + method + " - " + ex.getMessage()
 
 305                         logger.debug(exceptionMessage)
 
 306                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
 
 308             logger.info("Exited " + method)
 
 311         public void prepareServiceDeleteResource(DelegateExecution execution) {
 
 312                 def method = getClass().getSimpleName() + '.prepareServiceDeleteResource(' +'execution=' + execution.getId() +')'
 
 313                 logger.info("Entered " + method)
 
 317                         String serviceInstanceId = execution.getVariable("serviceInstanceId")
 
 320                         execution.setVariable(Prefix+"resourceList", "")
 
 321                         execution.setVariable(Prefix+"resourceCount", 0)
 
 322                         execution.setVariable(Prefix+"nextResource", 0)
 
 323                         execution.setVariable(Prefix+"resourceFinish", true)
 
 325                         String aaiJsonRecord = execution.getVariable("serviceInstance");
 
 326                         logger.info("serviceInstanceAaiRecord: " +aaiJsonRecord)
 
 328                         logger.info("aaiJsonRecord: " +aaiJsonRecord)
 
 329                         def serviceInstanceName = jsonUtil.getJsonValue(aaiJsonRecord, "service-instance.service-instance-name")
 
 330                         execution.setVariable("serviceInstanceName",serviceInstanceName)
 
 332                         def serviceType = jsonUtil.getJsonValue(aaiJsonRecord, "service-instance.service-type")
 
 333                         execution.setVariable("serviceType",serviceType)
 
 336                         String relationshipList = jsonUtil.getJsonValue(aaiJsonRecord, "service-instance.relationship-list")
 
 337                         logger.info("relationship-list:" + relationshipList)
 
 338                         if (! isBlank(relationshipList)){
 
 339                                 logger.info("relationship-list exists" )
 
 340                                 String relationShip = jsonUtil.getJsonValue(relationshipList, "relationship")
 
 341                                 logger.info("relationship: " + relationShip)
 
 342                                 JSONArray allResources      = new JSONArray()
 
 343                                 JSONArray serviceResources  = new JSONArray()
 
 344                                 JSONArray networkResources  = new JSONArray()
 
 345                                 JSONArray allottedResources = new JSONArray()
 
 348                                 if (! isBlank(relationShip)){
 
 349                                         JSONArray jsonArray = new JSONArray();
 
 350                                         if (relationShip.startsWith("{") && relationShip.endsWith("}")) {
 
 351                                                 JSONObject jsonObject = new JSONObject(relationShip);
 
 352                                                 jsonArray.put(jsonObject);
 
 353                                         } else if (relationShip.startsWith("[") && relationShip.endsWith("]")) {
 
 354                                                 jsonArray = new JSONArray(relationShip);
 
 356                                                 logger.info("The relationShip fomart is error" )
 
 359                                         List<String> relationList = jsonUtil.StringArrayToList(execution, jsonArray.toString())
 
 361                                         logger.info("relationList: " + relationList)
 
 363                                         int relationNum =relationList.size()
 
 364                                         logger.info("**************relationList size: " + relationNum)
 
 366                                         for ( int currentRelation = 0 ; currentRelation < relationNum ; currentRelation++ ) {
 
 367                                                 logger.info("current Relation num: " + currentRelation)
 
 368                                                 String relation = relationList[currentRelation]
 
 369                                                 logger.info("relation: " + relation)
 
 371                                                 String relatedTo = jsonUtil.getJsonValue(relation, "related-to")
 
 372                                 logger.info("relatedTo: " + relatedTo)
 
 374                                                 String relatedLink = jsonUtil.getJsonValue(relation, "related-link")
 
 375                                                 logger.info("relatedLink: " + relatedLink)
 
 377                                 if (StringUtils.equalsIgnoreCase(relatedTo, "allotted-resource")) {
 
 378                                         logger.info("allotted-resource exists ")
 
 380                             Optional<AllottedResource>  aaiArRsp = getAaiAr(execution, relatedLink)
 
 381                                                         logger.info("aaiArRsp: " + aaiArRsp)
 
 382                                                         if (aaiArRsp.isPresent()) {
 
 384                                                                 JSONObject jObject = new JSONObject()
 
 385                                                                 jObject.put("resourceType", aaiArRsp.get().getType())
 
 386                                                                 jObject.put("resourceInstanceId", aaiArRsp.get().getId())
 
 387                                                                 jObject.put("resourceRole", aaiArRsp.get().getRole())
 
 388                                                                 jObject.put("resourceVersion", aaiArRsp.get().getResourceVersion())
 
 390                                                                 allResources.put(jObject)
 
 391                                                                 logger.info("allResources: " + allResources)
 
 392                                                                 allottedResources.put(jObject)
 
 393                                                                 logger.info("allottedResources: " + allottedResources)
 
 396                                                 else if (StringUtils.equalsIgnoreCase(relatedTo, "service-instance")){
 
 397                                         logger.info("service-instance exists ")
 
 398                                                         JSONObject jObject = new JSONObject()
 
 401                                                         String rsDataStr  = jsonUtil.getJsonValue(relation, "relationship-data")
 
 402                                                         logger.info("rsDataStr: " + rsDataStr)
 
 403                                                         List<String> rsDataList = jsonUtil.StringArrayToList(execution, rsDataStr)
 
 404                                                         logger.info("rsDataList: " + rsDataList)
 
 405                                                         for(String rsData : rsDataList){
 
 406                                                                 logger.info("rsData: " + rsData)
 
 407                                                                 def eKey =  jsonUtil.getJsonValue(rsData, "relationship-key")
 
 408                                                                 def eValue = jsonUtil.getJsonValue(rsData, "relationship-value")
 
 409                                                                 if(eKey.equals("service-instance.service-instance-id")){
 
 410                                                                         jObject.put("resourceInstanceId", eValue)
 
 412                                                                 if(eKey.equals("service-subscription.service-type")){
 
 413                                                                         jObject.put("resourceType", eValue)
 
 417                                                         //related-to-property
 
 418                                                         String rPropertyStr  = jsonUtil.getJsonValue(relation, "related-to-property")
 
 419                                                         logger.info("related-to-property: " + rPropertyStr)
 
 420                                                         if (rPropertyStr instanceof JSONArray){
 
 421                                                                 List<String> rPropertyList = jsonUtil.StringArrayToList(execution, rPropertyStr)
 
 422                                                                 for (String rProperty : rPropertyList) {
 
 423                                                                         logger.info("rProperty: " + rProperty)
 
 424                                                                         def eKey =  jsonUtil.getJsonValue(rProperty, "property-key")
 
 425                                                                         def eValue = jsonUtil.getJsonValue(rProperty, "property-value")
 
 426                                                                         if(eKey.equals("service-instance.service-instance-name")){
 
 427                                                                                 jObject.put("resourceName", eValue)
 
 432                                                                 String rProperty = rPropertyStr
 
 433                                                                 logger.info("rProperty: " + rProperty)
 
 434                                                                 def eKey =  jsonUtil.getJsonValue(rProperty, "property-key")
 
 435                                                                 def eValue = jsonUtil.getJsonValue(rProperty, "property-value")
 
 436                                                                 if (eKey.equals("service-instance.service-instance-name")) {
 
 437                                                                         jObject.put("resourceName", eValue)
 
 441                                                         allResources.put(jObject)
 
 442                                                         logger.info("allResources: " + allResources)
 
 444                                                         serviceResources.put(jObject)
 
 445                                                         logger.info("serviceResources: " + serviceResources)
 
 447                                                 else if (StringUtils.equalsIgnoreCase(relatedTo, "configuration")) {
 
 448                                         logger.info("configuration ")
 
 449                                                         JSONObject jObject = new JSONObject()
 
 452                                                         String rsDataStr  = jsonUtil.getJsonValue(relation, "relationship-data")
 
 453                                                         logger.info("rsDataStr: " + rsDataStr)
 
 454                                                         List<String> rsDataList = jsonUtil.StringArrayToList(execution, rsDataStr)
 
 455                                                         logger.info("rsDataList: " + rsDataList)
 
 456                                                         for (String rsData : rsDataList) {
 
 457                                                                 logger.info("rsData: " + rsData)
 
 458                                                                 def eKey =  jsonUtil.getJsonValue(rsData, "relationship-key")
 
 459                                                                 def eValue = jsonUtil.getJsonValue(rsData, "relationship-value")
 
 460                                                                 if(eKey.equals("configuration.configuration-id")){
 
 461                                                                         jObject.put("resourceInstanceId", eValue)
 
 466                                                         //related-to-property
 
 467                                                         String rPropertyStr  = jsonUtil.getJsonValue(relation, "related-to-property")
 
 468                                                         logger.info("related-to-property: " + rPropertyStr)
 
 469                                                         if (rPropertyStr instanceof JSONArray){
 
 470                                                                 List<String> rPropertyList = jsonUtil.StringArrayToList(execution, rPropertyStr)
 
 471                                                                 for(String rProperty : rPropertyList){
 
 472                                                                         logger.info("rProperty: " + rProperty)
 
 473                                                                         def eKey =  jsonUtil.getJsonValue(rProperty, "property-key")
 
 474                                                                         def eValue = jsonUtil.getJsonValue(rProperty, "property-value")
 
 475                                                                         if(eKey.equals("configuration.configuration-type")){
 
 476                                                                                 jObject.put("resourceType", eValue)
 
 481                                                                 String rProperty = rPropertyStr
 
 482                                                                 logger.info("rProperty: " + rProperty)
 
 483                                                                 def eKey =  jsonUtil.getJsonValue(rProperty, "property-key")
 
 484                                                                 def eValue = jsonUtil.getJsonValue(rProperty, "property-value")
 
 485                                                                 if(eKey.equals("configuration.configuration-type")){
 
 486                                                                         jObject.put("resourceType", eValue)
 
 489                                                         allResources.put(jObject)
 
 490                                                         logger.info("allResources: " + allResources)
 
 492                                                         networkResources.put(jObject)
 
 493                                                         logger.info("networkResources: " + networkResources)
 
 495                                                 logger.info("Get Next releation resource " )
 
 498                                         logger.info("Get releation finished. " )
 
 501                                 execution.setVariable("serviceRelationShip", allResources.toString())
 
 502                             logger.info("allResources: " + allResources.toString())
 
 503                                 String serviceRelationShip = execution.getVariable("serviceRelationShip")
 
 504                                 logger.info("serviceRelationShip: " + serviceRelationShip)
 
 505                                 if ((! isBlank(serviceRelationShip)) && (! serviceRelationShip.isEmpty())) {
 
 507                                         List<String> relationShipList = jsonUtil.StringArrayToList(execution, serviceRelationShip)
 
 508                                         logger.info("relationShipList: " + relationShipList)
 
 509                                         execution.setVariable(Prefix+"resourceList", relationShipList)
 
 511                                         int resourceCount = relationShipList.size()
 
 512                                         logger.info("resourceCount: " + resourceCount)
 
 513                                         execution.setVariable(Prefix+"resourceCount",resourceCount )
 
 516                                         execution.setVariable(Prefix+"nextResource", resourceNum)
 
 517                                         logger.info("start sort delete resource: ")
 
 518                                         sortDeleteResource(execution)
 
 521                                         if (resourceNum < resourceCount) {
 
 522                                                 execution.setVariable(Prefix+"resourceFinish", false)
 
 525                                         execution.setVariable(Prefix+"resourceFinish", true)
 
 527                                         logger.info("Resource  list set end : " + resourceCount)
 
 530                                 execution.setVariable("serviceResources", serviceResources.toString())
 
 531                                 logger.info("serviceResources: " + serviceResources)
 
 532                                 String serviceResourcesShip = execution.getVariable("serviceResources")
 
 533                                 logger.info("serviceResourcesShip: " + serviceResourcesShip)
 
 535                                 if ((! isBlank(serviceResourcesShip)) && (! serviceResourcesShip.isEmpty())) {
 
 536                     List<String> serviceResourcesList = jsonUtil.StringArrayToList(execution, serviceResourcesShip)
 
 537                                         logger.info("serviceResourcesList: " + serviceResourcesList)
 
 538                                         execution.setVariable(Prefix+"serviceResourceList", serviceResourcesList)
 
 539                                 execution.setVariable(Prefix+"serviceResourceCount", serviceResourcesList.size())
 
 540                                 execution.setVariable(Prefix+"nextServiceResource", 0)
 
 541                                 logger.info("Service Resource  list set end : " + serviceResourcesList.size())
 
 545                                 execution.setVariable("allottedResources", allottedResources.toString())
 
 546                                 logger.info("allottedResources: " + allottedResources)
 
 547                                 String allottedResourcesShip = execution.getVariable("allottedResources")
 
 548                                 logger.info("allottedResourcesShip: " + allottedResourcesShip)
 
 549                                 if ((! isBlank(allottedResourcesShip)) && (! allottedResourcesShip.isEmpty())) {
 
 550                     List<String> allottedResourcesList = jsonUtil.StringArrayToList(execution, allottedResourcesShip)
 
 551                                         logger.info("allottedResourcesList: " + allottedResourcesList)
 
 552                                         execution.setVariable(Prefix+"allottedResourcesList", allottedResourcesList)
 
 553                                 execution.setVariable(Prefix+"allottedResourcesListCount", allottedResourcesList.size())
 
 554                                 execution.setVariable(Prefix+"nextAllottedResourcesList", 0)
 
 555                                 logger.info("Allotted Resource  list set end : " + allottedResourcesList.size())
 
 558                                 execution.setVariable("networkResources", networkResources.toString())
 
 559                                 logger.info("networkResources: " + networkResources)
 
 560                                 String networkResourcesShip = execution.getVariable("networkResources")
 
 561                                 logger.info("networkResourcesShip: " + networkResourcesShip)
 
 562                                 if ((! isBlank(networkResourcesShip)) && (! networkResourcesShip.isEmpty())) {
 
 563                     List<String> networkResourcesList = jsonUtil.StringArrayToList(execution, networkResourcesShip)
 
 564                                         logger.info("networkResourcesList: " + networkResourcesList)
 
 565                                         execution.setVariable(Prefix+"networkResourcesList", networkResourcesList)
 
 566                                 execution.setVariable(Prefix+"networkResourcesListCount", networkResourcesList.size())
 
 567                                 execution.setVariable(Prefix+"nextNetworkResourcesList", 0)
 
 568                                 logger.info("Network Resource  list set end : " + networkResourcesList.size())
 
 572                 } catch (BpmnError e){
 
 574                 } catch (Exception ex) {
 
 575                     String exceptionMessage = "Bpmn error encountered in DeleteMobileAPNCustService flow. prepareServiceDeleteResource() - " + ex.getMessage()
 
 576                     logger.debug(exceptionMessage)
 
 577                     exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
 
 579                 logger.info("Exited " + method)
 
 582         private Optional<AllottedResource>  getAaiAr(DelegateExecution execution, String relink) {
 
 583                 def method = getClass().getSimpleName() + '.getAaiAr(' +'execution=' + execution.getId() +')'
 
 584                 logger.info("Entered " + method)
 
 585                 AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.ALLOTTED_RESOURCE, UriBuilder.fromPath(relink).build())
 
 586         return getAAIClient().get(AllottedResource.class,uri)
 
 589          * prepare Decompose next resource to create request
 
 591         public void preProcessDecomposeNextResource(DelegateExecution execution){
 
 592         def method = getClass().getSimpleName() + '.getAaiAr(' +'execution=' + execution.getId() +')'
 
 593                 logger.info("Entered " + method)
 
 594         logger.trace("STARTED preProcessDecomposeNextResource Process ")
 
 596             int resourceNum = execution.getVariable(Prefix+"nextServiceResource")
 
 597                         List<String> serviceResourceList = execution.getVariable(Prefix+"serviceResourceList")
 
 598                         logger.info("Service Resource List : " + serviceResourceList)
 
 600                         String serviceResource = serviceResourceList[resourceNum]
 
 601             execution.setVariable(Prefix+"serviceResource", serviceResource)
 
 602                         logger.info("Current Service Resource : " + serviceResource)
 
 604                         String resourceType  = jsonUtil.getJsonValue(serviceResource, "resourceType")
 
 605                         execution.setVariable("resourceType", resourceType)
 
 606                         logger.info("resourceType : " + resourceType)
 
 608                         String resourceInstanceId  = jsonUtil.getJsonValue(serviceResource, "resourceInstanceId")
 
 609                         execution.setVariable("resourceInstanceId", resourceInstanceId)
 
 610                         logger.info("resourceInstanceId : " + resourceInstanceId)
 
 612                         String resourceRole  = jsonUtil.getJsonValue(serviceResource, "resourceRole")
 
 613                         execution.setVariable("resourceRole", resourceRole)
 
 614                         logger.info("resourceRole : " + resourceRole)
 
 616                         String resourceVersion  = jsonUtil.getJsonValue(serviceResource, "resourceVersion")
 
 617                         execution.setVariable("resourceVersion", resourceVersion)
 
 618                         logger.info("resourceVersion : " + resourceVersion)
 
 620                         String resourceName = jsonUtil.getJsonValue(serviceResource, "resourceName")
 
 621                         if (isBlank(resourceName)){
 
 622                                 resourceName = resourceInstanceId
 
 624                         execution.setVariable(Prefix+"resourceName", resourceName)
 
 625                         logger.info("resource Name : " + resourceName)
 
 628                         execution.setVariable(Prefix+"nextServiceResource", resourceNum + 1)
 
 630                         int serviceResourceCount = execution.getVariable(Prefix+"serviceResourceCount")
 
 631                         if (serviceResourceCount >0 ){
 
 632                             int progress = (resourceNum*100) / serviceResourceCount
 
 633                                 execution.setVariable("progress", progress.toString() )
 
 635                         execution.setVariable("operationStatus", resourceName )
 
 638             // try error in method block
 
 639                         String exceptionMessage = "Bpmn error encountered in CreateMobileAPNCustService flow. Unexpected Error from method preProcessDecomposeNextResource() - " + ex.getMessage()
 
 640                         logger.debug(exceptionMessage)
 
 641                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
 
 643             logger.info("Exited " + method)
 
 646          * post Decompose next resource to create request
 
 648         public void postProcessDecomposeNextResource(DelegateExecution execution){
 
 649         def method = getClass().getSimpleName() + '.postProcessDecomposeNextResource(' +'execution=' + execution.getId() +')'
 
 650                 logger.info("Entered " + method)
 
 651         logger.trace("STARTED postProcessDecomposeNextResource Process ")
 
 653             String resourceName = execution.getVariable(Prefix+"resourceName")
 
 654                         int resourceNum = execution.getVariable(Prefix+"nextServiceResource")
 
 655                         logger.debug("Current Resource count:"+ execution.getVariable(Prefix+"nextServiceResource"))
 
 657                         int resourceCount = execution.getVariable(Prefix+"serviceResourceCount")
 
 658                         logger.debug("Total Resource count:"+ execution.getVariable(Prefix+"serviceResourceCount"))
 
 660             if (resourceNum < resourceCount) {
 
 661                                 execution.setVariable(Prefix+"resourceFinish", false)
 
 664                             execution.setVariable(Prefix+"resourceFinish", true)
 
 667                         logger.debug("Resource Finished:"+ execution.getVariable(Prefix+"resourceFinish"))
 
 669                         if (resourceCount >0 ){
 
 670                             int progress = (resourceNum*100) / resourceCount
 
 672                                 execution.setVariable("progress", progress.toString() )
 
 673                                 logger.trace(":"+ execution.getVariable(""))
 
 675                         execution.setVariable("operationStatus", resourceName )
 
 679             // try error in method block
 
 680                         String exceptionMessage = "Bpmn error encountered in CreateMobileAPNCustService flow. Unexpected Error from method postProcessDecomposeNextResource() - " + ex.getMessage()
 
 681                         logger.debug(exceptionMessage)
 
 682                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
 
 684             logger.info("Exited " + method)
 
 687         * prepare post Unkown Resource Type
 
 689         public void postOtherControllerType(DelegateExecution execution){
 
 690         def method = getClass().getSimpleName() + '.postOtherControllerType(' +'execution=' + execution.getId() +')'
 
 691                 def isDebugEnabled = execution.getVariable("isDebugEnabled")
 
 692                 logger.info("Entered " + method)
 
 696             String resourceName = execution.getVariable(Prefix+"resourceName")
 
 697                         String resourceType = execution.getVariable(Prefix+"resourceType")
 
 698                         String controllerType = execution.getVariable("controllerType")
 
 700                     String msg = "Resource name: "+ resourceName + " resource Type: " + resourceType+ " controller Type: " + controllerType + " can not be processed  n the workflow"
 
 704             // try error in method block
 
 705                         String exceptionMessage = "Bpmn error encountered in DoCreateMobileAPNServiceInstance flow. Unexpected Error from method postOtherControllerType() - " + ex.getMessage()
 
 706                         logger.debug(exceptionMessage)
 
 707                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
 
 709             logger.info("Exited " + method)
 
 713     * prepare delete parameters
 
 715     public void preSDNCResourceDelete(execution, resourceName){
 
 716         // we use resource instance ids for delete flow as resourceTemplateUUIDs
 
 718         def method = getClass().getSimpleName() + '.preSDNCResourceDelete(' +'execution=' + execution.getId() +')'
 
 719                 logger.info("Entered " + method)
 
 721         logger.trace("STARTED preSDNCResourceDelete Process ")
 
 722         String networkResources = execution.getVariable("networkResources")
 
 725         execution.setVariable("foundResource", false)
 
 726         if (networkResources != null) {
 
 727             def jsonSlurper = new JsonSlurper()
 
 728             List relationShipList =  jsonSlurper.parseText(networkResources)
 
 729                         relationShipList.each {
 
 730                 if(StringUtils.containsIgnoreCase(it.resourceType, resourceName)) {
 
 731                                     String resourceInstanceUUID = it.resourceInstanceId
 
 732                                     String resourceTemplateUUID = it.resourceInstanceId
 
 733                                     execution.setVariable("resourceTemplateId", resourceTemplateUUID)
 
 734                                     execution.setVariable("resourceInstanceId", resourceInstanceUUID)
 
 735                                     execution.setVariable("resourceType", resourceName)
 
 736                                         execution.setVariable("foundResource", true)
 
 737                                 logger.info("Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + "  resourceInstanceId: " + resourceInstanceUUID + " resourceType: " + resourceName)
 
 741         logger.info("Exited " + method)
 
 743         public void preProcessSDNCDelete (DelegateExecution execution) {
 
 744                 def method = getClass().getSimpleName() + '.preProcessSDNCDelete(' +'execution=' + execution.getId() +')'
 
 745                 logger.info("Entered " + method)
 
 746                 logger.trace("preProcessSDNCDelete ")
 
 750                         def serviceInstanceId = execution.getVariable("serviceInstanceId")
 
 751                         def serviceInstanceName = execution.getVariable("serviceInstanceName")
 
 752                         def callbackURL = execution.getVariable("sdncCallbackUrl")
 
 753                         def requestId = execution.getVariable("msoRequestId")
 
 754                         def serviceId = execution.getVariable("productFamilyId")
 
 755                         def subscriptionServiceType = execution.getVariable("subscriptionServiceType")
 
 756                         def globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId
 
 758                         String serviceModelInfo = execution.getVariable("serviceModelInfo")
 
 759                         def modelInvariantUuid = ""
 
 760                         def modelVersion = ""
 
 763                         if (!isBlank(serviceModelInfo))
 
 765                                 modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid")
 
 766                                 modelVersion = jsonUtil.getJsonValue(serviceModelInfo, "modelVersion")
 
 767                                 modelUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelUuid")
 
 768                                 modelName = jsonUtil.getJsonValue(serviceModelInfo, "modelName")
 
 770                                 if (modelInvariantUuid == null) {
 
 771                                         modelInvariantUuid = ""
 
 773                                 if (modelVersion == null) {
 
 776                                 if (modelUuid == null) {
 
 779                                 if (modelName == null) {
 
 783                         if (serviceInstanceName == null) {
 
 784                                 serviceInstanceName = ""
 
 786                         if (serviceId == null) {
 
 790                         def siParamsXml = execution.getVariable("siParamsXml")
 
 791                         def serviceType = execution.getVariable("serviceType")
 
 792                         if (serviceType == null)
 
 797                         def sdncRequestId = UUID.randomUUID().toString()
 
 800                                         """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
 
 801                                                                                                         xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
 
 802                                                                                                         xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
 
 803                                    <sdncadapter:RequestHeader>
 
 804                                                         <sdncadapter:RequestId>${MsoUtils.xmlEscape(sdncRequestId)}</sdncadapter:RequestId>
 
 805                                                         <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
 
 806                                                         <sdncadapter:SvcAction>delete</sdncadapter:SvcAction>
 
 807                                                         <sdncadapter:SvcOperation>service-topology-operation</sdncadapter:SvcOperation>
 
 808                                                         <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackURL)}</sdncadapter:CallbackUrl>
 
 809                                                         <sdncadapter:MsoAction>${MsoUtils.xmlEscape(serviceType)}</sdncadapter:MsoAction>
 
 810                                         </sdncadapter:RequestHeader>
 
 811                                 <sdncadapterworkflow:SDNCRequestData>
 
 812                                         <request-information>
 
 813                                                 <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
 
 818                                                 <request-action>DeleteServiceInstance</request-action>
 
 819                                         </request-information>
 
 820                                         <service-information>
 
 821                                                 <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id>
 
 822                                                 <subscription-service-type>${MsoUtils.xmlEscape(subscriptionServiceType)}</subscription-service-type>
 
 823                                                 <onap-model-information>
 
 824                                                  <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
 
 825                                                  <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid>
 
 826                                                  <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version>
 
 827                                                  <model-name>${MsoUtils.xmlEscape(modelName)}</model-name>
 
 828                                             </onap-model-information>
 
 829                                                 <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
 
 831                                                 <global-customer-id>${MsoUtils.xmlEscape(globalSubscriberId)}</global-customer-id>
 
 832                                         </service-information>
 
 833                                         <service-request-input>
 
 834                                                 <service-instance-name>${MsoUtils.xmlEscape(serviceInstanceName)}</service-instance-name>
 
 836                                         </service-request-input>
 
 837                                 </sdncadapterworkflow:SDNCRequestData>
 
 838                                 </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
 
 840                         sdncDelete = utils.formatXml(sdncDelete)
 
 841                         def sdncRequestId2 = UUID.randomUUID().toString()
 
 842                         String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
 
 843                         execution.setVariable("sdncDelete", sdncDelete)
 
 844                         execution.setVariable("sdncDeactivate", sdncDeactivate)
 
 845                         logger.info("sdncDeactivate:\n" + sdncDeactivate)
 
 846                         logger.info("sdncDelete:\n" + sdncDelete)
 
 848                 } catch (BpmnError e) {
 
 850                 } catch(Exception ex) {
 
 851                         msg = "Exception in preProcessSDNCDelete. " + ex.getMessage()
 
 853                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception Occured in preProcessSDNCDelete.\n" + ex.getMessage())
 
 855                 logger.info("Exited " + method)
 
 858         public void postProcessSDNCDelete(DelegateExecution execution, String response, String action) {
 
 860                 def method = getClass().getSimpleName() + '.postProcessSDNCDelete(' +'execution=' + execution.getId() +')'
 
 861                 logger.info("Entered " + method)
 
 862                 logger.trace("postProcessSDNC " + action + " ")
 
 866                         WorkflowException workflowException = execution.getVariable("WorkflowException")
 
 867                         boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
 
 868                         logger.info("SDNCResponse: " + response)
 
 869                         logger.info("workflowException: " + workflowException)
 
 871                         SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
 
 872                         sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
 
 873                         if(execution.getVariable(Prefix + 'sdncResponseSuccess') == "true"){
 
 874                                 logger.info("Good response from SDNC Adapter for service-instance " + action + "response:\n" + response)
 
 877                                 msg = "Bad Response from SDNC Adapter for service-instance " + action
 
 879                                 exceptionUtil.buildAndThrowWorkflowException(execution, 3500, msg)
 
 881                 } catch (BpmnError e) {
 
 883                 } catch(Exception ex) {
 
 884                         msg = "Exception in postProcessSDNC " + action + " Exception:" + ex.getMessage()
 
 886                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
 
 888                 logger.info("Exited " + method)
 
 892          * Init the service Operation Status
 
 894         public void preUpdateServiceOperationStatus(DelegateExecution execution){
 
 895         def method = getClass().getSimpleName() + '.preUpdateServiceOperationStatus(' +'execution=' + execution.getId() +')'
 
 896                 logger.info("Entered " + method)
 
 899             String serviceId = execution.getVariable("serviceInstanceId")
 
 900             String operationId = execution.getVariable("operationId")
 
 901             String serviceName = execution.getVariable("serviceInstanceName")
 
 902             String operationType = "DELETE"
 
 904             String result = "processing"
 
 905             String progress = execution.getVariable("progress")
 
 906                         logger.info("progress: " + progress )
 
 907                         if ("100".equalsIgnoreCase(progress))
 
 912             String operationContent = "Prepare service delete: " + execution.getVariable("operationStatus")
 
 913             logger.info("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId)
 
 914             serviceId = UriUtils.encode(serviceId,"UTF-8")
 
 915             execution.setVariable("serviceInstanceId", serviceId)
 
 916             execution.setVariable("operationId", operationId)
 
 917             execution.setVariable("operationType", operationType)
 
 919             def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
 
 920             execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
 
 921             logger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint)
 
 924                 """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
 
 925                         xmlns:ns="http://org.onap.so/requestsdb">
 
 928                             <ns:updateServiceOperationStatus xmlns:ns="http://org.onap.so/requestsdb">
 
 929                             <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId>
 
 930                             <operationId>${MsoUtils.xmlEscape(operationId)}</operationId>
 
 931                             <serviceName>${MsoUtils.xmlEscape(serviceName)}</serviceName>
 
 932                             <operationType>${MsoUtils.xmlEscape(operationType)}</operationType>
 
 933                             <userId>${MsoUtils.xmlEscape(userId)}</userId>
 
 934                             <result>${MsoUtils.xmlEscape(result)}</result>
 
 935                             <operationContent>${MsoUtils.xmlEscape(operationContent)}</operationContent>
 
 936                             <progress>${MsoUtils.xmlEscape(progress)}</progress>
 
 937                             <reason>${MsoUtils.xmlEscape(reason)}</reason>
 
 938                         </ns:updateServiceOperationStatus>
 
 940                 </soapenv:Envelope>"""
 
 942             payload = utils.formatXml(payload)
 
 943             execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload)
 
 944             logger.info("Outgoing preUpdateServiceOperationStatus: \n" + payload)
 
 948                         logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
 
 949                                         "Exception Occured Processing preUpdateServiceOperationStatus.", "BPMN",
 
 950                                         ErrorCode.UnknownError.getValue(), e);
 
 951             execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preUpdateServiceOperationStatus Method:\n" + e.getMessage())
 
 953         logger.trace("COMPLETED preUpdateServiceOperationStatus Process ")
 
 954         logger.info("Exited " + method)
 
 957         public void preInitResourcesOperStatus(DelegateExecution execution){
 
 958         def method = getClass().getSimpleName() + '.preInitResourcesOperStatus(' +'execution=' + execution.getId() +')'
 
 959                 logger.info("Entered " + method)
 
 961         logger.trace("STARTED preInitResourcesOperStatus Process ")
 
 964             String serviceId = execution.getVariable("serviceInstanceId")
 
 965             String operationId = execution.getVariable("operationId")
 
 966             String operationType = "DELETE"
 
 967             String resourceTemplateUUIDs = ""
 
 968             String result = "processing"
 
 969             String progress = "0"
 
 971             String operationContent = "Prepare service delete"
 
 972             logger.info("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType)
 
 973             serviceId = UriUtils.encode(serviceId,"UTF-8")
 
 974             execution.setVariable("serviceInstanceId", serviceId)
 
 975             execution.setVariable("operationId", operationId)
 
 976             execution.setVariable("operationType", operationType)
 
 978             String serviceRelationShip = execution.getVariable("serviceRelationShip")
 
 979             logger.info("serviceRelationShip: " + serviceRelationShip)
 
 980                         if (! isBlank(serviceRelationShip)) {
 
 981                 def jsonSlurper = new JsonSlurper()
 
 982                 def jsonOutput = new JsonOutput()
 
 983                 List relationShipList =  jsonSlurper.parseText(serviceRelationShip)
 
 985                 if (relationShipList != null) {
 
 986                     relationShipList.each {
 
 987                         resourceTemplateUUIDs  = resourceTemplateUUIDs + it.resourceInstanceId + ":"
 
 992             def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
 
 993             execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
 
 994             logger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint)
 
 997                 """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
 
 998                         xmlns:ns="http://org.onap.so/requestsdb">
 
1001                             <ns:initResourceOperationStatus xmlns:ns="http://org.onap.so/requestsdb">
 
1002                             <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId>
 
1003                             <operationId>${MsoUtils.xmlEscape(operationId)}</operationId>
 
1004                             <operationType>${MsoUtils.xmlEscape(operationType)}</operationType>
 
1005                             <resourceTemplateUUIDs>${MsoUtils.xmlEscape(resourceTemplateUUIDs)}</resourceTemplateUUIDs>
 
1006                         </ns:initResourceOperationStatus>
 
1008                 </soapenv:Envelope>"""
 
1010             payload = utils.formatXml(payload)
 
1011             execution.setVariable("CVFMI_initResOperStatusRequest", payload)
 
1012             logger.info("Outgoing initResourceOperationStatus: \n" + payload)
 
1013             logger.debug("DoCustomDeleteE2EServiceInstanceV2 Outgoing initResourceOperationStatus Request: " + payload)
 
1015                 }catch (BpmnError e) {
 
1017                 } catch (Exception ex) {
 
1018                         msg = "Exception in DoCustomDeleteE2EServiceInstanceV2.preInitResourcesOperStatus. " + ex.getMessage()
 
1020                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
 
1022         logger.info("Exited " + method)
 
1028     * prepare delete parameters
 
1030         public void preProcessVFCResourceDelete(execution){
 
1031                 // we use resource instance ids for delete flow as resourceTemplateUUIDs
 
1033                 def method = getClass().getSimpleName() + '.preProcessVFCResourceDelete(' +'execution=' + execution.getId() +')'
 
1034                 logger.info("Entered " + method)
 
1036                 logger.trace("STARTED preProcessVFCResourceDelete Process ")
 
1038                         String serviceResource = execution.getVariable("serviceResource")
 
1039                         logger.info("serviceResource : " + serviceResource)
 
1041                         String resourceInstanceId  =  execution.getVariable("resourceInstanceId")
 
1042                         logger.info("resourceInstanceId : " + resourceInstanceId)
 
1044                         execution.setVariable("resourceTemplateId", resourceInstanceId)
 
1045                         logger.info("resourceTemplateId : " + resourceInstanceId)
 
1047                         String resourceType = execution.getVariable("resourceType")
 
1048                         logger.info("resourceType : " + resourceType)
 
1051                         String resourceName = execution.getVariable(Prefix+"resourceName")
 
1052                         if (isBlank(resourceName)){
 
1053                                 resourceName = resourceInstanceId
 
1055                         execution.setVariable("resourceName", resourceName)
 
1056                         logger.info("resource Name : " + resourceName)
 
1058                         logger.info("Delete Resource Info: resourceInstanceId :" + resourceInstanceId + "  resourceTemplateId: " + resourceInstanceId + " resourceType: " + resourceType)
 
1059                 }catch (BpmnError e) {
 
1061                 } catch (Exception ex) {
 
1062                         msg = "Exception in DoDeleteE2EServiceInstance.preProcessVFCResourceDelete. " + ex.getMessage()
 
1064                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
 
1066                 logger.info("Exited " + method)
 
1069         public void postProcessVFCDelete(DelegateExecution execution, String response, String action) {
 
1070                 def method = getClass().getSimpleName() + '.postProcessVFCDelete(' +'execution=' + execution.getId() +')'
 
1071                 logger.info("Entered " + method)
 
1073                 logger.trace("STARTED postProcessVFCDelete Process ")
 
1076                 }catch (BpmnError e) {
 
1078                 } catch (Exception ex) {
 
1079                         msg = "Exception in DoDeleteE2EServiceInstance.postProcessVFCDelete. " + ex.getMessage()
 
1081                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
 
1083                 logger.info("Exited " + method)