diff options
author | Thomas Lenz <tlenz@iaik.tugraz.at> | 2018-06-25 13:22:20 +0200 |
---|---|---|
committer | Thomas Lenz <tlenz@iaik.tugraz.at> | 2018-06-25 13:22:20 +0200 |
commit | 30e324851d67bd900471457e3c30a19b4073ec77 (patch) | |
tree | 26dc86ca4bee05522dd2eff7ea5dfcbe626d68af /id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils | |
parent | 55f71502a0b62624d5ebc0e4aa749b3f5d5a0bf2 (diff) | |
download | moa-id-spss-30e324851d67bd900471457e3c30a19b4073ec77.tar.gz moa-id-spss-30e324851d67bd900471457e3c30a19b4073ec77.tar.bz2 moa-id-spss-30e324851d67bd900471457e3c30a19b4073ec77.zip |
add SP specific configuration for SL2.0
Diffstat (limited to 'id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils')
-rw-r--r-- | id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/KeyValueUtils.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/KeyValueUtils.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/KeyValueUtils.java index 40ef5a23a..a206c9125 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/KeyValueUtils.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/KeyValueUtils.java @@ -34,6 +34,7 @@ import java.util.Set; import org.apache.commons.lang3.StringUtils; +import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.util.MiscUtil; /** @@ -44,6 +45,8 @@ public class KeyValueUtils { public static final String KEY_DELIMITER = "."; public static final String CSV_DELIMITER = ","; + public static final String KEYVVALUEDELIMITER = "="; + public static final String DEFAULT_VALUE = "default"; /** * Convert Java properties into a Map<String, String> @@ -328,6 +331,29 @@ public class KeyValueUtils { } /** + * Convert a List of String elements to a Map of Key/Value pairs + * <br> + * Every List element used as a key/value pair and the '=' sign represents the delimiter between key and value + * + * @param elements List of key/value elements + * @return Map of Key / Value pairs, but never null + */ + public static Map<String, String> convertListToMap(List<String> elements) { + Map<String, String> map = new HashMap<String, String>(); + for (String el : elements) { + if (el.contains(KEYVVALUEDELIMITER)) { + String[] split = el.split(KEYVVALUEDELIMITER); + map.put(split[0], split[1]); + + } else + Logger.debug("Key/Value Mapper: '" + el + "' contains NO '='. Ignore it."); + + } + + return map; + } + + /** * This method remove all newline delimiter (\n or \r\n) from input data * * @param value Input String |