← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 775: Implemented Jasper report viewer (jasper-report-viewer).

 

------------------------------------------------------------
revno: 775
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Sun 2009-09-27 15:09:53 +0200
message:
  Implemented Jasper report viewer (jasper-report-viewer).
modified:
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/reportviewer/action/GetAllReportsAction.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.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.
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/reportviewer/action/GetAllReportsAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/reportviewer/action/GetAllReportsAction.java	2009-08-20 08:17:49 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/reportviewer/action/GetAllReportsAction.java	2009-09-27 13:09:53 +0000
@@ -35,6 +35,7 @@
 
 import javax.servlet.http.HttpServletRequest;
 
+import org.hisp.dhis.options.SystemSettingManager;
 import org.hisp.dhis.report.Report;
 import org.hisp.dhis.report.ReportManager;
 import org.hisp.dhis.report.ReportService;
@@ -71,6 +72,13 @@
     {
         this.reportService = reportService;
     }
+    
+    private SystemSettingManager systemSettingManager;
+
+    public void setSystemSettingManager( SystemSettingManager systemSettingManager )
+    {
+        this.systemSettingManager = systemSettingManager;
+    }
 
     // -------------------------------------------------------------------------
     // Output
@@ -90,27 +98,41 @@
     public String execute() 
         throws Exception
     {
-        ReportConfiguration config = reportManager.getConfiguration();
-        
-        String birtHome = config.getHome();
-        
-        String birtDirectory = config.getDirectory();
-
-        HttpServletRequest request = ServletActionContext.getRequest();
-        
-        String birtURL = getBaseUrl( request ) + birtDirectory + SEPARATOR + BASE_QUERY;
-        
-        if ( birtHome != null && birtDirectory != null )
+        String reportFramework = (String) systemSettingManager.getSystemSetting( SystemSettingManager.KEY_REPORT_FRAMEWORK );
+        
+        if ( reportFramework != null && reportFramework.equals( Report.TYPE_JASPER ) )
         {
             for ( Report report : reportService.getAllReports() )
             {
-                String url = birtURL + report.getDesign();
-                
-                report.setUrl( url );
+                report.setUrl( "renderReport.action?template=" + report.getDesign() );
                 
                 reports.add( report );
             }
         }
+        else // BIRT
+        {
+            ReportConfiguration config = reportManager.getConfiguration();
+            
+            String birtHome = config.getHome();
+            
+            String birtDirectory = config.getDirectory();
+    
+            HttpServletRequest request = ServletActionContext.getRequest();
+            
+            String birtURL = getBaseUrl( request ) + birtDirectory + SEPARATOR + BASE_QUERY;
+            
+            if ( birtHome != null && birtDirectory != null )
+            {
+                for ( Report report : reportService.getAllReports() )
+                {
+                    String url = birtURL + report.getDesign();
+                    
+                    report.setUrl( url );
+                    
+                    reports.add( report );
+                }
+            }
+        }
         
         Collections.sort( reports, new ReportComparator() );
         

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml	2009-09-14 16:00:37 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml	2009-09-27 13:09:53 +0000
@@ -327,6 +327,8 @@
       ref="org.hisp.dhis.report.ReportManager"/>
     <property name="reportService"
       ref="org.hisp.dhis.report.ReportService"/>
+    <property name="systemSettingManager"
+      ref="org.hisp.dhis.options.SystemSettingManager"/>
   </bean>
   
   <bean id="org.hisp.dhis.reporting.reportviewer.action.GetReportAction"