Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public TotalAggregationType getTotalAggregationType() {
// -------------------------------------------------------------------------

@JsonProperty
@JsonSerialize(as = BaseNameableObject.class)
@JsonSerialize(as = NameableObject.class)
@JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0)
@Property(
value = PropertyType.REFERENCE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import lombok.Builder;
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.DxfNamespaces;
import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.period.Period;
Expand Down Expand Up @@ -68,7 +69,7 @@ public class DataApprovalStateResponse {
*/

@JsonProperty
@JsonSerialize(as = BaseIdentifiableObject.class)
@JsonSerialize(as = IdentifiableObject.class)
@JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0)
public DataSet getDataSet() {
return dataSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public boolean equals(Object object) {
// -------------------------------------------------------------------------

@JsonProperty
@JsonSerialize(as = BaseIdentifiableObject.class)
@JsonSerialize(as = IdentifiableObject.class)
@JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0)
public DataSet getDataSet() {
return dataSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,22 @@
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import com.google.common.base.MoreObjects;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.ForeignKey;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import java.util.Date;
import lombok.Setter;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hisp.dhis.common.DxfNamespaces;
import org.hisp.dhis.common.EmbeddedObject;
import org.hisp.dhis.common.adapter.JacksonPeriodDeserializer;
Expand All @@ -48,18 +61,32 @@
/**
* @author Stian Sandvold
*/
@Entity
@Table(name = "datainputperiod")
@Setter
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@JacksonXmlRootElement(localName = "dataInputPeriods", namespace = DxfNamespaces.DXF_2_0)
public class DataInputPeriod implements EmbeddedObject {
/** The database internal identifier for this Object. */
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
@Column(name = "datainputperiodid")
private int id;

/** Period data must belong to */
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(
name = "periodid",
nullable = false,
foreignKey = @ForeignKey(name = "fk_datainputperiod_period"))
private Period period;

/** Opening date of which data can be entered */
@Column(name = "openingdate")
private Date openingDate;

/** Closing date of which data can no longer be entered */
@Column(name = "closingdate")
private Date closingDate;

public DataInputPeriod() {}
Expand Down Expand Up @@ -103,10 +130,6 @@ public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

@JsonProperty
@JsonSerialize(using = JacksonPeriodSerializer.class)
@JsonDeserialize(using = JacksonPeriodDeserializer.class)
Expand All @@ -115,30 +138,18 @@ public Period getPeriod() {
return period;
}

public void setPeriod(Period period) {
this.period = period;
}

@JsonProperty
@JacksonXmlProperty(localName = "openingDate", namespace = DxfNamespaces.DXF_2_0)
public Date getOpeningDate() {
return openingDate;
}

public void setOpeningDate(Date openingDate) {
this.openingDate = openingDate;
}

@JsonProperty
@JacksonXmlProperty(localName = "closingDate", namespace = DxfNamespaces.DXF_2_0)
public Date getClosingDate() {
return closingDate;
}

public void setClosingDate(Date closingDate) {
this.closingDate = closingDate;
}

@Override
public boolean equals(Object object) {
if (this == object) {
Expand Down
Loading
Loading