← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2670: Fixed bug, changed from js to json encoding for dataintegrity check response template

 

------------------------------------------------------------
revno: 2670
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-01-20 12:39:27 +0100
message:
  Fixed bug, changed from js to json encoding for dataintegrity check response template
modified:
  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/webapp/dhis-web-maintenance-dataadmin/responseDataIntegrity.vm
  resources/sql/integritychecks.sql


--
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-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	2010-11-29 17:16:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataintegrity/GetDataIntegrityAction.java	2011-01-20 11:39:27 +0000
@@ -33,6 +33,8 @@
 import java.util.List;
 import java.util.Map;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.comparator.DataElementNameComparator;
 import org.hisp.dhis.dataintegrity.DataIntegrityService;
@@ -58,6 +60,8 @@
 public class GetDataIntegrityAction
     implements Action
 {
+    private static final Log log = LogFactory.getLog( GetDataIntegrityAction.class );
+    
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -235,28 +239,26 @@
     {
         dataElementsWithoutDataSet = new ArrayList<DataElement>( dataIntegrityService.getDataElementsWithoutDataSet() );
         dataElementsWithoutGroups = new ArrayList<DataElement>( dataIntegrityService.getDataElementsWithoutGroups() );
-        dataElementsAssignedToDataSetsWithDifferentPeriodTypes = dataIntegrityService
-            .getDataElementsAssignedToDataSetsWithDifferentPeriodTypes();
-        dataElementsViolatingCompulsoryGroupSets = new ArrayList<DataElement>( dataIntegrityService
-            .getDataElementsViolatingCompulsoryGroupSets() );
-        dataElementsViolatingExclusiveGroupSets = new ArrayList<DataElement>( dataIntegrityService
-            .getDataElementsViolatingExclusiveGroupSets() );
-
-        dataSetsNotAssignedToOrganisationUnits = new ArrayList<DataSet>( dataIntegrityService
-            .getDataSetsNotAssignedToOrganisationUnits() );
-
-        sectionsWithInvalidCategoryCombinations = new ArrayList<Section>( dataIntegrityService.
-            getSectionsWithInvalidCategoryCombinations() );
+        dataElementsAssignedToDataSetsWithDifferentPeriodTypes = dataIntegrityService.getDataElementsAssignedToDataSetsWithDifferentPeriodTypes();
+        dataElementsViolatingCompulsoryGroupSets = new ArrayList<DataElement>( dataIntegrityService.getDataElementsViolatingCompulsoryGroupSets() );
+        dataElementsViolatingExclusiveGroupSets = new ArrayList<DataElement>( dataIntegrityService.getDataElementsViolatingExclusiveGroupSets() );
+
+        log.info( "Checked data elements" );
+        
+        dataSetsNotAssignedToOrganisationUnits = new ArrayList<DataSet>( dataIntegrityService.getDataSetsNotAssignedToOrganisationUnits() );
+        sectionsWithInvalidCategoryCombinations = new ArrayList<Section>( dataIntegrityService.getSectionsWithInvalidCategoryCombinations() );
+        
+        log.info( "Checked data sets" );
         
         indicatorsWithIdenticalFormulas = dataIntegrityService.getIndicatorsWithIdenticalFormulas();
         indicatorsWithoutGroups = new ArrayList<Indicator>( dataIntegrityService.getIndicatorsWithoutGroups() );
         invalidIndicatorNumerators = dataIntegrityService.getInvalidIndicatorNumerators();
         invalidIndicatorDenominators = dataIntegrityService.getInvalidIndicatorDenominators();
-        indicatorsViolatingCompulsoryGroupSets = new ArrayList<Indicator>( dataIntegrityService
-            .getIndicatorsViolatingCompulsoryGroupSets() );
-        indicatorsViolatingExclusiveGroupSets = new ArrayList<Indicator>( dataIntegrityService
-            .getIndicatorsViolatingExclusiveGroupSets() );
+        indicatorsViolatingCompulsoryGroupSets = new ArrayList<Indicator>( dataIntegrityService.getIndicatorsViolatingCompulsoryGroupSets() );
+        indicatorsViolatingExclusiveGroupSets = new ArrayList<Indicator>( dataIntegrityService.getIndicatorsViolatingExclusiveGroupSets() );
 
+        log.info( "Checked indicators" );
+        
         organisationUnitsWithCyclicReferences = new ArrayList<OrganisationUnit>( dataIntegrityService
             .getOrganisationUnitsWithCyclicReferences() );
         orphanedOrganisationUnits = new ArrayList<OrganisationUnit>( dataIntegrityService
@@ -271,9 +273,14 @@
             .getOrganisationUnitGroupsWithoutGroupSets() );
         validationRulesWithoutGroups = new ArrayList<ValidationRule>( dataIntegrityService
             .getValidationRulesWithoutGroups() );
+        
+        log.info( "Checked organisation units" );
+        
         invalidValidationRuleLeftSideExpressions = dataIntegrityService.getInvalidValidationRuleLeftSideExpressions();
         invalidValidationRuleRightSideExpressions = dataIntegrityService.getInvalidValidationRuleRightSideExpressions();
 
+        log.info( "Checked validation rules" );
+        
         Collections.sort( dataElementsWithoutDataSet, new DataElementNameComparator() );
         Collections.sort( dataElementsWithoutGroups, new DataElementNameComparator() );
         Collections.sort( dataElementsViolatingCompulsoryGroupSets, new DataElementNameComparator() );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/responseDataIntegrity.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/responseDataIntegrity.vm	2010-11-29 17:16:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/responseDataIntegrity.vm	2011-01-20 11:39:27 +0000
@@ -2,17 +2,17 @@
 #set( $size = $list.size() )
 "$!encoder.jsEncode( ${name} )": [
 #foreach( $o in $list )
-"$!encoder.jsEncode( ${o.name} )"#if( $velocityCount < $size ),#end
+"$!encoder.jsonEncode( ${o.name} )"#if( $velocityCount < $size ),#end
 #end
 ]
 #end
 
 #macro( violationWithCollection $name $list )
 #set( $listSize = $list.size() )
-"$!encoder.jsEncode( ${name} )": [
+"$!encoder.jsonEncode( ${name} )": [
 #foreach( $o in $list )
 #set( $oSize = $o.size() )
-"#foreach( $p in $o ) $!encoder.jsEncode( ${p.name} ) #if( $velocityCount < $oSize ), #end
+"#foreach( $p in $o ) $!encoder.jsonEncode( ${p.name} ) #if( $velocityCount < $oSize ), #end
 #end "#if( $velocityCount < $listSize ),#end
 #end
 ]
@@ -20,19 +20,19 @@
 
 #macro( violationWithMap $name $map )
 #set( $size = $map.keySet().size() )
-"$!encoder.jsEncode( ${name} )": [
+"$!encoder.jsonEncode( ${name} )": [
 #foreach( $o in $map.keySet() )
-"$!encoder.jsEncode( ${o.name} ): $map.get( $o )"#if( $velocityCount < $size ),#end
+"$!encoder.jsonEncode( ${o.name} ): $map.get( $o )"#if( $velocityCount < $size ),#end
 #end
 ]
 #end
 
 #macro( violationWithMapList $name $map )
 #set( $mapSize = $map.keySet().size() )
-"$!encoder.jsEncode( ${name} )": [
+"$!encoder.jsonEncode( ${name} )": [
 #foreach( $o in $map.keySet() )
 #set( $listSize = $map.get( $o ).size() )
-"$!encoder.jsEncode( ${o.name} ):#foreach( $p in $map.get( $o ) ) $!encoder.jsEncode( ${p.name} )#if( $velocityCount < $listSize ), #end
+"$!encoder.jsonEncode( ${o.name} ):#foreach( $p in $map.get( $o ) ) $!encoder.jsonEncode( ${p.name} )#if( $velocityCount < $listSize ), #end
 #end "#if( $velocityCount < $mapSize ),#end
 #end
 ]

=== modified file 'resources/sql/integritychecks.sql'
--- resources/sql/integritychecks.sql	2010-12-22 09:16:14 +0000
+++ resources/sql/integritychecks.sql	2011-01-20 11:39:27 +0000
@@ -21,9 +21,10 @@
 join dataset ds on(dm.datasetid=ds.datasetid)
 where de.dataelementid in (
   select de.dataelementid from dataelement de
-  full join datasetmembers ds on (de.dataelementid=ds.dataelementid)
+  join datasetmembers ds on (de.dataelementid=ds.dataelementid)
   group by de.dataelementid
-  having(count(de.dataelementid) > 1) );
+  having(count(de.dataelementid) > 1) )
+order by de.name;
 
 -- Get dataelements which are members of a section but not the section's dataset
 
@@ -35,7 +36,7 @@
   join dataset ds on(dm.datasetid=ds.datasetid)
   where sc.datasetid=ds.datasetid);
 
--- Get orgunit groups which an orgunit member of
+-- Get orgunit groups which an orgunit is member of
 
 select * from orgunitgroup g
 join orgunitgroupmembers m using(orgunitgroupid)