stability fixes

fixed bean error
fixed execution variable name
do not explicitly set hibernate objects
Removed remaing references to tunnel-xconnect
fixed virtual link case

Change-Id: Ia5a59794e84beadcbf259efb899878cc4465ca57
Issue-ID: SO-997
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
index 8e36cc5..fc48996 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
@@ -890,7 +890,7 @@
 		if (bbName.contains(NETWORK) && !bbName.contains(NETWORK_COLLECTION)) {
 			String networkId = lookupKeyMap.get(ResourceKey.NETWORK_ID);
 			ModelInfo networkModelInfo = new ModelInfo();
-			if(!Boolean.TRUE.equals(executeBB.getBuildingBlock().getIsVirtualLink())) {
+			if((!Boolean.TRUE.equals(executeBB.getBuildingBlock().getIsVirtualLink()))) {
 				NetworkResourceCustomization networkCust = getNetworkCustomizationByKey(key, service);
 				if (networkCust != null) {
 					networkModelInfo.setModelCustomizationUuid(networkCust.getModelCustomizationUUID());
@@ -901,7 +901,13 @@
 				}
 			} else {
 				msoLogger.debug("Orchestrating on Collection Network Resource Customization");
-				serviceInstance.getNetworks().add(getVirtualLinkL3Network(lookupKeyMap, bbName, key, networkId));
+				CollectionNetworkResourceCustomization collectionNetworkResourceCust = bbInputSetupUtils.getCatalogCollectionNetworkResourceCustByID(key);
+				L3Network l3Network = getVirtualLinkL3Network(lookupKeyMap, bbName, key, networkId, collectionNetworkResourceCust, serviceInstance);
+				NetworkResourceCustomization networkResourceCustomization = 
+						mapperLayer.mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust);
+				if(l3Network != null) {
+					l3Network.setModelInfoNetwork(mapperLayer.mapCatalogNetworkToNetwork(networkResourceCustomization));
+				}
 			}
 		} else if(bbName.contains("Configuration")) {
 			String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID);
@@ -917,15 +923,18 @@
 	}
 
 	protected L3Network getVirtualLinkL3Network(Map<ResourceKey, String> lookupKeyMap, String bbName, String key,
-			String networkId) {
-		CollectionNetworkResourceCustomization collectionNetworkResourceCust = bbInputSetupUtils.getCatalogCollectionNetworkResourceCustByID(key);
-		if(collectionNetworkResourceCust != null && (bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString()) 
+			String networkId, CollectionNetworkResourceCustomization collectionNetworkResourceCust, ServiceInstance serviceInstance) {
+		if(collectionNetworkResourceCust != null) {
+			if((bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString())
 				|| bbName.equalsIgnoreCase(AssignFlows.NETWORK_MACRO.toString()))) {
-			NetworkResourceCustomization networkResourceCustomization = 
-					mapperLayer.mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust);
-			L3Network l3Network = createNetwork(lookupKeyMap, null, networkId, null);
-			l3Network.setModelInfoNetwork(mapperLayer.mapCatalogNetworkToNetwork(networkResourceCustomization));
-			return l3Network;
+				serviceInstance.getNetworks().add(createNetwork(lookupKeyMap, null, networkId, null));
+			} else {
+				for (L3Network network : serviceInstance.getNetworks()) {
+					if (network.getNetworkId().equalsIgnoreCase(networkId)) {
+						return network;
+					}
+				}
+			}
 		}
 		return null;
 	}
diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn
index 31a9817..67bd961 100644
--- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn
+++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_EsMs0HcuEeW2U_kkOHX1ZQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.1" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_EsMs0HcuEeW2U_kkOHX1ZQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
   <bpmn2:process id="CompleteMsoProcess" name="CompleteMsoProcess" isExecutable="true">
     <bpmn2:scriptTask id="preProcessRequest" name="Pre-Process Request" scriptFormat="groovy">
       <bpmn2:incoming>SequenceFlow_18</bpmn2:incoming>
@@ -101,6 +101,7 @@
         <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
         <camunda:in variables="all" />
         <camunda:out variables="all" />
+        <camunda:in businessKey="#{execution.processBusinessKey}" />
       </bpmn2:extensionElements>
       <bpmn2:incoming>SequenceFlow_81</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_13qdn1s</bpmn2:outgoing>