← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19844: Removed service layer method

 

------------------------------------------------------------
revno: 19844
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-08-25 12:17:01 +0200
message:
  Removed service layer 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-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitListAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/META-INF/dhis/beans.xml


--
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-08-06 13:12:50 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java	2015-08-25 10:17:01 +0000
@@ -160,15 +160,6 @@
     List<OrganisationUnit> getAllOrganisationUnitsByStatusLastUpdated( boolean status, Date lastUpdated );
 
     /**
-     * Returns all OrganisationUnits with corresponding name key based on the given list.
-     *
-     * @param orgUnits the collection of organization unit objects.
-     * @param key      the name key.
-     * @return a collection of OrganisationUnits.
-     */
-    void searchOrganisationUnitByName( List<OrganisationUnit> orgUnits, String key );
-
-    /**
      * Returns all OrganisationUnits with corresponding identifiers.
      *
      * @param identifiers the collection of identifiers.

=== 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-08-06 13:12:50 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java	2015-08-25 10:17:01 +0000
@@ -207,20 +207,6 @@
     }
 
     @Override
-    public void searchOrganisationUnitByName( List<OrganisationUnit> orgUnits, String key )
-    {
-        Iterator<OrganisationUnit> iterator = orgUnits.iterator();
-
-        while ( iterator.hasNext() )
-        {
-            if ( !iterator.next().getName().toLowerCase().contains( key.toLowerCase() ) )
-            {
-                iterator.remove();
-            }
-        }
-    }
-
-    @Override
     public List<OrganisationUnit> getOrganisationUnits( final Collection<Integer> identifiers )
     {
         List<OrganisationUnit> objects = getAllOrganisationUnits();

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitListAction.java	2015-02-19 09:18:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitListAction.java	2015-08-25 10:17:01 +0000
@@ -34,10 +34,10 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
+import java.util.stream.Collectors;
 
 import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
 import org.hisp.dhis.paging.ActionPagingSupport;
 
@@ -53,13 +53,6 @@
     // Dependencies
     // -------------------------------------------------------------------------
     
-    private OrganisationUnitService organisationUnitService;
-
-    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
-    {
-        this.organisationUnitService = organisationUnitService;
-    }
-
     private OrganisationUnitSelectionManager selectionManager;
 
     public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
@@ -121,7 +114,7 @@
 
         if ( isNotBlank( key ) )
         {
-            organisationUnitService.searchOrganisationUnitByName( organisationUnits, key );
+            organisationUnits = organisationUnits.stream().filter( p -> p.getName().toLowerCase().contains( key.toLowerCase() ) ).collect( Collectors.toList() );
         }
 
         this.paging = createPaging( organisationUnits.size() );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/META-INF/dhis/beans.xml	2015-03-27 17:33:25 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/META-INF/dhis/beans.xml	2015-08-25 10:17:01 +0000
@@ -9,7 +9,6 @@
   <bean id="org.hisp.dhis.oum.action.organisationunit.GetOrganisationUnitListAction" class="org.hisp.dhis.oum.action.organisationunit.GetOrganisationUnitListAction"
     scope="prototype">
     <property name="selectionManager" ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
-    <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
   </bean>
 
   <bean id="org.hisp.dhis.oum.action.organisationunit.GetOrganisationUnitAction" class="org.hisp.dhis.oum.action.organisationunit.GetOrganisationUnitAction"