dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #25439
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12627: PatientStore, removed unused methods
------------------------------------------------------------
revno: 12627
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-10-14 12:24:31 +0200
message:
PatientStore, removed unused methods
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-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-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-14 10:07:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java 2013-10-14 10:24:31 +0000
@@ -60,25 +60,9 @@
Collection<Patient> getAllPatients();
- /**
- * Search Patient base on name/birthDate/gender
- *
- * @param name
- * @param birthdate
- * @param gender
- * @return Patient List
- */
Collection<Patient> getPatients( String name, Date birthdate, String gender );
/**
- * Search Patient base on gender
- *
- * @param gender
- * @return Patient List
- */
- Collection<Patient> getPatiensByGender( String gender );
-
- /**
* Search Patient base on birthDate
*
* @param birthDate
@@ -143,22 +127,6 @@
Collection<Patient> getPatients( OrganisationUnit organisationUnit, Program program );
/**
- * Search Patient base on organization unit with result limited
- *
- * @param organisationUnit organisationUnit
- * @return Patient List
- */
- Collection<Patient> getPatients( OrganisationUnit organisationUnit, String gender, Integer min, Integer max );
-
- /**
- * Search Patient base on organization unit with result limited
- *
- * @param organisationUnit organisationUnit
- * @return Patient List
- */
- Collection<Patient> getPatients( OrganisationUnit organisationUnit, String gender );
-
- /**
* Search Patient base on organization unit and sort the result by
* PatientAttribute
*
=== 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-14 10:07:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java 2013-10-14 10:24:31 +0000
@@ -46,8 +46,6 @@
{
String ID = PatientStore.class.getName();
- Collection<Patient> getByGender( String gender );
-
Collection<Patient> getByBirthDate( Date birthDate );
Collection<Patient> getByNames( String name, Integer min, Integer max );
@@ -58,8 +56,6 @@
Collection<Patient> getByOrgUnitAndNameLike( OrganisationUnit organisationUnit, String nameLike, Integer min, Integer max );
- Collection<Patient> getByOrgUnitAndGender( OrganisationUnit organisationUnit, String gender, Integer min, Integer max );
-
Collection<Patient> getByOrgUnitProgram( OrganisationUnit organisationUnit, Program program, Integer min,
Integer max );
=== 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 10:07:20 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/AbstractPersonService.java 2013-10-14 10:24:31 +0000
@@ -160,13 +160,6 @@
}
@Override
- public Persons getPersons( Gender gender )
- {
- List<Patient> patients = new ArrayList<Patient>( patientService.getPatiensByGender( gender.getValue() ) );
- return getPersons( patients );
- }
-
- @Override
public Persons getPersons( Program program )
{
List<Patient> patients = new ArrayList<Patient>( patientService.getPatients( program ) );
@@ -181,13 +174,6 @@
}
@Override
- public Persons getPersons( OrganisationUnit organisationUnit, Gender gender )
- {
- List<Patient> patients = new ArrayList<Patient>( patientService.getPatients( organisationUnit, 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-10-14 10:07:20 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/PersonService.java 2013-10-14 10:24:31 +0000
@@ -58,14 +58,10 @@
Persons getPersons( OrganisationUnit organisationUnit, String nameLike );
- Persons getPersons( Gender gender );
-
Persons getPersons( Program program );
Persons getPersons( OrganisationUnit organisationUnit, Program program );
- Persons getPersons( OrganisationUnit organisationUnit, 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-10-14 09:59:01 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/PersonServiceTest.java 2013-10-14 10:24:31 +0000
@@ -119,13 +119,6 @@
}
@Test
- public void testGetPersonByGender()
- {
- assertEquals( 2, personService.getPersons( Gender.MALE ).getPersons().size() );
- assertEquals( 2, personService.getPersons( Gender.FEMALE ).getPersons().size() );
- }
-
- @Test
public void testGetPersonByOrganisationUnit()
{
assertEquals( 2, personService.getPersons( organisationUnitA ).getPersons().size() );
@@ -133,17 +126,6 @@
}
@Test
- public void testGetPersonByOrganisationUnitAndGender()
- {
- assertEquals( 0, personService.getPersons( organisationUnitA, Gender.TRANSGENDER ).getPersons().size() );
- assertEquals( 1, personService.getPersons( organisationUnitA, Gender.MALE ).getPersons().size() );
- assertEquals( 1, personService.getPersons( organisationUnitA, Gender.FEMALE ).getPersons().size() );
- assertEquals( 0, personService.getPersons( organisationUnitB, Gender.TRANSGENDER ).getPersons().size() );
- assertEquals( 1, personService.getPersons( organisationUnitB, Gender.MALE ).getPersons().size() );
- assertEquals( 1, personService.getPersons( organisationUnitB, Gender.FEMALE ).getPersons().size() );
- }
-
- @Test
public void getPersonByPatients()
{
List<Patient> patients = Arrays.asList( maleA, femaleB );
=== 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 10:07:20 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java 2013-10-14 10:24:31 +0000
@@ -204,12 +204,6 @@
}
@Override
- public Collection<Patient> getPatiensByGender( String gender )
- {
- return patientStore.getByGender( gender );
- }
-
- @Override
public Collection<Patient> getPatientsByBirthDate( Date birthDate )
{
return patientStore.getByBirthDate( birthDate );
@@ -309,18 +303,6 @@
}
@Override
- public Collection<Patient> getPatients( OrganisationUnit organisationUnit, String gender, Integer min, Integer max )
- {
- return patientStore.getByOrgUnitAndGender( organisationUnit, gender, min, max );
- }
-
- @Override
- public Collection<Patient> getPatients( OrganisationUnit organisationUnit, String gender )
- {
- return patientStore.getByOrgUnitAndGender( organisationUnit, gender, 0, Integer.MAX_VALUE );
- }
-
- @Override
public Collection<Patient> getPatients( OrganisationUnit organisationUnit, PatientAttribute patientAttribute,
Integer min, Integer max )
{
=== 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 10:07:20 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java 2013-10-14 10:24:31 +0000
@@ -104,13 +104,6 @@
// Implementation methods
// -------------------------------------------------------------------------
- @SuppressWarnings( "unchecked" )
- @Override
- public Collection<Patient> getByGender( String gender )
- {
- return getCriteria( Restrictions.eq( "gender", gender ) ).list();
- }
-
@Override
@SuppressWarnings( "unchecked" )
public Collection<Patient> getByBirthDate( Date birthDate )
@@ -183,25 +176,6 @@
}
@Override
- @SuppressWarnings( "unchecked" )
- public Collection<Patient> getByOrgUnitAndGender( OrganisationUnit organisationUnit, String gender, Integer min,
- Integer max )
- {
- String hql = "select p from Patient p where p.organisationUnit = :organisationUnit and p.gender = :gender order by p.id DESC";
-
- Query query = getQuery( hql );
- query.setEntity( "organisationUnit", organisationUnit );
- query.setString( "gender", gender );
-
- if ( min != null && max != null )
- {
- query.setFirstResult( min ).setMaxResults( max );
- }
-
- return query.list();
- }
-
- @Override
//TODO this method must be changed - cannot retrieve one by one
public Collection<Patient> getByOrgUnitProgram( OrganisationUnit organisationUnit, Program program, Integer min,
Integer max )
=== 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-14 09:59:01 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonController.java 2013-10-14 10:24:31 +0000
@@ -28,11 +28,16 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.io.IOException;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
import org.hisp.dhis.api.controller.WebOptions;
import org.hisp.dhis.api.controller.exception.NotFoundException;
import org.hisp.dhis.api.utils.ContextUtils;
import org.hisp.dhis.common.IdentifiableObjectManager;
-import org.hisp.dhis.dxf2.events.person.Gender;
import org.hisp.dhis.dxf2.events.person.Identifier;
import org.hisp.dhis.dxf2.events.person.Person;
import org.hisp.dhis.dxf2.events.person.PersonService;
@@ -56,11 +61,6 @@
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.client.HttpClientErrorException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.Map;
-
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
@@ -85,7 +85,6 @@
@PreAuthorize("hasRole('ALL') or hasRole('F_ACCESS_PATIENT_ATTRIBUTES')")
public String getPersons(
@RequestParam( value = "orgUnit", required = false ) String orgUnitUid,
- @RequestParam( required = false ) Gender gender,
@RequestParam( value = "program", required = false ) String programUid,
@RequestParam( required = false ) String identifierType,
@RequestParam( required = false ) String identifier,
@@ -107,11 +106,6 @@
OrganisationUnit organisationUnit = getOrganisationUnit( orgUnitUid );
persons = personService.getPersons( organisationUnit, nameLike );
}
- else if ( gender != null )
- {
- OrganisationUnit organisationUnit = getOrganisationUnit( orgUnitUid );
- persons = personService.getPersons( organisationUnit, gender );
- }
else if ( programUid != null )
{
OrganisationUnit organisationUnit = getOrganisationUnit( orgUnitUid );