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 2017/09/13 13:07:13 UTC

[3/3] syncope git commit: Remove useless method

Remove useless method


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/2143809e
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/2143809e
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/2143809e

Branch: refs/heads/master
Commit: 2143809efa19a7128f41ec5d9c03e1ae5ef01ff1
Parents: f22c28d
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Wed Sep 13 15:07:02 2017 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Wed Sep 13 15:07:02 2017 +0200

----------------------------------------------------------------------
 .../AbstractPropagationTaskExecutor.java        | 32 +++-----------------
 1 file changed, 5 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/2143809e/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
index 3bbed99..2e06e8b 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
@@ -22,11 +22,11 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Date;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.stream.Collectors;
 import org.apache.syncope.common.lib.collections.IteratorChain;
 import org.apache.syncope.common.lib.to.ExecTO;
 import org.apache.syncope.common.lib.to.PropagationTaskTO;
@@ -177,30 +177,6 @@ public abstract class AbstractPropagationTaskExecutor implements PropagationTask
         return result;
     }
 
-    /**
-     * Transform a {@link Collection} of {@link Attribute} instances into a {@link Map}.
-     * The key to each element in the map is the {@code name} of an {@link Attribute}.
-     * The value of each element in the map is the {@link Attribute} instance with that name.
-     * <br/>
-     * Different from the original because:
-     * <ul>
-     * <li>map keys are transformed toUpperCase()</li>
-     * <li>returned map is mutable</li>
-     * </ul>
-     *
-     * @param attributes set of attribute to transform to a map.
-     * @return a map of string and attribute.
-     *
-     * @see org.identityconnectors.framework.common.objects.AttributeUtil#toMap(java.util.Collection)
-     */
-    private Map<String, Attribute> toMap(final Collection<? extends Attribute> attributes) {
-        Map<String, Attribute> map = new HashMap<>();
-        attributes.forEach(attr -> {
-            map.put(attr.getName().toUpperCase(), attr);
-        });
-        return map;
-    }
-
     protected Uid createOrUpdate(
             final PropagationTask task,
             final ConnectorObject beforeObj,
@@ -251,8 +227,10 @@ public abstract class AbstractPropagationTaskExecutor implements PropagationTask
 
             // 2. check wether anything is actually needing to be propagated, i.e. if there is attribute
             // difference between beforeObj - just read above from the connector - and the values to be propagated
-            Map<String, Attribute> originalAttrMap = toMap(beforeObj.getAttributes());
-            Map<String, Attribute> updateAttrMap = toMap(attributes);
+            Map<String, Attribute> originalAttrMap = beforeObj.getAttributes().stream().
+                    collect(Collectors.toMap(attr -> attr.getName().toUpperCase(), attr -> attr));
+            Map<String, Attribute> updateAttrMap = attributes.stream().
+                    collect(Collectors.toMap(attr -> attr.getName().toUpperCase(), attr -> attr));
 
             // Only compare attribute from beforeObj that are also being updated
             Set<String> skipAttrNames = originalAttrMap.keySet();