← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7295: [mobile] modify sms commands

 

------------------------------------------------------------
revno: 7295
committer: Em <em.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-06-14 16:41:45 +0700
message:
  [mobile] modify sms commands
removed:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/incoming/
added:
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/smscommand/
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/smscommand/SMSCode.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/smscommand/SMSCommand.hbm.xml
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCommandStore.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/SMSCommandAction.java


--
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/smscommand/SMSCommandStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCommandStore.java	2012-06-13 08:44:07 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCommandStore.java	2012-06-14 09:41:45 +0000
@@ -3,8 +3,6 @@
 import java.util.Collection;
 import java.util.Set;
 
-import org.hisp.dhis.common.GenericNameableObjectStore;
-
 public interface SMSCommandStore  {
     Collection<SMSCommand> getSMSCommands();
     SMSCommand getSMSCommand(int id);

=== added directory 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/smscommand'
=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/smscommand/SMSCode.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/smscommand/SMSCode.hbm.xml	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/smscommand/SMSCode.hbm.xml	2012-06-14 09:41:45 +0000
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+    "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd";
+    [<!ENTITY identifiableProperties SYSTEM "classpath://org/hisp/dhis/common/identifiableProperties.hbm">]
+    >
+<hibernate-mapping package="org.hisp.dhis.smscommand">
+  <class name="SMSCode" table="smscodes">
+    <cache usage="read-write" />
+    <id name="id" column="smscodeid">
+      <generator class="increment" />
+    </id>
+
+    <property name="code" type="text" />
+    <many-to-one name="dataElement" class="org.hisp.dhis.dataelement.DataElement" column="dataelementid"
+      foreign-key="fk_dataelement_dataelementid" />
+    <property name="optionId" type="integer" />
+
+  </class>
+</hibernate-mapping> 
\ No newline at end of file

=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/smscommand/SMSCommand.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/smscommand/SMSCommand.hbm.xml	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/smscommand/SMSCommand.hbm.xml	2012-06-14 09:41:45 +0000
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+    "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd";
+    [<!ENTITY identifiableProperties SYSTEM "classpath://org/hisp/dhis/common/identifiableProperties.hbm">]
+    >
+<hibernate-mapping package="org.hisp.dhis.smscommand">
+  <class name="SMSCommand" table="smscommands">
+    <cache usage="read-write" />
+    <id name="id" column="smscommandid">
+      <generator class="increment" />
+    </id>
+    <property name="name" type="text" />
+    <property name="parser" type="text" />
+    <property name="seperator" type="text" />
+    <property name="codeSeperator" type="text" />
+    <many-to-one name="dataset" class="org.hisp.dhis.dataset.DataSet" column="datasetid" foreign-key="fk_dataset_datasetid" />
+
+    <set name="codes" table="smscommandcodes">
+      <cache usage="read-write" />
+      <key column="id" />
+      <many-to-many class="org.hisp.dhis.smscommand.SMSCode" column="codeid" unique="true" />
+    </set>
+
+  </class>
+</hibernate-mapping> 
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/SMSCommandAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/SMSCommandAction.java	2012-06-13 08:44:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/SMSCommandAction.java	2012-06-14 09:41:45 +0000
@@ -14,11 +14,9 @@
 
 import com.opensymphony.xwork2.Action;
 
-public class SMSCommandAction
-    implements Action
-{
+public class SMSCommandAction implements Action {
+
     private SMSCommandService smsCommandService;
-
     private DataSetService dataSetService;
 
     private int selectedCommandID = -1;
@@ -29,82 +27,71 @@
     // Action implementation
     // -------------------------------------------------------------------------
 
-    public String execute()
-        throws Exception
-    {
-        if ( getSMSCommand() != null && getSMSCommand().getCodes() != null )
-        {
-            for ( SMSCode x : getSMSCommand().getCodes() )
-            {
-                codes.put( "" + x.getDataElement().getId() + x.getOptionId(), x.getCode() );
+    public String execute() throws Exception {
+        if (getSMSCommand() != null && getSMSCommand().getCodes() != null) {
+            for (SMSCode x : getSMSCommand().getCodes()) {
+                codes.put("" + x.getDataElement().getId() + x.getOptionId(), x.getCode());
             }
         }
         return SUCCESS;
     }
 
-    public Set<DataElement> getDataSetElements()
-    {
-        if ( getSMSCommand() != null )
-        {
+    public Set<DataElement> getDataSetElements() {
+        if (getSMSCommand() != null) {
             DataSet d = getSMSCommand().getDataset();
-            if ( d != null )
-            {
+            if (d != null) {
                 return d.getDataElements();
             }
         }
         return null;
     }
 
-    public Collection<DataSet> getDataSets()
-    {
-        return dataSetService.getAllDataSets();
+    public Collection<DataSet> getDataSets() {
+        return getDataSetService().getAllDataSets();
     }
 
-    public Collection<SMSCommand> getSMSCommands()
-    {
-        System.out.println( "get:" + smsCommandService.getSMSCommands() );
+    public Collection<SMSCommand> getSMSCommands() {
+        System.out.println("get:" + smsCommandService.getSMSCommands());
         return smsCommandService.getSMSCommands();
     }
 
-    public SMSCommand getSMSCommand()
-    {
-        if ( selectedCommandID > -1 )
-        {
-            return smsCommandService.getSMSCommand( selectedCommandID );
-        }
-        else
-        {
+    public SMSCommand getSMSCommand() {
+        if (selectedCommandID > -1) {
+            return smsCommandService.getSMSCommand(selectedCommandID);
+        } else {
             return null;
         }
     }
 
-    public void setSmsCommandService( SMSCommandService smsCommandService )
-    {
+    public SMSCommandService getSmsCommandService() {
+        return smsCommandService;
+    }
+
+    public void setSmsCommandService(SMSCommandService smsCommandService) {
         this.smsCommandService = smsCommandService;
     }
 
-    public int getSelectedCommandID()
-    {
+    public int getSelectedCommandID() {
         return selectedCommandID;
     }
 
-    public void setSelectedCommandID( int selectedCommandID )
-    {
+    public void setSelectedCommandID(int selectedCommandID) {
         this.selectedCommandID = selectedCommandID;
     }
 
-    public void setDataSetService( DataSetService dataSetService )
-    {
+    public DataSetService getDataSetService() {
+        return dataSetService;
+    }
+
+    public void setDataSetService(DataSetService dataSetService) {
         this.dataSetService = dataSetService;
     }
 
-    public Map<String, String> getCodes()
-    {
+    public Map<String, String> getCodes() {
         return codes;
     }
 
-    public void setCodes( Map<String, String> codes )
-    {
+    public void setCodes(Map<String, String> codes) {
         this.codes = codes;
     }
 

=== removed directory 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/incoming'