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/11/02 10:04:48 UTC

[syncope] branch master updated (639c314 -> e4c9270)

This is an automated email from the ASF dual-hosted git repository.

ilgrosso pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/syncope.git.


    from 639c314  Upgrading Cargo
     new 2a5ebc9  SYNCOPE-1390: Pull Realms: pull task with Unmatching Rules: PROVISION shouldn't create propagation task (#86)
     new e4c9270  Small optimimzation

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/syncope/core/logic/RealmLogic.java  |  8 ++------
 .../pushpull/DefaultRealmPullResultHandler.java    | 22 ++++++++++------------
 2 files changed, 12 insertions(+), 18 deletions(-)


[syncope] 02/02: Small optimimzation

Posted by il...@apache.org.
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ò <il...@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);
 


[syncope] 01/02: SYNCOPE-1390: Pull Realms: pull task with Unmatching Rules: PROVISION shouldn't create propagation task (#86)

Posted by il...@apache.org.
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 2a5ebc988df1d1717835f0195e479736791abf91
Author: Alexander Tsvetkov <al...@gmail.com>
AuthorDate: Fri Nov 2 12:59:03 2018 +0300

    SYNCOPE-1390: Pull Realms: pull task with Unmatching Rules: PROVISION shouldn't create propagation task (#86)
---
 .../java/pushpull/DefaultRealmPullResultHandler.java     | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

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 1e1fdd2..82c507c 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
@@ -31,7 +31,6 @@ import org.apache.syncope.common.lib.types.AuditElements;
 import org.apache.syncope.common.lib.types.AuditElements.Result;
 import org.apache.syncope.common.lib.types.ClientExceptionType;
 import org.apache.syncope.common.lib.types.MatchingRule;
-import org.apache.syncope.core.provisioning.api.PropagationByResource;
 import org.apache.syncope.common.lib.types.PullMode;
 import org.apache.syncope.common.lib.types.ResourceOperation;
 import org.apache.syncope.common.lib.types.UnmatchingRule;
@@ -42,6 +41,7 @@ import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
 import org.apache.syncope.core.persistence.api.entity.Realm;
 import org.apache.syncope.core.persistence.api.entity.resource.OrgUnit;
 import org.apache.syncope.core.persistence.api.entity.task.PullTask;
+import org.apache.syncope.core.provisioning.api.PropagationByResource;
 import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
 import org.apache.syncope.core.provisioning.api.pushpull.IgnoreProvisionException;
 import org.apache.syncope.core.provisioning.api.pushpull.ProvisioningReport;
@@ -160,7 +160,7 @@ public class DefaultRealmPullResultHandler
                 action.beforeAssign(profile, delta, realmTO);
             }
 
-            create(realmTO, delta, UnmatchingRule.toEventName(UnmatchingRule.ASSIGN), result);
+            create(realmTO, delta, UnmatchingRule.ASSIGN, result);
         }
 
         return Collections.singletonList(result);
@@ -198,7 +198,7 @@ public class DefaultRealmPullResultHandler
                 action.beforeProvision(profile, delta, realmTO);
             }
 
-            create(realmTO, delta, UnmatchingRule.toEventName(UnmatchingRule.PROVISION), result);
+            create(realmTO, delta, UnmatchingRule.PROVISION, result);
         }
 
         return Collections.singletonList(result);
@@ -225,7 +225,7 @@ public class DefaultRealmPullResultHandler
     private void create(
             final RealmTO realmTO,
             final SyncDelta delta,
-            final String operation,
+            final UnmatchingRule unmatchingRule,
             final ProvisioningReport result)
             throws JobExecutionException {
 
@@ -239,8 +239,10 @@ public class DefaultRealmPullResultHandler
             for (String resource : realm.getResourceKeys()) {
                 propByRes.add(ResourceOperation.CREATE, resource);
             }
-            List<PropagationTaskTO> tasks = propagationManager.createTasks(realm, propByRes, null);
-            taskExecutor.execute(tasks, false);
+            if (unmatchingRule == UnmatchingRule.ASSIGN) {
+                List<PropagationTaskTO> tasks = propagationManager.createTasks(realm, propByRes, null);
+                taskExecutor.execute(tasks, false);
+            }
 
             RealmTO actual = binder.getRealmTO(realm, true);
 
@@ -271,7 +273,7 @@ public class DefaultRealmPullResultHandler
             resultStatus = Result.FAILURE;
         }
 
-        finalize(operation, resultStatus, null, output, delta);
+        finalize(UnmatchingRule.toEventName(unmatchingRule), resultStatus, null, output, delta);
     }
 
     private List<ProvisioningReport> update(final SyncDelta delta, final List<String> keys, final boolean inLink)