dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #30251
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15349: [mobile] reply message
------------------------------------------------------------
revno: 15349
committer: Hong Em <em.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-05-22 15:23:41 +0700
message:
[mobile] reply message
modified:
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/Message.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/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-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-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-05-21 19:12:39 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/ActivityReportingService.java 2014-05-22 08:23:41 +0000
@@ -64,7 +64,8 @@
String saveProgramStage( ProgramStage programStage, int patientId, int orgUnitId )
throws NotAllowedException;
- Patient enrollProgram( String enrollInfo, List<org.hisp.dhis.api.mobile.model.LWUITmodel.ProgramStage> mobileProgramStageList, Date incidentDate )
+ Patient enrollProgram( String enrollInfo,
+ List<org.hisp.dhis.api.mobile.model.LWUITmodel.ProgramStage> mobileProgramStageList, Date incidentDate )
throws NotAllowedException;
Collection<org.hisp.dhis.trackedentity.TrackedEntityAttribute> getPatientAtts( String programId );
@@ -114,4 +115,8 @@
Collection<Message> getMessage( String conversationId )
throws NotAllowedException;
+
+ String replyMessage( Message message )
+ throws NotAllowedException;
+
}
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Message.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Message.java 2014-05-21 13:44:34 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Message.java 2014-05-22 08:23:41 +0000
@@ -122,8 +122,10 @@
public void deSerialize( DataInputStream din )
throws IOException
{
+
subject = din.readUTF();
text = din.readUTF();
+
if ( lastSenderName != null )
{
lastSenderName = din.readUTF();
=== 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-05-21 13:44:34 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileOrgUnitLinks.java 2014-05-22 08:23:41 +0000
@@ -75,6 +75,8 @@
private String getMessageUrl;
+ private String replyMessageUrl;
+
private String updateContactUrl;
private String findPatientUrl;
@@ -277,6 +279,16 @@
this.getMessageUrl = getMessageUrl;
}
+ public String getReplyMessageUrl()
+ {
+ return replyMessageUrl;
+ }
+
+ public void setReplyMessageUrl( String replyMessageUrl )
+ {
+ this.replyMessageUrl = replyMessageUrl;
+ }
+
public String getUpdateContactUrl()
{
return updateContactUrl;
@@ -376,12 +388,12 @@
{
this.findPatientInAdvancedUrl = findPatientInAdvancedUrl;
}
-
+
public String getFindVisitScheduleUrl()
{
return findVisitScheduleUrl;
}
-
+
public void setFindVisitScheduleUrl( String findVisitScheduleUrl )
{
this.findVisitScheduleUrl = findVisitScheduleUrl;
@@ -446,6 +458,7 @@
dataOutputStream.writeUTF( sendMessageUrl );
dataOutputStream.writeUTF( downloadMessageConversationUrl );
dataOutputStream.writeUTF( getMessageUrl );
+ dataOutputStream.writeUTF( replyMessageUrl );
dataOutputStream.writeUTF( updateContactUrl );
dataOutputStream.writeUTF( findPatientUrl );
dataOutputStream.writeUTF( registerPersonUrl );
@@ -483,6 +496,7 @@
sendMessageUrl = dataInputStream.readUTF();
downloadMessageConversationUrl = dataInputStream.readUTF();
getMessageUrl = dataInputStream.readUTF();
+ replyMessageUrl = dataInputStream.readUTF();
updateContactUrl = dataInputStream.readUTF();
findPatientUrl = dataInputStream.readUTF();
registerPersonUrl = dataInputStream.readUTF();
@@ -537,6 +551,7 @@
dataOutputStream.writeUTF( this.sendMessageUrl );
dataOutputStream.writeUTF( this.downloadMessageConversationUrl );
dataOutputStream.writeUTF( this.getMessageUrl );
+ dataOutputStream.writeUTF( this.replyMessageUrl );
// dataOutputStream.writeUTF( this.updateContactUrl );
}
@@ -560,6 +575,7 @@
dataOutputStream.writeUTF( sendMessageUrl );
dataOutputStream.writeUTF( downloadMessageConversationUrl );
dataOutputStream.writeUTF( getMessageUrl );
+ dataOutputStream.writeUTF( replyMessageUrl );
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-05-21 13:44:34 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java 2014-05-22 08:23:41 +0000
@@ -1909,14 +1909,16 @@
String eventsInfo = "";
for ( List<Object> row : listOfListProgramStageInstance )
{
- TrackedEntityInstance instance = entityInstanceService.getTrackedEntityInstance( (String)row.get(0) );
- Collection<TrackedEntityAttribute> displayAttributes = attributeService.getTrackedEntityAttributesDisplayInList();
-
+ TrackedEntityInstance instance = entityInstanceService.getTrackedEntityInstance( (String) row.get( 0 ) );
+ Collection<TrackedEntityAttribute> displayAttributes = attributeService
+ .getTrackedEntityAttributesDisplayInList();
+
eventsInfo += instance.getId() + "/";
String displayName = "";
for ( TrackedEntityAttribute displayAttribute : displayAttributes )
{
- TrackedEntityAttributeValue value = attValueService.getTrackedEntityAttributeValue( instance, displayAttribute );
+ TrackedEntityAttributeValue value = attValueService.getTrackedEntityAttributeValue( instance,
+ displayAttribute );
if ( value != null )
{
displayName += value.getValue() + " ";
@@ -1944,7 +1946,7 @@
{
calendar.add( Calendar.DATE, operation * 7 );
}
- else if ( adjustment.equals( "1 month" ))
+ else if ( adjustment.equals( "1 month" ) )
{
calendar.add( Calendar.DATE, operation * 30 );
}
@@ -2024,4 +2026,18 @@
return messages;
}
+
+ @Override
+ public String replyMessage( org.hisp.dhis.api.mobile.model.Message message )
+ throws NotAllowedException
+ {
+ String metaData = MessageService.META_USER_AGENT;
+
+ MessageConversation conversation = messageService.getMessageConversation( Integer.parseInt( message
+ .getSubject() ) );
+
+ messageService.sendReply( conversation, message.getText(), metaData );
+
+ return MESSAGE_SENT;
+ }
}
\ No newline at end of file
=== 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-05-21 13:44:34 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/api/model/OrgUnitTest.java 2014-05-22 08:23:41 +0000
@@ -64,6 +64,7 @@
unit.setSendMessageUrl( "sendMessageUrl" );
unit.setDownloadMessageConversationUrl( "downloadMessageConversationUrl" );
unit.setGetMessageUrl( "getMessageUrl" );
+ unit.setReplyMessageUrl( "replyMessageUrl" );
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-05-21 13:44:34 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/api/model/OrgUnitsTest.java 2014-05-22 08:23:41 +0000
@@ -90,6 +90,7 @@
orgUnit.setSendMessageUrl( "sendMessage" );
orgUnit.setDownloadMessageConversationUrl( "downloadMessageConversation" );
orgUnit.setGetMessageUrl( "getMessage" );
+ orgUnit.setReplyMessageUrl( "replyMessage" );
orgUnit.setUpdateContactUrl( "updateContactForMobile" );
orgUnit.setFindPatientUrl( "findPatient" );
orgUnit.setRegisterPersonUrl( "registerPerson" );
=== 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-05-21 13:44:34 +0000
+++ dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileClientController.java 2014-05-22 08:23:41 +0000
@@ -152,6 +152,7 @@
orgUnit.setSendMessageUrl( getUrl( request, unit.getId(), "sendMessage" ) );
orgUnit.setDownloadMessageConversationUrl( getUrl( request, unit.getId(), "downloadMessageConversation" ) );
orgUnit.setGetMessageUrl( getUrl( request, unit.getId(), "getMessage" ) );
+ orgUnit.setReplyMessageUrl( getUrl( request, unit.getId(), "replyMessage" ) );
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-05-21 13:44:34 +0000
+++ dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileOrganisationUnitController.java 2014-05-22 08:23:41 +0000
@@ -617,4 +617,15 @@
}
+ @RequestMapping( method = RequestMethod.POST, value = "{clientVersion}/orgUnits/{id}/replyMessage" )
+ @ResponseBody
+ public String replyMessage( @PathVariable
+ int id, @RequestBody
+ Message message )
+ throws NotAllowedException
+ {
+ return activityReportingService.replyMessage( message );
+
+ }
+
}