dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #00150
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 42: Impl data integrity check for data elements registered for data elements with different period ty...
------------------------------------------------------------
revno: 42
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Wed 2009-03-11 13:42:37 +0100
message:
Impl data integrity check for data elements registered for data elements with different period types.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataintegrity/DataIntegrityService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetService.java
dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataintegrity/DefaultDataIntegrityService.java
dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/dataintegrity/DataIntegrityServiceTest.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataintegrity/GetDataIntegrityAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/dataIntegrityForm.vm
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataintegrity/DataIntegrityService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataintegrity/DataIntegrityService.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataintegrity/DataIntegrityService.java 2009-03-11 12:42:37 +0000
@@ -61,6 +61,12 @@
*/
Collection<DataElement> getDataElementsWithoutGroups();
+ /**
+ * Returns all data elements which are members of data sets with different
+ * period types.
+ */
+ Collection<DataElement> getDataElementsAssignedToDataSetsWithDifferentPeriodTypes();
+
// -------------------------------------------------------------------------
// DataSet
// -------------------------------------------------------------------------
@@ -69,7 +75,7 @@
* Gets all data sets which are not assigned to any organisation units.
*/
Collection<DataSet> getDataSetsNotAssignedToOrganisationUnits();
-
+
// -------------------------------------------------------------------------
// Indicator
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetService.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetService.java 2009-03-11 12:42:37 +0000
@@ -30,6 +30,8 @@
import java.util.Collection;
import java.util.List;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.source.Source;
/**
@@ -143,6 +145,20 @@
*/
List<DataSet> getAssignedDataSets();
+ /**
+ * Searches through the data sets with the corresponding given identifiers.
+ * If the given data element is a member of one of the data sets, that
+ * data sets period type is returned. This implies that if the data element
+ * is a member of more than one data set, which period type being returned
+ * is undefined. If null is passed as the second argument, all data sets
+ * will be searched.
+ *
+ * @param dataElement the data element to find the period type for.
+ * @param dataSetIdentifiers the data set identifiers to search through.
+ * @return the period type of the given data element.
+ */
+ PeriodType getPeriodType( DataElement dataElement, Collection<Integer> dataSetIdentifiers );
+
// -------------------------------------------------------------------------
// FrequencyOverrideAssociation
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataintegrity/DefaultDataIntegrityService.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataintegrity/DefaultDataIntegrityService.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataintegrity/DefaultDataIntegrityService.java 2009-03-11 12:42:37 +0000
@@ -48,6 +48,7 @@
import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.period.PeriodType;
/**
* @author Lars Helge Overland
@@ -157,6 +158,37 @@
return dataElements;
}
+ public Collection<DataElement> getDataElementsAssignedToDataSetsWithDifferentPeriodTypes()
+ {
+ Collection<DataElement> dataElements = dataElementService.getAllDataElements();
+
+ Collection<DataSet> dataSets = dataSetService.getAllDataSets();
+
+ Collection<DataElement> targets = new ArrayList<DataElement>();
+
+ Set<PeriodType> periodTypes = new HashSet<PeriodType>();
+
+ for ( DataElement element : dataElements )
+ {
+ for ( DataSet dataSet : dataSets )
+ {
+ if ( dataSet.getDataElements().contains( element ) )
+ {
+ periodTypes.add( dataSet.getPeriodType() );
+ }
+ }
+
+ if ( periodTypes.size() > 1 )
+ {
+ targets.add( element );
+ }
+
+ periodTypes.clear();
+ }
+
+ return targets;
+ }
+
// -------------------------------------------------------------------------
// DataSet
// -------------------------------------------------------------------------
@@ -178,8 +210,8 @@
}
return dataSets;
- }
-
+ }
+
// -------------------------------------------------------------------------
// Indicator
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/dataintegrity/DataIntegrityServiceTest.java'
--- dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/dataintegrity/DataIntegrityServiceTest.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/dataintegrity/DataIntegrityServiceTest.java 2009-03-11 12:42:37 +0000
@@ -45,6 +45,7 @@
import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.period.MonthlyPeriodType;
+import org.hisp.dhis.period.QuarterlyPeriodType;
/**
* @author Lars Helge Overland
@@ -153,13 +154,15 @@
organisationUnitService.updateOrganisationUnit( unitA );
dataSetA = createDataSet( 'A', new MonthlyPeriodType() );
- dataSetB = createDataSet( 'B', new MonthlyPeriodType() );
+ dataSetB = createDataSet( 'B', new QuarterlyPeriodType() );
dataSetA.getDataElements().add( elementA );
dataSetA.getDataElements().add( elementB );
dataSetA.getSources().add( unitA );
+ dataSetB.getDataElements().add( elementA );
+
dataSetService.addDataSet( dataSetA );
dataSetService.addDataSet( dataSetB );
@@ -224,6 +227,13 @@
assertTrue( equals( expected, elementB, elementC ) );
}
+
+ public void testGetDataElementsAssignedToDataSetsWithDifferentPeriodType()
+ {
+ Collection<DataElement> expected = dataIntegrityService.getDataElementsAssignedToDataSetsWithDifferentPeriodTypes();
+
+ assertTrue( equals( expected, elementA ) );
+ }
public void testGetDataSetsNotAssignedToOrganisationUnits()
{
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java 2009-03-09 22:33:48 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java 2009-03-11 12:42:37 +0000
@@ -33,7 +33,9 @@
import java.util.List;
import java.util.Set;
+import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.i18n.I18nService;
+import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.source.Source;
/**
@@ -205,6 +207,28 @@
return assignedDataSetList;
}
+ public PeriodType getPeriodType( DataElement dataElement, Collection<Integer> dataSetIdentifiers )
+ {
+ Collection<DataSet> dataSets = getDataSets( dataSetIdentifiers );
+
+ for ( DataSet dataSet : dataSets )
+ {
+ if ( dataSet.getDataElements().contains( dataElement ) )
+ {
+ return dataSet.getPeriodType();
+ }
+ }
+
+ return null;
+ }
+
+ public Collection<DataSet> getDistictDataElements( Collection<Integer> dataSetIdentifiers )
+ {
+ Collection<DataSet> dataSets = getDataSets( dataSetIdentifiers );
+
+ return dataSets;
+ }
+
// -------------------------------------------------------------------------
// FrequencyOverrideAssociation
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataintegrity/GetDataIntegrityAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataintegrity/GetDataIntegrityAction.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataintegrity/GetDataIntegrityAction.java 2009-03-11 12:42:37 +0000
@@ -80,6 +80,13 @@
{
return dataSetsNotAssignedToOrganisationUnits;
}
+
+ private Collection<DataElement> dataElementsAssignedToDataSetsWithDifferentPeriodTypes;
+
+ public Collection<DataElement> getDataElementsAssignedToDataSetsWithDifferentPeriodTypes()
+ {
+ return dataElementsAssignedToDataSetsWithDifferentPeriodTypes;
+ }
private Collection<Indicator> indicatorsWithBlankFormulas;
@@ -152,6 +159,7 @@
{
dataElementsWithoutDataSet = dataIntegrityService.getDataElementsWithoutDataSet();
dataElementsWithoutGroups = dataIntegrityService.getDataElementsWithoutGroups();
+ dataElementsAssignedToDataSetsWithDifferentPeriodTypes = dataIntegrityService.getDataElementsAssignedToDataSetsWithDifferentPeriodTypes();
dataSetsNotAssignedToOrganisationUnits = dataIntegrityService.getDataSetsNotAssignedToOrganisationUnits();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2009-03-11 12:42:37 +0000
@@ -1,95 +1,96 @@
-data_locking = Data Locking
-locked_datasets = Locked data sets
-unlocked_datasets = Unlocked data sets
-save = Save
-data_administration = Data Administration
-period_type = Period Type
-select_period_type_all = Select period type / All
-select_period_all = Select period / All
-select_options = Please select at least one option
-performing_maintenance = Performing maintenance...
-maintenance_performed = Maintenance performed
-generating_resource_tables = Generating resource tables...
-resource_tables_generated = Resource tables generated
-maintenance = Maintenance
-resource_table = Resource Table
-clear_aggregated_datavalues = Clear aggregated datavalues
-clear_aggregated_indicatorvalues = Clear aggregated indicatorvalues
-clear_dataset_completeness = Clear dataset completeness
-clear_hierarchy_history = Clear hierarchy history
-clear_zero_values = Clear zero values
-group_set_structure = Exclusive organisation unit groupset structure
-organisation_unit_structure = Organisation unit structure
-data_element_category_option_combo_name = Data element category option combo name
-generate_resource_tables = Generate tables
-perform_maintenance = Perform maintenance
-prune_periods = Prune periods
-system_administration = System Administration
-cache_statistics = Cache Statistics
-second_level_cache_statistics = Second Level Cache Statistics
-region_name = Region name
-put_count = Put count
-hit_count = Hit count
-miss_count = Miss count
-mem_count = Mem count
-disk_count = Disk count
-mem_size = Mem size
-total_second_level_cache = Total Second Level Cache
-total_query_cache = Total Query Cache
-query_cache_statistics = Query Cache Statistics
-query_name = Query name
-put_count = Put count
-hit_count = Hit count
-miss_count = Miss count
-exec_count = Exec count
-exec_avg_time = Exec avg time
-exec_max_time = Exec max time
-exec_min_time = Exec min time
-exec_row_count = Exec row count
-clear_cache = Clear cache
-data_statistics = Data Statistics
-number = Number
-type = Type
-data_elements = Data elements
-data_element_groups = Data element groups
-indicator_types = Indicator types
-indicators = Indicators
-indicator_groups = Indicator groups
-data_sets = Data sets
-data_dictionaries = Data dictionaries
-organisation_units = Organisation units
-validation_rules = Validation rules
-periods = Periods
-data_values = Data values
-number_of_objects = Number of objects
-data_browser = Data Browser
-from_date = From date
-to_date = To date
-browse_by = Browse by
-select_mode = Select mode
-select_parent_organisation_unit = Select parent organisation unit
-search_results_for = Search results for
-request_returned_in = Request returned in
-query_took = Query took
-number_of_queries_executed = Number of queries executed
-period_type = Period type
-no_data_found = No data found
-browse = Browse
-back = Back
-select_period_type = Select Period Type
-data_integrity = Data Integrity
-data_elements_without_data_set = Data elements without data set
-data_elements_without_groups = Data elements without groups
-data_sets_not_assigned_to_organisation_units = Data sets not assigned to organisation units
-indicators_with_blank_formulas = Indicators with blank formulas
-indicators_with_identical_formulas = Indicators with identical formulas
-indicators_without_groups = Indicators without groups
-organisation_units_with_cyclic_references = Organisation units with cyclic references
-orphaned_organisation_units = Orphaned organisation units
-organisation_units_without_groups = Organisation units without groups
-organisation_units_violating_compulsory_group_sets = Organisation units violating compulsory group sets
-organisation_units_violation_exclusive_group_sets = Organisation units violating exclusive group sets
-organisation_unit_groups_without_group_sets = Organisation unit groups without group sets
-no_violations = No violations
-view_violations = View violations
-data_integrity_checks_performed = Data integrity checks performed
+data_locking = Data Locking
+locked_datasets = Locked data sets
+unlocked_datasets = Unlocked data sets
+save = Save
+data_administration = Data Administration
+period_type = Period Type
+select_period_type_all = Select period type / All
+select_period_all = Select period / All
+select_options = Please select at least one option
+performing_maintenance = Performing maintenance...
+maintenance_performed = Maintenance performed
+generating_resource_tables = Generating resource tables...
+resource_tables_generated = Resource tables generated
+maintenance = Maintenance
+resource_table = Resource Table
+clear_aggregated_datavalues = Clear aggregated datavalues
+clear_aggregated_indicatorvalues = Clear aggregated indicatorvalues
+clear_dataset_completeness = Clear dataset completeness
+clear_hierarchy_history = Clear hierarchy history
+clear_zero_values = Clear zero values
+group_set_structure = Exclusive organisation unit groupset structure
+organisation_unit_structure = Organisation unit structure
+data_element_category_option_combo_name = Data element category option combo name
+generate_resource_tables = Generate tables
+perform_maintenance = Perform maintenance
+prune_periods = Prune periods
+system_administration = System Administration
+cache_statistics = Cache Statistics
+second_level_cache_statistics = Second Level Cache Statistics
+region_name = Region name
+put_count = Put count
+hit_count = Hit count
+miss_count = Miss count
+mem_count = Mem count
+disk_count = Disk count
+mem_size = Mem size
+total_second_level_cache = Total Second Level Cache
+total_query_cache = Total Query Cache
+query_cache_statistics = Query Cache Statistics
+query_name = Query name
+put_count = Put count
+hit_count = Hit count
+miss_count = Miss count
+exec_count = Exec count
+exec_avg_time = Exec avg time
+exec_max_time = Exec max time
+exec_min_time = Exec min time
+exec_row_count = Exec row count
+clear_cache = Clear cache
+data_statistics = Data Statistics
+number = Number
+type = Type
+data_elements = Data elements
+data_element_groups = Data element groups
+indicator_types = Indicator types
+indicators = Indicators
+indicator_groups = Indicator groups
+data_sets = Data sets
+data_dictionaries = Data dictionaries
+organisation_units = Organisation units
+validation_rules = Validation rules
+periods = Periods
+data_values = Data values
+number_of_objects = Number of objects
+data_browser = Data Browser
+from_date = From date
+to_date = To date
+browse_by = Browse by
+select_mode = Select mode
+select_parent_organisation_unit = Select parent organisation unit
+search_results_for = Search results for
+request_returned_in = Request returned in
+query_took = Query took
+number_of_queries_executed = Number of queries executed
+period_type = Period type
+no_data_found = No data found
+browse = Browse
+back = Back
+select_period_type = Select Period Type
+data_integrity = Data Integrity
+data_elements_without_data_set = Data elements without data set
+data_elements_without_groups = Data elements without groups
+data_sets_not_assigned_to_organisation_units = Data sets not assigned to organisation units
+indicators_with_blank_formulas = Indicators with blank formulas
+indicators_with_identical_formulas = Indicators with identical formulas
+indicators_without_groups = Indicators without groups
+organisation_units_with_cyclic_references = Organisation units with cyclic references
+orphaned_organisation_units = Orphaned organisation units
+organisation_units_without_groups = Organisation units without groups
+organisation_units_violating_compulsory_group_sets = Organisation units violating compulsory group sets
+organisation_units_violation_exclusive_group_sets = Organisation units violating exclusive group sets
+organisation_unit_groups_without_group_sets = Organisation unit groups without group sets
+no_violations = No violations
+view_violations = View violations
+data_integrity_checks_performed = Data integrity checks performed
+data_elements_assigned_to_period_types_with_different_period_types = Data elements assigned to period types with different period types
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/dataIntegrityForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/dataIntegrityForm.vm 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/dataIntegrityForm.vm 2009-03-11 12:42:37 +0000
@@ -34,6 +34,9 @@
#integrityHeader( $i18n.getString( "data_elements_without_groups" ) $dataElementsWithoutGroups.size() "dataElementsWithoutGroups" )
#violationList( "dataElementsWithoutGroups" $dataElementsWithoutGroups )
+#integrityHeader( $i18n.getString( "data_elements_assigned_to_period_types_with_different_period_types" ) $dataElementsAssignedToDataSetsWithDifferentPeriodTypes.size() "dataElementsAssignedToDataSetsWithDifferentPeriodTypes" )
+#violationList( "dataElementsAssignedToDataSetsWithDifferentPeriodTypes" $dataElementsAssignedToDataSetsWithDifferentPeriodTypes )
+
#integrityHeader( $i18n.getString( "data_sets_not_assigned_to_organisation_units" ) $dataSetsNotAssignedToOrganisationUnits.size() "dataSetsNotAssignedToOrganisationUnits" )
#violationList( "dataSetsNotAssignedToOrganisationUnits" $dataSetsNotAssignedToOrganisationUnits )
--
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.