diff options
author | Thomas Lenz <tlenz@iaik.tugraz.at> | 2016-03-09 09:15:03 +0100 |
---|---|---|
committer | Thomas Lenz <tlenz@iaik.tugraz.at> | 2016-03-09 09:15:03 +0100 |
commit | f9020f47b60bc1cff6c671461924ba606ce87853 (patch) | |
tree | dd05ff3e0467293094253a495eb203e71a5d1be5 /id/server/moa-id-commons/src/main/java/at | |
parent | f66ed1831a4877d6c7cb3c55bbc3fd84024a1523 (diff) | |
download | moa-id-spss-f9020f47b60bc1cff6c671461924ba606ce87853.tar.gz moa-id-spss-f9020f47b60bc1cff6c671461924ba606ce87853.tar.bz2 moa-id-spss-f9020f47b60bc1cff6c671461924ba606ce87853.zip |
fix some problems in ELGA-mandate module
Diffstat (limited to 'id/server/moa-id-commons/src/main/java/at')
-rw-r--r-- | id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/KeyValueUtils.java | 23 |
1 files changed, 21 insertions, 2 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 cbdd13d0e..add929e1d 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 @@ -31,8 +31,6 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; -import org.apache.commons.lang3.StringUtils; - import at.gv.egovernment.moa.util.MiscUtil; /** @@ -283,6 +281,27 @@ public class KeyValueUtils { return false; } + /** + * Convert a CSV list to a List of CSV values + * <br><br> + * This method removes all whitespace at the begin or the + * end of CSV values and remove newLine signs at the end of value. + * The ',' is used as list delimiter + * + * @param csv CSV encoded input data + * @return List of CSV normalized values, but never null + */ + public static List<String> getListOfCSVValues(String csv) { + List<String> list = new ArrayList<String>(); + if (MiscUtil.isNotEmpty(csv)) { + String[] values = csv.split(CSV_DELIMITER); + for (String el: values) + list.add(el.trim()); + + } + + return list; + } /** * This method remove all newline delimiter (\n or \r\n) from input data |