← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2022: Removed unnecessary Measure interface

 

------------------------------------------------------------
revno: 2022
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2010-11-09 22:57:28 +0100
message:
  Removed unnecessary Measure interface
removed:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/Measure.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValue.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionOption.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java
  dhis-2/dhis-api/src/test/java/org/hisp/dhis/dataelement/DimensionTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueDimensionTest.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/DataElementCategoryOption.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java	2010-10-28 09:17:13 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java	2010-11-09 21:57:28 +0000
@@ -31,7 +31,6 @@
 import java.util.Set;
 
 import org.hisp.dhis.common.IdentifiableObject;
-import org.hisp.dhis.dimension.Dimension;
 import org.hisp.dhis.dimension.DimensionOption;
 import org.hisp.dhis.dimension.DimensionOptionElement;
 import org.hisp.dhis.dimension.DimensionType;
@@ -83,11 +82,6 @@
         return DimensionType.CATEGORY;
     }
     
-    public Dimension getDimension()
-    {
-        return category;
-    }
-    
     // -------------------------------------------------------------------------
     // hashCode, equals and toString
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java	2010-11-09 21:57:28 +0000
@@ -31,7 +31,6 @@
 import java.util.Set;
 
 import org.hisp.dhis.common.IdentifiableObject;
-import org.hisp.dhis.dimension.Dimension;
 import org.hisp.dhis.dimension.DimensionOption;
 import org.hisp.dhis.dimension.DimensionOptionElement;
 import org.hisp.dhis.dimension.DimensionType;
@@ -74,11 +73,6 @@
         return members;
     }
     
-    public Dimension getDimension()
-    {
-        return groupSet;
-    }
-    
     // -------------------------------------------------------------------------
     // hashCode and equals
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValue.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValue.java	2010-10-22 10:11:39 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValue.java	2010-11-09 21:57:28 +0000
@@ -29,16 +29,10 @@
 
 import java.io.Serializable;
 import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
 
 import org.hisp.dhis.common.ImportableObject;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dimension.Dimension;
-import org.hisp.dhis.dimension.DimensionOption;
-import org.hisp.dhis.dimension.DimensionSet;
-import org.hisp.dhis.dimension.Measure;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.source.Source;
 
@@ -47,14 +41,11 @@
  * @version $Id: DataValue.java 4638 2008-02-25 10:06:47Z larshelg $
  */
 public class DataValue
-    implements Serializable, Measure, ImportableObject
+    implements Serializable, ImportableObject
 {
     public static final String TRUE = "true";
     public static final String FALSE = "false";
     
-    
-    
-    
     /**
      * Part of the DataValue's composite ID
      */
@@ -153,37 +144,6 @@
     // -------------------------------------------------------------------------
     // Dimension
     // -------------------------------------------------------------------------
-
-    public Map<Dimension, DimensionOption> getDimensions()
-    {
-        Map<Dimension, DimensionOption> dimensions = new HashMap<Dimension, DimensionOption>();
-        
-        dimensions.put( DataElement.DIMENSION, dataElement );
-        dimensions.put( Period.DIMENSION, period );
-        dimensions.put( Source.DIMENSION, source );
-        
-        if ( optionCombo != null && !optionCombo.isDefault() )
-        {
-            for ( DimensionOption dimensionOption : optionCombo.getDimensionOptions() )
-            {
-                dimensions.put( dimensionOption.getDimension(), dimensionOption );
-            }
-        }
-        
-        return dimensions;
-    }
-    
-    public Map<Dimension, DimensionOption> getDimensions( DimensionSet dimensionSet )
-    {
-        Map<Dimension, DimensionOption> dimensions = getDimensions();
-                
-        for ( Dimension dimension : dimensionSet.getDimensions() )
-        {
-            dimensions.put( dimension, dimension.getDimensionOption( dataElement ) );
-        }
-        
-        return dimensions;
-    }
     
     public String getMeasure()
     {

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionOption.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionOption.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionOption.java	2010-11-09 21:57:28 +0000
@@ -39,6 +39,4 @@
     DimensionType getDimensionType();
     
     Set<? extends DimensionOptionElement> getDimensionOptionElements();
-    
-    Dimension getDimension();
 }

=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/Measure.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/Measure.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/Measure.java	1970-01-01 00:00:00 +0000
@@ -1,42 +0,0 @@
-package org.hisp.dhis.dimension;
-
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.Map;
-
-/**
- * @author Lars Helge Overland
- */
-public interface Measure
-{
-    Map<Dimension, DimensionOption> getDimensions();
-    
-    Map<Dimension, DimensionOption> getDimensions( DimensionSet dimensionSet );
-    
-    String getMeasure();
-}

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java	2010-11-09 21:57:28 +0000
@@ -31,7 +31,6 @@
 import java.util.Set;
 
 import org.hisp.dhis.common.IdentifiableObject;
-import org.hisp.dhis.dimension.Dimension;
 import org.hisp.dhis.dimension.DimensionOption;
 import org.hisp.dhis.dimension.DimensionOptionElement;
 import org.hisp.dhis.dimension.DimensionType;
@@ -73,11 +72,6 @@
     {
         return members;
     }
-
-    public Dimension getDimension()
-    {
-        return groupSet;
-    }
     
     // -------------------------------------------------------------------------
     // hashCode and equals

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java	2010-05-12 12:01:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java	2010-11-09 21:57:28 +0000
@@ -31,7 +31,6 @@
 import java.util.Set;
 
 import org.hisp.dhis.common.IdentifiableObject;
-import org.hisp.dhis.dimension.Dimension;
 import org.hisp.dhis.dimension.DimensionOption;
 import org.hisp.dhis.dimension.DimensionOptionElement;
 import org.hisp.dhis.dimension.DimensionType;
@@ -65,11 +64,6 @@
     // hashCode and equals
     // -------------------------------------------------------------------------
 
-    public Dimension getDimension()
-    {
-        return groupSet;
-    }
-
     public Set<? extends DimensionOptionElement> getDimensionOptionElements()
     {
         return members;

=== modified file 'dhis-2/dhis-api/src/test/java/org/hisp/dhis/dataelement/DimensionTest.java'
--- dhis-2/dhis-api/src/test/java/org/hisp/dhis/dataelement/DimensionTest.java	2010-06-23 17:50:25 +0000
+++ dhis-2/dhis-api/src/test/java/org/hisp/dhis/dataelement/DimensionTest.java	2010-11-09 21:57:28 +0000
@@ -32,18 +32,11 @@
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Map;
 
-import org.hisp.dhis.datavalue.DataValue;
 import org.hisp.dhis.dimension.BasicDimensionSet;
 import org.hisp.dhis.dimension.Dimension;
-import org.hisp.dhis.dimension.DimensionOption;
 import org.hisp.dhis.dimension.DimensionOptionElement;
 import org.hisp.dhis.dimension.DimensionSet;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.period.MonthlyPeriodType;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.source.Source;
 import org.junit.Test;
 
 /**
@@ -54,9 +47,6 @@
     @Test
     public void testGroupSetDimensions()
     {
-        OrganisationUnit source = new OrganisationUnit( "Bobs Clinic" );
-        Period period = new MonthlyPeriodType().createPeriod();
-        
         DataElement hivAids = new DataElement( "HivAids" );
         DataElement malaria = new DataElement( "Malaria" );
         DataElement diabetes = new DataElement( "Diabetes" );
@@ -81,40 +71,6 @@
         diseaseType.getMembers().add( communicable );
         diseaseType.getMembers().add( nonCommunicable );
         
-        DataValue dataValue = new DataValue( hivAids, period, source );
-        
-        Map<Dimension, DimensionOption> dimensions = dataValue.getDimensions( diseaseByType );
-        
-        // Test Measure.getDimensions
-        
-        assertEquals( 4, dimensions.size() );
-        
-        assertTrue( dimensions.keySet().contains( diseaseType ) );
-        assertTrue( dimensions.keySet().contains( DataElement.DIMENSION ) );
-        assertTrue( dimensions.keySet().contains( Period.DIMENSION ) );
-        assertTrue( dimensions.keySet().contains( Source.DIMENSION ) );
-        
-        assertTrue( dimensions.values().contains( communicable ) );
-        assertTrue( dimensions.values().contains( hivAids ) );
-        assertTrue( dimensions.values().contains( period ) );
-        assertTrue( dimensions.values().contains( source ) );
-
-        dataValue = new DataValue( diabetes, period, source );
-        
-        dimensions = dataValue.getDimensions( diseaseByType );
-        
-        assertEquals( 4, dimensions.size() );
-        
-        assertTrue( dimensions.keySet().contains( diseaseType ) );
-        assertTrue( dimensions.keySet().contains( DataElement.DIMENSION ) );
-        assertTrue( dimensions.keySet().contains( Period.DIMENSION ) );
-        assertTrue( dimensions.keySet().contains( Source.DIMENSION ) );
-        
-        assertTrue( dimensions.values().contains( nonCommunicable ) );
-        assertTrue( dimensions.values().contains( diabetes ) );
-        assertTrue( dimensions.values().contains( period ) );
-        assertTrue( dimensions.values().contains( source ) );
-        
         // Test Dimension.getDimensionOption
         
         assertEquals( communicable, diseaseType.getDimensionOption( hivAids ) );
@@ -131,6 +87,6 @@
         assertTrue( dimensionOptionElements.contains( hivAids ) );
         assertTrue( dimensionOptionElements.contains( malaria ) );
         assertTrue( dimensionOptionElements.contains( diabetes ) );
-        assertTrue( dimensionOptionElements.contains( cancer ) );
+        assertTrue( dimensionOptionElements.contains( cancer ) );        
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueDimensionTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueDimensionTest.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueDimensionTest.java	2010-11-09 21:57:28 +0000
@@ -34,12 +34,9 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Map;
 
 import org.apache.commons.collections.CollectionUtils;
 import org.hisp.dhis.DhisSpringTest;
-import org.hisp.dhis.dimension.Dimension;
-import org.hisp.dhis.dimension.DimensionOption;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategory;
 import org.hisp.dhis.dataelement.DataElementCategoryCombo;
@@ -145,13 +142,6 @@
         DataValue dataValue = dataValueService.getDataValue( sourceA, dataElementA, periodA, categoryOptionCombo );
         
         assertNotNull( dataValue );
-        
-        Map<Dimension, DimensionOption> dimensions = dataValue.getDimensions();
-        
-        assertEquals( dimensions.keySet().size(), 4 );
-        assertEquals( dataElementA, dimensions.get( DataElement.DIMENSION ) );
-        assertEquals( periodA, dimensions.get( Period.DIMENSION ) );
-        assertEquals( sourceA, dimensions.get( Source.DIMENSION ) );
     }
     
     @Test