dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #22661
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10960: Minor refactor of DimensionalObject. Using NameableObject instead of IdentifiableObject as dimens...
Merge authors:
Lars Helge Øverland (larshelge)
------------------------------------------------------------
revno: 10960 [merge]
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-05-23 15:55:02 +0200
message:
Minor refactor of DimensionalObject. Using NameableObject instead of IdentifiableObject as dimension items. Need the short name and description properties for report tables.
added:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/NameableObjectUtils.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseAnalyticalObject.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseDimensionalObject.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseNameableObject.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionalObject.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/DataElementGroupSet.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsManager.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DimensionItem.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultQueryPlanner.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/JdbcAnalyticsManager.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/PartitionUtils.java
dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/DataQueryParamsTest.java
dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/AnalyticsManagerTest.java
dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/QueryPlannerTest.java
dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/table/PartitionUtilsTest.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultDimensionService.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/jdbc/AnalyticsDataSetReportStore.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseAnalyticalObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseAnalyticalObject.java 2013-05-23 09:23:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseAnalyticalObject.java 2013-05-23 13:38:20 +0000
@@ -338,25 +338,25 @@
}
else if ( ORGUNIT_DIM_ID.equals( dimension ) && ( !organisationUnits.isEmpty() || hasUserOrgUnit() ) )
{
- List<IdentifiableObject> ouList = new ArrayList<IdentifiableObject>();
+ List<NameableObject> ouList = new ArrayList<NameableObject>();
ouList.addAll( organisationUnits );
ouList.addAll( transientOrganisationUnits );
if ( userOrganisationUnit )
{
- ouList.add( new BaseIdentifiableObject( KEY_USER_ORGUNIT, KEY_USER_ORGUNIT, KEY_USER_ORGUNIT ) );
+ ouList.add( new BaseNameableObject( KEY_USER_ORGUNIT, KEY_USER_ORGUNIT, KEY_USER_ORGUNIT ) );
}
if ( userOrganisationUnitChildren )
{
- ouList.add( new BaseIdentifiableObject( KEY_USER_ORGUNIT_CHILDREN, KEY_USER_ORGUNIT_CHILDREN, KEY_USER_ORGUNIT_CHILDREN ) );
+ ouList.add( new BaseNameableObject( KEY_USER_ORGUNIT_CHILDREN, KEY_USER_ORGUNIT_CHILDREN, KEY_USER_ORGUNIT_CHILDREN ) );
}
objects.add( new BaseDimensionalObject( dimension, DimensionType.ORGANISATIONUNIT, ouList ) );
}
else if ( CATEGORYOPTIONCOMBO_DIM_ID.equals( dimension ) )
{
- objects.add( new BaseDimensionalObject( dimension, DimensionType.CATEGORY_OPTION_COMBO, new ArrayList<IdentifiableObject>() ) );
+ objects.add( new BaseDimensionalObject( dimension, DimensionType.CATEGORY_OPTION_COMBO, new ArrayList<BaseNameableObject>() ) );
}
else if ( categoryDims.contains( dimension ) )
{
@@ -366,7 +366,7 @@
}
else // Group set
{
- ListMap<String, IdentifiableObject> deGroupMap = new ListMap<String, IdentifiableObject>();
+ ListMap<String, BaseNameableObject> deGroupMap = new ListMap<String, BaseNameableObject>();
for ( DataElementGroup group : dataElementGroups )
{
@@ -378,7 +378,7 @@
objects.add( new BaseDimensionalObject( dimension, DimensionType.DATAELEMENT_GROUPSET, deGroupMap.get( dimension ) ) );
}
- ListMap<String, IdentifiableObject> ouGroupMap = new ListMap<String, IdentifiableObject>();
+ ListMap<String, BaseNameableObject> ouGroupMap = new ListMap<String, BaseNameableObject>();
for ( OrganisationUnitGroup group : organisationUnitGroups )
{
@@ -406,7 +406,7 @@
return categoryDims;
}
- public static String getId( List<NameableObject> column, List<NameableObject> row )
+ public static String getIdentifer( List<NameableObject> column, List<NameableObject> row )
{
StringBuilder id = new StringBuilder();
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseDimensionalObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseDimensionalObject.java 2013-05-22 10:27:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseDimensionalObject.java 2013-05-23 13:38:20 +0000
@@ -42,7 +42,7 @@
@JacksonXmlRootElement( localName = "dimensionalObject", namespace = DxfNamespaces.DXF_2_0)
public class BaseDimensionalObject
- extends BaseIdentifiableObject implements DimensionalObject
+ extends BaseNameableObject implements DimensionalObject
{
/**
* The type of this dimension.
@@ -59,7 +59,7 @@
/**
* The dimensional items for this dimension.
*/
- private List<IdentifiableObject> items = new ArrayList<IdentifiableObject>();
+ private List<NameableObject> items = new ArrayList<NameableObject>();
//--------------------------------------------------------------------------
// Constructors
@@ -74,28 +74,28 @@
this.uid = dimension;
}
- public BaseDimensionalObject( String dimension, DimensionType type, List<? extends IdentifiableObject> items )
+ public BaseDimensionalObject( String dimension, DimensionType type, List<? extends NameableObject> items )
{
this.uid = dimension;
this.type = type;
- this.items = new ArrayList<IdentifiableObject>( items );
+ this.items = new ArrayList<NameableObject>( items );
}
- public BaseDimensionalObject( String dimension, DimensionType type, String dimensionName, List<IdentifiableObject> items )
+ public BaseDimensionalObject( String dimension, DimensionType type, String dimensionName, List<? extends NameableObject> items )
{
this.uid = dimension;
this.type = type;
this.dimensionName = dimensionName;
- this.items = items;
+ this.items = new ArrayList<NameableObject>( items );
}
- public BaseDimensionalObject( String dimension, DimensionType type, String dimensionName, String displayName, List<IdentifiableObject> items )
+ public BaseDimensionalObject( String dimension, DimensionType type, String dimensionName, String displayName, List<? extends NameableObject> items )
{
this.uid = dimension;
this.type = type;
this.dimensionName = dimensionName;
this.displayName = displayName;
- this.items = items;
+ this.items = new ArrayList<NameableObject>( items );
}
// -------------------------------------------------------------------------
@@ -164,12 +164,12 @@
@JsonView( { DimensionalView.class } )
@JacksonXmlElementWrapper( localName = "items", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "item", namespace = DxfNamespaces.DXF_2_0 )
- public List<IdentifiableObject> getItems()
+ public List<NameableObject> getItems()
{
return items;
}
- public void setItems( List<IdentifiableObject> items )
+ public void setItems( List<NameableObject> items )
{
this.items = items;
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseNameableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseNameableObject.java 2013-03-19 17:31:48 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseNameableObject.java 2013-05-23 13:38:20 +0000
@@ -76,6 +76,13 @@
{
}
+ public BaseNameableObject( String uid, String code, String name )
+ {
+ this.uid = uid;
+ this.code = code;
+ this.name = name;
+ }
+
public BaseNameableObject( int id, String uid, String name, String shortName,
String code, String description )
{
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionalObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionalObject.java 2013-05-19 18:49:47 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionalObject.java 2013-05-23 13:38:20 +0000
@@ -61,7 +61,7 @@
String getDisplayName();
- List<IdentifiableObject> getItems();
+ List<NameableObject> getItems();
boolean isAllItems();
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/NameableObjectUtils.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/NameableObjectUtils.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/NameableObjectUtils.java 2013-05-23 13:38:20 +0000
@@ -0,0 +1,90 @@
+package org.hisp.dhis.common;
+
+/*
+ * Copyright (c) 2004-2012, 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.Collection;
+import java.util.List;
+
+/**
+ * @author Lars Helge Overland
+ */
+public class NameableObjectUtils
+{
+ /**
+ * Returns a list of NameableObjects.
+ *
+ * @param objects the NameableObjects to include in the list.
+ * @return a list of NameableObjects.
+ */
+ public static List<NameableObject> getList( NameableObject... objects )
+ {
+ List<NameableObject> list = new ArrayList<NameableObject>();
+
+ for ( NameableObject object : objects )
+ {
+ list.add( object );
+ }
+
+ return list;
+ }
+
+ /**
+ * Returns a list with erasure NameableObject based on the given collection.
+ *
+ * @param collection the collection.
+ * @return a list of NameableObjects.
+ */
+ public static List<NameableObject> asList( Collection<? extends NameableObject> collection )
+ {
+ List<NameableObject> list = new ArrayList<NameableObject>();
+ list.addAll( collection );
+ return list;
+ }
+
+ /**
+ * Returns a list typed with the desired erasure based on the given collection.
+ * This operation implies an unchecked cast and it is the responsibility of
+ * the caller to make sure the cast is valid.
+ *
+ * @param collection the collection.
+ * @return a list.
+ */
+ @SuppressWarnings("unchecked")
+ public static <T extends NameableObject> List<T> asTypedList( Collection<NameableObject> collection )
+ {
+ List<T> list = new ArrayList<T>();
+
+ for ( NameableObject object : collection )
+ {
+ list.add( (T) object );
+ }
+
+ return list;
+ }
+}
=== 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 2013-05-13 08:36:43 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java 2013-05-23 13:38:20 +0000
@@ -34,6 +34,7 @@
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.DxfNamespaces;
import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.NameableObject;
import org.hisp.dhis.common.annotation.Scanned;
import org.hisp.dhis.common.view.DetailedView;
import org.hisp.dhis.common.view.DimensionalView;
@@ -139,11 +140,6 @@
return null;
}
- public List<IdentifiableObject> getDimensionItems()
- {
- return new ArrayList<IdentifiableObject>( categoryOptions );
- }
-
// -------------------------------------------------------------------------
// Dimensional object
// -------------------------------------------------------------------------
@@ -154,9 +150,9 @@
@JsonView( { DetailedView.class, DimensionalView.class } )
@JacksonXmlElementWrapper( localName = "items", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "item", namespace = DxfNamespaces.DXF_2_0 )
- public List<IdentifiableObject> getItems()
+ public List<NameableObject> getItems()
{
- return new ArrayList<IdentifiableObject>( categoryOptions );
+ return new ArrayList<NameableObject>( categoryOptions );
}
// -------------------------------------------------------------------------
=== 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 2013-05-08 22:56:40 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java 2013-05-23 13:38:20 +0000
@@ -36,6 +36,7 @@
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.DxfNamespaces;
import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.NameableObject;
import org.hisp.dhis.common.annotation.Scanned;
import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
import org.hisp.dhis.common.view.DetailedView;
@@ -174,11 +175,6 @@
return sortedGroups;
}
- public List<IdentifiableObject> getDimensionItems()
- {
- return new ArrayList<IdentifiableObject>( members );
- }
-
// -------------------------------------------------------------------------
// Dimensional object
// -------------------------------------------------------------------------
@@ -189,9 +185,9 @@
@JsonView( { DimensionalView.class } )
@JacksonXmlElementWrapper( localName = "items", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "item", namespace = DxfNamespaces.DXF_2_0 )
- public List<IdentifiableObject> getItems()
+ public List<NameableObject> getItems()
{
- return new ArrayList<IdentifiableObject>( members );
+ return new ArrayList<NameableObject>( members );
}
// -------------------------------------------------------------------------
=== 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 2013-05-08 22:56:40 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java 2013-05-23 13:38:20 +0000
@@ -39,6 +39,7 @@
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.DxfNamespaces;
import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.NameableObject;
import org.hisp.dhis.common.annotation.Scanned;
import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
import org.hisp.dhis.common.view.DetailedView;
@@ -166,11 +167,6 @@
return sortedGroups;
}
- public List<IdentifiableObject> getDimensionItems()
- {
- return new ArrayList<IdentifiableObject>( organisationUnitGroups );
- }
-
// -------------------------------------------------------------------------
// Dimensional object
// -------------------------------------------------------------------------
@@ -181,9 +177,9 @@
@JsonView( { DetailedView.class, DimensionalView.class } )
@JacksonXmlElementWrapper( localName = "items", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "item", namespace = DxfNamespaces.DXF_2_0 )
- public List<IdentifiableObject> getItems()
+ public List<NameableObject> getItems()
{
- return new ArrayList<IdentifiableObject>( organisationUnitGroups );
+ return new ArrayList<NameableObject>( organisationUnitGroups );
}
// -------------------------------------------------------------------------
=== 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 2013-05-23 12:00:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java 2013-05-23 12:59:00 +0000
@@ -40,7 +40,6 @@
import org.apache.commons.lang.StringUtils;
import org.hisp.dhis.common.BaseAnalyticalObject;
-import org.hisp.dhis.common.BaseNameableObject;
import org.hisp.dhis.common.CombinationGenerator;
import org.hisp.dhis.common.DimensionalObject;
import org.hisp.dhis.common.DxfNamespaces;
@@ -144,6 +143,9 @@
public static final int DESC = 1;
public static final int NONE = 0;
+ public static final NameableObject[] IRT = new NameableObject[0];
+ public static final NameableObject[][] IRT2D = new NameableObject[0][];
+
public static final Map<String, String> PRETTY_COLUMNS = new HashMap<String, String>()
{
{
@@ -171,9 +173,6 @@
private static final String EMPTY = "";
- private static final NameableObject[] IRT = new NameableObject[0];
- private static final NameableObject[][] IRT2D = new NameableObject[0][];
-
private static final String ILLEGAL_FILENAME_CHARS_REGEX = "[/\\?%*:|\"'<>.]";
// -------------------------------------------------------------------------
@@ -593,6 +592,17 @@
}
/**
+ * Adds an empty list of NameableObjects to the given list if empty.
+ */
+ public static void addIfEmpty( List<List<NameableObject>> list )
+ {
+ if ( list != null && list.size() == 0 )
+ {
+ list.add( Arrays.asList( new NameableObject[0] ) );
+ }
+ }
+
+ /**
* Generates a grid for this report table based on the given aggregate value
* map.
*
@@ -604,9 +614,9 @@
public Grid getGrid( Grid grid, Map<String, Double> valueMap, boolean paramColumns )
{
final String subtitle = StringUtils.trimToEmpty( getParentOrganisationUnitName() ) + SPACE
- + StringUtils.trimToEmpty( getReportingPeriodName() );
+ + StringUtils.trimToEmpty( reportingPeriodName );
- grid.setTitle( getName() + " - " + subtitle );
+ grid.setTitle( name + " - " + subtitle );
// ---------------------------------------------------------------------
// Headers
@@ -674,7 +684,7 @@
for ( List<NameableObject> column : gridColumns )
{
- String key = BaseAnalyticalObject.getId( column, row );
+ String key = BaseAnalyticalObject.getIdentifer( column, row );
Double value = valueMap.get( key );
@@ -714,17 +724,6 @@
// -------------------------------------------------------------------------
/**
- * Adds an empty list of NameableObjects to the given list if empty.
- */
- private static void addIfEmpty( List<List<NameableObject>> list )
- {
- if ( list != null && list.size() == 0 )
- {
- list.add( Arrays.asList( new NameableObject[0] ) );
- }
- }
-
- /**
* Returns the number of empty lists among the argument lists.
*/
private static int nonEmptyLists( List<?>... lists )
@@ -766,25 +765,6 @@
return null;
}
- /**
- * Gets the real Nameable class in case of a proxy.
- */
- @SuppressWarnings("unchecked")
- public static Class<? extends NameableObject> getNameableClass( Class<?> clazz )
- {
- while ( clazz != null )
- {
- if ( BaseNameableObject.class.equals( clazz.getSuperclass() ) )
- {
- return (Class<? extends NameableObject>) clazz;
- }
-
- clazz = clazz.getSuperclass();
- }
-
- throw new IllegalStateException( "Class is not a Nameable object: " + clazz );
- }
-
// -------------------------------------------------------------------------
// Get- and set-methods for persisted properties
// -------------------------------------------------------------------------
@@ -1002,12 +982,22 @@
return gridColumns;
}
+ public void setGridColumns( List<List<NameableObject>> gridColumns )
+ {
+ this.gridColumns = gridColumns;
+ }
+
@JsonIgnore
public List<List<NameableObject>> getGridRows()
{
return gridRows;
}
+ public void setGridRows( List<List<NameableObject>> gridRows )
+ {
+ this.gridRows = gridRows;
+ }
+
@JsonIgnore
public OrganisationUnit getParentOrganisationUnit()
{
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsManager.java 2013-05-07 08:37:33 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsManager.java 2013-05-23 13:38:20 +0000
@@ -30,8 +30,8 @@
import java.util.Map;
import java.util.concurrent.Future;
-import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.common.ListMap;
+import org.hisp.dhis.common.NameableObject;
/**
* @author Lars Helge Overland
@@ -58,5 +58,5 @@
* @param dataPeriodAggregationPeriodMap the mapping between data periods and
* aggregation periods for this query.
*/
- void replaceDataPeriodsWithAggregationPeriods( Map<String, Double> dataValueMap, DataQueryParams params, ListMap<IdentifiableObject, IdentifiableObject> dataPeriodAggregationPeriodMap );
+ void replaceDataPeriodsWithAggregationPeriods( Map<String, Double> dataValueMap, DataQueryParams params, ListMap<NameableObject, NameableObject> dataPeriodAggregationPeriodMap );
}
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java 2013-05-13 11:54:20 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java 2013-05-23 13:38:20 +0000
@@ -38,8 +38,8 @@
import static org.hisp.dhis.common.DimensionalObject.INDICATOR_DIM_ID;
import static org.hisp.dhis.common.DimensionalObject.ORGUNIT_DIM_ID;
import static org.hisp.dhis.common.DimensionalObject.PERIOD_DIM_ID;
-import static org.hisp.dhis.common.IdentifiableObjectUtils.asList;
-import static org.hisp.dhis.common.IdentifiableObjectUtils.getList;
+import static org.hisp.dhis.common.NameableObjectUtils.asList;
+import static org.hisp.dhis.common.NameableObjectUtils.getList;
import static org.hisp.dhis.system.util.CollectionUtils.emptyIfNull;
import java.util.ArrayList;
@@ -57,8 +57,8 @@
import org.hisp.dhis.common.CombinationGenerator;
import org.hisp.dhis.common.DimensionType;
import org.hisp.dhis.common.DimensionalObject;
-import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.common.ListMap;
+import org.hisp.dhis.common.NameableObject;
import org.hisp.dhis.dataelement.DataElementCategory;
import org.hisp.dhis.dataelement.DataElementGroupSet;
import org.hisp.dhis.dataelement.DataElementOperand;
@@ -112,7 +112,7 @@
private transient String tableName;
- private ListMap<String, IdentifiableObject> tableNamePeriodMap;
+ private ListMap<String, NameableObject> tableNamePeriodMap;
private transient String periodType;
@@ -190,7 +190,7 @@
for ( String tableName : tableNamePeriodMap.keySet() )
{
- List<IdentifiableObject> periods = tableNamePeriodMap.get( tableName );
+ List<NameableObject> periods = tableNamePeriodMap.get( tableName );
DataQueryParams params = new DataQueryParams( this );
params.setTableName( tableName );
@@ -236,7 +236,7 @@
{
if ( DATA_DIMS.contains( iter.next().getDimension() ) )
{
- iter.set( new BaseDimensionalObject( DATA_X_DIM_ID, DimensionType.DATA_X, null, DISPLAY_NAME_DATA_X, new ArrayList<IdentifiableObject>() ) );
+ iter.set( new BaseDimensionalObject( DATA_X_DIM_ID, DimensionType.DATA_X, null, DISPLAY_NAME_DATA_X, new ArrayList<NameableObject>() ) );
break dimensions;
}
}
@@ -371,8 +371,8 @@
*/
public boolean hasPeriods()
{
- List<IdentifiableObject> dimOpts = getDimensionOptions( PERIOD_DIM_ID );
- List<IdentifiableObject> filterOpts = getFilterOptions( PERIOD_DIM_ID );
+ List<NameableObject> dimOpts = getDimensionOptions( PERIOD_DIM_ID );
+ List<NameableObject> filterOpts = getFilterOptions( PERIOD_DIM_ID );
return ( dimOpts != null && !dimOpts.isEmpty() ) || ( filterOpts != null && !filterOpts.isEmpty() );
}
@@ -432,7 +432,7 @@
{
Map<String, PeriodType> map = new HashMap<String, PeriodType>();
- for ( IdentifiableObject dataSet : getDataSets() )
+ for ( NameableObject dataSet : getDataSets() )
{
DataSet ds = (DataSet) dataSet;
@@ -465,13 +465,13 @@
* Creates a mapping between the data periods, based on the data period type
* for this query, and the aggregation periods for this query.
*/
- public ListMap<IdentifiableObject, IdentifiableObject> getDataPeriodAggregationPeriodMap()
+ public ListMap<NameableObject, NameableObject> getDataPeriodAggregationPeriodMap()
{
- ListMap<IdentifiableObject, IdentifiableObject> map = new ListMap<IdentifiableObject, IdentifiableObject>();
+ ListMap<NameableObject, NameableObject> map = new ListMap<NameableObject, NameableObject>();
if ( dataPeriodType != null )
{
- for ( IdentifiableObject aggregatePeriod : getDimensionOrFilter( PERIOD_DIM_ID ) )
+ for ( NameableObject aggregatePeriod : getDimensionOrFilter( PERIOD_DIM_ID ) )
{
Period dataPeriod = dataPeriodType.createPeriod( ((Period) aggregatePeriod).getStartDate() );
@@ -488,7 +488,7 @@
* when then the data period type has lower frequency than the aggregation
* period type.
*/
- public void replaceAggregationPeriodsWithDataPeriods( ListMap<IdentifiableObject, IdentifiableObject> dataPeriodAggregationPeriodMap )
+ public void replaceAggregationPeriodsWithDataPeriods( ListMap<NameableObject, NameableObject> dataPeriodAggregationPeriodMap )
{
if ( isAggregationType( AVERAGE_INT_DISAGGREGATION ) && dataPeriodType != null )
{
@@ -496,11 +496,11 @@
if ( getPeriods() != null ) // Period is dimension
{
- setDimensionOptions( PERIOD_DIM_ID, DimensionType.PERIOD, dataPeriodType.getName(), new ArrayList<IdentifiableObject>( dataPeriodAggregationPeriodMap.keySet() ) );
+ setDimensionOptions( PERIOD_DIM_ID, DimensionType.PERIOD, dataPeriodType.getName(), new ArrayList<NameableObject>( dataPeriodAggregationPeriodMap.keySet() ) );
}
else // Period is filter
{
- setFilterOptions( PERIOD_DIM_ID, DimensionType.PERIOD, dataPeriodType.getName(), new ArrayList<IdentifiableObject>( dataPeriodAggregationPeriodMap.keySet() ) );
+ setFilterOptions( PERIOD_DIM_ID, DimensionType.PERIOD, dataPeriodType.getName(), new ArrayList<NameableObject>( dataPeriodAggregationPeriodMap.keySet() ) );
}
}
}
@@ -521,7 +521,7 @@
{
List<DimensionItem> options = new ArrayList<DimensionItem>();
- for ( IdentifiableObject option : dimension.getItems() )
+ for ( NameableObject option : dimension.getItems() )
{
options.add( new DimensionItem( dimension.getDimension(), option ) );
}
@@ -573,7 +573,7 @@
/**
* Retrieves the options for the given dimension identifier.
*/
- public List<IdentifiableObject> getDimensionOptions( String dimension )
+ public List<NameableObject> getDimensionOptions( String dimension )
{
int index = dimensions.indexOf( new BaseDimensionalObject( dimension ) );
@@ -593,7 +593,7 @@
/**
* Sets the options for the given dimension.
*/
- public DataQueryParams setDimensionOptions( String dimension, DimensionType type, String dimensionName, List<IdentifiableObject> options )
+ public DataQueryParams setDimensionOptions( String dimension, DimensionType type, String dimensionName, List<NameableObject> options )
{
int index = dimensions.indexOf( new BaseDimensionalObject( dimension ) );
@@ -612,7 +612,7 @@
/**
* Retrieves the options for the given filter.
*/
- public List<IdentifiableObject> getFilterOptions( String filter )
+ public List<NameableObject> getFilterOptions( String filter )
{
int index = filters.indexOf( new BaseDimensionalObject( filter ) );
@@ -632,7 +632,7 @@
/**
* Sets the options for the given filter.
*/
- public DataQueryParams setFilterOptions( String filter, DimensionType type, String dimensionName, List<IdentifiableObject> options )
+ public DataQueryParams setFilterOptions( String filter, DimensionType type, String dimensionName, List<NameableObject> options )
{
int index = filters.indexOf( new BaseDimensionalObject( filter ) );
@@ -651,7 +651,7 @@
/**
* Updates the options for the given filter.
*/
- public DataQueryParams updateFilterOptions( String filter, List<IdentifiableObject> options )
+ public DataQueryParams updateFilterOptions( String filter, List<NameableObject> options )
{
int index = filters.indexOf( new BaseDimensionalObject( filter ) );
@@ -900,12 +900,12 @@
this.tableName = tableName;
}
- public ListMap<String, IdentifiableObject> getTableNamePeriodMap()
+ public ListMap<String, NameableObject> getTableNamePeriodMap()
{
return tableNamePeriodMap;
}
- public void setTableNamePeriodMap( ListMap<String, IdentifiableObject> tableNamePeriodMap )
+ public void setTableNamePeriodMap( ListMap<String, NameableObject> tableNamePeriodMap )
{
this.tableNamePeriodMap = tableNamePeriodMap;
}
@@ -944,7 +944,7 @@
// Get and set helpers for dimensions or filter
// -------------------------------------------------------------------------
- public List<IdentifiableObject> getDimensionOrFilter( String key )
+ public List<NameableObject> getDimensionOrFilter( String key )
{
return getDimensionOptions( key ) != null ? getDimensionOptions( key ) : getFilterOptions( key );
}
@@ -958,52 +958,52 @@
// Get and set helpers for dimensions
// -------------------------------------------------------------------------
- public List<IdentifiableObject> getIndicators()
+ public List<NameableObject> getIndicators()
{
return getDimensionOptions( INDICATOR_DIM_ID );
}
- public void setIndicators( List<? extends IdentifiableObject> indicators )
+ public void setIndicators( List<? extends NameableObject> indicators )
{
setDimensionOptions( INDICATOR_DIM_ID, DimensionType.INDICATOR, null, asList( indicators ) );
}
- public List<IdentifiableObject> getDataElements()
+ public List<NameableObject> getDataElements()
{
return getDimensionOptions( DATAELEMENT_DIM_ID );
}
- public void setDataElements( List<? extends IdentifiableObject> dataElements )
+ public void setDataElements( List<? extends NameableObject> dataElements )
{
setDimensionOptions( DATAELEMENT_DIM_ID, DimensionType.DATAELEMENT, null, asList( dataElements ) );
}
- public List<IdentifiableObject> getDataSets()
+ public List<NameableObject> getDataSets()
{
return getDimensionOptions( DATASET_DIM_ID );
}
- public void setDataSets( List<? extends IdentifiableObject> dataSets )
+ public void setDataSets( List<? extends NameableObject> dataSets )
{
setDimensionOptions( DATASET_DIM_ID, DimensionType.DATASET, null, asList( dataSets ) );
}
- public List<IdentifiableObject> getPeriods()
+ public List<NameableObject> getPeriods()
{
return getDimensionOptions( PERIOD_DIM_ID );
}
- public void setPeriods( List<? extends IdentifiableObject> periods )
+ public void setPeriods( List<? extends NameableObject> periods )
{
setDimensionOptions( PERIOD_DIM_ID, DimensionType.PERIOD, null, asList( periods ) );
}
- public List<IdentifiableObject> getOrganisationUnits()
+ public List<NameableObject> getOrganisationUnits()
{
return getDimensionOptions( ORGUNIT_DIM_ID );
}
- public void setOrganisationUnits( List<? extends IdentifiableObject> organisationUnits )
+ public void setOrganisationUnits( List<? extends NameableObject> organisationUnits )
{
setDimensionOptions( ORGUNIT_DIM_ID, DimensionType.ORGANISATIONUNIT, null, asList( organisationUnits ) );
}
@@ -1033,49 +1033,49 @@
public void setDataElementGroupSet( DataElementGroupSet groupSet )
{
- setDimensionOptions( groupSet.getUid(), DimensionType.DATAELEMENT_GROUPSET, null, new ArrayList<IdentifiableObject>( groupSet.getDimensionItems() ) );
+ setDimensionOptions( groupSet.getUid(), DimensionType.DATAELEMENT_GROUPSET, null, new ArrayList<NameableObject>( groupSet.getItems() ) );
}
public void setOrganisationUnitGroupSet( OrganisationUnitGroupSet groupSet )
{
- setDimensionOptions( groupSet.getUid(), DimensionType.ORGANISATIONUNIT_GROUPSET, null, new ArrayList<IdentifiableObject>( groupSet.getDimensionItems() ) );
+ setDimensionOptions( groupSet.getUid(), DimensionType.ORGANISATIONUNIT_GROUPSET, null, new ArrayList<NameableObject>( groupSet.getItems() ) );
}
public void setCategory( DataElementCategory category )
{
- setDimensionOptions( category.getUid(), DimensionType.CATEGORY, null, new ArrayList<IdentifiableObject>( category.getDimensionItems() ) );
+ setDimensionOptions( category.getUid(), DimensionType.CATEGORY, null, new ArrayList<NameableObject>( category.getItems() ) );
}
public void enableCategoryOptionCombos()
{
- setDimensionOptions( CATEGORYOPTIONCOMBO_DIM_ID, DimensionType.CATEGORY_OPTION_COMBO, null, new ArrayList<IdentifiableObject>() );
+ setDimensionOptions( CATEGORYOPTIONCOMBO_DIM_ID, DimensionType.CATEGORY_OPTION_COMBO, null, new ArrayList<NameableObject>() );
}
// -------------------------------------------------------------------------
// Get and set helpers for filters
// -------------------------------------------------------------------------
- public List<IdentifiableObject> getFilterPeriods()
+ public List<NameableObject> getFilterPeriods()
{
return getFilterOptions( PERIOD_DIM_ID );
}
- public void setFilterPeriods( List<IdentifiableObject> periods )
+ public void setFilterPeriods( List<NameableObject> periods )
{
setFilterOptions( PERIOD_DIM_ID, DimensionType.PERIOD, null, periods );
}
- public List<IdentifiableObject> getFilterOrganisationUnits()
+ public List<NameableObject> getFilterOrganisationUnits()
{
return getFilterOptions( ORGUNIT_DIM_ID );
}
- public void setFilterOrganisationUnits( List<IdentifiableObject> organisationUnits )
+ public void setFilterOrganisationUnits( List<NameableObject> organisationUnits )
{
setFilterOptions( ORGUNIT_DIM_ID, DimensionType.ORGANISATIONUNIT, null, organisationUnits );
}
- public void setFilter( String filter, DimensionType type, IdentifiableObject item )
+ public void setFilter( String filter, DimensionType type, NameableObject item )
{
setFilterOptions( filter, type, null, getList( item ) );
}
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DimensionItem.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DimensionItem.java 2013-05-07 08:37:33 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DimensionItem.java 2013-05-23 13:38:20 +0000
@@ -31,7 +31,7 @@
import java.util.List;
import org.hisp.dhis.common.DimensionalObject;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.NameableObject;
import org.hisp.dhis.system.util.CollectionUtils;
/**
@@ -41,13 +41,13 @@
{
private String dimension;
- private IdentifiableObject item;
+ private NameableObject item;
// -------------------------------------------------------------------------
// Constructor
// -------------------------------------------------------------------------
- public DimensionItem( String dimension, IdentifiableObject item )
+ public DimensionItem( String dimension, NameableObject item )
{
this.dimension = dimension;
this.item = item;
@@ -67,12 +67,12 @@
this.dimension = dimension;
}
- public IdentifiableObject getItem()
+ public NameableObject getItem()
{
return item;
}
- public void setItem( IdentifiableObject item )
+ public void setItem( NameableObject item )
{
this.item = item;
}
@@ -127,7 +127,7 @@
* dimension items. If no items are given, items are null or there are
* no period dimension, null is returned.
*/
- public static IdentifiableObject getPeriodItem( List<DimensionItem> items )
+ public static NameableObject getPeriodItem( List<DimensionItem> items )
{
if ( items != null && !items.isEmpty() )
{
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java 2013-05-23 12:01:15 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java 2013-05-23 13:38:20 +0000
@@ -46,8 +46,8 @@
import static org.hisp.dhis.common.DimensionalObject.ORGUNIT_DIM_ID;
import static org.hisp.dhis.common.DimensionalObject.PERIOD_DIM_ID;
import static org.hisp.dhis.common.DimensionalObjectUtils.toDimension;
-import static org.hisp.dhis.common.IdentifiableObjectUtils.asList;
-import static org.hisp.dhis.common.IdentifiableObjectUtils.asTypedList;
+import static org.hisp.dhis.common.NameableObjectUtils.asList;
+import static org.hisp.dhis.common.NameableObjectUtils.asTypedList;
import static org.hisp.dhis.common.IdentifiableObjectUtils.getUids;
import static org.hisp.dhis.organisationunit.OrganisationUnit.KEY_USER_ORGUNIT;
import static org.hisp.dhis.organisationunit.OrganisationUnit.KEY_USER_ORGUNIT_CHILDREN;
@@ -81,6 +81,7 @@
import org.hisp.dhis.common.Grid;
import org.hisp.dhis.common.GridHeader;
import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.NameableObject;
import org.hisp.dhis.constant.ConstantService;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategory;
@@ -104,7 +105,6 @@
import org.hisp.dhis.period.RelativePeriodEnum;
import org.hisp.dhis.period.RelativePeriods;
import org.hisp.dhis.period.comparator.AscendingPeriodComparator;
-import org.hisp.dhis.reporttable.ReportTable;
import org.hisp.dhis.system.grid.ListGrid;
import org.hisp.dhis.system.util.ConversionUtils;
import org.hisp.dhis.system.util.DebugUtils;
@@ -170,7 +170,7 @@
// -------------------------------------------------------------------------
@Override
- public Grid getAggregatedDataValues( DataQueryParams params )
+ public Grid getAggregatedDataValues( DataQueryParams params )
{
queryPlanner.validate( params );
@@ -582,9 +582,9 @@
{
List<DimensionalObject> dataDimensions = new ArrayList<DimensionalObject>();
- List<IdentifiableObject> indicators = new ArrayList<IdentifiableObject>();
- List<IdentifiableObject> dataElements = new ArrayList<IdentifiableObject>();
- List<IdentifiableObject> dataSets = new ArrayList<IdentifiableObject>();
+ List<NameableObject> indicators = new ArrayList<NameableObject>();
+ List<NameableObject> dataElements = new ArrayList<NameableObject>();
+ List<NameableObject> dataSets = new ArrayList<NameableObject>();
options : for ( String uid : items )
{
@@ -640,7 +640,7 @@
if ( CATEGORYOPTIONCOMBO_DIM_ID.equals( dimension ) )
{
- DimensionalObject object = new BaseDimensionalObject( dimension, DimensionType.CATEGORY_OPTION_COMBO, null, DISPLAY_NAME_CATEGORYOPTIONCOMBO, new ArrayList<IdentifiableObject>() );
+ DimensionalObject object = new BaseDimensionalObject( dimension, DimensionType.CATEGORY_OPTION_COMBO, null, DISPLAY_NAME_CATEGORYOPTIONCOMBO, new ArrayList<NameableObject>() );
return Arrays.asList( object );
}
@@ -689,7 +689,7 @@
{
User user = currentUserService.getCurrentUser();
- List<IdentifiableObject> ous = new ArrayList<IdentifiableObject>();
+ List<NameableObject> ous = new ArrayList<NameableObject>();
for ( String ou : items )
{
@@ -726,7 +726,7 @@
if ( ougs != null )
{
- List<IdentifiableObject> ous = asList( organisationUnitGroupService.getOrganisationUnitGroupsByUid( items ) );
+ List<NameableObject> ous = asList( organisationUnitGroupService.getOrganisationUnitGroupsByUid( items ) );
DimensionalObject object = new BaseDimensionalObject( dimension, DimensionType.ORGANISATIONUNIT_GROUPSET, null, ougs.getDisplayName(), ous );
@@ -737,7 +737,7 @@
if ( degs != null )
{
- List<IdentifiableObject> des = asList( dataElementService.getDataElementGroupsByUid( items ) );
+ List<NameableObject> des = asList( dataElementService.getDataElementGroupsByUid( items ) );
DimensionalObject object = new BaseDimensionalObject( dimension, DimensionType.DATAELEMENT_GROUPSET, null, degs.getDisplayName(), des );
@@ -748,7 +748,7 @@
if ( dec != null && dec.isDataDimension() )
{
- List<IdentifiableObject> decos = asList( categoryService.getDataElementCategoriesByUid( items ) );
+ List<NameableObject> decos = asList( categoryService.getDataElementCategoriesByUid( items ) );
DimensionalObject object = new BaseDimensionalObject( dimension, DimensionType.CATEGORY, null, dec.getDisplayName(), decos );
@@ -761,7 +761,7 @@
private DataQueryParams replaceIndicatorsWithDataElements( DataQueryParams params, int indicatorIndex )
{
List<Indicator> indicators = asTypedList( params.getIndicators() );
- List<IdentifiableObject> dataElements = asList( expressionService.getDataElementsInIndicators( indicators ) );
+ List<NameableObject> dataElements = asList( expressionService.getDataElementsInIndicators( indicators ) );
params.getDimensions().set( indicatorIndex, new BaseDimensionalObject( DATAELEMENT_DIM_ID, DimensionType.DATAELEMENT, dataElements ) );
params.enableCategoryOptionCombos();
@@ -785,7 +785,7 @@
for ( DimensionalObject dimension : dimensions )
{
- List<IdentifiableObject> options = new ArrayList<IdentifiableObject>( dimension.getItems() );
+ List<NameableObject> options = new ArrayList<NameableObject>( dimension.getItems() );
// -----------------------------------------------------------------
// If dimension is not fixed and has no options, insert all options
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultQueryPlanner.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultQueryPlanner.java 2013-05-13 11:54:20 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultQueryPlanner.java 2013-05-23 13:38:20 +0000
@@ -52,8 +52,8 @@
import org.hisp.dhis.analytics.table.PartitionUtils;
import org.hisp.dhis.common.BaseDimensionalObject;
import org.hisp.dhis.common.DimensionalObject;
-import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.common.ListMap;
+import org.hisp.dhis.common.NameableObject;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementGroup;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -251,7 +251,7 @@
{
DimensionalObject dim = query.getDimension( dimension );
- List<IdentifiableObject> values = null;
+ List<NameableObject> values = null;
if ( dim == null || ( values = dim.getItems() ) == null || values.isEmpty() )
{
@@ -259,9 +259,9 @@
continue;
}
- List<List<IdentifiableObject>> valuePages = new PaginatedList<IdentifiableObject>( values ).setNumberOfPages( optimalForSubQuery ).getPages();
+ List<List<NameableObject>> valuePages = new PaginatedList<NameableObject>( values ).setNumberOfPages( optimalForSubQuery ).getPages();
- for ( List<IdentifiableObject> valuePage : valuePages )
+ for ( List<NameableObject> valuePage : valuePages )
{
DataQueryParams subQuery = new DataQueryParams( query );
subQuery.setDimensionOptions( dim.getDimension(), dim.getType(), dim.getDimensionName(), valuePage );
@@ -293,7 +293,7 @@
}
else if ( params.getPeriods() != null && !params.getPeriods().isEmpty() )
{
- ListMap<String, IdentifiableObject> tableNamePeriodMap = PartitionUtils.getTableNamePeriodMap( params.getPeriods(), tableName );
+ ListMap<String, NameableObject> tableNamePeriodMap = PartitionUtils.getTableNamePeriodMap( params.getPeriods(), tableName );
for ( String table : tableNamePeriodMap.keySet() )
{
@@ -305,7 +305,7 @@
}
else if ( params.getFilterPeriods() != null && !params.getFilterPeriods().isEmpty() )
{
- ListMap<String, IdentifiableObject> tableNamePeriodMap = PartitionUtils.getTableNamePeriodMap( params.getFilterPeriods(), tableName );
+ ListMap<String, NameableObject> tableNamePeriodMap = PartitionUtils.getTableNamePeriodMap( params.getFilterPeriods(), tableName );
DataQueryParams query = new DataQueryParams( params );
query.setTableNamePeriodMap( tableNamePeriodMap );
@@ -337,7 +337,7 @@
}
else if ( params.getPeriods() != null && !params.getPeriods().isEmpty() )
{
- ListMap<String, IdentifiableObject> periodTypePeriodMap = getPeriodTypePeriodMap( params.getPeriods() );
+ ListMap<String, NameableObject> periodTypePeriodMap = getPeriodTypePeriodMap( params.getPeriods() );
for ( String periodType : periodTypePeriodMap.keySet() )
{
@@ -351,7 +351,7 @@
{
DimensionalObject filter = params.getFilter( PERIOD_DIM_ID );
- ListMap<String, IdentifiableObject> periodTypePeriodMap = getPeriodTypePeriodMap( filter.getItems() );
+ ListMap<String, NameableObject> periodTypePeriodMap = getPeriodTypePeriodMap( filter.getItems() );
params.removeFilter( PERIOD_DIM_ID ).setPeriodType( periodTypePeriodMap.keySet().iterator().next() ); // Using first period type
@@ -383,7 +383,7 @@
if ( params.getOrganisationUnits() != null && !params.getOrganisationUnits().isEmpty() )
{
- ListMap<Integer, IdentifiableObject> levelOrgUnitMap = getLevelOrgUnitMap( params.getOrganisationUnits() );
+ ListMap<Integer, NameableObject> levelOrgUnitMap = getLevelOrgUnitMap( params.getOrganisationUnits() );
for ( Integer level : levelOrgUnitMap.keySet() )
{
@@ -396,7 +396,7 @@
{
DimensionalObject filter = params.getFilter( ORGUNIT_DIM_ID );
- ListMap<Integer, IdentifiableObject> levelOrgUnitMap = getLevelOrgUnitMap( params.getFilterOrganisationUnits() );
+ ListMap<Integer, NameableObject> levelOrgUnitMap = getLevelOrgUnitMap( params.getFilterOrganisationUnits() );
params.removeFilter( ORGUNIT_DIM_ID );
@@ -450,7 +450,7 @@
{
PeriodType periodType = PeriodType.getPeriodTypeByName( params.getPeriodType() );
- ListMap<AggregationType, IdentifiableObject> aggregationTypeDataElementMap = getAggregationTypeDataElementMap( params.getDataElements(), periodType );
+ ListMap<AggregationType, NameableObject> aggregationTypeDataElementMap = getAggregationTypeDataElementMap( params.getDataElements(), periodType );
for ( AggregationType aggregationType : aggregationTypeDataElementMap.keySet() )
{
@@ -503,7 +503,7 @@
return queries;
}
- ListMap<PeriodType, IdentifiableObject> periodTypeDataElementMap = getPeriodTypeDataElementMap( params.getDataElements() );
+ ListMap<PeriodType, NameableObject> periodTypeDataElementMap = getPeriodTypeDataElementMap( params.getDataElements() );
for ( PeriodType periodType : periodTypeDataElementMap.keySet() )
{
@@ -523,11 +523,11 @@
/**
* Creates a mapping between period type name and period for the given periods.
*/
- private ListMap<String, IdentifiableObject> getPeriodTypePeriodMap( Collection<IdentifiableObject> periods )
+ private ListMap<String, NameableObject> getPeriodTypePeriodMap( Collection<NameableObject> periods )
{
- ListMap<String, IdentifiableObject> map = new ListMap<String, IdentifiableObject>();
+ ListMap<String, NameableObject> map = new ListMap<String, NameableObject>();
- for ( IdentifiableObject period : periods )
+ for ( NameableObject period : periods )
{
String periodTypeName = ((Period) period).getPeriodType().getName();
@@ -541,11 +541,11 @@
* Creates a mapping between level and organisation unit for the given organisation
* units.
*/
- private ListMap<Integer, IdentifiableObject> getLevelOrgUnitMap( Collection<IdentifiableObject> orgUnits )
+ private ListMap<Integer, NameableObject> getLevelOrgUnitMap( Collection<NameableObject> orgUnits )
{
- ListMap<Integer, IdentifiableObject> map = new ListMap<Integer, IdentifiableObject>();
+ ListMap<Integer, NameableObject> map = new ListMap<Integer, NameableObject>();
- for ( IdentifiableObject orgUnit : orgUnits )
+ for ( NameableObject orgUnit : orgUnits )
{
int level = organisationUnitService.getLevelOfOrganisationUnit( ((OrganisationUnit) orgUnit).getUid() );
@@ -559,11 +559,11 @@
* Creates a mapping between the aggregation type and data element for the
* given data elements and period type.
*/
- private ListMap<AggregationType, IdentifiableObject> getAggregationTypeDataElementMap( Collection<IdentifiableObject> dataElements, PeriodType aggregationPeriodType )
+ private ListMap<AggregationType, NameableObject> getAggregationTypeDataElementMap( Collection<NameableObject> dataElements, PeriodType aggregationPeriodType )
{
- ListMap<AggregationType, IdentifiableObject> map = new ListMap<AggregationType, IdentifiableObject>();
+ ListMap<AggregationType, NameableObject> map = new ListMap<AggregationType, NameableObject>();
- for ( IdentifiableObject element : dataElements )
+ for ( NameableObject element : dataElements )
{
DataElement de = (DataElement) element;
@@ -614,11 +614,11 @@
* Creates a mapping between the period type and the data element for the
* given data elements.
*/
- private ListMap<PeriodType, IdentifiableObject> getPeriodTypeDataElementMap( Collection<IdentifiableObject> dataElements )
+ private ListMap<PeriodType, NameableObject> getPeriodTypeDataElementMap( Collection<NameableObject> dataElements )
{
- ListMap<PeriodType, IdentifiableObject> map = new ListMap<PeriodType, IdentifiableObject>();
+ ListMap<PeriodType, NameableObject> map = new ListMap<PeriodType, NameableObject>();
- for ( IdentifiableObject element : dataElements )
+ for ( NameableObject element : dataElements )
{
DataElement dataElement = (DataElement) element;
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/JdbcAnalyticsManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/JdbcAnalyticsManager.java 2013-05-13 14:21:55 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/JdbcAnalyticsManager.java 2013-05-23 13:38:20 +0000
@@ -56,8 +56,8 @@
import org.hisp.dhis.analytics.DataQueryParams;
import org.hisp.dhis.analytics.MeasureFilter;
import org.hisp.dhis.common.DimensionalObject;
-import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.common.ListMap;
+import org.hisp.dhis.common.NameableObject;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.system.util.MathUtils;
@@ -96,7 +96,7 @@
@Async
public Future<Map<String, Double>> getAggregatedDataValues( DataQueryParams params )
{
- ListMap<IdentifiableObject, IdentifiableObject> dataPeriodAggregationPeriodMap = params.getDataPeriodAggregationPeriodMap();
+ ListMap<NameableObject, NameableObject> dataPeriodAggregationPeriodMap = params.getDataPeriodAggregationPeriodMap();
params.replaceAggregationPeriodsWithDataPeriods( dataPeriodAggregationPeriodMap );
@@ -133,7 +133,7 @@
return new AsyncResult<Map<String, Double>>( map );
}
- public void replaceDataPeriodsWithAggregationPeriods( Map<String, Double> dataValueMap, DataQueryParams params, ListMap<IdentifiableObject, IdentifiableObject> dataPeriodAggregationPeriodMap )
+ public void replaceDataPeriodsWithAggregationPeriods( Map<String, Double> dataValueMap, DataQueryParams params, ListMap<NameableObject, NameableObject> dataPeriodAggregationPeriodMap )
{
if ( params.isAggregationType( AVERAGE_INT_DISAGGREGATION ) )
{
@@ -152,13 +152,13 @@
Assert.notNull( keyArray[periodIndex], keyArray.toString() );
- List<IdentifiableObject> periods = dataPeriodAggregationPeriodMap.get( PeriodType.getPeriodFromIsoString( keyArray[periodIndex] ) );
+ List<NameableObject> periods = dataPeriodAggregationPeriodMap.get( PeriodType.getPeriodFromIsoString( keyArray[periodIndex] ) );
Assert.notNull( periods, dataPeriodAggregationPeriodMap.toString() );
Double value = dataValueMap.get( key );
- for ( IdentifiableObject period : periods )
+ for ( NameableObject period : periods )
{
String[] keyCopy = keyArray.clone();
keyCopy[periodIndex] = ((Period) period).getIsoDate();
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/PartitionUtils.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/PartitionUtils.java 2013-05-07 08:37:33 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/PartitionUtils.java 2013-05-23 13:38:20 +0000
@@ -33,8 +33,8 @@
import java.util.List;
import org.hisp.dhis.analytics.AnalyticsTableManager;
-import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.common.ListMap;
+import org.hisp.dhis.common.NameableObject;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.period.YearlyPeriodType;
@@ -96,11 +96,11 @@
return PeriodType.getPeriodFromIsoString( isoPeriod );
}
- public static ListMap<String, IdentifiableObject> getTableNamePeriodMap( List<IdentifiableObject> periods, String tableName )
+ public static ListMap<String, NameableObject> getTableNamePeriodMap( List<NameableObject> periods, String tableName )
{
- ListMap<String, IdentifiableObject> map = new ListMap<String, IdentifiableObject>();
+ ListMap<String, NameableObject> map = new ListMap<String, NameableObject>();
- for ( IdentifiableObject period : periods )
+ for ( NameableObject period : periods )
{
map.putValue( getTableName( (Period) period, tableName ), period );
}
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/DataQueryParamsTest.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/DataQueryParamsTest.java 2013-05-13 11:54:20 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/DataQueryParamsTest.java 2013-05-23 13:38:20 +0000
@@ -41,7 +41,7 @@
import org.hisp.dhis.common.BaseDimensionalObject;
import org.hisp.dhis.common.DimensionType;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.NameableObject;
import org.hisp.dhis.period.Period;
import org.junit.Test;
@@ -81,7 +81,7 @@
assertFalse( params.hasPeriods() );
- List<IdentifiableObject> periods = new ArrayList<IdentifiableObject>();
+ List<NameableObject> periods = new ArrayList<NameableObject>();
params.getDimensions().add( new BaseDimensionalObject( PERIOD_DIM_ID, DimensionType.PERIOD, periods ) );
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/AnalyticsManagerTest.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/AnalyticsManagerTest.java 2013-05-07 08:37:33 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/AnalyticsManagerTest.java 2013-05-23 13:38:20 +0000
@@ -27,7 +27,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.common.IdentifiableObjectUtils.getList;
+import static org.hisp.dhis.common.NameableObjectUtils.getList;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -38,10 +38,10 @@
import org.hisp.dhis.analytics.AggregationType;
import org.hisp.dhis.analytics.AnalyticsManager;
import org.hisp.dhis.analytics.DataQueryParams;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.ListMap;
+import org.hisp.dhis.common.NameableObject;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.YearlyPeriodType;
-import org.hisp.dhis.common.ListMap;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
@@ -70,7 +70,7 @@
dataValueMap.put( BASE_UID + "A-2012-" + BASE_UID + "A", 1d );
dataValueMap.put( BASE_UID + "B-2012-" + BASE_UID + "A", 1d );
- ListMap<IdentifiableObject, IdentifiableObject> dataPeriodAggregationPeriodMap = new ListMap<IdentifiableObject, IdentifiableObject>();
+ ListMap<NameableObject, NameableObject> dataPeriodAggregationPeriodMap = new ListMap<NameableObject, NameableObject>();
dataPeriodAggregationPeriodMap.putValue( y2012, createPeriod( "2012Q1" ) );
dataPeriodAggregationPeriodMap.putValue( y2012, createPeriod( "2012Q2" ) );
dataPeriodAggregationPeriodMap.putValue( y2012, createPeriod( "2012Q3" ) );
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/QueryPlannerTest.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/QueryPlannerTest.java 2013-05-13 11:54:20 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/QueryPlannerTest.java 2013-05-23 13:38:20 +0000
@@ -32,7 +32,7 @@
import static org.hisp.dhis.common.DimensionalObject.DATA_X_DIM_ID;
import static org.hisp.dhis.common.DimensionalObject.ORGUNIT_DIM_ID;
import static org.hisp.dhis.common.DimensionalObject.PERIOD_DIM_ID;
-import static org.hisp.dhis.common.IdentifiableObjectUtils.getList;
+import static org.hisp.dhis.common.NameableObjectUtils.getList;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -50,8 +50,8 @@
import org.hisp.dhis.analytics.QueryPlanner;
import org.hisp.dhis.common.BaseDimensionalObject;
import org.hisp.dhis.common.DimensionalObject;
-import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.common.ListMap;
+import org.hisp.dhis.common.NameableObject;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.dataelement.DataElementCategoryService;
@@ -207,11 +207,11 @@
@Test
public void testSetGetCopy()
{
- List<IdentifiableObject> desA = getList( deA, deB );
- List<IdentifiableObject> ousA = getList( ouA, ouB );
- List<IdentifiableObject> ousB = getList( ouC, ouD );
- List<IdentifiableObject> pesA = getList( createPeriod( "2000Q1" ), createPeriod( "2000Q2" ) );
- List<IdentifiableObject> pesB = getList( createPeriod( "200001" ), createPeriod( "200002" ) );
+ List<NameableObject> desA = getList( deA, deB );
+ List<NameableObject> ousA = getList( ouA, ouB );
+ List<NameableObject> ousB = getList( ouC, ouD );
+ List<NameableObject> pesA = getList( createPeriod( "2000Q1" ), createPeriod( "2000Q2" ) );
+ List<NameableObject> pesB = getList( createPeriod( "200001" ), createPeriod( "200002" ) );
DataQueryParams paramsA = new DataQueryParams();
paramsA.setDataElements( desA );
@@ -353,7 +353,7 @@
params.setPeriodType( QuarterlyPeriodType.NAME );
params.setDataPeriodType( new YearlyPeriodType() );
- ListMap<IdentifiableObject, IdentifiableObject> map = params.getDataPeriodAggregationPeriodMap();
+ ListMap<NameableObject, NameableObject> map = params.getDataPeriodAggregationPeriodMap();
assertEquals( 2, map.size() );
@@ -637,9 +637,9 @@
// Supportive methods
// -------------------------------------------------------------------------
- private static boolean samePeriodType( List<IdentifiableObject> isoPeriods )
+ private static boolean samePeriodType( List<NameableObject> isoPeriods )
{
- Iterator<IdentifiableObject> periods = new ArrayList<IdentifiableObject>( isoPeriods ).iterator();
+ Iterator<NameableObject> periods = new ArrayList<NameableObject>( isoPeriods ).iterator();
PeriodType first = ((Period) periods.next()).getPeriodType();
@@ -656,9 +656,9 @@
return true;
}
- private static boolean samePartition( List<IdentifiableObject> isoPeriods )
+ private static boolean samePartition( List<NameableObject> isoPeriods )
{
- Iterator<IdentifiableObject> periods = new ArrayList<IdentifiableObject>( isoPeriods ).iterator();
+ Iterator<NameableObject> periods = new ArrayList<NameableObject>( isoPeriods ).iterator();
int year = new Cal().set( ((Period) periods.next()).getStartDate() ).getYear();
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/table/PartitionUtilsTest.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/table/PartitionUtilsTest.java 2013-05-07 08:37:33 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/table/PartitionUtilsTest.java 2013-05-23 13:38:20 +0000
@@ -28,19 +28,20 @@
*/
import static org.hisp.dhis.DhisConvenienceTest.createPeriod;
-import static org.hisp.dhis.analytics.AnalyticsTableManager.*;
-import static org.hisp.dhis.common.IdentifiableObjectUtils.getList;
+import static org.hisp.dhis.analytics.AnalyticsTableManager.ANALYTICS_TABLE_NAME;
+import static org.hisp.dhis.analytics.AnalyticsTableManager.TABLE_TEMP_SUFFIX;
+import static org.hisp.dhis.common.NameableObjectUtils.getList;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.Date;
import java.util.List;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.ListMap;
+import org.hisp.dhis.common.NameableObject;
import org.hisp.dhis.period.Cal;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.YearlyPeriodType;
-import org.hisp.dhis.common.ListMap;
import org.junit.Test;
/**
@@ -91,7 +92,7 @@
@Test
public void testGetTablePeriodMap()
{
- ListMap<String, IdentifiableObject> map = PartitionUtils.getTableNamePeriodMap( getList(
+ ListMap<String, NameableObject> map = PartitionUtils.getTableNamePeriodMap( getList(
createPeriod( "2000S1" ), createPeriod( "2000S2" ), createPeriod( "2001S1" ), createPeriod( "2001S2" ), createPeriod( "2002S1" ) ), TABLE_NAME );
assertEquals( 3, map.size() );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultDimensionService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultDimensionService.java 2013-05-23 10:55:23 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultDimensionService.java 2013-05-23 13:38:20 +0000
@@ -225,7 +225,7 @@
String dimensionId = dimension.getDimension();
- List<IdentifiableObject> items = dimension.getItems();
+ List<NameableObject> items = dimension.getItems();
if ( items != null )
{
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/jdbc/AnalyticsDataSetReportStore.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/jdbc/AnalyticsDataSetReportStore.java 2013-05-13 14:45:19 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/jdbc/AnalyticsDataSetReportStore.java 2013-05-23 13:38:20 +0000
@@ -27,7 +27,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.common.IdentifiableObjectUtils.getList;
+import static org.hisp.dhis.common.NameableObjectUtils.getList;
import java.util.ArrayList;
import java.util.HashMap;