package eu.eudat.models.data.funder; import eu.eudat.models.DataModel; import java.util.Date; import java.util.UUID; public class Funder implements DataModel { private UUID id; private String label; private String reference; private String definition; private eu.eudat.data.entities.Funder.Status status; private Date created; private Date modified; private Integer type; public UUID getId() { return id; } public void setId(UUID id) { this.id = id; } public String getLabel() { return label; } public void setLabel(String label) { this.label = label; } public String getReference() { return reference; } public void setReference(String reference) { this.reference = reference; } public String getDefinition() { return definition; } public void setDefinition(String definition) { this.definition = definition; } public Short getStatus() { return status.getValue(); } public void setStatus(Short status) { this.status = eu.eudat.data.entities.Funder.Status.fromInteger(status); } public Date getCreated() { return created; } public void setCreated(Date created) { this.created = created; } public Date getModified() { return modified; } public void setModified(Date modified) { this.modified = modified; } public Integer getType() { return type; } public void setType(Integer type) { this.type = type; } @Override public Funder fromDataModel(eu.eudat.data.entities.Funder entity) { this.id = entity.getId(); this.label = entity.getLabel(); this.reference = entity.getReference(); this.type = entity.getType(); this.definition = entity.getDefinition(); this.setStatus(entity.getStatus()); this.created = entity.getCreated(); this.modified = entity.getModified(); return this; } @Override public eu.eudat.data.entities.Funder toDataModel() throws Exception { eu.eudat.data.entities.Funder entity = new eu.eudat.data.entities.Funder(); entity.setId(this.id); entity.setLabel(this.label); entity.setType(this.type); entity.setReference(this.reference == null ? "dmp:" + this.label : this.reference); entity.setDefinition(this.definition); entity.setCreated(this.created == null ? new Date() : this.created); entity.setStatus(this.status != null ? this.getStatus() : eu.eudat.data.entities.Grant.Status.ACTIVE.getValue()); entity.setModified(new Date()); return entity; } @Override public String getHint() { return null; } }