← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12625: Removed unused method from PatientStore

 

------------------------------------------------------------
revno: 12625
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-10-14 11:59:01 +0200
message:
  Removed unused method from PatientStore
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/DefaultSmsSender.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/AbstractPersonService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/PersonService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/PersonServiceTest.java
  dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationMultiEventsServiceTest.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonController.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/patient/PatientService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java	2013-10-08 17:16:47 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java	2013-10-14 09:59:01 +0000
@@ -146,15 +146,6 @@
      *
      * @param organisationUnit
      * @param program
-     * @param gender
-     * @return
-     */
-    Collection<Patient> getPatients( OrganisationUnit organisationUnit, Program program, String gender );
-
-    /**
-     *
-     * @param organisationUnit
-     * @param program
      * @return
      */
     Collection<Patient> getPatients( OrganisationUnit organisationUnit, Program program );

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java	2013-10-08 17:16:47 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java	2013-10-14 09:59:01 +0000
@@ -93,8 +93,6 @@
         Collection<PatientAttribute> patientAttributes, Collection<PatientIdentifierType> identifierTypes, Integer statusEnrollment, Integer min,
         Integer max );
 
-    Collection<Patient> getByOrgUnitProgramGender( OrganisationUnit organisationUnit, Program program, String gender, Integer min, Integer max );
-
     Collection<Patient> getByProgram( Program program, Integer min, Integer max );
 
     Collection<Patient> getByProgram( Program program, String gender, Integer min, Integer max );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/DefaultSmsSender.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/DefaultSmsSender.java	2013-10-08 07:11:22 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/DefaultSmsSender.java	2013-10-14 09:59:01 +0000
@@ -33,6 +33,7 @@
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.sms.outbound.DefaultOutboundSmsTransportService;
@@ -41,8 +42,6 @@
 import org.hisp.dhis.user.CurrentUserService;
 import org.hisp.dhis.user.User;
 import org.hisp.dhis.user.UserService;
-import org.hisp.dhis.user.UserSetting;
-import org.hisp.dhis.user.UserSettingService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -155,13 +154,11 @@
                     {
                         if ( !currentUserService.getCurrentUser().equals( user ) )
                         {
-                            //if ( isQualifiedReceiver( user ) )
                             toSendList.add( user );
                         }
                     }
                     else if ( currentUserService.getCurrentUser() == null )
                     {
-                        //if ( isQualifiedReceiver( user ) )
                         toSendList.add( user );
                     }
                 }
@@ -231,38 +228,6 @@
     // Supportive methods
     // -------------------------------------------------------------------------
 
-    private boolean isQualifiedReceiver( User user )
-    {
-        if ( user.getFirstName() == null ) // If receiver is raw number
-        {
-            return true;
-        }
-        else
-        // If receiver is user
-        {
-            UserSetting userSetting = userService
-                .getUserSetting( user, UserSettingService.KEY_MESSAGE_SMS_NOTIFICATION );
-
-            if ( userSetting != null )
-            {
-                boolean sendSMSNotification = (Boolean) userSetting.getValue();
-
-                if ( sendSMSNotification == true )
-                {
-                    return true;
-                }
-                else
-                {
-                    return false;
-                }
-            }
-            else
-            {
-                return false;
-            }
-        }
-    }
-
     private String createMessage( String subject, String text, User sender )
     {
         String name = "DHIS";

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/AbstractPersonService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/AbstractPersonService.java	2013-10-14 09:28:36 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/AbstractPersonService.java	2013-10-14 09:59:01 +0000
@@ -195,13 +195,6 @@
     }
 
     @Override
-    public Persons getPersons( OrganisationUnit organisationUnit, Program program, Gender gender )
-    {
-        List<Patient> patients = new ArrayList<Patient>( patientService.getPatients( organisationUnit, program, gender.getValue() ) );
-        return getPersons( patients );
-    }
-
-    @Override
     public Persons getPersons( Collection<Patient> patients )
     {
         Persons persons = new Persons();

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/PersonService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/PersonService.java	2013-09-27 13:56:18 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/PersonService.java	2013-10-14 09:59:01 +0000
@@ -68,8 +68,6 @@
 
     Persons getPersons( OrganisationUnit organisationUnit, Gender gender );
 
-    Persons getPersons( OrganisationUnit organisationUnit, Program program, Gender gender );
-
     Persons getPersons( Collection<Patient> patients );
 
     Person getPerson( String uid );

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/PersonServiceTest.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/PersonServiceTest.java	2013-09-20 15:12:37 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/PersonServiceTest.java	2013-10-14 09:59:01 +0000
@@ -144,15 +144,6 @@
     }
 
     @Test
-    public void testGetPersonByOrganisationUnitAndGenderAndProgram()
-    {
-        assertEquals( 1, personService.getPersons( organisationUnitA, programA, Gender.MALE ).getPersons().size() );
-        assertEquals( 1, personService.getPersons( organisationUnitA, programA, Gender.FEMALE ).getPersons().size() );
-        assertEquals( 0, personService.getPersons( organisationUnitB, programA, Gender.MALE ).getPersons().size() );
-        assertEquals( 0, personService.getPersons( organisationUnitB, programA, Gender.FEMALE ).getPersons().size() );
-    }
-
-    @Test
     public void getPersonByPatients()
     {
         List<Patient> patients = Arrays.asList( maleA, femaleB );

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationMultiEventsServiceTest.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationMultiEventsServiceTest.java	2013-09-30 12:11:16 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationMultiEventsServiceTest.java	2013-10-14 09:59:01 +0000
@@ -28,6 +28,15 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.Date;
+import java.util.HashSet;
+
 import org.hamcrest.CoreMatchers;
 import org.hisp.dhis.DhisTest;
 import org.hisp.dhis.common.IdentifiableObjectManager;
@@ -51,15 +60,6 @@
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import java.util.Date;
-import java.util.HashSet;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java	2013-10-14 09:28:36 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java	2013-10-14 09:59:01 +0000
@@ -309,12 +309,6 @@
     }
 
     @Override
-    public Collection<Patient> getPatients( OrganisationUnit organisationUnit, Program program, String gender )
-    {
-        return patientStore.getByOrgUnitProgramGender( organisationUnit, program, gender, 0, Integer.MAX_VALUE );
-    }
-
-    @Override
     public Collection<Patient> getPatients( OrganisationUnit organisationUnit, Program program )
     {
         return patientStore.getByOrgUnitProgram( organisationUnit, program, 0, Integer.MAX_VALUE );

=== 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-10-14 09:28:36 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java	2013-10-14 09:59:01 +0000
@@ -238,40 +238,6 @@
 
     @Override
     //TODO this method must be changed - cannot retrieve one by one
-    public Collection<Patient> getByOrgUnitProgramGender( OrganisationUnit organisationUnit, Program program,
-        String gender, Integer min, Integer max )
-    {
-        List<Patient> patients = new ArrayList<Patient>();
-
-        String sql = "select p.patientid from patient p join programinstance pi on p.patientid=pi.patientid "
-            + "where p.organisationunitid=" + organisationUnit.getId() + " and pi.programid=" + program.getId()
-            + " and pi.status=" + ProgramInstance.STATUS_ACTIVE + " and p.gender='" + gender + "'";
-
-        if ( min != null && max != null )
-        {
-            sql += statementBuilder.limitRecord( min, max );
-        }
-
-        try
-        {
-            patients = jdbcTemplate.query( sql, new RowMapper<Patient>()
-            {
-                public Patient mapRow( ResultSet rs, int rowNum )
-                    throws SQLException
-                {
-                    return get( rs.getInt( 1 ) );
-                }
-            } );
-        }
-        catch ( Exception ex )
-        {
-            ex.printStackTrace();
-        }
-
-        return patients;
-    }
-
-    @Override
     public Collection<Patient> getByProgram( Program program, Integer min, Integer max )
     {
         List<Patient> patients = new ArrayList<Patient>();

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonController.java	2013-10-01 12:13:34 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonController.java	2013-10-14 09:59:01 +0000
@@ -107,12 +107,6 @@
                 OrganisationUnit organisationUnit = getOrganisationUnit( orgUnitUid );
                 persons = personService.getPersons( organisationUnit, nameLike );
             }
-            else if ( programUid != null && gender != null )
-            {
-                OrganisationUnit organisationUnit = getOrganisationUnit( orgUnitUid );
-                Program program = getProgram( programUid );
-                persons = personService.getPersons( organisationUnit, program, gender );
-            }
             else if ( gender != null )
             {
                 OrganisationUnit organisationUnit = getOrganisationUnit( orgUnitUid );