syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [syncope] 02/02: Small optimimzation
Date Fri, 02 Nov 2018 10:04:50 GMT
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

commit e4c92705c6fb918bddd8859681071b6a4610dddd
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
AuthorDate: Fri Nov 2 11:03:06 2018 +0100

    Small optimimzation
---
 .../src/main/java/org/apache/syncope/core/logic/RealmLogic.java   | 8 ++------
 .../provisioning/java/pushpull/DefaultRealmPullResultHandler.java | 8 ++------
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/RealmLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/RealmLogic.java
index 86a1847..3da062e 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/RealmLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/RealmLogic.java
@@ -120,9 +120,7 @@ public class RealmLogic extends AbstractTransactionalLogic<RealmTO>
{
         Realm realm = realmDAO.save(binder.create(parent, realmTO));
 
         PropagationByResource propByRes = new PropagationByResource();
-        realm.getResourceKeys().forEach(resource -> {
-            propByRes.add(ResourceOperation.CREATE, resource);
-        });
+        propByRes.addAll(ResourceOperation.CREATE, realm.getResourceKeys());
         List<PropagationTaskTO> tasks = propagationManager.createTasks(realm, propByRes,
null);
         PropagationReporter propagationReporter = taskExecutor.execute(tasks, false);
 
@@ -185,9 +183,7 @@ public class RealmLogic extends AbstractTransactionalLogic<RealmTO>
{
         }
 
         PropagationByResource propByRes = new PropagationByResource();
-        realm.getResourceKeys().forEach(resource -> {
-            propByRes.add(ResourceOperation.DELETE, resource);
-        });
+        propByRes.addAll(ResourceOperation.DELETE, realm.getResourceKeys());
         List<PropagationTaskTO> tasks = propagationManager.createTasks(realm, propByRes,
null);
         PropagationReporter propagationReporter = taskExecutor.execute(tasks, false);
 
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/DefaultRealmPullResultHandler.java
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/DefaultRealmPullResultHandler.java
index 82c507c..e0dd728 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/DefaultRealmPullResultHandler.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/DefaultRealmPullResultHandler.java
@@ -236,9 +236,7 @@ public class DefaultRealmPullResultHandler
             Realm realm = realmDAO.save(binder.create(profile.getTask().getDestinatioRealm(),
realmTO));
 
             PropagationByResource propByRes = new PropagationByResource();
-            for (String resource : realm.getResourceKeys()) {
-                propByRes.add(ResourceOperation.CREATE, resource);
-            }
+            propByRes.addAll(ResourceOperation.CREATE, realm.getResourceKeys());
             if (unmatchingRule == UnmatchingRule.ASSIGN) {
                 List<PropagationTaskTO> tasks = propagationManager.createTasks(realm,
propByRes, null);
                 taskExecutor.execute(tasks, false);
@@ -609,9 +607,7 @@ public class DefaultRealmPullResultHandler
                         }
 
                         PropagationByResource propByRes = new PropagationByResource();
-                        for (String resource : realm.getResourceKeys()) {
-                            propByRes.add(ResourceOperation.DELETE, resource);
-                        }
+                        propByRes.addAll(ResourceOperation.DELETE, realm.getResourceKeys());
                         List<PropagationTaskTO> tasks = propagationManager.createTasks(realm,
propByRes, null);
                         taskExecutor.execute(tasks, false);
 


Mime
View raw message