← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17221: Ad-hoc, added analytics table generator task. This is useful in order not to start a webapp every...

 

------------------------------------------------------------
revno: 17221
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-10-23 09:14:17 +0200
message:
  Ad-hoc, added analytics table generator task. This is useful in order not to start a webapp every time you want to test against a real db.
added:
  tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/command/AnalyticsTableGenerator.java
modified:
  tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/RunMe.java
  tools/dhis-adhoc/src/main/resources/META-INF/dhis/beans.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 'tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/RunMe.java'
--- tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/RunMe.java	2013-01-27 11:43:58 +0000
+++ tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/RunMe.java	2014-10-23 07:14:17 +0000
@@ -35,7 +35,7 @@
      */
     public static List<String> commands()
     {
-        return Arrays.asList( "exampleCommand" );
+        return Arrays.asList( "analyticsTableGenerator" );
     }
     
     public static void main( String[] args )

=== added file 'tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/command/AnalyticsTableGenerator.java'
--- tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/command/AnalyticsTableGenerator.java	1970-01-01 00:00:00 +0000
+++ tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/command/AnalyticsTableGenerator.java	2014-10-23 07:14:17 +0000
@@ -0,0 +1,25 @@
+package org.hisp.dhis.adhoc.command;
+
+import javax.annotation.Resource;
+
+import org.hisp.dhis.adhoc.Command;
+import org.hisp.dhis.analytics.scheduling.AnalyticsTableTask;
+import org.hisp.dhis.system.scheduling.Scheduler;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class AnalyticsTableGenerator
+    implements Command
+{
+    @Resource(name="analyticsAllTask")
+    private AnalyticsTableTask analyticsTableTask;
+    
+    @Autowired
+    private Scheduler scheduler;
+    
+    @Override
+    public void execute()
+        throws Exception
+    {
+        scheduler.executeTask( analyticsTableTask );        
+    }
+}

=== modified file 'tools/dhis-adhoc/src/main/resources/META-INF/dhis/beans.xml'
--- tools/dhis-adhoc/src/main/resources/META-INF/dhis/beans.xml	2014-04-25 14:00:28 +0000
+++ tools/dhis-adhoc/src/main/resources/META-INF/dhis/beans.xml	2014-10-23 07:14:17 +0000
@@ -6,4 +6,5 @@
     
     <bean id="randomDataPopulator" class="org.hisp.dhis.adhoc.command.RandomDataPopulator" />
 
+	<bean id="analyticsTableGenerator" class="org.hisp.dhis.adhoc.command.AnalyticsTableGenerator" />
 </beans>