← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4326: Cached the categoryoptioncombo->categoryoptions association

 

------------------------------------------------------------
revno: 4326
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-08-17 11:25:09 +0200
message:
  Cached the categoryoptioncombo->categoryoptions association
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOptionCombo.hbm.xml
  dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/ehcache.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/GetAssignedGroupsByDataElementAction.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-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java	2011-07-07 20:49:32 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java	2011-08-17 09:25:09 +0000
@@ -336,7 +336,7 @@
     public void generateDefaultDimension()
     {
         // ---------------------------------------------------------------------
-        // Add default DataElementCategoryOption
+        // DataElementCategoryOption
         // ---------------------------------------------------------------------
 
         DataElementCategoryOption categoryOption = new DataElementCategoryOption(
@@ -345,8 +345,7 @@
         addDataElementCategoryOption( categoryOption );
 
         // ---------------------------------------------------------------------
-        // Add default DataElementCategory containing default
-        // DataElementCategoryOption
+        // DataElementCategory
         // ---------------------------------------------------------------------
 
         DataElementCategory category = new DataElementCategory( DataElementCategory.DEFAULT_NAME );
@@ -354,16 +353,15 @@
         List<DataElementCategoryOption> categoryOptions = new ArrayList<DataElementCategoryOption>();
         categoryOptions.add( categoryOption );
         category.setCategoryOptions( categoryOptions );
+        categoryOption.setCategory( category );
 
         addDataElementCategory( category );
 
         // ---------------------------------------------------------------------
-        // Add default DataElementCategoryCombo made of the default
-        // DataElementCategory
+        // DataElementCategoryCombo
         // ---------------------------------------------------------------------
 
-        DataElementCategoryCombo categoryCombo = new DataElementCategoryCombo(
-            DataElementCategoryCombo.DEFAULT_CATEGORY_COMBO_NAME );
+        DataElementCategoryCombo categoryCombo = new DataElementCategoryCombo( DataElementCategoryCombo.DEFAULT_CATEGORY_COMBO_NAME );
 
         List<DataElementCategory> categories = new ArrayList<DataElementCategory>();
         categories.add( category );
@@ -372,14 +370,14 @@
         addDataElementCategoryCombo( categoryCombo );
 
         // ---------------------------------------------------------------------
-        // Add default DataElementCategoryOptionCombo
+        // DataElementCategoryOptionCombo
         // ---------------------------------------------------------------------
 
         DataElementCategoryOptionCombo categoryOptionCombo = new DataElementCategoryOptionCombo();
 
         categoryOptionCombo.setCategoryCombo( categoryCombo );
         categoryOptionCombo.setCategoryOptions( new ArrayList<DataElementCategoryOption>( categoryOptions ) );
-
+        
         addDataElementCategoryOptionCombo( categoryOptionCombo );
 
         Set<DataElementCategoryOptionCombo> categoryOptionCombos = new HashSet<DataElementCategoryOptionCombo>();
@@ -387,6 +385,9 @@
         categoryCombo.setOptionCombos( categoryOptionCombos );
 
         updateDataElementCategoryCombo( categoryCombo );
+        
+        categoryOption.setCategoryOptionCombos( categoryOptionCombos );
+        updateDataElementCategoryOption( categoryOption );
     }
 
     public DataElementCategoryOptionCombo getDefaultDataElementCategoryOptionCombo()
@@ -531,6 +532,9 @@
             optionCombos.add( optionCombo );
         }
 
+        //TODO update category option -> category option combo association
+        //TODO re-implement using CombinationGenerator
+        
         categoryCombo.setOptionCombos( optionCombos );
 
         updateDataElementCategoryCombo( categoryCombo );
@@ -738,5 +742,4 @@
     {
         return dataElementCategoryComboStore.getBetweenByName( name, first, max );
     }
-
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOptionCombo.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOptionCombo.hbm.xml	2011-05-29 11:00:17 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOptionCombo.hbm.xml	2011-08-17 09:25:09 +0000
@@ -17,6 +17,7 @@
     </property>
 
     <list name="categoryOptions" table="categoryoptioncombos_categoryoptions">
+	  <cache usage="read-write" />
       <key column="categoryoptioncomboid" foreign-key="fk_categoryoptioncombos_categoryoptions_categoryoptioncomboid" />
       <list-index column="sort_order" base="1" />
       <many-to-many class="org.hisp.dhis.dataelement.DataElementCategoryOption" column="categoryoptionid"

=== 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-08-12 18:53:10 +0000
+++ dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/ehcache.xml	2011-08-17 09:25:09 +0000
@@ -3,7 +3,7 @@
 
   <diskStore path="java.io.tmpdir" />
 
-  <defaultCache maxElementsInMemory="400000" eternal="false" timeToIdleSeconds="360" timeToLiveSeconds="720"
+  <defaultCache maxElementsInMemory="600000" eternal="false" timeToIdleSeconds="360" timeToLiveSeconds="720"
     overflowToDisk="false" diskPersistent="false" diskExpiryThreadIntervalSeconds="720" memoryStoreEvictionPolicy="LRU" />
 
   <!-- Hibernate entities -->
@@ -101,10 +101,12 @@
   <cache name="org.hisp.dhis.dataelement.DataElementCategory.categoryOptions" maxElementsInMemory="300" />
 
   <cache name="org.hisp.dhis.dataelement.DataElementCategoryOption.categoryOptionCombos" maxElementsInMemory="500" />
+  
+  <cache name="org.hisp.dhis.dataelement.DataElementCategoryOptionCombo.categoryOptions" maxElementsInMemory="500" />
 
   <cache name="org.hisp.dhis.dataset.DataSet.dataElements" maxElementsInMemory="4000" />
 
-  <cache name="org.hisp.dhis.dataset.DataSet.sources" maxElementsInMemory="20000" />
+  <cache name="org.hisp.dhis.dataset.DataSet.sources" maxElementsInMemory="120000" />
 
   <cache name="org.hisp.dhis.dataset.DataSet.sections" maxElementsInMemory="400" />
 
@@ -132,7 +134,7 @@
 
   <cache name="org.hisp.dhis.organisationunit.OrganisationUnit.children" maxElementsInMemory="20000" />
 
-  <cache name="org.hisp.dhis.organisationunit.OrganisationUnit.dataSets" maxElementsInMemory="400" />
+  <cache name="org.hisp.dhis.organisationunit.OrganisationUnit.dataSets" maxElementsInMemory="120000" />
 
   <cache name="org.hisp.dhis.organisationunit.OrganisationUnit.groups" maxElementsInMemory="400" />
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/GetAssignedGroupsByDataElementAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/GetAssignedGroupsByDataElementAction.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/GetAssignedGroupsByDataElementAction.java	2011-08-17 09:25:09 +0000
@@ -78,7 +78,7 @@
     public String execute()
         throws Exception
     {
-        DataElement dataElement = dataElementService.getDataElement( this.dataElementId );
+        DataElement dataElement = dataElementService.getDataElement( dataElementId );
 
         dataElementGroups = new ArrayList<DataElementGroup>( dataElementService
             .getGroupsContainingDataElement( dataElement ) );