← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5543: minor fixes

 

------------------------------------------------------------
revno: 5543
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-12-22 14:18:22 +0100
message:
  minor fixes
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValue.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/Report.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulator.java
  dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/report.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/dataelement/DataElementCategoryOption.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java	2011-12-09 20:53:07 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java	2011-12-22 13:18:22 +0000
@@ -146,6 +146,7 @@
         this.category = category;
     }
 
+    // TODO Serialize this when bobs concept stuff is in place
     public Concept getConcept()
     {
         return concept;

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValue.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValue.java	2011-12-14 16:53:56 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValue.java	2011-12-22 13:18:22 +0000
@@ -27,15 +27,15 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.io.Serializable;
-import java.util.Date;
-
 import org.hisp.dhis.common.ImportableObject;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
 
+import java.io.Serializable;
+import java.util.Date;
+
 /**
  * @author Kristian Nordal
  * @version $Id: DataValue.java 4638 2008-02-25 10:06:47Z larshelg $
@@ -50,7 +50,7 @@
 
     public static final String TRUE = "true";
     public static final String FALSE = "false";
-    
+
     /**
      * Part of the DataValue's composite ID
      */
@@ -78,9 +78,9 @@
     private Date timestamp;
 
     private String comment;
-    
+
     private Boolean followup;
-    
+
     // -------------------------------------------------------------------------
     // Constructors
     // -------------------------------------------------------------------------
@@ -122,7 +122,7 @@
     }
 
     public DataValue( DataElement dataElement, Period period, OrganisationUnit source, String value, String storedBy,
-        Date timestamp, String comment )
+                      Date timestamp, String comment )
     {
         this.dataElement = dataElement;
         this.period = period;
@@ -132,9 +132,9 @@
         this.timestamp = timestamp;
         this.comment = comment;
     }
-    
+
     public DataValue( DataElement dataElement, Period period, OrganisationUnit source, String value, String storedBy,
-        Date timestamp, String comment, DataElementCategoryOptionCombo optionCombo )
+                      Date timestamp, String comment, DataElementCategoryOptionCombo optionCombo )
     {
         this.dataElement = dataElement;
         this.period = period;
@@ -149,12 +149,12 @@
     // -------------------------------------------------------------------------
     // Dimension
     // -------------------------------------------------------------------------
-    
+
     public String getMeasure()
     {
         return value;
     }
-    
+
     public String getName()
     {
         throw new UnsupportedOperationException();
@@ -166,10 +166,10 @@
 
     public boolean isZero()
     {
-        return dataElement != null && dataElement.getType().equals( DataElement.VALUE_TYPE_INT ) 
+        return dataElement != null && dataElement.getType().equals( DataElement.VALUE_TYPE_INT )
             && value != null && new Double( value ).intValue() == 0;
     }
-    
+
     public boolean isNullValue()
     {
         return value == null && comment == null;
@@ -204,7 +204,7 @@
 
         final DataValue other = (DataValue) o;
 
-        return dataElement.equals( other.getDataElement() ) && optionCombo.equals( other.getOptionCombo() ) 
+        return dataElement.equals( other.getDataElement() ) && optionCombo.equals( other.getOptionCombo() )
             && period.equals( other.getPeriod() ) && source.equals( other.getSource() );
     }
 
@@ -255,7 +255,7 @@
     {
         this.source = source;
     }
-    
+
     public DataElementCategoryOptionCombo getOptionCombo()
     {
         return optionCombo;

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/Report.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/Report.java	2011-12-13 14:04:12 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/Report.java	2011-12-22 13:18:22 +0000
@@ -27,16 +27,20 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.HashSet;
-import java.util.Set;
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.hisp.dhis.common.BaseIdentifiableObject;
+import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.common.adapter.ReportTableXmlAdapter;
+import org.hisp.dhis.reporttable.ReportTable;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
-
-import org.hisp.dhis.common.BaseIdentifiableObject;
-import org.hisp.dhis.common.Dxf2Namespace;
-import org.hisp.dhis.reporttable.ReportTable;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import java.util.HashSet;
+import java.util.Set;
 
 /**
  * @author Lars Helge Overland
@@ -56,7 +60,7 @@
     private ReportTable reportTable;
 
     private Boolean usingOrgUnitGroupSets;
-    
+
     private Set<ReportGroup> groups = new HashSet<ReportGroup>();
 
     // -------------------------------------------------------------------------
@@ -110,7 +114,7 @@
     {
         return reportTable != null;
     }
-    
+
     public boolean isUsingOrganisationUnitGroupSets()
     {
         return usingOrgUnitGroupSets != null && usingOrgUnitGroupSets;
@@ -159,6 +163,8 @@
     // Getters and setters
     // -------------------------------------------------------------------------
 
+    @XmlElement
+    @JsonProperty
     public String getDesignContent()
     {
         return designContent;
@@ -168,7 +174,11 @@
     {
         this.designContent = designContent;
     }
-    
+
+    @XmlElement
+    @XmlJavaTypeAdapter( ReportTableXmlAdapter.class )
+    @JsonProperty
+    @JsonSerialize( contentAs = BaseIdentifiableObject.class )
     public ReportTable getReportTable()
     {
         return reportTable;

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulator.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulator.java	2011-12-21 11:37:17 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulator.java	2011-12-22 13:18:22 +0000
@@ -1066,6 +1066,7 @@
 
         if ( root )
         {
+            populateIdentifiableObject( report.getReportTable() );
         }
     }
 

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/report.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/report.xsl	2011-12-15 21:05:08 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/report.xsl	2011-12-22 13:18:22 +0000
@@ -5,8 +5,8 @@
   >
 
   <xsl:template match="d:report">
-    <div class="report">
-      <h2> <xsl:value-of select="@name" /> </h2>
+  <div class="report">
+    <h2> <xsl:value-of select="@name" /> </h2>
 	  
 	  <table>
 		<tr>
@@ -24,21 +24,30 @@
 		</tr>
 	  </table><br/>
 	  
-      <table>
-        <tr>
-          <td>ID</td>
-          <td> <xsl:value-of select="@id" /> </td>
-        </tr>
-        <tr>
-          <td>Last Updated</td>
-          <td> <xsl:value-of select="@lastUpdated" /> </td>
-        </tr>
-        <tr>
-          <td>Code</td>
-          <td> <xsl:value-of select="@code" /> </td>
-        </tr>
-      </table>
-    </div>
+    <table>
+      <tr>
+        <td>ID</td>
+        <td> <xsl:value-of select="@id" /> </td>
+      </tr>
+      <tr>
+        <td>Last Updated</td>
+        <td> <xsl:value-of select="@lastUpdated" /> </td>
+      </tr>
+      <tr>
+        <td>Code</td>
+        <td> <xsl:value-of select="@code" /> </td>
+      </tr>
+    </table>
+
+    <xsl:apply-templates select="d:reportTable" mode="short"/>
+  </div>
+  </xsl:template>
+
+  <xsl:template match="d:reportTable" mode="short">
+    <h3>ReportTable</h3>
+    <table class="reportTable">
+      <xsl:apply-templates select="." mode="row"/>
+    </table>
   </xsl:template>
 
 </xsl:stylesheet>