← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16472: add trackedEntityInstance ID to events. Fix xml bug in TrackedEntityInstance, use xml wrapper cal...

 

------------------------------------------------------------
revno: 16472
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-08-22 11:48:43 +0700
message:
  add trackedEntityInstance ID to events. Fix xml bug in TrackedEntityInstance, use xml wrapper called attributes and element name called attribute.
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/TrackedEntityInstance.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/event/JdbcEventStore.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java	2014-08-21 05:47:47 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java	2014-08-22 04:48:43 +0000
@@ -127,6 +127,8 @@
                     event.setEnrollmentStatus( EventStatus.fromInt( rowSet.getInt( "pi_status" ) ) );
                 }
 
+                event.setTrackedEntityInstance( rowSet.getString( "tei_uid" ) );
+
                 event.setStoredBy( rowSet.getString( "psi_completeduser" ) );
                 event.setOrgUnit( rowSet.getString( "ou_uid" ) );
                 event.setDueDate( StringUtils.defaultIfEmpty(
@@ -201,7 +203,7 @@
         SqlHelper hlp = new SqlHelper();
 
         String sql =
-            "select pi.uid as pi_uid, pi.status as pi_status, p.uid as p_uid, p.type as p_type, ps.uid as ps_uid, ps.capturecoordinates as ps_capturecoordinates, pa.uid as pa_uid, psi.uid as psi_uid, psi.status as psi_status, ou.uid as ou_uid, " +
+            "select pa.uid as tei_uid, pi.uid as pi_uid, pi.status as pi_status, p.uid as p_uid, p.type as p_type, ps.uid as ps_uid, ps.capturecoordinates as ps_capturecoordinates, pa.uid as pa_uid, psi.uid as psi_uid, psi.status as psi_status, ou.uid as ou_uid, " +
                 "psi.executiondate as psi_executiondate, psi.duedate as psi_duedate, psi.completeduser as psi_completeduser, psi.longitude as psi_longitude, psi.latitude as psi_latitude, " +
                 "psinote.trackedentitycommentid as psinote_id, psinote.commenttext as psinote_value, psinote.createddate as psinote_soreddate, psinote.creator as psinote_storedby, " +
                 "pdv.value as pdv_value, pdv.storedby as pdv_storedby, pdv.providedelsewhere as pdv_providedelsewhere, de.uid as de_uid " +

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/TrackedEntityInstance.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/TrackedEntityInstance.java	2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/TrackedEntityInstance.java	2014-08-22 04:48:43 +0000
@@ -28,20 +28,20 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.lang.StringUtils;
-import org.hisp.dhis.common.DxfNamespaces;
-
 import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+import org.apache.commons.lang.StringUtils;
+import org.hisp.dhis.common.DxfNamespaces;
+
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
-@JacksonXmlRootElement( localName = "trackedEntityInstance", namespace = DxfNamespaces.DXF_2_0 )
+@JacksonXmlRootElement(localName = "trackedEntityInstance", namespace = DxfNamespaces.DXF_2_0)
 public class TrackedEntityInstance
 {
     private String trackedEntity;
@@ -71,9 +71,9 @@
             }
         }
     }
-    
-    @JsonProperty( required = true )
-    @JacksonXmlProperty( isAttribute = true )
+
+    @JsonProperty(required = true)
+    @JacksonXmlProperty(isAttribute = true)
     public String getTrackedEntity()
     {
         return trackedEntity;
@@ -84,8 +84,8 @@
         this.trackedEntity = trackedEntity;
     }
 
-    @JsonProperty( required = true )
-    @JacksonXmlProperty( isAttribute = true )
+    @JsonProperty(required = true)
+    @JacksonXmlProperty(isAttribute = true)
     public String getTrackedEntityInstance()
     {
         return trackedEntityInstance;
@@ -96,8 +96,8 @@
         this.trackedEntityInstance = trackedEntityInstance;
     }
 
-    @JsonProperty( required = true )
-    @JacksonXmlProperty( isAttribute = true )
+    @JsonProperty(required = true)
+    @JacksonXmlProperty(isAttribute = true)
     public String getOrgUnit()
     {
         return orgUnit;
@@ -109,7 +109,7 @@
     }
 
     @JsonProperty
-    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0)
     public List<Relationship> getRelationships()
     {
         return relationships;
@@ -121,7 +121,8 @@
     }
 
     @JsonProperty
-    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    @JacksonXmlElementWrapper( localName = "attributes", namespace = DxfNamespaces.DXF_2_0 )
+    @JacksonXmlProperty( localName = "attribute", namespace = DxfNamespaces.DXF_2_0 )
     public List<Attribute> getAttributes()
     {
         return attributes;