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("template", this.template.toString());
builder.field("status", this.status.toString()); builder.field("status", this.status.toString());
builder.field("dmp", this.dmp.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()); builder.field("grant", this.grant.toString());
if (collaborators != null) { if (collaborators != null) {
builder.startArray("collaborators"); builder.startArray("collaborators");

View File

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