2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ============LICENSE_END=========================================================
\r
20 package org.openecomp.mso.bpmn.infrastructure.scripts;
\r
22 import static org.apache.commons.lang3.StringUtils.*;
\r
24 import org.apache.commons.lang3.*
\r
25 import org.camunda.bpm.engine.delegate.BpmnError
\r
26 import org.camunda.bpm.engine.delegate.DelegateExecution
\r
27 import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
\r
28 import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
\r
29 import org.openecomp.mso.client.orchestration.AAIOrchestrator
\r
30 import org.openecomp.mso.client.orchestration.SDNCOrchestrator
\r
32 import groovy.json.*
\r
35 * This groovy class supports the <class>DoCreateServiceInstanceV2.bpmn</class> process.
\r
39 public class DoCreateServiceInstanceV2 extends AbstractServiceTaskProcessor {
\r
41 AAIOrchestrator aaiO = new AAIOrchestrator()
\r
42 SDNCOrchestrator sdncO = new SDNCOrchestrator()
\r
45 public void preProcessRequest(DelegateExecution execution) {
\r
48 public void createServiceInstance(DelegateExecution execution) {
\r
49 execution.setVariable("callSDNC",true)
\r
50 if(execution.getVariable("serviceType").equalsIgnoreCase("PORT-MIRROR")== false){
\r
51 if(execution.getVariable("sdncVersion").equals("1610")){
\r
52 execution.setVariable("callSDNC",false);
\r
55 ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition")
\r
57 aaiO.createServiceInstance(serviceDecomp)
\r
58 } catch (BpmnError e) {
\r
63 public void createProject(DelegateExecution execution) {
\r
64 ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition")
\r
65 if (serviceDecomp.getServiceInstance() != null && serviceDecomp.getProject() != null) {
\r
67 aaiO.createProjectandConnectServiceInstance(serviceDecomp)
\r
68 } catch (BpmnError e) {
\r
74 public void createOwningEntity(DelegateExecution execution) {
\r
75 ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition")
\r
76 if (serviceDecomp.getServiceInstance() != null && serviceDecomp.getOwningEntity() != null) {
\r
78 aaiO.createOwningEntityandConnectServiceInstance(serviceDecomp)
\r
79 } catch (BpmnError e) {
\r
85 public void sdncAssignRequest(DelegateExecution execution) {
\r
86 ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition")
\r
87 if (serviceDecomp != null) {
\r
89 sdncO.sendSyncResponse(serviceDecomp)
\r
90 } catch (BpmnError e) {
\r
97 public void rollback(DelegateExecution execution) {
\r