dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #09842
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2663: Added function for executing data mart tasks. This function is currently for testing purposes onl...
------------------------------------------------------------
revno: 2663
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-01-20 08:45:51 +0100
message:
Added function for executing data mart tasks. This function is currently for testing purposes only and has no user interface.
added:
dhis-2/dhis-web/dhis-web-datamart/src/main/java/org/hisp/dhis/datamart/action/ExecuteExportAction.java
modified:
dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/DataMartScheduler.java
dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/task/SpringDataMartScheduler.java
dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-datamart/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-datamart/src/main/resources/struts.xml
--
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-datamart-default/src/main/java/org/hisp/dhis/datamart/DataMartScheduler.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/DataMartScheduler.java 2011-01-19 11:53:21 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/DataMartScheduler.java 2011-01-20 07:45:51 +0000
@@ -40,6 +40,8 @@
final String STATUS_STOPPED = "stopped";
final String STATUS_NOT_STARTED = "not_started";
+ void executeDataMartExport();
+
public void scheduleDataMartExport();
boolean stopDataMartExport();
=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/task/SpringDataMartScheduler.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/task/SpringDataMartScheduler.java 2011-01-19 11:53:21 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/task/SpringDataMartScheduler.java 2011-01-20 07:45:51 +0000
@@ -34,6 +34,7 @@
import org.hisp.dhis.datamart.DataMartService;
import org.hisp.dhis.indicator.IndicatorService;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.springframework.core.task.TaskExecutor;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.support.CronTrigger;
@@ -62,6 +63,13 @@
{
this.taskScheduler = taskScheduler;
}
+
+ private TaskExecutor taskExecutor;
+
+ public void setTaskExecutor( TaskExecutor taskExecutor )
+ {
+ this.taskExecutor = taskExecutor;
+ }
private DataElementService dataElementService;
@@ -88,6 +96,13 @@
// DataMartSceduler implementation
// -------------------------------------------------------------------------
+ public void executeDataMartExport()
+ {
+ DataMartTask task = new DataMartTask( dataMartService, dataElementService, indicatorService, organisationUnitService );
+
+ taskExecutor.execute( task );
+ }
+
public void scheduleDataMartExport()
{
DataMartTask task = new DataMartTask( dataMartService, dataElementService, indicatorService, organisationUnitService );
=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/META-INF/dhis/beans.xml 2011-01-11 13:11:31 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/META-INF/dhis/beans.xml 2011-01-20 07:45:51 +0000
@@ -198,7 +198,9 @@
<property name="dataMartService"
ref="org.hisp.dhis.datamart.DataMartService"/>
<property name="taskScheduler"
- ref="taskScheduler"/>
+ ref="taskScheduler"/>
+ <property name="taskExecutor"
+ ref="taskScheduler"/>
<property name="dataElementService"
ref="org.hisp.dhis.dataelement.DataElementService"/>
<property name="indicatorService"
=== added file 'dhis-2/dhis-web/dhis-web-datamart/src/main/java/org/hisp/dhis/datamart/action/ExecuteExportAction.java'
--- dhis-2/dhis-web/dhis-web-datamart/src/main/java/org/hisp/dhis/datamart/action/ExecuteExportAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-datamart/src/main/java/org/hisp/dhis/datamart/action/ExecuteExportAction.java 2011-01-20 07:45:51 +0000
@@ -0,0 +1,32 @@
+package org.hisp.dhis.datamart.action;
+
+import org.hisp.dhis.datamart.DataMartScheduler;
+
+import com.opensymphony.xwork2.Action;
+
+public class ExecuteExportAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private DataMartScheduler dataMartScheduler;
+
+ public void setDataMartScheduler( DataMartScheduler dataMartScheduler )
+ {
+ this.dataMartScheduler = dataMartScheduler;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ {
+ dataMartScheduler.executeDataMartExport();
+
+ return SUCCESS;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-datamart/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-datamart/src/main/resources/META-INF/dhis/beans.xml 2011-01-11 13:11:31 +0000
+++ dhis-2/dhis-web/dhis-web-datamart/src/main/resources/META-INF/dhis/beans.xml 2011-01-20 07:45:51 +0000
@@ -116,4 +116,11 @@
ref="org.hisp.dhis.datamart.DataMartScheduler"/>
</bean>
+ <bean id="org.hisp.dhis.datamart.action.ExecuteExportAction"
+ class="org.hisp.dhis.datamart.action.ExecuteExportAction"
+ scope="prototype">
+ <property name="dataMartScheduler"
+ ref="org.hisp.dhis.datamart.DataMartScheduler"/>
+ </bean>
+
</beans>
=== modified file 'dhis-2/dhis-web/dhis-web-datamart/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-datamart/src/main/resources/struts.xml 2011-01-11 13:11:31 +0000
+++ dhis-2/dhis-web/dhis-web-datamart/src/main/resources/struts.xml 2011-01-20 07:45:51 +0000
@@ -87,5 +87,9 @@
<result name="success" type="redirect">getScheduledExportStatus.action</result>
</action>
+ <action name="executeExport" class="org.hisp.dhis.datamart.action.ExecuteExportAction">
+ <result name="success" type="redirect">getScheduledExportStatus.action</result>
+ </action>
+
</package>
</struts>