org.hisp.dhis.model.IdentifiableObject Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dhis2-java-client Show documentation
Show all versions of dhis2-java-client Show documentation
DHIS 2 API client for Java.
package org.hisp.dhis.model;
import java.util.Date;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@ToString
public class IdentifiableObject
{
@JsonProperty
protected String id;
@JsonProperty
protected String code;
@JsonProperty
protected String name;
@JsonProperty
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'hh:mm:ss")
protected Date created;
@JsonProperty
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'hh:mm:ss")
protected Date lastUpdated;
@JsonProperty
protected Set attributeValues = new HashSet<>();
// -------------------------------------------------------------------------
// Loigc methods
// -------------------------------------------------------------------------
public boolean addAttributeValue( AttributeValue attributeValue )
{
return this.attributeValues.add( attributeValue );
}
public void clearAttributeValues()
{
this.attributeValues.clear();
}
// -------------------------------------------------------------------------
// hashCode, equals, toString
// -------------------------------------------------------------------------
@Override
public int hashCode()
{
return Objects.hash( getId() );
}
@Override
public boolean equals( Object o )
{
if ( this == o )
{
return true;
}
if ( o == null )
{
return false;
}
if ( !getClass().isAssignableFrom( o.getClass() ) )
{
return false;
}
final IdentifiableObject other = (IdentifiableObject) o;
return Objects.equals( getId(), other.getId() );
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy