← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2031: Fixed bug export PDF for indicator - Replaced the original formula in indicator by text formula

 

------------------------------------------------------------
revno: 2031
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Wed 2010-09-01 14:30:48 +0700
message:
  Fixed bug export PDF for indicator - Replaced the original formula in indicator by text formula
modified:
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/IndicatorConverter.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/exporter/ITextPDFExportService.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/pdf/impl/ItextPdfService.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.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-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/IndicatorConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/IndicatorConverter.java	2010-08-31 09:21:17 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/IndicatorConverter.java	2010-09-01 07:30:48 +0000
@@ -29,6 +29,7 @@
 
 import java.util.Collection;
 
+import org.hisp.dhis.expression.ExpressionService;
 import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.importexport.ExportParams;
 import org.hisp.dhis.importexport.PDFConverter;
@@ -54,9 +55,12 @@
 {
     private IndicatorService indicatorService;
 
-    public IndicatorConverter( IndicatorService indicatorService )
+    private ExpressionService expressionService;
+
+    public IndicatorConverter( IndicatorService indicatorService, ExpressionService expressionService )
     {
         this.indicatorService = indicatorService;
+        this.expressionService = expressionService;
     }
 
     // -------------------------------------------------------------------------
@@ -105,18 +109,19 @@
 
             table.addCell( getItalicCell( i18n.getString( "numerator_aggregation_operator" ), 1, ITALIC ) );
             table.addCell( getTextCell( i18n.getString( indicator.getNumeratorAggregationOperator() ) ) );
-            
+
             table.addCell( getItalicCell( i18n.getString( "numerator_formula" ), 1, ITALIC ) );
-            table.addCell( getTextCell( indicator.getNumerator(), TEXT ) );
+            table.addCell( getTextCell( expressionService.getExpressionDescription( indicator.getNumerator() ), TEXT ) );
 
             table.addCell( getItalicCell( i18n.getString( "denominator_description" ), 1, ITALIC ) );
             table.addCell( getTextCell( indicator.getDenominatorDescription(), TEXT ) );
 
             table.addCell( getItalicCell( i18n.getString( "denominator_aggregation_operator" ), 1, ITALIC ) );
             table.addCell( getTextCell( i18n.getString( indicator.getDenominatorAggregationOperator() ) ) );
-            
+
             table.addCell( getItalicCell( i18n.getString( "denominator_formula" ), 1, ITALIC ) );
-            table.addCell( getTextCell( indicator.getDenominator(), TEXT ) );
+            table
+                .addCell( getTextCell( expressionService.getExpressionDescription( indicator.getDenominator() ), TEXT ) );
 
             table.addCell( getCell( 2, 30 ) );
 

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/exporter/ITextPDFExportService.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/exporter/ITextPDFExportService.java	2010-06-03 08:06:09 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/exporter/ITextPDFExportService.java	2010-09-01 07:30:48 +0000
@@ -37,6 +37,7 @@
 
 import org.hibernate.SessionFactory;
 import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.expression.ExpressionService;
 import org.hisp.dhis.importexport.ExportParams;
 import org.hisp.dhis.importexport.ExportService;
 import org.hisp.dhis.importexport.pdf.converter.DataElementConverter;
@@ -83,6 +84,13 @@
         this.organisationUnitService = organisationUnitService;
     }
 
+    private ExpressionService expressionService;
+
+    public void setExpressionService( ExpressionService expressionService )
+    {
+        this.expressionService = expressionService;
+    }
+
     // -------------------------------------------------------------------------
     // ExportService implementation
     // -------------------------------------------------------------------------
@@ -111,7 +119,7 @@
             thread.setExportParams( params );
 
             thread.setDataElementConverter( new DataElementConverter( dataElementService ) );
-            thread.setIndicatorConverter( new IndicatorConverter( indicatorService ) );
+            thread.setIndicatorConverter( new IndicatorConverter( indicatorService, expressionService ) );
             thread.setExtendedDataElementConverter( new ExtendedDataElementConverter( dataElementService ) );
             thread.setOrganisationUnitHierarchyConverter( new OrganisationUnitHierarchyConverter(
                 organisationUnitService ) );

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml	2010-08-31 05:47:11 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml	2010-09-01 07:30:48 +0000
@@ -303,6 +303,8 @@
 		<property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
 		<property name="organisationUnitService"
 			ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+		<property name="expressionService"
+			ref="org.hisp.dhis.expression.ExpressionService" />
 	</bean>
 
 	<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/pdf/impl/ItextPdfService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/pdf/impl/ItextPdfService.java	2010-08-31 09:21:17 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/pdf/impl/ItextPdfService.java	2010-09-01 07:30:48 +0000
@@ -48,6 +48,7 @@
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.expression.ExpressionService;
 import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.indicator.Indicator;
@@ -113,6 +114,13 @@
         this.organisationUnitService = organisationUnitService;
     }
 
+    private ExpressionService expressionService;
+
+    public void setExpressionService( ExpressionService expressionService )
+    {
+        this.expressionService = expressionService;
+    }
+
     // -------------------------------------------------------------------------
     // PdfService implementation
     // -------------------------------------------------------------------------
@@ -195,7 +203,7 @@
             table.addCell( getTextCell( indicator.getNumeratorAggregationOperator(), TEXT ) );
 
             table.addCell( getItalicCell( i18n.getString( "numerator_formula" ), 1, ITALIC ) );
-            table.addCell( getTextCell( indicator.getNumerator(), TEXT ) );
+            table.addCell( getTextCell( expressionService.getExpressionDescription( indicator.getNumerator() ), TEXT ) );
 
             table.addCell( getItalicCell( i18n.getString( "denominator_description" ), 1, ITALIC ) );
             table.addCell( getTextCell( indicator.getDenominatorDescription(), TEXT ) );
@@ -204,7 +212,8 @@
             table.addCell( getTextCell( indicator.getDenominatorAggregationOperator(), TEXT ) );
 
             table.addCell( getItalicCell( i18n.getString( "denominator_formula" ), 1, ITALIC ) );
-            table.addCell( getTextCell( indicator.getDenominator(), TEXT ) );
+            table
+                .addCell( getTextCell( expressionService.getExpressionDescription( indicator.getDenominator() ), TEXT ) );
 
             table.addCell( getCell( 2, 30 ) );
 

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml	2010-08-31 05:47:11 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml	2010-09-01 07:30:48 +0000
@@ -190,6 +190,8 @@
       ref="org.hisp.dhis.indicator.IndicatorService"/>
     <property name="organisationUnitService"
       ref="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
+    <property name="expressionService"
+      ref="org.hisp.dhis.expression.ExpressionService"/>
   </bean>
   
   <!-- Workbook -->

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml	2010-08-28 12:18:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml	2010-09-01 07:30:48 +0000
@@ -409,7 +409,7 @@
 			<result name="success" type="redirect">
 				showSqlViewListForm.action</result>
 			<result name="error" type="redirect">index.action</result>
-			<param name="requiredAuthorities">F_SQLVIEW_ADD</param>
+			<param name="requiredAuthorities">F_SQLVIEW_UPDATE</param>
 		</action>
 		
 		<action name="removeSqlViewObject"