Commit 2958cab1 authored by Georgios Kolokythas's avatar Georgios Kolokythas

Refactors how "External Resources" are saved on Dataset.

parent 1b7d1188
......@@ -281,20 +281,41 @@ public class Dataset implements DataEntity<Dataset, UUID> {
this.setLabel(entity.getLabel());
this.setProperties(entity.getProperties());
this.getDatasetDataRepositories().removeAll(this.getDatasetDataRepositories());
if (entity.getDatasetDataRepositories() != null)
this.getDatasetDataRepositories().addAll(entity.getDatasetDataRepositories());
if (entity.getDatasetDataRepositories() == null || entity.getDatasetDataRepositories().size() < 1) {
if (this.getDatasetDataRepositories() != null) this.getDatasetDataRepositories().removeAll(this.getDatasetDataRepositories());
} else {
if (this.getDatasetDataRepositories() != null) {
this.getDatasetDataRepositories().removeAll(this.getDatasetDataRepositories());
} else {
this.setDatasetDataRepositories(new HashSet<>());
}
this.getDatasetDataRepositories().addAll(entity.getDatasetDataRepositories().stream().peek(item -> item.setDataset(this)).collect(Collectors.toList()));
}
if (entity.getDatasetExternalDatasets() == null || entity.getDatasetExternalDatasets().size() < 1) {
if (this.getDatasetExternalDatasets() != null) this.getDatasetExternalDatasets().removeAll(this.getDatasetExternalDatasets());
} else {
if (this.getDatasetExternalDatasets() != null) {
this.getDatasetExternalDatasets().removeAll(this.getDatasetExternalDatasets());
} else {
this.setDatasetExternalDatasets(new HashSet<>());
}
this.getDatasetExternalDatasets().addAll(entity.getDatasetExternalDatasets().stream().peek(item -> item.setDataset(this)).collect(Collectors.toList()));
}
this.getDatasetExternalDatasets().removeAll(this.getDatasetExternalDatasets());
if (entity.getDatasetExternalDatasets() != null)
this.getDatasetExternalDatasets().addAll(entity.getDatasetExternalDatasets());
if (entity.getServices() == null || entity.getServices().size() < 1) {
if (this.getServices() != null) this.getServices().removeAll(this.getServices());
} else {
if (this.getServices() != null) {
this.getServices().removeAll(this.getServices());
} else {
this.setServices(new HashSet<>());
}
this.getServices().addAll(entity.getServices().stream().peek(item -> item.setDataset(this)).collect(Collectors.toList()));
}
this.setRegistries(entity.getRegistries());
this.getServices().removeAll(this.getServices());
if (entity.getServices() != null)
this.getServices().addAll(entity.getServices());
this.setDmp(entity.getDmp());
this.setStatus(entity.getStatus());
this.setProfile(entity.getProfile());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment