------------------------------------------------------------ revno: 17998 committer: Lars Helge Overland <larshe...@gmail.com> branch nick: dhis2 timestamp: Wed 2015-01-14 19:17:17 +0100 message: Dashboard, persistence of event reports modified: dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardItem.java dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dashboard/impl/DefaultDashboardService.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-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-01-14 17:55:17 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardItem.java 2015-01-14 18:17:17 +0000 @@ -34,6 +34,7 @@ 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; import org.hisp.dhis.common.BaseIdentifiableObject; import org.hisp.dhis.common.DxfNamespaces; @@ -43,6 +44,7 @@ import org.hisp.dhis.common.view.ExportView; import org.hisp.dhis.document.Document; import org.hisp.dhis.eventchart.EventChart; +import org.hisp.dhis.eventreport.EventReport; import org.hisp.dhis.mapping.Map; import org.hisp.dhis.report.Report; import org.hisp.dhis.reporttable.ReportTable; @@ -87,6 +89,8 @@ private ReportTable reportTable; + private EventReport eventReport; + @Scanned private List<User> users = new ArrayList<>(); @@ -138,6 +142,10 @@ { return TYPE_REPORT_TABLE; } + else if ( eventReport != null ) + { + return TYPE_EVENT_REPORT; + } else if ( !users.isEmpty() ) { return TYPE_USERS; @@ -180,6 +188,10 @@ { return reportTable; } + else if ( eventReport != null ) + { + return eventReport; + } return null; } @@ -215,6 +227,7 @@ count += eventChart != null ? 1 : 0; count += map != null ? 1 : 0; count += reportTable != null ? 1 : 0; + count += eventReport != null ? 1 : 0; count += users.size(); count += reports.size(); count += resources.size(); @@ -321,6 +334,20 @@ this.reportTable = reportTable; } + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JsonSerialize( as = BaseIdentifiableObject.class ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public EventReport getEventReport() + { + return eventReport; + } + + public void setEventReport( EventReport eventReport ) + { + this.eventReport = eventReport; + } + @JsonProperty( "users" ) @JsonView( { DetailedView.class, ExportView.class } ) @JsonSerialize( contentAs = BaseIdentifiableObject.class ) === modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dashboard/impl/DefaultDashboardService.java' --- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dashboard/impl/DefaultDashboardService.java 2015-01-14 17:55:17 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dashboard/impl/DefaultDashboardService.java 2015-01-14 18:17:17 +0000 @@ -150,6 +150,12 @@ item.setReportTable( objectManager.get( ReportTable.class, contentUid ) ); dashboard.getItems().add( 0, item ); } + else if ( TYPE_EVENT_REPORT.equals( type ) ) + { + DashboardItem item = new DashboardItem(); + item.setEventReport( objectManager.get( EventReport.class, contentUid ) ); + dashboard.getItems().add( 0, item ); + } else if ( TYPE_MESSAGES.equals( type ) ) { DashboardItem item = new DashboardItem(); @@ -225,6 +231,11 @@ { item.setReportTable( objectManager.get( ReportTable.class, item.getReportTable().getUid() ) ); } + + if ( item.getEventReport() != null ) + { + item.setEventReport( objectManager.get( EventReport.class, item.getEventReport().getUid() ) ); + } if ( item.getUsers() != null ) { === 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 17:55:17 +0000 +++ 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 @@ -23,6 +23,8 @@ <many-to-one name="reportTable" class="org.hisp.dhis.reporttable.ReportTable" foreign-key="fk_dashboarditem_reporttableid" /> + <many-to-one name="eventReport" class="org.hisp.dhis.eventreport.EventReport" foreign-key="fk_dashboarditem_eventreportid" /> + <list name="users" table="dashboarditem_users"> <key column="dashboarditemid" foreign-key="fk_dashboarditem_users_dashboardid" /> <list-index column="sort_order" base="0" /> === 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-01-14 17:55:17 +0000 +++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js 2015-01-14 18:17:17 +0000 @@ -639,13 +639,13 @@ } else if ( "eventReport" == dashboardItem.type ) { - $d.append( $.tmpl( dhis2.db.tmpl.reportTableItem, { "itemId": dashboardItem.id, "id": dashboardItem.reportTable.id, "name": dashboardItem.reportTable.name, "style": style, + $d.append( $.tmpl( dhis2.db.tmpl.eventReportItem, { "itemId": dashboardItem.id, "id": dashboardItem.eventReport.id, "name": dashboardItem.eventReport.name, "style": style, "i18n_remove": i18n_remove, "i18n_share": i18n_share_interpretation, "i18n_click_and_drag_to_new_position": i18n_click_and_drag_to_new_position } ) ); DHIS.getEventReport({ url: '..', el: 'plugin-' + dashboardItem.id, - id: dashboardItem.reportTable.id, + id: dashboardItem.eventReport.id, width: width - scrollbarWidth, height: 290, dashboard: true,
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp