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:50 UTC

[syncope] branch 2_0_X updated (741f34f -> 5b8846b)

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

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


    from 741f34f  Upgrading Cargo
     new 68b3b89  SYNCOPE-1390: Pull Realms: pull task with Unmatching Rules: PROVISION shouldn't create propagation task (#86)
     new 5b8846b  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 2_0_X
in repository https://gitbox.apache.org/repos/asf/syncope.git

commit 5b8846b2ac7dd48523bd03e73f714c3584c72c0e
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 54ac004..dcb5494 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
@@ -127,9 +127,7 @@ public class RealmLogic extends AbstractTransactionalLogic<RealmTO> {
         Realm realm = realmDAO.save(binder.create(parent, realmTO));
 
         PropagationByResource propByRes = new PropagationByResource();
-        for (String resource : realm.getResourceKeys()) {
-            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);
 
@@ -192,9 +190,7 @@ public class RealmLogic extends AbstractTransactionalLogic<RealmTO> {
         }
 
         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);
         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 3be6554..5c63133 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 2_0_X
in repository https://gitbox.apache.org/repos/asf/syncope.git

commit 68b3b89234e5d16a63eba71402320da4dae56902
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 c315343..3be6554 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)