← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12102: minor fixes to person update, removed debug println

 

------------------------------------------------------------
revno: 12102
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-09-16 14:41:18 +0200
message:
  minor fixes to person update, removed debug println
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/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/event/person/AbstractPersonService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/person/AbstractPersonService.java	2013-09-16 11:56:40 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/person/AbstractPersonService.java	2013-09-16 12:41:18 +0000
@@ -324,19 +324,23 @@
     @Override
     public ImportSummary updatePerson( Person person )
     {
-        System.err.println( "Person: " + person );
-
         ImportSummary importSummary = new ImportSummary();
         importSummary.setDataValueCount( null );
 
-        Patient patient = manager.get( Patient.class, person.getPerson() );
-        System.err.println( "Patient: " + person );
-        OrganisationUnit organisationUnit = manager.get( OrganisationUnit.class, person.getOrgUnit() );
-
         List<ImportConflict> importConflicts = new ArrayList<ImportConflict>();
         importConflicts.addAll( checkForRequiredIdentifiers( person ) );
         importConflicts.addAll( checkForRequiredAttributes( person ) );
 
+        Patient patient = manager.get( Patient.class, person.getPerson() );
+
+        if ( patient == null )
+        {
+            importConflicts.add(
+                new ImportConflict( "Person", "person " + person.getPerson() + " does not point to valid person" ) );
+        }
+
+        OrganisationUnit organisationUnit = manager.get( OrganisationUnit.class, person.getOrgUnit() );
+
         if ( organisationUnit == null )
         {
             importConflicts.add(
@@ -387,8 +391,6 @@
         updateAttributeValues( person, patient );
         patientService.updatePatient( patient );
 
-        System.err.println( "Patient: " + getPerson( patient ) );
-
         importSummary.setStatus( ImportStatus.SUCCESS );
         importSummary.setReference( patient.getUid() );
         importSummary.getImportCount().incrementImported();