dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15139
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5351: merged with dxf2: simplified output format for non-detailed resources, updated all adapters
Merge authors:
Morten Olav Hansen (mortenoh)
------------------------------------------------------------
revno: 5351 [merge]
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-12-09 22:00:05 +0100
message:
merged with dxf2: simplified output format for non-detailed resources, updated all adapters
removed:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/codelist/
dhis-2/dhis-api/src/main/java/org/hisp/dhis/codelist/CodeList.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/codelist/package-info.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/BaseNameableObjectXmlAdapter.java
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/JsonDataSetDeserializer.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonDateSerializer.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/JsonIdentifiableObjectSerializer.java
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/JsonNameableObjectSerializer.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/comparator/CategoryComboSizeComparator.java
added:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/AttributeXmlAdapter.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/DataElementXmlAdapter.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/IndicatorTypeXmlAdapter.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/MapViewXmlAdapter.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/OrganisationUnitLevelXmlAdapter.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/PeriodXmlAdapter.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/comparator/DataElementCategoryComboSizeComparator.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/Attributes.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Charts.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseLinkableObject.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseNameableObject.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/constant/Constant.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/DataElementCategories.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/DataElementCategoryCombos.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/DataElementCategoryOptionCombos.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptions.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/dataelement/DataElementGroupSets.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroups.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementOperand.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElements.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryForm.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/CompleteDataSetRegistration.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/CompleteDataSetRegistrations.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/DataSets.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/document/Document.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/indicator/IndicatorGroupSets.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroups.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorTypes.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicators.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/Maps.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/organisationunit/OrganisationUnitGroupSets.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroups.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnits.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/RelativePeriods.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/User.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartController.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-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 21:57:53 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attribute.java 2011-12-09 20:53:07 +0000
@@ -149,6 +149,7 @@
this.userAttribute = userAttribute;
}
+ // TODO expose attribute values? probably not..
public Set<AttributeValue> getAttributeValues()
{
return attributeValues;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attributes.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attributes.java 2011-12-06 21:57:53 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attributes.java 2011-12-09 20:53:07 +0000
@@ -28,13 +28,17 @@
package org.hisp.dhis.attribute;
import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.BaseLinkableObject;
import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.common.adapter.AttributeXmlAdapter;
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.util.ArrayList;
import java.util.List;
@@ -48,7 +52,9 @@
private List<Attribute> attributes = new ArrayList<Attribute>();
@XmlElement( name = "attributeType" )
+ @XmlJavaTypeAdapter( AttributeXmlAdapter.class )
@JsonProperty( value = "attributeTypes" )
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<Attribute> getAttributes()
{
return attributes;
=== 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-09 18:08:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java 2011-12-09 20:53:07 +0000
@@ -31,8 +31,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.BaseNameableObjectXmlAdapter;
-import org.hisp.dhis.common.adapter.JsonNameableObjectCollectionSerializer;
+import org.hisp.dhis.common.adapter.*;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.i18n.I18nFormat;
@@ -143,13 +142,13 @@
private transient I18nFormat format;
- private List<Period> relativePeriods = new ArrayList<Period>();
-
- private List<Period> allPeriods = new ArrayList<Period>();
-
- private OrganisationUnit organisationUnit;
-
- private List<OrganisationUnit> allOrganisationUnits = new ArrayList<OrganisationUnit>();
+ private transient List<Period> relativePeriods = new ArrayList<Period>();
+
+ private transient List<Period> allPeriods = new ArrayList<Period>();
+
+ private transient OrganisationUnit organisationUnit;
+
+ private transient List<OrganisationUnit> allOrganisationUnits = new ArrayList<OrganisationUnit>();
// -------------------------------------------------------------------------
// Constructors
@@ -472,9 +471,9 @@
this.hideSubtitle = hideSubtitle;
}
- @XmlJavaTypeAdapter( BaseNameableObjectXmlAdapter.class )
@XmlElementWrapper( name = "indicators" )
@XmlElement( name = "indicator" )
+ @XmlJavaTypeAdapter( IndicatorXmlAdapter.class )
@JsonProperty
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<Indicator> getIndicators()
@@ -489,7 +488,7 @@
@XmlElementWrapper( name = "dataElements" )
@XmlElement( name = "dataElement" )
- @XmlJavaTypeAdapter( BaseNameableObjectXmlAdapter.class )
+ @XmlJavaTypeAdapter( DataElementXmlAdapter.class )
@JsonProperty
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<DataElement> getDataElements()
@@ -504,7 +503,7 @@
@XmlElementWrapper( name = "dataSets" )
@XmlElement( name = "dataSet" )
- @XmlJavaTypeAdapter( BaseNameableObjectXmlAdapter.class )
+ @XmlJavaTypeAdapter( DataSetXmlAdapter.class )
@JsonProperty
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<DataSet> getDataSets()
@@ -517,6 +516,7 @@
this.dataSets = dataSets;
}
+ // TODO marshall this? we probably want that..
public List<Period> getPeriods()
{
return periods;
@@ -527,11 +527,11 @@
this.periods = periods;
}
- @XmlJavaTypeAdapter( BaseNameableObjectXmlAdapter.class )
@XmlElementWrapper( name = "organisationUnits" )
@XmlElement( name = "organisationUnit" )
+ @XmlJavaTypeAdapter( OrganisationUnitXmlAdapter.class )
@JsonProperty
- @JsonSerialize( using = JsonNameableObjectCollectionSerializer.class )
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<OrganisationUnit> getOrganisationUnits()
{
return organisationUnits;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Charts.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Charts.java 2011-12-09 18:42:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Charts.java 2011-12-09 20:53:07 +0000
@@ -27,29 +27,34 @@
package org.hisp.dhis.chart;
-import java.util.ArrayList;
-import java.util.List;
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.hisp.dhis.common.BaseIdentifiableObject;
+import org.hisp.dhis.common.BaseLinkableObject;
+import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.common.adapter.ChartXmlAdapter;
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 org.codehaus.jackson.annotate.JsonProperty;
-import org.hisp.dhis.common.BaseLinkableObject;
-import org.hisp.dhis.common.Dxf2Namespace;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import java.util.ArrayList;
+import java.util.List;
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
-@XmlRootElement( name = "charts", namespace=Dxf2Namespace.NAMESPACE)
+@XmlRootElement( name = "charts", namespace = Dxf2Namespace.NAMESPACE )
@XmlAccessorType( value = XmlAccessType.NONE )
public class Charts extends BaseLinkableObject
{
private List<Chart> charts = new ArrayList<Chart>();
@XmlElement( name = "chart" )
+ @XmlJavaTypeAdapter( ChartXmlAdapter.class )
@JsonProperty( value = "charts" )
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<Chart> getCharts()
{
return charts;
=== removed directory 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/codelist'
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/codelist/CodeList.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/codelist/CodeList.java 2011-12-03 10:35:41 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/codelist/CodeList.java 1970-01-01 00:00:00 +0000
@@ -1,42 +0,0 @@
-package org.hisp.dhis.codelist;
-
-import org.hisp.dhis.common.BaseIdentifiableObject;
-import org.hisp.dhis.common.Dxf2Namespace;
-
-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 java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-@XmlRootElement( name = "codeList", namespace = Dxf2Namespace.NAMESPACE )
-@XmlAccessorType( value = XmlAccessType.NONE )
-public class CodeList<T extends BaseIdentifiableObject>
-{
- private List<T> list = new ArrayList<T>();
-
- public CodeList()
- {
-
- }
-
- public CodeList( List<T> list )
- {
- this.list = list;
- }
-
- @XmlElement( name = "code" )
- public List<T> getList()
- {
- return list;
- }
-
- public void setList( List<T> list )
- {
- this.list = list;
- }
-}
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/codelist/package-info.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/codelist/package-info.java 2011-12-06 10:52:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/codelist/package-info.java 1970-01-01 00:00:00 +0000
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @author bobj
- */
-
-@XmlSchema(
- namespace = "http://dhis2.org/schema/dxf/2.0",
- xmlns = {
- @XmlNs(namespaceURI = "http://dhis2.org/schema/dxf/2.0", prefix = "d")
- },
- elementFormDefault = XmlNsForm.QUALIFIED)
-
-package org.hisp.dhis.codelist;
-
-import javax.xml.bind.annotation.XmlSchema;
-import javax.xml.bind.annotation.XmlNs;
-import javax.xml.bind.annotation.XmlNsForm;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseLinkableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseLinkableObject.java 2011-12-06 11:36:12 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseLinkableObject.java 2011-12-09 20:53:07 +0000
@@ -45,7 +45,6 @@
@XmlAttribute
@JsonProperty
- @JsonSerialize( include = JsonSerialize.Inclusion.NON_NULL )
public String getLink()
{
return link;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseNameableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseNameableObject.java 2011-12-06 11:36:12 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseNameableObject.java 2011-12-09 20:53:07 +0000
@@ -76,7 +76,6 @@
@XmlAttribute
@JsonProperty
- @JsonSerialize( include = JsonSerialize.Inclusion.NON_NULL )
public String getAlternativeName()
{
return alternativeName;
@@ -89,7 +88,6 @@
@XmlAttribute
@JsonProperty
- @JsonSerialize( include = JsonSerialize.Inclusion.NON_NULL )
public String getShortName()
{
return shortName;
@@ -102,7 +100,6 @@
@XmlElement
@JsonProperty
- @JsonSerialize( include = JsonSerialize.Inclusion.NON_NULL )
public String getDescription()
{
return description;
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/AttributeXmlAdapter.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/AttributeXmlAdapter.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/AttributeXmlAdapter.java 2011-12-09 20:53:07 +0000
@@ -0,0 +1,60 @@
+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.hisp.dhis.attribute.Attribute;
+import org.hisp.dhis.common.BaseIdentifiableObject;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+import java.util.UUID;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class AttributeXmlAdapter extends XmlAdapter<BaseIdentifiableObject, Attribute>
+{
+ private BaseIdentifiableObjectXmlAdapter baseIdentifiableObjectXmlAdapter = new BaseIdentifiableObjectXmlAdapter();
+
+ @Override
+ public Attribute unmarshal( BaseIdentifiableObject identifiableObject ) throws Exception
+ {
+ Attribute attribute = new Attribute();
+
+ attribute.setUid( identifiableObject.getUid() );
+ attribute.setLastUpdated( identifiableObject.getLastUpdated() );
+ attribute.setName( identifiableObject.getName() == null ? UUID.randomUUID().toString() : identifiableObject.getName() );
+
+ return attribute;
+ }
+
+ @Override
+ public BaseIdentifiableObject marshal( Attribute attribute ) throws Exception
+ {
+ return baseIdentifiableObjectXmlAdapter.marshal( attribute );
+ }
+}
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/BaseNameableObjectXmlAdapter.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/BaseNameableObjectXmlAdapter.java 2011-12-09 18:08:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/BaseNameableObjectXmlAdapter.java 1970-01-01 00:00:00 +0000
@@ -1,62 +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.hisp.dhis.common.BaseNameableObject;
-
-import javax.xml.bind.annotation.adapters.XmlAdapter;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-public class BaseNameableObjectXmlAdapter extends XmlAdapter<BaseNameableObject, BaseNameableObject>
-{
- @Override
- public BaseNameableObject unmarshal( BaseNameableObject baseIdentifiableObject ) throws Exception
- {
- return baseIdentifiableObject;
- }
-
- @Override
- public BaseNameableObject marshal( BaseNameableObject baseIdentifiableObject ) throws Exception
- {
- if ( baseIdentifiableObject != null )
- {
- BaseNameableObject bio = new BaseNameableObject();
-
- bio.setUid( baseIdentifiableObject.getUid() );
- bio.setName( baseIdentifiableObject.getName() );
- bio.setLastUpdated( baseIdentifiableObject.getLastUpdated() );
- bio.setLink( baseIdentifiableObject.getLink() );
-
- return bio;
- }
-
- return null;
- }
-}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/DataElementXmlAdapter.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/DataElementXmlAdapter.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/DataElementXmlAdapter.java 2011-12-09 18:57:46 +0000
@@ -0,0 +1,60 @@
+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.hisp.dhis.common.BaseIdentifiableObject;
+import org.hisp.dhis.dataelement.DataElement;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+import java.util.UUID;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class DataElementXmlAdapter extends XmlAdapter<BaseIdentifiableObject, DataElement>
+{
+ private BaseIdentifiableObjectXmlAdapter baseIdentifiableObjectXmlAdapter = new BaseIdentifiableObjectXmlAdapter();
+
+ @Override
+ public DataElement unmarshal( BaseIdentifiableObject identifiableObject ) throws Exception
+ {
+ DataElement dataElement = new DataElement();
+
+ dataElement.setUid( identifiableObject.getUid() );
+ dataElement.setLastUpdated( identifiableObject.getLastUpdated() );
+ dataElement.setName( identifiableObject.getName() == null ? UUID.randomUUID().toString() : identifiableObject.getName() );
+
+ return dataElement;
+ }
+
+ @Override
+ public BaseIdentifiableObject marshal( DataElement dataElement ) throws Exception
+ {
+ return baseIdentifiableObjectXmlAdapter.marshal( dataElement );
+ }
+}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/IndicatorTypeXmlAdapter.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/IndicatorTypeXmlAdapter.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/IndicatorTypeXmlAdapter.java 2011-12-09 20:53:07 +0000
@@ -0,0 +1,60 @@
+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.hisp.dhis.common.BaseIdentifiableObject;
+import org.hisp.dhis.indicator.IndicatorType;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+import java.util.UUID;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class IndicatorTypeXmlAdapter extends XmlAdapter<BaseIdentifiableObject, IndicatorType>
+{
+ private BaseIdentifiableObjectXmlAdapter baseIdentifiableObjectXmlAdapter = new BaseIdentifiableObjectXmlAdapter();
+
+ @Override
+ public IndicatorType unmarshal( BaseIdentifiableObject identifiableObject ) throws Exception
+ {
+ IndicatorType indicatorType = new IndicatorType();
+
+ indicatorType.setUid( identifiableObject.getUid() );
+ indicatorType.setLastUpdated( identifiableObject.getLastUpdated() );
+ indicatorType.setName( identifiableObject.getName() == null ? UUID.randomUUID().toString() : identifiableObject.getName() );
+
+ return indicatorType;
+ }
+
+ @Override
+ public BaseIdentifiableObject marshal( IndicatorType indicatorType ) throws Exception
+ {
+ return baseIdentifiableObjectXmlAdapter.marshal( indicatorType );
+ }
+}
=== removed 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 2011-12-06 19:52:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonCollectionSerializer.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.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();
- }
-}
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonDataSetDeserializer.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonDataSetDeserializer.java 2011-12-09 13:41:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonDataSetDeserializer.java 1970-01-01 00:00:00 +0000
@@ -1,28 +0,0 @@
-package org.hisp.dhis.common.adapter;
-
-import org.codehaus.jackson.JsonParser;
-import org.codehaus.jackson.JsonProcessingException;
-import org.codehaus.jackson.map.DeserializationContext;
-import org.codehaus.jackson.map.JsonDeserializer;
-import org.hisp.dhis.common.BaseNameableObject;
-import org.hisp.dhis.dataset.DataSet;
-
-import java.io.IOException;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-public class JsonDataSetDeserializer extends JsonDeserializer<DataSet>
-{
- @Override
- public DataSet deserialize( JsonParser jp, DeserializationContext context ) throws IOException, JsonProcessingException
- {
- DataSet dataSet = new DataSet();
- BaseNameableObject baseNameableObject = jp.readValueAs( BaseNameableObject.class );
-
- dataSet.setUid( baseNameableObject.getUid() );
- dataSet.setName( baseNameableObject.getName() );
-
- return dataSet;
- }
-}
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonDateSerializer.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonDateSerializer.java 2011-11-25 18:17:41 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonDateSerializer.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 java.io.IOException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.codehaus.jackson.JsonGenerator;
-import org.codehaus.jackson.JsonProcessingException;
-import org.codehaus.jackson.map.JsonSerializer;
-import org.codehaus.jackson.map.SerializerProvider;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-public class JsonDateSerializer extends JsonSerializer<Date>
-{
- /**
- * This gives us date in the format "2010-02-05T10:58:27.355+0100" which is not really ISO8601.
- *
- * TODO Proper format here should be "2010-02-05T10:58:27.355+01:00", should be fixed.
- */
- private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
-
- @Override
- public void serialize( Date date, JsonGenerator jgen, SerializerProvider provider ) throws IOException, JsonProcessingException
- {
- String formattedDate = dateFormat.format( date );
-
- jgen.writeString( formattedDate );
- }
-}
=== removed 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 2011-12-06 19:52:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonIdentifiableObjectCollectionSerializer.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.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/JsonIdentifiableObjectSerializer.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonIdentifiableObjectSerializer.java 2011-12-06 18:18:18 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonIdentifiableObjectSerializer.java 1970-01-01 00:00:00 +0000
@@ -1,79 +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;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-public class JsonIdentifiableObjectSerializer extends JsonSerializer<IdentifiableObject>
-{
- /**
- * Jackson doesn't seem to see the downcasted object, so we need to manually write the values.
- * TODO fix this.
- */
- @Override
- public void serialize( IdentifiableObject value, JsonGenerator jgen, SerializerProvider provider ) throws IOException, JsonProcessingException
- {
- if ( value != null )
- {
- jgen.writeStartObject();
-
- jgen.writeStringField( "id", value.getUid() );
- jgen.writeStringField( "name", value.getName() );
-
- jgen.writeFieldName( "lastUpdated" );
-
- JsonDateSerializer jsonDateSerializer = new JsonDateSerializer();
- jsonDateSerializer.serialize( value.getLastUpdated(), jgen, provider );
-
- if ( value.getLink() != null )
- {
- jgen.writeStringField( "link", value.getLink() );
- }
-
- if ( value.getCode() != null )
- {
- jgen.writeStringField( "code", value.getCode() );
- }
-
- jgen.writeEndObject();
- }
- else
- {
- jgen.writeNull();
- }
- }
-}
=== removed 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 2011-12-06 19:52:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonNameableObjectCollectionSerializer.java 1970-01-01 00:00:00 +0000
@@ -1,57 +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.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/JsonNameableObjectSerializer.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonNameableObjectSerializer.java 2011-12-06 18:18:18 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonNameableObjectSerializer.java 1970-01-01 00:00:00 +0000
@@ -1,93 +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;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-public class JsonNameableObjectSerializer extends JsonSerializer<NameableObject>
-{
- /**
- * Jackson doesn't seem to see the downcasted object, so we need to manually write the values.
- * TODO fix this.
- */
- @Override
- public void serialize( NameableObject nameableObject, JsonGenerator jgen, SerializerProvider provider ) throws IOException, JsonProcessingException
- {
- if ( nameableObject != null )
- {
- jgen.writeStartObject();
-
- jgen.writeStringField( "id", nameableObject.getUid() );
- jgen.writeStringField( "name", nameableObject.getName() );
- jgen.writeFieldName( "lastUpdated" );
-
- JsonDateSerializer jsonDateSerializer = new JsonDateSerializer();
- jsonDateSerializer.serialize( nameableObject.getLastUpdated(), jgen, provider );
-
- if ( nameableObject.getLink() != null )
- {
- jgen.writeStringField( "link", nameableObject.getLink() );
- }
-
- if ( nameableObject.getCode() != null )
- {
- jgen.writeStringField( "code", nameableObject.getCode() );
- }
-
- if ( nameableObject.getShortName() != null )
- {
- jgen.writeStringField( "shortName", nameableObject.getShortName() );
- }
-
- if ( nameableObject.getAlternativeName() != null )
- {
- jgen.writeStringField( "alternativeName", nameableObject.getAlternativeName() );
- }
-
- if ( nameableObject.getDescription() != null )
- {
- jgen.writeStringField( "description", nameableObject.getDescription() );
- }
-
- jgen.writeEndObject();
- }
- else
- {
- jgen.writeNull();
- }
- }
-}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/MapViewXmlAdapter.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/MapViewXmlAdapter.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/MapViewXmlAdapter.java 2011-12-09 20:53:07 +0000
@@ -0,0 +1,60 @@
+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.hisp.dhis.common.BaseIdentifiableObject;
+import org.hisp.dhis.mapping.MapView;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+import java.util.UUID;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class MapViewXmlAdapter extends XmlAdapter<BaseIdentifiableObject, MapView>
+{
+ private BaseIdentifiableObjectXmlAdapter baseIdentifiableObjectXmlAdapter = new BaseIdentifiableObjectXmlAdapter();
+
+ @Override
+ public MapView unmarshal( BaseIdentifiableObject identifiableObject ) throws Exception
+ {
+ MapView mapView = new MapView();
+
+ mapView.setUid( identifiableObject.getUid() );
+ mapView.setLastUpdated( identifiableObject.getLastUpdated() );
+ mapView.setName( identifiableObject.getName() == null ? UUID.randomUUID().toString() : identifiableObject.getName() );
+
+ return mapView;
+ }
+
+ @Override
+ public BaseIdentifiableObject marshal( MapView mapView ) throws Exception
+ {
+ return baseIdentifiableObjectXmlAdapter.marshal( mapView );
+ }
+}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/OrganisationUnitLevelXmlAdapter.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/OrganisationUnitLevelXmlAdapter.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/OrganisationUnitLevelXmlAdapter.java 2011-12-09 20:53:07 +0000
@@ -0,0 +1,60 @@
+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.hisp.dhis.common.BaseIdentifiableObject;
+import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+import java.util.UUID;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class OrganisationUnitLevelXmlAdapter extends XmlAdapter<BaseIdentifiableObject, OrganisationUnitLevel>
+{
+ private BaseIdentifiableObjectXmlAdapter baseIdentifiableObjectXmlAdapter = new BaseIdentifiableObjectXmlAdapter();
+
+ @Override
+ public OrganisationUnitLevel unmarshal( BaseIdentifiableObject identifiableObject ) throws Exception
+ {
+ OrganisationUnitLevel organisationUnitLevel = new OrganisationUnitLevel();
+
+ organisationUnitLevel.setUid( identifiableObject.getUid() );
+ organisationUnitLevel.setLastUpdated( identifiableObject.getLastUpdated() );
+ organisationUnitLevel.setName( identifiableObject.getName() == null ? UUID.randomUUID().toString() : identifiableObject.getName() );
+
+ return organisationUnitLevel;
+ }
+
+ @Override
+ public BaseIdentifiableObject marshal( OrganisationUnitLevel organisationUnitLevel ) throws Exception
+ {
+ return baseIdentifiableObjectXmlAdapter.marshal( organisationUnitLevel );
+ }
+}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/PeriodXmlAdapter.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/PeriodXmlAdapter.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/PeriodXmlAdapter.java 2011-12-09 20:53:07 +0000
@@ -0,0 +1,60 @@
+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.hisp.dhis.common.BaseIdentifiableObject;
+import org.hisp.dhis.period.Period;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+import java.util.UUID;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class PeriodXmlAdapter extends XmlAdapter<BaseIdentifiableObject, Period>
+{
+ private BaseIdentifiableObjectXmlAdapter baseIdentifiableObjectXmlAdapter = new BaseIdentifiableObjectXmlAdapter();
+
+ @Override
+ public Period unmarshal( BaseIdentifiableObject identifiableObject ) throws Exception
+ {
+ Period period = new Period();
+
+ period.setUid( identifiableObject.getUid() );
+ period.setLastUpdated( identifiableObject.getLastUpdated() );
+ period.setName( identifiableObject.getName() == null ? UUID.randomUUID().toString() : identifiableObject.getName() );
+
+ return period;
+ }
+
+ @Override
+ public BaseIdentifiableObject marshal( Period period ) throws Exception
+ {
+ return baseIdentifiableObjectXmlAdapter.marshal( period );
+ }
+}
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/comparator/CategoryComboSizeComparator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/comparator/CategoryComboSizeComparator.java 2010-05-12 13:38:28 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/comparator/CategoryComboSizeComparator.java 1970-01-01 00:00:00 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2004-2009, 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.
- */
-package org.hisp.dhis.common.comparator;
-
-/**
- * @author Abyot Asalefew Gizaw
- * @version $Id$
- */
-import java.util.Comparator;
-
-import org.hisp.dhis.dataelement.DataElementCategoryCombo;
-
-public class CategoryComboSizeComparator
- implements Comparator<DataElementCategoryCombo>
-{
- public int compare( DataElementCategoryCombo o1, DataElementCategoryCombo o2 )
- {
- return (int) (o1.getOptionCombos().size() - o2.getOptionCombos().size());
- }
-}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/constant/Constant.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/constant/Constant.java 2011-12-03 10:35:41 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/constant/Constant.java 2011-12-09 20:53:07 +0000
@@ -27,11 +27,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import org.codehaus.jackson.annotate.JsonProperty;
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.Dxf2Namespace;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
@@ -115,6 +117,8 @@
// Getter & Setter
// -------------------------------------------------------------------------
+ @XmlElement
+ @JsonProperty
public double getValue()
{
return value;
=== 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-09 18:08:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2011-12-09 20:53:07 +0000
@@ -490,6 +490,7 @@
@XmlElementWrapper( name = "dataSets" )
@XmlElement( name = "dataSet" )
@XmlJavaTypeAdapter( DataSetXmlAdapter.class )
+ @JsonProperty
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
public Set<DataSet> getDataSets()
{
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategories.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategories.java 2011-12-07 12:27:51 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategories.java 2011-12-09 20:53:07 +0000
@@ -28,13 +28,17 @@
*/
import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.BaseLinkableObject;
import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.common.adapter.CategoryXmlAdapter;
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.util.ArrayList;
import java.util.List;
@@ -48,7 +52,9 @@
private List<DataElementCategory> categories = new ArrayList<DataElementCategory>();
@XmlElement( name = "category" )
+ @XmlJavaTypeAdapter( CategoryXmlAdapter.class )
@JsonProperty( value = "categories" )
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<DataElementCategory> getCategories()
{
return categories;
=== 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-07 12:27:51 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java 2011-12-09 20:53:07 +0000
@@ -30,8 +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.BaseNameableObjectXmlAdapter;
-import org.hisp.dhis.common.adapter.JsonNameableObjectCollectionSerializer;
+import org.hisp.dhis.common.adapter.CategoryOptionXmlAdapter;
import org.hisp.dhis.concept.Concept;
import javax.xml.bind.annotation.*;
@@ -149,9 +148,9 @@
// ------------------------------------------------------------------------
@XmlElementWrapper( name = "categoryOptions" )
- @XmlJavaTypeAdapter( BaseNameableObjectXmlAdapter.class )
+ @XmlJavaTypeAdapter( CategoryOptionXmlAdapter.class )
@XmlElement( name = "categoryOption" )
- @JsonSerialize( using = JsonNameableObjectCollectionSerializer.class )
+ @JsonSerialize( contentAs = BaseIdentifiableObject.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-09 18:42:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java 2011-12-09 20:53:07 +0000
@@ -27,24 +27,17 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.hisp.dhis.common.BaseIdentifiableObject;
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.CategoryOptionComboXmlAdapter;
+import org.hisp.dhis.common.adapter.CategoryXmlAdapter;
+
+import javax.xml.bind.annotation.*;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import java.util.*;
/**
* @author Abyot Aselefew
@@ -222,7 +215,9 @@
@XmlElementWrapper( name = "categories" )
@XmlElement( name = "category" )
- @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class )
+ @XmlJavaTypeAdapter( CategoryXmlAdapter.class )
+ @JsonProperty
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<DataElementCategory> getCategories()
{
return categories;
@@ -233,9 +228,11 @@
this.categories = categories;
}
- @XmlElementWrapper( name = "optionCombos" )
- @XmlElement( name = "optionCombo" )
- @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class )
+ @XmlElementWrapper( name = "categoryOptionCombos" )
+ @XmlElement( name = "categoryOptionCombo" )
+ @XmlJavaTypeAdapter( CategoryOptionComboXmlAdapter.class )
+ @JsonProperty( value = "categoryOptionCombo" )
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public Set<DataElementCategoryOptionCombo> getOptionCombos()
{
return optionCombos;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombos.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombos.java 2011-12-07 12:27:51 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombos.java 2011-12-09 20:53:07 +0000
@@ -28,13 +28,17 @@
*/
import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.BaseLinkableObject;
import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.common.adapter.CategoryComboXmlAdapter;
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.util.ArrayList;
import java.util.List;
@@ -48,7 +52,9 @@
private List<DataElementCategoryCombo> categoryCombos = new ArrayList<DataElementCategoryCombo>();
@XmlElement( name = "categoryCombo" )
+ @XmlJavaTypeAdapter( CategoryComboXmlAdapter.class )
@JsonProperty( value = "categoryCombos" )
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<DataElementCategoryCombo> getCategoryCombos()
{
return categoryCombos;
=== 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-07 12:27:51 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java 2011-12-09 20:53:07 +0000
@@ -29,15 +29,17 @@
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.BaseNameableObject;
import org.hisp.dhis.common.Dxf2Namespace;
-import org.hisp.dhis.common.adapter.*;
+import org.hisp.dhis.common.adapter.BaseIdentifiableObjectXmlAdapter;
+import org.hisp.dhis.common.adapter.CategoryOptionComboXmlAdapter;
+import org.hisp.dhis.concept.Concept;
import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.util.HashSet;
import java.util.Set;
-import org.hisp.dhis.concept.Concept;
/**
* @author Abyot Asalefew
@@ -54,7 +56,7 @@
public static final String DEFAULT_NAME = "default";
private DataElementCategory category;
-
+
private Concept concept;
private Set<DataElementCategoryOptionCombo> categoryOptionCombos = new HashSet<DataElementCategoryOptionCombo>();
@@ -133,7 +135,7 @@
@XmlElement
@XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class )
@JsonProperty
- @JsonSerialize( using = JsonIdentifiableObjectSerializer.class )
+ @JsonSerialize( as = BaseIdentifiableObject.class )
public DataElementCategory getCategory()
{
return category;
@@ -144,18 +146,21 @@
this.category = category;
}
- public Concept getConcept() {
+ public Concept getConcept()
+ {
return concept;
}
- public void setConcept(Concept concept) {
+ public void setConcept( Concept concept )
+ {
this.concept = concept;
}
@XmlElementWrapper( name = "categoryOptionCombos" )
- @XmlJavaTypeAdapter( BaseNameableObjectXmlAdapter.class )
+ @XmlJavaTypeAdapter( CategoryOptionComboXmlAdapter.class )
@XmlElement( name = "categoryOptionCombo" )
- @JsonSerialize( using = JsonNameableObjectCollectionSerializer.class )
+ @JsonProperty
+ @JsonSerialize( contentAs = BaseIdentifiableObject.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-07 12:27:51 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java 2011-12-09 20:53:07 +0000
@@ -30,12 +30,11 @@
import org.apache.commons.lang.StringEscapeUtils;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.BaseNameableObject;
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.JsonNameableObjectCollectionSerializer;
+import org.hisp.dhis.common.adapter.CategoryComboXmlAdapter;
+import org.hisp.dhis.common.adapter.CategoryOptionXmlAdapter;
import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
@@ -295,9 +294,9 @@
}
@XmlElement
- @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class )
+ @XmlJavaTypeAdapter( CategoryComboXmlAdapter.class )
@JsonProperty
- @JsonSerialize( using = JsonIdentifiableObjectSerializer.class )
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public DataElementCategoryCombo getCategoryCombo()
{
return categoryCombo;
@@ -309,10 +308,10 @@
}
@XmlElementWrapper( name = "categoryOptions" )
- @XmlJavaTypeAdapter( BaseNameableObjectXmlAdapter.class )
+ @XmlJavaTypeAdapter( CategoryOptionXmlAdapter.class )
@XmlElement( name = "categoryOption" )
@JsonProperty
- @JsonSerialize( using = JsonNameableObjectCollectionSerializer.class )
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<DataElementCategoryOption> getCategoryOptions()
{
return categoryOptions;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombos.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombos.java 2011-12-07 12:27:51 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombos.java 2011-12-09 20:53:07 +0000
@@ -28,13 +28,17 @@
*/
import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.BaseLinkableObject;
import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.common.adapter.CategoryOptionComboXmlAdapter;
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.util.ArrayList;
import java.util.List;
@@ -48,7 +52,9 @@
private List<DataElementCategoryOptionCombo> categoryOptionCombos = new ArrayList<DataElementCategoryOptionCombo>();
@XmlElement( name = "categoryOptionCombo" )
+ @XmlJavaTypeAdapter( CategoryOptionComboXmlAdapter.class )
@JsonProperty( value = "categoryOptionCombos" )
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<DataElementCategoryOptionCombo> getCategoryOptionCombos()
{
return categoryOptionCombos;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptions.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptions.java 2011-12-07 12:27:51 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptions.java 2011-12-09 20:53:07 +0000
@@ -1,13 +1,17 @@
package org.hisp.dhis.dataelement;
import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.BaseLinkableObject;
import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.common.adapter.CategoryOptionXmlAdapter;
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.util.ArrayList;
import java.util.List;
@@ -21,7 +25,9 @@
private List<DataElementCategoryOption> categoryOptions = new ArrayList<DataElementCategoryOption>();
@XmlElement( name = "categoryOption" )
+ @XmlJavaTypeAdapter( CategoryOptionXmlAdapter.class )
@JsonProperty( value = "categoryOptions" )
+ @JsonSerialize( contentAs = BaseIdentifiableObject.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-09 18:08:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java 2011-12-09 20:53:07 +0000
@@ -31,7 +31,8 @@
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.DataElementGroupSetXmlAdapter;
+import org.hisp.dhis.common.adapter.DataElementXmlAdapter;
import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
@@ -147,7 +148,7 @@
@XmlElementWrapper( name = "dataElements" )
@XmlElement( name = "dataElement" )
- @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class )
+ @XmlJavaTypeAdapter( DataElementXmlAdapter.class )
@JsonProperty( value = "dataElements" )
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
public Set<DataElement> getMembers()
@@ -161,7 +162,7 @@
}
@XmlElement( name = "dataElementGroupSet" )
- @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class )
+ @XmlJavaTypeAdapter( DataElementGroupSetXmlAdapter.class )
@JsonProperty( value = "dataElementGroupSet" )
@JsonSerialize( as = BaseIdentifiableObject.class )
public DataElementGroupSet getGroupSet()
=== 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-09 18:08:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java 2011-12-09 20:53:07 +0000
@@ -31,7 +31,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.DataElementGroupXmlAdapter;
import org.hisp.dhis.dataelement.comparator.DataElementGroupNameComparator;
import javax.xml.bind.annotation.*;
@@ -220,7 +220,7 @@
@XmlElementWrapper( name = "dataElementGroups" )
@XmlElement( name = "dataElementGroup" )
- @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class )
+ @XmlJavaTypeAdapter( DataElementGroupXmlAdapter.class )
@JsonProperty( value = "dataElementGroups" )
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<DataElementGroup> getMembers()
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSets.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSets.java 2011-12-03 14:31:45 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSets.java 2011-12-09 20:53:07 +0000
@@ -28,13 +28,17 @@
*/
import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.BaseLinkableObject;
import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.common.adapter.DataElementGroupSetXmlAdapter;
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.util.ArrayList;
import java.util.List;
@@ -48,7 +52,9 @@
private List<DataElementGroupSet> dataElementGroupSets = new ArrayList<DataElementGroupSet>();
@XmlElement( name = "dataElementGroupSet" )
+ @XmlJavaTypeAdapter( DataElementGroupSetXmlAdapter.class )
@JsonProperty( value = "dataElementGroupSets" )
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<DataElementGroupSet> getDataElementGroupSets()
{
return dataElementGroupSets;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroups.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroups.java 2011-12-03 14:31:45 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroups.java 2011-12-09 20:53:07 +0000
@@ -28,13 +28,17 @@
*/
import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.BaseLinkableObject;
import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.common.adapter.DataElementGroupXmlAdapter;
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.util.ArrayList;
import java.util.List;
@@ -48,7 +52,9 @@
private List<DataElementGroup> dataElementGroups = new ArrayList<DataElementGroup>();
@XmlElement( name = "dataElementGroup" )
+ @XmlJavaTypeAdapter( DataElementGroupXmlAdapter.class )
@JsonProperty( value = "dataElementGroups" )
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<DataElementGroup> getDataElementGroups()
{
return dataElementGroups;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementOperand.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementOperand.java 2011-12-03 10:35:41 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementOperand.java 2011-12-09 20:53:07 +0000
@@ -30,11 +30,16 @@
import org.apache.commons.lang.StringEscapeUtils;
import org.codehaus.jackson.annotate.JsonProperty;
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.BaseNameableObjectXmlAdapter;
-import org.hisp.dhis.common.adapter.JsonNameableObjectSerializer;
+import org.hisp.dhis.common.adapter.BaseIdentifiableObjectXmlAdapter;
+import org.hisp.dhis.common.adapter.CategoryOptionComboXmlAdapter;
+import org.hisp.dhis.common.adapter.DataElementXmlAdapter;
-import javax.xml.bind.annotation.*;
+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;
import java.util.ArrayList;
@@ -342,9 +347,9 @@
}
@XmlElement
- @XmlJavaTypeAdapter( BaseNameableObjectXmlAdapter.class )
+ @XmlJavaTypeAdapter( DataElementXmlAdapter.class )
@JsonProperty
- @JsonSerialize( using = JsonNameableObjectSerializer.class )
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public DataElement getDataElement()
{
return dataElement;
@@ -356,9 +361,9 @@
}
@XmlElement
- @XmlJavaTypeAdapter( BaseNameableObjectXmlAdapter.class )
+ @XmlJavaTypeAdapter( CategoryOptionComboXmlAdapter.class )
@JsonProperty
- @JsonSerialize( using = JsonNameableObjectSerializer.class )
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public DataElementCategoryOptionCombo getCategoryOptionCombo()
{
return categoryOptionCombo;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElements.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElements.java 2011-12-03 14:31:45 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElements.java 2011-12-09 20:53:07 +0000
@@ -28,13 +28,17 @@
*/
import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.BaseLinkableObject;
import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.common.adapter.DataElementXmlAdapter;
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.util.ArrayList;
import java.util.List;
@@ -48,7 +52,9 @@
private List<DataElement> dataElements = new ArrayList<DataElement>();
@XmlElement( name = "dataElement" )
+ @XmlJavaTypeAdapter( DataElementXmlAdapter.class )
@JsonProperty( value = "dataElements" )
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<DataElement> getDataElements()
{
return dataElements;
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/comparator/DataElementCategoryComboSizeComparator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/comparator/DataElementCategoryComboSizeComparator.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/comparator/DataElementCategoryComboSizeComparator.java 2011-12-09 20:53:07 +0000
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2004-2009, 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.
+ */
+package org.hisp.dhis.dataelement.comparator;
+
+/**
+ * @author Abyot Asalefew Gizaw
+ * @version $Id$
+ */
+import java.util.Comparator;
+
+import org.hisp.dhis.dataelement.DataElementCategoryCombo;
+
+public class DataElementCategoryComboSizeComparator
+ implements Comparator<DataElementCategoryCombo>
+{
+ public int compare( DataElementCategoryCombo o1, DataElementCategoryCombo o2 )
+ {
+ return (int) (o1.getOptionCombos().size() - o2.getOptionCombos().size());
+ }
+}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryForm.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryForm.java 2011-12-09 18:08:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryForm.java 2011-12-09 20:53:07 +0000
@@ -90,7 +90,6 @@
* Map the identifiers inside the HTML code according to the provided data
* element identifier and category option combo identifier mappings.
*
- * @param htmlCode the HTML code.
* @param dataElementMap the mapping between data element identifiers to be
* converted.
* @param categoryOptionComboMap the mapping between category option combo
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/CompleteDataSetRegistration.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/CompleteDataSetRegistration.java 2011-12-03 10:35:41 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/CompleteDataSetRegistration.java 2011-12-09 20:53:07 +0000
@@ -29,10 +29,12 @@
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.Dxf2Namespace;
import org.hisp.dhis.common.ImportableObject;
-import org.hisp.dhis.common.adapter.BaseNameableObjectXmlAdapter;
-import org.hisp.dhis.common.adapter.JsonDateSerializer;
+import org.hisp.dhis.common.adapter.DataSetXmlAdapter;
+import org.hisp.dhis.common.adapter.OrganisationUnitXmlAdapter;
+import org.hisp.dhis.common.adapter.PeriodXmlAdapter;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.period.Period;
@@ -179,7 +181,9 @@
// -------------------------------------------------------------------------
@XmlElement
- @XmlJavaTypeAdapter( BaseNameableObjectXmlAdapter.class )
+ @XmlJavaTypeAdapter( DataSetXmlAdapter.class )
+ @JsonProperty
+ @JsonSerialize( as = BaseIdentifiableObject.class )
public DataSet getDataSet()
{
return dataSet;
@@ -191,7 +195,9 @@
}
@XmlElement
- @XmlJavaTypeAdapter( BaseNameableObjectXmlAdapter.class )
+ @XmlJavaTypeAdapter( PeriodXmlAdapter.class )
+ @JsonProperty
+ @JsonSerialize( as = BaseIdentifiableObject.class )
public Period getPeriod()
{
return period;
@@ -202,8 +208,10 @@
this.period = period;
}
- @XmlElement
- @XmlJavaTypeAdapter( BaseNameableObjectXmlAdapter.class )
+ @XmlElement( name = "organisationUnit" )
+ @XmlJavaTypeAdapter( OrganisationUnitXmlAdapter.class )
+ @JsonProperty( value = "organisationUnit" )
+ @JsonSerialize( as = BaseIdentifiableObject.class )
public OrganisationUnit getSource()
{
return source;
@@ -216,7 +224,6 @@
@XmlElement
@JsonProperty
- @JsonSerialize( using = JsonDateSerializer.class )
public Date getDate()
{
return date;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/CompleteDataSetRegistrations.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/CompleteDataSetRegistrations.java 2011-12-03 14:31:45 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/CompleteDataSetRegistrations.java 2011-12-09 20:53:07 +0000
@@ -28,6 +28,8 @@
*/
import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.BaseLinkableObject;
import org.hisp.dhis.common.Dxf2Namespace;
@@ -35,6 +37,7 @@
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.util.ArrayList;
import java.util.List;
=== 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-09 18:08:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java 2011-12-09 20:53:07 +0000
@@ -32,8 +32,9 @@
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.BaseNameableObject;
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.DataElementXmlAdapter;
+import org.hisp.dhis.common.adapter.IndicatorXmlAdapter;
+import org.hisp.dhis.common.adapter.OrganisationUnitXmlAdapter;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementOperand;
import org.hisp.dhis.dataentryform.DataEntryForm;
@@ -307,7 +308,7 @@
@XmlElementWrapper( name = "dataElements" )
@XmlElement( name = "dataElement" )
- @XmlJavaTypeAdapter( BaseNameableObjectXmlAdapter.class )
+ @XmlJavaTypeAdapter( DataElementXmlAdapter.class )
@JsonProperty( value = "dataElements" )
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
public Set<DataElement> getDataElements()
@@ -322,7 +323,7 @@
@XmlElementWrapper( name = "indicators" )
@XmlElement( name = "indicator" )
- @XmlJavaTypeAdapter( BaseNameableObjectXmlAdapter.class )
+ @XmlJavaTypeAdapter( IndicatorXmlAdapter.class )
@JsonProperty( value = "indicators" )
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
public Set<Indicator> getIndicators()
@@ -349,7 +350,7 @@
@XmlElementWrapper( name = "organisationUnits" )
@XmlElement( name = "organisationUnit" )
- @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class )
+ @XmlJavaTypeAdapter( OrganisationUnitXmlAdapter.class )
@JsonProperty( value = "organisationUnits" )
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
public Set<OrganisationUnit> getSources()
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSets.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSets.java 2011-12-03 14:31:45 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSets.java 2011-12-09 20:53:07 +0000
@@ -28,13 +28,17 @@
*/
import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.BaseLinkableObject;
import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.common.adapter.DataSetXmlAdapter;
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.util.ArrayList;
import java.util.List;
@@ -48,7 +52,9 @@
private List<DataSet> dataSets = new ArrayList<DataSet>();
@XmlElement( name = "dataSet" )
+ @XmlJavaTypeAdapter( DataSetXmlAdapter.class )
@JsonProperty( value = "dataSets" )
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<DataSet> getDataSets()
{
return dataSets;
=== 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-09 18:08:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java 2011-12-09 20:53:07 +0000
@@ -28,6 +28,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.DataElementXmlAdapter;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementOperand;
@@ -199,7 +200,7 @@
@XmlElementWrapper( name = "dataElements" )
@XmlElement( name = "dataElement" )
- @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class )
+ @XmlJavaTypeAdapter( DataElementXmlAdapter.class )
@JsonProperty( value = "dataElements" )
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<DataElement> getDataElements()
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/document/Document.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/document/Document.java 2011-12-09 20:14:06 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/document/Document.java 2011-12-09 20:58:29 +0000
@@ -29,23 +29,30 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.hisp.dhis.common.Dxf2Namespace;
+
+import javax.xml.bind.annotation.*;
+
/**
* @author Lars Helge Overland
* @version $Id$
*/
+@XmlRootElement( name = "dataElement", namespace = Dxf2Namespace.NAMESPACE )
+@XmlAccessorType( value = XmlAccessType.NONE )
public class Document
extends BaseIdentifiableObject
{
private String url;
-
+
private boolean external;
-
+
private String contentType;
-
+
public Document()
- {
+ {
}
-
+
public Document( String name, String url, boolean external, String contentType )
{
this.name = name;
@@ -58,7 +65,7 @@
public int hashCode()
{
return name.hashCode();
- }
+ }
@Override
public boolean equals( Object object )
@@ -67,22 +74,24 @@
{
return true;
}
-
+
if ( object == null )
{
return false;
}
-
+
if ( getClass() != object.getClass() )
{
return false;
}
-
+
final Document other = (Document) object;
-
+
return name.equals( other.name );
}
+ @XmlElement
+ @JsonProperty
public String getUrl()
{
return url;
@@ -93,6 +102,8 @@
this.url = url;
}
+ @XmlElement
+ @JsonProperty
public boolean isExternal()
{
return external;
@@ -103,6 +114,8 @@
this.external = external;
}
+ @XmlElement
+ @JsonProperty
public String getContentType()
{
return contentType;
=== 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-09 18:08:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java 2011-12-09 20:53:07 +0000
@@ -33,8 +33,9 @@
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.BaseNameableObject;
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.DataSetXmlAdapter;
+import org.hisp.dhis.common.adapter.IndicatorGroupXmlAdapter;
+import org.hisp.dhis.common.adapter.IndicatorTypeXmlAdapter;
import org.hisp.dhis.dataset.DataSet;
import javax.xml.bind.annotation.*;
@@ -171,7 +172,8 @@
}
@XmlElement
- @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class )
+ @XmlJavaTypeAdapter( IndicatorTypeXmlAdapter.class )
+ @JsonProperty
@JsonSerialize( as = BaseIdentifiableObject.class )
public IndicatorType getIndicatorType()
{
@@ -280,7 +282,7 @@
}
@XmlElementWrapper( name = "indicatorGroups" )
- @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class )
+ @XmlJavaTypeAdapter( IndicatorGroupXmlAdapter.class )
@XmlElement( name = "indicatorGroup" )
@JsonProperty( value = "indicatorGroups" )
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
@@ -295,7 +297,7 @@
}
@XmlElementWrapper( name = "dataSets" )
- @XmlJavaTypeAdapter( BaseNameableObjectXmlAdapter.class )
+ @XmlJavaTypeAdapter( DataSetXmlAdapter.class )
@XmlElement( name = "dataSet" )
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
public Set<DataSet> getDataSets()
=== 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-09 18:08:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java 2011-12-09 20:53:07 +0000
@@ -31,8 +31,8 @@
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.JsonIdentifiableObjectCollectionSerializer;
+import org.hisp.dhis.common.adapter.IndicatorGroupSetXmlAdapter;
+import org.hisp.dhis.common.adapter.IndicatorXmlAdapter;
import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
@@ -144,9 +144,10 @@
// -------------------------------------------------------------------------
@XmlElementWrapper( name = "indicators" )
- @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class )
@XmlElement( name = "indicator" )
- @JsonSerialize( using = JsonIdentifiableObjectCollectionSerializer.class )
+ @XmlJavaTypeAdapter( IndicatorXmlAdapter.class )
+ @JsonProperty( value = "indicators" )
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public Set<Indicator> getMembers()
{
return members;
@@ -158,7 +159,7 @@
}
@XmlElement( name = "indicatorGroupSet" )
- @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class )
+ @XmlJavaTypeAdapter( IndicatorGroupSetXmlAdapter.class )
@JsonProperty( value = "indicatorGroupSet" )
@JsonSerialize( as = BaseIdentifiableObject.class )
public IndicatorGroupSet getGroupSet()
=== 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-09 18:08:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.java 2011-12-09 20:53:07 +0000
@@ -31,7 +31,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.IndicatorGroupXmlAdapter;
import org.hisp.dhis.indicator.comparator.IndicatorGroupNameComparator;
import javax.xml.bind.annotation.*;
@@ -220,7 +220,7 @@
@XmlElementWrapper( name = "indicatorGroups" )
@XmlElement( name = "indicatorGroup" )
- @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class )
+ @XmlJavaTypeAdapter( IndicatorGroupXmlAdapter.class )
@JsonProperty( value = "indicatorGroups" )
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<IndicatorGroup> getMembers()
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSets.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSets.java 2011-12-03 14:31:45 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSets.java 2011-12-09 20:53:07 +0000
@@ -28,13 +28,17 @@
*/
import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.BaseLinkableObject;
import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.common.adapter.IndicatorGroupSetXmlAdapter;
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.util.ArrayList;
import java.util.List;
@@ -48,7 +52,9 @@
private List<IndicatorGroupSet> indicatorGroupSets = new ArrayList<IndicatorGroupSet>();
@XmlElement( name = "indicatorGroupSet" )
+ @XmlJavaTypeAdapter( IndicatorGroupSetXmlAdapter.class )
@JsonProperty( value = "indicatorGroupSets" )
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<IndicatorGroupSet> getIndicatorGroupSets()
{
return indicatorGroupSets;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroups.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroups.java 2011-12-03 14:31:45 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroups.java 2011-12-09 20:53:07 +0000
@@ -28,13 +28,17 @@
*/
import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.BaseLinkableObject;
import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.common.adapter.IndicatorGroupXmlAdapter;
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.util.ArrayList;
import java.util.List;
@@ -48,7 +52,9 @@
private List<IndicatorGroup> indicatorGroups = new ArrayList<IndicatorGroup>();
@XmlElement( name = "indicatorGroup" )
+ @XmlJavaTypeAdapter( IndicatorGroupXmlAdapter.class )
@JsonProperty( value = "indicatorGroups" )
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<IndicatorGroup> getIndicatorGroups()
{
return indicatorGroups;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorTypes.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorTypes.java 2011-12-03 14:31:45 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorTypes.java 2011-12-09 20:53:07 +0000
@@ -28,13 +28,17 @@
*/
import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.BaseLinkableObject;
import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.common.adapter.IndicatorTypeXmlAdapter;
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.util.ArrayList;
import java.util.List;
@@ -48,7 +52,9 @@
private List<IndicatorType> indicatorTypes = new ArrayList<IndicatorType>();
@XmlElement( name = "indicatorType" )
+ @XmlJavaTypeAdapter( IndicatorTypeXmlAdapter.class )
@JsonProperty( value = "indicatorTypes" )
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<IndicatorType> getIndicatorTypes()
{
return indicatorTypes;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicators.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicators.java 2011-12-03 14:31:45 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicators.java 2011-12-09 20:53:07 +0000
@@ -29,13 +29,17 @@
import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.BaseLinkableObject;
import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.common.adapter.IndicatorXmlAdapter;
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.util.ArrayList;
import java.util.List;
@@ -49,7 +53,9 @@
private List<Indicator> indicators = new ArrayList<Indicator>();
@XmlElement( name = "indicator" )
+ @XmlJavaTypeAdapter( IndicatorXmlAdapter.class )
@JsonProperty( value = "indicators" )
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<Indicator> getIndicators()
{
return indicators;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java 2011-12-06 15:03:45 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java 2011-12-09 20:53:07 +0000
@@ -27,14 +27,11 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-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 org.codehaus.jackson.annotate.JsonProperty;
+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.*;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementGroup;
import org.hisp.dhis.indicator.Indicator;
@@ -45,6 +42,12 @@
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.user.User;
+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;
+
/**
* @author Jan Henrik Overland
* @version $Id$
@@ -107,10 +110,10 @@
}
public MapView( String name, User user, String mapValueType, IndicatorGroup indicatorGroup, Indicator indicator,
- DataElementGroup dataElementGroup, DataElement dataElement, String mapDateType, PeriodType periodType,
- Period period, OrganisationUnit parentOrganisationUnit, OrganisationUnitLevel organisationUnitLevel,
- String mapLegendType, Integer method, Integer classes, String bounds, String colorLow, String colorHigh,
- MapLegendSet mapLegendSet, Integer radiusLow, Integer radiusHigh, String longitude, String latitude, int zoom )
+ DataElementGroup dataElementGroup, DataElement dataElement, String mapDateType, PeriodType periodType,
+ Period period, OrganisationUnit parentOrganisationUnit, OrganisationUnitLevel organisationUnitLevel,
+ String mapLegendType, Integer method, Integer classes, String bounds, String colorLow, String colorHigh,
+ MapLegendSet mapLegendSet, Integer radiusLow, Integer radiusHigh, String longitude, String latitude, int zoom )
{
this.name = name;
this.user = user;
@@ -209,7 +212,9 @@
}
@XmlElement
+ @XmlJavaTypeAdapter( IndicatorGroupXmlAdapter.class )
@JsonProperty
+ @JsonSerialize( as = BaseIdentifiableObject.class )
public IndicatorGroup getIndicatorGroup()
{
return indicatorGroup;
@@ -221,7 +226,9 @@
}
@XmlElement
+ @XmlJavaTypeAdapter( IndicatorXmlAdapter.class )
@JsonProperty
+ @JsonSerialize( as = BaseIdentifiableObject.class )
public Indicator getIndicator()
{
return indicator;
@@ -233,7 +240,9 @@
}
@XmlElement
+ @XmlJavaTypeAdapter( DataElementGroupXmlAdapter.class )
@JsonProperty
+ @JsonSerialize( as = BaseIdentifiableObject.class )
public DataElementGroup getDataElementGroup()
{
return dataElementGroup;
@@ -245,7 +254,9 @@
}
@XmlElement
+ @XmlJavaTypeAdapter( DataElementXmlAdapter.class )
@JsonProperty
+ @JsonSerialize( as = BaseIdentifiableObject.class )
public DataElement getDataElement()
{
return dataElement;
@@ -279,7 +290,9 @@
}
@XmlElement
+ @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class )
@JsonProperty
+ @JsonSerialize( as = BaseIdentifiableObject.class )
public Period getPeriod()
{
return period;
@@ -291,7 +304,9 @@
}
@XmlElement
+ @XmlJavaTypeAdapter( OrganisationUnitXmlAdapter.class )
@JsonProperty
+ @JsonSerialize( as = BaseIdentifiableObject.class )
public OrganisationUnit getParentOrganisationUnit()
{
return parentOrganisationUnit;
@@ -303,7 +318,9 @@
}
@XmlElement
+ @XmlJavaTypeAdapter( OrganisationUnitLevelXmlAdapter.class )
@JsonProperty
+ @JsonSerialize( as = BaseIdentifiableObject.class )
public OrganisationUnitLevel getOrganisationUnitLevel()
{
return organisationUnitLevel;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/Maps.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/Maps.java 2011-12-09 18:42:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/Maps.java 2011-12-09 20:53:07 +0000
@@ -1,16 +1,19 @@
package org.hisp.dhis.mapping;
-import java.util.ArrayList;
-import java.util.List;
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.hisp.dhis.common.BaseIdentifiableObject;
+import org.hisp.dhis.common.BaseLinkableObject;
+import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.common.adapter.MapViewXmlAdapter;
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 org.codehaus.jackson.annotate.JsonProperty;
-import org.hisp.dhis.common.BaseLinkableObject;
-import org.hisp.dhis.common.Dxf2Namespace;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import java.util.ArrayList;
+import java.util.List;
/*
* Copyright (c) 2011, University of Oslo
@@ -46,7 +49,9 @@
private List<MapView> maps = new ArrayList<MapView>();
@XmlElement( name = "map" )
+ @XmlJavaTypeAdapter( MapViewXmlAdapter.class )
@JsonProperty( value = "maps" )
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<MapView> getMaps()
{
return maps;
=== 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-09 18:08:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2011-12-09 20:53:07 +0000
@@ -34,8 +34,9 @@
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.BaseNameableObject;
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.DataSetXmlAdapter;
+import org.hisp.dhis.common.adapter.OrganisationUnitGroupXmlAdapter;
+import org.hisp.dhis.common.adapter.OrganisationUnitXmlAdapter;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator;
@@ -506,7 +507,8 @@
}
@XmlElement
- @XmlJavaTypeAdapter( BaseNameableObjectXmlAdapter.class )
+ @XmlJavaTypeAdapter( OrganisationUnitXmlAdapter.class )
+ @JsonProperty
@JsonSerialize( as = BaseIdentifiableObject.class )
public OrganisationUnit getParent()
{
@@ -626,7 +628,7 @@
@XmlElementWrapper( name = "organisationUnitGroups" )
@XmlElement( name = "organisationUnitGroup" )
- @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class )
+ @XmlJavaTypeAdapter( OrganisationUnitGroupXmlAdapter.class )
@JsonProperty( value = "organisationUnitGroups" )
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
public Set<OrganisationUnitGroup> getGroups()
@@ -641,7 +643,8 @@
@XmlElementWrapper( name = "dataSets" )
@XmlElement( name = "dataSet" )
- @XmlJavaTypeAdapter( BaseNameableObjectXmlAdapter.class )
+ @XmlJavaTypeAdapter( DataSetXmlAdapter.class )
+ @JsonProperty
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
public Set<DataSet> getDataSets()
{
=== 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-09 18:08:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java 2011-12-09 20:53:07 +0000
@@ -31,8 +31,8 @@
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.OrganisationUnitGroupSetXmlAdapter;
+import org.hisp.dhis.common.adapter.OrganisationUnitXmlAdapter;
import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
@@ -145,7 +145,7 @@
@XmlElementWrapper( name = "organisationUnits" )
@XmlElement( name = "organisationUnit" )
- @XmlJavaTypeAdapter( BaseNameableObjectXmlAdapter.class )
+ @XmlJavaTypeAdapter( OrganisationUnitXmlAdapter.class )
@JsonProperty( value = "organisationUnits" )
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
public Set<OrganisationUnit> getMembers()
@@ -159,7 +159,7 @@
}
@XmlElement( name = "organisationUnitGroupSet" )
- @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class )
+ @XmlJavaTypeAdapter( OrganisationUnitGroupSetXmlAdapter.class )
@JsonProperty( value = "organisationUnitGroupSet" )
@JsonSerialize( as = BaseIdentifiableObject.class )
public OrganisationUnitGroupSet getGroupSet()
=== 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-09 18:08:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java 2011-12-09 20:53:07 +0000
@@ -31,7 +31,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.OrganisationUnitGroupXmlAdapter;
import org.hisp.dhis.organisationunit.comparator.OrganisationUnitGroupNameComparator;
import javax.xml.bind.annotation.*;
@@ -198,7 +198,7 @@
@XmlElementWrapper( name = "organisationUnitGroups" )
@XmlElement( name = "organisationUnitGroup" )
- @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class )
+ @XmlJavaTypeAdapter( OrganisationUnitGroupXmlAdapter.class )
@JsonProperty( value = "organisationUnitGroups" )
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
public Set<OrganisationUnitGroup> getOrganisationUnitGroups()
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSets.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSets.java 2011-12-03 14:31:45 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSets.java 2011-12-09 20:53:07 +0000
@@ -28,13 +28,17 @@
*/
import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.BaseLinkableObject;
import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.common.adapter.OrganisationUnitGroupSetXmlAdapter;
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.util.ArrayList;
import java.util.List;
@@ -48,7 +52,9 @@
private List<OrganisationUnitGroupSet> organisationUnitGroupSets = new ArrayList<OrganisationUnitGroupSet>();
@XmlElement( name = "organisationUnitGroupSet" )
+ @XmlJavaTypeAdapter( OrganisationUnitGroupSetXmlAdapter.class )
@JsonProperty( value = "organisationUnitGroupSets" )
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<OrganisationUnitGroupSet> getOrganisationUnitGroupSets()
{
return organisationUnitGroupSets;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroups.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroups.java 2011-12-03 14:31:45 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroups.java 2011-12-09 20:53:07 +0000
@@ -28,13 +28,17 @@
*/
import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.BaseLinkableObject;
import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.common.adapter.OrganisationUnitGroupXmlAdapter;
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.util.ArrayList;
import java.util.List;
@@ -48,7 +52,9 @@
private List<OrganisationUnitGroup> organisationUnitGroups = new ArrayList<OrganisationUnitGroup>();
@XmlElement( name = "organisationUnitGroup" )
+ @XmlJavaTypeAdapter( OrganisationUnitGroupXmlAdapter.class )
@JsonProperty( value = "organisationUnitGroups" )
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<OrganisationUnitGroup> getOrganisationUnitGroups()
{
return organisationUnitGroups;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnits.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnits.java 2011-12-03 14:31:45 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnits.java 2011-12-09 20:53:07 +0000
@@ -28,13 +28,17 @@
*/
import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.BaseLinkableObject;
import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.common.adapter.OrganisationUnitXmlAdapter;
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.util.ArrayList;
import java.util.List;
@@ -48,7 +52,9 @@
private List<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>();
@XmlElement( name = "organisationUnit" )
+ @XmlJavaTypeAdapter( OrganisationUnitXmlAdapter.class )
@JsonProperty( value = "organisationUnits" )
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public List<OrganisationUnit> getOrganisationUnits()
{
return organisationUnits;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/RelativePeriods.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/RelativePeriods.java 2011-11-25 10:09:59 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/RelativePeriods.java 2011-12-09 20:53:07 +0000
@@ -271,7 +271,6 @@
* Return the name of the reporting period. The current date is set to
* todays date minus one month.
*
- * @param date the start date of the reporting period.
* @param format the i18n format.
* @return the name of the reporting period.
*/
@@ -485,7 +484,6 @@
* Creates an instance of RelativePeriods based on given set of PeriodType
* names.
*
- * @param config the Configuration object.
* @return a RelativePeriods instance.
*/
public RelativePeriods getRelativePeriods( Set<String> periodTypes )
=== 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-06 21:57:53 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/User.java 2011-12-09 20:53:07 +0000
@@ -31,12 +31,14 @@
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.hisp.dhis.attribute.AttributeValue;
+import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.Dxf2Namespace;
import org.hisp.dhis.common.IdentifiableObjectUtils;
-import org.hisp.dhis.common.adapter.JsonCollectionSerializer;
+import org.hisp.dhis.common.adapter.OrganisationUnitXmlAdapter;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import javax.xml.bind.annotation.*;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.io.Serializable;
import java.util.Collection;
import java.util.HashSet;
@@ -271,6 +273,11 @@
this.userCredentials = userCredentials;
}
+ @XmlElementWrapper( name = "organisationUnits" )
+ @XmlElement( name = "organisationUnit" )
+ @XmlJavaTypeAdapter( OrganisationUnitXmlAdapter.class )
+ @JsonProperty
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
public Collection<OrganisationUnit> getOrganisationUnits()
{
return organisationUnits;
@@ -284,7 +291,6 @@
@XmlElementWrapper( name = "attributes" )
@XmlElement( name = "attribute" )
@JsonProperty( value = "attributes" )
- @JsonSerialize( using = JsonCollectionSerializer.class )
public Set<AttributeValue> getAttributeValues()
{
return attributeValues;
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java 2011-12-09 19:30:02 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java 2011-12-09 20:58:29 +0000
@@ -40,7 +40,7 @@
import java.util.Set;
import org.hisp.dhis.common.GenericIdentifiableObjectStore;
-import org.hisp.dhis.common.comparator.CategoryComboSizeComparator;
+import org.hisp.dhis.dataelement.comparator.DataElementCategoryComboSizeComparator;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.hierarchy.HierarchyViolationException;
import org.hisp.dhis.i18n.I18nService;
@@ -277,7 +277,7 @@
List<DataElementCategoryCombo> listCategoryCombos = new ArrayList<DataElementCategoryCombo>( setCategoryCombos );
- Collections.sort( listCategoryCombos, new CategoryComboSizeComparator() );
+ Collections.sort( listCategoryCombos, new DataElementCategoryComboSizeComparator() );
return listCategoryCombos;
}
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartController.java 2011-12-08 17:11:47 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartController.java 2011-12-09 20:53:07 +0000
@@ -33,6 +33,8 @@
import org.hisp.dhis.chart.ChartService;
import org.hisp.dhis.chart.Charts;
import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.i18n.I18nManager;
+import org.hisp.dhis.i18n.I18nManagerException;
import org.hisp.dhis.period.Period;
import org.jfree.chart.ChartUtilities;
import org.jfree.chart.JFreeChart;
@@ -62,6 +64,9 @@
@Autowired
private ChartService chartService;
+ @Autowired
+ private I18nManager i18nManager;
+
//-------------------------------------------------------------------------------------------------------
// GET
//-------------------------------------------------------------------------------------------------------
@@ -99,37 +104,12 @@
return "chart";
}
- private class MockI18nFormat
- extends I18nFormat
- {
- public MockI18nFormat()
- {
- super( null );
- }
-
- @Override
- public String formatPeriod( Period period )
- {
- String name = period.getStartDate() + "-" + period.getEndDate();
-
- return name.toLowerCase().trim();
- }
-
- @Override
- public String formatDate( Date date )
- {
- return date.toString().toLowerCase().trim();
- }
- }
-
@RequestMapping( value = "/{uid}.png", method = RequestMethod.GET )
public void getChartPNG( @PathVariable( "uid" ) String uid, @RequestParam( value = "width", defaultValue = "700", required = false ) int width,
@RequestParam( value = "height", defaultValue = "500", required = false ) int height,
- HttpServletResponse response ) throws IOException
+ HttpServletResponse response ) throws IOException, I18nManagerException
{
- I18nFormat i18nFormat = new MockI18nFormat();
-
- JFreeChart chart = chartService.getJFreeChart( uid, i18nFormat );
+ JFreeChart chart = chartService.getJFreeChart( uid, i18nManager.getI18nFormat() );
response.setContentType( "image/png" );
ChartUtilities.writeChartAsPNG( response.getOutputStream(), chart, width, height );
@@ -138,11 +118,9 @@
@RequestMapping( value = "/{uid}.jpg", method = RequestMethod.GET )
public void getChartJPG( @PathVariable( "uid" ) String uid, @RequestParam( value = "width", defaultValue = "700", required = false ) int width,
@RequestParam( value = "height", defaultValue = "500", required = false ) int height,
- HttpServletResponse response ) throws IOException
+ HttpServletResponse response ) throws IOException, I18nManagerException
{
- I18nFormat i18nFormat = new MockI18nFormat();
-
- JFreeChart chart = chartService.getJFreeChart( uid, i18nFormat );
+ JFreeChart chart = chartService.getJFreeChart( uid, i18nManager.getI18nFormat() );
response.setContentType( "image/jpg" );
ChartUtilities.writeChartAsJPEG( response.getOutputStream(), chart, width, height );