dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #25341
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12547: minor
------------------------------------------------------------
revno: 12547
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-10-10 15:12:16 +0700
message:
minor
modified:
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/LostEvent.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.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/LWUITmodel/LostEvent.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/LostEvent.java 2013-10-09 03:02:54 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/LostEvent.java 2013-10-10 08:12:16 +0000
@@ -69,8 +69,23 @@
dueDate = dint.readUTF();
status = dint.readInt();
isRiskCase = dint.readBoolean();
- comment = dint.readUTF();
- SMS = dint.readUTF();
+ if ( dint.readBoolean() == true )
+ {
+ comment = dint.readUTF();
+ }
+ else
+ {
+ comment = null;
+ }
+
+ if ( dint.readBoolean() == true )
+ {
+ SMS = dint.readUTF();
+ }
+ else
+ {
+ SMS = null;
+ }
}
@Override
=== 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 2013-10-10 05:42:48 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java 2013-10-10 08:12:16 +0000
@@ -2060,46 +2060,57 @@
}
}
+ @SuppressWarnings( "finally" )
@Override
public Notification handleLostToFollowUp( LostEvent lostEvent )
throws NotAllowedException
{
- ProgramStageInstance programStageInstance = programStageInstanceService.getProgramStageInstance( lostEvent.getId() );
- programStageInstance.setDueDate( PeriodUtil.stringToDate( lostEvent.getDueDate() ) );
- programStageInstance.setStatus( lostEvent.getStatus() );
-
- List<MessageConversation> conversationList = new ArrayList<MessageConversation>();
-
- MessageConversation conversation = new MessageConversation( lostEvent.getName(), currentUserService.getCurrentUser() );
-
- conversation.addMessage( new Message( lostEvent.getComment(), null, currentUserService.getCurrentUser() ) );
-
- conversation.setRead( true );
-
- conversationList.add( conversation );
-
- programStageInstance.setMessageConversations( conversationList );
-
- messageService.saveMessageConversation( conversation );
-
- programStageInstanceService.updateProgramStageInstance( programStageInstance );
-
Notification notification = new Notification();
-
- String message = "";
-
- //send SMS
- if ( programStageInstance.getProgramInstance().getPatient().getPhoneNumber() != null && lostEvent.getSMS() != null )
- {
- User user = new User();
- user.setPhoneNumber( programStageInstance.getProgramInstance().getPatient().getPhoneNumber() );
- List<User> recipientsList = new ArrayList<User>();
- recipientsList.add( user );
-
- message = smsSender.sendMessage( lostEvent.getName(), lostEvent.getSMS(), currentUserService.getCurrentUser(), recipientsList, false );
- }
- notification.setMessage( message );
-
- return notification;
+ try
+ {
+ ProgramStageInstance programStageInstance = programStageInstanceService.getProgramStageInstance( lostEvent.getId() );
+ programStageInstance.setDueDate( PeriodUtil.stringToDate( lostEvent.getDueDate() ) );
+ programStageInstance.setStatus( lostEvent.getStatus() );
+
+ if ( lostEvent.getComment() != null )
+ {
+ List<MessageConversation> conversationList = new ArrayList<MessageConversation>();
+
+ MessageConversation conversation = new MessageConversation( lostEvent.getName(), currentUserService.getCurrentUser() );
+
+ conversation.addMessage( new Message( lostEvent.getComment(), null, currentUserService.getCurrentUser() ) );
+
+ conversation.setRead( true );
+
+ conversationList.add( conversation );
+
+ programStageInstance.setMessageConversations( conversationList );
+
+ messageService.saveMessageConversation( conversation );
+ }
+
+ programStageInstanceService.updateProgramStageInstance( programStageInstance );
+
+ //send SMS
+ if ( programStageInstance.getProgramInstance().getPatient().getPhoneNumber() != null && lostEvent.getSMS() != null )
+ {
+ User user = new User();
+ user.setPhoneNumber( programStageInstance.getProgramInstance().getPatient().getPhoneNumber() );
+ List<User> recipientsList = new ArrayList<User>();
+ recipientsList.add( user );
+
+ smsSender.sendMessage( lostEvent.getName(), lostEvent.getSMS(), currentUserService.getCurrentUser(), recipientsList, false );
+ }
+
+ notification.setMessage( "Success" );
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ notification.setMessage( "Fail" );
+ }
+ finally
+ {
+ return notification;
+ }
}
}