113 lines
2.7 KiB
Java
113 lines
2.7 KiB
Java
package eu.eudat.models.externaldataset;
|
|
|
|
import eu.eudat.data.entities.ExternalDataset;
|
|
import eu.eudat.models.DataModel;
|
|
import eu.eudat.types.externalsourcetype.ExternalDatasetType;
|
|
|
|
import java.util.Date;
|
|
import java.util.UUID;
|
|
|
|
public class ExternalDatasetListingModel implements DataModel<ExternalDataset, ExternalDatasetListingModel> {
|
|
|
|
private UUID id;
|
|
private String label;
|
|
private String abbreviation;
|
|
private String reference;
|
|
private Date created;
|
|
private Date modified;
|
|
private String info;
|
|
private ExternalDatasetType 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 getAbbreviation() {
|
|
return abbreviation;
|
|
}
|
|
|
|
public void setAbbreviation(String abbreviation) {
|
|
this.abbreviation = abbreviation;
|
|
}
|
|
|
|
public String getReference() {
|
|
return reference;
|
|
}
|
|
|
|
public void setReference(String reference) {
|
|
this.reference = reference;
|
|
}
|
|
|
|
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 != null ? type.getValue() : null;
|
|
}
|
|
|
|
public void setType(Integer type) {
|
|
this.type = ExternalDatasetType.fromInteger(type);
|
|
}
|
|
|
|
public String getInfo() {
|
|
return info;
|
|
}
|
|
|
|
public void setInfo(String info) {
|
|
this.info = info;
|
|
}
|
|
|
|
@Override
|
|
public ExternalDatasetListingModel fromDataModel(ExternalDataset entity) {
|
|
this.id = entity.getId();
|
|
this.abbreviation = entity.getAbbreviation();
|
|
this.label = entity.getLabel();
|
|
this.modified = entity.getModified();
|
|
this.created = entity.getCreated();
|
|
this.reference = entity.getReference();
|
|
return this;
|
|
}
|
|
|
|
@Override
|
|
public ExternalDataset toDataModel() throws Exception {
|
|
ExternalDataset externalDataset = new ExternalDataset();
|
|
externalDataset.setAbbreviation(this.abbreviation);
|
|
externalDataset.setCreated(this.created != null ? this.created : new Date());
|
|
externalDataset.setLabel(this.label);
|
|
externalDataset.setId(this.id);
|
|
externalDataset.setModified(this.modified);
|
|
externalDataset.setReference(this.reference);
|
|
return externalDataset;
|
|
}
|
|
|
|
@Override
|
|
public String getHint() {
|
|
return null;
|
|
}
|
|
}
|