=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramExpression.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramExpression.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramExpression.java 2014-05-23 14:58:07 +0000 @@ -28,29 +28,35 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +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; + import java.io.Serializable; /** * @author Chau Thu Tran - * - * @version ProgramExpression.java 2:48:32 PM Nov 8, 2012 $ */ +@JacksonXmlRootElement( localName = "programExpression", namespace = DxfNamespaces.DXF_2_0 ) public class ProgramExpression implements Serializable { - private static final long serialVersionUID = -2807997671779497354L; + private static final long serialVersionUID = -2807997671779497354L; public static final String SEPARATOR_ID = "\\."; public static String OBJECT_PROGRAM_STAGE_DATAELEMENT = "DE"; public static String OBJECT_PROGRAM_STAGE = "PS"; public static final String SEPARATOR_OBJECT = ":"; - public static final String DUE_DATE = "DUE_DATE"; + public static final String DUE_DATE = "DUE_DATE"; public static final String REPORT_DATE = "REPORT_DATE"; - public static final String RANGE_IN_DUE_DATE = "RANGE_IN_DUE_DATE"; + public static final String RANGE_IN_DUE_DATE = "RANGE_IN_DUE_DATE"; public static final String NOT_NULL_VALUE_IN_EXPRESSION = "NOT-NULL-VALUE"; - private int id; private String expression; @@ -80,8 +86,8 @@ { final int prime = 31; int result = 1; - result = prime * result + ( ( description == null ) ? 0 : description.hashCode() ); - result = prime * result + ( ( expression == null ) ? 0 : expression.hashCode() ); + result = prime * result + ((description == null) ? 0 : description.hashCode()); + result = prime * result + ((expression == null) ? 0 : expression.hashCode()); return result; } @@ -92,19 +98,19 @@ { return true; } - + if ( object == null ) { return false; } - + if ( getClass() != object.getClass() ) { return false; } - + final ProgramExpression other = (ProgramExpression) object; - + if ( description == null ) { if ( other.description != null ) @@ -116,7 +122,7 @@ { return false; } - + if ( expression == null ) { if ( other.expression != null ) @@ -128,7 +134,7 @@ { return false; } - + return true; } @@ -146,6 +152,9 @@ this.id = id; } + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public String getExpression() { return expression; @@ -156,6 +165,9 @@ this.expression = expression; } + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public String getDescription() { return description; @@ -165,5 +177,4 @@ { this.description = description; } - } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java 2014-05-23 14:58:07 +0000 @@ -28,21 +28,30 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +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.BaseNameableObject; +import org.hisp.dhis.common.DxfNamespaces; +import org.hisp.dhis.common.view.DetailedView; +import org.hisp.dhis.common.view.ExportView; /** * @author Chau Thu Tran - * @version $ ProgramIndicator.java Apr 16, 2013 1:00:15 PM $ */ +@JacksonXmlRootElement( localName = "programIndicator", namespace = DxfNamespaces.DXF_2_0 ) public class ProgramIndicator extends BaseNameableObject { private static final long serialVersionUID = 7920320128945484331L; public static String OBJECT_PROGRAM_STAGE_DATAELEMENT = "DE"; - + public static String SEPARATOR_OBJECT = ":"; - + public static final String SEPARATOR_ID = "\\."; public static final String VALUE_TYPE_DATE = "date"; @@ -53,8 +62,8 @@ public static final String CURRENT_DATE = "current_date"; public static final String regExp = "\\[" + OBJECT_PROGRAM_STAGE_DATAELEMENT + SEPARATOR_OBJECT + "([a-zA-Z0-9\\- ]+[" - + SEPARATOR_ID + "[0-9]*]*)" + "\\]"; - + + SEPARATOR_ID + "[0-9]*]*)" + "\\]"; + private String valueType; private String expression; @@ -69,11 +78,12 @@ public ProgramIndicator() { - + setAutoFields(); } public ProgramIndicator( String name, String description, String valueType, String expression ) { + this(); this.name = name; this.description = description; this.valueType = valueType; @@ -84,6 +94,9 @@ // Getters && Setters // ------------------------------------------------------------------------- + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public String getValueType() { return valueType; @@ -94,6 +107,9 @@ this.valueType = valueType; } + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public String getExpression() { return expression; @@ -104,6 +120,9 @@ this.expression = expression; } + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public String getRootDate() { return rootDate; @@ -114,6 +133,10 @@ this.rootDate = rootDate; } + @JsonProperty + @JsonSerialize( as = BaseIdentifiableObject.class ) + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Program getProgram() { return program; @@ -123,5 +146,4 @@ { this.program = program; } - } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstance.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstance.java 2014-04-04 21:45:55 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstance.java 2014-05-23 14:58:07 +0000 @@ -42,10 +42,6 @@ /** * @author Abyot Asalefew */ -/** - * @author abyot - * - */ public class ProgramStageInstance extends BaseIdentifiableObject { === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramTrackedEntityAttribute.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramTrackedEntityAttribute.java 2014-03-20 22:27:27 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramTrackedEntityAttribute.java 2014-05-23 14:58:07 +0000 @@ -136,7 +136,7 @@ } @JsonProperty - @JsonView( { DetailedView.class } ) + @JsonView( { DetailedView.class, ExportView.class } ) @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Boolean isMandatory() { === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidation.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidation.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidation.java 2014-05-23 14:58:07 +0000 @@ -28,13 +28,21 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +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.expression.Operator; /** * @author Chau Thu Tran - * @version $ ProgramValidation.java Apr 28, 2011 10:27:29 AM $ */ +@JacksonXmlRootElement( localName = "programValidation", namespace = DxfNamespaces.DXF_2_0 ) public class ProgramValidation extends BaseIdentifiableObject { @@ -63,7 +71,7 @@ // ------------------------------------------------------------------------- // Fields // ------------------------------------------------------------------------- - + private ProgramExpression leftSide; private Operator operator; @@ -99,9 +107,9 @@ { final int prime = 31; int result = 1; - result = prime * result + ( ( leftSide == null ) ? 0 : leftSide.hashCode() ); - result = prime * result + ( ( program == null ) ? 0 : program.hashCode() ); - result = prime * result + ( ( rightSide == null ) ? 0 : rightSide.hashCode() ); + result = prime * result + ((leftSide == null) ? 0 : leftSide.hashCode()); + result = prime * result + ((program == null) ? 0 : program.hashCode()); + result = prime * result + ((rightSide == null) ? 0 : rightSide.hashCode()); return result; } @@ -167,7 +175,10 @@ // ------------------------------------------------------------------------- // Getters && Setters // ------------------------------------------------------------------------- - + + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public ProgramExpression getLeftSide() { return leftSide; @@ -178,6 +189,9 @@ this.leftSide = leftSide; } + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public ProgramExpression getRightSide() { return rightSide; @@ -188,6 +202,10 @@ this.rightSide = rightSide; } + @JsonProperty + @JsonSerialize( as = BaseIdentifiableObject.class ) + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Program getProgram() { return program; @@ -198,6 +216,9 @@ this.program = program; } + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Operator getOperator() { return operator; === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidationResult.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidationResult.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidationResult.java 2014-05-23 14:58:07 +0000 @@ -28,9 +28,20 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +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; + /** * @author Chau Thu Tran */ +@JacksonXmlRootElement( localName = "programValidationResult", namespace = DxfNamespaces.DXF_2_0 ) public class ProgramValidationResult { private ProgramStageInstance programStageInstance; @@ -80,19 +91,19 @@ { return true; } - + if ( object == null ) { return false; } - + if ( getClass() != object.getClass() ) { return false; } - + final ProgramValidationResult other = (ProgramValidationResult) object; - + if ( programStageInstance == null ) { if ( other.programStageInstance != null ) @@ -104,7 +115,7 @@ { return false; } - + if ( programValidation == null ) { if ( other.programValidation != null ) @@ -116,7 +127,7 @@ { return false; } - + return true; } @@ -124,6 +135,10 @@ // Setters && Getters // ------------------------------------------------------------------------- + @JsonProperty + @JsonSerialize( as = BaseIdentifiableObject.class ) + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public ProgramStageInstance getProgramStageInstance() { return programStageInstance; @@ -134,6 +149,10 @@ this.programStageInstance = programStageInstance; } + @JsonProperty + @JsonSerialize( as = BaseIdentifiableObject.class ) + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public ProgramValidation getProgramValidation() { return programValidation; @@ -144,6 +163,9 @@ this.programValidation = programValidation; } + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public String getLeftsideValue() { return leftsideValue; @@ -154,6 +176,9 @@ this.leftsideValue = leftsideValue; } + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public String getRightsideValue() { return rightsideValue; === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/SchedulingProgramObject.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/SchedulingProgramObject.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/SchedulingProgramObject.java 2014-05-23 14:58:07 +0000 @@ -28,11 +28,18 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +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 Chau Thu Tran - * - * @version SchedulingProgramObject.java 4:45:18 PM Sep 10, 2012 $ */ +@JacksonXmlRootElement( localName = "schedulingProgramObject", namespace = DxfNamespaces.DXF_2_0 ) public class SchedulingProgramObject { private String phoneNumber; @@ -63,6 +70,9 @@ // Getters and setters // ------------------------------------------------------------------------- + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public String getPhoneNumber() { return phoneNumber; @@ -73,6 +83,9 @@ this.phoneNumber = phoneNumber; } + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Integer getProgramStageInstanceId() { return programStageInstanceId; @@ -83,6 +96,9 @@ this.programStageInstanceId = programStageInstanceId; } + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public String getMessage() { return message; @@ -93,6 +109,9 @@ this.message = message; } + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Integer getProgramInstanceId() { return programInstanceId; === removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/TabularEventColumn.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/TabularEventColumn.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/TabularEventColumn.java 1970-01-01 00:00:00 +0000 @@ -1,172 +0,0 @@ -package org.hisp.dhis.program; - -/* - * Copyright (c) 2004-2014, 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 Chau Thu Tran - * - * @version $ TabularEventColumn.java Nov 22, 2013 1:13:39 PM $ - */ -public class TabularEventColumn -{ - public static String PREFIX_DATA_ELEMENT = "de"; - - public static String PREFIX_NUMBER_DATA_ELEMENT = "numberDe"; - - private String prefix; - - private String identifier; - - private boolean hidden; - - private String query; - - private String operator; - - private String name; - - private boolean dateType; - - // ------------------------------------------------------------------------- - // Constructor - // ------------------------------------------------------------------------- - - public TabularEventColumn() - { - } - - public TabularEventColumn( String prefix, String identifier, String name, boolean hidden, String operator, - String query ) - { - this.prefix = prefix; - this.identifier = identifier; - this.name = name; - this.hidden = hidden; - this.query = query; - this.operator = operator; - } - - // ------------------------------------------------------------------------- - // Logic - // ------------------------------------------------------------------------- - - public boolean hasQuery() - { - return (operator != null && !operator.isEmpty()) || (query != null && !query.isEmpty()); - } - - public Integer getIdentifierAsInt() - { - return identifier != null ? Integer.parseInt( identifier ) : null; - } - - public boolean isDataElement() - { - return PREFIX_DATA_ELEMENT.equals( prefix ) || PREFIX_NUMBER_DATA_ELEMENT.equals( prefix ); - } - - public boolean isNumberDataElement() - { - return PREFIX_NUMBER_DATA_ELEMENT.equals( prefix ); - } - - // ------------------------------------------------------------------------- - // Get methods - // ------------------------------------------------------------------------- - - public String getPrefix() - { - return prefix; - } - - public void setPrefix( String prefix ) - { - this.prefix = prefix; - } - - public String getIdentifier() - { - return identifier; - } - - public void setIdentifier( String identifier ) - { - this.identifier = identifier; - } - - public boolean isHidden() - { - return hidden; - } - - public void setHidden( boolean hidden ) - { - this.hidden = hidden; - } - - public String getQuery() - { - return query; - } - - public void setQuery( String query ) - { - this.query = query; - } - - public String getName() - { - return name; - } - - public void setName( String name ) - { - this.name = name; - } - - public boolean isDateType() - { - return dateType; - } - - public void setDateType( boolean dateType ) - { - this.dateType = dateType; - } - - public String getOperator() - { - return operator; - } - - public void setOperator( String operator ) - { - this.operator = operator; - } -} === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntity.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntity.java 2014-03-30 17:33:23 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntity.java 2014-05-23 14:58:07 +0000 @@ -28,15 +28,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import org.hisp.dhis.common.BaseNameableObject; import org.hisp.dhis.common.DxfNamespaces; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - /** * @author Chau Thu Tran */ -@JacksonXmlRootElement( localName = "trackedEntity", namespace = DxfNamespaces.DXF_2_0 ) +@JacksonXmlRootElement(localName = "trackedEntity", namespace = DxfNamespaces.DXF_2_0) public class TrackedEntity extends BaseNameableObject { @@ -48,10 +47,12 @@ public TrackedEntity() { + setAutoFields(); } - + public TrackedEntity( String name, String description ) { + this(); this.name = name; this.description = description; } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java 2014-05-17 12:04:42 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java 2014-05-23 14:58:07 +0000 @@ -28,6 +28,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +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.BaseDimensionalObject; import org.hisp.dhis.common.BaseIdentifiableObject; import org.hisp.dhis.common.DxfNamespaces; @@ -37,12 +42,6 @@ import org.hisp.dhis.common.view.WithoutOrganisationUnitsView; import org.hisp.dhis.option.OptionSet; -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; - /** * @author Abyot Asalefew */ @@ -112,7 +111,7 @@ setAutoFields(); } - public TrackedEntityAttribute( String name, String description, String valueType, + public TrackedEntityAttribute( String name, String description, String valueType, Boolean inherit, Boolean displayOnVisitSchedule ) { this.name = name; @@ -141,7 +140,7 @@ // ------------------------------------------------------------------------- @JsonProperty - @JsonView( { DetailedView.class } ) + @JsonView( { DetailedView.class, ExportView.class } ) @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Boolean getInherit() { @@ -152,9 +151,9 @@ { this.inherit = inherit; } - + @JsonProperty - @JsonView( { DetailedView.class } ) + @JsonView( { DetailedView.class, ExportView.class } ) @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public String getDescription() { @@ -195,7 +194,7 @@ } @JsonProperty - @JsonView( { DetailedView.class } ) + @JsonView( { DetailedView.class, ExportView.class } ) @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public String getExpression() { @@ -208,7 +207,7 @@ } @JsonProperty - @JsonView( { DetailedView.class } ) + @JsonView( { DetailedView.class, ExportView.class } ) @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Boolean getDisplayOnVisitSchedule() { @@ -221,7 +220,7 @@ } @JsonProperty - @JsonView( { DetailedView.class } ) + @JsonView( { DetailedView.class, ExportView.class } ) @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Integer getSortOrderInVisitSchedule() { @@ -234,7 +233,7 @@ } @JsonProperty - @JsonView( { DetailedView.class } ) + @JsonView( { DetailedView.class, ExportView.class } ) @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Boolean getDisplayInListNoProgram() { @@ -247,7 +246,7 @@ } @JsonProperty - @JsonView( { DetailedView.class } ) + @JsonView( { DetailedView.class, ExportView.class } ) @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Integer getSortOrderInListNoProgram() { @@ -260,7 +259,7 @@ } @JsonProperty - @JsonView( { DetailedView.class } ) + @JsonView( { DetailedView.class, ExportView.class } ) @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Boolean isUnique() { @@ -273,7 +272,7 @@ } @JsonProperty - @JsonView( { DetailedView.class } ) + @JsonView( { DetailedView.class, ExportView.class } ) @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Boolean getOrgunitScope() { @@ -286,7 +285,7 @@ } @JsonProperty - @JsonView( { DetailedView.class } ) + @JsonView( { DetailedView.class, ExportView.class } ) @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Boolean getProgramScope() { @@ -299,6 +298,7 @@ } @JsonProperty + @JsonSerialize( as = BaseIdentifiableObject.class ) @JsonView( { DetailedView.class, ExportView.class } ) @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public OptionSet getOptionSet() @@ -314,7 +314,7 @@ // ------------------------------------------------------------------------- // Static methods // ------------------------------------------------------------------------- - + @Override public void mergeWith( IdentifiableObject other ) { === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentitycomment/TrackedEntityComment.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentitycomment/TrackedEntityComment.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentitycomment/TrackedEntityComment.java 2014-05-23 14:58:07 +0000 @@ -28,13 +28,20 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +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; + import java.util.Date; /** * @author Chau Thu Tran - * - * @version TrackedEntityComment.java 9:24:52 AM Aug 17, 2012 $ */ +@JacksonXmlRootElement( localName = "trackedEntityComment", namespace = DxfNamespaces.DXF_2_0 ) public class TrackedEntityComment { private int id; @@ -59,7 +66,7 @@ this.creator = creator; this.createdDate = createdDate; } - + //TODO implement hashCode and equals // ------------------------------------------------------------------------- @@ -76,6 +83,9 @@ this.id = id; } + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public String getCommentText() { return commentText; @@ -86,6 +96,9 @@ this.commentText = commentText; } + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Date getCreatedDate() { return createdDate; @@ -96,6 +109,9 @@ this.createdDate = createdDate; } + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public String getCreator() { return creator;