=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attribute.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attribute.java 2011-12-06 04:28:54 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attribute.java 2011-12-06 19:19:40 +0000 @@ -159,6 +159,8 @@ this.attributeValues = attributeValues; } + @XmlElement + @JsonProperty public Integer getSortOrder() { return sortOrder; === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeValue.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeValue.java 2011-12-03 10:35:41 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeValue.java 2011-12-06 19:52:58 +0000 @@ -28,12 +28,16 @@ package org.hisp.dhis.attribute; import org.codehaus.jackson.annotate.JsonProperty; +import org.codehaus.jackson.map.annotate.JsonSerialize; import org.hisp.dhis.common.Dxf2Namespace; +import org.hisp.dhis.common.adapter.BaseIdentifiableObjectXmlAdapter; +import org.hisp.dhis.common.adapter.JsonIdentifiableObjectSerializer; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import java.io.Serializable; /** @@ -70,6 +74,14 @@ return id; } + public void setId( int id ) + { + this.id = id; + } + + @XmlElement( name = "attribute" ) + @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class ) + @JsonSerialize( using = JsonIdentifiableObjectSerializer.class ) public Attribute getAttribute() { return attribute; @@ -80,11 +92,6 @@ this.attribute = attribute; } - public void setId( int id ) - { - this.id = id; - } - @XmlElement @JsonProperty public String getValue() === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java 2011-12-06 10:54:49 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java 2011-12-06 19:52:58 +0000 @@ -31,7 +31,7 @@ import org.codehaus.jackson.map.annotate.JsonSerialize; import org.hisp.dhis.common.BaseIdentifiableObject; import org.hisp.dhis.common.adapter.BaseNameableObjectXmlAdapter; -import org.hisp.dhis.common.adapter.JsonNameableObjectListSerializer; +import org.hisp.dhis.common.adapter.JsonNameableObjectCollectionSerializer; import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataset.DataSet; import org.hisp.dhis.i18n.I18nFormat; @@ -476,7 +476,7 @@ @XmlElementWrapper( name = "indicators" ) @XmlElement( name = "indicator" ) @JsonProperty - @JsonSerialize( using = JsonNameableObjectListSerializer.class ) + @JsonSerialize( using = JsonNameableObjectCollectionSerializer.class ) public List getIndicators() { return indicators; @@ -491,7 +491,7 @@ @XmlElementWrapper( name = "dataElements" ) @XmlElement( name = "dataElement" ) @JsonProperty - @JsonSerialize( using = JsonNameableObjectListSerializer.class ) + @JsonSerialize( using = JsonNameableObjectCollectionSerializer.class ) public List getDataElements() { return dataElements; @@ -506,7 +506,7 @@ @XmlElementWrapper( name = "dataSets" ) @XmlElement( name = "dataSet" ) @JsonProperty - @JsonSerialize( using = JsonNameableObjectListSerializer.class ) + @JsonSerialize( using = JsonNameableObjectCollectionSerializer.class ) public List getDataSets() { return dataSets; @@ -531,7 +531,7 @@ @XmlElementWrapper( name = "organisationUnits" ) @XmlElement( name = "organisationUnit" ) @JsonProperty - @JsonSerialize( using = JsonNameableObjectListSerializer.class ) + @JsonSerialize( using = JsonNameableObjectCollectionSerializer.class ) public List getOrganisationUnits() { return organisationUnits; === added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonCollectionSerializer.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonCollectionSerializer.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonCollectionSerializer.java 2011-12-06 19:52:58 +0000 @@ -0,0 +1,55 @@ +package org.hisp.dhis.common.adapter; + +/* + * Copyright (c) 2004-2011, 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.codehaus.jackson.JsonGenerator; +import org.codehaus.jackson.JsonProcessingException; +import org.codehaus.jackson.map.JsonSerializer; +import org.codehaus.jackson.map.SerializerProvider; + +import java.io.IOException; +import java.util.Collection; + +/** + * @author Morten Olav Hansen + */ +public class JsonCollectionSerializer extends JsonSerializer> +{ + @Override + public void serialize( Collection objects, JsonGenerator jgen, SerializerProvider provider ) throws IOException, JsonProcessingException + { + jgen.writeStartArray(); + + for ( Object object : objects ) + { + jgen.writeObject( object ); + } + + jgen.writeEndArray(); + } +} === added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonIdentifiableObjectCollectionSerializer.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonIdentifiableObjectCollectionSerializer.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonIdentifiableObjectCollectionSerializer.java 2011-12-06 19:52:58 +0000 @@ -0,0 +1,58 @@ +package org.hisp.dhis.common.adapter; + +/* + * Copyright (c) 2004-2011, 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.codehaus.jackson.JsonGenerator; +import org.codehaus.jackson.JsonProcessingException; +import org.codehaus.jackson.map.JsonSerializer; +import org.codehaus.jackson.map.SerializerProvider; +import org.hisp.dhis.common.IdentifiableObject; + +import java.io.IOException; +import java.util.Collection; + +/** + * @author Morten Olav Hansen + */ +public class JsonIdentifiableObjectCollectionSerializer extends JsonSerializer> +{ + @Override + public void serialize( Collection identifiableObjects, JsonGenerator jgen, SerializerProvider provider ) throws IOException, JsonProcessingException + { + JsonIdentifiableObjectSerializer jsonIdentifiableObjectSerializer = new JsonIdentifiableObjectSerializer(); + + jgen.writeStartArray(); + + for ( IdentifiableObject identifiableObject : identifiableObjects ) + { + jsonIdentifiableObjectSerializer.serialize( identifiableObject, jgen, provider ); + } + + jgen.writeEndArray(); + } +} === removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonIdentifiableObjectListSerializer.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonIdentifiableObjectListSerializer.java 2011-11-23 12:21:07 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonIdentifiableObjectListSerializer.java 1970-01-01 00:00:00 +0000 @@ -1,58 +0,0 @@ -package org.hisp.dhis.common.adapter; - -/* - * Copyright (c) 2004-2011, 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.codehaus.jackson.JsonGenerator; -import org.codehaus.jackson.JsonProcessingException; -import org.codehaus.jackson.map.JsonSerializer; -import org.codehaus.jackson.map.SerializerProvider; -import org.hisp.dhis.common.IdentifiableObject; - -import java.io.IOException; -import java.util.List; - -/** - * @author Morten Olav Hansen - */ -public class JsonIdentifiableObjectListSerializer extends JsonSerializer> -{ - @Override - public void serialize( List identifiableObjects, JsonGenerator jgen, SerializerProvider provider ) throws IOException, JsonProcessingException - { - JsonIdentifiableObjectSerializer jsonIdentifiableObjectSerializer = new JsonIdentifiableObjectSerializer(); - - jgen.writeStartArray(); - - for ( IdentifiableObject identifiableObject : identifiableObjects ) - { - jsonIdentifiableObjectSerializer.serialize( identifiableObject, jgen, provider ); - } - - jgen.writeEndArray(); - } -} === removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonIdentifiableObjectSetSerializer.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonIdentifiableObjectSetSerializer.java 2011-11-22 14:05:18 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonIdentifiableObjectSetSerializer.java 1970-01-01 00:00:00 +0000 @@ -1,58 +0,0 @@ -package org.hisp.dhis.common.adapter; - -/* - * Copyright (c) 2004-2011, 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.codehaus.jackson.JsonGenerator; -import org.codehaus.jackson.JsonProcessingException; -import org.codehaus.jackson.map.JsonSerializer; -import org.codehaus.jackson.map.SerializerProvider; -import org.hisp.dhis.common.IdentifiableObject; - -import java.io.IOException; -import java.util.Set; - -/** - * @author Morten Olav Hansen - */ -public class JsonIdentifiableObjectSetSerializer extends JsonSerializer> -{ - @Override - public void serialize( Set identifiableObjects, JsonGenerator jgen, SerializerProvider provider ) throws IOException, JsonProcessingException - { - JsonIdentifiableObjectSerializer jsonIdentifiableObjectSerializer = new JsonIdentifiableObjectSerializer(); - - jgen.writeStartArray(); - - for ( IdentifiableObject identifiableObject : identifiableObjects ) - { - jsonIdentifiableObjectSerializer.serialize( identifiableObject, jgen, provider ); - } - - jgen.writeEndArray(); - } -} === added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonNameableObjectCollectionSerializer.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonNameableObjectCollectionSerializer.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonNameableObjectCollectionSerializer.java 2011-12-06 19:52:58 +0000 @@ -0,0 +1,57 @@ +package org.hisp.dhis.common.adapter; + +/* + * Copyright (c) 2004-2011, 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.codehaus.jackson.JsonGenerator; +import org.codehaus.jackson.map.JsonSerializer; +import org.codehaus.jackson.map.SerializerProvider; +import org.hisp.dhis.common.NameableObject; + +import java.io.IOException; +import java.util.Collection; + +/** + * @author Morten Olav Hansen + */ +public class JsonNameableObjectCollectionSerializer extends JsonSerializer> +{ + @Override + public void serialize( Collection nameableObjects, JsonGenerator jgen, SerializerProvider provider ) throws IOException + { + JsonNameableObjectSerializer jsonNameableObjectSerializer = new JsonNameableObjectSerializer(); + + jgen.writeStartArray(); + + for ( NameableObject nameableObject : nameableObjects ) + { + jsonNameableObjectSerializer.serialize( nameableObject, jgen, provider ); + } + + jgen.writeEndArray(); + } +} === removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonNameableObjectListSerializer.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonNameableObjectListSerializer.java 2011-11-23 14:00:28 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonNameableObjectListSerializer.java 1970-01-01 00:00:00 +0000 @@ -1,58 +0,0 @@ -package org.hisp.dhis.common.adapter; - -/* - * Copyright (c) 2004-2011, 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.codehaus.jackson.JsonGenerator; -import org.codehaus.jackson.JsonProcessingException; -import org.codehaus.jackson.map.JsonSerializer; -import org.codehaus.jackson.map.SerializerProvider; -import org.hisp.dhis.common.NameableObject; - -import java.io.IOException; -import java.util.List; - -/** - * @author Morten Olav Hansen - */ -public class JsonNameableObjectListSerializer extends JsonSerializer> -{ - @Override - public void serialize( List nameableObjects, JsonGenerator jgen, SerializerProvider provider ) throws IOException, JsonProcessingException - { - JsonNameableObjectSerializer jsonNameableObjectSerializer = new JsonNameableObjectSerializer(); - - jgen.writeStartArray(); - - for ( NameableObject nameableObject : nameableObjects ) - { - jsonNameableObjectSerializer.serialize( nameableObject, jgen, provider ); - } - - jgen.writeEndArray(); - } -} === removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonNameableObjectSetSerializer.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonNameableObjectSetSerializer.java 2011-11-22 14:05:18 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonNameableObjectSetSerializer.java 1970-01-01 00:00:00 +0000 @@ -1,58 +0,0 @@ -package org.hisp.dhis.common.adapter; - -/* - * Copyright (c) 2004-2011, 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.codehaus.jackson.JsonGenerator; -import org.codehaus.jackson.JsonProcessingException; -import org.codehaus.jackson.map.JsonSerializer; -import org.codehaus.jackson.map.SerializerProvider; -import org.hisp.dhis.common.NameableObject; - -import java.io.IOException; -import java.util.Set; - -/** - * @author Morten Olav Hansen - */ -public class JsonNameableObjectSetSerializer extends JsonSerializer> -{ - @Override - public void serialize( Set nameableObjects, JsonGenerator jgen, SerializerProvider provider ) throws IOException, JsonProcessingException - { - JsonNameableObjectSerializer jsonNameableObjectSerializer = new JsonNameableObjectSerializer(); - - jgen.writeStartArray(); - - for ( NameableObject nameableObject : nameableObjects ) - { - jsonNameableObjectSerializer.serialize( nameableObject, jgen, provider ); - } - - jgen.writeEndArray(); - } -} === removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonSetSerializer.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonSetSerializer.java 2011-12-06 17:52:58 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonSetSerializer.java 1970-01-01 00:00:00 +0000 @@ -1,55 +0,0 @@ -package org.hisp.dhis.common.adapter; - -/* - * Copyright (c) 2004-2011, 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.codehaus.jackson.JsonGenerator; -import org.codehaus.jackson.JsonProcessingException; -import org.codehaus.jackson.map.JsonSerializer; -import org.codehaus.jackson.map.SerializerProvider; - -import java.io.IOException; -import java.util.Set; - -/** - * @author Morten Olav Hansen - */ -public class JsonSetSerializer extends JsonSerializer> -{ - @Override - public void serialize( Set objects, JsonGenerator jgen, SerializerProvider provider ) throws IOException, JsonProcessingException - { - jgen.writeStartArray(); - - for ( Object object : objects ) - { - jgen.writeObject( object ); - } - - jgen.writeEndArray(); - } -} === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2011-12-06 17:30:12 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2011-12-06 19:52:58 +0000 @@ -443,6 +443,8 @@ this.categoryCombo = categoryCombo; } + @XmlElement + @JsonProperty public Integer getSortOrder() { return sortOrder; @@ -468,7 +470,7 @@ @XmlElementWrapper( name = "dataElementGroups" ) @XmlElement( name = "dataElementGroup" ) @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class ) - @JsonSerialize( using = JsonIdentifiableObjectSetSerializer.class ) + @JsonSerialize( using = JsonIdentifiableObjectCollectionSerializer.class ) public Set getGroups() { return groups; @@ -482,7 +484,7 @@ @XmlElementWrapper( name = "dataSets" ) @XmlElement( name = "dataSet" ) @XmlJavaTypeAdapter( BaseNameableObjectXmlAdapter.class ) - @JsonSerialize( using = JsonNameableObjectSetSerializer.class ) + @JsonSerialize( using = JsonNameableObjectCollectionSerializer.class ) public Set getDataSets() { return dataSets; @@ -529,6 +531,9 @@ this.numberType = numberType; } + @XmlElementWrapper( name = "attributeValues" ) + @XmlElement( name = "attributeValue" ) + @JsonSerialize( using = JsonCollectionSerializer.class ) public Set getAttributeValues() { return attributeValues; === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java 2011-12-03 10:35:41 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java 2011-12-06 19:52:58 +0000 @@ -31,7 +31,7 @@ import org.hisp.dhis.common.BaseIdentifiableObject; import org.hisp.dhis.common.Dxf2Namespace; import org.hisp.dhis.common.adapter.BaseNameableObjectXmlAdapter; -import org.hisp.dhis.common.adapter.JsonNameableObjectListSerializer; +import org.hisp.dhis.common.adapter.JsonNameableObjectCollectionSerializer; import org.hisp.dhis.concept.Concept; import javax.xml.bind.annotation.*; @@ -151,7 +151,7 @@ @XmlElementWrapper( name = "categoryOptions" ) @XmlJavaTypeAdapter( BaseNameableObjectXmlAdapter.class ) @XmlElement( name = "categoryOption" ) - @JsonSerialize( using = JsonNameableObjectListSerializer.class ) + @JsonSerialize( using = JsonNameableObjectCollectionSerializer.class ) public List getCategoryOptions() { return categoryOptions; === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java 2011-12-03 10:35:41 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java 2011-12-06 19:52:58 +0000 @@ -32,8 +32,7 @@ import org.hisp.dhis.common.CombinationGenerator; import org.hisp.dhis.common.Dxf2Namespace; import org.hisp.dhis.common.adapter.BaseIdentifiableObjectXmlAdapter; -import org.hisp.dhis.common.adapter.JsonIdentifiableObjectSetSerializer; -import org.hisp.dhis.common.adapter.JsonIdentifiableObjectListSerializer; +import org.hisp.dhis.common.adapter.JsonIdentifiableObjectCollectionSerializer; import javax.xml.bind.annotation.*; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; @@ -216,7 +215,7 @@ @XmlElementWrapper( name = "categories" ) @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class ) @XmlElement( name = "category" ) - @JsonSerialize( using = JsonIdentifiableObjectListSerializer.class ) + @JsonSerialize( using = JsonIdentifiableObjectCollectionSerializer.class ) public List getCategories() { return categories; @@ -230,7 +229,7 @@ @XmlElementWrapper( name = "optionCombos" ) @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class ) @XmlElement( name = "optionCombo" ) - @JsonSerialize( using = JsonIdentifiableObjectSetSerializer.class ) + @JsonSerialize( using = JsonIdentifiableObjectCollectionSerializer.class ) public Set getOptionCombos() { return optionCombos; === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java 2011-12-03 10:35:41 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java 2011-12-06 19:52:58 +0000 @@ -155,7 +155,7 @@ @XmlElementWrapper( name = "categoryOptionCombos" ) @XmlJavaTypeAdapter( BaseNameableObjectXmlAdapter.class ) @XmlElement( name = "categoryOptionCombo" ) - @JsonSerialize( using = JsonNameableObjectSetSerializer.class ) + @JsonSerialize( using = JsonNameableObjectCollectionSerializer.class ) public Set getCategoryOptionCombos() { return categoryOptionCombos; === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java 2011-12-03 10:35:41 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java 2011-12-06 19:52:58 +0000 @@ -35,7 +35,7 @@ import org.hisp.dhis.common.adapter.BaseIdentifiableObjectXmlAdapter; import org.hisp.dhis.common.adapter.BaseNameableObjectXmlAdapter; import org.hisp.dhis.common.adapter.JsonIdentifiableObjectSerializer; -import org.hisp.dhis.common.adapter.JsonNameableObjectListSerializer; +import org.hisp.dhis.common.adapter.JsonNameableObjectCollectionSerializer; import javax.xml.bind.annotation.*; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; @@ -312,7 +312,7 @@ @XmlJavaTypeAdapter( BaseNameableObjectXmlAdapter.class ) @XmlElement( name = "categoryOption" ) @JsonProperty - @JsonSerialize( using = JsonNameableObjectListSerializer.class ) + @JsonSerialize( using = JsonNameableObjectCollectionSerializer.class ) public List getCategoryOptions() { return categoryOptions; === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java 2011-12-06 17:37:30 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java 2011-12-06 19:52:58 +0000 @@ -147,7 +147,7 @@ @XmlElementWrapper( name = "dataElements" ) @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class ) @XmlElement( name = "dataElement" ) - @JsonSerialize( using = JsonIdentifiableObjectSetSerializer.class ) + @JsonSerialize( using = JsonIdentifiableObjectCollectionSerializer.class ) public Set getMembers() { return members; === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java 2011-12-06 17:37:30 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java 2011-12-06 19:52:58 +0000 @@ -32,7 +32,7 @@ import org.hisp.dhis.common.BaseIdentifiableObject; import org.hisp.dhis.common.Dxf2Namespace; import org.hisp.dhis.common.adapter.BaseIdentifiableObjectXmlAdapter; -import org.hisp.dhis.common.adapter.JsonIdentifiableObjectListSerializer; +import org.hisp.dhis.common.adapter.JsonIdentifiableObjectCollectionSerializer; import org.hisp.dhis.dataelement.comparator.DataElementGroupNameComparator; import javax.xml.bind.annotation.*; @@ -222,7 +222,7 @@ @XmlElementWrapper( name = "dataElementGroups" ) @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class ) @XmlElement( name = "dataElementGroup" ) - @JsonSerialize( using = JsonIdentifiableObjectListSerializer.class ) + @JsonSerialize( using = JsonIdentifiableObjectCollectionSerializer.class ) public List getMembers() { return members; === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java 2011-12-06 17:52:58 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java 2011-12-06 19:52:58 +0000 @@ -306,7 +306,7 @@ @XmlElementWrapper( name = "dataElements" ) @XmlElement( name = "dataElement" ) @XmlJavaTypeAdapter( BaseNameableObjectXmlAdapter.class ) - @JsonSerialize( using = JsonNameableObjectSetSerializer.class ) + @JsonSerialize( using = JsonNameableObjectCollectionSerializer.class ) public Set getDataElements() { return dataElements; @@ -320,7 +320,7 @@ @XmlElementWrapper( name = "indicators" ) @XmlElement( name = "indicator" ) @XmlJavaTypeAdapter( BaseNameableObjectXmlAdapter.class ) - @JsonSerialize( using = JsonNameableObjectSetSerializer.class ) + @JsonSerialize( using = JsonNameableObjectCollectionSerializer.class ) public Set getIndicators() { return indicators; @@ -346,7 +346,7 @@ @XmlElementWrapper( name = "organisationUnits" ) @XmlElement( name = "organisationUnit" ) @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class ) - @JsonSerialize( using = JsonIdentifiableObjectSetSerializer.class ) + @JsonSerialize( using = JsonIdentifiableObjectCollectionSerializer.class ) public Set getSources() { return sources; @@ -357,6 +357,8 @@ this.sources = sources; } + @XmlElement + @JsonProperty public Integer getSortOrder() { return sortOrder; @@ -370,7 +372,7 @@ @XmlElementWrapper( name = "sections" ) @XmlElement( name = "section" ) @JsonProperty - @JsonSerialize( using = JsonSetSerializer.class ) + @JsonSerialize( using = JsonCollectionSerializer.class ) public Set
getSections() { return sections; === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java 2011-12-06 17:52:58 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java 2011-12-06 19:52:58 +0000 @@ -27,8 +27,7 @@ import org.codehaus.jackson.map.annotate.JsonSerialize; import org.hisp.dhis.common.Dxf2Namespace; import org.hisp.dhis.common.adapter.BaseIdentifiableObjectXmlAdapter; -import org.hisp.dhis.common.adapter.JsonIdentifiableObjectListSerializer; -import org.hisp.dhis.common.adapter.JsonIdentifiableObjectSetSerializer; +import org.hisp.dhis.common.adapter.JsonIdentifiableObjectCollectionSerializer; import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataelement.DataElementCategoryCombo; import org.hisp.dhis.dataelement.DataElementOperand; @@ -201,7 +200,7 @@ @XmlElementWrapper( name = "dataElements" ) @XmlElement( name = "dataElement" ) @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class ) - @JsonSerialize( using = JsonIdentifiableObjectListSerializer.class ) + @JsonSerialize( using = JsonIdentifiableObjectCollectionSerializer.class ) public List getDataElements() { return dataElements; @@ -217,6 +216,8 @@ this.dataElements.add( dataElement ); } + @XmlElement + @JsonProperty public int getSortOrder() { return sortOrder; === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java 2011-12-06 17:30:12 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java 2011-12-06 19:52:58 +0000 @@ -253,6 +253,8 @@ this.explodedDenominator = explodedDenominator; } + @XmlElement + @JsonProperty public Integer getSortOrder() { return sortOrder; @@ -278,7 +280,7 @@ @XmlElementWrapper( name = "indicatorGroups" ) @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class ) @XmlElement( name = "indicatorGroup" ) - @JsonSerialize( using = JsonIdentifiableObjectSetSerializer.class ) + @JsonSerialize( using = JsonIdentifiableObjectCollectionSerializer.class ) public Set getGroups() { return groups; @@ -292,7 +294,7 @@ @XmlElementWrapper( name = "dataSets" ) @XmlJavaTypeAdapter( BaseNameableObjectXmlAdapter.class ) @XmlElement( name = "dataSet" ) - @JsonSerialize( using = JsonNameableObjectSetSerializer.class ) + @JsonSerialize( using = JsonNameableObjectCollectionSerializer.class ) public Set getDataSets() { return dataSets; @@ -303,6 +305,9 @@ this.dataSets = dataSets; } + @XmlElementWrapper( name = "attributeValues" ) + @XmlElement( name = "attributeValue" ) + @JsonSerialize( using = JsonCollectionSerializer.class ) public Set getAttributeValues() { return attributeValues; === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java 2011-12-06 17:37:30 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java 2011-12-06 19:52:58 +0000 @@ -31,8 +31,8 @@ import org.hisp.dhis.common.BaseIdentifiableObject; import org.hisp.dhis.common.Dxf2Namespace; import org.hisp.dhis.common.adapter.BaseIdentifiableObjectXmlAdapter; +import org.hisp.dhis.common.adapter.JsonIdentifiableObjectCollectionSerializer; import org.hisp.dhis.common.adapter.JsonIdentifiableObjectSerializer; -import org.hisp.dhis.common.adapter.JsonIdentifiableObjectSetSerializer; import javax.xml.bind.annotation.*; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; @@ -146,7 +146,7 @@ @XmlElementWrapper( name = "indicators" ) @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class ) @XmlElement( name = "indicator" ) - @JsonSerialize( using = JsonIdentifiableObjectSetSerializer.class ) + @JsonSerialize( using = JsonIdentifiableObjectCollectionSerializer.class ) public Set getMembers() { return members; === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.java 2011-12-06 17:37:30 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.java 2011-12-06 19:52:58 +0000 @@ -37,7 +37,7 @@ import org.hisp.dhis.common.BaseIdentifiableObject; import org.hisp.dhis.common.Dxf2Namespace; import org.hisp.dhis.common.adapter.BaseIdentifiableObjectXmlAdapter; -import org.hisp.dhis.common.adapter.JsonIdentifiableObjectListSerializer; +import org.hisp.dhis.common.adapter.JsonIdentifiableObjectCollectionSerializer; import org.hisp.dhis.indicator.comparator.IndicatorGroupNameComparator; import javax.xml.bind.annotation.*; @@ -223,7 +223,7 @@ @XmlElementWrapper( name = "indicatorGroups" ) @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class ) @XmlElement( name = "indicatorGroup" ) - @JsonSerialize( using = JsonIdentifiableObjectListSerializer.class ) + @JsonSerialize( using = JsonIdentifiableObjectCollectionSerializer.class ) public List getMembers() { return members; === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2011-12-06 18:18:18 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2011-12-06 19:52:58 +0000 @@ -30,7 +30,6 @@ import org.apache.commons.lang.StringUtils; import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.map.annotate.JsonSerialize; -import org.hisp.dhis.aggregation.AggregatedMapValue; import org.hisp.dhis.attribute.AttributeValue; import org.hisp.dhis.common.BaseNameableObject; import org.hisp.dhis.common.Dxf2Namespace; @@ -628,7 +627,7 @@ @XmlElementWrapper( name = "organisationUnitGroups" ) @XmlElement( name = "organisationUnitGroup" ) @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class ) - @JsonSerialize( using = JsonIdentifiableObjectSetSerializer.class ) + @JsonSerialize( using = JsonIdentifiableObjectCollectionSerializer.class ) public Set getGroups() { return groups; @@ -642,7 +641,7 @@ @XmlElementWrapper( name = "dataSets" ) @XmlElement( name = "dataSet" ) @XmlJavaTypeAdapter( BaseNameableObjectXmlAdapter.class ) - @JsonSerialize( using = JsonNameableObjectSetSerializer.class ) + @JsonSerialize( using = JsonNameableObjectCollectionSerializer.class ) public Set getDataSets() { return dataSets; @@ -758,6 +757,9 @@ this.type = type; } + @XmlElementWrapper( name = "attributeValues" ) + @XmlElement( name = "attributeValue" ) + @JsonSerialize( using = JsonCollectionSerializer.class ) public Set getAttributeValues() { return attributeValues; === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java 2011-12-06 17:37:30 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java 2011-12-06 19:52:58 +0000 @@ -30,10 +30,7 @@ import org.codehaus.jackson.map.annotate.JsonSerialize; import org.hisp.dhis.common.BaseIdentifiableObject; import org.hisp.dhis.common.Dxf2Namespace; -import org.hisp.dhis.common.adapter.BaseIdentifiableObjectXmlAdapter; -import org.hisp.dhis.common.adapter.BaseNameableObjectXmlAdapter; -import org.hisp.dhis.common.adapter.JsonIdentifiableObjectSerializer; -import org.hisp.dhis.common.adapter.JsonNameableObjectSetSerializer; +import org.hisp.dhis.common.adapter.*; import javax.xml.bind.annotation.*; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; @@ -147,7 +144,7 @@ @XmlElementWrapper( name = "organisationUnits" ) @XmlElement( name = "organisationUnit" ) @XmlJavaTypeAdapter( BaseNameableObjectXmlAdapter.class ) - @JsonSerialize( using = JsonNameableObjectSetSerializer.class ) + @JsonSerialize( using = JsonNameableObjectCollectionSerializer.class ) public Set getMembers() { return members; === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java 2011-12-03 10:35:41 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java 2011-12-06 19:52:58 +0000 @@ -32,7 +32,7 @@ import org.hisp.dhis.common.BaseIdentifiableObject; import org.hisp.dhis.common.Dxf2Namespace; import org.hisp.dhis.common.adapter.BaseIdentifiableObjectXmlAdapter; -import org.hisp.dhis.common.adapter.JsonIdentifiableObjectSetSerializer; +import org.hisp.dhis.common.adapter.JsonIdentifiableObjectCollectionSerializer; import org.hisp.dhis.organisationunit.comparator.OrganisationUnitGroupNameComparator; import javax.xml.bind.annotation.*; @@ -200,7 +200,7 @@ @XmlElementWrapper( name = "organisationUnitGroups" ) @XmlElement( name = "organisationUnitGroup" ) @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class ) - @JsonSerialize( using = JsonIdentifiableObjectSetSerializer.class ) + @JsonSerialize( using = JsonIdentifiableObjectCollectionSerializer.class ) public Set getOrganisationUnitGroups() { return organisationUnitGroups; === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/User.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/User.java 2011-12-03 14:31:45 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/User.java 2011-12-06 19:52:58 +0000 @@ -29,15 +29,14 @@ import org.apache.commons.collections.CollectionUtils; import org.codehaus.jackson.annotate.JsonProperty; +import org.codehaus.jackson.map.annotate.JsonSerialize; import org.hisp.dhis.attribute.AttributeValue; import org.hisp.dhis.common.Dxf2Namespace; import org.hisp.dhis.common.IdentifiableObjectUtils; +import org.hisp.dhis.common.adapter.JsonCollectionSerializer; import org.hisp.dhis.organisationunit.OrganisationUnit; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.*; import java.io.Serializable; import java.util.Collection; import java.util.HashSet; @@ -282,6 +281,9 @@ this.organisationUnits = organisationUnits; } + @XmlElementWrapper( name = "attributeValues" ) + @XmlElement( name = "attributeValue" ) + @JsonSerialize( using = JsonCollectionSerializer.class ) public Set getAttributeValues() { return attributeValues; === added file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/adapter/MediaTypeCollecctionJsonSerializer.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/adapter/MediaTypeCollecctionJsonSerializer.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/adapter/MediaTypeCollecctionJsonSerializer.java 2011-12-06 19:52:58 +0000 @@ -0,0 +1,55 @@ +package org.hisp.dhis.api.adapter; + +/* + * Copyright (c) 2004-2011, 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.codehaus.jackson.JsonGenerator; +import org.codehaus.jackson.map.JsonSerializer; +import org.codehaus.jackson.map.SerializerProvider; +import org.springframework.http.MediaType; + +import java.io.IOException; +import java.util.Collection; + +/** + * @author Morten Olav Hansen + */ +public class MediaTypeCollecctionJsonSerializer extends JsonSerializer> +{ + @Override + public void serialize( Collection mediaTypes, JsonGenerator jgen, SerializerProvider serializerProvider ) throws IOException + { + jgen.writeStartArray(); + + for ( MediaType mediaType : mediaTypes ) + { + jgen.writeString( mediaType.toString() ); + } + + jgen.writeEndArray(); + } +} === removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/adapter/MediaTypeListJsonSerializer.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/adapter/MediaTypeListJsonSerializer.java 2011-12-06 08:39:29 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/adapter/MediaTypeListJsonSerializer.java 1970-01-01 00:00:00 +0000 @@ -1,57 +0,0 @@ -package org.hisp.dhis.api.adapter; - -/* - * Copyright (c) 2004-2011, 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.codehaus.jackson.JsonGenerator; -import org.codehaus.jackson.JsonProcessingException; -import org.codehaus.jackson.map.JsonSerializer; -import org.codehaus.jackson.map.SerializerProvider; -import org.springframework.http.MediaType; - -import java.io.IOException; -import java.util.List; - -/** - * @author Morten Olav Hansen - */ -public class MediaTypeListJsonSerializer extends JsonSerializer> -{ - @Override - public void serialize( List mediaTypes, JsonGenerator jgen, SerializerProvider serializerProvider ) - throws IOException, JsonProcessingException - { - jgen.writeStartArray(); - - for ( MediaType mediaType : mediaTypes ) - { - jgen.writeString( mediaType.toString() ); - } - - jgen.writeEndArray(); - } -} === added file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/adapter/RequestMethodCollectionJsonSerializer.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/adapter/RequestMethodCollectionJsonSerializer.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/adapter/RequestMethodCollectionJsonSerializer.java 2011-12-06 19:52:58 +0000 @@ -0,0 +1,57 @@ +package org.hisp.dhis.api.adapter; + +/* + * Copyright (c) 2004-2011, 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.codehaus.jackson.JsonGenerator; +import org.codehaus.jackson.JsonProcessingException; +import org.codehaus.jackson.map.JsonSerializer; +import org.codehaus.jackson.map.SerializerProvider; +import org.springframework.web.bind.annotation.RequestMethod; + +import java.io.IOException; +import java.util.Collection; + +/** + * @author Morten Olav Hansen + */ +public class RequestMethodCollectionJsonSerializer extends JsonSerializer> +{ + @Override + public void serialize( Collection requestMethods, JsonGenerator jgen, SerializerProvider serializerProvider ) + throws IOException, JsonProcessingException + { + jgen.writeStartArray(); + + for ( RequestMethod requestMethod : requestMethods ) + { + jgen.writeString( requestMethod.toString() ); + } + + jgen.writeEndArray(); + } +} === removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/adapter/RequestMethodListJsonSerializer.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/adapter/RequestMethodListJsonSerializer.java 2011-12-06 08:39:29 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/adapter/RequestMethodListJsonSerializer.java 1970-01-01 00:00:00 +0000 @@ -1,57 +0,0 @@ -package org.hisp.dhis.api.adapter; - -/* - * Copyright (c) 2004-2011, 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.codehaus.jackson.JsonGenerator; -import org.codehaus.jackson.JsonProcessingException; -import org.codehaus.jackson.map.JsonSerializer; -import org.codehaus.jackson.map.SerializerProvider; -import org.springframework.web.bind.annotation.RequestMethod; - -import java.io.IOException; -import java.util.List; - -/** - * @author Morten Olav Hansen - */ -public class RequestMethodListJsonSerializer extends JsonSerializer> -{ - @Override - public void serialize( List requestMethods, JsonGenerator jgen, SerializerProvider serializerProvider ) - throws IOException, JsonProcessingException - { - jgen.writeStartArray(); - - for ( RequestMethod requestMethod : requestMethods ) - { - jgen.writeString( requestMethod.toString() ); - } - - jgen.writeEndArray(); - } -} === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulator.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulator.java 2011-12-06 18:08:40 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulator.java 2011-12-06 19:19:40 +0000 @@ -31,6 +31,7 @@ import org.hisp.dhis.api.webdomain.Resource; import org.hisp.dhis.api.webdomain.Resources; import org.hisp.dhis.attribute.Attribute; +import org.hisp.dhis.attribute.AttributeValue; import org.hisp.dhis.attribute.Attributes; import org.hisp.dhis.chart.Chart; import org.hisp.dhis.chart.Charts; @@ -49,13 +50,13 @@ import java.util.Collection; import java.util.HashMap; import java.util.Map; +import java.util.Set; /** * @author Morten Olav Hansen */ public class WebLinkPopulator { - /** * Custom linkable object -> path mappings */ @@ -432,6 +433,7 @@ { handleIdentifiableObjectCollection( dataElement.getGroups() ); handleIdentifiableObjectCollection( dataElement.getDataSets() ); + handleAttributeValueCollection( dataElement.getAttributeValues() ); populateIdentifiableObject( dataElement.getCategoryCombo() ); } } @@ -504,6 +506,7 @@ { handleIdentifiableObjectCollection( indicator.getGroups() ); handleIdentifiableObjectCollection( indicator.getDataSets() ); + handleAttributeValueCollection( indicator.getAttributeValues() ); } } @@ -624,6 +627,7 @@ populateIdentifiableObject( organisationUnit.getParent() ); handleIdentifiableObjectCollection( organisationUnit.getDataSets() ); handleIdentifiableObjectCollection( organisationUnit.getGroups() ); + handleAttributeValueCollection( organisationUnit.getAttributeValues() ); } } @@ -679,6 +683,17 @@ } } + private void handleAttributeValueCollection( Set attributeValues ) + { + if ( attributeValues != null ) + { + for ( AttributeValue attributeValue : attributeValues ) + { + populateIdentifiableObject( attributeValue.getAttribute() ); + } + } + } + public void handleIdentifiableObjectCollection( Collection identifiableObjects ) { if ( identifiableObjects != null ) @@ -731,11 +746,11 @@ StringBuilder builder = new StringBuilder(); builder.append( request.getScheme() ); - builder.append( "://" + request.getServerName() ); + builder.append( "://" ).append( request.getServerName() ); if ( request.getServerPort() != 80 && request.getServerPort() != 443 ) { - builder.append( ":" + request.getServerPort() ); + builder.append( ":" ).append( request.getServerPort() ); } builder.append( request.getContextPath() ); === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/Resource.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/Resource.java 2011-12-06 10:58:10 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/Resource.java 2011-12-06 19:52:58 +0000 @@ -29,9 +29,9 @@ import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.map.annotate.JsonSerialize; -import org.hisp.dhis.api.adapter.MediaTypeListJsonSerializer; +import org.hisp.dhis.api.adapter.MediaTypeCollecctionJsonSerializer; import org.hisp.dhis.api.adapter.MediaTypeXmlAdapter; -import org.hisp.dhis.api.adapter.RequestMethodListJsonSerializer; +import org.hisp.dhis.api.adapter.RequestMethodCollectionJsonSerializer; import org.hisp.dhis.api.adapter.RequestMethodXmlAdapter; import org.hisp.dhis.common.BaseLinkableObject; import org.hisp.dhis.common.Dxf2Namespace; @@ -89,7 +89,7 @@ @XmlElementWrapper( name = "methods" ) @XmlElement( name = "method" ) @XmlJavaTypeAdapter( RequestMethodXmlAdapter.class ) - @JsonSerialize( using = RequestMethodListJsonSerializer.class ) + @JsonSerialize( using = RequestMethodCollectionJsonSerializer.class ) public List getMethods() { return methods; @@ -103,7 +103,7 @@ @XmlElementWrapper( name = "mediaTypes" ) @XmlElement( name = "mediaType" ) @XmlJavaTypeAdapter( MediaTypeXmlAdapter.class ) - @JsonSerialize( using = MediaTypeListJsonSerializer.class ) + @JsonSerialize( using = MediaTypeCollecctionJsonSerializer.class ) public List getMediaTypes() { return mediaTypes; === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/dataElement.xsl' --- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/dataElement.xsl 2011-12-06 16:05:52 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/dataElement.xsl 2011-12-06 19:04:21 +0000 @@ -9,7 +9,6 @@

- @@ -66,19 +65,18 @@
ID
- - + - +

DataElementCategoryCombo

- +

DataElementGroups

@@ -87,7 +85,7 @@ - +

DataSets

@@ -96,4 +94,4 @@ - + \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/identifiable-row.xsl' --- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/identifiable-row.xsl 2011-12-06 13:34:35 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/identifiable-row.xsl 2011-12-06 19:04:21 +0000 @@ -1,94 +1,50 @@ - + xmlns="http://www.w3.org/1999/xhtml" xmlns:d="http://dhis2.org/schema/dxf/2.0"> + - - - - - - - - - + + + + + + - + - - /api/organisationUnits + === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/organisationUnit.xsl' --- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/organisationUnit.xsl 2011-12-06 16:05:52 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/organisationUnit.xsl 2011-12-06 19:04:21 +0000 @@ -61,19 +61,19 @@
- - - html - - - - - xml - - - - - json - - - - - jsonp - - - - - pdf - -
+ + + html + + xml + + json + + jsonp + + pdf +
- +
- +

Parent OrganisationUnit

- +

OrganisationUnit Groups

@@ -82,7 +82,7 @@ - +

DataSets

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java 2011-10-05 15:00:45 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java 2011-12-06 18:59:50 +0000 @@ -27,24 +27,18 @@ * 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.Set; - +import com.opensymphony.xwork2.Action; import org.hisp.dhis.attribute.AttributeService; -import org.hisp.dhis.dataelement.DataElement; -import org.hisp.dhis.dataelement.DataElementCategoryCombo; -import org.hisp.dhis.dataelement.DataElementCategoryService; -import org.hisp.dhis.dataelement.DataElementGroup; -import org.hisp.dhis.dataelement.DataElementGroupSet; -import org.hisp.dhis.dataelement.DataElementService; +import org.hisp.dhis.dataelement.*; import org.hisp.dhis.dataset.DataSet; import org.hisp.dhis.dataset.DataSetService; import org.hisp.dhis.system.util.AttributeUtils; import org.hisp.dhis.system.util.ConversionUtils; -import com.opensymphony.xwork2.Action; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Set; /** * @author Torgeir Lorange Ostby @@ -275,7 +269,11 @@ dataElement.setCategoryCombo( categoryCombo ); dataElement.setAggregationLevels( new ArrayList( ConversionUtils .getIntegerCollection( aggregationLevels ) ) ); - dataElement.setZeroIsSignificant( zeroIsSignificant ); + + if ( zeroIsSignificant != null ) + { + dataElement.setZeroIsSignificant( zeroIsSignificant ); + } Set dataSets = dataElement.getDataSets(); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml 2011-09-30 10:24:49 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml 2011-12-06 19:13:19 +0000 @@ -600,6 +600,17 @@ + + F_DATAELEMENT_DELETE + +