← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16631: local/in PBF work in progress

 

------------------------------------------------------------
revno: 16631
committer: Mithilesh Kumar Thakur <mithilesh.hisp@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-09-05 06:06:07 +0100
message:
  local/in PBF work in progress
modified:
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportModel.java
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportService.java
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportStore.java
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportType.java
  local/in/dhis-in-services/dhis-in-service-reports/pom.xml
  local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java
  local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/hibernate/HibernateReportStore.java
  local/in/dhis-in-services/dhis-in-service-survey/pom.xml
  local/in/dhis-in-services/dhis-service-aggregationengine/pom.xml
  local/in/dhis-in-services/dhis-service-aggregationengine/src/main/java/org/hisp/dhis/aggregation/impl/indicator/IndicatorAggregation.java
  local/in/dhis-in-services/dhis-service-aggregationengine/src/main/resources/META-INF/dhis/beans.xml
  local/in/dhis-in-services/pom.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 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportModel.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportModel.java	2010-12-29 07:57:25 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportModel.java	2014-09-05 05:06:07 +0000
@@ -33,8 +33,9 @@
 public class ReportModel 
 {
 
-    public final static String RM_STATIC = "static";
-        
+    public final static String RM_STATIC = "STATIC";
+    
+    /*
     public final static String RM_DYNAMIC_WITH_ROOT = "dynamicwithrootfacility";
         
     public final static String RM_DYNAMIC_WITHOUT_ROOT = "dynamicwithoutroot";
@@ -54,6 +55,7 @@
     public final static String RM_PROGRESSIVE_ORGUNIT = "PROGRESSIVE-ORGUNIT";
     
     public final static String RM_PROGRESSIVE_PERIOD = "PROGRESSIVE-PERIOD";
+    */
     
         
     public static List<String> getReportModels()
@@ -61,7 +63,7 @@
         List<String> reportModels = new ArrayList<String>();
 
         reportModels.add( RM_STATIC );
-        
+        /*
         reportModels.add( RM_STATIC_DATAELEMENTS );
         
         reportModels.add( RM_STATIC_FINANCIAL );
@@ -81,7 +83,8 @@
         reportModels.add( RM_PROGRESSIVE_ORGUNIT );
         
         reportModels.add( RM_PROGRESSIVE_PERIOD );
-
+        */
+        
         return reportModels;            
     }
         

=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportService.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportService.java	2012-07-26 09:20:56 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportService.java	2014-09-05 05:06:07 +0000
@@ -58,6 +58,8 @@
     Report_in getReportByName( String name );
 
     Collection<Report_in> getReportBySource( OrganisationUnit source );
+    
+    Collection<Report_in> getReportBySourceAndReportType( OrganisationUnit source, String reportType  );
 
     Collection<Report_in> getAllReports();
 

=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportStore.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportStore.java	2012-04-16 11:29:53 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportStore.java	2014-09-05 05:06:07 +0000
@@ -51,6 +51,8 @@
     Report_in getReportByName( String name );
 
     Collection<Report_in> getReportBySource( OrganisationUnit source );
+    
+    Collection<Report_in> getReportBySourceAndReportType( OrganisationUnit source, String reportType  );
 
     Collection<Report_in> getAllReports();
 

=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportType.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportType.java	2012-07-24 12:38:31 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/ReportType.java	2014-09-05 05:06:07 +0000
@@ -32,6 +32,7 @@
 
 public class ReportType
 {
+    /*
     public final static String RT_ROUTINE = "Routine";
 
     public final static String RT_LINELIST = "Linelisting";
@@ -67,11 +68,14 @@
     public final static String RT_RANKING_REPORT = "Ranking Reports";
 
     public final static String RT_FEEDBACK_TEMPLATE = "Feedback Template";
+    */
+    
+    public final static String RT_BIRT = "Birt Report";
 
     public static List<String> getReportTypes()
     {
         List<String> reportTypes = new ArrayList<String>();
-
+        /*
         reportTypes.add( RT_AGGREGATION );
         
         reportTypes.add( RT_FEEDBACK );
@@ -107,6 +111,9 @@
         reportTypes.add( RT_RANKING_REPORT);
 
         reportTypes.add(RT_FEEDBACK_TEMPLATE);
+        */
+        
+        reportTypes.add(RT_BIRT);
         
         return reportTypes;
     }

=== modified file 'local/in/dhis-in-services/dhis-in-service-reports/pom.xml'
--- local/in/dhis-in-services/dhis-in-service-reports/pom.xml	2014-01-10 07:08:30 +0000
+++ local/in/dhis-in-services/dhis-in-service-reports/pom.xml	2014-09-05 05:06:07 +0000
@@ -6,7 +6,7 @@
 	<parent>
 		<groupId>org.hisp.dhis</groupId>
 		<artifactId>dhis-in-services</artifactId>
-		<version>2.15-SNAPSHOT</version>
+		<version>2.17-SNAPSHOT</version>
 	</parent>
   
   <artifactId>dhis-in-service-reports</artifactId>

=== modified file 'local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java'
--- local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java	2012-07-27 12:16:33 +0000
+++ local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java	2014-09-05 05:06:07 +0000
@@ -220,6 +220,12 @@
     }
 
     @Transactional
+    public Collection<Report_in> getReportBySourceAndReportType( OrganisationUnit source, String reportType  )
+    {
+        return reportStore.getReportBySourceAndReportType( source, reportType );
+    }    
+   
+    @Transactional
     public Collection<Report_in> getReportsByPeriodAndReportType( PeriodType periodType, String reportType )
     {
         return reportStore.getReportsByPeriodAndReportType( periodType, reportType );
@@ -867,13 +873,13 @@
                         tempPeriod = (Period) periodList.get( 0 );
                     }
 
-                    DataValue dataValue = dataValueService.getDataValue( organisationUnit, dataElement, tempPeriod,
-                        optionCombo );
-
+                    //DataValue dataValue = dataValueService.getDataValue( organisationUnit, dataElement, tempPeriod, optionCombo );
+                    DataValue dataValue = dataValueService.getDataValue( dataElement, tempPeriod, organisationUnit, optionCombo );
+                    
                     if ( dataValue != null && dataValue.getValue() != null )
                     {
                         replaceString = dataValue.getValue();
-                    }
+                    } 
                     else
                     {
                         replaceString = "";
@@ -1015,8 +1021,8 @@
                         double aggregatedValue = 0.0;
                         for ( Period tempPeriod : periodList )
                         {
-                            DataValue dataValue = dataValueService.getDataValue( organisationUnit, dataElement,
-                                tempPeriod, optionCombo );
+                            //DataValue dataValue = dataValueService.getDataValue( organisationUnit, dataElement,  tempPeriod, optionCombo );
+                            DataValue dataValue = dataValueService.getDataValue( dataElement, tempPeriod, organisationUnit, optionCombo );
 
                             if ( dataValue != null )
                             {
@@ -1047,8 +1053,8 @@
                         tempPeriod = (Period) periodList.get( 0 );
                     }
 
-                    DataValue dataValue = dataValueService.getDataValue( organisationUnit, dataElement, tempPeriod,
-                        optionCombo );
+                    //DataValue dataValue = dataValueService.getDataValue( organisationUnit, dataElement, tempPeriod, optionCombo );
+                    DataValue dataValue = dataValueService.getDataValue( dataElement, tempPeriod, organisationUnit, optionCombo );
 
                     if ( dataValue != null )
                     {
@@ -1197,8 +1203,8 @@
                         tempPeriod = (Period) periodList.get( 0 );
                     }
 
-                    DataValue dataValue = dataValueService.getDataValue( organisationUnit, dataElement, tempPeriod,
-                        optionCombo );
+                    //DataValue dataValue = dataValueService.getDataValue( organisationUnit, dataElement, tempPeriod, optionCombo );
+                    DataValue dataValue = dataValueService.getDataValue( dataElement, tempPeriod, organisationUnit, optionCombo );
 
                     if ( dataValue != null )
                     {
@@ -2030,9 +2036,10 @@
                         tempPeriod = periodService.getPeriod( periodIds.iterator().next() );
                     }
 
-                    DataValue dataValue = dataValueService.getDataValue( organisationUnit, dataElement, tempPeriod,
-                        optionCombo );
-
+                    //DataValue dataValue = dataValueService.getDataValue( organisationUnit, dataElement, tempPeriod, optionCombo );
+                    
+                    DataValue dataValue = dataValueService.getDataValue( dataElement, tempPeriod, organisationUnit, optionCombo );
+                    
                     if ( dataValue != null && dataValue.getValue() != null )
                     {
                         replaceString = dataValue.getValue();

=== modified file 'local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/hibernate/HibernateReportStore.java'
--- local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/hibernate/HibernateReportStore.java	2011-04-27 17:15:13 +0000
+++ local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/hibernate/HibernateReportStore.java	2014-09-05 05:06:07 +0000
@@ -106,6 +106,23 @@
     }
 
     @SuppressWarnings( "unchecked" )
+    public Collection<Report_in> getReportBySourceAndReportType( OrganisationUnit source, String reportType )
+    {
+        Session session = sessionFactory.getCurrentSession();
+
+        Criteria criteria = session.createCriteria( Report_in.class );
+        criteria.createAlias( "sources", "s" );
+        criteria.add( Restrictions.eq( "s.id", source.getId() ) );
+        
+        criteria.add( Restrictions.eq( "reportType", reportType ) );
+
+        return criteria.list();
+    }
+    
+    
+    
+    
+    @SuppressWarnings( "unchecked" )
     public Collection<Report_in> getReportsByPeriodAndReportType( PeriodType periodType, String reportType )
     {
         Session session = sessionFactory.getCurrentSession();

=== modified file 'local/in/dhis-in-services/dhis-in-service-survey/pom.xml'
--- local/in/dhis-in-services/dhis-in-service-survey/pom.xml	2014-01-10 07:08:30 +0000
+++ local/in/dhis-in-services/dhis-in-service-survey/pom.xml	2014-09-05 05:06:07 +0000
@@ -6,7 +6,7 @@
 	<parent>
 		<groupId>org.hisp.dhis</groupId>
 		<artifactId>dhis-in-services</artifactId>
-		<version>2.15-SNAPSHOT</version>
+		<version>2.17-SNAPSHOT</version>
 	</parent>
 	
 	<artifactId>dhis-in-service-survey</artifactId>

=== modified file 'local/in/dhis-in-services/dhis-service-aggregationengine/pom.xml'
--- local/in/dhis-in-services/dhis-service-aggregationengine/pom.xml	2014-01-10 07:08:30 +0000
+++ local/in/dhis-in-services/dhis-service-aggregationengine/pom.xml	2014-09-05 05:06:07 +0000
@@ -5,8 +5,8 @@
   
   <parent>
     <groupId>org.hisp.dhis</groupId>
-    <artifactId>dhis-services</artifactId>
-    <version>2.15-SNAPSHOT</version>
+    <artifactId>dhis-in-services</artifactId>
+    <version>2.17-SNAPSHOT</version>
   </parent>
   
   <artifactId>dhis-service-aggregationengine-default</artifactId>
@@ -27,12 +27,12 @@
     </dependency>
     
     <!-- Other -->
-    
+    <!--
     <dependency>
       <groupId>jep</groupId>
       <artifactId>jep</artifactId>
     </dependency>    
-    
+    -->
   </dependencies>
   <properties>
     <rootDir>../../</rootDir>

=== modified file 'local/in/dhis-in-services/dhis-service-aggregationengine/src/main/java/org/hisp/dhis/aggregation/impl/indicator/IndicatorAggregation.java'
--- local/in/dhis-in-services/dhis-service-aggregationengine/src/main/java/org/hisp/dhis/aggregation/impl/indicator/IndicatorAggregation.java	2013-08-23 16:05:01 +0000
+++ local/in/dhis-in-services/dhis-service-aggregationengine/src/main/java/org/hisp/dhis/aggregation/impl/indicator/IndicatorAggregation.java	2014-09-05 05:06:07 +0000
@@ -29,7 +29,6 @@
  */
 
 import static org.hisp.dhis.system.util.DateUtils.daysBetween;
-import static org.hisp.dhis.system.util.MathUtils.INVALID;
 import static org.hisp.dhis.system.util.MathUtils.calculateExpression;
 
 import java.util.Date;
@@ -37,7 +36,6 @@
 import java.util.Map;
 import java.util.Set;
 
-import org.hisp.dhis.aggregation.impl.cache.AggregationCache;
 import org.hisp.dhis.constant.ConstantService;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
@@ -58,13 +56,14 @@
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
-    
+    /*
     private AggregationCache aggregationCache;
 
     public void setAggregationCache( AggregationCache aggregationCache )
     {
         this.aggregationCache = aggregationCache;
     }    
+    */
     
     private DataElementService dataElementService;
     
@@ -106,7 +105,8 @@
         double denominatorValue = calculateExpression( generateExpression( indicator.getDenominator(),
             startDate, endDate, organisationUnit, days ) );
         
-        if ( denominatorValue == INVALID || denominatorValue == 0.0 )
+        
+        if (  denominatorValue == 0.0 )
         {
             return null;
         }
@@ -114,7 +114,7 @@
         double numeratorValue = calculateExpression( generateExpression( indicator.getNumerator(), startDate,
             endDate, organisationUnit, days ) );
         
-        if ( numeratorValue == INVALID )
+        if ( numeratorValue == 0.0 )
         {
             return null;
         }
@@ -150,6 +150,8 @@
     {
         Map<String, Double> constantMap = constantService.getConstantMap();
         
+        Map<String, Integer> constantMap1 = new HashMap<String, Integer>();
+        
         Set<DataElementOperand> operands = expressionService.getOperandsInExpression( expression );
         
         Map<DataElementOperand, Double> valueMap = new HashMap<DataElementOperand, Double>();
@@ -159,9 +161,11 @@
             DataElement dataElement = dataElementService.getDataElement( operand.getDataElementId() );
             DataElementCategoryOptionCombo optionCombo = !operand.isTotal() ? categoryService.getDataElementCategoryOptionCombo( operand.getOptionComboId() ) : null;
 
-            valueMap.put( operand, aggregationCache.getAggregatedDataValue( dataElement, optionCombo, startDate, endDate, organisationUnit ) );            
+            //valueMap.put( operand, aggregationCache.getAggregatedDataValue( dataElement, optionCombo, startDate, endDate, organisationUnit ) );            
         }
         
-        return expressionService.generateExpression( expression, valueMap, constantMap, null, false );
+        return expressionService.generateExpression( expression, valueMap, constantMap, constantMap1, null, false );
+        
+        //return expressionService.generateExpression( expression, valueMap, constantMap, null, false );
     }
 }

=== modified file 'local/in/dhis-in-services/dhis-service-aggregationengine/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-in-services/dhis-service-aggregationengine/src/main/resources/META-INF/dhis/beans.xml	2012-12-14 13:46:47 +0000
+++ local/in/dhis-in-services/dhis-service-aggregationengine/src/main/resources/META-INF/dhis/beans.xml	2014-09-05 05:06:07 +0000
@@ -62,7 +62,7 @@
     <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
     <property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
     <property name="expressionService" ref="org.hisp.dhis.expression.ExpressionService" />
-    <property name="aggregationCache" ref="org.hisp.dhis.aggregation.impl.cache.AggregationCache" />
+    <!--<property name="aggregationCache" ref="org.hisp.dhis.aggregation.impl.cache.AggregationCache" />-->
     <property name="constantService" ref="org.hisp.dhis.constant.ConstantService" />
   </bean>
 

=== modified file 'local/in/dhis-in-services/pom.xml'
--- local/in/dhis-in-services/pom.xml	2014-07-25 10:59:27 +0000
+++ local/in/dhis-in-services/pom.xml	2014-09-05 05:06:07 +0000
@@ -17,13 +17,17 @@
 	<!--
     <module>dhis-in-service-dbmanager</module>
 	<module>dhis-in-service-linelisting</module> 
-	<module>dhis-in-service-reports</module>
-    <module>dhis-in-service-survey</module>
+	
+    
 	<module>dhis-in-service-dataentrystatus</module>-->
 	<!--<module>dhis-service-aggregationengine-default</module>-->
+	<module>dhis-in-service-survey</module>
 	<module>dhis-in-service-configuration</module>
+	<module>dhis-in-service-lookup</module>
+	<module>dhis-in-service-reports</module>
+	<module>dhis-service-aggregationengine</module>
 	<!--<module>dhis-in-service-coldchain</module>-->
-	<module>dhis-in-service-lookup</module>
+	
   </modules>
   
   <dependencies>