summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/MapAction.java
diff options
context:
space:
mode:
authorStone, Avi (as206k) <as206k@att.com>2018-04-12 15:12:44 +0300
committerStone, Avi (as206k) <as206k@att.com>2018-04-12 15:16:30 +0300
commit438bdef0d2473a4db83aac3d71d4596b223879d7 (patch)
treec6cd021d4b64d83c435ae07143ee4aa1ae0cfd6b /src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/MapAction.java
parenta5e73f1e0597834ba46754aaae4683f7acf06e47 (diff)
DCAE-D property initial commit
DCAE-D property initial commit Change-Id: I5ba79eddaa1732524e30652b679e4dd5dfed56b5 Issue-ID: SDC-1218 Signed-off-by: Stone, Avi (as206k) <as206k@att.com>
Diffstat (limited to 'src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/MapAction.java')
-rw-r--r--src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/MapAction.java92
1 files changed, 92 insertions, 0 deletions
diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/MapAction.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/MapAction.java
new file mode 100644
index 0000000..b7988f4
--- /dev/null
+++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/MapAction.java
@@ -0,0 +1,92 @@
+package org.onap.sdc.dcae.composition.restmodels.ruleeditor;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import com.google.gson.annotations.SerializedName;
+
+public class MapAction extends BaseAction {
+
+ private Transform map;
+
+ public Transform getMap() {
+ return map;
+ }
+
+ public void setMap(Transform map) {
+ this.map = map;
+ }
+
+ public List<UIHashMap> getMapValues() {
+ return null == map? null : map.values;
+ }
+
+ public boolean mapHasDefault() {
+ return null != map && map.haveDefault;
+ }
+
+ public String getMapDefaultValue() {
+ return null == map? null : map.defaultValue;
+ }
+
+
+ private class Transform {
+ @SerializedName("default")
+ private String defaultValue;
+ private boolean haveDefault;
+ private List<UIHashMap> values;
+
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ public void setDefaultValue(String defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ public boolean isHaveDefault() {
+ return haveDefault;
+ }
+
+ public void setHaveDefault(boolean haveDefault) {
+ this.haveDefault = haveDefault;
+ }
+
+ public List<UIHashMap> getValues() {
+ return values;
+ }
+
+ public void setValues(List<UIHashMap> values) {
+ this.values = values;
+ }
+
+ }
+
+ private class UIHashMap {
+ private String key;
+ private String value;
+
+ public String getKey() {
+ return key;
+ }
+
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ }
+
+ public Map<String, String> transformToMap() throws IllegalStateException {
+ return getMap().getValues().stream().collect(Collectors.toMap(UIHashMap::getKey, UIHashMap::getValue));
+ }
+
+}