Commit 4e7e2691 authored by George Kalampokis's avatar George Kalampokis

When cloning Datasets with external references properly get the DataRepository...

When cloning Datasets with external references properly get the DataRepository id and the ExternalDatatset id and copy the data from the original (ref #226)
parent 15c256e7
......@@ -788,11 +788,12 @@ public class DataManagementPlanManager {
if (newDataset.getDatasetDataRepositories() != null) {
newDataset.setDatasetDataRepositories(newDataset.getDatasetDataRepositories().stream().map(item -> {
DataRepository dataRepository = new DataRepository();
dataRepository.setId(item.getId());
dataRepository.setId(item.getDataRepository().getId());
DatasetDataRepository datasetDataRepository = new DatasetDataRepository();
datasetDataRepository.setDataRepository(dataRepository);
datasetDataRepository.setDataset(newDataset);
datasetDataRepository.setData(item.getData());
return datasetDataRepository;
}).collect(Collectors.toSet()));
}
......@@ -800,10 +801,11 @@ public class DataManagementPlanManager {
if (newDataset.getDatasetExternalDatasets() != null) {
newDataset.setDatasetExternalDatasets(newDataset.getDatasetExternalDatasets().stream().map(item -> {
ExternalDataset externalDataset = new ExternalDataset();
externalDataset.setId(item.getId());
externalDataset.setId(item.getExternalDataset().getId());
DatasetExternalDataset datasetExternalDataset = new DatasetExternalDataset();
datasetExternalDataset.setExternalDataset(externalDataset);
datasetExternalDataset.setDataset(newDataset);
datasetExternalDataset.setData(item.getData());
return datasetExternalDataset;
}).collect(Collectors.toSet()));
}
......@@ -823,6 +825,7 @@ public class DataManagementPlanManager {
DatasetService datasetService = new DatasetService();
datasetService.setService(service);
datasetService.setDataset(newDataset);
datasetService.setData(item.getData());
return datasetService;
}).collect(Collectors.toSet()));
}
......
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