← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19843: Removed unused service layer methods

 

------------------------------------------------------------
revno: 19843
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-08-25 12:03:15 +0200
message:
  Removed unused service layer methods
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/DefaultIndicatorService.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/indicator/IndicatorServiceTest.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/GetAssignedIndicatorGroupsAction.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/indicator/IndicatorService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorService.java	2015-06-16 05:11:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorService.java	2015-08-25 10:03:15 +0000
@@ -132,8 +132,6 @@
 
     List<IndicatorGroup> getIndicatorGroupByName( String name );
 
-    List<IndicatorGroup> getGroupsContainingIndicator( Indicator indicator );
-
     List<IndicatorGroup> getIndicatorGroupsBetween( int first, int max );
 
     List<IndicatorGroup> getIndicatorGroupsBetweenByName( String name, int first, int max );
@@ -160,12 +158,8 @@
 
     List<IndicatorGroupSet> getIndicatorGroupSetByName( String name );
 
-    List<IndicatorGroupSet> getCompulsoryIndicatorGroupSets();
-
     List<IndicatorGroupSet> getCompulsoryIndicatorGroupSetsWithMembers();
 
-    List<IndicatorGroupSet> getCompulsoryIndicatorGroupSetsNotAssignedTo( Indicator indicator );
-
     List<IndicatorGroupSet> getAllIndicatorGroupSets();
 
     List<IndicatorGroupSet> getIndicatorGroupSets( Collection<Integer> identifiers );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/DefaultIndicatorService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/DefaultIndicatorService.java	2015-06-16 05:11:29 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/DefaultIndicatorService.java	2015-08-25 10:03:15 +0000
@@ -36,13 +36,12 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.List;
 
 import org.hisp.dhis.common.GenericIdentifiableObjectStore;
-import org.hisp.dhis.i18n.I18nService;
 import org.hisp.dhis.commons.filter.Filter;
 import org.hisp.dhis.commons.filter.FilterUtils;
+import org.hisp.dhis.i18n.I18nService;
 import org.springframework.transaction.annotation.Transactional;
 
 /**
@@ -379,26 +378,6 @@
     }
 
     @Override
-    public List<IndicatorGroup> getGroupsContainingIndicator( Indicator indicator )
-    {
-        List<IndicatorGroup> groups = getAllIndicatorGroups();
-
-        Iterator<IndicatorGroup> iterator = groups.iterator();
-
-        while ( iterator.hasNext() )
-        {
-            IndicatorGroup group = iterator.next();
-
-            if ( !group.getMembers().contains( indicator ) )
-            {
-                iterator.remove();
-            }
-        }
-
-        return groups;
-    }
-
-    @Override
     public int getIndicatorGroupCount()
     {
         return indicatorGroupStore.getCount();
@@ -476,22 +455,6 @@
     }
 
     @Override
-    public List<IndicatorGroupSet> getCompulsoryIndicatorGroupSets()
-    {
-        List<IndicatorGroupSet> groupSets = new ArrayList<>();
-
-        for ( IndicatorGroupSet groupSet : getAllIndicatorGroupSets() )
-        {
-            if ( groupSet.isCompulsory() )
-            {
-                groupSets.add( groupSet );
-            }
-        }
-
-        return groupSets;
-    }
-
-    @Override
     public List<IndicatorGroupSet> getCompulsoryIndicatorGroupSetsWithMembers()
     {
         return FilterUtils.filter( getAllIndicatorGroupSets(), new Filter<IndicatorGroupSet>()
@@ -505,22 +468,6 @@
     }
 
     @Override
-    public List<IndicatorGroupSet> getCompulsoryIndicatorGroupSetsNotAssignedTo( Indicator indicator )
-    {
-        List<IndicatorGroupSet> groupSets = new ArrayList<>();
-
-        for ( IndicatorGroupSet groupSet : getCompulsoryIndicatorGroupSets() )
-        {
-            if ( !groupSet.isMemberOfIndicatorGroups( indicator ) && groupSet.hasIndicatorGroups() )
-            {
-                groupSets.add( groupSet );
-            }
-        }
-
-        return groupSets;
-    }
-
-    @Override
     public List<IndicatorGroupSet> getAllIndicatorGroupSets()
     {
         return i18n( i18nService, indicatorGroupSetStore.getAll() );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/indicator/IndicatorServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/indicator/IndicatorServiceTest.java	2015-06-16 05:11:29 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/indicator/IndicatorServiceTest.java	2015-08-25 10:03:15 +0000
@@ -33,9 +33,7 @@
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
-import java.util.HashSet;
 import java.util.List;
-import java.util.Set;
 
 import org.hisp.dhis.DhisSpringTest;
 import org.junit.Test;
@@ -264,57 +262,6 @@
         assertTrue( indicatorService.getIndicatorGroupByName( "IndicatorGroupC" ).isEmpty() );
     }
 
-    @Test
-    public void testGetGroupsContainingIndicator() throws Exception
-    {
-        IndicatorType indicatorType = new IndicatorType( "indicatorTypeName", 100, false );
-        indicatorService.addIndicatorType( indicatorType );
-
-        Indicator indicator1 = createIndicator( 'A', indicatorType );
-        Indicator indicator2 = createIndicator( 'B', indicatorType );
-        Indicator indicator3 = createIndicator( 'C', indicatorType );
-        Indicator indicator4 = createIndicator( 'D', indicatorType );
-
-        indicatorService.addIndicator( indicator1 );
-        indicatorService.addIndicator( indicator2 );
-        indicatorService.addIndicator( indicator3 );
-        indicatorService.addIndicator( indicator4 );
-
-        IndicatorGroup indicatorGroup1 = new IndicatorGroup( "indicatorGroupName1" );
-        IndicatorGroup indicatorGroup2 = new IndicatorGroup( "indicatorGroupName2" );
-        IndicatorGroup indicatorGroup3 = new IndicatorGroup( "indicatorGroupName3" );
-        IndicatorGroup indicatorGroup4 = new IndicatorGroup( "indicatorGroupName4" );
-
-        Set<Indicator> members1 = new HashSet<>();
-        Set<Indicator> members2 = new HashSet<>();
-
-        members1.add( indicator1 );
-        members1.add( indicator2 );
-        members2.add( indicator1 );
-        members2.add( indicator3 );
-        members2.add( indicator4 );
-
-        indicatorGroup1.setMembers( members1 );
-        indicatorGroup2.setMembers( members2 );
-        indicatorGroup3.setMembers( members1 );
-        indicatorGroup4.setMembers( members2 );
-
-        indicatorService.addIndicatorGroup( indicatorGroup1 );
-        indicatorService.addIndicatorGroup( indicatorGroup2 );
-        indicatorService.addIndicatorGroup( indicatorGroup3 );
-        indicatorService.addIndicatorGroup( indicatorGroup4 );
-
-        List<IndicatorGroup> groups1 = indicatorService.getGroupsContainingIndicator( indicator1 );
-
-        assertTrue( groups1.size() == 4 );
-
-        List<IndicatorGroup> groups2 = indicatorService.getGroupsContainingIndicator( indicator2 );
-
-        assertTrue( groups2.size() == 2 );
-        assertTrue( groups2.contains( indicatorGroup1 ) );
-        assertTrue( groups2.contains( indicatorGroup3 ) );
-    }
-
     // -------------------------------------------------------------------------
     // Indicator
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/GetAssignedIndicatorGroupsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/GetAssignedIndicatorGroupsAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/GetAssignedIndicatorGroupsAction.java	2015-08-25 10:03:15 +0000
@@ -88,7 +88,7 @@
         {
             Indicator indicator = indicatorService.getIndicator( indicatorId );
 
-            indicatorGroups = new ArrayList<>( indicatorService.getGroupsContainingIndicator( indicator ) );
+            indicatorGroups = new ArrayList<>( indicator.getGroups() );
 
             Collections.sort( indicatorGroups, IdentifiableObjectNameComparator.INSTANCE );
         }