dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #31224
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15898: [mobile] add interpretation for J2ME
------------------------------------------------------------
revno: 15898
committer: Hong Em <em.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2014-06-29 00:56:14 +0700
message:
[mobile] add interpretation for J2ME
added:
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Interpretation.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/InterpretationComment.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/interpretation/InterpretationService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/interpretation/InterpretationStore.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/ActivityReportingService.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileOrgUnitLinks.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java
dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/api/model/OrgUnitTest.java
dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/api/model/OrgUnitsTest.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/interpretation/hibernate/HibernateInterpretationStore.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/interpretation/impl/DefaultInterpretationService.java
dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileClientController.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-api/src/main/java/org/hisp/dhis/interpretation/InterpretationService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/interpretation/InterpretationService.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/interpretation/InterpretationService.java 2014-06-28 17:56:14 +0000
@@ -67,4 +67,6 @@
int countChartInterpretations( Chart chart );
int countReportTableInterpretations( ReportTable reportTable );
+
+ Interpretation getInterpretationByChartId(int id);
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/interpretation/InterpretationStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/interpretation/InterpretationStore.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/interpretation/InterpretationStore.java 2014-06-28 17:56:14 +0000
@@ -44,4 +44,7 @@
int countChartInterpretations( Chart chart );
int countReportTableInterpretations( ReportTable reportTable );
+
+ Interpretation getByChartId( int id );
+
}
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/ActivityReportingService.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/ActivityReportingService.java 2014-06-24 04:33:13 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/ActivityReportingService.java 2014-06-28 17:56:14 +0000
@@ -34,6 +34,7 @@
import org.hisp.dhis.api.mobile.model.ActivityPlan;
import org.hisp.dhis.api.mobile.model.ActivityValue;
+import org.hisp.dhis.api.mobile.model.Interpretation;
import org.hisp.dhis.api.mobile.model.Message;
import org.hisp.dhis.api.mobile.model.MessageConversation;
import org.hisp.dhis.api.mobile.model.PatientAttribute;
@@ -126,4 +127,12 @@
String replyMessage( Message message )
throws NotAllowedException;
+ Interpretation getInterpretation( String uId )
+ throws NotAllowedException;
+
+ String postInterpretation( String data )
+ throws NotAllowedException;
+
+ String postInterpretationComment( String data )
+ throws NotAllowedException;
}
=== added file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Interpretation.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Interpretation.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Interpretation.java 2014-06-28 17:56:14 +0000
@@ -0,0 +1,126 @@
+package org.hisp.dhis.api.mobile.model;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+public class Interpretation
+ implements DataStreamSerializable
+
+{
+ private int id;
+
+ private String text;
+
+ private Collection<InterpretationComment> inComments;
+
+ private List<InterpretationComment> interCommentList = new ArrayList<InterpretationComment>();
+
+ public int getId()
+ {
+ return id;
+ }
+
+ public void setId( int id )
+ {
+ this.id = id;
+ }
+
+ public String getText()
+ {
+ return text;
+ }
+
+ public void setText( String text )
+ {
+ this.text = text;
+ }
+
+ public Collection<InterpretationComment> getInComments()
+ {
+ return inComments;
+ }
+
+ public void setInComments( Collection<InterpretationComment> inComments )
+ {
+ this.inComments = inComments;
+ }
+
+ public List<InterpretationComment> getInterCommentList()
+ {
+ return interCommentList;
+ }
+
+ public void setInterCommentList( List<InterpretationComment> interCommentList )
+ {
+ this.interCommentList = interCommentList;
+ }
+
+ @Override
+ public void serialize( DataOutputStream dout )
+ throws IOException
+ {
+ dout.writeInt( this.getId() );
+ dout.writeUTF( this.getText() );
+
+ if ( inComments == null )
+ {
+ dout.writeInt( 0 );
+ }
+ else
+ {
+ dout.writeInt( inComments.size() );
+ for ( InterpretationComment interpretation : inComments )
+ {
+ interpretation.serialize( dout );
+ }
+ }
+
+ }
+
+ @Override
+ public void deSerialize( DataInputStream dataInputStream )
+ throws IOException
+ {
+ id = dataInputStream.readInt();
+ text = dataInputStream.readUTF();
+
+ int interCommentSize = dataInputStream.readInt();
+
+ for ( int i = 0; i < interCommentSize; i++ )
+ {
+ InterpretationComment interComment = new InterpretationComment();
+ interComment.deSerialize( dataInputStream );
+ interCommentList.add( interComment );
+ }
+
+ }
+
+ @Override
+ public void serializeVersion2_8( DataOutputStream dataOutputStream )
+ throws IOException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void serializeVersion2_9( DataOutputStream dataOutputStream )
+ throws IOException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void serializeVersion2_10( DataOutputStream dataOutputStream )
+ throws IOException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+}
=== added file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/InterpretationComment.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/InterpretationComment.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/InterpretationComment.java 2014-06-28 17:56:14 +0000
@@ -0,0 +1,59 @@
+package org.hisp.dhis.api.mobile.model;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+public class InterpretationComment
+ implements DataStreamSerializable
+{
+ private String text;
+
+ @Override
+ public void serialize( DataOutputStream dout )
+ throws IOException
+ {
+ dout.writeUTF( this.getText() );
+
+ }
+
+ @Override
+ public void deSerialize( DataInputStream din )
+ throws IOException
+ {
+ text = din.readUTF();
+
+ }
+
+ @Override
+ public void serializeVersion2_8( DataOutputStream dataOutputStream )
+ throws IOException
+ {
+
+ }
+
+ @Override
+ public void serializeVersion2_9( DataOutputStream dataOutputStream )
+ throws IOException
+ {
+
+ }
+
+ @Override
+ public void serializeVersion2_10( DataOutputStream dataOutputStream )
+ throws IOException
+ {
+
+ }
+
+ public String getText()
+ {
+ return text;
+ }
+
+ public void setText( String text )
+ {
+ this.text = text;
+ }
+
+}
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileOrgUnitLinks.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileOrgUnitLinks.java 2014-06-24 04:33:13 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileOrgUnitLinks.java 2014-06-28 17:56:14 +0000
@@ -77,6 +77,12 @@
private String replyMessageUrl;
+ private String downloadInterpretationUrl;
+
+ private String postInterpretationUrl;
+
+ private String postCommentUrl;
+
private String updateContactUrl;
private String findPatientUrl;
@@ -293,6 +299,38 @@
this.replyMessageUrl = replyMessageUrl;
}
+ public String getDownloadInterpretationUrl()
+ {
+ return downloadInterpretationUrl;
+ }
+
+ public void setDownloadInterpretationUrl( String downloadInterpretationUrl )
+ {
+ this.downloadInterpretationUrl = downloadInterpretationUrl;
+ }
+
+ public String getPostInterpretationUrl()
+ {
+ return postInterpretationUrl;
+ }
+
+ public void setPostInterpretationUrl( String postInterpretationUrl )
+ {
+ this.postInterpretationUrl = postInterpretationUrl;
+ }
+
+
+
+ public String getPostCommentUrl()
+ {
+ return postCommentUrl;
+ }
+
+ public void setPostCommentUrl( String postCommentUrl )
+ {
+ this.postCommentUrl = postCommentUrl;
+ }
+
public String getUpdateContactUrl()
{
return updateContactUrl;
@@ -483,6 +521,9 @@
dataOutputStream.writeUTF( downloadMessageConversationUrl );
dataOutputStream.writeUTF( getMessageUrl );
dataOutputStream.writeUTF( replyMessageUrl );
+ dataOutputStream.writeUTF( downloadInterpretationUrl );
+ dataOutputStream.writeUTF( postInterpretationUrl );
+ dataOutputStream.writeUTF( postCommentUrl );
dataOutputStream.writeUTF( updateContactUrl );
dataOutputStream.writeUTF( findPatientUrl );
dataOutputStream.writeUTF( registerPersonUrl );
@@ -523,6 +564,9 @@
downloadMessageConversationUrl = dataInputStream.readUTF();
getMessageUrl = dataInputStream.readUTF();
replyMessageUrl = dataInputStream.readUTF();
+ downloadInterpretationUrl = dataInputStream.readUTF();
+ postInterpretationUrl = dataInputStream.readUTF();
+ postCommentUrl = dataInputStream.readUTF();
updateContactUrl = dataInputStream.readUTF();
findPatientUrl = dataInputStream.readUTF();
registerPersonUrl = dataInputStream.readUTF();
@@ -580,6 +624,9 @@
dataOutputStream.writeUTF( this.downloadMessageConversationUrl );
dataOutputStream.writeUTF( this.getMessageUrl );
dataOutputStream.writeUTF( this.replyMessageUrl );
+ dataOutputStream.writeUTF( this.downloadInterpretationUrl );
+ dataOutputStream.writeUTF( this.postInterpretationUrl );
+ dataOutputStream.writeUTF( this.postCommentUrl );
// dataOutputStream.writeUTF( this.updateContactUrl );
}
@@ -604,6 +651,9 @@
dataOutputStream.writeUTF( downloadMessageConversationUrl );
dataOutputStream.writeUTF( getMessageUrl );
dataOutputStream.writeUTF( replyMessageUrl );
+ dataOutputStream.writeUTF( downloadInterpretationUrl );
+ dataOutputStream.writeUTF( postInterpretationUrl );
+ dataOutputStream.writeUTF( postCommentUrl );
dataOutputStream.writeUTF( updateContactUrl );
dataOutputStream.writeUTF( findPatientUrl );
dataOutputStream.writeUTF( registerPersonUrl );
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java 2014-06-24 04:33:13 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java 2014-06-28 17:56:14 +0000
@@ -49,6 +49,8 @@
import org.hisp.dhis.api.mobile.model.ActivityValue;
import org.hisp.dhis.api.mobile.model.Beneficiary;
import org.hisp.dhis.api.mobile.model.DataValue;
+import org.hisp.dhis.api.mobile.model.Interpretation;
+import org.hisp.dhis.api.mobile.model.InterpretationComment;
import org.hisp.dhis.api.mobile.model.OptionSet;
import org.hisp.dhis.api.mobile.model.PatientAttribute;
import org.hisp.dhis.api.mobile.model.Task;
@@ -58,11 +60,14 @@
import org.hisp.dhis.api.mobile.model.LWUITmodel.PatientList;
import org.hisp.dhis.api.mobile.model.LWUITmodel.Section;
import org.hisp.dhis.api.mobile.model.comparator.ActivityComparator;
+import org.hisp.dhis.chart.Chart;
+import org.hisp.dhis.chart.ChartService;
import org.hisp.dhis.common.Grid;
import org.hisp.dhis.common.QueryItem;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.event.EventStatus;
+import org.hisp.dhis.interpretation.InterpretationService;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.i18n.I18nManager;
import org.hisp.dhis.message.Message;
@@ -126,6 +131,10 @@
private static final String MESSAGE_SENT = "message_sent";
+ private static final String INTERPRETATION_SENT = "interpretation_sent";
+
+ private static final String COMMENT_SENT = "comment_sent";
+
private ActivityComparator activityComparator = new ActivityComparator();
// -------------------------------------------------------------------------
@@ -170,6 +179,10 @@
private UserService userService;
+ private InterpretationService interpretationService;
+
+ private ChartService chartService;
+
private Integer patientId;
@Autowired
@@ -268,6 +281,16 @@
// -------------------------------------------------------------------------
// MobileDataSetService
// -------------------------------------------------------------------------
+ @Required
+ public void setInterpretationService( InterpretationService interpretationService )
+ {
+ this.interpretationService = interpretationService;
+ }
+
+ public void setChartService( ChartService chartService )
+ {
+ this.chartService = chartService;
+ }
private TrackedEntityAttribute groupByAttribute;
@@ -2083,6 +2106,78 @@
}
@Override
+ public Interpretation getInterpretation( String uId )
+ throws NotAllowedException
+ {
+ Chart chart = chartService.getChart( uId );
+ org.hisp.dhis.interpretation.Interpretation interpretationCore = interpretationService
+ .getInterpretationByChartId( chart.getId() );
+
+ Collection<InterpretationComment> interComments = new HashSet<InterpretationComment>();
+
+ for ( org.hisp.dhis.interpretation.InterpretationComment interCommentsCore : interpretationCore.getComments() )
+ {
+
+ InterpretationComment interComment = new InterpretationComment();
+ interComment.setText( interCommentsCore.getText() );
+ interComments.add( interComment );
+ }
+
+ Interpretation interpretation = new Interpretation();
+ interpretation.setId( interpretationCore.getId() );
+ interpretation.setText( interpretationCore.getText() );
+ interpretation.setInComments( interComments );
+
+ return interpretation;
+ }
+
+ private org.hisp.dhis.interpretation.Interpretation interpretation;
+
+ public void setInterpretation( org.hisp.dhis.interpretation.Interpretation interpretation )
+ {
+ this.interpretation = interpretation;
+ }
+
+ public org.hisp.dhis.interpretation.Interpretation getInterpretation()
+ {
+ return interpretation;
+ }
+
+ @Override
+ public String postInterpretation( String data )
+ throws NotAllowedException
+ {
+
+ String uId = data.substring( 0, 11 );
+
+ String interpretation = data.substring( 11, data.length() - 0 );
+
+ Chart c = chartService.getChart( uId );
+
+ org.hisp.dhis.interpretation.Interpretation i = new org.hisp.dhis.interpretation.Interpretation( c, null,
+ interpretation );
+
+ i.setUser( currentUserService.getCurrentUser() );
+
+ interpretationService.saveInterpretation( i );
+
+ return INTERPRETATION_SENT;
+ }
+
+ @Override
+ public String postInterpretationComment( String data )
+ throws NotAllowedException
+ {
+ int interpretationId = Integer.parseInt( data.substring( 0, 7 ) );
+ String comment = data.substring( 7, data.length() - 0 );
+
+ setInterpretation( interpretationService.getInterpretation( interpretationId ) );
+ interpretationService.addInterpretationComment( interpretation.getUid(), comment );
+
+ return COMMENT_SENT;
+ }
+
+ @Override
public String completeProgramInstance( int programId )
throws NotAllowedException
{
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml 2014-06-24 04:33:13 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml 2014-06-28 17:56:14 +0000
@@ -46,9 +46,12 @@
<property name="messageService" ref="org.hisp.dhis.message.MessageService" />
<property name="smsSender" ref="org.hisp.dhis.sms.SmsSender" />
<property name="userService" ref="org.hisp.dhis.user.UserService" />
+ <property name="interpretationService" ref="org.hisp.dhis.interpretation.InterpretationService" />
+ <property name="chartService" ref="org.hisp.dhis.chart.ChartService" />
<property name="trackedEntityService" ref="org.hisp.dhis.trackedentity.TrackedEntityService" />
<property name="i18nManager" ref="org.hisp.dhis.i18n.I18nManager" />
<property name="reminderService" ref="org.hisp.dhis.trackedentity.TrackedEntityInstanceReminderService" />
+
</bean>
<bean id="org.hisp.dhis.mobile.api.IProgramService" class="org.hisp.dhis.mobile.service.DefaultProgramService">
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/api/model/OrgUnitTest.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/api/model/OrgUnitTest.java 2014-06-24 04:33:13 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/api/model/OrgUnitTest.java 2014-06-28 17:56:14 +0000
@@ -65,6 +65,9 @@
unit.setDownloadMessageConversationUrl( "downloadMessageConversationUrl" );
unit.setGetMessageUrl( "getMessageUrl" );
unit.setReplyMessageUrl( "replyMessageUrl" );
+ unit.setDownloadInterpretationUrl( "downloadInterpretationUrl" );
+ unit.setPostInterpretationUrl( "postInterpretationUrl" );
+ unit.setPostCommentUrl( "postCommentUrl" );
unit.setUpdateContactUrl( "updateContactUrl" );
unit.setFindPatientUrl( "findPatientUrl" );
unit.setUploadProgramStageUrl( "uploadProgramStageUrl" );
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/api/model/OrgUnitsTest.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/api/model/OrgUnitsTest.java 2014-06-24 04:33:13 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/api/model/OrgUnitsTest.java 2014-06-28 17:56:14 +0000
@@ -91,6 +91,9 @@
orgUnit.setDownloadMessageConversationUrl( "downloadMessageConversation" );
orgUnit.setGetMessageUrl( "getMessage" );
orgUnit.setReplyMessageUrl( "replyMessage" );
+ orgUnit.setDownloadInterpretationUrl( "downloadInterpretation" );
+ orgUnit.setPostInterpretationUrl( "postInterpretation" );
+ orgUnit.setPostCommentUrl( "postComment" );
orgUnit.setUpdateContactUrl( "updateContactForMobile" );
orgUnit.setFindPatientUrl( "findPatient" );
orgUnit.setRegisterPersonUrl( "registerPerson" );
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/interpretation/hibernate/HibernateInterpretationStore.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/interpretation/hibernate/HibernateInterpretationStore.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/interpretation/hibernate/HibernateInterpretationStore.java 2014-06-28 17:56:14 +0000
@@ -97,4 +97,14 @@
return ((Long) query.uniqueResult()).intValue();
}
+
+ @Override
+ public Interpretation getByChartId( int id )
+ {
+ String hql = "from Interpretation i where i.chart.id = " + id;
+
+ Query query = sessionFactory.getCurrentSession().createQuery( hql );
+
+ return (Interpretation) query.uniqueResult();
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/interpretation/impl/DefaultInterpretationService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/interpretation/impl/DefaultInterpretationService.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/interpretation/impl/DefaultInterpretationService.java 2014-06-28 17:56:14 +0000
@@ -213,4 +213,9 @@
{
return interpretationStore.countReportTableInterpretations( reportTable );
}
+
+ public Interpretation getInterpretationByChartId( int id )
+ {
+ return interpretationStore.getByChartId( id );
+ }
}
=== modified file 'dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileClientController.java'
--- dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileClientController.java 2014-06-24 04:33:13 +0000
+++ dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileClientController.java 2014-06-28 17:56:14 +0000
@@ -153,6 +153,9 @@
orgUnit.setDownloadMessageConversationUrl( getUrl( request, unit.getId(), "downloadMessageConversation" ) );
orgUnit.setGetMessageUrl( getUrl( request, unit.getId(), "getMessage" ) );
orgUnit.setReplyMessageUrl( getUrl( request, unit.getId(), "replyMessage" ) );
+ orgUnit.setDownloadInterpretationUrl(getUrl(request, unit.getId(), "downloadInterpretation" ));
+ orgUnit.setPostInterpretationUrl( getUrl( request, unit.getId(), "postInterpretation" ) );
+ orgUnit.setPostCommentUrl( getUrl( request, unit.getId(), "postComment" ) );
orgUnit.setUpdateContactUrl( getUrl( request, unit.getId(), "updateContactForMobile" ) );
orgUnit.setFindPatientUrl( getUrl( request, unit.getId(), "findPatient" ) );
orgUnit.setRegisterPersonUrl( getUrl( request, unit.getId(), "registerPerson" ) );
=== 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 2014-06-24 04:33:13 +0000
+++ dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileOrganisationUnitController.java 2014-06-28 17:56:14 +0000
@@ -45,6 +45,8 @@
import org.hisp.dhis.api.mobile.model.DataSetValue;
import org.hisp.dhis.api.mobile.model.DataSetValueList;
import org.hisp.dhis.api.mobile.model.DataStreamSerializable;
+import org.hisp.dhis.api.mobile.model.Interpretation;
+import org.hisp.dhis.api.mobile.model.InterpretationComment;
import org.hisp.dhis.api.mobile.model.Message;
import org.hisp.dhis.api.mobile.model.MobileModel;
import org.hisp.dhis.api.mobile.model.ModelList;
@@ -723,4 +725,39 @@
}
+ @RequestMapping( method = RequestMethod.GET, value = "{clientVersion}/orgUnits/{id}/downloadInterpretation" )
+ @ResponseBody
+ public Interpretation downloadInterpretation( String clientVersion, @PathVariable
+ int id, @RequestHeader( "uId" )
+ String uId )
+ throws NotAllowedException
+ {
+ Interpretation interpretation = activityReportingService.getInterpretation( uId );
+ return interpretation;
+ }
+
+ @RequestMapping( method = RequestMethod.GET, value = "{clientVersion}/orgUnits/{id}/postInterpretation" )
+ @ResponseBody
+ public Interpretation postInterpretation( String clientVersion, @PathVariable
+ int id, @RequestHeader( "data" )
+ String data )
+ throws NotAllowedException
+ {
+ Interpretation interpretation = new Interpretation();
+ interpretation.setText( activityReportingService.postInterpretation( data ) );
+ return interpretation;
+ }
+
+ @RequestMapping( method = RequestMethod.GET, value = "{clientVersion}/orgUnits/{id}/postComment" )
+ @ResponseBody
+ public InterpretationComment postInterpretationComment( String clientVersion, @PathVariable
+ int id, @RequestHeader( "data" )
+ String data )
+ throws NotAllowedException
+ {
+ InterpretationComment message = new InterpretationComment();
+ message.setText( activityReportingService.postInterpretationComment( data ) );
+ return message;
+ }
+
}