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

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

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)