← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9597: Updated adhoc tool

 

------------------------------------------------------------
revno: 9597
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-01-24 09:39:47 +0100
message:
  Updated adhoc tool
removed:
  tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/CustomFormWriter.java
added:
  tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/command/
  tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/command/ExampleCommand.java
modified:
  tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/Command.java
  tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/RunMe.java
  tools/dhis-adhoc/src/main/resources/META-INF/dhis/beans.xml
  tools/dhis-adhoc/src/main/resources/log4j.properties


--
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/Command.java'
--- tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/Command.java	2013-01-23 14:05:25 +0000
+++ tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/Command.java	2013-01-24 08:39:47 +0000
@@ -2,5 +2,6 @@
 
 public interface Command
 {
-    void execute();
+    void execute() 
+        throws Exception;
 }

=== removed file 'tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/CustomFormWriter.java'
--- tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/CustomFormWriter.java	2013-01-23 14:05:25 +0000
+++ tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/CustomFormWriter.java	1970-01-01 00:00:00 +0000
@@ -1,20 +0,0 @@
-package org.hisp.dhis.adhoc;
-
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.dataset.DataSetService;
-import org.springframework.beans.factory.annotation.Autowired;
-
-public class CustomFormWriter
-    implements Command
-{
-    @Autowired
-    private DataSetService dataSetService;
-    
-    @Autowired
-    private DataElementService dataElementService;
-    
-    @Override
-    public void execute()
-    {
-    }
-}

=== 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-23 14:05:25 +0000
+++ tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/RunMe.java	2013-01-24 08:39:47 +0000
@@ -14,7 +14,7 @@
  * 
  * To add tasks you should implement the Command interface, add your implementation
  * class as a bean in beans.xml under src/main/resources/META-INF/dhis, and add
- * the bean identifier to the list in the commands() method int this class.
+ * the bean identifier to the list in the commands() method in this class.
  */
 public class RunMe
 {
@@ -24,7 +24,16 @@
     
     private static ApplicationContext context;
     
+    /**
+     * Add commands here by adding the bean identifier to the list.
+     */
+    public static List<String> commands()
+    {
+        return Arrays.asList( "exampleCommand" );
+    }
+    
     public static void main( String[] args )
+        throws Exception
     {
         System.setProperty( "dhis2.home", DHIS2_HOME );
         
@@ -45,16 +54,11 @@
             log.info( "Done: " + id );
         }
         
-        log.info( "Completed" );
+        log.info( "Process completed" );
     }
     
     private static Command get( String id )
     {
         return (Command) context.getBean( id );
     }
-    
-    private static List<String> commands()
-    {
-        return Arrays.asList( "customFormWriter" );
-    }
 }

=== added directory 'tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/command'
=== added file 'tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/command/ExampleCommand.java'
--- tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/command/ExampleCommand.java	1970-01-01 00:00:00 +0000
+++ tools/dhis-adhoc/src/main/java/org/hisp/dhis/adhoc/command/ExampleCommand.java	2013-01-24 08:39:47 +0000
@@ -0,0 +1,16 @@
+package org.hisp.dhis.adhoc.command;
+
+import org.hisp.dhis.adhoc.Command;
+import org.springframework.transaction.annotation.Transactional;
+
+public class ExampleCommand
+    implements Command
+{
+    @Override
+    @Transactional
+    public void execute()
+        throws Exception
+    {
+        // Do your stuff here
+    }
+}

=== modified file 'tools/dhis-adhoc/src/main/resources/META-INF/dhis/beans.xml'
--- tools/dhis-adhoc/src/main/resources/META-INF/dhis/beans.xml	2013-01-23 14:05:25 +0000
+++ tools/dhis-adhoc/src/main/resources/META-INF/dhis/beans.xml	2013-01-24 08:39:47 +0000
@@ -2,6 +2,6 @@
 <beans xmlns="http://www.springframework.org/schema/beans"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd";>
 
-    <bean id="customFormWriter" class="org.hisp.dhis.adhoc.CustomFormWriter"/>
-    
+    <bean id="exampleCommand" class="org.hisp.dhis.adhoc.command.ExampleCommand" />
+
 </beans>

=== modified file 'tools/dhis-adhoc/src/main/resources/log4j.properties'
--- tools/dhis-adhoc/src/main/resources/log4j.properties	2013-01-23 14:05:25 +0000
+++ tools/dhis-adhoc/src/main/resources/log4j.properties	2013-01-24 08:39:47 +0000
@@ -22,9 +22,6 @@
 # DHIS 2 logging level
 log4j.logger.org.hisp.dhis = INFO
 
-# SMS lib logging level
-log4j.logger.smslib = INFO
-
 # Ehcache logging level
 log4j.logger.org.hibernate.cache=ERROR