← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3979: [DHISMobile] Support new workflow of "Find Beneficiary"

 

------------------------------------------------------------
revno: 3979
committer: Long <thanhlongngo1988>
branch nick: dhis2
timestamp: Wed 2011-06-22 14:50:35 +0700
message:
  [DHISMobile] Support new workflow of "Find Beneficiary"
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ActivityReportingServiceImpl.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/NotAllowedException.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-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ActivityReportingServiceImpl.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ActivityReportingServiceImpl.java	2011-05-26 04:03:58 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ActivityReportingServiceImpl.java	2011-06-22 07:50:35 +0000
@@ -155,13 +155,16 @@
         Collection<Patient> patients = patientIdentifierService.getPatientsByIdentifier( keyword, 0,
             patientIdentifierService.countGetPatientsByIdentifier( keyword ) );
 
-        // Prevent the case that there are so many result (will hang the mobile
-        // phone ) because user just enter one or two number
+        // Make sure user input full beneficiary identifier number
 
-        if ( patients.size() > 10 )
+        if ( patients.size() > 1 )
         {
             throw NotAllowedException.NEED_MORE_SPECIFIC;
         }
+        else if ( patients.size() == 0 )
+        {
+            throw NotAllowedException.NO_BENEFICIARY_FOUND;
+        }
         else
         {
             if ( patients != null )
@@ -191,7 +194,6 @@
                     }
                 }
             }
-
             return new ActivityPlan( items );
         }
 

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/NotAllowedException.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/NotAllowedException.java	2011-05-26 04:03:58 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/NotAllowedException.java	2011-06-22 07:50:35 +0000
@@ -45,7 +45,9 @@
 
     public static final NotAllowedException NO_USER = new NotAllowedException( "NO_USER", "No user is logged in." );
     
-    public static final NotAllowedException NEED_MORE_SPECIFIC = new NotAllowedException( "NEED_MORE_SPECIFIC", "So many result. Please be more specific" );
+    public static final NotAllowedException NEED_MORE_SPECIFIC = new NotAllowedException( "NEED_MORE_SPECIFIC");
+    
+    public static final NotAllowedException NO_BENEFICIARY_FOUND = new NotAllowedException( "NO_BENEFICIARY_FOUND");
     
     private String reason;