syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject svn commit: r1544077 - /syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/sync/impl/SyncJob.java
Date Thu, 21 Nov 2013 09:51:46 GMT
Author: ilgrosso
Date: Thu Nov 21 09:51:46 2013
New Revision: 1544077

URL: http://svn.apache.org/r1544077
Log:
[SYNCOPE-440] Calling getLastSyncToken() before actual sync()

Modified:
    syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/sync/impl/SyncJob.java

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/sync/impl/SyncJob.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/sync/impl/SyncJob.java?rev=1544077&r1=1544076&r2=1544077&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/sync/impl/SyncJob.java
(original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/sync/impl/SyncJob.java
Thu Nov 21 09:51:46 2013
@@ -46,6 +46,7 @@ import org.apache.syncope.core.sync.Sync
 import org.apache.syncope.core.util.ApplicationContextProvider;
 import org.apache.syncope.core.workflow.role.RoleWorkflowAdapter;
 import org.identityconnectors.framework.common.objects.ObjectClass;
+import org.identityconnectors.framework.common.objects.SyncToken;
 import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.support.AbstractBeanDefinition;
@@ -386,7 +387,7 @@ public class SyncJob extends AbstractTas
         final SyncopeSyncResultHandler handler =
                 (SyncopeSyncResultHandler) ((DefaultListableBeanFactory) ApplicationContextProvider.
                 getApplicationContext().getBeanFactory()).createBean(
-                SyncopeSyncResultHandler.class, AbstractBeanDefinition.AUTOWIRE_BY_NAME,
false);
+                        SyncopeSyncResultHandler.class, AbstractBeanDefinition.AUTOWIRE_BY_NAME,
false);
         handler.setConnector(connector);
         handler.setActions(actions);
         handler.setDryRun(dryRun);
@@ -396,6 +397,15 @@ public class SyncJob extends AbstractTas
 
         actions.beforeAll(handler);
         try {
+            SyncToken latestUSyncToken = null;
+            if (uMapping != null && !syncTask.isFullReconciliation()) {
+                latestUSyncToken = connector.getLatestSyncToken(ObjectClass.ACCOUNT);
+            }
+            SyncToken latestRSyncToken = null;
+            if (rMapping != null && !syncTask.isFullReconciliation()) {
+                latestRSyncToken = connector.getLatestSyncToken(ObjectClass.GROUP);
+            }
+
             if (syncTask.isFullReconciliation()) {
                 if (uMapping != null) {
                     connector.getAllObjects(ObjectClass.ACCOUNT, handler,
@@ -420,10 +430,10 @@ public class SyncJob extends AbstractTas
                 try {
                     ExternalResource resource = resourceDAO.find(syncTask.getResource().getName());
                     if (uMapping != null) {
-                        resource.setUsyncToken(connector.getLatestSyncToken(ObjectClass.ACCOUNT));
+                        resource.setUsyncToken(latestUSyncToken);
                     }
                     if (rMapping != null) {
-                        resource.setRsyncToken(connector.getLatestSyncToken(ObjectClass.GROUP));
+                        resource.setRsyncToken(latestRSyncToken);
                     }
                     resourceDAO.save(resource);
                 } catch (Exception e) {



Mime
View raw message