← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20162: ReportTable, enums for displayDensity and fontSize

 

------------------------------------------------------------
revno: 20162
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-09-15 12:40:23 +0200
message:
  ReportTable, enums for displayDensity and fontSize
added:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DisplayDensity.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/FontSize.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReport.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/eventreport/EventReport.hbm.xml
  dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml


--
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
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DisplayDensity.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DisplayDensity.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DisplayDensity.java	2015-09-15 10:40:23 +0000
@@ -0,0 +1,37 @@
+package org.hisp.dhis.common;
+
+/*
+ * Copyright (c) 2004-2015, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @author Lars Helge Overland
+ */
+public enum DisplayDensity
+{
+    COMFORTABLE, NORMAL, COMPACT;
+}

=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/FontSize.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/FontSize.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/FontSize.java	2015-09-15 10:40:23 +0000
@@ -0,0 +1,37 @@
+package org.hisp.dhis.common;
+
+/*
+ * Copyright (c) 2004-2015, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @author Lars Helge Overland
+ */
+public enum FontSize
+{
+    LARGE, NORMAL, SMALL;
+}

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReport.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReport.java	2015-08-04 16:05:37 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReport.java	2015-09-15 10:40:23 +0000
@@ -37,8 +37,10 @@
 import org.hisp.dhis.common.BaseDimensionalObject;
 import org.hisp.dhis.common.BaseIdentifiableObject;
 import org.hisp.dhis.common.DimensionalObject;
+import org.hisp.dhis.common.DisplayDensity;
 import org.hisp.dhis.common.DxfNamespaces;
 import org.hisp.dhis.common.EventAnalyticalObject;
+import org.hisp.dhis.common.FontSize;
 import org.hisp.dhis.common.IdentifiableObject;
 import org.hisp.dhis.common.MergeStrategy;
 import org.hisp.dhis.common.view.DetailedView;
@@ -170,12 +172,12 @@
     /**
      * The display density of the text in the table.
      */
-    private String displayDensity;
+    private DisplayDensity displayDensity;
 
     /**
      * The font size of the text in the table.
      */
-    private String fontSize;
+    private FontSize fontSize;
 
     /**
      * The font size of the text in the table.
@@ -507,12 +509,12 @@
     @JsonProperty
     @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
-    public String getDisplayDensity()
+    public DisplayDensity getDisplayDensity()
     {
         return displayDensity;
     }
 
-    public void setDisplayDensity( String displayDensity )
+    public void setDisplayDensity( DisplayDensity displayDensity )
     {
         this.displayDensity = displayDensity;
     }
@@ -520,12 +522,12 @@
     @JsonProperty
     @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
-    public String getFontSize()
+    public FontSize getFontSize()
     {
         return fontSize;
     }
 
-    public void setFontSize( String fontSize )
+    public void setFontSize( FontSize fontSize )
     {
         this.fontSize = fontSize;
     }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java	2015-09-06 07:05:53 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java	2015-09-15 10:40:23 +0000
@@ -45,7 +45,9 @@
 import org.hisp.dhis.common.CombinationGenerator;
 import org.hisp.dhis.common.DimensionalObject;
 import org.hisp.dhis.common.DimensionalObjectUtils;
+import org.hisp.dhis.common.DisplayDensity;
 import org.hisp.dhis.common.DxfNamespaces;
+import org.hisp.dhis.common.FontSize;
 import org.hisp.dhis.common.Grid;
 import org.hisp.dhis.common.GridHeader;
 import org.hisp.dhis.common.IdentifiableObject;
@@ -91,14 +93,6 @@
     public static final String TOTAL_COLUMN_NAME = "total";
     public static final String TOTAL_COLUMN_PRETTY_NAME = "Total";
 
-    public static final String DISPLAY_DENSITY_COMFORTABLE = "comfortable";
-    public static final String DISPLAY_DENSITY_NORMAL = "normal";
-    public static final String DISPLAY_DENSITY_COMPACT = "compact";
-
-    public static final String FONT_SIZE_LARGE = "large";
-    public static final String FONT_SIZE_NORMAL = "normal";
-    public static final String FONT_SIZE_SMALL = "small";
-
     public static final NameableObject[] IRT = new NameableObject[0];
     public static final NameableObject[][] IRT2D = new NameableObject[0][];
 
@@ -175,12 +169,12 @@
     /**
      * The display density of the text in the table.
      */
-    private String displayDensity;
+    private DisplayDensity displayDensity;
 
     /**
      * The font size of the text in the table.
      */
-    private String fontSize;
+    private FontSize fontSize;
 
     /**
      * The legend set in the table.
@@ -903,12 +897,12 @@
     @JsonProperty
     @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
-    public String getDisplayDensity()
+    public DisplayDensity getDisplayDensity()
     {
         return displayDensity;
     }
 
-    public void setDisplayDensity( String displayDensity )
+    public void setDisplayDensity( DisplayDensity displayDensity )
     {
         this.displayDensity = displayDensity;
     }
@@ -916,12 +910,12 @@
     @JsonProperty
     @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
-    public String getFontSize()
+    public FontSize getFontSize()
     {
         return fontSize;
     }
 
-    public void setFontSize( String fontSize )
+    public void setFontSize( FontSize fontSize )
     {
         this.fontSize = fontSize;
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2015-09-15 10:26:47 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2015-09-15 10:40:23 +0000
@@ -878,6 +878,22 @@
         executeSql( "update dashboarditem set shape='NORMAL' where shape ='normal'" );
         executeSql( "update dashboarditem set shape='DOUBLE_WIDTH' where shape ='double_width'" );
         executeSql( "update dashboarditem set shape='FULL_WIDTH' where shape ='full_width'" );
+        
+        executeSql( "update reporttable set displaydensity='COMFORTABLE' where displaydensity='comfortable'" );
+        executeSql( "update reporttable set displaydensity='NORMAL' where displaydensity='normal'" );
+        executeSql( "update reporttable set displaydensity='COMPACT' where displaydensity='compact'" );
+
+        executeSql( "update eventreport set displaydensity='COMFORTABLE' where displaydensity='comfortable'" );
+        executeSql( "update eventreport set displaydensity='NORMAL' where displaydensity='normal'" );
+        executeSql( "update eventreport set displaydensity='COMPACT' where displaydensity='compact'" );
+
+        executeSql( "update reporttable set fontsize='LARGE' where displaydensity='large'" );
+        executeSql( "update reporttable set fontsize='NORMAL' where displaydensity='normal'" );
+        executeSql( "update reporttable set fontsize='SMALL' where displaydensity='small'" );
+
+        executeSql( "update eventreport set fontsize='LARGE' where displaydensity='large'" );
+        executeSql( "update eventreport set fontsize='NORMAL' where displaydensity='normal'" );
+        executeSql( "update eventreport set fontsize='SMALL' where displaydensity='small'" );
 
         oauth2();
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/eventreport/EventReport.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/eventreport/EventReport.hbm.xml	2015-09-10 11:56:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/eventreport/EventReport.hbm.xml	2015-09-15 10:40:23 +0000
@@ -154,9 +154,19 @@
 
     <property name="digitGroupSeparator" />
 
-    <property name="displayDensity" />
+    <property name="displayDensity" length="40">
+		<type name="org.hibernate.type.EnumType">
+			<param name="enumClass">org.hisp.dhis.common.DisplayDensity</param>
+			<param name="type">12</param>
+		</type> 
+	</property>
 
-    <property name="fontSize" />
+    <property name="fontSize" length="40">
+		<type name="org.hibernate.type.EnumType">
+			<param name="enumClass">org.hisp.dhis.common.FontSize</param>
+			<param name="type">12</param>
+		</type> 
+	</property>
 
     <property name="sortOrder" />
 

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml	2015-09-10 11:56:07 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml	2015-09-15 10:40:23 +0000
@@ -151,9 +151,19 @@
 	
     <property name="digitGroupSeparator" />
 
-    <property name="displayDensity" />
+    <property name="displayDensity" length="40">
+		<type name="org.hibernate.type.EnumType">
+			<param name="enumClass">org.hisp.dhis.common.DisplayDensity</param>
+			<param name="type">12</param>
+		</type> 
+	</property>
 
-    <property name="fontSize" />
+    <property name="fontSize" length="40">
+		<type name="org.hibernate.type.EnumType">
+			<param name="enumClass">org.hisp.dhis.common.FontSize</param>
+			<param name="type">12</param>
+		</type> 
+	</property>
 
     <property name="userOrganisationUnit" />