← Back to team overview

dhis-mobile-devs team mailing list archive

[Branch ~dhis-mobile-devs/dhis-mobile/lwuit-tracking] Rev 199: Implementation: J2ME Tracker 2.15 (Add TrackedEntity)

 

------------------------------------------------------------
revno: 199
committer: sherylyn.marie
branch nick: lwuit-tracking
timestamp: Mon 2014-03-31 15:35:06 +0800
message:
  Implementation: J2ME Tracker 2.15 (Add TrackedEntity)
  https://blueprints.launchpad.net/dhis-mobile/+spec/j2me-tracker-2.15
  
  Added LogMan logs as well
modified:
  src/org/hisp/dhis/mobile/connection/ConnectionManager.java
  src/org/hisp/dhis/mobile/connection/task/DownloadAllResourceTask.java
  src/org/hisp/dhis/mobile/model/PatientAttribute.java
  src/org/hisp/dhis/mobile/view/PersonRegistrationView.java


--
lp:~dhis-mobile-devs/dhis-mobile/lwuit-tracking
https://code.launchpad.net/~dhis-mobile-devs/dhis-mobile/lwuit-tracking

Your team DHIS mobile developers is subscribed to branch lp:~dhis-mobile-devs/dhis-mobile/lwuit-tracking.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis-mobile-devs/dhis-mobile/lwuit-tracking/+edit-subscription
=== modified file 'src/org/hisp/dhis/mobile/connection/ConnectionManager.java'
--- src/org/hisp/dhis/mobile/connection/ConnectionManager.java	2014-03-26 04:24:35 +0000
+++ src/org/hisp/dhis/mobile/connection/ConnectionManager.java	2014-03-31 07:35:06 +0000
@@ -95,7 +95,7 @@
     public static void init( org.hisp.dhis.mobile.midlet.DHISMIDlet dhisMIDlet, String url, String userName,
         String password, String locale, OrgUnit orgUnit )
     {
-        LogMan.log( LogMan.DEV, "Network" + CLASS_TAG, "Initializing Connection Manager..." );
+        LogMan.log( LogMan.DEV, "Network," + CLASS_TAG, "Initializing Connection Manager..." );
 
         ConnectionManager.dhisMIDlet = dhisMIDlet;
         ConnectionManager.url = url;
@@ -107,11 +107,11 @@
         ua = "Profile/" + System.getProperty( "microedition.profiles" ) + " Configuration/"
             + System.getProperty( "microedition.configuration" );
 
-        LogMan.log( LogMan.DEV, "Network" + CLASS_TAG, "Connection Settings: URL=" + url );
+        LogMan.log( LogMan.DEV, "Network," + CLASS_TAG, "Connection Settings: URL=" + url );
         LogMan.log( LogMan.DEV, "Network,Authentication," + CLASS_TAG, "Connection Settings: Username=" + userName );
         LogMan.log( LogMan.DEV, "Network,Authentication," + CLASS_TAG, "Connection Settings: Password=" + password );
-        LogMan.log( LogMan.DEV, "Network" + CLASS_TAG, "Connection Settings: Locale=" + locale );
-        LogMan.log( LogMan.DEV, "Network" + CLASS_TAG, "Connection Settings: User-Agent=" + ua );
+        LogMan.log( LogMan.DEV, "Network," + CLASS_TAG, "Connection Settings: Locale=" + locale );
+        LogMan.log( LogMan.DEV, "Network," + CLASS_TAG, "Connection Settings: User-Agent=" + ua );
     }
 
     /**

=== modified file 'src/org/hisp/dhis/mobile/connection/task/DownloadAllResourceTask.java'
--- src/org/hisp/dhis/mobile/connection/task/DownloadAllResourceTask.java	2014-03-26 04:24:35 +0000
+++ src/org/hisp/dhis/mobile/connection/task/DownloadAllResourceTask.java	2014-03-31 07:35:06 +0000
@@ -37,7 +37,7 @@
     extends AbstractTask
 {
     private static final String CLASS_TAG = "DownloadAllResourceTask";
-    
+
     private MobileModel mobileModel = new MobileModel();
 
     private Vector orgUnitVector;
@@ -68,6 +68,8 @@
     {
         DataInputStream inputStream = null;
         ConnectionManager.setUrl( orgUnit.getDownloadAllUrl() );
+        LogMan.log( LogMan.INFO, "Network," + CLASS_TAG, "Downloading programs..." + ConnectionManager.getUrl() );
+
         try
         {
             inputStream = this.download();

=== modified file 'src/org/hisp/dhis/mobile/model/PatientAttribute.java'
--- src/org/hisp/dhis/mobile/model/PatientAttribute.java	2014-02-07 11:02:56 +0000
+++ src/org/hisp/dhis/mobile/model/PatientAttribute.java	2014-03-31 07:35:06 +0000
@@ -37,7 +37,7 @@
 
     private boolean isDisplayedInList = false;
 
-    private Vector predefinedValues;
+    private OptionSet optionSet;
 
     // -------------------------------------------------------------------------
     // Constructors
@@ -98,14 +98,14 @@
         this.isMandatory = isMandatory;
     }
 
-    public Vector getPredefinedValues()
+    public OptionSet getOptionSet()
     {
-        return predefinedValues;
+        return optionSet;
     }
 
-    public void setPredefinedValues( Vector predefinedValues )
+    public void setOptionSet( OptionSet optionSet )
     {
-        this.predefinedValues = predefinedValues;
+        this.optionSet = optionSet;
     }
 
     public boolean isDisplayedInList()
@@ -144,10 +144,12 @@
         dout.writeBoolean( isMandatory );
         dout.writeBoolean( isDisplayedInList );
 
-        dout.writeInt( predefinedValues.size() );
-        for ( int i = 0; i < predefinedValues.size(); i++ )
+        int optionSize = (optionSet == null || optionSet.getOptions() == null) ? 0 : optionSet.getOptions().size();
+        
+        dout.writeInt( optionSize );
+        if ( optionSize > 0 )
         {
-            dout.writeUTF( (String) predefinedValues.elementAt( i ) );
+            optionSet.serialize( dout );
         }
     }
 
@@ -159,13 +161,13 @@
         this.setType( din.readUTF() );
         this.setMandatory( din.readBoolean() );
         this.setDisplayedInList( din.readBoolean() );
-
+        
         int optionSize = din.readInt();
-        predefinedValues = new Vector();
-
-        for ( int i = 0; i < optionSize; i++ )
+        
+        if( optionSize > 0 )
         {
-            predefinedValues.addElement( din.readUTF() );
+            this.optionSet = new OptionSet();
+            this.optionSet.deSerialize( din );
         }
     }
 

=== modified file 'src/org/hisp/dhis/mobile/view/PersonRegistrationView.java'
--- src/org/hisp/dhis/mobile/view/PersonRegistrationView.java	2014-02-07 11:02:56 +0000
+++ src/org/hisp/dhis/mobile/view/PersonRegistrationView.java	2014-03-31 07:35:06 +0000
@@ -5,8 +5,10 @@
 import java.util.Vector;
 
 import org.hisp.dhis.mobile.connection.ConnectionManager;
+import org.hisp.dhis.mobile.log.LogMan;
 import org.hisp.dhis.mobile.midlet.DHISMIDlet;
 import org.hisp.dhis.mobile.midlet.NameBasedMIDlet;
+import org.hisp.dhis.mobile.model.OptionSet;
 import org.hisp.dhis.mobile.model.Patient;
 import org.hisp.dhis.mobile.model.PatientAttribute;
 import org.hisp.dhis.mobile.model.Program;
@@ -31,6 +33,7 @@
     extends AbstractView
     implements ActionListener
 {
+    private static final String CLASS_TAG = "PersonRegistrationView";
 
     public static final String BLANK = "";
 
@@ -126,10 +129,12 @@
                 }
                 if ( patientAttribute.getType().equals( "combo" ) )
                 {
+                    LogMan.log( LogMan.DEBUG, "UI," + CLASS_TAG, "adding combo box" );
 
-                    Vector predefinedVector = patientAttribute.getPredefinedValues();
-                    String[] options = new String[predefinedVector.size()];
-                    predefinedVector.copyInto( options );
+                    Vector optionSet = patientAttribute.getOptionSet().getOptions();
+                    String[] options = new String[optionSet.size()];
+                    LogMan.log( LogMan.DEBUG, "UI," + CLASS_TAG, "options size="+optionSet.size() );
+                    optionSet.copyInto( options );
 
                     ComboBox comboBox = new ComboBox( options );
                     comboBox.setLabelForComponent( patientAttributeLabel );
@@ -341,7 +346,7 @@
                 patientAttribute.setName( name );
                 patientAttribute.setValue( value );
                 patientAttribute.setType( "" );
-                patientAttribute.setPredefinedValues( new Vector() );
+                patientAttribute.setOptionSet( programAttribute.getOptionSet() );
                 patientAttribute.setDisplayedInList( programAttribute.isDisplayedInList() );
                 attributeVector.addElement( patientAttribute );
             }