argos/dmp-backend/src/main/java/eu/eudat/models/externaldataset/ExternalDatasetListingModel...

92 lines
2.2 KiB
Java

package eu.eudat.models.externaldataset;
import eu.eudat.entities.ExternalDataset;
import eu.eudat.models.DataModel;
import javax.persistence.Column;
import java.util.Date;
import java.util.UUID;
/**
* Created by ikalyvas on 1/17/2018.
*/
public class ExternalDatasetListingModel implements DataModel<ExternalDataset> {
private UUID id;
private String label;
private String abbreviation;
private String reference;
private Date created;
private 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 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;
}
@Override
public void fromDataModel(ExternalDataset entity) throws InstantiationException, IllegalAccessException {
this.id = entity.getId();
this.abbreviation = entity.getAbbreviation();
this.label = entity.getLabel();
this.modified = entity.getModified();
this.created = entity.getCreated();
this.reference = entity.getReference();
}
@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;
}
}