2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.mso.bpmn.infrastructure.scripts
23 import org.apache.commons.lang3.StringUtils
24 import org.camunda.bpm.engine.delegate.BpmnError
25 import org.json.JSONObject
27 import org.onap.so.logger.MsoLogger
28 import org.openecomp.mso.bpmn.common.recipe.ResourceInput
29 import org.openecomp.mso.bpmn.common.resource.ResourceRequestBuilder
30 import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
31 import org.camunda.bpm.engine.delegate.DelegateExecution
32 import org.openecomp.mso.bpmn.core.json.JsonUtils
33 import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
34 import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils
37 * This groovy class supports the <class>ActivateSDNCCNetworkResource.bpmn</class> process.
38 * flow for SDNC Network Resource Activate
40 public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
41 private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,
42 CreateSDNCNetworkResource.class);
43 String Prefix = "DEACTSDNCRES_"
45 ExceptionUtil exceptionUtil = new ExceptionUtil()
47 JsonUtils jsonUtil = new JsonUtils()
49 SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
51 public void preProcessRequest(DelegateExecution execution) {
52 msoLogger.info(" ***** started preProcessRequest*****")
55 public void prepareSDNCRequest(DelegateExecution execution) {
56 msoLogger.info(" ***** started prepareSDNCRequest *****")
59 public void prepareUpdateAfterDeActivateSDNCResource(DelegateExecution execution) {
60 msoLogger.info("***** started prepareUpdateAfterDeActivateSDNCResource *****")
63 public void postDeactivateSDNCCall(DelegateExecution execution) {
64 msoLogger.info(" ***** started postDeactivateSDNCCall *****")
67 public void sendSyncResponse(DelegateExecution execution) {
68 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
69 msoLogger.info(" ***** started sendSyncResponse *****")
72 String operationStatus = "finished"
73 // RESTResponse for main flow
74 String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()
75 msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
76 sendWorkflowResponse(execution, 202, resourceOperationResp)
77 execution.setVariable("sentSyncResponse", true)
79 } catch (Exception ex) {
80 String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
82 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
84 msoLogger.debug(" ***** Exit sendSyncResopnse *****")