← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13748: properly provide xml/json for programPatientAttribute

 

------------------------------------------------------------
revno: 13748
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-01-16 14:34:15 +0700
message:
  properly provide xml/json for programPatientAttribute
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramPatientAttribute.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/program/ProgramPatientAttribute.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramPatientAttribute.java	2014-01-09 12:49:36 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramPatientAttribute.java	2014-01-16 07:34:15 +0000
@@ -27,24 +27,34 @@
 
 package org.hisp.dhis.program;
 
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonView;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+import org.hisp.dhis.common.BaseIdentifiableObject;
+import org.hisp.dhis.common.DxfNamespaces;
+import org.hisp.dhis.common.view.DetailedView;
+import org.hisp.dhis.common.view.ExportView;
+import org.hisp.dhis.common.view.WithoutOrganisationUnitsView;
+import org.hisp.dhis.patient.PatientAttribute;
+
 import java.io.Serializable;
 
-import org.hisp.dhis.patient.PatientAttribute;
-
 /**
  * @author Chau Thu Tran
- * 
  * @version $ ProgramPatientAttribute.java Jan 7, 2014 9:16:05 AM $
  */
+@JacksonXmlRootElement( localName = "programPersonAttribute", namespace = DxfNamespaces.DXF_2_0 )
 public class ProgramPatientAttribute
     implements Serializable
 {
     private static final long serialVersionUID = -2420475559273198337L;
 
     private int id;
-    
+
     private PatientAttribute patientAttribute;
-    
+
     private Integer sortOrder;
 
     private boolean displayedInList;
@@ -113,6 +123,10 @@
         this.id = id;
     }
 
+    @JsonProperty
+    @JsonSerialize( as = BaseIdentifiableObject.class )
+    @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } )
+    @JacksonXmlProperty( localName = "personAttribute", namespace = DxfNamespaces.DXF_2_0 )
     public PatientAttribute getPatientAttribute()
     {
         return patientAttribute;
@@ -132,7 +146,10 @@
     {
         this.sortOrder = sortOrder;
     }
-    
+
+    @JsonProperty
+    @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } )
+    @JacksonXmlProperty( localName = "displayedInList", namespace = DxfNamespaces.DXF_2_0 )
     public Boolean getDisplayedInList()
     {
         return displayedInList;