dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #24673
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12136: Minor fixes
------------------------------------------------------------
revno: 12136
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-09-18 11:59:56 +0200
message:
Minor fixes
modified:
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/AbstractPersonService.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-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.java 2013-09-18 09:50:42 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.java 2013-09-18 09:59:56 +0000
@@ -76,7 +76,7 @@
@Override
public Enrollments getEnrollments( Person person )
{
- Patient patient = patientService.getPatient( person.getPerson() );
+ Patient patient = getPatient( person.getPerson() );
return getEnrollments( patient );
}
@@ -113,10 +113,22 @@
@Override
public Enrollments getEnrollments( Program program, Person person )
{
- Patient patient = patientService.getPatient( person.getPerson() );
+ Patient patient = getPatient( person.getPerson() );
return getEnrollments( programInstanceService.getProgramInstances( patient, program ) );
}
+ private Patient getPatient( String person )
+ {
+ Patient patient = patientService.getPatient( person );
+
+ if ( patient == null )
+ {
+ throw new IllegalArgumentException( "Person does not exist." );
+ }
+
+ return patient;
+ }
+
@Override
public Enrollments getEnrollments( Collection<ProgramInstance> programInstances )
{
@@ -157,6 +169,7 @@
List<Program> programs = new ArrayList<Program>();
programs.addAll( programService.getPrograms( Program.SINGLE_EVENT_WITH_REGISTRATION ) );
programs.addAll( programService.getPrograms( Program.MULTIPLE_EVENTS_WITH_REGISTRATION ) );
+
return programs;
}
}
=== 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-09-17 12:15:39 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/AbstractPersonService.java 2013-09-18 09:59:56 +0000
@@ -167,6 +167,11 @@
@Override
public Person getPerson( Patient patient )
{
+ if ( patient == null )
+ {
+ return null;
+ }
+
Person person = new Person();
person.setPerson( patient.getUid() );
person.setOrgUnit( patient.getOrganisationUnit().getUid() );