← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8666: Made Interpretations correctly display in /api/interpretations and /api/interpretations/{uid}.

 

------------------------------------------------------------
revno: 8666
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-10-23 15:24:16 +0200
message:
  Made Interpretations correctly display in /api/interpretations and /api/interpretations/{uid}.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/interpretation/Interpretation.java
  dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java
  dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/interpretation.xsl
  dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/list.xsl


--
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/interpretation/Interpretation.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/interpretation/Interpretation.java	2012-09-24 21:54:54 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/interpretation/Interpretation.java	2012-10-23 13:24:16 +0000
@@ -30,6 +30,7 @@
 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.JacksonXmlElementWrapper;
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
 import org.hisp.dhis.chart.Chart;
@@ -156,6 +157,12 @@
     // Get and set methods
     // -------------------------------------------------------------------------
 
+    @Override
+    public String getName()
+    {
+        return uid;
+    }
+
     @JsonProperty
     @JsonSerialize( as = BaseIdentifiableObject.class )
     @JsonView( { DetailedView.class, ExportView.class } )
@@ -281,9 +288,9 @@
     }
 
     @JsonProperty
-    @JsonSerialize( contentAs = BaseIdentifiableObject.class )
     @JsonView( { DetailedView.class, ExportView.class } )
-    @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
+    @JacksonXmlElementWrapper( localName = "comments", namespace = Dxf2Namespace.NAMESPACE )
+    @JacksonXmlProperty( localName = "comment", namespace = Dxf2Namespace.NAMESPACE )
     public List<InterpretationComment> getComments()
     {
         return comments;

=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java	2012-08-09 13:24:53 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java	2012-10-23 13:24:16 +0000
@@ -45,6 +45,7 @@
 import org.hisp.dhis.indicator.IndicatorGroup;
 import org.hisp.dhis.indicator.IndicatorGroupSet;
 import org.hisp.dhis.indicator.IndicatorType;
+import org.hisp.dhis.interpretation.Interpretation;
 import org.hisp.dhis.mapping.MapLayer;
 import org.hisp.dhis.mapping.MapLegend;
 import org.hisp.dhis.mapping.MapLegendSet;
@@ -89,6 +90,8 @@
 
     private List<MessageConversation> messageConversations = new ArrayList<MessageConversation>();
 
+    private List<Interpretation> interpretations = new ArrayList<Interpretation>(  );
+
     private List<OptionSet> optionSets = new ArrayList<OptionSet>();
 
     private List<DataElementCategory> categories = new ArrayList<DataElementCategory>();
@@ -217,6 +220,19 @@
     }
 
     @JsonProperty
+    @JacksonXmlElementWrapper( localName = "interpretations", namespace = Dxf2Namespace.NAMESPACE )
+    @JacksonXmlProperty( localName = "interpretation", namespace = Dxf2Namespace.NAMESPACE )
+    public List<Interpretation> getInterpretations()
+    {
+        return interpretations;
+    }
+
+    public void setInterpretations( List<Interpretation> interpretations )
+    {
+        this.interpretations = interpretations;
+    }
+
+    @JsonProperty
     @JacksonXmlElementWrapper( localName = "dataElements", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "dataElement", namespace = Dxf2Namespace.NAMESPACE )
     public List<DataElement> getDataElements()

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/interpretation.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/interpretation.xsl	2012-10-17 17:04:50 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/interpretation.xsl	2012-10-23 13:24:16 +0000
@@ -27,6 +27,29 @@
           <td> <xsl:value-of select="d:created" /> </td>
         </tr>
       </table>
+
+      <xsl:apply-templates select="d:user|d:comments" mode="short" />
     </div>
   </xsl:template>
-</xsl:stylesheet>
\ No newline at end of file
+
+  <xsl:template match="d:comments" mode="short">
+    <xsl:if test="count(child::*) > 0">
+      <h3>Comments</h3>
+      <xsl:apply-templates select="child::*" mode="short"/>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="d:comment" mode="short">
+    <table class="comments">
+      <tr>
+        <td>Created</td>
+        <td> <xsl:value-of select="d:created" /> </td>
+      </tr>
+      <tr>
+        <td>Text</td>
+        <td> <xsl:value-of select="d:text" /> </td>
+      </tr>
+    </table>
+  </xsl:template>
+
+</xsl:stylesheet>

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/list.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/list.xsl	2012-05-30 13:29:47 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/list.xsl	2012-10-23 13:24:16 +0000
@@ -18,7 +18,7 @@
       d:documents|d:indicatorGroups|d:indicatorGroupSets|d:organisationUnitGroups|
       d:organisationUnitGroupSets|d:indicatorTypes|d:attributeTypes|d:reports|d:constants|
       d:sqlViews|d:validationRules|d:validationRuleGroups|d:users|d:userGroups|d:userAuthorityGroups|
-      d:reportTables|d:mapLegends|d:mapLegendSets|d:mapLayers|d:optionSets">
+      d:reportTables|d:mapLegends|d:mapLegendSets|d:mapLayers|d:optionSets|d:interpretations">
 
     <h3>
       <xsl:value-of select="local-name()" />