dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #39765
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20161: DashboardItem. Using enum for shape.
------------------------------------------------------------
revno: 20161
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-09-15 12:26:47 +0200
message:
DashboardItem. Using enum for shape.
added:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardItemShape.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardItem.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/dashboard/hibernate/DashboardItem.hbm.xml
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DashboardItemController.java
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js
--
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/dashboard/DashboardItem.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardItem.java 2015-09-15 10:15:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardItem.java 2015-09-15 10:26:47 +0000
@@ -66,10 +66,6 @@
{
public static final int MAX_CONTENT = 8;
- public static final String SHAPE_NORMAL = "normal";
- public static final String SHAPE_DOUBLE_WIDTH = "double_width";
- public static final String SHAPE_FULL_WIDTH = "full_width";
-
private Chart chart;
private EventChart eventChart;
@@ -91,7 +87,7 @@
private Boolean messages;
- private String shape;
+ private DashboardItemShape shape;
// -------------------------------------------------------------------------
// Constructors
@@ -398,12 +394,12 @@
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
- public String getShape()
+ public DashboardItemShape getShape()
{
return shape;
}
- public void setShape( String shape )
+ public void setShape( DashboardItemShape shape )
{
this.shape = shape;
}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardItemShape.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardItemShape.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardItemShape.java 2015-09-15 10:26:47 +0000
@@ -0,0 +1,37 @@
+package org.hisp.dhis.dashboard;
+
+/*
+ * 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 DashboardItemShape
+{
+ NORMAL, DOUBLE_WIDTH, FULL_WIDTH;
+}
=== 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-14 13:27:40 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2015-09-15 10:26:47 +0000
@@ -874,6 +874,10 @@
executeSql( "update report set type='JASPER_REPORT_TABLE' where type='jasperReportTable'" );
executeSql( "update report set type='JASPER_JDBC' where type='jasperJdbc'" );
executeSql( "update report set type='HTML' where type='html'" );
+
+ 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'" );
oauth2();
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/dashboard/hibernate/DashboardItem.hbm.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/dashboard/hibernate/DashboardItem.hbm.xml 2015-01-14 18:17:17 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/dashboard/hibernate/DashboardItem.hbm.xml 2015-09-15 10:26:47 +0000
@@ -45,7 +45,12 @@
<property name="messages" />
- <property name="shape" />
-
+ <property name="shape" length="50">
+ <type name="org.hibernate.type.EnumType">
+ <param name="enumClass">org.hisp.dhis.dashboard.DashboardItemShape</param>
+ <param name="type">12</param>
+ </type>
+ </property>
+
</class>
</hibernate-mapping>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DashboardItemController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DashboardItemController.java 2015-07-09 06:44:02 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DashboardItemController.java 2015-09-15 10:26:47 +0000
@@ -29,8 +29,10 @@
*/
import com.google.common.collect.Lists;
+
import org.hisp.dhis.common.Pager;
import org.hisp.dhis.dashboard.DashboardItem;
+import org.hisp.dhis.dashboard.DashboardItemShape;
import org.hisp.dhis.dashboard.DashboardService;
import org.hisp.dhis.dxf2.webmessage.WebMessageException;
import org.hisp.dhis.query.Order;
@@ -46,6 +48,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+
import java.util.List;
/**
@@ -82,7 +85,7 @@
}
@RequestMapping( value = "/{uid}/shape/{shape}", method = RequestMethod.PUT )
- public void putDashboardItemShape( @PathVariable String uid, @PathVariable String shape,
+ public void putDashboardItemShape( @PathVariable String uid, @PathVariable DashboardItemShape shape,
HttpServletRequest request, HttpServletResponse response ) throws Exception
{
DashboardItem item = dashboardService.getDashboardItem( uid );
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js 2015-09-15 10:15:00 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js 2015-09-15 10:26:47 +0000
@@ -28,9 +28,9 @@
dhis2.db.currentUserOrgUnit = [];
dhis2.db.contextPath;
dhis2.db.maxItems = 40;
-dhis2.db.shapeNormal = "normal";
-dhis2.db.shapeDoubleWidth = "double_width";
-dhis2.db.shapeFullWidth = "full_width";
+dhis2.db.shapeNormal = "NORMAL";
+dhis2.db.shapeDoubleWidth = "DOUBLE_WIDTH";
+dhis2.db.shapeFullWidth = "FULL_WIDTH";
dhis2.db.widthNormal = 408;
dhis2.db.widthDouble = 847;
dhis2.db.visualItemTypes = ["CHART", "EVENT_CHART", "MAP", "REPORT_TABLE", "EVENT_REPORT"];