dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #11426
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3251: Restructuring identifiableobject while thinking about what to do about ids.
------------------------------------------------------------
revno: 3251
committer: Jo Størset <storset@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-04-01 11:57:53 +0200
message:
Restructuring identifiableobject while thinking about what to do about ids.
added:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AbstractIdentifiableObject.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AbstractNameableObject.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/NameableObject.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObject.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/ImportableObject.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/comparator/IdentifiableObjectNameComparator.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/concept/Concept.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/datadictionary/DataDictionary.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/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/dataset/DataSet.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/indicator/IndicatorType.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/olap/OlapURL.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/organisationunit/OrganisationUnitLevel.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientMobileSetting.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/pivottable/PivotTable.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/Report.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-api/src/main/java/org/hisp/dhis/validation/ValidationRule.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleGroup.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/LinkBuilder.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/LinkBuilderImpl.java
dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/displayproperty/DefaultDisplayPropertyHandler.java
dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/displayproperty/DisplayPropertyHandler.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/pivottable/impl/DefaultPivotTableService.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/test/java/org/hisp/dhis/reporttable/ReportTableTest.java
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/GridUtils.java
local/in/dhis-in-api/src/main/java/org/hisp/dhis/linelisting/LineListElement.java
local/in/dhis-in-api/src/main/java/org/hisp/dhis/linelisting/LineListElementOptions.java
local/in/dhis-in-api/src/main/java/org/hisp/dhis/linelisting/LineListOption.java
local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/ExportSurveyDataToExcelAction.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
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AbstractIdentifiableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AbstractIdentifiableObject.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AbstractIdentifiableObject.java 2011-04-01 09:57:53 +0000
@@ -0,0 +1,106 @@
+package org.hisp.dhis.common;
+
+/*
+ * 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 Bob Jolliffe
+ * @version $Id$
+ */
+public abstract class AbstractIdentifiableObject
+ implements IdentifiableObject
+{
+ /**
+ * The database internal identifier for this Object.
+ */
+ protected int id;
+
+ /**
+ * The Universally Unique Identifer for this Object.
+ */
+ protected String uuid;
+
+ /**
+ * The name of this Object. Required and unique.
+ */
+ protected String name;
+
+ public AbstractIdentifiableObject()
+ {
+ }
+
+ public AbstractIdentifiableObject( int id, String uuid, String name )
+ {
+ this.id = id;
+ this.uuid = uuid;
+ this.name = name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hisp.dhis.common.IdentifiableObject#getId()
+ */
+ @Override
+ public int getId()
+ {
+ return id;
+ }
+
+ public void setId( int id )
+ {
+ this.id = id;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hisp.dhis.common.IdentifiableObject#getUuid()
+ */
+ @Override
+ public String getUuid()
+ {
+ return uuid;
+ }
+
+ public void setUuid( String uuid )
+ {
+ this.uuid = uuid;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hisp.dhis.common.IdentifiableObject#getName()
+ */
+ @Override
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AbstractNameableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AbstractNameableObject.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AbstractNameableObject.java 2011-04-01 09:57:53 +0000
@@ -0,0 +1,81 @@
+package org.hisp.dhis.common;
+
+public class AbstractNameableObject
+ extends AbstractIdentifiableObject implements NameableObject
+{
+
+ /**
+ * An alternative name of this Object. Optional but unique.
+ */
+ protected String alternativeName;
+
+ /**
+ * An short name representing this Object. Optional but unique.
+ */
+ protected String shortName;
+
+ /**
+ * An code representing this Object. Optional but unique.
+ */
+ protected String code;
+
+ /**
+ * Description of this Object.
+ */
+ protected String description;
+
+ public AbstractNameableObject()
+ {
+ }
+
+ public AbstractNameableObject( int id, String uuid, String name, String alternativeName, String shortName,
+ String code, String description )
+ {
+ super( id, uuid, name );
+ this.alternativeName = alternativeName;
+ this.shortName = shortName;
+ this.code = code;
+ this.description = description;
+ }
+
+ public String getAlternativeName()
+ {
+ return alternativeName;
+ }
+
+ public void setAlternativeName( String alternativeName )
+ {
+ this.alternativeName = alternativeName;
+ }
+
+ public String getShortName()
+ {
+ return shortName;
+ }
+
+ public void setShortName( String shortName )
+ {
+ this.shortName = shortName;
+ }
+
+ public String getCode()
+ {
+ return code;
+ }
+
+ public void setCode( String code )
+ {
+ this.code = code;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription( String description )
+ {
+ this.description = description;
+ }
+
+}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObject.java 2010-05-12 13:38:28 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObject.java 2011-04-01 09:57:53 +0000
@@ -1,147 +1,13 @@
-package org.hisp.dhis.common;
-
-/*
- * 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.io.Serializable;
-
-/**
- * @author Bob Jolliffe
- * @version $Id$
- */
-public abstract class IdentifiableObject
- implements ImportableObject, Serializable
-{
- /**
- * The database internal identifier for this Object.
- */
- protected int id;
-
- /**
- * The Universally Unique Identifer for this Object.
- */
- protected String uuid;
-
- /**
- * The name of this Object. Required and unique.
- */
- protected String name;
-
- /**
- * An alternative name of this Object. Optional but unique.
- */
- protected String alternativeName;
-
- /**
- * An short name representing this Object. Optional but unique.
- */
- protected String shortName;
-
- /**
- * An code representing this Object. Optional but unique.
- */
- protected String code;
-
- /**
- * Description of this Object.
- */
- protected String description;
-
- // -------------------------------------------------------------------------
- // Getters and setters
- // -------------------------------------------------------------------------
-
- public int getId()
- {
- return id;
- }
-
- public void setId( int id )
- {
- this.id = id;
- }
-
- public String getUuid()
- {
- return uuid;
- }
-
- public void setUuid( String uuid )
- {
- this.uuid = uuid;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName( String name )
- {
- this.name = name;
- }
-
- public String getAlternativeName()
- {
- return alternativeName;
- }
-
- public void setAlternativeName( String alternativeName )
- {
- this.alternativeName = alternativeName;
- }
-
- public String getShortName()
- {
- return shortName;
- }
-
- public void setShortName( String shortName )
- {
- this.shortName = shortName;
- }
-
- public String getCode()
- {
- return code;
- }
-
- public void setCode( String code )
- {
- this.code = code;
- }
-
- public String getDescription()
- {
- return description;
- }
-
- public void setDescription( String description )
- {
- this.description = description;
- }
-}
+package org.hisp.dhis.common;
+
+public interface IdentifiableObject
+ extends ImportableObject
+{
+
+ public abstract int getId();
+
+ public abstract String getUuid();
+
+ public abstract String getName();
+
+}
\ No newline at end of file
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/ImportableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/ImportableObject.java 2010-05-12 13:50:43 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/ImportableObject.java 2011-04-01 09:57:53 +0000
@@ -1,5 +1,7 @@
package org.hisp.dhis.common;
+import java.io.Serializable;
+
/*
* Copyright (c) 2004-2010, University of Oslo
* All rights reserved.
@@ -32,6 +34,7 @@
* @version $Id$
*/
public interface ImportableObject
+ extends Serializable
{
String getName();
}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/NameableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/NameableObject.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/NameableObject.java 2011-04-01 09:57:53 +0000
@@ -0,0 +1,39 @@
+package org.hisp.dhis.common;
+
+/*
+ * Copyright (c) 2011, 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.
+ */
+
+public interface NameableObject extends IdentifiableObject
+{
+ public String getAlternativeName();
+
+ public String getShortName();
+
+ public String getCode();
+
+ public String getDescription();
+}
\ No newline at end of file
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/comparator/IdentifiableObjectNameComparator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/comparator/IdentifiableObjectNameComparator.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/comparator/IdentifiableObjectNameComparator.java 2011-04-01 09:57:53 +0000
@@ -29,15 +29,15 @@
import java.util.Comparator;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractIdentifiableObject;
/**
* @author Lars Helge Overland
*/
public class IdentifiableObjectNameComparator
- implements Comparator<IdentifiableObject>
+ implements Comparator<AbstractIdentifiableObject>
{
- public int compare( IdentifiableObject object0, IdentifiableObject object1 )
+ public int compare( AbstractIdentifiableObject object0, AbstractIdentifiableObject object1 )
{
return object0.getName().compareToIgnoreCase( object1.getName() );
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/concept/Concept.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/concept/Concept.java 2010-11-30 06:49:21 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/concept/Concept.java 2011-04-01 09:57:53 +0000
@@ -27,7 +27,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractIdentifiableObject;
/**
* A Concept Name is a short name which is used as an attribute name
@@ -40,7 +40,7 @@
* @version $Id Concept.java Aug 25, 2010$
*/
public class Concept
- extends IdentifiableObject
+ extends AbstractIdentifiableObject
{
public static String DEFAULT_CONCEPT_NAME = "default";
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/datadictionary/DataDictionary.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datadictionary/DataDictionary.java 2010-05-12 12:01:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datadictionary/DataDictionary.java 2011-04-01 09:57:53 +0000
@@ -30,7 +30,7 @@
import java.util.HashSet;
import java.util.Set;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractIdentifiableObject;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.indicator.Indicator;
@@ -39,7 +39,7 @@
* @version $Id$
*/
public class DataDictionary
- extends IdentifiableObject
+ extends AbstractIdentifiableObject
{
private String description;
=== 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-02-24 21:01:47 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2011-04-01 09:57:53 +0000
@@ -35,7 +35,7 @@
import java.util.Set;
import org.apache.commons.lang.StringEscapeUtils;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractNameableObject;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.period.YearlyPeriodType;
@@ -57,7 +57,7 @@
* @version $Id: DataElement.java 5540 2008-08-19 10:47:07Z larshelg $
*/
public class DataElement
- extends IdentifiableObject
+ extends AbstractNameableObject
{
public static final String VALUE_TYPE_STRING = "string";
=== 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 2011-01-31 19:47:04 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java 2011-04-01 09:57:53 +0000
@@ -30,7 +30,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractIdentifiableObject;
import org.hisp.dhis.concept.Concept;
/**
@@ -43,7 +43,7 @@
* @version $Id DataElementCategory.java Aug 25, 2010 duyhieu$
*/
public class DataElementCategory
- extends IdentifiableObject
+ extends AbstractIdentifiableObject
{
public static final String DEFAULT_NAME = "default";
=== 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 2011-03-16 20:50:40 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java 2011-04-01 09:57:53 +0000
@@ -32,14 +32,14 @@
import java.util.List;
import java.util.Set;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractIdentifiableObject;
/**
* @author Abyot Aselefew
* @version $Id$
*/
public class DataElementCategoryCombo
- extends IdentifiableObject
+ extends AbstractIdentifiableObject
{
public static final String DEFAULT_CATEGORY_COMBO_NAME = "default";
=== 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 2011-03-20 09:29:59 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java 2011-04-01 09:57:53 +0000
@@ -30,21 +30,21 @@
import java.util.HashSet;
import java.util.Set;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractNameableObject;
/**
* @author Abyot Asalefew
* @version $Id$
*/
public class DataElementCategoryOption
- extends IdentifiableObject
+ extends AbstractNameableObject
{
public static final String DEFAULT_NAME = "default";
-
+
private DataElementCategory category;
-
+
private Set<DataElementCategoryOptionCombo> categoryOptionCombos = new HashSet<DataElementCategoryOptionCombo>();
-
+
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
@@ -52,13 +52,10 @@
public DataElementCategoryOption()
{
}
-
- /**
- * @param name the name.
- */
+
public DataElementCategoryOption( String name )
{
- this.name = name;
+ this.name = name;
}
// -------------------------------------------------------------------------
@@ -69,7 +66,7 @@
{
return name.equals( DEFAULT_NAME );
}
-
+
// -------------------------------------------------------------------------
// hashCode, equals and toString
// -------------------------------------------------------------------------
@@ -87,17 +84,17 @@
{
return true;
}
-
+
if ( object == null )
{
return false;
}
-
- if ( !( object instanceof DataElementCategoryOption ) )
+
+ if ( !(object instanceof DataElementCategoryOption) )
{
return false;
}
-
+
final DataElementCategoryOption other = (DataElementCategoryOption) object;
return name.equals( other.getName() );
@@ -118,7 +115,7 @@
{
return name;
}
-
+
public DataElementCategory getCategory()
{
return category;
=== 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 2011-02-15 06:25:53 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java 2011-04-01 09:57:53 +0000
@@ -35,14 +35,14 @@
import java.util.Set;
import org.apache.commons.lang.StringEscapeUtils;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractNameableObject;
/**
* @author Abyot Aselefew
* @version $Id$
*/
public class DataElementCategoryOptionCombo
- extends IdentifiableObject
+ extends AbstractNameableObject
{
public static final String DEFAULT_NAME = "default";
=== 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 2011-01-31 19:47:04 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java 2011-04-01 09:57:53 +0000
@@ -30,14 +30,14 @@
import java.util.HashSet;
import java.util.Set;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractIdentifiableObject;
/**
* @author Kristian Nordal
* @version $Id: DataElementGroup.java 5540 2008-08-19 10:47:07Z larshelg $
*/
public class DataElementGroup
- extends IdentifiableObject
+ extends AbstractIdentifiableObject
{
private Set<DataElement> members = new HashSet<DataElement>();
=== 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 2011-01-31 19:47:04 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java 2011-04-01 09:57:53 +0000
@@ -31,7 +31,7 @@
import java.util.Collection;
import java.util.List;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractIdentifiableObject;
/**
* DataElementGroupSet is a set of DataElementGroups. It is by default exclusive,
@@ -41,7 +41,7 @@
* @author Lars Helge Overland
*/
public class DataElementGroupSet
- extends IdentifiableObject
+ extends AbstractIdentifiableObject
{
private List<DataElementGroup> members = new ArrayList<DataElementGroup>();
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java 2011-03-17 10:20:34 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java 2011-04-01 09:57:53 +0000
@@ -31,7 +31,7 @@
import java.util.HashSet;
import java.util.Set;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractNameableObject;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementOperand;
import org.hisp.dhis.dataentryform.DataEntryForm;
@@ -47,7 +47,7 @@
* @version $Id: DataSet.java 6255 2008-11-10 16:01:24Z larshelg $
*/
public class DataSet
- extends IdentifiableObject
+ extends AbstractNameableObject
{
/**
* The PeriodType indicating the frequency that this DataSet should be used
=== 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-31 19:47:04 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java 2011-04-01 09:57:53 +0000
@@ -33,14 +33,14 @@
import java.util.List;
import java.util.Set;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractNameableObject;
/**
* @author Lars Helge Overland
* @version $Id: Indicator.java 5540 2008-08-19 10:47:07Z larshelg $
*/
public class Indicator
- extends IdentifiableObject
+ extends AbstractNameableObject
{
private Boolean annualized;
@@ -73,33 +73,6 @@
private List<IndicatorGroupSet> groupSets = new ArrayList<IndicatorGroupSet>();
// -------------------------------------------------------------------------
- // Constructors
- // -------------------------------------------------------------------------
-
- public Indicator()
- {
- }
-
- public Indicator( String name, String alternativeName, String shortName, String code, String description, Boolean annualized,
- IndicatorType indicatorType, String numerator, String numeratorDescription, String numeratorAggregationOperator, String denominator,
- String denominatorDescription, String denominatorAggregationOperator )
- {
- this.name = name;
- this.alternativeName = alternativeName;
- this.shortName = shortName;
- this.code = code;
- this.description = description;
- this.annualized = annualized;
- this.indicatorType = indicatorType;
- this.numerator = numerator;
- this.numeratorDescription = numeratorDescription;
- this.numeratorAggregationOperator = numeratorAggregationOperator;
- this.denominator = denominator;
- this.denominatorDescription = denominatorDescription;
- this.denominatorAggregationOperator = denominatorAggregationOperator;
- }
-
- // -------------------------------------------------------------------------
// 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 2011-01-31 19:47:04 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java 2011-04-01 09:57:53 +0000
@@ -30,14 +30,14 @@
import java.util.HashSet;
import java.util.Set;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractIdentifiableObject;
/**
* @author Lars Helge Overland
* @version $Id: IndicatorGroup.java 5296 2008-05-29 16:06:14Z larshelg $
*/
public class IndicatorGroup
- extends IdentifiableObject
+ extends AbstractIdentifiableObject
{
private Set<Indicator> members = new HashSet<Indicator>();
=== 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 2011-01-31 19:47:04 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.java 2011-04-01 09:57:53 +0000
@@ -31,7 +31,7 @@
import java.util.Collection;
import java.util.List;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractIdentifiableObject;
/**
* An IndicatorGroupSet is a set of IndicatorGroups. It is by default exclusive,
@@ -41,7 +41,7 @@
* @author Lars Helge Overland
*/
public class IndicatorGroupSet
- extends IdentifiableObject
+ extends AbstractIdentifiableObject
{
private List<IndicatorGroup> members = new ArrayList<IndicatorGroup>();
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorType.java 2010-12-16 04:38:17 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorType.java 2011-04-01 09:57:53 +0000
@@ -27,14 +27,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractIdentifiableObject;
/**
* @author Lars Helge Overland
* @version $Id: IndicatorType.java 5296 2008-05-29 16:06:14Z larshelg $
*/
public class IndicatorType
- extends IdentifiableObject
+ extends AbstractIdentifiableObject
{
private int factor;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/olap/OlapURL.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/olap/OlapURL.java 2010-05-12 12:01:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/olap/OlapURL.java 2011-04-01 09:57:53 +0000
@@ -23,14 +23,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractIdentifiableObject;
/**
* @author Lars Helge Overland
* @version $Id$
*/
public class OlapURL
- extends IdentifiableObject
+ extends AbstractIdentifiableObject
{
private String url;
=== 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 2011-01-31 19:47:04 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java 2011-04-01 09:57:53 +0000
@@ -30,7 +30,7 @@
import java.util.HashSet;
import java.util.Set;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractIdentifiableObject;
/**
* @author Kristian Nordal
@@ -38,7 +38,7 @@
*/
public class OrganisationUnitGroup
- extends IdentifiableObject
+ extends AbstractIdentifiableObject
{
private Set<OrganisationUnit> members = new HashSet<OrganisationUnit>();
=== 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 2011-01-31 19:47:04 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java 2011-04-01 09:57:53 +0000
@@ -33,14 +33,14 @@
import java.util.List;
import java.util.Set;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractIdentifiableObject;
/**
* @author Kristian Nordal
* @version $Id: OrganisationUnitGroupSet.java 1905 2006-09-23 14:34:55Z torgeilo $
*/
public class OrganisationUnitGroupSet
- extends IdentifiableObject
+ extends AbstractIdentifiableObject
{
private String description;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitLevel.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitLevel.java 2010-05-12 12:01:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitLevel.java 2011-04-01 09:57:53 +0000
@@ -27,14 +27,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractIdentifiableObject;
/**
* @author Lars Helge Overland
* @version $Id$
*/
public class OrganisationUnitLevel
- extends IdentifiableObject
+ extends AbstractIdentifiableObject
{
private int level;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientMobileSetting.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientMobileSetting.java 2010-11-25 08:05:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientMobileSetting.java 2011-04-01 09:57:53 +0000
@@ -29,9 +29,9 @@
import java.util.List;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractIdentifiableObject;
-public class PatientMobileSetting extends IdentifiableObject
+public class PatientMobileSetting extends AbstractIdentifiableObject
{
private Boolean gender, dobtype, birthdate, bloodgroup, registrationdate;
=== 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-02-24 21:01:47 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java 2011-04-01 09:57:53 +0000
@@ -31,14 +31,14 @@
import java.text.SimpleDateFormat;
import java.util.Date;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractNameableObject;
/**
* @author Kristian Nordal
* @version $Id: Period.java 5277 2008-05-27 15:48:42Z larshelg $
*/
public class Period
- extends IdentifiableObject
+ extends AbstractNameableObject
{
public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd";
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/pivottable/PivotTable.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/pivottable/PivotTable.java 2011-03-15 23:26:14 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/pivottable/PivotTable.java 2011-04-01 09:57:53 +0000
@@ -33,7 +33,7 @@
import org.hisp.dhis.aggregation.AggregatedIndicatorValue;
import org.hisp.dhis.common.AggregatedValue;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractIdentifiableObject;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.period.Period;
@@ -43,7 +43,7 @@
*/
public class PivotTable
{
- private List<? extends IdentifiableObject> indicators = new ArrayList<IdentifiableObject>();
+ private List<? extends AbstractIdentifiableObject> indicators = new ArrayList<AbstractIdentifiableObject>();
private List<Period> periods = new ArrayList<Period>();
@@ -63,12 +63,12 @@
// Getters and setters
// -------------------------------------------------------------------------
- public List<? extends IdentifiableObject> getIndicators()
+ public List<? extends AbstractIdentifiableObject> getIndicators()
{
return indicators;
}
- public void setIndicators( List<? extends IdentifiableObject> indicators )
+ public void setIndicators( List<? extends AbstractIdentifiableObject> indicators )
{
this.indicators = indicators;
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/Report.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/Report.java 2011-02-22 23:05:45 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/Report.java 2011-04-01 09:57:53 +0000
@@ -27,7 +27,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractIdentifiableObject;
import org.hisp.dhis.reporttable.ReportTable;
/**
@@ -35,7 +35,7 @@
* @version $Id$
*/
public class Report
- extends IdentifiableObject
+ extends AbstractIdentifiableObject
{
public static final String TEMPLATE_DIR = "templates";
=== 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-02-28 20:10:12 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java 2011-04-01 09:57:53 +0000
@@ -35,8 +35,10 @@
import java.util.Map;
import org.apache.commons.lang.StringUtils;
+import org.hisp.dhis.common.AbstractNameableObject;
import org.hisp.dhis.common.CombinationGenerator;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.NameableObject;
+import org.hisp.dhis.common.NameableObject;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementCategoryOption;
@@ -57,7 +59,7 @@
* @version $Id$
*/
public class ReportTable
- extends IdentifiableObject
+ extends AbstractNameableObject
{
public static final String DATAELEMENT_ID = "dataelementid";
public static final String DATAELEMENT_NAME = "dataelementname";
@@ -105,7 +107,7 @@
put( ORGANISATION_UNIT_IS_PARENT_COLUMN_NAME, "Organisation unit is parent" );
} };
- public static final Map<Class<? extends IdentifiableObject>, String> CLASS_ID_MAP = new HashMap<Class<? extends IdentifiableObject>, String>() { {
+ public static final Map<Class<? extends NameableObject>, String> CLASS_ID_MAP = new HashMap<Class<? extends NameableObject>, String>() { {
put( Indicator.class, INDICATOR_ID );
put( DataElement.class, DATAELEMENT_ID );
put( DataElementCategoryOptionCombo.class, CATEGORYCOMBO_ID );
@@ -116,7 +118,7 @@
} };
private static final String EMPTY = "";
- private static final IdentifiableObject[] IRT = new IdentifiableObject[0];
+ private static final NameableObject[] IRT = new NameableObject[0];
private static final String[] SRT = new String[0];
private static final String ILLEGAL_FILENAME_CHARS_REGEX = "[/\\?%*:|\"'<>.]";
@@ -221,17 +223,17 @@
/**
* All Indicatrs, including DateElements, Indicators and DataSets.
*/
- private List<IdentifiableObject> allIndicators = new ArrayList<IdentifiableObject>();
+ private List<NameableObject> allIndicators = new ArrayList<NameableObject>();
/**
* All crosstabulated columns.
*/
- private List<List<IdentifiableObject>> columns = new ArrayList<List<IdentifiableObject>>();
+ private List<List<NameableObject>> columns = new ArrayList<List<NameableObject>>();
/**
* All rows.
*/
- private List<List<IdentifiableObject>> rows = new ArrayList<List<IdentifiableObject>>();
+ private List<List<NameableObject>> rows = new ArrayList<List<NameableObject>>();
/**
* Names of the columns used to query the datavalue table and as index columns
@@ -375,8 +377,8 @@
allUnits.addAll( relativeUnits );
allUnits = removeDuplicates( allUnits );
- columns = new CombinationGenerator<IdentifiableObject>( getArrays( true ) ).getCombinations();
- rows = new CombinationGenerator<IdentifiableObject>( getArrays( false ) ).getCombinations();
+ columns = new CombinationGenerator<NameableObject>( getArrays( true ) ).getCombinations();
+ rows = new CombinationGenerator<NameableObject>( getArrays( false ) ).getCombinations();
addIfEmpty( columns ); // Allow for all or none crosstab dimensions
addIfEmpty( rows );
@@ -423,11 +425,11 @@
* Generates a pretty column name based on short-names of the argument objects.
* Null arguments are ignored in the name.
*/
- public static String getPrettyColumnName( List<IdentifiableObject> objects )
+ public static String getPrettyColumnName( List<NameableObject> objects )
{
StringBuffer buffer = new StringBuffer();
- for ( IdentifiableObject object : objects )
+ for ( NameableObject object : objects )
{
buffer.append( object != null ? ( object.getShortName() + SPACE ) : EMPTY );
}
@@ -439,11 +441,11 @@
* Generates a column name based on short-names of the argument objects. Null
* arguments are ignored in the name.
*/
- public static String getColumnName( List<IdentifiableObject> objects )
+ public static String getColumnName( List<NameableObject> objects )
{
StringBuffer buffer = new StringBuffer();
- for ( IdentifiableObject object : objects )
+ for ( NameableObject object : objects )
{
if ( object != null && object instanceof Period )
{
@@ -464,25 +466,25 @@
* Generates a grid identifier based on the internal identifiers of the
* argument objects.
*/
- public static String getIdentifier( List<IdentifiableObject> objects )
+ public static String getIdentifier( List<NameableObject> objects )
{
- return getIdentifier( objects, new ArrayList<IdentifiableObject>() );
+ return getIdentifier( objects, new ArrayList<NameableObject>() );
}
/**
* Generates a grid identifier based on the internal identifiers of the
* argument objects.
*/
- public static String getIdentifier( List<IdentifiableObject> objects1, List<IdentifiableObject> objects2 )
+ public static String getIdentifier( List<? extends NameableObject> objects1, List<? extends NameableObject> objects2 )
{
List<String> identifiers = new ArrayList<String>();
- for ( IdentifiableObject object : objects1 )
+ for ( NameableObject object : objects1 )
{
identifiers.add( getIdentifier( object.getClass(), object.getId() ) );
}
- for ( IdentifiableObject object : objects2 )
+ for ( NameableObject object : objects2 )
{
identifiers.add( getIdentifier( object.getClass(), object.getId() ) );
}
@@ -493,11 +495,11 @@
/**
* Generates a grid column identifier based on the argument identifiers.
*/
- public static String getIdentifier( List<IdentifiableObject> objects, Class<? extends IdentifiableObject> clazz, int id )
+ public static String getIdentifier( List<NameableObject> objects, Class<? extends NameableObject> clazz, int id )
{
List<String> identifiers = new ArrayList<String>();
- for ( IdentifiableObject object : objects )
+ for ( NameableObject object : objects )
{
identifiers.add( getIdentifier( object.getClass(), object.getId() ) );
}
@@ -522,7 +524,7 @@
/**
* Returns a grid identifier based on the argument class and id.
*/
- public static String getIdentifier( Class<? extends IdentifiableObject> clazz, int id )
+ public static String getIdentifier( Class<? extends NameableObject> clazz, int id )
{
return CLASS_ID_MAP.get( clazz ) + id;
}
@@ -588,9 +590,9 @@
// Supportive methods
// -------------------------------------------------------------------------
- private IdentifiableObject[][] getArrays( boolean crosstab )
+ private NameableObject[][] getArrays( boolean crosstab )
{
- List<IdentifiableObject[]> arrays = new ArrayList<IdentifiableObject[]>();
+ List<NameableObject[]> arrays = new ArrayList<NameableObject[]>();
if ( ( doIndicators && crosstab ) || ( !doIndicators && !crosstab ) )
{
@@ -612,17 +614,17 @@
arrays.add( categoryOptionCombos.toArray( IRT ) );
}
- return arrays.toArray( new IdentifiableObject[0][] );
+ return arrays.toArray( new NameableObject[0][] );
}
/**
- * Adds an empty list of IdentifiableObjects to the given list if empty.
+ * Adds an empty list of NameableObjects to the given list if empty.
*/
- private void addIfEmpty( List<List<IdentifiableObject>> list )
+ private void addIfEmpty( List<List<NameableObject>> list )
{
if ( list != null && list.size() == 0 )
{
- list.add( Arrays.asList( new IdentifiableObject[0] ) );
+ list.add( Arrays.asList( new NameableObject[0] ) );
}
}
@@ -958,12 +960,12 @@
this.organisationUnitName = organisationUnitName;
}
- public List<List<IdentifiableObject>> getColumns()
+ public List<List<NameableObject>> getColumns()
{
return columns;
}
- public List<List<IdentifiableObject>> getRows()
+ public List<List<NameableObject>> getRows()
{
return rows;
}
=== 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 2011-01-31 19:47:04 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/source/Source.java 2011-04-01 09:57:53 +0000
@@ -30,7 +30,7 @@
import java.util.HashSet;
import java.util.Set;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractNameableObject;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataset.DataSet;
@@ -39,7 +39,7 @@
* @version $Id: Source.java 5277 2008-05-27 15:48:42Z larshelg $
*/
public abstract class Source
- extends IdentifiableObject
+ extends AbstractNameableObject
{
protected Set<DataSet> dataSets = new HashSet<DataSet>();
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRule.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRule.java 2010-12-29 10:06:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRule.java 2011-04-01 09:57:53 +0000
@@ -30,7 +30,7 @@
import java.util.HashSet;
import java.util.Set;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractIdentifiableObject;
import org.hisp.dhis.expression.Expression;
import org.hisp.dhis.expression.Operator;
import org.hisp.dhis.period.PeriodType;
@@ -40,7 +40,7 @@
* @version $Id: ValidationRule.java 5434 2008-06-18 18:57:59Z larshelg $
*/
public class ValidationRule
- extends IdentifiableObject
+ extends AbstractIdentifiableObject
{
public static final String TYPE_STATISTICAL = "statistical";
public static final String TYPE_ABSOLUTE = "absolute";
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleGroup.java 2010-05-12 12:01:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleGroup.java 2011-04-01 09:57:53 +0000
@@ -30,14 +30,14 @@
import java.util.HashSet;
import java.util.Set;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractIdentifiableObject;
/**
* @author Lars Helge Overland
* @version $Id$
*/
public class ValidationRuleGroup
- extends IdentifiableObject
+ extends AbstractIdentifiableObject
{
private String description;
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/LinkBuilder.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/LinkBuilder.java 2011-02-25 18:08:38 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/LinkBuilder.java 2011-04-01 09:57:53 +0000
@@ -3,14 +3,14 @@
import java.util.Collection;
import java.util.List;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractIdentifiableObject;
import org.hisp.dhis.importexport.dxf2.model.Link;
public interface LinkBuilder
{
- public List<Link> getLinks( Collection<? extends IdentifiableObject> targets );
+ public List<Link> getLinks( Collection<? extends AbstractIdentifiableObject> targets );
- public Link get( IdentifiableObject target );
+ public Link get( AbstractIdentifiableObject target );
}
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/LinkBuilderImpl.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/LinkBuilderImpl.java 2011-02-25 18:08:38 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/LinkBuilderImpl.java 2011-04-01 09:57:53 +0000
@@ -4,23 +4,23 @@
import java.util.Collection;
import java.util.List;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractIdentifiableObject;
import org.hisp.dhis.importexport.dxf2.model.Link;
public class LinkBuilderImpl implements LinkBuilder
{
- public List<Link> getLinks( Collection<? extends IdentifiableObject> targets )
+ public List<Link> getLinks( Collection<? extends AbstractIdentifiableObject> targets )
{
List<Link> links = new ArrayList<Link>();
- for ( IdentifiableObject target : targets )
+ for ( AbstractIdentifiableObject target : targets )
{
links.add( get( target ) );
}
return links;
}
- public Link get( IdentifiableObject target )
+ public Link get( AbstractIdentifiableObject target )
{
Link link = new Link();
=== modified file 'dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/displayproperty/DefaultDisplayPropertyHandler.java'
--- dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/displayproperty/DefaultDisplayPropertyHandler.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/displayproperty/DefaultDisplayPropertyHandler.java 2011-04-01 09:57:53 +0000
@@ -29,7 +29,8 @@
import java.util.List;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractNameableObject;
+import org.hisp.dhis.common.NameableObject;
/**
* @author Lars Helge Overland
@@ -49,9 +50,9 @@
// DisplayPropertyHandler implementation
// -------------------------------------------------------------------------
- public List<? extends IdentifiableObject> handle( List<? extends IdentifiableObject> list )
+ public List<? extends NameableObject> handle( List<? extends AbstractNameableObject> list )
{
- for ( IdentifiableObject object : list )
+ for ( AbstractNameableObject object : list )
{
handle( object );
}
@@ -59,7 +60,7 @@
return list;
}
- public IdentifiableObject handle( IdentifiableObject object )
+ public NameableObject handle( AbstractNameableObject object )
{
if ( displayProperty.equals( DisplayPropertyManager.DISPLAY_PROPERTY_SHORTNAME ) )
{
=== modified file 'dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/displayproperty/DisplayPropertyHandler.java'
--- dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/displayproperty/DisplayPropertyHandler.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/displayproperty/DisplayPropertyHandler.java 2011-04-01 09:57:53 +0000
@@ -29,7 +29,8 @@
import java.util.List;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractNameableObject;
+import org.hisp.dhis.common.NameableObject;
/**
* @author Lars Helge Overland
@@ -37,7 +38,7 @@
*/
public interface DisplayPropertyHandler
{
- List<? extends IdentifiableObject> handle( List<? extends IdentifiableObject> list );
+ List<? extends NameableObject> handle( List<? extends AbstractNameableObject> list );
- IdentifiableObject handle( IdentifiableObject object );
+ NameableObject handle( AbstractNameableObject object );
}
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/pivottable/impl/DefaultPivotTableService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/pivottable/impl/DefaultPivotTableService.java 2011-03-15 23:26:14 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/pivottable/impl/DefaultPivotTableService.java 2011-04-01 09:57:53 +0000
@@ -37,7 +37,7 @@
import org.hisp.dhis.aggregation.AggregatedDataValueService;
import org.hisp.dhis.common.AggregatedValue;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractIdentifiableObject;
import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementService;
@@ -61,7 +61,7 @@
public class DefaultPivotTableService
implements PivotTableService
{
- private static final Comparator<IdentifiableObject> INDICATOR_COMPARATOR = new IdentifiableObjectNameComparator();
+ private static final Comparator<AbstractIdentifiableObject> INDICATOR_COMPARATOR = new IdentifiableObjectNameComparator();
private static final Comparator<OrganisationUnit> ORGUNIT_COMPARATOR = new OrganisationUnitNameComparator();
private static final Comparator<Period> PERIOD_COMPARATOR = new AscendingPeriodComparator();
@@ -118,7 +118,7 @@
List<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>(
organisationUnitService.getOrganisationUnit( organisationUnitId ).getChildren() );
- List<? extends IdentifiableObject> indicators = null;
+ List<? extends AbstractIdentifiableObject> indicators = null;
Collection<? extends AggregatedValue> aggregatedValues = null;
if ( dataType == DATA_TYPE_INDICATOR )
@@ -153,7 +153,7 @@
}
else
{
- indicators = new ArrayList<IdentifiableObject>( dataElementService.getDataElementGroup( groupId ).getMembers() );
+ indicators = new ArrayList<AbstractIdentifiableObject>( dataElementService.getDataElementGroup( groupId ).getMembers() );
aggregatedValues = aggregatedDataValueService.getAggregatedDataValues(
ConversionUtils.getIdentifiers( Indicator.class, indicators ),
=== 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-03-29 20:06:47 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java 2011-04-01 09:57:53 +0000
@@ -52,6 +52,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.completeness.DataSetCompletenessService;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryOption;
@@ -389,7 +390,7 @@
grid.addHeader( new GridHeader( PRETTY_COLUMNS.get( PARAM_ORGANISATIONUNIT_COLUMN_NAME ), PARAM_ORGANISATIONUNIT_COLUMN_NAME, String.class.getName(), true, true ) );
grid.addHeader( new GridHeader( PRETTY_COLUMNS.get( ORGANISATION_UNIT_IS_PARENT_COLUMN_NAME ), ORGANISATION_UNIT_IS_PARENT_COLUMN_NAME, String.class.getName(), true, true ) );
- for ( List<IdentifiableObject> column : reportTable.getColumns() )
+ for ( List<NameableObject> column : reportTable.getColumns() )
{
grid.addHeader( new GridHeader( getPrettyColumnName( column ), getColumnName( column ), Double.class.getName(), false, false ) );
}
@@ -411,7 +412,7 @@
// Values
// ---------------------------------------------------------------------
- for ( List<IdentifiableObject> row : reportTable.getRows() )
+ for ( List<NameableObject> row : reportTable.getRows() )
{
grid.addRow();
@@ -420,7 +421,7 @@
grid.addValue( object.getId() ); // Index columns
}
- for ( IdentifiableObject object : row )
+ for ( NameableObject object : row )
{
grid.addValue( object.getShortName() ); // Index name columns
}
@@ -429,7 +430,7 @@
grid.addValue( reportTable.getOrganisationUnitName() );
grid.addValue( isCurrentParent( row ) ? YES : NO );
- for ( List<IdentifiableObject> column : reportTable.getColumns() )
+ for ( List<NameableObject> column : reportTable.getColumns() )
{
grid.addValue( map.get( getIdentifier( row, column ) ) ); // Values
}
@@ -496,7 +497,7 @@
*
* @param objects the List of IdentifiableObjects.
*/
- private boolean isCurrentParent( List<IdentifiableObject> objects )
+ private boolean isCurrentParent( List<? extends IdentifiableObject> objects )
{
for ( IdentifiableObject object : objects )
{
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableTest.java 2011-02-17 18:48:30 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableTest.java 2011-04-01 09:57:53 +0000
@@ -43,7 +43,8 @@
import java.util.List;
import org.hisp.dhis.DhisTest;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.NameableObject;
+import org.hisp.dhis.common.NameableObject;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
@@ -202,16 +203,16 @@
i18nFormat = new MockI18nFormat();
}
- private static List<IdentifiableObject> getList( IdentifiableObject... objects )
+ private static List<NameableObject> getList( NameableObject... objects )
{
return Arrays.asList( objects );
}
- private static List<String> getColumnNames( List<List<IdentifiableObject>> cols )
+ private static List<String> getColumnNames( List<List<NameableObject>> cols )
{
List<String> columns = new ArrayList<String>();
- for ( List<IdentifiableObject> column : cols )
+ for ( List<NameableObject> column : cols )
{
columns.add( getColumnName( column ) );
}
@@ -226,11 +227,11 @@
@Test
public void testGetIdentifierA()
{
- List<IdentifiableObject> a1 = getList( unitA, periodA );
- List<IdentifiableObject> a2 = getList( indicatorA );
+ List<NameableObject> a1 = getList( unitA, periodA );
+ List<NameableObject> a2 = getList( indicatorA );
- List<IdentifiableObject> b1 = getList( periodA );
- List<IdentifiableObject> b2 = getList( indicatorA, unitA );
+ List<NameableObject> b1 = getList( periodA );
+ List<NameableObject> b2 = getList( indicatorA, unitA );
assertNotNull( getIdentifier( a1, a2 ) );
assertNotNull( getIdentifier( b1, b2 ) );
@@ -268,8 +269,8 @@
@Test
public void testGetIdentifierC()
{
- List<IdentifiableObject> a1 = getList( dataElementA, periodA, categoryOptionComboA );
- List<IdentifiableObject> a2 = getList( unitA );
+ List<NameableObject> a1 = getList( dataElementA, periodA, categoryOptionComboA );
+ List<NameableObject> a2 = getList( unitA );
String b1 = getIdentifier( DataElement.class,'A' );
String b2 = getIdentifier( Period.class, 'A' );
@@ -285,12 +286,12 @@
@Test
public void testGetColumnName()
{
- List<IdentifiableObject> a1 = getList( unitA, periodC );
+ List<NameableObject> a1 = getList( unitA, periodC );
assertNotNull( getColumnName( a1 ) );
assertEquals( "organisationunitshorta_reporting_month", getColumnName( a1 ) );
- List<IdentifiableObject> a2 = getList( unitB, periodD );
+ List<NameableObject> a2 = getList( unitB, periodD );
assertNotNull( getColumnName( a2 ) );
assertEquals( "organisationunitshortb_year", getColumnName( a2 ) );
@@ -317,12 +318,12 @@
assertEquals( 1, indexNameColumns.size() );
assertTrue( indexNameColumns.contains( ReportTable.ORGANISATIONUNIT_NAME ) );
- List<List<IdentifiableObject>> columns = reportTable.getColumns();
+ List<List<NameableObject>> columns = reportTable.getColumns();
assertNotNull( columns );
assertEquals( 8, columns.size() );
- Iterator<List<IdentifiableObject>> iterator = columns.iterator();
+ Iterator<List<NameableObject>> iterator = columns.iterator();
assertEquals( getList( indicatorA, periodA ), iterator.next() );
assertEquals( getList( indicatorA, periodB ), iterator.next() );
@@ -343,7 +344,7 @@
assertTrue( columnNames.contains( "indicatorshortb_reporting_month" ) );
assertTrue( columnNames.contains( "indicatorshortb_year" ) );
- List<List<IdentifiableObject>> rows = reportTable.getRows();
+ List<List<NameableObject>> rows = reportTable.getRows();
assertNotNull( rows );
assertEquals( 2, rows.size() );
@@ -377,12 +378,12 @@
assertTrue( indexNameColumns.contains( ReportTable.INDICATOR_NAME ) );
assertTrue( indexNameColumns.contains( ReportTable.PERIOD_NAME ) );
- List<List<IdentifiableObject>> columns = reportTable.getColumns();
+ List<List<NameableObject>> columns = reportTable.getColumns();
assertNotNull( columns );
assertEquals( 2, columns.size() );
- Iterator<List<IdentifiableObject>> iterator = columns.iterator();
+ Iterator<List<NameableObject>> iterator = columns.iterator();
assertEquals( getList( unitA ), iterator.next() );
assertEquals( getList( unitB ), iterator.next() );
@@ -395,7 +396,7 @@
assertTrue( columnNames.contains( "organisationunitshorta" ) );
assertTrue( columnNames.contains( "organisationunitshortb" ) );
- List<List<IdentifiableObject>> rows = reportTable.getRows();
+ List<List<NameableObject>> rows = reportTable.getRows();
assertNotNull( rows );
assertEquals( 8, rows.size() );
@@ -433,12 +434,12 @@
assertEquals( 1, indexNameColumns.size() );
assertTrue( indexNameColumns.contains( ReportTable.PERIOD_NAME ) );
- List<List<IdentifiableObject>> columns = reportTable.getColumns();
+ List<List<NameableObject>> columns = reportTable.getColumns();
assertNotNull( columns );
assertEquals( 4, columns.size() );
- Iterator<List<IdentifiableObject>> iterator = columns.iterator();
+ Iterator<List<NameableObject>> iterator = columns.iterator();
assertEquals( getList( indicatorA, unitA ), iterator.next() );
assertEquals( getList( indicatorA, unitB ), iterator.next() );
@@ -455,7 +456,7 @@
assertTrue( columnNames.contains( "indicatorshortb_organisationunitshorta" ) );
assertTrue( columnNames.contains( "indicatorshortb_organisationunitshortb" ) );
- List<List<IdentifiableObject>> rows = reportTable.getRows();
+ List<List<NameableObject>> rows = reportTable.getRows();
assertNotNull( rows );
assertEquals( 4, rows.size() );
@@ -487,12 +488,12 @@
assertNotNull( indexNameColumns );
assertEquals( 0, indexNameColumns.size() );
- List<List<IdentifiableObject>> columns = reportTable.getColumns();
+ List<List<NameableObject>> columns = reportTable.getColumns();
assertNotNull( columns );
assertEquals( 16, columns.size() );
- List<List<IdentifiableObject>> rows = reportTable.getRows();
+ List<List<NameableObject>> rows = reportTable.getRows();
assertNotNull( rows );
assertEquals( 1, rows.size() );
@@ -517,12 +518,12 @@
assertNotNull( indexNameColumns );
assertEquals( 3, indexNameColumns.size() );
- List<List<IdentifiableObject>> columns = reportTable.getColumns();
+ List<List<NameableObject>> columns = reportTable.getColumns();
assertNotNull( columns );
assertEquals( 1, columns.size() );
- List<List<IdentifiableObject>> rows = reportTable.getRows();
+ List<List<NameableObject>> rows = reportTable.getRows();
assertNotNull( rows );
assertEquals( 16, rows.size() );
@@ -549,7 +550,7 @@
assertEquals( 1, indexNameColumns.size() );
assertTrue( indexNameColumns.contains( ReportTable.ORGANISATIONUNIT_NAME ) );
- List<List<IdentifiableObject>> columns = reportTable.getColumns();
+ List<List<NameableObject>> columns = reportTable.getColumns();
assertNotNull( columns );
assertEquals( 8, columns.size() );
@@ -564,7 +565,7 @@
assertTrue( columnNames.contains( "dataelementshortb_year" ) );
assertTrue( columnNames.contains( "dataelementshortb_reporting_month" ) );
- List<List<IdentifiableObject>> rows = reportTable.getRows();
+ List<List<NameableObject>> rows = reportTable.getRows();
assertNotNull( rows );
assertEquals( 2, rows.size() );
@@ -593,7 +594,7 @@
assertTrue( indexNameColumns.contains( ReportTable.INDICATOR_NAME ) );
assertTrue( indexNameColumns.contains( ReportTable.PERIOD_NAME ) );
- List<List<IdentifiableObject>> columns = reportTable.getColumns();
+ List<List<NameableObject>> columns = reportTable.getColumns();
assertNotNull( columns );
assertEquals( 2, columns.size() );
@@ -606,7 +607,7 @@
assertTrue( columnNames.contains( "organisationunitshorta" ) );
assertTrue( columnNames.contains( "organisationunitshortb" ) );
- List<List<IdentifiableObject>> rows = reportTable.getRows();
+ List<List<NameableObject>> rows = reportTable.getRows();
assertNotNull( rows );
assertEquals( 8, rows.size() );
@@ -633,7 +634,7 @@
assertEquals( 1, indexNameColumns.size() );
assertTrue( indexNameColumns.contains( ReportTable.PERIOD_NAME ) );
- List<List<IdentifiableObject>> columns = reportTable.getColumns();
+ List<List<NameableObject>> columns = reportTable.getColumns();
assertNotNull( columns );
assertEquals( 4, columns.size() );
@@ -648,7 +649,7 @@
assertTrue( columnNames.contains( "dataelementshortb_organisationunitshorta" ) );
assertTrue( columnNames.contains( "dataelementshortb_organisationunitshortb" ) );
- List<List<IdentifiableObject>> rows = reportTable.getRows();
+ List<List<NameableObject>> rows = reportTable.getRows();
assertNotNull( rows );
assertEquals( 4, rows.size() );
@@ -675,12 +676,12 @@
assertEquals( 1, indexNameColumns.size() );
assertTrue( indexNameColumns.contains( ReportTable.ORGANISATIONUNIT_NAME ) );
- List<List<IdentifiableObject>> columns = reportTable.getColumns();
+ List<List<NameableObject>> columns = reportTable.getColumns();
assertNotNull( columns );
assertEquals( 16, columns.size() );
- Iterator<List<IdentifiableObject>> iterator = columns.iterator();
+ Iterator<List<NameableObject>> iterator = columns.iterator();
assertEquals( getList( dataElementA, periodA, categoryOptionComboA ), iterator.next() );
assertEquals( getList( dataElementA, periodA, categoryOptionComboB ), iterator.next() );
@@ -704,7 +705,7 @@
assertNotNull( columnNames );
assertEquals( 16, columnNames.size() );
- List<List<IdentifiableObject>> rows = reportTable.getRows();
+ List<List<NameableObject>> rows = reportTable.getRows();
assertNotNull( rows );
assertEquals( 2, rows.size() );
@@ -738,12 +739,12 @@
assertTrue( indexNameColumns.contains( ReportTable.INDICATOR_NAME ) );
assertTrue( indexNameColumns.contains( ReportTable.PERIOD_NAME ) );
- List<List<IdentifiableObject>> columns = reportTable.getColumns();
+ List<List<NameableObject>> columns = reportTable.getColumns();
assertNotNull( columns );
assertEquals( 4, columns.size() );
- Iterator<List<IdentifiableObject>> iterator = columns.iterator();
+ Iterator<List<NameableObject>> iterator = columns.iterator();
assertEquals( getList( unitA, categoryOptionComboA ), iterator.next() );
assertEquals( getList( unitA, categoryOptionComboB ), iterator.next() );
@@ -755,7 +756,7 @@
assertNotNull( columnNames );
assertEquals( 4, columnNames.size() );
- List<List<IdentifiableObject>> rows = reportTable.getRows();
+ List<List<NameableObject>> rows = reportTable.getRows();
assertNotNull( rows );
assertEquals( 8, rows.size() );
@@ -793,12 +794,12 @@
assertEquals( 1, indexNameColumns.size() );
assertTrue( indexNameColumns.contains( ReportTable.PERIOD_NAME ) );
- List<List<IdentifiableObject>> columns = reportTable.getColumns();
+ List<List<NameableObject>> columns = reportTable.getColumns();
assertNotNull( columns );
assertEquals( 8, columns.size() );
- Iterator<List<IdentifiableObject>> iterator = columns.iterator();
+ Iterator<List<NameableObject>> iterator = columns.iterator();
assertEquals( getList( dataElementA, unitA, categoryOptionComboA ), iterator.next() );
assertEquals( getList( dataElementA, unitA, categoryOptionComboB ), iterator.next() );
@@ -814,7 +815,7 @@
assertNotNull( columnNames );
assertEquals( 8, columnNames.size() );
- List<List<IdentifiableObject>> rows = reportTable.getRows();
+ List<List<NameableObject>> rows = reportTable.getRows();
assertNotNull( rows );
assertEquals( 4, rows.size() );
@@ -848,7 +849,7 @@
assertEquals( 1, indexNameColumns.size() );
assertTrue( indexNameColumns.contains( ReportTable.ORGANISATIONUNIT_NAME ) );
- List<List<IdentifiableObject>> columns = reportTable.getColumns();
+ List<List<NameableObject>> columns = reportTable.getColumns();
assertNotNull( columns );
assertEquals( 8, columns.size() );
@@ -863,7 +864,7 @@
assertTrue( columnNames.contains( "datasetshortb_year" ) );
assertTrue( columnNames.contains( "datasetshortb_reporting_month" ) );
- List<List<IdentifiableObject>> rows = reportTable.getRows();
+ List<List<NameableObject>> rows = reportTable.getRows();
assertNotNull( rows );
assertEquals( 2, rows.size() );
@@ -892,7 +893,7 @@
assertTrue( indexNameColumns.contains( ReportTable.INDICATOR_NAME ) );
assertTrue( indexNameColumns.contains( ReportTable.PERIOD_NAME ) );
- List<List<IdentifiableObject>> columns = reportTable.getColumns();
+ List<List<NameableObject>> columns = reportTable.getColumns();
assertNotNull( columns );
assertEquals( 2, columns.size() );
@@ -905,7 +906,7 @@
assertTrue( columnNames.contains( "organisationunitshorta" ) );
assertTrue( columnNames.contains( "organisationunitshortb" ) );
- List<List<IdentifiableObject>> rows = reportTable.getRows();
+ List<List<NameableObject>> rows = reportTable.getRows();
assertNotNull( rows );
assertEquals( 8, rows.size() );
@@ -932,7 +933,7 @@
assertEquals( 1, indexNameColumns.size() );
assertTrue( indexNameColumns.contains( ReportTable.PERIOD_NAME ) );
- List<List<IdentifiableObject>> columns = reportTable.getColumns();
+ List<List<NameableObject>> columns = reportTable.getColumns();
assertNotNull( columns );
assertEquals( 4, columns.size() );
@@ -947,7 +948,7 @@
assertTrue( columnNames.contains( "datasetshortb_organisationunitshorta" ) );
assertTrue( columnNames.contains( "datasetshortb_organisationunitshortb" ) );
- List<List<IdentifiableObject>> rows = reportTable.getRows();
+ List<List<NameableObject>> rows = reportTable.getRows();
assertNotNull( rows );
assertEquals( 4, rows.size() );
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/GridUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/GridUtils.java 2011-03-31 13:38:43 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/GridUtils.java 2011-04-01 09:57:53 +0000
@@ -231,13 +231,7 @@
{
final StringWriter writer = new StringWriter();
- final VelocityEngine velocity = getVelocityEngine();
-
- final VelocityContext context = new VelocityContext();
-
- context.put( KEY_GRID, grid );
-
- velocity.getTemplate( TEMPLATE ).merge( context, writer );
+ render( grid, writer );
String report = writer.toString();
@@ -254,19 +248,13 @@
public static void toJrxml( Grid grid, Writer writer )
throws Exception
{
- final VelocityEngine velocity = getVelocityEngine();
-
- final VelocityContext context = new VelocityContext();
-
- context.put( KEY_GRID, grid );
-
- velocity.getTemplate( TEMPLATE ).merge( context, writer );
+ render(grid, writer);
}
/**
- * Creates a VelocityEngine instance.
+ * Render using velocity
*/
- private static VelocityEngine getVelocityEngine()
+ private static void render(Grid grid, Writer writer)
throws Exception
{
final VelocityEngine velocity = new VelocityEngine();
@@ -275,6 +263,12 @@
velocity.setProperty( RESOURCE_LOADER_NAME + ".resource.loader.class", ClasspathResourceLoader.class.getName() );
velocity.init();
- return velocity;
+ final VelocityContext context = new VelocityContext();
+
+ context.put( KEY_GRID, grid );
+
+ velocity.getTemplate( TEMPLATE ).merge( context, writer );
+
+
}
}
=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/linelisting/LineListElement.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/linelisting/LineListElement.java 2010-06-07 06:41:39 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/linelisting/LineListElement.java 2011-04-01 09:57:53 +0000
@@ -31,11 +31,11 @@
import java.util.ArrayList;
import java.util.Collection;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractIdentifiableObject;
@SuppressWarnings("serial")
public class LineListElement
- extends IdentifiableObject
+ extends AbstractIdentifiableObject
implements Serializable
{
public static final String TYPE_STRING = "string";
=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/linelisting/LineListElementOptions.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/linelisting/LineListElementOptions.java 2010-10-20 06:14:25 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/linelisting/LineListElementOptions.java 2011-04-01 09:57:53 +0000
@@ -1,7 +1,7 @@
package org.hisp.dhis.linelisting;
import java.io.Serializable;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractIdentifiableObject;
/*
* Copyright (c) 2004-2009, University of Oslo
@@ -31,7 +31,7 @@
*/
@SuppressWarnings( "serial" )
public class LineListElementOptions
- extends IdentifiableObject
+ extends AbstractIdentifiableObject
implements Serializable
{
=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/linelisting/LineListOption.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/linelisting/LineListOption.java 2010-06-07 06:41:39 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/linelisting/LineListOption.java 2011-04-01 09:57:53 +0000
@@ -29,11 +29,11 @@
import java.io.Serializable;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractIdentifiableObject;
@SuppressWarnings("serial")
public class LineListOption
- extends IdentifiableObject
+ extends AbstractIdentifiableObject
implements Serializable
{
/**
=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/ExportSurveyDataToExcelAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/ExportSurveyDataToExcelAction.java 2010-12-29 07:47:36 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dataanalyser/action/ExportSurveyDataToExcelAction.java 2011-04-01 09:57:53 +0000
@@ -271,10 +271,8 @@
System.out.println( data2.length );
*/
- selectedOrgUnit = new OrganisationUnit();
selectedOrgUnit = organisationUnitService.getOrganisationUnit( selectedOrgUnitId );
- selectedIndicator = new Indicator();
selectedIndicator = indicatorService.getIndicator( selctedIndicatorId );