← Back to team overview

dhis-mobile-devs team mailing list archive

[Branch ~dhis-mobile-devs/dhis-mobile/lwuit-tracking] Rev 191: clean up, refactor code

 

------------------------------------------------------------
revno: 191
committer: Long <Long@Long-Laptop>
branch nick: lwuit-tracking
timestamp: Mon 2013-12-02 16:38:40 +0700
message:
  clean up, refactor code
removed:
  src/org/hisp/dhis/mobile/connection/task/UpdateDataSetTask.java
modified:
  src/org/hisp/dhis/mobile/connection/ConnectionManager.java
  src/org/hisp/dhis/mobile/connection/task/AddRelationshipTask.java
  src/org/hisp/dhis/mobile/connection/task/FindAnonymousProgramTask.java
  src/org/hisp/dhis/mobile/connection/task/FindLostToFollowUpTask.java
  src/org/hisp/dhis/mobile/connection/task/FindPatientTask.java
  src/org/hisp/dhis/mobile/connection/task/GenerateRepeatableEventTask.java
  src/org/hisp/dhis/mobile/connection/task/GetProgramsTask.java
  src/org/hisp/dhis/mobile/connection/task/RegisterAllOfflinePatientTask.java
  src/org/hisp/dhis/mobile/connection/task/SaveUnregisteredPersonTask.java
  src/org/hisp/dhis/mobile/connection/task/SendLostToFollowUpTask.java
  src/org/hisp/dhis/mobile/connection/task/UpdateContactTask.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	2013-11-28 07:12:43 +0000
+++ src/org/hisp/dhis/mobile/connection/ConnectionManager.java	2013-12-02 09:38:40 +0000
@@ -42,7 +42,6 @@
 import org.hisp.dhis.mobile.connection.task.SaveUnregisteredPersonTask;
 import org.hisp.dhis.mobile.connection.task.SendLostToFollowUpTask;
 import org.hisp.dhis.mobile.connection.task.UpdateContactTask;
-import org.hisp.dhis.mobile.connection.task.UpdateDataSetTask;
 import org.hisp.dhis.mobile.connection.task.UpdateNewVersionTask;
 import org.hisp.dhis.mobile.connection.task.UploadTrackingFormTask;
 import org.hisp.dhis.mobile.midlet.DHISMIDlet;
@@ -145,11 +144,6 @@
         runTask( new DownloadAllResourceTask( orgUnitVector ) );
     }
 
-    public static void updateDataSet()
-    {
-        runTask( new UpdateDataSetTask() );
-    }
-
     public static void updateNewVersion()
     {
         runTask( new UpdateNewVersionTask() );

=== modified file 'src/org/hisp/dhis/mobile/connection/task/AddRelationshipTask.java'
--- src/org/hisp/dhis/mobile/connection/task/AddRelationshipTask.java	2013-04-05 07:53:02 +0000
+++ src/org/hisp/dhis/mobile/connection/task/AddRelationshipTask.java	2013-12-02 09:38:40 +0000
@@ -48,9 +48,9 @@
 public class AddRelationshipTask
     extends AbstractTask
 {
-    Relationship enrollmentRelationship;
+    private Relationship enrollmentRelationship;
 
-    NameBasedMIDlet nameBasedMIDlet;
+    private NameBasedMIDlet nameBasedMIDlet;
 
     public void run()
     {

=== modified file 'src/org/hisp/dhis/mobile/connection/task/FindAnonymousProgramTask.java'
--- src/org/hisp/dhis/mobile/connection/task/FindAnonymousProgramTask.java	2013-10-03 08:31:21 +0000
+++ src/org/hisp/dhis/mobile/connection/task/FindAnonymousProgramTask.java	2013-12-02 09:38:40 +0000
@@ -44,7 +44,7 @@
 
     private String keyWord;
 
-    NameBasedMIDlet nameBasedMIDlet;
+    private NameBasedMIDlet nameBasedMIDlet;
     
     public FindAnonymousProgramTask( String keyWord )
     {

=== modified file 'src/org/hisp/dhis/mobile/connection/task/FindLostToFollowUpTask.java'
--- src/org/hisp/dhis/mobile/connection/task/FindLostToFollowUpTask.java	2013-11-12 08:06:45 +0000
+++ src/org/hisp/dhis/mobile/connection/task/FindLostToFollowUpTask.java	2013-12-02 09:38:40 +0000
@@ -42,7 +42,7 @@
 {
     private String searchEventInfos;
 
-    NameBasedMIDlet nameBasedMIDlet;
+    private NameBasedMIDlet nameBasedMIDlet;
     
     public FindLostToFollowUpTask( String searchEventInfos )
     {

=== modified file 'src/org/hisp/dhis/mobile/connection/task/FindPatientTask.java'
--- src/org/hisp/dhis/mobile/connection/task/FindPatientTask.java	2013-10-21 02:58:54 +0000
+++ src/org/hisp/dhis/mobile/connection/task/FindPatientTask.java	2013-12-02 09:38:40 +0000
@@ -47,7 +47,7 @@
 {
     private String keyWord;
 
-    NameBasedMIDlet nameBasedMIDlet;
+    private NameBasedMIDlet nameBasedMIDlet;
 
     public FindPatientTask( String keyWord )
     {

=== modified file 'src/org/hisp/dhis/mobile/connection/task/GenerateRepeatableEventTask.java'
--- src/org/hisp/dhis/mobile/connection/task/GenerateRepeatableEventTask.java	2013-10-30 09:20:56 +0000
+++ src/org/hisp/dhis/mobile/connection/task/GenerateRepeatableEventTask.java	2013-12-02 09:38:40 +0000
@@ -44,7 +44,7 @@
 {
     private String eventInfo;
 
-    NameBasedMIDlet nameBasedMIDlet;
+    private NameBasedMIDlet nameBasedMIDlet;
     
     public GenerateRepeatableEventTask( String eventInfo )
     {

=== modified file 'src/org/hisp/dhis/mobile/connection/task/GetProgramsTask.java'
--- src/org/hisp/dhis/mobile/connection/task/GetProgramsTask.java	2013-11-28 07:12:43 +0000
+++ src/org/hisp/dhis/mobile/connection/task/GetProgramsTask.java	2013-12-02 09:38:40 +0000
@@ -49,11 +49,11 @@
 
     public static final String MULTI_EVENT_TYPE = "1";
 
-    String programType;
-
-    boolean isLostToFollowUp;
-
-    NameBasedMIDlet nameBasedMIDlet;
+    private String programType;
+
+    private boolean isLostToFollowUp;
+
+    private NameBasedMIDlet nameBasedMIDlet;
 
     public GetProgramsTask( String programType, boolean isLostToFollowUp )
     {

=== modified file 'src/org/hisp/dhis/mobile/connection/task/RegisterAllOfflinePatientTask.java'
--- src/org/hisp/dhis/mobile/connection/task/RegisterAllOfflinePatientTask.java	2013-09-10 16:25:58 +0000
+++ src/org/hisp/dhis/mobile/connection/task/RegisterAllOfflinePatientTask.java	2013-12-02 09:38:40 +0000
@@ -16,7 +16,7 @@
 
     private Patient patient;
 
-    NameBasedMIDlet nameBasedMIDlet;
+    private NameBasedMIDlet nameBasedMIDlet;
 
     public RegisterAllOfflinePatientTask( Patient patient )
     {

=== modified file 'src/org/hisp/dhis/mobile/connection/task/SaveUnregisteredPersonTask.java'
--- src/org/hisp/dhis/mobile/connection/task/SaveUnregisteredPersonTask.java	2013-08-27 08:04:10 +0000
+++ src/org/hisp/dhis/mobile/connection/task/SaveUnregisteredPersonTask.java	2013-12-02 09:38:40 +0000
@@ -10,7 +10,7 @@
 {
     private Patient patient;
 
-    NameBasedMIDlet nameBasedMIDlet;
+    private NameBasedMIDlet nameBasedMIDlet;
 
     public SaveUnregisteredPersonTask( Patient patient )
     {

=== modified file 'src/org/hisp/dhis/mobile/connection/task/SendLostToFollowUpTask.java'
--- src/org/hisp/dhis/mobile/connection/task/SendLostToFollowUpTask.java	2013-10-10 04:37:14 +0000
+++ src/org/hisp/dhis/mobile/connection/task/SendLostToFollowUpTask.java	2013-12-02 09:38:40 +0000
@@ -45,9 +45,9 @@
  */
 public class SendLostToFollowUpTask extends AbstractTask
 {
-    NameBasedMIDlet nameBasedMIDlet;
+    private NameBasedMIDlet nameBasedMIDlet;
     
-    LostEvent lostEvent;
+    private LostEvent lostEvent;
     
     public SendLostToFollowUpTask( LostEvent lostEvent )
     {

=== modified file 'src/org/hisp/dhis/mobile/connection/task/UpdateContactTask.java'
--- src/org/hisp/dhis/mobile/connection/task/UpdateContactTask.java	2013-04-15 06:29:16 +0000
+++ src/org/hisp/dhis/mobile/connection/task/UpdateContactTask.java	2013-12-02 09:38:40 +0000
@@ -51,13 +51,13 @@
 public class UpdateContactTask
     extends AbstractTask
 {
-    NameBasedMIDlet nameBasedMIDlet;
-    
-    static Alert check;
-
-    Random randPh = new Random();
-
-    PIM pim;
+    private NameBasedMIDlet nameBasedMIDlet;
+
+    private static Alert check;
+
+    private Random randPh = new Random();
+
+    private PIM pim;
 
     private String nameToWrite;
 
@@ -94,7 +94,7 @@
         writeContacts( contactList );
         contactList = null;
         System.gc();
-        nameBasedMIDlet.getAlertBoxView( "Update contact from server successfully", "Caution").showView();
+        nameBasedMIDlet.getAlertBoxView( "Update contact from server successfully", "Caution" ).showView();
     }
 
     public synchronized void writeContacts( Vector contactList )

=== removed file 'src/org/hisp/dhis/mobile/connection/task/UpdateDataSetTask.java'
--- src/org/hisp/dhis/mobile/connection/task/UpdateDataSetTask.java	2012-08-09 10:08:07 +0000
+++ src/org/hisp/dhis/mobile/connection/task/UpdateDataSetTask.java	1970-01-01 00:00:00 +0000
@@ -1,105 +0,0 @@
-package org.hisp.dhis.mobile.connection.task;
-
-/*
- * Copyright (c) 2004-2011, University of Oslo All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
- * following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the
- * distribution. * Neither the name of the HISP project nor the names of its contributors may be used to endorse or
- * promote products derived from this software without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.util.Vector;
-import javax.microedition.rms.RecordStoreException;
-
-import org.hisp.dhis.mobile.connection.ConnectionManager;
-import org.hisp.dhis.mobile.midlet.DHISMIDlet;
-import org.hisp.dhis.mobile.model.DataSet;
-import org.hisp.dhis.mobile.model.DataSetList;
-import org.hisp.dhis.mobile.recordstore.DataSetRecordStore;
-import org.hisp.dhis.mobile.util.SerializationUtil;
-
-public class UpdateDataSetTask
-    extends AbstractTask
-{
-
-    public void run()
-    {
-        DataInputStream inputStream = null;
-        try
-        {
-            DataSetList dataSetList = new DataSetList();
-            Vector currentDataSets = DataSetRecordStore.loadDataSets( ConnectionManager.getOrgUnit() );
-            for ( int i = 0; i < currentDataSets.size(); i++ )
-            {
-                ((DataSet) currentDataSets.elementAt( i )).setSections( null );
-            }
-            dataSetList.setCurrentDataSets( currentDataSets );
-
-            inputStream = this.getDecompressedStream( this.upload( SerializationUtil.serialize( dataSetList ) ) );
-
-            if ( inputStream != null )
-            {
-                dataSetList = null;
-                dataSetList = new DataSetList();
-                dataSetList.deSerialize( inputStream );
-
-                if ( dataSetList.getAddedDataSets() != null )
-                {
-                    DataSetRecordStore.saveDataSets( dataSetList.getAddedDataSets(), ConnectionManager.getOrgUnit() );
-                }
-
-                if ( dataSetList.getModifiedDataSets() != null )
-                {
-                    DataSetRecordStore.saveDataSets( dataSetList.getModifiedDataSets(), ConnectionManager.getOrgUnit() );
-                }
-
-                Vector deletedDataSetVector = dataSetList.getDeletedDataSets();
-
-                if ( deletedDataSetVector != null )
-                {
-                    for ( int i = 0; i < deletedDataSetVector.size(); i++ )
-                    {
-                        DataSetRecordStore.deleteDataSet( ((DataSet) deletedDataSetVector.elementAt( i )) );
-                    }
-                }
-            }
-        }
-        catch ( RecordStoreException e )
-        {
-            e.printStackTrace();
-            DHISMIDlet.debug( e.getMessage() );
-        }
-        catch ( IOException e )
-        {
-            e.printStackTrace();
-            DHISMIDlet.debug( e.getMessage() );
-        }
-        finally
-        {
-            try
-            {
-                if ( inputStream != null )
-                    inputStream.close();
-                System.gc();
-            }
-            catch ( IOException e )
-            {
-                e.printStackTrace();
-            }
-        }
-    }
-
-}