summaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCoreBPMN/src/main/java
diff options
context:
space:
mode:
authorDeterme, Sebastien (sd378r) <sd378r@intl.att.com>2017-05-09 03:55:30 -0700
committerDeterme, Sebastien (sd378r) <sd378r@intl.att.com>2017-05-09 05:18:51 -0700
commitb1e5734ef566af5d49ba17d05ca0ab7b56d6666d (patch)
tree92a232e908ae587cb244fd102e9c2c5648c66a9f /bpmn/MSOCoreBPMN/src/main/java
parentd4f2190943216278826f39e7010d57f872bda90d (diff)
[MSO-8] Additional fixes for the second rebase
DB fixes + BPMN flows and groovy fixes + Fix issue with CloudConfig file not reloaded properly when it's wrong (JSON error or model hierarchy mistake) at MSO startup Change-Id: I2853030b78499e2a761706b643ea210955e72de3 Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com> [MSO-8] Restore files removed in patch set 2 Those groovy files must be there Change-Id: I9a47ac3d9c8fc06774a1b8f518491b1b0b00af04 Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
Diffstat (limited to 'bpmn/MSOCoreBPMN/src/main/java')
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/AllottedResource.java38
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/HomingSolution.java49
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/InstanceData.java37
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/JsonWrapper.java140
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/ModelInfo.java101
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/ModuleResource.java60
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/NetworkResource.java42
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/ResourceDecomposition.java70
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/ServiceDecomposition.java159
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/ServiceInstanceData.java23
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/VnfResource.java91
11 files changed, 810 insertions, 0 deletions
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/AllottedResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/AllottedResource.java
new file mode 100644
index 0000000000..c7d2ed9583
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/AllottedResource.java
@@ -0,0 +1,38 @@
+package org.openecomp.mso.bpmn.core.decomposition;
+
+import org.codehaus.jackson.map.annotate.JsonRootName;
+
+@JsonRootName("allottedResource")
+public class AllottedResource extends ResourceDecomposition {
+
+ private static final long serialVersionUID = 1L;
+
+ /*
+ * set resourceType for this object
+ */
+ public AllottedResource(){
+ resourceType = "allottedResource";
+ }
+
+ /*
+ * fields specific to VNF resource type
+ */
+ private String allottedResourceType;
+ private String allottedResourceRole;
+
+ /*
+ * GET and SET
+ */
+ public String getAllottedResourceType() {
+ return allottedResourceType;
+ }
+ public void setAllottedResourceType(String allottedResourceType) {
+ this.allottedResourceType = allottedResourceType;
+ }
+ public String getAllottedResourceRole() {
+ return allottedResourceRole;
+ }
+ public void setAllottedResourceRole(String allottedResourceRole) {
+ this.allottedResourceRole = allottedResourceRole;
+ }
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/HomingSolution.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/HomingSolution.java
new file mode 100644
index 0000000000..f6c1ad917f
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/HomingSolution.java
@@ -0,0 +1,49 @@
+package org.openecomp.mso.bpmn.core.decomposition;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class HomingSolution extends JsonWrapper implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private String infraServiceInstanceId;
+ private String aicCloudRegionId;
+ private String ucpeId;
+ private List<String> entitlementPool;
+ private List<String> entitlementKeyGroup;
+
+ /*
+ * GET && SET
+ */
+ public String getInfraServiceInstanceId() {
+ return infraServiceInstanceId;
+ }
+ public void setInfraServiceInstanceId(String infraServiceInstanceId) {
+ this.infraServiceInstanceId = infraServiceInstanceId;
+ }
+ public String getAicCloudRegionId() {
+ return aicCloudRegionId;
+ }
+ public void setAicCloudRegionId(String aicCloudRegionId) {
+ this.aicCloudRegionId = aicCloudRegionId;
+ }
+ public String getUcpeId() {
+ return ucpeId;
+ }
+ public void setUcpeId(String ucpeId) {
+ this.ucpeId = ucpeId;
+ }
+ public List<String> getEntitlementPool() {
+ return entitlementPool;
+ }
+ public void setEntitlementPool(List<String> entitlementPool) {
+ this.entitlementPool = entitlementPool;
+ }
+ public List getEntitlementKeyGroup() {
+ return entitlementKeyGroup;
+ }
+ public void setEntitlementKeyGroup(List entitlementKeyGroup) {
+ this.entitlementKeyGroup = entitlementKeyGroup;
+ }
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/InstanceData.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/InstanceData.java
new file mode 100644
index 0000000000..13e9f9ac00
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/InstanceData.java
@@ -0,0 +1,37 @@
+package org.openecomp.mso.bpmn.core.decomposition;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+@JsonIgnoreProperties
+public class InstanceData extends JsonWrapper implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private String instanceId;
+ private String instanceName;
+ private HomingSolution homingSolution;
+
+ /*
+ * GET && SET
+ */
+ public String getInstanceId() {
+ return instanceId;
+ }
+ public void setInstanceId(String instanceId) {
+ this.instanceId = instanceId;
+ }
+ public String getInstanceName() {
+ return instanceName;
+ }
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+ public HomingSolution getHomingSolution() {
+ return homingSolution;
+ }
+ public void setHomingSolution(HomingSolution homingSolution) {
+ this.homingSolution = homingSolution;
+ }
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/JsonWrapper.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/JsonWrapper.java
new file mode 100644
index 0000000000..dcc6852c4e
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/JsonWrapper.java
@@ -0,0 +1,140 @@
+package org.openecomp.mso.bpmn.core.decomposition;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.codehaus.jackson.JsonGenerationException;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.map.ObjectWriter;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+
+
+//import org.codehaus.jackson.map.SerializationConfig.Feature;
+import org.codehaus.jackson.map.DeserializationConfig.Feature;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+/**
+ * Wrapper encapsulates needed JSON functionality
+ * to be extended by MSO service decomposition objects
+ * providing ways to convert to and from JSON
+ *
+ * @author
+ *
+ */
+@JsonInclude(Include.NON_NULL)
+public abstract class JsonWrapper {
+
+ @JsonInclude(Include.NON_NULL)
+ public String toJsonString(){
+
+
+
+ String jsonString = "";
+ //convert with Jackson
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.enable(org.codehaus.jackson.map.SerializationConfig.Feature.WRAP_ROOT_VALUE);
+
+ mapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
+
+ ObjectWriter ow = mapper.writer().withDefaultPrettyPrinter();
+ try {
+ jsonString = ow.writeValueAsString(this);
+ } catch (JsonGenerationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (JsonMappingException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return jsonString;
+ }
+
+ @JsonInclude(Include.NON_NULL)
+ public JSONObject toJsonObject(){
+
+ ObjectMapper mapper = new ObjectMapper();
+ // mapper.configure(SerializationConfig.Feature.WRAP_ROOT_VALUE, true);
+ //mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
+
+ mapper.enable(org.codehaus.jackson.map.SerializationConfig.Feature.WRAP_ROOT_VALUE);
+ // mapper.enable(org.codehaus.jackson.map.DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+ JSONObject json = new JSONObject();
+ try {
+ json = new JSONObject(mapper.writeValueAsString(this));
+ } catch (JsonGenerationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (JsonMappingException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (JSONException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return json;
+ }
+
+ public String listToJson(List list) {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.enable(org.codehaus.jackson.map.SerializationConfig.Feature.WRAP_ROOT_VALUE);
+
+ String jsonString = "";
+ try {
+ jsonString = mapper.writeValueAsString(list);
+ } catch (JsonGenerationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (JsonMappingException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ return jsonString;
+ }
+
+ /**
+ * Method to construct Service Decomposition object converting
+ * JSON structure
+ *
+ * @param jsonString - input in JSON format confirming ServiceDecomposition
+ * @return - ServiceDecomposition object
+ */
+ public ServiceDecomposition JsonToServiceDecomposition(String jsonString) {
+
+ ServiceDecomposition serviceDecomposition = new ServiceDecomposition();
+ ObjectMapper om = new ObjectMapper();
+ om.configure(Feature.UNWRAP_ROOT_VALUE, true);
+
+ try {
+ serviceDecomposition = om.readValue(jsonString, ServiceDecomposition.class);
+ } catch (JsonParseException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (JsonMappingException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ return serviceDecomposition;
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/ModelInfo.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/ModelInfo.java
new file mode 100644
index 0000000000..ecbb076d80
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/ModelInfo.java
@@ -0,0 +1,101 @@
+package org.openecomp.mso.bpmn.core.decomposition;
+
+import java.io.Serializable;
+
+import org.codehaus.jackson.map.annotate.JsonRootName;
+
+@JsonRootName("modelInfo")
+public class ModelInfo extends JsonWrapper implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private String modelName = "";
+ private String modelUuid = "";
+ private String modelInvariantId = "";
+ private String modelVersion = "";
+ //additionally on resource level
+ private String modelCustomizationUuid = "";
+ private String modelInstanceName = "";
+
+ //TODO - those were present in original "modelInfo" object structure. Confirm.
+ private String modelCustomizationName = "";
+ private String modelVersionId = "";
+ private String modelType = "";
+
+ public String getModelName() {
+ return modelName;
+ }
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+ public String getModelUuid() {
+ return modelUuid;
+ }
+ public void setModelUuid(String modelUuid) {
+ this.modelUuid = modelUuid;
+ }
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+ public String getModelVersion() {
+ return modelVersion;
+ }
+ public void setModelVersion(String modelVersion) {
+ this.modelVersion = modelVersion;
+ }
+ public String getModelCustomizationUuid() {
+ return modelCustomizationUuid;
+ }
+ public void setModelCustomizationUuid(String modelCustomizationUuid) {
+ this.modelCustomizationUuid = modelCustomizationUuid;
+ }
+ public String getModelInstanceName() {
+ return modelInstanceName;
+ }
+ public void setModelInstanceName(String modelInstanceName) {
+ this.modelInstanceName = modelInstanceName;
+ }
+ public String getModelCustomizationName() {
+ return modelCustomizationName;
+ }
+ public void setModelCustomizationName(String modelCustomizationName) {
+ this.modelCustomizationName = modelCustomizationName;
+ }
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+ public String getModelType() {
+ return modelType;
+ }
+ public void setModelType(String modelType) {
+ this.modelType = modelType;
+ }
+
+ //TODO add convenience methods
+
+
+ //TODO - complete this manual
+ public String toString(){
+
+ String jsonString = "";
+
+ //can try building manually
+ jsonString = "{" +
+ "\"modelName\":\"" + getModelName() + "\"," +
+ "\"modelUuid\":\"" + getModelUuid() + "\"" +
+ "\"modelInvariantId\":\"" + getModelInvariantId() + "\"" +
+ "}";
+
+
+ return jsonString;
+ }
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/ModuleResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/ModuleResource.java
new file mode 100644
index 0000000000..1c91f4e600
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/ModuleResource.java
@@ -0,0 +1,60 @@
+package org.openecomp.mso.bpmn.core.decomposition;
+
+import org.codehaus.jackson.map.annotate.JsonRootName;
+
+@JsonRootName("vfModule")
+public class ModuleResource extends ResourceDecomposition {
+
+ private static final long serialVersionUID = 1L;
+
+ /*
+ * set resourceType for this object
+ */
+ public ModuleResource(){
+ resourceType = "module";
+ }
+
+ /*
+ * fields specific to VF Module resource type
+ */
+ private String vfModuleType;
+ private boolean hasVolumeGroup;
+ private boolean isBase;
+ private String vfModuleLabel;
+ private int initialCount;
+
+ /*
+ * GET && SET
+ */
+ public boolean getIsBase() {
+ return isBase;
+ }
+ public void setIsBase(boolean isBase) {
+ this.isBase = isBase;
+ }
+ public String getVfModuleLabel() {
+ return vfModuleLabel;
+ }
+ public void setVfModuleLabel(String vfModuleLabel) {
+ this.vfModuleLabel = vfModuleLabel;
+ }
+ public int getInitialCount() {
+ return initialCount;
+ }
+ public void setInitialCount(int initialCount) {
+ this.initialCount = initialCount;
+ }
+ public String getVfModuleType() {
+ return vfModuleType;
+ }
+ public void setVfModuleType(String vfModuleType) {
+ this.vfModuleType = vfModuleType;
+ }
+ public boolean isHasVolumeGroup() {
+ return hasVolumeGroup;
+ }
+ public void setHasVolumeGroup(boolean hasVolumeGroup) {
+ this.hasVolumeGroup = hasVolumeGroup;
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/NetworkResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/NetworkResource.java
new file mode 100644
index 0000000000..16d1010633
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/NetworkResource.java
@@ -0,0 +1,42 @@
+package org.openecomp.mso.bpmn.core.decomposition;
+
+import org.codehaus.jackson.map.annotate.JsonRootName;
+
+
+/**
+ * Encapsulates Network resource data set
+ * @author
+ *
+ */
+@JsonRootName("networkResource")
+public class NetworkResource extends ResourceDecomposition {
+
+ private static final long serialVersionUID = 1L;
+ /*
+ * set resourceType for this object
+ */
+ public NetworkResource(){
+ resourceType = "networkResource";
+ }
+ /*
+ * fields specific to VNF resource type
+ */
+ private String networkType;
+ private String networkRole;
+
+ /*
+ * GET and SET
+ */
+ public String getNetworkType() {
+ return networkType;
+ }
+ public void setNetworkType(String networkType) {
+ this.networkType = networkType;
+ }
+ public String getNetworkRole() {
+ return networkRole;
+ }
+ public void setNetworkRole(String networkRole) {
+ this.networkRole = networkRole;
+ }
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/ResourceDecomposition.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/ResourceDecomposition.java
new file mode 100644
index 0000000000..ba01c8fc44
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/ResourceDecomposition.java
@@ -0,0 +1,70 @@
+package org.openecomp.mso.bpmn.core.decomposition;
+
+import java.io.Serializable;
+
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.map.annotate.JsonRootName;
+
+/**
+ * Abstract superclass for all individual decomposition resources
+ *
+ * @author
+ *
+ */
+//@JsonIgnoreProperties
+public abstract class ResourceDecomposition extends JsonWrapper implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String resourceType; // Enum of vnf or network or allotted resource
+ private ModelInfo modelInfo;
+
+ //private List modules;
+ private InstanceData instanceData = new InstanceData();
+
+ // GET and SET
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+
+ public InstanceData getInstanceData() {
+ return instanceData;
+ }
+ public void setInstanceData(InstanceData instanceData) {
+ this.instanceData = instanceData;
+ }
+ public void setResourceType(String resourceType) {
+ this.resourceType = resourceType;
+ }
+
+ //Utility methods
+ @JsonIgnore
+ public ModelInfo getResourceModel() {
+ return modelInfo;
+ }
+ @JsonIgnore
+ public String getResourceInstanceId() {
+ return this.getInstanceData().getInstanceId();
+ }
+ @JsonIgnore
+ public String getResourceInstanceName() {
+ return this.getInstanceData().getInstanceName();
+ }
+// @JsonIgnore
+// public String getResourceHomingSolution() {
+// }
+
+ public void setResourceInstanceId(String newInstanceId){
+ this.getInstanceData().setInstanceId(newInstanceId);
+ }
+ public void setResourceInstanceName(String newInstanceName){
+ this.getInstanceData().setInstanceName(newInstanceName);
+ }
+// @JsonIgnore
+// public String setResourceHomingSolution() {
+// }
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/ServiceDecomposition.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/ServiceDecomposition.java
new file mode 100644
index 0000000000..00ba091677
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/ServiceDecomposition.java
@@ -0,0 +1,159 @@
+package org.openecomp.mso.bpmn.core.decomposition;
+
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.codehaus.jackson.map.annotate.JsonRootName;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import org.json.JSONObject;
+
+
+
+/**
+ * Service Decomposition Structure
+ * This Java object contains service information:
+ * - Service model info
+ * - list of VNF resource's decompositon
+ * - list of network resource's decompositon
+ * - list of allotted resource's decompositon
+ */
+@JsonRootName(value = "serviceResources")
+//@JsonTypeInfo(include=As.WRAPPER_OBJECT, use=Id.NAME)
+public class ServiceDecomposition extends JsonWrapper implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @JsonProperty("modelInfo")
+ private ModelInfo modelInfo;
+ private ServiceInstanceData serviceInstanceData;
+ @JsonProperty("vnfResource")
+ private List <VnfResource> vnfResources;
+ @JsonProperty("networkResource")
+ private List <NetworkResource> networkResources;
+ @JsonProperty("allottedResource")
+ private List <AllottedResource> allottedResources;
+
+ public ServiceDecomposition () {
+ super();
+ }
+
+ public ServiceDecomposition (ModelInfo modelInfo, ServiceInstanceData serviceInstanceData, List <VnfResource> vnfResources, List <NetworkResource> networkResources, List <AllottedResource> allottedResources ) {
+ //TODO provide constructor implementation
+// this.modelInfo = modelInfo;
+// this.serviceInstanceData = serviceInstanceData;
+// this.vnfResources = vnfResources;
+// this.networkResources = networkResources;
+// this.allottedResources = allottedResources;
+
+ }
+
+ public ServiceDecomposition (String catalogRestOutput, String serviceInstanceId) {
+ //TODO provide constructor implementation
+
+ this.modelInfo = this.JsonToServiceDecomposition(catalogRestOutput).getModelInfo();
+ this.vnfResources = this.JsonToServiceDecomposition(catalogRestOutput).getServiceVnfs();
+ this.allottedResources = this.JsonToServiceDecomposition(catalogRestOutput).getServiceAllottedResources();
+ this.networkResources = this.JsonToServiceDecomposition(catalogRestOutput).getServiceNetworks();
+ this.serviceInstanceData = new ServiceInstanceData();
+ this.serviceInstanceData.setInstanceId(serviceInstanceId);
+ }
+ public ServiceDecomposition (JSONObject catalogRestOutput, String serviceInstanceId) {
+ //TODO provide constructor implementation
+ }
+ //GET and SET
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+ public ServiceInstanceData getServiceInstanceData() {
+ return serviceInstanceData;
+ }
+ public void setServiceInstanceData(ServiceInstanceData serviceInstanceData) {
+ this.serviceInstanceData = serviceInstanceData;
+ }
+ public List<VnfResource> getServiceVnfs() {
+ return vnfResources;
+ }
+ public void setServiceVnfs(List<VnfResource> vnfResources) {
+ this.vnfResources = vnfResources;
+ }
+ public List<NetworkResource> getServiceNetworks() {
+ return networkResources;
+ }
+ public void setServiceNetworks(List<NetworkResource> networkResources) {
+ this.networkResources = networkResources;
+ }
+ public List<AllottedResource> getServiceAllottedResources() {
+ return allottedResources;
+ }
+ public void setServiceAllottedResources(List<AllottedResource> allottedResources) {
+ this.allottedResources = allottedResources;
+ }
+
+ // methods to add to the list
+ public void addVnfResource(VnfResource vnfResource) {
+ if (vnfResources == null){
+ vnfResources = new ArrayList<VnfResource>();
+ }
+ this.vnfResources.add(vnfResource);
+ }
+ public void addNetworkResource(NetworkResource networkResource) {
+ if (networkResources == null){
+ networkResources = new ArrayList<NetworkResource>();
+ }
+ this.networkResources.add(networkResource);
+ }
+ public void addAllottedResource(AllottedResource allottedResource) {
+ if (allottedResources == null){
+ allottedResources = new ArrayList<AllottedResource>();
+ }
+ this.allottedResources.add(allottedResource);
+ }
+
+// //TODO - IF NEEDED, update below methods to return one resource decomposition by (?) ID, not index - used temporarily
+// public VnfResource getnfResource(int index) {
+//
+//// Iterator<VnfResource> iter = vnfResources.iterator();
+//// while (iter.hasNext()) {
+//// VnfResource vnfResource = iter.next();
+//// vnfResource.getModelInfo().getModelInvariantId();
+//// }
+// return this.vnfResources.get(index);
+// }
+// public NetworkResource getNetworkResource( int index) {
+// return this.networkResources.get(index);
+// }
+// public AllottedResource getAllottedResource(int index) {
+// return this.allottedResources.get(index);
+// }
+
+ @JsonIgnore
+ public List<ResourceDecomposition> getServiceResources(){
+ ArrayList serviceResources = new ArrayList();
+ serviceResources.addAll(this.getServiceNetworks());
+ serviceResources.addAll(this.getServiceVnfs());
+ serviceResources.addAll(this.getServiceAllottedResources());
+ return serviceResources;
+ }
+
+ @JsonIgnore
+ public String getServiceResourcesJsonString(){
+ StringBuffer serviceResourcesJsonStringBuffer = new StringBuffer();
+ serviceResourcesJsonStringBuffer.append(listToJson((this.getServiceNetworks())));
+ serviceResourcesJsonStringBuffer.append(listToJson((this.getServiceVnfs())));
+ serviceResourcesJsonStringBuffer.append(listToJson((this.getServiceAllottedResources())));
+ return serviceResourcesJsonStringBuffer.toString();
+ }
+
+ //return String representation of JSON
+ @Override
+ public String toString(){
+ return "string representation";
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/ServiceInstanceData.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/ServiceInstanceData.java
new file mode 100644
index 0000000000..9b7393d742
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/ServiceInstanceData.java
@@ -0,0 +1,23 @@
+package org.openecomp.mso.bpmn.core.decomposition;
+
+import java.io.Serializable;
+
+public class ServiceInstanceData extends JsonWrapper implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+ private String instanceId;
+ private String instanceName;
+
+ public String getInstanceId() {
+ return instanceId;
+ }
+ public void setInstanceId(String instanceId) {
+ this.instanceId = instanceId;
+ }
+ public String getInstanceName() {
+ return instanceName;
+ }
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/VnfResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/VnfResource.java
new file mode 100644
index 0000000000..267a20ebe6
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/decomposition/VnfResource.java
@@ -0,0 +1,91 @@
+package org.openecomp.mso.bpmn.core.decomposition;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.codehaus.jackson.map.annotate.JsonRootName;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Encapsulates VNF resource data set
+ * @author
+ *
+ */
+@JsonRootName("vnfResource")
+public class VnfResource extends ResourceDecomposition {
+
+ private static final long serialVersionUID = 1L;
+
+ /*
+ * set resourceType for this object
+ */
+ public VnfResource(){
+ resourceType = "vnfResource";
+ }
+
+ /*
+ * fields specific to VNF resource type
+ */
+ @JsonProperty("vfModules")
+ private List <ModuleResource> vfModules;
+ private String vnfType;
+
+ /*
+ * GET and SET
+ */
+ public List<ModuleResource> getVfModules() {
+ return vfModules;
+ }
+ public void setModules(List<ModuleResource> moduleResources) {
+ this.vfModules = moduleResources;
+ }
+ public String getVnfType() {
+ return vnfType;
+ }
+ public void setVnfType(String vnfType) {
+ this.vnfType = vnfType;
+ }
+
+ /*
+ * GET accessors per design requirements
+ */
+
+ /**
+ * Returns a list of all VfModule objects.
+ * Base module is first entry in the list
+ * @return ordered list of ModuleResources objects
+ */
+ @JsonIgnore
+ public List<ModuleResource> getAllVfModuleObjects(){
+
+ for (int i = 0; i < vfModules.size(); i++) {
+ ModuleResource moduleResource = vfModules.get(i);
+ if (moduleResource.getIsBase()){
+ vfModules.remove(moduleResource);
+ vfModules.add(0,moduleResource);
+ }
+ }
+ return vfModules;
+ }
+
+ /**
+ *
+ * @return Returns JSON list of all VfModule structures.
+ */
+ @JsonIgnore
+ public String getAllVfModulesJson(){
+
+ return listToJson(vfModules);
+ }
+
+ // methods to add to the list
+ public void addVfModule(ModuleResource moduleResource) {
+ if (vfModules == null){
+ vfModules = new ArrayList<ModuleResource>();
+ }
+ this.vfModules.add(moduleResource);
+ }
+
+}