← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20197: Removed method

 

------------------------------------------------------------
revno: 20197
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-09-17 08:53:33 +0200
message:
  Removed method
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitQueryParams.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitServiceTest.java
  dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/fred/webapi/v1/utils/OrganisationUnitToFacilityConverter.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-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitQueryParams.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitQueryParams.java	2015-09-11 19:29:32 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitQueryParams.java	2015-09-17 06:53:33 +0000
@@ -54,7 +54,7 @@
      * The groups for which members to include.
      */
     private Set<OrganisationUnitGroup> groups = new HashSet<>();
-
+    
     /**
      * The maximum number of organisation unit levels to fetch, relative to the
      * real root of the hierarchy.

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java	2015-09-16 18:31:45 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java	2015-09-17 06:53:33 +0000
@@ -342,19 +342,6 @@
     List<OrganisationUnit> getOrganisationUnitsAtLevels( Collection<Integer> levels, Collection<OrganisationUnit> parents );
 
     /**
-     * Returns all OrganisationUnits which are children of the given units and are
-     * at the given hierarchical level. The root OrganisationUnits are at level 1.
-     * If parents is null, then all OrganisationUnits at the given level are returned.
-     *
-     * @param level  the hierarchical level.
-     * @param parent the parent units.
-     * @return all OrganisationUnits which are children of the given units and are
-     * at the given hierarchical level.
-     * @throws IllegalArgumentException if the level is illegal.
-     */
-    List<OrganisationUnit> getOrganisationUnitsAtLevel( int level, Collection<OrganisationUnit> parents );
-
-    /**
      * Returns the number of levels in the OrganisationUnit hierarchy.
      *
      * @return the number of hierarchical levels.

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java	2015-09-16 18:31:45 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java	2015-09-17 06:53:33 +0000
@@ -433,7 +433,7 @@
             return roots;
         }
 
-        return getOrganisationUnitsAtLevel( level, roots );
+        return getOrganisationUnitsAtLevels( Sets.newHashSet( level ), roots );
     }
 
     @Override
@@ -442,16 +442,7 @@
         List<OrganisationUnit> parents = new ArrayList<>();
         parents.add( parent );
 
-        return getOrganisationUnitsAtLevel( level, parent != null ? parents : null );
-    }
-
-    @Override
-    public List<OrganisationUnit> getOrganisationUnitsAtLevel( int level, Collection<OrganisationUnit> parents )
-    {
-        Set<Integer> levels = new HashSet<>();
-        levels.add( level );
-
-        return getOrganisationUnitsAtLevels( levels, parents );
+        return getOrganisationUnitsAtLevels( Sets.newHashSet( level ), parent != null ? parents : null );
     }
 
     //TODO rewrite using path

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitServiceTest.java	2015-09-16 18:31:45 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitServiceTest.java	2015-09-17 06:53:33 +0000
@@ -537,12 +537,9 @@
         List<OrganisationUnit> unitsA = new ArrayList<>( Arrays.asList( unitB, unitC ) );
         List<OrganisationUnit> unitsB = new ArrayList<>( Arrays.asList( unitD, unitE ) );
 
-        OrganisationUnit nill = null;
-
-        assertTrue( equals( organisationUnitService.getOrganisationUnitsAtLevel( 3, unitsA ), unitD, unitE, unitF, unitG ) );
-        assertTrue( equals( organisationUnitService.getOrganisationUnitsAtLevel( 4, unitsA ), unitH, unitI, unitJ, unitK, unitL, unitM, unitN, unitO ) );
-        assertTrue( equals( organisationUnitService.getOrganisationUnitsAtLevel( 4, unitsB ), unitH, unitI, unitJ, unitK ) );
-        assertTrue( equals( organisationUnitService.getOrganisationUnitsAtLevel( 2, nill ), unitB, unitC ) );
+        assertTrue( equals( organisationUnitService.getOrganisationUnitsAtLevels( Sets.newHashSet( 3 ), unitsA ), unitD, unitE, unitF, unitG ) );
+        assertTrue( equals( organisationUnitService.getOrganisationUnitsAtLevels( Sets.newHashSet( 4 ), unitsA ), unitH, unitI, unitJ, unitK, unitL, unitM, unitN, unitO ) );
+        assertTrue( equals( organisationUnitService.getOrganisationUnitsAtLevels( Sets.newHashSet( 4 ), unitsB ), unitH, unitI, unitJ, unitK ) );
 
         assertEquals( 2, unitB.getLevel() );
         assertEquals( 3, unitD.getLevel() );

=== modified file 'dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/fred/webapi/v1/utils/OrganisationUnitToFacilityConverter.java'
--- dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/fred/webapi/v1/utils/OrganisationUnitToFacilityConverter.java	2015-09-17 04:29:29 +0000
+++ dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/fred/webapi/v1/utils/OrganisationUnitToFacilityConverter.java	2015-09-17 06:53:33 +0000
@@ -28,24 +28,22 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
 import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.web.ohie.fred.webapi.v1.controller.FacilityController;
 import org.hisp.dhis.web.ohie.fred.webapi.v1.domain.Facility;
 import org.hisp.dhis.web.ohie.fred.webapi.v1.domain.Identifier;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.convert.converter.Converter;
 import org.springframework.stereotype.Component;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
-
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */