dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #06706
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1863: Removed outdated code
------------------------------------------------------------
revno: 1863
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Mon 2010-07-19 10:31:42 +0200
message:
Removed outdated code
removed:
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/dataaccess/
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/dataaccess/Dhis20ReportDataAccess.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/dataaccess/ReportDataAccess.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/dataaccess/ReportDataAccessException.java
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/AbstractAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/report/XmlReportStore.java
dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml
--
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-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 2010-07-10 10:42:16 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2010-07-19 08:31:42 +0000
@@ -149,6 +149,14 @@
executeSql( "ALTER TABLE section DROP COLUMN label" );
executeSql( "DROP TABLE sectionmembers" );
+ // set varchar to text
+ executeSql( "ALTER TABLE dataelement ALTER description TYPE text" );
+ executeSql( "ALTER TABLE indicator ALTER description TYPE text" );
+ executeSql( "ALTER TABLE datadictionary ALTER description TYPE text" );
+ executeSql( "ALTER TABLE validationrule ALTER description TYPE text" );
+ executeSql( "ALTER TABLE expression ALTER expression TYPE text" );
+ executeSql( "ALTER TABLE translation ALTER value TYPE text" );
+
log.info( "Tables updated" );
}
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/AbstractAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/AbstractAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/AbstractAction.java 2010-07-19 08:31:42 +0000
@@ -35,7 +35,6 @@
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.oust.manager.SelectionTreeManager;
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
-import org.hisp.dhis.reporting.dataset.dataaccess.ReportDataAccess;
import org.hisp.dhis.reporting.dataset.report.ReportStore;
import org.hisp.dhis.user.CurrentUserService;
import org.hisp.dhis.user.User;
@@ -61,13 +60,6 @@
this.reportStore = reportStore;
}
- protected ReportDataAccess reportDataAccess;
-
- public void setReportDataAccess( ReportDataAccess reportDataAccess )
- {
- this.reportDataAccess = reportDataAccess;
- }
-
protected OrganisationUnitSelectionManager selectionManager;
public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
@@ -331,9 +323,6 @@
{
int organisationUnitId = 0;
- // OrganisationUnit selectedUnit =
- // selectionManager.getSelectedOrganisationUnit();
-
OrganisationUnit selectedUnit = selectionTreeManager.getSelectedOrganisationUnit();
if ( selectedUnit != null )
=== removed directory 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/dataaccess'
=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/dataaccess/Dhis20ReportDataAccess.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/dataaccess/Dhis20ReportDataAccess.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/dataaccess/Dhis20ReportDataAccess.java 1970-01-01 00:00:00 +0000
@@ -1,181 +0,0 @@
-package org.hisp.dhis.reporting.dataset.dataaccess;
-
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Set;
-
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementGroup;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.indicator.Indicator;
-import org.hisp.dhis.indicator.IndicatorGroup;
-import org.hisp.dhis.indicator.IndicatorService;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.system.filter.AggregatableDataElementFilter;
-import org.hisp.dhis.system.util.FilterUtils;
-
-/**
- * @author Lars Helge Overland
- * @version $Id: Dhis20ReportDataAccess.java 5244 2008-05-25 10:42:48Z larshelg $
- */
-public class Dhis20ReportDataAccess
- implements ReportDataAccess
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private OrganisationUnitService organisationUnitService;
-
- public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
- {
- this.organisationUnitService = organisationUnitService;
- }
-
- private IndicatorService indicatorService;
-
- public void setIndicatorService( IndicatorService indicatorService )
- {
- this.indicatorService = indicatorService;
- }
-
- private DataElementService dataElementService;
-
- public void setDataElementService( DataElementService dataElementService )
- {
- this.dataElementService = dataElementService;
- }
-
- // -------------------------------------------------------------------------
- // Dhis 2.0 implementation
- // -------------------------------------------------------------------------
-
- public Collection<DataElement> getAllDataElements()
- throws ReportDataAccessException
- {
- return dataElementService.getAggregateableDataElements();
- }
-
- public Collection<DataElementGroup> getAllDataElementGroups()
- throws ReportDataAccessException
- {
- return dataElementService.getAllDataElementGroups();
- }
-
- public Collection<DataElement> getMembersOfDataElementGroup( int dataElementGroupId )
- throws ReportDataAccessException
- {
- DataElementGroup group = dataElementService.getDataElementGroup( dataElementGroupId );
-
- Set<DataElement> dataElements = group.getMembers();
-
- FilterUtils.filter( dataElements, new AggregatableDataElementFilter() );
-
- return dataElements;
- }
-
- public Collection<Indicator> getAllIndicators()
- throws ReportDataAccessException
- {
- return indicatorService.getAllIndicators();
- }
-
- public Collection<IndicatorGroup> getAllIndicatorGroups()
- throws ReportDataAccessException
- {
- return indicatorService.getAllIndicatorGroups();
- }
-
- public Collection<Indicator> getMembersOfIndicatorGroup( int indicatorGroupId )
- throws ReportDataAccessException
- {
- IndicatorGroup group = indicatorService.getIndicatorGroup( indicatorGroupId );
-
- return group.getMembers();
- }
-
- public String getOrganisationUnitName( int organisationUnitId )
- throws ReportDataAccessException
- {
- OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
- return organisationUnit.getName();
- }
-
- public String getOrganisationUnitShortName( int organisationUnitId )
- throws ReportDataAccessException
- {
- OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
- return organisationUnit.getShortName();
- }
-
- public Collection<Integer> getChildrenOfOrganisationUnit( int organisationUnitId )
- throws ReportDataAccessException
- {
- Collection<Integer> children = new ArrayList<Integer>();
-
- OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
-
- for ( OrganisationUnit child : organisationUnit.getChildren() )
- {
- children.add( child.getId() );
- }
-
- return children;
- }
-
- public String getDataElementName( int dataElementId )
- throws ReportDataAccessException
- {
- DataElement dataElement = dataElementService.getDataElement( dataElementId );
- return dataElement.getName();
- }
-
- public String getDataElementShortName( int dataElementId )
- throws ReportDataAccessException
- {
- DataElement dataElement = dataElementService.getDataElement( dataElementId );
- return dataElement.getShortName();
- }
-
- public String getIndicatorName( int indicatorId )
- throws ReportDataAccessException
- {
- Indicator indicator = indicatorService.getIndicator( indicatorId );
- return indicator.getName();
- }
-
- public String getIndicatorShortName( int indicatorId )
- throws ReportDataAccessException
- {
- Indicator indicator = indicatorService.getIndicator( indicatorId );
- return indicator.getShortName();
- }
-}
=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/dataaccess/ReportDataAccess.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/dataaccess/ReportDataAccess.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/dataaccess/ReportDataAccess.java 1970-01-01 00:00:00 +0000
@@ -1,141 +0,0 @@
-package org.hisp.dhis.reporting.dataset.dataaccess;
-
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.Collection;
-
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementGroup;
-import org.hisp.dhis.indicator.Indicator;
-import org.hisp.dhis.indicator.IndicatorGroup;
-
-/**
- * This layer is responsible for all access to the service layer and should not
- * be short-cut. The reason for inluding this layer is to be able to use other
- * datasources than DHIS 2, eg. DHIS 1.4. Systems wanting to integrate this module
- * can the simply implement this interface.
- *
- * @author Lars Helge Overland
- * @version $Id: ReportDataAccess.java 5244 2008-05-25 10:42:48Z larshelg $
- */
-public interface ReportDataAccess
-{
- String BEAN_ID = ReportDataAccess.class.getName();
-
- /**
- * Retrieves all DataElements.
- * @throws ReportDataAccessException
- */
- Collection<DataElement> getAllDataElements()
- throws ReportDataAccessException;
-
- /**
- * Retrieves all DataElementGroups.
- * @throws ReportDataAccessException
- */
- Collection<DataElementGroup> getAllDataElementGroups()
- throws ReportDataAccessException;
-
- /**
- * Retrieves members of DataElementGroup.
- * @throws ReportDataAccessException
- */
- Collection<DataElement> getMembersOfDataElementGroup( int dataElementGroupId )
- throws ReportDataAccessException;
-
- /**
- * Retrieves all Indicators.
- * @throws ReportDataAccessException
- */
- Collection<Indicator> getAllIndicators()
- throws ReportDataAccessException;
-
- /**
- * Retrieves all IndicatorGroups.
- * @throws ReportDataAccessException
- */
- Collection<IndicatorGroup> getAllIndicatorGroups()
- throws ReportDataAccessException;
-
- /**
- * Retrieves members of IndicatorGroup.
- * @throws ReportDataAccessException
- */
- Collection<Indicator> getMembersOfIndicatorGroup( int indicatorGroupId )
- throws ReportDataAccessException;
-
- /**
- * Gets the name of the Organisation Unit with the given identifier.
- * @throws ReportDataAccessException
- */
- String getOrganisationUnitName( int organisationUnitId )
- throws ReportDataAccessException;
-
- /**
- * Gets the short-name of the Organisation Unit with the given identifier.
- * @throws ReportDataAccessException
- */
- String getOrganisationUnitShortName( int organisationUnitId )
- throws ReportDataAccessException;
-
- /**
- * Gets the children of the Organisation Unit with the given identifer.
- * @throws ReportDataAccessException
- */
- Collection<Integer> getChildrenOfOrganisationUnit( int organisationUnitId )
- throws ReportDataAccessException;
-
- /**
- * Gets the name of the DataElement with the given identifier.
- * @throws ReportDataAccessException
- */
- String getDataElementName( int dataElementId )
- throws ReportDataAccessException;
-
- /**
- * Gets the short name of the DataElement with the given identifier.
- * @throws ReportDataAccessException
- */
- String getDataElementShortName( int dataElementId )
- throws ReportDataAccessException;
-
- /**
- * Gets the name of the Indicator with the given identifier.
- * @throws ReportDataAccessException
- */
- String getIndicatorName( int indicatorId )
- throws ReportDataAccessException;
-
- /**
- * Gets the short name of the Indicator with the given identifier.
- * @throws ReportDataAccessException
- */
- String getIndicatorShortName( int indicatorId )
- throws ReportDataAccessException;
-
-}
=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/dataaccess/ReportDataAccessException.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/dataaccess/ReportDataAccessException.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/dataaccess/ReportDataAccessException.java 1970-01-01 00:00:00 +0000
@@ -1,46 +0,0 @@
-package org.hisp.dhis.reporting.dataset.dataaccess;
-
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @author Lars Helge Overland
- * @version $Id: ReportDataAccessException.java 2869 2007-02-20 14:26:09Z andegje $
- */
-public class ReportDataAccessException
- extends Exception
-{
- public ReportDataAccessException( String message )
- {
- super( message );
- }
-
- public ReportDataAccessException( String message, Throwable cause )
- {
- super( message, cause );
- }
-}
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/report/XmlReportStore.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/report/XmlReportStore.java 2010-05-17 21:05:26 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/report/XmlReportStore.java 2010-07-19 08:31:42 +0000
@@ -46,10 +46,13 @@
import java.util.Iterator;
import java.util.List;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.external.location.LocationManager;
import org.hisp.dhis.external.location.LocationManagerException;
-import org.hisp.dhis.reporting.dataset.dataaccess.ReportDataAccess;
-import org.hisp.dhis.reporting.dataset.dataaccess.ReportDataAccessException;
+import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.indicator.IndicatorService;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.reporting.dataset.utils.FileUtils;
import org.hisp.dhis.reporting.dataset.utils.JRXmlFilter;
import org.hisp.dhis.reporting.dataset.utils.XMLUtils;
@@ -86,11 +89,25 @@
// Dependencies
// -------------------------------------------------------------------------
- private ReportDataAccess reportDataAccess;
-
- public void setReportDataAccess( ReportDataAccess reportDataAccess )
- {
- this.reportDataAccess = reportDataAccess;
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ private DataElementService dataElementService;
+
+ public void setDataElementService( DataElementService dataElementService )
+ {
+ this.dataElementService = dataElementService;
+ }
+
+ private IndicatorService indicatorService;
+
+ public void setIndicatorService( IndicatorService indicatorService )
+ {
+ this.indicatorService = indicatorService;
}
@Autowired
@@ -282,104 +299,98 @@
public void addReportElement( String reportName, String type, int elementId )
throws ReportStoreException, LocationManagerException
{
- try
- {
- reportName = XMLUtils.encode( reportName );
-
- Report report = getReport( reportName );
-
- List<Element> reportElements = report.getReportElements();
-
- String elementName = "";
-
- if ( type.equals( ReportStore.DATAELEMENT ) )
- {
- if ( reportDisplayProperty.equals( NAME ) )
- {
- elementName = reportDataAccess.getDataElementName( elementId );
- }
- else if ( reportDisplayProperty.equals( SHORT_NAME ) )
- {
- elementName = reportDataAccess.getDataElementShortName( elementId );
- }
- }
- else if ( type.equals( ReportStore.INDICATOR ) )
- {
- if ( reportDisplayProperty.equals( NAME ) )
- {
- elementName = reportDataAccess.getIndicatorName( elementId );
- }
- else if ( reportDisplayProperty.equals( SHORT_NAME ) )
- {
- elementName = reportDataAccess.getIndicatorShortName( elementId );
- }
- }
-
- elementName = XMLUtils.encode( elementName );
-
- Element element = new Element( type, elementId, elementName );
-
- reportElements.add( element );
-
- updateReport( reportName, report );
- }
- catch ( ReportDataAccessException ex )
- {
- throw new ReportStoreException( "Failed to retrieve data", ex );
- }
+ reportName = XMLUtils.encode( reportName );
+
+ Report report = getReport( reportName );
+
+ List<Element> reportElements = report.getReportElements();
+
+ String elementName = "";
+
+ if ( type.equals( ReportStore.DATAELEMENT ) )
+ {
+ DataElement dataElement = dataElementService.getDataElement( elementId );
+
+ if ( reportDisplayProperty.equals( NAME ) )
+ {
+ elementName = dataElement.getName();
+ }
+ else if ( reportDisplayProperty.equals( SHORT_NAME ) )
+ {
+ elementName = dataElement.getShortName();
+ }
+ }
+ else if ( type.equals( ReportStore.INDICATOR ) )
+ {
+ Indicator indicator = indicatorService.getIndicator( elementId );
+
+ if ( reportDisplayProperty.equals( NAME ) )
+ {
+ elementName = indicator.getName();
+ }
+ else if ( reportDisplayProperty.equals( SHORT_NAME ) )
+ {
+ elementName = indicator.getShortName();
+ }
+ }
+
+ elementName = XMLUtils.encode( elementName );
+
+ Element element = new Element( type, elementId, elementName );
+
+ reportElements.add( element );
+
+ updateReport( reportName, report );
}
public void addReportElement( String reportName, String type, int elementId, int organisationUnitId )
throws ReportStoreException, LocationManagerException
{
- try
- {
- Report report = getReport( reportName );
-
- List<Element> reportElements = report.getReportElements();
-
- String elementName = "";
-
- if ( type.equals( ReportStore.DATAELEMENT ) )
- {
- if ( reportDisplayProperty.equals( NAME ) )
- {
- elementName = reportDataAccess.getDataElementName( elementId );
- }
- else if ( reportDisplayProperty.equals( SHORT_NAME ) )
- {
- elementName = reportDataAccess.getDataElementShortName( elementId );
- }
- }
- else if ( type.equals( ReportStore.INDICATOR ) )
- {
- if ( reportDisplayProperty.equals( NAME ) )
- {
- elementName = reportDataAccess.getIndicatorName( elementId );
- }
- else if ( reportDisplayProperty.equals( SHORT_NAME ) )
- {
- elementName = reportDataAccess.getIndicatorShortName( elementId );
- }
- }
-
- String organisationUnitName = reportDataAccess.getOrganisationUnitShortName( organisationUnitId );
+ Report report = getReport( reportName );
+
+ List<Element> reportElements = report.getReportElements();
+
+ String elementName = "";
+
+ if ( type.equals( ReportStore.DATAELEMENT ) )
+ {
+ DataElement dataElement = dataElementService.getDataElement( elementId );
+
+ if ( reportDisplayProperty.equals( NAME ) )
+ {
+ elementName = dataElement.getName();
+ }
+ else if ( reportDisplayProperty.equals( SHORT_NAME ) )
+ {
+ elementName = dataElement.getShortName();
+ }
+ }
+ else if ( type.equals( ReportStore.INDICATOR ) )
+ {
+ Indicator indicator = indicatorService.getIndicator( elementId );
+
+ if ( reportDisplayProperty.equals( NAME ) )
+ {
+ elementName = indicator.getName();
+ }
+ else if ( reportDisplayProperty.equals( SHORT_NAME ) )
+ {
+ elementName = indicator.getShortName();
+ }
+ }
+
+ String organisationUnitName = organisationUnitService.getOrganisationUnit( organisationUnitId ).getShortName();
- elementName = XMLUtils.encode( elementName );
-
- organisationUnitName = XMLUtils.encode( organisationUnitName );
-
- OrgUnitSpecificElement element = new OrgUnitSpecificElement( type, elementId, elementName,
- organisationUnitId, organisationUnitName );
-
- reportElements.add( element );
-
- updateReport( reportName, report );
- }
- catch ( ReportDataAccessException ex )
- {
- throw new ReportStoreException( "Failed to retrieve data", ex );
- }
+ elementName = XMLUtils.encode( elementName );
+
+ organisationUnitName = XMLUtils.encode( organisationUnitName );
+
+ OrgUnitSpecificElement element = new OrgUnitSpecificElement( type, elementId, elementName,
+ organisationUnitId, organisationUnitName );
+
+ reportElements.add( element );
+
+ updateReport( reportName, report );
}
public void removeReportElement( String reportName, String id )
@@ -485,58 +496,53 @@
public void addChartElement( String reportName, String type, int elementId )
throws ReportStoreException, LocationManagerException
{
- try
- {
- reportName = XMLUtils.encode( reportName );
-
- Report report = getReport( reportName );
-
- List<Element> chartElements = report.getChartElements();
-
- String elementName = "";
-
- if ( type.equals( ReportStore.DATAELEMENT ) )
- {
- if ( reportDisplayProperty.equals( NAME ) )
- {
- elementName = reportDataAccess.getDataElementName( elementId );
- }
- else if ( reportDisplayProperty.equals( SHORT_NAME ) )
- {
- elementName = reportDataAccess.getDataElementShortName( elementId );
- }
- }
- else if ( type.equals( ReportStore.INDICATOR ) )
- {
- if ( reportDisplayProperty.equals( NAME ) )
- {
- elementName = reportDataAccess.getIndicatorName( elementId );
- }
- else if ( reportDisplayProperty.equals( SHORT_NAME ) )
- {
- elementName = reportDataAccess.getIndicatorShortName( elementId );
- }
- }
-
- elementName = XMLUtils.encode( elementName );
-
- Element element = new Element( type, elementId, elementName );
-
- chartElements.add( element );
-
- updateReport( reportName, report );
- }
- catch ( ReportDataAccessException ex )
- {
- throw new ReportStoreException( "Failed to retrieve data", ex );
- }
+ reportName = XMLUtils.encode( reportName );
+
+ Report report = getReport( reportName );
+
+ List<Element> chartElements = report.getChartElements();
+
+ String elementName = "";
+
+ if ( type.equals( ReportStore.DATAELEMENT ) )
+ {
+ DataElement dataElement = dataElementService.getDataElement( elementId );
+
+ if ( reportDisplayProperty.equals( NAME ) )
+ {
+ elementName = dataElement.getName();
+ }
+ else if ( reportDisplayProperty.equals( SHORT_NAME ) )
+ {
+ elementName = dataElement.getShortName();
+ }
+ }
+ else if ( type.equals( ReportStore.INDICATOR ) )
+ {
+ Indicator indicator = indicatorService.getIndicator( elementId );
+
+ if ( reportDisplayProperty.equals( NAME ) )
+ {
+ elementName = indicator.getName();
+ }
+ else if ( reportDisplayProperty.equals( SHORT_NAME ) )
+ {
+ elementName = indicator.getShortName();
+ }
+ }
+
+ elementName = XMLUtils.encode( elementName );
+
+ Element element = new Element( type, elementId, elementName );
+
+ chartElements.add( element );
+
+ updateReport( reportName, report );
}
public void addChartElement( String reportName, String type, int elementId, int organisationUnitId )
throws ReportStoreException, LocationManagerException
{
- try
- {
reportName = XMLUtils.encode( reportName );
Report report = getReport( reportName );
@@ -547,29 +553,33 @@
if ( type.equals( ReportStore.DATAELEMENT ) )
{
+ DataElement dataElement = dataElementService.getDataElement( elementId );
+
if ( reportDisplayProperty.equals( NAME ) )
{
- elementName = reportDataAccess.getDataElementName( elementId );
+ elementName = dataElement.getName();
}
else if ( reportDisplayProperty.equals( SHORT_NAME ) )
{
- elementName = reportDataAccess.getDataElementShortName( elementId );
+ elementName = dataElement.getShortName();
}
}
else if ( type.equals( ReportStore.INDICATOR ) )
{
+ Indicator indicator = indicatorService.getIndicator( elementId );
+
if ( reportDisplayProperty.equals( NAME ) )
{
- elementName = reportDataAccess.getIndicatorName( elementId );
+ elementName = indicator.getName();
}
else if ( reportDisplayProperty.equals( SHORT_NAME ) )
{
- elementName = reportDataAccess.getIndicatorShortName( elementId );
+ elementName = indicator.getShortName();
}
}
-
- String organisationUnitName = reportDataAccess.getOrganisationUnitShortName( organisationUnitId );
-
+
+ String organisationUnitName = organisationUnitService.getOrganisationUnit( organisationUnitId ).getShortName();
+
elementName = XMLUtils.encode( elementName );
organisationUnitName = XMLUtils.encode( organisationUnitName );
@@ -580,11 +590,6 @@
chartElements.add( element );
updateReport( reportName, report );
- }
- catch ( ReportDataAccessException ex )
- {
- throw new ReportStoreException( "Failed to retrieve data", ex );
- }
}
public void removeChartElement( String reportName, String id )
@@ -745,5 +750,3 @@
return report.getChartTemplate();
}
}
-
-
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml 2010-07-04 23:55:46 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml 2010-07-19 08:31:42 +0000
@@ -408,19 +408,6 @@
<!-- Custom DataSet Report -->
- <!-- DataAccess -->
-
- <bean id="org.hisp.dhis.reporting.dataset.dataaccess.ReportDataAccess"
- class="org.hisp.dhis.reporting.dataset.dataaccess.Dhis20ReportDataAccess"
- scope="prototype">
- <property name="organisationUnitService"
- ref ="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
- <property name="indicatorService"
- ref="org.hisp.dhis.indicator.IndicatorService"/>
- <property name="dataElementService"
- ref="org.hisp.dhis.dataelement.DataElementService"/>
- </bean>
-
<!-- Selection State -->
<bean id="org.hisp.dhis.reporting.dataset.state.SelectedStateManager"
@@ -438,8 +425,12 @@
<bean id="org.hisp.dhis.reporting.dataset.report.ReportStore"
class="org.hisp.dhis.reporting.dataset.report.XmlReportStore"
scope="prototype">
- <property name="reportDataAccess"
- ref="org.hisp.dhis.reporting.dataset.dataaccess.ReportDataAccess"/>
+ <property name="organisationUnitService"
+ ref ="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
+ <property name="indicatorService"
+ ref="org.hisp.dhis.indicator.IndicatorService"/>
+ <property name="dataElementService"
+ ref="org.hisp.dhis.dataelement.DataElementService"/>
<property name="reportDisplayProperty" value="name"/>
</bean>