2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.so.bpmn.infrastructure.scripts
23 import org.camunda.bpm.engine.delegate.BpmnError
24 import org.camunda.bpm.engine.delegate.DelegateExecution
25 import org.camunda.bpm.engine.runtime.Execution
26 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
27 import org.onap.so.bpmn.core.domain.ServiceDecomposition
28 import org.onap.so.client.orchestration.AAIServiceInstanceResources
29 import org.onap.so.logger.MsoLogger
32 public class DoCreateServiceInstanceRollbackV2 extends AbstractServiceTaskProcessor{
33 private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateServiceInstanceRollbackV2.class);
36 public void preProcessRequest(DelegateExecution execution) {
40 public void aaiServiceInstanceRollback (DelegateExecution execution) {
41 def aaiServiceInstanceRollback = execution.getVariable("aaiServiceInstanceRollback")
42 if(aaiServiceInstanceRollback){
43 msoLogger.trace("Started aaiServiceInstanceRollback")
45 ServiceDecomposition serviceDecomp = execution.getVariable("ServiceDecomposition")
46 AAIServiceInstanceResources aaiO = new AAIServiceInstanceResources()
47 aaiO.deleteServiceInstance(serviceDecomp)
48 }catch (Exception ex) {
49 String msg = "Error Response from AAI for aaiServiceInstanceRollback"
50 execution.setVariable("rollbackError", msg)
52 throw new BpmnError("MSOWorkflowException")
54 msoLogger.trace("Completed aaiServiceInstanceRollback")
56 msoLogger.trace("SKIPPING A&AI ROLLBACK")
60 public void rollbackError (DelegateExecution execution) {
61 msoLogger.trace("rollbackError")
63 msoLogger.debug("Caught an Exception in DoCreateServiceInstanceRollbackV2")
65 msoLogger.debug("BPMN Error during rollbackError: " + b.getMessage())
67 msoLogger.debug("Caught Exception during rollbackError: " + e.getMessage())
69 msoLogger.debug(" Exit processRollbackException")