← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13397: minor change to Person.Attribute model, added new property called attribute which points to uid, ...

 

------------------------------------------------------------
revno: 13397
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-12-23 11:25:53 +0100
message:
  minor change to Person.Attribute model, added new property called attribute which points to uid, old type property now points to PatientAttribute.valueType
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/Attribute.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:11:55 +0000
+++ 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
@@ -233,7 +233,8 @@
         {
             Attribute attribute = new Attribute();
             attribute.setDisplayName( patientAttributeValue.getPatientAttribute().getDisplayName() );
-            attribute.setType( patientAttributeValue.getPatientAttribute().getUid() );
+            attribute.setAttribute( patientAttributeValue.getPatientAttribute().getUid() );
+            attribute.setType( patientAttributeValue.getPatientAttribute().getValueType() );
             attribute.setValue( patientAttributeValue.getValue() );
 
             person.getAttributes().add( attribute );

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/Attribute.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/Attribute.java	2013-09-19 09:40:29 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/Attribute.java	2013-12-23 10:25:53 +0000
@@ -41,6 +41,8 @@
 {
     private String displayName;
 
+    private String attribute;
+
     private String type;
 
     private String value;
@@ -54,8 +56,9 @@
         this.value = value;
     }
 
-    public Attribute( String type, String value )
+    public Attribute( String attribute, String type, String value )
     {
+        this.attribute = attribute;
         this.type = type;
         this.value = value;
     }
@@ -74,6 +77,18 @@
 
     @JsonProperty
     @JacksonXmlProperty( isAttribute = true )
+    public String getAttribute()
+    {
+        return attribute;
+    }
+
+    public void setAttribute( String attribute )
+    {
+        this.attribute = attribute;
+    }
+
+    @JsonProperty
+    @JacksonXmlProperty( isAttribute = true )
     public String getType()
     {
         return type;
@@ -102,11 +117,12 @@
         if ( this == o ) return true;
         if ( o == null || getClass() != o.getClass() ) return false;
 
-        Attribute attribute = (Attribute) o;
+        Attribute attribute1 = (Attribute) o;
 
-        if ( displayName != null ? !displayName.equals( attribute.displayName ) : attribute.displayName != null ) return false;
-        if ( type != null ? !type.equals( attribute.type ) : attribute.type != null ) return false;
-        if ( value != null ? !value.equals( attribute.value ) : attribute.value != null ) return false;
+        if ( attribute != null ? !attribute.equals( attribute1.attribute ) : attribute1.attribute != null ) return false;
+        if ( displayName != null ? !displayName.equals( attribute1.displayName ) : attribute1.displayName != null ) return false;
+        if ( type != null ? !type.equals( attribute1.type ) : attribute1.type != null ) return false;
+        if ( value != null ? !value.equals( attribute1.value ) : attribute1.value != null ) return false;
 
         return true;
     }
@@ -115,6 +131,7 @@
     public int hashCode()
     {
         int result = displayName != null ? displayName.hashCode() : 0;
+        result = 31 * result + (attribute != null ? attribute.hashCode() : 0);
         result = 31 * result + (type != null ? type.hashCode() : 0);
         result = 31 * result + (value != null ? value.hashCode() : 0);
         return result;
@@ -125,6 +142,7 @@
     {
         return "Attribute{" +
             "displayName='" + displayName + '\'' +
+            ", attribute='" + attribute + '\'' +
             ", type='" + type + '\'' +
             ", value='" + value + '\'' +
             '}';