dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #08167
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1911: Wait Form for login and delete datavalue method
------------------------------------------------------------
revno: 1911
committer: Long <thanhlongngo1988>
branch nick: cbhis-mobile
timestamp: Mon 2010-09-06 10:04:35 +0700
message:
Wait Form for login and delete datavalue method
modified:
mobile/dhis-mobile/.mtj
mobile/dhis-mobile/src/org/hisp/dhis/mobile/db/Storage.java
mobile/dhis-mobile/src/org/hisp/dhis/mobile/ui/DHISMIDlet.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 'mobile/dhis-mobile/.mtj'
--- mobile/dhis-mobile/.mtj 2010-08-30 09:47:01 +0000
+++ mobile/dhis-mobile/.mtj 2010-09-06 03:04:35 +0000
@@ -8,8 +8,8 @@
<configuration active="true" name="DefaultFxPhone1">
<device group="Sun Java(TM) Wireless Toolkit 2.5.2_01 for CLDC" name="DefaultColorPhone"/>
<symbolSet name="DefaultFxPhone1">
+ <symbol name="MMAPI" value="1.2"/>
<symbol name="screen.isColor" value="true"/>
- <symbol name="MMAPI" value="1.2"/>
<symbol name="descriptor" value="FX Emulator"/>
<symbol name="screen.bitDepth" value="16"/>
<symbol name="JSR82" value="1.1"/>
=== modified file 'mobile/dhis-mobile/src/org/hisp/dhis/mobile/db/Storage.java'
--- mobile/dhis-mobile/src/org/hisp/dhis/mobile/db/Storage.java 2010-08-31 09:00:31 +0000
+++ mobile/dhis-mobile/src/org/hisp/dhis/mobile/db/Storage.java 2010-09-06 03:04:35 +0000
@@ -238,6 +238,35 @@
rse.printStackTrace();
}
}
+
+ public static void deleteDataValue( Activity activity, DataValue newDataValue )
+ {
+ RecordStore rs = null;
+ RecordEnumeration re = null;
+ try
+ {
+ DataValueFilter filter = new DataValueFilter();
+ filter.setDataElementID( newDataValue.getDataElementId() );
+ filter.setProStageInstanceID( activity.getTask().getProgStageInstId() );
+ rs = RecordStore.openRecordStore( ModelRecordStore.DATAVALUE_DB, true );
+ re = rs.enumerateRecords( filter, null, false );
+ while ( re.hasNextElement() )
+ {
+ if ( re.numRecords() == 1 )
+ {
+ int id = re.nextRecordId();
+ rs.deleteRecord( id );
+ }
+ }
+ filter = null;
+ re = null;
+ rs = null;
+ }
+ catch ( RecordStoreException rse )
+ {
+ rse.printStackTrace();
+ }
+ }
public static void saveOrgUnit( OrgUnit orgUnit )
{
=== modified file 'mobile/dhis-mobile/src/org/hisp/dhis/mobile/ui/DHISMIDlet.java'
--- mobile/dhis-mobile/src/org/hisp/dhis/mobile/ui/DHISMIDlet.java 2010-08-31 09:00:31 +0000
+++ mobile/dhis-mobile/src/org/hisp/dhis/mobile/ui/DHISMIDlet.java 2010-09-06 03:04:35 +0000
@@ -465,6 +465,13 @@
getDataValue( selectedActivity.getTask().getProgStageInstId(), de.getId(), txtField.getString() ) );
System.out.println( "Updating: " + de.getName() );
}
+ else
+ {
+ Storage.deleteDataValue( selectedActivity,
+ getDataValue( selectedActivity.getTask().getProgStageInstId(), de.getId(), txtField.getString() ) );
+ System.out.println( "Deleting: " + de.getName() );
+
+ }
}
}
@@ -943,7 +950,7 @@
// This is just for test .....
ProgramStageForm frm = Storage.fetchForm( 1 );
-// renderForm( frm, form );
+ // renderForm( frm, form );
}
return form;
}
@@ -1193,6 +1200,7 @@
DownloadManager downloadManager = new DownloadManager( this, getUrl().getString() + "user", user,
DownloadManager.DOWNLOAD_ORGUNIT );
downloadManager.start();
+ switchDisplayable( null, getWaitForm( "Connecting", "Please wait..." ) );
}
else
@@ -1341,7 +1349,7 @@
Date date = new Date();
date.setTime( Long.parseLong( (String) dataValueTable.get( String.valueOf( de.getId() ) ) ) );
dateField.setDate( date );
- System.out.println("Date in db is: " + date.toString());
+ System.out.println( "Date in db is: " + date.toString() );
}
form.append( dateField );
formElements.put( de, dateField );