dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #22033
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10556: Cleanup. Removed DXF1 data value import-export.
------------------------------------------------------------
revno: 10556
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-04-15 17:12:27 +0200
message:
Cleanup. Removed DXF1 data value import-export.
removed:
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataValueConverter.java
dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf/DXFImportServiceTest.java
modified:
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DXFConverter.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/exporter/DefaultDXFExportService.java
dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataSet.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataSetList.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/OptionSet.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/Patient.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/Program.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/OptionSet.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Program.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/ProgramStage.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Section.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DXFConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DXFConverter.java 2013-01-05 15:22:55 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DXFConverter.java 2013-04-15 15:12:27 +0000
@@ -37,7 +37,6 @@
import org.amplecode.staxwax.writer.XMLWriter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.aggregation.AggregatedDataValueService;
import org.hisp.dhis.cache.HibernateCacheManager;
import org.hisp.dhis.chart.ChartService;
import org.hisp.dhis.common.ProcessState;
@@ -58,11 +57,9 @@
import org.hisp.dhis.dataset.CompleteDataSetRegistration;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.datavalue.DataValue;
import org.hisp.dhis.expression.ExpressionService;
import org.hisp.dhis.importexport.ExportParams;
import org.hisp.dhis.importexport.GroupMemberAssociation;
-import org.hisp.dhis.importexport.ImportDataValue;
import org.hisp.dhis.importexport.ImportObjectService;
import org.hisp.dhis.importexport.ImportParams;
import org.hisp.dhis.importexport.XMLConverter;
@@ -95,10 +92,8 @@
import org.hisp.dhis.jdbc.batchhandler.DataSetBatchHandler;
import org.hisp.dhis.jdbc.batchhandler.DataSetMemberBatchHandler;
import org.hisp.dhis.jdbc.batchhandler.DataSetSourceAssociationBatchHandler;
-import org.hisp.dhis.jdbc.batchhandler.DataValueBatchHandler;
import org.hisp.dhis.jdbc.batchhandler.GroupSetBatchHandler;
import org.hisp.dhis.jdbc.batchhandler.GroupSetMemberBatchHandler;
-import org.hisp.dhis.jdbc.batchhandler.ImportDataValueBatchHandler;
import org.hisp.dhis.jdbc.batchhandler.IndicatorBatchHandler;
import org.hisp.dhis.jdbc.batchhandler.IndicatorGroupBatchHandler;
import org.hisp.dhis.jdbc.batchhandler.IndicatorGroupMemberBatchHandler;
@@ -265,13 +260,6 @@
this.chartService = chartService;
}
- private AggregatedDataValueService aggregatedDataValueService;
-
- public void setAggregatedDataValueService( AggregatedDataValueService aggregatedDataValueService )
- {
- this.aggregatedDataValueService = aggregatedDataValueService;
- }
-
private BatchHandlerFactory batchHandlerFactory;
public void setBatchHandlerFactory( BatchHandlerFactory batchHandlerFactory )
@@ -1009,32 +997,6 @@
log.info( "Imported CompleteDataSetRegistrations" );
}
- else if ( reader.isStartElement( DataValueConverter.COLLECTION_NAME ) && params.isDataValues() )
- {
- log.debug("Starting DataValues import");
-
- state.setMessage( "importing_data_values" );
-
- BatchHandler<DataValue> batchHandler = batchHandlerFactory.createBatchHandler(
- DataValueBatchHandler.class ).init();
- BatchHandler<ImportDataValue> importDataValueBatchHandler = batchHandlerFactory.createBatchHandler(
- ImportDataValueBatchHandler.class ).init();
-
- XMLConverter converter = new DataValueConverter( batchHandler, importDataValueBatchHandler,
- aggregatedDataValueService, importObjectService, params, objectMappingGenerator
- .getDataElementMapping( params.skipMapping() ), objectMappingGenerator.getPeriodMapping( params
- .skipMapping() ), objectMappingGenerator.getOrganisationUnitMapping( params.skipMapping() ),
- objectMappingGenerator.getCategoryOptionComboMapping( params.skipMapping() ) );
-
- converterInvoker.invokeRead( converter, reader, params );
-
- batchHandler.flush();
-
- importDataValueBatchHandler.flush();
-
- log.info( "Imported DataValues" );
- }
-
}
if ( params.isAnalysis() )
=== removed file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataValueConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataValueConverter.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataValueConverter.java 1970-01-01 00:00:00 +0000
@@ -1,203 +0,0 @@
-package org.hisp.dhis.importexport.dxf.converter;
-
-/*
- * 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.Collection;
-import java.util.Map;
-
-import org.amplecode.quick.BatchHandler;
-import org.amplecode.quick.StatementManager;
-import org.amplecode.staxwax.reader.XMLReader;
-import org.amplecode.staxwax.writer.XMLWriter;
-import org.hisp.dhis.aggregation.AggregatedDataValueService;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.datavalue.DataValue;
-import org.hisp.dhis.datavalue.DeflatedDataValue;
-import org.hisp.dhis.importexport.ExportParams;
-import org.hisp.dhis.importexport.ImportDataValue;
-import org.hisp.dhis.importexport.ImportObjectService;
-import org.hisp.dhis.importexport.ImportParams;
-import org.hisp.dhis.importexport.XMLConverter;
-import org.hisp.dhis.importexport.importer.DataValueImporter;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.period.PeriodService;
-import org.hisp.dhis.system.util.DateUtils;
-
-/**
- * @author Lars Helge Overland
- * @version $Id: DataValueConverter.java 6455 2008-11-24 08:59:37Z larshelg $
- */
-public class DataValueConverter
- extends DataValueImporter implements XMLConverter
-{
- public static final String COLLECTION_NAME = "dataValues";
- public static final String ELEMENT_NAME = "dataValue";
-
- private static final String FIELD_DATAELEMENT = "dataElement";
- private static final String FIELD_PERIOD = "period";
- private static final String FIELD_SOURCE = "source";
- private static final String FIELD_VALUE = "value";
- private static final String FIELD_STOREDBY = "storedBy";
- private static final String FIELD_TIMESTAMP = "timeStamp";
- private static final String FIELD_COMMENT = "comment";
- private static final String FIELD_CATEGORY_OPTION_COMBO = "categoryOptionCombo";
-
- // -------------------------------------------------------------------------
- // Properties
- // -------------------------------------------------------------------------
-
- private StatementManager statementManager;
-
- private PeriodService periodService;
-
- private Map<Object, Integer> dataElementMapping;
- private Map<Object, Integer> periodMapping;
- private Map<Object, Integer> sourceMapping;
- private Map<Object, Integer> categoryOptionComboMapping;
-
- // -------------------------------------------------------------------------
- // Constructor
- // -------------------------------------------------------------------------
-
- /**
- * Constructor for write operations.
- */
- public DataValueConverter( AggregatedDataValueService aggregatedDataValueService,
- StatementManager statementManager,
- PeriodService periodService )
- {
- this.aggregatedDataValueService = aggregatedDataValueService;
- this.statementManager = statementManager;
- this.periodService = periodService;
- }
-
- /**
- * Constructor for read operations.
- */
- public DataValueConverter( BatchHandler<DataValue> batchHandler,
- BatchHandler<ImportDataValue> importDataValueBatchHandler,
- AggregatedDataValueService aggregatedDataValueService,
- ImportObjectService importObjectService,
- ImportParams params,
- Map<Object, Integer> dataElementMapping,
- Map<Object, Integer> periodMapping,
- Map<Object, Integer> sourceMapping,
- Map<Object, Integer> categoryOptionComboMapping )
- {
- this.batchHandler = batchHandler;
- this.importDataValueBatchHandler = importDataValueBatchHandler;
- this.aggregatedDataValueService = aggregatedDataValueService;
- this.importObjectService = importObjectService;
- this.params = params;
- this.dataElementMapping = dataElementMapping;
- this.periodMapping = periodMapping;
- this.sourceMapping = sourceMapping;
- this.categoryOptionComboMapping = categoryOptionComboMapping;
- }
-
- // -------------------------------------------------------------------------
- // XMLConverter implementation
- // -------------------------------------------------------------------------
-
- public void write( XMLWriter writer, ExportParams params )
- {
- if ( params.isIncludeDataValues() )
- {
- if ( params.getStartDate() != null && params.getEndDate() != null )
- {
- Collection<DeflatedDataValue> values = null;
-
- Collection<Period> periods = periodService.getIntersectingPeriods( params.getStartDate(), params.getEndDate() );
-
- statementManager.initialise();
-
- writer.openElement( COLLECTION_NAME );
-
- for ( final Integer element : params.getDataElements() )
- {
- for ( final Period period : periods )
- {
- values = aggregatedDataValueService.getDeflatedDataValues( element, period.getId(), params.getOrganisationUnits() );
-
- for ( final DeflatedDataValue value : values )
- {
- writer.writeElement( ELEMENT_NAME, EMPTY,
- FIELD_DATAELEMENT, String.valueOf( value.getDataElementId() ),
- FIELD_PERIOD, String.valueOf( value.getPeriodId() ),
- FIELD_SOURCE, String.valueOf( value.getSourceId() ),
- FIELD_VALUE, value.getValue(),
- FIELD_STOREDBY, value.getStoredBy(),
- FIELD_TIMESTAMP, DateUtils.getMediumDateString( value.getTimestamp() ),
- FIELD_COMMENT, value.getComment(),
- FIELD_CATEGORY_OPTION_COMBO, String.valueOf( value.getCategoryOptionComboId() ) );
- }
- }
- }
-
- writer.closeElement();
-
- statementManager.destroy();
- }
- }
- }
-
- public void read( XMLReader reader, ImportParams params )
- {
- while ( reader.moveToStartElement( ELEMENT_NAME, COLLECTION_NAME ) )
- {
- final Map<String, String> values = reader.readElements( ELEMENT_NAME );
-
- final DataValue value = new DataValue();
-
- final DataElement element = new DataElement();
- value.setDataElement( element );
-
- final Period period = new Period();
- value.setPeriod( period );
-
- final OrganisationUnit source = new OrganisationUnit();
- value.setSource( source );
-
- final DataElementCategoryOptionCombo categoryOptionCombo = new DataElementCategoryOptionCombo();
- value.setOptionCombo( categoryOptionCombo );
-
- value.getDataElement().setId( dataElementMapping.get( Integer.parseInt( values.get( FIELD_DATAELEMENT ) ) ) );
- value.getPeriod().setId( periodMapping.get( Integer.parseInt( values.get( FIELD_PERIOD ) ) ) );
- value.getSource().setId( sourceMapping.get( Integer.parseInt( values.get( FIELD_SOURCE ) ) ) );
- value.setValue( values.get( FIELD_VALUE ) );
- value.setStoredBy( values.get( FIELD_STOREDBY ) );
- value.setTimestamp( DateUtils.getMediumDate( values.get( FIELD_TIMESTAMP ) ) );
- value.setComment( values.get( FIELD_COMMENT ) );
- value.getOptionCombo().setId( categoryOptionComboMapping.get( Integer.parseInt( values.get( FIELD_CATEGORY_OPTION_COMBO ) ) ) );
-
- importObject( value, params );
- }
- }
-}
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/exporter/DefaultDXFExportService.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/exporter/DefaultDXFExportService.java 2012-03-29 21:52:27 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/exporter/DefaultDXFExportService.java 2013-04-15 15:12:27 +0000
@@ -42,11 +42,9 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
-import org.amplecode.quick.StatementManager;
import org.amplecode.staxwax.factory.XMLFactory;
import org.amplecode.staxwax.writer.XMLWriter;
import org.hibernate.SessionFactory;
-import org.hisp.dhis.aggregation.AggregatedDataValueService;
import org.hisp.dhis.chart.ChartService;
import org.hisp.dhis.concept.ConceptService;
import org.hisp.dhis.constant.ConstantService;
@@ -58,7 +56,6 @@
import org.hisp.dhis.importexport.ExportParams;
import org.hisp.dhis.importexport.ExportPipeThread;
import org.hisp.dhis.importexport.ExportService;
-import org.hisp.dhis.importexport.dxf.converter.AggregatedDataValueConverter;
import org.hisp.dhis.importexport.dxf.converter.CategoryCategoryOptionAssociationConverter;
import org.hisp.dhis.importexport.dxf.converter.CategoryComboCategoryAssociationConverter;
import org.hisp.dhis.importexport.dxf.converter.ChartConverter;
@@ -80,7 +77,6 @@
import org.hisp.dhis.importexport.dxf.converter.DataSetConverter;
import org.hisp.dhis.importexport.dxf.converter.DataSetMemberConverter;
import org.hisp.dhis.importexport.dxf.converter.DataSetSourceAssociationConverter;
-import org.hisp.dhis.importexport.dxf.converter.DataValueConverter;
import org.hisp.dhis.importexport.dxf.converter.GroupSetConverter;
import org.hisp.dhis.importexport.dxf.converter.GroupSetMemberConverter;
import org.hisp.dhis.importexport.dxf.converter.IndicatorConverter;
@@ -127,13 +123,6 @@
this.sessionFactory = sessionFactory;
}
- private StatementManager statementManager;
-
- public void setStatementManager( StatementManager statementManager )
- {
- this.statementManager = statementManager;
- }
-
private ConceptService conceptService;
public void setConceptService( ConceptService conceptService )
@@ -240,13 +229,6 @@
this.completeDataSetRegistrationService = completeDataSetRegistrationService;
}
- private AggregatedDataValueService aggregatedDataValueService;
-
- public void setAggregatedDataValueService( AggregatedDataValueService aggregatedDataValueService )
- {
- this.aggregatedDataValueService = aggregatedDataValueService;
- }
-
// -------------------------------------------------------------------------
// ExportService implementation
// -------------------------------------------------------------------------
@@ -337,10 +319,6 @@
thread.registerXMLConverter( new CompleteDataSetRegistrationConverter( completeDataSetRegistrationService,
dataSetService, organisationUnitService, periodService ) );
- thread.registerXMLConverter( params.isAggregatedData() ? new AggregatedDataValueConverter(
- aggregatedDataValueService, dataSetService, periodService ) : new DataValueConverter(
- aggregatedDataValueService, statementManager, periodService ) );
-
thread.start();
// -----------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml 2012-12-14 13:46:47 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml 2013-04-15 15:12:27 +0000
@@ -190,7 +190,6 @@
<property name="reportTableService" ref="org.hisp.dhis.reporttable.ReportTableService" />
<property name="chartService" ref="org.hisp.dhis.chart.ChartService" />
<property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
- <property name="aggregatedDataValueService" ref="org.hisp.dhis.aggregation.AggregatedDataValueService" />
<property name="batchHandlerFactory" ref="batchHandlerFactory" />
<property name="objectMappingGenerator" ref="org.hisp.dhis.importexport.mapping.ObjectMappingGenerator" />
<property name="converterInvoker" ref="org.hisp.dhis.importexport.invoker.ConverterInvoker" />
@@ -223,7 +222,6 @@
<bean id="org.hisp.dhis.importexport.DXFExportService" class="org.hisp.dhis.importexport.dxf.exporter.DefaultDXFExportService">
<property name="sessionFactory" ref="sessionFactory" />
- <property name="statementManager" ref="statementManager" />
<property name="conceptService" ref="org.hisp.dhis.concept.ConceptService" />
<property name="constantService" ref="org.hisp.dhis.constant.ConstantService" />
<property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
@@ -239,7 +237,6 @@
<property name="reportTableService" ref="org.hisp.dhis.reporttable.ReportTableService" />
<property name="chartService" ref="org.hisp.dhis.chart.ChartService" />
<property name="completeDataSetRegistrationService" ref="org.hisp.dhis.dataset.CompleteDataSetRegistrationService" />
- <property name="aggregatedDataValueService" ref="org.hisp.dhis.aggregation.AggregatedDataValueService" />
</bean>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
=== removed file 'dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf/DXFImportServiceTest.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf/DXFImportServiceTest.java 2012-11-20 17:04:08 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf/DXFImportServiceTest.java 1970-01-01 00:00:00 +0000
@@ -1,576 +0,0 @@
-package org.hisp.dhis.importexport.dxf;
-
-/*
- * 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.junit.Assert.assertEquals;
-import static org.apache.commons.io.IOUtils.copy;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.hisp.dhis.DhisTest;
-import org.hisp.dhis.datadictionary.DataDictionaryService;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryService;
-import org.hisp.dhis.dataelement.DataElementGroup;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.datavalue.DataValue;
-import org.hisp.dhis.datavalue.DataValueService;
-import org.hisp.dhis.expression.ExpressionService;
-import org.hisp.dhis.external.location.LocationManager;
-import org.hisp.dhis.external.location.LocationManagerException;
-import org.hisp.dhis.importexport.GroupMemberType;
-import org.hisp.dhis.importexport.ImportDataValueService;
-import org.hisp.dhis.importexport.ImportObjectService;
-import org.hisp.dhis.importexport.ImportObjectStatus;
-import org.hisp.dhis.importexport.ImportParams;
-import org.hisp.dhis.importexport.ImportService;
-import org.hisp.dhis.importexport.ImportStrategy;
-import org.hisp.dhis.importexport.util.ImportExportUtils;
-import org.hisp.dhis.indicator.Indicator;
-import org.hisp.dhis.indicator.IndicatorGroup;
-import org.hisp.dhis.indicator.IndicatorService;
-import org.hisp.dhis.indicator.IndicatorType;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.validation.ValidationRule;
-import org.hisp.dhis.validation.ValidationRuleService;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * <p>dxfA.zip contains 3 objects of each meta-data type.</p>
- *
- * <p>dxfB.zip contains 5 objects of each meta-data type.</p>
- *
- * <p>dxfC.zip contains 5 objects of each meta-data type with variations in properties in 3 of them, except for one-property objects.</p>
- *
- * <p>dxfD.zip contains 2 objects of type DataElement, Period, and OrganisationUnit and 8 DataValues registered for all combinations.
- *
- * <p>dxfE.zip contains 3 DataElements, 2 Periods, and 2 OrganisationUnits and 12 DataValues registered for all combinations.
- *
- * <p>dxfF.zip contains 3 DataElements with variations in properties in 2 of them, 2 Periods, and 2 OrganisationUnits and 12 DataValues registered for all combinations.
- *
- * <p>dxfG.zip contains 3 DataElements, 2 Periods, and 2 OrganisationUnits and 12 DataValues registered for all combinations with "20" as value instead of "10".
- *
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class DXFImportServiceTest
- extends DhisTest
-{
- private final int dataASize = 3;
-
- private final int dataBSize = 5;
-
- private final int dataCSize = 5;
-
- private ImportService importService;
-
- private InputStream inputStreamA;
-
- private InputStream inputStreamAx;
-
- private InputStream inputStreamAz;
-
- private InputStream inputStreamB;
-
- private InputStream inputStreamC;
-
- private InputStream inputStreamD;
-
- private InputStream inputStreamE;
-
- private InputStream inputStreamF;
-
- private InputStream inputStreamG;
-
- private InputStream inputStreamH;
-
- private InputStream inputStreamTransforms;
-
- private InputStream inputStreamSimpleXsl;
-
- private InputStream inputStreamExcelx;
-
- private InputStream inputStreamSdmx;
-
- private InputStream inputStreamXL2DXF;
-
- private InputStream inputStreamSdmxCross2DXF;
-
- private final static String TRANSFORMS = "transforms.xml";
-
- private final static String SIMPLEXSL = "changeroot.xsl";
-
- private final static String XL2DXF = "xl2dxf.xsl";
-
- private final static String SDMXCROSS2DXF = "cross2dxf.xsl";
-
- private ImportObjectService importObjectService;
-
- private ImportDataValueService importDataValueService;
-
- private LocationManager locationManager;
-
- // -------------------------------------------------------------------------
- // Fixture
- // -------------------------------------------------------------------------
-
- @Override
- public void setUpTest() throws LocationManagerException, IOException
- {
- ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
-
- inputStreamA = classLoader.getResourceAsStream( "dxfA.zip" );
- inputStreamAx = classLoader.getResourceAsStream( "dxfA.xml" );
- inputStreamAz = classLoader.getResourceAsStream( "dxfA.xml.gz" );
- inputStreamB = classLoader.getResourceAsStream( "dxfB.xml" );
- inputStreamC = classLoader.getResourceAsStream( "dxfC.xml" );
- inputStreamD = classLoader.getResourceAsStream( "dxfD.xml" );
- inputStreamE = classLoader.getResourceAsStream( "dxfE.xml" );
- inputStreamF = classLoader.getResourceAsStream( "dxfF.xml" );
- inputStreamG = classLoader.getResourceAsStream( "dxfG.xml" );
- inputStreamH = classLoader.getResourceAsStream( "changeroot.xml" );
- inputStreamExcelx = classLoader.getResourceAsStream( "orgunits.xlsx" );
- inputStreamSdmx = classLoader.getResourceAsStream( "sdmx_cross.zip" );
-
- inputStreamTransforms = classLoader.getResourceAsStream( TRANSFORMS );
- inputStreamSimpleXsl = classLoader.getResourceAsStream( SIMPLEXSL );
- inputStreamXL2DXF = classLoader.getResourceAsStream( XL2DXF );
- inputStreamSdmxCross2DXF = classLoader.getResourceAsStream( SDMXCROSS2DXF );
-
- importService = (ImportService) getBean( "org.hisp.dhis.importexport.ImportService" );
-
- categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID );
-
- dataElementService = (DataElementService) getBean( DataElementService.ID );
-
- dataDictionaryService = (DataDictionaryService) getBean( DataDictionaryService.ID );
-
- indicatorService = (IndicatorService) getBean( IndicatorService.ID );
-
- dataSetService = (DataSetService) getBean( DataSetService.ID );
-
- organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
-
- organisationUnitGroupService = (OrganisationUnitGroupService) getBean( OrganisationUnitGroupService.ID );
-
- dataValueService = (DataValueService) getBean( DataValueService.ID );
-
- validationRuleService = (ValidationRuleService) getBean( ValidationRuleService.ID );
-
- expressionService = (ExpressionService) getBean( ExpressionService.ID );
-
- importObjectService = (ImportObjectService) getBean( ImportObjectService.ID );
-
- importDataValueService = (ImportDataValueService) getBean( ImportDataValueService.ID );
-
- locationManager = (LocationManager) getBean( "locationManager" );
-
- setExternalTestDir( locationManager );
-
- // horrible hack to copy some files into external test dir
- File extDir = null;
- extDir = locationManager.getFileForWriting( "." );
- if ( ( extDir != null ) && ( extDir.isDirectory() ) )
- {
- OutputStream transforms = null;
- OutputStream simplexsl = null;
- OutputStream xl2dxf = null;
- OutputStream cross2dxf = null;
- String transformPath = extDir.getPath() + "/transform";
- String metadataPath = extDir.getPath() + "/metadata";
- File transformDir = new File( transformPath );
- File metadataDir = new File( metadataPath );
- transformDir.mkdir();
- metadataDir.mkdir();
- transforms = new FileOutputStream( transformPath + "/" + TRANSFORMS );
- simplexsl = new FileOutputStream( transformPath + "/" + SIMPLEXSL );
- xl2dxf = new FileOutputStream( transformPath + "/" + XL2DXF );
- cross2dxf = new FileOutputStream( transformPath + "/" + SDMXCROSS2DXF );
- copy( inputStreamTransforms, transforms );
- copy( inputStreamSimpleXsl, simplexsl );
- copy( inputStreamXL2DXF, xl2dxf );
- copy( inputStreamSdmxCross2DXF, cross2dxf );
- transforms.close();
- simplexsl.close();
- }
- }
-
- @Override
- public void tearDownTest()
- throws Exception
- {
- inputStreamA.close();
- inputStreamAx.close();
- inputStreamAz.close();
- inputStreamB.close();
- inputStreamC.close();
- inputStreamD.close();
- inputStreamE.close();
- inputStreamF.close();
- inputStreamH.close();
- inputStreamSdmx.close();
- inputStreamTransforms.close();
- inputStreamSimpleXsl.close();
-
- // clean up the mess ...
- //removeExternalTestDir();
- }
-
- @Override
- public boolean emptyDatabaseAfterTest()
- {
- return true;
- }
-
- // -------------------------------------------------------------------------
- // Tests
- // -------------------------------------------------------------------------
- // TODO Improve test on duplicate GroupMemberAssociations
-
- @Test
- public void testSimpleImportWithTransform() throws Exception
- {
- ImportParams importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, false, false, false );
-
- importService.importData( importParams, inputStreamH );
-
- assertEquals( categoryService.getAllDataElementCategoryOptions().size(), 5 );
- }
-
- @Ignore
- @Test
- public void testExcelXImportWithTransform() throws Exception
- {
- ImportParams importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, false, false, false );
-
- importService.importData( importParams, inputStreamExcelx );
-
- assertEquals( organisationUnitService.getAllOrganisationUnits().size(), 49 );
- }
-
- @Ignore
- @Test
- public void testSDMXImportWithTransform() throws Exception
- {
- ImportParams importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, false, false, false );
-
- importService.importData( importParams, inputStreamSdmx );
-
- assertEquals( dataValueService.getAllDataValues().size(), 20 );
- }
-
- @Test
- public void testImportMetaData() throws Exception
- {
- ImportParams importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, false, false, false );
-
- importService.importData( importParams, inputStreamAx );
-
- assertObjects( dataASize );
- }
-
- @Test
- public void testImportMetaDataFromXML() throws Exception
- {
- ImportParams importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, false, false, false );
-
- importService.importData( importParams, inputStreamAx );
-
- assertObjects( dataASize );
- }
-
- @Test
- public void testImportMetaDataFromGzip() throws Exception
- {
- ImportParams importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, false, false, false );
-
- importService.importData( importParams, inputStreamAz );
-
- assertObjects( dataASize );
- }
-
- @Test
- public void testImportMetaDataWithPreview() throws Exception
- {
- ImportParams importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, true, false, false );
-
- importService.importData( importParams, inputStreamA );
-
- assertImportObjects( ImportObjectStatus.NEW, dataASize );
-
- assertGroupMembers( dataASize );
- }
-
- @Test
- public void testImportMetaDataWithPreviewAndDuplicates() throws Exception
- {
- ImportParams importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, false, false, false );
-
- importService.importData( importParams, inputStreamA );
-
- assertObjects( dataASize );
-
- importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, true, false, false );
-
- importService.importData( importParams, inputStreamB );
-
- assertImportObjects( ImportObjectStatus.NEW, dataBSize - dataASize );
-
- assertImportObjects( ImportObjectStatus.UPDATE, 0 );
-
- assertGroupMembers( dataBSize );
- }
-
- @Test
- public void testImportMetaDataWithPreviewAndUpdates() throws Exception
- {
- ImportParams importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, false, false, false );
-
- importService.importData( importParams, inputStreamA );
-
- assertObjects( dataASize );
-
- importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, true, false, false );
-
- importService.importData( importParams, inputStreamC );
-
- assertUpdateableImportObjects( ImportObjectStatus.UPDATE, dataASize );
-
- assertImportObjects( ImportObjectStatus.NEW, dataCSize - dataASize );
-
- assertGroupMembers( dataCSize );
- }
-
- @Test
- public void testImportDataValues() throws Exception
- {
- ImportParams importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, false, true, false );
-
- importService.importData( importParams, inputStreamD );
-
- assertEquals( dataElementService.getAllDataElements().size(), 2 );
-
- assertEquals( organisationUnitService.getAllOrganisationUnits().size(), 2 );
-
- assertEquals( dataValueService.getAllDataValues().size(), 8 );
- }
-
- @Test
- public void testImportDataValuesWithUpdates() throws Exception
- {
- ImportParams importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, false, true, false );
-
- importService.importData( importParams, inputStreamE );
-
- assertEquals( 12, dataValueService.getAllDataValues().size() );
-
- for ( DataValue dataValue : dataValueService.getAllDataValues() )
- {
- assertEquals( "10", dataValue.getValue() );
- }
-
- dbmsManager.clearSession();
-
- importService.importData( importParams, inputStreamG );
-
- assertEquals( 12, dataValueService.getAllDataValues().size() );
-
- for ( DataValue dataValue : dataValueService.getAllDataValues() )
- {
- assertEquals( "20", dataValue.getValue() );
- }
- }
-
- @Test
- public void testImportDataValuesWithPreview() throws Exception
- {
- ImportParams importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, true, true, false );
-
- importService.importData( importParams, inputStreamD );
-
- assertEquals( importObjectService.getImportObjects( ImportObjectStatus.NEW, DataElement.class ).size(), 2 );
-
- assertEquals( importObjectService.getImportObjects( ImportObjectStatus.NEW, OrganisationUnit.class ).size(), 2 );
-
- assertEquals( importDataValueService.getImportDataValues( ImportObjectStatus.NEW ).size(), 8 );
- }
-
- @Test
- public void testImportDataValuesWithPreviewAndDuplicates() throws Exception
- {
- ImportParams importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, false, true, false );
-
- importService.importData( importParams, inputStreamD );
-
- assertEquals( dataElementService.getAllDataElements().size(), 2 );
-
- assertEquals( organisationUnitService.getAllOrganisationUnits().size(), 2 );
-
- assertEquals( dataValueService.getAllDataValues().size(), 8 );
-
- importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, true, true, false );
-
- importService.importData( importParams, inputStreamE );
-
- assertEquals( importObjectService.getImportObjects( ImportObjectStatus.NEW, DataElement.class ).size(), 1 );
-
- assertEquals( importObjectService.getImportObjects( ImportObjectStatus.NEW, OrganisationUnit.class ).size(), 0 );
-
- assertEquals( importDataValueService.getImportDataValues( ImportObjectStatus.NEW ).size(), 12 );
- }
-
- @Test
- public void testImportDataValuesWithPreviewAndUpdates() throws Exception
- {
- ImportParams importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, false, true, false );
-
- importService.importData( importParams, inputStreamD );
-
- assertEquals( dataElementService.getAllDataElements().size(), 2 );
-
- assertEquals( organisationUnitService.getAllOrganisationUnits().size(), 2 );
-
- assertEquals( dataValueService.getAllDataValues().size(), 8 );
-
- importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, true, true, false );
-
- importService.importData( importParams, inputStreamF );
-
- assertEquals( importObjectService.getImportObjects( ImportObjectStatus.NEW, DataElement.class ).size(), 1 );
-
- assertEquals( importObjectService.getImportObjects( ImportObjectStatus.NEW, OrganisationUnit.class ).size(), 0 );
-
- //TODO assertEquals( importObjectService.getImportObjects( ImportObjectStatus.UPDATE, DataElement.class ).size(), 2 );
-
- assertEquals( importDataValueService.getImportDataValues( ImportObjectStatus.NEW ).size(), 12 );
- }
-
- // -------------------------------------------------------------------------
- // Supportive methods
- // -------------------------------------------------------------------------
- private void assertObjects( int expectedSize )
- {
- assertEquals( categoryService.getAllDataElementCategoryOptions().size(), 5 ); // Including default
-
- assertEquals( categoryService.getAllDataElementCategories().size(), 3 ); // Including default
-
- assertEquals( categoryService.getAllDataElementCategoryCombos().size(), 3 ); // Including default
-
- assertEquals( categoryService.getAllDataElementCategoryOptionCombos().size(), 5 ); // Including default
-
- assertEquals( dataElementService.getAllDataElements().size(), expectedSize );
-
- assertEquals( dataElementService.getAllDataElementGroups().size(), expectedSize );
-
- for ( DataElementGroup group : dataElementService.getAllDataElementGroups() )
- {
- assertEquals( group.getMembers().size(), expectedSize );
- }
-
- assertEquals( indicatorService.getAllIndicatorTypes().size(), expectedSize );
-
- assertEquals( indicatorService.getAllIndicators().size(), expectedSize );
-
- assertEquals( indicatorService.getAllIndicatorGroups().size(), expectedSize );
-
- for ( IndicatorGroup group : indicatorService.getAllIndicatorGroups() )
- {
- assertEquals( group.getMembers().size(), expectedSize );
- }
-
- assertEquals( dataSetService.getAllDataSets().size(), expectedSize );
-
- for ( DataSet dataSet : dataSetService.getAllDataSets() )
- {
- assertEquals( dataSet.getDataElements().size(), expectedSize );
- }
-
- assertEquals( organisationUnitService.getAllOrganisationUnits().size(), expectedSize );
-
- assertEquals( organisationUnitGroupService.getAllOrganisationUnitGroups().size(), expectedSize );
-
- for ( OrganisationUnitGroup group : organisationUnitGroupService.getAllOrganisationUnitGroups() )
- {
- assertEquals( group.getMembers().size(), expectedSize );
- }
-
- assertEquals( organisationUnitGroupService.getAllOrganisationUnitGroupSets().size(), expectedSize );
-
- assertEquals( validationRuleService.getAllValidationRules().size(), expectedSize );
- }
-
- private void assertImportObjects( ImportObjectStatus status, int expectedSize )
- {
- assertUpdateableImportObjects( status, expectedSize );
-
- assertEquals( importObjectService.getImportObjects( status, DataElementGroup.class ).size(), expectedSize );
-
- assertEquals( importObjectService.getImportObjects( status, IndicatorType.class ).size(), expectedSize );
-
- assertEquals( importObjectService.getImportObjects( status, IndicatorGroup.class ).size(), expectedSize );
-
- assertEquals( importObjectService.getImportObjects( status, DataSet.class ).size(), expectedSize );
-
- assertEquals( importObjectService.getImportObjects( status, OrganisationUnitGroup.class ).size(), expectedSize );
-
- assertEquals( importObjectService.getImportObjects( status, OrganisationUnitGroupSet.class ).size(), expectedSize );
-
- assertEquals( importObjectService.getImportObjects( status, ValidationRule.class ).size(), expectedSize );
- }
-
- private void assertUpdateableImportObjects( ImportObjectStatus status, int expectedSize )
- {
- assertEquals( importObjectService.getImportObjects( status, DataElement.class ).size(), expectedSize );
-
- assertEquals( importObjectService.getImportObjects( status, Indicator.class ).size(), expectedSize );
-
- assertEquals( importObjectService.getImportObjects( status, OrganisationUnit.class ).size(), expectedSize );
- }
-
- private void assertGroupMembers( int expectedSize )
- {
- assertEquals( importObjectService.getImportObjects( GroupMemberType.DATAELEMENTGROUP ).size(), expectedSize * expectedSize );
-
- assertEquals( importObjectService.getImportObjects( GroupMemberType.INDICATORGROUP ).size(), expectedSize * expectedSize );
-
- assertEquals( importObjectService.getImportObjects( GroupMemberType.DATASET ).size(), expectedSize * expectedSize );
-
- assertEquals( importObjectService.getImportObjects( GroupMemberType.ORGANISATIONUNITGROUP ).size(), expectedSize * expectedSize );
- }
-}
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataSet.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataSet.java 2013-02-26 07:47:48 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataSet.java 2013-04-15 15:12:27 +0000
@@ -37,7 +37,7 @@
public class DataSet
extends Model
- implements DataStreamSerializable, Comparable<DataSet>
+ implements Comparable<DataSet>
{
private String clientVersion;
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataSetList.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataSetList.java 2013-02-25 06:32:56 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/DataSetList.java 2013-04-15 15:12:27 +0000
@@ -35,7 +35,6 @@
public class DataSetList
extends Model
- implements DataStreamSerializable
{
private String clientVersion;
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/OptionSet.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/OptionSet.java 2013-03-29 07:57:12 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/OptionSet.java 2013-04-15 15:12:27 +0000
@@ -32,7 +32,6 @@
import java.util.ArrayList;
import java.util.List;
-import org.hisp.dhis.api.mobile.model.DataStreamSerializable;
import org.hisp.dhis.api.mobile.model.Model;
/**
@@ -42,7 +41,6 @@
*/
public class OptionSet
extends Model
- implements DataStreamSerializable
{
private String clientVersion;
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/Patient.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/Patient.java 2013-04-05 06:01:19 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/Patient.java 2013-04-15 15:12:27 +0000
@@ -47,7 +47,6 @@
public class Patient
implements DataStreamSerializable
{
-
private String clientVersion;
private int id;
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/Program.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/Program.java 2013-04-10 03:13:47 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/Program.java 2013-04-15 15:12:27 +0000
@@ -104,7 +104,7 @@
dout.writeInt( programStages.size() );
for ( int i = 0; i < programStages.size(); i++ )
{
- ProgramStage ps = (ProgramStage) programStages.get( i );
+ ProgramStage ps = programStages.get( i );
ps.serialize( dout );
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/OptionSet.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/OptionSet.java 2013-03-29 07:39:49 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/OptionSet.java 2013-04-15 15:12:27 +0000
@@ -35,7 +35,6 @@
public class OptionSet
extends Model
- implements DataStreamSerializable
{
private String clientVersion;
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Program.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Program.java 2013-02-25 06:32:56 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Program.java 2013-04-15 15:12:27 +0000
@@ -108,7 +108,7 @@
dout.writeInt( programStages.size() );
for ( int i = 0; i < programStages.size(); i++ )
{
- ProgramStage programStage = (ProgramStage) programStages.get( i );
+ ProgramStage programStage = programStages.get( i );
programStage.setClientVersion( TWO_POINT_EIGHT );
programStage.serialize( dout );
}
@@ -124,7 +124,7 @@
dout.writeInt( programStages.size() );
for ( int i = 0; i < programStages.size(); i++ )
{
- ProgramStage programStage = (ProgramStage) programStages.get( i );
+ ProgramStage programStage = programStages.get( i );
programStage.setClientVersion( TWO_POINT_NINE );
programStage.serialize( dout );
}
@@ -140,7 +140,7 @@
dout.writeInt( programStages.size() );
for ( int i = 0; i < programStages.size(); i++ )
{
- ProgramStage programStage = (ProgramStage) programStages.get( i );
+ ProgramStage programStage = programStages.get( i );
programStage.setClientVersion( TWO_POINT_TEN );
programStage.serialize( dout );
}
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/ProgramStage.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/ProgramStage.java 2013-02-25 06:32:56 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/ProgramStage.java 2013-04-15 15:12:27 +0000
@@ -88,7 +88,7 @@
for ( int i = 0; i < dataElements.size(); i++ )
{
- DataElement de = (DataElement) dataElements.get( i );
+ DataElement de = dataElements.get( i );
de.setClientVersion( TWO_POINT_EIGHT );
de.serialize( dout );
}
@@ -105,7 +105,7 @@
for ( int i = 0; i < dataElements.size(); i++ )
{
- DataElement de = (DataElement) dataElements.get( i );
+ DataElement de = dataElements.get( i );
de.setClientVersion( TWO_POINT_NINE );
de.serialize( dout );
}
@@ -122,7 +122,7 @@
for ( int i = 0; i < dataElements.size(); i++ )
{
- DataElement de = (DataElement) dataElements.get( i );
+ DataElement de = dataElements.get( i );
de.setClientVersion( TWO_POINT_TEN );
de.serialize( dout );
}
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Section.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Section.java 2013-02-25 06:32:56 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/Section.java 2013-04-15 15:12:27 +0000
@@ -95,7 +95,7 @@
dout.writeInt( dataElements.size() );
for ( int i = 0; i < dataElements.size(); i++ )
{
- DataElement de = (DataElement) dataElements.get( i );
+ DataElement de = dataElements.get( i );
de.setClientVersion( TWO_POINT_EIGHT );
de.serialize( dout );
}
@@ -118,7 +118,7 @@
dout.writeInt( dataElements.size() );
for ( int i = 0; i < dataElements.size(); i++ )
{
- DataElement de = (DataElement) dataElements.get( i );
+ DataElement de = dataElements.get( i );
de.setClientVersion( TWO_POINT_NINE);
de.serialize( dout );
}
@@ -141,7 +141,7 @@
dout.writeInt( dataElements.size() );
for ( int i = 0; i < dataElements.size(); i++ )
{
- DataElement de = (DataElement) dataElements.get( i );
+ DataElement de = dataElements.get( i );
de.setClientVersion( TWO_POINT_TEN);
de.serialize( dout );
}
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java 2013-04-15 03:09:26 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java 2013-04-15 15:12:27 +0000
@@ -27,7 +27,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.net.IDN;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -293,34 +292,32 @@
}
else
{
- if ( patients != null )
+ Iterator<Patient> iterator = patients.iterator();
+
+ while ( iterator.hasNext() )
{
- Iterator<Patient> iterator = patients.iterator();
-
- while ( iterator.hasNext() )
+ Patient patient = iterator.next();
+
+ List<ProgramStageInstance> programStageInstances = programStageInstanceService
+ .getProgramStageInstances( patient, false );
+
+ for ( int i = 0; i < programStageInstances.size(); i++ )
{
- Patient patient = iterator.next();
-
- List<ProgramStageInstance> programStageInstances = programStageInstanceService
- .getProgramStageInstances( patient, false );
-
- for ( int i = 0; i < programStageInstances.size(); i++ )
+ ProgramStageInstance programStageInstance = programStageInstances.get( i );
+
+ // expiredDate.setTime( DateUtils.getDateAfterAddition(
+ // programStageInstance.getDueDate(), 0 ) );
+ expiredDate.setTime( DateUtils.getDateAfterAddition( programStageInstance.getDueDate(), 30 ) );
+
+ if ( programStageInstance.getDueDate().getTime() <= time
+ && expiredDate.getTimeInMillis() > time )
{
- ProgramStageInstance programStageInstance = programStageInstances.get( i );
-
- // expiredDate.setTime( DateUtils.getDateAfterAddition(
- // programStageInstance.getDueDate(), 0 ) );
- expiredDate.setTime( DateUtils.getDateAfterAddition( programStageInstance.getDueDate(), 30 ) );
-
- if ( programStageInstance.getDueDate().getTime() <= time
- && expiredDate.getTimeInMillis() > time )
- {
- items.add( getActivity( programStageInstance,
- programStageInstance.getDueDate().getTime() < time ) );
- }
+ items.add( getActivity( programStageInstance,
+ programStageInstance.getDueDate().getTime() < time ) );
}
}
}
+
return new ActivityPlan( items );
}
@@ -348,7 +345,7 @@
ProgramStageSection programStageSection = programStageSectionService
.getProgramStageSection( programStageSectionId );
- if ( programStageSectionId != null && programStageSectionId != 0 )
+ if ( programStageSectionId != 0 )
{
for ( ProgramStageDataElement de : programStageSection.getProgramStageDataElements() )
{
@@ -373,7 +370,6 @@
if ( dataElements.size() != dataElementIds.size() )
{
- ;
throw NotAllowedException.INVALID_PROGRAM_STAGE;
}