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/07/26 07:27:14 UTC
[2/2] syncope git commit: [SYNCOPE-1343] Reflow
[SYNCOPE-1343] Reflow
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/0895017a
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/0895017a
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/0895017a
Branch: refs/heads/master
Commit: 0895017a2447e915eb17c822cad865bab368c2ed
Parents: 0bb9d9d
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Jul 26 09:26:48 2018 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Jul 26 09:27:01 2018 +0200
----------------------------------------------------------------------
.../syncope/common/lib/AnyOperations.java | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/0895017a/common/lib/src/main/java/org/apache/syncope/common/lib/AnyOperations.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/AnyOperations.java b/common/lib/src/main/java/org/apache/syncope/common/lib/AnyOperations.java
index c8e7eb6..966b1f3 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/AnyOperations.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/AnyOperations.java
@@ -622,18 +622,16 @@ public final class AnyOperations {
/**
* Add PLAIN attribute DELETE patch for those attributes of the input AnyTO without values or containing null value
*
- * @param anyTO
- * @param result
+ * @param anyTO User, Group or Any Object to look for attributes with no value
+ * @param patch patch to enrich with DELETE statements
*/
- public static void cleanEmptyAttrs(final AnyTO anyTO, final AnyPatch result) {
- anyTO.getPlainAttrs().stream()
- .filter(plainAttrTO -> isEmpty(plainAttrTO))
- .forEach(plainAttrTO -> {
- result.getPlainAttrs().add(new AttrPatch.Builder().
- operation(PatchOperation.DELETE).
- attrTO(new AttrTO.Builder().schema(plainAttrTO.getSchema()).build()).
- build());
- });
+ public static void cleanEmptyAttrs(final AnyTO anyTO, final AnyPatch patch) {
+ patch.getPlainAttrs().addAll(anyTO.getPlainAttrs().stream().
+ filter(plainAttrTO -> isEmpty(plainAttrTO)).
+ map(plainAttrTO -> new AttrPatch.Builder().
+ operation(PatchOperation.DELETE).
+ attrTO(new AttrTO.Builder().schema(plainAttrTO.getSchema()).build()).
+ build()).collect(Collectors.toSet()));
}
private static boolean isEmpty(final AttrTO attrTO) {