=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2013-02-13 03:57:52 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2013-02-13 06:42:49 +0000 @@ -197,7 +197,7 @@ @JsonProperty( value = "organisationUnits" ) @JsonSerialize( contentAs = BaseIdentifiableObject.class ) - @JsonView( { DetailedView.class } ) + @JsonView( { DetailedView.class, ExportView.class } ) @JacksonXmlElementWrapper( localName = "organisationUnits", namespace = DxfNamespaces.DXF_2_0 ) @JacksonXmlProperty( localName = "organisationUnit", namespace = DxfNamespaces.DXF_2_0 ) public Set getOrganisationUnits() @@ -205,20 +205,23 @@ return organisationUnits; } + @JsonProperty( value = "programInstances" ) + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlElementWrapper( localName = "programInstances", namespace = DxfNamespaces.DXF_2_0 ) + @JacksonXmlProperty( localName = "programInstance", namespace = DxfNamespaces.DXF_2_0 ) + public Set getProgramInstances() + { + return programInstances; + } + public void setProgramInstances( Set programInstances ) { this.programInstances = programInstances; } - // TODO expose as xml/json - public Set getProgramInstances() - { - return programInstances; - } - @JsonProperty( value = "programStages" ) @JsonSerialize( contentAs = BaseIdentifiableObject.class ) - @JsonView( { DetailedView.class } ) + @JsonView( { DetailedView.class, ExportView.class } ) @JacksonXmlElementWrapper( localName = "programStages", namespace = DxfNamespaces.DXF_2_0 ) @JacksonXmlProperty( localName = "programStage", namespace = DxfNamespaces.DXF_2_0 ) public Set getProgramStages() @@ -283,7 +286,7 @@ @JsonProperty( value = "identifierTypes" ) @JsonSerialize( contentAs = BaseIdentifiableObject.class ) - @JsonView( { DetailedView.class } ) + @JsonView( { DetailedView.class, ExportView.class } ) @JacksonXmlElementWrapper( localName = "identifierTypes", namespace = DxfNamespaces.DXF_2_0 ) @JacksonXmlProperty( localName = "identifierType", namespace = DxfNamespaces.DXF_2_0 ) public List getPatientIdentifierTypes() @@ -298,7 +301,7 @@ @JsonProperty( value = "attributes" ) @JsonSerialize( contentAs = BaseIdentifiableObject.class ) - @JsonView( { DetailedView.class } ) + @JsonView( { DetailedView.class, ExportView.class } ) @JacksonXmlElementWrapper( localName = "attributes", namespace = DxfNamespaces.DXF_2_0 ) @JacksonXmlProperty( localName = "attribute", namespace = DxfNamespaces.DXF_2_0 ) public List getPatientAttributes() === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstance.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstance.java 2013-02-13 03:57:52 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstance.java 2013-02-13 06:42:49 +0000 @@ -26,8 +26,15 @@ */ package org.hisp.dhis.program; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonView; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import org.hisp.dhis.common.BaseIdentifiableObject; import org.hisp.dhis.common.DxfNamespaces; +import org.hisp.dhis.common.view.DetailedView; +import org.hisp.dhis.common.view.ExportView; import org.hisp.dhis.patient.Patient; import java.io.Serializable; @@ -193,6 +200,9 @@ /** * @return the dateOfIncident */ + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Date getDateOfIncident() { return dateOfIncident; @@ -209,6 +219,9 @@ /** * @return the enrollmentDate */ + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Date getEnrollmentDate() { return enrollmentDate; @@ -225,6 +238,9 @@ /** * @return the endDate */ + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Date getEndDate() { return endDate; @@ -241,6 +257,9 @@ /** * @return the completed */ + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public boolean isCompleted() { return completed; @@ -273,6 +292,10 @@ /** * @return the program */ + @JsonProperty + @JsonSerialize( as = BaseIdentifiableObject.class ) + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Program getProgram() { return program; === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationCriteria.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationCriteria.java 2013-02-13 03:57:52 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationCriteria.java 2013-02-13 06:42:49 +0000 @@ -27,14 +27,19 @@ package org.hisp.dhis.validation; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonView; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import org.hisp.dhis.common.DxfNamespaces; +import org.hisp.dhis.common.view.DetailedView; +import org.hisp.dhis.common.view.ExportView; /** * @author Lars Helge Overland * @version $Id$ */ -@JacksonXmlRootElement( localName = "validationCriteria", namespace = DxfNamespaces.DXF_2_0 ) +@JacksonXmlRootElement(localName = "validationCriteria", namespace = DxfNamespaces.DXF_2_0) public class ValidationCriteria { public static final int OPERATOR_LESS_THAN = -1; @@ -104,6 +109,14 @@ return id; } + public void setId( int id ) + { + this.id = id; + } + + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public String getName() { return name; @@ -114,11 +127,9 @@ this.name = name; } - public void setId( int id ) - { - this.id = id; - } - + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public String getDescription() { return description; @@ -129,6 +140,9 @@ this.description = description; } + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public String getProperty() { return property; @@ -139,6 +153,9 @@ this.property = property; } + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public int getOperator() { return operator; @@ -149,6 +166,9 @@ this.operator = operator; } + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Object getValue() { return value;