------------------------------------------------------------ revno: 16234 committer: Lars Helge Overland <larshe...@gmail.com> branch nick: dhis2 timestamp: Fri 2014-07-25 10:41:20 +0200 message: Data sync, added last success info field under scheduling modified: dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/synch/DefaultSynchronizationManager.java dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/synch/SynchronizationManager.java dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/scheduling/ScheduleTasksAction.java dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/viewScheduledTasks.vm
-- lp:dhis2 https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk Your team DHIS 2 developers is subscribed to branch lp:dhis2. To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/synch/DefaultSynchronizationManager.java' --- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/synch/DefaultSynchronizationManager.java 2014-07-23 11:34:30 +0000 +++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/synch/DefaultSynchronizationManager.java 2014-07-25 08:41:20 +0000 @@ -162,7 +162,7 @@ log.info( status ); - return status; + return status; } public ImportSummary executeDataSynch() @@ -182,7 +182,7 @@ // --------------------------------------------------------------------- final Date startTime = new Date(); - final Date lastSuccessTime = getLastSynchSuccess(); + final Date lastSuccessTime = getLastSynchSuccessFallback(); int lastUpdatedCount = dataValueService.getDataValueCountLastUpdatedAfter( lastSuccessTime ); @@ -225,6 +225,11 @@ return summary; } + public Date getLastSynchSuccess() + { + return (Date) systemSettingManager.getSystemSetting( KEY_LAST_SUCCESSFUL_SYNC ); + } + // ------------------------------------------------------------------------- // Supportive methods // ------------------------------------------------------------------------- @@ -233,7 +238,7 @@ * Gets the time of the last successful synchronization operation. If not set, * the current date subtracted three days is returned. */ - private Date getLastSynchSuccess() + private Date getLastSynchSuccessFallback() { Date fallback = new Cal().subtract( Calendar.DAY_OF_YEAR, 3 ).time(); === modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/synch/SynchronizationManager.java' --- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/synch/SynchronizationManager.java 2014-07-11 15:50:18 +0000 +++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/synch/SynchronizationManager.java 2014-07-25 08:41:20 +0000 @@ -28,6 +28,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import java.util.Date; + import org.hisp.dhis.dxf2.importsummary.ImportSummary; /** @@ -38,4 +40,6 @@ AvailabilityStatus isRemoteServerAvailable(); ImportSummary executeDataSynch(); + + Date getLastSynchSuccess(); } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/scheduling/ScheduleTasksAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/scheduling/ScheduleTasksAction.java 2014-07-11 21:22:57 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/scheduling/ScheduleTasksAction.java 2014-07-25 08:41:20 +0000 @@ -44,6 +44,7 @@ import static org.hisp.dhis.system.util.CollectionUtils.emptyIfNull; import java.util.Collection; +import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -51,11 +52,13 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.hisp.dhis.common.ListMap; +import org.hisp.dhis.dxf2.synch.SynchronizationManager; import org.hisp.dhis.organisationunit.OrganisationUnitLevel; import org.hisp.dhis.organisationunit.OrganisationUnitService; import org.hisp.dhis.scheduling.SchedulingManager; import org.hisp.dhis.setting.SystemSettingManager; import org.hisp.dhis.system.scheduling.Scheduler; +import org.springframework.beans.factory.annotation.Autowired; import com.opensymphony.xwork2.Action; @@ -75,26 +78,17 @@ // Dependencies // ------------------------------------------------------------------------- + @Autowired private SystemSettingManager systemSettingManager; - public void setSystemSettingManager( SystemSettingManager systemSettingManager ) - { - this.systemSettingManager = systemSettingManager; - } - + @Autowired private SchedulingManager schedulingManager; - public void setSchedulingManager( SchedulingManager schedulingManager ) - { - this.schedulingManager = schedulingManager; - } - + @Autowired private OrganisationUnitService organisationUnitService; - public void setOrganisationUnitService( OrganisationUnitService organisationUnitService ) - { - this.organisationUnitService = organisationUnitService; - } + @Autowired + private SynchronizationManager synchronizationManager; // ------------------------------------------------------------------------- // Input @@ -215,6 +209,13 @@ { return levels; } + + private Date lastDataSyncSuccess; + + public Date getLastDataSyncSuccess() + { + return lastDataSyncSuccess; + } // ------------------------------------------------------------------------- // Action implementation @@ -349,6 +350,7 @@ running = STATUS_RUNNING.equals( status ); levels = organisationUnitService.getOrganisationUnitLevels(); + lastDataSyncSuccess = synchronizationManager.getLastSynchSuccess(); log.info( "Status: " + status ); log.info( "Running: " + running ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml 2014-04-19 10:51:12 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml 2014-07-25 08:41:20 +0000 @@ -344,11 +344,7 @@ <bean id="org.hisp.dhis.dataadmin.action.scheduling.ScheduleTasksAction" class="org.hisp.dhis.dataadmin.action.scheduling.ScheduleTasksAction" - scope="prototype"> - <property name="systemSettingManager" ref="org.hisp.dhis.setting.SystemSettingManager" /> - <property name="schedulingManager" ref="org.hisp.dhis.scheduling.SchedulingManager" /> - <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" /> - </bean> + scope="prototype"/> <!-- OptionSet --> === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2014-07-11 21:22:57 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2014-07-25 08:41:20 +0000 @@ -353,4 +353,5 @@ disabled=Disabled data_synchronization=Data synchronization data_synchronization_strategy=Data synchronization strategy -enabled=Enabled \ No newline at end of file +enabled=Enabled +last_success=Last success \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/viewScheduledTasks.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/viewScheduledTasks.vm 2014-07-11 21:22:57 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/viewScheduledTasks.vm 2014-07-25 08:41:20 +0000 @@ -51,6 +51,8 @@ <div class="settingLabel settingIndent">$i18n.getString( "data_synchronization_strategy" )</div> +<div class="settingLabel settingIndent tipText">$i18n.getString( "last_success" ): $format.formatDateTime( $lastDataSyncSuccess )</div> + <div class="setting settingIndent"> <select id="dataSynchStrategy" name="dataSynchStrategy" class="scheduling"> <option value="disabled">$i18n.getString( "disabled" )</option>
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp