summaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCoreBPMN/src/main/java
diff options
context:
space:
mode:
authorRob Daugherty <rd472p@att.com>2018-03-14 02:07:32 -0400
committerRob Daugherty <rd472p@att.com>2018-03-14 04:08:41 -0400
commit38f720752af4d4aad8c4e467a288d9048659f688 (patch)
treee81066a8b5c77272e30fb57a64999573c4db4d86 /bpmn/MSOCoreBPMN/src/main/java
parentaee3d223f92a6f250f43e17558a2dfd576ff7294 (diff)
AT&T 1712 and 1802 release code
This is code from AT&T's 1712 and 1802 releases. Change-Id: Ie1e85851e94bc66c4d9514a0226c221939531a04 Issue-ID: SO-425 Signed-off-by: Rob Daugherty <rd472p@att.com>
Diffstat (limited to 'bpmn/MSOCoreBPMN/src/main/java')
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/AllottedResource.java35
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ConfigResource.java60
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Configuration.java88
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Customer.java52
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/HomingSolution.java95
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/JsonWrapper.java6
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/License.java120
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ModuleResource.java20
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/OwningEntity.java53
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Project.java47
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Request.java69
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Resource.java13
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceInstance.java21
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceType.java2
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceDecomposition.java156
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceInstance.java59
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/TunnelConnect.java77
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/VnfResource.java34
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/DecomposeJsonUtil.java25
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java199
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonWrapper.java6
21 files changed, 1086 insertions, 151 deletions
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/AllottedResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/AllottedResource.java
index 89addb9b39..21943c047f 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/AllottedResource.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/AllottedResource.java
@@ -24,7 +24,10 @@ import java.util.UUID;
import com.fasterxml.jackson.annotation.JsonRootName;
-
+/**
+ * Stores allotted-resource information
+ *
+ */
@JsonRootName("allottedResource")
public class AllottedResource extends Resource {
@@ -43,12 +46,16 @@ public class AllottedResource extends Resource {
*/
private String allottedResourceType;
private String allottedResourceRole;
+ private String providingServiceModelName;
private String providingServiceModelInvariantUuid;
+ private String providingServiceModelUuid;
private String nfFunction;
private String nfType;
private String nfRole;
private String nfNamingCode;
-
+ private String orchestrationStatus;
+ private TunnelConnect tunnelConnect;
+
/*
* GET and SET
*/
@@ -64,6 +71,12 @@ public class AllottedResource extends Resource {
public void setAllottedResourceRole(String allottedResourceRole) {
this.allottedResourceRole = allottedResourceRole;
}
+ public String getProvidingServiceModelName() {
+ return providingServiceModelName;
+ }
+ public void setProvidingServiceModelName(String providingServiceModelName) {
+ this.providingServiceModelName = providingServiceModelName;
+ }
public String getProvidingServiceModelInvariantUuid() {
return providingServiceModelInvariantUuid;
}
@@ -71,6 +84,12 @@ public class AllottedResource extends Resource {
String providingServiceModelInvariantUuid) {
this.providingServiceModelInvariantUuid = providingServiceModelInvariantUuid;
}
+ public String getProvidingServiceModelUuid() {
+ return providingServiceModelUuid;
+ }
+ public void setProvidingServiceModelUuid(String providingServiceModelUuid) {
+ this.providingServiceModelUuid = providingServiceModelUuid;
+ }
public String getNfFunction() {
return nfFunction;
}
@@ -95,4 +114,16 @@ public class AllottedResource extends Resource {
public void setNfNamingCode(String nfNamingCode) {
this.nfNamingCode = nfNamingCode;
}
+ public String getOrchestrationStatus() {
+ return orchestrationStatus;
+ }
+ public void setOrchestrationStatus(String orchestrationStatus) {
+ this.orchestrationStatus = orchestrationStatus;
+ }
+ public TunnelConnect getTunnelConnect() {
+ return tunnelConnect;
+ }
+ public void setTunnelConnect(TunnelConnect tunnelConnect) {
+ this.tunnelConnect = tunnelConnect;
+ }
} \ No newline at end of file
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ConfigResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ConfigResource.java
new file mode 100644
index 0000000000..cd45309f28
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ConfigResource.java
@@ -0,0 +1,60 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.bpmn.core.domain;
+
+import java.util.UUID;
+
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+
+@JsonRootName("configResource")
+public class ConfigResource extends Resource {
+
+ private static final long serialVersionUID = 1L;
+
+ /*
+ * set resourceType for this object
+ */
+ public ConfigResource(){
+ resourceType = ResourceType.CONFIGURATION;
+ setResourceId(UUID.randomUUID().toString());
+ }
+
+ /*
+ * fields specific to Config Resource resource type
+ */
+
+ /*
+ * GET and SET
+ */
+
+ private String toscaNodeType;
+
+ public String getToscaNodeType() {
+ return toscaNodeType;
+ }
+
+ public void setToscaNodeType(String toscaNodeType) {
+ this.toscaNodeType = toscaNodeType;
+ }
+
+
+} \ No newline at end of file
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Configuration.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Configuration.java
new file mode 100644
index 0000000000..c80a1fddb4
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Configuration.java
@@ -0,0 +1,88 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.bpmn.core.domain;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+/**
+ * Stores configuration information and modeled off
+ * of the AAI configuration object
+ *
+ */
+@JsonRootName("configuration")
+public class Configuration extends JsonWrapper implements Serializable{
+
+ private static final long serialVersionUID = 1L;
+
+ private String id;
+ private String name;
+ private String type;
+ private String orchestrationStatus;
+ private String tunnelBandwidth;
+ private String vendorAllowedMaxBandwidth;
+ private String resourceVersion;
+ public String getId() {
+ return id;
+ }
+ public void setId(String id) {
+ this.id = id;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getType() {
+ return type;
+ }
+ public void setType(String type) {
+ this.type = type;
+ }
+ public String getOrchestrationStatus() {
+ return orchestrationStatus;
+ }
+ public void setOrchestrationStatus(String orchestrationStatus) {
+ this.orchestrationStatus = orchestrationStatus;
+ }
+ public String getTunnelBandwidth() {
+ return tunnelBandwidth;
+ }
+ public void setTunnelBandwidth(String tunnelBandwidth) {
+ this.tunnelBandwidth = tunnelBandwidth;
+ }
+ public String getVendorAllowedMaxBandwidth() {
+ return vendorAllowedMaxBandwidth;
+ }
+ public void setVendorAllowedMaxBandwidth(String vendorAllowedMaxBandwidth) {
+ this.vendorAllowedMaxBandwidth = vendorAllowedMaxBandwidth;
+ }
+ public String getResourceVersion() {
+ return resourceVersion;
+ }
+ public void setResourceVersion(String resourceVersion) {
+ this.resourceVersion = resourceVersion;
+ }
+
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Customer.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Customer.java
new file mode 100644
index 0000000000..623ab0df20
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Customer.java
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.bpmn.core.domain;
+
+import java.io.Serializable;
+/**
+ * This class is used to store customer
+ * data of services aka ServiceDecomposition
+ *
+ * @author bb3476
+ *
+ */
+
+public class Customer extends JsonWrapper implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+ private String subscriptionServiceType;
+ private String globalSubscriberId;
+
+
+ public String getSubscriptionServiceType() {
+ return subscriptionServiceType;
+ }
+ public void setSubscriptionServiceType(String subscriptionServiceType) {
+ this.subscriptionServiceType = subscriptionServiceType;
+ }
+ public String getGlobalSubscriberId() {
+ return globalSubscriberId;
+ }
+ public void setGlobalSubscriberId(String globalSubscriberId) {
+ this.globalSubscriberId = globalSubscriberId;
+ }
+
+} \ No newline at end of file
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/HomingSolution.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/HomingSolution.java
index c038866e71..40506576a5 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/HomingSolution.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/HomingSolution.java
@@ -23,32 +23,47 @@ package org.openecomp.mso.bpmn.core.domain;
import java.io.Serializable;
import java.util.List;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonRootName;
+/**
+ * Stores resources placement and licensing information
+ *
+ */
@JsonRootName("homingSolution")
-public class HomingSolution extends JsonWrapper implements Serializable {
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class HomingSolution extends JsonWrapper implements Serializable {
private static final long serialVersionUID = 1L;
private InventoryType inventoryType;
- private String serviceInstanceId;
- private String vnfHostname;
+ private boolean isRehome;
+ private String serviceInstanceId; //TODO should start using si object instead
private String cloudOwner;
private String cloudRegionId;
private String aicClli;
private String aicVersion;
- private String ucpeId; //TODO Remove?
- private List<String> entitlementPoolList;
- private List<String> licenseKeyGroupList;
+ private String tenant;
+ private VnfResource vnf;
+ private License license = new License();
- public InventoryType getInventoryType(){
+ /**
+ * @return the inventoryType which indicates the solution type
+ */
+ public InventoryType getInventoryType() {
return inventoryType;
}
- public void setInventoryType(InventoryType inventoryType){
+ public void setInventoryType(InventoryType inventoryType) {
this.inventoryType = inventoryType;
}
+ public boolean isRehome() {
+ return isRehome;
+ }
+ public void setRehome(boolean isRehome) {
+ this.isRehome = isRehome;
+ }
public String getServiceInstanceId() {
return serviceInstanceId;
@@ -58,21 +73,11 @@ public class HomingSolution extends JsonWrapper implements Serializable {
this.serviceInstanceId = serviceInstanceId;
}
- public String getVnfHostname(){
- return vnfHostname;
- }
-
- public void setVnfHostname(String vnfHostname){
- this.vnfHostname = vnfHostname;
- }
-
-
- public String getCloudOwner(){
+ public String getCloudOwner() {
return cloudOwner;
}
-
- public void setCloudOwner(String cloudOwner){
+ public void setCloudOwner(String cloudOwner) {
this.cloudOwner = cloudOwner;
}
@@ -83,48 +88,56 @@ public class HomingSolution extends JsonWrapper implements Serializable {
public void setCloudRegionId(String cloudRegionId) {
this.cloudRegionId = cloudRegionId;
}
-
-
- public String getAicClli(){
+ /**
+ * @return the aicClli (aka aic site, physical location id)
+ */
+ public String getAicClli() {
return aicClli;
}
-
- public void setAicClli(String aicClli){
+ public void setAicClli(String aicClli) {
this.aicClli = aicClli;
}
-
- public String getAicVersion(){
+ public String getAicVersion() {
return aicVersion;
}
-
- public void setAicVersion(String aicVersion){
+ public void setAicVersion(String aicVersion) {
this.aicVersion = aicVersion;
}
- public String getUcpeId(){
- return ucpeId;
+ public String getTenant() {
+ return tenant;
}
- public void setUcpeId(String ucpeId){
- this.ucpeId = ucpeId;
+ public void setTenant(String tenant) {
+ this.tenant = tenant;
}
- public List<String> getEntitlementPoolList(){
- return entitlementPoolList;
+ /**
+ * @return the vnf that the resource was homed too.
+ */
+ public VnfResource getVnf() {
+ return vnf;
}
- public void setEntitlementPoolList(List<String> entitlementPoolList){
- this.entitlementPoolList = entitlementPoolList;
+ public void setVnf(VnfResource vnf) {
+ this.vnf = vnf;
}
- public List<String> getLicenseKeyGroupList(){
- return licenseKeyGroupList;
+ public License getLicense() {
+ return license;
}
- public void setLicenseKeyGroupList(List<String> licenseKeyGroupList){
- this.licenseKeyGroupList = licenseKeyGroupList;
+ public void setLicense(License license) {
+ this.license = license;
}
+
+
+ public static long getSerialversionuid() {
+ return serialVersionUID;
+ }
+
+
} \ No newline at end of file
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/JsonWrapper.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/JsonWrapper.java
index f37db4abdd..5cd078d69c 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/JsonWrapper.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/JsonWrapper.java
@@ -37,7 +37,7 @@ import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.openecomp.mso.logger.MsoLogger;
-//import org.codehaus.jackson.map.SerializationConfig.Feature;
+//import com.fasterxml.jackson.map.SerializationFeature;
/**
@@ -84,11 +84,11 @@ public abstract class JsonWrapper implements Serializable {
public JSONObject toJsonObject(){
ObjectMapper mapper = new ObjectMapper();
- // mapper.configure(SerializationConfig.Feature.WRAP_ROOT_VALUE, true);
+ // mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
//mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
- // mapper.enable(org.codehaus.jackson.map.DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+ // mapper.enable(com.fasterxml.jackson.map.DeserializationFeature.UNWRAP_ROOT_VALUE);
JSONObject json = new JSONObject();
try {
json = new JSONObject(mapper.writeValueAsString(this));
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/License.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/License.java
new file mode 100644
index 0000000000..eeb533c7f2
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/License.java
@@ -0,0 +1,120 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.bpmn.core.domain;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.json.JSONArray;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+/**
+ * Stores licensing information and is an attribute
+ * of a <class>HomingSolution</class>
+ *
+ */
+@JsonRootName("license")
+@JsonInclude(JsonInclude.Include.NON_EMPTY)
+public class License extends JsonWrapper implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ StringBuilder sb = new StringBuilder();
+
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ private List<String> entitlementPoolList = new ArrayList<String>();
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ private List<String> licenseKeyGroupList = new ArrayList<String>();
+
+
+ public List<String> getEntitlementPoolList() {
+ return entitlementPoolList;
+ }
+
+ public void setEntitlementPoolList(List<String> entitlementPoolList) {
+ this.entitlementPoolList = entitlementPoolList;
+ }
+
+ public List<String> getLicenseKeyGroupList() {
+ return licenseKeyGroupList;
+ }
+
+ public void setLicenseKeyGroupList(List<String> licenseKeyGroupList) {
+ this.licenseKeyGroupList = licenseKeyGroupList;
+ }
+
+ /**
+ * This method adds a Entitlement Pool Uuid
+ * to the EntitlementPoolList
+ *
+ * @param the EntitlementPoolUuid
+ */
+ public void addEntitlementPool(String entitlementPoolUuid) {
+ entitlementPoolList.add(entitlementPoolUuid);
+ }
+
+ /**
+ * This method adds a License Key Group Uuid
+ * to the LicenseKeyGroupList
+ *
+ * @param the licenseKeyGroupUuid
+ */
+ public void addLicenseKeyGroup(String licenseKeyGroupUuid) {
+ licenseKeyGroupList.add(licenseKeyGroupUuid);
+ }
+
+ /**
+ * This method returns the licenseKeyGroupList
+ * as a json array
+ *
+ * @return the strList
+ */
+ @JsonIgnore
+ public JSONArray getLicenseKeyGroupListAsString() {
+ JSONArray array = new JSONArray(licenseKeyGroupList);
+ return array;
+ }
+
+ /**
+ * This method returns the entitlementPoolList
+ * as a json array
+ *
+ * @return the strList
+ */
+ @JsonIgnore
+ public JSONArray getEntitlementPoolListAsString() {
+ JSONArray array = new JSONArray(entitlementPoolList);
+ return array;
+ }
+
+ /**
+ * @return the serialversionuid
+ */
+ public static long getSerialversionuid() {
+ return serialVersionUID;
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ModuleResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ModuleResource.java
index 37bd7214a6..cbc9196289 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ModuleResource.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ModuleResource.java
@@ -33,19 +33,33 @@ public class ModuleResource extends Resource {
public ModuleResource(){
resourceType = ResourceType.MODULE;
}
-
+
/*
* fields specific to VF Module resource type
*/
+ private String vfModuleName;
private String vfModuleType;
+ private String heatStackId;
private boolean hasVolumeGroup;
private boolean isBase;
private String vfModuleLabel;
private int initialCount;
-
+
/*
* GET && SET
*/
+ public String getVfModuleName() {
+ return vfModuleName;
+ }
+ public void setVfModuleName(String vfModuleName) {
+ this.vfModuleName = vfModuleName;
+ }
+ public String getHeatStackId() {
+ return heatStackId;
+ }
+ public void setHeatStackId(String heatStackId) {
+ this.heatStackId = heatStackId;
+ }
public boolean getIsBase() {
return isBase;
}
@@ -76,5 +90,5 @@ public class ModuleResource extends Resource {
public void setHasVolumeGroup(boolean hasVolumeGroup) {
this.hasVolumeGroup = hasVolumeGroup;
}
-
+
} \ No newline at end of file
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/OwningEntity.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/OwningEntity.java
new file mode 100644
index 0000000000..8fcbbd5d3f
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/OwningEntity.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.bpmn.core.domain;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+/**
+ * This class is used to store instance
+ * data of owningEntity for ServiceDecomposition
+ *
+ * @author bb3476
+ *
+ */
+@JsonRootName("owningEntity")
+public class OwningEntity extends JsonWrapper implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+ private String owningEntityId;
+ private String owningEntityName;
+ public String getOwningEntityId() {
+ return owningEntityId;
+ }
+ public void setOwningEntityId(String owningEntityId) {
+ this.owningEntityId = owningEntityId;
+ }
+ public String getOwningEntityName() {
+ return owningEntityName;
+ }
+ public void setOwningEntityName(String owningEntityName) {
+ this.owningEntityName = owningEntityName;
+ }
+
+} \ No newline at end of file
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Project.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Project.java
new file mode 100644
index 0000000000..8088585d23
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Project.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.bpmn.core.domain;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+/**
+ * This class is used to store instance
+ * data of projects for ServiceDecomposition
+ *
+ * @author bb3476
+ *
+ */
+@JsonRootName("project")
+public class Project extends JsonWrapper implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+ private String projectName;
+
+ public String getProjectName() {
+ return projectName;
+ }
+ public void setProjectName(String projectName) {
+ this.projectName = projectName;
+ }
+
+} \ No newline at end of file
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Request.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Request.java
new file mode 100644
index 0000000000..394528f897
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Request.java
@@ -0,0 +1,69 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.bpmn.core.domain;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+/**
+ * This class is used to store instance
+ * data of services aka ServiceDecomposition
+ *
+ * @author bb3476
+ *
+ */
+
+public class Request extends JsonWrapper implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+ private String sdncRequestId;
+ private String requestId;
+ private ModelInfo modelInfo;
+ private String productFamilyId;
+
+ public String getSdncRequestId() {
+ return sdncRequestId;
+ }
+ public void setSdncRequestId(String sdncRequestId) {
+ this.sdncRequestId = sdncRequestId;
+ }
+ public String getRequestId() {
+ return requestId;
+ }
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+ public String getProductFamilyId() {
+ return productFamilyId;
+ }
+ public void setProductFamilyId(String productFamilyId) {
+ this.productFamilyId = productFamilyId;
+ }
+
+
+} \ No newline at end of file
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Resource.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Resource.java
index 60c4fcedb9..ce5ad47a15 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Resource.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Resource.java
@@ -23,20 +23,23 @@ package org.openecomp.mso.bpmn.core.domain;
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
public abstract class Resource extends JsonWrapper implements Serializable {
private static final long serialVersionUID = 1L;
- private String resourceId;
+ private String resourceId; // TODO name this field just id instead, should be the id of the object as it is in aai
protected ResourceType resourceType; // Enum of vnf or network or allotted resource
protected ModelInfo modelInfo;
private long concurrencyCounter = 1L;
//private List modules;
private ResourceInstance resourceInstance = new ResourceInstance(); // TODO possibly remove
- private HomingSolution homingSolution = new HomingSolution(); // TODO maybe this instead of resourceInstance being "bridge"
+ private HomingSolution homingSolution = new HomingSolution();
+ @JsonInclude(JsonInclude.Include.NON_NULL)
+ private HomingSolution currentHomingSolution;
//common parameters for all Resources
private String toscaNodeType;
@@ -68,6 +71,12 @@ public abstract class Resource extends JsonWrapper implements Serializable {
public void setHomingSolution(HomingSolution homingSolution){
this.homingSolution = homingSolution;
}
+ public HomingSolution getCurrentHomingSolution() {
+ return currentHomingSolution;
+ }
+ public void setCurrentHomingSolution(HomingSolution currentHomingSolution) {
+ this.currentHomingSolution = currentHomingSolution;
+ }
public void setResourceType(ResourceType resourceType) {
this.resourceType = resourceType;
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceInstance.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceInstance.java
index 32cda68ba5..70977e1d86 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceInstance.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceInstance.java
@@ -25,25 +25,33 @@ import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
/**
- * This class is used to store instance
- * data of Resources
+ * Use resourceId in resource class instead
*
* @author cb645j
*
*/
//@JsonIgnoreProperties
+//TODO update any existing references then remove this pointless class
+@Deprecated
public class ResourceInstance extends JsonWrapper implements Serializable {
private static final long serialVersionUID = 1L;
private String instanceId;
private String instanceName;
- private HomingSolution homingSolution;
public String getInstanceId() {
return instanceId;
}
+
+ /**
+ * This class and method is deprecated so use
+ * resourceId field in resource class instead
+ *
+ * @author cb645j
+ *
+ */
public void setInstanceId(String instanceId) {
this.instanceId = instanceId;
}
@@ -53,10 +61,5 @@ public class ResourceInstance extends JsonWrapper implements Serializable {
public void setInstanceName(String instanceName) {
this.instanceName = instanceName;
}
- public HomingSolution getHomingSolution() {
- return homingSolution;
- }
- public void setHomingSolution(HomingSolution homingSolution) {
- this.homingSolution = homingSolution;
- }
+
} \ No newline at end of file
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceType.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceType.java
index 05bccb9e7a..65cf03cd15 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceType.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceType.java
@@ -22,5 +22,5 @@ package org.openecomp.mso.bpmn.core.domain;
public enum ResourceType {
- VNF, NETWORK, MODULE, ALLOTTED_RESOURCE // etc.
+ VNF, NETWORK, MODULE, ALLOTTED_RESOURCE, CONFIGURATION // etc.
} \ No newline at end of file
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceDecomposition.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceDecomposition.java
index 8581eee25a..077e5726d7 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceDecomposition.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceDecomposition.java
@@ -30,11 +30,13 @@ import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
-
+import org.json.JSONObject;
import org.openecomp.mso.bpmn.core.json.DecomposeJsonUtil;
import org.openecomp.mso.bpmn.core.json.JsonDecomposingException;
+
+
/**
* Service Decomposition Structure
* This Java object contains service information:
@@ -57,14 +59,69 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
@JsonProperty("serviceRole")
private String serviceRole;
private ServiceInstance serviceInstance;
+ private Request request;
+ private Customer customer;
+ private String callbackURN;
+ private String sdncVersion;
+ @JsonProperty("project")
+ private Project project;
+ @JsonProperty("owningEntity")
+ private OwningEntity owningEntity;
@JsonProperty("vnfResource")
private List <VnfResource> vnfResources;
@JsonProperty("networkResource")
private List <NetworkResource> networkResources;
@JsonProperty("allottedResource")
private List <AllottedResource> allottedResources;
+ @JsonProperty("configResource")
+ private List <ConfigResource> configResources;
public ServiceDecomposition () {
+ super();
+ }
+
+ public ServiceDecomposition (String catalogRestOutput) throws JsonDecomposingException {
+ ServiceDecomposition serviceDecomposition = DecomposeJsonUtil.jsonToServiceDecomposition(catalogRestOutput);
+ this.modelInfo = serviceDecomposition.getModelInfo();
+ this.vnfResources = serviceDecomposition.getServiceVnfs();
+ this.allottedResources = serviceDecomposition.getServiceAllottedResources();
+ this.networkResources = serviceDecomposition.getServiceNetworks();
+ this.serviceRole = serviceDecomposition.getServiceRole();
+ this.serviceType = serviceDecomposition.getServiceType();
+ this.configResources = serviceDecomposition.getServiceConfigResources();
+ }
+
+ /**
+ * Constructor taking Catalog DB Adapter REST output (serviceResources model) + service Instance ID
+ * @param catalogRestOutput
+ * @param serviceInstanceId
+ */
+ public ServiceDecomposition (String catalogRestOutput, String serviceInstanceId) throws JsonDecomposingException {
+ ServiceDecomposition serviceDecomposition = DecomposeJsonUtil.jsonToServiceDecomposition(catalogRestOutput);
+ this.modelInfo = serviceDecomposition.getModelInfo();
+ this.vnfResources = serviceDecomposition.getServiceVnfs();
+ this.allottedResources = serviceDecomposition.getServiceAllottedResources();
+ this.configResources = serviceDecomposition.getServiceConfigResources();
+ this.networkResources = serviceDecomposition.getServiceNetworks();
+
+ this.serviceRole = serviceDecomposition.getServiceRole();
+ this.serviceType = serviceDecomposition.getServiceType();
+
+ this.serviceInstance = new ServiceInstance();
+ this.serviceInstance.setInstanceId(serviceInstanceId);
+
+ this.project = serviceDecomposition.getProject();
+ this.owningEntity = serviceDecomposition.getOwningEntity();
+ }
+
+ /**
+ * Constructor taking a Service Decomposition JSON serialization
+ * @param catalogRestOutput
+ * @param serviceInstanceId
+ */
+ public ServiceDecomposition (JSONObject jsonServiceDecomposition, String serviceInstanceId) {
+ //TODO provide constructor implementation
+
}
//*****
@@ -86,6 +143,18 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
public void setServiceInstance(ServiceInstance serviceInstance) {
this.serviceInstance = serviceInstance;
}
+ public Project getProject() {
+ return project;
+ }
+ public OwningEntity getOwningEntity() {
+ return owningEntity;
+ }
+ public void setProject(Project project) {
+ this.project = project;
+ }
+ public void setOwningEntity(OwningEntity owningEntity) {
+ this.owningEntity = owningEntity;
+ }
public List<VnfResource> getServiceVnfs() {
return vnfResources;
}
@@ -95,6 +164,12 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
public List<NetworkResource> getServiceNetworks() {
return networkResources;
}
+ public void setServiceConfigs(List<ConfigResource> configResources) {
+ this.configResources = configResources;
+ }
+ public List<ConfigResource> getServiceConfigs() {
+ return configResources;
+ }
public void setServiceNetworks(List<NetworkResource> networkResources) {
this.networkResources = networkResources;
}
@@ -104,6 +179,12 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
public void setServiceAllottedResources(List<AllottedResource> allottedResources) {
this.allottedResources = allottedResources;
}
+ public List<ConfigResource> getServiceConfigResources() {
+ return configResources;
+ }
+ public void setServiceConfigResources(List<ConfigResource> configResources) {
+ this.configResources = configResources;
+ }
public String getServiceType() {
return serviceType;
}
@@ -119,6 +200,35 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
public void setServiceRole(String serviceRole) {
this.serviceRole = serviceRole;
}
+ public Request getRequest() {
+ return request;
+ }
+
+ public void setRequest(Request request) {
+ this.request = request;
+ }
+ public Customer getCustomer() {
+ return customer;
+ }
+ public void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
+ public String getCallbackURN() {
+ return callbackURN;
+ }
+
+ public void setCallbackURN(String callbackURN) {
+ this.callbackURN = callbackURN;
+ }
+
+ public String getSdncVersion() {
+ return sdncVersion;
+ }
+
+ public void setSdncVersion(String sdncVersion) {
+ this.sdncVersion = sdncVersion;
+ }
+
//*****
//*****
@@ -141,6 +251,9 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
if(this.getServiceVnfs() != null){
serviceResources.addAll(this.getServiceVnfs());
}
+ if(this.getServiceConfigResources() != null){
+ serviceResources.addAll(this.getServiceConfigResources());
+ }
return serviceResources;
}
@@ -151,7 +264,8 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
public String getServiceResourcesJsonString() {
return listToJson((this.getServiceNetworks())) +
listToJson((this.getServiceVnfs())) +
- listToJson((this.getServiceAllottedResources()));
+ listToJson((this.getServiceAllottedResources())) +
+ listToJson((this.getServiceConfigResources()));
}
/**
@@ -178,6 +292,14 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
public String getServiceAllottedResourcesJson(){
return listToJson(this.getServiceAllottedResources());
}
+ /**
+ * Returns a JSON list of all Config Resource structures (i.e. the serialized ConfigResource objects).
+ * @return
+ */
+ @JsonIgnore
+ public String getServiceConfigResourcesJson(){
+ return listToJson(this.getServiceConfigResources());
+ }
//TODO - define Resource Object ID
@JsonIgnore
@@ -224,7 +346,16 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
}
this.allottedResources.add((AllottedResource)allottedResource);
}
-
+ /**
+ * Add Config resource to the list
+ * @param allottedResource
+ */
+ public void addConfigResource(Resource configResource) {
+ if (configResources == null){
+ configResources = new ArrayList<>();
+ }
+ this.configResources.add((ConfigResource)configResource);
+ }
/**
* Add resource to the list
* Given a ResourceDecomposition (subclass) object, add it to the Service Decomposition (in the appropriate category, e.g. as a VNF, Network, or Allotted Resource).
@@ -243,6 +374,9 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
case ALLOTTED_RESOURCE:
this.addAllottedResource(resource);
break;
+ case CONFIGURATION:
+ this.addConfigResource(resource);
+ break;
default:
throw new IllegalArgumentException("Invalid resource type: " + resource.resourceType);
}
@@ -268,14 +402,22 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
}
/**
* Add resource to the list
- * @param jsonResource
+ * @param Resource
*/
public void addAllottedResource(String jsonResource) throws JsonDecomposingException {
AllottedResource allottedResource = null;
allottedResource = DecomposeJsonUtil.jsonToAllottedResource(jsonResource);
this.addVnfResource(allottedResource);
}
-
+ /**
+ * Add resource to the list
+ * @param Resource
+ */
+ public void addConfigResource(String jsonResource) throws JsonDecomposingException {
+ ConfigResource configResource = null;
+ configResource = DecomposeJsonUtil.jsonToConfigResource(jsonResource);
+ this.addVnfResource(configResource);
+ }
/**
* Given a ResourceDecomposition (subclass) object, locate it in the Service Decomposition by its unique ID, and replace the current version with the new one.
* This method should support concurrency control via an auto-incrementing field in the ResourceDecomposition class.
@@ -348,6 +490,9 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
case ALLOTTED_RESOURCE:
this.setServiceAllottedResources((List<AllottedResource>)(List<?>)resources);
break;
+ case CONFIGURATION:
+ this.setServiceConfigResources((List<ConfigResource>)(List<?>)resources);
+ break;
default:
throw new IllegalArgumentException("Invalid resource type: " + resources.get(0).resourceType);
}
@@ -375,4 +520,5 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
}
return null;
}
+
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceInstance.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceInstance.java
index ede995dbd6..aa5e9a035d 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceInstance.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceInstance.java
@@ -21,6 +21,9 @@
package org.openecomp.mso.bpmn.core.domain;
import java.io.Serializable;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonRootName;
/**
* This class is used to store instance
@@ -34,7 +37,33 @@ public class ServiceInstance extends JsonWrapper implements Serializable {
private static final long serialVersionUID = 1L;
private String instanceId;
private String instanceName;
+ private String orchestrationStatus;
+ private Configuration configuration;
+ private String serviceType;
+ private String serviceId;
+ private ModelInfo modelInfo;
+ private String environmentContext;
+ private String workloadContext;
+ private Map serviceParams;
+ public String getServiceType() {
+ return serviceType;
+ }
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+ public String getServiceId() {
+ return serviceId;
+ }
+ public void setServiceId(String serviceId) {
+ this.serviceId = serviceId;
+ }
+ public Map getServiceParams() {
+ return serviceParams;
+ }
+ public void setServiceParams(Map serviceParams) {
+ this.serviceParams = serviceParams;
+ }
public String getInstanceId() {
return instanceId;
}
@@ -47,4 +76,34 @@ public class ServiceInstance extends JsonWrapper implements Serializable {
public void setInstanceName(String instanceName) {
this.instanceName = instanceName;
}
+ public String getOrchestrationStatus() {
+ return orchestrationStatus;
+ }
+ public void setOrchestrationStatus(String orchestrationStatus) {
+ this.orchestrationStatus = orchestrationStatus;
+ }
+ public Configuration getConfiguration() {
+ return configuration;
+ }
+ public void setConfiguration(Configuration configuration) {
+ this.configuration = configuration;
+ }
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+ public String getEnvironmentContext() {
+ return environmentContext;
+ }
+ public void setEnvironmentContext(String environmentContext) {
+ this.environmentContext = environmentContext;
+ }
+ public String getWorkloadContext() {
+ return workloadContext;
+ }
+ public void setWorkloadContext(String workloadContext) {
+ this.workloadContext = workloadContext;
+ }
} \ No newline at end of file
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/TunnelConnect.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/TunnelConnect.java
new file mode 100644
index 0000000000..01e7245aa7
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/TunnelConnect.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.bpmn.core.domain;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+/**
+ * This class represents the specifics of a tunnel
+ * cross connect piece of a resource
+ *
+ * @author cb645j
+ *
+ *TODO This may change to house both isp speeds
+ */
+@JsonRootName("tunnelConnect")
+public class TunnelConnect extends JsonWrapper implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+ private String id;
+ private String upBandwidth;
+ private String downBandwidth;
+ private String upBandwidth2;
+ private String downBandwidth2;
+
+
+ public String getId() {
+ return id;
+ }
+ public void setId(String id) {
+ this.id = id;
+ }
+ public String getUpBandwidth() {
+ return upBandwidth;
+ }
+ public void setUpBandwidth(String upBandwidth) {
+ this.upBandwidth = upBandwidth;
+ }
+ public String getDownBandwidth() {
+ return downBandwidth;
+ }
+ public void setDownBandwidth(String downBandwidth) {
+ this.downBandwidth = downBandwidth;
+ }
+ public String getUpBandwidth2() {
+ return upBandwidth2;
+ }
+ public void setUpBandwidth2(String upBandwidth2) {
+ this.upBandwidth2 = upBandwidth2;
+ }
+ public String getDownBandwidth2() {
+ return downBandwidth2;
+ }
+ public void setDownBandwidth2(String downBandwidth2) {
+ this.downBandwidth2 = downBandwidth2;
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/VnfResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/VnfResource.java
index 20903c0717..a328ddf719 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/VnfResource.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/VnfResource.java
@@ -44,17 +44,19 @@ public class VnfResource extends Resource {
resourceType = ResourceType.VNF;
setResourceId(UUID.randomUUID().toString());
}
-
+
/*
* fields specific to VNF resource type
*/
@JsonProperty("vfModules")
private List <ModuleResource> vfModules;
+ private String vnfHostname;
private String vnfType;
private String nfFunction;
private String nfType;
private String nfRole;
private String nfNamingCode;
+ private String multiStageDesign;
/*
* GET and SET
@@ -65,6 +67,12 @@ public class VnfResource extends Resource {
public void setModules(List<ModuleResource> moduleResources) {
this.vfModules = moduleResources;
}
+ public String getVnfHostname() {
+ return vnfHostname;
+ }
+ public void setVnfHostname(String vnfHostname) {
+ this.vnfHostname = vnfHostname;
+ }
@Deprecated
public void setVnfType(String vnfType) {
this.vnfType = vnfType;
@@ -96,10 +104,16 @@ public class VnfResource extends Resource {
public void setNfNamingCode(String nfNamingCode) {
this.nfNamingCode = nfNamingCode;
}
+ public String getMultiStageDesign() {
+ return multiStageDesign;
+ }
+ public void setMultiStageDesign(String multiStageDesign) {
+ this.multiStageDesign = multiStageDesign;
+ }
/*
* GET accessors per design requirements
*/
-
+
/**
* Returns a list of all VfModule objects.
* Base module is first entry in the list
@@ -110,7 +124,7 @@ public class VnfResource extends Resource {
if (vfModules == null) {
return null;
}
-
+
for (int i = 0; i < vfModules.size(); i++) {
ModuleResource moduleResource = vfModules.get(i);
if (moduleResource.getIsBase()){
@@ -120,17 +134,17 @@ public class VnfResource extends Resource {
}
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){
@@ -138,12 +152,12 @@ public class VnfResource extends Resource {
}
this.vfModules.add(moduleResource);
}
-
+
/**
- * Utility method to allow construction of the filed in the form of
+ * Utility method to allow construction of the filed in the form of
* <serviceResources.modelInfo.modelName>/<serviceVnfs.modelInfo.modelInstanceName>
- *
+ *
* default setter for this field deprecated
* @param modelName << serviceResources.modelInfo.modelName
*/
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/DecomposeJsonUtil.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/DecomposeJsonUtil.java
index dcd9e3b39a..8ab93f2842 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/DecomposeJsonUtil.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/DecomposeJsonUtil.java
@@ -20,16 +20,22 @@
package org.openecomp.mso.bpmn.core.json;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
+import java.io.Serializable;
+
import org.openecomp.mso.bpmn.core.domain.AllottedResource;
+import org.openecomp.mso.bpmn.core.domain.ConfigResource;
import org.openecomp.mso.bpmn.core.domain.NetworkResource;
import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition;
import org.openecomp.mso.bpmn.core.domain.ServiceInstance;
import org.openecomp.mso.bpmn.core.domain.VnfResource;
-public class DecomposeJsonUtil {
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class DecomposeJsonUtil implements Serializable {
+
+ private static final long serialVersionUID = 1L;
private static final ObjectMapper OBJECT_MAPPER = createObjectMapper();
@@ -51,7 +57,10 @@ public class DecomposeJsonUtil {
*/
public static ServiceDecomposition jsonToServiceDecomposition(String jsonString) throws JsonDecomposingException {
try {
- return OBJECT_MAPPER.readValue(jsonString, ServiceDecomposition.class);
+ ObjectMapper om = new ObjectMapper();
+ om.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
+ om.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ return om.readValue(jsonString, ServiceDecomposition.class);
} catch (IOException e) {
throw new JsonDecomposingException("Exception while converting json to service decomposition", e);
}
@@ -118,4 +127,12 @@ public class DecomposeJsonUtil {
throw new JsonDecomposingException("Exception while converting json to allotted resource", e);
}
}
+
+ public static ConfigResource jsonToConfigResource(String jsonString) throws JsonDecomposingException {
+ try {
+ return OBJECT_MAPPER.readValue(jsonString, ConfigResource.class);
+ } catch (IOException e) {
+ throw new JsonDecomposingException("Exception while converting json to allotted resource", e);
+ }
+ }
} \ No newline at end of file
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java
index bfad9bac26..79b9239015 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java
@@ -21,27 +21,42 @@
package org.openecomp.mso.bpmn.core.json;
+import java.io.IOException;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.HashMap;
import java.util.StringTokenizer;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.runtime.Execution;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.XML;
-
+import org.openecomp.mso.apihandler.common.ValidationException;
//import org.openecomp.mso.bpmn.core.BPMNLogger;
import org.openecomp.mso.bpmn.core.xml.XmlTool;
import org.openecomp.mso.logger.MsoLogger;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.github.fge.jackson.JsonLoader;
+import com.github.fge.jsonschema.core.exceptions.ProcessingException;
+import com.github.fge.jsonschema.core.report.ProcessingReport;
+import com.github.fge.jsonschema.main.JsonSchemaFactory;
+import com.github.fge.jsonschema.main.JsonValidator;
+
/**
* Utility class for JSON processing
*
* @version 1.0
+ *
+ * Note: It was observed, that depending on the JSON implementation, an org.json.JSONException or a
+ * java.util.NoSuchElementException will be thrown in the event of the key value being "not found"
+ * in a JSON document. A general check has been added to the applicable catch blocks for this
+ * this type of behavior to reduce the amount of logging. As a key value not being found is
+ * expect behavior, it makes no sense to log the stack trace associated with this type of failure.
*/
public class JsonUtils {
@@ -117,7 +132,7 @@ public class JsonUtils {
* to convert a JSONObject to an XML Doc. The intent of this is to
* correctly generate XML from JSON including TAGs for JSONArrays
*
- * @param obj object to be converted to XML
+ * @param obj org.json.JSON object to be converted to XML
* @param tagName optional XML tagname supplied primarily during recursive calls
* @return String containing the XML translation
*/
@@ -391,12 +406,12 @@ public class JsonUtils {
msoLogger.debug("getJsonValue(): the raw value is an Integer Object=" + rawValue);
return (Integer) rawValue;
} else {
- msoLogger.debug("getJsonValue(): the raw value is NOT an Integer Object=" + rawValue.toString());
+ msoLogger.debug("getJsonIntValue(): the raw value is NOT an Integer Object=" + rawValue.toString());
return 0;
}
}
} catch (Exception e) {
- msoLogger.debug("getJsonValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(), e);
+ msoLogger.debug("getJsonIntValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(), e);
}
return 0;
}
@@ -416,15 +431,15 @@ public class JsonUtils {
return false;
} else {
if (rawValue instanceof Boolean) {
- msoLogger.debug("getJsonValue(): the raw value is a Boolean Object=" + rawValue);
+ msoLogger.debug("getJsonBooleanValue(): the raw value is a Boolean Object=" + rawValue);
return (Boolean) rawValue;
} else {
- msoLogger.debug("getJsonValue(): the raw value is NOT an Boolean Object=" + rawValue.toString());
+ msoLogger.debug("getJsonBooleanValue(): the raw value is NOT an Boolean Object=" + rawValue.toString());
return false;
}
}
} catch (Exception e) {
- msoLogger.debug("getJsonValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(),e);
+ msoLogger.debug("getJsonBooleanValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(),e);
}
return false;
}
@@ -472,7 +487,7 @@ public class JsonUtils {
for (int i = 0; i < arrayLen; i++) {
msoLogger.debug("getJsonParamValue(): index: " + i + ", value: " + ((JSONArray) rawValue).get(i).toString());
if (((JSONArray) rawValue).get(i) instanceof JSONObject) {
- msoLogger.debug("getJsonParamValue(): index: " + i + " is a JSONObject");
+// msoLogger.debug("getJsonParamValue(): index: " + i + " is a JSONObject");
JSONObject jsonObj = (JSONObject)((JSONArray) rawValue).get(i);
String parmValue = jsonObj.get(name).toString();
if (parmValue != null) {
@@ -498,11 +513,13 @@ public class JsonUtils {
return null;
}
}
- } catch (JSONException je) {
- // JSONObject::get() throws this exception if one of the specified keys is not found
- msoLogger.debug("getJsonParamValue(): caught JSONException attempting to retrieve param value for keys:" + keys + ", name=" + name, je);
} catch (Exception e) {
+ // JSONObject::get() throws a "not found" exception if one of the specified keys is not found
+ if (e.getMessage().contains("not found")) {
+ msoLogger.debug("getJsonParamValue(): failed to retrieve param value for keys:" + keys + ", name=" + name + ": " + e.getMessage());
+ } else {
msoLogger.debug("getJsonParamValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(), e);
+ }
}
return null;
}
@@ -539,23 +556,25 @@ public class JsonUtils {
String keyValue = null;
try {
if (jsonObj.has(key)) {
- msoLogger.debug("getJsonValueForKey(): found value for key=" + key);
Object value = jsonObj.get(key);
- if (value == null)
+ msoLogger.debug("getJsonValueForKey(): found value=" + (String) value + ", for key=" + key);
+ if (value == null) {
return null;
- else
+ } else {
return ((String) value);
+ }
} else {
- msoLogger.debug("getJsonValueForKey(): iterating over the keys");
+// msoLogger.debug("getJsonValueForKey(): iterating over the keys");
Iterator <String> itr = jsonObj.keys();
while (itr.hasNext()) {
String nextKey = itr.next();
Object obj = jsonObj.get(nextKey);
if (obj instanceof JSONObject) {
- msoLogger.debug("getJsonValueForKey(): key=" + nextKey + ", points to JSONObject, recursive call");
+// msoLogger.debug("getJsonValueForKey(): key=" + nextKey + ", points to JSONObject, recursive call on: " +
+// ((JSONObject) obj).toString(MSOJsonIndentFactor));
keyValue = getJsonValueForKey((JSONObject) obj, key);
if (keyValue != null) {
- msoLogger.debug("getJsonValueForKey(): found value=" + keyValue + ", for key=" + key);
+// msoLogger.debug("getJsonValueForKey(): found value=" + keyValue + ", for key=" + key);
break;
}
} else {
@@ -563,12 +582,14 @@ public class JsonUtils {
}
}
}
- } catch (JSONException je) {
- // JSONObject::get() throws this exception if one of the specified keys is not found
- msoLogger.debug("getJsonValueForKey(): caught JSONException attempting to retrieve value for key=" + key, je);
- keyValue = null;
} catch (Exception e) {
+ // JSONObject::get() throws a "not found" exception if one of the specified keys is not found
+ if (e.getMessage().contains("not found")) {
+ msoLogger.debug("getJsonValueForKey(): failed to retrieve param value for key=" + key + ": " + e.getMessage());
+ } else {
msoLogger.debug("getJsonValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString(), e);
+ }
+ keyValue = null;
}
return keyValue;
}
@@ -583,35 +604,38 @@ public class JsonUtils {
*/
public static Integer getJsonIntValueForKey(JSONObject jsonObj, String key) {
// String isDebugLogEnabled = "true";
- Integer keyValue = 0;
+ Integer keyValue = null;
try {
if (jsonObj.has(key)) {
- msoLogger.debug("getJsonValueForKey(): found value for key=" + key);
- return (Integer) jsonObj.get(key);
+ Integer value = (Integer) jsonObj.get(key);
+ msoLogger.debug("getJsonIntValueForKey(): found value=" + value + ", for key=" + key);
+ return value;
} else {
- msoLogger.debug("getJsonValueForKey(): iterating over the keys");
+// msoLogger.debug("getJsonIntValueForKey(): iterating over the keys");
Iterator <String> itr = jsonObj.keys();
while (itr.hasNext()) {
String nextKey = itr.next();
Object obj = jsonObj.get(nextKey);
if (obj instanceof JSONObject) {
- msoLogger.debug("getJsonValueForKey(): key=" + nextKey + ", points to JSONObject, recursive call");
+// msoLogger.debug("getJsonIntValueForKey(): key=" + nextKey + ", points to JSONObject, recursive call");
keyValue = getJsonIntValueForKey((JSONObject) obj, key);
if (keyValue != null) {
- msoLogger.debug("getJsonValueForKey(): found value=" + keyValue + ", for key=" + key);
+// msoLogger.debug("getJsonIntValueForKey(): found value=" + keyValue + ", for key=" + key);
break;
}
} else {
- msoLogger.debug("getJsonValueForKey(): key=" + nextKey + ", does not point to a JSONObject, next key");
+ msoLogger.debug("getJsonIntValueForKey(): key=" + nextKey + ", does not point to a JSONObject, next key");
}
}
}
- } catch (JSONException je) {
- // JSONObject::get() throws this exception if one of the specified keys is not found
- msoLogger.debug("getJsonValueForKey(): caught JSONException attempting to retrieve value for key=" + key, je);
- keyValue = null;
} catch (Exception e) {
- msoLogger.debug("getJsonValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString(),e);
+ // JSONObject::get() throws a "not found" exception if one of the specified keys is not found
+ if (e.getMessage().contains("not found")) {
+ msoLogger.debug("getJsonIntValueForKey(): failed to retrieve param value for key=" + key + ": " + e.getMessage());
+ } else {
+ msoLogger.debug("getJsonIntValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString(),e);
+ }
+ keyValue = null;
}
return keyValue;
}
@@ -625,22 +649,23 @@ public class JsonUtils {
* @return String field value associated with key
*/
public static Boolean getJsonBooleanValueForKey(JSONObject jsonObj, String key) {
- Boolean keyValue = false;
+ Boolean keyValue = null;
try {
if (jsonObj.has(key)) {
- msoLogger.debug("getJsonBooleanValueForKey(): found value for key=" + key);
- return (Boolean) jsonObj.get(key);
+ Boolean value = (Boolean) jsonObj.get(key);
+ msoLogger.debug("getJsonBooleanValueForKey(): found value=" + value + ", for key=" + key);
+ return value;
} else {
- msoLogger.debug("getJsonBooleanValueForKey(): iterating over the keys");
+// msoLogger.debug("getJsonBooleanValueForKey(): iterating over the keys");
Iterator <String> itr = jsonObj.keys();
while (itr.hasNext()) {
String nextKey = itr.next();
Object obj = jsonObj.get(nextKey);
if (obj instanceof JSONObject) {
- msoLogger.debug("getJsonBooleanValueForKey(): key=" + nextKey + ", points to JSONObject, recursive call");
+// msoLogger.debug("getJsonBooleanValueForKey(): key=" + nextKey + ", points to JSONObject, recursive call");
keyValue = getJsonBooleanValueForKey((JSONObject) obj, key);
if (keyValue != null) {
- msoLogger.debug("getJsonBooleanValueForKey(): found value=" + keyValue + ", for key=" + key);
+// msoLogger.debug("getJsonBooleanValueForKey(): found value=" + keyValue + ", for key=" + key);
break;
}
} else {
@@ -648,12 +673,14 @@ public class JsonUtils {
}
}
}
- } catch (JSONException je) {
- // JSONObject::get() throws this exception if one of the specified keys is not found
- msoLogger.debug("getJsonBooleanValueForKey(): caught JSONException attempting to retrieve value for key=" + key,je);
- keyValue = null;
} catch (Exception e) {
+ // JSONObject::get() throws a "not found" exception if one of the specified keys is not found
+ if (e.getMessage().contains("not found")) {
+ msoLogger.debug("getJsonBooleanValueForKey(): failed to retrieve param value for key=" + key + ": " + e.getMessage());
+ } else {
msoLogger.debug("getJsonBooleanValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString(),e);
+ }
+ keyValue = null;
}
return keyValue;
}
@@ -773,7 +800,7 @@ public class JsonUtils {
keyStr = keyTokens.nextToken();
Object keyValue = jsonObj.get(keyStr);
if (keyValue instanceof JSONObject) {
- msoLogger.debug("getJsonRawValue(): key=" + keyStr + " points to json object");
+// msoLogger.debug("getJsonRawValue(): key=" + keyStr + " points to json object");
jsonObj = (JSONObject) keyValue;
} else {
if (keyTokens.hasMoreElements()) {
@@ -795,11 +822,13 @@ public class JsonUtils {
return jsonObj.toString();
}
- } catch (JSONException je) {
- // JSONObject::get() throws this exception if one of the specified keys is not found
- msoLogger.debug("getJsonRawValue(): caught JSONException attempting to retrieve raw value for key=" + keyStr,je);
} catch (Exception e) {
+ // JSONObject::get() throws a "not found" exception if one of the specified keys is not found
+ if (e.getMessage().contains("not found")) {
+ msoLogger.debug("getJsonRawValue(): failed to retrieve param value for key=" + keyStr + ": " + e.getMessage());
+ } else {
msoLogger.debug("getJsonRawValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(),e);
+ }
}
return null;
}
@@ -823,7 +852,7 @@ public class JsonUtils {
if (keyTokens.hasMoreElements()) {
Object keyValue = jsonObj.get(keyStr);
if (keyValue instanceof JSONObject) {
- msoLogger.debug("putJsonValue(): key=" + keyStr + " points to json object");
+// msoLogger.debug("putJsonValue(): key=" + keyStr + " points to json object");
jsonObj = (JSONObject) keyValue;
} else {
msoLogger.debug("putJsonValue(): key=" + keyStr + " not the last key but points to non-json object: " + keyValue);
@@ -837,12 +866,13 @@ public class JsonUtils {
// should not hit this point if the key points to a valid key value
return null;
- } catch (JSONException je) {
- // JSONObject::get() throws this exception if one of the specified keys is not found
- msoLogger.debug("putJsonValue(): caught JSONException attempting to retrieve value for key=" + keyStr,je);
- return null;
} catch (Exception e) {
+ // JSONObject::get() throws a "not found" exception if one of the specified keys is not found
+ if (e.getMessage().contains("not found")) {
+ msoLogger.debug("putJsonValue(): failed to put param value for key=" + keyStr + ": " + e.getMessage());
+ } else {
msoLogger.debug("putJsonValue(): unable to parse json to put value for key=" + keys + ". Exception was: " + e.toString(),e);
+ }
}
return null;
}
@@ -856,23 +886,25 @@ public class JsonUtils {
*
* @return Map - a Map containing the entries
*/
- public Map<String, String> entryArrayToMap(Execution execution, String entryArray) {
- msoLogger.debug("Started Entry Array To Map Util Method");
+ public Map<String, String> jsonStringToMap(DelegateExecution execution, String entry) {
+ msoLogger.debug("Started Json String To Map Method");
Map<String, String> map = new HashMap<>();
//Populate Map
- String entryListJson = "{ \"entry\":" + entryArray + "}";
- JSONObject obj = new JSONObject(entryListJson);
- JSONArray arr = obj.getJSONArray("entry");
- for (int i = 0; i < arr.length(); i++){
- JSONObject jo = arr.getJSONObject(i);
- String key = jo.getString("key");
- String value =jo.getString("value");
- map.put(key, value);
+ JSONObject obj = new JSONObject(entry);
+
+ /* Wildfly is pushing a version of org.json which does not
+ * auto cast to string. Leaving it as an object prevents
+ * a method not found exception at runtime.
+ */
+ final Iterator<String> keys = obj.keys();
+ while (keys.hasNext()) {
+ final String key = keys.next();
+ map.put(key, obj.getString(key));
}
msoLogger.debug("Outgoing Map is: " + map);
- msoLogger.debug("Completed Entry Array To Map Util Method");
+ msoLogger.debug("Completed Json String To Map Method");
return map;
}
@@ -888,14 +920,14 @@ public class JsonUtils {
* @return Map - a Map containing the entries
*
*/
- public Map<String, String> entryArrayToMap(Execution execution, String entryArray, String keyNode, String valueNode) {
+ public Map<String, String> entryArrayToMap(DelegateExecution execution, String entryArray, String keyNode, String valueNode) {
msoLogger.debug("Started Entry Array To Map Util Method");
Map<String, String> map = new HashMap<>();
//Populate Map
- String entryListJson = "{ \"entry\":" + entryArray + "}";
+ String entryListJson = "{ \"wrapper\":" + entryArray + "}";
JSONObject obj = new JSONObject(entryListJson);
- JSONArray arr = obj.getJSONArray("entry");
+ JSONArray arr = obj.getJSONArray("wrapper");
for (int i = 0; i < arr.length(); i++){
JSONObject jo = arr.getJSONObject(i);
String key = jo.getString(keyNode);
@@ -961,4 +993,35 @@ public class JsonUtils {
return true;
}
-} \ No newline at end of file
+ /**
+ *
+ * Validates the JSON document against a schema file.
+ *
+ * @param jsonStr String containing the JSON doc
+ * @param jsonSchemaPath full path to a valid JSON schema file
+ * @return String the validation results/report
+ *
+ *
+ */
+ public static String jsonSchemaValidation(String jsonStr, String jsonSchemaPath) throws ValidationException {
+ try {
+ msoLogger.debug("JSON document to be validated: " + jsonStr);
+ JsonNode document = JsonLoader.fromString(jsonStr);
+// JsonNode document = JsonLoader.fromFile(jsonDoc);
+ JsonNode schema = JsonLoader.fromPath(jsonSchemaPath);
+
+ JsonSchemaFactory factory = JsonSchemaFactory.byDefault();
+ JsonValidator validator = factory.getValidator();
+
+ ProcessingReport report = validator.validate(schema, document);
+ msoLogger.debug("JSON schema validation report: " + report.toString());
+ return report.toString();
+ } catch (IOException e) {
+ msoLogger.debug("IOException performing JSON schema validation on document: " + e.toString());
+ throw new ValidationException(e.getMessage());
+ } catch (ProcessingException e) {
+ msoLogger.debug("ProcessingException performing JSON schema validation on document: " + e.toString());
+ throw new ValidationException(e.getMessage());
+ }
+ }
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonWrapper.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonWrapper.java
index 2fe625849b..1efcf5f286 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonWrapper.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonWrapper.java
@@ -77,11 +77,11 @@ public abstract class JsonWrapper implements Serializable {
public JSONObject toJsonObject() {
ObjectMapper mapper = new ObjectMapper();
- // mapper.configure(SerializationConfig.Feature.WRAP_ROOT_VALUE, true);
+ // mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
//mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
- // mapper.enable(org.codehaus.jackson.map.DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+ // mapper.enable(com.fasterxml.jackson.map.DeserializationFeature.UNWRAP_ROOT_VALUE);
JSONObject json = new JSONObject();
try {
json = new JSONObject(mapper.writeValueAsString(this));
@@ -128,4 +128,4 @@ public abstract class JsonWrapper implements Serializable {
public String toString() {
return this.toJsonString();
}
-} \ No newline at end of file
+}