← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2877: Removed the silly config file / gui for completeness and replaced with a system setting

 

------------------------------------------------------------
revno: 2877
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-02-18 21:20:07 +0100
message:
  Removed the silly config file / gui for completeness and replaced with a system setting
removed:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessConfiguration.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/action/GetDataCompletenessConfigurationAction.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/action/SetDataCompletenessConfigurationAction.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/configureDataCompletenessForm.vm
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/configureReportForm.vm
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessService.java
  dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/SystemSettingManager.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/impl/AbstractDataSetCompletenessService.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceTest.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/SystemSettingInterceptor.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/manager/DefaultSelectionTreeManager.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/manager/DefaultOrganisationUnitSelectionManager.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/manager/DefaultTreeStateManager.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/SetSystemSettingsAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemSettings.vm
  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/struts.xml
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewDataCompletenessForm.vm


--
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
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessConfiguration.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessConfiguration.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessConfiguration.java	1970-01-01 00:00:00 +0000
@@ -1,91 +0,0 @@
-package org.hisp.dhis.completeness;
-
-/*
- * Copyright (c) 2004-2010, 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 java.io.Serializable;
-import java.util.Calendar;
-import java.util.Date;
-
-import org.hisp.dhis.period.Period;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class DataSetCompletenessConfiguration
-    implements Serializable
-{
-    private Integer days;
-    
-    private Calendar cal = Calendar.getInstance();
-    
-    // -------------------------------------------------------------------------
-    // Constructors
-    // -------------------------------------------------------------------------
-
-    public DataSetCompletenessConfiguration()
-    {
-    }
-    
-    public DataSetCompletenessConfiguration( Integer days )
-    {
-        this.days = days;
-    }
-
-    // -------------------------------------------------------------------------
-    // Logic methods
-    // -------------------------------------------------------------------------
-
-    public Date getDeadline( Period period )
-    {
-        Date date = null;
-        
-        if ( period != null )
-        {
-            if ( days != null && cal != null )
-            {
-                cal.clear();                
-                cal.setTime( period.getEndDate() );                                       
-                cal.add( Calendar.DAY_OF_MONTH, days );
-                
-                date = cal.getTime();
-            }
-            else
-            {
-                date = period.getEndDate();
-            }
-        }
-        
-        return date;
-    }
-
-    // -------------------------------------------------------------------------
-    // Getters
-    // -------------------------------------------------------------------------
-
-    public Integer getDays()
-    {
-        return days;
-    }
-}

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessService.java	2011-02-03 20:42:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessService.java	2011-02-18 20:20:07 +0000
@@ -31,7 +31,6 @@
 import java.util.Date;
 
 import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.external.configuration.NoConfigurationFoundException;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.RelativePeriods;
@@ -102,20 +101,6 @@
     DataSetCompletenessResult getDataSetCompleteness( Period period, Date deadline, OrganisationUnit unit, DataSet dataSet );
     
     /**
-     * Sets the configuration for the data completeness functionality.
-     * @param configuration the configuration object.
-     */
-    void setConfiguration( DataSetCompletenessConfiguration configuration );
-    
-    /**
-     * Gets the configuration for the data completeness functionality.
-     * @return the configuration for the data completeness functionality.
-     * @throws NoConfigurationFoundException
-     */
-    DataSetCompletenessConfiguration getConfiguration()
-        throws NoConfigurationFoundException;
-    
-    /**
      * Creates an index on the aggregateddatasetcompleteness table.
      */
     void createIndex();

=== modified file 'dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/SystemSettingManager.java'
--- dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/SystemSettingManager.java	2011-02-01 11:03:47 +0000
+++ dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/SystemSettingManager.java	2011-02-18 20:20:07 +0000
@@ -53,6 +53,7 @@
     final String KEY_DISABLE_DATAENTRYFORM_WHEN_COMPLETED = "dataEntryFormCompleted";
     final String KEY_FACTOR_OF_DEVIATION = "factorDeviation";
     final String KEY_AGGREGATION_STRATEGY = "aggregationStrategy";
+    final String KEY_COMPLETENESS_OFFSET = "completenessOffset";
     final String KEY_PATIENT_EXCEL_TEMPLATE_FILE_NAME = "patientExcelTemplateFileName";
     
     final String KEY_CHR_IMAGE_DIRECTORY = "chrImageDirectory";
@@ -65,6 +66,7 @@
     final String AGGREGATION_STRATEGY_REAL_TIME = "real_time";
     final String AGGREGATION_STRATEGY_BATCH = "batch";
     final String DEFAULT_AGGREGATION_STRATEGY = AGGREGATION_STRATEGY_REAL_TIME;
+    final int DEFAULT_COMPLETENESS_OFFSET = 15;
     
     void saveSystemSetting( String name, Serializable value );   
 

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/impl/AbstractDataSetCompletenessService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/impl/AbstractDataSetCompletenessService.java	2011-02-03 20:42:05 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/impl/AbstractDataSetCompletenessService.java	2011-02-18 20:20:07 +0000
@@ -27,9 +27,11 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.io.InputStream;
-import java.io.OutputStream;
+import static org.hisp.dhis.options.SystemSettingManager.DEFAULT_COMPLETENESS_OFFSET;
+import static org.hisp.dhis.options.SystemSettingManager.KEY_COMPLETENESS_OFFSET;
+
 import java.util.ArrayList;
+import java.util.Calendar;
 import java.util.Collection;
 import java.util.Date;
 import java.util.List;
@@ -38,17 +40,14 @@
 import org.amplecode.quick.BatchHandlerFactory;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.completeness.DataSetCompletenessConfiguration;
 import org.hisp.dhis.completeness.DataSetCompletenessResult;
 import org.hisp.dhis.completeness.DataSetCompletenessService;
 import org.hisp.dhis.completeness.DataSetCompletenessStore;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.external.configuration.ConfigurationManager;
-import org.hisp.dhis.external.location.LocationManager;
-import org.hisp.dhis.external.location.LocationManagerException;
 import org.hisp.dhis.jdbc.batchhandler.DataSetCompletenessResultBatchHandler;
+import org.hisp.dhis.options.SystemSettingManager;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.Period;
@@ -69,24 +68,6 @@
     private static final Log log = LogFactory.getLog( AbstractDataSetCompletenessService.class );
     
     // -------------------------------------------------------------------------
-    // Properties
-    // -------------------------------------------------------------------------
-
-    private String configDir;
-
-    public void setConfigDir( String configDir )
-    {
-        this.configDir = configDir;
-    }
-    
-    private String configFile;
-
-    public void setConfigFile( String configFile )
-    {
-        this.configFile = configFile;
-    }
-    
-    // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
 
@@ -131,19 +112,12 @@
     {
         this.completenessStore = completenessStore;
     }
-
-    protected LocationManager locationManager;
-
-    public void setLocationManager( LocationManager locationManager )
-    {
-        this.locationManager = locationManager;
-    }
-
-    protected ConfigurationManager<DataSetCompletenessConfiguration> configurationManager;
-
-    public void setConfigurationManager( ConfigurationManager<DataSetCompletenessConfiguration> configurationManager )
-    {
-        this.configurationManager = configurationManager;
+    
+    private SystemSettingManager systemSettingManager;
+
+    public void setSystemSettingManager( SystemSettingManager systemSettingManager )
+    {
+        this.systemSettingManager = systemSettingManager;
     }
 
     // -------------------------------------------------------------------------
@@ -181,7 +155,7 @@
     {
         log.info( "Data completeness export process started" );
         
-        DataSetCompletenessConfiguration config = getConfiguration();
+        int days = (Integer) systemSettingManager.getSystemSetting( KEY_COMPLETENESS_OFFSET, DEFAULT_COMPLETENESS_OFFSET );
         
         completenessStore.deleteDataSetCompleteness( dataSetIds, periodIds, organisationUnitIds );
         
@@ -216,7 +190,7 @@
                     {
                         if ( intersectingPeriod.getPeriodType().equals( dataSet.getPeriodType() ) )
                         {
-                            deadline = config != null ? config.getDeadline( intersectingPeriod ) : null;
+                            deadline = getDeadline( intersectingPeriod, days );
                             
                             result = getDataSetCompleteness( intersectingPeriod, deadline, unit, dataSet );
                             
@@ -245,7 +219,8 @@
     {
         final Period period = periodService.getPeriod( periodId );
         
-        Date deadline = getConfiguration() != null ? getConfiguration().getDeadline( period ) : null;
+        int days = (Integer) systemSettingManager.getSystemSetting( KEY_COMPLETENESS_OFFSET, DEFAULT_COMPLETENESS_OFFSET );        
+        Date deadline = getDeadline( period, days );
         
         final Collection<? extends Source> children = organisationUnitService.getOrganisationUnitWithChildren( organisationUnitId );
         
@@ -280,7 +255,8 @@
     {
         final Period period = periodService.getPeriod( periodId );
 
-        Date deadline = getConfiguration() != null ? getConfiguration().getDeadline( period ) : null;
+        int days = (Integer) systemSettingManager.getSystemSetting( KEY_COMPLETENESS_OFFSET, DEFAULT_COMPLETENESS_OFFSET );        
+        Date deadline = getDeadline( period, days );
         
         final DataSet dataSet = dataSetService.getDataSet( dataSetId );
         
@@ -334,39 +310,7 @@
         
         return result;
     }
-    
-    // -------------------------------------------------------------------------
-    // Configuration
-    // -------------------------------------------------------------------------
-
-    public void setConfiguration( DataSetCompletenessConfiguration configuration )
-    {
-        try
-        {
-            OutputStream out = locationManager.getOutputStream( configFile, configDir );
-            
-            configurationManager.setConfiguration( configuration, out );
-        }
-        catch ( LocationManagerException ex )
-        {
-            throw new RuntimeException( "Failed to set configuration", ex );
-        }
-    }
-    
-    public DataSetCompletenessConfiguration getConfiguration()
-    {
-        try
-        {
-            InputStream in = locationManager.getInputStream( configFile, configDir );
-            
-            return configurationManager.getConfiguration( in, DataSetCompletenessConfiguration.class );
-        }
-        catch ( LocationManagerException ex )
-        {
-            return null;
-        }
-    }
-    
+        
     // -------------------------------------------------------------------------
     // Index
     // -------------------------------------------------------------------------
@@ -380,4 +324,26 @@
     {
         completenessStore.dropIndex();
     }
+
+    // -------------------------------------------------------------------------
+    // Supportive methods
+    // -------------------------------------------------------------------------
+
+    private Date getDeadline( Period period, int days )
+    {
+        Calendar cal = Calendar.getInstance();
+        
+        Date date = null;
+        
+        if ( period != null )
+        {
+            cal.clear();                
+            cal.setTime( period.getEndDate() );                                       
+            cal.add( Calendar.DAY_OF_MONTH, days );
+            
+            date = cal.getTime();
+        }
+        
+        return date;
+    }
 }

=== 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	2011-02-17 16:39:32 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml	2011-02-18 20:20:07 +0000
@@ -141,8 +141,6 @@
   
   <bean id="compulsoryDataCompletenessService"
 	class="org.hisp.dhis.completeness.impl.CompulsoryDataSetCompletenessService">
-    <property name="configDir" value="reports"/>
-    <property name="configFile" value="dataSetCompletenessConfiguration.xml"/>
     <property name="batchHandlerFactory" ref="batchHandlerFactory"/>
     <property name="organisationUnitService"
       ref="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
@@ -154,8 +152,8 @@
       ref="org.hisp.dhis.period.PeriodService"/>
     <property name="completenessStore"
       ref="org.hisp.dhis.completeness.DataSetCompletenessStore"/>
-	<property name="locationManager" ref="locationManager"/>
-	<property name="configurationManager" ref="configurationManager"/>
+    <property name="systemSettingManager" 
+    	ref="org.hisp.dhis.options.SystemSettingManager"/>
   </bean>
   
   <bean id="ratioDataCompletenessService"

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceTest.java	2010-10-29 12:19:15 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceTest.java	2011-02-18 20:20:07 +0000
@@ -40,14 +40,12 @@
 import org.hisp.dhis.dataset.CompleteDataSetRegistrationService;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.external.configuration.NoConfigurationFoundException;
 import org.hisp.dhis.external.location.LocationManager;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.period.PeriodType;
-import org.junit.Ignore;
 import org.junit.Test;
 
 /**
@@ -165,14 +163,6 @@
         onTimeA = getDate( 2000, 2, 10 );
         tooLateA = getDate( 2000, 2, 25 );
         tooLateB = getDate( 2000, 3, 25 );
-
-        // ---------------------------------------------------------------------
-        // Configure DataSetCompleteness
-        // ---------------------------------------------------------------------
-        
-        DataSetCompletenessConfiguration config = new DataSetCompletenessConfiguration( 15 );
-                
-        completenessService.setConfiguration( config );
     }
 
     @Override
@@ -406,18 +396,4 @@
         assertEquals( referenceB, resultB );
         assertEquals( referenceC, resultC );        
     }
-
-    @Ignore
-    @Test
-    public void testConfiguration()
-        throws NoConfigurationFoundException
-    {
-        DataSetCompletenessConfiguration config = new DataSetCompletenessConfiguration( 15 );
-        
-        completenessService.setConfiguration( config );
-        
-        DataSetCompletenessConfiguration receivedConfig = completenessService.getConfiguration();
-        
-        assertNotNull( receivedConfig );
-    }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/SystemSettingInterceptor.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/SystemSettingInterceptor.java	2011-02-01 11:15:08 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/SystemSettingInterceptor.java	2011-02-18 20:20:07 +0000
@@ -27,7 +27,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.options.SystemSettingManager.DEFAULT_AGGREGATION_STRATEGY;
+import static org.hisp.dhis.options.SystemSettingManager.*;
 import static org.hisp.dhis.options.SystemSettingManager.DEFAULT_FACTOR_OF_DEVIATION;
 import static org.hisp.dhis.options.SystemSettingManager.KEY_AGGREGATION_STRATEGY;
 import static org.hisp.dhis.options.SystemSettingManager.KEY_APPLICATION_TITLE;
@@ -87,6 +87,7 @@
         map.put( KEY_DISABLE_DATAENTRYFORM_WHEN_COMPLETED, systemSettingManager.getSystemSetting( KEY_DISABLE_DATAENTRYFORM_WHEN_COMPLETED, false ) );
         map.put( KEY_FACTOR_OF_DEVIATION, systemSettingManager.getSystemSetting( KEY_FACTOR_OF_DEVIATION, DEFAULT_FACTOR_OF_DEVIATION ) );
         map.put( KEY_AGGREGATION_STRATEGY, systemSettingManager.getSystemSetting( KEY_AGGREGATION_STRATEGY, DEFAULT_AGGREGATION_STRATEGY ) );
+        map.put( KEY_COMPLETENESS_OFFSET, systemSettingManager.getSystemSetting( KEY_COMPLETENESS_OFFSET, DEFAULT_COMPLETENESS_OFFSET ) );
         
         invocation.getStack().push( map );
         

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/manager/DefaultSelectionTreeManager.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/manager/DefaultSelectionTreeManager.java	2010-09-22 09:14:07 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/manager/DefaultSelectionTreeManager.java	2011-02-18 20:20:07 +0000
@@ -203,7 +203,6 @@
     // Session methods
     // -------------------------------------------------------------------------
 
-    @SuppressWarnings( "unchecked" )
     protected Map getSession()
     {
         return ActionContext.getContext().getSession();

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/manager/DefaultOrganisationUnitSelectionManager.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/manager/DefaultOrganisationUnitSelectionManager.java	2010-07-14 03:04:25 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/manager/DefaultOrganisationUnitSelectionManager.java	2011-02-18 20:20:07 +0000
@@ -200,7 +200,6 @@
     // Session methods
     // -------------------------------------------------------------------------
 
-    @SuppressWarnings( "unchecked" )
     protected Map getSession()
     {
         return ActionContext.getContext().getSession();

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/manager/DefaultTreeStateManager.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/manager/DefaultTreeStateManager.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/manager/DefaultTreeStateManager.java	2011-02-18 20:20:07 +0000
@@ -143,7 +143,6 @@
         return treeState;
     }
 
-    @SuppressWarnings( "unchecked" )
     protected Map getSession()
     {
         return ActionContext.getContext().getSession();

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/SetSystemSettingsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/SetSystemSettingsAction.java	2011-02-01 11:03:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/SetSystemSettingsAction.java	2011-02-18 20:20:07 +0000
@@ -27,7 +27,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.options.SystemSettingManager.KEY_AGGREGATION_STRATEGY;
+import static org.hisp.dhis.options.SystemSettingManager.*;
 import static org.hisp.dhis.options.SystemSettingManager.KEY_APPLICATION_TITLE;
 import static org.hisp.dhis.options.SystemSettingManager.KEY_DISABLE_DATAENTRYFORM_WHEN_COMPLETED;
 import static org.hisp.dhis.options.SystemSettingManager.KEY_FACTOR_OF_DEVIATION;
@@ -125,6 +125,13 @@
     {
         this.aggregationStrategy = aggregationStrategy;
     }
+    
+    private Integer completenessOffset;
+
+    public void setCompletenessOffset( Integer completenessOffset )
+    {
+        this.completenessOffset = completenessOffset;
+    }
 
     // -------------------------------------------------------------------------
     // Action implementation
@@ -143,7 +150,7 @@
         {
             startModule = null;
         }
-
+        
         systemSettingManager.saveSystemSetting( KEY_APPLICATION_TITLE, applicationTitle );
         systemSettingManager.saveSystemSetting( KEY_FLAG, flag );
         systemSettingManager.saveSystemSetting( KEY_START_MODULE, startModule );
@@ -152,6 +159,7 @@
         systemSettingManager.saveSystemSetting( KEY_FACTOR_OF_DEVIATION, factorDeviation );
         styleManager.setCurrentStyle( currentStyle );
         systemSettingManager.saveSystemSetting( KEY_AGGREGATION_STRATEGY, aggregationStrategy );
+        systemSettingManager.saveSystemSetting( KEY_COMPLETENESS_OFFSET, completenessOffset );
         
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties	2011-01-07 11:37:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties	2011-02-18 20:20:07 +0000
@@ -102,3 +102,4 @@
 aggregation_strategy = Aggregation strategy
 real_time = Real-time
 batch = Batch
+days_after_period_timeliness = Days after period end to qualify for timely data submission
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemSettings.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemSettings.vm	2011-02-01 11:03:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemSettings.vm	2011-02-18 20:20:07 +0000
@@ -62,7 +62,13 @@
 <h4>$i18n.getString( "data_analysis_factor" )</h4>
 
 <p>
-	<input type="text" id="factorDeviation" name="factorDeviation" value="$factorDeviation"/>
+	<input type="text" id="factorDeviation" name="factorDeviation" value="$!factorDeviation"/>
+</p>
+
+<h4>$i18n.getString( "days_after_period_timeliness" )</h4>
+
+<p>
+	<input type="text" id="completenessOffset" name="completenessOffset" value="$!completenessOffset"/>
 </p>
 
 <p><input type="submit" value="$i18n.getString( 'save' )" style="width:10em"/></p>

=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/action/GetDataCompletenessConfigurationAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/action/GetDataCompletenessConfigurationAction.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/action/GetDataCompletenessConfigurationAction.java	1970-01-01 00:00:00 +0000
@@ -1,97 +0,0 @@
-package org.hisp.dhis.reporting.completeness.action;
-
-/*
- * Copyright (c) 2004-2010, 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.completeness.DataSetCompletenessConfiguration;
-import org.hisp.dhis.completeness.DataSetCompletenessService;
-import org.hisp.dhis.external.configuration.NoConfigurationFoundException;
-import org.hisp.dhis.i18n.I18n;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class GetDataCompletenessConfigurationAction
-    implements Action
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private DataSetCompletenessService completenessService;
-
-    public void setCompletenessService( DataSetCompletenessService completenessService )
-    {
-        this.completenessService = completenessService;
-    }
-
-    private I18n i18n;
-
-    public void setI18n( I18n i18n )
-    {
-        this.i18n = i18n;
-    }
-    
-    // -------------------------------------------------------------------------
-    // Output
-    // -------------------------------------------------------------------------
-
-    private DataSetCompletenessConfiguration configuration;
-
-    public DataSetCompletenessConfiguration getConfiguration()
-    {
-        return configuration;
-    }
-
-    private String message;
-
-    public String getMessage()
-    {
-        return message;
-    }
-
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-
-    public String execute()
-    {
-        try
-        {
-            configuration = completenessService.getConfiguration();
-        }
-        catch ( NoConfigurationFoundException ex )
-        {
-            message = i18n.getString( "set_configuration" );
-        }
-        
-        return SUCCESS;
-    }
-}

=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/action/SetDataCompletenessConfigurationAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/action/SetDataCompletenessConfigurationAction.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/completeness/action/SetDataCompletenessConfigurationAction.java	1970-01-01 00:00:00 +0000
@@ -1,76 +0,0 @@
-package org.hisp.dhis.reporting.completeness.action;
-
-/*
- * Copyright (c) 2004-2010, 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.completeness.DataSetCompletenessConfiguration;
-import org.hisp.dhis.completeness.DataSetCompletenessService;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class SetDataCompletenessConfigurationAction
-    implements Action
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private DataSetCompletenessService completenessService;
-
-    public void setCompletenessService( DataSetCompletenessService completenessService )
-    {
-        this.completenessService = completenessService;
-    }
-    
-    // -------------------------------------------------------------------------
-    // Input
-    // -------------------------------------------------------------------------
-
-    private int days;
-
-    public void setDays( int days )
-    {
-        this.days = days;
-    }
-
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-
-    public String execute()
-    {
-        DataSetCompletenessConfiguration config = new DataSetCompletenessConfiguration( days );
-        
-        completenessService.setConfiguration( config );
-        
-        return SUCCESS;
-    }
-}

=== 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	2011-02-03 20:15:02 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml	2011-02-18 20:20:07 +0000
@@ -410,21 +410,7 @@
 	<property name="selectionTreeManager"
       ref="org.hisp.dhis.oust.manager.SelectionTreeManager"/>
   </bean>
-    
-  <bean id="org.hisp.dhis.reporting.completeness.action.GetDataCompletenessConfigurationAction"
-    class="org.hisp.dhis.reporting.completeness.action.GetDataCompletenessConfigurationAction"
-    scope="prototype">
-    <property name="completenessService"
-      ref="registrationDataCompletenessService"/>
-  </bean>
-  
-  <bean id="org.hisp.dhis.reporting.completeness.action.SetDataCompletenessConfigurationAction"
-    class="org.hisp.dhis.reporting.completeness.action.SetDataCompletenessConfigurationAction"
-    scope="prototype">
-    <property name="completenessService"
-      ref="registrationDataCompletenessService"/>
-  </bean>
-  
+      
   <!-- Tallysheet -->
   
   <bean id="org.hisp.dhis.reporting.tallysheet.action.SelectTallySheetAction"

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml	2011-02-03 16:35:12 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml	2011-02-18 20:20:07 +0000
@@ -283,16 +283,6 @@
       <result name="pdf" type="gridPdfResult"/>
       <result name="html" type="velocity">/dhis-web-commons/ajax/htmlGrid.vm</result>
     </action> 
-        
-    <action name="displayConfigureDataCompletenessForm" class="org.hisp.dhis.reporting.completeness.action.GetDataCompletenessConfigurationAction">
-      <result name="success" type="velocity">/main.vm</result>
-      <param name="page">/dhis-web-reporting/configureDataCompletenessForm.vm</param>
-      <param name="menu">/dhis-web-reporting/menu.vm</param>
-    </action>
-    
-    <action name="setDataCompletenessConfiguration" class="org.hisp.dhis.reporting.completeness.action.SetDataCompletenessConfigurationAction">
-      <result name="success" type="redirect">displayViewDataCompletenessForm.action</result>
-    </action>
     
     <!-- DataSet Report -->
     

=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/configureDataCompletenessForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/configureDataCompletenessForm.vm	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/configureDataCompletenessForm.vm	1970-01-01 00:00:00 +0000
@@ -1,28 +0,0 @@
-
-<h3>$i18n.getString( "data_completeness_configuration" )</h3>
-
-<form action="setDataCompletenessConfiguration.action" method="post">
-
-<table>
-    <tr>
-        <th colspan="2">$i18n.getString( "reporting_deadline" )</th>
-    </tr>
-    <tr>
-        <td><label for="days">$i18n.getString( "nr_of_days" )</label></td>
-        <td><input type="text" id="days" name="days" style="width:12em; text-align:center" value="$!configuration.days"></td>
-    </tr>
-    <tr>
-        <td></td>
-        <td><input type="submit" value="$i18n.getString( 'save' )" style="width:6em"><input
-                   type="button" value="$i18n.getString( 'cancel' )" style="width:6em" 
-                   onclick="window.location.href='displayViewDataCompletenessForm.action'"></td>
-    </tr>
-</table>
-
-</form>
-
-<span id="info">$i18n.getString( "completeness_configuration_explanation" ).</span>
-
-#if ( $message )
-    <span id="message" style="display:block">$!message</span>
-#end

=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/configureReportForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/configureReportForm.vm	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/configureReportForm.vm	1970-01-01 00:00:00 +0000
@@ -1,32 +0,0 @@
-
-<h3>$i18n.getString( 'report_configuration' )</h3>
-
-<form action="setReportConfiguration.action" method="post">
-
-<table>
-    <tr>
-        <th colspan="2">$i18n.getString( "details" )</th>
-    </tr>
-    <tr>
-        <td><label for="home">$i18n.getString( "home" )</label></td>
-        <td><input type="text" id="home" name="home" style="width:30em" onchange="homeChanged()" value="$!reportConfiguration.home"></td>
-    </tr>
-    <tr>
-        <td><label for="directory">$i18n.getString( "directory" )</label></td>
-        <td><input type="text" id="directory" name="directory" style="width:30em" value="$!reportConfiguration.directory"></td>
-    </tr>
-    <tr>
-        <td></td>
-        <td><input type="submit" value="$i18n.getString( 'save' )" style="width:15em"><input
-                   type="button" value="$i18n.getString( 'cancel' )" style="width:15em" 
-                   onclick="window.location.href='displayViewReportForm.action'"></td>
-    </tr>
-</table>
-
-</form>
-
-<span id="info">$i18n.getString( "home_explanation" ). $i18n.getString( "directory_explanation" ).</span>
-
-#if ( $message )
-    <span id="message" style="display:block">$!message</span>
-#end

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewDataCompletenessForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewDataCompletenessForm.vm	2010-12-26 23:25:10 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewDataCompletenessForm.vm	2011-02-18 20:20:07 +0000
@@ -16,8 +16,7 @@
         <td valign="bottom">
         	<input type="button" value="$i18n.getString( 'get_report_as_pdf' )" style="width:140px" onclick="getCompleteness( 'pdf' )"/>
             <input type="button" value="$i18n.getString( 'get_report_as_xls' )" style="width:140px" onclick="getCompleteness( 'xls' )"/><br>
-        	<input type="button" value="$i18n.getString( 'get_report_as_csv' )" style="width:140px" onclick="getCompleteness( 'csv' )"/>
-            <input type="button" value="$i18n.getString( 'configuration' )" style="width:140px" onclick="window.location.href='displayConfigureDataCompletenessForm.action'"/><br><br>        	
+        	<input type="button" value="$i18n.getString( 'get_report_as_csv' )" style="width:140px" onclick="getCompleteness( 'csv' )"/><br><br>        	
                 	
             <input type="radio" name="criteria" id="registrationRadio" value="registration" checked="checked" onclick="displayCompleteness()"/>
             <label for="registrationRadio">$i18n.getString( 'based_on_registration' )</label><br/>