← Back to team overview

dhis2-devs team mailing list archive

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

 

------------------------------------------------------------
revno: 20210
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-09-17 14:29:02 +0200
message:
  Removed method
modified:
  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


--
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/OrganisationUnitService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java	2015-09-17 06:53:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java	2015-09-17 12:29:02 +0000
@@ -293,18 +293,6 @@
     List<OrganisationUnit> getOrganisationUnitsWithChildren( Collection<String> uids, Integer maxLevels );
 
     /**
-     * Returns the branch of OrganisationUnits from a root to a given
-     * OrganisationUnit. Both root and target OrganisationUnits are included in
-     * the returned collection.
-     *
-     * @param id the id of the OrganisationUnit to trace upwards from.
-     * @return the list of OrganisationUnits from a root to the given
-     * OrganisationUnit, or an empty list if the given OrganisationUnit
-     * doesn't exist.
-     */
-    List<OrganisationUnit> getOrganisationUnitBranch( int id );
-
-    /**
      * Returns all OrganisationUnits at a given hierarchical level. The root
      * OrganisationUnits are at level 1.
      *

=== 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-17 06:53:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java	2015-09-17 12:29:02 +0000
@@ -396,34 +396,6 @@
     }
 
     @Override
-    public List<OrganisationUnit> getOrganisationUnitBranch( int id )
-    {
-        OrganisationUnit organisationUnit = getOrganisationUnit( id );
-
-        if ( organisationUnit == null )
-        {
-            return Collections.emptyList();
-        }
-
-        ArrayList<OrganisationUnit> result = new ArrayList<>();
-
-        result.add( organisationUnit );
-
-        OrganisationUnit parent = organisationUnit.getParent();
-
-        while ( parent != null )
-        {
-            result.add( parent );
-
-            parent = parent.getParent();
-        }
-
-        Collections.reverse( result ); // From root to target
-
-        return result;
-    }
-
-    @Override
     public List<OrganisationUnit> getOrganisationUnitsAtLevel( int level )
     {
         List<OrganisationUnit> roots = getRootOrganisationUnits();

=== 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-17 06:53:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitServiceTest.java	2015-09-17 12:29:02 +0000
@@ -276,28 +276,6 @@
     }
 
     @Test
-    public void testGetOrganisationUnitGraph()
-    {
-        OrganisationUnit organisationUnit1 = createOrganisationUnit( 'A' );
-        OrganisationUnit organisationUnit2 = createOrganisationUnit( 'B', organisationUnit1 );
-        OrganisationUnit organisationUnit3 = createOrganisationUnit( 'C', organisationUnit2 );
-
-        int orgId1 = organisationUnitService.addOrganisationUnit( organisationUnit1 );
-        int orgId2 = organisationUnitService.addOrganisationUnit( organisationUnit2 );
-        int orgId3 = organisationUnitService.addOrganisationUnit( organisationUnit3 );
-
-        List<OrganisationUnit> graph = organisationUnitService.getOrganisationUnitBranch( orgId3 );
-        assertNotNull( graph );
-        assertEquals( 3, graph.size() );
-        OrganisationUnit orgUnit = graph.get( 0 );
-        assertEquals( orgId1, orgUnit.getId() );
-        orgUnit = graph.get( 1 );
-        assertEquals( orgId2, orgUnit.getId() );
-        orgUnit = graph.get( 2 );
-        assertEquals( orgId3, orgUnit.getId() );
-    }
-
-    @Test
     public void testGetAllOrganisationUnitsAndGetRootOrganisationUnit()
     {
         // creating a tree with two roots ( id1 and id4 )