← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21581: minor, add iasc/idesc as alias for asc/desc sorting operators

 

------------------------------------------------------------
revno: 21581
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2016-01-05 15:11:51 +0700
message:
  minor, add iasc/idesc as alias for asc/desc sorting operators
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/common/OrderParams.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-dxf2/src/main/java/org/hisp/dhis/dxf2/common/OrderParams.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/common/OrderParams.java	2016-01-05 07:53:54 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/common/OrderParams.java	2016-01-05 08:11:51 +0000
@@ -76,18 +76,18 @@
                 continue;
             }
 
-            Order newOrder;
+            Order order;
 
-            if ( "asc".equals( split[1] ) )
+            if ( "asc".equals( split[1] ) || "iasc".equals( split[1] ) )
             {
-                newOrder = Order.iasc( schema.getProperty( split[0] ) );
+                order = Order.iasc( schema.getProperty( split[0] ) );
             }
             else
             {
-                newOrder = Order.idesc( schema.getProperty( split[0] ) );
+                order = Order.idesc( schema.getProperty( split[0] ) );
             }
 
-            orders.put( split[0], newOrder.ignoreCase() );
+            orders.put( split[0], order.ignoreCase() );
         }
 
         return new ArrayList<>( orders.values() );
@@ -100,7 +100,8 @@
 
     private boolean validDirection( String direction )
     {
-        return "asc".equals( direction ) || "desc".equals( direction );
+        return "asc".equals( direction ) || "desc".equals( direction )
+            || "iasc".equals( direction ) || "idesc".equals( direction );
     }
 
     @Override