← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3496: Association caching of groups and group sets. Improves performance of orgunit distribution report.

 

------------------------------------------------------------
revno: 3496
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2011-04-30 11:28:32 +0200
message:
  Association caching of groups and group sets. Improves performance of orgunit distribution report.
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroup.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroupSet.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/Indicator.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroup.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroupSet.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroup.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroupSet.hbm.xml
  dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/ehcache.xml


--
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-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java	2011-04-26 17:29:50 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java	2011-04-30 09:28:32 +0000
@@ -42,7 +42,6 @@
 import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.hierarchy.HierarchyViolationException;
 import org.hisp.dhis.organisationunit.comparator.OrganisationUnitLevelComparator;
-import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator;
 import org.hisp.dhis.system.util.AuditLogUtil;
 import org.hisp.dhis.system.util.Filter;
 import org.hisp.dhis.system.util.FilterUtils;
@@ -216,8 +215,7 @@
             level++;
         }
 
-        List<OrganisationUnit> childList = new ArrayList<OrganisationUnit>( parent.getChildren() );
-        Collections.sort( childList, new OrganisationUnitNameComparator() );
+        List<OrganisationUnit> childList = parent.getSortedChildren();
         
         for ( OrganisationUnit child : childList )
         {

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml	2011-04-24 11:26:20 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml	2011-04-30 09:28:32 +0000
@@ -54,6 +54,7 @@
     <property name="lastUpdated" />
 
     <set name="groups" table="dataelementgroupmembers" inverse="true">
+      <cache usage="read-write" />
       <key column="dataelementid" />
       <many-to-many class="org.hisp.dhis.dataelement.DataElementGroup" column="dataelementgroupid" />
     </set>

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroup.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroup.hbm.xml	2011-04-12 13:25:06 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroup.hbm.xml	2011-04-30 09:28:32 +0000
@@ -21,6 +21,7 @@
     </property>
 
     <set name="members" table="dataelementgroupmembers">
+      <cache usage="read-write" />
       <key column="dataelementgroupid" />
       <many-to-many class="org.hisp.dhis.dataelement.DataElement" column="dataelementid"
         foreign-key="fk_dataelementgroup_dataelementid" />

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroupSet.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroupSet.hbm.xml	2011-04-23 18:52:44 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroupSet.hbm.xml	2011-04-30 09:28:32 +0000
@@ -21,6 +21,7 @@
     </property>
 
     <list name="members" table="dataelementgroupsetmembers">
+      <cache usage="read-write" />
       <key column="dataelementgroupsetid" />
       <list-index column="sort_order" base="1" />
       <many-to-many class="org.hisp.dhis.dataelement.DataElementGroup" column="dataelementgroupid" unique="true"

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/Indicator.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/Indicator.hbm.xml	2011-04-12 13:25:06 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/Indicator.hbm.xml	2011-04-30 09:28:32 +0000
@@ -58,6 +58,7 @@
     <property name="lastUpdated" />
 
     <set name="groups" table="indicatorgroupmembers" inverse="true">
+      <cache usage="read-write" />
       <key column="indicatorid" />
       <many-to-many class="org.hisp.dhis.indicator.IndicatorGroup" column="indicatorgroupid" />
     </set>

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroup.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroup.hbm.xml	2011-04-12 13:25:06 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroup.hbm.xml	2011-04-30 09:28:32 +0000
@@ -21,6 +21,7 @@
     </property>
 
     <set name="members" table="indicatorgroupmembers">
+      <cache usage="read-write" />
       <key column="indicatorgroupid" />
       <many-to-many class="org.hisp.dhis.indicator.Indicator" column="indicatorid" foreign-key="fk_indicatorgroup_indicatorid" />
     </set>

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroupSet.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroupSet.hbm.xml	2011-04-23 18:52:44 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroupSet.hbm.xml	2011-04-30 09:28:32 +0000
@@ -21,6 +21,7 @@
     </property>
 
     <list name="members" table="indicatorgroupsetmembers">
+      <cache usage="read-write" />
       <key column="indicatorgroupsetid" />
       <list-index column="sort_order" base="1" />
       <many-to-many class="org.hisp.dhis.indicator.IndicatorGroup" column="indicatorgroupid" unique="true"

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml	2011-04-24 12:17:55 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml	2011-04-30 09:28:32 +0000
@@ -61,11 +61,13 @@
     </set>
 
     <set name="groups" table="orgunitgroupmembers" inverse="true">
+      <cache usage="read-write" />
       <key column="organisationunitid" />
       <many-to-many class="org.hisp.dhis.organisationunit.OrganisationUnitGroup" column="orgunitgroupid" />
     </set>
 
     <set name="users" table="usermembership" inverse="true">
+      <cache usage="read-write" />
       <key column="organisationunitid" />
       <many-to-many class="org.hisp.dhis.user.User" column="userinfoid" />
     </set>

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroup.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroup.hbm.xml	2011-04-23 18:52:44 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroup.hbm.xml	2011-04-30 09:28:32 +0000
@@ -21,6 +21,7 @@
     </property>
 
     <set name="members" table="orgunitgroupmembers">
+      <cache usage="read-write" />
       <key column="orgunitgroupid" />
       <many-to-many class="org.hisp.dhis.organisationunit.OrganisationUnit" column="organisationunitid"
         foreign-key="fk_orgunitgroup_organisationunitid" />

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroupSet.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroupSet.hbm.xml	2011-04-23 18:52:44 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroupSet.hbm.xml	2011-04-30 09:28:32 +0000
@@ -20,6 +20,7 @@
     <property name="compulsory" not-null="true" />
 
     <set name="organisationUnitGroups" table="orgunitgroupsetmembers">
+      <cache usage="read-write" />
       <key column="orgunitgroupsetid" />
       <many-to-many class="org.hisp.dhis.organisationunit.OrganisationUnitGroup" column="orgunitgroupid"
         foreign-key="fk_orgunitgroupset_orgunitgroupid" />

=== modified file 'dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/ehcache.xml'
--- dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/ehcache.xml	2011-04-24 13:31:09 +0000
+++ dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/ehcache.xml	2011-04-30 09:28:32 +0000
@@ -152,6 +152,24 @@
   <cache name="org.hisp.dhis.dataelement.DataElement.dataSets"
     maxElementsInMemory="400"/>
   
+  <cache name="org.hisp.dhis.dataelement.DataElement.groups"
+    maxElementsInMemory="400"/>
+  
+  <cache name="org.hisp.dhis.dataelement.DataElementGroup.members"
+    maxElementsInMemory="400"/>
+  
+  <cache name="org.hisp.dhis.dataelement.DataElementGroupSet.members"
+    maxElementsInMemory="400"/>
+    
+  <cache name="org.hisp.dhis.indicator.Indicator.groups"
+    maxElementsInMemory="400"/>
+  
+  <cache name="org.hisp.dhis.indicator.IndicatorGroup.members"
+    maxElementsInMemory="400"/>
+  
+  <cache name="org.hisp.dhis.indicator.IndicatorGroupSet.members"
+    maxElementsInMemory="400"/>
+  
   <cache name="org.hisp.dhis.dataset.Section.dataElements"
     maxElementsInMemory="4000"/>
   
@@ -167,6 +185,18 @@
   <cache name="org.hisp.dhis.organisationunit.OrganisationUnit.dataSets"
     maxElementsInMemory="400"/>
   
+  <cache name="org.hisp.dhis.organisationunit.OrganisationUnit.groups"
+    maxElementsInMemory="400"/>
+  
+  <cache name="org.hisp.dhis.organisationunit.OrganisationUnit.users"
+    maxElementsInMemory="400"/>
+  
+  <cache name="org.hisp.dhis.organisationunit.OrganisationUnitGroup.members"
+    maxElementsInMemory="10000"/>
+  
+  <cache name="org.hisp.dhis.organisationunit.OrganisationUnitGroupSet.organisationUnitGroups"
+    maxElementsInMemory="400"/>
+  
   <cache name="org.hisp.dhis.reporttable.ReportTable.dataElements"
     maxElementsInMemory="4000"/>