This is an automated email from the ASF dual-hosted git repository.

ilgrosso pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/syncope.git


The following commit(s) were added to refs/heads/master by this push:
     new 544cd5d  [SYNCOPE-1449] if single value, bind to value; if multi-value 
bind to list of values
544cd5d is described below

commit 544cd5df974c012b4d6d891c67176c524bf208ca
Author: Francesco Chicchiriccò <ilgro...@apache.org>
AuthorDate: Tue Mar 12 15:11:07 2019 +0100

    [SYNCOPE-1449] if single value, bind to value; if multi-value bind to list 
of values
---
 .../core/provisioning/java/jexl/JexlUtils.java       | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git 
a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/jexl/JexlUtils.java
 
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/jexl/JexlUtils.java
index ef47a5f..413f30c 100644
--- 
a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/jexl/JexlUtils.java
+++ 
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/jexl/JexlUtils.java
@@ -198,13 +198,15 @@ public final class JexlUtils {
 
     public static void addAttrsToContext(final Collection<Attr> attrs, final 
JexlContext jexlContext) {
         attrs.stream().filter(attr -> attr.getSchema() != null).forEach(attr 
-> {
-            String expressionValue = attr.getValues().isEmpty()
+            Object value = attr.getValues().isEmpty()
                     ? StringUtils.EMPTY
-                    : attr.getValues().get(0);
+                    : attr.getValues().size() == 1
+                    ? attr.getValues().get(0)
+                    : attr.getValues();
 
-            LOG.debug("Add attribute {} with value {}", attr.getSchema(), 
expressionValue);
+            LOG.debug("Add attribute {} with value {}", attr.getSchema(), 
value);
 
-            jexlContext.set(attr.getSchema(), expressionValue);
+            jexlContext.set(attr.getSchema(), value);
         });
     }
 
@@ -213,13 +215,15 @@ public final class JexlUtils {
 
         attrs.stream().filter(attr -> attr.getSchema() != null).forEach(attr 
-> {
             List<String> attrValues = attr.getValuesAsStrings();
-            String expressionValue = attrValues.isEmpty()
+            Object value = attrValues.isEmpty()
                     ? StringUtils.EMPTY
-                    : attrValues.get(0);
+                    : attrValues.size() == 1
+                    ? attrValues.get(0)
+                    : attrValues;
 
-            LOG.debug("Add attribute {} with value {}", 
attr.getSchema().getKey(), expressionValue);
+            LOG.debug("Add attribute {} with value {}", 
attr.getSchema().getKey(), value);
 
-            jexlContext.set(attr.getSchema().getKey(), expressionValue);
+            jexlContext.set(attr.getSchema().getKey(), value);
         });
     }
 

Reply via email to