dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #25411
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12603: Removed various export-to-pdf functions in lists, simply did not work at all. Will reimplement wi...
------------------------------------------------------------
revno: 12603
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2013-10-13 18:15:28 +0200
message:
Removed various export-to-pdf functions in lists, simply did not work at all. Will reimplement with web api later.
removed:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/pdf/
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/pdf/ExportToPdfAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/pdf/
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/pdf/ExportToPdfAction.java
dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/pdf/
dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/pdf/ExportToPdfAction.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationResult.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElement.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicator.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnit.vm
dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/validationRule.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/validation/ValidationResult.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationResult.java 2013-10-13 09:59:35 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationResult.java 2013-10-13 16:15:28 +0000
@@ -183,9 +183,7 @@
public int compareTo( ValidationResult other )
{
- int result;
-
- result = source.getName().compareTo( other.source.getName() );
+ int result = source.getName().compareTo( other.source.getName() );
if ( result != 0 )
{
@@ -234,14 +232,14 @@
return result;
}
- result = ( int ) Math.signum( Math.round( 100.0 * leftsideValue ) - Math.round( 100.0 * other.leftsideValue ) );
+ result = (int) Math.signum( Math.round( 100.0 * leftsideValue ) - Math.round( 100.0 * other.leftsideValue ) );
if ( result != 0 )
{
return result;
}
- result = ( int ) Math.signum( Math.round( 100.0 * rightsideValue ) - Math.round( 100.0 * other.rightsideValue ) );
+ result = (int) Math.signum( Math.round( 100.0 * rightsideValue ) - Math.round( 100.0 * other.rightsideValue ) );
if ( result != 0 )
{
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java 2013-10-13 09:59:35 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java 2013-10-13 16:15:28 +0000
@@ -451,7 +451,8 @@
// Find out which users receive alerts, and which ValidationRules they
// receive alerts for.
- HashMap<User, Collection<ValidationRule>> userRulesMap = new HashMap<User, Collection<ValidationRule>>();
+ Map<User, Collection<ValidationRule>> userRulesMap = new HashMap<User, Collection<ValidationRule>>();
+
for ( ValidationRuleGroup validationRuleGroup : getAllValidationRuleGroups() )
{
Collection<UserAuthorityGroup> userRolesToAlert = validationRuleGroup.getUserAuthorityGroupsToAlert();
=== removed directory 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/pdf'
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/pdf/ExportToPdfAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/pdf/ExportToPdfAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/pdf/ExportToPdfAction.java 1970-01-01 00:00:00 +0000
@@ -1,245 +0,0 @@
-package org.hisp.dhis.dd.action.pdf;
-
-/*
- * Copyright (c) 2004-2013, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import static org.apache.commons.lang.StringUtils.isNotBlank;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.common.ServiceProvider;
-import org.hisp.dhis.datadictionary.DataDictionaryService;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.i18n.I18n;
-import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.importexport.ExportParams;
-import org.hisp.dhis.importexport.ExportService;
-import org.hisp.dhis.indicator.Indicator;
-import org.hisp.dhis.indicator.IndicatorService;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class ExportToPdfAction
- implements Action
-{
- private static final Log log = LogFactory.getLog( ExportToPdfAction.class );
-
- private static final String EXPORT_FORMAT_PDF = "PDF";
-
- private static final String TYPE_DATAELEMENT = "dataElement";
-
- private static final String TYPE_INDICATOR = "indicator";
-
- private static final String FILENAME_DATAELEMENT = "DataElements.zip";
-
- private static final String FILENAME_INDICATOR = "Indicators.zip";
-
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private DataElementService dataElementService;
-
- public void setDataElementService( DataElementService dataElementService )
- {
- this.dataElementService = dataElementService;
- }
-
- private DataDictionaryService dataDictionaryService;
-
- public void setDataDictionaryService( DataDictionaryService dataDictionaryService )
- {
- this.dataDictionaryService = dataDictionaryService;
- }
-
- private IndicatorService indicatorService;
-
- public void setIndicatorService( IndicatorService indicatorService )
- {
- this.indicatorService = indicatorService;
- }
-
- private ServiceProvider<ExportService> serviceProvider;
-
- public void setServiceProvider( ServiceProvider<ExportService> serviceProvider )
- {
- this.serviceProvider = serviceProvider;
- }
-
- private I18n i18n;
-
- public void setI18n( I18n i18n )
- {
- this.i18n = i18n;
- }
-
- private I18nFormat format;
-
- public void setFormat( I18nFormat format )
- {
- this.format = format;
- }
-
- // -------------------------------------------------------------------------
- // Output
- // -------------------------------------------------------------------------
-
- private InputStream inputStream;
-
- public InputStream getInputStream()
- {
- return inputStream;
- }
-
- private String fileName;
-
- public String getFileName()
- {
- return fileName;
- }
-
- // -------------------------------------------------------------------------
- // Input
- // -------------------------------------------------------------------------
-
- private Integer dataDictionaryId;
-
- public void setDataDictionaryId( Integer dataDictionaryId )
- {
- this.dataDictionaryId = dataDictionaryId;
- }
-
- private String curKey;
-
- public void setCurKey( String curKey )
- {
- this.curKey = curKey;
- }
-
- private String type;
-
- public void setType( String type )
- {
- this.type = type;
- }
-
- // -------------------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------------------
-
- public String execute()
- throws Exception
- {
- if ( type != null )
- {
- ExportParams params = new ExportParams();
-
- if ( type.equals( TYPE_DATAELEMENT ) )
- {
- List<DataElement> dataElements = null;
-
- if ( isNotBlank( curKey ) ) // Filter on key only if set
- {
- dataElements = new ArrayList<DataElement>( dataElementService.searchDataElementsByName( curKey ) );
- }
- else if ( dataDictionaryId != null && dataDictionaryId != -1 )
- {
- dataElements = new ArrayList<DataElement>( dataDictionaryService
- .getDataElementsByDictionaryId( dataDictionaryId ) );
- }
- else
- {
- dataElements = new ArrayList<DataElement>( dataElementService.getAllDataElements() );
- }
-
- if ( !dataElements.isEmpty() )
- {
- params.setDataElementObjects( dataElements );
- }
- else
- {
- params.setDataElementObjects( null );
- }
-
- fileName = FILENAME_DATAELEMENT;
-
- log.info( "Exporting to PDF for object type: " + TYPE_DATAELEMENT );
- }
- else if ( type.equals( TYPE_INDICATOR ) )
- {
- List<Indicator> indicators = null;
-
- if ( isNotBlank( curKey ) ) // Filter on key only if set
- {
- indicators = new ArrayList<Indicator>( indicatorService.getIndicatorsLikeName( curKey ) );
- }
- else if ( dataDictionaryId != null && dataDictionaryId != -1 )
- {
- indicators = new ArrayList<Indicator>( dataDictionaryService.getDataDictionary( dataDictionaryId )
- .getIndicators() );
- }
- else
- {
- indicators = new ArrayList<Indicator>( indicatorService.getAllIndicators() );
- }
-
- if ( !indicators.isEmpty() )
- {
- params.setIndicatorObjects( indicators );
- }
- else
- {
- params.setIndicatorObjects( null );
- }
-
- fileName = FILENAME_INDICATOR;
-
- log.info( "Exporting to PDF for object type: " + TYPE_INDICATOR );
- }
-
- params.setIncludeDataValues( false );
- params.setI18n( i18n );
- params.setFormat( format );
-
- ExportService exportService = serviceProvider.provide( EXPORT_FORMAT_PDF );
-
- inputStream = exportService.exportData( params );
- }
-
- return SUCCESS;
- }
-}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml 2013-08-12 08:56:50 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml 2013-10-13 16:15:28 +0000
@@ -514,16 +514,6 @@
<property name="dataElementCategoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
</bean>
- <!-- PDF -->
-
- <bean id="org.hisp.dhis.dd.action.pdf.ExportToPdfAction" class="org.hisp.dhis.dd.action.pdf.ExportToPdfAction"
- scope="prototype">
- <property name="serviceProvider" ref="exportServiceProvider" />
- <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
- <property name="dataDictionaryService" ref="org.hisp.dhis.datadictionary.DataDictionaryService" />
- <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
- </bean>
-
<!-- Validate CategoryOption -->
<bean id="org.hisp.dhis.dd.action.category.ValidateDataElementCategoryOptionAction" class="org.hisp.dhis.dd.action.category.ValidateDataElementCategoryOptionAction"
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml 2013-07-25 09:37:43 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml 2013-10-13 16:15:28 +0000
@@ -677,17 +677,6 @@
<param name="requiredAuthorities">F_DATAELEMENT_DELETE</param>
</action>
- <!-- PDF -->
-
- <action name="exportToPdf" class="org.hisp.dhis.dd.action.pdf.ExportToPdfAction">
- <result name="success" type="stream">
- <param name="contentType">application/zip</param>
- <param name="inputName">inputStream</param>
- <param name="contentDisposition">filename="${fileName}"</param>
- <param name="bufferSize">10240</param>
- </result>
- </action>
-
<!-- Validate CategoryOption -->
<action name="validateDataElementCategoryOption" class="org.hisp.dhis.dd.action.category.ValidateDataElementCategoryOptionAction">
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElement.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElement.vm 2013-10-10 15:32:40 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElement.vm 2013-10-13 16:15:28 +0000
@@ -47,8 +47,7 @@
</div>
</td>
<td style="text-align:right">
- <input type="button" value="$i18n.getString( 'get_pdf' )" onclick="exportPDF( 'dataElement' );" style="width:80px"/>
- <input type="button" value="$i18n.getString( 'sort' )" onclick="window.location.href='showSortDataElementForm.action'" style="width:80px"/>
+ <input type="button" value="$i18n.getString( 'sort' )" onclick="window.location.href='showSortDataElementForm.action'" style="width:80px"/>
#if ( $!dataDictionaryMode && $dataDictionaryMode == "extended" )
<input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddExtendedDataElementForm.action'" style="width:80px"/>
#else
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicator.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicator.vm 2013-06-29 14:16:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicator.vm 2013-10-13 16:15:28 +0000
@@ -34,8 +34,7 @@
</div>
</td>
<td style="text-align:right">
- <input type="button" value="$i18n.getString( 'get_pdf' )" onclick="exportPDF( 'indicator' );" style="width:80px"/>
- <input type="button" value="$i18n.getString( 'sort' )" onclick="window.location.href='showSortIndicatorForm.action'" style="width:80px"/>
+ <input type="button" value="$i18n.getString( 'sort' )" onclick="window.location.href='showSortIndicatorForm.action'" style="width:80px"/>
#if ( $dataDictionaryMode == "extended" )
<input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddExtendedIndicatorForm.action'" style="width:80px"/>
#else
=== removed directory 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/pdf'
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/pdf/ExportToPdfAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/pdf/ExportToPdfAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/pdf/ExportToPdfAction.java 1970-01-01 00:00:00 +0000
@@ -1,201 +0,0 @@
-package org.hisp.dhis.oum.action.pdf;
-
-/*
- * Copyright (c) 2004-2013, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import static org.apache.commons.lang.StringUtils.isNotBlank;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.common.ServiceProvider;
-import org.hisp.dhis.i18n.I18n;
-import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.importexport.ExportParams;
-import org.hisp.dhis.importexport.ExportService;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Dang Duy Hieu
- * @version $Id$
- */
-public class ExportToPdfAction
- implements Action
-{
- private static final Log log = LogFactory.getLog( ExportToPdfAction.class );
-
- private static final String EXPORT_FORMAT_PDF = "PDF";
-
- private static final String TYPE_ORGANISATIONUNIT = "organisationUnit";
-
- private static final String FILENAME_ORGANISATIONUNIT = "Organisationunits.zip";
-
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private OrganisationUnitService organisationUnitService;
-
- public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
- {
- this.organisationUnitService = organisationUnitService;
- }
-
- private OrganisationUnitSelectionManager selectionManager;
-
- public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
- {
- this.selectionManager = selectionManager;
- }
-
- private ServiceProvider<ExportService> serviceProvider;
-
- public void setServiceProvider( ServiceProvider<ExportService> serviceProvider )
- {
- this.serviceProvider = serviceProvider;
- }
-
- private I18n i18n;
-
- public void setI18n( I18n i18n )
- {
- this.i18n = i18n;
- }
-
- private I18nFormat format;
-
- public void setFormat( I18nFormat format )
- {
- this.format = format;
- }
-
- // -------------------------------------------------------------------------
- // Output
- // -------------------------------------------------------------------------
-
- private InputStream inputStream;
-
- public InputStream getInputStream()
- {
- return inputStream;
- }
-
- private String fileName;
-
- public String getFileName()
- {
- return fileName;
- }
-
- // -------------------------------------------------------------------------
- // Input
- // -------------------------------------------------------------------------
-
- private String curKey;
-
- public void setCurKey( String curKey )
- {
- this.curKey = curKey;
- }
-
- private String type;
-
- public void setType( String type )
- {
- this.type = type;
- }
-
- // -------------------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------------------
-
- public String execute()
- throws Exception
- {
- if ( type != null )
- {
- ExportParams params = new ExportParams();
-
- if ( type.equals( TYPE_ORGANISATIONUNIT ) )
- {
- List<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>();
-
- Collection<OrganisationUnit> selectedUnits = selectionManager.getSelectedOrganisationUnits();
-
- if ( selectedUnits.isEmpty() )
- {
- organisationUnits.addAll( selectionManager.getRootOrganisationUnits() );
- }
- else
- {
- for ( OrganisationUnit selectedUnit : selectedUnits )
- {
- organisationUnits.addAll( selectedUnit.getChildren() );
- }
- }
-
- if ( isNotBlank( curKey ) )
- {
- organisationUnitService.searchOrganisationUnitByName( organisationUnits, curKey );
- }
-
- if ( !organisationUnits.isEmpty() )
- {
- params.setOrganisationUnitObjects( organisationUnits );
- }
- else
- {
- params.setOrganisationUnitObjects( null );
- }
-
- fileName = FILENAME_ORGANISATIONUNIT;
-
- log.info( "Exporting to PDF for object type: " + TYPE_ORGANISATIONUNIT );
- }
-
- params.setIncludeDataValues( false );
- params.setI18n( i18n );
- params.setFormat( format );
-
- ExportService exportService = serviceProvider.provide( EXPORT_FORMAT_PDF );
-
- inputStream = exportService.exportData( params );
- }
-
- return SUCCESS;
- }
-
-}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/META-INF/dhis/beans.xml 2013-02-28 05:58:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/META-INF/dhis/beans.xml 2013-10-13 16:15:28 +0000
@@ -66,15 +66,6 @@
<property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
</bean>
- <!-- PDF -->
-
- <bean id="org.hisp.dhis.oum.action.pdf.ExportToPdfAction" class="org.hisp.dhis.oum.action.pdf.ExportToPdfAction"
- scope="prototype">
- <property name="serviceProvider" ref="exportServiceProvider" />
- <property name="selectionManager" ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
- <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
- </bean>
-
<!-- OrganisationUnitGroup -->
<bean id="org.hisp.dhis.oum.action.organisationunitgroup.ShowAddOrganisationUnitGroupFormAction" class="org.hisp.dhis.oum.action.organisationunitgroup.ShowAddOrganisationUnitGroupFormAction">
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/struts.xml 2013-10-10 15:32:40 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/struts.xml 2013-10-13 16:15:28 +0000
@@ -71,17 +71,6 @@
<param name="requiredAuthorities">F_ORGANISATIONUNIT_DELETE</param>
</action>
- <!-- PDF -->
-
- <action name="exportToPdf" class="org.hisp.dhis.oum.action.pdf.ExportToPdfAction">
- <result name="success" type="stream">
- <param name="contentType">application/zip</param>
- <param name="inputName">inputStream</param>
- <param name="contentDisposition">filename="${fileName}"</param>
- <param name="bufferSize">10240</param>
- </result>
- </action>
-
<!-- OrganisationUnitGroup -->
<action name="organisationUnitGroup" class="org.hisp.dhis.oum.action.organisationunitgroup.GetOrganisationUnitGroupListAction">
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnit.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnit.vm 2013-10-10 15:32:40 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnit.vm 2013-10-13 16:15:28 +0000
@@ -18,7 +18,6 @@
<tr>
<td>#filterDiv( "organisationUnit" )</td>
<td colspan="3" style="text-align:right">
- <input type="button" value="$i18n.getString( 'get_pdf' )" onclick="exportPDF( 'organisationUnit' );" style="width:80px"/>
<input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddOrganisationUnitForm.action'"/>
</td>
</tr>
=== removed directory 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/pdf'
=== removed file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/pdf/ExportToPdfAction.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/pdf/ExportToPdfAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/pdf/ExportToPdfAction.java 1970-01-01 00:00:00 +0000
@@ -1,181 +0,0 @@
-package org.hisp.dhis.validationrule.action.pdf;
-
-/*
- * Copyright (c) 2004-2013, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import static org.apache.commons.lang.StringUtils.isNotBlank;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.common.ServiceProvider;
-import org.hisp.dhis.i18n.I18n;
-import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.importexport.ExportParams;
-import org.hisp.dhis.importexport.ExportService;
-import org.hisp.dhis.validation.ValidationRule;
-import org.hisp.dhis.validation.ValidationRuleService;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Dang Duy Hieu
- * @version $Id$
- */
-public class ExportToPdfAction
- implements Action
-{
- private static final Log log = LogFactory.getLog( ExportToPdfAction.class );
-
- private static final String EXPORT_FORMAT_PDF = "PDF";
-
- private static final String TYPE_VALIDATION_RULE = "validationRule";
-
- private static final String FILENAME_VALIDATION_RULE = "ValidationRules.zip";
-
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private ServiceProvider<ExportService> serviceProvider;
-
- public void setServiceProvider( ServiceProvider<ExportService> serviceProvider )
- {
- this.serviceProvider = serviceProvider;
- }
-
- private ValidationRuleService validationRuleService;
-
- public void setValidationRuleService( ValidationRuleService validationRuleService )
- {
- this.validationRuleService = validationRuleService;
- }
-
- private I18n i18n;
-
- public void setI18n( I18n i18n )
- {
- this.i18n = i18n;
- }
-
- private I18nFormat format;
-
- public void setFormat( I18nFormat format )
- {
- this.format = format;
- }
-
- // -------------------------------------------------------------------------
- // Input & Output
- // -------------------------------------------------------------------------
-
- private List<ValidationRule> validationRulesList;
-
- private String type;
-
- public void setType( String type )
- {
- this.type = type;
- }
-
- private String curKey;
-
- public void setCurKey( String curKey )
- {
- this.curKey = curKey;
- }
-
- // -------------------------------------------------------------------------
- // Output
- // -------------------------------------------------------------------------
-
- private InputStream inputStream;
-
- public InputStream getInputStream()
- {
- return inputStream;
- }
-
- private String fileName;
-
- public String getFileName()
- {
- return fileName;
- }
-
- // -------------------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------------------
-
- public String execute()
- throws Exception
- {
- if ( type != null )
- {
- ExportParams params = new ExportParams();
-
- if ( type.equals( TYPE_VALIDATION_RULE ) )
- {
- if ( isNotBlank( curKey ) ) // Filter on key only if set
- {
- validationRulesList = new ArrayList<ValidationRule>( validationRuleService.getValidationRulesByName( curKey ) );
- }
- else
- {
- validationRulesList = new ArrayList<ValidationRule>( validationRuleService.getAllValidationRules() );
- }
-
- if ( (validationRulesList != null) && !validationRulesList.isEmpty() )
- {
- params.setValidationRuleObjects( validationRulesList );
- }
- else
- {
- params.setValidationRuleObjects( null );
- }
-
- fileName = FILENAME_VALIDATION_RULE;
-
- log.info( "Exporting to PDF for object type: " + TYPE_VALIDATION_RULE );
- }
-
- params.setIncludeDataValues( false );
- params.setI18n( i18n );
- params.setFormat( format );
-
- ExportService exportService = serviceProvider.provide( EXPORT_FORMAT_PDF );
-
- inputStream = exportService.exportData( params );
- }
-
- return SUCCESS;
- }
-}
=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/META-INF/dhis/beans.xml 2013-10-08 17:20:57 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/META-INF/dhis/beans.xml 2013-10-13 16:15:28 +0000
@@ -208,12 +208,5 @@
scope="prototype">
<property name="selectionTreeManager" ref="org.hisp.dhis.oust.manager.SelectionTreeManager" />
</bean>
- <!-- PDF -->
-
- <bean id="org.hisp.dhis.validationrule.action.pdf.ExportToPdfAction" class="org.hisp.dhis.validationrule.action.pdf.ExportToPdfAction"
- scope="prototype">
- <property name="serviceProvider" ref="exportServiceProvider" />
- <property name="validationRuleService" ref="org.hisp.dhis.validation.ValidationRuleService" />
- </bean>
</beans>
=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/struts.xml 2013-09-24 11:23:59 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/struts.xml 2013-10-13 16:15:28 +0000
@@ -216,16 +216,5 @@
<result name="pdf" type="gridPdfResult" />
</action>
- <!-- PDF -->
-
- <action name="exportToPdf" class="org.hisp.dhis.validationrule.action.pdf.ExportToPdfAction">
- <result name="success" type="stream">
- <param name="contentType">application/zip</param>
- <param name="inputName">inputStream</param>
- <param name="contentDisposition">filename="${fileName}"</param>
- <param name="bufferSize">10240</param>
- </result>
- </action>
-
</package>
</struts>
=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/validationRule.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/validationRule.vm 2013-10-08 19:10:40 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/validationRule.vm 2013-10-13 16:15:28 +0000
@@ -52,7 +52,6 @@
<tr>
<td>#filterDiv( "validationRule" )</td>
<td style="text-align:right">
- <input type="button" value="$i18n.getString( 'get_pdf' )" onclick="exportPDF( 'validationRule' );" style="width:140px"/>
<input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddValidationRuleForm.action'">
</td>
</tr>