=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2012-07-10 11:18:29 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2012-07-12 09:32:15 +0000 @@ -305,7 +305,16 @@ { return (type != null && type.equals( VALUE_TYPE_STRING ) && textType != null) ? textType : type; } - + + /** Returns whether aggregation should be skipped for this data element, based + * on the setting of the data set which this data element is a members of, + * if any. + */ + public boolean isSkipAggregation() + { + return dataSets != null && dataSets.size() > 0 && dataSets.iterator().next().isSkipAggregation(); + } + /** * Returns the PeriodType of the DataElement, based on the PeriodType of the * DataSet which the DataElement is registered for. === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java 2012-06-26 12:06:43 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java 2012-07-12 09:32:15 +0000 @@ -138,7 +138,12 @@ * How many days after period is over will this dataSet auto-lock */ private int expiryDays; - + + /** + * Property indicating whether aggregation should be skipped. + */ + private boolean skipAggregation; + // ------------------------------------------------------------------------- // Contructors // ------------------------------------------------------------------------- @@ -527,6 +532,19 @@ this.expiryDays = expiryDays; } + @JsonProperty + @JsonView( {DetailedView.class, ExportView.class} ) + @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE ) + public boolean isSkipAggregation() + { + return skipAggregation; + } + + public void setSkipAggregation( boolean skipAggregation ) + { + this.skipAggregation = skipAggregation; + } + @Override public void mergeWith( IdentifiableObject other ) { === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2012-07-10 11:18:29 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2012-07-12 09:32:15 +0000 @@ -445,6 +445,7 @@ executeSql( "delete from systemsetting where name='currentStyle' and value like '%blue/blue.css'" ); executeSql( "update dataentryform set style='regular' where style is null" ); + executeSql( "update dataset set skipaggregation = false where skipaggregation is null" ); log.info( "Tables updated" ); } === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml' --- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml 2012-06-25 20:39:32 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml 2012-07-12 09:32:15 +0000 @@ -66,6 +66,8 @@ + + === modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java' --- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java 2013-01-01 01:19:11 +0000 +++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java 2012-07-12 09:32:15 +0000 @@ -68,6 +68,7 @@ import org.hisp.dhis.scheduling.TaskId; import org.hisp.dhis.setting.SystemSettingManager; import org.hisp.dhis.system.filter.AggregatableDataElementFilter; +import org.hisp.dhis.system.filter.DataElementWithAggregationFilter; import org.hisp.dhis.system.filter.OrganisationUnitAboveOrEqualToLevelFilter; import org.hisp.dhis.system.filter.PastAndCurrentPeriodFilter; import org.hisp.dhis.system.notification.Notifier; @@ -239,6 +240,7 @@ organisationUnitService.filterOrganisationUnitsWithoutData( organisationUnits ); Collections.shuffle( organisationUnits ); FilterUtils.filter( dataElements, new AggregatableDataElementFilter() ); + FilterUtils.filter( dataElements, new DataElementWithAggregationFilter() ); expressionService.filterInvalidIndicators( indicators ); clock.logTime( "Filtered objects" ); === added file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/filter/DataElementWithAggregationFilter.java' --- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/filter/DataElementWithAggregationFilter.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/filter/DataElementWithAggregationFilter.java 2012-07-12 09:32:15 +0000 @@ -0,0 +1,44 @@ +package org.hisp.dhis.system.filter; + +/* + * Copyright (c) 2004-2012, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of the HISP project nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +import org.hisp.dhis.dataelement.DataElement; +import org.hisp.dhis.system.util.Filter; + +/** + * @author Lars Helge Overland + */ +public class DataElementWithAggregationFilter + implements Filter +{ + @Override + public boolean retain( DataElement element ) + { + return element != null && !element.isSkipAggregation(); + } +} === added file 'dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/filter/DataElementWithAggregationFilterTest.java' --- dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/filter/DataElementWithAggregationFilterTest.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/filter/DataElementWithAggregationFilterTest.java 2012-07-12 09:32:15 +0000 @@ -0,0 +1,53 @@ +package org.hisp.dhis.system.filter; + +import static junit.framework.Assert.assertEquals; +import static junit.framework.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.List; + +import org.hisp.dhis.DhisTest; +import org.hisp.dhis.dataelement.DataElement; +import org.hisp.dhis.dataset.DataSet; +import org.hisp.dhis.period.MonthlyPeriodType; +import org.hisp.dhis.system.util.FilterUtils; +import org.junit.Test; + +/** + * @author Lars Helge Overland + * @version $Id$ + */ +public class DataElementWithAggregationFilterTest + extends DhisTest +{ + @Test + public void filter() + { + DataElement elementA = createDataElement( 'A' ); + DataElement elementB = createDataElement( 'B' ); + DataElement elementC = createDataElement( 'C' ); + DataElement elementD = createDataElement( 'D' ); + + DataSet dataSetA = createDataSet( 'A', new MonthlyPeriodType() ); + dataSetA.setSkipAggregation( false ); + dataSetA.addDataElement( elementA ); + dataSetA.addDataElement( elementC ); + + DataSet dataSetB = createDataSet( 'A', new MonthlyPeriodType() ); + dataSetB.setSkipAggregation( true ); + dataSetB.addDataElement( elementB ); + dataSetB.addDataElement( elementD ); + + List list = new ArrayList(); + list.add( elementA ); + list.add( elementB ); + list.add( elementC ); + list.add( elementD ); + + FilterUtils.filter( list, new DataElementWithAggregationFilter() ); + + assertEquals( 2, list.size() ); + assertTrue( list.contains( elementA ) ); + assertTrue( list.contains( elementC ) ); + } +} === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java 2012-06-25 20:39:32 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java 2012-07-12 09:32:15 +0000 @@ -127,6 +127,13 @@ { this.expiryDays = expiryDays; } + + private boolean skipAggregation; + + public void setSkipAggregation( boolean skipAggregation ) + { + this.skipAggregation = skipAggregation; + } private String frequencySelect; @@ -176,6 +183,7 @@ DataSet dataSet = new DataSet( name, shortName, code, periodType ); dataSet.setExpiryDays( expiryDays ); + dataSet.setSkipAggregation( skipAggregation ); for ( String id : dataElementsSelectedList ) { === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java 2012-06-25 20:39:32 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java 2012-07-12 09:32:15 +0000 @@ -139,6 +139,13 @@ this.expiryDays = expiryDays; } + private boolean skipAggregation; + + public void setSkipAggregation( boolean skipAggregation ) + { + this.skipAggregation = skipAggregation; + } + private String frequencySelect; public void setFrequencySelect( String frequencySelect ) @@ -201,6 +208,7 @@ DataSet dataSet = dataSetService.getDataSet( dataSetId ); dataSet.setExpiryDays( expiryDays ); + dataSet.setSkipAggregation( skipAggregation ); if ( !(equalsNullSafe( name, dataSet.getName() ) && periodType.equals( dataSet.getPeriodType() ) && dataElements.equals( dataSet.getDataElements() ) && indicators.equals( dataSet.getIndicators() )) ) === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties 2012-06-25 20:39:32 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties 2012-07-12 09:32:15 +0000 @@ -87,4 +87,5 @@ regular=Regular compact=Compact none=None -allow_future_periods=Allow future periods \ No newline at end of file +allow_future_periods=Allow future periods +skip_aggregation=Skip aggregation \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addDataSet.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addDataSet.vm 2012-06-25 20:39:32 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addDataSet.vm 2012-07-12 09:32:15 +0000 @@ -91,13 +91,22 @@ - #foreach ( $periodType in $periodTypes ) #end + + + + + + $i18n.getString("available_for_mobile_reporting") === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm 2012-06-25 20:39:32 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm 2012-07-12 09:32:15 +0000 @@ -91,13 +91,22 @@ - #foreach ( $periodType in $periodTypes ) #end + + + + + +