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 static org.apache.commons.lang3.StringUtils.*;
25 import org.apache.commons.lang3.*
26 import org.camunda.bpm.engine.delegate.BpmnError
27 import org.camunda.bpm.engine.delegate.DelegateExecution
28 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
29 import org.onap.so.bpmn.core.domain.ServiceDecomposition
30 import org.onap.so.client.orchestration.AAIServiceInstanceResources
31 import org.onap.so.client.orchestration.SDNCServiceInstanceResources
32 import org.onap.so.logger.MsoLogger
33 import org.onap.so.logger.MessageEnum
38 * This groovy class supports the <class>DoCreateServiceInstanceV2.bpmn</class> process.
42 public class DoCreateServiceInstanceV2 extends AbstractServiceTaskProcessor {
43 private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateServiceInstanceV2.class);
44 AAIServiceInstanceResources aaiO = new AAIServiceInstanceResources()
45 SDNCServiceInstanceResources sdncO = new SDNCServiceInstanceResources()
48 public void preProcessRequest(DelegateExecution execution) {
51 public void createServiceInstance(DelegateExecution execution) {
52 execution.setVariable("callSDNC",true)
53 if(execution.getVariable("serviceType").equalsIgnoreCase("PORT-MIRROR")== false){
54 if(execution.getVariable("sdncVersion").equals("1610")){
55 execution.setVariable("callSDNC",false);
58 ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition")
60 aaiO.createServiceInstance(serviceDecomp)
61 } catch (BpmnError e) {
66 public void createProject(DelegateExecution execution) {
67 ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition")
68 if (serviceDecomp.getServiceInstance() != null && serviceDecomp.getProject() != null) {
70 aaiO.createProjectandConnectServiceInstance(serviceDecomp)
71 } catch (BpmnError e) {
77 public void createOwningEntity(DelegateExecution execution) {
78 ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition")
79 if (serviceDecomp.getServiceInstance() != null && serviceDecomp.getOwningEntity() != null) {
81 aaiO.createOwningEntityandConnectServiceInstance(serviceDecomp)
82 } catch (BpmnError e) {
88 public void sdncAssignRequest(DelegateExecution execution) {
89 ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition")
90 if (serviceDecomp != null) {
92 sdncO.sendSyncResponse(serviceDecomp)
93 } catch (BpmnError e) {
100 public void rollback(DelegateExecution execution) {