dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27021
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13398: minor changes to Person.identifier model
------------------------------------------------------------
revno: 13398
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-12-23 11:40:20 +0100
message:
minor changes to Person.identifier model
modified:
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/AbstractPersonService.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/Identifier.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/person/AbstractPersonService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/AbstractPersonService.java 2013-12-23 10:25:53 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/AbstractPersonService.java 2013-12-23 10:40:20 +0000
@@ -135,7 +135,7 @@
public Person getPerson( Identifier identifier )
{
PatientIdentifierType patientIdentifierType = patientIdentifierTypeService
- .getPatientIdentifierTypeByUid( identifier.getType() );
+ .getPatientIdentifierTypeByUid( identifier.getIdentifier() );
Patient patient = patientIdentifierService.getPatient( patientIdentifierType, identifier.getValue() );
return getPerson( patient );
}
@@ -216,12 +216,15 @@
for ( PatientIdentifier patientIdentifier : patient.getIdentifiers() )
{
- String identifierType = patientIdentifier.getIdentifierType() == null ? null : patientIdentifier
+ String identifierId = patientIdentifier.getIdentifierType() == null ? null : patientIdentifier
.getIdentifierType().getUid();
+
+ String identifierType = patientIdentifier.getIdentifierType() == null ? "system" : patientIdentifier.getIdentifierType().getType();
+
String displayName = patientIdentifier.getIdentifierType() != null ? patientIdentifier.getIdentifierType()
.getDisplayName() : null;
- Identifier identifier = new Identifier( identifierType, patientIdentifier.getIdentifier() );
+ Identifier identifier = new Identifier( identifierId, identifierType, patientIdentifier.getIdentifier() );
identifier.setDisplayName( displayName );
person.getIdentifiers().add( identifier );
}
@@ -392,7 +395,7 @@
{
if ( identifier.getValue() != null )
{
- cacheMap.put( identifier.getType(), identifier.getValue() );
+ cacheMap.put( identifier.getIdentifier(), identifier.getValue() );
}
}
@@ -429,11 +432,11 @@
for ( Identifier identifier : person.getIdentifiers() )
{
PatientIdentifierType patientIdentifierType = manager.get( PatientIdentifierType.class,
- identifier.getType() );
+ identifier.getIdentifier() );
if ( patientIdentifierType == null )
{
- importConflicts.add( new ImportConflict( "Identifier.type", "Invalid type " + identifier.getType() ) );
+ importConflicts.add( new ImportConflict( "Identifier.type", "Invalid type " + identifier.getIdentifier() ) );
}
}
@@ -450,7 +453,7 @@
{
if ( attribute.getValue() != null )
{
- cache.add( attribute.getType() );
+ cache.add( attribute.getAttribute() );
}
}
@@ -468,11 +471,11 @@
for ( Attribute attribute : person.getAttributes() )
{
- PatientAttribute patientAttribute = manager.get( PatientAttribute.class, attribute.getType() );
+ PatientAttribute patientAttribute = manager.get( PatientAttribute.class, attribute.getAttribute() );
if ( patientAttribute == null )
{
- importConflicts.add( new ImportConflict( "Attribute.type", "Invalid type " + attribute.getType() ) );
+ importConflicts.add( new ImportConflict( "Attribute.type", "Invalid type " + attribute.getAttribute() ) );
}
}
@@ -509,7 +512,7 @@
{
for ( Attribute attribute : person.getAttributes() )
{
- PatientAttribute patientAttribute = manager.get( PatientAttribute.class, attribute.getType() );
+ PatientAttribute patientAttribute = manager.get( PatientAttribute.class, attribute.getAttribute() );
if ( patientAttribute != null )
{
@@ -532,7 +535,7 @@
{
Identifier identifier = iterator.next();
- if ( identifier.getType() == null )
+ if ( identifier.getIdentifier() == null )
{
iterator.remove();
}
@@ -563,7 +566,7 @@
{
for ( Identifier identifier : person.getIdentifiers() )
{
- if ( identifier.getType() == null )
+ if ( identifier.getIdentifier() == null )
{
PatientIdentifier patientIdentifier = new PatientIdentifier();
patientIdentifier.setIdentifier( identifier.getValue().trim() );
@@ -575,7 +578,7 @@
continue;
}
- PatientIdentifierType type = manager.get( PatientIdentifierType.class, identifier.getType() );
+ PatientIdentifierType type = manager.get( PatientIdentifierType.class, identifier.getIdentifier() );
if ( type != null && nullIfEmpty( identifier.getValue() ) != null )
{
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/Identifier.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/Identifier.java 2013-09-19 09:40:29 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/Identifier.java 2013-12-23 10:40:20 +0000
@@ -41,6 +41,8 @@
{
private String displayName;
+ private String identifier;
+
private String type;
private String value;
@@ -54,8 +56,9 @@
this.value = value;
}
- public Identifier( String type, String value )
+ public Identifier( String identifier, String type, String value )
{
+ this.identifier = identifier;
this.type = type;
this.value = value;
}
@@ -74,6 +77,18 @@
@JsonProperty
@JacksonXmlProperty( isAttribute = true )
+ public String getIdentifier()
+ {
+ return identifier;
+ }
+
+ public void setIdentifier( String identifier )
+ {
+ this.identifier = identifier;
+ }
+
+ @JsonProperty
+ @JacksonXmlProperty( isAttribute = true )
public String getType()
{
return type;
@@ -105,6 +120,7 @@
Identifier that = (Identifier) o;
if ( displayName != null ? !displayName.equals( that.displayName ) : that.displayName != null ) return false;
+ if ( identifier != null ? !identifier.equals( that.identifier ) : that.identifier != null ) return false;
if ( type != null ? !type.equals( that.type ) : that.type != null ) return false;
if ( value != null ? !value.equals( that.value ) : that.value != null ) return false;
@@ -115,15 +131,18 @@
public int hashCode()
{
int result = displayName != null ? displayName.hashCode() : 0;
+ result = 31 * result + (identifier != null ? identifier.hashCode() : 0);
result = 31 * result + (type != null ? type.hashCode() : 0);
result = 31 * result + (value != null ? value.hashCode() : 0);
return result;
}
- @Override public String toString()
+ @Override
+ public String toString()
{
return "Identifier{" +
"displayName='" + displayName + '\'' +
+ ", identifier='" + identifier + '\'' +
", type='" + type + '\'' +
", value='" + value + '\'' +
'}';