dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17088
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6697: Using uids for reports in light module
------------------------------------------------------------
revno: 6697
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-04-23 12:21:07 +0200
message:
Using uids for reports in light module
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/ReportService.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/impl/DefaultReportService.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dashboard/action/GetReportAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dashboard/action/GetReportParamsAction.java
dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dashboard_reports.vm
dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/inputReportParamsForm.vm
dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/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/report/ReportService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/ReportService.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/ReportService.java 2012-04-23 10:21:07 +0000
@@ -35,7 +35,6 @@
/**
* @author Lars Helge Overland
- * @version $Id$
*/
public interface ReportService
{
@@ -44,9 +43,6 @@
final String REPORTTYPE_PDF = "pdf";
final String REPORTTYPE_XLS = "xls";
- public void renderReport( OutputStream out, Report report, Date reportingPeriod,
- Integer organisationUnitId, String type, I18nFormat format );
-
void renderReport( OutputStream out, String reportUid, Date reportingPeriod,
String organisationUnitUid, String type, I18nFormat format );
@@ -74,10 +70,30 @@
*/
Report getReport( String uid );
+ /**
+ * Returns the total number of reports.
+ * @return the total number of reports.
+ */
int getReportCount();
+ /**
+ * Retrieves the given number of maximum reports starting at the given start
+ * index. Reports are sorted on the name property.
+ *
+ * @param first the start index.
+ * @param max the maximum number of reports.
+ * @return a collection of reports.
+ */
Collection<Report> getReportsBetween( int first, int max );
+ /**
+ * Retrieves the given number of maximum reports starting at the given start
+ * index. Reports are sorted on the name property.
+ *
+ * @param first the start index.
+ * @param max the maximum number of reports.
+ * @return a collection of reports.
+ */
Collection<Report> getReportsBetweenByName( String name, int first, int max );
/**
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/impl/DefaultReportService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/impl/DefaultReportService.java 2012-03-07 07:39:30 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/impl/DefaultReportService.java 2012-04-23 10:21:07 +0000
@@ -119,14 +119,7 @@
String organisationUnitUid, String type, I18nFormat format )
{
Report report = getReport( reportUid );
- OrganisationUnit unit = organisationUnitService.getOrganisationUnit( organisationUnitUid );
- renderReport( out, report, reportingPeriod, unit.getId(), type, format );
- }
-
- public void renderReport( OutputStream out, Report report, Date reportingPeriod,
- Integer organisationUnitId, String type, I18nFormat format )
- {
Map<String, Object> params = new HashMap<String, Object>();
params.putAll( constantService.getConstantParameterMap() );
@@ -141,7 +134,7 @@
{
ReportTable reportTable = report.getReportTable();
- Grid grid = reportTableService.getReportTableGrid( reportTable.getId(), format, reportingPeriod, organisationUnitId );
+ Grid grid = reportTableService.getReportTableGrid( reportTable.getUid(), format, reportingPeriod, organisationUnitUid );
if ( report.isUsingOrganisationUnitGroupSets() )
{
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dashboard/action/GetReportAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dashboard/action/GetReportAction.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dashboard/action/GetReportAction.java 2012-04-23 10:21:07 +0000
@@ -61,27 +61,27 @@
// Input
// -------------------------------------------------------------------------
- private Integer id;
-
- public void setId( Integer id )
- {
- this.id = id;
- }
-
- private String reportingPeriod;
-
- public void setReportingPeriod( String reportingPeriod )
- {
- this.reportingPeriod = reportingPeriod;
- }
-
- private Integer organisationUnitId;
-
- public void setOrganisationUnitId( Integer organisationUnitId )
- {
- this.organisationUnitId = organisationUnitId;
- }
-
+ private String uid;
+
+ public void setUid( String uid )
+ {
+ this.uid = uid;
+ }
+
+ private String pe;
+
+ public void setPe( String pe )
+ {
+ this.pe = pe;
+ }
+
+ private String ou;
+
+ public void setOu( String ou )
+ {
+ this.ou = ou;
+ }
+
// -------------------------------------------------------------------------
// Output
// -------------------------------------------------------------------------
@@ -101,9 +101,9 @@
public String execute()
throws Exception
{
- Date date = reportingPeriod != null ? DateUtils.getMediumDate( reportingPeriod ) : new Date();
+ Date date = pe != null ? DateUtils.getMediumDate( pe ) : new Date();
- grid = reportTableService.getReportTableGrid( id, format, date, organisationUnitId );
+ grid = reportTableService.getReportTableGrid( uid, format, date, ou );
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dashboard/action/GetReportParamsAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dashboard/action/GetReportParamsAction.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dashboard/action/GetReportParamsAction.java 2012-04-23 10:21:07 +0000
@@ -78,18 +78,18 @@
// Input
// -------------------------------------------------------------------------
- private Integer id;
-
- public Integer getId()
- {
- return id;
- }
-
- public void setId( Integer id )
- {
- this.id = id;
- }
-
+ private String uid;
+
+ public String getUid()
+ {
+ return uid;
+ }
+
+ public void setUid( String uid )
+ {
+ this.uid = uid;
+ }
+
// -------------------------------------------------------------------------
// Output
// -------------------------------------------------------------------------
@@ -116,9 +116,9 @@
{
selectionTreeManager.setCurrentUserOrganisationUnitAsSelected();
- if ( id != null )
+ if ( uid != null )
{
- ReportTable reportTable = reportTableService.getReportTable( id, ReportTableService.MODE_REPORT_TABLE );
+ ReportTable reportTable = reportTableService.getReportTable( uid, ReportTableService.MODE_REPORT_TABLE );
if ( reportTable != null )
{
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dashboard_reports.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dashboard_reports.vm 2011-10-13 14:29:49 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dashboard_reports.vm 2012-04-23 10:21:07 +0000
@@ -2,6 +2,6 @@
<div class="contentDiv">
#foreach( $table in $reportTables )
-<div class="contentItemDiv" id="reportTable${table.id}" onclick="getReportParams( '${table.id}' )">$encoder.htmlEncode( $table.name )</div>
+<div class="contentItemDiv" id="reportTable${table.id}" onclick="getReportParams( '${table.uid}' )">$encoder.htmlEncode( $table.name )</div>
#end
</div>
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/inputReportParamsForm.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/inputReportParamsForm.vm 2011-10-12 17:32:39 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/inputReportParamsForm.vm 2012-04-23 10:21:07 +0000
@@ -13,7 +13,7 @@
<div class="headerDiv"><span class="header">$i18n.getString( "report_table_parameters" )</span></div>
-<input type="hidden" id="id" name="id" value="$!id" />
+<input type="hidden" id="uid" name="uid" value="$!uid" />
<!-- Reporting month -->
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/javascript/dashboard.js'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/javascript/dashboard.js 2011-09-22 10:22:37 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/javascript/dashboard.js 2012-04-23 10:21:07 +0000
@@ -13,14 +13,14 @@
// Report table
// -----------------------------------------------------------------------------
-function getReportParams( id )
+function getReportParams( uid )
{
- window.location.href = "getReportParams.action?id=" + id;
+ window.location.href = "getReportParams.action?uid=" + uid;
}
function validationError()
{
- if ( $( "#selectionTree" ).length && selectionTreeSelection.getSelected().length == 0 )
+ if ( $( "#selectionTree" ).length && !selectionTreeSelection.isSelected() )
{
setMessage( i18n_please_select_unit );
return true;
@@ -36,16 +36,16 @@
return false;
}
- var url = "id=" + $( "#id" ).val() + "&mode=" + $( "#mode" ).val();
+ var url = "uid=" + $( "#uid" ).val();
if ( $( "#reportingPeriod" ).length )
{
- url += "&reportingPeriod=" + $( "#reportingPeriod" ).val();
+ url += "&pe=" + $( "#reportingPeriod" ).val();
}
if ( $( "#selectionTree" ).length )
{
- url += "&organisationUnitId=" + selectionTreeSelection.getSelected()[0];
+ url += "&ou=" + selectionTreeSelection.getSelectedUid();
}
window.location.href = "getReport.action?" + url;