More bugfixes

This commit is contained in:
George Kalampokis 2020-03-11 11:42:38 +02:00
parent 818c6378c2
commit 0067ecef26
2 changed files with 19 additions and 13 deletions

View File

@ -154,7 +154,9 @@ public class Dataset implements ElasticEntity<Dataset> {
builder.field("template", this.template.toString());
builder.field("status", this.status.toString());
builder.field("dmp", this.dmp.toString());
builder.field("group", this.group.toString());
if (this.group != null) {
builder.field("group", this.group.toString());
}
builder.field("grant", this.grant.toString());
if (collaborators != null) {
builder.startArray("collaborators");

View File

@ -568,12 +568,14 @@ public class DatasetManager {
dataset.setDmp(datasetWizardModel.getDmp().getId());
dataset.setGroup(datasetWizardModel.getDmp().getGroupId());
dataset.setGrant(datasetWizardModel.getDmp().getGrant().getId());
dataset.setCollaborators(datasetWizardModel.getDmp().getUsers().stream().map(user -> {
Collaborator collaborator = new Collaborator();
collaborator.setId(user.getId().toString());
collaborator.setName(user.getName());
return collaborator;
}).collect(Collectors.toList()));
if (datasetWizardModel.getDmp().getUsers() != null) {
dataset.setCollaborators(datasetWizardModel.getDmp().getUsers().stream().map(user -> {
Collaborator collaborator = new Collaborator();
collaborator.setId(user.getId().toString());
collaborator.setName(user.getName());
return collaborator;
}).collect(Collectors.toList()));
}
DataManagementPlanCriteria dmpCriteria = new DataManagementPlanCriteria();
dmpCriteria.setAllVersions(true);
dmpCriteria.setGroupIds(Collections.singletonList(datasetWizardModel.getDmp().getGroupId()));
@ -582,12 +584,14 @@ public class DatasetManager {
if (dataset.getLastVersion() == null) {
dataset.setLastVersion(true);
}
dataset.setOrganizations(datasetWizardModel.getDmp().getOrganisations().stream().map(org -> {
Organization organization = new Organization();
organization.setId(org.getId());
organization.setName(org.getName());
return organization;
}).collect(Collectors.toList()));
if (datasetWizardModel.getDmp().getOrganisations() != null) {
dataset.setOrganizations(datasetWizardModel.getDmp().getOrganisations().stream().map(org -> {
Organization organization = new Organization();
organization.setId(org.getId());
organization.setName(org.getName());
return organization;
}).collect(Collectors.toList()));
}
datasetRepository.createOrUpdate(dataset);
// }
}