dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #24570
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12071: support creation of persons with identifiers
------------------------------------------------------------
revno: 12071
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-09-13 10:27:37 +0200
message:
support creation of persons with identifiers
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifier.java
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-api/src/main/java/org/hisp/dhis/patient/PatientIdentifier.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifier.java 2013-09-13 07:40:23 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifier.java 2013-09-13 08:27:37 +0000
@@ -50,6 +50,11 @@
private String identifier;
+ public PatientIdentifier()
+ {
+ setAutoFields();
+ }
+
// -------------------------------------------------------------------------
// Getters and setters
// -------------------------------------------------------------------------
=== 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-13 07:08:33 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/person/AbstractPersonService.java 2013-09-13 08:27:37 +0000
@@ -33,6 +33,7 @@
import org.hisp.dhis.patient.Patient;
import org.hisp.dhis.patient.PatientIdentifier;
import org.hisp.dhis.patient.PatientIdentifierService;
+import org.hisp.dhis.patient.PatientIdentifierType;
import org.hisp.dhis.patient.PatientService;
import org.hisp.dhis.patient.util.PatientIdentifierGenerator;
import org.hisp.dhis.program.Program;
@@ -255,11 +256,24 @@
// remove systemId from Person object
while ( iterator.hasNext() )
{
- Identifier next = iterator.next();
+ Identifier identifier = iterator.next();
- if ( next.getType() == null )
+ if ( identifier.getType() == null )
{
iterator.remove();
+ continue;
+ }
+
+ PatientIdentifierType type = manager.get( PatientIdentifierType.class, identifier.getType() );
+
+ if ( type != null )
+ {
+ PatientIdentifier patientIdentifier = new PatientIdentifier();
+ patientIdentifier.setIdentifier( identifier.getValue().trim() );
+ patientIdentifier.setIdentifierType( type );
+ patientIdentifier.setPatient( patient );
+
+ patient.getIdentifiers().add( patientIdentifier );
}
}
@@ -338,6 +352,7 @@
patientIdentifier = new PatientIdentifier();
patientIdentifier.setPatient( patient );
patientIdentifier.setIdentifier( systemId );
+ patientIdentifier.setIdentifierType( null );
patient.getIdentifiers().add( patientIdentifier );
}