← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22117: Integrity, instantiating collections

 

------------------------------------------------------------
revno: 22117
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2016-03-02 23:21:49 +0100
message:
  Integrity, instantiating collections
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-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


--
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-03-02 17:06:15 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataintegrity/DataIntegrityReport.java	2016-03-02 22:21:49 +0000
@@ -41,62 +41,66 @@
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.validation.ValidationRule;
 
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.SortedMap;
+import java.util.TreeMap;
 
 /**
  * @author Halvdan Hoem Grelland <halvdanhg@xxxxxxxxx>
  */
 public class DataIntegrityReport
 {
-    private List<DataElement> dataElementsWithoutDataSet;
-    
-    private List<DataElement> dataElementsWithoutGroups;
-    
-    private Map<DataElement, Collection<DataSet>> dataElementsAssignedToDataSetsWithDifferentPeriodTypes;
-    
-    private SortedMap<DataElement, Collection<DataElementGroup>> dataElementsViolatingExclusiveGroupSets;
-
-    private SortedMap<DataSet, Collection<DataElement>> dataElementsInDataSetNotInForm;
-    
-    private List<DataElementCategoryCombo> invalidCategoryCombos;
-
-    private Map<DataSet, Set<DataElementOperand>> categoryOptionCombosNotInDataElementCategoryCombo;
-    
-    private List<DataSet> dataSetsNotAssignedToOrganisationUnits;
-    
-    private List<Section> sectionsWithInvalidCategoryCombinations;
-
-    private Collection<Collection<Indicator>> indicatorsWithIdenticalFormulas;
-    
-    private List<Indicator> indicatorsWithoutGroups;
-    
-    private Map<Indicator, String> invalidIndicatorNumerators;
-    
-    private Map<Indicator, String> invalidIndicatorDenominators;
-    
-    private SortedMap<Indicator, Collection<IndicatorGroup>> indicatorsViolatingExclusiveGroupSets;
-    
-    private List<Period> duplicatePeriods;
-    
-    private List<OrganisationUnit> organisationUnitsWithCyclicReferences;
-    
-    private List<OrganisationUnit> orphanedOrganisationUnits;
-    
-    private List<OrganisationUnit> organisationUnitsWithoutGroups;
-    
-    private SortedMap<OrganisationUnit, Collection<OrganisationUnitGroup>> organisationUnitsViolatingExclusiveGroupSets;
-    
-    private List<OrganisationUnitGroup> organisationUnitGroupsWithoutGroupSets;
-    
-    private List<ValidationRule> validationRulesWithoutGroups;
-    
-    private Map<ValidationRule, String> invalidValidationRuleLeftSideExpressions;
-    
-    private Map<ValidationRule, String> invalidValidationRuleRightSideExpressions;
+    private List<DataElement> dataElementsWithoutDataSet = new ArrayList<>();
+    
+    private List<DataElement> dataElementsWithoutGroups = new ArrayList<>();
+    
+    private Map<DataElement, Collection<DataSet>> dataElementsAssignedToDataSetsWithDifferentPeriodTypes = new HashMap<>();
+    
+    private SortedMap<DataElement, Collection<DataElementGroup>> dataElementsViolatingExclusiveGroupSets = new TreeMap<>();
+
+    private SortedMap<DataSet, Collection<DataElement>> dataElementsInDataSetNotInForm = new TreeMap<>();
+    
+    private List<DataElementCategoryCombo> invalidCategoryCombos = new ArrayList<>();
+
+    private Map<DataSet, Set<DataElementOperand>> categoryOptionCombosNotInDataElementCategoryCombo = new HashMap<>();
+    
+    private List<DataSet> dataSetsNotAssignedToOrganisationUnits = new ArrayList<>();
+    
+    private List<Section> sectionsWithInvalidCategoryCombinations = new ArrayList<>();
+
+    private Set<Set<Indicator>> indicatorsWithIdenticalFormulas = new HashSet<>();
+    
+    private List<Indicator> indicatorsWithoutGroups = new ArrayList<>();
+    
+    private Map<Indicator, String> invalidIndicatorNumerators = new HashMap<>();
+    
+    private Map<Indicator, String> invalidIndicatorDenominators = new HashMap<>();
+    
+    private SortedMap<Indicator, Collection<IndicatorGroup>> indicatorsViolatingExclusiveGroupSets = new TreeMap<>();
+    
+    private List<Period> duplicatePeriods = new ArrayList<>();
+    
+    private List<OrganisationUnit> organisationUnitsWithCyclicReferences = new ArrayList<>();
+    
+    private List<OrganisationUnit> orphanedOrganisationUnits = new ArrayList<>();
+    
+    private List<OrganisationUnit> organisationUnitsWithoutGroups = new ArrayList<>();
+    
+    private SortedMap<OrganisationUnit, Collection<OrganisationUnitGroup>> organisationUnitsViolatingExclusiveGroupSets = new TreeMap<>();
+    
+    private List<OrganisationUnitGroup> organisationUnitGroupsWithoutGroupSets = new ArrayList<>();
+    
+    private List<ValidationRule> validationRulesWithoutGroups = new ArrayList<>();
+    
+    private Map<ValidationRule, String> invalidValidationRuleLeftSideExpressions = new HashMap<>();
+    
+    private Map<ValidationRule, String> invalidValidationRuleRightSideExpressions = new HashMap<>();
 
     //-------------------------------------------------------------------------
     // Constructors
@@ -201,12 +205,12 @@
         this.sectionsWithInvalidCategoryCombinations = sectionsWithInvalidCategoryCombinations;
     }
 
-    public Collection<Collection<Indicator>> getIndicatorsWithIdenticalFormulas()
+    public Set<Set<Indicator>> getIndicatorsWithIdenticalFormulas()
     {
         return indicatorsWithIdenticalFormulas;
     }
 
-    public void setIndicatorsWithIdenticalFormulas( Collection<Collection<Indicator>> indicatorsWithIdenticalFormulas )
+    public void setIndicatorsWithIdenticalFormulas( Set<Set<Indicator>> indicatorsWithIdenticalFormulas )
     {
         this.indicatorsWithIdenticalFormulas = indicatorsWithIdenticalFormulas;
     }

=== 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 21:44:53 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataintegrity/DataIntegrityService.java	2016-03-02 22:21:49 +0000
@@ -127,7 +127,7 @@
     /**
      * Gets all indicators with identical numerator and denominator.
      */
-    Set<Collection<Indicator>> getIndicatorsWithIdenticalFormulas();
+    Set<Set<Indicator>> getIndicatorsWithIdenticalFormulas();
 
     /**
      * Gets all indicators which are not assigned to any groups.

=== 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 21:44:53 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataintegrity/DefaultDataIntegrityService.java	2016-03-02 22:21:49 +0000
@@ -366,7 +366,7 @@
     // -------------------------------------------------------------------------
 
     @Override
-    public Set<Collection<Indicator>> getIndicatorsWithIdenticalFormulas()
+    public Set<Set<Indicator>> getIndicatorsWithIdenticalFormulas()
     {
         Map<String, Indicator> formulas = new HashMap<>();
 

=== 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	2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/dataintegrity/DataIntegrityServiceTest.java	2016-03-02 22:21:49 +0000
@@ -33,6 +33,7 @@
 
 import java.util.Collection;
 import java.util.Map;
+import java.util.Set;
 
 import org.hisp.dhis.DhisSpringTest;
 import org.hisp.dhis.dataelement.DataElement;
@@ -267,7 +268,7 @@
     @Test
     public void testGetIndicatorsWithIdenticalFormulas()
     {
-        Collection<Collection<Indicator>> expected = dataIntegrityService.getIndicatorsWithIdenticalFormulas();
+        Set<Set<Indicator>> expected = dataIntegrityService.getIndicatorsWithIdenticalFormulas();
 
         Collection<Indicator> violation = expected.iterator().next();