← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16462: allow getting enrollments with no TEI

 

------------------------------------------------------------
revno: 16462
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-08-21 13:21:10 +0700
message:
  allow getting enrollments with no TEI
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.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	2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.java	2014-08-21 06:21:10 +0000
@@ -257,15 +257,15 @@
     @Override
     public Enrollment getEnrollment( ProgramInstance programInstance )
     {
-        if ( programInstance.getEntityInstance() == null )
-        {
-            return null;
-        }
-
         Enrollment enrollment = new Enrollment();
 
         enrollment.setEnrollment( programInstance.getUid() );
-        enrollment.setTrackedEntityInstance( programInstance.getEntityInstance().getUid() );
+
+        if ( programInstance.getEntityInstance() != null )
+        {
+            enrollment.setTrackedEntityInstance( programInstance.getEntityInstance().getUid() );
+        }
+
         enrollment.setProgram( programInstance.getProgram().getUid() );
         enrollment.setStatus( EnrollmentStatus.fromInt( programInstance.getStatus() ) );
         enrollment.setDateOfEnrollment( programInstance.getEnrollmentDate() );