dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #05927
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1862: Fix bug #484055: slow speed on select/unselected large number of orgUnits on the unit tree.
Merge authors:
Quang <Quang@Quang-PC>
------------------------------------------------------------
revno: 1862 [merge]
committer: Quang <Quang@Quang-PC>
branch nick: trunk
timestamp: Mon 2010-05-17 23:13:24 +0700
message:
Fix bug #484055: slow speed on select/unselected large number of orgUnits on the unit tree.
modified:
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/manager/DefaultSelectionTreeManager.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/manager/SelectionTreeManager.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/action/UpdateReportAssociationsAction.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/excelitemgroup/action/UpdateExcelItemGroupAssociationsAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/DefineDataSetAssociationsAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/editor/SaveAssignMultiDataSetForOrgunitAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/AddOrganisationUnitGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/UpdateOrganisationUnitGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/DefineProgramAssociationsAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddUserAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateUserAction.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-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/manager/DefaultSelectionTreeManager.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/manager/DefaultSelectionTreeManager.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/manager/DefaultSelectionTreeManager.java 2010-05-17 16:13:24 +0000
@@ -148,13 +148,6 @@
}
// ---------------------------------------------------------------------
- // Reload the units to ensure it is loaded within the current
- // transaction
- // ---------------------------------------------------------------------
-
- Collection<OrganisationUnit> reloadedSelectedUnits = reloadOrganisationUnits( selectedUnits );
-
- // ---------------------------------------------------------------------
// Remove all selected units that are not in the trees
// ---------------------------------------------------------------------
@@ -162,9 +155,9 @@
if ( rootUnits != null )
{
- reloadedSelectedUnits = getUnitsInTree( rootUnits, reloadedSelectedUnits );
+ selectedUnits = getUnitsInTree( rootUnits, selectedUnits );
- saveToSession( SESSION_KEY_SELECTED_ORG_UNITS, reloadedSelectedUnits );
+ saveToSession( SESSION_KEY_SELECTED_ORG_UNITS, selectedUnits );
}
}
@@ -175,18 +168,13 @@
throw new IllegalArgumentException( "Selected locked OrganisationUnits cannot be null" );
}
- // Reload the units to ensure it is loaded within the current
- // transaction
-
- Collection<OrganisationUnit> reloadedSelectedUnits = reloadOrganisationUnits( selectedUnits );
-
Collection<OrganisationUnit> rootUnits = getRootOrganisationUnits();
if ( rootUnits != null )
{
- reloadedSelectedUnits = getUnitsInTree( rootUnits, reloadedSelectedUnits );
+ selectedUnits = getUnitsInTree( rootUnits, selectedUnits );
- saveToSession( SESSION_KEY_LOCKED_ORG_UNITS, reloadedSelectedUnits );
+ saveToSession( SESSION_KEY_LOCKED_ORG_UNITS, selectedUnits );
}
}
@@ -199,9 +187,14 @@
return new HashSet<OrganisationUnit>();
}
- return reloadOrganisationUnits( selectedUnits );
+ return selectedUnits;
}
+ public Collection<OrganisationUnit> getReloadedSelectedOrganisationUnits()
+ {
+ return reloadOrganisationUnits( getSelectedOrganisationUnits() );
+ }
+
public Collection<OrganisationUnit> getLockOnSelectedOrganisationUnits()
{
Collection<OrganisationUnit> selectedUnits = getCollectionFromSession( SESSION_KEY_LOCKED_ORG_UNITS );
@@ -210,7 +203,7 @@
{
return new HashSet<OrganisationUnit>();
}
- return reloadOrganisationUnits( selectedUnits );
+ return selectedUnits;
}
public void clearSelectedOrganisationUnits()
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/manager/SelectionTreeManager.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/manager/SelectionTreeManager.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/manager/SelectionTreeManager.java 2010-05-17 16:13:24 +0000
@@ -141,4 +141,6 @@
* if the argument is null
*/
void setSelectedOrganisationUnit( OrganisationUnit unit );
+
+ Collection<OrganisationUnit> getReloadedSelectedOrganisationUnits();
}
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/action/UpdateReportAssociationsAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/action/UpdateReportAssociationsAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/action/UpdateReportAssociationsAction.java 2010-05-17 16:13:24 +0000
@@ -26,6 +26,9 @@
*/
package org.hisp.dhis.reportexcel.action;
+import java.util.Collection;
+
+import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.oust.manager.SelectionTreeManager;
import org.hisp.dhis.reportexcel.ReportExcel;
import org.hisp.dhis.reportexcel.ReportExcelService;
@@ -80,7 +83,9 @@
reportExcel.getOrganisationAssocitions().clear();
- reportExcel.getOrganisationAssocitions().addAll( selectionTreeManager.getSelectedOrganisationUnits() );
+ Collection<OrganisationUnit> orgUnits = selectionTreeManager.getReloadedSelectedOrganisationUnits();
+
+ reportExcel.getOrganisationAssocitions().addAll( orgUnits );
reportService.updateReportExcel( reportExcel );
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/excelitemgroup/action/UpdateExcelItemGroupAssociationsAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/excelitemgroup/action/UpdateExcelItemGroupAssociationsAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/excelitemgroup/action/UpdateExcelItemGroupAssociationsAction.java 2010-05-17 16:13:24 +0000
@@ -26,6 +26,9 @@
*/
package org.hisp.dhis.reportexcel.excelitemgroup.action;
+import java.util.Collection;
+
+import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.oust.manager.SelectionTreeManager;
import org.hisp.dhis.reportexcel.excelitem.ExcelItemGroup;
import org.hisp.dhis.reportexcel.excelitem.ExcelItemService;
@@ -37,55 +40,61 @@
* @version $Id$
*/
-public class UpdateExcelItemGroupAssociationsAction implements Action {
- // -------------------------------------------
- // Dependency
- // -------------------------------------------
-
- private ExcelItemService excelItemService;
-
- private SelectionTreeManager selectionTreeManager;
-
- // -------------------------------------------
- // Input & Output
- // -------------------------------------------
-
- private Integer excelItemGroupId;
-
- // -------------------------------------------
- // Getters & Setters
- // -------------------------------------------
-
- public void setSelectionTreeManager(
- SelectionTreeManager selectionTreeManager) {
- this.selectionTreeManager = selectionTreeManager;
- }
-
- public void setExcelItemService(ExcelItemService excelItemService) {
- this.excelItemService = excelItemService;
- }
-
- public void setExcelItemGroupId(Integer excelItemGroupId) {
- this.excelItemGroupId = excelItemGroupId;
- }
-
- // -------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------
-
- public String execute() throws Exception {
-
- ExcelItemGroup excelItemGroup = excelItemService
- .getExcelItemGroup(excelItemGroupId);
-
- excelItemGroup.getOrganisationAssocitions().clear();
-
- excelItemGroup.getOrganisationAssocitions().addAll(
- selectionTreeManager.getSelectedOrganisationUnits());
-
- excelItemService.updateExcelItemGroup(excelItemGroup);
-
- return SUCCESS;
- }
+public class UpdateExcelItemGroupAssociationsAction
+ implements Action
+{
+ // -------------------------------------------
+ // Dependency
+ // -------------------------------------------
+
+ private ExcelItemService excelItemService;
+
+ private SelectionTreeManager selectionTreeManager;
+
+ // -------------------------------------------
+ // Input & Output
+ // -------------------------------------------
+
+ private Integer excelItemGroupId;
+
+ // -------------------------------------------
+ // Getters & Setters
+ // -------------------------------------------
+
+ public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager )
+ {
+ this.selectionTreeManager = selectionTreeManager;
+ }
+
+ public void setExcelItemService( ExcelItemService excelItemService )
+ {
+ this.excelItemService = excelItemService;
+ }
+
+ public void setExcelItemGroupId( Integer excelItemGroupId )
+ {
+ this.excelItemGroupId = excelItemGroupId;
+ }
+
+ // -------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+
+ ExcelItemGroup excelItemGroup = excelItemService.getExcelItemGroup( excelItemGroupId );
+
+ excelItemGroup.getOrganisationAssocitions().clear();
+
+ Collection<OrganisationUnit> orgUnits = selectionTreeManager.getReloadedSelectedOrganisationUnits();
+
+ excelItemGroup.getOrganisationAssocitions().addAll( orgUnits );
+
+ excelItemService.updateExcelItemGroup( excelItemGroup );
+
+ return SUCCESS;
+ }
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/DefineDataSetAssociationsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/DefineDataSetAssociationsAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/DefineDataSetAssociationsAction.java 2010-05-17 16:13:24 +0000
@@ -83,26 +83,26 @@
throws Exception
{
- Collection<OrganisationUnit> rootUnits = selectionTreeManager.getRootOrganisationUnits();
-
- Set<OrganisationUnit> unitsInTheTree = new HashSet<OrganisationUnit>();
-
- getUnitsInTheTree( rootUnits, unitsInTheTree );
-
- DataSet dataSet = dataSetService.getDataSet( dataSetId );
-
- Set<Source> assignedSources = dataSet.getSources();
-
- assignedSources.removeAll( convert( unitsInTheTree ) );
-
- Collection<OrganisationUnit> selectedOrganisationUnits = selectionTreeManager.getSelectedOrganisationUnits();
-
- assignedSources.addAll( convert( selectedOrganisationUnits ) );
-
- dataSet.setSources( assignedSources );
-
+ Collection<OrganisationUnit> rootUnits = selectionTreeManager.getRootOrganisationUnits();
+
+ Set<OrganisationUnit> unitsInTheTree = new HashSet<OrganisationUnit>();
+
+ getUnitsInTheTree( rootUnits, unitsInTheTree );
+
+ DataSet dataSet = dataSetService.getDataSet( dataSetId );
+
+ Set<Source> assignedSources = dataSet.getSources();
+
+ assignedSources.removeAll( convert( unitsInTheTree ) );
+
+ Collection<OrganisationUnit> selectedOrganisationUnits = selectionTreeManager.getReloadedSelectedOrganisationUnits();
+
+ assignedSources.addAll( convert( selectedOrganisationUnits ) );
+
+ dataSet.setSources( assignedSources );
+
dataSetService.updateDataSet( dataSet );
-
+
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/editor/SaveAssignMultiDataSetForOrgunitAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/editor/SaveAssignMultiDataSetForOrgunitAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/editor/SaveAssignMultiDataSetForOrgunitAction.java 2010-05-17 16:13:24 +0000
@@ -97,7 +97,7 @@
assignedSources.removeAll( convert( unitsInTheTree ) );
Collection<OrganisationUnit> selectedOrganisationUnits = selectionTreeManager
- .getSelectedOrganisationUnits();
+ .getReloadedSelectedOrganisationUnits();
assignedSources.addAll( convert( selectedOrganisationUnits ) );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/AddOrganisationUnitGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/AddOrganisationUnitGroupAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/AddOrganisationUnitGroupAction.java 2010-05-17 16:13:24 +0000
@@ -27,6 +27,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.util.Collection;
import java.util.HashSet;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -83,8 +84,9 @@
{
OrganisationUnitGroup organisationUnitGroup = new OrganisationUnitGroup( name );
- organisationUnitGroup.setMembers( new HashSet<OrganisationUnit>( selectionTreeManager
- .getSelectedOrganisationUnits() ) );
+ Collection<OrganisationUnit> selectedOrganisationUnits = selectionTreeManager.getReloadedSelectedOrganisationUnits();
+
+ organisationUnitGroup.setMembers( new HashSet<OrganisationUnit>( selectedOrganisationUnits ) );
organisationUnitGroupService.addOrganisationUnitGroup( organisationUnitGroup );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/UpdateOrganisationUnitGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/UpdateOrganisationUnitGroupAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/UpdateOrganisationUnitGroupAction.java 2010-05-17 16:13:24 +0000
@@ -27,6 +27,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.util.Collection;
import java.util.HashSet;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -92,8 +93,9 @@
organisationUnitGroup.setName( name );
- organisationUnitGroup.setMembers( new HashSet<OrganisationUnit>( selectionTreeManager
- .getSelectedOrganisationUnits() ) );
+ Collection<OrganisationUnit> selectedOrganisationUnits = selectionTreeManager.getReloadedSelectedOrganisationUnits();
+
+ organisationUnitGroup.setMembers( new HashSet<OrganisationUnit>( selectedOrganisationUnits ) );
organisationUnitGroupService.updateOrganisationUnitGroup( organisationUnitGroup );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/DefineProgramAssociationsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/DefineProgramAssociationsAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/DefineProgramAssociationsAction.java 2010-05-17 16:13:24 +0000
@@ -96,7 +96,7 @@
assignedUnits.removeAll( convert( unitsInTheTree ) );
- Collection<OrganisationUnit> selectedOrganisationUnits = selectionTreeManager.getSelectedOrganisationUnits();
+ Collection<OrganisationUnit> selectedOrganisationUnits = selectionTreeManager.getReloadedSelectedOrganisationUnits();
assignedUnits.addAll( convert( selectedOrganisationUnits ) );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddUserAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddUserAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddUserAction.java 2010-05-17 16:13:24 +0000
@@ -167,7 +167,7 @@
// Create userCredentials and user
// ---------------------------------------------------------------------
- Collection<OrganisationUnit> orgUnits = selectionTreeManager.getSelectedOrganisationUnits();
+ Collection<OrganisationUnit> orgUnits = selectionTreeManager.getReloadedSelectedOrganisationUnits();
User user = new User();
user.setSurname( surname );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateUserAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateUserAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateUserAction.java 2010-05-17 16:13:24 +0000
@@ -159,7 +159,7 @@
// Update userCredentials and user
// ---------------------------------------------------------------------
- Collection<OrganisationUnit> units = selectionTreeManager.getSelectedOrganisationUnits();
+ Collection<OrganisationUnit> units = selectionTreeManager.getReloadedSelectedOrganisationUnits();
User user = userStore.getUser( id );
user.setSurname( surname );