113 lines
3.3 KiB
Java
113 lines
3.3 KiB
Java
package eu.eudat.models.data.quickwizard;
|
|
|
|
import eu.eudat.commons.scope.user.UserScope;
|
|
import eu.eudat.data.DescriptionTemplateEntity;
|
|
import eu.eudat.model.User;
|
|
import eu.eudat.models.data.dmp.AssociatedProfile;
|
|
|
|
import javax.management.InvalidApplicationException;
|
|
import java.util.*;
|
|
|
|
|
|
public class DmpQuickWizardModel {
|
|
private UUID id;
|
|
private String label;
|
|
private int status;
|
|
private AssociatedProfile datasetProfile;
|
|
private String description;
|
|
private String language;
|
|
|
|
|
|
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 int getStatus() {
|
|
return status;
|
|
}
|
|
|
|
public void setStatus(int status) {
|
|
this.status = status;
|
|
}
|
|
|
|
public void setDatasetProfile(AssociatedProfile datasetProfile) {
|
|
this.datasetProfile = datasetProfile;
|
|
}
|
|
|
|
public String getDescription() {
|
|
return description;
|
|
}
|
|
|
|
public void setDescription(String description) {
|
|
this.description = description;
|
|
}
|
|
|
|
|
|
public String getLanguage() {
|
|
return language;
|
|
}
|
|
|
|
public void setLanguage(String language) {
|
|
this.language = language;
|
|
}
|
|
|
|
public eu.eudat.models.data.dmp.DataManagementPlan toDataDmp(/*Grant grant, Project project,*/ UserScope userScope) throws InvalidApplicationException {
|
|
eu.eudat.models.data.dmp.DataManagementPlan dataManagementPlanEntity = new eu.eudat.models.data.dmp.DataManagementPlan();
|
|
|
|
dataManagementPlanEntity.setId(this.id);
|
|
dataManagementPlanEntity.setVersion(0);
|
|
|
|
dataManagementPlanEntity.setLabel(this.label);
|
|
//TODO
|
|
// if (grant != null) {
|
|
// eu.eudat.models.data.grant.Grant importGrant = new eu.eudat.models.data.grant.Grant();
|
|
// dataManagementPlanEntity.setGrant(importGrant.fromDataModel(grant));
|
|
// }
|
|
// if (project != null) {
|
|
// eu.eudat.models.data.project.Project importProject = new eu.eudat.models.data.project.Project();
|
|
// dataManagementPlanEntity.setProject(importProject.fromDataModel(project));
|
|
// }
|
|
if (this.datasetProfile != null) {
|
|
List<AssociatedProfile> assProfile = new LinkedList<>();
|
|
assProfile.add(this.datasetProfile);
|
|
dataManagementPlanEntity.setProfiles(assProfile);
|
|
}
|
|
dataManagementPlanEntity.setStatus((short) this.status);
|
|
dataManagementPlanEntity.setDescription(this.description);
|
|
dataManagementPlanEntity.setProperties(null);
|
|
dataManagementPlanEntity.setCreated(new Date());
|
|
List<User> user = new LinkedList<>();
|
|
User userInfo = new User();
|
|
userInfo.setId(userScope.getUserId());
|
|
// dataManagementPlanEntity.setAssociatedUsers(user);
|
|
dataManagementPlanEntity.setExtraProperties(new HashMap<>());
|
|
dataManagementPlanEntity.getExtraProperties().put("language", this.language);
|
|
dataManagementPlanEntity.getExtraProperties().put("visible", false);
|
|
dataManagementPlanEntity.getExtraProperties().put("contact", userScope.getUserId().toString());
|
|
return dataManagementPlanEntity;
|
|
}
|
|
|
|
|
|
public DescriptionTemplateEntity getDatasetProfile() {
|
|
DescriptionTemplateEntity descriptionTemplateEntity = new DescriptionTemplateEntity();
|
|
descriptionTemplateEntity.setDefinition(this.datasetProfile.getLabel());
|
|
descriptionTemplateEntity.setLabel(this.datasetProfile.getLabel());
|
|
descriptionTemplateEntity.setId(this.datasetProfile.getDescriptionTemplateId());
|
|
return descriptionTemplateEntity;
|
|
}
|
|
|
|
|
|
}
|