You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2018/11/22 14:32:38 UTC

[syncope] branch master updated: Attempt to increase readability

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 68d0739  Attempt to increase readability
68d0739 is described below

commit 68d0739a95d3ffad98e6326bfc37d6846dec4d56
Author: Francesco Chicchiriccò <il...@apache.org>
AuthorDate: Thu Nov 22 15:32:13 2018 +0100

    Attempt to increase readability
---
 .../client/console/wizards/any/PlainAttrs.java     | 23 ++++++++++------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java
index b767910..a9e1f90 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java
@@ -411,26 +411,23 @@ public class PlainAttrs extends AbstractAttrs<PlainSchemaTO> {
                     }
                     item.add(panel);
 
-                    Optional<AttrTO> previousPlainAttr = previousObject == null
+                    Optional<AttrTO> prevAttr = previousObject == null
                             ? Optional.empty()
                             : previousObject.getPlainAttr(attrTO.getSchema());
                     if (previousObject != null
-                            && ((!previousPlainAttr.isPresent() && isNotEmptyOrBlank(attrTO.getValues()))
-                            || (previousPlainAttr.isPresent() && !ListUtils.isEqualList(
-                            ListUtils.select(previousPlainAttr.get().getValues(),
-                                    object -> StringUtils.isNotEmpty(object)),
-                            ListUtils.select(attrTO.getValues(), object -> StringUtils.isNotEmpty(object)))))) {
-
-                        List<String> oldValues = previousPlainAttr.isPresent()
-                                ? previousPlainAttr.get().getValues()
+                            && ((!prevAttr.isPresent() && attrTO.getValues().stream().anyMatch(StringUtils::isNotBlank))
+                            || (prevAttr.isPresent() && !ListUtils.isEqualList(
+                            prevAttr.get().getValues().stream().
+                                    filter(StringUtils::isNotBlank).collect(Collectors.toList()),
+                            attrTO.getValues().stream().
+                                    filter(StringUtils::isNotBlank).collect(Collectors.toList()))))) {
+
+                        List<String> oldValues = prevAttr.isPresent()
+                                ? prevAttr.get().getValues()
                                 : Collections.<String>emptyList();
                         panel.showExternAction(new LabelInfo("externalAction", oldValues));
                     }
                 }
-
-                protected boolean isNotEmptyOrBlank(final List<String> values) {
-                    return values.stream().anyMatch(value -> StringUtils.isNotBlank(value));
-                }
             });
         }
     }