← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19971: Reverted r 19969

 

------------------------------------------------------------
revno: 19971
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-09-03 17:25:27 +0200
message:
  Reverted r 19969
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseAnalyticalObject.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/EventAnalyticalObject.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/QueryItem.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/EventAnalyticsService.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/EventAnalyticsController.java


--
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/common/BaseAnalyticalObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseAnalyticalObject.java	2015-09-03 14:31:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseAnalyticalObject.java	2015-09-03 15:25:27 +0000
@@ -74,7 +74,6 @@
 import org.hisp.dhis.period.RelativePeriods;
 import org.hisp.dhis.period.comparator.AscendingPeriodComparator;
 import org.hisp.dhis.program.Program;
-import org.hisp.dhis.program.ProgramIndicator;
 import org.hisp.dhis.trackedentity.TrackedEntityAttributeDimension;
 import org.hisp.dhis.trackedentity.TrackedEntityDataElementDimension;
 import org.hisp.dhis.user.User;
@@ -158,9 +157,6 @@
     @Scanned
     protected List<OrganisationUnitGroup> itemOrganisationUnitGroups = new ArrayList<>();
 
-    @Scanned
-    protected List<ProgramIndicator> itemProgramIndicators = new ArrayList<>();
-    
     protected String digitGroupSeparator;
 
     protected int sortOrder;
@@ -223,11 +219,6 @@
         return itemOrganisationUnitGroups != null && !itemOrganisationUnitGroups.isEmpty();
     }
     
-    public boolean hasItemProgramIndicators()
-    {
-        return itemProgramIndicators != null && !itemProgramIndicators.isEmpty();
-    }
-    
     public boolean hasSortOrder()
     {
         return sortOrder != 0;
@@ -849,7 +840,6 @@
         userOrganisationUnitChildren = false;
         userOrganisationUnitGrandChildren = false;
         itemOrganisationUnitGroups.clear();
-        itemProgramIndicators.clear();
     }
 
     @Override
@@ -889,7 +879,6 @@
             userOrganisationUnitChildren = object.isUserOrganisationUnitChildren();
             userOrganisationUnitGrandChildren = object.isUserOrganisationUnitGrandChildren();
             itemOrganisationUnitGroups = object.getItemOrganisationUnitGroups();
-            itemProgramIndicators = object.getItemProgramIndicators();
             digitGroupSeparator = object.getDigitGroupSeparator();
             userOrganisationUnit = object.isUserOrganisationUnit();
             sortOrder = object.getSortOrder();
@@ -1125,20 +1114,6 @@
     }
 
     @JsonProperty
-    @JsonView( { DetailedView.class, ExportView.class } )
-    @JacksonXmlElementWrapper( localName = "itemProgramIndicators", namespace = DxfNamespaces.DXF_2_0 )
-    @JacksonXmlProperty( localName = "itemProgramIndicator", namespace = DxfNamespaces.DXF_2_0 )
-    public List<ProgramIndicator> getItemProgramIndicators()
-    {
-        return itemProgramIndicators;
-    }
-
-    public void setItemProgramIndicators( List<ProgramIndicator> itemProgramIndicators )
-    {
-        this.itemProgramIndicators = itemProgramIndicators;
-    }
-
-    @JsonProperty
     @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public String getDigitGroupSeparator()

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/EventAnalyticalObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/EventAnalyticalObject.java	2015-09-03 14:31:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/EventAnalyticalObject.java	2015-09-03 15:25:27 +0000
@@ -29,12 +29,10 @@
  */
 
 import java.util.Date;
-import java.util.List;
 
 import org.hisp.dhis.analytics.EventOutputType;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.program.Program;
-import org.hisp.dhis.program.ProgramIndicator;
 import org.hisp.dhis.program.ProgramStage;
 import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
 
@@ -62,15 +60,11 @@
     // Base class emulation methods
     // -------------------------------------------------------------------------
     
-    List<ProgramIndicator> getItemProgramIndicators();
-    
-    void setItemProgramIndicators( List<ProgramIndicator> itemProgramIndicators );
-    
     DataElement getDataElementValueDimension();
 
     void setDataElementValueDimension( DataElement dataElementValueDimension );
 
     TrackedEntityAttribute getAttributeValueDimension();
     
-    void setAttributeValueDimension( TrackedEntityAttribute attributeValueDimension );
+    void setAttributeValueDimension( TrackedEntityAttribute attributeValueDimension );   
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/QueryItem.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/QueryItem.java	2015-09-03 14:31:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/QueryItem.java	2015-09-03 15:25:27 +0000
@@ -111,7 +111,7 @@
 
     public String getTypeAsString()
     {
-        return valueType.getJavaClass().getName();
+        return valueType.getJavaClass().toString();
     }
 
     public boolean isNumeric()

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/EventAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/EventAnalyticsService.java	2015-09-03 14:31:20 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/EventAnalyticsService.java	2015-09-03 15:25:27 +0000
@@ -88,7 +88,6 @@
      * @param endDate the end date.
      * @param dimension the set of dimensions.
      * @param filter the set of filters.
-     * @param indicator the set of program indicators.
      * @param ouMode the organisation unit mode.
      * @param asc the dimensions to be sorted ascending.
      * @param desc the dimensions to be sorted descending.
@@ -101,15 +100,9 @@
      * @param pageSize the page size.
      * @param format the i18n format.
      */
-    EventQueryParams getFromUrl( String program, String stage, String startDate, String endDate, Set<String> dimension, Set<String> filter, Set<String> indicator,
+    EventQueryParams getFromUrl( String program, String stage, String startDate, String endDate, Set<String> dimension, Set<String> filter, 
         String ouMode, Set<String> asc, Set<String> desc, boolean skipMeta, boolean skipData, boolean hierarchyMeta, boolean coordinatesOnly, 
         DisplayProperty displayProperty, Integer page, Integer pageSize, I18nFormat format );
     
-    /**
-     * Get query from event analytical object.
-     * 
-     * @param object the event analytical object.
-     * @param format the i18n format.
-     */
     EventQueryParams getFromAnalyticalObject( EventAnalyticalObject object, I18nFormat format );
 }

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java	2015-09-03 14:31:20 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java	2015-09-03 15:25:27 +0000
@@ -85,8 +85,6 @@
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.program.Program;
-import org.hisp.dhis.program.ProgramIndicator;
-import org.hisp.dhis.program.ProgramIndicatorService;
 import org.hisp.dhis.program.ProgramService;
 import org.hisp.dhis.program.ProgramStage;
 import org.hisp.dhis.program.ProgramStageService;
@@ -129,16 +127,13 @@
 
     @Autowired
     private DataElementService dataElementService;
-    
-    @Autowired
-    private ProgramIndicatorService programIndicatorService;
-    
+
     @Autowired
     private TrackedEntityAttributeService attributeService;
     
     @Autowired
     private OrganisationUnitService organisationUnitService;
-    
+
     @Autowired
     private LegendService legendService;
 
@@ -322,11 +317,6 @@
         {
             grid.addHeader( new GridHeader( item.getItem().getUid(), item.getItem().getName(), item.getTypeAsString(), false, true, item.getOptionSetUid(), item.getLegendSetUid() ) );
         }
-        
-        for ( ProgramIndicator in : params.getItemProgramIndicators() )
-        {
-            grid.addHeader( new GridHeader( in.getUid(), in.getName(), Double.class.getName(), false, true ) );
-        }
 
         // ---------------------------------------------------------------------
         // Data
@@ -389,7 +379,7 @@
         boolean hierarchyMeta, boolean showHierarchy, SortOrder sortOrder, Integer limit, EventOutputType outputType, boolean collapseDataDimensions, 
         boolean aggregateData, DisplayProperty displayProperty, I18nFormat format )
     {
-        EventQueryParams params = getFromUrl( program, stage, startDate, endDate, dimension, filter, null, null, null, null,
+        EventQueryParams params = getFromUrl( program, stage, startDate, endDate, dimension, filter, null, null, null,
             skipMeta, skipData, hierarchyMeta, false, displayProperty, null, null, format );
                 
         params.setValue( getValueDimension( value ) );
@@ -407,9 +397,8 @@
 
     @Override
     public EventQueryParams getFromUrl( String program, String stage, String startDate, String endDate,
-        Set<String> dimension, Set<String> filter, Set<String> indicator, String ouMode, Set<String> asc, Set<String> desc,
-        boolean skipMeta, boolean skipData, boolean hierarchyMeta, boolean coordinatesOnly, 
-        DisplayProperty displayProperty, Integer page, Integer pageSize, I18nFormat format )
+        Set<String> dimension, Set<String> filter, String ouMode, Set<String> asc, Set<String> desc,
+        boolean skipMeta, boolean skipData, boolean hierarchyMeta, boolean coordinatesOnly, DisplayProperty displayProperty, Integer page, Integer pageSize, I18nFormat format )
     {
         EventQueryParams params = new EventQueryParams();
 
@@ -480,19 +469,6 @@
                 }
             }
         }
-        
-        if ( indicator != null )
-        {
-            for ( String uid : indicator )
-            {
-                ProgramIndicator in = programIndicatorService.getProgramIndicatorByUid( uid );
-                
-                if ( in != null )
-                {
-                    params.getItemProgramIndicators().add( in );
-                }
-            }
-        }
 
         if ( asc != null )
         {
@@ -566,11 +542,6 @@
                     params.getItemFilters().add( getQueryItem( filter.getDimension(), filter.getFilter() ) );
                 }
             }
-            
-            for ( ProgramIndicator in : object.getItemProgramIndicators() )
-            {
-                params.getItemProgramIndicators().add( in );
-            }
 
             params.setProgram( object.getProgram() );
             params.setProgramStage( object.getProgramStage() );

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java	2015-09-03 14:31:20 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java	2015-09-03 15:25:27 +0000
@@ -50,7 +50,6 @@
 import org.hisp.dhis.common.DimensionType;
 import org.hisp.dhis.common.DimensionalObject;
 import org.hisp.dhis.common.Grid;
-import org.hisp.dhis.common.GridHeader;
 import org.hisp.dhis.common.NameableObject;
 import org.hisp.dhis.common.QueryFilter;
 import org.hisp.dhis.common.QueryItem;
@@ -62,7 +61,6 @@
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.program.ProgramIndicator;
 import org.hisp.dhis.program.ProgramIndicatorService;
-import org.hisp.dhis.system.util.MathUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.BadSqlGrammarException;
 import org.springframework.jdbc.core.JdbcTemplate;
@@ -275,6 +273,8 @@
 
     private void getEvents( Grid grid, EventQueryParams params, String sql )
     {
+        int rowLength = grid.getHeaders().size();
+
         SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql );
 
         log.debug( "Analytics event query SQL: " + sql );
@@ -283,22 +283,11 @@
         {
             grid.addRow();
             
-            int index = 1;
-            
-            for ( GridHeader header : grid.getHeaders() )
+            for ( int i = 0; i < rowLength; i++ )
             {
-                if ( Double.class.getName().equals( header.getType() ) )
-                {
-                    double val = rowSet.getDouble( index );
-                    
-                    grid.addValue( params.isSkipRounding() ? val : MathUtils.getRounded( val ) );
-                }
-                else
-                {                
-                    grid.addValue( rowSet.getString( index ) );
-                }
+                int index = i + 1;
                 
-                index++;
+                grid.addValue( rowSet.getString( index ) );
             }
         }
     }
@@ -401,11 +390,6 @@
             sql += statementBuilder.columnQuote( queryItem.getItemName() ) + ",";
         }
         
-        for ( ProgramIndicator in : params.getItemProgramIndicators() )
-        {
-            sql += "(" + programIndicatorService.getAnalyticsSQl( in.getExpression() ) + "),";
-        }
-        
         return removeLastComma( sql );
     }
 

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java	2015-09-03 14:31:20 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java	2015-09-03 15:25:27 +0000
@@ -173,8 +173,6 @@
                 "and ( dv.value != '0' or de.aggregationtype in ('" + AGGREGATION_OPERATOR_AVERAGE + ',' + AGGREGATION_OPERATOR_AVERAGE_SUM + "') " +
                 "or de.zeroissignificant = true ) ";
             
-            //TODO upgrade to ValueType enum when database column has been renamed
-            
             populateTable( table, "cast(dv.value as " + dbl + ")", "null", DataElement.VALUE_TYPE_INT, intClause, approvalClause );
             
             populateTable( table, "1", "null", DataElement.VALUE_TYPE_BOOL, "dv.value = 'true'", approvalClause );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/EventAnalyticsController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/EventAnalyticsController.java	2015-09-03 14:31:20 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/EventAnalyticsController.java	2015-09-03 15:25:27 +0000
@@ -254,7 +254,6 @@
         @RequestParam( required = false ) String endDate,
         @RequestParam Set<String> dimension,
         @RequestParam( required = false ) Set<String> filter,
-        @RequestParam( required = false ) Set<String> indicator,
         @RequestParam( required = false ) String ouMode,
         @RequestParam( required = false ) Set<String> asc,
         @RequestParam( required = false ) Set<String> desc,
@@ -268,7 +267,7 @@
         Model model,
         HttpServletResponse response ) throws Exception
     {
-        EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter, indicator, ouMode,
+        EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter, ouMode,
             asc, desc, skipMeta, skipData, hierarchyMeta, coordinatesOnly, displayProperty, page, pageSize, i18nManager.getI18nFormat() );
 
         contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_JSON, CacheStrategy.RESPECT_SYSTEM_SETTING );
@@ -286,7 +285,6 @@
         @RequestParam( required = false ) String endDate,
         @RequestParam Set<String> dimension,
         @RequestParam( required = false ) Set<String> filter,
-        @RequestParam( required = false ) Set<String> indicator,
         @RequestParam( required = false ) String ouMode,
         @RequestParam( required = false ) Set<String> asc,
         @RequestParam( required = false ) Set<String> desc,
@@ -300,7 +298,7 @@
         Model model,
         HttpServletResponse response ) throws Exception
     {
-        EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter, indicator,
+        EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter,
             ouMode, asc, desc, skipMeta, skipData, hierarchyMeta, coordinatesOnly, displayProperty, page, pageSize, i18nManager.getI18nFormat() );
 
         contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_XML, CacheStrategy.RESPECT_SYSTEM_SETTING, "events.xml", false );
@@ -316,7 +314,6 @@
         @RequestParam( required = false ) String endDate,
         @RequestParam Set<String> dimension,
         @RequestParam( required = false ) Set<String> filter,
-        @RequestParam( required = false ) Set<String> indicator,
         @RequestParam( required = false ) String ouMode,
         @RequestParam( required = false ) Set<String> asc,
         @RequestParam( required = false ) Set<String> desc,
@@ -330,7 +327,7 @@
         Model model,
         HttpServletResponse response ) throws Exception
     {
-        EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter, indicator,
+        EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter,
             ouMode, asc, desc, skipMeta, skipData, hierarchyMeta, coordinatesOnly, displayProperty, page, pageSize, i18nManager.getI18nFormat() );
 
         contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_EXCEL, CacheStrategy.RESPECT_SYSTEM_SETTING, "events.xls", true );
@@ -346,7 +343,6 @@
         @RequestParam( required = false ) String endDate,
         @RequestParam Set<String> dimension,
         @RequestParam( required = false ) Set<String> filter,
-        @RequestParam( required = false ) Set<String> indicator,
         @RequestParam( required = false ) String ouMode,
         @RequestParam( required = false ) Set<String> asc,
         @RequestParam( required = false ) Set<String> desc,
@@ -360,7 +356,7 @@
         Model model,
         HttpServletResponse response ) throws Exception
     {
-        EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter, indicator,
+        EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter,
             ouMode, asc, desc, skipMeta, skipData, hierarchyMeta, coordinatesOnly, displayProperty, page, pageSize, i18nManager.getI18nFormat() );
 
         contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_CSV, CacheStrategy.RESPECT_SYSTEM_SETTING, "events.csv", true );
@@ -376,7 +372,6 @@
         @RequestParam( required = false ) String endDate,
         @RequestParam Set<String> dimension,
         @RequestParam( required = false ) Set<String> filter,
-        @RequestParam( required = false ) Set<String> indicator,
         @RequestParam( required = false ) String ouMode,
         @RequestParam( required = false ) Set<String> asc,
         @RequestParam( required = false ) Set<String> desc,
@@ -390,7 +385,7 @@
         Model model,
         HttpServletResponse response ) throws Exception
     {
-        EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter, indicator,
+        EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter,
             ouMode, asc, desc, skipMeta, skipData, hierarchyMeta, coordinatesOnly, displayProperty, page, pageSize, i18nManager.getI18nFormat() );
 
         contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_HTML, CacheStrategy.RESPECT_SYSTEM_SETTING, "events.html", false );