← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14271: minor renaming in enrollment api

 

------------------------------------------------------------
revno: 14271
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-03-18 08:56:50 +0100
message:
  minor renaming in enrollment api
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/enrollment/Enrollment.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/EnrollmentService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/JacksonEnrollmentService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/EnrollmentServiceTest.java
  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/RegistrationSingleEventServiceTest.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/EnrollmentController.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-03-17 08:22:01 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.java	2014-03-18 07:56:50 +0000
@@ -213,7 +213,7 @@
         Enrollment enrollment = new Enrollment();
 
         enrollment.setEnrollment( programInstance.getUid() );
-        enrollment.setPerson( programInstance.getEntityInstance().getUid() );
+        enrollment.setTrackedEntityInstance( programInstance.getEntityInstance().getUid() );
         enrollment.setProgram( programInstance.getProgram().getUid() );
         enrollment.setStatus( EnrollmentStatus.fromInt( programInstance.getStatus() ) );
         enrollment.setDateOfEnrollment( programInstance.getEnrollmentDate() );
@@ -227,9 +227,9 @@
     // -------------------------------------------------------------------------
 
     @Override
-    public ImportSummary saveEnrollment( Enrollment enrollment )
+    public ImportSummary addEnrollment( Enrollment enrollment )
     {
-        org.hisp.dhis.trackedentity.TrackedEntityInstance entityInstance = getTrackedEntityInstance( enrollment.getPerson() );
+        org.hisp.dhis.trackedentity.TrackedEntityInstance entityInstance = getTrackedEntityInstance( enrollment.getTrackedEntityInstance() );
         TrackedEntityInstance trackedEntityInstance = trackedEntityInstanceService.getTrackedEntityInstance( entityInstance );
         Program program = getProgram( enrollment.getProgram() );
 
@@ -237,7 +237,7 @@
 
         if ( !enrollments.getEnrollments().isEmpty() )
         {
-            ImportSummary importSummary = new ImportSummary( ImportStatus.ERROR, "Person " + trackedEntityInstance.getTrackedEntityInstance()
+            ImportSummary importSummary = new ImportSummary( ImportStatus.ERROR, "TrackedEntityInstance " + trackedEntityInstance.getTrackedEntityInstance()
                 + " already have an active enrollment in program " + program.getUid() );
             importSummary.getImportCount().incrementIgnored();
 
@@ -250,7 +250,7 @@
 
         if ( programInstance == null )
         {
-            return new ImportSummary( ImportStatus.ERROR, "Could not enroll person " + enrollment.getPerson()
+            return new ImportSummary( ImportStatus.ERROR, "Could not enroll TrackedEntityInstance " + enrollment.getTrackedEntityInstance()
                 + " into program " + enrollment.getProgram() );
         }
 
@@ -288,7 +288,7 @@
             return importSummary;
         }
 
-        org.hisp.dhis.trackedentity.TrackedEntityInstance entityInstance = getTrackedEntityInstance( enrollment.getPerson() );
+        org.hisp.dhis.trackedentity.TrackedEntityInstance entityInstance = getTrackedEntityInstance( enrollment.getTrackedEntityInstance() );
         Program program = getProgram( enrollment.getProgram() );
 
         programInstance.setProgram( program );
@@ -370,13 +370,13 @@
         return programs;
     }
 
-    private org.hisp.dhis.trackedentity.TrackedEntityInstance getTrackedEntityInstance( String person )
+    private org.hisp.dhis.trackedentity.TrackedEntityInstance getTrackedEntityInstance( String trackedEntityInstance )
     {
-        org.hisp.dhis.trackedentity.TrackedEntityInstance entityInstance = entityInstanceService.getTrackedEntityInstance( person );
+        org.hisp.dhis.trackedentity.TrackedEntityInstance entityInstance = entityInstanceService.getTrackedEntityInstance( trackedEntityInstance );
 
         if ( entityInstance == null )
         {
-            throw new IllegalArgumentException( "Person does not exist." );
+            throw new IllegalArgumentException( "TrackedEntityInstance does not exist." );
         }
 
         return entityInstance;

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/Enrollment.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/Enrollment.java	2014-03-17 15:40:04 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/Enrollment.java	2014-03-18 07:56:50 +0000
@@ -46,7 +46,7 @@
 {
     private String enrollment;
 
-    private String person;
+    private String trackedEntityInstance;
 
     private String program;
 
@@ -64,14 +64,14 @@
 
     @JsonProperty( required = true )
     @JacksonXmlProperty( isAttribute = true )
-    public String getPerson()
+    public String getTrackedEntityInstance()
     {
-        return person;
+        return trackedEntityInstance;
     }
 
-    public void setPerson( String person )
+    public void setTrackedEntityInstance( String trackedEntityInstance )
     {
-        this.person = person;
+        this.trackedEntityInstance = trackedEntityInstance;
     }
 
     @JsonProperty( required = true )
@@ -158,7 +158,8 @@
         if ( dateOfEnrollment != null ? !dateOfEnrollment.equals( that.dateOfEnrollment ) : that.dateOfEnrollment != null ) return false;
         if ( dateOfIncident != null ? !dateOfIncident.equals( that.dateOfIncident ) : that.dateOfIncident != null ) return false;
         if ( enrollment != null ? !enrollment.equals( that.enrollment ) : that.enrollment != null ) return false;
-        if ( person != null ? !person.equals( that.person ) : that.person != null ) return false;
+        if ( trackedEntityInstance != null ? !trackedEntityInstance.equals( that.trackedEntityInstance ) : that.trackedEntityInstance != null )
+            return false;
         if ( program != null ? !program.equals( that.program ) : that.program != null ) return false;
         if ( status != that.status ) return false;
 
@@ -169,7 +170,7 @@
     public int hashCode()
     {
         int result = enrollment != null ? enrollment.hashCode() : 0;
-        result = 31 * result + (person != null ? person.hashCode() : 0);
+        result = 31 * result + (trackedEntityInstance != null ? trackedEntityInstance.hashCode() : 0);
         result = 31 * result + (program != null ? program.hashCode() : 0);
         result = 31 * result + (status != null ? status.hashCode() : 0);
         result = 31 * result + (dateOfEnrollment != null ? dateOfEnrollment.hashCode() : 0);
@@ -183,7 +184,7 @@
     {
         return "Enrollment{" +
             "enrollment='" + enrollment + '\'' +
-            ", person='" + person + '\'' +
+            ", trackedEntityInstance='" + trackedEntityInstance + '\'' +
             ", program='" + program + '\'' +
             ", status=" + status +
             ", dateOfEnrollment=" + dateOfEnrollment +

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/EnrollmentService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/EnrollmentService.java	2014-03-17 08:22:01 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/EnrollmentService.java	2014-03-18 07:56:50 +0000
@@ -84,11 +84,11 @@
     // CREATE
     // -------------------------------------------------------------------------
 
-    ImportSummary saveEnrollment( Enrollment enrollment );
-
-    ImportSummaries saveEnrollmentsJson( InputStream inputStream ) throws IOException;
-
-    ImportSummaries saveEnrollmentsXml( InputStream inputStream ) throws IOException;
+    ImportSummary addEnrollment( Enrollment enrollment );
+
+    ImportSummaries addEnrollmentsJson( InputStream inputStream ) throws IOException;
+
+    ImportSummaries addEnrollmentsXml( InputStream inputStream ) throws IOException;
 
     // -------------------------------------------------------------------------
     // UPDATE

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/JacksonEnrollmentService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/JacksonEnrollmentService.java	2014-01-02 13:13:21 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/JacksonEnrollmentService.java	2014-03-18 07:56:50 +0000
@@ -93,7 +93,7 @@
     // -------------------------------------------------------------------------
 
     @Override
-    public ImportSummaries saveEnrollmentsJson( InputStream inputStream ) throws IOException
+    public ImportSummaries addEnrollmentsJson( InputStream inputStream ) throws IOException
     {
         ImportSummaries importSummaries = new ImportSummaries();
         String input = StreamUtils.copyToString( inputStream, Charset.forName( "UTF-8" ) );
@@ -105,21 +105,21 @@
             for ( Enrollment enrollment : enrollments.getEnrollments() )
             {
                 enrollment.setEnrollment( null );
-                importSummaries.addImportSummary( saveEnrollment( enrollment ) );
+                importSummaries.addImportSummary( addEnrollment( enrollment ) );
             }
         }
         catch ( Exception ex )
         {
             Enrollment enrollment = fromJson( input, Enrollment.class );
             enrollment.setEnrollment( null );
-            importSummaries.addImportSummary( saveEnrollment( enrollment ) );
+            importSummaries.addImportSummary( addEnrollment( enrollment ) );
         }
 
         return importSummaries;
     }
 
     @Override
-    public ImportSummaries saveEnrollmentsXml( InputStream inputStream ) throws IOException
+    public ImportSummaries addEnrollmentsXml( InputStream inputStream ) throws IOException
     {
         ImportSummaries importSummaries = new ImportSummaries();
         String input = StreamUtils.copyToString( inputStream, Charset.forName( "UTF-8" ) );
@@ -131,14 +131,14 @@
             for ( Enrollment enrollment : enrollments.getEnrollments() )
             {
                 enrollment.setEnrollment( null );
-                importSummaries.addImportSummary( saveEnrollment( enrollment ) );
+                importSummaries.addImportSummary( addEnrollment( enrollment ) );
             }
         }
         catch ( Exception ex )
         {
             Enrollment enrollment = fromXml( input, Enrollment.class );
             enrollment.setEnrollment( null );
-            importSummaries.addImportSummary( saveEnrollment( enrollment ) );
+            importSummaries.addImportSummary( addEnrollment( enrollment ) );
         }
 
         return importSummaries;

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/EnrollmentServiceTest.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/EnrollmentServiceTest.java	2014-03-17 08:22:01 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/EnrollmentServiceTest.java	2014-03-18 07:56:50 +0000
@@ -180,18 +180,18 @@
     public void testSaveEnrollment()
     {
         Enrollment enrollment = new Enrollment();
-        enrollment.setPerson( maleA.getUid() );
+        enrollment.setTrackedEntityInstance( maleA.getUid() );
         enrollment.setProgram( programA.getUid() );
         enrollment.setDateOfIncident( new Date() );
         enrollment.setDateOfEnrollment( new Date() );
 
-        ImportSummary importSummary = enrollmentService.saveEnrollment( enrollment );
+        ImportSummary importSummary = enrollmentService.addEnrollment( enrollment );
         assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
 
         List<Enrollment> enrollments = enrollmentService.getEnrollments( maleA ).getEnrollments();
 
         assertEquals( 1, enrollments.size() );
-        assertEquals( maleA.getUid(), enrollments.get( 0 ).getPerson() );
+        assertEquals( maleA.getUid(), enrollments.get( 0 ).getTrackedEntityInstance() );
         assertEquals( programA.getUid(), enrollments.get( 0 ).getProgram() );
     }
 
@@ -199,12 +199,12 @@
     public void testUpdateEnrollment()
     {
         Enrollment enrollment = new Enrollment();
-        enrollment.setPerson( maleA.getUid() );
+        enrollment.setTrackedEntityInstance( maleA.getUid() );
         enrollment.setProgram( programA.getUid() );
         enrollment.setDateOfIncident( new Date() );
         enrollment.setDateOfEnrollment( new Date() );
 
-        ImportSummary importSummary = enrollmentService.saveEnrollment( enrollment );
+        ImportSummary importSummary = enrollmentService.addEnrollment( enrollment );
         assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
 
         List<Enrollment> enrollments = enrollmentService.getEnrollments( maleA ).getEnrollments();
@@ -212,7 +212,7 @@
         assertEquals( 1, enrollments.size() );
         enrollment = enrollments.get( 0 );
 
-        assertEquals( maleA.getUid(), enrollment.getPerson() );
+        assertEquals( maleA.getUid(), enrollment.getTrackedEntityInstance() );
         assertEquals( programA.getUid(), enrollment.getProgram() );
 
         Date MARCH_20_81 = new Cal( 81, 2, 20 ).time();
@@ -229,7 +229,7 @@
     public void testUpdateCompleted()
     {
         Enrollment enrollment = new Enrollment();
-        enrollment.setPerson( maleA.getUid() );
+        enrollment.setTrackedEntityInstance( maleA.getUid() );
         enrollment.setProgram( programA.getUid() );
         enrollment.setDateOfIncident( new Date() );
         enrollment.setDateOfEnrollment( new Date() );
@@ -237,7 +237,7 @@
         List<Enrollment> enrollments = enrollmentService.getEnrollments( maleA ).getEnrollments();
         assertEquals( 0, enrollments.size() );
         
-        ImportSummary importSummary = enrollmentService.saveEnrollment( enrollment );
+        ImportSummary importSummary = enrollmentService.addEnrollment( enrollment );
         assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
 
         enrollments = enrollmentService.getEnrollments( maleA ).getEnrollments();
@@ -256,12 +256,12 @@
     public void testUpdateCancelled()
     {
         Enrollment enrollment = new Enrollment();
-        enrollment.setPerson( maleA.getUid() );
+        enrollment.setTrackedEntityInstance( maleA.getUid() );
         enrollment.setProgram( programA.getUid() );
         enrollment.setDateOfIncident( new Date() );
         enrollment.setDateOfEnrollment( new Date() );
 
-        ImportSummary importSummary = enrollmentService.saveEnrollment( enrollment );
+        ImportSummary importSummary = enrollmentService.addEnrollment( enrollment );
         assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
 
         List<Enrollment> enrollments = enrollmentService.getEnrollments( maleA ).getEnrollments();
@@ -280,12 +280,12 @@
     public void testUpdateReEnrollmentShouldFail()
     {
         Enrollment enrollment = new Enrollment();
-        enrollment.setPerson( maleA.getUid() );
+        enrollment.setTrackedEntityInstance( maleA.getUid() );
         enrollment.setProgram( programA.getUid() );
         enrollment.setDateOfIncident( new Date() );
         enrollment.setDateOfEnrollment( new Date() );
 
-        ImportSummary importSummary = enrollmentService.saveEnrollment( enrollment );
+        ImportSummary importSummary = enrollmentService.addEnrollment( enrollment );
         assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
 
         List<Enrollment> enrollments = enrollmentService.getEnrollments( maleA ).getEnrollments();
@@ -310,14 +310,14 @@
     public void testMultipleEnrollmentsShouldFail()
     {
         Enrollment enrollment = new Enrollment();
-        enrollment.setPerson( maleA.getUid() );
+        enrollment.setTrackedEntityInstance( maleA.getUid() );
         enrollment.setProgram( programA.getUid() );
         enrollment.setDateOfIncident( new Date() );
         enrollment.setDateOfEnrollment( new Date() );
 
-        ImportSummary importSummary = enrollmentService.saveEnrollment( enrollment );
+        ImportSummary importSummary = enrollmentService.addEnrollment( enrollment );
         assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
-        importSummary = enrollmentService.saveEnrollment( enrollment );
+        importSummary = enrollmentService.addEnrollment( enrollment );
         assertEquals( ImportStatus.ERROR, importSummary.getStatus() );
         assertThat( importSummary.getDescription(), CoreMatchers.containsString( "already have an active enrollment in program" ) );
     }
@@ -327,12 +327,12 @@
     public void testUpdatePersonShouldKeepEnrollments()
     {
         Enrollment enrollment = new Enrollment();
-        enrollment.setPerson( maleA.getUid() );
+        enrollment.setTrackedEntityInstance( maleA.getUid() );
         enrollment.setProgram( programA.getUid() );
         enrollment.setDateOfIncident( new Date() );
         enrollment.setDateOfEnrollment( new Date() );
 
-        ImportSummary importSummary = enrollmentService.saveEnrollment( enrollment );
+        ImportSummary importSummary = enrollmentService.addEnrollment( enrollment );
         assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
 
         TrackedEntityInstance trackedEntityInstance = trackedEntityInstanceService.getTrackedEntityInstance( maleA );
@@ -342,7 +342,7 @@
         List<Enrollment> enrollments = enrollmentService.getEnrollments( trackedEntityInstance ).getEnrollments();
 
         assertEquals( 1, enrollments.size() );
-        assertEquals( maleA.getUid(), enrollments.get( 0 ).getPerson() );
+        assertEquals( maleA.getUid(), enrollments.get( 0 ).getTrackedEntityInstance() );
         assertEquals( programA.getUid(), enrollments.get( 0 ).getProgram() );
     }
 }

=== 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	2014-03-17 13:44:19 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationMultiEventsServiceTest.java	2014-03-18 07:56:50 +0000
@@ -198,7 +198,7 @@
     public void testSaveSameEventMultipleTimesShouldOnlyGive1Event()
     {
         Enrollment enrollment = createEnrollment( programA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
-        ImportSummary importSummary = enrollmentService.saveEnrollment( enrollment );
+        ImportSummary importSummary = enrollmentService.addEnrollment( enrollment );
         assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
 
         Event event = createEvent( programA.getUid(), programStageA.getUid(), organisationUnitA.getUid(),
@@ -223,7 +223,7 @@
     public void testSaveRepeatableStageWithoutEventIdShouldCreateNewEvent()
     {
         Enrollment enrollment = createEnrollment( programA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
-        ImportSummary importSummary = enrollmentService.saveEnrollment( enrollment );
+        ImportSummary importSummary = enrollmentService.addEnrollment( enrollment );
         assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
 
         Event event = createEvent( programA.getUid(), programStageA.getUid(), organisationUnitA.getUid(),
@@ -250,7 +250,7 @@
     public void testSaveRepeatableStageWithEventIdShouldNotCreateAdditionalEvents()
     {
         Enrollment enrollment = createEnrollment( programA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
-        ImportSummary importSummary = enrollmentService.saveEnrollment( enrollment );
+        ImportSummary importSummary = enrollmentService.addEnrollment( enrollment );
         assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
 
         Event event = createEvent( programA.getUid(), programStageA.getUid(), organisationUnitA.getUid(),
@@ -285,7 +285,7 @@
     {
         Enrollment enrollment = new Enrollment();
         enrollment.setProgram( program );
-        enrollment.setPerson( person );
+        enrollment.setTrackedEntityInstance( person );
 
         return enrollment;
     }

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationSingleEventServiceTest.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationSingleEventServiceTest.java	2014-03-17 13:44:19 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationSingleEventServiceTest.java	2014-03-18 07:56:50 +0000
@@ -156,7 +156,7 @@
     public void testSaveWithEnrollmentShouldNotFail()
     {
         Enrollment enrollment = createEnrollment( programA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
-        ImportSummary importSummary = enrollmentService.saveEnrollment( enrollment );
+        ImportSummary importSummary = enrollmentService.addEnrollment( enrollment );
         assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
 
         Event event = createEvent( programA.getUid(), organisationUnitA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
@@ -168,7 +168,7 @@
     public void testSavingMultipleEventsShouldOnlyUpdate()
     {
         Enrollment enrollment = createEnrollment( programA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
-        ImportSummary importSummary = enrollmentService.saveEnrollment( enrollment );
+        ImportSummary importSummary = enrollmentService.addEnrollment( enrollment );
         assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
 
         Event event = createEvent( programA.getUid(), organisationUnitA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
@@ -194,7 +194,7 @@
     public void testMultipleEnrollmentsWithEventShouldGiveDifferentUIDs()
     {
         Enrollment enrollment = createEnrollment( programA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
-        enrollmentService.saveEnrollment( enrollment );
+        enrollmentService.addEnrollment( enrollment );
 
         Event event = createEvent( programA.getUid(), organisationUnitA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
         event.setStatus( EventStatus.COMPLETED );
@@ -204,7 +204,7 @@
         enrollmentService.completeEnrollment( enrollment );
 
         enrollment = createEnrollment( programA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
-        enrollmentService.saveEnrollment( enrollment );
+        enrollmentService.addEnrollment( enrollment );
 
         event = createEvent( programA.getUid(), organisationUnitA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
         event.setStatus( EventStatus.COMPLETED );
@@ -220,7 +220,7 @@
     {
         Enrollment enrollment = new Enrollment();
         enrollment.setProgram( program );
-        enrollment.setPerson( person );
+        enrollment.setTrackedEntityInstance( person );
 
         return enrollment;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/EnrollmentController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/EnrollmentController.java	2014-03-17 08:46:22 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/EnrollmentController.java	2014-03-18 07:56:50 +0000
@@ -156,7 +156,7 @@
     @PreAuthorize("hasRole('ALL') or hasRole('F_PROGRAM_ENROLLMENT')")
     public void postEnrollmentXml( HttpServletRequest request, HttpServletResponse response ) throws IOException
     {
-        ImportSummaries importSummaries = enrollmentService.saveEnrollmentsXml( request.getInputStream() );
+        ImportSummaries importSummaries = enrollmentService.addEnrollmentsXml( request.getInputStream() );
 
         if ( importSummaries.getImportSummaries().size() > 1 )
         {
@@ -181,7 +181,7 @@
     @PreAuthorize("hasRole('ALL') or hasRole('F_PROGRAM_ENROLLMENT')")
     public void postEnrollmentJson( HttpServletRequest request, HttpServletResponse response ) throws IOException
     {
-        ImportSummaries importSummaries = enrollmentService.saveEnrollmentsJson( request.getInputStream() );
+        ImportSummaries importSummaries = enrollmentService.addEnrollmentsJson( request.getInputStream() );
 
         if ( importSummaries.getImportSummaries().size() > 1 )
         {