=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/SpringDataValueSetStore.java' --- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/SpringDataValueSetStore.java 2012-04-13 20:09:02 +0000 +++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/SpringDataValueSetStore.java 2012-04-13 22:28:40 +0000 @@ -30,7 +30,6 @@ import static org.hisp.dhis.system.util.ConversionUtils.getIdentifiers; import static org.hisp.dhis.system.util.DateUtils.getMediumDateString; import static org.hisp.dhis.system.util.TextUtils.getCommaDelimitedString; -import static org.hisp.dhis.system.util.TextUtils.ifNotNull; import java.io.OutputStream; import java.util.Collection; @@ -69,10 +68,10 @@ SqlRowSet rowSet = jdbcTemplate.queryForRowSet( getDataValueSql( dataElements, periods, orgUnits ) ); DataValueSet dataValueSet = new StreamingDataValueSet( writer ); - dataValueSet.setDataSet( ifNotNull( dataSet, dataSet.getUid() ) ); + dataValueSet.setDataSet( dataSet != null ? dataSet.getUid() : null ); dataValueSet.setCompleteDate( getMediumDateString( completeDate ) ); - dataValueSet.setPeriod( ifNotNull( period, period.getIsoDate() ) ); - dataValueSet.setOrgUnit( ifNotNull( orgUnit, orgUnit.getUid() ) ); + dataValueSet.setPeriod( period != null ? period.getIsoDate() : null ); + dataValueSet.setOrgUnit( orgUnit != null ? orgUnit.getUid() : null ); while ( rowSet.next() ) { === modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/TextUtils.java' --- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/TextUtils.java 2012-04-13 10:21:57 +0000 +++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/TextUtils.java 2012-04-13 22:28:40 +0000 @@ -74,19 +74,7 @@ return matcher.appendTail( buffer ).toString(); } - - /** - * Returns the value argument if the object argument is not null, null otherwise. - * - * @param object the object. - * @param value the value. - * @return the value or null. - */ - public static T ifNotNull( Object object, T value ) - { - return object != null ? value: null; - } - + /** * Gets the sub string of the given string. If the beginIndex is larger than * the length of the string, the empty string is returned. If the beginIndex + === modified file 'dhis-2/dhis-web/dhis-web-importexport/pom.xml' --- dhis-2/dhis-web/dhis-web-importexport/pom.xml 2012-02-20 12:01:56 +0000 +++ dhis-2/dhis-web/dhis-web-importexport/pom.xml 2012-04-13 22:28:40 +0000 @@ -38,6 +38,10 @@ dhis-service-administration + javax.servlet + servlet-api + + org.hisp.dhis dhis-web-commons === added file 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue/ExportDataValueAction.java' --- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue/ExportDataValueAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue/ExportDataValueAction.java 2012-04-13 22:28:40 +0000 @@ -0,0 +1,138 @@ +package org.hisp.dhis.importexport.action.datavalue; + +/* + * Copyright (c) 2004-2012, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of the HISP project nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +import static org.hisp.dhis.system.util.DateUtils.getMediumDate; +import static org.hisp.dhis.system.util.CodecUtils.filenameEncode; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts2.ServletActionContext; +import org.hisp.dhis.dxf2.datavalueset.DataValueSetService; +import org.hisp.dhis.organisationunit.OrganisationUnit; +import org.hisp.dhis.organisationunit.OrganisationUnitService; +import org.hisp.dhis.oust.manager.SelectionTreeManager; +import org.hisp.dhis.util.ContextUtils; +import org.springframework.beans.factory.annotation.Autowired; + +import com.opensymphony.xwork2.Action; + +/** + * @author Lars Helge Overland + */ +public class ExportDataValueAction + implements Action +{ + private final static String FILE_PREFIX = "Export"; + private final static String FILE_SEPARATOR = "_"; + private final static String FILE_EXTENSION = ".xml"; + + @Autowired + private SelectionTreeManager selectionTreeManager; + + @Autowired + private OrganisationUnitService organisationUnitService; + + @Autowired + private DataValueSetService dataValueSetService; + + // ------------------------------------------------------------------------- + // Input + // ------------------------------------------------------------------------- + + private Set selectedDataSets; + + public void setSelectedDataSets( Set selectedDataSets ) + { + this.selectedDataSets = selectedDataSets; + } + + private String startDate; + + public void setStartDate( String startDate ) + { + this.startDate = startDate; + } + + private String endDate; + + public void setEndDate( String endDate ) + { + this.endDate = endDate; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + public String execute() + throws Exception + { + Set orgUnits = new HashSet(); + + for ( OrganisationUnit unit : selectionTreeManager.getReloadedSelectedOrganisationUnits() ) + { + Collection children = organisationUnitService.getOrganisationUnitWithChildren( unit.getId() ); + + for ( OrganisationUnit child : children ) + { + orgUnits.add( child.getUid() ); + } + } + + HttpServletResponse response = ServletActionContext.getResponse(); + + ContextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_XML, true, getFileName(), true ); + + dataValueSetService.writeDataValueSet( selectedDataSets, getMediumDate( startDate ), getMediumDate( endDate ), orgUnits, response.getOutputStream() ); + + return SUCCESS; + } + + // ------------------------------------------------------------------------- + // Supportive methods + // ------------------------------------------------------------------------- + + private String getFileName() + { + String fileName = FILE_PREFIX + FILE_SEPARATOR + startDate + FILE_SEPARATOR + endDate; + + if ( selectionTreeManager.getSelectedOrganisationUnits().size() == 1 ) + { + fileName += FILE_SEPARATOR + filenameEncode( selectionTreeManager.getSelectedOrganisationUnits().iterator().next().getShortName() ); + } + + fileName += FILE_EXTENSION; + + return fileName; + } +} === removed file 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/exp/DataValueExportAction.java' --- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/exp/DataValueExportAction.java 2012-04-13 10:21:57 +0000 +++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/exp/DataValueExportAction.java 1970-01-01 00:00:00 +0000 @@ -1,291 +0,0 @@ -package org.hisp.dhis.importexport.action.exp; - -/* - * Copyright (c) 2004-2012, University of Oslo - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of the HISP project nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -import static org.hisp.dhis.system.util.ConversionUtils.getIdentifiers; -import static org.hisp.dhis.system.util.ConversionUtils.getIntegerCollection; -import static org.hisp.dhis.system.util.DateUtils.getMediumDate; -import static org.hisp.dhis.system.util.DateUtils.getMediumDateString; -import static org.hisp.dhis.system.util.CodecUtils.filenameEncode; - -import java.io.InputStream; -import java.util.Collection; - -import org.hisp.dhis.common.ServiceProvider; -import org.hisp.dhis.dataelement.DataElement; -import org.hisp.dhis.dataset.DataSetService; -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.oust.manager.SelectionTreeManager; -import org.hisp.dhis.period.Period; -import org.hisp.dhis.period.PeriodService; -import org.hisp.dhis.system.util.ConversionUtils; - -import com.opensymphony.xwork2.Action; - -/** - * @author Lars Helge Overland - * @version $Id$ - */ -public class DataValueExportAction - implements Action -{ - private final static String FILE_EXTENSION = ".zip"; - private final static String FILE_PREFIX = "Export"; - private final static String FILE_SEPARATOR = "_"; - - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private SelectionTreeManager selectionTreeManager; - - public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager ) - { - this.selectionTreeManager = selectionTreeManager; - } - - private ServiceProvider serviceProvider; - - public void setServiceProvider( ServiceProvider serviceProvider ) - { - this.serviceProvider = serviceProvider; - } - - private DataSetService dataSetService; - - public void setDataSetService( DataSetService dataSetService ) - { - this.dataSetService = dataSetService; - } - - private PeriodService periodService; - - public void setPeriodService( PeriodService periodService ) - { - this.periodService = periodService; - } - - private OrganisationUnitService organisationUnitService; - - public void setOrganisationUnitService( OrganisationUnitService organisationUnitService ) - { - this.organisationUnitService = organisationUnitService; - } - - // ------------------------------------------------------------------------- - // Output - // ------------------------------------------------------------------------- - - private InputStream inputStream; - - public InputStream getInputStream() - { - return inputStream; - } - - private String fileName; - - public String getFileName() - { - return fileName; - } - - // ------------------------------------------------------------------------- - // Input - // ------------------------------------------------------------------------- - - private String exportFormat; - - public String getExportFormat() - { - return exportFormat; - } - - public void setExportFormat( String exportFormat ) - { - this.exportFormat = exportFormat; - } - - private boolean aggregatedData; - - public void setAggregatedData( boolean aggregatedData ) - { - this.aggregatedData = aggregatedData; - } - - private boolean excludeChildren; - - public void setExcludeChildren( boolean excludeChildren ) - { - this.excludeChildren = excludeChildren; - } - - private int dataSourceLevel; - - public void setDataSourceLevel( int dataSourceLevel ) - { - this.dataSourceLevel = dataSourceLevel; - } - - private String startDate; - - public void setStartDate( String startDate ) - { - this.startDate = startDate; - } - - private String endDate; - - public void setEndDate( String endDate ) - { - this.endDate = endDate; - } - - private Collection selectedDataSets; - - public void setSelectedDataSets( Collection selectedDataSets ) - { - this.selectedDataSets = selectedDataSets; - } - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - public String execute() - throws Exception - { - ExportParams params = new ExportParams(); - - // --------------------------------------------------------------------- - // Get DataElements - // --------------------------------------------------------------------- - - if ( selectedDataSets != null ) - { - params.setCategories( null ); - params.setCategoryCombos( null ); - params.setCategoryOptions( null ); - params.setCategoryOptionCombos( null ); - - params.setDataSets( getIntegerCollection( selectedDataSets ) ); - - params.setDataElements( getIdentifiers( DataElement.class, dataSetService.getDistinctDataElements( params.getDataSets() ) ) ); - } - - // --------------------------------------------------------------------- - // Get Periods - // --------------------------------------------------------------------- - - if ( startDate != null && startDate.trim().length() > 0 && endDate != null && endDate.trim().length() > 0 ) - { - params.setStartDate( getMediumDate( startDate ) ); - params.setEndDate( getMediumDate( endDate ) ); - - params.setPeriods( getIdentifiers( Period.class, - periodService.getIntersectingPeriods( getMediumDate( startDate ), getMediumDate( endDate ) ) ) ); - } - - // --------------------------------------------------------------------- - // Get OrganisationUnit - // --------------------------------------------------------------------- - - Collection selectedUnits = selectionTreeManager.getReloadedSelectedOrganisationUnits(); - - if ( selectedUnits != null ) - { - if ( aggregatedData ) - { - for ( OrganisationUnit unit : selectedUnits ) - { - params.getOrganisationUnits().addAll( ConversionUtils.getIdentifiers( OrganisationUnit.class, - organisationUnitService.getOrganisationUnitsAtLevel( dataSourceLevel, unit ) ) ); - } - } - else - { - for ( OrganisationUnit unit : selectedUnits ) - { - if ( excludeChildren ) - { - params.getOrganisationUnits().add( unit.getId() ); - } - else - { - params.getOrganisationUnits().addAll( ConversionUtils.getIdentifiers( OrganisationUnit.class, - organisationUnitService.getOrganisationUnitWithChildren( unit.getId() ) ) ); - } - } - } - } - - params.setIncludeDataValues( true ); - params.setIncludeCompleteDataSetRegistrations( true ); - params.setAggregatedData( aggregatedData ); - - // --------------------------------------------------------------------- - // Export - // --------------------------------------------------------------------- - - ExportService exportService = serviceProvider.provide( exportFormat ); - - inputStream = exportService.exportData( params ); - - fileName = getFileName( params ); - - return SUCCESS; - } - - // ------------------------------------------------------------------------- - // Supportive methods - // ------------------------------------------------------------------------- - - private String getFileName( ExportParams params ) - { - String fileName = FILE_PREFIX + FILE_SEPARATOR + - getMediumDateString( getMediumDate( startDate ) ) + FILE_SEPARATOR + - getMediumDateString( getMediumDate( endDate ) ); - - if ( selectionTreeManager.getSelectedOrganisationUnits().size() == 1 ) - { - fileName += FILE_SEPARATOR + filenameEncode( selectionTreeManager.getSelectedOrganisationUnits().iterator().next().getShortName() ); - } - - if ( params.getDataSets().size() == 1 ) - { - fileName += FILE_SEPARATOR + filenameEncode( dataSetService.getDataSet( params.getDataSets().iterator().next() ).getName() ); - } - - fileName += FILE_EXTENSION; - - return fileName; - } -} === removed file 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/exp/GetExportOptionsAction.java' --- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/exp/GetExportOptionsAction.java 2011-12-26 10:07:59 +0000 +++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/exp/GetExportOptionsAction.java 1970-01-01 00:00:00 +0000 @@ -1,118 +0,0 @@ -package org.hisp.dhis.importexport.action.exp; - -/* - * Copyright (c) 2004-2012, University of Oslo - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of the HISP project nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -import java.util.ArrayList; -import java.util.List; - -import org.hisp.dhis.dataset.DataSet; -import org.hisp.dhis.dataset.DataSetService; -import org.hisp.dhis.organisationunit.OrganisationUnitLevel; -import org.hisp.dhis.organisationunit.OrganisationUnitService; -import org.hisp.dhis.oust.manager.SelectionTreeManager; - -import com.opensymphony.xwork2.Action; - -/** - * @author Lars Helge Overland - * @version $Id: GetOptionsAction.java 2869 2007-02-20 14:26:09Z andegje $ - */ -public class GetExportOptionsAction - implements Action -{ - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private DataSetService dataSetService; - - public void setDataSetService( DataSetService dataSetService ) - { - this.dataSetService = dataSetService; - } - - private SelectionTreeManager selectionTreeManager; - - public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager ) - { - this.selectionTreeManager = selectionTreeManager; - } - - private OrganisationUnitService organisationUnitService; - - public void setOrganisationUnitService( OrganisationUnitService organisationUnitService ) - { - this.organisationUnitService = organisationUnitService; - } - - // ------------------------------------------------------------------------- - // Output - // ------------------------------------------------------------------------- - - private String exportFormat; - - public String getExportFormat() - { - return exportFormat; - } - - public void setExportFormat( String format ) - { - this.exportFormat = format; - } - - private List dataSets; - - public List getDataSets() - { - return dataSets; - } - - private List levels; - - public List getLevels() - { - return levels; - } - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - public String execute() - throws Exception - { - selectionTreeManager.clearSelectedOrganisationUnits(); - - dataSets = new ArrayList( dataSetService.getAllDataSets() ); - - levels = new ArrayList( organisationUnitService.getOrganisationUnitLevels() ); - - return SUCCESS; - } -} === removed file 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/exp/GetExportStatusAction.java' --- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/exp/GetExportStatusAction.java 2011-12-26 10:07:59 +0000 +++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/exp/GetExportStatusAction.java 1970-01-01 00:00:00 +0000 @@ -1,112 +0,0 @@ -package org.hisp.dhis.importexport.action.exp; - -/* - * Copyright (c) 2004-2012, University of Oslo - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of the HISP project nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -import static org.hisp.dhis.util.InternalProcessUtil.*; - -import org.amplecode.cave.process.ProcessCoordinator; -import org.amplecode.cave.process.ProcessExecutor; -import org.amplecode.cave.process.state.MessageState; -import org.hisp.dhis.i18n.I18n; - -import com.opensymphony.xwork2.Action; - -/** - * @author Lars Helge Overland - * @version $Id$ - */ -public class GetExportStatusAction - implements Action -{ - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private ProcessCoordinator processCoordinator; - - public void setProcessCoordinator( ProcessCoordinator processCoordinator ) - { - this.processCoordinator = processCoordinator; - } - - private I18n i18n; - - public void setI18n( I18n i18n ) - { - this.i18n = i18n; - } - - // ------------------------------------------------------------------------- - // Output - // ------------------------------------------------------------------------- - - private String statusMessage = new String(); - - public String getStatusMessage() - { - return statusMessage; - } - - private boolean finished = false; - - public boolean getFinished() - { - return finished; - } - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - public String execute() - { - if ( processIsRunning( PROCESS_KEY_EXPORT ) ) - { - String id = getCurrentRunningProcess( PROCESS_KEY_EXPORT ); - - ProcessExecutor executor = processCoordinator.getProcess( id ); - - if ( executor != null && executor.getProcess() != null && executor.getState() != null ) - { - MessageState state = (MessageState) executor.getState(); - - statusMessage = i18n.getString( state.getMessage() ); - - finished = state.isEnded(); - } - } - else - { - statusMessage = i18n.getString( "no_process_running" ); - - finished = false; - } - - return SUCCESS; - } -} === modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-importexport/src/main/resources/META-INF/dhis/beans.xml 2012-04-11 20:16:18 +0000 +++ dhis-2/dhis-web/dhis-web-importexport/src/main/resources/META-INF/dhis/beans.xml 2012-04-13 22:28:40 +0000 @@ -11,6 +11,10 @@ + + + + - - - - - - - - - - - - - - - - - - === modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/resources/struts.xml' --- dhis-2/dhis-web/dhis-web-importexport/src/main/resources/struts.xml 2012-04-11 20:16:18 +0000 +++ dhis-2/dhis-web/dhis-web-importexport/src/main/resources/struts.xml 2012-04-13 22:28:40 +0000 @@ -33,6 +33,19 @@ plainTextError + + + + /main.vm + /dhis-web-importexport/exportDataValueForm.vm + /dhis-web-importexport/mainMenu.vm + ../dhis-web-commons/oust/oust.js,javascript/export.js + + + + + + @@ -157,13 +170,6 @@ javascript/detailedExport.js - - /main.vm - /dhis-web-importexport/exportDataValueForm.vm - /dhis-web-importexport/mainMenu.vm - ../dhis-web-commons/oust/oust.js,javascript/export.js - - application/zip @@ -182,20 +188,6 @@ - - - application/zip - inputStream - filename="${fileName}" - 10240 - - - - - /dhis-web-importexport/responseExportStatus.vm - plainTextError - - /dhis-web-importexport/responseDataElements.vm plainTextError === modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/exportDataValueForm.vm' --- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/exportDataValueForm.vm 2012-03-07 10:32:33 +0000 +++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/exportDataValueForm.vm 2012-04-13 22:28:40 +0000 @@ -5,34 +5,38 @@ selectionTreeSelection.setMultipleSelectionAllowed( true ); selectionTree.clearSelectedOrganisationUnits(); selectionTree.buildSelectionTree(); + + jQuery("#availableDataSets").dhisAjaxSelect({ + source: "../api/dataSets.json?links=false&paging=false", + iterator: "dataSets", + connectedTo: 'selectedDataSets', + handler: function(item) { + var option = jQuery("