When cloning Datasets with external references properly get the DataRepository id and the ExternalDatatset id and copy the data from the original (ref #226)

This commit is contained in:
George Kalampokis 2020-01-20 11:00:05 +02:00
parent 15c256e7eb
commit 4e7e269130
1 changed files with 5 additions and 2 deletions

View File

@ -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()));
}