package eu.eudat.models.data.services; import eu.eudat.data.entities.Service; import eu.eudat.data.entities.UserInfo; import eu.eudat.models.DataModel; import java.util.Date; import java.util.UUID; /** * Created by ikalyvas on 9/3/2018. */ public class ServiceModel implements DataModel { public UUID id; public String label; public String abbreviation; public String uri; public Date created; public Date modified; 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 getAbbreviation() { return abbreviation; } public void setAbbreviation(String abbreviation) { this.abbreviation = abbreviation; } public String getUri() { return uri; } public void setUri(String uri) { this.uri = uri; } 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; } @Override public ServiceModel fromDataModel(Service entity) { this.abbreviation = entity.getAbbreviation(); this.created = entity.getCreated(); this.id = entity.getId(); this.label = entity.getLabel(); this.modified = entity.getModified(); this.uri = entity.getUri(); return this; } @Override public Service toDataModel() throws Exception { Service service = new Service(); service.setId(this.id != null ? this.id : UUID.randomUUID()); service.setAbbreviation(this.abbreviation); service.setCreated(this.created != null ? this.created : new Date()); service.setLabel(this.label); service.setModified(new Date()); service.setUri(this.uri); service.setReference("innerdata/" + service.getId()); service.setModified(new Date()); service.setStatus((short)0); service.setCreationUser(new UserInfo()); return service; } @Override public String getHint() { return null; } }