------------------------------------------------------------ revno: 8434 committer: Morten Olav Hansen <[email protected]> branch nick: dhis2 timestamp: Mon 2012-10-08 19:42:51 +0200 message: added basic form object, available at /api/dataSets/UID/form added: dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/FormUtils.java dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/Field.java dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/Form.java dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/InputType.java dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/Section.java modified: dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataSetController.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-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataSetController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataSetController.java 2012-06-06 14:46:46 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataSetController.java 2012-10-08 17:42:51 +0000 @@ -27,9 +27,19 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import org.hisp.dhis.api.utils.ContextUtils; +import org.hisp.dhis.api.utils.FormUtils; +import org.hisp.dhis.api.webdomain.form.Form; import org.hisp.dhis.dataset.DataSet; +import org.hisp.dhis.dxf2.utils.JacksonUtils; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; /** * @author Morten Olav Hansen <[email protected]> @@ -40,4 +50,48 @@ extends AbstractCrudController<DataSet> { public static final String RESOURCE_PATH = "/dataSets"; + + @RequestMapping( value = "/{uid}/form", method = RequestMethod.GET, produces = {"application/json", "text/*"} ) + public void getFormJson( @PathVariable( "uid" ) String uid, HttpServletRequest request, HttpServletResponse response ) throws IOException + { + DataSet dataSet = getEntity( uid ); + + if ( dataSet == null ) + { + ContextUtils.notFoundResponse( response, "Object not found for uid: " + uid ); + return; + } + + Form form = FormUtils.fromDataSet( dataSet ); + + JacksonUtils.toJson( response.getOutputStream(), form ); + } + + @RequestMapping( value = "/{uid}/form", method = RequestMethod.GET, produces = {"application/xml", "text/xml"} ) + public void getFormXml( @PathVariable( "uid" ) String uid, HttpServletRequest request, HttpServletResponse response ) throws IOException + { + DataSet dataSet = getEntity( uid ); + + if ( dataSet == null ) + { + ContextUtils.notFoundResponse( response, "Object not found for uid: " + uid ); + return; + } + + Form form = FormUtils.fromDataSet( dataSet ); + + JacksonUtils.toXml( response.getOutputStream(), form ); + } + + @RequestMapping( value = "/{uid}/form", method = RequestMethod.POST, consumes = "application/json" ) + public void postFormJson( @PathVariable( "uid" ) String uid, HttpServletRequest request, HttpServletResponse response ) + { + System.err.println( "postFormJson" ); + } + + @RequestMapping( value = "/{uid}/form", method = RequestMethod.POST, consumes = {"application/xml", "text/xml"} ) + public void postFormXml( @PathVariable( "uid" ) String uid, HttpServletRequest request, HttpServletResponse response ) + { + System.err.println( "postFormXml" ); + } } === added file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/FormUtils.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/FormUtils.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/FormUtils.java 2012-10-08 17:42:51 +0000 @@ -0,0 +1,164 @@ +package org.hisp.dhis.api.utils; + +/* +* 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 org.hisp.dhis.api.webdomain.form.Form; +import org.hisp.dhis.api.webdomain.form.Field; +import org.hisp.dhis.api.webdomain.form.InputType; +import org.hisp.dhis.api.webdomain.form.Section; +import org.hisp.dhis.dataelement.DataElement; +import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; +import org.hisp.dhis.dataset.DataSet; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * @author Morten Olav Hansen <[email protected]> + */ +public class FormUtils +{ + public static Form fromDataSet( DataSet dataSet ) + { + Form form = new Form(); + form.setName( dataSet.getName() ); + form.setPeriod( dataSet.getPeriodType().getIsoFormat() ); + + if ( dataSet.getSections().size() > 0 ) + { + for ( org.hisp.dhis.dataset.Section section : dataSet.getSections() ) + { + Section s = new Section(); + s.setName( section.getName() ); + s.setFields( inputsFromDataElements( section.getDataElements() ) ); + form.getSections().add( s ); + } + } + else + { + Section s = new Section(); + s.setName( "default" ); + s.setFields( inputsFromDataElements( dataSet.getDataElements() ) ); + + form.getSections().add( s ); + } + + return form; + } + + private static List<Field> inputsFromDataElements( Collection<DataElement> dataElements ) + { + List<Field> fields = new ArrayList<Field>(); + + for ( DataElement dataElement : dataElements ) + { + if ( dataElement.getCategoryCombo().getName().equalsIgnoreCase( "default" ) ) + { + Field field = new Field(); + + field.setName( dataElement.getName() ); + field.setDataElement( dataElement.getUid() ); + field.setCategoryOptionCombo( dataElement.getCategoryCombo().getSortedOptionCombos().get( 0 ).getUid() ); + field.setType( inputTypeFromDataElement( dataElement ) ); + field.setValue( "" ); + + fields.add( field ); + } + else + { + for ( DataElementCategoryOptionCombo categoryOptionCombo : dataElement.getCategoryCombo().getSortedOptionCombos() ) + { + Field field = new Field(); + + field.setName( dataElement.getName() + " " + categoryOptionCombo.getName() ); + field.setDataElement( dataElement.getUid() ); + field.setCategoryOptionCombo( categoryOptionCombo.getUid() ); + field.setType( inputTypeFromDataElement( dataElement ) ); + field.setValue( "" ); + + fields.add( field ); + } + } + } + + return fields; + } + + private static InputType inputTypeFromDataElement( DataElement dataElement ) + { + if ( dataElement.getType().equalsIgnoreCase( "string" ) ) + { + if ( dataElement.getTextType().equalsIgnoreCase( "text" ) ) + { + return InputType.TEXT; + } + /* + else if ( dataElement.getTextType().equalsIgnoreCase( "longtext" ) ) + { + return InputType.TEXT_LONG; + } + */ + } + else if ( dataElement.getType().equalsIgnoreCase( "int" ) ) + { + if ( dataElement.getNumberType().equalsIgnoreCase( "number" ) ) + { + return InputType.NUMBER; + } + else if ( dataElement.getNumberType().equalsIgnoreCase( "int" ) ) + { + return InputType.INTEGER; + } + else if ( dataElement.getNumberType().equalsIgnoreCase( "positiveNumber" ) ) + { + return InputType.INTEGER_POSITIVE; + } + else if ( dataElement.getNumberType().equalsIgnoreCase( "negativeNumber" ) ) + { + return InputType.INTEGER_NEGATIVE; + } + } + else if ( dataElement.getType().equalsIgnoreCase( "bool" ) ) + { + return InputType.BOOLEAN; + } + /* + else if ( dataElement.getType().equalsIgnoreCase( "trueOnly" ) ) + { + return InputType.TRUE_ONLY; + } + */ + else if ( dataElement.getType().equalsIgnoreCase( "date" ) ) + { + return InputType.DATE; + } + + return null; + } +} === added directory 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form' === added file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/Field.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/Field.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/Field.java 2012-10-08 17:42:51 +0000 @@ -0,0 +1,114 @@ +package org.hisp.dhis.api.webdomain.form; + +/* +* 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 com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import org.hisp.dhis.common.Dxf2Namespace; + +/** + * @author Morten Olav Hansen <[email protected]> + */ +@JacksonXmlRootElement( localName = "field", namespace = Dxf2Namespace.NAMESPACE ) +public class Field +{ + private String name; + + private String dataElement; + + private String categoryOptionCombo; + + private String value; + + private InputType type; + + public Field() + { + } + + @JsonProperty + @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE ) + public String getName() + { + return name; + } + + public void setName( String name ) + { + this.name = name; + } + + @JsonProperty + @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE ) + public String getDataElement() + { + return dataElement; + } + + public void setDataElement( String dataElement ) + { + this.dataElement = dataElement; + } + + @JsonProperty + @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE ) + public String getCategoryOptionCombo() + { + return categoryOptionCombo; + } + + public void setCategoryOptionCombo( String categoryOptionCombo ) + { + this.categoryOptionCombo = categoryOptionCombo; + } + + @JsonProperty + @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE ) + public String getValue() + { + return value; + } + + public void setValue( String value ) + { + this.value = value; + } + + @JsonProperty + @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE ) + public InputType getType() + { + return type; + } + + public void setType( InputType type ) + { + this.type = type; + } +} === added file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/Form.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/Form.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/Form.java 2012-10-08 17:42:51 +0000 @@ -0,0 +1,91 @@ +package org.hisp.dhis.api.webdomain.form; + +/* +* 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 com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import org.hisp.dhis.common.Dxf2Namespace; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Morten Olav Hansen <[email protected]> + */ +@JacksonXmlRootElement( localName = "form", namespace = Dxf2Namespace.NAMESPACE ) +public class Form +{ + private String name; + + private String period; + + private List<Section> sections = new ArrayList<Section>(); + + public Form() + { + } + + @JsonProperty + @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE ) + public String getName() + { + return name; + } + + public void setName( String name ) + { + this.name = name; + } + + @JsonProperty + @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE ) + public String getPeriod() + { + return period; + } + + public void setPeriod( String period ) + { + this.period = period; + } + + @JsonProperty + @JacksonXmlElementWrapper( localName = "sections", namespace = Dxf2Namespace.NAMESPACE ) + @JacksonXmlProperty( localName = "section", namespace = Dxf2Namespace.NAMESPACE ) + public List<Section> getSections() + { + return sections; + } + + public void setSections( List<Section> sections ) + { + this.sections = sections; + } +} === added file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/InputType.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/InputType.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/InputType.java 2012-10-08 17:42:51 +0000 @@ -0,0 +1,44 @@ +package org.hisp.dhis.api.webdomain.form; + +/* +* 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. +*/ + +/** + * @author Morten Olav Hansen <[email protected]> + */ +public enum InputType +{ + TEXT, + POSITIVE_INTEGER, + BOOLEAN, + DATE, + NUMBER, + INTEGER, + INTEGER_POSITIVE, + INTEGER_NEGATIVE, + NEGATIVE_INTEGER +} === added file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/Section.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/Section.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/Section.java 2012-10-08 17:42:51 +0000 @@ -0,0 +1,77 @@ +package org.hisp.dhis.api.webdomain.form; + +/* +* 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 com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import org.hisp.dhis.common.Dxf2Namespace; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Morten Olav Hansen <[email protected]> + */ +@JacksonXmlRootElement( localName = "section", namespace = Dxf2Namespace.NAMESPACE ) +public class Section +{ + private String name; + + private List<Field> fields = new ArrayList<Field>(); + + public Section() + { + } + + @JsonProperty + @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE ) + public String getName() + { + return name; + } + + public void setName( String name ) + { + this.name = name; + } + + @JsonProperty + @JacksonXmlElementWrapper( localName = "fields", namespace = Dxf2Namespace.NAMESPACE ) + @JacksonXmlProperty( localName = "field", namespace = Dxf2Namespace.NAMESPACE ) + public List<Field> getFields() + { + return fields; + } + + public void setFields( List<Field> fields ) + { + this.fields = fields; + } +}
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : [email protected] Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp

