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());
if (this.group != null) {
builder.field("group", this.group.toString()); 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());
if (datasetWizardModel.getDmp().getUsers() != null) {
dataset.setCollaborators(datasetWizardModel.getDmp().getUsers().stream().map(user -> { dataset.setCollaborators(datasetWizardModel.getDmp().getUsers().stream().map(user -> {
Collaborator collaborator = new Collaborator(); Collaborator collaborator = new Collaborator();
collaborator.setId(user.getId().toString()); collaborator.setId(user.getId().toString());
collaborator.setName(user.getName()); collaborator.setName(user.getName());
return collaborator; return collaborator;
}).collect(Collectors.toList())); }).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);
} }
if (datasetWizardModel.getDmp().getOrganisations() != null) {
dataset.setOrganizations(datasetWizardModel.getDmp().getOrganisations().stream().map(org -> { dataset.setOrganizations(datasetWizardModel.getDmp().getOrganisations().stream().map(org -> {
Organization organization = new Organization(); Organization organization = new Organization();
organization.setId(org.getId()); organization.setId(org.getId());
organization.setName(org.getName()); organization.setName(org.getName());
return organization; return organization;
}).collect(Collectors.toList())); }).collect(Collectors.toList()));
}
datasetRepository.createOrUpdate(dataset); datasetRepository.createOrUpdate(dataset);
// } // }
} }