← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16330: Options, minor fixes

 

------------------------------------------------------------
revno: 16330
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-08-06 13:25:51 +0200
message:
  Options, minor fixes
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/Options.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/TextUtils.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitController.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/metadata/Options.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/Options.java	2014-08-06 11:11:12 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/Options.java	2014-08-06 11:25:51 +0000
@@ -212,9 +212,14 @@
         return options.get( type );
     }
     
+    public Integer getInt( String type )
+    {
+        return options.get( type ) != null ? Integer.parseInt( options.get( type ) ) : null;
+    }
+    
     public boolean isTrue( String type )
     {
-        return options.containsKey( type ) && TextUtils.TRUE.equalsIgnoreCase( options.get( type ) );
+        return options.get( type ) != null && Boolean.parseBoolean( options.get( type ) );
     }
 
     //--------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/TextUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/TextUtils.java	2014-08-06 11:11:12 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/TextUtils.java	2014-08-06 11:25:51 +0000
@@ -45,7 +45,6 @@
     public static final TextUtils INSTANCE = new TextUtils();
     public static final String EMPTY = "";
     public static final String SPACE = "";
-    public static final String TRUE = "true";
     public static final String LN = System.getProperty( "line.separator" );
     
     private static final Pattern LINK_PATTERN = Pattern.compile( "((http://|https://|www\\.).+?)($|\\n|\\r|\\r\\n| )" );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitController.java	2014-08-06 11:11:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitController.java	2014-08-06 11:25:51 +0000
@@ -66,20 +66,15 @@
     {
         List<OrganisationUnit> entityList;
 
-        boolean levelSorted = options.contains( "levelSorted" ) && Boolean.parseBoolean( options.get( "levelSorted" ) );
-
         Integer level = null;
 
-        Integer maxLevel = null;
+        boolean levelSorted = options.isTrue( "levelSorted" );
 
-        if ( options.contains( "level" ) )
-        {
-            level = Integer.parseInt( options.get( "level" ) );
-        }
+        Integer maxLevel = options.getInt( "level" );
 
         if ( options.contains( "maxLevel" ) )
         {
-            maxLevel = Integer.parseInt( options.get( "maxLevel" ) );
+            maxLevel = options.getInt( "maxLevel" );
 
             if ( organisationUnitService.getOrganisationUnitLevelByLevel( maxLevel ) == null )
             {