dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #14833
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5149: refactored chart.title to chart.name to make use of identifiableobject
------------------------------------------------------------
revno: 5149
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2011-11-12 18:43:35 +0000
message:
refactored chart.title to chart.name to make use of identifiableobject
removed:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/comparator/ChartTitleComparator.java
added:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/comparator/ChartNameComparator.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/ChartService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/ChartConverter.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/importer/ChartImporter.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/hibernate/HibernateChartStore.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java
dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml
dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartServiceTest.java
dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java
dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/ChartResource.java
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/ProvideContentAction.java
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/mainForm.vm
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/GetAllChartsAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/SaveChartAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/ValidateChartAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/ViewChartAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/ShowUpdateChartGroupFormAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartForm.vm
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chart.js
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonChart.vm
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonCharts.vm
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/updateChartGroupForm.vm
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewChartForm.vm
--
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/chart/Chart.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java 2011-10-20 09:35:23 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java 2011-11-12 18:43:35 +0000
@@ -91,8 +91,6 @@
private int id;
- private String title;
-
private String domainAxixLabel;
private String rangeAxisLabel;
@@ -157,9 +155,9 @@
{
}
- public Chart( String title )
+ public Chart( String name )
{
- this.title = title;
+ this.name = name;
}
public void init()
@@ -213,7 +211,7 @@
@Override
public int hashCode()
{
- return title.hashCode();
+ return name.hashCode();
}
@Override
@@ -236,13 +234,13 @@
Chart other = (Chart) object;
- return title.equals( other.getTitle() );
+ return name.equals( other.getName() );
}
@Override
public String toString()
{
- return "[" + title + "]";
+ return "[" + name + "]";
}
// -------------------------------------------------------------------------
@@ -310,12 +308,12 @@
public String getName()
{
- return title;
+ return name;
}
public void setName( String name )
{
- this.title = name;
+ this.name = name;
}
// -------------------------------------------------------------------------
@@ -332,16 +330,6 @@
this.id = id;
}
- public String getTitle()
- {
- return title;
- }
-
- public void setTitle( String title )
- {
- this.title = title;
- }
-
public String getDomainAxixLabel()
{
return domainAxixLabel;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/ChartService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/ChartService.java 2011-10-23 12:03:50 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/ChartService.java 2011-11-12 18:43:35 +0000
@@ -52,13 +52,13 @@
JFreeChart getJFreeChart( int id, I18nFormat format );
JFreeChart getJFreePeriodChart( Indicator indicator, OrganisationUnit unit, boolean title, I18nFormat format );
-
+
JFreeChart getJFreeOrganisationUnitChart( Indicator indicator, OrganisationUnit parent, boolean title, I18nFormat format );
JFreeChart getJFreeChart( List<Indicator> indicators, List<DataElement> dataElements, List<DataSet> dataSets, List<Period> periods,
List<OrganisationUnit> organisationUnits, String dimension, boolean regression, I18nFormat format );
- JFreeChart getJFreeChart( String title, PlotOrientation orientation, CategoryLabelPositions labelPositions,
+ JFreeChart getJFreeChart( String name, PlotOrientation orientation, CategoryLabelPositions labelPositions,
Map<String, Double> categoryValues );
JFreeChart getJFreeChartHistory( DataElement dataElement, DataElementCategoryOptionCombo categoryOptionCombo,
@@ -74,7 +74,7 @@
Collection<Chart> getAllCharts();
- Chart getChartByTitle( String name );
+ Chart getChartByName( String name );
Collection<Chart> getCharts( final Collection<Integer> identifiers );
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/comparator/ChartNameComparator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/comparator/ChartNameComparator.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/comparator/ChartNameComparator.java 2011-11-12 18:43:35 +0000
@@ -0,0 +1,45 @@
+package org.hisp.dhis.chart.comparator;
+
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.Comparator;
+
+import org.hisp.dhis.chart.Chart;
+
+/**
+ * @author Lars Helge Overland
+ * @version $Id$
+ */
+public class ChartNameComparator
+ implements Comparator<Chart>
+{
+ public int compare( Chart chart1, Chart chart2 )
+ {
+ return chart1.getName().compareToIgnoreCase( chart2.getName() );
+ }
+}
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/comparator/ChartTitleComparator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/comparator/ChartTitleComparator.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/comparator/ChartTitleComparator.java 1970-01-01 00:00:00 +0000
@@ -1,45 +0,0 @@
-package org.hisp.dhis.chart.comparator;
-
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.Comparator;
-
-import org.hisp.dhis.chart.Chart;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class ChartTitleComparator
- implements Comparator<Chart>
-{
- public int compare( Chart chart1, Chart chart2 )
- {
- return chart1.getTitle().compareToIgnoreCase( chart2.getTitle() );
- }
-}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java 2011-11-04 09:34:37 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java 2011-11-12 18:43:35 +0000
@@ -50,7 +50,7 @@
{
private static final Log log = LogFactory.getLog( IdentityPopulator.class );
- private static String[] tables = { "constant", "attribute", "indicatortype", "indicatorgroupset", "indicator",
+ private static String[] tables = { "chart", "constant", "attribute", "indicatortype", "indicatorgroupset", "indicator",
"indicatorgroup", "datadictionary", "validationrulegroup", "validationrule", "dataset", "orgunitlevel",
"organisationunit", "orgunitgroup", "orgunitgroupset", "dataelementcategoryoption", "dataelementgroup",
"dataelement", "dataelementgroupset", "dataelementcategory", "categorycombo", "categoryoptioncombo" };
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2011-10-27 12:08:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2011-11-12 18:43:35 +0000
@@ -254,6 +254,7 @@
executeSql( "ALTER TABLE chart DROP COLUMN last12individualmonths" );
executeSql( "ALTER TABLE chart DROP COLUMN individualmonthsthisyear" );
executeSql( "ALTER TABLE chart DROP COLUMN individualquartersthisyear" );
+ executeSql( "ALTER TABLE chart RENAME COLUMN title TO name" );
executeSql( "ALTER TABLE datamartexport DROP COLUMN last3months" );
executeSql( "ALTER TABLE datamartexport DROP COLUMN last6months" );
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/ChartConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/ChartConverter.java 2011-01-06 15:40:07 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/ChartConverter.java 2011-11-12 18:43:35 +0000
@@ -104,7 +104,7 @@
writer.openElement( ELEMENT_NAME );
writer.writeElement( FIELD_ID, String.valueOf( chart.getId() ) );
- writer.writeElement( FIELD_TITLE, String.valueOf( chart.getTitle() ) );
+ writer.writeElement( FIELD_TITLE, String.valueOf( chart.getName() ) );
writer.writeElement( FIELD_TYPE, String.valueOf( chart.getType() ) );
writer.writeElement( FIELD_SIZE, String.valueOf( chart.getSize() ) );
writer.writeElement( FIELD_DIMENSION, String.valueOf( chart.getDimension() ) );
@@ -163,7 +163,7 @@
chart.setId( Integer.parseInt( reader.getElementValue() ) );
reader.moveToStartElement( FIELD_TITLE );
- chart.setTitle( reader.getElementValue() );
+ chart.setName( reader.getElementValue() );
reader.moveToStartElement( FIELD_TYPE );
chart.setType( reader.getElementValue() );
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/importer/ChartImporter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/importer/ChartImporter.java 2011-01-06 15:40:07 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/importer/ChartImporter.java 2011-11-12 18:43:35 +0000
@@ -65,7 +65,7 @@
@Override
protected void importMatching( Chart object, Chart match )
{
- match.setTitle( object.getTitle() );
+ match.setName( object.getName() );
match.setType( object.getType() );
match.setSize( object.getSize() );
match.setDimension( object.getDimension() );
@@ -88,13 +88,13 @@
@Override
protected Chart getMatching( Chart object )
{
- return chartService.getChartByTitle( object.getTitle() );
+ return chartService.getChartByName( object.getName() );
}
@Override
protected boolean isIdentical( Chart object, Chart existing )
{
- if ( !object.getTitle().equals( existing.getTitle() ) )
+ if ( !object.getName().equals( existing.getName() ) )
{
return false;
}
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/hibernate/HibernateChartStore.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/hibernate/HibernateChartStore.java 2010-12-13 21:21:33 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/hibernate/HibernateChartStore.java 2011-11-12 18:43:35 +0000
@@ -35,6 +35,7 @@
import org.hibernate.criterion.Restrictions;
import org.hisp.dhis.chart.Chart;
import org.hisp.dhis.chart.ChartStore;
+import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
import org.hisp.dhis.hibernate.HibernateGenericStore;
/**
@@ -42,11 +43,11 @@
* @version $Id$
*/
public class HibernateChartStore
- extends HibernateGenericStore<Chart> implements ChartStore
+ extends HibernateIdentifiableObjectStore<Chart> implements ChartStore
{
public Chart getByTitle( String title )
{
- return getObject( Restrictions.eq( "title", title ) );
+ return getObject( Restrictions.eq( "name", title ) );
}
public int getChartCount()
@@ -58,7 +59,7 @@
public Collection<Chart> getChartsBetween( int first, int max )
{
Criteria criteria = getCriteria();
- criteria.addOrder( Order.asc( "title" ) );
+ criteria.addOrder( Order.asc( "name" ) );
criteria.setFirstResult( first );
criteria.setMaxResults( max );
return criteria.list();
@@ -68,8 +69,8 @@
public Collection<Chart> getChartsBetweenByName( String name, int first, int max )
{
Criteria criteria = getCriteria();
- criteria.add( Restrictions.ilike( "title", "%" + name + "%" ) );
- criteria.addOrder( Order.asc( "title" ) );
+ criteria.add( Restrictions.ilike( "name", "%" + name + "%" ) );
+ criteria.addOrder( Order.asc( "name" ) );
criteria.setFirstResult( first );
criteria.setMaxResults( max );
return criteria.list();
@@ -79,7 +80,7 @@
{
Criteria criteria = getCriteria();
criteria.setProjection( Projections.rowCount() );
- criteria.add( Restrictions.ilike( "title", "%" + name + "%" ) );
+ criteria.add( Restrictions.ilike( "name", "%" + name + "%" ) );
return ((Number) criteria.uniqueResult()).intValue();
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java 2011-10-23 12:03:50 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java 2011-11-12 18:43:35 +0000
@@ -261,7 +261,7 @@
if ( title )
{
- chart.setTitle( indicator.getName() );
+ chart.setName( indicator.getName() );
}
chart.setType( TYPE_LINE );
@@ -290,7 +290,7 @@
if ( title )
{
- chart.setTitle( indicator.getName() );
+ chart.setName( indicator.getName() );
}
chart.setType( TYPE_BAR );
@@ -316,15 +316,15 @@
if ( indicators != null && !indicators.isEmpty() )
{
- chart.setTitle( getTitle( indicators.get( 0 ), periods, organisationUnits, format ) );
+ chart.setName( getTitle( indicators.get( 0 ), periods, organisationUnits, format ) );
}
else if ( dataElements != null && !dataElements.isEmpty() )
{
- chart.setTitle( getTitle( dataElements.get( 0 ), periods, organisationUnits, format ) );
+ chart.setName( getTitle( dataElements.get( 0 ), periods, organisationUnits, format ) );
}
else if ( dataSets != null && !dataSets.isEmpty() )
{
- chart.setTitle( getTitle( dataSets.get( 0 ), periods, organisationUnits, format ) );
+ chart.setName( getTitle( dataSets.get( 0 ), periods, organisationUnits, format ) );
}
chart.setType( TYPE_BAR );
@@ -346,20 +346,20 @@
return getJFreeChart( chart, false );
}
- public JFreeChart getJFreeChart( String title, PlotOrientation orientation, CategoryLabelPositions labelPositions,
+ public JFreeChart getJFreeChart( String name, PlotOrientation orientation, CategoryLabelPositions labelPositions,
Map<String, Double> categoryValues )
{
DefaultCategoryDataset dataSet = new DefaultCategoryDataset();
for ( Entry<String, Double> entry : categoryValues.entrySet() )
{
- dataSet.addValue( entry.getValue(), title, entry.getKey() );
+ dataSet.addValue( entry.getValue(), name, entry.getKey() );
}
CategoryPlot plot = getCategoryPlot( dataSet, getBarRenderer(), orientation, labelPositions );
JFreeChart jFreeChart = getBasicJFreeChart( plot );
- jFreeChart.setTitle( title );
+ jFreeChart.setTitle( name );
return jFreeChart;
}
@@ -697,7 +697,7 @@
plot.setRenderer( 1, lineRenderer );
}
- JFreeChart jFreeChart = new JFreeChart( chart.getTitle(), titleFont, plot, !chart.isHideLegend() );
+ JFreeChart jFreeChart = new JFreeChart( chart.getName(), titleFont, plot, !chart.isHideLegend() );
if ( chart.isTargetLine() )
{
@@ -755,12 +755,12 @@
if ( chart.isType( TYPE_STACKED_BAR ) )
{
- stackedBarChart = ChartFactory.createStackedBarChart( chart.getTitle(), chart.getDomainAxixLabel(),
+ stackedBarChart = ChartFactory.createStackedBarChart( chart.getName(), chart.getDomainAxixLabel(),
chart.getRangeAxisLabel(), dataSet, orientation, true, false, false );
}
else
{
- stackedBarChart = ChartFactory.createStackedBarChart3D( chart.getTitle(), chart.getDomainAxixLabel(),
+ stackedBarChart = ChartFactory.createStackedBarChart3D( chart.getName(), chart.getDomainAxixLabel(),
chart.getRangeAxisLabel(), dataSet, orientation, true, false, false );
}
@@ -785,12 +785,12 @@
if ( chart.isType( TYPE_PIE ) )
{
- multiplePieChart = ChartFactory.createMultiplePieChart( chart.getTitle(), dataSets[0], TableOrder.BY_ROW,
+ multiplePieChart = ChartFactory.createMultiplePieChart( chart.getName(), dataSets[0], TableOrder.BY_ROW,
!chart.getHideLegend(), false, false );
}
else
{
- multiplePieChart = ChartFactory.createMultiplePieChart3D( chart.getTitle(), dataSets[0], TableOrder.BY_ROW,
+ multiplePieChart = ChartFactory.createMultiplePieChart3D( chart.getName(), dataSets[0], TableOrder.BY_ROW,
!chart.getHideLegend(), false, false );
}
@@ -1146,7 +1146,7 @@
return chartStore.getAll();
}
- public Chart getChartByTitle( String name )
+ public Chart getChartByName( String name )
{
return chartStore.getByTitle( name );
}
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml 2011-10-20 11:23:55 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml 2011-11-12 18:43:35 +0000
@@ -1,7 +1,9 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
+ "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"
+ [<!ENTITY identifiableProperties SYSTEM "classpath://org/hisp/dhis/common/identifiableProperties.hbm">]
+>
<hibernate-mapping>
<class name="org.hisp.dhis.chart.Chart" table="chart">
@@ -11,10 +13,7 @@
<id name="id" column="chartid">
<generator class="native" />
</id>
-
- <property name="uuid" length="40" />
-
- <property name="title" not-null="true" unique="true" />
+ &identifiableProperties;
<property name="domainAxixLabel" />
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartServiceTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartServiceTest.java 2011-04-18 13:03:42 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartServiceTest.java 2011-11-12 18:43:35 +0000
@@ -227,6 +227,6 @@
chartService.saveChart( chartB );
chartService.saveChart( chartC );
- assertEquals( chartB, chartService.getChartByTitle( "ChartB" ) );
+ assertEquals( chartB, chartService.getChartByName( "ChartB" ) );
}
}
=== modified file 'dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java'
--- dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java 2011-11-03 01:02:13 +0000
+++ dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java 2011-11-12 18:43:35 +0000
@@ -820,7 +820,7 @@
{
Chart chart = new Chart();
- chart.setTitle( "Chart" + uniqueCharacter );
+ chart.setName( "Chart" + uniqueCharacter );
chart.setDimension( Chart.DIMENSION_PERIOD_INDICATOR );
chart.setIndicators( indicators );
chart.setPeriods( periods );
=== modified file 'dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/ChartResource.java'
--- dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/ChartResource.java 2011-11-02 11:14:35 +0000
+++ dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/ChartResource.java 2011-11-12 18:43:35 +0000
@@ -65,7 +65,7 @@
final Chart chart = chartService.getChart( id );
- final String filename = CodecUtils.filenameEncode( chart.getTitle() + ".png" );
+ final String filename = CodecUtils.filenameEncode( chart.getName() + ".png" );
return ResponseUtils.response( true, filename, false ).entity( new StreamingOutput()
{
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/ProvideContentAction.java'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/ProvideContentAction.java 2011-09-30 09:50:17 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/ProvideContentAction.java 2011-11-12 18:43:35 +0000
@@ -38,7 +38,7 @@
import org.hisp.dhis.chart.Chart;
import org.hisp.dhis.chart.ChartService;
-import org.hisp.dhis.chart.comparator.ChartTitleComparator;
+import org.hisp.dhis.chart.comparator.ChartNameComparator;
import org.hisp.dhis.dashboard.DashboardManager;
import org.hisp.dhis.message.MessageService;
import org.hisp.dhis.user.UserSettingService;
@@ -131,7 +131,7 @@
charts = new ArrayList<Chart>( chartService.getAllCharts() );
- Collections.sort( charts, new ChartTitleComparator() );
+ Collections.sort( charts, new ChartNameComparator() );
int chartsInDashboardCount = (Integer) userSettingService.getUserSetting( KEY_CHARTS_IN_DASHBOARD, DEFAULT_CHARTS_IN_DASHBOARD );
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/mainForm.vm'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/mainForm.vm 2011-06-17 17:53:38 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/mainForm.vm 2011-11-12 18:43:35 +0000
@@ -29,7 +29,7 @@
<div id="$listId" class="menuDropDownArea">
<ul class="menuDropDownBox">
#foreach( $chart in $charts )
- <li class="menuDropDownItem" onclick="setAreaItem( '$divId', '$chart.id' )">${chart.title} </li>
+ <li class="menuDropDownItem" onclick="setAreaItem( '$divId', '$chart.id' )">${chart.name} </li>
#end
</ul>
</div>
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/GetAllChartsAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/GetAllChartsAction.java 2011-09-23 18:54:49 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/GetAllChartsAction.java 2011-11-12 18:43:35 +0000
@@ -35,7 +35,7 @@
import org.hisp.dhis.chart.Chart;
import org.hisp.dhis.chart.ChartService;
-import org.hisp.dhis.chart.comparator.ChartTitleComparator;
+import org.hisp.dhis.chart.comparator.ChartNameComparator;
import org.hisp.dhis.paging.ActionPagingSupport;
/**
@@ -59,9 +59,9 @@
// -------------------------------------------------------------------------
// Input & Output
// -------------------------------------------------------------------------
-
+
private String key;
-
+
public String getKey()
{
return key;
@@ -78,17 +78,17 @@
{
return charts;
}
-
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
-
+
public String execute()
{
if ( isNotBlank( key ) )
{
this.paging = createPaging( chartService.getChartCountByName( key ) );
-
+
charts = new ArrayList<Chart>( chartService.getChartsBetweenByName( key, paging.getStartPos(), paging.getPageSize() ) );
}
else
@@ -97,9 +97,9 @@
charts = new ArrayList<Chart>( chartService.getChartsBetween( paging.getStartPos(), paging.getPageSize() ) );
}
-
- Collections.sort( charts, new ChartTitleComparator() );
-
+
+ Collections.sort( charts, new ChartNameComparator() );
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/SaveChartAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/SaveChartAction.java 2011-11-01 18:02:50 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/SaveChartAction.java 2011-11-12 18:43:35 +0000
@@ -128,11 +128,11 @@
this.rangeAxisLabel = rangeAxisLabel;
}
- private String title;
+ private String name;
- public void setTitle( String title )
+ public void setName( String name )
{
- this.title = title;
+ this.name = name;
}
private boolean hideSubtitle;
@@ -353,7 +353,7 @@
Collections.sort( periods, new AscendingPeriodComparator() );
- chart.setTitle( title );
+ chart.setName( name );
chart.setDomainAxixLabel( domainAxisLabel );
chart.setRangeAxisLabel( rangeAxisLabel );
chart.setHideSubtitle( hideSubtitle );
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/ValidateChartAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/ValidateChartAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/ValidateChartAction.java 2011-11-12 18:43:35 +0000
@@ -67,13 +67,13 @@
public void setId( Integer id )
{
this.id = id;
- }
-
- private String title;
-
- public void setTitle( String title )
+ }
+
+ private String name;
+
+ public void setName( String name )
{
- this.title = title;
+ this.name = name;
}
// -------------------------------------------------------------------------
@@ -93,7 +93,7 @@
public String execute()
{
- if ( title == null )
+ if ( name == null )
{
message = i18n.getString( "specify_title" );
@@ -101,18 +101,18 @@
}
else
{
- title = title.trim();
+ name = name.trim();
- if ( title.length() == 0 )
+ if ( name.length() == 0 )
{
message = i18n.getString( "specify_title" );
return INPUT;
}
- Chart match = chartService.getChartByTitle( title );
-
- if ( match != null && ( id == null || match.getId() != id ) )
+ Chart match = chartService.getChartByName( name );
+
+ if ( match != null && (id == null || match.getId() != id) )
{
message = i18n.getString( "title_in_use" );
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/ViewChartAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/ViewChartAction.java 2011-01-27 16:15:25 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/ViewChartAction.java 2011-11-12 18:43:35 +0000
@@ -123,7 +123,7 @@
height = temp.getHeight();
filename = CodecUtils.filenameEncode( temp.getName() );
- log.info( "Viewing chart: " + temp.getTitle() + ", width: " + width + ", height: " + height );
+ log.info( "Viewing chart: " + temp.getName() + ", width: " + width + ", height: " + height );
}
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/ShowUpdateChartGroupFormAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/ShowUpdateChartGroupFormAction.java 2011-07-29 04:06:52 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/ShowUpdateChartGroupFormAction.java 2011-11-12 18:43:35 +0000
@@ -34,7 +34,7 @@
import org.hisp.dhis.chart.Chart;
import org.hisp.dhis.chart.ChartGroup;
import org.hisp.dhis.chart.ChartService;
-import org.hisp.dhis.chart.comparator.ChartTitleComparator;
+import org.hisp.dhis.chart.comparator.ChartNameComparator;
import com.opensymphony.xwork2.Action;
@@ -92,7 +92,7 @@
groupMembers = new ArrayList<Chart>( chartGroup.getMembers() );
- Collections.sort( groupMembers, new ChartTitleComparator() );
+ Collections.sort( groupMembers, new ChartNameComparator() );
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartForm.vm 2011-10-20 11:23:55 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartForm.vm 2011-11-12 18:43:35 +0000
@@ -61,8 +61,8 @@
<th colspan="2">$i18n.getString( "chart" )</th>
</tr>
<tr>
- <td><label for="title">$i18n.getString( "title" )</label></td>
- <td><input type="text" id="title" name="title" style="width:300px" value="$!chart.title"></td>
+ <td><label for="name">$i18n.getString( "title" )</label></td>
+ <td><input type="text" id="name" name="name" style="width:300px" value="$!chart.name"></td>
</tr>
<tr>
<td><label for="domainAxisLabel">$i18n.getString( "domain_axis_label_x" )</label></td>
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chart.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chart.js 2011-10-20 11:23:55 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chart.js 2011-11-12 18:43:35 +0000
@@ -41,7 +41,7 @@
var dataElements = parseInt( json.chart.dataElements );
var dataSets = parseInt( json.chart.dataSets );
- setInnerHTML( 'titleField', json.chart.title );
+ setInnerHTML( 'nameField', json.chart.name );
setInnerHTML( 'dimensionField', json.chart.dimension );
if ( isIndicatorChart( json.chart.dimension ) )
@@ -86,7 +86,7 @@
{
$.postJSON( "validateChart.action", {
id : getFieldValue( "id" ),
- title : getFieldValue( "title" )
+ name : getFieldValue( "name" )
}, function( json )
{
if ( json.response == "input" )
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonChart.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonChart.vm 2011-10-20 11:23:55 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonChart.vm 2011-11-12 18:43:35 +0000
@@ -1,7 +1,7 @@
{ "chart":
{
"id": "$!{chart.id}",
- "title": "$!encoder.jsonEncode( ${chart.title} )",
+ "name": "$!encoder.jsonEncode( ${chart.name} )",
"dimension": "$!encoder.jsonEncode( ${chart.dimension} )",
"indicators": "$!{chart.indicators.size()}",
"dataElements": "$!{chart.dataElements.size()}",
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonCharts.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonCharts.vm 2011-07-21 06:51:02 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonCharts.vm 2011-11-12 18:43:35 +0000
@@ -4,7 +4,7 @@
#set( $groups = $chart.groups )
{
"id": $!{chart.id},
- "name": "$!encoder.jsonEncode( ${chart.title} )",
+ "name": "$!encoder.jsonEncode( ${chart.name} )",
"dimension": "$!encoder.jsonEncode( ${chart.dimension} )",
"indicators": "$!encoder.jsonEncode( ${chart.indicators.size()} )",
"dataElements": "$!encoder.jsonEncode( ${chart.dataElements.size()} )",
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/updateChartGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/updateChartGroupForm.vm 2011-07-21 09:09:42 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/updateChartGroupForm.vm 2011-11-12 18:43:35 +0000
@@ -65,7 +65,7 @@
<td>
<select id="groupMembers" name="groupMembers" multiple="multiple" style="height: 200px; width: 100%; margin-top: 22px;">
#foreach( $chart in $groupMembers )
- <option value="$chart.id">$encoder.htmlEncode( $chart.title )</option>
+ <option value="$chart.id">$encoder.htmlEncode( $chart.name )</option>
#end
</select>
</td>
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewChartForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewChartForm.vm 2011-10-20 11:23:55 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewChartForm.vm 2011-11-12 18:43:35 +0000
@@ -53,12 +53,12 @@
<tbody id="list">
#foreach ( $chart in $charts )
<tr id="tr${chart.id}">
- <td onclick="showChartDetails( $chart.id )">$encoder.htmlEncode( $chart.title )</td>
+ <td onclick="showChartDetails( $chart.id )">$encoder.htmlEncode( $chart.name )</td>
<td style="text-align:right">
<a href="javascript:viewChart( 'viewChart.action?id=$chart.id', '$chart.size' )" title="$i18n.getString( "view_chart" )"><img src="../images/start_process.png" alt="$i18n.getString( "view_chart" )"></a>
<a href="displayAddChartForm.action?id=$chart.id&dimension=$chart.dimension" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( "edit" )"></a>
#if( $auth.hasAccess( "dhis-web-reporting", "removeChart" ) )
- <a href="javascript:removeChart( $chart.id, '$encoder.jsEncode( $chart.title )' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( "remove" )"></a>
+ <a href="javascript:removeChart( $chart.id, '$encoder.jsEncode( $chart.name )' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( "remove" )"></a>
#else <img src="../images/delete-denied.png"> #end
<a href="javascript:showChartDetails( $chart.id )" title="$i18n.getString( "show_details" )"><img src="../images/information.png" alt="$i18n.getString( "show_details" )"></a>
</td>
@@ -74,7 +74,7 @@
<div style="float:right">
<a href="javascript:hideDetails()" title="$i18n.getString( "hide_details" )"><img src="../images/close.png" alt="$i18n.getString( "hide_details" )"></a>
</div>
- <p><label>$i18n.getString( "title" ):</label><br><span id="titleField"></span></p>
+ <p><label>$i18n.getString( "title" ):</label><br><span id="nameField"></span></p>
<p><label>$i18n.getString( "dimension" ):</label><br><span id="dimensionField"></span></p>
<p id='indicatorsView'><label>$i18n.getString( "indicators" ):</label><br><span id="indicatorsField"></span></p>
<p id='dataElementsView'><label>$i18n.getString( "dataelements" ):</label><br><span id="dataElementsField"></span></p>