syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject syncope git commit: Experimenting with commons-collections' CollectionUtils and Predicate: looks good!
Date Mon, 06 Apr 2015 16:57:33 GMT
Repository: syncope
Updated Branches:
  refs/heads/SYNCOPE-119 4095f1e84 -> 678e968cb


Experimenting with commons-collections' CollectionUtils and Predicate: looks good!


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

Branch: refs/heads/SYNCOPE-119
Commit: 678e968cb9cfb5f11cbfbea0d17ed5d70dbde0b6
Parents: 4095f1e
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Mon Apr 6 18:57:26 2015 +0200
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Mon Apr 6 18:57:26 2015 +0200

----------------------------------------------------------------------
 common/lib/pom.xml                                    |  6 +++++-
 .../syncope/common/lib/to/AbstractSubjectTO.java      | 14 +++++++-------
 .../syncope/common/lib/types/WorkflowTasks.java       |  2 +-
 .../java/data/AbstractAttributableDataBinder.java     |  4 +---
 pom.xml                                               |  8 +++++++-
 5 files changed, 21 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/678e968c/common/lib/pom.xml
----------------------------------------------------------------------
diff --git a/common/lib/pom.xml b/common/lib/pom.xml
index 2bdc6ea..14f8208 100644
--- a/common/lib/pom.xml
+++ b/common/lib/pom.xml
@@ -57,7 +57,11 @@ under the License.
       <groupId>org.apache.commons</groupId>
       <artifactId>commons-lang3</artifactId>
     </dependency>
-    
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-collections4</artifactId>
+    </dependency>
+      
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>

http://git-wip-us.apache.org/repos/asf/syncope/blob/678e968c/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractSubjectTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractSubjectTO.java
b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractSubjectTO.java
index a2e1b3a..62c83eb 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractSubjectTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractSubjectTO.java
@@ -26,6 +26,8 @@ import java.util.Set;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlElementWrapper;
 import javax.xml.bind.annotation.XmlType;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
 
 @XmlType
 public abstract class AbstractSubjectTO extends AbstractAttributableTO {
@@ -45,15 +47,13 @@ public abstract class AbstractSubjectTO extends AbstractAttributableTO
{
 
     public boolean removePropagationTO(final String resource) {
         if (resource != null && getPropagationStatusTOs().isEmpty()) {
-            final List<PropagationStatus> toBeRemoved = new ArrayList<>();
+            return CollectionUtils.filterInverse(propagationStatusTOs, new Predicate<PropagationStatus>()
{
 
-            for (PropagationStatus propagationTO : getPropagationStatusTOs()) {
-                if (resource.equals(propagationTO.getResource())) {
-                    toBeRemoved.add(propagationTO);
+                @Override
+                public boolean evaluate(final PropagationStatus propagationStatus) {
+                    return resource.equals(propagationStatus.getResource());
                 }
-            }
-
-            return propagationStatusTOs.removeAll(toBeRemoved);
+            });
         }
         return false;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/678e968c/common/lib/src/main/java/org/apache/syncope/common/lib/types/WorkflowTasks.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/WorkflowTasks.java
b/common/lib/src/main/java/org/apache/syncope/common/lib/types/WorkflowTasks.java
index 8c487f8..d23b1bc 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/WorkflowTasks.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/WorkflowTasks.java
@@ -29,7 +29,7 @@ public class WorkflowTasks {
     private List<String> tasks;
 
     public WorkflowTasks() {
-        this.tasks = new ArrayList<String>();
+        this.tasks = new ArrayList<>();
     }
 
     public WorkflowTasks(final Collection<String> tasks) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/678e968c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAttributableDataBinder.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAttributableDataBinder.java
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAttributableDataBinder.java
index 65fc97e..a33e062 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAttributableDataBinder.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAttributableDataBinder.java
@@ -664,9 +664,7 @@ abstract class AbstractAttributableDataBinder {
         }
 
         // 3. user and group virtual attributes will be evaluated by the propagation manager
only (if needed).
-        if (AttributableType.USER == attrUtil.getType()
-                || AttributableType.GROUP == attrUtil.getType()) {
-
+        if (AttributableType.USER == attrUtil.getType() || AttributableType.GROUP == attrUtil.getType())
{
             for (AttrTO vattrTO : attributableTO.getVirAttrs()) {
                 VirSchema virSchema = virtAttrHander.getVirSchema(vattrTO.getSchema(), attrUtil.virSchemaClass());
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/678e968c/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 054db15..f5fe484 100644
--- a/pom.xml
+++ b/pom.xml
@@ -357,6 +357,7 @@ under the License.
     <commons-codec.version>1.10</commons-codec.version>
     <commons-jexl.version>2.1.1</commons-jexl.version>
     <commons-lang.version>3.3.2</commons-lang.version>
+    <commons-collection.version>4.0</commons-collection.version>
     <commons.logging.version>1.1.3</commons.logging.version>
 
     <h2.version>1.4.186</h2.version>
@@ -651,7 +652,12 @@ under the License.
         <artifactId>commons-lang3</artifactId>
         <version>${commons-lang.version}</version>
       </dependency>
-      
+      <dependency>
+        <groupId>org.apache.commons</groupId>
+        <artifactId>commons-collections4</artifactId>
+        <version>${commons-collection.version}</version>
+      </dependency>
+            
       <dependency>
         <groupId>net.tirasa.connid</groupId>
         <artifactId>connector-framework</artifactId>


Mime
View raw message