=== modified file 'dhis-2/dhis-api/pom.xml' --- dhis-2/dhis-api/pom.xml 2011-11-21 12:41:53 +0000 +++ dhis-2/dhis-api/pom.xml 2011-12-02 23:36:03 +0000 @@ -1,3 +1,5 @@ + + === 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-11-24 14:36:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attribute.java 2011-12-03 10:35:41 +0000 @@ -27,10 +27,13 @@ package org.hisp.dhis.attribute; +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; import java.util.HashSet; import java.util.Set; @@ -38,7 +41,7 @@ /** * @author mortenoh */ -@XmlRootElement( name = "attribute" ) +@XmlRootElement( name = "attribute", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class Attribute extends BaseIdentifiableObject { @@ -74,6 +77,8 @@ this.valueType = valueType; } + @XmlElement + @JsonProperty public String getValueType() { return valueType; @@ -84,6 +89,8 @@ this.valueType = valueType; } + @XmlElement + @JsonProperty public boolean isMandatory() { return mandatory; @@ -94,6 +101,8 @@ this.mandatory = mandatory; } + @XmlElement + @JsonProperty public boolean isDataElementAttribute() { return dataElementAttribute; @@ -104,6 +113,8 @@ this.dataElementAttribute = dataElementAttribute; } + @XmlElement + @JsonProperty public boolean isIndicatorAttribute() { return indicatorAttribute; @@ -114,6 +125,8 @@ this.indicatorAttribute = indicatorAttribute; } + @XmlElement + @JsonProperty public boolean isOrganisationUnitAttribute() { return organisationUnitAttribute; @@ -124,16 +137,8 @@ this.organisationUnitAttribute = organisationUnitAttribute; } - public void setAttributeValues( Set attributeValues ) - { - this.attributeValues = attributeValues; - } - - public void setSortOrder( Integer sortOrder ) - { - this.sortOrder = sortOrder; - } - + @XmlElement + @JsonProperty public boolean isUserAttribute() { return userAttribute; @@ -149,8 +154,20 @@ return attributeValues; } + public void setAttributeValues( Set attributeValues ) + { + this.attributeValues = attributeValues; + } + + @XmlElement + @JsonProperty public Integer getSortOrder() { return sortOrder; } + + public void setSortOrder( Integer sortOrder ) + { + this.sortOrder = sortOrder; + } } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeValue.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeValue.java 2011-11-22 14:05:18 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeValue.java 2011-12-03 10:35:41 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2010, University of Oslo + * Copyright (c) 2004-2011, University of Oslo * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,15 +27,19 @@ package org.hisp.dhis.attribute; +import org.codehaus.jackson.annotate.JsonProperty; +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.io.Serializable; /** * @author mortenoh */ -@XmlRootElement( name = "attributeValue" ) +@XmlRootElement( name = "attributeValue", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class AttributeValue implements Serializable @@ -81,6 +85,8 @@ this.id = id; } + @XmlElement + @JsonProperty public String getValue() { return value; === added 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 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attributes.java 2011-12-03 14:31:45 +0000 @@ -0,0 +1,61 @@ +/* + * 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. + */ + +package org.hisp.dhis.attribute; + +import org.codehaus.jackson.annotate.JsonProperty; +import org.hisp.dhis.common.BaseLinkableObject; +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 + */ +@XmlRootElement( name = "attributes", namespace = Dxf2Namespace.NAMESPACE ) +@XmlAccessorType( value = XmlAccessType.NONE ) +public class Attributes extends BaseLinkableObject +{ + private List attributes = new ArrayList(); + + @XmlElement( name = "attribute" ) + @JsonProperty( value = "attributes" ) + public List getAttributes() + { + return attributes; + } + + public void setAttributes( List attributes ) + { + this.attributes = 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-02 15:18:52 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java 2011-12-03 10:35:41 +0000 @@ -30,6 +30,7 @@ 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.JsonNameableObjectListSerializer; import org.hisp.dhis.dataelement.DataElement; @@ -50,7 +51,7 @@ /** * @author Lars Helge Overland */ -@XmlRootElement( name = "chart" ) +@XmlRootElement( name = "chart", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class Chart extends BaseIdentifiableObject === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/ChartGroup.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/ChartGroup.java 2011-11-24 14:36:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/ChartGroup.java 2011-12-03 10:35:41 +0000 @@ -28,6 +28,7 @@ */ import org.hisp.dhis.common.BaseIdentifiableObject; +import org.hisp.dhis.common.Dxf2Namespace; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -38,7 +39,7 @@ /** * @author Dang Duy Hieu */ -@XmlRootElement( name = "chartGroup" ) +@XmlRootElement( name = "chartGroup", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class ChartGroup extends BaseIdentifiableObject { === 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-11-24 14:57:12 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Charts.java 2011-12-03 13:36:49 +0000 @@ -1,6 +1,35 @@ +/* + * 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. + */ + package org.hisp.dhis.chart; import org.codehaus.jackson.annotate.JsonProperty; +import org.hisp.dhis.common.BaseLinkableObject; +import org.hisp.dhis.common.Dxf2Namespace; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -12,16 +41,13 @@ /** * @author Morten Olav Hansen */ -@XmlRootElement( name = "charts" ) +@XmlRootElement( name = "charts", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) -public class Charts +public class Charts extends BaseLinkableObject { private List charts = new ArrayList(); - public Charts() - { - - } + private String link; @XmlElement( name = "chart" ) @JsonProperty( value = "charts" ) === modified 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-11-24 14:36:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/codelist/CodeList.java 2011-12-03 10:35:41 +0000 @@ -1,6 +1,7 @@ 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; @@ -12,7 +13,7 @@ /** * @author Morten Olav Hansen */ -@XmlRootElement( name = "codeList" ) +@XmlRootElement( name = "codeList", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class CodeList { === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java 2011-11-25 14:03:14 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java 2011-12-03 13:36:49 +0000 @@ -32,15 +32,18 @@ import org.hisp.dhis.common.adapter.JsonDateSerializer; import javax.xml.bind.annotation.*; -import java.util.*; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; /** * @author Bob Jolliffe */ -@XmlRootElement( name = "identifiableObject" ) +@XmlRootElement( name = "identifiableObject", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) -@XmlType( propOrder = {"uid", "name", "code", "lastUpdated"} ) -public class BaseIdentifiableObject +@XmlType( propOrder = {"uid", "name", "code", "lastUpdated" } ) +public class BaseIdentifiableObject extends BaseLinkableObject implements IdentifiableObject { /** @@ -100,8 +103,8 @@ } @XmlID - @XmlAttribute(name = "id") - @JsonProperty(value = "id") + @XmlAttribute( name = "id" ) + @JsonProperty( value = "id" ) public String getUid() { return uid; === added 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 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseLinkableObject.java 2011-12-03 16:31:50 +0000 @@ -0,0 +1,56 @@ +package org.hisp.dhis.common; + +/* + * 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.annotate.JsonProperty; + +import javax.xml.bind.annotation.XmlAttribute; + +/** + * @author Morten Olav Hansen + */ +public class BaseLinkableObject implements LinkableObject +{ + /** + * As part of the marshalling process, this field can be set to indicate a link to this + * identifiable object (will be used on the web layer for navigating the REST API) + */ + private String link; + + @XmlAttribute + @JsonProperty + public String getLink() + { + return link; + } + + public void setLink( String link ) + { + this.link = 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-11-24 14:36:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseNameableObject.java 2011-12-03 10:35:41 +0000 @@ -34,7 +34,7 @@ /** * @author Bob Jolliffe */ -@XmlRootElement( name = "nameableObject" ) +@XmlRootElement( name = "nameableObject", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class BaseNameableObject extends BaseIdentifiableObject implements NameableObject === added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/Dxf2Namespace.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/Dxf2Namespace.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/Dxf2Namespace.java 2011-12-03 10:35:41 +0000 @@ -0,0 +1,12 @@ +package org.hisp.dhis.common; + +/** + * We should probably rename this class at some point, but using it for now. + * It can be refactored later on. + * + * @author Morten Olav Hansen + */ +public class Dxf2Namespace +{ + public static final String NAMESPACE = "http://dhis2.org/schema/dxf/2.0"; +} === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObject.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObject.java 2011-11-22 15:48:30 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObject.java 2011-12-03 12:53:47 +0000 @@ -31,7 +31,7 @@ */ public interface IdentifiableObject - extends ImportableObject + extends ImportableObject, LinkableObject { public abstract int getId(); === added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/LinkableObject.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/LinkableObject.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/LinkableObject.java 2011-12-03 13:36:49 +0000 @@ -0,0 +1,36 @@ +package org.hisp.dhis.common; + +/* + * 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. + */ + +/** + * @author Morten Olav Hansen + */ +public interface LinkableObject +{ + public String getLink(); +} === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/BaseIdentifiableObjectXmlAdapter.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/BaseIdentifiableObjectXmlAdapter.java 2011-11-25 14:03:14 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/BaseIdentifiableObjectXmlAdapter.java 2011-12-03 12:53:47 +0000 @@ -54,6 +54,7 @@ bio.setCode( baseIdentifiableObject.getCode() ); bio.setName( baseIdentifiableObject.getName() ); bio.setLastUpdated( baseIdentifiableObject.getLastUpdated() ); + bio.setLink( baseIdentifiableObject.getLink() ); return bio; } === modified 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-11-25 14:03:14 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/BaseNameableObjectXmlAdapter.java 2011-12-03 12:53:47 +0000 @@ -54,6 +54,7 @@ bno.setCode( baseNameableObject.getCode() ); bno.setName( baseNameableObject.getName() ); bno.setLastUpdated( baseNameableObject.getLastUpdated() ); + bno.setLink( baseNameableObject.getLink() ); bno.setShortName( baseNameableObject.getShortName() ); bno.setAlternativeName( baseNameableObject.getAlternativeName() ); === modified 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-11-23 14:00:28 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonIdentifiableObjectSerializer.java 2011-12-03 12:53:47 +0000 @@ -61,6 +61,8 @@ JsonDateSerializer jsonDateSerializer = new JsonDateSerializer(); jsonDateSerializer.serialize( value.getLastUpdated(), jgen, provider ); + jgen.writeStringField( "link", value.getLink() ); + jgen.writeEndObject(); } else { jgen.writeNull(); === modified 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-11-23 14:00:28 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonNameableObjectSerializer.java 2011-12-03 12:53:47 +0000 @@ -55,12 +55,13 @@ jgen.writeStringField( "uid", nameableObject.getUid() ); jgen.writeStringField( "name", nameableObject.getName() ); jgen.writeStringField( "code", nameableObject.getCode() ); - jgen.writeFieldName( "lastUpdated" ); JsonDateSerializer jsonDateSerializer = new JsonDateSerializer(); jsonDateSerializer.serialize( nameableObject.getLastUpdated(), jgen, provider ); + jgen.writeStringField( "link", nameableObject.getLink() ); + jgen.writeStringField( "shortName", nameableObject.getShortName() ); jgen.writeStringField( "alternativeName", nameableObject.getAlternativeName() ); jgen.writeStringField( "description", nameableObject.getDescription() ); === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/concept/Concept.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/concept/Concept.java 2011-11-24 14:36:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/concept/Concept.java 2011-12-03 10:35:41 +0000 @@ -28,6 +28,7 @@ */ import org.hisp.dhis.common.BaseIdentifiableObject; +import org.hisp.dhis.common.Dxf2Namespace; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -42,7 +43,7 @@ * * @author Dang Duy Hieu */ -@XmlRootElement( name = "concept" ) +@XmlRootElement( name = "concept", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class Concept extends BaseIdentifiableObject { === 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-11-24 14:36:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/constant/Constant.java 2011-12-03 10:35:41 +0000 @@ -28,6 +28,7 @@ */ import org.hisp.dhis.common.BaseIdentifiableObject; +import org.hisp.dhis.common.Dxf2Namespace; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -37,7 +38,7 @@ * @author Dang Duy Hieu * @version $Id Constant.java June 29, 2011$ */ -@XmlRootElement( name = "constant" ) +@XmlRootElement( name = "constant", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class Constant extends BaseIdentifiableObject { === 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-11-25 11:00:15 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2011-12-03 10:35:41 +0000 @@ -32,6 +32,7 @@ import org.codehaus.jackson.map.annotate.JsonSerialize; import org.hisp.dhis.attribute.AttributeValue; import org.hisp.dhis.common.BaseNameableObject; +import org.hisp.dhis.common.Dxf2Namespace; import org.hisp.dhis.common.adapter.*; import org.hisp.dhis.dataset.DataSet; import org.hisp.dhis.period.PeriodType; @@ -60,7 +61,7 @@ * @author Kristian Nordal * @version $Id: DataElement.java 5540 2008-08-19 10:47:07Z larshelg $ */ -@XmlRootElement( name = "dataElement" ) +@XmlRootElement( name = "dataElement", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class DataElement extends BaseNameableObject { === 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-11-23 14:00:28 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategories.java 2011-12-03 14:31:45 +0000 @@ -1,6 +1,8 @@ package org.hisp.dhis.dataelement; import org.codehaus.jackson.annotate.JsonProperty; +import org.hisp.dhis.common.BaseLinkableObject; +import org.hisp.dhis.common.Dxf2Namespace; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -12,17 +14,12 @@ /** * @author Morten Olav Hansen */ -@XmlRootElement( name = "dataElementCategories" ) +@XmlRootElement( name = "dataElementCategories", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) -public class DataElementCategories +public class DataElementCategories extends BaseLinkableObject { private List dataElementCategories = new ArrayList(); - public DataElementCategories() - { - - } - @XmlElement( name = "dataElementCategory" ) @JsonProperty( value = "dataElementCategories" ) public List getDataElementCategories() === 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-11-24 14:59:27 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java 2011-12-03 10:35:41 +0000 @@ -29,6 +29,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.JsonNameableObjectListSerializer; import org.hisp.dhis.concept.Concept; @@ -46,7 +47,7 @@ * * @author Abyot Asalefew */ -@XmlRootElement( name = "dataElementCategory" ) +@XmlRootElement( name = "dataElementCategory", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class DataElementCategory extends BaseIdentifiableObject { === 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-11-24 14:57:12 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java 2011-12-03 10:35:41 +0000 @@ -30,6 +30,7 @@ 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.JsonIdentifiableObjectSetSerializer; import org.hisp.dhis.common.adapter.JsonIdentifiableObjectListSerializer; @@ -41,7 +42,7 @@ /** * @author Abyot Aselefew */ -@XmlRootElement( name = "dataElementCategoryCombo" ) +@XmlRootElement( name = "dataElementCategoryCombo", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class DataElementCategoryCombo extends BaseIdentifiableObject === 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-11-23 14:00:28 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombos.java 2011-12-03 14:31:45 +0000 @@ -1,6 +1,8 @@ package org.hisp.dhis.dataelement; import org.codehaus.jackson.annotate.JsonProperty; +import org.hisp.dhis.common.BaseLinkableObject; +import org.hisp.dhis.common.Dxf2Namespace; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -12,17 +14,12 @@ /** * @author Morten Olav Hansen */ -@XmlRootElement( name = "dataElementCategoryCombos" ) +@XmlRootElement( name = "dataElementCategoryCombos", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) -public class DataElementCategoryCombos +public class DataElementCategoryCombos extends BaseLinkableObject { private List dataElementCategoryCombos = new ArrayList(); - public DataElementCategoryCombos() - { - - } - @XmlElement( name = "dataElementCategoryCombo" ) @JsonProperty( value = "dataElementCategoryCombos" ) public List getDataElementCategoryCombos() === 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-11-24 14:57:12 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java 2011-12-03 10:35:41 +0000 @@ -30,6 +30,7 @@ import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.map.annotate.JsonSerialize; import org.hisp.dhis.common.BaseNameableObject; +import org.hisp.dhis.common.Dxf2Namespace; import org.hisp.dhis.common.adapter.*; import javax.xml.bind.annotation.*; @@ -41,7 +42,7 @@ /** * @author Abyot Asalefew */ -@XmlRootElement( name = "dataElementCategoryOption" ) +@XmlRootElement( name = "dataElementCategoryOption", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class DataElementCategoryOption extends BaseNameableObject { === 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-11-24 14:57:12 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java 2011-12-03 10:35:41 +0000 @@ -31,6 +31,7 @@ import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.map.annotate.JsonSerialize; 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; @@ -43,7 +44,7 @@ /** * @author Abyot Aselefew */ -@XmlRootElement( name = "dataElementCategoryOptionCombo" ) +@XmlRootElement( name = "dataElementCategoryOptionCombo", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class DataElementCategoryOptionCombo extends BaseNameableObject { === 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-11-23 14:00:28 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombos.java 2011-12-03 14:31:45 +0000 @@ -1,6 +1,8 @@ package org.hisp.dhis.dataelement; import org.codehaus.jackson.annotate.JsonProperty; +import org.hisp.dhis.common.BaseLinkableObject; +import org.hisp.dhis.common.Dxf2Namespace; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -12,17 +14,12 @@ /** * @author Morten Olav Hansen */ -@XmlRootElement( name = "dataElementCategoryOptionCombos" ) +@XmlRootElement( name = "dataElementCategoryOptionCombos", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) -public class DataElementCategoryOptionCombos +public class DataElementCategoryOptionCombos extends BaseLinkableObject { private List dataElementCategoryOptionCombos = new ArrayList(); - public DataElementCategoryOptionCombos() - { - - } - @XmlElement( name = "dataElementCategoryOptionCombo" ) @JsonProperty( value = "dataElementCategoryOptionCombos" ) public List getDataElementCategoryOptionCombos() === 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-11-23 14:00:28 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptions.java 2011-12-03 14:31:45 +0000 @@ -1,6 +1,8 @@ package org.hisp.dhis.dataelement; import org.codehaus.jackson.annotate.JsonProperty; +import org.hisp.dhis.common.BaseLinkableObject; +import org.hisp.dhis.common.Dxf2Namespace; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -12,17 +14,12 @@ /** * @author Morten Olav Hansen */ -@XmlRootElement( name = "dataElementCategoryOptions" ) +@XmlRootElement( name = "dataElementCategoryOptions", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) -public class DataElementCategoryOptions +public class DataElementCategoryOptions extends BaseLinkableObject { private List dataElementCategoryOptions = new ArrayList(); - public DataElementCategoryOptions() - { - - } - @XmlElement( name = "dataElementCategoryOption" ) @JsonProperty( value = "dataElementCategoryOptions" ) public List getDataElementCategoryOptions() === 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-11-24 14:57:12 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java 2011-12-03 10:35:41 +0000 @@ -29,6 +29,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.JsonIdentifiableObjectSetSerializer; @@ -43,7 +44,7 @@ * @author Kristian Nordal * @version $Id: DataElementGroup.java 5540 2008-08-19 10:47:07Z larshelg $ */ -@XmlRootElement( name = "dataElementGroup" ) +@XmlRootElement( name = "dataElementGroup", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class DataElementGroup extends BaseIdentifiableObject { === 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-11-24 14:57:12 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java 2011-12-03 10:35:41 +0000 @@ -30,6 +30,7 @@ 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.BaseIdentifiableObjectXmlAdapter; import org.hisp.dhis.common.adapter.JsonIdentifiableObjectListSerializer; import org.hisp.dhis.dataelement.comparator.DataElementGroupNameComparator; @@ -48,7 +49,7 @@ * * @author Lars Helge Overland */ -@XmlRootElement( name = "dataElementGroupSet" ) +@XmlRootElement( name = "dataElementGroupSet", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class DataElementGroupSet extends BaseIdentifiableObject { === 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-11-23 12:21:07 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSets.java 2011-12-03 14:31:45 +0000 @@ -28,6 +28,8 @@ */ import org.codehaus.jackson.annotate.JsonProperty; +import org.hisp.dhis.common.BaseLinkableObject; +import org.hisp.dhis.common.Dxf2Namespace; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -39,17 +41,12 @@ /** * @author Morten Olav Hansen */ -@XmlRootElement( name = "dataElementGroupSets" ) +@XmlRootElement( name = "dataElementGroupSets", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) -public class DataElementGroupSets +public class DataElementGroupSets extends BaseLinkableObject { private List dataElementGroupSets = new ArrayList(); - public DataElementGroupSets() - { - - } - @XmlElement( name = "dataElementGroupSet" ) @JsonProperty( value = "dataElementGroupSets" ) public List getDataElementGroupSets() === 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-11-23 12:21:07 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroups.java 2011-12-03 14:31:45 +0000 @@ -28,6 +28,8 @@ */ import org.codehaus.jackson.annotate.JsonProperty; +import org.hisp.dhis.common.BaseLinkableObject; +import org.hisp.dhis.common.Dxf2Namespace; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -39,17 +41,12 @@ /** * @author Morten Olav Hansen */ -@XmlRootElement( name = "dataElementGroups" ) +@XmlRootElement( name = "dataElementGroups", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) -public class DataElementGroups +public class DataElementGroups extends BaseLinkableObject { private List dataElementGroups = new ArrayList(); - public DataElementGroups() - { - - } - @XmlElement( name = "dataElementGroup" ) @JsonProperty( value = "dataElementGroups" ) public List getDataElementGroups() === 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-11-25 13:25:37 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementOperand.java 2011-12-03 10:35:41 +0000 @@ -30,6 +30,7 @@ import org.apache.commons.lang.StringEscapeUtils; import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.map.annotate.JsonSerialize; +import org.hisp.dhis.common.Dxf2Namespace; import org.hisp.dhis.common.adapter.BaseNameableObjectXmlAdapter; import org.hisp.dhis.common.adapter.JsonNameableObjectSerializer; @@ -46,7 +47,7 @@ * * @author Abyot Asalefew */ -@XmlRootElement( name = "dataElementOperand" ) +@XmlRootElement( name = "dataElementOperand", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class DataElementOperand implements Serializable, Comparable === 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-11-21 12:41:53 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElements.java 2011-12-03 14:31:45 +0000 @@ -28,6 +28,8 @@ */ import org.codehaus.jackson.annotate.JsonProperty; +import org.hisp.dhis.common.BaseLinkableObject; +import org.hisp.dhis.common.Dxf2Namespace; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -39,17 +41,12 @@ /** * @author Morten Olav Hansen */ -@XmlRootElement( name = "dataElements" ) +@XmlRootElement( name = "dataElements", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) -public class DataElements +public class DataElements extends BaseLinkableObject { private List dataElements = new ArrayList(); - public DataElements() - { - - } - @XmlElement( name = "dataElement" ) @JsonProperty( value = "dataElements" ) public List getDataElements() === 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-11-24 17:50:07 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/CompleteDataSetRegistration.java 2011-12-03 10:35:41 +0000 @@ -29,6 +29,7 @@ import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.map.annotate.JsonSerialize; +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; @@ -46,7 +47,7 @@ /** * @author Lars Helge Overland */ -@XmlRootElement( name = "completeDataSetRegistration" ) +@XmlRootElement( name = "completeDataSetRegistration", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class CompleteDataSetRegistration implements ImportableObject, Serializable === 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-11-24 17:50:07 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/CompleteDataSetRegistrations.java 2011-12-03 14:31:45 +0000 @@ -1,6 +1,35 @@ package org.hisp.dhis.dataset; +/* + * 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.annotate.JsonProperty; +import org.hisp.dhis.common.BaseLinkableObject; +import org.hisp.dhis.common.Dxf2Namespace; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -12,17 +41,12 @@ /** * @author Morten Olav Hansen */ -@XmlRootElement( name = "completeDataSetRegistrations" ) +@XmlRootElement( name = "completeDataSetRegistrations", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) -public class CompleteDataSetRegistrations +public class CompleteDataSetRegistrations extends BaseLinkableObject { private List completeDataSetRegistrations = new ArrayList(); - public CompleteDataSetRegistrations() - { - - } - @XmlElement( name = "completeDataSetRegistration" ) @JsonProperty( value = "completeDataSetRegistrations" ) public List getCompleteDataSetRegistrations() === 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-02 15:18:52 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java 2011-12-03 14:31:45 +0000 @@ -1,7 +1,7 @@ package org.hisp.dhis.dataset; /* - * Copyright (c) 2004-2010, University of Oslo + * Copyright (c) 2004-2011, University of Oslo * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,6 +30,7 @@ import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.map.annotate.JsonSerialize; 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.JsonIdentifiableObjectSetSerializer; @@ -52,7 +53,7 @@ * * @author Kristian Nordal */ -@XmlRootElement( name = "dataSet" ) +@XmlRootElement( name = "dataSet", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class DataSet extends BaseNameableObject { === 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-11-24 17:03:14 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSets.java 2011-12-03 14:31:45 +0000 @@ -1,6 +1,35 @@ package org.hisp.dhis.dataset; +/* + * 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.annotate.JsonProperty; +import org.hisp.dhis.common.BaseLinkableObject; +import org.hisp.dhis.common.Dxf2Namespace; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -12,17 +41,12 @@ /** * @author Morten Olav Hansen */ -@XmlRootElement( name = "dataSets" ) +@XmlRootElement( name = "dataSets", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) -public class DataSets +public class DataSets extends BaseLinkableObject { private List dataSets = new ArrayList(); - public DataSets() - { - - } - @XmlElement( name = "dataSet" ) @JsonProperty( value = "dataSets" ) public List getDataSets() === 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-02 15:18:52 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java 2011-12-03 10:35:41 +0000 @@ -25,6 +25,7 @@ import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.map.annotate.JsonSerialize; +import org.hisp.dhis.common.Dxf2Namespace; import org.hisp.dhis.common.adapter.BaseIdentifiableObjectXmlAdapter; import org.hisp.dhis.common.adapter.JsonIdentifiableObjectListSerializer; import org.hisp.dhis.common.adapter.JsonIdentifiableObjectSetSerializer; @@ -40,7 +41,7 @@ import java.util.List; import java.util.Set; -@XmlRootElement( name = "section" ) +@XmlRootElement( name = "section", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class Section implements Serializable === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Sections.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Sections.java 2011-11-24 17:03:14 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Sections.java 2011-12-03 14:31:45 +0000 @@ -1,6 +1,35 @@ package org.hisp.dhis.dataset; +/* + * 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.annotate.JsonProperty; +import org.hisp.dhis.common.BaseLinkableObject; +import org.hisp.dhis.common.Dxf2Namespace; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -12,17 +41,12 @@ /** * @author Morten Olav Hansen */ -@XmlRootElement( name = "sections" ) +@XmlRootElement( name = "sections", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) -public class Sections +public class Sections extends BaseLinkableObject { private List
sections = new ArrayList
(); - public Sections() - { - - } - @XmlElement( name = "section" ) @JsonProperty( value = "sections" ) public List
getSections() === 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-11-25 11:00:15 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java 2011-12-03 10:35:41 +0000 @@ -31,6 +31,7 @@ import org.codehaus.jackson.map.annotate.JsonSerialize; import org.hisp.dhis.attribute.AttributeValue; import org.hisp.dhis.common.BaseNameableObject; +import org.hisp.dhis.common.Dxf2Namespace; import org.hisp.dhis.common.adapter.*; import org.hisp.dhis.dataset.DataSet; @@ -43,7 +44,7 @@ * @author Lars Helge Overland * @version $Id: Indicator.java 5540 2008-08-19 10:47:07Z larshelg $ */ -@XmlRootElement( name = "indicator" ) +@XmlRootElement( name = "indicator", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class Indicator extends BaseNameableObject { === 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-11-24 14:57:12 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java 2011-12-03 10:35:41 +0000 @@ -29,6 +29,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.JsonIdentifiableObjectSetSerializer; @@ -40,7 +41,7 @@ /** * @author Lars Helge Overland */ -@XmlRootElement( name = "indicatorGroup" ) +@XmlRootElement( name = "indicatorGroup", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class IndicatorGroup extends BaseIdentifiableObject { === 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-11-24 14:57:12 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.java 2011-12-03 10:35:41 +0000 @@ -35,6 +35,7 @@ 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.BaseIdentifiableObjectXmlAdapter; import org.hisp.dhis.common.adapter.JsonIdentifiableObjectListSerializer; import org.hisp.dhis.indicator.comparator.IndicatorGroupNameComparator; @@ -49,7 +50,7 @@ * * @author Lars Helge Overland */ -@XmlRootElement( name = "indicatorGroupSet" ) +@XmlRootElement( name = "indicatorGroupSet", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class IndicatorGroupSet extends BaseIdentifiableObject { === 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-11-23 12:21:07 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSets.java 2011-12-03 14:31:45 +0000 @@ -27,8 +27,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - import org.codehaus.jackson.annotate.JsonProperty; +import org.hisp.dhis.common.BaseLinkableObject; +import org.hisp.dhis.common.Dxf2Namespace; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -40,17 +41,12 @@ /** * @author Morten Olav Hansen */ -@XmlRootElement( name = "indicatorGroupSets" ) +@XmlRootElement( name = "indicatorGroupSets", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) -public class IndicatorGroupSets +public class IndicatorGroupSets extends BaseLinkableObject { private List indicatorGroupSets = new ArrayList(); - public IndicatorGroupSets() - { - - } - @XmlElement( name = "indicatorGroupSet" ) @JsonProperty( value = "indicatorGroupSets" ) public List getIndicatorGroupSets() === 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-11-23 12:21:07 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroups.java 2011-12-03 14:31:45 +0000 @@ -27,8 +27,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - import org.codehaus.jackson.annotate.JsonProperty; +import org.hisp.dhis.common.BaseLinkableObject; +import org.hisp.dhis.common.Dxf2Namespace; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -40,17 +41,12 @@ /** * @author Morten Olav Hansen */ -@XmlRootElement( name = "indicatorGroups" ) +@XmlRootElement( name = "indicatorGroups", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) -public class IndicatorGroups +public class IndicatorGroups extends BaseLinkableObject { private List indicatorGroups = new ArrayList(); - public IndicatorGroups() - { - - } - @XmlElement( name = "indicatorGroup" ) @JsonProperty( value = "indicatorGroups" ) public List getIndicatorGroups() === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorType.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorType.java 2011-11-25 11:00:15 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorType.java 2011-12-03 10:35:41 +0000 @@ -29,6 +29,7 @@ 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; @@ -38,7 +39,7 @@ /** * @author Lars Helge Overland */ -@XmlRootElement( name = "indicatorType" ) +@XmlRootElement( name = "indicatorType", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class IndicatorType extends BaseIdentifiableObject { === 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-11-23 12:28:39 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorTypes.java 2011-12-03 14:31:45 +0000 @@ -27,8 +27,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - import org.codehaus.jackson.annotate.JsonProperty; +import org.hisp.dhis.common.BaseLinkableObject; +import org.hisp.dhis.common.Dxf2Namespace; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -40,16 +41,12 @@ /** * @author Morten Olav Hansen */ -@XmlRootElement( name = "indicatorTypes" ) +@XmlRootElement( name = "indicatorTypes", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) -public class IndicatorTypes +public class IndicatorTypes extends BaseLinkableObject { private List indicatorTypes = new ArrayList(); - public IndicatorTypes() { - - } - @XmlElement( name = "indicatorType" ) @JsonProperty( value = "indicatorTypes" ) public List getIndicatorTypes() === 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-11-22 14:05:18 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicators.java 2011-12-03 14:31:45 +0000 @@ -29,6 +29,8 @@ import org.codehaus.jackson.annotate.JsonProperty; +import org.hisp.dhis.common.BaseLinkableObject; +import org.hisp.dhis.common.Dxf2Namespace; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -40,16 +42,12 @@ /** * @author Morten Olav Hansen */ -@XmlRootElement( name = "indicators" ) +@XmlRootElement( name = "indicators", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) -public class Indicators +public class Indicators extends BaseLinkableObject { private List indicators = new ArrayList(); - public Indicators() { - - } - @XmlElement( name = "indicator" ) @JsonProperty( value = "indicators" ) public List getIndicators() === 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-11-25 13:25:37 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2011-12-03 10:35:41 +0000 @@ -32,6 +32,7 @@ import org.codehaus.jackson.map.annotate.JsonSerialize; import org.hisp.dhis.attribute.AttributeValue; import org.hisp.dhis.common.BaseNameableObject; +import org.hisp.dhis.common.Dxf2Namespace; import org.hisp.dhis.common.adapter.*; import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataset.DataSet; @@ -47,7 +48,7 @@ /** * @author Kristian Nordal */ -@XmlRootElement( name = "organisationUnit" ) +@XmlRootElement( name = "organisationUnit", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class OrganisationUnit extends BaseNameableObject { === 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-11-25 13:25:37 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java 2011-12-03 10:35:41 +0000 @@ -29,6 +29,7 @@ import org.codehaus.jackson.map.annotate.JsonSerialize; import org.hisp.dhis.common.BaseIdentifiableObject; +import org.hisp.dhis.common.Dxf2Namespace; import org.hisp.dhis.common.adapter.BaseIdentifiableObjectXmlAdapter; import org.hisp.dhis.common.adapter.BaseNameableObjectXmlAdapter; import org.hisp.dhis.common.adapter.JsonIdentifiableObjectSerializer; @@ -42,7 +43,7 @@ /** * @author Kristian Nordal */ -@XmlRootElement( name = "organisationUnitGroup" ) +@XmlRootElement( name = "organisationUnitGroup", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class OrganisationUnitGroup extends BaseIdentifiableObject { === 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-11-25 13:25:37 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java 2011-12-03 10:35:41 +0000 @@ -30,6 +30,7 @@ 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.BaseIdentifiableObjectXmlAdapter; import org.hisp.dhis.common.adapter.JsonIdentifiableObjectSetSerializer; import org.hisp.dhis.organisationunit.comparator.OrganisationUnitGroupNameComparator; @@ -41,7 +42,7 @@ /** * @author Kristian Nordal */ -@XmlRootElement( name = "organisationUnitGroupSet" ) +@XmlRootElement( name = "organisationUnitGroupSet", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class OrganisationUnitGroupSet extends BaseIdentifiableObject { === 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-11-25 13:25:37 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSets.java 2011-12-03 14:31:45 +0000 @@ -1,6 +1,35 @@ package org.hisp.dhis.organisationunit; +/* + * 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.annotate.JsonProperty; +import org.hisp.dhis.common.BaseLinkableObject; +import org.hisp.dhis.common.Dxf2Namespace; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -12,17 +41,12 @@ /** * @author Morten Olav Hansen */ -@XmlRootElement( name = "organisationUnitGroupSets" ) +@XmlRootElement( name = "organisationUnitGroupSets", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) -public class OrganisationUnitGroupSets +public class OrganisationUnitGroupSets extends BaseLinkableObject { private List organisationUnitGroupSets = new ArrayList(); - public OrganisationUnitGroupSets() - { - - } - @XmlElement( name = "organisationUnitGroupSet" ) @JsonProperty( value = "organisationUnitGroupSets" ) public List getOrganisationUnitGroupSets() === 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-11-25 13:25:37 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroups.java 2011-12-03 14:31:45 +0000 @@ -1,6 +1,35 @@ package org.hisp.dhis.organisationunit; +/* + * 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.annotate.JsonProperty; +import org.hisp.dhis.common.BaseLinkableObject; +import org.hisp.dhis.common.Dxf2Namespace; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -12,17 +41,12 @@ /** * @author Morten Olav Hansen */ -@XmlRootElement( name = "organisationUnitGroups" ) +@XmlRootElement( name = "organisationUnitGroups", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) -public class OrganisationUnitGroups +public class OrganisationUnitGroups extends BaseLinkableObject { private List organisationUnitGroups = new ArrayList(); - public OrganisationUnitGroups() - { - - } - @XmlElement( name = "organisationUnitGroup" ) @JsonProperty( value = "organisationUnitGroups" ) public List getOrganisationUnitGroups() === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitLevel.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitLevel.java 2011-11-25 15:12:06 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitLevel.java 2011-12-03 10:35:41 +0000 @@ -29,6 +29,7 @@ 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; @@ -38,7 +39,7 @@ /** * @author Lars Helge Overland */ -@XmlRootElement( name = "organisationUnitLevel" ) +@XmlRootElement( name = "organisationUnitLevel", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class OrganisationUnitLevel extends BaseIdentifiableObject { === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitLevels.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitLevels.java 2011-11-25 15:12:06 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitLevels.java 2011-12-03 14:31:45 +0000 @@ -1,6 +1,35 @@ package org.hisp.dhis.organisationunit; +/* + * 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.annotate.JsonProperty; +import org.hisp.dhis.common.BaseLinkableObject; +import org.hisp.dhis.common.Dxf2Namespace; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -12,16 +41,12 @@ /** * @author Morten Olav Hansen */ -@XmlRootElement( name = "organisationUnitLevels" ) +@XmlRootElement( name = "organisationUnitLevels", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) -public class OrganisationUnitLevels +public class OrganisationUnitLevels extends BaseLinkableObject { private List organisationUnitLevels = new ArrayList(); - public OrganisationUnitLevels() - { - } - @XmlElement( name = "organisationUnitLevel" ) @JsonProperty( value = "organisationUnitLevels" ) public List getOrganisationUnitLevels() === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java 2011-11-25 15:12:06 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java 2011-12-03 14:31:45 +0000 @@ -1,7 +1,7 @@ package org.hisp.dhis.organisationunit; /* - * Copyright (c) 2004-2010, University of Oslo + * Copyright (c) 2004-2011, University of Oslo * All rights reserved. * * Redistribution and use in source and binary forms, with or without === 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-11-25 13:25:37 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnits.java 2011-12-03 14:31:45 +0000 @@ -1,6 +1,35 @@ package org.hisp.dhis.organisationunit; +/* + * 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.annotate.JsonProperty; +import org.hisp.dhis.common.BaseLinkableObject; +import org.hisp.dhis.common.Dxf2Namespace; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -12,17 +41,12 @@ /** * @author Morten Olav Hansen */ -@XmlRootElement( name = "organisationUnits" ) +@XmlRootElement( name = "organisationUnits", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) -public class OrganisationUnits +public class OrganisationUnits extends BaseLinkableObject { private List organisationUnits = new ArrayList(); - public OrganisationUnits() - { - - } - @XmlElement( name = "organisationUnit" ) @JsonProperty( value = "organisationUnits" ) public List getOrganisationUnits() === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java 2011-11-24 14:57:12 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java 2011-12-03 10:35:41 +0000 @@ -28,6 +28,7 @@ */ import org.hisp.dhis.common.BaseNameableObject; +import org.hisp.dhis.common.Dxf2Namespace; import org.hisp.dhis.common.Weighted; import javax.xml.bind.annotation.XmlAccessType; @@ -40,7 +41,7 @@ /** * @author Kristian Nordal */ -@XmlRootElement( name = "period" ) +@XmlRootElement( name = "period", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class Period extends BaseNameableObject implements Weighted === 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-11-25 14:53:34 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/User.java 2011-12-03 14:31:45 +0000 @@ -1,7 +1,7 @@ package org.hisp.dhis.user; /* - * Copyright (c) 2004-2010, University of Oslo + * Copyright (c) 2004-2011, University of Oslo * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,6 +30,7 @@ import org.apache.commons.collections.CollectionUtils; import org.codehaus.jackson.annotate.JsonProperty; import org.hisp.dhis.attribute.AttributeValue; +import org.hisp.dhis.common.Dxf2Namespace; import org.hisp.dhis.common.IdentifiableObjectUtils; import org.hisp.dhis.organisationunit.OrganisationUnit; @@ -46,7 +47,7 @@ * @author Nguyen Hong Duc * @version $Id: User.java 5554 2008-08-20 09:18:38Z abyot $ */ -@XmlRootElement( name = "user" ) +@XmlRootElement( name = "user", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class User implements Serializable === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/Users.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/Users.java 2011-11-25 14:53:34 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/Users.java 2011-12-03 14:31:45 +0000 @@ -1,6 +1,35 @@ package org.hisp.dhis.user; +/* + * 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.annotate.JsonProperty; +import org.hisp.dhis.common.BaseLinkableObject; +import org.hisp.dhis.common.Dxf2Namespace; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -12,17 +41,12 @@ /** * @author Morten Olav Hansen */ -@XmlRootElement( name = "users" ) +@XmlRootElement( name = "users", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) -public class Users +public class Users extends BaseLinkableObject { private List users = new ArrayList(); - public Users() - { - - } - @XmlElement( name = "user" ) @JsonProperty( value = "users" ) public List getUsers() === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRule.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRule.java 2011-11-24 14:36:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRule.java 2011-12-03 10:35:41 +0000 @@ -28,6 +28,7 @@ */ import org.hisp.dhis.common.BaseIdentifiableObject; +import org.hisp.dhis.common.Dxf2Namespace; import org.hisp.dhis.expression.Expression; import org.hisp.dhis.expression.Operator; import org.hisp.dhis.period.PeriodType; @@ -41,7 +42,7 @@ /** * @author Kristian Nordal */ -@XmlRootElement( name = "validationRule" ) +@XmlRootElement( name = "validationRule", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class ValidationRule extends BaseIdentifiableObject === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleGroup.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleGroup.java 2011-11-24 14:36:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleGroup.java 2011-12-03 10:35:41 +0000 @@ -28,6 +28,7 @@ */ import org.hisp.dhis.common.BaseIdentifiableObject; +import org.hisp.dhis.common.Dxf2Namespace; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -38,7 +39,7 @@ /** * @author Lars Helge Overland */ -@XmlRootElement( name = "validationRuleGroup" ) +@XmlRootElement( name = "validationRuleGroup", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) public class ValidationRuleGroup extends BaseIdentifiableObject === added directory 'dhis-2/dhis-dxf2' === added file 'dhis-2/dhis-dxf2/pom.xml' --- dhis-2/dhis-dxf2/pom.xml 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-dxf2/pom.xml 2011-12-03 10:15:42 +0000 @@ -0,0 +1,41 @@ + + + + + 4.0.0 + + + org.hisp.dhis + dhis + 2.6-SNAPSHOT + + + dhis-dxf2 + jar + DHIS Data Exchange + + + + org.hisp.dhis + dhis-api + + + org.codehaus.jackson + jackson-core-asl + + + org.codehaus.jackson + jackson-mapper-asl + + + org.codehaus.jackson + jackson-xc + + + javax.xml.bind + jaxb-api + + + + === added directory 'dhis-2/dhis-dxf2/src' === added directory 'dhis-2/dhis-dxf2/src/main' === added directory 'dhis-2/dhis-dxf2/src/main/java' === added directory 'dhis-2/dhis-dxf2/src/main/java/org' === added directory 'dhis-2/dhis-dxf2/src/main/java/org/hisp' === added directory 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis' === added directory 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2' === added directory 'dhis-2/dhis-dxf2/src/test' === added directory 'dhis-2/dhis-dxf2/src/test/java' === added directory 'dhis-2/dhis-dxf2/src/test/java/org' === added directory 'dhis-2/dhis-dxf2/src/test/java/org/hisp' === added directory 'dhis-2/dhis-dxf2/src/test/java/org/hisp/dhis' === added directory 'dhis-2/dhis-dxf2/src/test/java/org/hisp/dhis/dxf2' === modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/package-info.java' --- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/package-info.java 2011-02-21 10:32:35 +0000 +++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/package-info.java 2011-12-03 10:15:42 +0000 @@ -1,6 +1,7 @@ @javax.xml.bind.annotation.XmlSchema( namespace = "http://dhis2.org/schema/dxf/2.0-SNAPSHOT", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED ) + package org.hisp.dhis.importexport.dxf2.model; /* === modified file 'dhis-2/dhis-web/dhis-web-api/pom.xml' --- dhis-2/dhis-web/dhis-web-api/pom.xml 2011-12-03 10:15:00 +0000 +++ dhis-2/dhis-web/dhis-web-api/pom.xml 2011-12-03 17:24:32 +0000 @@ -18,6 +18,10 @@ + org.hisp.dhis + dhis-dxf2 + + javax.servlet servlet-api === added file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AttributeController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AttributeController.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AttributeController.java 2011-12-03 14:20:18 +0000 @@ -0,0 +1,73 @@ +package org.hisp.dhis.api.controller; + +/* + * 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.attribute.AttributeService; +import org.hisp.dhis.attribute.Attributes; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; + +/** + * @author Morten Olav Hansen + */ +@Controller +@RequestMapping( value = "/attributes" ) +public class AttributeController +{ + @Autowired + private AttributeService attributeService; + + @RequestMapping( method = RequestMethod.GET ) + public String getAttributes( Model model, HttpServletRequest request ) + { + Attributes attributes = new Attributes(); + attributes.setAttributes( new ArrayList( attributeService.getAllAttributes() ) ); + + model.addAttribute( "model", attributes ); + + return "attributes"; + } + + @RequestMapping( value = "/{uid}", method = RequestMethod.GET ) + public String getAttribute( @PathVariable( "uid" ) String uid, Model model, HttpServletRequest request ) + { + Attribute attribute = attributeService.getAttribute( uid ); + + model.addAttribute( "model", attribute ); + + return "attribute"; + } +} === 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-01 13:44:45 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartController.java 2011-12-03 18:00:10 +0000 @@ -27,6 +27,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import org.hisp.dhis.api.utils.IdentifiableObjectParams; +import org.hisp.dhis.api.utils.WebLinkPopulatorListener; import org.hisp.dhis.chart.Chart; import org.hisp.dhis.chart.ChartService; import org.hisp.dhis.chart.Charts; @@ -37,9 +39,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; /** * @author Morten Olav Hansen @@ -52,21 +53,33 @@ private ChartService chartService; @RequestMapping( method = RequestMethod.GET ) - public String getCharts( Model model ) + public String getCharts( IdentifiableObjectParams params, Model model, HttpServletRequest request ) { Charts charts = new Charts(); charts.setCharts( new ArrayList( chartService.getAllCharts() ) ); + if ( params.hasLinks() ) + { + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( charts ); + } + model.addAttribute( "model", charts ); return "charts"; } @RequestMapping( value = "/{uid}", method = RequestMethod.GET ) - public String getChart( @PathVariable( "uid" ) String uid, Model model ) + public String getChart( @PathVariable( "uid" ) String uid, IdentifiableObjectParams params, Model model, HttpServletRequest request ) { Chart chart = chartService.getChart( uid ); + if ( params.hasLinks() ) + { + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( chart ); + } + model.addAttribute( "model", chart ); return "chart"; === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/CompleteDataSetRegistrationController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/CompleteDataSetRegistrationController.java 2011-12-01 19:14:36 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/CompleteDataSetRegistrationController.java 2011-12-03 14:20:18 +0000 @@ -36,6 +36,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; /** @@ -54,7 +55,7 @@ } @RequestMapping( method = RequestMethod.GET ) - public String getCompleteDataSetRegistrations( Model model ) + public String getCompleteDataSetRegistrations( Model model, HttpServletRequest request ) { CompleteDataSetRegistrations completeDataSetRegistrations = new CompleteDataSetRegistrations(); completeDataSetRegistrations.setCompleteDataSetRegistrations( new ArrayList( completeDataSetRegistrationService.getAllCompleteDataSetRegistrations() ) ); === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementCategoryComboController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementCategoryComboController.java 2011-12-01 19:14:36 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementCategoryComboController.java 2011-12-03 18:00:10 +0000 @@ -27,6 +27,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import org.hisp.dhis.api.utils.WebLinkPopulatorListener; import org.hisp.dhis.dataelement.DataElementCategoryCombo; import org.hisp.dhis.dataelement.DataElementCategoryCombos; import org.hisp.dhis.dataelement.DataElementCategoryService; @@ -37,9 +38,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; /** * @author Morten Olav Hansen @@ -52,21 +52,27 @@ private DataElementCategoryService dataElementCategoryService; @RequestMapping( method = RequestMethod.GET ) - public String getDataElementCategoryCombos( Model model ) + public String getDataElementCategoryCombos( Model model, HttpServletRequest request ) { DataElementCategoryCombos dataElementCategoryCombos = new DataElementCategoryCombos(); dataElementCategoryCombos.setDataElementCategoryCombos( new ArrayList( dataElementCategoryService.getAllDataElementCategoryCombos() ) ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( dataElementCategoryCombos ); + model.addAttribute( "model", dataElementCategoryCombos ); return "dataElementCategoryCombos"; } @RequestMapping( value = "/{uid}", method = RequestMethod.GET ) - public String getDataElementCategoryCombo( @PathVariable( "uid" ) String uid, Model model ) + public String getDataElementCategoryCombo( @PathVariable( "uid" ) String uid, Model model, HttpServletRequest request ) { DataElementCategoryCombo dataElementCategoryCombo = dataElementCategoryService.getDataElementCategoryCombo( uid ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( dataElementCategoryCombo ); + model.addAttribute( "model", dataElementCategoryCombo ); return "dataElementCategoryCombo"; === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementCategoryController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementCategoryController.java 2011-12-01 19:14:36 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementCategoryController.java 2011-12-03 18:00:10 +0000 @@ -27,6 +27,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import org.hisp.dhis.api.utils.WebLinkPopulatorListener; import org.hisp.dhis.dataelement.DataElementCategories; import org.hisp.dhis.dataelement.DataElementCategory; import org.hisp.dhis.dataelement.DataElementCategoryService; @@ -37,6 +38,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; /** @@ -50,21 +52,27 @@ private DataElementCategoryService dataElementCategoryService; @RequestMapping( method = RequestMethod.GET ) - public String getDataElementCategories( Model model ) + public String getDataElementCategories( Model model, HttpServletRequest request ) { DataElementCategories dataElementCategories = new DataElementCategories(); dataElementCategories.setDataElementCategories( new ArrayList( dataElementCategoryService.getAllDataElementCategories() ) ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( dataElementCategories ); + model.addAttribute( "model", dataElementCategories ); return "dataElementCategories"; } @RequestMapping( value = "/{uid}", method = RequestMethod.GET ) - public String getDataElementCategory( @PathVariable( "uid" ) String uid, Model model ) + public String getDataElementCategory( @PathVariable( "uid" ) String uid, Model model, HttpServletRequest request ) { DataElementCategory dataElementCategory = dataElementCategoryService.getDataElementCategory( uid ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( dataElementCategory ); + model.addAttribute( "model", dataElementCategory ); return "dataElementCategory"; === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementCategoryOptionComboController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementCategoryOptionComboController.java 2011-12-01 19:14:36 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementCategoryOptionComboController.java 2011-12-03 18:00:10 +0000 @@ -27,6 +27,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import org.hisp.dhis.api.utils.WebLinkPopulatorListener; import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; import org.hisp.dhis.dataelement.DataElementCategoryOptionCombos; import org.hisp.dhis.dataelement.DataElementCategoryService; @@ -37,6 +38,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; /** @@ -50,21 +52,27 @@ private DataElementCategoryService dataElementCategoryService; @RequestMapping( method = RequestMethod.GET ) - public String getDataElementCategoryOptionCombos( Model model ) + public String getDataElementCategoryOptionCombos( Model model, HttpServletRequest request ) { DataElementCategoryOptionCombos dataElementCategoryOptionCombos = new DataElementCategoryOptionCombos(); dataElementCategoryOptionCombos.setDataElementCategoryOptionCombos( new ArrayList( dataElementCategoryService.getAllDataElementCategoryOptionCombos() ) ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( dataElementCategoryOptionCombos ); + model.addAttribute( "model", dataElementCategoryOptionCombos ); return "dataElementCategoryOptionCombos"; } @RequestMapping( value = "/{uid}", method = RequestMethod.GET ) - public String getDataElementCategoryCombo( @PathVariable( "uid" ) String uid, Model model ) + public String getDataElementCategoryCombo( @PathVariable( "uid" ) String uid, Model model, HttpServletRequest request ) { DataElementCategoryOptionCombo dataElementCategoryOptionCombo = dataElementCategoryService.getDataElementCategoryOptionCombo( uid ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( dataElementCategoryOptionCombo ); + model.addAttribute( "model", dataElementCategoryOptionCombo ); return "dataElementCategoryOptionCombo"; === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementCategoryOptionController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementCategoryOptionController.java 2011-12-01 19:14:36 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementCategoryOptionController.java 2011-12-03 18:00:10 +0000 @@ -27,6 +27,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import org.hisp.dhis.api.utils.WebLinkPopulatorListener; import org.hisp.dhis.dataelement.DataElementCategoryOption; import org.hisp.dhis.dataelement.DataElementCategoryOptions; import org.hisp.dhis.dataelement.DataElementCategoryService; @@ -37,6 +38,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; /** @@ -50,21 +52,27 @@ private DataElementCategoryService dataElementCategoryService; @RequestMapping( method = RequestMethod.GET ) - public String getDataElementCategoryOptions( Model model ) + public String getDataElementCategoryOptions( Model model, HttpServletRequest request ) { DataElementCategoryOptions dataElementCategoryOptions = new DataElementCategoryOptions(); dataElementCategoryOptions.setDataElementCategoryOptions( new ArrayList( dataElementCategoryService.getAllDataElementCategoryOptions() ) ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( dataElementCategoryOptions ); + model.addAttribute( "model", dataElementCategoryOptions ); return "dataElementCategoryOptions"; } @RequestMapping( value = "/{uid}", method = RequestMethod.GET ) - public String getDataElementCategoryOption( @PathVariable( "uid" ) String uid, Model model ) + public String getDataElementCategoryOption( @PathVariable( "uid" ) String uid, Model model, HttpServletRequest request ) { DataElementCategoryOption dataElementCategoryOption = dataElementCategoryService.getDataElementCategoryOption( uid ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( dataElementCategoryOption ); + model.addAttribute( "model", dataElementCategoryOption ); return "dataElementCategoryOption"; === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementController.java 2011-12-02 17:22:15 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementController.java 2011-12-03 18:00:10 +0000 @@ -27,6 +27,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import org.hisp.dhis.api.utils.WebLinkPopulatorListener; import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataelement.DataElementService; import org.hisp.dhis.dataelement.DataElements; @@ -39,6 +40,7 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseStatus; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.InputStream; import java.util.ArrayList; @@ -54,11 +56,14 @@ private DataElementService dataElementService; @RequestMapping( method = RequestMethod.GET ) - public String getDataElements( Model model ) + public String getDataElements( Model model, HttpServletRequest request ) { DataElements dataElements = new DataElements(); dataElements.setDataElements( new ArrayList( dataElementService.getAllActiveDataElements() ) ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( dataElements ); + model.addAttribute( "model", dataElements ); return "dataElements"; @@ -83,10 +88,13 @@ } @RequestMapping( value = "/{uid}", method = RequestMethod.GET ) - public String getDataElement( @PathVariable( "uid" ) String uid, Model model ) + public String getDataElement( @PathVariable( "uid" ) String uid, Model model, HttpServletRequest request ) { DataElement dataElement = dataElementService.getDataElement( uid ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( dataElement ); + model.addAttribute( "model", dataElement ); return "dataElement"; === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementGroupController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementGroupController.java 2011-12-01 19:14:36 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementGroupController.java 2011-12-03 18:00:10 +0000 @@ -27,6 +27,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import org.hisp.dhis.api.utils.WebLinkPopulatorListener; import org.hisp.dhis.dataelement.DataElementGroup; import org.hisp.dhis.dataelement.DataElementGroups; import org.hisp.dhis.dataelement.DataElementService; @@ -37,6 +38,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; @Controller @@ -47,21 +49,27 @@ private DataElementService dataElementService; @RequestMapping( method = RequestMethod.GET ) - public String getDataElementGroups( Model model ) + public String getDataElementGroups( Model model, HttpServletRequest request ) { DataElementGroups dataElementGroups = new DataElementGroups(); dataElementGroups.setDataElementGroups( new ArrayList( dataElementService.getAllDataElementGroups() ) ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( dataElementGroups ); + model.addAttribute( "model", dataElementGroups ); return "dataElementGroups"; } @RequestMapping( value = "/{uid}", method = RequestMethod.GET ) - public String getDataElementGroup( @PathVariable( "uid" ) String uid, Model model ) + public String getDataElementGroup( @PathVariable( "uid" ) String uid, Model model, HttpServletRequest request ) { DataElementGroup dataElementGroup = dataElementService.getDataElementGroup( uid ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( dataElementGroup ); + model.addAttribute( "model", dataElementGroup ); return "dataElementGroup"; === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementGroupSetController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementGroupSetController.java 2011-12-01 19:14:36 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementGroupSetController.java 2011-12-03 18:00:10 +0000 @@ -27,6 +27,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import org.hisp.dhis.api.utils.WebLinkPopulatorListener; import org.hisp.dhis.dataelement.DataElementGroupSet; import org.hisp.dhis.dataelement.DataElementGroupSets; import org.hisp.dhis.dataelement.DataElementService; @@ -37,6 +38,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; /** @@ -50,21 +52,27 @@ private DataElementService dataElementService; @RequestMapping( method = RequestMethod.GET ) - public String getDataElementGroupSets( Model model ) + public String getDataElementGroupSets( Model model, HttpServletRequest request ) { DataElementGroupSets dataElementGroupSets = new DataElementGroupSets(); dataElementGroupSets.setDataElementGroupSets( new ArrayList( dataElementService.getAllDataElementGroupSets() ) ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( dataElementGroupSets ); + model.addAttribute( "model", dataElementGroupSets ); return "dataElementGroupSets"; } @RequestMapping( value = "/{uid}", method = RequestMethod.GET ) - public String getDataElementGroupSet( @PathVariable( "uid" ) String uid, Model model ) + public String getDataElementGroupSet( @PathVariable( "uid" ) String uid, Model model, HttpServletRequest request ) { DataElementGroupSet dataElementGroupSet = dataElementService.getDataElementGroupSet( uid ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( dataElementGroupSet ); + model.addAttribute( "model", dataElementGroupSet ); return "dataElementGroupSet"; === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataSetController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataSetController.java 2011-12-02 15:18:52 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataSetController.java 2011-12-03 18:00:10 +0000 @@ -27,6 +27,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import org.hisp.dhis.api.utils.WebLinkPopulatorListener; import org.hisp.dhis.dataset.DataSet; import org.hisp.dhis.dataset.DataSetService; import org.hisp.dhis.dataset.DataSets; @@ -37,6 +38,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; /** @@ -50,21 +52,27 @@ private DataSetService dataSetService; @RequestMapping( method = RequestMethod.GET ) - public String getDataSets( Model model ) + public String getDataSets( Model model, HttpServletRequest request ) { DataSets dataSets = new DataSets(); dataSets.setDataSets( new ArrayList( dataSetService.getAllDataSets() ) ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( dataSets ); + model.addAttribute( "model", dataSets ); return "dataSets"; } @RequestMapping( value = "/{uid}", method = RequestMethod.GET ) - public String getDataSet( @PathVariable( "uid" ) String uid, Model model ) + public String getDataSet( @PathVariable( "uid" ) String uid, Model model, HttpServletRequest request ) { DataSet dataSet = dataSetService.getDataSet( uid ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( dataSet ); + model.addAttribute( "model", dataSet ); return "dataSet"; === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataValueSetController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataValueSetController.java 2011-12-02 14:53:08 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataValueSetController.java 2011-12-03 14:11:49 +0000 @@ -24,7 +24,6 @@ @RequestMapping( value = "/dataValueSets" ) public class DataValueSetController { - private static final Log log = LogFactory.getLog( DataValueSetController.class ); @Autowired @@ -34,9 +33,7 @@ private UserService userService; @RequestMapping( method = RequestMethod.POST ) - public void storeDataValueSet( @RequestBody - DataValueSet dataValueSet, @RequestParam( required = false ) - String phoneNumber ) + public void storeDataValueSet( @RequestBody DataValueSet dataValueSet, @RequestParam( required = false ) String phoneNumber ) { if ( phoneNumber != null && !phoneNumber.trim().isEmpty() ) { @@ -66,7 +63,7 @@ /** * Find orgunit corresponding to the registered phone number. - * + * * @param phoneNumber The phone number to look up * @return the organisation unit uid * @throws IllegalArgumentException if === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorController.java 2011-12-01 19:14:36 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorController.java 2011-12-03 18:00:10 +0000 @@ -27,6 +27,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import org.hisp.dhis.api.utils.WebLinkPopulatorListener; import org.hisp.dhis.indicator.Indicator; import org.hisp.dhis.indicator.IndicatorService; import org.hisp.dhis.indicator.Indicators; @@ -37,6 +38,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; /** @@ -50,21 +52,27 @@ private IndicatorService indicatorService; @RequestMapping( method = RequestMethod.GET ) - public String getIndicators( Model model ) + public String getIndicators( Model model, HttpServletRequest request ) { Indicators indicators = new Indicators(); indicators.setIndicators( new ArrayList( indicatorService.getAllIndicators() ) ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( indicators ); + model.addAttribute( "model", indicators ); return "indicators"; } @RequestMapping( value = "/{uid}", method = RequestMethod.GET ) - public String getIndicator( @PathVariable( "uid" ) String uid, Model model ) + public String getIndicator( @PathVariable( "uid" ) String uid, Model model, HttpServletRequest request ) { Indicator indicator = indicatorService.getIndicator( uid ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( indicator ); + model.addAttribute( "model", indicator ); return "indicator"; === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorGroupController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorGroupController.java 2011-12-01 19:14:36 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorGroupController.java 2011-12-03 18:00:10 +0000 @@ -27,6 +27,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import org.hisp.dhis.api.utils.WebLinkPopulatorListener; import org.hisp.dhis.indicator.IndicatorGroup; import org.hisp.dhis.indicator.IndicatorGroups; import org.hisp.dhis.indicator.IndicatorService; @@ -37,6 +38,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; /** @@ -50,21 +52,27 @@ private IndicatorService indicatorService; @RequestMapping( method = RequestMethod.GET ) - public String getIndicatorGroups( Model model ) + public String getIndicatorGroups( Model model, HttpServletRequest request ) { IndicatorGroups indicatorGroups = new IndicatorGroups(); indicatorGroups.setIndicatorGroups( new ArrayList( indicatorService.getAllIndicatorGroups() ) ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( indicatorGroups ); + model.addAttribute( "model", indicatorGroups ); return "indicatorGroups"; } @RequestMapping( value = "/{uid}", method = RequestMethod.GET ) - public String getIndicatorGroup( @PathVariable( "uid" ) String uid, Model model ) + public String getIndicatorGroup( @PathVariable( "uid" ) String uid, Model model, HttpServletRequest request ) { IndicatorGroup indicatorGroup = indicatorService.getIndicatorGroup( uid ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( indicatorGroup ); + model.addAttribute( "model", indicatorGroup ); return "indicatorGroup"; === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorGroupSetController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorGroupSetController.java 2011-12-01 19:14:36 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorGroupSetController.java 2011-12-03 18:00:10 +0000 @@ -27,6 +27,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import org.hisp.dhis.api.utils.WebLinkPopulatorListener; import org.hisp.dhis.indicator.IndicatorGroupSet; import org.hisp.dhis.indicator.IndicatorGroupSets; import org.hisp.dhis.indicator.IndicatorService; @@ -37,6 +38,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; /** @@ -50,21 +52,27 @@ private IndicatorService indicatorService; @RequestMapping( method = RequestMethod.GET ) - public String getIndicatorGroupSets( Model model ) + public String getIndicatorGroupSets( Model model, HttpServletRequest request ) { IndicatorGroupSets indicatorGroupSets = new IndicatorGroupSets(); indicatorGroupSets.setIndicatorGroupSets( new ArrayList( indicatorService.getAllIndicatorGroupSets() ) ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( indicatorGroupSets ); + model.addAttribute( "model", indicatorGroupSets ); return "indicatorGroupSets"; } @RequestMapping( value = "/{uid}", method = RequestMethod.GET ) - public String getIndicatorGroupSet( @PathVariable( "uid" ) String uid, Model model ) + public String getIndicatorGroupSet( @PathVariable( "uid" ) String uid, Model model, HttpServletRequest request ) { IndicatorGroupSet indicatorGroupSet = indicatorService.getIndicatorGroupSet( uid ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( indicatorGroupSet ); + model.addAttribute( "model", indicatorGroupSet ); return "indicatorGroupSet"; === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorTypeController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorTypeController.java 2011-12-01 19:14:36 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorTypeController.java 2011-12-03 18:00:10 +0000 @@ -27,6 +27,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import org.hisp.dhis.api.utils.WebLinkPopulatorListener; import org.hisp.dhis.indicator.IndicatorService; import org.hisp.dhis.indicator.IndicatorType; import org.hisp.dhis.indicator.IndicatorTypes; @@ -37,6 +38,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; /** @@ -50,21 +52,27 @@ private IndicatorService indicatorService; @RequestMapping( method = RequestMethod.GET ) - public String getIndicatorTypes( Model model ) + public String getIndicatorTypes( Model model, HttpServletRequest request ) { IndicatorTypes indicatorTypes = new IndicatorTypes(); indicatorTypes.setIndicatorTypes( new ArrayList( indicatorService.getAllIndicatorTypes() ) ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( indicatorTypes ); + model.addAttribute( "model", indicatorTypes ); return "indicatorTypes"; } @RequestMapping( value = "/{uid}", method = RequestMethod.GET ) - public String getIndicator( @PathVariable( "uid" ) String uid, Model model ) + public String getIndicator( @PathVariable( "uid" ) String uid, Model model, HttpServletRequest request ) { IndicatorType indicatorType = indicatorService.getIndicatorType( uid ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( indicatorType ); + model.addAttribute( "model", indicatorType ); return "indicatorType"; === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitController.java 2011-12-01 19:14:36 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitController.java 2011-12-03 18:00:10 +0000 @@ -1,5 +1,6 @@ package org.hisp.dhis.api.controller; +import org.hisp.dhis.api.utils.WebLinkPopulatorListener; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.organisationunit.OrganisationUnitService; import org.hisp.dhis.organisationunit.OrganisationUnits; @@ -10,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; /** @@ -23,21 +25,27 @@ private OrganisationUnitService organisationUnitService; @RequestMapping( method = RequestMethod.GET ) - public String getOrganisationUnits( Model model ) + public String getOrganisationUnits( Model model, HttpServletRequest request ) { OrganisationUnits organisationUnits = new OrganisationUnits(); organisationUnits.setOrganisationUnits( new ArrayList( organisationUnitService.getAllOrganisationUnits() ) ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( organisationUnits ); + model.addAttribute( "model", organisationUnits ); return "organisationUnits"; } @RequestMapping( value = "/{uid}", method = RequestMethod.GET ) - public String getOrganisationUnit( @PathVariable( "uid" ) String uid, Model model ) + public String getOrganisationUnit( @PathVariable( "uid" ) String uid, Model model, HttpServletRequest request ) { OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( uid ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( organisationUnit ); + model.addAttribute( "model", organisationUnit ); return "organisationUnit"; === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitGroupController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitGroupController.java 2011-12-01 19:14:36 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitGroupController.java 2011-12-03 18:00:10 +0000 @@ -1,5 +1,6 @@ package org.hisp.dhis.api.controller; +import org.hisp.dhis.api.utils.WebLinkPopulatorListener; import org.hisp.dhis.organisationunit.OrganisationUnitGroup; import org.hisp.dhis.organisationunit.OrganisationUnitGroupService; import org.hisp.dhis.organisationunit.OrganisationUnitGroups; @@ -10,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; /** @@ -23,21 +25,28 @@ private OrganisationUnitGroupService organisationUnitGroupService; @RequestMapping( method = RequestMethod.GET ) - public String getOrganisationUnits( Model model ) + public String getOrganisationUnits( Model model, HttpServletRequest request ) { OrganisationUnitGroups organisationUnitGroups = new OrganisationUnitGroups(); organisationUnitGroups.setOrganisationUnitGroups( new ArrayList( organisationUnitGroupService.getAllOrganisationUnitGroups() ) ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( organisationUnitGroups ); + model.addAttribute( "model", organisationUnitGroups ); return "organisationUnitGroups"; } @RequestMapping( value = "/{uid}", method = RequestMethod.GET ) - public String getOrganisationUnit( @PathVariable( "uid" ) String uid, Model model ) + public String getOrganisationUnit( @PathVariable( "uid" ) String uid, Model model, HttpServletRequest request ) { OrganisationUnitGroup organisationUnitGroup = organisationUnitGroupService.getOrganisationUnitGroup( uid ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( organisationUnitGroup ); + + model.addAttribute( "model", organisationUnitGroup ); return "organisationUnitGroup"; === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitGroupSetController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitGroupSetController.java 2011-12-01 19:14:36 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitGroupSetController.java 2011-12-03 18:00:10 +0000 @@ -27,6 +27,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import org.hisp.dhis.api.utils.WebLinkPopulatorListener; import org.hisp.dhis.organisationunit.OrganisationUnitGroupService; import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet; import org.hisp.dhis.organisationunit.OrganisationUnitGroupSets; @@ -37,6 +38,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; /** @@ -50,21 +52,27 @@ private OrganisationUnitGroupService organisationUnitGroupService; @RequestMapping( method = RequestMethod.GET ) - public String getOrganisationUnitGroupSets( Model model ) + public String getOrganisationUnitGroupSets( Model model, HttpServletRequest request ) { OrganisationUnitGroupSets organisationUnitGroupSets = new OrganisationUnitGroupSets(); organisationUnitGroupSets.setOrganisationUnitGroupSets( new ArrayList( organisationUnitGroupService.getAllOrganisationUnitGroupSets() ) ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( organisationUnitGroupSets ); + model.addAttribute( "model", organisationUnitGroupSets ); return "organisationUnitGroupSets"; } @RequestMapping( value = "/{uid}", method = RequestMethod.GET ) - public String getOrganisationUnitGroupSet( @PathVariable( "uid" ) String uid, Model model ) + public String getOrganisationUnitGroupSet( @PathVariable( "uid" ) String uid, Model model, HttpServletRequest request ) { OrganisationUnitGroupSet organisationUnitGroupSet = organisationUnitGroupService.getOrganisationUnitGroupSet( uid ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( organisationUnitGroupSet ); + model.addAttribute( "model", organisationUnitGroupSet ); return "organisationUnitGroupSet"; === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitLevelController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitLevelController.java 2011-12-01 19:14:36 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitLevelController.java 2011-12-03 18:00:10 +0000 @@ -27,6 +27,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import org.hisp.dhis.api.utils.WebLinkPopulatorListener; import org.hisp.dhis.organisationunit.OrganisationUnitLevel; import org.hisp.dhis.organisationunit.OrganisationUnitLevels; import org.hisp.dhis.organisationunit.OrganisationUnitService; @@ -37,6 +38,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; /** @@ -50,21 +52,27 @@ private OrganisationUnitService organisationUnitService; @RequestMapping( method = RequestMethod.GET ) - public String getOrganisationUnitLevels( Model model ) + public String getOrganisationUnitLevels( Model model, HttpServletRequest request ) { OrganisationUnitLevels organisationUnitLevels = new OrganisationUnitLevels(); organisationUnitLevels.setOrganisationUnitLevels( new ArrayList( organisationUnitService.getOrganisationUnitLevels() ) ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( organisationUnitLevels ); + model.addAttribute( "model", organisationUnitLevels ); return "organisationUnitLevels"; } @RequestMapping( value = "/{uid}", method = RequestMethod.GET ) - public String getOrganisationUnit( @PathVariable( "uid" ) String uid, Model model ) + public String getOrganisationUnit( @PathVariable( "uid" ) String uid, Model model, HttpServletRequest request ) { OrganisationUnitLevel organisationUnitLevel = organisationUnitService.getOrganisationUnitLevel( uid ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( organisationUnitLevel ); + model.addAttribute( "model", organisationUnitLevel ); return "organisationUnitLevel"; === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/UserController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/UserController.java 2011-12-01 19:14:36 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/UserController.java 2011-12-03 18:00:10 +0000 @@ -27,6 +27,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import org.hisp.dhis.api.utils.WebLinkPopulatorListener; import org.hisp.dhis.user.User; import org.hisp.dhis.user.UserService; import org.hisp.dhis.user.Users; @@ -37,6 +38,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; /** @@ -50,21 +52,27 @@ private UserService userService; @RequestMapping( method = RequestMethod.GET ) - public String getUsers( Model model ) + public String getUsers( Model model, HttpServletRequest request ) { Users users = new Users(); users.setUsers( new ArrayList( userService.getAllUsers() ) ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( users ); + model.addAttribute( "model", users ); return "users"; } @RequestMapping( value = "/{id}", method = RequestMethod.GET ) - public String getUser( @PathVariable( "id" ) Integer id, Model model ) + public String getUser( @PathVariable( "id" ) Integer id, Model model, HttpServletRequest request ) { User user = userService.getUser( id ); + WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request ); + listener.beforeMarshal( user ); + model.addAttribute( "model", user ); return "user"; === removed directory 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/listener' === removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/listener/IdentifiableObjectListener.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/listener/IdentifiableObjectListener.java 2011-11-16 08:23:17 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/listener/IdentifiableObjectListener.java 1970-01-01 00:00:00 +0000 @@ -1,42 +0,0 @@ -package org.hisp.dhis.api.listener; - -import javax.servlet.http.HttpServletRequest; -import javax.xml.bind.Marshaller; - -public class IdentifiableObjectListener extends Marshaller.Listener { - private HttpServletRequest request; - -/* public IdentifiableObjectListener(HttpServletRequest request) { - this.request = request; - } - - @Override - public void beforeMarshal(Object source) { - if (source instanceof XCharts) { - XCharts charts = (XCharts) source; - - for (XChart chart : charts.getCharts()) { - addHref(chart, request); - } - } else if (source instanceof XChart) { - XChart chart = (XChart) source; - addHref(chart, request); - } - } - - public void addHref(XIdentifiableObject identifiableObject, HttpServletRequest request) { - String path = request.getRequestURL().toString(); - path = StringUtils.stripFilenameExtension(path); - - while (path.lastIndexOf("/") == path.length() - 1) { - path = path.substring(0, path.length() - 1); - } - - identifiableObject.setHref(path + "/" + identifiableObject.getId()); - } - - @Override - public void afterMarshal(Object source) { - } -*/ -} === added directory 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils' === added file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/IdentifiableObjectParams.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/IdentifiableObjectParams.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/IdentifiableObjectParams.java 2011-12-03 18:00:10 +0000 @@ -0,0 +1,46 @@ +package org.hisp.dhis.api.utils; + +/* + * 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. + */ + +/** + * @author Morten Olav Hansen + */ +public class IdentifiableObjectParams +{ + private boolean links = true; + + public boolean hasLinks() + { + return links; + } + + public void setLinks( boolean links ) + { + this.links = links; + } +} === added file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulatorListener.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulatorListener.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulatorListener.java 2011-12-03 18:00:10 +0000 @@ -0,0 +1,661 @@ +package org.hisp.dhis.api.utils; + +/* + * 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.attribute.Attributes; +import org.hisp.dhis.chart.Chart; +import org.hisp.dhis.chart.Charts; +import org.hisp.dhis.common.BaseIdentifiableObject; +import org.hisp.dhis.dataelement.*; +import org.hisp.dhis.dataset.CompleteDataSetRegistration; +import org.hisp.dhis.dataset.CompleteDataSetRegistrations; +import org.hisp.dhis.dataset.DataSet; +import org.hisp.dhis.dataset.DataSets; +import org.hisp.dhis.indicator.*; +import org.hisp.dhis.organisationunit.*; +import org.hisp.dhis.user.User; +import org.hisp.dhis.user.Users; + +import javax.servlet.http.HttpServletRequest; +import javax.xml.bind.Marshaller; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +/** + * @author Morten Olav Hansen + */ +public class WebLinkPopulatorListener extends Marshaller.Listener +{ + private HttpServletRequest request; + + private static Map resourcePaths = new HashMap(); + + private String rootPath = null; + + static + { + resourcePaths.put( Attributes.class, "attributes" ); + resourcePaths.put( Attribute.class, "attributes" ); + + resourcePaths.put( Charts.class, "charts" ); + resourcePaths.put( Chart.class, "charts" ); + + resourcePaths.put( CompleteDataSetRegistrations.class, "completeDataSetRegistrations" ); + resourcePaths.put( CompleteDataSetRegistration.class, "completeDataSetRegistrations" ); + + resourcePaths.put( Indicators.class, "indicators" ); + resourcePaths.put( Indicator.class, "indicators" ); + resourcePaths.put( IndicatorGroups.class, "indicatorGroups" ); + resourcePaths.put( IndicatorGroup.class, "indicatorGroups" ); + resourcePaths.put( IndicatorGroupSets.class, "indicatorGroupSets" ); + resourcePaths.put( IndicatorGroupSet.class, "indicatorGroupSets" ); + resourcePaths.put( IndicatorTypes.class, "indicatorTypes" ); + resourcePaths.put( IndicatorType.class, "indicatorTypes" ); + + resourcePaths.put( DataElements.class, "dataElements" ); + resourcePaths.put( DataElement.class, "dataElements" ); + resourcePaths.put( DataElementGroups.class, "dataElementGroups" ); + resourcePaths.put( DataElementGroup.class, "dataElementGroups" ); + resourcePaths.put( DataElementGroupSets.class, "dataElementGroupSets" ); + resourcePaths.put( DataElementGroupSet.class, "dataElementGroupSets" ); + + resourcePaths.put( DataElementCategories.class, "dataElementCategories" ); + resourcePaths.put( DataElementCategory.class, "dataElementCategories" ); + resourcePaths.put( DataElementCategoryCombos.class, "dataElementCategoryCombos" ); + resourcePaths.put( DataElementCategoryCombo.class, "dataElementCategoryCombos" ); + resourcePaths.put( DataElementCategoryOptions.class, "dataElementCategoryOptions" ); + resourcePaths.put( DataElementCategoryOption.class, "dataElementCategoryOptions" ); + resourcePaths.put( DataElementCategoryOptionCombos.class, "dataElementCategoryOptionCombos" ); + resourcePaths.put( DataElementCategoryOptionCombo.class, "dataElementCategoryOptionCombos" ); + + resourcePaths.put( OrganisationUnits.class, "organisationUnits" ); + resourcePaths.put( OrganisationUnit.class, "organisationUnits" ); + resourcePaths.put( OrganisationUnitGroups.class, "organisationUnitGroups" ); + resourcePaths.put( OrganisationUnitGroup.class, "organisationUnitGroups" ); + resourcePaths.put( OrganisationUnitGroupSets.class, "organisationUnitGroupSets" ); + resourcePaths.put( OrganisationUnitGroupSet.class, "organisationUnitGroupSets" ); + + resourcePaths.put( DataSets.class, "dataSets" ); + resourcePaths.put( DataSet.class, "dataSets" ); + + resourcePaths.put( Users.class, "users" ); + resourcePaths.put( User.class, "users" ); + } + + public WebLinkPopulatorListener( HttpServletRequest request ) + { + this.request = request; + } + + @Override + public void beforeMarshal( Object source ) + { + if ( source instanceof Charts ) + { + populateCharts( (Charts) source, true ); + } + else if ( source instanceof Chart ) + { + populateChart( (Chart) source, true ); + } + else if ( source instanceof DataSets ) + { + populateDataSets( (DataSets) source, true ); + } + else if ( source instanceof DataSet ) + { + populateDataSet( (DataSet) source, true ); + } + else if ( source instanceof OrganisationUnits ) + { + populateOrganisationUnits( (OrganisationUnits) source, true ); + } + else if ( source instanceof OrganisationUnit ) + { + populateOrganisationUnit( (OrganisationUnit) source, true ); + } + else if ( source instanceof OrganisationUnitGroups ) + { + populateOrganisationUnitGroups( (OrganisationUnitGroups) source, true ); + } + else if ( source instanceof OrganisationUnitGroup ) + { + populateOrganisationUnitGroup( (OrganisationUnitGroup) source, true ); + } + else if ( source instanceof OrganisationUnitGroupSets ) + { + populateOrganisationUnitGroupSets( (OrganisationUnitGroupSets) source, true ); + } + else if ( source instanceof OrganisationUnitGroupSet ) + { + populateOrganisationUnitGroupSet( (OrganisationUnitGroupSet) source, true ); + } + else if ( source instanceof Indicators ) + { + populateIndicators( (Indicators) source, true ); + } + else if ( source instanceof Indicator ) + { + populateIndicator( (Indicator) source, true ); + } + else if ( source instanceof IndicatorGroups ) + { + populateIndicatorGroups( (IndicatorGroups) source, true ); + } + else if ( source instanceof IndicatorGroup ) + { + populateIndicatorGroup( (IndicatorGroup) source, true ); + } + else if ( source instanceof IndicatorGroupSets ) + { + populateIndicatorGroupSets( (IndicatorGroupSets) source, true ); + } + else if ( source instanceof IndicatorGroupSet ) + { + populateIndicatorGroupSet( (IndicatorGroupSet) source, true ); + } + else if ( source instanceof DataElements ) + { + populateDataElements( (DataElements) source, true ); + } + else if ( source instanceof DataElement ) + { + populateDataElement( (DataElement) source, true ); + } + else if ( source instanceof DataElementGroups ) + { + populateDataElementGroups( (DataElementGroups) source, true ); + } + else if ( source instanceof DataElementGroup ) + { + populateDataElementGroup( (DataElementGroup) source, true ); + } + else if ( source instanceof DataElementGroupSets ) + { + populateDataElementGroupSets( (DataElementGroupSets) source, true ); + } + else if ( source instanceof DataElementGroupSet ) + { + populateDataElementGroupSet( (DataElementGroupSet) source, true ); + } + else if ( source instanceof DataElementCategories ) + { + populateDataElementCategories( (DataElementCategories) source, true ); + } + else if ( source instanceof DataElementCategory ) + { + populateDataElementCategory( (DataElementCategory) source, true ); + } + else if ( source instanceof DataElementCategoryCombos ) + { + populateDataElementCategoryCombos( (DataElementCategoryCombos) source, true ); + } + else if ( source instanceof DataElementCategoryCombo ) + { + populateDataElementCategoryCombo( (DataElementCategoryCombo) source, true ); + } + else if ( source instanceof DataElementCategoryOptions ) + { + populateDataElementCategoryOptions( (DataElementCategoryOptions) source, true ); + } + else if ( source instanceof DataElementCategoryOption ) + { + populateDataElementCategoryOption( (DataElementCategoryOption) source, true ); + } + else if ( source instanceof DataElementCategoryOptionCombos ) + { + populateDataElementCategoryOptionCombos( (DataElementCategoryOptionCombos) source, true ); + } + else if ( source instanceof DataElementCategoryOptionCombo ) + { + populateDataElementCategoryOptionCombo( (DataElementCategoryOptionCombo) source, true ); + } + } + + private void populateDataElementCategories( DataElementCategories dataElementCategories, boolean root ) + { + dataElementCategories.setLink( getBasePath( DataElementCategories.class ) ); + + if ( root ) + { + for ( DataElementCategory dataElementCategory : dataElementCategories.getDataElementCategories() ) + { + populateDataElementCategory( dataElementCategory, false ); + } + } + } + + private void populateDataElementCategory( DataElementCategory dataElementCategory, boolean root ) + { + dataElementCategory.setLink( getPathWithUid( dataElementCategory ) ); + + if ( root ) + { + handleIdentifiableObjectCollection( dataElementCategory.getCategoryOptions() ); + } + } + + private void populateDataElementCategoryCombos( DataElementCategoryCombos dataElementCategoryCombos, boolean root ) + { + dataElementCategoryCombos.setLink( getBasePath( DataElementCategoryCombos.class ) ); + + if ( root ) + { + for ( DataElementCategoryCombo dataElementCategoryCombo : dataElementCategoryCombos.getDataElementCategoryCombos() ) + { + populateDataElementCategoryCombo( dataElementCategoryCombo, false ); + } + } + } + + private void populateDataElementCategoryCombo( DataElementCategoryCombo dataElementCategoryCombo, boolean root ) + { + dataElementCategoryCombo.setLink( getPathWithUid( dataElementCategoryCombo ) ); + + if ( root ) + { + handleIdentifiableObjectCollection( dataElementCategoryCombo.getOptionCombos() ); + handleIdentifiableObjectCollection( dataElementCategoryCombo.getCategories() ); + } + } + + private void populateDataElementCategoryOptions( DataElementCategoryOptions dataElementCategoryOptions, boolean root ) + { + dataElementCategoryOptions.setLink( getBasePath( DataElementCategoryOptions.class ) ); + + if ( root ) + { + for ( DataElementCategoryOption dataElementCategoryOption : dataElementCategoryOptions.getDataElementCategoryOptions() ) + { + populateDataElementCategoryOption( dataElementCategoryOption, false ); + } + } + } + + private void populateDataElementCategoryOption( DataElementCategoryOption dataElementCategoryOption, boolean root ) + { + dataElementCategoryOption.setLink( getPathWithUid( dataElementCategoryOption ) ); + + if ( root ) + { + handleIdentifiableObjectCollection( dataElementCategoryOption.getCategoryOptionCombos() ); + populateIdentifiableObject( dataElementCategoryOption.getCategory() ); + } + } + + private void populateDataElementCategoryOptionCombos( DataElementCategoryOptionCombos dataElementCategoryOptionCombos, boolean root ) + { + dataElementCategoryOptionCombos.setLink( getBasePath( DataElementCategoryOptionCombos.class ) ); + + if ( root ) + { + for ( DataElementCategoryOptionCombo dataElementCategoryOptionCombo : dataElementCategoryOptionCombos.getDataElementCategoryOptionCombos() ) + { + populateDataElementCategoryOptionCombo( dataElementCategoryOptionCombo, false ); + } + } + } + + private void populateDataElementCategoryOptionCombo( DataElementCategoryOptionCombo dataElementCategoryOptionCombo, boolean root ) + { + dataElementCategoryOptionCombo.setLink( getPathWithUid( dataElementCategoryOptionCombo ) ); + + if ( root ) + { + handleIdentifiableObjectCollection( dataElementCategoryOptionCombo.getCategoryOptions() ); + populateIdentifiableObject( dataElementCategoryOptionCombo.getCategoryCombo() ); + } + } + + private void populateDataElements( DataElements dataElements, boolean root ) + { + dataElements.setLink( getBasePath( DataElements.class ) ); + + if ( root ) + { + for ( DataElement dataElement : dataElements.getDataElements() ) + { + populateDataElement( dataElement, false ); + } + } + } + + private void populateDataElement( DataElement dataElement, boolean root ) + { + dataElement.setLink( getPathWithUid( dataElement ) ); + + if ( root ) + { + handleIdentifiableObjectCollection( dataElement.getGroups() ); + handleIdentifiableObjectCollection( dataElement.getDataSets() ); + populateIdentifiableObject( dataElement.getCategoryCombo() ); + } + } + + private void populateDataElementGroups( DataElementGroups dataElementGroups, boolean root ) + { + dataElementGroups.setLink( getBasePath( DataElementGroups.class ) ); + + if ( root ) + { + for ( DataElementGroup dataElementGroup : dataElementGroups.getDataElementGroups() ) + { + populateDataElementGroup( dataElementGroup, false ); + } + } + } + + private void populateDataElementGroup( DataElementGroup dataElementGroup, boolean root ) + { + dataElementGroup.setLink( getPathWithUid( dataElementGroup ) ); + + if ( root ) + { + handleIdentifiableObjectCollection( dataElementGroup.getMembers() ); + populateIdentifiableObject( dataElementGroup.getGroupSet() ); + } + } + + private void populateDataElementGroupSets( DataElementGroupSets dataElementGroupSets, boolean root ) + { + dataElementGroupSets.setLink( getBasePath( DataElementGroupSets.class ) ); + + if ( root ) + { + for ( DataElementGroupSet dataElementGroupSet : dataElementGroupSets.getDataElementGroupSets() ) + { + populateDataElementGroupSet( dataElementGroupSet, false ); + } + } + } + + private void populateDataElementGroupSet( DataElementGroupSet dataElementGroupSet, boolean root ) + { + dataElementGroupSet.setLink( getPathWithUid( dataElementGroupSet ) ); + + if ( root ) + { + handleIdentifiableObjectCollection( dataElementGroupSet.getMembers() ); + } + } + + private void populateIndicators( Indicators indicators, boolean root ) + { + indicators.setLink( getBasePath( Indicators.class ) ); + + for ( Indicator indicator : indicators.getIndicators() ) + { + populateIndicator( indicator, false ); + } + } + + private void populateIndicator( Indicator indicator, boolean root ) + { + indicator.setLink( getPathWithUid( indicator ) ); + + if ( root ) + { + handleIdentifiableObjectCollection( indicator.getGroups() ); + handleIdentifiableObjectCollection( indicator.getDataSets() ); + } + } + + private void populateIndicatorGroups( IndicatorGroups indicatorGroups, boolean root ) + { + indicatorGroups.setLink( getBasePath( IndicatorGroups.class ) ); + + for ( IndicatorGroup indicatorGroup : indicatorGroups.getIndicatorGroups() ) + { + populateIndicatorGroup( indicatorGroup, false ); + } + } + + private void populateIndicatorGroup( IndicatorGroup indicatorGroup, boolean root ) + { + indicatorGroup.setLink( getPathWithUid( indicatorGroup ) ); + + if ( root ) + { + handleIdentifiableObjectCollection( indicatorGroup.getMembers() ); + populateIdentifiableObject( indicatorGroup.getGroupSet() ); + } + } + + private void populateIndicatorGroupSets( IndicatorGroupSets indicatorGroupSets, boolean root ) + { + indicatorGroupSets.setLink( getBasePath( IndicatorGroupSets.class ) ); + + for ( IndicatorGroupSet indicatorGroupSet : indicatorGroupSets.getIndicatorGroupSets() ) + { + populateIndicatorGroupSet( indicatorGroupSet, false ); + } + } + + private void populateIndicatorGroupSet( IndicatorGroupSet indicatorGroupSet, boolean root ) + { + indicatorGroupSet.setLink( getPathWithUid( indicatorGroupSet ) ); + + if ( root ) + { + handleIdentifiableObjectCollection( indicatorGroupSet.getMembers() ); + } + } + + private void populateOrganisationUnitGroups( OrganisationUnitGroups organisationUnitGroups, boolean root ) + { + organisationUnitGroups.setLink( getBasePath( OrganisationUnitGroups.class ) ); + + if ( root ) + { + for ( OrganisationUnitGroup organisationUnitGroup : organisationUnitGroups.getOrganisationUnitGroups() ) + { + populateOrganisationUnitGroup( organisationUnitGroup, false ); + } + } + } + + private void populateOrganisationUnitGroup( OrganisationUnitGroup organisationUnitGroup, boolean root ) + { + organisationUnitGroup.setLink( getPathWithUid( organisationUnitGroup ) ); + + if ( root ) + { + handleIdentifiableObjectCollection( organisationUnitGroup.getMembers() ); + populateIdentifiableObject( organisationUnitGroup.getGroupSet() ); + } + } + + private void populateOrganisationUnitGroupSets( OrganisationUnitGroupSets organisationUnitGroupSets, boolean root ) + { + organisationUnitGroupSets.setLink( getBasePath( OrganisationUnitGroupSets.class ) ); + + if ( root ) + { + for ( OrganisationUnitGroupSet organisationUnitGroupSet : organisationUnitGroupSets.getOrganisationUnitGroupSets() ) + { + populateOrganisationUnitGroupSet( organisationUnitGroupSet, false ); + } + } + } + + private void populateOrganisationUnitGroupSet( OrganisationUnitGroupSet organisationUnitGroupSet, boolean root ) + { + organisationUnitGroupSet.setLink( getPathWithUid( organisationUnitGroupSet ) ); + + if ( root ) + { + handleIdentifiableObjectCollection( organisationUnitGroupSet.getOrganisationUnitGroups() ); + } + } + + private void populateOrganisationUnits( OrganisationUnits organisationUnits, boolean root ) + { + organisationUnits.setLink( getBasePath( OrganisationUnits.class ) ); + + if ( root ) + { + for ( OrganisationUnit organisationUnit : organisationUnits.getOrganisationUnits() ) + { + populateOrganisationUnit( organisationUnit, false ); + } + } + } + + private void populateOrganisationUnit( OrganisationUnit organisationUnit, boolean root ) + { + organisationUnit.setLink( getPathWithUid( organisationUnit ) ); + + if ( root ) + { + populateIdentifiableObject( organisationUnit.getParent() ); + handleIdentifiableObjectCollection( organisationUnit.getDataSets() ); + handleIdentifiableObjectCollection( organisationUnit.getGroups() ); + } + } + + private void populateDataSets( DataSets dataSets, boolean root ) + { + dataSets.setLink( getBasePath( DataSets.class ) ); + + if ( root ) + { + for ( DataSet dataSet : dataSets.getDataSets() ) + { + populateDataSet( dataSet, false ); + } + } + } + + private void populateDataSet( DataSet dataSet, boolean root ) + { + dataSet.setLink( getPathWithUid( dataSet ) ); + + if ( root ) + { + handleIdentifiableObjectCollection( dataSet.getDataElements() ); + handleIdentifiableObjectCollection( dataSet.getIndicators() ); + handleIdentifiableObjectCollection( dataSet.getSources() ); + } + } + + private void populateCharts( Charts charts, boolean root ) + { + charts.setLink( getBasePath( Chart.class ) ); + + if ( root ) + { + for ( Chart chart : charts.getCharts() ) + { + populateChart( chart, false ); + } + } + } + + private void populateChart( Chart chart, boolean root ) + { + chart.setLink( getPathWithUid( chart ) ); + + if ( root ) + { + handleIdentifiableObjectCollection( chart.getIndicators() ); + handleIdentifiableObjectCollection( chart.getDataElements() ); + handleIdentifiableObjectCollection( chart.getOrganisationUnits() ); + handleIdentifiableObjectCollection( chart.getAllOrganisationUnits() ); + handleIdentifiableObjectCollection( chart.getDataSets() ); + handleIdentifiableObjectCollection( chart.getPeriods() ); + handleIdentifiableObjectCollection( chart.getAllPeriods() ); + } + } + + public void handleIdentifiableObjectCollection( Collection identifiableObjects ) + { + for ( BaseIdentifiableObject baseIdentifiableObject : identifiableObjects ) + { + populateIdentifiableObject( baseIdentifiableObject ); + } + } + + private void populateIdentifiableObject( BaseIdentifiableObject baseIdentifiableObject ) + { + baseIdentifiableObject.setLink( getPathWithUid( baseIdentifiableObject ) ); + } + + private String getPathWithUid( BaseIdentifiableObject baseIdentifiableObject ) + { + return getBasePath( baseIdentifiableObject.getClass() ) + "/" + baseIdentifiableObject.getUid(); + } + + private String getBasePath( Class clazz ) + { + if ( rootPath == null ) + { + StringBuffer buffer = new StringBuffer(); + buffer.append( request.getScheme() ); + + buffer.append( "://" + request.getServerName() ); + + if ( request.getServerPort() != 80 || request.getServerPort() != 443 ) + { + buffer.append( ":" + request.getServerPort() ); + } + + buffer.append( request.getServletPath() ); + + rootPath = buffer.toString(); + } + + String resourcePath = resourcePaths.get( clazz ); + + // in some cases, the class is a dynamic subclass (usually subclassed with javaassist), so + // we need to fetch the superClass instead. + if ( resourcePath == null ) + { + resourcePath = resourcePaths.get( clazz.getSuperclass() ); + } + + return rootPath + "/" + resourcePath; + } + + +/* + private String getCalculatedBasePath() + { + String path = request.getRequestURL().toString(); + path = StringUtils.stripFilenameExtension( path ); + + while ( path.lastIndexOf( "/" ) == path.length() - 1 ) + { + path = path.substring( 0, path.length() - 1 ); + } + + return path; + } +*/ +} === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/ClassPathUriResolver.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/ClassPathUriResolver.java 2011-12-02 14:01:09 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/ClassPathUriResolver.java 2011-12-03 14:35:34 +0000 @@ -1,5 +1,32 @@ package org.hisp.dhis.api.view; +/* + * 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.springframework.core.io.ClassPathResource; import javax.xml.transform.Source; === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/ExtendedMappingJacksonView.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/ExtendedMappingJacksonView.java 2011-11-21 14:58:04 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/ExtendedMappingJacksonView.java 2011-12-03 14:35:34 +0000 @@ -1,5 +1,32 @@ package org.hisp.dhis.api.view; +/* + * 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.JsonEncoding; import org.codehaus.jackson.JsonFactory; import org.codehaus.jackson.JsonGenerator; === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/Jaxb2View.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/Jaxb2View.java 2011-11-30 12:12:57 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/Jaxb2View.java 2011-12-03 14:35:34 +0000 @@ -1,5 +1,32 @@ package org.hisp.dhis.api.view; +/* + * 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.springframework.web.servlet.view.AbstractView; import javax.servlet.http.HttpServletRequest; === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/TransformCache.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/TransformCache.java 2011-12-02 14:01:09 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/TransformCache.java 2011-12-03 14:35:34 +0000 @@ -1,11 +1,7 @@ package org.hisp.dhis.api.view; - -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; - /* - * Copyright (c) 2004-2005, University of Oslo + * Copyright (c) 2004-2011, University of Oslo * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -15,7 +11,7 @@ * * 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 nor the names of its contributors may + * * 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. * @@ -30,8 +26,11 @@ * (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 javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; + /** - * * @author bobj * @version created 02-Dec-2011 */ === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/ViewUtils.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/ViewUtils.java 2011-11-28 17:34:49 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/ViewUtils.java 2011-12-03 14:35:34 +0000 @@ -1,8 +1,34 @@ package org.hisp.dhis.api.view; +/* + * 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.springframework.validation.BindingResult; -import java.lang.annotation.Annotation; import java.util.HashMap; import java.util.Map; === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/XslFoPdfView.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/XslFoPdfView.java 2011-12-02 15:28:37 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/XslFoPdfView.java 2011-12-03 14:35:34 +0000 @@ -1,5 +1,32 @@ package org.hisp.dhis.api.view; +/* + * 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.apache.fop.apps.Fop; import org.apache.fop.apps.FopFactory; import org.apache.xmlgraphics.util.MimeConstants; @@ -10,7 +37,9 @@ import javax.xml.bind.JAXBContext; import javax.xml.bind.Marshaller; import javax.xml.bind.util.JAXBSource; -import javax.xml.transform.*; +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; import javax.xml.transform.sax.SAXResult; import java.util.Map; === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/XsltHtmlView.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/XsltHtmlView.java 2011-12-02 15:28:37 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/XsltHtmlView.java 2011-12-03 14:35:34 +0000 @@ -1,5 +1,32 @@ package org.hisp.dhis.api.view; +/* + * 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.springframework.web.servlet.view.AbstractUrlBasedView; import javax.servlet.http.HttpServletRequest; @@ -19,7 +46,7 @@ public class XsltHtmlView extends AbstractUrlBasedView { public static final String HTML_CONTENT_TYPE = "text/html"; - + public XsltHtmlView() { setContentType( HTML_CONTENT_TYPE ); === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/identifiable-row.xsl' --- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/identifiable-row.xsl 2011-12-02 20:35:16 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/identifiable-row.xsl 2011-12-02 22:03:43 +0000 @@ -45,5 +45,55 @@ + + + + /api/organisationUnits + + + + + + + + + + html + + + + + + + + xml + + + + + + + + json + + + + + + + + jsonp + + + + + + + + pdf + + + + === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/organisationUnit.xsl' --- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/organisationUnit.xsl 2011-12-02 20:35:16 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/organisationUnit.xsl 2011-12-02 22:03:43 +0000 @@ -64,7 +64,7 @@

Parent OrganisationUnit

- +
=== modified file 'dhis-2/pom.xml' --- dhis-2/pom.xml 2011-12-03 10:15:00 +0000 +++ dhis-2/pom.xml 2011-12-03 17:24:32 +0000 @@ -1,3 +1,5 @@ + + 4.0.0 @@ -23,6 +25,7 @@ dhis-api dhis-services + dhis-dxf2 dhis-support @@ -175,6 +178,11 @@ org.hisp.dhis + dhis-dxf2 + ${project.version} + + + org.hisp.dhis dhis-service-i18n ${project.version}