dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15094
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5316: removed old list/set json serializers and added collection json serializer
Merge authors:
Bob Jolliffe bobjolliffe@xxxxxxxxx
Morten Olav Hansen (mortenoh)
------------------------------------------------------------
revno: 5316 [merge]
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-12-06 20:54:04 +0100
message:
removed old list/set json serializers and added collection json serializer
removed:
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/JsonIdentifiableObjectSetSerializer.java
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/JsonNameableObjectSetSerializer.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonSetSerializer.java
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/RequestMethodListJsonSerializer.java
added:
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/JsonIdentifiableObjectCollectionSerializer.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonNameableObjectCollectionSerializer.java
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/RequestMethodCollectionJsonSerializer.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attribute.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeValue.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/User.java
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/webdomain/Resource.java
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/identifiable-row.xsl
dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/organisationUnit.xsl
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/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.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-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<Indicator> getIndicators()
{
return indicators;
@@ -491,7 +491,7 @@
@XmlElementWrapper( name = "dataElements" )
@XmlElement( name = "dataElement" )
@JsonProperty
- @JsonSerialize( using = JsonNameableObjectListSerializer.class )
+ @JsonSerialize( using = JsonNameableObjectCollectionSerializer.class )
public List<DataElement> getDataElements()
{
return dataElements;
@@ -506,7 +506,7 @@
@XmlElementWrapper( name = "dataSets" )
@XmlElement( name = "dataSet" )
@JsonProperty
- @JsonSerialize( using = JsonNameableObjectListSerializer.class )
+ @JsonSerialize( using = JsonNameableObjectCollectionSerializer.class )
public List<DataSet> getDataSets()
{
return dataSets;
@@ -531,7 +531,7 @@
@XmlElementWrapper( name = "organisationUnits" )
@XmlElement( name = "organisationUnit" )
@JsonProperty
- @JsonSerialize( using = JsonNameableObjectListSerializer.class )
+ @JsonSerialize( using = JsonNameableObjectCollectionSerializer.class )
public List<OrganisationUnit> 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 <mortenoh@xxxxxxxxx>
+ */
+public class JsonCollectionSerializer extends JsonSerializer<Collection<Object>>
+{
+ @Override
+ public void serialize( Collection<Object> 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 <mortenoh@xxxxxxxxx>
+ */
+public class JsonIdentifiableObjectCollectionSerializer extends JsonSerializer<Collection<IdentifiableObject>>
+{
+ @Override
+ public void serialize( Collection<IdentifiableObject> 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 <mortenoh@xxxxxxxxx>
- */
-public class JsonIdentifiableObjectListSerializer extends JsonSerializer<List<IdentifiableObject>>
-{
- @Override
- public void serialize( List<IdentifiableObject> 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 <mortenoh@xxxxxxxxx>
- */
-public class JsonIdentifiableObjectSetSerializer extends JsonSerializer<Set<IdentifiableObject>>
-{
- @Override
- public void serialize( Set<IdentifiableObject> 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 <mortenoh@xxxxxxxxx>
+ */
+public class JsonNameableObjectCollectionSerializer extends JsonSerializer<Collection<NameableObject>>
+{
+ @Override
+ public void serialize( Collection<NameableObject> 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 <mortenoh@xxxxxxxxx>
- */
-public class JsonNameableObjectListSerializer extends JsonSerializer<List<NameableObject>>
-{
- @Override
- public void serialize( List<NameableObject> 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 <mortenoh@xxxxxxxxx>
- */
-public class JsonNameableObjectSetSerializer extends JsonSerializer<Set<NameableObject>>
-{
- @Override
- public void serialize( Set<NameableObject> 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 <mortenoh@xxxxxxxxx>
- */
-public class JsonSetSerializer extends JsonSerializer<Set<Object>>
-{
- @Override
- public void serialize( Set<Object> 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<DataElementGroup> 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<DataSet> getDataSets()
{
return dataSets;
@@ -529,6 +531,9 @@
this.numberType = numberType;
}
+ @XmlElementWrapper( name = "attributeValues" )
+ @XmlElement( name = "attributeValue" )
+ @JsonSerialize( using = JsonCollectionSerializer.class )
public Set<AttributeValue> 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<DataElementCategoryOption> 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<DataElementCategory> 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<DataElementCategoryOptionCombo> 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<DataElementCategoryOptionCombo> 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<DataElementCategoryOption> 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<DataElement> 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<DataElementGroup> 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<DataElement> 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<Indicator> 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<OrganisationUnit> 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<Section> 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<DataElement> 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<IndicatorGroup> 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<DataSet> getDataSets()
{
return dataSets;
@@ -303,6 +305,9 @@
this.dataSets = dataSets;
}
+ @XmlElementWrapper( name = "attributeValues" )
+ @XmlElement( name = "attributeValue" )
+ @JsonSerialize( using = JsonCollectionSerializer.class )
public Set<AttributeValue> 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<Indicator> 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<IndicatorGroup> 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<OrganisationUnitGroup> 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<DataSet> getDataSets()
{
return dataSets;
@@ -758,6 +757,9 @@
this.type = type;
}
+ @XmlElementWrapper( name = "attributeValues" )
+ @XmlElement( name = "attributeValue" )
+ @JsonSerialize( using = JsonCollectionSerializer.class )
public Set<AttributeValue> 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<OrganisationUnit> 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<OrganisationUnitGroup> 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<AttributeValue> 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 <mortenoh@xxxxxxxxx>
+ */
+public class MediaTypeCollecctionJsonSerializer extends JsonSerializer<Collection<MediaType>>
+{
+ @Override
+ public void serialize( Collection<MediaType> 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 <mortenoh@xxxxxxxxx>
- */
-public class MediaTypeListJsonSerializer extends JsonSerializer<List<MediaType>>
-{
- @Override
- public void serialize( List<MediaType> 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 <mortenoh@xxxxxxxxx>
+ */
+public class RequestMethodCollectionJsonSerializer extends JsonSerializer<Collection<RequestMethod>>
+{
+ @Override
+ public void serialize( Collection<RequestMethod> 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 <mortenoh@xxxxxxxxx>
- */
-public class RequestMethodListJsonSerializer extends JsonSerializer<List<RequestMethod>>
-{
- @Override
- public void serialize( List<RequestMethod> 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 <mortenoh@xxxxxxxxx>
*/
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<AttributeValue> attributeValues )
+ {
+ if ( attributeValues != null )
+ {
+ for ( AttributeValue attributeValue : attributeValues )
+ {
+ populateIdentifiableObject( attributeValue.getAttribute() );
+ }
+ }
+ }
+
public void handleIdentifiableObjectCollection( Collection<? extends BaseIdentifiableObject> 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<RequestMethod> 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<MediaType> 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 @@
<h2>
<xsl:value-of select="@name" />
</h2>
-
<table border="1">
<tr>
<td>ID</td>
@@ -66,19 +65,18 @@
</td>
</tr>
</table>
-
- <xsl:apply-templates select="d:categoryCombo|d:groups|d:dataSets" mode="dataElement" />
+ <xsl:apply-templates select="d:categoryCombo|d:dataElementGroups|d:dataSets"/>
</div>
</xsl:template>
- <xsl:template match="d:categoryCombo" mode="dataElement">
+ <xsl:template match="d:categoryCombo">
<h3>DataElementCategoryCombo</h3>
<table border="1" class="categoryCombo">
<xsl:apply-templates select="child::*" mode="row"/>
</table>
</xsl:template>
- <xsl:template match="d:groups" mode="dataElement">
+ <xsl:template match="d:dataElementGroups">
<xsl:if test="count(child::*) > 0">
<h3>DataElementGroups</h3>
<table border="1" class="dataElementGroups">
@@ -87,7 +85,7 @@
</xsl:if>
</xsl:template>
- <xsl:template match="d:dataSets" mode="dataElement">
+ <xsl:template match="d:dataSets">
<xsl:if test="count(child::*) > 0">
<h3>DataSets</h3>
<table border="1" class="dataSets">
@@ -96,4 +94,4 @@
</xsl:if>
</xsl:template>
-</xsl:stylesheet>
+</xsl:stylesheet>
\ 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 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:d="http://dhis2.org/schema/dxf/2.0"
- >
-
+ xmlns="http://www.w3.org/1999/xhtml" xmlns:d="http://dhis2.org/schema/dxf/2.0">
+
<xsl:template match="*" mode="row">
- <xsl:variable name="root" select="concat('/api/',local-name(.),'s')" />
- <tr>
- <td><xsl:value-of select="@name"/></td>
- <td>
- <xsl:element name="a">
- <xsl:attribute name="href"><xsl:value-of select="concat($root,'/',@id)"/></xsl:attribute>
- <xsl:text>html</xsl:text>
- </xsl:element>
- </td>
- <td>
- <xsl:element name="a">
- <xsl:attribute name="href"><xsl:value-of select="concat($root,'/',@id,'.xml')"/></xsl:attribute>
- <xsl:text>xml</xsl:text>
- </xsl:element>
- </td>
- <td>
- <xsl:element name="a">
- <xsl:attribute name="href"><xsl:value-of select="concat($root,'/',@id,'.json')"/></xsl:attribute>
- <xsl:text>json</xsl:text>
- </xsl:element>
- </td>
- <td>
- <xsl:element name="a">
- <xsl:attribute name="href"><xsl:value-of select="concat($root,'/',@id,'.jsonp')"/></xsl:attribute>
- <xsl:text>jsonp</xsl:text>
- </xsl:element>
- </td>
- <td>
- <xsl:element name="a">
- <xsl:attribute name="href"><xsl:value-of select="concat($root,'/',@id,'.pdf')"/></xsl:attribute>
- <xsl:text>pdf</xsl:text>
- </xsl:element>
- </td>
- </tr>
+ <td>
+ <xsl:value-of select="@name"/>
+ </td>
+ <td>
+ <a href="{@link}">html</a>
+ </td>
+ <td>
+ <a href="{@link}.xml">xml</a>
+ </td>
+ <td>
+ <a href="{@link}.json">json</a>
+ </td>
+ <td>
+ <a href="{@link}.jsonp">jsonp</a>
+ </td>
+ <td>
+ <a href="{@link}.pdf">pdf</a>
+ </td>
</xsl:template>
-
+
<!-- special case - TODO handle this better -->
- <xsl:template match="d:parent" mode="row">
- <xsl:variable name="root">/api/organisationUnits</xsl:variable>
+ <!-- <xsl:template match="d:parent" mode="row">
<tr>
<td>
<xsl:value-of select="@name"/>
</td>
<td>
- <xsl:element name="a">
- <xsl:attribute name="href">
- <xsl:value-of select="concat($root,'/',@id)"/>
- </xsl:attribute>
- <xsl:text>html</xsl:text>
- </xsl:element>
- </td>
- <td>
- <xsl:element name="a">
- <xsl:attribute name="href">
- <xsl:value-of select="concat($root,'/',@id,'.xml')"/>
- </xsl:attribute>
- <xsl:text>xml</xsl:text>
- </xsl:element>
- </td>
- <td>
- <xsl:element name="a">
- <xsl:attribute name="href">
- <xsl:value-of select="concat($root,'/',@id,'.json')"/>
- </xsl:attribute>
- <xsl:text>json</xsl:text>
- </xsl:element>
- </td>
- <td>
- <xsl:element name="a">
- <xsl:attribute name="href">
- <xsl:value-of select="concat($root,'/',@id,'.jsonp')"/>
- </xsl:attribute>
- <xsl:text>jsonp</xsl:text>
- </xsl:element>
- </td>
- <td>
- <xsl:element name="a">
- <xsl:attribute name="href">
- <xsl:value-of select="concat($root,'/',@id,'.pdf')"/>
- </xsl:attribute>
- <xsl:text>pdf</xsl:text>
- </xsl:element>
+ <a href="{@link}">html</a>
+ </td>
+ <td>
+ <a href="{@link}.xml">xml</a>
+ </td>
+ <td>
+ <a href="{@link}.json">json</a>
+ </td>
+ <td>
+ <a href="{@link}.jsonp">jsonp</a>
+ </td>
+ <td>
+ <a href="{@link}.pdf">pdf</a>
</td>
</tr>
- </xsl:template>
+ </xsl:template>-->
</xsl:stylesheet>
=== 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 @@
</table>
- <xsl:apply-templates select="d:parent|d:groups|d:dataSets" mode="orgunit" />
+ <xsl:apply-templates select="d:parent|d:organisationUnitGroups|d:dataSets" />
</div>
</xsl:template>
- <xsl:template match="d:parent" mode="orgunit">
+ <xsl:template match="d:parent">
<h3>Parent OrganisationUnit</h3>
<table border="1">
<xsl:apply-templates select="." mode="row"/>
</table>
</xsl:template>
- <xsl:template match="d:groups" mode="orgunit">
+ <xsl:template match="d:organisationUnitGroups">
<xsl:if test="count(child::*) > 0">
<h3>OrganisationUnit Groups</h3>
<table border="1" class="organisationUnitGroups">
@@ -82,7 +82,7 @@
</xsl:if>
</xsl:template>
- <xsl:template match="d:dataSets" mode="orgunit">
+ <xsl:template match="d:dataSets">
<xsl:if test="count(child::*) > 0">
<h3>DataSets</h3>
<table border="1" class="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<Integer>( ConversionUtils
.getIntegerCollection( aggregationLevels ) ) );
- dataElement.setZeroIsSignificant( zeroIsSignificant );
+
+ if ( zeroIsSignificant != null )
+ {
+ dataElement.setZeroIsSignificant( zeroIsSignificant );
+ }
Set<DataSet> 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 @@
</property>
</bean>
+ <!--
+ <bean id="org.hisp.dhis.dd.action.category.ShowCategoryEditorAction" class="org.hisp.dhis.dd.action.category.ShowCategoryEditorAction"
+ scope="prototype">
+ <property name="categoryService">
+ <ref bean="org.hisp.dhis.dataelement.DataElementCategoryService" />
+ </property>
+ <property name="conceptService">
+ <ref bean="org.hisp.dhis.concept.ConceptService" />
+ </property>
+ </bean>-->
+
<!-- CategoryOption -->
<bean id="org.hisp.dhis.dd.action.category.AddDataElementCategoryOptionAction" class="org.hisp.dhis.dd.action.category.AddDataElementCategoryOptionAction"
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml 2011-09-27 18:03:19 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml 2011-12-06 19:13:19 +0000
@@ -620,6 +620,14 @@
<param name="requiredAuthorities">F_DATAELEMENT_DELETE</param>
</action>
+ <!--
+ <action name="showCategoryEditor" class="org.hisp.dhis.dd.action.category.ShowCategoryEditorAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-datadictionary/multidimensional/showCategoryEditor.vm</param>
+ <param name="javascripts">javascript/category.js</param>
+ <param name="requiredAuthorities">F_DATAELEMENT_ADD</param>
+ </action> -->
+
<!-- CategoryOption -->
<action name="addDataElementCategoryOption" class="org.hisp.dhis.dd.action.category.AddDataElementCategoryOptionAction">