dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #21102
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9904: [mobile] support J2ME SMS (WIP)
------------------------------------------------------------
revno: 9904
committer: Long <Long@Long-Laptop>
branch nick: dhis2
timestamp: Tue 2013-02-26 14:47:48 +0700
message:
[mobile] support J2ME SMS (WIP)
modified:
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataSet.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileModel.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/SMSCommand.java
dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileOrganisationUnitController.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-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataSet.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataSet.java 2013-02-25 06:32:56 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataSet.java 2013-02-26 07:47:48 +0000
@@ -47,8 +47,6 @@
private int version;
- private SMSCommand smsCommand;
-
public DataSet()
{
}
@@ -211,16 +209,6 @@
section.serialize( dout );
}
}
-
- if ( this.smsCommand != null )
- {
- dout.writeInt( 1 );
- smsCommand.serialize( dout );
- }
- else
- {
- dout.writeInt( 0 );
- }
}
@Override
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileModel.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileModel.java 2013-02-25 06:32:56 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileModel.java 2013-02-26 07:47:48 +0000
@@ -279,6 +279,7 @@
public void serializeVersion2_10( DataOutputStream dout )
throws IOException
{
+
if ( programs == null )
{
dout.writeInt( 0 );
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/SMSCommand.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/SMSCommand.java 2013-02-25 06:32:56 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/SMSCommand.java 2013-02-26 07:47:48 +0000
@@ -15,9 +15,9 @@
private String codeSeparator;
private List<SMSCode> smsCodes;
-
+
private String clientVersion;
-
+
private int dataSetId;
@Override
@@ -87,7 +87,7 @@
{
this.smsCodes = smsCodes;
}
-
+
public String getClientVersion()
{
return clientVersion;
@@ -97,7 +97,7 @@
{
this.clientVersion = clientVersion;
}
-
+
public int getDataSetId()
{
return dataSetId;
@@ -113,8 +113,24 @@
throws IOException
{
dataOutputStream.writeUTF( this.parserType );
- dataOutputStream.writeUTF( this.separator );
- dataOutputStream.writeUTF( this.codeSeparator );
+ if ( this.separator != null )
+ {
+ dataOutputStream.writeUTF( this.separator );
+ }
+ else
+ {
+ dataOutputStream.writeUTF( "" );
+ }
+
+ if ( this.codeSeparator != null )
+ {
+ dataOutputStream.writeUTF( this.codeSeparator );
+ }
+ else
+ {
+ dataOutputStream.writeUTF( "" );
+ }
+
dataOutputStream.writeInt( this.dataSetId );
if ( this.smsCodes == null )
@@ -124,11 +140,10 @@
else
{
dataOutputStream.writeInt( smsCodes.size() );
- }
-
- for ( SMSCode smsCode : smsCodes )
- {
- smsCode.serialize( dataOutputStream );
+ for ( SMSCode smsCode : smsCodes )
+ {
+ smsCode.serialize( dataOutputStream );
+ }
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileOrganisationUnitController.java'
--- dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileOrganisationUnitController.java 2013-02-25 06:32:56 +0000
+++ dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileOrganisationUnitController.java 2013-02-26 07:47:48 +0000
@@ -25,6 +25,7 @@
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.patient.PatientService;
+import org.hisp.dhis.sms.parse.ParserType;
import org.hisp.dhis.smscommand.SMSCommandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@@ -316,18 +317,21 @@
{
SMSCommand mobileSMSCommand = new SMSCommand();
List<SMSCode> smsCodes = new ArrayList<SMSCode>();
- mobileSMSCommand.setCodeSeparator( normalSMSCommand.getSeparator() );
+
+ mobileSMSCommand.setParserType( normalSMSCommand.getParserType().name() );
+ mobileSMSCommand.setCodeSeparator( normalSMSCommand.getCodeSeparator() );
mobileSMSCommand.setDataSetId( normalSMSCommand.getDataset().getId() );
- mobileSMSCommand.setCodeSeparator( normalSMSCommand.getCodeSeparator() );
+ mobileSMSCommand.setSeparator( normalSMSCommand.getSeparator() );
+
for ( org.hisp.dhis.smscommand.SMSCode normalSMSCode : normalSMSCommand.getCodes() )
{
SMSCode smsCode = new SMSCode();
+
smsCode.setCode( normalSMSCode.getCode() );
smsCode.setDataElementId( normalSMSCode.getDataElement().getId() );
smsCode.setOptionId( normalSMSCode.getId() );
smsCodes.add( smsCode );
}
- mobileSMSCommand.setSmsCodes( smsCodes );
smsCommands.add( mobileSMSCommand );
}
return smsCommands;