dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #05733
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1815: Updated DXF import/export of ReportTable with new attributes
------------------------------------------------------------
revno: 1815
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-04-29 19:05:22 +0200
message:
Updated DXF import/export of ReportTable with new attributes
modified:
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/converter/AbstractReportTableConverter.java
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/ReportTableConverter.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/exporter/DefaultDXFExportService.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/converter/AbstractReportTableConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/converter/AbstractReportTableConverter.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/converter/AbstractReportTableConverter.java 2010-04-29 17:05:22 +0000
@@ -27,6 +27,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.indicator.IndicatorService;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.period.PeriodService;
import org.hisp.dhis.reporttable.ReportTable;
import org.hisp.dhis.reporttable.ReportTableService;
@@ -38,6 +44,18 @@
extends AbstractConverter<ReportTable>
{
protected ReportTableService reportTableService;
+
+ protected DataElementService dataElementService;
+
+ protected DataElementCategoryService categoryService;
+
+ protected IndicatorService indicatorService;
+
+ protected DataSetService dataSetService;
+
+ protected PeriodService periodService;
+
+ protected OrganisationUnitService organisationUnitService;
// -------------------------------------------------------------------------
// Overridden methods
@@ -45,7 +63,7 @@
protected void importUnique( ReportTable object )
{
- batchHandler.addObject( object );
+ reportTableService.saveReportTable( object );
}
protected void importMatching( ReportTable object, ReportTable match )
=== 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 2010-02-22 09:37:31 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DXFConverter.java 2010-04-29 17:05:22 +0000
@@ -27,11 +27,10 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import org.amplecode.staxwax.writer.XMLWriter;
-import org.hisp.dhis.importexport.ExportParams;
import org.amplecode.quick.BatchHandler;
import org.amplecode.quick.BatchHandlerFactory;
import org.amplecode.staxwax.reader.XMLReader;
+import org.amplecode.staxwax.writer.XMLWriter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.cache.HibernateCacheManager;
@@ -54,6 +53,7 @@
import org.hisp.dhis.datavalue.DataValue;
import org.hisp.dhis.datavalue.DataValueService;
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;
@@ -100,11 +100,6 @@
import org.hisp.dhis.jdbc.batchhandler.OrganisationUnitGroupMemberBatchHandler;
import org.hisp.dhis.jdbc.batchhandler.PeriodBatchHandler;
import org.hisp.dhis.jdbc.batchhandler.ReportTableBatchHandler;
-import org.hisp.dhis.jdbc.batchhandler.ReportTableDataElementBatchHandler;
-import org.hisp.dhis.jdbc.batchhandler.ReportTableDataSetBatchHandler;
-import org.hisp.dhis.jdbc.batchhandler.ReportTableIndicatorBatchHandler;
-import org.hisp.dhis.jdbc.batchhandler.ReportTableOrganisationUnitBatchHandler;
-import org.hisp.dhis.jdbc.batchhandler.ReportTablePeriodBatchHandler;
import org.hisp.dhis.jdbc.batchhandler.SourceBatchHandler;
import org.hisp.dhis.olap.OlapURLService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -932,8 +927,15 @@
batchHandler.init();
- XMLConverter converter = new ReportTableConverter( batchHandler, reportTableService,
- importObjectService );
+ XMLConverter converter = new ReportTableConverter( reportTableService, importObjectService,
+ dataElementService, categoryService, indicatorService, dataSetService, periodService, organisationUnitService,
+ objectMappingGenerator.getDataElementMapping( params.skipMapping() ),
+ objectMappingGenerator.getDataElementGroupSetMapping( params.skipMapping() ),
+ objectMappingGenerator.getCategoryComboMapping( params.skipMapping() ),
+ objectMappingGenerator.getIndicatorMapping( params.skipMapping() ),
+ objectMappingGenerator.getDataSetMapping( params.skipMapping() ),
+ objectMappingGenerator.getPeriodMapping( params.skipMapping() ),
+ objectMappingGenerator.getOrganisationUnitMapping( params.skipMapping() ) );
converterInvoker.invokeRead( converter, reader, params );
@@ -941,101 +943,6 @@
log.info( "Imported ReportTables" );
}
- else if ( reader.isStartElement( ReportTableDataElementConverter.COLLECTION_NAME ) )
- {
- state.setMessage( "importing_report_table_dataelements" );
-
- BatchHandler<GroupMemberAssociation> batchHandler = batchHandlerFactory
- .createBatchHandler( ReportTableDataElementBatchHandler.class );
-
- batchHandler.init();
-
- XMLConverter converter = new ReportTableDataElementConverter( batchHandler, importObjectService,
- objectMappingGenerator.getReportTableMapping( params.skipMapping() ), objectMappingGenerator
- .getDataElementMapping( params.skipMapping() ) );
-
- converterInvoker.invokeRead( converter, reader, params );
-
- batchHandler.flush();
-
- log.info( "Imported ReportTable DataElements" );
- }
- else if ( reader.isStartElement( ReportTableIndicatorConverter.COLLECTION_NAME ) )
- {
- state.setMessage( "importing_report_table_indicators" );
-
- BatchHandler<GroupMemberAssociation> batchHandler = batchHandlerFactory
- .createBatchHandler( ReportTableIndicatorBatchHandler.class );
-
- batchHandler.init();
-
- XMLConverter converter = new ReportTableIndicatorConverter( batchHandler, importObjectService,
- objectMappingGenerator.getReportTableMapping( params.skipMapping() ), objectMappingGenerator
- .getIndicatorMapping( params.skipMapping() ) );
-
- converterInvoker.invokeRead( converter, reader, params );
-
- batchHandler.flush();
-
- log.info( "Imported ReportTable Indicators" );
- }
- else if ( reader.isStartElement( ReportTableDataSetConverter.COLLECTION_NAME ) )
- {
- state.setMessage( "importing_report_table_datasets" );
-
- BatchHandler<GroupMemberAssociation> batchHandler = batchHandlerFactory
- .createBatchHandler( ReportTableDataSetBatchHandler.class );
-
- batchHandler.init();
-
- XMLConverter converter = new ReportTableDataSetConverter( batchHandler, importObjectService,
- objectMappingGenerator.getReportTableMapping( params.skipMapping() ), objectMappingGenerator
- .getDataSetMapping( params.skipMapping() ) );
-
- converterInvoker.invokeRead( converter, reader, params );
-
- batchHandler.flush();
-
- log.info( "Imported ReportTable DataSets" );
- }
- else if ( reader.isStartElement( ReportTablePeriodConverter.COLLECTION_NAME ) )
- {
- state.setMessage( "importing_report_table_periods" );
-
- BatchHandler<GroupMemberAssociation> batchHandler = batchHandlerFactory
- .createBatchHandler( ReportTablePeriodBatchHandler.class );
-
- batchHandler.init();
-
- XMLConverter converter = new ReportTablePeriodConverter( batchHandler, importObjectService,
- objectMappingGenerator.getReportTableMapping( params.skipMapping() ), objectMappingGenerator
- .getPeriodMapping( params.skipMapping() ) );
-
- converterInvoker.invokeRead( converter, reader, params );
-
- batchHandler.flush();
-
- log.info( "Imported ReportTable Periods" );
- }
- else if ( reader.isStartElement( ReportTableOrganisationUnitConverter.COLLECTION_NAME ) )
- {
- state.setMessage( "importing_report_table_organisation_units" );
-
- BatchHandler<GroupMemberAssociation> batchHandler = batchHandlerFactory
- .createBatchHandler( ReportTableOrganisationUnitBatchHandler.class );
-
- batchHandler.init();
-
- XMLConverter converter = new ReportTableOrganisationUnitConverter( batchHandler, importObjectService,
- objectMappingGenerator.getReportTableMapping( params.skipMapping() ), objectMappingGenerator
- .getOrganisationUnitMapping( params.skipMapping() ) );
-
- converterInvoker.invokeRead( converter, reader, params );
-
- batchHandler.flush();
-
- log.info( "Imported ReportTable OrganisationUnits" );
- }
else if ( reader.isStartElement( OlapUrlConverter.COLLECTION_NAME ) )
{
state.setMessage( "importing_olap_urls" );
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/ReportTableConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/ReportTableConverter.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/ReportTableConverter.java 2010-04-29 17:05:22 +0000
@@ -27,19 +27,31 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.List;
import java.util.Map;
-import org.amplecode.quick.BatchHandler;
import org.amplecode.staxwax.reader.XMLReader;
import org.amplecode.staxwax.writer.XMLWriter;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementGroupSet;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
import org.hisp.dhis.importexport.ExportParams;
import org.hisp.dhis.importexport.GroupMemberType;
import org.hisp.dhis.importexport.ImportObjectService;
import org.hisp.dhis.importexport.ImportParams;
import org.hisp.dhis.importexport.XMLConverter;
import org.hisp.dhis.importexport.converter.AbstractReportTableConverter;
-import org.hisp.dhis.importexport.mapping.NameMappingUtil;
+import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.indicator.IndicatorService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
import org.hisp.dhis.reporttable.RelativePeriods;
import org.hisp.dhis.reporttable.ReportParams;
import org.hisp.dhis.reporttable.ReportTable;
@@ -61,7 +73,17 @@
private static final String FIELD_EXISTING_TABLE_NAME = "existingTableName";
private static final String FIELD_MODE = "mode";
private static final String FIELD_REGRESSION = "regression";
-
+
+ private static final String FIELD_DATA_ELEMENTS = "dataElements";
+ private static final String FIELD_INDICATORS = "indicators";
+ private static final String FIELD_DATASETS = "dataSets";
+ private static final String FIELD_PERIODS = "periods";
+ private static final String FIELD_ORGANISATION_UNITS = "organisationUnits";
+
+ private static final String FIELD_DIMENSION_TYPE = "dimensionType";
+ private static final String FIELD_CATEGORY_COMBO = "categoryCombo";
+ private static final String FIELD_DATA_ELEMENT_GROUP_SETS = "dataElementGroupSets";
+
private static final String FIELD_DO_INDICATORS = "doIndicators";
private static final String FIELD_DO_PERIODS = "doPeriods";
private static final String FIELD_DO_ORGANISATION_UNITS = "doOrganisationUnits";
@@ -84,12 +106,22 @@
private static final String FIELD_PARAM_PARENT_ORG_UNIT = "paramParentOrganisationUnit";
private static final String FIELD_PARAM_ORG_UNIT = "paramOrganisationUnit";
+ private Map<Object, Integer> dataElementMapping;
+ private Map<Object, Integer> dataElementGroupSetMapping;
+ private Map<Object, Integer> categoryComboMapping;
+ private Map<Object, Integer> indicatorMapping;
+ private Map<Object, Integer> dataSetMapping;
+ private Map<Object, Integer> periodMapping;
+ private Map<Object, Integer> organisationUnitMapping;
+
// -------------------------------------------------------------------------
// Constructor
// -------------------------------------------------------------------------
/**
* Constructor for write operations.
+ *
+ * @param reportTableService ReportTableService
*/
public ReportTableConverter( ReportTableService reportTableService )
{
@@ -99,17 +131,53 @@
/**
* Constructor for read operations.
*
- * @param batchHandler BatchHandler
- * @param reportTableStore ReportTableStore
+ * @param reportTableService ReportTableService
* @param importObjectService ImportObjectService
+ * @param dataElementService DataElementService
+ * @param categoryService CategoryService
+ * @param indicatorService IndicatorService
+ * @param dataSetService DataSetService
+ * @param periodService PeriodService
+ * @param organisationUnitService OrganisationUnitService
+ * @param dataElementMapping
+ * @param dataElementGroupSetMapping
+ * @param categoryComboMapping
+ * @param indicatorMapping
+ * @param dataSetMapping
+ * @param periodMapping
+ * @param organisationUnitMapping
*/
- public ReportTableConverter( BatchHandler<ReportTable> batchHandler,
- ReportTableService reportTableService,
- ImportObjectService importObjectService )
+ public ReportTableConverter( ReportTableService reportTableService,
+ ImportObjectService importObjectService,
+ DataElementService dataElementService,
+ DataElementCategoryService categoryService,
+ IndicatorService indicatorService,
+ DataSetService dataSetService,
+ PeriodService periodService,
+ OrganisationUnitService organisationUnitService,
+ Map<Object, Integer> dataElementMapping,
+ Map<Object, Integer> dataElementGroupSetMapping,
+ Map<Object, Integer> categoryComboMapping,
+ Map<Object, Integer> indicatorMapping,
+ Map<Object, Integer> dataSetMapping,
+ Map<Object, Integer> periodMapping,
+ Map<Object, Integer> organisationUnitMapping )
{
- this.batchHandler = batchHandler;
this.reportTableService = reportTableService;
this.importObjectService = importObjectService;
+ this.dataElementService = dataElementService;
+ this.categoryService = categoryService;
+ this.indicatorService = indicatorService;
+ this.dataSetService = dataSetService;
+ this.periodService = periodService;
+ this.organisationUnitService = organisationUnitService;
+ this.dataElementMapping = dataElementMapping;
+ this.dataElementGroupSetMapping = dataElementGroupSetMapping;
+ this.categoryComboMapping = categoryComboMapping;
+ this.indicatorMapping = indicatorMapping;
+ this.dataSetMapping = dataSetMapping;
+ this.periodMapping = periodMapping;
+ this.organisationUnitMapping = organisationUnitMapping;
}
// -------------------------------------------------------------------------
@@ -135,6 +203,51 @@
writer.writeElement( FIELD_MODE, reportTable.getMode() );
writer.writeElement( FIELD_REGRESSION, String.valueOf( reportTable.isRegression() ) );
+ writer.openElement( FIELD_DATA_ELEMENTS );
+ for ( DataElement dataElement : reportTable.getDataElements() )
+ {
+ writer.writeElement( FIELD_ID, String.valueOf( dataElement.getId() ) );
+ }
+ writer.closeElement();
+
+ writer.openElement( FIELD_INDICATORS );
+ for ( Indicator indicator : reportTable.getIndicators() )
+ {
+ writer.writeElement( FIELD_ID, String.valueOf( indicator.getId() ) );
+ }
+ writer.closeElement();
+
+ writer.openElement( FIELD_DATASETS );
+ for ( DataSet dataSet : reportTable.getDataSets() )
+ {
+ writer.writeElement( FIELD_ID, String.valueOf( dataSet.getId() ) );
+ }
+ writer.closeElement();
+
+ writer.openElement( FIELD_PERIODS );
+ for ( Period period : reportTable.getPeriods() )
+ {
+ writer.writeElement( FIELD_ID, String.valueOf( period.getId() ) );
+ }
+ writer.closeElement();
+
+ writer.openElement( FIELD_ORGANISATION_UNITS );
+ for ( OrganisationUnit unit : reportTable.getUnits() )
+ {
+ writer.writeElement( FIELD_ID, String.valueOf( unit.getId() ) );
+ }
+ writer.closeElement();
+
+ writer.writeElement( FIELD_DIMENSION_TYPE, reportTable.getDimensionType() != null ? reportTable.getDimensionType() : EMPTY );
+ writer.writeElement( FIELD_CATEGORY_COMBO, reportTable.getCategoryCombo() != null ? String.valueOf( reportTable.getCategoryCombo().getId() ) : EMPTY );
+
+ writer.openElement( FIELD_DATA_ELEMENT_GROUP_SETS );
+ for ( DataElementGroupSet groupSet : reportTable.getDataElementGroupSets() )
+ {
+ writer.writeElement( FIELD_ID, String.valueOf( groupSet.getId() ) );
+ }
+ writer.closeElement();
+
writer.writeElement( FIELD_DO_INDICATORS, String.valueOf( reportTable.isDoIndicators() ) );
writer.writeElement( FIELD_DO_PERIODS, String.valueOf( reportTable.isDoPeriods() ) );
writer.writeElement( FIELD_DO_ORGANISATION_UNITS, String.valueOf( reportTable.isDoUnits() ) );
@@ -165,11 +278,9 @@
}
public void read( XMLReader reader, ImportParams params )
- {
+ {
while ( reader.moveToStartElement( ELEMENT_NAME, COLLECTION_NAME ) )
{
- final Map<String, String> values = reader.readElements( ELEMENT_NAME );
-
final ReportTable reportTable = new ReportTable();
final RelativePeriods relatives = new RelativePeriods();
@@ -178,36 +289,127 @@
final ReportParams reportParams = new ReportParams();
reportTable.setReportParams( reportParams );
- reportTable.setId( Integer.parseInt( values.get( FIELD_ID ) ) );
- reportTable.setName( values.get( FIELD_NAME ) );
- reportTable.setTableName( values.get( FIELD_TABLE_NAME ) );
- reportTable.setExistingTableName( values.get( FIELD_EXISTING_TABLE_NAME ) );
- reportTable.setMode( values.get( FIELD_MODE ) );
- reportTable.setRegression( Boolean.parseBoolean( values.get( FIELD_REGRESSION ) ) );
-
- reportTable.setDoIndicators( Boolean.parseBoolean( values.get( FIELD_DO_INDICATORS ) ) );
- reportTable.setDoPeriods( Boolean.parseBoolean( values.get( FIELD_DO_PERIODS ) ) );
- reportTable.setDoUnits( Boolean.parseBoolean( values.get( FIELD_DO_ORGANISATION_UNITS ) ) );
-
- reportTable.getRelatives().setReportingMonth( Boolean.parseBoolean( values.get( FIELD_REPORTING_MONTH ) ) );
- reportTable.getRelatives().setLast3Months( Boolean.parseBoolean( values.get( FIELD_LAST_3_MONTHS ) ) );
- reportTable.getRelatives().setLast6Months( Boolean.parseBoolean( values.get( FIELD_LAST_6_MONTHS ) ) );
- reportTable.getRelatives().setLast9Months( Boolean.parseBoolean( values.get( FIELD_LAST_9_MONTHS ) ) );
- reportTable.getRelatives().setLast12Months( Boolean.parseBoolean( values.get( FIELD_LAST_12_MONTHS ) ) );
- reportTable.getRelatives().setSoFarThisYear( Boolean.parseBoolean( values.get( FIELD_SO_FAR_THIS_YEAR ) ) );
- reportTable.getRelatives().setSoFarThisFinancialYear( Boolean.parseBoolean( values.get( FIELD_SO_FAR_THIS_FINANCIAL_YEAR ) ) );
- reportTable.getRelatives().setLast3To6Months( Boolean.parseBoolean( values.get( FIELD_LAST_3_TO_6_MONTHS ) ) );
- reportTable.getRelatives().setLast6To9Months( Boolean.parseBoolean( values.get( FIELD_LAST_6_TO_9_MONTHS ) ) );
- reportTable.getRelatives().setLast9To12Months( Boolean.parseBoolean( values.get( FIELD_LAST_9_TO_12_MONTHS ) ) );
- reportTable.getRelatives().setLast12IndividualMonths( Boolean.parseBoolean( values.get( FIELD_LAST_12_INDIVIDUAL_MONHTS ) ) );
- reportTable.getRelatives().setIndividualMonthsThisYear( Boolean.parseBoolean( values.get( FIELD_INDIVIDUAL_MONTHS_THIS_YEAR ) ) );
- reportTable.getRelatives().setIndividualQuartersThisYear( Boolean.parseBoolean( values.get( FIELD_INDIVIDUAL_QUARTERS_THIS_YEAR ) ) );
-
- reportTable.getReportParams().setParamReportingMonth( Boolean.parseBoolean( values.get( FIELD_PARAM_REPORTING_MONTH ) ) );
- reportTable.getReportParams().setParamParentOrganisationUnit( Boolean.parseBoolean( values.get( FIELD_PARAM_PARENT_ORG_UNIT ) ) );
- reportTable.getReportParams().setParamOrganisationUnit( Boolean.parseBoolean( values.get( FIELD_PARAM_ORG_UNIT ) ) );
-
- NameMappingUtil.addReportTableMapping( reportTable.getId(), reportTable.getName() );
+ reader.moveToStartElement( FIELD_ID );
+ reportTable.setId( Integer.parseInt( reader.getElementValue() ) );
+
+ reader.moveToStartElement( FIELD_NAME );
+ reportTable.setName( reader.getElementValue() );
+
+ reader.moveToStartElement( FIELD_TABLE_NAME );
+ reportTable.setTableName( reader.getElementValue() );
+
+ reader.moveToStartElement( FIELD_EXISTING_TABLE_NAME );
+ reportTable.setExistingTableName( reader.getElementValue() );
+
+ reader.moveToStartElement( FIELD_MODE );
+ reportTable.setMode( reader.getElementValue() );
+
+ reader.moveToStartElement( FIELD_REGRESSION );
+ reportTable.setRegression( Boolean.parseBoolean( reader.getElementValue() ) );
+
+ while ( reader.moveToStartElement( FIELD_ID, FIELD_DATA_ELEMENTS ) )
+ {
+ int id = Integer.parseInt( reader.getElementValue() );
+ reportTable.getDataElements().add( dataElementService.getDataElement( dataElementMapping.get( id ) ) );
+ }
+
+ while ( reader.moveToStartElement( FIELD_ID, FIELD_INDICATORS ) )
+ {
+ int id = Integer.parseInt( reader.getElementValue() );
+ reportTable.getIndicators().add( indicatorService.getIndicator( indicatorMapping.get( id ) ) );
+ }
+
+ while ( reader.moveToStartElement( FIELD_ID, FIELD_DATASETS ) )
+ {
+ int id = Integer.parseInt( reader.getElementValue() );
+ reportTable.getDataSets().add( dataSetService.getDataSet( dataSetMapping.get( id ) ) );
+ }
+
+ while ( reader.moveToStartElement( FIELD_ID, FIELD_PERIODS ) )
+ {
+ int id = Integer.parseInt( reader.getElementValue() );
+ reportTable.getPeriods().add( periodService.getPeriod( periodMapping.get( id ) ) );
+ }
+
+ while ( reader.moveToStartElement( FIELD_ID, FIELD_ORGANISATION_UNITS ) )
+ {
+ int id = Integer.parseInt( reader.getElementValue() );
+ reportTable.getUnits().add( organisationUnitService.getOrganisationUnit( organisationUnitMapping.get( id ) ) );
+ }
+
+ reader.moveToStartElement( FIELD_DIMENSION_TYPE );
+ reportTable.setDimensionType( reader.getElementValue() );
+
+ reader.moveToStartElement( FIELD_CATEGORY_COMBO );
+ String cc = reader.getElementValue();
+ reportTable.setCategoryCombo( cc != null ? categoryService.getDataElementCategoryCombo( categoryComboMapping.get( Integer.parseInt( cc ) ) ) : null );
+
+ List<DataElementGroupSet> groupSets = new ArrayList<DataElementGroupSet>();
+ while ( reader.moveToStartElement( FIELD_ID, FIELD_DATA_ELEMENT_GROUP_SETS ) )
+ {
+ int id = Integer.parseInt( reader.getElementValue() );
+ groupSets.add( dataElementService.getDataElementGroupSet( dataElementGroupSetMapping.get( id ) ) );
+ }
+ reportTable.setDataElementGroupSets( groupSets );
+
+ reader.moveToStartElement( FIELD_DO_INDICATORS );
+ reportTable.setDoIndicators( Boolean.parseBoolean( reader.getElementValue() ) );
+
+ reader.moveToStartElement( FIELD_DO_PERIODS );
+ reportTable.setDoPeriods( Boolean.parseBoolean( reader.getElementValue() ) );
+
+ reader.moveToStartElement( FIELD_DO_ORGANISATION_UNITS );
+ reportTable.setDoUnits( Boolean.parseBoolean( reader.getElementValue() ) );
+
+ reader.moveToStartElement( FIELD_REPORTING_MONTH );
+ reportTable.getRelatives().setReportingMonth( Boolean.parseBoolean( reader.getElementValue() ) );
+
+ reader.moveToStartElement( FIELD_LAST_3_MONTHS );
+ reportTable.getRelatives().setLast3Months( Boolean.parseBoolean( reader.getElementValue() ) );
+
+ reader.moveToStartElement( FIELD_LAST_6_MONTHS );
+ reportTable.getRelatives().setLast6Months( Boolean.parseBoolean( reader.getElementValue() ) );
+
+ reader.moveToStartElement( FIELD_LAST_9_MONTHS );
+ reportTable.getRelatives().setLast9Months( Boolean.parseBoolean( reader.getElementValue() ) );
+
+ reader.moveToStartElement( FIELD_LAST_12_MONTHS );
+ reportTable.getRelatives().setLast12Months( Boolean.parseBoolean( reader.getElementValue() ) );
+
+ reader.moveToStartElement( FIELD_SO_FAR_THIS_YEAR );
+ reportTable.getRelatives().setSoFarThisYear( Boolean.parseBoolean( reader.getElementValue() ) );
+
+ reader.moveToStartElement( FIELD_SO_FAR_THIS_FINANCIAL_YEAR );
+ reportTable.getRelatives().setSoFarThisFinancialYear( Boolean.parseBoolean( reader.getElementValue() ) );
+
+ reader.moveToStartElement( FIELD_LAST_3_TO_6_MONTHS );
+ reportTable.getRelatives().setLast3To6Months( Boolean.parseBoolean( reader.getElementValue() ) );
+
+ reader.moveToStartElement( FIELD_LAST_6_TO_9_MONTHS );
+ reportTable.getRelatives().setLast6To9Months( Boolean.parseBoolean( reader.getElementValue() ) );
+
+ reader.moveToStartElement( FIELD_LAST_9_TO_12_MONTHS );
+ reportTable.getRelatives().setLast9To12Months( Boolean.parseBoolean( reader.getElementValue() ) );
+
+ reader.moveToStartElement( FIELD_LAST_12_INDIVIDUAL_MONHTS );
+ reportTable.getRelatives().setLast12IndividualMonths( Boolean.parseBoolean( reader.getElementValue() ) );
+
+ reader.moveToStartElement( FIELD_INDIVIDUAL_MONTHS_THIS_YEAR );
+ reportTable.getRelatives().setIndividualMonthsThisYear( Boolean.parseBoolean( reader.getElementValue() ) );
+
+ reader.moveToStartElement( FIELD_INDIVIDUAL_QUARTERS_THIS_YEAR );
+ reportTable.getRelatives().setIndividualQuartersThisYear( Boolean.parseBoolean( reader.getElementValue() ) );
+
+ reader.moveToStartElement( FIELD_PARAM_REPORTING_MONTH );
+ reportTable.getReportParams().setParamReportingMonth( Boolean.parseBoolean( reader.getElementValue() ) );
+
+ reader.moveToStartElement( FIELD_PARAM_PARENT_ORG_UNIT );
+ reportTable.getReportParams().setParamParentOrganisationUnit( Boolean.parseBoolean( reader.getElementValue() ) );
+
+ reader.moveToStartElement( FIELD_PARAM_ORG_UNIT );
+ reportTable.getReportParams().setParamOrganisationUnit( Boolean.parseBoolean( reader.getElementValue() ) );
+
+ //NameMappingUtil.addReportTableMapping( reportTable.getId(), reportTable.getName() );
read( reportTable, GroupMemberType.NONE, 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 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/exporter/DefaultDXFExportService.java 2010-04-29 17:05:22 +0000
@@ -87,11 +87,6 @@
import org.hisp.dhis.importexport.dxf.converter.OrganisationUnitRelationshipConverter;
import org.hisp.dhis.importexport.dxf.converter.PeriodConverter;
import org.hisp.dhis.importexport.dxf.converter.ReportTableConverter;
-import org.hisp.dhis.importexport.dxf.converter.ReportTableDataElementConverter;
-import org.hisp.dhis.importexport.dxf.converter.ReportTableDataSetConverter;
-import org.hisp.dhis.importexport.dxf.converter.ReportTableIndicatorConverter;
-import org.hisp.dhis.importexport.dxf.converter.ReportTableOrganisationUnitConverter;
-import org.hisp.dhis.importexport.dxf.converter.ReportTablePeriodConverter;
import org.hisp.dhis.importexport.dxf.converter.ValidationRuleConverter;
import org.hisp.dhis.indicator.IndicatorService;
import org.hisp.dhis.olap.OlapURLService;
@@ -301,11 +296,6 @@
thread.registerXMLConverter( new PeriodConverter( periodService ) );
thread.registerXMLConverter( new ReportTableConverter( reportTableService ) );
- thread.registerXMLConverter( new ReportTableDataElementConverter( reportTableService ) );
- thread.registerXMLConverter( new ReportTableIndicatorConverter( reportTableService ) );
- thread.registerXMLConverter( new ReportTableDataSetConverter( reportTableService ) );
- thread.registerXMLConverter( new ReportTablePeriodConverter( reportTableService ) );
- thread.registerXMLConverter( new ReportTableOrganisationUnitConverter( reportTableService ) );
thread.registerXMLConverter( new OlapUrlConverter( olapURLService ) );