dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #06217
Re: [Branch ~dhis2-devs-core/dhis2/trunk] Rev 1946: Modified DXF, coordinates are now nested within feature, and feature type is an attribute of feat...
Minor tweak: suggest <coordinate> is renamed <coordinates>.. You are
storing multiple coordinates in this element.
On 2 June 2010 10:52, <noreply@xxxxxxxxxxxxx> wrote:
> ------------------------------------------------------------
> revno: 1946
> committer: Lars <larshelg@larshelg-laptop>
> branch nick: trunk
> timestamp: Wed 2010-06-02 11:51:11 +0200
> message:
> Modified DXF, coordinates are now nested within feature, and feature type is an attribute of feature.
> modified:
> dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/OrganisationUnitConverter.java
> dhis-2/dhis-services/dhis-service-importexport/src/test/resources/dxfOrganisationUnits.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/dxf/converter/OrganisationUnitConverter.java'
> --- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/OrganisationUnitConverter.java 2010-05-29 16:06:56 +0000
> +++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/OrganisationUnitConverter.java 2010-06-02 09:51:11 +0000
> @@ -65,10 +65,10 @@
> private static final String FIELD_ACTIVE = "active";
> private static final String FIELD_COMMENT = "comment";
> private static final String FIELD_GEO_CODE = "geoCode";
> - private static final String FIELD_COORDINATES = "coordinates";
> private static final String FIELD_COORDINATE = "coordinate";
> - private static final String FIELD_FEATURE_TYPE = "featureType";
> + private static final String FIELD_FEATURE = "feature";
> private static final String FIELD_LAST_UPDATED = "lastUpdated";
> + private static final String ATTRIBUTE_TYPE = "type";
>
> // -------------------------------------------------------------------------
> // Constructor
> @@ -126,9 +126,8 @@
> writer.writeElement( FIELD_ACTIVE, String.valueOf( unit.isActive() ) );
> writer.writeElement( FIELD_COMMENT, unit.getComment() );
> writer.writeElement( FIELD_GEO_CODE, unit.getGeoCode() );
> - writer.writeElement( FIELD_FEATURE_TYPE, unit.getFeatureType() );
>
> - writer.openElement( FIELD_COORDINATES );
> + writer.openElement( FIELD_FEATURE, ATTRIBUTE_TYPE, unit.getFeatureType() );
> for ( String coordinate : unit.getCoordinatesAsCollection() )
> {
> writer.writeElement( FIELD_COORDINATE, coordinate );
> @@ -182,11 +181,11 @@
> reader.moveToStartElement( FIELD_GEO_CODE );
> unit.setGeoCode( reader.getElementValue() );
>
> - reader.moveToStartElement( FIELD_FEATURE_TYPE );
> - unit.setFeatureType( reader.getElementValue() );
> + reader.moveToStartElement( FIELD_FEATURE );
> + unit.setFeatureType( reader.getAttributeValue( ATTRIBUTE_TYPE ) );
>
> Collection<String> coordinates = new ArrayList<String>();
> - while ( reader.moveToStartElement( FIELD_COORDINATE, FIELD_COORDINATES ) )
> + while ( reader.moveToStartElement( FIELD_COORDINATE, FIELD_FEATURE ) )
> {
> coordinates.add( reader.getElementValue() );
> }
>
> === modified file 'dhis-2/dhis-services/dhis-service-importexport/src/test/resources/dxfOrganisationUnits.xml'
> --- dhis-2/dhis-services/dhis-service-importexport/src/test/resources/dxfOrganisationUnits.xml 2010-05-25 17:36:53 +0000
> +++ dhis-2/dhis-services/dhis-service-importexport/src/test/resources/dxfOrganisationUnits.xml 2010-06-02 09:51:11 +0000
> @@ -11,12 +11,11 @@
> <active>true</active>
> <comment>Comment</comment>
> <geoCode>GeoCode</geoCode>
> -<featureType>MultiPolygon</featureType>
> -<coordinates>
> +<feature type="MultiPolygon">
> <coordinate>11.11,22.22 33.33,44.44 55.55,66.66</coordinate>
> <coordinate>77.77,88.88 99.99,11.11 22.22,33.33</coordinate>
> <coordinate>44.44,55.55 66.66,77.77 88.88,99.99</coordinate>
> -</coordinates>
> +</feature>
> <lastUpdated>2010-01-01</lastUpdated>
> </organisationUnit>
> <organisationUnit>
> @@ -30,12 +29,11 @@
> <active>true</active>
> <comment>Comment</comment>
> <geoCode>GeoCode</geoCode>
> -<featureType>MultiPolygon</featureType>
> -<coordinates>
> +<feature type="MultiPolygon">
> <coordinate>11.11,22.22 33.33,44.44 55.55,66.66</coordinate>
> <coordinate>77.77,88.88 99.99,11.11 22.22,33.33</coordinate>
> <coordinate>44.44,55.55 66.66,77.77 88.88,99.99</coordinate>
> -</coordinates>
> +</feature>
> <lastUpdated>2010-01-01</lastUpdated>
> </organisationUnit>
> <organisationUnit>
> @@ -49,12 +47,11 @@
> <active>true</active>
> <comment>Comment</comment>
> <geoCode>GeoCode</geoCode>
> -<featureType>MultiPolygon</featureType>
> -<coordinates>
> +<feature type="MultiPolygon">
> <coordinate>11.11,22.22 33.33,44.44 55.55,66.66</coordinate>
> <coordinate>77.77,88.88 99.99,11.11 22.22,33.33</coordinate>
> <coordinate>44.44,55.55 66.66,77.77 88.88,99.99</coordinate>
> -</coordinates>
> +</feature>
> <lastUpdated>2010-01-01</lastUpdated>
> </organisationUnit>
> </organisationUnits>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help : https://help.launchpad.net/ListHelp
>
>
Follow ups
References