Merge branch 'Development' of https://gitlab.eudat.eu/dmp/OpenAIRE-EUDAT-DMP-service-pilot into Development
This commit is contained in:
commit
4f2fb712cf
|
@ -4,6 +4,7 @@ import eu.eudat.dao.entities.*;
|
|||
import eu.eudat.entities.UserInfo;
|
||||
import eu.eudat.models.HintedModelFactory;
|
||||
import eu.eudat.models.criteria.DataRepositoryCriteria;
|
||||
import eu.eudat.models.criteria.ExternalDatasetCriteria;
|
||||
import eu.eudat.models.criteria.RegistryCriteria;
|
||||
import eu.eudat.models.criteria.ServiceCriteria;
|
||||
import eu.eudat.models.dataset.Dataset;
|
||||
|
@ -65,6 +66,7 @@ public class DatasetManager {
|
|||
createRegistriesIfTheyDontExist(apiContext.getDatabaseRepository().getRegistryDao(), dataset);
|
||||
createDataRepositoriesIfTheyDontExist(apiContext.getDatabaseRepository().getDataRepositoryDao(), dataset);
|
||||
createServicesIfTheyDontExist(apiContext.getDatabaseRepository().getServiceDao(), dataset);
|
||||
createExternalDatasetsIfTheyDontExist(apiContext.getDatabaseRepository().getExternalDatasetDao(), dataset);
|
||||
return apiContext.getDatabaseRepository().getDatasetDao().createOrUpdate(dataset);
|
||||
}
|
||||
|
||||
|
@ -105,6 +107,18 @@ public class DatasetManager {
|
|||
}
|
||||
}
|
||||
|
||||
private static void createExternalDatasetsIfTheyDontExist(ExternalDatasetDao externalDatasetDao, eu.eudat.entities.Dataset dataset) {
|
||||
if (dataset.getExternalDatasets() != null && !dataset.getExternalDatasets().isEmpty()) {
|
||||
for (eu.eudat.entities.ExternalDataset externalDataset : dataset.getExternalDatasets()) {
|
||||
ExternalDatasetCriteria criteria = new ExternalDatasetCriteria();
|
||||
criteria.setLike(externalDataset.getReference());
|
||||
List<eu.eudat.entities.ExternalDataset> entries = externalDatasetDao.getWithCriteria(criteria).toList();
|
||||
if (entries != null && !entries.isEmpty()) externalDataset.setId(entries.get(0).getId());
|
||||
else externalDataset = externalDatasetDao.createOrUpdate(externalDataset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void makePublic(DatasetDao datasetDao, UUID id) throws Exception {
|
||||
eu.eudat.entities.Dataset dataset = datasetDao.find(id);
|
||||
if (dataset.getStatus() != eu.eudat.entities.Dataset.Status.FINALISED.getValue())
|
||||
|
|
|
@ -168,6 +168,7 @@ public class DatasetWizardModel implements DataModel<Dataset> {
|
|||
this.reference = entity.getReference();
|
||||
this.description = entity.getDescription();
|
||||
this.profile = new DatasetProfileListingModel();
|
||||
this.uri = entity.getUri();
|
||||
this.profile.fromDataModel(entity.getProfile());
|
||||
this.registries = new DomainModelConverter<eu.eudat.entities.Registry, Registry>().fromDataModel(entity.getRegistries().stream().collect(Collectors.toList()), Registry.class);
|
||||
this.dataRepositories = new DomainModelConverter<eu.eudat.entities.DataRepository, DataRepository>().fromDataModel(entity.getDataRepositories().stream().collect(Collectors.toList()), DataRepository.class);
|
||||
|
|
|
@ -34,8 +34,8 @@ public class ConfigLoader {
|
|||
|
||||
JAXBContext jaxbContext = JAXBContext.newInstance(ExternalUrls.class);
|
||||
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
|
||||
is = new URL("file:///"+System.getenv("CATALINA_HOME")+fileUrl).openStream();
|
||||
//is = new URL("file:///C:/Users/ikalyvas/Documents/Projects/OpenAIRE-EUDAT-DMP-service-pilot/dmp-backend/src/main/resources/ExternalUrls.xml").openStream();
|
||||
//is = new URL("file:///"+System.getenv("CATALINA_HOME")+fileUrl).openStream();
|
||||
is = new URL("file:///C:/Users/ikalyvas/Documents/Projects/OpenAIRE-EUDAT-DMP-service-pilot/dmp-backend/src/main/resources/ExternalUrls.xml").openStream();
|
||||
externalUrls = (ExternalUrls) jaxbUnmarshaller.unmarshal(is);
|
||||
// System.out.println(new ObjectMapper().writeValueAsString(externalUrls));
|
||||
} catch (Exception ex) {
|
||||
|
|
Loading…
Reference in New Issue