aboutsummaryrefslogtreecommitdiff
path: root/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2015-07-21 15:30:40 +0200
committerThomas Lenz <tlenz@iaik.tugraz.at>2015-07-21 15:30:40 +0200
commit4795b273bb734f04056babe963d8588ffbf50fb0 (patch)
tree4c38c2a7b957608ad21034ec40b96466d3f3f98e /id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils
parenta10034425b325acaf9796183d1206979664e483d (diff)
downloadmoa-id-spss-4795b273bb734f04056babe963d8588ffbf50fb0.tar.gz
moa-id-spss-4795b273bb734f04056babe963d8588ffbf50fb0.tar.bz2
moa-id-spss-4795b273bb734f04056babe963d8588ffbf50fb0.zip
fix MOA-ID-Auth problems
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.java24
1 files changed, 24 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 f20647fb0..04eb30f72 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
@@ -227,4 +227,28 @@ public class KeyValueUtils {
return findNextFreeListCounter((String[]) keySet.toArray(), listPrefix);
}
+
+ /**
+ * Normalize a CSV encoded list of value of an key/value pair
+ *
+ * This method removes all whitespace at the begin or the
+ * end of CSV values
+ *
+ * @param value CSV encoded input data
+ * @return normalized CSV encoded data or null if {value} is null or empty
+ */
+ public static String normalizeCSVValueString(String value) {
+ String normalizedCodes = null;
+ if (MiscUtil.isNotEmpty(value)) {
+ String[] codes = value.split(",");
+ for (String el: codes) {
+ if (normalizedCodes == null)
+ normalizedCodes = el.trim();
+ else
+ normalizedCodes += "," + el;
+
+ }
+ }
+ return normalizedCodes;
+ }
}