dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #21179
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9952: Pushed some code from DataMartTask to service layer
------------------------------------------------------------
revno: 9952
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2013-03-03 22:30:24 +0100
message:
Pushed some code from DataMartTask to service layer
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessEngine.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/datamart/DataMartEngine.java
dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java
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/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-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessEngine.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessEngine.java 2013-01-01 01:19:11 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessEngine.java 2013-03-03 21:30:24 +0000
@@ -29,7 +29,6 @@
import java.util.Collection;
-import org.hisp.dhis.period.RelativePeriods;
import org.hisp.dhis.scheduling.TaskId;
/**
@@ -39,8 +38,7 @@
{
final String ID = DataSetCompletenessEngine.class.getName();
- void exportDataSetCompleteness( Collection<Integer> dataSetIds, RelativePeriods relatives,
- Collection<Integer> organisationUnitIds, TaskId id );
+ 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/datamart/DataMartEngine.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datamart/DataMartEngine.java 2012-04-12 12:39:47 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datamart/DataMartEngine.java 2013-03-03 21:30:24 +0000
@@ -57,6 +57,14 @@
*/
void export( Collection<Integer> dataElementIds, Collection<Integer> indicatorIds,
Collection<Integer> periodIds, Collection<Integer> organisationUnitIds );
+
+ /**
+ * Exports aggregated values to the data mart tables.
+ *
+ * @param periodIds the period identifiers.
+ * @param id the task identifier.
+ */
+ void export( Collection<Integer> periodIds, TaskId id );
/**
* Exports aggregated values to the data mart tables.
=== 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-02-26 09:45:13 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java 2013-03-03 21:30:24 +0000
@@ -193,6 +193,17 @@
}
@Transactional
+ public void export( Collection<Integer> periodIds, TaskId id )
+ {
+ 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> organisationUnitGroupIds = ConversionUtils.getIdentifiers( OrganisationUnitGroup.class, organisationUnitGroupService.getOrganisationUnitGroupsWithGroupSets() );
+
+ export( dataElementIds, indicatorIds, periodIds, organisationUnitIds, organisationUnitGroupIds, id );
+ }
+
+ @Transactional
public void export( Collection<Integer> dataElementIds, Collection<Integer> indicatorIds,
Collection<Integer> periodIds, Collection<Integer> organisationUnitIds, Collection<Integer> organisationUnitGroupIds, TaskId id )
{
=== modified 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 2013-01-01 01:19:11 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/engine/DefaultDataSetCompletenessEngine.java 2013-03-03 21:30:24 +0000
@@ -27,10 +27,10 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.hisp.dhis.scheduling.TaskCategory.DATAMART;
import static org.hisp.dhis.setting.SystemSettingManager.DEFAULT_COMPLETENESS_OFFSET;
import static org.hisp.dhis.setting.SystemSettingManager.KEY_COMPLETENESS_OFFSET;
import static org.hisp.dhis.system.notification.NotificationLevel.INFO;
-import static org.hisp.dhis.scheduling.TaskCategory.DATAMART;
import java.util.ArrayList;
import java.util.Collection;
@@ -46,7 +46,6 @@
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodService;
-import org.hisp.dhis.period.RelativePeriods;
import org.hisp.dhis.scheduling.TaskId;
import org.hisp.dhis.setting.SystemSettingManager;
import org.hisp.dhis.system.filter.DataSetWithOrganisationUnitsFilter;
@@ -123,18 +122,14 @@
// -------------------------------------------------------------------------
@Transactional
- public void exportDataSetCompleteness( Collection<Integer> dataSetIds, RelativePeriods relatives,
- Collection<Integer> organisationUnitIds, TaskId id )
+ public void exportDataSetCompleteness( Collection<Integer> periodIds, TaskId id )
{
- if ( relatives != null )
- {
- Collection<Integer> periodIds = ConversionUtils.getIdentifiers( Period.class,
- periodService.reloadPeriods( relatives.getRelativePeriods() ) );
-
- exportDataSetCompleteness( dataSetIds, periodIds, organisationUnitIds, id );
- }
+ Collection<Integer> dataSetIds = ConversionUtils.getIdentifiers( DataSet.class, dataSetService.getAllDataSets() );
+ Collection<Integer> organisationUnitIds = ConversionUtils.getIdentifiers( OrganisationUnit.class, organisationUnitService.getAllOrganisationUnits() );
+
+ exportDataSetCompleteness( dataSetIds, periodIds, organisationUnitIds, id );
}
-
+
@Transactional
public void exportDataSetCompleteness( Collection<Integer> dataSetIds, Collection<Integer> periodIds,
Collection<Integer> organisationUnitIds, TaskId id )
=== 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 2012-12-14 13:46:47 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml 2013-03-03 21:30:24 +0000
@@ -256,12 +256,7 @@
<bean id="abstractDataMartTask" class="org.hisp.dhis.system.scheduling.DataMartTask" scope="prototype">
<constructor-arg ref="org.hisp.dhis.datamart.DataMartEngine" />
<constructor-arg ref="org.hisp.dhis.completeness.DataSetCompletenessEngine" />
- <constructor-arg ref="org.hisp.dhis.dataelement.DataElementService" />
- <constructor-arg ref="org.hisp.dhis.indicator.IndicatorService" />
<constructor-arg ref="org.hisp.dhis.period.PeriodService" />
- <constructor-arg ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
- <constructor-arg ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
- <constructor-arg ref="org.hisp.dhis.dataset.DataSetService" />
<constructor-arg ref="org.hisp.dhis.setting.SystemSettingManager" />
</bean>
=== 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 2012-05-08 15:55:59 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/scheduling/DataMartTask.java 2013-03-03 21:30:24 +0000
@@ -38,17 +38,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.completeness.DataSetCompletenessEngine;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.datamart.DataMartEngine;
-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.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodService;
import org.hisp.dhis.period.RelativePeriods;
@@ -68,18 +58,8 @@
private DataSetCompletenessEngine completenessEngine;
- private DataElementService dataElementService;
-
- private IndicatorService indicatorService;
-
private PeriodService periodService;
-
- private OrganisationUnitService organisationUnitService;
-
- private OrganisationUnitGroupService organisationUnitGroupService;
-
- private DataSetService dataSetService;
-
+
private SystemSettingManager systemSettingManager;
// -------------------------------------------------------------------------
@@ -123,18 +103,11 @@
}
public DataMartTask( DataMartEngine dataMartEngine, DataSetCompletenessEngine completenessEngine,
- DataElementService dataElementService, IndicatorService indicatorService, PeriodService periodService,
- OrganisationUnitService organisationUnitService, OrganisationUnitGroupService organisationUnitGroupService,
- DataSetService dataSetService, SystemSettingManager systemSettingManager )
+ PeriodService periodService, SystemSettingManager systemSettingManager )
{
this.dataMartEngine = dataMartEngine;
this.completenessEngine = completenessEngine;
- this.dataElementService = dataElementService;
- this.indicatorService = indicatorService;
this.periodService = periodService;
- this.organisationUnitService = organisationUnitService;
- this.organisationUnitGroupService = organisationUnitGroupService;
- this.dataSetService = dataSetService;
this.systemSettingManager = systemSettingManager;
}
@@ -146,12 +119,6 @@
@SuppressWarnings("unchecked")
public void run()
{
- Collection<Integer> dataElementIds = ConversionUtils.getIdentifiers( DataElement.class, dataElementService.getAllDataElements() );
- Collection<Integer> indicatorIds = ConversionUtils.getIdentifiers( Indicator.class, indicatorService.getAllIndicators() );
- Collection<Integer> dataSetIds = ConversionUtils.getIdentifiers( DataSet.class, dataSetService.getAllDataSets() );
- Collection<Integer> organisationUnitIds = ConversionUtils.getIdentifiers( OrganisationUnit.class, organisationUnitService.getAllOrganisationUnits() );
- Collection<Integer> organisationUnitGroupIds = ConversionUtils.getIdentifiers( OrganisationUnitGroup.class, organisationUnitGroupService.getOrganisationUnitGroupsWithGroupSets() );
-
Set<String> periodTypes = (Set<String>) systemSettingManager.getSystemSetting( KEY_SCHEDULED_PERIOD_TYPES, DEFAULT_SCHEDULED_PERIOD_TYPES );
List<Period> periods = getPeriods( periodTypes );
@@ -160,8 +127,8 @@
Collection<Integer> periodIds = ConversionUtils.getIdentifiers( Period.class, periodService.reloadPeriods( periods ) );
- dataMartEngine.export( dataElementIds, indicatorIds, periodIds, organisationUnitIds, organisationUnitGroupIds, taskId );
- completenessEngine.exportDataSetCompleteness( dataSetIds, periodIds, organisationUnitIds, taskId );
+ dataMartEngine.export( periodIds, taskId );
+ completenessEngine.exportDataSetCompleteness( periodIds, taskId );
}
// -------------------------------------------------------------------------