dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #14718
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5084: Scheduling: Now exporting periods for last 12 months instead of just current year. Which period t...
Merge authors:
Lars Helge Øverland (larshelge)
------------------------------------------------------------
revno: 5084 [merge]
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-11-02 15:51:40 +0100
message:
Scheduling: Now exporting periods for last 12 months instead of just current year. Which period types to include in the export is now configurable. Scheduling UI moved from reporting to data admin module.
removed:
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/scheduling/
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/scheduling/action/
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/scheduling/action/ScheduleTasksAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewScheduledTasks.vm
added:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/scheduling/
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/webapp/dhis-web-maintenance-dataadmin/viewScheduledTasks.vm
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/options/SystemSettingManager.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/RelativePeriods.java
dhis-2/dhis-api/src/test/java/org/hisp/dhis/period/RelativePeriodTest.java
dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/scheduling/DataMartTask.java
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/scheduling/DataSetCompletenessTask.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/resources/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/menu.vm
dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties
dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/menu.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-api/src/main/java/org/hisp/dhis/options/SystemSettingManager.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/options/SystemSettingManager.java 2011-10-05 07:03:07 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/options/SystemSettingManager.java 2011-11-02 14:51:40 +0000
@@ -29,8 +29,13 @@
import java.io.Serializable;
import java.util.Collection;
+import java.util.HashSet;
import java.util.List;
+import org.hisp.dhis.period.MonthlyPeriodType;
+import org.hisp.dhis.period.QuarterlyPeriodType;
+import org.hisp.dhis.period.YearlyPeriodType;
+
/**
* @author Stian Strandli
* @version $Id: SystemSettingManager.java 4910 2008-04-15 17:55:02Z larshelg $
@@ -60,6 +65,7 @@
final String KEY_EMAIL_HOST_NAME = "keyEmailHostName";
final String KEY_EMAIL_USERNAME = "keyEmailUsername";
final String KEY_EMAIL_PASSWORD = "keyEmailPassword";
+ final String KEY_SCHEDULED_PERIOD_TYPES = "keyScheduledPeriodTypes";
final int DEFAULT_MAX_NUMBER_OF_ATTEMPTS = 20;
final int DEFAULT_TIMEFRAME_MINUTES = 1;
@@ -70,6 +76,11 @@
final String AGGREGATION_STRATEGY_BATCH = "batch";
final String DEFAULT_AGGREGATION_STRATEGY = AGGREGATION_STRATEGY_REAL_TIME;
final int DEFAULT_COMPLETENESS_OFFSET = 15;
+ final HashSet<String> DEFAULT_SCHEDULED_PERIOD_TYPES = new HashSet<String>() { {
+ add( MonthlyPeriodType.NAME );
+ add( QuarterlyPeriodType.NAME );
+ add( YearlyPeriodType.NAME );
+ } };
void saveSystemSetting( String name, Serializable value );
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/RelativePeriods.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/RelativePeriods.java 2011-11-01 17:57:03 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/RelativePeriods.java 2011-11-02 14:39:42 +0000
@@ -27,12 +27,16 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.hisp.dhis.period.PeriodType.getPeriodTypeByName;
+
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
+import java.util.Set;
+import org.hisp.dhis.configuration.Configuration;
import org.hisp.dhis.i18n.I18nFormat;
/**
@@ -479,7 +483,40 @@
return cal.getTime();
}
+
+ /**
+ * Creates an instance of RelativePeriods based on the scheduledPeriodTypes
+ * set from Configuration.
+ *
+ * @param config the Configuration object.
+ * @return a RelativePeriods instance.
+ */
+ public RelativePeriods getRelativePeriods( Set<String> periodTypes )
+ {
+ RelativePeriods relatives = new RelativePeriods();
+
+ if ( periodTypes == null || periodTypes.isEmpty() )
+ {
+ relatives.setLast12Months( true );
+ relatives.setLast4Quarters( true );
+ relatives.setLastYear( true );
+ }
+ else
+ {
+ relatives.setLast12Months( periodTypes.contains( MonthlyPeriodType.NAME ) );
+ relatives.setLast6BiMonths( periodTypes.contains( BiMonthlyPeriodType.NAME ) );
+ relatives.setLast4Quarters( periodTypes.contains( QuarterlyPeriodType.NAME ) );
+ relatives.setLast2SixMonths( periodTypes.contains( SixMonthlyPeriodType.NAME ) );
+ relatives.setLastYear( periodTypes.contains( YearlyPeriodType.NAME ) );
+ }
+
+ return relatives;
+ }
+ // -------------------------------------------------------------------------
+ // Is methods
+ // -------------------------------------------------------------------------
+
public boolean isReportingMonth()
{
return reportingMonth != null && reportingMonth;
=== modified file 'dhis-2/dhis-api/src/test/java/org/hisp/dhis/period/RelativePeriodTest.java'
--- dhis-2/dhis-api/src/test/java/org/hisp/dhis/period/RelativePeriodTest.java 2011-11-01 17:57:03 +0000
+++ dhis-2/dhis-api/src/test/java/org/hisp/dhis/period/RelativePeriodTest.java 2011-11-02 14:39:42 +0000
@@ -28,11 +28,14 @@
*/
import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
import java.util.Calendar;
import java.util.Date;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.mock.MockI18nFormat;
@@ -120,4 +123,22 @@
assertEquals( 66, relatives.size() );
}
+
+ @Test
+ public void testGetRelativePeriods()
+ {
+ Set<String> periodTypes = new HashSet<String>();
+ periodTypes.add( MonthlyPeriodType.NAME );
+ periodTypes.add( BiMonthlyPeriodType.NAME );
+ periodTypes.add( SixMonthlyPeriodType.NAME );
+
+ RelativePeriods relatives = new RelativePeriods().getRelativePeriods( periodTypes );
+
+ assertTrue( relatives.isLast12Months() );
+ assertTrue( relatives.isLast6BiMonths() );
+ assertTrue( relatives.isLast2SixMonths() );
+
+ assertFalse( relatives.isLast4Quarters() );
+ assertFalse( relatives.isLastYear() );
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml 2011-10-23 12:03:50 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml 2011-11-02 14:39:42 +0000
@@ -287,12 +287,14 @@
<constructor-arg ref="org.hisp.dhis.dataelement.DataElementService" />
<constructor-arg ref="org.hisp.dhis.indicator.IndicatorService" />
<constructor-arg ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ <constructor-arg ref="org.hisp.dhis.options.SystemSettingManager" />
</bean>
<bean id="dataSetCompletenessTask" class="org.hisp.dhis.system.scheduling.DataSetCompletenessTask" scope="prototype">
<constructor-arg ref="registrationDataCompletenessService" />
<constructor-arg ref="org.hisp.dhis.dataset.DataSetService" />
- <constructor-arg ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ <constructor-arg ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ <constructor-arg ref="org.hisp.dhis.options.SystemSettingManager" />
</bean>
<!-- DeletionHandler -->
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/scheduling/DataMartTask.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/scheduling/DataMartTask.java 2011-11-01 18:02:50 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/scheduling/DataMartTask.java 2011-11-02 14:51:40 +0000
@@ -27,14 +27,18 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.hisp.dhis.options.SystemSettingManager.*;
+
import java.util.Collection;
import java.util.HashSet;
+import java.util.Set;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.datamart.DataMartService;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorService;
+import org.hisp.dhis.options.SystemSettingManager;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.period.RelativePeriods;
@@ -53,24 +57,30 @@
private IndicatorService indicatorService;
private OrganisationUnitService organisationUnitService;
-
+
+ private SystemSettingManager systemSettingManager;
+
public DataMartTask( DataMartService dataMartService, DataElementService dataElementService, IndicatorService indicatorService,
- OrganisationUnitService organisationUnitService )
+ OrganisationUnitService organisationUnitService, SystemSettingManager systemSettingManager )
{
this.dataMartService = dataMartService;
this.dataElementService = dataElementService;
this.indicatorService = indicatorService;
this.organisationUnitService = organisationUnitService;
+ this.systemSettingManager = systemSettingManager;
}
@Override
+ @SuppressWarnings("unchecked")
public void run()
{
Collection<Integer> dataElementIds = ConversionUtils.getIdentifiers( DataElement.class, dataElementService.getAllDataElements() );
Collection<Integer> indicatorIds = ConversionUtils.getIdentifiers( Indicator.class, indicatorService.getAllIndicators() );
Collection<Integer> organisationUnitIds = ConversionUtils.getIdentifiers( OrganisationUnit.class, organisationUnitService.getAllOrganisationUnits() );
- RelativePeriods relatives = new RelativePeriods( false, false, false, true, true, true, false, false, false, false, false, false, false, false );
+ Set<String> periodTypes = (Set<String>) systemSettingManager.getSystemSetting( KEY_SCHEDULED_PERIOD_TYPES, DEFAULT_SCHEDULED_PERIOD_TYPES );
+
+ RelativePeriods relatives = new RelativePeriods().getRelativePeriods( periodTypes );
dataMartService.export( dataElementIds, indicatorIds, new HashSet<Integer>(), organisationUnitIds, relatives, true );
}
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/scheduling/DataSetCompletenessTask.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/scheduling/DataSetCompletenessTask.java 2011-11-01 18:02:50 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/scheduling/DataSetCompletenessTask.java 2011-11-02 14:51:40 +0000
@@ -28,15 +28,19 @@
*/
import java.util.Collection;
+import java.util.Set;
import org.hisp.dhis.completeness.DataSetCompletenessService;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.options.SystemSettingManager;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.period.RelativePeriods;
import org.hisp.dhis.system.util.ConversionUtils;
+import static org.hisp.dhis.options.SystemSettingManager.*;
+
/**
* @author Lars Helge Overland
*/
@@ -49,21 +53,27 @@
private OrganisationUnitService organisationUnitService;
- public DataSetCompletenessTask( DataSetCompletenessService completenessService,
- DataSetService dataSetService, OrganisationUnitService organisationUnitService )
+ private SystemSettingManager systemSettingManager;
+
+ public DataSetCompletenessTask( DataSetCompletenessService completenessService, DataSetService dataSetService,
+ OrganisationUnitService organisationUnitService, SystemSettingManager systemSettingManager )
{
this.completenessService = completenessService;
this.dataSetService = dataSetService;
this.organisationUnitService = organisationUnitService;
+ this.systemSettingManager = systemSettingManager;
}
@Override
+ @SuppressWarnings("unchecked")
public void run()
{
Collection<Integer> dataSetIds = ConversionUtils.getIdentifiers( DataSet.class, dataSetService.getAllDataSets() );
Collection<Integer> organisationUnitIds = ConversionUtils.getIdentifiers( OrganisationUnit.class, organisationUnitService.getAllOrganisationUnits() );
- RelativePeriods relatives = new RelativePeriods( false, false, false, true, true, true, false, false, false, false, false, false, false, false );
+ Set<String> periodTypes = (Set<String>) systemSettingManager.getSystemSetting( KEY_SCHEDULED_PERIOD_TYPES, DEFAULT_SCHEDULED_PERIOD_TYPES );
+
+ RelativePeriods relatives = new RelativePeriods().getRelativePeriods( periodTypes );
completenessService.exportDataSetCompleteness( dataSetIds, relatives, organisationUnitIds );
}
=== added directory 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/scheduling'
=== added 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 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/scheduling/ScheduleTasksAction.java 2011-11-02 14:51:40 +0000
@@ -0,0 +1,153 @@
+package org.hisp.dhis.dataadmin.action.scheduling;
+
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import static org.hisp.dhis.options.SystemSettingManager.KEY_SCHEDULED_PERIOD_TYPES;
+import static org.hisp.dhis.options.SystemSettingManager.*;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.hisp.dhis.options.SystemSettingManager;
+import org.hisp.dhis.scheduling.SchedulingManager;
+import org.hisp.dhis.system.scheduling.Scheduler;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Lars Helge Overland
+ */
+public class ScheduleTasksAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private SystemSettingManager systemSettingManager;
+
+ public void setSystemSettingManager( SystemSettingManager systemSettingManager )
+ {
+ this.systemSettingManager = systemSettingManager;
+ }
+
+ private SchedulingManager schedulingManager;
+
+ public void setSchedulingManager( SchedulingManager schedulingManager )
+ {
+ this.schedulingManager = schedulingManager;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private boolean execute;
+
+ public void setExecute( boolean execute )
+ {
+ this.execute = execute;
+ }
+
+ private boolean statusOnly = false;
+
+ public void setStatusOnly( boolean statusOnly )
+ {
+ this.statusOnly = statusOnly;
+ }
+
+ private Set<String> scheduledPeriodTypes = new HashSet<String>();
+
+ public void setScheduledPeriodTypes( Set<String> scheduledPeriodTypes )
+ {
+ this.scheduledPeriodTypes = scheduledPeriodTypes;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private String status;
+
+ public String getStatus()
+ {
+ return status;
+ }
+
+ private boolean running;
+
+ public boolean isRunning()
+ {
+ return running;
+ }
+
+ private Set<String> periodTypes = new HashSet<String>();
+
+ public Set<String> getPeriodTypes()
+ {
+ return periodTypes;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ @SuppressWarnings("unchecked")
+ public String execute()
+ {
+ if ( execute )
+ {
+ schedulingManager.executeTasks();
+ }
+ else if ( !statusOnly )
+ {
+ systemSettingManager.saveSystemSetting( KEY_SCHEDULED_PERIOD_TYPES, (HashSet<String>) scheduledPeriodTypes );
+
+ if ( Scheduler.STATUS_RUNNING.equals( schedulingManager.getTaskStatus() ) )
+ {
+ systemSettingManager.saveSystemSetting( KEY_DATAMART_TASK, new Boolean( false ) );
+ systemSettingManager.saveSystemSetting( KEY_DATASETCOMPLETENESS_TASK, new Boolean( false ) );
+
+ schedulingManager.stopTasks();
+ }
+ else
+ {
+ systemSettingManager.saveSystemSetting( KEY_DATAMART_TASK, new Boolean( true) );
+ systemSettingManager.saveSystemSetting( KEY_DATASETCOMPLETENESS_TASK, new Boolean( true ) );
+
+ schedulingManager.scheduleTasks();
+ }
+ }
+
+ status = schedulingManager.getTaskStatus();
+ running = Scheduler.STATUS_RUNNING.equals( status );
+ periodTypes = (Set<String>) systemSettingManager.getSystemSetting( KEY_SCHEDULED_PERIOD_TYPES, DEFAULT_SCHEDULED_PERIOD_TYPES );
+
+ return SUCCESS;
+ }
+}
=== 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 2011-10-03 09:23:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml 2011-11-02 14:39:42 +0000
@@ -323,4 +323,12 @@
<property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
</bean>
+ <!-- Scheduling -->
+
+ <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.options.SystemSettingManager" />
+ <property name="schedulingManager" ref="org.hisp.dhis.scheduling.SchedulingManager" />
+ </bean>
+
</beans>
=== 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 2011-09-21 15:41:25 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2011-11-02 14:39:42 +0000
@@ -360,3 +360,13 @@
attribute_sort_order = Attribute sort order
data_element_does_not_exist = Data element does not exist
category_option_combo_does_not_exist = Category option combo does not exist
+scheduling_is = Scheduling is
+scheduling = Scheduling
+scheduling_management = Scheduling management
+stop = Stop
+refresh = Refresh
+aggregation_period_types = Aggregation period types
+not_started = not started
+running = running
+done = done
+stopped = stopped
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml 2011-10-07 04:26:51 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml 2011-11-02 14:39:42 +0000
@@ -550,5 +550,22 @@
<param name="onExceptionReturn">plainTextError</param>
</action>
+ <!-- Scheduling -->
+
+ <action name="viewScheduledTasks" class="org.hisp.dhis.dataadmin.action.scheduling.ScheduleTasksAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-dataadmin/viewScheduledTasks.vm</param>
+ <param name="menu">/dhis-web-maintenance-dataadmin/menu.vm</param>
+ <param name="statusOnly">true</param>
+ <param name="requiredAuthorities">F_SCHEDULING_ADMIN</param>
+ </action>
+
+ <action name="scheduleTasks" class="org.hisp.dhis.dataadmin.action.scheduling.ScheduleTasksAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-dataadmin/viewScheduledTasks.vm</param>
+ <param name="menu">/dhis-web-maintenance-dataadmin/menu.vm</param>
+ <param name="requiredAuthorities">F_SCHEDULING_ADMIN</param>
+ </action>
+
</package>
</struts>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/menu.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/menu.vm 2011-10-03 09:23:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/menu.vm 2011-11-02 14:39:42 +0000
@@ -17,11 +17,6 @@
<li><a href="displayPruneOrganisationUnitForm.action">$i18n.getString( "organisation_unit_pruning" ) </a></li>
<li><a href="getMinMaxValidationParams.action">$i18n.getString( "min_max_value_generation") </a></li>
<li><a href="constant.action">$i18n.getString( "constant") </a></li>
-</ul>
-
-<h2>$i18n.getString( "system_administration" ) </h2>
-
-<ul>
<li><a href="showCache.action">$i18n.getString( "cache_statistics" ) </a></li>
</ul>
@@ -30,3 +25,9 @@
<ul>
<li><a href="attribute.action">$i18n.getString( "attribute" ) </a></li>
</ul>
+
+<h2>$i18n.getString( "scheduling" ) </h2>
+
+<ul>
+ <li><a href="viewScheduledTasks.action">$i18n.getString( "scheduling" )</a></li>
+</ul>
=== added 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 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/viewScheduledTasks.vm 2011-11-02 14:39:42 +0000
@@ -0,0 +1,36 @@
+
+<h3>$i18n.getString( "scheduling_management" )</h3>
+
+<form action="scheduleTasks.action" method="post">
+<table>
+<tr>
+ <th>$i18n.getString( "aggregation_period_types" )</th>
+</tr>
+<tr>
+ <td>
+ <label for="monthly">$i18n.getString( "Monthly" )</label><input type="checkbox" id="monthly" name="scheduledPeriodTypes" value="Monthly"#if( $periodTypes.contains( "Monthly" ) ) checked="checked"#end>
+ <label for="biMonthly">$i18n.getString( "BiMonthly" )</label><input type="checkbox" id="biMonthly" name="scheduledPeriodTypes" value="BiMonthly"#if( $periodTypes.contains( "BiMonthly" ) ) checked="checked"#end>
+ <label for="quarterly">$i18n.getString( "Quarterly" )</label><input type="checkbox" id="quarterly" name="scheduledPeriodTypes" value="Quarterly"#if( $periodTypes.contains( "Quarterly" ) ) checked="checked"#end><br><br>
+ <label for="sixMonthly">$i18n.getString( "SixMonthly" )</label><input type="checkbox" id="sixMonthly" name="scheduledPeriodTypes" value="SixMonthly"#if( $periodTypes.contains( "SixMonthly" ) ) checked="checked"#end>
+ <label for="yearly">$i18n.getString( "Yearly" )</label><input type="checkbox" id="yearly" name="scheduledPeriodTypes" value="Yearly"#if( $periodTypes.contains( "Yearly" ) ) checked="checked"#end>
+ </td>
+</tr>
+<tr>
+ <td style="height:10px"></td>
+</tr>
+<tr>
+ <td>
+ <input type="submit" style="width:140px"
+ #if ( $running )
+ value="$i18n.getString( 'stop' )"
+ #else
+ value="$i18n.getString( 'start' )"
+ #end
+ />
+ <input type="button" style="width:140px" onclick="window.location.href='viewScheduledTasks.action?statusOnly=true'" value="$i18n.getString( 'refresh' )" />
+ </td>
+</tr>
+</table>
+</form>
+
+<span id="info">$i18n.getString( "scheduling_is" ) $!i18n.getString( $!status )</span>
=== removed directory 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/scheduling'
=== removed directory 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/scheduling/action'
=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/scheduling/action/ScheduleTasksAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/scheduling/action/ScheduleTasksAction.java 2011-05-14 19:32:53 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/scheduling/action/ScheduleTasksAction.java 1970-01-01 00:00:00 +0000
@@ -1,131 +0,0 @@
-package org.hisp.dhis.reporting.scheduling.action;
-
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import org.hisp.dhis.options.SystemSettingManager;
-import org.hisp.dhis.scheduling.SchedulingManager;
-import org.hisp.dhis.system.scheduling.Scheduler;
-
-import com.opensymphony.xwork2.Action;
-
-import static org.hisp.dhis.options.SystemSettingManager.*;
-
-/**
- * @author Lars Helge Overland
- */
-public class ScheduleTasksAction
- implements Action
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private SystemSettingManager systemSettingManager;
-
- public void setSystemSettingManager( SystemSettingManager systemSettingManager )
- {
- this.systemSettingManager = systemSettingManager;
- }
-
- private SchedulingManager schedulingManager;
-
- public void setSchedulingManager( SchedulingManager schedulingManager )
- {
- this.schedulingManager = schedulingManager;
- }
-
- // -------------------------------------------------------------------------
- // Input
- // -------------------------------------------------------------------------
-
- private boolean execute;
-
- public void setExecute( boolean execute )
- {
- this.execute = execute;
- }
-
- private boolean statusOnly = false;
-
- public void setStatusOnly( boolean statusOnly )
- {
- this.statusOnly = statusOnly;
- }
-
- // -------------------------------------------------------------------------
- // Output
- // -------------------------------------------------------------------------
-
- private String status;
-
- public String getStatus()
- {
- return status;
- }
-
- private boolean running;
-
- public boolean isRunning()
- {
- return running;
- }
-
- // -------------------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------------------
-
- public String execute()
- {
- if ( !statusOnly )
- {
- if ( execute )
- {
- schedulingManager.executeTasks();
- }
- else if ( Scheduler.STATUS_RUNNING.equals( schedulingManager.getTaskStatus() ) )
- {
- systemSettingManager.saveSystemSetting( KEY_DATAMART_TASK, new Boolean( false ) );
- systemSettingManager.saveSystemSetting( KEY_DATASETCOMPLETENESS_TASK, new Boolean( false ) );
-
- schedulingManager.stopTasks();
- }
- else
- {
- systemSettingManager.saveSystemSetting( KEY_DATAMART_TASK, new Boolean( true) );
- systemSettingManager.saveSystemSetting( KEY_DATASETCOMPLETENESS_TASK, new Boolean( true ) );
-
- schedulingManager.scheduleTasks();
- }
- }
-
- status = schedulingManager.getTaskStatus();
- running = Scheduler.STATUS_RUNNING.equals( status );
-
- return SUCCESS;
- }
-}
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml 2011-10-20 09:35:23 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml 2011-11-02 14:39:42 +0000
@@ -417,14 +417,6 @@
<property name="organisationUnitGroupService" ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
</bean>
- <!-- Scheduling -->
-
- <bean id="org.hisp.dhis.reporting.scheduling.action.ScheduleTasksAction" class="org.hisp.dhis.reporting.scheduling.action.ScheduleTasksAction"
- scope="prototype">
- <property name="systemSettingManager" ref="org.hisp.dhis.options.SystemSettingManager" />
- <property name="schedulingManager" ref="org.hisp.dhis.scheduling.SchedulingManager" />
- </bean>
-
<!-- Export -->
<bean id="org.hisp.dhis.reporting.exp.ExportDataMartAction" class="org.hisp.dhis.reporting.exp.ExportDataMartAction"
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties 2011-10-27 12:08:07 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties 2011-11-02 14:39:42 +0000
@@ -347,17 +347,6 @@
get_report_as_jrxml = Download as JRXML
user_organisation_unit = Include current user organisation unit
select_category_combo = Select category combination
-scheduled_export_is = Scheduled export is
-running = running
-done = done
-stopped = stopped
-not_started = not started
-scheduling = Scheduling
-scheduling_management = Scheduling management
-scheduling_is = Scheduling is
-start = Start
-stop = Stop
-refresh = Refresh
sort_order = Sort order
none = None
ascending = Low to high
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml 2011-10-11 14:54:46 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml 2011-11-02 14:39:42 +0000
@@ -519,23 +519,6 @@
<result name="success" type="chart"></result>
</action>
- <!-- Scheduling -->
-
- <action name="viewScheduledTasks" class="org.hisp.dhis.reporting.scheduling.action.ScheduleTasksAction">
- <result name="success" type="velocity">/main.vm</result>
- <param name="page">/dhis-web-reporting/viewScheduledTasks.vm</param>
- <param name="menu">/dhis-web-reporting/menu.vm</param>
- <param name="statusOnly">true</param>
- <param name="requiredAuthorities">F_SCHEDULING_ADMIN</param>
- </action>
-
- <action name="scheduleTasks" class="org.hisp.dhis.reporting.scheduling.action.ScheduleTasksAction">
- <result name="success" type="velocity">/main.vm</result>
- <param name="page">/dhis-web-reporting/viewScheduledTasks.vm</param>
- <param name="menu">/dhis-web-reporting/menu.vm</param>
- <param name="requiredAuthorities">F_SCHEDULING_ADMIN</param>
- </action>
-
<!-- Datamart CSV Export -->
<action name="weeklyDataValues" class="org.hisp.dhis.reporting.exp.ExportDataMartAction">
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/menu.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/menu.vm 2011-07-22 07:14:57 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/menu.vm 2011-11-02 14:39:42 +0000
@@ -20,11 +20,6 @@
<li><a href="displayPivotTableForm.action">$i18n.getString( "pivot_table" ) </a></li>
</ul>
-<h2>$i18n.getString( "scheduling" ) </h2>
-<ul>
- <li><a href="viewScheduledTasks.action">$i18n.getString( "scheduling" )</a></li>
-</ul>
-
<h2>$i18n.getString( "groups" ) </h2>
<ul>
<li><a href="viewGroups.action">$i18n.getString( "groups" )</a></li>
=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewScheduledTasks.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewScheduledTasks.vm 2011-03-28 20:09:32 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewScheduledTasks.vm 1970-01-01 00:00:00 +0000
@@ -1,16 +0,0 @@
-
-<h3>$i18n.getString( "scheduling_management" )</h3>
-
-<span id="info">$i18n.getString( "scheduling_is" ) $!i18n.getString( $!status )</span>
-
-<p>
-<input type="button" style="width:140px" onclick="window.location.href='scheduleTasks.action'"
-#if ( $running )
-value="$i18n.getString( 'stop' )"
-#else
-value="$i18n.getString( 'start' )"
-#end
-/>
-
-<input type="button" style="width:140px" onclick="window.location.href='viewScheduledTasks.action'" value="$i18n.getString( 'refresh' )" />
-</p>