← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21455: minor fix

 

------------------------------------------------------------
revno: 21455
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-12-15 09:10:55 +0100
message:
  minor fix
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/Query.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/query/Query.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/Query.java	2015-11-12 04:47:12 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/Query.java	2015-12-15 08:10:55 +0000
@@ -29,9 +29,7 @@
  */
 
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Optional;
 import org.hisp.dhis.common.IdentifiableObject;
-import org.hisp.dhis.schema.Property;
 import org.hisp.dhis.schema.Schema;
 
 import java.util.ArrayList;
@@ -161,16 +159,13 @@
             return this;
         }
 
-        Optional<Property> name = Optional.fromNullable( schema.getPersistedProperty( "name" ) );
-        Optional<Property> created = Optional.fromNullable( schema.getPersistedProperty( "created" ) );
-
-        if ( name.isPresent() )
+        if ( schema.havePersistedProperty( "name" ) )
         {
-            addOrder( Order.asc( name.get() ) );
+            addOrder( Order.asc( schema.getPersistedProperty( "name" ) ) );
         }
-        else if ( created.isPresent() )
+        if ( schema.havePersistedProperty( "created" ) )
         {
-            addOrder( Order.desc( created.get() ) );
+            addOrder( Order.desc( schema.getPersistedProperty( "created" ) ) );
         }
 
         return this;