← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5212: Merged DataSetCompletenessTask with DataMartTask

 

------------------------------------------------------------
revno: 5212
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-11-24 11:38:05 +0100
message:
  Merged DataSetCompletenessTask with DataMartTask
removed:
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/scheduling/DataSetCompletenessTask.java
modified:
  dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/scheduling/DataMartTask.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-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-11-02 14:39:42 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml	2011-11-24 10:38:05 +0000
@@ -276,27 +276,21 @@
     <property name="scheduler" ref="scheduler" />
     <property name="tasks">
       <map>
-        <entry key="keyDataMartTask" value-ref="dataMartTask" />
-        <entry key="keyDataSetCompletenessTask" value-ref="dataSetCompletenessTask" />
+        <entry key="keyDataMartTask" value-ref="dataMartLast12MonthsTask" />
       </map>
     </property>
   </bean>
 
-  <bean id="dataMartTask" class="org.hisp.dhis.system.scheduling.DataMartTask" scope="prototype">
+  <bean id="dataMartLast12MonthsTask" class="org.hisp.dhis.system.scheduling.DataMartTask" scope="prototype">
     <constructor-arg ref="org.hisp.dhis.datamart.DataMartService" />
+    <constructor-arg ref="registrationDataCompletenessService" />
     <constructor-arg ref="org.hisp.dhis.dataelement.DataElementService" />
     <constructor-arg ref="org.hisp.dhis.indicator.IndicatorService" />
     <constructor-arg ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+    <constructor-arg ref="org.hisp.dhis.dataset.DataSetService" />
 	<constructor-arg ref="org.hisp.dhis.options.SystemSettingManager" />
   </bean>
 
-  <bean id="dataSetCompletenessTask" class="org.hisp.dhis.system.scheduling.DataSetCompletenessTask" scope="prototype">
-    <constructor-arg ref="registrationDataCompletenessService" />
-    <constructor-arg ref="org.hisp.dhis.dataset.DataSetService" />
-    <constructor-arg ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
-	<constructor-arg ref="org.hisp.dhis.options.SystemSettingManager" />
-  </bean>
-
   <!-- DeletionHandler -->
 
   <bean id="org.hisp.dhis.report.ReportDeletionHandler" class="org.hisp.dhis.report.ReportDeletionHandler">

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/scheduling/DataMartTask.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/scheduling/DataMartTask.java	2011-11-14 14:48:51 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/scheduling/DataMartTask.java	2011-11-24 10:38:05 +0000
@@ -34,9 +34,12 @@
 import java.util.HashSet;
 import java.util.Set;
 
+import org.hisp.dhis.completeness.DataSetCompletenessService;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.datamart.DataMartService;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.indicator.IndicatorService;
 import org.hisp.dhis.options.SystemSettingManager;
@@ -52,22 +55,29 @@
     implements Runnable
 {
     private DataMartService dataMartService;
- 
+
+    private DataSetCompletenessService completenessService;
+    
     private DataElementService dataElementService;
     
     private IndicatorService indicatorService;
     
     private OrganisationUnitService organisationUnitService;
+
+    private DataSetService dataSetService;
     
     private SystemSettingManager systemSettingManager;
     
-    public DataMartTask( DataMartService dataMartService, DataElementService dataElementService, IndicatorService indicatorService,
-        OrganisationUnitService organisationUnitService, SystemSettingManager systemSettingManager )
+    public DataMartTask( DataMartService dataMartService, DataSetCompletenessService completenessService, 
+        DataElementService dataElementService, IndicatorService indicatorService, 
+        OrganisationUnitService organisationUnitService, DataSetService dataSetService, SystemSettingManager systemSettingManager )
     {
         this.dataMartService = dataMartService;
+        this.completenessService = completenessService;
         this.dataElementService = dataElementService;
         this.indicatorService = indicatorService;
         this.organisationUnitService = organisationUnitService;
+        this.dataSetService = dataSetService;
         this.systemSettingManager = systemSettingManager;
     }
     
@@ -78,11 +88,13 @@
         Collection<Integer> dataElementIds = ConversionUtils.getIdentifiers( DataElement.class, dataElementService.getAllDataElements() );
         Collection<Integer> indicatorIds = ConversionUtils.getIdentifiers( Indicator.class, indicatorService.getAllIndicators() );
         Collection<Integer> organisationUnitIds = ConversionUtils.getIdentifiers( OrganisationUnit.class, organisationUnitService.getAllOrganisationUnits() );
+        Collection<Integer> dataSetIds = ConversionUtils.getIdentifiers( DataSet.class, dataSetService.getAllDataSets() );
         
         Set<String> periodTypes = (Set<String>) systemSettingManager.getSystemSetting( KEY_SCHEDULED_PERIOD_TYPES, DEFAULT_SCHEDULED_PERIOD_TYPES );
         
         RelativePeriods relatives = new RelativePeriods().getRelativePeriods( periodTypes );
         
         dataMartService.export( dataElementIds, indicatorIds, new HashSet<Integer>(), organisationUnitIds, relatives, true );
+        completenessService.exportDataSetCompleteness( dataSetIds, relatives, organisationUnitIds ); 
     }
 }

=== removed file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/scheduling/DataSetCompletenessTask.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/scheduling/DataSetCompletenessTask.java	2011-11-14 14:48:51 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/scheduling/DataSetCompletenessTask.java	1970-01-01 00:00:00 +0000
@@ -1,81 +0,0 @@
-package org.hisp.dhis.system.scheduling;
-
-/*
- * 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 static org.hisp.dhis.options.SystemSettingManager.DEFAULT_SCHEDULED_PERIOD_TYPES;
-import static org.hisp.dhis.options.SystemSettingManager.KEY_SCHEDULED_PERIOD_TYPES;
-
-import java.util.Collection;
-import java.util.Set;
-
-import org.hisp.dhis.completeness.DataSetCompletenessService;
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.options.SystemSettingManager;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.period.RelativePeriods;
-import org.hisp.dhis.system.util.ConversionUtils;
-
-/**
- * @author Lars Helge Overland
- */
-public class DataSetCompletenessTask
-    implements Runnable
-{
-    private DataSetCompletenessService completenessService;
-    
-    private DataSetService dataSetService;
-    
-    private OrganisationUnitService organisationUnitService;
-
-    private SystemSettingManager systemSettingManager;
-    
-    public DataSetCompletenessTask( DataSetCompletenessService completenessService, DataSetService dataSetService, 
-        OrganisationUnitService organisationUnitService, SystemSettingManager systemSettingManager )
-    {
-        this.completenessService = completenessService;
-        this.dataSetService = dataSetService;
-        this.organisationUnitService = organisationUnitService;
-        this.systemSettingManager = systemSettingManager;
-    }
-    
-    @Override
-    @SuppressWarnings("unchecked")    
-    public void run()
-    {
-        Collection<Integer> dataSetIds = ConversionUtils.getIdentifiers( DataSet.class, dataSetService.getAllDataSets() );
-        Collection<Integer> organisationUnitIds = ConversionUtils.getIdentifiers( OrganisationUnit.class, organisationUnitService.getAllOrganisationUnits() );
-
-        Set<String> periodTypes = (Set<String>) systemSettingManager.getSystemSetting( KEY_SCHEDULED_PERIOD_TYPES, DEFAULT_SCHEDULED_PERIOD_TYPES );
-        
-        RelativePeriods relatives = new RelativePeriods().getRelativePeriods( periodTypes );
-        
-        completenessService.exportDataSetCompleteness( dataSetIds, relatives, organisationUnitIds );        
-    }
-}