You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by an...@apache.org on 2018/11/22 09:18:30 UTC
[syncope] branch master updated: [SYNCOPE-1397] Now plain
attributes are shown in approval,
removed unwanted changed flags on empty attributes
This is an automated email from the ASF dual-hosted git repository.
andreapatricelli 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 b7f9a4b [SYNCOPE-1397] Now plain attributes are shown in approval, removed unwanted changed flags on empty attributes
b7f9a4b is described below
commit b7f9a4b864f0e093618f1791de5b626db5e6a3cf
Author: Andrea Patricelli <an...@apache.org>
AuthorDate: Thu Nov 22 10:17:27 2018 +0100
[SYNCOPE-1397] Now plain attributes are shown in approval, removed unwanted changed flags on empty attributes
---
.../client/console/wizards/any/PlainAttrs.java | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 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 7357313..fb9c7c6 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
@@ -23,6 +23,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import java.util.stream.Collectors;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
@@ -409,20 +410,25 @@ public class PlainAttrs extends AbstractAttrs<PlainSchemaTO> {
((MultiFieldPanel) panel).setReadOnly(schemas.get(attrTO.getSchema()).isReadonly());
}
item.add(panel);
+ Optional<AttrTO> previousPlainAttr = previousObject.getPlainAttr(attrTO.getSchema());
if (previousObject != null
- && (previousObject.getPlainAttr(attrTO.getSchema()) == null
- || !ListUtils.isEqualList(
- ListUtils.select(previousObject.getPlainAttr(attrTO.getSchema()).get().getValues(),
- object -> StringUtils.isNotEmpty(object)),
- ListUtils.select(attrTO.getValues(), object -> StringUtils.isNotEmpty(object))))) {
+ && ((!previousPlainAttr.isPresent() && !isEmptyOrBlank(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 = previousObject.getPlainAttr(attrTO.getSchema()) == null
+ List<String> oldValues = !previousPlainAttr.isPresent()
? Collections.<String>emptyList()
- : previousObject.getPlainAttr(attrTO.getSchema()).get().getValues();
+ : previousPlainAttr.get().getValues();
panel.showExternAction(new LabelInfo("externalAction", oldValues));
}
}
+
+ protected boolean isEmptyOrBlank(final List<String> values) {
+ return values.stream().allMatch(value -> StringUtils.isBlank(value));
+ }
});
}
}