← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 297: Moved a function from the ReportTableService to the ReportTable object

 

------------------------------------------------------------
revno: 297
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Mon 2009-05-18 22:27:17 +0200
message:
  Moved a function from the ReportTableService to the ReportTable object
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableService.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetDisplayTableOptionsAction.java

=== 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	2009-05-18 20:04:49 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java	2009-05-18 20:27:17 +0000
@@ -444,6 +444,29 @@
     // Public methods
     // -------------------------------------------------------------------------
 
+    public List<ReportTableColumn> getFilledReportTableColumns()
+    {
+        List<String> columns = getAllColumns();
+        
+        List<ReportTableColumn> displayColumns = new ArrayList<ReportTableColumn>( getDisplayColumns() );
+        
+        for ( String column : columns )
+        {
+            if ( !hasDisplayColumn( column ) )
+            {
+                ReportTableColumn displayColumn = new ReportTableColumn();
+                
+                displayColumn.setName( column );
+                displayColumn.setHeader( column );
+                displayColumn.setHidden( true );
+                
+                displayColumns.add( displayColumn );
+            }
+        }
+        
+        return displayColumns;
+    }
+    
     public List<String> getAllColumns()
     {
         List<String> columns = new ArrayList<String>();

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableService.java	2009-05-18 20:04:49 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableService.java	2009-05-18 20:27:17 +0000
@@ -122,13 +122,4 @@
      * @return a ReportTableData object.
      */
     ReportTableData getReportTableData( int id );
-    
-    /**
-     * Returns a list with ReportTableColumns for the ReportTable with the given
-     * identifier. ReportTableColumns are generated and injected where missing.
-     * 
-     * @param id the identifier of the ReportTable.
-     * @return a list of ReportTableColumns.
-     */
-    List<ReportTableColumn> getFilledReportTableColumns( int id );
 }

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java	2009-05-18 20:04:49 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java	2009-05-18 20:27:17 +0000
@@ -41,7 +41,6 @@
 import org.hisp.dhis.period.RelativePeriodType;
 import org.hisp.dhis.reporttable.RelativePeriods;
 import org.hisp.dhis.reporttable.ReportTable;
-import org.hisp.dhis.reporttable.ReportTableColumn;
 import org.hisp.dhis.reporttable.ReportTableData;
 import org.hisp.dhis.reporttable.ReportTableService;
 import org.hisp.dhis.reporttable.ReportTableStore;
@@ -290,33 +289,6 @@
         return reportTableManager.getReportTableData( reportTable );
     }
     
-    public List<ReportTableColumn> getFilledReportTableColumns( int id )
-    {
-        ReportTable reportTable = getReportTable( id );
-        
-        reportTable.init();
-        
-        List<String> columns = reportTable.getAllColumns();
-        
-        List<ReportTableColumn> displayColumns = new ArrayList<ReportTableColumn>( reportTable.getDisplayColumns() );
-        
-        for ( String column : columns )
-        {
-            if ( !reportTable.hasDisplayColumn( column ) )
-            {
-                ReportTableColumn displayColumn = new ReportTableColumn();
-                
-                displayColumn.setName( column );
-                displayColumn.setHeader( column );
-                displayColumn.setHidden( true );
-                
-                displayColumns.add( displayColumn );
-            }
-        }
-        
-        return displayColumns;
-    }
-    
     // -------------------------------------------------------------------------
     // Supportive methods
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetDisplayTableOptionsAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetDisplayTableOptionsAction.java	2009-05-18 20:04:49 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetDisplayTableOptionsAction.java	2009-05-18 20:27:17 +0000
@@ -43,7 +43,9 @@
     {
         reportTable = reportTableService.getReportTable( id );
         
-        columns = reportTableService.getFilledReportTableColumns( id );
+        reportTable.init();
+        
+        columns = reportTable.getFilledReportTableColumns();
         
         return SUCCESS;
     }



--
Trunk
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.