dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17240
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6795: Added notifications to data set completeness export
------------------------------------------------------------
revno: 6795
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-01-01 02:19:11 +0100
message:
Added notifications to data set completeness export
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessEngine.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-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
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 2012-04-06 20:02:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessEngine.java 2013-01-01 01:19:11 +0000
@@ -30,6 +30,7 @@
import java.util.Collection;
import org.hisp.dhis.period.RelativePeriods;
+import org.hisp.dhis.scheduling.TaskId;
/**
* @author Lars Helge Overland
@@ -39,8 +40,8 @@
final String ID = DataSetCompletenessEngine.class.getName();
void exportDataSetCompleteness( Collection<Integer> dataSetIds, RelativePeriods relatives,
- Collection<Integer> organisationUnitIds );
+ Collection<Integer> organisationUnitIds, TaskId id );
void exportDataSetCompleteness( Collection<Integer> dataSetIds, Collection<Integer> periodIds,
- Collection<Integer> organisationUnitIds );
+ Collection<Integer> organisationUnitIds, TaskId id );
}
=== 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 2012-04-24 12:14:22 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java 2013-01-01 01:19:11 +0000
@@ -205,7 +205,7 @@
final int cpuCores = SystemUtils.getCpuCores();
Clock clock = new Clock().startClock().logTime( "Data mart export process started, number of CPU cores: " + cpuCores + ", " + SystemUtils.getMemoryString() );
- notifier.clear( id, DATAMART ).notify( id, DATAMART, "Process started" );
+ notifier.clear( id, DATAMART ).notify( id, DATAMART, "Data mart export process started" );
// ---------------------------------------------------------------------
// Replace null with empty collection
=== 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 00:37:33 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/engine/DefaultDataSetCompletenessEngine.java 2013-01-01 01:19:11 +0000
@@ -29,6 +29,8 @@
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;
@@ -45,8 +47,10 @@
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;
+import org.hisp.dhis.system.notification.Notifier;
import org.hisp.dhis.system.util.Clock;
import org.hisp.dhis.system.util.ConcurrentUtils;
import org.hisp.dhis.system.util.ConversionUtils;
@@ -107,30 +111,38 @@
this.systemSettingManager = systemSettingManager;
}
+ private Notifier notifier;
+
+ public void setNotifier( Notifier notifier )
+ {
+ this.notifier = notifier;
+ }
+
// -------------------------------------------------------------------------
// DataSetCompletenessEngine implementation
// -------------------------------------------------------------------------
@Transactional
public void exportDataSetCompleteness( Collection<Integer> dataSetIds, RelativePeriods relatives,
- Collection<Integer> organisationUnitIds )
+ Collection<Integer> organisationUnitIds, TaskId id )
{
if ( relatives != null )
{
Collection<Integer> periodIds = ConversionUtils.getIdentifiers( Period.class,
periodService.reloadPeriods( relatives.getRelativePeriods() ) );
- exportDataSetCompleteness( dataSetIds, periodIds, organisationUnitIds );
+ exportDataSetCompleteness( dataSetIds, periodIds, organisationUnitIds, id );
}
}
@Transactional
public void exportDataSetCompleteness( Collection<Integer> dataSetIds, Collection<Integer> periodIds,
- Collection<Integer> organisationUnitIds )
+ 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, DATAMART, "Completeness export process started" );
completenessStore.dropIndex();
@@ -142,6 +154,7 @@
completenessStore.deleteDataSetCompleteness( dataSetIds, periodIds, organisationUnitIds );
clock.logTime( "Deleted existing completeness data" );
+ notifier.notify( id, DATAMART, "Exporting completeness for data sets" );
Collection<Period> periods = periodService.getPeriods( periodIds );
Collection<OrganisationUnit> organisationUnits = organisationUnitService.getOrganisationUnits( organisationUnitIds );
@@ -167,5 +180,6 @@
clock.logTime( "Created index" );
clock.logTime( "Completeness export process completed" );
+ notifier.notify( id, DATAMART, INFO, "Completeness process completed", true );
}
}
=== 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-04-25 20:34:19 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml 2013-01-01 01:19:11 +0000
@@ -104,6 +104,7 @@
<property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
<property name="systemSettingManager" ref="org.hisp.dhis.setting.SystemSettingManager" />
+ <property name="notifier" ref="notifier" />
</bean>
<bean id="compulsoryDataCompletenessService" class="org.hisp.dhis.completeness.impl.CompulsoryDataSetCompletenessService">
=== 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 2012-04-06 20:02:26 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceExportTest.java 2013-01-01 01:19:11 +0000
@@ -161,7 +161,7 @@
registrationService.saveCompleteDataSetRegistration( new CompleteDataSetRegistration( dataSetA, periodC, unitC, null, "" ) );
completenessEngine.exportDataSetCompleteness( getIdentifiers( DataSet.class, dataSets ),
- getIdentifiers( Period.class, periods ), getIdentifiers( OrganisationUnit.class, units ) );
+ getIdentifiers( Period.class, periods ), getIdentifiers( OrganisationUnit.class, units ), null );
assertEquals( 100.0, completenessStore.getPercentage( dataSetA.getId(), periodA.getId(), unitB.getId() ) );
assertEquals( 100.0, completenessStore.getPercentage( dataSetA.getId(), periodA.getId(), unitC.getId() ) );
=== 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 2012-03-18 12:15:26 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceTest.java 2013-01-01 01:19:11 +0000
@@ -45,7 +45,6 @@
import org.hisp.dhis.dataset.CompleteDataSetRegistrationService;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.datavalue.DataValue;
import org.hisp.dhis.datavalue.DataValueService;
import org.hisp.dhis.external.location.LocationManager;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -70,8 +69,6 @@
private DataSetCompletenessService registrationCompletenessService;
- private DataSetCompletenessService compulsoryCompletenessService;
-
private PeriodType periodType;
private Period periodA;
@@ -140,8 +137,6 @@
registrationCompletenessService = (DataSetCompletenessService) getBean( "registrationDataCompletenessService" );
- compulsoryCompletenessService = (DataSetCompletenessService) getBean( "compulsoryDataCompletenessService" );
-
categoryOptionCombo = categoryService.getDefaultDataElementCategoryOptionCombo();
periodType = new MonthlyPeriodType();
=== 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-04-12 12:39:47 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/scheduling/DataMartTask.java 2013-01-01 01:19:11 +0000
@@ -166,7 +166,7 @@
Collection<Integer> periodIds = ConversionUtils.getIdentifiers( Period.class, periodService.reloadPeriods( periods ) );
dataMartEngine.export( dataElementIds, indicatorIds, periodIds, organisationUnitIds, organisationUnitGroupIds, taskId );
- completenessEngine.exportDataSetCompleteness( dataSetIds, periodIds, organisationUnitIds );
+ completenessEngine.exportDataSetCompleteness( dataSetIds, periodIds, organisationUnitIds, taskId );
}
// -------------------------------------------------------------------------