dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #43622
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22113: Integrity checks, added check for invalid category combos
------------------------------------------------------------
revno: 22113
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2016-03-02 18:06:15 +0100
message:
Integrity checks, added check for invalid category combos
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataintegrity/DataIntegrityReport.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataintegrity/DataIntegrityService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataintegrity/FlattenedDataIntegrityReport.java
dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataintegrity/DefaultDataIntegrityService.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/dataIntegrity.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/dataIntegrity.js
--
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/dataintegrity/DataIntegrityReport.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataintegrity/DataIntegrityReport.java 2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataintegrity/DataIntegrityReport.java 2016-03-02 17:06:15 +0000
@@ -29,6 +29,7 @@
*/
import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementGroup;
import org.hisp.dhis.dataelement.DataElementOperand;
import org.hisp.dhis.dataset.DataSet;
@@ -60,6 +61,8 @@
private SortedMap<DataElement, Collection<DataElementGroup>> dataElementsViolatingExclusiveGroupSets;
private SortedMap<DataSet, Collection<DataElement>> dataElementsInDataSetNotInForm;
+
+ private List<DataElementCategoryCombo> invalidCategoryCombos;
private Map<DataSet, Set<DataElementOperand>> categoryOptionCombosNotInDataElementCategoryCombo;
@@ -158,6 +161,16 @@
this.dataElementsInDataSetNotInForm = dataElementsInDataSetNotInForm;
}
+ public List<DataElementCategoryCombo> getInvalidCategoryCombos()
+ {
+ return invalidCategoryCombos;
+ }
+
+ public void setInvalidCategoryCombos( List<DataElementCategoryCombo> invalidCategoryCombos )
+ {
+ this.invalidCategoryCombos = invalidCategoryCombos;
+ }
+
public Map<DataSet, Set<DataElementOperand>> getCategoryOptionCombosNotInDataElementCategoryCombo()
{
return categoryOptionCombosNotInDataElementCategoryCombo;
=== 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 2016-03-02 16:55:48 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataintegrity/DataIntegrityService.java 2016-03-02 17:06:15 +0000
@@ -34,6 +34,7 @@
import org.hisp.dhis.common.SetMap;
import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementGroup;
import org.hisp.dhis.dataelement.DataElementOperand;
import org.hisp.dhis.dataset.DataSet;
@@ -88,6 +89,11 @@
*/
SortedMap<DataSet, Collection<DataElement>> getDataElementsInDataSetNotInForm();
+ /**
+ * Returns all invalid category combinations.
+ */
+ List<DataElementCategoryCombo> getInvalidCategoryCombos();
+
// -------------------------------------------------------------------------
// Section
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataintegrity/FlattenedDataIntegrityReport.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataintegrity/FlattenedDataIntegrityReport.java 2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataintegrity/FlattenedDataIntegrityReport.java 2016-03-02 17:06:15 +0000
@@ -63,6 +63,9 @@
@JsonProperty
private SortedMap<String, Collection<String>> dataElementsInDataSetNotInForm;
+
+ @JsonProperty
+ private List<String> invalidCategoryCombos;
@JsonProperty
private Map<String, Set<String>> categoryOptionCombosNotInDataElementCategoryCombo;
@@ -126,6 +129,8 @@
dataElementsViolatingExclusiveGroupSets = transformSortedMap( report.getDataElementsViolatingExclusiveGroupSets() );
dataElementsInDataSetNotInForm = transformSortedMap( report.getDataElementsInDataSetNotInForm() );
+
+ invalidCategoryCombos = transformCollection( report.getInvalidCategoryCombos() );
categoryOptionCombosNotInDataElementCategoryCombo = transformMapOfSets( report.getCategoryOptionCombosNotInDataElementCategoryCombo() );
=== 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 2016-03-02 16:55:48 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataintegrity/DefaultDataIntegrityService.java 2016-03-02 17:06:15 +0000
@@ -36,6 +36,7 @@
import org.hisp.dhis.commons.filter.Filter;
import org.hisp.dhis.commons.filter.FilterUtils;
import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementGroup;
@@ -75,6 +76,7 @@
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
+import java.util.stream.Collectors;
import static org.hisp.dhis.commons.collection.ListUtils.getDuplicates;
@@ -278,6 +280,14 @@
return map;
}
+
+ @Override
+ public List<DataElementCategoryCombo> getInvalidCategoryCombos()
+ {
+ List<DataElementCategoryCombo> categoryCombos = categoryService.getAllDataElementCategoryCombos();
+
+ return categoryCombos.stream().filter( c -> !c.isValid() ).collect( Collectors.toList() );
+ }
// -------------------------------------------------------------------------
// DataSet
@@ -660,6 +670,7 @@
report.setDataElementsAssignedToDataSetsWithDifferentPeriodTypes( getDataElementsAssignedToDataSetsWithDifferentPeriodTypes() );
report.setDataElementsViolatingExclusiveGroupSets( getDataElementsViolatingExclusiveGroupSets() );
report.setDataElementsInDataSetNotInForm( getDataElementsInDataSetNotInForm() );
+ report.setInvalidCategoryCombos( getInvalidCategoryCombos() );
log.info( "Checked data elements" );
=== 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 2016-02-19 14:24:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2016-03-02 17:06:15 +0000
@@ -385,4 +385,5 @@
expired_invitations=Expired invitations
category_option=Category Option
category_option_group=Category Option Group
-document=Document
\ No newline at end of file
+document=Document
+invalid_category_combos=Invalid category combinations
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/dataIntegrity.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/dataIntegrity.vm 2015-03-04 16:54:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/dataIntegrity.vm 2016-03-02 17:06:15 +0000
@@ -14,6 +14,7 @@
#integrityItem( $i18n.getString( "data_elements_without_groups" ) "dataElementsWithoutGroups" )
#integrityItem( $i18n.getString( "data_elements_violating_exclusive_group_sets" ) "dataElementsViolatingExclusiveGroupSets" )
#integrityItem( $i18n.getString( "data_elements_in_data_set_not_in_form" ) "dataElementsInDataSetNotInForm" )
+#integrityItem( $i18n.getString( "invalid_category_combos" ) "invalidCategoryCombos" )
#integrityItem( $i18n.getString( "data_elements_assigned_to_period_types_with_different_period_types" ) "dataElementsAssignedToDataSetsWithDifferentPeriodTypes" )
#integrityItem( $i18n.getString( "category_option_combos_not_in_data_element_category_combo" ) "categoryOptionCombosNotInDataElementCategoryCombo" )
#integrityItem( $i18n.getString( "data_sets_not_assigned_to_organisation_units" ) "dataSetsNotAssignedToOrganisationUnits" )
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/dataIntegrity.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/dataIntegrity.js 2015-03-19 15:51:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/dataIntegrity.js 2016-03-02 17:06:15 +0000
@@ -111,6 +111,7 @@
displayViolation( json.dataElementsWithoutGroups, "dataElementsWithoutGroups", false, asList );
displayViolation( json.dataElementsViolatingExclusiveGroupSets, "dataElementsViolatingExclusiveGroupSets", true, asMapList );
displayViolation( json.dataElementsInDataSetNotInForm, "dataElementsInDataSetNotInForm", true, asMapList );
+ displayViolation( json.invalidCategoryCombos, "invalidCategoryCombos", false, asList );
displayViolation( json.dataElementsAssignedToDataSetsWithDifferentPeriodTypes, "dataElementsAssignedToDataSetsWithDifferentPeriodTypes", true, asMapList );
displayViolation( json.categoryOptionCombosNotInDataElementCategoryCombo, "categoryOptionCombosNotInDataElementCategoryCombo", true, asMapList );
displayViolation( json.dataSetsNotAssignedToOrganisationUnits, "dataSetsNotAssignedToOrganisationUnits", false, asList );