dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #10452
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2864: DHIS2->DHIS1.4 XML export problem fixed (partially) by enabling orgunit hierarchy export. Fixes #...
Merge authors:
jason <jason@jason-win7>
------------------------------------------------------------
revno: 2864 [merge]
committer: jason <jason@jason-win7>
branch nick: dhis2
timestamp: Thu 2011-02-17 11:51:48 +0200
message:
DHIS2->DHIS1.4 XML export problem fixed (partially) by enabling orgunit hierarchy export. Fixes #556573.
added:
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/xsd/OrganisationUnitGroupXSDConverter.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/xsd/OrganisationUnitHierarchyXSDConverter.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/xsd/OrganisationUnitXSDConverter.java
modified:
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/DataElementConverter.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/OrganisationUnitConverter.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/OrganisationUnitHierarchyConverter.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/xsd/DataRootXSDConverter.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/exporter/DefaultDhis14XMLExportService.java
dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/DataElementConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/DataElementConverter.java 2010-05-29 16:06:56 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/DataElementConverter.java 2011-02-17 09:51:48 +0000
@@ -160,15 +160,18 @@
if ( elements != null && elements.size() > 0 )
{
+ int i = 0;
for ( DataElement object : elements )
{
final boolean calculated = object instanceof CalculatedDataElement;
final boolean saveCalculated = calculated ? ((CalculatedDataElement)object).isSaved() : false;
-
+
+ i++;
+
writer.openElement( ELEMENT_NAME );
writer.writeElement( FIELD_ID, String.valueOf( object.getId() ) );
- writer.writeElement( FIELD_SORT_ORDER, object.getSortOrder() != null ? String.valueOf( object.getSortOrder() ) : EMPTY );
+ writer.writeElement( FIELD_SORT_ORDER, object.getSortOrder() != null ? String.valueOf( object.getSortOrder() ) : String.valueOf( i++ ) );
writer.writeElement( FIELD_CODE, object.getCode() );
writer.writeElement( FIELD_NAME, object.getName() );
writer.writeElement( FIELD_SHORT_NAME, object.getShortName() );
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/OrganisationUnitConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/OrganisationUnitConverter.java 2010-05-29 16:06:56 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/OrganisationUnitConverter.java 2011-02-17 09:51:48 +0000
@@ -107,11 +107,13 @@
{
for ( OrganisationUnit unit : units )
{
+ int level = organisationUnitService.getLevelOfOrganisationUnit( unit );
+
writer.openElement( ELEMENT_NAME );
writer.writeElement( FIELD_ID, String.valueOf( unit.getId() ) );
writer.writeElement( FIELD_CODE, unit.getCode() );
- writer.writeElement( FIELD_LEVEL, "" );
+ writer.writeElement( FIELD_LEVEL, String.valueOf( level ) );
writer.writeElement( FIELD_NAME, unit.getName() );
writer.writeElement( FIELD_SHORT_NAME, unit.getShortName() );
writer.writeElement( FIELD_VALID_FROM, String.valueOf( VALID_FROM ) );
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/OrganisationUnitHierarchyConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/OrganisationUnitHierarchyConverter.java 2010-05-29 16:06:56 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/OrganisationUnitHierarchyConverter.java 2011-02-17 09:51:48 +0000
@@ -42,6 +42,7 @@
import org.hisp.dhis.importexport.importer.OrganisationUnitRelationshipImporter;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.importexport.dhis14.util.Dhis14DateUtil;
import org.hisp.dhis.system.util.MimicingHashMap;
/**
@@ -121,8 +122,8 @@
writer.writeElement( FIELD_STRUCTURE, String.valueOf( STRUCTURE_ID ) );
writer.writeElement( FIELD_CHILD, String.valueOf( unit.getId() ) );
writer.writeElement( FIELD_PARENT, String.valueOf( unit.getParent().getId() ) );
- writer.writeElement( FIELD_LAST_USER, "" );
- writer.writeElement( FIELD_LAST_UPDATED, "" );
+ writer.writeElement( FIELD_LAST_USER, String.valueOf( 1 ) );
+ writer.writeElement( FIELD_LAST_UPDATED, Dhis14DateUtil.getDateString( unit.getLastUpdated() ) );
writer.closeElement();
}
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/xsd/DataRootXSDConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/xsd/DataRootXSDConverter.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/xsd/DataRootXSDConverter.java 2011-02-17 07:01:28 +0000
@@ -40,7 +40,7 @@
public class DataRootXSDConverter
implements XMLConverter
{
- private static final String DHIS_VERSION = "1.4.0.108";
+ private static final String DHIS_VERSION = "1.4.0.129";
// -------------------------------------------------------------------------
// Constructor
@@ -63,25 +63,31 @@
writer.closeElement();
- /*
+
writer.openElement( "xsd:complexType" );
writer.openElement( "xsd:sequence" );
writer.writeElement( "xsd:element", "", "ref", "DataElement", "minOccurs", "0", "maxOccurs", "unbounded" );
- writer.writeElement( "xsd:element", "", "ref", "DataElementAndIndicatorGroup", "minOccurs", "0", "maxOccurs", "unbounded" );
+ writer.writeElement( "xsd:element", "", "ref", "DataElementCalculauted", "minOccurs", "0", "maxOccurs", "unbounded" );
writer.writeElement( "xsd:element", "", "ref", "DataElementGroupMember", "minOccurs", "0", "maxOccurs", "unbounded" );
- writer.writeElement( "xsd:element", "", "ref", "Indicator", "minOccurs", "0", "maxOccurs", "unbounded" );
- writer.writeElement( "xsd:element", "", "ref", "IndicatorType", "minOccurs", "0", "maxOccurs", "unbounded" );
- writer.writeElement( "xsd:element", "", "ref", "IndicatorGroupMember", "minOccurs", "0", "maxOccurs", "unbounded" );
- writer.writeElement( "xsd:element", "", "ref", "DataPeriodType", "minOccurs", "0", "maxOccurs", "unbounded" );
+ writer.writeElement( "xsd:element", "", "ref", "OrgUnit", "minOccurs", "0", "maxOccurs", "unbounded" );
+ writer.writeElement( "xsd:element", "", "ref", "OrgUnitHierarchy", "minOccurs", "0", "maxOccurs", "unbounded" );
+ writer.writeElement( "xsd:element", "", "ref", "OrgUnitStructure", "minOccurs", "0", "maxOccurs", "unbounded" );
+ writer.writeElement( "xsd:element", "", "ref", "DataType", "minOccurs", "0", "maxOccurs", "unbounded" );
+ //writer.writeElement( "xsd:element", "", "ref", "Indicator", "minOccurs", "0", "maxOccurs", "unbounded" );
+ //writer.writeElement( "xsd:element", "", "ref", "IndicatorType", "minOccurs", "0", "maxOccurs", "unbounded" );
+ //writer.writeElement( "xsd:element", "", "ref", "IndicatorGroupMember", "minOccurs", "0", "maxOccurs", "unbounded" );
writer.writeElement( "xsd:element", "", "ref", "UserName", "minOccurs", "0", "maxOccurs", "unbounded" );
- writer.writeElement( "xsd:element", "", "ref", "DataType", "minOccurs", "0", "maxOccurs", "unbounded" );
-
- writer.closeElement();
-
- writer.closeElement();
- */
+ writer.writeElement( "xsd:element", "", "ref", "UserInfoRole", "minOccurs", "0", "maxOccurs", "unbounded" );
+ //writer.writeElement( "xsd:element", "", "ref", "DataType", "minOccurs", "0", "maxOccurs", "unbounded" );
+ writer.writeElement( "xsd:element", "", "ref", "DataPeriod", "minOccurs", "0", "maxOccurs", "unbounded" );
+ //writer.writeElement( "xsd:element", "", "ref", "DataPeriodType", "minOccurs", "0", "maxOccurs", "unbounded" );
+
+ writer.closeElement();
+
+ writer.closeElement();
+
}
public void read( XMLReader reader, ImportParams params )
=== added file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/xsd/OrganisationUnitGroupXSDConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/xsd/OrganisationUnitGroupXSDConverter.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/xsd/OrganisationUnitGroupXSDConverter.java 2011-02-17 09:51:48 +0000
@@ -0,0 +1,56 @@
+package org.hisp.dhis.importexport.dhis14.xml.converter.xsd;
+
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.amplecode.staxwax.reader.XMLReader;
+import org.amplecode.staxwax.writer.XMLWriter;
+import org.hisp.dhis.importexport.ExportParams;
+import org.hisp.dhis.importexport.ImportParams;
+
+/**
+ * @author Jason P. Pickering
+ * @version $Id: OrganisationUnitXSDConverter.java 6455 2011-02-17 09:04:37Z jasonp $
+ */
+public class OrganisationUnitGroupXSDConverter
+ extends AbstractXSDConverter
+{
+ public OrganisationUnitGroupXSDConverter()
+ {
+ // Not implemented
+ }
+
+ public void write( XMLWriter writer, ExportParams params )
+ {
+ // Not implemented
+ }
+
+ public void read( XMLReader reader, ImportParams params )
+ {
+ // Not implemented
+ }
+}
=== added file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/xsd/OrganisationUnitHierarchyXSDConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/xsd/OrganisationUnitHierarchyXSDConverter.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/xsd/OrganisationUnitHierarchyXSDConverter.java 2011-02-17 09:51:48 +0000
@@ -0,0 +1,94 @@
+package org.hisp.dhis.importexport.dhis14.xml.converter.xsd;
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+
+import org.amplecode.staxwax.reader.XMLReader;
+import org.amplecode.staxwax.writer.XMLWriter;
+import org.hisp.dhis.importexport.ExportParams;
+import org.hisp.dhis.importexport.ImportParams;
+
+/**
+ * @author Jason P. Pickering
+ * @version $Id: OrganisationUnitXSDConverter.java 6455 2011-02-17 09:04:37Z jasonp $
+ */
+
+
+public class OrganisationUnitHierarchyXSDConverter
+extends AbstractXSDConverter
+{
+
+
+ public OrganisationUnitHierarchyXSDConverter()
+ {
+ }
+
+ // -------------------------------------------------------------------------
+ // XMLConverter implementation
+ // -------------------------------------------------------------------------
+
+ public void write( XMLWriter writer, ExportParams params )
+ {
+ if ( params.getOrganisationUnits() != null && params.getOrganisationUnits().size() > 0 )
+ {
+ writer.openElement( "xsd:element", "name", "OrgHierarchy" );
+
+ writeAnnotation( writer );
+
+ writer.openElement( "xsd:complexType" );
+
+ writer.openElement( "xsd:sequence" );
+
+ writeLongInteger( writer, "OrgHierarchyID", 1, true );
+
+ writeInteger( writer, "OrgUnitLevel", 0, false );
+
+ writeInteger( writer, "OrgUnitStructureID", 1, true );
+
+ writeInteger( writer, "OrgUnitChildID", 1, true );
+
+ writeInteger( writer, "OrgUnitParentID", 1, true );
+
+ writeInteger( writer, "LastUserID", 1, true );
+
+ writeDateTime( writer, "LastUpdated", 1, true );
+
+ writer.closeElement();
+
+ writer.closeElement();
+
+ writer.closeElement();
+ }
+ }
+
+ public void read( XMLReader reader, ImportParams params )
+ {
+ // Not implemented
+ }
+
+}
=== added file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/xsd/OrganisationUnitXSDConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/xsd/OrganisationUnitXSDConverter.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/xsd/OrganisationUnitXSDConverter.java 2011-02-17 09:51:48 +0000
@@ -0,0 +1,111 @@
+package org.hisp.dhis.importexport.dhis14.xml.converter.xsd;
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+
+import org.amplecode.staxwax.reader.XMLReader;
+import org.amplecode.staxwax.writer.XMLWriter;
+import org.hisp.dhis.importexport.ExportParams;
+import org.hisp.dhis.importexport.ImportParams;
+
+/**
+ * @author Jason P. Pickering
+ */
+
+public class OrganisationUnitXSDConverter
+extends AbstractXSDConverter
+{
+ public OrganisationUnitXSDConverter()
+ {
+ }
+ public void write( XMLWriter writer, ExportParams params )
+ {
+ if ( params.getOrganisationUnits() != null && params.getOrganisationUnits().size() > 0 )
+ {
+ writer.openElement( "xsd:element", "name", "OrgUnit" );
+
+ writeAnnotation( writer );
+
+ writer.openElement( "xsd:complexType" );
+
+ writer.openElement( "xsd:sequence" );
+
+ writeInteger( writer, "OrgUnitID", 1, true );
+
+ writeText( writer, "OrgUnitCode", 0, false, 15 );
+
+ writeInteger( writer, "OrgUnitLevel", 1, true );
+
+ writeText( writer, "OrgUnitName", 1, true, 230 );
+
+ writeText( writer, "OrgUnitShort", 1, true, 25 );
+
+ writeLongInteger( writer, "ValidFrom", 1, true );
+
+ writeLongInteger( writer, "ValidTo", 1, true );
+
+ writeInteger ( writer, "Active", 1, true);
+
+ writeMemo( writer, "Comment", 0, false, 536870910 );
+
+ writeInteger( writer, "Selected", 1, true );
+
+ writeInteger( writer, "LastUserID", 1, true );
+
+ writeDateTime( writer, "LastUpdated", 1, true );
+
+ writeText( writer, "OrgUnitNameOld", 0, false, 230 );
+
+ writeText( writer, "OrgUnitShortOld", 0, false, 25 );
+
+ writeText( writer, "OrgUnitNameAlt1", 0, false, 230 );
+
+ writeText( writer, "OrgUnitShortAlt1", 0, false, 25 );
+
+ writeText( writer, "OrgUnitNameAlt2", 0, false, 230 );
+
+ writeText( writer, "OrgUnitShortAlt2", 0, false, 25 );
+
+ writeText( writer, "OrgUnitNameAlt3", 0, false, 230 );
+
+ writeText( writer, "OrgUnitShortAlt3", 0, false, 25 );
+
+ writer.closeElement();
+
+ writer.closeElement();
+
+ writer.closeElement();
+ }
+ }
+
+ public void read( XMLReader reader, ImportParams params )
+ {
+ // Not implemented
+ }
+
+}
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/exporter/DefaultDhis14XMLExportService.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/exporter/DefaultDhis14XMLExportService.java 2010-10-29 12:19:15 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/exporter/DefaultDhis14XMLExportService.java 2011-02-17 09:51:48 +0000
@@ -44,6 +44,10 @@
import org.hisp.dhis.importexport.ExportParams;
import org.hisp.dhis.importexport.ExportPipeThread;
import org.hisp.dhis.importexport.ExportService;
+import org.hisp.dhis.importexport.dhis14.xml.converter.OrganisationUnitConverter;
+import org.hisp.dhis.importexport.dhis14.xml.converter.OrganisationUnitGroupConverter;
+import org.hisp.dhis.importexport.dhis14.xml.converter.OrganisationUnitGroupMemberConverter;
+import org.hisp.dhis.importexport.dhis14.xml.converter.OrganisationUnitHierarchyConverter;
import org.hisp.dhis.importexport.dhis14.xml.converter.CalculatedDataElementAssociationConverter;
import org.hisp.dhis.importexport.dhis14.xml.converter.DataElementConverter;
import org.hisp.dhis.importexport.dhis14.xml.converter.DataTypeConverter;
@@ -53,17 +57,14 @@
import org.hisp.dhis.importexport.dhis14.xml.converter.PeriodTypeConverter;
import org.hisp.dhis.importexport.dhis14.xml.converter.UserConverter;
import org.hisp.dhis.importexport.dhis14.xml.converter.UserRoleConverter;
-import org.hisp.dhis.importexport.dhis14.xml.converter.xsd.CalculatedDataElementAssociationXSDConverter;
-import org.hisp.dhis.importexport.dhis14.xml.converter.xsd.DataElementXSDConverter;
-import org.hisp.dhis.importexport.dhis14.xml.converter.xsd.DataRootXSDConverter;
-import org.hisp.dhis.importexport.dhis14.xml.converter.xsd.DataTypeXSDConverter;
-import org.hisp.dhis.importexport.dhis14.xml.converter.xsd.IndicatorTypeXSDConverter;
-import org.hisp.dhis.importexport.dhis14.xml.converter.xsd.IndicatorXSDConverter;
-import org.hisp.dhis.importexport.dhis14.xml.converter.xsd.PeriodTypeXSDConverter;
-import org.hisp.dhis.importexport.dhis14.xml.converter.xsd.UserRoleXSDConverter;
-import org.hisp.dhis.importexport.dhis14.xml.converter.xsd.UserXSDConverter;
+
+import org.hisp.dhis.importexport.dhis14.xml.converter.xsd.*;
+
import org.hisp.dhis.indicator.IndicatorService;
import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
+
/**
* @author Lars Helge Overland
@@ -123,7 +124,18 @@
{
this.aggregatedDataValueService = aggregatedDataValueService;
}
-
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+ private OrganisationUnitGroupService organisationUnitGroupService;
+
+ public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
+ {
+ this.organisationUnitGroupService = organisationUnitGroupService;
+ }
// -------------------------------------------------------------------------
// ExportService implementation
// -------------------------------------------------------------------------
@@ -161,19 +173,27 @@
thread.setRootProperties( ROOT_PROPERTIES );
thread.registerXSDConverter( new DataRootXSDConverter() );
-
- thread.registerXSDConverter( new PeriodTypeXSDConverter() );
thread.registerXSDConverter( new DataElementXSDConverter() );
thread.registerXSDConverter( new CalculatedDataElementAssociationXSDConverter() );
+ thread.registerXSDConverter( new PeriodTypeXSDConverter() );
+ thread.registerXSDConverter(new OrganisationUnitXSDConverter() );
+ thread.registerXSDConverter( new OrganisationUnitHierarchyXSDConverter() );
thread.registerXSDConverter( new IndicatorTypeXSDConverter() );
thread.registerXSDConverter( new IndicatorXSDConverter() );
thread.registerXSDConverter( new DataTypeXSDConverter() );
thread.registerXSDConverter( new UserXSDConverter() );
thread.registerXSDConverter( new UserRoleXSDConverter() );
- thread.registerXMLConverter( new PeriodTypeConverter() );
- thread.registerXMLConverter( new CalculatedDataElementAssociationConverter( dataElementService ) );
thread.registerXMLConverter( new DataElementConverter( dataElementService ) );
+ thread.registerXMLConverter( new CalculatedDataElementAssociationConverter( dataElementService ) );
+ thread.registerXMLConverter( new PeriodTypeConverter() );
+ thread.registerXMLConverter( new CalculatedDataElementAssociationConverter( dataElementService ) );
+ thread.registerXMLConverter( new PeriodTypeConverter() );
+ thread.registerXMLConverter( new OrganisationUnitConverter( organisationUnitService ) );
+ //thread.registerXMLConverter( new OrganisationUnitGroupConverter( organisationUnitGroupService ) );
+ //thread.registerXMLConverter( new OrganisationUnitGroupMemberConverter( organisationUnitGroupService, organisationUnitService ) );
+ thread.registerXMLConverter( new OrganisationUnitHierarchyConverter( organisationUnitService ) );
+ thread.registerXMLConverter( new OrganisationUnitConverter( organisationUnitService ) );
thread.registerXMLConverter( new IndicatorTypeConverter( indicatorService ) );
thread.registerXMLConverter( new IndicatorConverter( indicatorService ) );
thread.registerXMLConverter( new DataTypeConverter() );
=== 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 2011-02-16 17:16:18 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml 2011-02-17 07:01:28 +0000
@@ -347,6 +347,9 @@
class="org.hisp.dhis.importexport.dhis14.xml.exporter.DefaultDhis14XMLExportService">
<property name="sessionFactory" ref="sessionFactory"/>
<property name="statementManager" ref="statementManager"/>
+ <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ <property name="organisationUnitGroupService"
+ ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
<property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
<property name="periodService" ref="org.hisp.dhis.period.PeriodService" />