← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6024: Lock exception, sorting of datasets

 

------------------------------------------------------------
revno: 6024
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-02-17 14:13:54 +0100
message:
  Lock exception, sorting of datasets
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateLockExceptionStore.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetDataSetsAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetPeriodsAction.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/dataset/hibernate/HibernateLockExceptionStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateLockExceptionStore.java	2012-02-17 05:01:36 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateLockExceptionStore.java	2012-02-17 13:13:54 +0000
@@ -31,12 +31,10 @@
 import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.List;
 
 import org.hibernate.Criteria;
 import org.hibernate.Query;
 import org.hibernate.criterion.Projections;
-import org.hibernate.criterion.Property;
 import org.hibernate.criterion.Restrictions;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataset.DataSet;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetDataSetsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetDataSetsAction.java	2012-02-13 04:51:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetDataSetsAction.java	2012-02-17 13:13:54 +0000
@@ -28,6 +28,8 @@
  */
 
 import com.opensymphony.xwork2.Action;
+
+import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
@@ -35,6 +37,7 @@
 import org.hisp.dhis.user.UserCredentials;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
@@ -90,12 +93,13 @@
     {
         dataSets = getDataSetsForCurrentUser( id );
 
+        Collections.sort( dataSets, IdentifiableObjectNameComparator.INSTANCE );
+        
         return SUCCESS;
     }
 
     private List<DataSet> getDataSetsForCurrentUser( String ids )
     {
-        // start out with a Set, so that we don't get duplicates
         Set<DataSet> dataSets = new HashSet<DataSet>();
 
         if ( ids.length() == 0 )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetPeriodsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetPeriodsAction.java	2012-02-16 12:58:37 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetPeriodsAction.java	2012-02-17 13:13:54 +0000
@@ -48,6 +48,8 @@
 public class GetPeriodsAction
     implements Action
 {
+    private static final int MAX_PERIODS = 24;
+    
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -115,9 +117,9 @@
         FilterUtils.filter( periods, new PastAndCurrentPeriodFilter() );
         Collections.reverse( periods );
 
-        if ( periods.size() > 10 )
+        if ( periods.size() > MAX_PERIODS )
         {
-            periods = periods.subList( 0, 10 );
+            periods = periods.subList( 0, MAX_PERIODS );
         }
 
         return periods;