aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-adapters-rest-interface/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-adapters-rest-interface/src/main')
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java8
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java6
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java8
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java6
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapAdapter.java62
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapElements.java37
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapEntry.java36
7 files changed, 161 insertions, 2 deletions
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java
index c62dc0dfbf..a136ff778d 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java
@@ -23,9 +23,14 @@ package org.onap.so.adapters.vnfrest;
import java.util.HashMap;
import java.util.Map;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.onap.so.entity.MsoRequest;
+import org.onap.so.openstack.mappers.MapAdapter;
import com.fasterxml.jackson.annotation.JsonRootName;
@@ -35,6 +40,7 @@ import com.fasterxml.jackson.annotation.JsonRootName;
*/
@JsonRootName("createVfModuleRequest")
@XmlRootElement(name = "createVfModuleRequest")
+@XmlAccessorType(XmlAccessType.FIELD)
public class CreateVfModuleRequest extends VfRequestCommon {
private String cloudSiteId;
private String tenantId;
@@ -57,7 +63,7 @@ public class CreateVfModuleRequest extends VfRequestCommon {
private Boolean failIfExists = false;
private Boolean backout = true;
private Boolean enableBridge;
-
+ @XmlJavaTypeAdapter(MapAdapter.class)
private Map<String, Object> vfModuleParams = new HashMap<>();
private MsoRequest msoRequest = new MsoRequest();
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java
index 214abd4e9d..d402004d57 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java
@@ -24,14 +24,19 @@ package org.onap.so.adapters.vnfrest;
import java.util.HashMap;
import java.util.Map;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.onap.so.entity.MsoRequest;
+import org.onap.so.openstack.mappers.MapAdapter;
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("createVolumeGroupRequest")
@XmlRootElement(name = "createVolumeGroupRequest")
+@XmlAccessorType(XmlAccessType.FIELD)
public class CreateVolumeGroupRequest extends VfRequestCommon {
private String cloudSiteId;
private String tenantId;
@@ -41,6 +46,7 @@ public class CreateVolumeGroupRequest extends VfRequestCommon {
private String vnfVersion;
private String vfModuleType;
private String modelCustomizationUuid;
+ @XmlJavaTypeAdapter(MapAdapter.class)
private Map<String,Object> volumeGroupParams = new HashMap<>();
private Boolean failIfExists;
private Boolean enableBridge;
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java
index 1c7696a79b..bac9eae2c5 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java
@@ -24,14 +24,19 @@ package org.onap.so.adapters.vnfrest;
import java.util.HashMap;
import java.util.Map;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.onap.so.entity.MsoRequest;
+import org.onap.so.openstack.mappers.MapAdapter;
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("updateVfModuleRequest")
@XmlRootElement(name = "updateVfModuleRequest")
+@XmlAccessorType(XmlAccessType.FIELD)
public class UpdateVfModuleRequest extends VfRequestCommon {
private String cloudSiteId;
@@ -57,7 +62,8 @@ public class UpdateVfModuleRequest extends VfRequestCommon {
private String requestType;
private Boolean failIfExists;
private Boolean backout;
-
+
+ @XmlJavaTypeAdapter(MapAdapter.class)
private Map<String,Object> vfModuleParams = new HashMap<>();
private MsoRequest msoRequest = new MsoRequest();
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java
index 8ddef1eeaf..d3b685a1d0 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java
@@ -24,14 +24,19 @@ package org.onap.so.adapters.vnfrest;
import java.util.HashMap;
import java.util.Map;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.onap.so.entity.MsoRequest;
+import org.onap.so.openstack.mappers.MapAdapter;
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("updateVolumeGroupRequest")
@XmlRootElement(name = "updateVolumeGroupRequest")
+@XmlAccessorType(XmlAccessType.FIELD)
public class UpdateVolumeGroupRequest extends VfRequestCommon {
private String cloudSiteId;
private String tenantId;
@@ -41,6 +46,7 @@ public class UpdateVolumeGroupRequest extends VfRequestCommon {
private String vnfVersion;
private String vfModuleType;
private String modelCustomizationUuid;
+ @XmlJavaTypeAdapter(MapAdapter.class)
private Map<String,Object> volumeGroupParams = new HashMap<>();
private MsoRequest msoRequest = new MsoRequest();
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapAdapter.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapAdapter.java
new file mode 100644
index 0000000000..e816646e1c
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapAdapter.java
@@ -0,0 +1,62 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 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.onap.so.openstack.mappers;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
+import org.w3c.dom.Element;
+
+public class MapAdapter extends XmlAdapter<MapEntry, Map<String, Object>> {
+
+ @Override
+ public MapEntry marshal(Map<String, Object> v) throws Exception {
+
+ if (v == null || v.isEmpty()) {return null;}
+
+ MapEntry map = new MapEntry();
+
+ for (String key : v.keySet()) {
+ map.addEntry(key, v.get(key));
+ }
+
+ return map;
+ }
+
+ @Override
+ public Map<String, Object> unmarshal(MapEntry v) throws Exception {
+ if (v == null) {return null;}
+
+ Map<String, Object> map = new HashMap<>(v.entry.size());
+
+ for(MapElements entry: v.entry) {
+ if (entry.value instanceof Element) {
+ map.put(entry.key, ((Element)entry.value).getTextContent());
+ } else {
+ map.put(entry.key, entry.value);
+ }
+ }
+
+ return map;
+ }
+}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapElements.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapElements.java
new file mode 100644
index 0000000000..709393bb84
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapElements.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 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.onap.so.openstack.mappers;
+
+import javax.xml.bind.annotation.XmlElement;
+
+public class MapElements
+{
+ @XmlElement public String key;
+ @XmlElement public Object value;
+
+ public MapElements() {} //Required by JAXB
+
+ public MapElements(String key, Object value)
+ {
+ this.key = key;
+ this.value = value;
+ }
+}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapEntry.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapEntry.java
new file mode 100644
index 0000000000..e6dc0e0538
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapEntry.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 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.onap.so.openstack.mappers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MapEntry {
+
+ public List<MapElements> entry = new ArrayList<>();
+
+ public MapEntry() {} //Required by JAXB
+
+ public void addEntry(String key, Object value) {
+ entry.add(new MapElements(key, value));
+ }
+
+}