← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20492: Removed completeness data mart engine code

 

------------------------------------------------------------
revno: 20492
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2015-10-03 13:09:07 +0200
message:
  Removed completeness data mart engine code
removed:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessEngine.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/engine/
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/engine/DefaultDataSetCompletenessEngine.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessStore.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/java/org/hisp/dhis/completeness/jdbc/JDBCDataSetCompletenessStore.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/DataSetCompletenessServiceExportTest.java
  dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceTest.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
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessEngine.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessEngine.java	2015-09-16 14:49:50 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessEngine.java	1970-01-01 00:00:00 +0000
@@ -1,46 +0,0 @@
-package org.hisp.dhis.completeness;
-
-/*
- * Copyright (c) 2004-2015, 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.util.Collection;
-
-import org.hisp.dhis.scheduling.TaskId;
-
-/**
- * @author Lars Helge Overland
- */
-public interface DataSetCompletenessEngine
-{
-    String ID = DataSetCompletenessEngine.class.getName();
-    
-    void exportDataSetCompleteness( Collection<Integer> periodIds, TaskId id );
-    
-    void exportDataSetCompleteness( Collection<Integer> dataSetIds, Collection<Integer> periodIds,
-        Collection<Integer> organisationUnitIds, TaskId id );
-}

=== 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	2015-06-16 10:36:25 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessService.java	2015-10-03 11:09:07 +0000
@@ -31,23 +31,14 @@
 import java.util.Collection;
 import java.util.List;
 import java.util.Set;
-import java.util.concurrent.Future;
-
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.period.Period;
 
 /**
  * @author Lars Helge Overland
- * @version $Id$
  */
 public interface DataSetCompletenessService
 {
     String ID = DataSetCompletenessService.class.getName();
 
-    Future<?> exportDataSetCompleteness( Collection<DataSet> dataSets, Collection<Period> periods,
-        Collection<OrganisationUnit> units );
-
     /**
      * Returns a Collection of DataSetCompletenessResults. The
      * DataSetCompletenessResult object contains the name of the associated
@@ -80,19 +71,4 @@
      */
     List<DataSetCompletenessResult> getDataSetCompleteness( int periodId,
         Collection<Integer> organisationUnitIds, int dataSetId, Set<Integer> groupIds );
-
-    /**
-     * Delete all data set completeness registrations.
-     */
-    void deleteDataSetCompleteness();
-    
-    /**
-     * Creates an index on the aggregateddatasetcompleteness table.
-     */
-    void createIndex();
-
-    /**
-     * Drops the index on the aggregateddatasetcompleteness table.
-     */
-    void dropIndex();
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessStore.java	2015-06-16 10:36:25 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessStore.java	2015-10-03 11:09:07 +0000
@@ -35,7 +35,6 @@
 
 /**
  * @author Lars Helge Overland
- * @version $Id$
  */
 public interface DataSetCompletenessStore
 {
@@ -69,13 +68,4 @@
      * @param sourceIds  the Source identifiers.
      */
     void deleteDataSetCompleteness( Collection<Integer> dataSetIds, Collection<Integer> periodIds, Collection<Integer> sourceIds );
-
-    /**
-     * Deletes all datasetcompleteness entries.
-     */
-    void deleteDataSetCompleteness();
-
-    void createIndex();
-
-    void dropIndex();
 }

=== removed directory 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/engine'
=== removed file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/engine/DefaultDataSetCompletenessEngine.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/engine/DefaultDataSetCompletenessEngine.java	2015-10-03 11:02:47 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/engine/DefaultDataSetCompletenessEngine.java	1970-01-01 00:00:00 +0000
@@ -1,169 +0,0 @@
-package org.hisp.dhis.completeness.engine;
-
-/*
- * Copyright (c) 2004-2015, 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 static org.hisp.dhis.common.IdentifiableObjectUtils.getIdentifiers;
-import static org.hisp.dhis.system.notification.NotificationLevel.INFO;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.concurrent.Future;
-
-import org.hisp.dhis.commons.collection.PaginatedList;
-import org.hisp.dhis.commons.filter.FilterUtils;
-import org.hisp.dhis.system.util.Clock;
-import org.hisp.dhis.commons.util.ConcurrentUtils;
-import org.hisp.dhis.completeness.DataSetCompletenessEngine;
-import org.hisp.dhis.completeness.DataSetCompletenessService;
-import org.hisp.dhis.completeness.DataSetCompletenessStore;
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.dataset.DataSetService;
-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.scheduling.TaskId;
-import org.hisp.dhis.system.filter.DataSetWithOrganisationUnitsFilter;
-import org.hisp.dhis.system.notification.Notifier;
-import org.hisp.dhis.system.util.SystemUtils;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * @author Lars Helge Overland
- */
-public class DefaultDataSetCompletenessEngine
-    implements DataSetCompletenessEngine
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private DataSetCompletenessService completenessService;
-
-    public void setCompletenessService( DataSetCompletenessService completenessService )
-    {
-        this.completenessService = completenessService;
-    }
-
-    private DataSetCompletenessStore completenessStore;
-
-    public void setCompletenessStore( DataSetCompletenessStore completenessStore )
-    {
-        this.completenessStore = completenessStore;
-    }
-
-    private OrganisationUnitService organisationUnitService;
-
-    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
-    {
-        this.organisationUnitService = organisationUnitService;
-    }
-
-    private PeriodService periodService;
-
-    public void setPeriodService( PeriodService periodService )
-    {
-        this.periodService = periodService;
-    }
-
-    private DataSetService dataSetService;
-
-    public void setDataSetService( DataSetService dataSetService )
-    {
-        this.dataSetService = dataSetService;
-    }
-
-    private Notifier notifier;
-
-    public void setNotifier( Notifier notifier )
-    {
-        this.notifier = notifier;
-    }
-
-    // -------------------------------------------------------------------------
-    // DataSetCompletenessEngine implementation
-    // -------------------------------------------------------------------------
-
-    @Override
-    @Transactional
-    public void exportDataSetCompleteness( Collection<Integer> periodIds, TaskId id )
-    {
-        Collection<Integer> dataSetIds = getIdentifiers( dataSetService.getAllDataSets() );
-        Collection<Integer> organisationUnitIds = getIdentifiers( organisationUnitService.getAllOrganisationUnits() );
-
-        exportDataSetCompleteness( dataSetIds, periodIds, organisationUnitIds, id );
-    }
-
-    @Override
-    @Transactional
-    public void exportDataSetCompleteness( Collection<Integer> dataSetIds, Collection<Integer> periodIds,
-        Collection<Integer> organisationUnitIds, TaskId id )
-    {
-        final int cpuCores = SystemUtils.getCpuCores();
-
-        Clock clock = new Clock().startClock().logTime( "Data completeness export process started, number of CPU cores: " + cpuCores + ", " + SystemUtils.getMemoryString() );
-        notifier.notify( id, "Completeness export process started" );
-
-        completenessStore.dropIndex();
-
-        clock.logTime( "Dropped potential index" );
-
-        completenessStore.deleteDataSetCompleteness( dataSetIds, periodIds, organisationUnitIds );
-
-        clock.logTime( "Deleted existing completeness data" );
-        notifier.notify( id, "Exporting completeness for data sets" );
-
-        Collection<Period> periods = periodService.getPeriods( periodIds );
-        Collection<OrganisationUnit> organisationUnits = organisationUnitService.getOrganisationUnits( organisationUnitIds );
-        Collection<DataSet> dataSets = dataSetService.getDataSets( dataSetIds );
-
-        dataSets = completenessStore.getDataSetsWithRegistrations( dataSets );
-
-        FilterUtils.filter( dataSets, new DataSetWithOrganisationUnitsFilter() );
-
-        List<List<OrganisationUnit>> organisationUnitPages = new PaginatedList<>( organisationUnits ).setNumberOfPages( cpuCores ).getPages();
-
-        List<Future<?>> futures = new ArrayList<>();
-
-        for ( List<OrganisationUnit> organisationUnitPage : organisationUnitPages )
-        {
-            futures.add( completenessService.exportDataSetCompleteness( dataSets, periods, organisationUnitPage ) );
-        }
-
-        ConcurrentUtils.waitForCompletion( futures );
-
-        completenessStore.createIndex();
-
-        clock.logTime( "Created index" );
-
-        clock.logTime( "Completeness export process completed" );
-        notifier.notify( id, INFO, "Completeness process completed", true );
-    }
-}

=== 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	2015-08-30 14:51:28 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/impl/AbstractDataSetCompletenessService.java	2015-10-03 11:09:07 +0000
@@ -35,27 +35,18 @@
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
-import java.util.concurrent.Future;
 
-import org.amplecode.quick.BatchHandler;
-import org.amplecode.quick.BatchHandlerFactory;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.commons.collection.CachingMap;
 import org.hisp.dhis.completeness.DataSetCompletenessResult;
 import org.hisp.dhis.completeness.DataSetCompletenessService;
 import org.hisp.dhis.completeness.DataSetCompletenessStore;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.jdbc.batchhandler.DataSetCompletenessResultBatchHandler;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
-import org.hisp.dhis.organisationunit.OrganisationUnitHierarchy;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
-import org.springframework.scheduling.annotation.Async;
 import org.springframework.transaction.annotation.Transactional;
 
 import com.google.common.collect.Sets;
@@ -66,19 +57,10 @@
 public abstract class AbstractDataSetCompletenessService
     implements DataSetCompletenessService
 {
-    private static final Log log = LogFactory.getLog( AbstractDataSetCompletenessService.class );
-
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
 
-    private BatchHandlerFactory batchHandlerFactory;
-
-    public void setBatchHandlerFactory( BatchHandlerFactory batchHandlerFactory )
-    {
-        this.batchHandlerFactory = batchHandlerFactory;
-    }
-
     private OrganisationUnitService organisationUnitService;
 
     public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
@@ -133,56 +115,6 @@
     // -------------------------------------------------------------------------
 
     @Override
-    @Async
-    public Future<?> exportDataSetCompleteness( Collection<DataSet> dataSets, Collection<Period> periods,
-        Collection<OrganisationUnit> units )
-    {
-        BatchHandler<DataSetCompletenessResult> batchHandler = batchHandlerFactory
-            .createBatchHandler( DataSetCompletenessResultBatchHandler.class ).init();
-
-        OrganisationUnitHierarchy hierarchy = organisationUnitService.getOrganisationUnitHierarchy();
-        hierarchy.prepareChildren( units );
-        
-        final CachingMap<String, List<Integer>> periodCache = new CachingMap<>();
-        
-        for ( final DataSet dataSet : dataSets )
-        {
-            int dataSetFrequencyOrder = dataSet.getPeriodType().getFrequencyOrder();
-
-            for ( final OrganisationUnit unit : units )
-            {
-                Set<Integer> sources = hierarchy.getChildren( unit.getId() );
-
-                Set<Integer> relevantSources = getRelevantSources( dataSet, sources, null );
-
-                for ( final Period period : periods )
-                {
-                    if ( period.getPeriodType() != null && period.getPeriodType().getFrequencyOrder() >= dataSetFrequencyOrder )
-                    {
-                        final String periodKey = dataSet.getPeriodType().getName() + period.getStartDate().toString() + period.getEndDate().toString();
-                        
-                        final List<Integer> periodsBetweenDates = periodCache.get( periodKey, 
-                            () -> getIdentifiers( periodService.getPeriodsBetweenDates( dataSet.getPeriodType(), period.getStartDate(), period.getEndDate() ) ) );
-                        
-                        final DataSetCompletenessResult result = getDataSetCompleteness( period, periodsBetweenDates, unit, relevantSources, dataSet );
-
-                        if ( result.getSources() > 0 )
-                        {
-                            batchHandler.addObject( result );
-                        }
-                    }
-                }
-            }
-        }
-
-        batchHandler.flush();
-
-        log.info( "Completeness export task done" );
-
-        return null;
-    }
-
-    @Override
     @Transactional
     public List<DataSetCompletenessResult> getDataSetCompleteness( int periodId, int organisationUnitId, Set<Integer> groupIds )
     {
@@ -257,31 +189,6 @@
         return results;
     }
 
-    @Override
-    @Transactional
-    public void deleteDataSetCompleteness()
-    {
-        completenessStore.deleteDataSetCompleteness();
-    }
-
-    // -------------------------------------------------------------------------
-    // Index
-    // -------------------------------------------------------------------------
-
-    @Override
-    @Transactional
-    public void createIndex()
-    {
-        completenessStore.createIndex();
-    }
-
-    @Override
-    @Transactional
-    public void dropIndex()
-    {
-        completenessStore.dropIndex();
-    }
-
     // -------------------------------------------------------------------------
     // Supportive methods
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/jdbc/JDBCDataSetCompletenessStore.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/jdbc/JDBCDataSetCompletenessStore.java	2015-09-10 16:35:55 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/jdbc/JDBCDataSetCompletenessStore.java	2015-10-03 11:09:07 +0000
@@ -35,8 +35,6 @@
 import java.util.List;
 
 import org.amplecode.quick.StatementManager;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.completeness.DataSetCompletenessStore;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.jdbc.StatementBuilder;
@@ -48,8 +46,6 @@
 public class JDBCDataSetCompletenessStore
     implements DataSetCompletenessStore
 {
-    private static final Log log = LogFactory.getLog( JDBCDataSetCompletenessStore.class );
-    
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -69,10 +65,6 @@
     }
 
     // -------------------------------------------------------------------------
-    // DataSetCompletenessStore
-    // -------------------------------------------------------------------------
-
-    // -------------------------------------------------------------------------
     // Based on complete data set registrations
     // -------------------------------------------------------------------------
 
@@ -209,40 +201,4 @@
         
         statementManager.getHolder().executeUpdate( sql );
     }
-    
-    @Override
-    public void deleteDataSetCompleteness()
-    {
-        final String sql = "DELETE FROM aggregateddatasetcompleteness";
-        
-        statementManager.getHolder().executeUpdate( sql );
-    }
-
-    @Override
-    public void createIndex()
-    {
-        try
-        {
-            final String sql = "CREATE INDEX aggregateddatasetcompleteness_index ON aggregateddatasetcompleteness (datasetid, periodid, organisationunitid, value)";        
-            statementManager.getHolder().executeUpdate( sql, true );
-        }
-        catch ( Exception ex )
-        {
-            log.debug( "Index already exists", ex );
-        }
-    }
-    
-    @Override
-    public void dropIndex()
-    {
-        try
-        {
-            final String sql = "DROP INDEX aggregateddatasetcompleteness_index";        
-            statementManager.getHolder().executeUpdate( sql, true );
-        }
-        catch ( Exception ex )
-        {
-            log.debug( "Index does not exist", ex );
-        }
-    }
 }

=== 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	2015-09-14 11:56:00 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml	2015-10-03 11:09:07 +0000
@@ -79,18 +79,7 @@
     </property>
   </bean>
 
-  <bean id="org.hisp.dhis.completeness.DataSetCompletenessEngine"
-    class="org.hisp.dhis.completeness.engine.DefaultDataSetCompletenessEngine">
-    <property name="completenessService" ref="registrationDataCompletenessService" />
-    <property name="completenessStore" ref="org.hisp.dhis.completeness.DataSetCompletenessStore" />
-    <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
-    <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
-    <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
-    <property name="notifier" ref="notifier" />
-  </bean>
-
   <bean id="compulsoryDataCompletenessService" class="org.hisp.dhis.completeness.impl.CompulsoryDataSetCompletenessService">
-    <property name="batchHandlerFactory" ref="batchHandlerFactory" />
     <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
     <property name="organisationUnitGroupService" ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
     <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceExportTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceExportTest.java	2015-07-03 01:33:37 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceExportTest.java	2015-10-03 11:09:07 +0000
@@ -28,24 +28,23 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.hisp.dhis.DhisSpringTest;
-import org.hisp.dhis.dataset.CompleteDataSetRegistration;
 import org.hisp.dhis.dataset.CompleteDataSetRegistrationService;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.period.*;
+import org.hisp.dhis.period.MonthlyPeriodType;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.period.QuarterlyPeriodType;
 import org.junit.Ignore;
-import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.hisp.dhis.common.IdentifiableObjectUtils.getIdentifiers;
-import static org.junit.Assert.assertEquals;
-
 /**
  * @author Lars Helge Overland
  * @version $Id$
@@ -55,9 +54,6 @@
     extends DhisSpringTest
 {
     @Autowired
-    private DataSetCompletenessEngine completenessEngine;
-
-    @Autowired
     private DataSetCompletenessStore completenessStore;
 
     @Autowired
@@ -151,50 +147,4 @@
 
         dataSets.add( dataSetA );
     }
-
-    @Test
-    public void testExportDataSetCompleteness()
-    {
-        registrationService.saveCompleteDataSetRegistration(
-            new CompleteDataSetRegistration( dataSetA, periodA, unitB, null, null, "") );
-        registrationService.saveCompleteDataSetRegistration(
-            new CompleteDataSetRegistration( dataSetA, periodA, unitC, null, null, "") );
-        registrationService.saveCompleteDataSetRegistration(
-            new CompleteDataSetRegistration( dataSetA, periodB, unitB, null, null, "") );
-        registrationService.saveCompleteDataSetRegistration(
-            new CompleteDataSetRegistration( dataSetA, periodB, unitA, null, null, "") );
-        registrationService.saveCompleteDataSetRegistration(
-            new CompleteDataSetRegistration( dataSetA, periodC, unitA, null, null, "") );
-        registrationService.saveCompleteDataSetRegistration(
-            new CompleteDataSetRegistration( dataSetA, periodC, unitC, null, null, "") );
-
-        completenessEngine.exportDataSetCompleteness( getIdentifiers( dataSets ),
-            getIdentifiers( periods ), getIdentifiers( units ), null );
-
-        assertEquals( 100.0, completenessStore.getPercentage( dataSetA.getId(), periodA.getId(), unitB.getId() ),
-            DELTA );
-        assertEquals( 100.0, completenessStore.getPercentage( dataSetA.getId(), periodA.getId(), unitC.getId() ),
-            DELTA );
-        assertEquals( 66.7, completenessStore.getPercentage( dataSetA.getId(), periodA.getId(), unitA.getId() ),
-            DELTA );
-
-        assertEquals( 100.0, completenessStore.getPercentage( dataSetA.getId(), periodB.getId(), unitB.getId() ),
-            DELTA );
-        assertEquals( 0.0, completenessStore.getPercentage( dataSetA.getId(), periodB.getId(), unitC.getId() ), DELTA );
-        assertEquals( 66.7, completenessStore.getPercentage( dataSetA.getId(), periodB.getId(), unitA.getId() ),
-            DELTA );
-
-        assertEquals( 0.0, completenessStore.getPercentage( dataSetA.getId(), periodC.getId(), unitB.getId() ), DELTA );
-        assertEquals( 100.0, completenessStore.getPercentage( dataSetA.getId(), periodC.getId(), unitC.getId() ),
-            DELTA );
-        assertEquals( 66.7, completenessStore.getPercentage( dataSetA.getId(), periodC.getId(), unitA.getId() ),
-            DELTA );
-
-        assertEquals( 66.7, completenessStore.getPercentage( dataSetA.getId(), periodD.getId(), unitB.getId() ),
-            DELTA );
-        assertEquals( 66.7, completenessStore.getPercentage( dataSetA.getId(), periodD.getId(), unitC.getId() ),
-            DELTA );
-        assertEquals( 66.7, completenessStore.getPercentage( dataSetA.getId(), periodD.getId(), unitA.getId() ),
-            DELTA );
-    }
 }

=== 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	2015-06-16 10:36:25 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceTest.java	2015-10-03 11:09:07 +0000
@@ -28,8 +28,24 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.annotation.Resource;
+
 import org.hisp.dhis.DhisSpringTest;
-import org.hisp.dhis.dataelement.*;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementOperand;
+import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.dataset.CompleteDataSetRegistration;
 import org.hisp.dhis.dataset.CompleteDataSetRegistrationService;
 import org.hisp.dhis.dataset.DataSet;
@@ -40,21 +56,15 @@
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.period.*;
+import org.hisp.dhis.period.MonthlyPeriodType;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.period.QuarterlyPeriodType;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.annotation.Resource;
-
-import static org.junit.Assert.*;
-
 /**
  * @author Lars Helge Overland
  * @version $Id$
@@ -64,9 +74,6 @@
     extends DhisSpringTest
 {
     @Autowired
-    private DataSetCompletenessEngine completenessEngine;
-
-    @Autowired
     private DataSetCompletenessStore completenessStore;
 
     @Autowired