package eu.eudat.models.listingmodels; import eu.eudat.entities.DMP; import eu.eudat.entities.DataRepository; import eu.eudat.models.DataModel; import eu.eudat.models.dmp.Organisation; import eu.eudat.models.dmp.Researcher; import eu.eudat.utilities.builders.DomainModelConverter; import eu.eudat.utilities.helpers.LabelBuilder; import eu.eudat.utilities.helpers.LabelGenerator; import java.util.List; import java.util.stream.Collectors; /** * Created by ikalyvas on 12/19/2017. */ public class DataManagementPlanListingModel implements DataModel { private String id; private String label; private String project; private String profile; private String researchers; private String organisations; private String version; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getLabel() { return label; } public void setLabel(String label) { this.label = label; } public String getProject() { return project; } public void setProject(String project) { this.project = project; } public String getProfile() { return profile; } public void setProfile(String profile) { this.profile = profile; } public String getResearchers() { return researchers; } public void setResearchers(String researchers) { this.researchers = researchers; } public String getOrganisations() { return organisations; } public void setOrganisations(String organisations) { this.organisations = organisations; } public String getVersion() { return version; } public void setVersion(String version) { this.version = version; } @Override public void fromDataModel(DMP entity) throws InstantiationException, IllegalAccessException { this.id = entity.getId().toString(); this.label = entity.getLabel(); this.project = entity.getProject().getLabel(); if(entity.getProfile()!=null)this.profile = entity.getProfile().getLabel(); this.organisations =LabelBuilder.getLabel(new DomainModelConverter().fromDataModel(entity.getOrganisations().stream().collect(Collectors.toList()),Organisation.class)); this.researchers =LabelBuilder.getLabel(new DomainModelConverter().fromDataModel(entity.getResearchers().stream().collect(Collectors.toList()),Researcher.class)); this.version = ""+entity.getVersion(); } @Override public DMP toDataModel() { return null; } }