dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #10159
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2788: Removed the Dimension interfaces, just too complex and hard to maintain
------------------------------------------------------------
revno: 2788
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-01-31 20:47:04 +0100
message:
Removed the Dimension interfaces, just too complex and hard to maintain
removed:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/BasicDimensionSet.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/Dimension.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionOption.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionOptionElement.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionSet.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionType.java
dhis-2/dhis-api/src/test/java/org/hisp/dhis/dataelement/DimensionTest.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dimension/
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dimension/DefaultDimensionService.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dimension/
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dimension/DimensionServiceTest.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetDimensionSetDataElementsAction.java
added:
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetCategoryComboDataElementsAction.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueStore.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java
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-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/source/Source.java
dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedDataValueService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedDataValueStore.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DXFConverter.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/ReportTableConverter.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/xml/LocManagerXSLTLocator.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/statement/CreateReportTableStatement.java
dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetTableOptionsAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/SaveTableAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties
dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addTableForm.vm
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/lists.js
--
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/aggregation/AggregatedDataValueService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueService.java 2011-01-25 20:50:16 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueService.java 2011-01-31 19:47:04 +0000
@@ -31,11 +31,11 @@
import java.util.Map;
import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOption;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.dataelement.DataElementOperand;
import org.hisp.dhis.datavalue.DataValue;
import org.hisp.dhis.datavalue.DeflatedDataValue;
-import org.hisp.dhis.dimension.DimensionOption;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
@@ -87,12 +87,12 @@
* Gets the total aggregated value from the datamart table for the given parameters.
*
* @param dataElement The DataElement.
- * @param dimensionOptionElement the DimensionOptionElement.
+ * @param categoryOption the DataElementCategoryOption.
* @param period The Period.
* @param organisationUnit The OrganisationUnit.
* @return the aggregated value.
*/
- Double getAggregatedValue( DataElement dataElement, DimensionOption dimensionOption, Period period, OrganisationUnit organisationUnit );
+ Double getAggregatedValue( DataElement dataElement, DataElementCategoryOption categoryOption, Period period, OrganisationUnit organisationUnit );
/**
* Gets the aggregated value from the datamart table for the given parameters.
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueStore.java 2011-01-25 20:50:16 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueStore.java 2011-01-31 19:47:04 +0000
@@ -31,10 +31,10 @@
import java.util.Map;
import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOption;
import org.hisp.dhis.dataelement.DataElementOperand;
import org.hisp.dhis.datavalue.DataValue;
import org.hisp.dhis.datavalue.DeflatedDataValue;
-import org.hisp.dhis.dimension.DimensionOption;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
import org.hisp.dhis.period.Period;
@@ -75,12 +75,12 @@
* Gets the total aggregated value from the datamart table for the given parameters.
*
* @param dataElement The DataElement.
- * @param dimensionOptionElement the DimensionOptionElement.
+ * @param categoryOption the DataElementCategoryOption.
* @param period The Period.
* @param organisationUnit The OrganisationUnit.
* @return the aggregated value.
*/
- Double getAggregatedDataValue( DataElement dataElement, DimensionOption dimensionOption, Period period, OrganisationUnit organisationUnit );
+ Double getAggregatedDataValue( DataElement dataElement, DataElementCategoryOption categoryOption, Period period, OrganisationUnit organisationUnit );
/**
* Gets the aggregated value from the datamart table for the given parameters.
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2011-01-17 17:03:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2011-01-31 19:47:04 +0000
@@ -37,10 +37,6 @@
import org.apache.commons.lang.StringEscapeUtils;
import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.dimension.Dimension;
-import org.hisp.dhis.dimension.DimensionOption;
-import org.hisp.dhis.dimension.DimensionOptionElement;
-import org.hisp.dhis.dimension.DimensionType;
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.period.TwoYearlyPeriodType;
@@ -62,7 +58,6 @@
*/
public class DataElement
extends IdentifiableObject
- implements DimensionOption, DimensionOptionElement
{
public static final String VALUE_TYPE_STRING = "string";
@@ -188,83 +183,6 @@
}
// -------------------------------------------------------------------------
- // Dimension
- // -------------------------------------------------------------------------
-
- public static final Dimension DIMENSION = new DataElementDimension();
-
- public static class DataElementDimension
- extends Dimension
- {
- private static final String NAME = "DataElement";
-
- public String getName()
- {
- return NAME;
- }
-
- public List<? extends DimensionOption> getDimensionOptions()
- {
- return null;
- }
-
- @Override
- public boolean equals( Object o )
- {
- if ( this == o )
- {
- return true;
- }
-
- if ( o == null )
- {
- return false;
- }
-
- if ( !(o instanceof DataElementDimension) )
- {
- return false;
- }
-
- final DataElementDimension other = (DataElementDimension) o;
-
- return NAME.equals( other.getName() );
- }
-
- @Override
- public int hashCode()
- {
- return NAME.hashCode();
- }
-
- @Override
- public String toString()
- {
- return "[" + NAME + "]";
- }
- }
-
- public DimensionType getDimensionType()
- {
- return null; // DataElement is DimensionOption for the static DataElement dimension
- }
-
- public Set<? extends DimensionOptionElement> getDimensionOptionElements()
- {
- return null; // DataElement is DimensionOption for the static DataElement dimension
- }
-
- public List<? extends DimensionOption> getDimensionOptions()
- {
- return new ArrayList<DimensionOption>( groups );
- }
-
- public Dimension getDimension()
- {
- return DIMENSION;
- }
-
- // -------------------------------------------------------------------------
// hashCode, equals and toString
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java 2010-09-04 07:26:32 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java 2011-01-31 19:47:04 +0000
@@ -30,8 +30,8 @@
import java.util.ArrayList;
import java.util.List;
+import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.concept.Concept;
-import org.hisp.dhis.dimension.Dimension;
/**
* A Category is a dimension of a data element. DataElements can have sets of
@@ -43,7 +43,7 @@
* @version $Id DataElementCategory.java Aug 25, 2010 duyhieu$
*/
public class DataElementCategory
- extends Dimension
+ extends IdentifiableObject
{
public static final String DEFAULT_NAME = "default";
@@ -78,14 +78,22 @@
}
// -------------------------------------------------------------------------
- // Dimension
+ // Logic
// -------------------------------------------------------------------------
- public List<DataElementCategoryOption> getDimensionOptions()
+ public DataElementCategoryOption getCategoryOption( DataElementCategoryOptionCombo categoryOptionCombo )
{
- return categoryOptions;
+ for ( DataElementCategoryOption categoryOption : categoryOptions )
+ {
+ if ( categoryOption.getCategoryOptionCombos().contains( categoryOptionCombo ) )
+ {
+ return categoryOption;
+ }
+ }
+
+ return null;
}
-
+
// -------------------------------------------------------------------------
// hashCode, equals and toString
// -------------------------------------------------------------------------
@@ -148,5 +156,4 @@
{
this.concept = concept;
}
-
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java 2010-12-07 17:02:27 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java 2011-01-31 19:47:04 +0000
@@ -33,17 +33,13 @@
import java.util.Set;
import org.hisp.dhis.common.IdentifiableObject;
-import org.hisp.dhis.dimension.Dimension;
-import org.hisp.dhis.dimension.DimensionOptionElement;
-import org.hisp.dhis.dimension.DimensionSet;
-import org.hisp.dhis.dimension.DimensionType;
/**
* @author Abyot Aselefew
* @version $Id$
*/
public class DataElementCategoryCombo
- extends IdentifiableObject implements DimensionSet
+ extends IdentifiableObject
{
public static final String DEFAULT_CATEGORY_COMBO_NAME = "default";
@@ -68,30 +64,6 @@
private Set<DataElementCategoryOptionCombo> optionCombos = new HashSet<DataElementCategoryOptionCombo>();
// -------------------------------------------------------------------------
- // Dimension
- // -------------------------------------------------------------------------
-
- public String getDimensionSetId()
- {
- return DimensionType.CATEGORY.name() + SEPARATOR_TYPE + id;
- }
-
- public DimensionType getDimensionType()
- {
- return DimensionType.CATEGORY;
- }
-
- public List<? extends Dimension> getDimensions()
- {
- return categories;
- }
-
- public List<? extends DimensionOptionElement> getDimensionOptionElements()
- {
- return new ArrayList<DimensionOptionElement>( optionCombos );
- }
-
- // -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
=== 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-11-09 21:57:28 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java 2011-01-31 19:47:04 +0000
@@ -31,16 +31,13 @@
import java.util.Set;
import org.hisp.dhis.common.IdentifiableObject;
-import org.hisp.dhis.dimension.DimensionOption;
-import org.hisp.dhis.dimension.DimensionOptionElement;
-import org.hisp.dhis.dimension.DimensionType;
/**
* @author Abyot Asalefew
* @version $Id$
*/
public class DataElementCategoryOption
- extends IdentifiableObject implements DimensionOption
+ extends IdentifiableObject
{
public static final String DEFAULT_NAME = "default";
@@ -65,24 +62,6 @@
}
// -------------------------------------------------------------------------
- // Constructors
- // -------------------------------------------------------------------------
-
- public Set<? extends DimensionOptionElement> getDimensionOptionElements()
- {
- return categoryOptionCombos;
- }
-
- // -------------------------------------------------------------------------
- // Dimension
- // -------------------------------------------------------------------------
-
- public DimensionType getDimensionType()
- {
- return DimensionType.CATEGORY;
- }
-
- // -------------------------------------------------------------------------
// hashCode, equals and toString
// -------------------------------------------------------------------------
=== 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 2010-10-28 09:17:13 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java 2011-01-31 19:47:04 +0000
@@ -36,8 +36,6 @@
import org.apache.commons.lang.StringEscapeUtils;
import org.hisp.dhis.common.IdentifiableObject;
-import org.hisp.dhis.dimension.DimensionOption;
-import org.hisp.dhis.dimension.DimensionOptionElement;
/**
* @author Abyot Aselefew
@@ -45,7 +43,6 @@
*/
public class DataElementCategoryOptionCombo
extends IdentifiableObject
- implements DimensionOptionElement
{
public static final String DEFAULT_NAME = "default";
@@ -70,15 +67,6 @@
}
// -------------------------------------------------------------------------
- // Dimension
- // -------------------------------------------------------------------------
-
- public List<? extends DimensionOption> getDimensionOptions()
- {
- return categoryOptions;
- }
-
- // -------------------------------------------------------------------------
// hashCode, equals and toString
// -------------------------------------------------------------------------
=== 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 2011-01-06 13:33:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java 2011-01-31 19:47:04 +0000
@@ -213,7 +213,7 @@
* @return a collection of DataElementCategoryCombos.
*/
Collection<DataElementCategoryCombo> getAllDataElementCategoryCombos();
-
+
// -------------------------------------------------------------------------
// CategoryOptionCombo
// -------------------------------------------------------------------------
=== 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-11-09 21:57:28 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java 2011-01-31 19:47:04 +0000
@@ -31,16 +31,13 @@
import java.util.Set;
import org.hisp.dhis.common.IdentifiableObject;
-import org.hisp.dhis.dimension.DimensionOption;
-import org.hisp.dhis.dimension.DimensionOptionElement;
-import org.hisp.dhis.dimension.DimensionType;
/**
* @author Kristian Nordal
* @version $Id: DataElementGroup.java 5540 2008-08-19 10:47:07Z larshelg $
*/
public class DataElementGroup
- extends IdentifiableObject implements DimensionOption
+ extends IdentifiableObject
{
private Set<DataElement> members = new HashSet<DataElement>();
@@ -58,20 +55,6 @@
{
this.name = name;
}
-
- // -------------------------------------------------------------------------
- // Dimension
- // -------------------------------------------------------------------------
-
- public DimensionType getDimensionType()
- {
- return DimensionType.DATAELEMENTGROUPSET;
- }
-
- public Set<? extends DimensionOptionElement> getDimensionOptionElements()
- {
- return members;
- }
// -------------------------------------------------------------------------
// hashCode and equals
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java 2011-01-31 19:47:04 +0000
@@ -31,8 +31,7 @@
import java.util.Collection;
import java.util.List;
-import org.hisp.dhis.dimension.Dimension;
-import org.hisp.dhis.dimension.DimensionOption;
+import org.hisp.dhis.common.IdentifiableObject;
/**
* DataElementGroupSet is a set of DataElementGroups. It is by default exclusive,
@@ -42,7 +41,7 @@
* @author Lars Helge Overland
*/
public class DataElementGroupSet
- extends Dimension
+ extends IdentifiableObject
{
private List<DataElementGroup> members = new ArrayList<DataElementGroup>();
@@ -60,15 +59,6 @@
}
// -------------------------------------------------------------------------
- // Dimension
- // -------------------------------------------------------------------------
-
- public List<? extends DimensionOption> getDimensionOptions()
- {
- return members;
- }
-
- // -------------------------------------------------------------------------
// Logic
// -------------------------------------------------------------------------
@@ -84,6 +74,19 @@
return dataElements;
}
+ public DataElementGroup getGroup( DataElement dataElement )
+ {
+ for ( DataElementGroup group : members )
+ {
+ if ( group.getMembers().contains( dataElement ) )
+ {
+ return group;
+ }
+ }
+
+ return null;
+ }
+
// -------------------------------------------------------------------------
// equals and hashCode
// -------------------------------------------------------------------------
=== removed directory 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension'
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/BasicDimensionSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/BasicDimensionSet.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/BasicDimensionSet.java 1970-01-01 00:00:00 +0000
@@ -1,178 +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.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * @author Lars Helge Overland
- */
-public class BasicDimensionSet
- implements DimensionSet
-{
- private List<? extends Dimension> dimensions;
-
- // -------------------------------------------------------------------------
- // Constructors
- // -------------------------------------------------------------------------
-
- protected BasicDimensionSet()
- {
- }
-
- public BasicDimensionSet( List<? extends Dimension> dimensions )
- {
- this.dimensions = dimensions;
- }
-
- public BasicDimensionSet( Dimension... dimensions )
- {
- this.dimensions = Arrays.asList( dimensions );
- }
-
- // -------------------------------------------------------------------------
- // DimensionSet implementation
- // -------------------------------------------------------------------------
-
- public String getName()
- {
- StringBuffer name = new StringBuffer();
-
- Iterator<? extends Dimension> iterator = getDimensions().iterator();
-
- while ( iterator.hasNext() )
- {
- name.append( iterator.next().getName() );
-
- if ( iterator.hasNext() )
- {
- name.append( SEPARATOR_NAME );
- }
- }
-
- return name.toString();
- }
-
- public String getDimensionSetId()
- {
- StringBuffer identifier = new StringBuffer( DimensionType.DATAELEMENTGROUPSET.name() + SEPARATOR_TYPE );
-
- Iterator<? extends Dimension> iterator = getDimensions().iterator();
-
- while ( iterator.hasNext() )
- {
- identifier.append( iterator.next().getId() );
-
- if ( iterator.hasNext() )
- {
- identifier.append( SEPARATOR_ID );
- }
- }
-
- return identifier.toString();
- }
-
- public DimensionType getDimensionType()
- {
- return DimensionType.valueOf( getDimensionSetId().split( SEPARATOR_TYPE )[0] );
- }
-
- public List<? extends Dimension> getDimensions()
- {
- return dimensions;
- }
-
- public List<? extends DimensionOptionElement> getDimensionOptionElements()
- {
- List<DimensionOptionElement> dimensionOptionElements = new ArrayList<DimensionOptionElement>();
-
- for ( Dimension dimension : getDimensions() )
- {
- for ( DimensionOption dimensionOption : dimension.getDimensionOptions() )
- {
- dimensionOptionElements.addAll( dimensionOption.getDimensionOptionElements() );
- }
- }
-
- return dimensionOptionElements;
- }
-
- // -------------------------------------------------------------------------
- // equals, hashCode, toString
- // -------------------------------------------------------------------------
-
- @Override
- public boolean equals( Object object )
- {
- if ( this == object )
- {
- return true;
- }
-
- if ( object == null )
- {
- return false;
- }
-
- if ( getClass() != object.getClass() )
- {
- return false;
- }
-
- BasicDimensionSet other = (BasicDimensionSet) object;
-
- if ( dimensions == null )
- {
- if ( other.dimensions != null )
- {
- return false;
- }
- }
- else if ( !( new HashSet<Dimension>( dimensions ).equals( new HashSet<Dimension>( other.dimensions ) ) ) )
- {
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode()
- {
- return dimensions == null ? 0 : dimensions.hashCode();
- }
-
- public String toString()
- {
- return "[" + getName() + "]";
- }
-}
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/Dimension.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/Dimension.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/Dimension.java 1970-01-01 00:00:00 +0000
@@ -1,54 +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.List;
-
-import org.hisp.dhis.common.IdentifiableObject;
-
-/**
- * @author Lars Helge Overland
- */
-public abstract class Dimension
- extends IdentifiableObject
-{
- public abstract List<? extends DimensionOption> getDimensionOptions();
-
- public final DimensionOption getDimensionOption( DimensionOptionElement dimensionOptionElement )
- {
- for ( DimensionOption dimensionOption : getDimensionOptions() )
- {
- if ( dimensionOption.getDimensionOptionElements().contains( dimensionOptionElement ) )
- {
- return dimensionOption;
- }
- }
-
- return null;
- }
-}
=== removed 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-11-09 21:57:28 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionOption.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.Set;
-
-/**
- * @author Lars Helge Overland
- */
-public interface DimensionOption
-{
- String getName();
-
- DimensionType getDimensionType();
-
- Set<? extends DimensionOptionElement> getDimensionOptionElements();
-}
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionOptionElement.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionOptionElement.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionOptionElement.java 1970-01-01 00:00:00 +0000
@@ -1,44 +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.List;
-
-/**
- * @author Lars Helge Overland
- */
-public interface DimensionOptionElement
-{
- int getId();
-
- String getName();
-
- String getShortName();
-
- List<? extends DimensionOption> getDimensionOptions();
-}
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionService.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionService.java 1970-01-01 00:00:00 +0000
@@ -1,64 +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.Collection;
-
-import org.hisp.dhis.dataelement.DataElement;
-
-/**
- * @author Lars Helge Overland
- */
-public interface DimensionService
-{
- final String ID = DimensionService.class.getName();
-
- /**
- * Returns the DimensionSet with the argument DimensionSet identifier.
- *
- * @param dimensionSetId the DimensionSet identifier.
- * @return the DimensionSet with the argument DimensionSet identifier. Null
- * of the argument is null or no DimensionSet exists for the identifier.
- */
- DimensionSet getDimensionSet( String dimensionSetId );
-
- /**
- * Returns all DataElement DimensionSets.
- *
- * @return a Collection of DataElement DimensionSets.
- */
- Collection<DimensionSet> getDataElementDimensionSets();
-
- /**
- * Returns all DataElemens associated with the argument DimensionSet.
- *
- * @param dimensionSet the DimensionSet.
- * @return a Collection of DataElements associated with the argument DimensionSet.
- */
- Collection<DataElement> getDataElements( DimensionSet dimensionSet );
-}
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionSet.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionSet.java 1970-01-01 00:00:00 +0000
@@ -1,55 +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.List;
-
-/**
- * @author Lars Helge Overland
- */
-public interface DimensionSet
-{
- final String SEPARATOR_TYPE = "_";
- final String SEPARATOR_ID = "-";
- final String SEPARATOR_NAME = ", ";
-
- String getName();
-
- /**
- * The DimensionSet identifier is on the format
- * [DimensionType]SEPARATOR_TYPE[id]SEPARATOR_ID[id]SEPARATOR[id], for instance
- * GROUPSET_1-2-3 and CATEGORY_1 .
- */
- String getDimensionSetId();
-
- DimensionType getDimensionType();
-
- List<? extends Dimension> getDimensions();
-
- List<? extends DimensionOptionElement> getDimensionOptionElements();
-}
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionType.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionType.java 1970-01-01 00:00:00 +0000
@@ -1,39 +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.
- */
-
-/**
- * @author Lars Helge Overland
- */
-public enum DimensionType
-{
- CATEGORY,
- DATAELEMENTGROUPSET,
- INDICATORGROUPSET,
- ORGANISATIONUNITGROUPSET
-}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java 2011-01-17 17:03:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java 2011-01-31 19:47:04 +0000
@@ -34,15 +34,13 @@
import java.util.Set;
import org.hisp.dhis.common.IdentifiableObject;
-import org.hisp.dhis.dimension.DimensionOption;
-import org.hisp.dhis.dimension.DimensionOptionElement;
/**
* @author Lars Helge Overland
* @version $Id: Indicator.java 5540 2008-08-19 10:47:07Z larshelg $
*/
public class Indicator
- extends IdentifiableObject implements DimensionOptionElement
+ extends IdentifiableObject
{
private Boolean annualized;
@@ -100,15 +98,6 @@
this.denominatorDescription = denominatorDescription;
this.denominatorAggregationOperator = denominatorAggregationOperator;
}
-
- // -------------------------------------------------------------------------
- // Dimension
- // -------------------------------------------------------------------------
-
- public List<? extends DimensionOption> getDimensionOptions()
- {
- return new ArrayList<DimensionOption>( groups );
- }
// -------------------------------------------------------------------------
// Logic
=== 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-11-09 21:57:28 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java 2011-01-31 19:47:04 +0000
@@ -31,16 +31,13 @@
import java.util.Set;
import org.hisp.dhis.common.IdentifiableObject;
-import org.hisp.dhis.dimension.DimensionOption;
-import org.hisp.dhis.dimension.DimensionOptionElement;
-import org.hisp.dhis.dimension.DimensionType;
/**
* @author Lars Helge Overland
* @version $Id: IndicatorGroup.java 5296 2008-05-29 16:06:14Z larshelg $
*/
public class IndicatorGroup
- extends IdentifiableObject implements DimensionOption
+ extends IdentifiableObject
{
private Set<Indicator> members = new HashSet<Indicator>();
@@ -58,20 +55,6 @@
{
this.name = name;
}
-
- // -------------------------------------------------------------------------
- // Dimension
- // -------------------------------------------------------------------------
-
- public DimensionType getDimensionType()
- {
- return DimensionType.INDICATORGROUPSET;
- }
-
- public Set<? extends DimensionOptionElement> getDimensionOptionElements()
- {
- return members;
- }
// -------------------------------------------------------------------------
// hashCode and equals
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.java 2011-01-31 19:47:04 +0000
@@ -31,8 +31,7 @@
import java.util.Collection;
import java.util.List;
-import org.hisp.dhis.dimension.Dimension;
-import org.hisp.dhis.dimension.DimensionOption;
+import org.hisp.dhis.common.IdentifiableObject;
/**
* An IndicatorGroupSet is a set of IndicatorGroups. It is by default exclusive,
@@ -42,7 +41,7 @@
* @author Lars Helge Overland
*/
public class IndicatorGroupSet
- extends Dimension
+ extends IdentifiableObject
{
private List<IndicatorGroup> members = new ArrayList<IndicatorGroup>();
@@ -60,15 +59,6 @@
}
// -------------------------------------------------------------------------
- // Dimension
- // -------------------------------------------------------------------------
-
- public List<? extends DimensionOption> getDimensionOptions()
- {
- return members;
- }
-
- // -------------------------------------------------------------------------
// Logic
// -------------------------------------------------------------------------
@@ -84,6 +74,19 @@
return indicators;
}
+ public IndicatorGroup getGroup( Indicator indicator )
+ {
+ for ( IndicatorGroup group : members )
+ {
+ if ( group.getMembers().contains( indicator ) )
+ {
+ return group;
+ }
+ }
+
+ return null;
+ }
+
// -------------------------------------------------------------------------
// equals and hashCode
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2011-01-13 17:32:48 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2011-01-31 19:47:04 +0000
@@ -36,8 +36,6 @@
import java.util.regex.Pattern;
import org.apache.commons.lang.StringUtils;
-import org.hisp.dhis.dimension.DimensionOption;
-import org.hisp.dhis.dimension.DimensionOptionElement;
import org.hisp.dhis.source.Source;
/**
@@ -45,7 +43,7 @@
* @version $Id: OrganisationUnit.java 6251 2008-11-10 14:37:05Z larshelg $
*/
public class OrganisationUnit
- extends Source implements DimensionOptionElement
+ extends Source
{
public static final String FEATURETYPE_NONE = "None";
public static final String FEATURETYPE_MULTIPOLYGON = "MultiPolygon";
@@ -149,15 +147,6 @@
}
// -------------------------------------------------------------------------
- // Dimension
- // -------------------------------------------------------------------------
-
- public List<? extends DimensionOption> getDimensionOptions()
- {
- return new ArrayList<DimensionOption>( groups );
- }
-
- // -------------------------------------------------------------------------
// Logic
// -------------------------------------------------------------------------
@@ -296,7 +285,7 @@
return group != null ? group.getName() : null;
}
-
+
// -------------------------------------------------------------------------
// hashCode, equals and toString
// -------------------------------------------------------------------------
=== 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-11-09 21:57:28 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java 2011-01-31 19:47:04 +0000
@@ -31,9 +31,6 @@
import java.util.Set;
import org.hisp.dhis.common.IdentifiableObject;
-import org.hisp.dhis.dimension.DimensionOption;
-import org.hisp.dhis.dimension.DimensionOptionElement;
-import org.hisp.dhis.dimension.DimensionType;
/**
* @author Kristian Nordal
@@ -41,7 +38,7 @@
*/
public class OrganisationUnitGroup
- extends IdentifiableObject implements DimensionOption
+ extends IdentifiableObject
{
private Set<OrganisationUnit> members = new HashSet<OrganisationUnit>();
@@ -59,20 +56,6 @@
{
this.name = name;
}
-
- // -------------------------------------------------------------------------
- // hashCode and equals
- // -------------------------------------------------------------------------
-
- public Set<? extends DimensionOptionElement> getDimensionOptionElements()
- {
- return members;
- }
-
- public DimensionType getDimensionType()
- {
- return DimensionType.ORGANISATIONUNITGROUPSET;
- }
// -------------------------------------------------------------------------
// hashCode and equals
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java 2010-05-12 12:01:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java 2011-01-31 19:47:04 +0000
@@ -33,15 +33,14 @@
import java.util.List;
import java.util.Set;
-import org.hisp.dhis.dimension.Dimension;
-import org.hisp.dhis.dimension.DimensionOption;
+import org.hisp.dhis.common.IdentifiableObject;
/**
* @author Kristian Nordal
* @version $Id: OrganisationUnitGroupSet.java 1905 2006-09-23 14:34:55Z torgeilo $
*/
public class OrganisationUnitGroupSet
- extends Dimension
+ extends IdentifiableObject
{
private String description;
@@ -63,15 +62,6 @@
this.description = description;
this.compulsory = compulsory;
}
-
- // -------------------------------------------------------------------------
- // Dimension
- // -------------------------------------------------------------------------
-
- public List<? extends DimensionOption> getDimensionOptions()
- {
- return new ArrayList<DimensionOption>( organisationUnitGroups );
- }
// -------------------------------------------------------------------------
// Logic
@@ -106,7 +96,20 @@
{
return organisationUnitGroups != null && organisationUnitGroups.size() > 0;
}
+
+ public OrganisationUnitGroup getGroup( OrganisationUnit unit )
+ {
+ for ( OrganisationUnitGroup group : organisationUnitGroups )
+ {
+ if ( group.getMembers().contains( unit ) )
+ {
+ return group;
+ }
+ }
+ return null;
+ }
+
// -------------------------------------------------------------------------
// hashCode and equals
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java 2011-01-08 16:27:43 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java 2011-01-31 19:47:04 +0000
@@ -30,21 +30,15 @@
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
-import java.util.List;
-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;
/**
* @author Kristian Nordal
* @version $Id: Period.java 5277 2008-05-27 15:48:42Z larshelg $
*/
public class Period
- extends IdentifiableObject implements DimensionOption
+ extends IdentifiableObject
{
public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd";
@@ -99,78 +93,6 @@
}
// -------------------------------------------------------------------------
- // Dimension
- // -------------------------------------------------------------------------
-
- public static final Dimension DIMENSION = new PeriodDimension();
-
- public static class PeriodDimension
- extends Dimension
- {
- private static final String NAME = "Period";
-
- public String getName()
- {
- return NAME;
- }
-
- public List<? extends DimensionOption> getDimensionOptions()
- {
- return null;
- }
-
- @Override
- public boolean equals( Object o )
- {
- if ( this == o )
- {
- return true;
- }
-
- if ( o == null )
- {
- return false;
- }
-
- if ( !( o instanceof PeriodDimension ) )
- {
- return false;
- }
-
- final PeriodDimension other = (PeriodDimension) o;
-
- return NAME.equals( other.getName() );
- }
-
- @Override
- public int hashCode()
- {
- return NAME.hashCode();
- }
-
- @Override
- public String toString()
- {
- return "[" + NAME + "]";
- }
- }
-
- public DimensionType getDimensionType()
- {
- return null;
- }
-
- public Set<? extends DimensionOptionElement> getDimensionOptionElements()
- {
- return null;
- }
-
- public Dimension getDimension()
- {
- return DIMENSION;
- }
-
- // -------------------------------------------------------------------------
// Logic
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java 2011-01-25 12:07:27 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java 2011-01-31 19:47:04 +0000
@@ -38,14 +38,11 @@
import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategory;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
-import org.hisp.dhis.dataelement.DataElementGroupSet;
+import org.hisp.dhis.dataelement.DataElementCategoryOption;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.dataset.DataSet;
-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.dimension.DimensionType;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -165,21 +162,11 @@
private List<OrganisationUnit> units = new ArrayList<OrganisationUnit>();
/**
- * The {@link org.hisp.dhis.dimension.DimensionType} for the ReportTable.
- */
- private String dimensionType;
-
- /**
* The DataElementCategoryCombo for the ReportTable.
*/
private DataElementCategoryCombo categoryCombo;
/**
- * The DataElementGropSets for the ReportTable.
- */
- private List<DataElementGroupSet> dataElementGroupSets = new ArrayList<DataElementGroupSet>();
-
- /**
* Whether to crosstabulate on the Indicator dimension, which also represents DataElements and DataSets.
*/
private Boolean doIndicators;
@@ -237,7 +224,7 @@
/**
* CategoryCombos that will be crosstabulated on the columns axis. Optional dimension.
*/
- private List<? extends DimensionOptionElement> crossTabCategoryOptionCombos = new ArrayList<DimensionOptionElement>();
+ private List<DataElementCategoryOptionCombo> crossTabCategoryOptionCombos = new ArrayList<DataElementCategoryOptionCombo>();
/**
* Periods that will be crosstabulated on the columns axis. Mandatory dimension.
@@ -257,7 +244,7 @@
/**
* CategoryOptionCombos that will be present on the rows axis. Optional dimension.
*/
- private List<? extends DimensionOptionElement> reportCategoryOptionCombos = new ArrayList<DimensionOptionElement>();
+ private List<DataElementCategoryOptionCombo> reportCategoryOptionCombos = new ArrayList<DataElementCategoryOptionCombo>();
/**
* Periods that will be present on the rows axis. Mandatory dimension.
@@ -319,22 +306,17 @@
/**
* The category option combos derived from the dimension set.
*/
- private List<? extends DimensionOptionElement> categoryOptionCombos = new ArrayList<DimensionOptionElement>();
-
- /**
- * The data elements derived from the dimension set.
- */
- private List<DataElement> dimensionalDataElements = new ArrayList<DataElement>();
+ private List<DataElementCategoryOptionCombo> categoryOptionCombos = new ArrayList<DataElementCategoryOptionCombo>();
/**
* The dimension options.
*/
- private List<DimensionOption> dimensionOptions = new ArrayList<DimensionOption>();
+ private List<DataElementCategoryOption> categoryOptions = new ArrayList<DataElementCategoryOption>();
/**
* The dimension option column names.
*/
- private List<String> dimensionOptionColumns = new ArrayList<String>();
+ private List<String> categoryOptionColumns = new ArrayList<String>();
// -------------------------------------------------------------------------
// Constructors
@@ -391,7 +373,7 @@
List<Period> relativePeriods,
List<OrganisationUnit> units,
List<OrganisationUnit> relativeUnits,
- DimensionSet dimensionSet,
+ DataElementCategoryCombo categoryCombo,
boolean doIndicators,
boolean doPeriods,
boolean doUnits,
@@ -412,6 +394,7 @@
this.relativePeriods = relativePeriods;
this.units = units;
this.relativeUnits = relativeUnits;
+ this.categoryCombo = categoryCombo;
this.doIndicators = doIndicators;
this.doPeriods = doPeriods;
this.doUnits = doUnits;
@@ -419,8 +402,6 @@
this.reportParams = reportParams;
this.i18nFormat = i18nFormat;
this.reportingMonthName = reportingMonthName;
-
- this.setDimensionSet( dimensionSet );
}
// -------------------------------------------------------------------------
@@ -457,36 +438,15 @@
}
// ---------------------------------------------------------------------
- // Init dimensional lists
+ // Init dimensions
// ---------------------------------------------------------------------
- if ( isDimensional( DimensionType.CATEGORY ) )
+ if ( isDimensional() )
{
- // -----------------------------------------------------------------
- // CategoryCombo is set, populate CategoryOptionCombos
- // -----------------------------------------------------------------
-
- categoryOptionCombos = categoryCombo.getDimensionOptionElements();
+ categoryOptionCombos = new ArrayList<DataElementCategoryOptionCombo>( categoryCombo.getOptionCombos() );
verify( nonEmptyLists( categoryOptionCombos ) == 1, "Category option combos size must be larger than 0" );
}
- else if ( isDimensional( DimensionType.DATAELEMENTGROUPSET ) )
- {
- // -----------------------------------------------------------------
- // All DataElements have GroupSets, populate DataElements
- // -----------------------------------------------------------------
-
- List<DataElement> elements = new ArrayList<DataElement>();
-
- for ( DataElement element : dataElements )
- {
- elements.addAll( element.getDataElements() );
- }
-
- dimensionalDataElements = elements;
-
- verify( nonEmptyLists( dimensionalDataElements ) == 1, "Dimensional data elements size must be larger than 0" );
- }
// ---------------------------------------------------------------------
// Init indexColumns and selectColumns
@@ -498,7 +458,6 @@
crossTabIndicators.addAll( indicators );
crossTabIndicators.addAll( dataElements );
crossTabIndicators.addAll( dataSets );
- crossTabIndicators.addAll( dimensionalDataElements );
reportIndicators.add( null );
selectColumns.add( getIdentifier( mode ) );
}
@@ -509,12 +468,11 @@
reportIndicators.addAll( indicators );
reportIndicators.addAll( dataElements );
reportIndicators.addAll( dataSets );
- reportIndicators.addAll( dimensionalDataElements );
indexColumns.add( getIdentifier( mode ) );
indexNameColumns.add( getName( mode ) );
}
- if ( isDimensional( DimensionType.CATEGORY ) ) // Category options will be crosstab if dimensional and type category
+ if ( isDimensional() ) // Category options will be crosstab if dimensional
{
reportCategoryOptionCombos.add( null );
@@ -578,7 +536,7 @@
for ( IdentifiableObject indicator : crossTabIndicators )
{
- for ( DimensionOptionElement categoryOptionCombo : crossTabCategoryOptionCombos )
+ for ( DataElementCategoryOptionCombo categoryOptionCombo : crossTabCategoryOptionCombos )
{
for ( Period period : crossTabPeriods )
{
@@ -606,22 +564,22 @@
if ( doTotal() )
{
- verify ( nonEmptyLists( categoryCombo.getDimensions() ) == 1, "Category combo dimensions size must be larger than 0" );
+ verify ( nonEmptyLists( categoryCombo.getCategories() ) == 1, "Category combo categories size must be larger than 0" );
- for ( Dimension dimension : categoryCombo.getDimensions() )
+ for ( DataElementCategory category : categoryCombo.getCategories() )
{
- for ( DimensionOption dimensionOption : dimension.getDimensionOptions() )
+ for ( DataElementCategoryOption categoryOption : category.getCategoryOptions() )
{
- String columnName = databaseEncode( TOTAL_COLUMN_PREFIX + dimensionOption.getName() );
- String prettyColumnName = TOTAL_COLUMN_PRETTY_PREFIX + dimensionOption.getName();
+ String columnName = databaseEncode( TOTAL_COLUMN_PREFIX + categoryOption.getName() );
+ String prettyColumnName = TOTAL_COLUMN_PRETTY_PREFIX + categoryOption.getName();
- dimensionOptions.add( dimensionOption );
- dimensionOptionColumns.add( columnName );
+ categoryOptions.add( categoryOption );
+ categoryOptionColumns.add( columnName );
prettyCrossTabColumns.put( columnName, prettyColumnName );
}
}
- verify( nonEmptyLists( dimensionOptions, dimensionOptionColumns ) == 2, "Dimension options size must be larger than 0" );
+ verify( nonEmptyLists( categoryOptions, categoryOptionColumns ) == 2, "Category options size must be larger than 0" );
}
}
@@ -649,21 +607,6 @@
}
/**
- * Sets the appropriate dimension related properties depending on the dimension
- * set type.
- */
- @SuppressWarnings( "unchecked" )
- public void setDimensionSet( DimensionSet dimensionSet )
- {
- if ( dimensionSet != null )
- {
- dimensionType = dimensionSet.getDimensionType().name();
- categoryCombo = dimensionType.equals( DimensionType.CATEGORY.name() ) ? (DataElementCategoryCombo)dimensionSet : null;
- dataElementGroupSets = dimensionType.equals( DimensionType.DATAELEMENTGROUPSET.name() ) ? (List<DataElementGroupSet>)dimensionSet.getDimensions() : null;
- }
- }
-
- /**
* Returns a list of names of all columns for this ReportTable.
*/
public List<String> getAllColumns()
@@ -675,7 +618,7 @@
columns.add( ReportTable.REPORTING_MONTH_COLUMN_NAME );
columns.add( ReportTable.PARAM_ORGANISATIONUNIT_COLUMN_NAME );
columns.addAll( getCrossTabColumns() );
- columns.addAll( getDimensionOptionColumns() );
+ columns.addAll( getCategoryOptionColumns() );
if ( doTotal() )
{
@@ -747,25 +690,16 @@
*/
public boolean isDimensional()
{
- return dimensionType != null;
- }
-
- /**
- * Tests whether this ReportTable is multi-dimensional and of the argument
- * dimension set type.
- */
- public boolean isDimensional( DimensionType dimensionType )
- {
- return isDimensional() && this.dimensionType.equals( dimensionType.name() );
- }
-
+ return categoryCombo != null;
+ }
+
/**
* Tests whether a total column should be included.
*/
public boolean doTotal()
{
return !isDoIndicators() && !isDoPeriods() && !isDoUnits() &&
- isDimensional( DimensionType.CATEGORY ) && mode.equals( MODE_DATAELEMENTS );
+ isDimensional() && mode.equals( MODE_DATAELEMENTS );
}
/**
@@ -862,7 +796,7 @@
* Generates a pretty-print column name based on short-names of the argument
* objects. Null arguments are ignored in the name.
*/
- private String getPrettyColumnName( IdentifiableObject metaObject, DimensionOptionElement categoryOptionCombo, Period period, OrganisationUnit unit )
+ private String getPrettyColumnName( IdentifiableObject metaObject, DataElementCategoryOptionCombo categoryOptionCombo, Period period, OrganisationUnit unit )
{
StringBuffer buffer = new StringBuffer();
@@ -892,7 +826,7 @@
* Generates a column name based on short-names of the argument objects. Null
* arguments are ignored in the name.
*/
- private String getColumnName( IdentifiableObject metaObject, DimensionOptionElement categoryOptionCombo, Period period, OrganisationUnit unit )
+ private String getColumnName( IdentifiableObject metaObject, DataElementCategoryOptionCombo categoryOptionCombo, Period period, OrganisationUnit unit )
{
StringBuffer buffer = new StringBuffer();
@@ -924,7 +858,7 @@
* Generates a column identifier based on the internal identifiers of the
* argument objects. Null arguments are ignored in the identifier.
*/
- private String getColumnIdentifier( IdentifiableObject metaObject, DimensionOptionElement categoryOptionCombo, Period period, OrganisationUnit unit )
+ private String getColumnIdentifier( IdentifiableObject metaObject, DataElementCategoryOptionCombo categoryOptionCombo, Period period, OrganisationUnit unit )
{
StringBuffer buffer = new StringBuffer();
@@ -1125,12 +1059,12 @@
this.dataElements = dataElements;
}
- public List<? extends DimensionOptionElement> getCategoryOptionCombos()
+ public List<DataElementCategoryOptionCombo> getCategoryOptionCombos()
{
return categoryOptionCombos;
}
- public void setCategoryOptionCombos( List<? extends DimensionOptionElement> categoryOptionCombos )
+ public void setCategoryOptionCombos( List<DataElementCategoryOptionCombo> categoryOptionCombos )
{
this.categoryOptionCombos = categoryOptionCombos;
}
@@ -1175,16 +1109,6 @@
this.units = units;
}
- public String getDimensionType()
- {
- return dimensionType;
- }
-
- public void setDimensionType( String dimensionType )
- {
- this.dimensionType = dimensionType;
- }
-
public DataElementCategoryCombo getCategoryCombo()
{
return categoryCombo;
@@ -1195,16 +1119,6 @@
this.categoryCombo = categoryCombo;
}
- public List<DataElementGroupSet> getDataElementGroupSets()
- {
- return dataElementGroupSets;
- }
-
- public void setDataElementGroupSets( List<DataElementGroupSet> dataElementGroupSets )
- {
- this.dataElementGroupSets = dataElementGroupSets;
- }
-
public Boolean getDoIndicators()
{
return doIndicators;
@@ -1304,7 +1218,7 @@
return reportIndicators;
}
- public List<? extends DimensionOptionElement> getReportCategoryOptionCombos()
+ public List<DataElementCategoryOptionCombo> getReportCategoryOptionCombos()
{
return reportCategoryOptionCombos;
}
@@ -1369,13 +1283,13 @@
this.organisationUnitName = organisationUnitName;
}
- public List<DimensionOption> getDimensionOptions()
+ public List<DataElementCategoryOption> getCategoryOptions()
{
- return dimensionOptions;
+ return categoryOptions;
}
- public List<String> getDimensionOptionColumns()
+ public List<String> getCategoryOptionColumns()
{
- return dimensionOptionColumns;
+ return categoryOptionColumns;
}
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/source/Source.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/source/Source.java 2010-09-01 06:14:47 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/source/Source.java 2011-01-31 19:47:04 +0000
@@ -28,23 +28,18 @@
*/
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.dimension.Dimension;
-import org.hisp.dhis.dimension.DimensionOption;
-import org.hisp.dhis.dimension.DimensionOptionElement;
-import org.hisp.dhis.dimension.DimensionType;
/**
* @author Torgeir Lorange Ostby
* @version $Id: Source.java 5277 2008-05-27 15:48:42Z larshelg $
*/
public abstract class Source
- extends IdentifiableObject implements DimensionOption
+ extends IdentifiableObject
{
protected Set<DataSet> dataSets = new HashSet<DataSet>();
@@ -65,78 +60,6 @@
}
// -------------------------------------------------------------------------
- // Dimension
- // -------------------------------------------------------------------------
-
- public static final Dimension DIMENSION = new SourceDimension();
-
- public static class SourceDimension
- extends Dimension
- {
- private static final String NAME = "Source";
-
- public String getName()
- {
- return NAME;
- }
-
- public List<? extends DimensionOption> getDimensionOptions()
- {
- return null;
- }
-
- @Override
- public boolean equals( Object o )
- {
- if ( this == o )
- {
- return true;
- }
-
- if ( o == null )
- {
- return false;
- }
-
- if ( !( o instanceof SourceDimension ) )
- {
- return false;
- }
-
- final SourceDimension other = (SourceDimension) o;
-
- return NAME.equals( other.getName() );
- }
-
- @Override
- public int hashCode()
- {
- return NAME.hashCode();
- }
-
- @Override
- public String toString()
- {
- return "[" + NAME + "]";
- }
- }
-
- public DimensionType getDimensionType()
- {
- return null;
- }
-
- public Set<? extends DimensionOptionElement> getDimensionOptionElements()
- {
- return null;
- }
-
- public Dimension getDimension()
- {
- return DIMENSION;
- }
-
- // -------------------------------------------------------------------------
// hashCode, equals and toString
// -------------------------------------------------------------------------
=== removed 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-11-09 21:57:28 +0000
+++ dhis-2/dhis-api/src/test/java/org/hisp/dhis/dataelement/DimensionTest.java 1970-01-01 00:00:00 +0000
@@ -1,92 +0,0 @@
-package org.hisp.dhis.dataelement;
-
-/*
- * 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 static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hisp.dhis.dimension.BasicDimensionSet;
-import org.hisp.dhis.dimension.Dimension;
-import org.hisp.dhis.dimension.DimensionOptionElement;
-import org.hisp.dhis.dimension.DimensionSet;
-import org.junit.Test;
-
-/**
- * @author Lars Helge Overland
- */
-public class DimensionTest
-{
- @Test
- public void testGroupSetDimensions()
- {
- DataElement hivAids = new DataElement( "HivAids" );
- DataElement malaria = new DataElement( "Malaria" );
- DataElement diabetes = new DataElement( "Diabetes" );
- DataElement cancer = new DataElement( "Cancer" );
-
- DataElementGroup communicable = new DataElementGroup( "Communicable" );
- DataElementGroup nonCommunicable = new DataElementGroup( "NonCommunicable" );
-
- DataElementGroupSet diseaseType = new DataElementGroupSet( "DiseaseType" );
-
- List<Dimension> dims = new ArrayList<Dimension>();
- dims.add( diseaseType );
-
- DimensionSet diseaseByType = new BasicDimensionSet( dims );
-
- communicable.getMembers().add( hivAids );
- communicable.getMembers().add( malaria );
-
- nonCommunicable.getMembers().add( diabetes );
- nonCommunicable.getMembers().add( cancer );
-
- diseaseType.getMembers().add( communicable );
- diseaseType.getMembers().add( nonCommunicable );
-
- // Test Dimension.getDimensionOption
-
- assertEquals( communicable, diseaseType.getDimensionOption( hivAids ) );
- assertEquals( communicable, diseaseType.getDimensionOption( malaria ) );
- assertEquals( nonCommunicable, diseaseType.getDimensionOption( diabetes ) );
- assertEquals( nonCommunicable, diseaseType.getDimensionOption( cancer ) );
-
- // Test DimensionSet.getDimensionOptionElements
-
- List<? extends DimensionOptionElement> dimensionOptionElements = diseaseByType.getDimensionOptionElements();
-
- assertEquals( 4, dimensionOptionElements.size() );
-
- assertTrue( dimensionOptionElements.contains( hivAids ) );
- assertTrue( dimensionOptionElements.contains( malaria ) );
- assertTrue( dimensionOptionElements.contains( diabetes ) );
- assertTrue( dimensionOptionElements.contains( cancer ) );
- }
-}
=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java 2010-10-22 15:34:54 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java 2011-01-31 19:47:04 +0000
@@ -38,22 +38,24 @@
import org.amplecode.quick.BatchHandlerFactory;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategory;
+import org.hisp.dhis.dataelement.DataElementCategoryOption;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementGroup;
import org.hisp.dhis.dataelement.DataElementGroupSet;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.dataelement.comparator.DataElementCategoryNameComparator;
import org.hisp.dhis.dataelement.comparator.DataElementGroupSetNameComparator;
import org.hisp.dhis.dataelement.comparator.DataElementNameComparator;
-import org.hisp.dhis.dimension.Dimension;
-import org.hisp.dhis.dimension.DimensionOption;
import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.indicator.IndicatorGroup;
import org.hisp.dhis.indicator.IndicatorGroupSet;
import org.hisp.dhis.indicator.IndicatorService;
import org.hisp.dhis.indicator.comparator.IndicatorGroupSetNameComparator;
import org.hisp.dhis.indicator.comparator.IndicatorNameComparator;
import org.hisp.dhis.jdbc.batchhandler.GenericBatchHandler;
import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
@@ -243,11 +245,11 @@
values.add( String.valueOf( dataElement.getId() ) );
values.add( dataElement.getName() );
- for ( Dimension groupSet : groupSets )
+ for ( DataElementGroupSet groupSet : groupSets )
{
- DimensionOption dimensionOption = groupSet.getDimensionOption( dataElement );
+ DataElementGroup group = groupSet.getGroup( dataElement );
- values.add( dimensionOption != null ? dimensionOption.getName() : null );
+ values.add( group != null ? group.getName() : null );
}
batchHandler.addObject( values );
@@ -293,11 +295,11 @@
values.add( String.valueOf( indicator.getId() ) );
values.add( indicator.getName() );
- for ( Dimension groupSet : groupSets )
+ for ( IndicatorGroupSet groupSet : groupSets )
{
- DimensionOption dimensionOption = groupSet.getDimensionOption( indicator );
+ IndicatorGroup group = groupSet.getGroup( indicator );
- values.add( dimensionOption != null ? dimensionOption.getName() : null );
+ values.add( group != null ? group.getName() : null );
}
batchHandler.addObject( values );
@@ -345,11 +347,11 @@
values.add( String.valueOf( unit.getId() ) );
values.add( unit.getName() );
- for ( Dimension groupSet : groupSets )
+ for ( OrganisationUnitGroupSet groupSet : groupSets )
{
- DimensionOption dimensionOption = groupSet.getDimensionOption( unit );
+ OrganisationUnitGroup group = groupSet.getGroup( unit );
- values.add( dimensionOption != null ? dimensionOption.getName() : null );
+ values.add( group != null ? group.getName() : null );
}
batchHandler.addObject( values );
@@ -394,9 +396,9 @@
values.add( String.valueOf( categoryOptionCombo.getId() ) );
values.add( categoryOptionCombo.getName() );
- for ( Dimension category : categories )
+ for ( DataElementCategory category : categories )
{
- DimensionOption dimensionOption = category.getDimensionOption( categoryOptionCombo );
+ DataElementCategoryOption dimensionOption = category.getCategoryOption( categoryOptionCombo );
values.add( dimensionOption != null ? dimensionOption.getName() : null );
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedDataValueService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedDataValueService.java 2011-01-21 11:06:16 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedDataValueService.java 2011-01-31 19:47:04 +0000
@@ -36,11 +36,11 @@
import org.hisp.dhis.aggregation.AggregatedIndicatorValue;
import org.hisp.dhis.aggregation.AggregatedMapValue;
import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOption;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.dataelement.DataElementOperand;
import org.hisp.dhis.datavalue.DataValue;
import org.hisp.dhis.datavalue.DeflatedDataValue;
-import org.hisp.dhis.dimension.DimensionOption;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
@@ -88,9 +88,9 @@
return aggregatedDataValueStore.getAggregatedDataValue( dataElement, categoryOptionCombo, periodIds, organisationUnit );
}
- public Double getAggregatedValue( DataElement dataElement, DimensionOption dimensionOption, Period period, OrganisationUnit organisationUnit )
+ public Double getAggregatedValue( DataElement dataElement, DataElementCategoryOption categoryOption, Period period, OrganisationUnit organisationUnit )
{
- return aggregatedDataValueStore.getAggregatedDataValue( dataElement, dimensionOption, period, organisationUnit );
+ return aggregatedDataValueStore.getAggregatedDataValue( dataElement, categoryOption, period, organisationUnit );
}
public Collection<AggregatedDataValue> getAggregatedDataValues( int dataElementId, Collection<Integer> periodIds, Collection<Integer> organisationUnitIds )
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedDataValueStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedDataValueStore.java 2011-01-21 12:44:09 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedDataValueStore.java 2011-01-31 19:47:04 +0000
@@ -51,12 +51,11 @@
import org.hisp.dhis.aggregation.StoreIterator;
import org.hisp.dhis.caseaggregation.CaseAggregationCondition;
import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOption;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.dataelement.DataElementOperand;
import org.hisp.dhis.datavalue.DataValue;
import org.hisp.dhis.datavalue.DeflatedDataValue;
-import org.hisp.dhis.dimension.DimensionOption;
-import org.hisp.dhis.dimension.DimensionType;
import org.hisp.dhis.hibernate.HibernateGenericStore;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.period.Period;
@@ -130,24 +129,19 @@
return statementManager.getHolder().queryForDouble( sql );
}
- public Double getAggregatedDataValue( DataElement dataElement, DimensionOption dimensionOption, Period period, OrganisationUnit organisationUnit )
+ public Double getAggregatedDataValue( DataElement dataElement, DataElementCategoryOption categoryOption, Period period, OrganisationUnit organisationUnit )
{
- if ( dimensionOption.getDimensionType().equals( DimensionType.CATEGORY ) )
- {
- String ids = getCommaDelimitedString( getIdentifiers( DataElementCategoryOptionCombo.class, dimensionOption.getDimensionOptionElements() ) );
-
- final String sql =
- "SELECT SUM(value) " +
- "FROM aggregateddatavalue " +
- "WHERE dataelementid = " + dataElement.getId() + " " +
- "AND categoryoptioncomboid IN (" + ids + ") " +
- "AND periodid = " + period.getId() + " " +
- "AND organisationunitid = " + organisationUnit.getId();
+ String ids = getCommaDelimitedString( getIdentifiers( DataElementCategoryOptionCombo.class, categoryOption.getCategoryOptionCombos() ) );
+
+ final String sql =
+ "SELECT SUM(value) " +
+ "FROM aggregateddatavalue " +
+ "WHERE dataelementid = " + dataElement.getId() + " " +
+ "AND categoryoptioncomboid IN (" + ids + ") " +
+ "AND periodid = " + period.getId() + " " +
+ "AND organisationunitid = " + organisationUnit.getId();
- return statementManager.getHolder().queryForDouble( sql );
- }
-
- throw new IllegalArgumentException();
+ return statementManager.getHolder().queryForDouble( sql );
}
public Collection<AggregatedDataValue> getAggregatedDataValues( int dataElementId,
=== removed directory 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dimension'
=== removed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dimension/DefaultDimensionService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dimension/DefaultDimensionService.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dimension/DefaultDimensionService.java 1970-01-01 00:00:00 +0000
@@ -1,169 +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 static org.hisp.dhis.dimension.DimensionType.CATEGORY;
-import static org.hisp.dhis.dimension.DimensionType.DATAELEMENTGROUPSET;
-import static org.hisp.dhis.dimension.DimensionType.INDICATORGROUPSET;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryService;
-import org.hisp.dhis.dataelement.DataElementGroupSet;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.system.util.ConversionUtils;
-
-/**
- * @author Lars Helge Overland
- * @version $Id: Indicator.java 5540 2008-08-19 10:47:07Z larshelg $
- */
-public class DefaultDimensionService
- implements DimensionService
-{
- private static final String SEPARATOR_TYPE = "_";
- private static final String SEPARATOR_ID = "-";
-
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private DataElementService dataElementService;
-
- public void setDataElementService( DataElementService dataElementService )
- {
- this.dataElementService = dataElementService;
- }
-
- private DataElementCategoryService categoryService;
-
- public void setCategoryService( DataElementCategoryService categoryService )
- {
- this.categoryService = categoryService;
- }
-
- // -------------------------------------------------------------------------
- // DimensionService implementation
- // -------------------------------------------------------------------------
-
- public DimensionSet getDimensionSet( String dimensionSetId )
- {
- if ( dimensionSetId != null )
- {
- for ( DimensionSet dimensionSet : getDataElementDimensionSets() )
- {
- if ( dimensionSet.getDimensionSetId().equals( dimensionSetId ) )
- {
- return dimensionSet;
- }
- }
- }
-
- return null;
- }
-
- public Collection<DimensionSet> getDataElementDimensionSets()
- {
- List<DimensionSet> dimensionSets = new ArrayList<DimensionSet>();
-
- dimensionSets.addAll( categoryService.getAllDataElementCategoryCombos() );
-
- for ( Set<DataElementGroupSet> dimensionSet : getDistinctDataElementDimensionSets() )
- {
- dimensionSets.add( new BasicDimensionSet( new ArrayList<Dimension>( dimensionSet ) ) );
- }
-
- return dimensionSets;
- }
-
- public Collection<DataElement> getDataElements( DimensionSet dimensionSet )
- {
- Collection<DataElement> dataElements = null;
-
- if ( dimensionSet != null && dimensionSet.getDimensionType().equals( CATEGORY ) )
- {
- Integer id = getDimensionSetIdentifiers( dimensionSet.getDimensionSetId() )[0];
-
- DataElementCategoryCombo categoryCombo = categoryService.getDataElementCategoryCombo( id );
-
- dataElements = dataElementService.getDataElementByCategoryCombo( categoryCombo );
- }
- else if ( dimensionSet != null && dimensionSet.getDimensionType().equals( DATAELEMENTGROUPSET ) )
- {
- Integer[] ids = getDimensionSetIdentifiers( dimensionSet.getDimensionSetId() );
-
- Set<DataElementGroupSet> groupSets = getDataElementDimensionSet( ids );
-
- dataElements = dataElementService.getDataElementsByGroupSets( groupSets );
- }
- else if ( dimensionSet != null && dimensionSet.getDimensionType().equals( INDICATORGROUPSET ) )
- {
- throw new UnsupportedOperationException(); // TODO implement
- }
-
- return dataElements;
- }
-
- // -------------------------------------------------------------------------
- // Supportive methods
- // -------------------------------------------------------------------------
-
- private Integer[] getDimensionSetIdentifiers( String identifier )
- {
- return ConversionUtils.getIntegerArray( identifier.split( SEPARATOR_TYPE )[1].split( SEPARATOR_ID ) );
- }
-
- private Set<DataElementGroupSet> getDataElementDimensionSet( Integer[] identifiers )
- {
- Set<DataElementGroupSet> dimensionSet = new HashSet<DataElementGroupSet>();
-
- for ( Integer id : identifiers )
- {
- dimensionSet.add( dataElementService.getDataElementGroupSet( id ) );
- }
-
- return dimensionSet;
- }
-
- private Set<Set<DataElementGroupSet>> getDistinctDataElementDimensionSets()
- {
- Set<Set<DataElementGroupSet>> dimensionSets = new HashSet<Set<DataElementGroupSet>>();
-
- for ( DataElement dataElement : dataElementService.getDataElementsWithGroupSets() )
- {
- dimensionSets.add( new HashSet<DataElementGroupSet>( dataElement.getGroupSets() ) );
- }
-
- return dimensionSets;
- }
-}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2011-01-25 22:15:46 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2011-01-31 19:47:04 +0000
@@ -315,12 +315,6 @@
<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
</bean>
- <bean id="org.hisp.dhis.dimension.DimensionService" class="org.hisp.dhis.dimension.DefaultDimensionService">
- <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
- <property name="categoryService"
- ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
- </bean>
-
<bean id="org.hisp.dhis.organisationunit.OrganisationUnitService"
class="org.hisp.dhis.organisationunit.DefaultOrganisationUnitService">
<property name="sourceStore" ref="org.hisp.dhis.source.SourceStore" />
=== removed directory 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dimension'
=== removed file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dimension/DimensionServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dimension/DimensionServiceTest.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dimension/DimensionServiceTest.java 1970-01-01 00:00:00 +0000
@@ -1,122 +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 static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertTrue;
-
-import java.util.Collection;
-import java.util.HashSet;
-
-import org.hisp.dhis.DhisSpringTest;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementGroupSet;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.junit.Test;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class DimensionServiceTest
- extends DhisSpringTest
-{
- private DimensionService dimensionService;
-
- private DataElementGroupSet dataElementGroupSetA;
- private DataElementGroupSet dataElementGroupSetB;
- private DataElementGroupSet dataElementGroupSetC;
-
- private DataElement dataElementA;
- private DataElement dataElementB;
- private DataElement dataElementC;
- private DataElement dataElementD;
-
- @Override
- public void setUpTest()
- {
- dataElementService = (DataElementService) getBean( DataElementService.ID );
-
- dimensionService = (DimensionService) getBean( DimensionService.ID );
-
- dataElementGroupSetA = new DataElementGroupSet( "DataElementGroupSetA" );
- dataElementGroupSetB = new DataElementGroupSet( "DataElementGroupSetB" );
- dataElementGroupSetC = new DataElementGroupSet( "DataElementGroupSetC" );
-
- dataElementService.addDataElementGroupSet( dataElementGroupSetA );
- dataElementService.addDataElementGroupSet( dataElementGroupSetB );
- dataElementService.addDataElementGroupSet( dataElementGroupSetC );
-
- dataElementA = createDataElement( 'A' );
- dataElementB = createDataElement( 'B' );
- dataElementC = createDataElement( 'C' );
- dataElementD = createDataElement( 'D' );
-
- dataElementA.getGroupSets().add( dataElementGroupSetA );
- dataElementA.getGroupSets().add( dataElementGroupSetB );
-
- dataElementB.getGroupSets().add( dataElementGroupSetB );
- dataElementB.getGroupSets().add( dataElementGroupSetC );
-
- dataElementC.getGroupSets().add( dataElementGroupSetA );
- dataElementC.getGroupSets().add( dataElementGroupSetB );
-
- dataElementService.addDataElement( dataElementA );
- dataElementService.addDataElement( dataElementB );
- dataElementService.addDataElement( dataElementC );
- dataElementService.addDataElement( dataElementD );
- }
-
- @Test
- public void getDataElementDimensionSets()
- {
- Collection<DimensionSet> dimensionSets = dimensionService.getDataElementDimensionSets();
-
- assertEquals( 3, dimensionSets.size() ); // Including default category combo
- assertTrue( dimensionSets.contains( new BasicDimensionSet( dataElementGroupSetA, dataElementGroupSetB ) ) );
- assertTrue( dimensionSets.contains( new BasicDimensionSet( dataElementGroupSetB, dataElementGroupSetC ) ) );
- }
-
- @Test
- public void getDataElements()
- {
- Collection<DataElement> dataElements = new HashSet<DataElement>();
-
- Collection<DimensionSet> dimensionSets = dimensionService.getDataElementDimensionSets();
-
- for ( DimensionSet dimensionSet : dimensionSets )
- {
- dataElements.addAll( dimensionService.getDataElements( dimensionSet ) );
- }
-
- assertEquals( 3, dataElements.size() );
- assertTrue( dataElements.contains( dataElementA ) );
- assertTrue( dataElements.contains( dataElementB ) );
- assertTrue( dataElements.contains( dataElementC ) );
- }
-}
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DXFConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DXFConverter.java 2011-01-17 17:03:05 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DXFConverter.java 2011-01-31 19:47:04 +0000
@@ -919,7 +919,6 @@
XMLConverter converter = new ReportTableConverter( reportTableService, importObjectService,
dataElementService, categoryService, indicatorService, dataSetService, periodService,
organisationUnitService, objectMappingGenerator.getDataElementMapping( params.skipMapping() ),
- objectMappingGenerator.getDataElementGroupSetMapping( params.skipMapping() ),
objectMappingGenerator.getCategoryComboMapping( params.skipMapping() ), objectMappingGenerator
.getIndicatorMapping( params.skipMapping() ), objectMappingGenerator.getDataSetMapping( params
.skipMapping() ), objectMappingGenerator.getPeriodMapping( params.skipMapping() ),
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/ReportTableConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/ReportTableConverter.java 2011-01-17 11:53:20 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/ReportTableConverter.java 2011-01-31 19:47:04 +0000
@@ -27,16 +27,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.ArrayList;
import java.util.Collection;
-import java.util.List;
import java.util.Map;
import org.amplecode.staxwax.reader.XMLReader;
import org.amplecode.staxwax.writer.XMLWriter;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryService;
-import org.hisp.dhis.dataelement.DataElementGroupSet;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
@@ -78,9 +75,7 @@
private static final String FIELD_PERIODS = "periods";
private static final String FIELD_ORGANISATION_UNITS = "organisationUnits";
- private static final String FIELD_DIMENSION_TYPE = "dimensionType";
private static final String FIELD_CATEGORY_COMBO = "categoryCombo";
- private static final String FIELD_DATA_ELEMENT_GROUP_SETS = "dataElementGroupSets";
private static final String FIELD_DO_INDICATORS = "doIndicators";
private static final String FIELD_DO_PERIODS = "doPeriods";
@@ -99,7 +94,6 @@
private static final String FIELD_PARAM_ORG_UNIT = "paramOrganisationUnit";
private Map<Object, Integer> dataElementMapping;
- private Map<Object, Integer> dataElementGroupSetMapping;
private Map<Object, Integer> categoryComboMapping;
private Map<Object, Integer> indicatorMapping;
private Map<Object, Integer> dataSetMapping;
@@ -148,7 +142,6 @@
PeriodService periodService,
OrganisationUnitService organisationUnitService,
Map<Object, Integer> dataElementMapping,
- Map<Object, Integer> dataElementGroupSetMapping,
Map<Object, Integer> categoryComboMapping,
Map<Object, Integer> indicatorMapping,
Map<Object, Integer> dataSetMapping,
@@ -164,7 +157,6 @@
this.periodService = periodService;
this.organisationUnitService = organisationUnitService;
this.dataElementMapping = dataElementMapping;
- this.dataElementGroupSetMapping = dataElementGroupSetMapping;
this.categoryComboMapping = categoryComboMapping;
this.indicatorMapping = indicatorMapping;
this.dataSetMapping = dataSetMapping;
@@ -230,16 +222,8 @@
}
writer.closeElement();
- writer.writeElement( FIELD_DIMENSION_TYPE, reportTable.getDimensionType() != null ? reportTable.getDimensionType() : EMPTY );
writer.writeElement( FIELD_CATEGORY_COMBO, reportTable.getCategoryCombo() != null ? String.valueOf( reportTable.getCategoryCombo().getId() ) : EMPTY );
- writer.openElement( FIELD_DATA_ELEMENT_GROUP_SETS );
- for ( DataElementGroupSet groupSet : reportTable.getDataElementGroupSets() )
- {
- writer.writeElement( FIELD_ID, String.valueOf( groupSet.getId() ) );
- }
- writer.closeElement();
-
writer.writeElement( FIELD_DO_INDICATORS, String.valueOf( reportTable.isDoIndicators() ) );
writer.writeElement( FIELD_DO_PERIODS, String.valueOf( reportTable.isDoPeriods() ) );
writer.writeElement( FIELD_DO_ORGANISATION_UNITS, String.valueOf( reportTable.isDoUnits() ) );
@@ -323,21 +307,10 @@
reportTable.getUnits().add( organisationUnitService.getOrganisationUnit( organisationUnitMapping.get( id ) ) );
}
- reader.moveToStartElement( FIELD_DIMENSION_TYPE );
- reportTable.setDimensionType( reader.getElementValue() );
-
reader.moveToStartElement( FIELD_CATEGORY_COMBO );
String cc = reader.getElementValue();
reportTable.setCategoryCombo( cc != null ? categoryService.getDataElementCategoryCombo( categoryComboMapping.get( Integer.parseInt( cc ) ) ) : null );
- List<DataElementGroupSet> groupSets = new ArrayList<DataElementGroupSet>();
- while ( reader.moveToStartElement( FIELD_ID, FIELD_DATA_ELEMENT_GROUP_SETS ) )
- {
- int id = Integer.parseInt( reader.getElementValue() );
- groupSets.add( dataElementService.getDataElementGroupSet( dataElementGroupSetMapping.get( id ) ) );
- }
- reportTable.setDataElementGroupSets( groupSets );
-
reader.moveToStartElement( FIELD_DO_INDICATORS );
reportTable.setDoIndicators( Boolean.parseBoolean( reader.getElementValue() ) );
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/xml/LocManagerXSLTLocator.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/xml/LocManagerXSLTLocator.java 2010-10-29 08:56:13 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/xml/LocManagerXSLTLocator.java 2011-01-31 19:47:04 +0000
@@ -36,7 +36,6 @@
import org.hisp.dhis.external.location.LocationManager;
import org.hisp.dhis.external.location.LocationManagerException;
import org.hisp.dhis.importexport.ImportException;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.w3c.dom.Node;
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java 2011-01-26 10:01:53 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java 2011-01-31 19:47:04 +0000
@@ -44,11 +44,10 @@
import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.completeness.DataSetCompletenessService;
import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOption;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.datamart.DataMartService;
import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.dimension.DimensionOption;
-import org.hisp.dhis.dimension.DimensionOptionElement;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.jdbc.batchhandler.GenericBatchHandler;
@@ -449,7 +448,7 @@
for ( final IdentifiableObject metaObject : reportTable.getReportIndicators() )
{
- for ( final DimensionOptionElement categoryOptionCombo : reportTable.getReportCategoryOptionCombos() )
+ for ( final DataElementCategoryOptionCombo categoryOptionCombo : reportTable.getReportCategoryOptionCombos() )
{
for ( final Period period : reportTable.getReportPeriods() )
{
@@ -561,10 +560,10 @@
if ( reportTable.doTotal() )
{
- for ( DimensionOption dimensionOption : reportTable.getDimensionOptions() )
+ for ( DataElementCategoryOption categoryOption : reportTable.getCategoryOptions() )
{
grid.addValue( String.valueOf( aggregatedDataValueService.
- getAggregatedValue( (DataElement) metaObject, dimensionOption, period, unit ) ) );
+ getAggregatedValue( (DataElement) metaObject, categoryOption, period, unit ) ) );
}
grid.addValue( String.valueOf( aggregatedDataValueService.getAggregatedValue( (DataElement) metaObject, period, unit ) ) );
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/statement/CreateReportTableStatement.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/statement/CreateReportTableStatement.java 2011-01-13 17:32:48 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/statement/CreateReportTableStatement.java 2011-01-31 19:47:04 +0000
@@ -114,7 +114,7 @@
if ( reportTable.doTotal() )
{
- for ( String column : reportTable.getDimensionOptionColumns() )
+ for ( String column : reportTable.getCategoryOptionColumns() )
{
buffer.append( column + SPACE + statementBuilder.getDoubleColumnType() + SEPARATOR );
}
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml 2011-01-06 09:03:29 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml 2011-01-31 19:47:04 +0000
@@ -45,18 +45,9 @@
class="org.hisp.dhis.dataset.DataSet"/>
</list>
- <property name="dimensionType" column="dimension_type"/>
-
<many-to-one name="categoryCombo" class="org.hisp.dhis.dataelement.DataElementCategoryCombo"
column="categorycomboid" foreign-key="fk_reporttable_categorycombo"/>
- <list name="dataElementGroupSets" table="reporttable_dataelementgroupsets">
- <key column="reporttableid"/>
- <list-index column="sort_order" base="0"/>
- <many-to-many column="dataelementgroupsetid"
- class="org.hisp.dhis.dataelement.DataElementGroupSet"/>
- </list>
-
<list name="periods" table="reporttable_periods">
<key column="reporttableid"/>
<list-index column="sort_order" base="0"/>
=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetCategoryComboDataElementsAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetCategoryComboDataElementsAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetCategoryComboDataElementsAction.java 2011-01-31 19:47:04 +0000
@@ -0,0 +1,112 @@
+package org.hisp.dhis.reporting.tablecreator.action;
+
+/*
+ * 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.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Lars Helge Overland
+ */
+public class GetCategoryComboDataElementsAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private DataElementCategoryService categoryService;
+
+ public void setCategoryService( DataElementCategoryService categoryService )
+ {
+ this.categoryService = categoryService;
+ }
+
+ private DataElementService dataElementService;
+
+ public void setDataElementService( DataElementService dataElementService )
+ {
+ this.dataElementService = dataElementService;
+ }
+
+ private Comparator<DataElement> dataElementComparator;
+
+ public void setDataElementComparator( Comparator<DataElement> dataElementComparator )
+ {
+ this.dataElementComparator = dataElementComparator;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private Integer categoryComboId;
+
+ public void setCategoryComboId( Integer categoryComboId )
+ {
+ this.categoryComboId = categoryComboId;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private List<DataElement> dataElements;
+
+ public List<DataElement> getDataElements()
+ {
+ return dataElements;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ DataElementCategoryCombo categoryCombo = categoryService.getDataElementCategoryCombo( categoryComboId );
+
+ if ( categoryCombo != null )
+ {
+ dataElements = new ArrayList<DataElement>( dataElementService.getDataElementByCategoryCombo( categoryCombo ) );
+
+ Collections.sort( dataElements, dataElementComparator );
+ }
+
+ return SUCCESS;
+ }
+}
=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetDimensionSetDataElementsAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetDimensionSetDataElementsAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetDimensionSetDataElementsAction.java 1970-01-01 00:00:00 +0000
@@ -1,90 +0,0 @@
-package org.hisp.dhis.reporting.tablecreator.action;
-
-/*
- * 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.ArrayList;
-import java.util.List;
-
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dimension.DimensionService;
-import org.hisp.dhis.dimension.DimensionSet;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Lars Helge Overland
- */
-public class GetDimensionSetDataElementsAction
- implements Action
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private DimensionService dimensionService;
-
- public void setDimensionService( DimensionService dimensionService )
- {
- this.dimensionService = dimensionService;
- }
-
- // -------------------------------------------------------------------------
- // Input
- // -------------------------------------------------------------------------
-
- private String dimensionSetId;
-
- public void setDimensionSetId( String dimensionSetId )
- {
- this.dimensionSetId = dimensionSetId;
- }
-
- // -------------------------------------------------------------------------
- // Output
- // -------------------------------------------------------------------------
-
- private List<DataElement> dataElements;
-
- public List<DataElement> getDataElements()
- {
- return dataElements;
- }
-
- // -------------------------------------------------------------------------
- // Fixture
- // -------------------------------------------------------------------------
-
- public String execute()
- {
- DimensionSet dimensionSet = dimensionService.getDimensionSet( dimensionSetId );
-
- dataElements = new ArrayList<DataElement>( dimensionService.getDataElements( dimensionSet ) );
-
- return SUCCESS;
- }
-}
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetTableOptionsAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetTableOptionsAction.java 2011-01-28 23:04:52 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetTableOptionsAction.java 2011-01-31 19:47:04 +0000
@@ -37,15 +37,16 @@
import java.util.TreeMap;
import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementGroup;
import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dataelement.comparator.DataElementCategoryComboNameComparator;
import org.hisp.dhis.dataelement.comparator.DataElementGroupNameComparator;
import org.hisp.dhis.dataelement.comparator.DataElementNameComparator;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
import org.hisp.dhis.dataset.comparator.DataSetNameComparator;
-import org.hisp.dhis.dimension.DimensionService;
-import org.hisp.dhis.dimension.DimensionSet;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorGroup;
@@ -101,11 +102,11 @@
this.dataElementService = dataElementService;
}
- private DimensionService dimensionService;
+ private DataElementCategoryService categoryService;
- public void setDimensionService( DimensionService dimensionService )
+ public void setCategoryService( DataElementCategoryService categoryService )
{
- this.dimensionService = dimensionService;
+ this.categoryService = categoryService;
}
private IndicatorService indicatorService;
@@ -203,11 +204,11 @@
return dataElementGroups;
}
- private List<DimensionSet> dimensionSets = new ArrayList<DimensionSet>();
-
- public List<DimensionSet> getDimensionSets()
+ private List<DataElementCategoryCombo> categoryCombos = new ArrayList<DataElementCategoryCombo>();
+
+ public List<DataElementCategoryCombo> getCategoryCombos()
{
- return dimensionSets;
+ return categoryCombos;
}
private List<DataElement> dataElements = new ArrayList<DataElement>();
@@ -348,7 +349,9 @@
}
else if ( mode != null && mode.equals( ReportTable.MODE_DATAELEMENTS ) && dimension )
{
- dimensionSets = new ArrayList<DimensionSet>( dimensionService.getDataElementDimensionSets() );
+ categoryCombos = new ArrayList<DataElementCategoryCombo>( categoryService.getAllDataElementCategoryCombos() );
+
+ Collections.sort( categoryCombos, new DataElementCategoryComboNameComparator() );
}
else if ( mode != null && mode.equals( ReportTable.MODE_INDICATORS ) )
{
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/SaveTableAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/SaveTableAction.java 2011-01-18 14:33:30 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/SaveTableAction.java 2011-01-31 19:47:04 +0000
@@ -27,17 +27,18 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.system.util.ConversionUtils.*;
+import static org.hisp.dhis.system.util.ConversionUtils.getIntegerCollection;
+import static org.hisp.dhis.system.util.ConversionUtils.getList;
import java.util.ArrayList;
import java.util.List;
import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.dimension.DimensionService;
-import org.hisp.dhis.dimension.DimensionSet;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -75,12 +76,12 @@
{
this.dataElementService = dataElementService;
}
-
- private DimensionService dimensionService;
- public void setDimensionService( DimensionService dimensionService )
+ private DataElementCategoryService categoryService;
+
+ public void setCategoryService( DataElementCategoryService categoryService )
{
- this.dimensionService = dimensionService;
+ this.categoryService = categoryService;
}
private IndicatorService indicatorService;
@@ -143,11 +144,11 @@
this.regression = regression;
}
- private String dimensionSetId;
+ private Integer categoryComboId;
- public void setDimensionSetId( String dimensionSetId )
+ public void setCategoryComboId( Integer categoryComboId )
{
- this.dimensionSetId = dimensionSetId;
+ this.categoryComboId = categoryComboId;
}
private boolean doIndicators;
@@ -324,7 +325,7 @@
units.add( organisationUnitService.getOrganisationUnit( id ) );
}
- DimensionSet dimensionSet = dimensionService.getDimensionSet( dimensionSetId );
+ DataElementCategoryCombo categoryCombo = categoryService.getDataElementCategoryCombo( categoryComboId );
RelativePeriods relatives = new RelativePeriods( reportingMonth, monthsThisYear, quartersThisYear, thisYear, monthsLastYear, quartersLastYear, lastYear );
@@ -340,7 +341,7 @@
{
reportTable = new ReportTable( tableName, mode, regression,
dataElements, indicators, dataSets, periods, null, units, null,
- dimensionSet, doIndicators, doPeriods, doOrganisationUnits, relatives, reportParams,
+ categoryCombo, doIndicators, doPeriods, doOrganisationUnits, relatives, reportParams,
null, null );
}
else
@@ -354,12 +355,12 @@
reportTable.setDataSets( dataSets );
reportTable.setPeriods( periods );
reportTable.setUnits( units );
+ reportTable.setCategoryCombo( categoryCombo );
reportTable.setDoIndicators( doIndicators );
reportTable.setDoPeriods( doPeriods );
reportTable.setDoUnits( doOrganisationUnits );
reportTable.setRelatives( relatives );
reportTable.setReportParams( reportParams );
- reportTable.setDimensionSet( dimensionSet );
}
return reportTable;
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml 2011-01-21 18:49:34 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml 2011-01-31 19:47:04 +0000
@@ -150,8 +150,8 @@
ref="org.hisp.dhis.reporttable.ReportTableService"/>
<property name="dataElementService"
ref="org.hisp.dhis.dataelement.DataElementService"/>
- <property name="dimensionService"
- ref="org.hisp.dhis.dimension.DimensionService"/>
+ <property name="categoryService"
+ ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>
<property name="indicatorService"
ref="org.hisp.dhis.indicator.IndicatorService"/>
<property name="periodService"
@@ -169,8 +169,8 @@
ref="org.hisp.dhis.reporttable.ReportTableService"/>
<property name="dataElementService"
ref="org.hisp.dhis.dataelement.DataElementService"/>
- <property name="dimensionService"
- ref="org.hisp.dhis.dimension.DimensionService"/>
+ <property name="categoryService"
+ ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>
<property name="indicatorService"
ref="org.hisp.dhis.indicator.IndicatorService"/>
<property name="periodService"
@@ -246,20 +246,22 @@
<property name="reportTableService"
ref="org.hisp.dhis.reporttable.ReportTableService"/>
</bean>
-
- <bean id="org.hisp.dhis.reporting.tablecreator.action.GetDimensionSetDataElementsAction"
- class="org.hisp.dhis.reporting.tablecreator.action.GetDimensionSetDataElementsAction"
- scope="prototype">
- <property name="dimensionService"
- ref="org.hisp.dhis.dimension.DimensionService"/>
- </bean>
-
+
<bean id="org.hisp.dhis.reporting.tablecreator.action.ExportTableAction"
class="org.hisp.dhis.reporting.tablecreator.action.ExportTableAction"
scope="prototype">
<property name="reportTableService"
ref="org.hisp.dhis.reporttable.ReportTableService"/>
- </bean>
+ </bean>
+
+ <bean id="org.hisp.dhis.reporting.tablecreator.action.GetCategoryComboDataElementsAction"
+ class="org.hisp.dhis.reporting.tablecreator.action.GetCategoryComboDataElementsAction"
+ scope="prototype">
+ <property name="categoryService"
+ ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>
+ <property name="dataElementService"
+ ref="org.hisp.dhis.dataelement.DataElementService"/>
+ </bean>
<!-- ReportViewer -->
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties 2011-01-24 17:01:24 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties 2011-01-31 19:47:04 +0000
@@ -309,4 +309,5 @@
get_report_as_pdf = Download as PDF
get_report_as_jasper = Download as Jasper
get_report_as_jrxml = Download as JRXML
-user_organisation_unit = Include current user organisation unit
\ No newline at end of file
+user_organisation_unit = Include current user organisation unit
+select_category_combo = Select category combination
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml 2011-01-25 13:49:21 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml 2011-01-31 19:47:04 +0000
@@ -240,12 +240,7 @@
<result name="success" type="velocity-xml">/dhis-web-reporting/responseSuccess.vm</result>
<param name="onExceptionReturn">plainTextError</param>
</action>
-
- <action name="getDimensionSetDataElements" class="org.hisp.dhis.reporting.tablecreator.action.GetDimensionSetDataElementsAction">
- <result name="success" type="velocity">/dhis-web-commons/ajax/xmlDataElements.vm</result>
- <param name="onExceptionReturn">plainTextError</param>
- </action>
-
+
<action name="exportTable" class="org.hisp.dhis.reporting.tablecreator.action.ExportTableAction">
<result name="csv" type="gridCsvResult"/>
<result name="xls" type="gridXlsResult"/>
@@ -258,6 +253,11 @@
<param name="javascripts">javascript/generateReport.js</param>
</action>
+ <action name="getCategoryComboDataElements" class="org.hisp.dhis.reporting.tablecreator.action.GetCategoryComboDataElementsAction">
+ <result name="success" type="velocity-xml">../dhis-web-commons/ajax/xmlDataElements.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
+
<!-- PivotTable -->
<action name="displayPivotTableForm" class="org.hisp.dhis.reporting.pivottable.action.GetPivotTableOptionsAction">
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addTableForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addTableForm.vm 2011-01-06 09:03:29 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addTableForm.vm 2011-01-31 19:47:04 +0000
@@ -64,7 +64,7 @@
<select id="dataElementGroupId" name="dataElementGroupId" style="min-width:640px" onchange="getDataElements()">
<option value="$ALL">[ $i18n.getString( "select_dataelementgroup_all" ) ]</option>
#foreach ( $group in $dataElementGroups )
- <option value="$group.id">$group.name</option>
+ <option value="$group.id">$encoder.htmlEncode( $group.name )</option>
#end
</select>
</td>
@@ -76,10 +76,10 @@
<tr>
<td>
- <select id="dimensionSetId" name="dimensionSetId" style="min-width:640px" onchange="getDimensionSetDataElements()">
- <option value="-1">[ $i18n.getString( "select_dimension" ) ]</option>
- #foreach ( $dimensionSet in $dimensionSets )
- <option value="$dimensionSet.dimensionSetId">$dimensionSet.name</option>
+ <select id="categoryComboId" name="categoryComboId" style="min-width:640px" onchange="getCategoryComboDataElements()">
+ <option value="-1">[ $i18n.getString( "select_category_combo" ) ]</option>
+ #foreach ( $categoryCombo in $categoryCombos )
+ <option value="$categoryCombo.id">$encoder.htmlEncode( $categoryCombo.name )</option>
#end
</select>
</td>
@@ -91,7 +91,7 @@
<td>
<select multiple size="6" id="availableDataElements" name="availableDataElements" style="min-width:640px" ondblclick="moveSelectedById( 'availableDataElements', 'selectedDataElements' )">
#foreach ( $element in $dataElements )
- <option value="$element.id">$element.name</option>
+ <option value="$element.id">$encoder.htmlEncode( $element.name )</option>
#end
</select>
</td>
@@ -111,7 +111,7 @@
<td>
<select multiple size="6" id="selectedDataElements" name="selectedDataElements" style="min-width:640px" ondblclick="moveSelectedById( 'selectedDataElements', 'availableDataElements' )">
#foreach( $element in $selectedDataElements )
- <option value="$element.id">$element.name</option>
+ <option value="$element.id">$encoder.htmlEncode( $element.name )</option>
#end
</select>
</td>
@@ -132,7 +132,7 @@
<select id="indicatorGroupId" name="indicatorGroupId" style="min-width:640px" onchange="getIndicators()">
<option value="$ALL">[ $i18n.getString( "select_indicatorgroup_all" ) ]</option>
#foreach ( $group in $indicatorGroups )
- <option value="$group.id">$group.name</option>
+ <option value="$group.id">$encoder.htmlEncode( $group.name )</option>
#end
</select>
</td>
@@ -141,7 +141,7 @@
<td>
<select multiple size="6" id="availableIndicators" name="availableIndicators" style="min-width:640px" ondblclick="moveSelectedById( 'availableIndicators', 'selectedIndicators' )">
#foreach ( $indicator in $indicators )
- <option value="$indicator.id">$indicator.name</option>
+ <option value="$indicator.id">$encoder.htmlEncode( $indicator.name )</option>
#end
</select>
</td>
@@ -161,7 +161,7 @@
<td>
<select multiple size="6" id="selectedIndicators" name="selectedIndicators" style="min-width:640px" ondblclick="moveSelectedById( 'selectedIndicators', 'availableIndicators' )">
#foreach( $indicator in $selectedIndicators )
- <option value="$indicator.id">$indicator.name</option>
+ <option value="$indicator.id">$encoder.htmlEncode( $indicator.name )</option>
#end
</select>
</td>
@@ -181,7 +181,7 @@
<td>
<select multiple size="6" id="availableDataSets" name="availableDataSets" style="min-width:640px" ondblclick="moveSelectedById( 'availableDataSets', 'selectedDataSets' )">
#foreach ( $dataSet in $dataSets )
- <option value="$dataSet.id">$dataSet.name</option>
+ <option value="$dataSet.id">$encoder.htmlEncode( $dataSet.name )</option>
#end
</select>
</td>
@@ -201,7 +201,7 @@
<td>
<select multiple size="6" id="selectedDataSets" name="selectedDataSets" style="min-width:640px" ondblclick="moveSelectedById( 'selectedDataSets', 'availableDataSets' )">
#foreach ( $dataSet in $selectedDataSets )
- <option value="$dataSet.id">$dataSet.name</option>
+ <option value="$dataSet.id">$encoder.htmlEncode( $dataSet.name )</option>
#end
</select>
</td>
@@ -231,7 +231,7 @@
<td>
<select multiple size="6" id="availableOrganisationUnits" name="availableOrganisationUnits" style="min-width:640px" ondblclick="moveSelectedById( 'availableOrganisationUnits', 'selectedOrganisationUnits' )">
#foreach ( $unit in $organisationUnits )
- <option value="$unit.id">$unit.name</option>
+ <option value="$unit.id">$encoder.htmlEncode( $unit.name )</option>
#end
</select>
</td>
@@ -252,7 +252,7 @@
<td>
<select multiple size="6" id="selectedOrganisationUnits" name="selectedOrganisationUnits" style="min-width:640px" ondblclick="moveSelectedById( 'selectedOrganisationUnits', 'availableOrganisationUnits' )">
#foreach ( $unit in $selectedOrganisationUnits )
- <option value="$unit.id">$unit.name</option>
+ <option value="$unit.id">$encoder.htmlEncode( $unit.name )</option>
#end
</select>
</td>
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/lists.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/lists.js 2010-07-18 15:17:23 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/lists.js 2011-01-31 19:47:04 +0000
@@ -43,22 +43,22 @@
}
}
-function getDimensionSetDataElements()
+function getCategoryComboDataElements()
{
- var dimensionSetId = getListValue( "dimensionSetId" );
+ var categoryComboId = getListValue( "categoryComboId" );
- if ( dimensionSetId != null )
+ if ( categoryComboId != null )
{
- var url = "getDimensionSetDataElements.action?dimensionSetId=" + dimensionSetId;
+ var url = "getCategoryComboDataElements.action?categoryComboId=" + categoryComboId;
var request = new Request();
request.setResponseTypeXML( 'dataElement' );
- request.setCallbackSuccess( getDimensionSetDataElementsReceived );
+ request.setCallbackSuccess( getCategoryComboDataElementsReceived );
request.send( url );
}
}
-function getDimensionSetDataElementsReceived( xmlObject )
+function getCategoryComboDataElementsReceived( xmlObject )
{
var availableDataElements = document.getElementById( "availableDataElements" );
var selectedDataElements = document.getElementById( "selectedDataElements" );