← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22098: Cat option combo, removed outdated code

 

------------------------------------------------------------
revno: 22098
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2016-03-01 23:30:53 +0100
message:
  Cat option combo, removed outdated code
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.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/dataelement/DataElementCategoryOptionCombo.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java	2016-02-11 09:27:02 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java	2016-03-01 22:30:53 +0000
@@ -28,12 +28,9 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.Collection;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
 
 import org.apache.commons.lang3.StringUtils;
@@ -87,7 +84,6 @@
 
     public DataElementCategoryOptionCombo()
     {
-
     }
     
     // -------------------------------------------------------------------------
@@ -200,76 +196,11 @@
         categoryOptions.clear();
     }
 
-    /**
-     * Tests whether two objects compare on a name basis. The default equals
-     * method becomes unusable in the case of detached objects in conjunction
-     * with persistence frameworks that put proxys on associated objects and
-     * collections, since it tests the class type which will differ between the
-     * proxy and the raw type.
-     *
-     * @param object the object to test for equality.
-     * @return true if objects are equal, false otherwise.
-     */
-    public boolean equalsOnName( DataElementCategoryOptionCombo object )
-    {
-        if ( this == object )
-        {
-            return true;
-        }
-
-        if ( object == null || object.getCategoryCombo() == null || object.getCategoryOptions() == null )
-        {
-            return false;
-        }
-
-        if ( !categoryCombo.getName().equals( object.getCategoryCombo().getName() ) )
-        {
-            return false;
-        }
-
-        if ( categoryOptions.size() != object.getCategoryOptions().size() )
-        {
-            return false;
-        }
-
-        final Set<String> names1 = new HashSet<>();
-        final Set<String> names2 = new HashSet<>();
-
-        for ( DataElementCategoryOption option : categoryOptions )
-        {
-            names1.add( option.getName() );
-        }
-
-        for ( DataElementCategoryOption option : object.getCategoryOptions() )
-        {
-            names2.add( option.getName() );
-        }
-
-        return names1.equals( names2 );
-    }
-
     public boolean isDefault()
     {
         return categoryCombo != null && DEFAULT_NAME.equals( categoryCombo.getName() );
     }
 
-    /**
-     * Creates a mapping between the category option combo identifier and name
-     * for the given collection of elements.
-     */
-    @Deprecated
-    public static Map<Integer, String> getCategoryOptionComboMap( Collection<DataElementCategoryOptionCombo> categoryOptionCombos )
-    {
-        Map<Integer, String> map = new HashMap<>();
-
-        for ( DataElementCategoryOptionCombo coc : categoryOptionCombos )
-        {
-            map.put( coc.getId(), coc.getName() );
-        }
-
-        return map;
-    }
-
     // -------------------------------------------------------------------------
     // Getters and setters
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java	2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java	2016-03-01 22:30:53 +0000
@@ -418,15 +418,6 @@
     /**
      * Retrieves a DataElementCategoryOptionCombo.
      *
-     * @param categoryOptionCombo the DataElementCategoryOptionCombo to
-     *                            retrieve.
-     * @return a DataElementCategoryOptionCombo.
-     */
-    DataElementCategoryOptionCombo getDataElementCategoryOptionCombo( DataElementCategoryOptionCombo categoryOptionCombo );
-
-    /**
-     * Retrieves a DataElementCategoryOptionCombo.
-     *
      * @param categoryCombo   the DataElementCategoryOptionCombo.
      * @param categoryOptions the set of DataElementCategoryOptions.
      */

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java	2016-01-11 06:09:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java	2016-03-01 22:30:53 +0000
@@ -560,25 +560,6 @@
     }
 
     @Override
-    public DataElementCategoryOptionCombo getDataElementCategoryOptionCombo( DataElementCategoryOptionCombo categoryOptionCombo )
-    {
-        for ( DataElementCategoryOptionCombo dcoc : getAllDataElementCategoryOptionCombos() )
-        {
-            // -----------------------------------------------------------------
-            // Hibernate puts proxies on associations and makes the native
-            // equals methods unusable
-            // -----------------------------------------------------------------
-
-            if ( dcoc.equalsOnName( categoryOptionCombo ) )
-            {
-                return dcoc;
-            }
-        }
-
-        return null;
-    }
-
-    @Override
     public DataElementCategoryOptionCombo getDataElementCategoryOptionCombo( DataElementCategoryCombo categoryCombo,
         Set<DataElementCategoryOption> categoryOptions )
     {