← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11933: Renamed patient => person in Event. Check that person is not null, if program is with registration.

 

------------------------------------------------------------
revno: 11933
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-09-05 16:06:15 +0200
message:
  Renamed patient => person in Event. Check that person is not null, if program is with registration.
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/AbstractEventService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/Event.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/event/AbstractEventService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/AbstractEventService.java	2013-09-05 13:26:14 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/AbstractEventService.java	2013-09-05 14:06:15 +0000
@@ -125,12 +125,12 @@
         }
         else
         {
-            return new ImportSummary( ImportStatus.ERROR, "No Event programId or programStageId was provided." );
+            return new ImportSummary( ImportStatus.ERROR, "No Event.program or Event.programStage was provided." );
         }
 
         if ( program == null )
         {
-            return new ImportSummary( ImportStatus.ERROR, "No valid Event programId or programStageId was provided." );
+            return new ImportSummary( ImportStatus.ERROR, "No valid Event.program or Event.programStage was provided." );
         }
         else
         {
@@ -142,11 +142,16 @@
             }
         }
 
+        if ( program.isRegistration() && event.getPerson() == null )
+        {
+            return new ImportSummary( ImportStatus.ERROR, "No Event.person was provided for registration based program." );
+        }
+
         OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( event.getOrgUnit() );
 
         if ( organisationUnit == null )
         {
-            return new ImportSummary( ImportStatus.ERROR, "Event organisationUnitId does not point to a valid organisation unit." );
+            return new ImportSummary( ImportStatus.ERROR, "Event.orgUnit does not point to a valid organisation unit." );
         }
         else
         {
@@ -205,7 +210,7 @@
 
         if ( eventDate == null )
         {
-            return new ImportSummary( ImportStatus.ERROR, "Event eventDate is not in a valid format." );
+            return new ImportSummary( ImportStatus.ERROR, "Event.eventDate is not in a valid format." );
         }
 
         ImportSummary importSummary = new ImportSummary();

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/Event.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/Event.java	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/Event.java	2013-09-05 14:06:15 +0000
@@ -52,7 +52,7 @@
 
     private String orgUnit;
 
-    private String patient;
+    private String person;
 
     private String eventDate;
 
@@ -118,14 +118,14 @@
 
     @JsonProperty
     @JacksonXmlProperty( isAttribute = true )
-    public String getPatient()
+    public String getPerson()
     {
-        return patient;
+        return person;
     }
 
-    public void setPatient( String patient )
+    public void setPerson( String person )
     {
-        this.patient = patient;
+        this.person = person;
     }
 
     @JsonProperty( required = true )
@@ -197,7 +197,7 @@
             ", programStage='" + programStage + '\'' +
             ", event='" + event + '\'' +
             ", orgUnit='" + orgUnit + '\'' +
-            ", patient='" + patient + '\'' +
+            ", person='" + person + '\'' +
             ", eventDate='" + eventDate + '\'' +
             ", completed=" + completed +
             ", storedBy='" + storedBy + '\'' +