← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12312: minor fix in hibernatePatientStore

 

------------------------------------------------------------
revno: 12312
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-09-30 11:22:35 +0200
message:
  minor fix in hibernatePatientStore
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.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-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java	2013-09-27 13:56:18 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java	2013-09-30 09:22:35 +0000
@@ -98,7 +98,7 @@
     // Implementation methods
     // -------------------------------------------------------------------------
 
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings( "unchecked" )
     @Override
     public Collection<Patient> getByGender( String gender )
     {
@@ -106,7 +106,7 @@
     }
 
     @Override
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings( "unchecked" )
     public Collection<Patient> getByBirthDate( Date birthDate )
     {
         return getCriteria( Restrictions.eq( "birthDate", birthDate ) ).list();
@@ -115,11 +115,16 @@
     @Override
     public Collection<Patient> getByNames( String fullName, Integer min, Integer max )
     {
+        if ( min == null || max == null )
+        {
+            return getAllLikeNameOrderedName( fullName, 0, Integer.MAX_VALUE );
+        }
+
         return getAllLikeNameOrderedName( fullName, min, max );
     }
 
     @Override
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings( "unchecked" )
     public Collection<Patient> get( String name, Date birthdate, String gender )
 
     {
@@ -152,7 +157,7 @@
     }
 
     @Override
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings( "unchecked" )
     public Collection<Patient> getByOrgUnitAndNameLike( OrganisationUnit organisationUnit, String nameLike, Integer min, Integer max )
     {
         String hql = "select p from Patient p where p.organisationUnit = :organisationUnit "
@@ -171,7 +176,7 @@
     }
 
     @Override
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings( "unchecked" )
     public Collection<Patient> getByOrgUnitAndGender( OrganisationUnit organisationUnit, String gender, Integer min,
         Integer max )
     {
@@ -344,7 +349,7 @@
     }
 
     @Override
-    @SuppressWarnings("deprecation")
+    @SuppressWarnings( "deprecation" )
     public int countGetPatientsByOrgUnitProgram( OrganisationUnit organisationUnit, Program program )
     {
         String sql = "select count(p.patientid) from patient p join programinstance pi on p.patientid=pi.patientid "
@@ -355,7 +360,7 @@
     }
 
     @Override
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings( "unchecked" )
     public Collection<Patient> getRepresentatives( Patient patient )
     {
         String hql = "select distinct p from Patient p where p.representative = :representative order by p.id DESC";
@@ -824,7 +829,7 @@
     }
 
     @Override
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings( "unchecked" )
     public Collection<Patient> getByPhoneNumber( String phoneNumber, Integer min, Integer max )
     {
         String hql = "select p from Patient p where p.phoneNumber like '%" + phoneNumber + "%'";
@@ -870,7 +875,7 @@
         return patients;
     }
 
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings( "unchecked" )
     public Collection<Integer> getRegistrationOrgunitIds( Date startDate, Date endDate )
     {
         Criteria criteria = getCriteria();