From f253fd965cb1c9edde7ad4e18cbc25002af25b13 Mon Sep 17 00:00:00 2001 From: sgiannopoulos Date: Thu, 4 Jan 2024 12:55:42 +0200 Subject: [PATCH] remove old refence classes --- .../eu/eudat/data/old/DataRepository.java | 140 ------- .../eu/eudat/data/old/ExternalDataset.java | 112 ------ .../main/java/eu/eudat/data/old/Funder.java | 183 --------- .../main/java/eu/eudat/data/old/Grant.java | 299 --------------- .../java/eu/eudat/data/old/Organisation.java | 149 -------- .../main/java/eu/eudat/data/old/Project.java | 289 -------------- .../main/java/eu/eudat/data/old/Registry.java | 154 -------- .../java/eu/eudat/data/old/Researcher.java | 156 -------- .../main/java/eu/eudat/data/old/Service.java | 141 ------- .../DataRepositoryPublicModel.java | 1 - .../ExternalDatasetPublicListingModel.java | 1 - .../datasetwizard/RegistryPublicModel.java | 1 - .../datasetwizard/ServicePublicModel.java | 1 - .../funder/FunderPublicOverviewModel.java | 20 +- .../grant/GrantPublicOverviewModel.java | 1 - .../criteria/DataManagementPlanCriteria.java | 9 - .../dao/criteria/DataRepositoryCriteria.java | 17 - .../dao/criteria/ExternalDatasetCriteria.java | 15 - .../data/dao/criteria/FunderCriteria.java | 34 -- .../data/dao/criteria/GrantCriteria.java | 82 ---- .../dao/criteria/OrganisationCriteria.java | 31 -- .../data/dao/criteria/ProjectCriteria.java | 34 -- .../data/dao/criteria/RegistryCriteria.java | 17 - .../data/dao/criteria/ResearcherCriteria.java | 35 -- .../data/dao/criteria/ServiceCriteria.java | 17 - .../eudat/data/dao/entities/DMPDaoImpl.java | 4 +- .../data/dao/entities/DataRepositoryDao.java | 12 - .../dao/entities/DataRepositoryDaoImpl.java | 66 ---- .../data/dao/entities/ExternalDatasetDao.java | 15 - .../dao/entities/ExternalDatasetDaoImpl.java | 67 ---- .../eu/eudat/data/dao/entities/FunderDao.java | 16 - .../data/dao/entities/FunderDaoImpl.java | 76 ---- .../eu/eudat/data/dao/entities/GrantDao.java | 17 - .../eudat/data/dao/entities/GrantDaoImpl.java | 104 ----- .../data/dao/entities/OrganisationDao.java | 16 - .../dao/entities/OrganisationDaoImpl.java | 87 ----- .../eudat/data/dao/entities/ProjectDao.java | 16 - .../data/dao/entities/ProjectDaoImpl.java | 75 ---- .../eudat/data/dao/entities/RegistryDao.java | 14 - .../data/dao/entities/RegistryDaoImpl.java | 67 ---- .../data/dao/entities/ResearcherDao.java | 14 - .../data/dao/entities/ResearcherDaoImpl.java | 68 ---- .../eudat/data/dao/entities/ServiceDao.java | 14 - .../data/dao/entities/ServiceDaoImpl.java | 66 ---- .../DataManagementPlanCriteriaRequest.java | 34 -- .../item/funder/FunderCriteriaRequest.java | 17 - .../item/grant/GrantCriteriaRequest.java | 38 -- .../item/project/ProjectCriteriaRequest.java | 17 - .../researcher/ResearcherCriteriaRequest.java | 21 - .../dmp/DataManagementPlanTableRequest.java | 4 +- .../ExternalDatasetTableRequest.java | 23 -- .../items/table/grant/GrantTableRequest.java | 32 -- .../OrganisationsTableRequest.java | 25 -- .../main/java/eu/eudat/query/DMPQuery.java | 18 +- .../main/java/eu/eudat/query/GrantQuery.java | 110 ------ .../eu/eudat/controllers/BaseController.java | 6 - .../controllers/DashBoardController.java | 81 ---- .../eudat/controllers/DataRepositories.java | 60 --- .../eudat/controllers/ExternalDatasets.java | 80 ---- .../java/eu/eudat/controllers/Funders.java | 41 -- .../java/eu/eudat/controllers/Grants.java | 100 ----- .../eudat/controllers/JournalsController.java | 49 --- .../java/eu/eudat/controllers/Licenses.java | 46 --- .../eu/eudat/controllers/Organisations.java | 74 ---- .../java/eu/eudat/controllers/Projects.java | 43 --- .../PubRepositoriesController.java | 49 --- .../controllers/PublicationsController.java | 46 --- .../controllers/QuickWizardController.java | 73 ++-- .../java/eu/eudat/controllers/Registries.java | 59 --- .../eu/eudat/controllers/Researchers.java | 58 --- .../java/eu/eudat/controllers/Services.java | 58 --- .../controllers/TaxonomiesController.java | 46 --- .../java/eu/eudat/criteria/DMPCriteria.java | 13 +- .../java/eu/eudat/criteria/GrantCriteria.java | 109 ------ .../logic/builders/BuilderFactoryImpl.java | 11 - .../DataRepositoryCriteriaBuilder.java | 23 -- .../ExternalDatasetCriteriaBuilder.java | 23 -- .../criteria/RegistryCriteriaBuilder.java | 23 -- .../criteria/ServiceCriteriaBuilder.java | 23 -- .../builders/model/models/FunderBuilder.java | 87 ----- .../builders/model/models/GrantBuilder.java | 147 ------- .../model/models/OrganisationBuilder.java | 88 ----- .../builders/model/models/ProjectBuilder.java | 139 ------- .../model/models/ResearcherBuilder.java | 88 ----- .../logic/managers/DashBoardManager.java | 360 ------------------ .../managers/DataManagementPlanManager.java | 284 +++++++------- .../logic/managers/DataRepositoryManager.java | 100 ----- .../eudat/logic/managers/DatasetManager.java | 35 +- .../managers/ExternalDatasetManager.java | 88 ----- .../eudat/logic/managers/FunderManager.java | 70 ---- .../eu/eudat/logic/managers/GrantManager.java | 188 --------- .../eudat/logic/managers/LicenseManager.java | 46 --- .../eudat/logic/managers/MetricsManager.java | 28 +- .../logic/managers/OrganisationsManager.java | 115 ------ .../logic/managers/PrefillingManager.java | 10 +- .../eudat/logic/managers/ProjectManager.java | 66 ---- .../logic/managers/PublicationManager.java | 43 --- .../logic/managers/QuickWizardManager.java | 46 +-- .../eudat/logic/managers/RegistryManager.java | 61 --- .../logic/managers/ResearcherManager.java | 83 ---- .../eudat/logic/managers/ServiceManager.java | 66 ---- .../eudat/logic/managers/TaxonomyManager.java | 44 --- .../mapper/prefilling/PrefillingMapper.java | 46 ++- .../operations/DatabaseRepository.java | 15 - .../operations/DatabaseRepositoryImpl.java | 103 ----- .../utilities/documents/word/WordBuilder.java | 3 - .../eudat/models/data/FetcherReference.java | 162 ++++---- .../datarepository/DataRepositoryModel.java | 127 ------ .../models/data/dataset/DataRepository.java | 135 ------- .../eu/eudat/models/data/dataset/Dataset.java | 26 -- .../data/dataset/DatasetOverviewModel.java | 10 - .../eudat/models/data/dataset/Registry.java | 111 ------ .../eu/eudat/models/data/dataset/Service.java | 113 ------ .../datasetwizard/DatasetWizardModel.java | 34 -- .../models/data/dmp/DataManagementPlan.java | 43 --- .../dmp/DataManagementPlanEditorModel.java | 34 -- .../DataManagementPlanNewVersionModel.java | 42 +- .../eudat/models/data/dmp/Organisation.java | 123 ------ .../eu/eudat/models/data/dmp/Researcher.java | 150 -------- .../ExternalDatasetListingModel.java | 162 -------- .../externaldataset/ExternalDatasetModel.java | 93 ----- .../eu/eudat/models/data/funder/Funder.java | 150 -------- .../data/funder/FunderDMPEditorModel.java | 29 -- .../data/funder/FunderOverviewModel.java | 42 -- .../eu/eudat/models/data/grant/Grant.java | 241 ------------ .../models/data/grant/GrantCriteriaModel.java | 37 -- .../data/grant/GrantDMPEditorModel.java | 37 -- .../models/data/grant/GrantListingModel.java | 220 ----------- .../models/data/grant/GrantOverviewModel.java | 100 ----- .../models/data/license/LicenseModel.java | 127 ------ .../DataManagementPlanListingModel.java | 1 - .../DataManagementPlanOverviewModel.java | 26 -- .../eu/eudat/models/data/project/Project.java | 223 ----------- .../data/project/ProjectDMPEditorModel.java | 8 - .../data/publication/PublicationModel.java | 166 -------- .../data/quickwizard/DmpQuickWizardModel.java | 29 +- .../quickwizard/FunderQuickWizardModel.java | 34 -- .../quickwizard/GrantQuickWizardModel.java | 49 --- .../quickwizard/ProjectQuickWizardModel.java | 44 --- .../data/quickwizard/QuickWizardModel.java | 24 -- .../data/rda/FundingRDAExportModel.java | 16 +- .../data/rda/ProjectRDAExportModel.java | 5 +- .../models/data/registries/RegistryModel.java | 143 ------- .../models/data/researcher/Researcher.java | 52 --- .../models/data/services/ServiceModel.java | 144 ------- .../models/data/taxonomy/TaxonomyModel.java | 134 ------- .../rda/mapper/ContributorRDAMapper.java | 81 ++-- .../models/rda/mapper/FundingRDAMapper.java | 65 ---- .../models/rda/mapper/ProjectRDAMapper.java | 59 --- .../validators/DatasetProfileValidator.java | 26 -- .../validators/GrantModelValidator.java | 28 -- .../GrantTableRequestValidator.java | 32 -- 152 files changed, 422 insertions(+), 10050 deletions(-) delete mode 100644 dmp-backend/core/src/main/java/eu/eudat/data/old/DataRepository.java delete mode 100644 dmp-backend/core/src/main/java/eu/eudat/data/old/ExternalDataset.java delete mode 100644 dmp-backend/core/src/main/java/eu/eudat/data/old/Funder.java delete mode 100644 dmp-backend/core/src/main/java/eu/eudat/data/old/Grant.java delete mode 100644 dmp-backend/core/src/main/java/eu/eudat/data/old/Organisation.java delete mode 100644 dmp-backend/core/src/main/java/eu/eudat/data/old/Project.java delete mode 100644 dmp-backend/core/src/main/java/eu/eudat/data/old/Registry.java delete mode 100644 dmp-backend/core/src/main/java/eu/eudat/data/old/Researcher.java delete mode 100644 dmp-backend/core/src/main/java/eu/eudat/data/old/Service.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DataRepositoryCriteria.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/ExternalDatasetCriteria.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/FunderCriteria.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/GrantCriteria.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/OrganisationCriteria.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/ProjectCriteria.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/RegistryCriteria.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/ResearcherCriteria.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/ServiceCriteria.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DataRepositoryDao.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DataRepositoryDaoImpl.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ExternalDatasetDao.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ExternalDatasetDaoImpl.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/FunderDao.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/FunderDaoImpl.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/GrantDao.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/GrantDaoImpl.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/OrganisationDao.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/OrganisationDaoImpl.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ProjectDao.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ProjectDaoImpl.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/RegistryDao.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/RegistryDaoImpl.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ResearcherDao.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ResearcherDaoImpl.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ServiceDao.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ServiceDaoImpl.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/query/items/item/dmp/DataManagementPlanCriteriaRequest.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/query/items/item/funder/FunderCriteriaRequest.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/query/items/item/grant/GrantCriteriaRequest.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/query/items/item/project/ProjectCriteriaRequest.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/query/items/item/researcher/ResearcherCriteriaRequest.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/query/items/table/externaldataset/ExternalDatasetTableRequest.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/query/items/table/grant/GrantTableRequest.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/query/items/table/organisations/OrganisationsTableRequest.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/query/GrantQuery.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/controllers/DashBoardController.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/controllers/DataRepositories.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/controllers/ExternalDatasets.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/controllers/Funders.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/controllers/Grants.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/controllers/JournalsController.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/controllers/Licenses.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/controllers/Organisations.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/controllers/Projects.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/controllers/PubRepositoriesController.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/controllers/PublicationsController.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/controllers/Registries.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/controllers/Researchers.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/controllers/Services.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/controllers/TaxonomiesController.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/criteria/GrantCriteria.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/criteria/DataRepositoryCriteriaBuilder.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/criteria/ExternalDatasetCriteriaBuilder.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/criteria/RegistryCriteriaBuilder.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/criteria/ServiceCriteriaBuilder.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/models/FunderBuilder.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/models/GrantBuilder.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/models/OrganisationBuilder.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/models/ProjectBuilder.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/models/ResearcherBuilder.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/managers/DashBoardManager.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataRepositoryManager.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/managers/ExternalDatasetManager.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/managers/FunderManager.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/managers/GrantManager.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/managers/LicenseManager.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/managers/OrganisationsManager.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/managers/ProjectManager.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/managers/PublicationManager.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/managers/RegistryManager.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/managers/ResearcherManager.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/managers/ServiceManager.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/managers/TaxonomyManager.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/datarepository/DataRepositoryModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/dataset/DataRepository.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/dataset/Registry.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/dataset/Service.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/Organisation.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/Researcher.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/externaldataset/ExternalDatasetListingModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/externaldataset/ExternalDatasetModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/funder/Funder.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/funder/FunderDMPEditorModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/funder/FunderOverviewModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/grant/Grant.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/grant/GrantCriteriaModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/grant/GrantDMPEditorModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/grant/GrantListingModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/grant/GrantOverviewModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/license/LicenseModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/project/Project.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/publication/PublicationModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/quickwizard/FunderQuickWizardModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/quickwizard/GrantQuickWizardModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/quickwizard/ProjectQuickWizardModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/registries/RegistryModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/researcher/Researcher.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/services/ServiceModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/taxonomy/TaxonomyModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/FundingRDAMapper.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/ProjectRDAMapper.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/validators/DatasetProfileValidator.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/validators/GrantModelValidator.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/validators/GrantTableRequestValidator.java diff --git a/dmp-backend/core/src/main/java/eu/eudat/data/old/DataRepository.java b/dmp-backend/core/src/main/java/eu/eudat/data/old/DataRepository.java deleted file mode 100644 index cbedd066f..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/data/old/DataRepository.java +++ /dev/null @@ -1,140 +0,0 @@ -package eu.eudat.data.old; - - -import eu.eudat.data.UserEntity; -import eu.eudat.data.old.helpers.EntityBinder; -import eu.eudat.data.old.queryableentity.DataEntity; - -import jakarta.persistence.*; -import java.io.Serializable; -import java.util.Date; -import java.util.List; -import java.util.UUID; - -@Entity -@Table(name = "\"DataRepository\"") -public class DataRepository implements Serializable, DataEntity { - - @Id - @Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)") - private UUID id; - - @Column(name = "\"Label\"") - private String label; - - @Column(name = "\"Abbreviation\"") - private String abbreviation; - - @Column(name = "\"Reference\"") - private String reference; - - @Column(name = "\"Uri\"") - private String uri; - - @Column(name = "\"Definition\"") - private String definition; - - @Column(name = "\"Status\"", nullable = false) - private Short status; - - @Column(name = "\"Created\"", nullable = false) - private Date created = null; - - @Column(name = "\"Modified\"", nullable = false) - private Date modified = new Date(); - - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "\"CreationUser\"") - private UserEntity creationUser; - - - public Short getStatus() { - return status; - } - public void setStatus(Short status) { - this.status = status; - } - - public Date getCreated() { - return created; - } - public void setCreated(Date created) { - this.created = created; - } - - public Date getModified() { - return modified; - } - public void setModified(Date modified) { - this.modified = modified; - } - - public UUID getId() { - return id; - } - public void setId(UUID id) { - this.id = id; - } - - public String getLabel() { - return label; - } - public void setLabel(String label) { - this.label = label; - } - - public String getAbbreviation() { - return abbreviation; - } - public void setAbbreviation(String abbreviation) { - this.abbreviation = abbreviation; - } - - public String getReference() { - return reference; - } - public void setReference(String reference) { - this.reference = reference; - } - - public String getUri() { - return uri; - } - public void setUri(String uri) { - this.uri = uri; - } - - public String getDefinition() { - return definition; - } - public void setDefinition(String definition) { - this.definition = definition; - } - - public UserEntity getCreationUser() { - return creationUser; - } - public void setCreationUser(UserEntity creationUser) { - this.creationUser = creationUser; - } - - @Override - public void update(DataRepository entity) { - this.label = entity.getLabel(); - this.abbreviation = entity.getAbbreviation(); - this.uri = entity.getUri(); - - } - - @Override - public UUID getKeys() { - return this.id; - } - - @Override - public DataRepository buildFromTuple(List tuple, List fields, String base) { - String currentBase = base.isEmpty() ? "" : base + "."; - if (fields.contains(currentBase + "id")) this.id = EntityBinder.fromTuple(tuple, currentBase + "id"); - return this; - } -} diff --git a/dmp-backend/core/src/main/java/eu/eudat/data/old/ExternalDataset.java b/dmp-backend/core/src/main/java/eu/eudat/data/old/ExternalDataset.java deleted file mode 100644 index 87b0755ea..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/data/old/ExternalDataset.java +++ /dev/null @@ -1,112 +0,0 @@ -package eu.eudat.data.old; - -import eu.eudat.data.UserEntity; -import eu.eudat.data.converters.DateToUTCConverter; -import eu.eudat.data.old.helpers.EntityBinder; -import eu.eudat.data.old.queryableentity.DataEntity; - -import jakarta.persistence.*; -import java.util.Date; -import java.util.List; -import java.util.UUID; - - -@Entity -@Table(name = "\"ExternalDataset\"") -public class ExternalDataset implements DataEntity { - - @Id - @Column(name = "\"Id\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)") - private UUID id; - - @Column(name = "\"Label\"", nullable = false) - private String label; - - @Column(name = "\"Abbreviation\"", nullable = false) - private String abbreviation; - - @Column(name = "\"Reference\"", nullable = false) - private String reference; - - @Column(name = "\"Created\"", nullable = false) - @Convert(converter = DateToUTCConverter.class) - private Date created; - - @Column(name = "\"Modified\"", nullable = false) - @Convert(converter = DateToUTCConverter.class) - private Date modified; - - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "\"CreationUser\"", nullable = true) - private UserEntity creationUser; - - - public UUID getId() { - return id; - } - public void setId(UUID id) { - this.id = id; - } - - public String getLabel() { - return label; - } - public void setLabel(String label) { - this.label = label; - } - - public String getAbbreviation() { - return abbreviation; - } - public void setAbbreviation(String abbreviation) { - this.abbreviation = abbreviation; - } - - public String getReference() { - return reference; - } - public void setReference(String reference) { - this.reference = reference; - } - - public Date getCreated() { - return created; - } - public void setCreated(Date created) { - this.created = created; - } - - public Date getModified() { - return modified; - } - public void setModified(Date modified) { - this.modified = modified; - } - - public UserEntity getCreationUser() { - return creationUser; - } - public void setCreationUser(UserEntity creationUser) { - this.creationUser = creationUser; - } - - @Override - public void update(ExternalDataset entity) { - this.label = entity.getLabel(); - this.abbreviation = entity.getAbbreviation(); - this.modified = new Date(); - this.creationUser = entity.getCreationUser(); - } - - @Override - public UUID getKeys() { - return this.id; - } - - @Override - public ExternalDataset buildFromTuple(List tuple, List fields, String base) { - String currentBase = base.isEmpty() ? "" : base + "."; - if (fields.contains(currentBase + "id")) this.id = EntityBinder.fromTuple(tuple, currentBase + "id"); - return this; - } -} diff --git a/dmp-backend/core/src/main/java/eu/eudat/data/old/Funder.java b/dmp-backend/core/src/main/java/eu/eudat/data/old/Funder.java deleted file mode 100644 index 0119da5eb..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/data/old/Funder.java +++ /dev/null @@ -1,183 +0,0 @@ -package eu.eudat.data.old; - -import eu.eudat.data.UserEntity; -import eu.eudat.data.old.queryableentity.DataEntity; - -import jakarta.persistence.*; -import java.util.Date; -import java.util.List; -import java.util.UUID; - -@Entity -@Table(name = "\"Funder\"") -public class Funder implements DataEntity { - - public enum Status { - ACTIVE((short) 1), INACTIVE((short) 0), DELETED((short) 99); - - private short value; - - Status(short value) { - this.value = value; - } - - public short getValue() { - return value; - } - - public static Status fromInteger(int value) { - switch (value) { - case 0: - return INACTIVE; - case 1: - return ACTIVE; - case 99: - return DELETED; - default: - throw new RuntimeException("Unsupported Funder Status"); - } - } - } - - public enum FunderType { - EXTERNAL(0), INTERNAL(1); - - private Integer value; - - FunderType(Integer value) { - this.value = value; - } - - public Integer getValue() { - return value; - } - - public static FunderType fromInteger(int value) { - switch (value) { - case 0: - return EXTERNAL; - case 1: - return INTERNAL; - default: - throw new RuntimeException("Unsupported Grant Type"); - } - } - } - - @Id - //@GeneratedValue - //@GenericGenerator(name = "uuid2", strategy = "uuid2") - @Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)") - private UUID id; - - @Column(name = "\"Label\"") - private String label; - - @Column(name = "\"Reference\"", nullable = true) - private String reference; - - @Column(name = "\"Definition\"", nullable = true) - private String definition; - - @Column(name = "\"Status\"", nullable = false) - private Short status; - - @Column(name = "\"Created\"") - private Date created = null; - - @Column(name = "\"Modified\"") - private Date modified = new Date(); - - @Column(name = "\"Type\"") - private Integer type; - - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "\"CreationUser\"", nullable = true) - private UserEntity creationUser; - - - public UUID getId() { - return id; - } - public void setId(UUID id) { - this.id = id; - } - - public String getLabel() { - return label; - } - public void setLabel(String label) { - this.label = label; - } - - public String getReference() { - return reference; - } - public void setReference(String reference) { - this.reference = reference; - } - - public String getDefinition() { - return definition; - } - public void setDefinition(String definition) { - this.definition = definition; - } - - public Short getStatus() { - return status; - } - public void setStatus(Short status) { - this.status = status; - } - - public Date getCreated() { - return created; - } - public void setCreated(Date created) { - this.created = created; - } - - public Date getModified() { - return modified; - } - public void setModified(Date modified) { - this.modified = modified; - } - - public Integer getType() { - return type; - } - public void setType(Integer type) { - this.type = type; - } - - public UserEntity getCreationUser() { - return creationUser; - } - public void setCreationUser(UserEntity creationUser) { - this.creationUser = creationUser; - } - - @Override - public void update(Funder entity) { - this.label = entity.getLabel(); - this.reference = entity.getReference(); - this.definition = entity.getDefinition(); - this.status = entity.getStatus(); - this.created = entity.getCreated(); - this.modified = new Date(); - this.type = entity.getType(); - this.creationUser = entity.getCreationUser(); - } - - @Override - public UUID getKeys() { - return this.id; - } - - @Override - public Funder buildFromTuple(List tuple, List fields, String base) { - return null; - } -} diff --git a/dmp-backend/core/src/main/java/eu/eudat/data/old/Grant.java b/dmp-backend/core/src/main/java/eu/eudat/data/old/Grant.java deleted file mode 100644 index 78ddc52aa..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/data/old/Grant.java +++ /dev/null @@ -1,299 +0,0 @@ -package eu.eudat.data.old; - - -import eu.eudat.data.UserEntity; -import eu.eudat.data.converters.DateToUTCConverter; -import eu.eudat.data.old.helpers.EntityBinder; -import eu.eudat.data.old.queryableentity.DataEntity; - -import jakarta.persistence.*; -import java.util.*; -import java.util.stream.Collectors; - - -@Entity -@Table(name = "\"Grant\"") -//@NamedEntityGraphs({ -// @NamedEntityGraph( -// name = "grantRecentActivity", -// attributeNodes = {@NamedAttributeNode(value = "dmps", subgraph = "dmps")}, -// subgraphs = @NamedSubgraph(name = "dmps", attributeNodes = {@NamedAttributeNode("users")}) -// ), -// @NamedEntityGraph( -// name = "grantListingItem", -// attributeNodes = {@NamedAttributeNode(value = "dmps", subgraph = "dmps"), @NamedAttributeNode(value = "content")}, -// subgraphs = @NamedSubgraph(name = "dmps", attributeNodes = {@NamedAttributeNode("creator"), @NamedAttributeNode("grant"), @NamedAttributeNode("users")}) -// ) -//}) -public class Grant implements DataEntity { - - public enum Status { - ACTIVE((short) 1), INACTIVE((short) 0), DELETED((short) 99); - - private short value; - - private Status(short value) { - this.value = value; - } - - public short getValue() { - return value; - } - - public static Status fromInteger(int value) { - switch (value) { - case 0: - return INACTIVE; - case 1: - return ACTIVE; - case 99: - return DELETED; - default: - throw new RuntimeException("Unsupported Grant Status"); - } - } - } - - public enum GrantType { - EXTERNAL(0), INTERNAL(1); - - private Integer value; - - private GrantType(Integer value) { - this.value = value; - } - - public Integer getValue() { - return value; - } - - public static GrantType fromInteger(int value) { - switch (value) { - case 0: - return EXTERNAL; - case 1: - return INTERNAL; - default: - throw new RuntimeException("Unsupported Grant Type"); - } - } - } - - @Id - //@GeneratedValue - //@GenericGenerator(name = "uuid2", strategy = "uuid2") - @Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)") - private UUID id; - - -// @OneToMany(mappedBy = "grant") -// private Set dmps; - - @Column(name = "\"Label\"") - private String label; - - @Column(name = "\"Abbreviation\"") - private String abbreviation; - - @Column(name = "\"Reference\"", columnDefinition = "xml", nullable = true) - private String reference; - - @Column(name = "\"Uri\"") - private String uri; - - @Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true) - private String definition; - - @Column(name = "\"StartDate\"", nullable = true) - @Convert(converter = DateToUTCConverter.class) - private Date startdate = null; - - @Column(name = "\"EndDate\"", nullable = true) - @Convert(converter = DateToUTCConverter.class) - private Date enddate = null; - - @Column(name = "\"Status\"", nullable = false) - private Short status; - - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "\"CreationUser\"", nullable = true) - private UserEntity creationUser; - - @Column(name = "\"Created\"") - private Date created = null; - - @Column(name = "\"Modified\"") - private Date modified = new Date(); - - @Column(name = "\"Description\"") - private String description; - - @Column(name = "\"Type\"") - private Integer type; - - @OneToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "\"Content\"") - private Content content; - - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "\"Funder\"") - private Funder funder; - - public Grant() { - } - - public Grant(Grant grant) { - this.id = grant.getId(); - } - - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - - public Short getStatus() { - return status; - } - public void setStatus(Short status) { - this.status = status; - } - - public Date getCreated() { - return created; - } - public void setCreated(Date created) { - this.created = created; - } - - public Date getModified() { - return modified; - } - public void setModified(Date modified) { - this.modified = modified; - } - - public Date getStartdate() { - return startdate; - } - public void setStartdate(Date startdate) { - this.startdate = startdate; - } - - public Date getEnddate() { - return enddate; - } - public void setEnddate(Date enddate) { - this.enddate = enddate; - } - - public UUID getId() { - return id; - } - public void setId(UUID id) { - this.id = id; - } - - public String getLabel() { - return label; - } - public void setLabel(String label) { - this.label = label; - } - - public String getAbbreviation() { - return abbreviation; - } - public void setAbbreviation(String abbreviation) { - this.abbreviation = abbreviation; - } - - public String getReference() { - return reference; - } - public void setReference(String reference) { - this.reference = reference; - } - - public String getUri() { - return uri; - } - public void setUri(String uri) { - this.uri = uri; - } - - public String getDefinition() { - return definition; - } - public void setDefinition(String definition) { - this.definition = definition; - } - -// public Set getDmps() { -// return dmps; -// } -// public void setDmps(Set dmps) { -// this.dmps = dmps; -// } - - public UserEntity getCreationUser() { - return creationUser; - } - public void setCreationUser(UserEntity creationUser) { - this.creationUser = creationUser; - } - - public Integer getType() { - return type; - } - public void setType(Integer type) { - this.type = type; - } - - public Content getContent() { - return content; - } - public void setContent(Content content) { - this.content = content; - } - - public Funder getFunder() { - return funder; - } - public void setFunder(Funder funder) { - this.funder = funder; - } - - @Override - public void update(Grant entity) { - this.description = entity.getDescription(); - this.label = entity.getLabel(); - this.abbreviation = entity.getAbbreviation(); - this.created = entity.getCreated(); - this.definition = entity.getDefinition(); -// this.dmps = entity.getDmps(); - this.startdate = entity.getStartdate(); - this.enddate = entity.getEnddate(); - this.modified = new Date(); - this.uri = entity.getUri(); - this.funder = entity.getFunder(); - if (entity.getContent() != null) this.content = entity.getContent(); - } - - @Override - public UUID getKeys() { - return this.id; - } - - @Override - public Grant buildFromTuple(List tuple, List fields, String base) { - String currentBase = base.isEmpty() ? "" : base + "."; - if (fields.contains(currentBase + "id")) this.id = EntityBinder.fromTuple(tuple, currentBase + "id"); -// if (fields.contains(currentBase + "dmps")) -// this.dmps = tuple.stream().map(x -> new DMP().buildFromTuple(Arrays.asList(x), fields, currentBase + "dmps")).collect(Collectors.toSet()); -// if (fields.contains(currentBase + "creationUser")) -// this.creationUser = tuple.stream().map(x -> new UserEntity().buildFromTuple(Arrays.asList(x), fields, currentBase + "creationUser")).collect(Collectors.toList()).get(0); - return this; - } -} diff --git a/dmp-backend/core/src/main/java/eu/eudat/data/old/Organisation.java b/dmp-backend/core/src/main/java/eu/eudat/data/old/Organisation.java deleted file mode 100644 index db364f406..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/data/old/Organisation.java +++ /dev/null @@ -1,149 +0,0 @@ -package eu.eudat.data.old; - -import eu.eudat.data.converters.DateToUTCConverter; -import eu.eudat.data.old.helpers.EntityBinder; -import eu.eudat.data.old.queryableentity.DataEntity; - -import jakarta.persistence.*; -import java.io.Serializable; -import java.util.Date; -import java.util.List; -import java.util.Set; -import java.util.UUID; - -@Entity -//@Table(name = "\"Organisation\"") -//@NamedEntityGraphs({ -// @NamedEntityGraph( -// name = "organisationRecentActivity", -// attributeNodes = {@NamedAttributeNode(value = "dmps")} -// ) -//}) -public class Organisation implements Serializable, DataEntity { - - @Id - @GeneratedValue - @Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)") - private UUID id; - - @Column(name = "\"Label\"") - private String label; - - @Column(name = "\"Abbreviation\"") - private String abbreviation; - - @Column(name = "\"Reference\"", nullable = true) - private String reference; - - @Column(name = "\"Uri\"") - private String uri; - - @Column(name = "\"Definition\"", nullable = true) - private String definition; - -// @OneToMany(fetch = FetchType.LAZY) -// @JoinTable(name = "\"DMPOrganisation\"", -// joinColumns = {@JoinColumn(name = "\"Organisation\"", referencedColumnName = "\"ID\"")}, -// inverseJoinColumns = {@JoinColumn(name = "\"DMP\"", referencedColumnName = "\"ID\"")} -// ) -// private Set dmps; - - @Column(name = "\"Status\"", nullable = false) - private Short status; - - @Column(name = "\"Created\"") - @Convert(converter = DateToUTCConverter.class) - private Date created = null; - - @Column(name = "\"Modified\"") - @Convert(converter = DateToUTCConverter.class) - private Date modified = new Date(); - - - public Short getStatus() { - return status; - } - public void setStatus(Short status) { - this.status = status; - } - - public Date getCreated() { - return created; - } - public void setCreated(Date created) { - this.created = created; - } - - public Date getModified() { - return modified; - } - public void setModified(Date modified) { - this.modified = modified; - } - - public UUID getId() { - return id; - } - public void setId(UUID id) { - this.id = id; - } - - public String getLabel() { - return label; - } - public void setLabel(String label) { - this.label = label; - } - - public String getAbbreviation() { - return abbreviation; - } - public void setAbbreviation(String abbreviation) { - this.abbreviation = abbreviation; - } - - public String getReference() { - return reference; - } - public void setReference(String reference) { - this.reference = reference; - } - - public String getUri() { - return uri; - } - public void setUri(String uri) { - this.uri = uri; - } - - public String getDefinition() { - return definition; - } - public void setDefinition(String definition) { - this.definition = definition; - } - -// public Set getDmps() { -// return dmps; -// } -// public void setDmps(Set dmps) { -// this.dmps = dmps; -// } - - @Override - public void update(Organisation entity) { - - } - - @Override - public UUID getKeys() { - return this.id; - } - - @Override - public Organisation buildFromTuple(List tuple,List fields, String base) { - String currentBase = base.isEmpty() ? "" : base + "."; - if (fields.contains(currentBase + "id")) this.id = EntityBinder.fromTuple(tuple, currentBase + "id"); - return this; - } -} diff --git a/dmp-backend/core/src/main/java/eu/eudat/data/old/Project.java b/dmp-backend/core/src/main/java/eu/eudat/data/old/Project.java deleted file mode 100644 index 5d765c9eb..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/data/old/Project.java +++ /dev/null @@ -1,289 +0,0 @@ -package eu.eudat.data.old; - -import eu.eudat.data.UserEntity; -import eu.eudat.data.converters.DateToUTCConverter; -import eu.eudat.data.old.helpers.EntityBinder; -import eu.eudat.data.old.queryableentity.DataEntity; - -import jakarta.persistence.*; -import java.util.*; -import java.util.stream.Collectors; - -@Entity -@Table(name = "\"Project\"") -public class Project implements DataEntity { - - public enum Status { - ACTIVE((short) 1), INACTIVE((short) 0), DELETED((short) 99); - - private short value; - - Status(short value) { - this.value = value; - } - - public short getValue() { - return value; - } - - public static Status fromInteger(int value) { - switch (value) { - case 0: - return INACTIVE; - case 1: - return ACTIVE; - case 99: - return DELETED; - default: - throw new RuntimeException("Unsupported Project Status"); - } - } - } - - public enum ProjectType { - EXTERNAL(0), INTERNAL(1); - - private Integer value; - - ProjectType(Integer value) { - this.value = value; - } - - public Integer getValue() { - return value; - } - - public static ProjectType fromInteger(int value) { - switch (value) { - case 0: - return EXTERNAL; - case 1: - return INTERNAL; - default: - throw new RuntimeException("Unsupported Project Type"); - } - } - } - - @Id - //@GeneratedValue - //@GenericGenerator(name = "uuid2", strategy = "uuid2") - @Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)") - private UUID id; - -// @OneToMany(mappedBy = "project") -// private Set dmps; - - @Column(name = "\"Label\"") - private String label; - - @Column(name = "\"Abbreviation\"") - private String abbreviation; - - @Column(name = "\"Reference\"", nullable = true) - private String reference; - - @Column(name = "\"Uri\"") - private String uri; - - @Column(name = "\"Definition\"", nullable = true) - private String definition; - - @Column(name = "\"StartDate\"", nullable = false) - @Convert(converter = DateToUTCConverter.class) - private Date startdate = null; - - @Column(name = "\"EndDate\"", nullable = false) - @Convert(converter = DateToUTCConverter.class) - private Date enddate = null; - - @Column(name = "\"Status\"", nullable = false) - private Short status; - - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "\"CreationUser\"", nullable = true) - private UserEntity creationUser; - - @Column(name = "\"Created\"") - private Date created = null; - - @Column(name = "\"Modified\"") - private Date modified = new Date(); - - @Column(name = "\"Description\"") - private String description; - - @Column(name = "\"Type\"") - private Integer type; - - @OneToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "\"Content\"") - private Content content; - - public Project() { - } - - public Project(Project project) {this.id = project.getId();} - - public UUID getId() { - return id; - } - public void setId(UUID id) { - this.id = id; - } - -// public Set getDmps() { -// return dmps; -// } -// public void setDmps(Set dmps) { -// this.dmps = dmps; -// } - - public String getLabel() { - return label; - } - public void setLabel(String label) { - this.label = label; - } - - public String getAbbreviation() { - return abbreviation; - } - public void setAbbreviation(String abbreviation) { - this.abbreviation = abbreviation; - } - - public String getReference() { - return reference; - } - public void setReference(String reference) { - this.reference = reference; - } - - public String getUri() { - return uri; - } - public void setUri(String uri) { - this.uri = uri; - } - - public String getDefinition() { - return definition; - } - public void setDefinition(String definition) { - this.definition = definition; - } - - public Date getStartdate() { - return startdate; - } - public void setStartdate(Date startdate) { - this.startdate = startdate; - } - - public Date getEnddate() { - return enddate; - } - public void setEnddate(Date enddate) { - this.enddate = enddate; - } - - public Short getStatus() { - return status; - } - public void setStatus(Short status) { - this.status = status; - } - - public UserEntity getCreationUser() { - return creationUser; - } - public void setCreationUser(UserEntity creationUser) { - this.creationUser = creationUser; - } - - public Date getCreated() { - return created; - } - public void setCreated(Date created) { - this.created = created; - } - - public Date getModified() { - return modified; - } - public void setModified(Date modified) { - this.modified = modified; - } - - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - - public Integer getType() { - return type; - } - public void setType(Integer type) { - this.type = type; - } - - public Content getContent() { - return content; - } - public void setContent(Content content) { - this.content = content; - } - - @Override - public void update(Project entity) { - this.description = entity.getDescription(); - this.label = entity.getLabel(); - this.abbreviation = entity.getAbbreviation(); - this.created = entity.getCreated(); - this.definition = entity.getDefinition(); -// this.dmps = entity.getDmps(); - this.startdate = entity.getStartdate(); - this.enddate = entity.getEnddate(); - this.modified = new Date(); - this.uri = entity.getUri(); - if (entity.getContent() != null) this.content = entity.getContent(); - } - - public Project projectFromGrant(Grant grant) { - Project project = new Project(); - project.setDescription(grant.getDescription()); - project.setLabel(grant.getLabel()); - project.setAbbreviation(grant.getAbbreviation()); - project.setCreated(new Date()); - project.setDefinition(grant.getDefinition()); -// project.setDmps(grant.getDmps()); - project.setStartdate(grant.getStartdate()); - project.setEnddate(grant.getEnddate()); - project.setModified(new Date()); - project.setUri(grant.getUri()); - project.setContent(grant.getContent()); - project.setReference(grant.getReference()); - project.setStatus(grant.getStatus()); - - return project; - } - - @Override - public UUID getKeys() { - return this.id; - } - - @Override - public Project buildFromTuple(List tuple, List fields, String base) { - String currentBase = base.isEmpty() ? "" : base + "."; - if (fields.contains(currentBase + "id")) this.id = EntityBinder.fromTuple(tuple, currentBase + "id"); -// if (fields.contains(currentBase + "dmps")) -// this.dmps = tuple.stream().map(x -> new DMP().buildFromTuple(Arrays.asList(x), fields, currentBase + "dmps")).collect(Collectors.toSet()); -// if (fields.contains(currentBase + "creationUser")) -// this.creationUser = tuple.stream().map(x -> new UserEntity().buildFromTuple(Arrays.asList(x), fields, currentBase + "creationUser")).collect(Collectors.toList()).get(0); - return this; - } -} diff --git a/dmp-backend/core/src/main/java/eu/eudat/data/old/Registry.java b/dmp-backend/core/src/main/java/eu/eudat/data/old/Registry.java deleted file mode 100644 index 15614a495..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/data/old/Registry.java +++ /dev/null @@ -1,154 +0,0 @@ -package eu.eudat.data.old; - - -import eu.eudat.data.DescriptionEntity; -import eu.eudat.data.UserEntity; -import eu.eudat.data.converters.DateToUTCConverter; -import eu.eudat.data.old.helpers.EntityBinder; -import eu.eudat.data.old.queryableentity.DataEntity; - -import jakarta.persistence.*; -import java.util.Date; -import java.util.List; -import java.util.Set; -import java.util.UUID; - - -@Entity -@Table(name = "\"Registry\"") -public class Registry implements DataEntity { - - @Id - @Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)") - private UUID id; - - @Column(name = "\"Label\"") - private String label; - - @Column(name = "\"Abbreviation\"") - private String abbreviation; - - @Column(name = "\"Reference\"", nullable = true) - private String reference; - - @Column(name = "\"Uri\"") - private String uri; - - @Column(name = "\"Definition\"", nullable = true) - private String definition; - - @Transient - private Set descriptionEntities; - - @Column(name = "\"Status\"", nullable = false) - private Short status; - - @Column(name = "\"Created\"") - @Convert(converter = DateToUTCConverter.class) - private Date created = null; - - @Column(name = "\"Modified\"") - @Convert(converter = DateToUTCConverter.class) - private Date modified = new Date(); - - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "\"CreationUser\"", nullable = true) - private UserEntity creationUser; - - - public Short getStatus() { - return status; - } - public void setStatus(Short status) { - this.status = status; - } - - public Date getCreated() { - return created; - } - public void setCreated(Date created) { - this.created = created; - } - - public Date getModified() { - return modified; - } - public void setModified(Date modified) { - this.modified = modified; - } - - public UUID getId() { - return id; - } - public void setId(UUID id) { - this.id = id; - } - - public String getLabel() { - return label; - } - public void setLabel(String label) { - this.label = label; - } - - public String getAbbreviation() { - return abbreviation; - } - public void setAbbreviation(String abbreviation) { - this.abbreviation = abbreviation; - } - - public String getReference() { - return reference; - } - public void setReference(String reference) { - this.reference = reference; - } - - public String getUri() { - return uri; - } - public void setUri(String uri) { - this.uri = uri; - } - - public String getDefinition() { - return definition; - } - public void setDefinition(String definition) { - this.definition = definition; - } - - public Set getDatasets() { - return descriptionEntities; - } - public void setDatasets(Set descriptionEntities) { - this.descriptionEntities = descriptionEntities; - } - - public UserEntity getCreationUser() { - return creationUser; - } - public void setCreationUser(UserEntity creationUser) { - this.creationUser = creationUser; - } - - @Override - public void update(Registry entity) { - this.label = entity.getLabel(); - this.abbreviation = entity.getAbbreviation(); - this.uri = entity.getUri(); - } - - @Override - public UUID getKeys() { - return this.id; - } - - @Override - public Registry buildFromTuple(List tuple, List fields, String base) { - String currentBase = base.isEmpty() ? "" : base + "."; - if (fields.contains(currentBase + "id")) this.id = EntityBinder.fromTuple(tuple, currentBase + "id"); - return this; - } -} diff --git a/dmp-backend/core/src/main/java/eu/eudat/data/old/Researcher.java b/dmp-backend/core/src/main/java/eu/eudat/data/old/Researcher.java deleted file mode 100644 index 88a94f094..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/data/old/Researcher.java +++ /dev/null @@ -1,156 +0,0 @@ -package eu.eudat.data.old; - - -import eu.eudat.data.UserEntity; -import eu.eudat.data.converters.DateToUTCConverter; -import eu.eudat.data.old.helpers.EntityBinder; -import eu.eudat.data.old.queryableentity.DataEntity; - -import jakarta.persistence.*; -import java.util.Date; -import java.util.List; -import java.util.UUID; - - -@Entity -@Table(name = "\"Researcher\"") -public class Researcher implements DataEntity { - - @Id - @Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)") - private UUID id; - - @Column(name = "\"Label\"", nullable = false, length = 250) - private String label; - - @Column(name = "\"Uri\"") - private String uri; - - @Column(name = "\"PrimaryEmail\"") - private String primaryEmail; - - @Column(name = "\"Definition\"", nullable = true) - private String definition; - - @Column(name = "\"Reference\"", nullable = true) - private String reference; - - -// @OneToMany(fetch = FetchType.LAZY) -// @JoinTable(name = "\"DMPResearcher\"", -// joinColumns = {@JoinColumn(name = "\"Researcher\"", referencedColumnName = "\"ID\"")}, -// inverseJoinColumns = {@JoinColumn(name = "\"DMP\"", referencedColumnName = "\"ID\"")} -// ) -// private Set dMPs; - - - @Column(name = "\"Status\"", nullable = false) - private Short status; - - - @Column(name = "\"Created\"") - @Convert(converter = DateToUTCConverter.class) - private Date created = null; - - @Column(name = "\"Modified\"") - @Convert(converter = DateToUTCConverter.class) - private Date modified = new Date(); - - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "\"CreationUser\"", nullable = true) - private UserEntity creationUser; - - public Short getStatus() { - return status; - } - public void setStatus(Short status) { - this.status = status; - } - - public Date getCreated() { - return created; - } - public void setCreated(Date created) { - this.created = created; - } - - public Date getModified() { - return modified; - } - public void setModified(Date modified) { - this.modified = modified; - } - - public UUID getId() { - return id; - } - public void setId(UUID id) { - this.id = id; - } - - public String getLabel() { - return label; - } - public void setLabel(String label) { - this.label = label; - } - - public String getPrimaryEmail() { - return primaryEmail; - } - public void setPrimaryEmail(String primaryEmail) { - this.primaryEmail = primaryEmail; - } - - public String getReference() { - return reference; - } - public void setReference(String reference) { - this.reference = reference; - } - - public String getUri() { - return uri; - } - public void setUri(String uri) { - this.uri = uri; - } - - public String getDefinition() { - return definition; - } - public void setDefinition(String definition) { - this.definition = definition; - } - -// public Set getdMPs() { -// return dMPs; -// } -// public void setdMPs(Set dMPs) { -// this.dMPs = dMPs; -// } - - public UserEntity getCreationUser() { - return creationUser; - } - public void setCreationUser(UserEntity creationUser) { - this.creationUser = creationUser; - } - - @Override - public void update(Researcher entity) { - - } - - @Override - public UUID getKeys() { - return this.id; - } - - @Override - public Researcher buildFromTuple(List tuple, List fields, String base) { - String currentBase = base.isEmpty() ? "" : base + "."; - if (fields.contains(currentBase + "id")) this.id = EntityBinder.fromTuple(tuple, currentBase + "id"); - return this; - } -} diff --git a/dmp-backend/core/src/main/java/eu/eudat/data/old/Service.java b/dmp-backend/core/src/main/java/eu/eudat/data/old/Service.java deleted file mode 100644 index 066b34054..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/data/old/Service.java +++ /dev/null @@ -1,141 +0,0 @@ -package eu.eudat.data.old; - - -import eu.eudat.data.UserEntity; -import eu.eudat.data.converters.DateToUTCConverter; -import eu.eudat.data.old.queryableentity.DataEntity; - -import jakarta.persistence.*; -import java.util.Date; -import java.util.List; -import java.util.UUID; - - -@Entity -@Table(name = "\"Service\"") -public class Service implements DataEntity { - - @Id - @Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)") - private UUID id; - - @Column(name = "\"Label\"") - private String label; - - @Column(name = "\"Abbreviation\"") - private String abbreviation; - - @Column(name = "\"Reference\"", nullable = true) - private String reference; - - @Column(name = "\"Uri\"") - private String uri; - - @Column(name = "\"Definition\"", nullable = false) - private String definition; - - @Column(name = "\"Status\"", nullable = false) - private Short status; - - @Column(name = "\"Created\"") - @Convert(converter = DateToUTCConverter.class) - private Date created = null; - - @Column(name = "\"Modified\"") - @Convert(converter = DateToUTCConverter.class) - private Date modified = new Date(); - - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "\"CreationUser\"", nullable = true) - private UserEntity creationUser; - - - public Short getStatus() { - return status; - } - public void setStatus(Short status) { - this.status = status; - } - - public Date getCreated() { - return created; - } - public void setCreated(Date created) { - this.created = created; - } - - public Date getModified() { - return modified; - } - public void setModified(Date modified) { - this.modified = modified; - } - - public UUID getId() { - return id; - } - public void setId(UUID id) { - this.id = id; - } - - public String getLabel() { - return label; - } - public void setLabel(String label) { - this.label = label; - } - - public String getAbbreviation() { - return abbreviation; - } - public void setAbbreviation(String abbreviation) { - this.abbreviation = abbreviation; - } - - public String getReference() { - return reference; - } - public void setReference(String reference) { - this.reference = reference; - } - - public String getUri() { - return uri; - } - public void setUri(String uri) { - this.uri = uri; - } - - public String getDefinition() { - return definition; - } - public void setDefinition(String definition) { - this.definition = definition; - } - - public UserEntity getCreationUser() { - return creationUser; - } - public void setCreationUser(UserEntity creationUser) { - this.creationUser = creationUser; - } - - @Override - public void update(Service entity) { - this.label = entity.getLabel(); - this.abbreviation = entity.getAbbreviation(); - this.uri = entity.getUri(); - } - - @Override - public UUID getKeys() { - return this.id; - } - - @Override - public Service buildFromTuple(List tuple, List fields, String base) { - String currentBase = base.isEmpty() ? "" : base + "."; - if (fields.contains(currentBase + "id")) this.id = UUID.fromString((String) tuple.get(0).get(currentBase + "id")); - return this; - } -} diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/publicapi/datasetwizard/DataRepositoryPublicModel.java b/dmp-backend/core/src/main/java/eu/eudat/model/publicapi/datasetwizard/DataRepositoryPublicModel.java index 1ac49e0fe..29c146c8d 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/publicapi/datasetwizard/DataRepositoryPublicModel.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/publicapi/datasetwizard/DataRepositoryPublicModel.java @@ -1,7 +1,6 @@ package eu.eudat.model.publicapi.datasetwizard; import eu.eudat.commons.enums.ReferenceType; -import eu.eudat.data.old.DataRepository; import eu.eudat.model.DescriptionReference; import eu.eudat.model.Reference; import eu.eudat.model.referencedefinition.Field; diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/publicapi/datasetwizard/ExternalDatasetPublicListingModel.java b/dmp-backend/core/src/main/java/eu/eudat/model/publicapi/datasetwizard/ExternalDatasetPublicListingModel.java index fcce9cc58..9ab04c895 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/publicapi/datasetwizard/ExternalDatasetPublicListingModel.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/publicapi/datasetwizard/ExternalDatasetPublicListingModel.java @@ -1,7 +1,6 @@ package eu.eudat.model.publicapi.datasetwizard; import eu.eudat.commons.enums.ReferenceType; -import eu.eudat.data.old.ExternalDataset; import eu.eudat.model.DescriptionReference; import eu.eudat.model.Reference; import eu.eudat.model.referencedefinition.Field; diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/publicapi/datasetwizard/RegistryPublicModel.java b/dmp-backend/core/src/main/java/eu/eudat/model/publicapi/datasetwizard/RegistryPublicModel.java index ed008fd16..521a3a8cf 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/publicapi/datasetwizard/RegistryPublicModel.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/publicapi/datasetwizard/RegistryPublicModel.java @@ -1,7 +1,6 @@ package eu.eudat.model.publicapi.datasetwizard; import eu.eudat.commons.enums.ReferenceType; -import eu.eudat.data.old.Registry; import eu.eudat.model.DescriptionReference; import eu.eudat.model.Reference; import eu.eudat.model.referencedefinition.Field; diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/publicapi/datasetwizard/ServicePublicModel.java b/dmp-backend/core/src/main/java/eu/eudat/model/publicapi/datasetwizard/ServicePublicModel.java index 2d92287c5..20564d363 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/publicapi/datasetwizard/ServicePublicModel.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/publicapi/datasetwizard/ServicePublicModel.java @@ -1,7 +1,6 @@ package eu.eudat.model.publicapi.datasetwizard; import eu.eudat.commons.enums.ReferenceType; -import eu.eudat.data.old.Service; import eu.eudat.model.DescriptionReference; import eu.eudat.model.Reference; import eu.eudat.model.referencedefinition.Field; diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/publicapi/funder/FunderPublicOverviewModel.java b/dmp-backend/core/src/main/java/eu/eudat/model/publicapi/funder/FunderPublicOverviewModel.java index 0ed6d1a7f..0ff6a11db 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/publicapi/funder/FunderPublicOverviewModel.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/publicapi/funder/FunderPublicOverviewModel.java @@ -1,7 +1,5 @@ package eu.eudat.model.publicapi.funder; -import eu.eudat.data.old.Funder; - import java.util.UUID; public class FunderPublicOverviewModel { @@ -22,15 +20,15 @@ public class FunderPublicOverviewModel { this.label = label; } - public FunderPublicOverviewModel fromDataModel(Funder entity) { - this.id = entity.getId(); - this.label = entity.getLabel(); - return this; - } - - public Funder toDataModel() throws Exception { - return null; - } +// public FunderPublicOverviewModel fromDataModel(Funder entity) { +// this.id = entity.getId(); +// this.label = entity.getLabel(); +// return this; +// } +// +// public Funder toDataModel() throws Exception { +// return null; +// } public String getHint() { return null; diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/publicapi/grant/GrantPublicOverviewModel.java b/dmp-backend/core/src/main/java/eu/eudat/model/publicapi/grant/GrantPublicOverviewModel.java index 1566bec26..fb90d86a5 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/publicapi/grant/GrantPublicOverviewModel.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/publicapi/grant/GrantPublicOverviewModel.java @@ -1,7 +1,6 @@ package eu.eudat.model.publicapi.grant; import eu.eudat.commons.enums.ReferenceType; -import eu.eudat.data.old.Grant; import eu.eudat.model.DescriptionReference; import eu.eudat.model.DmpReference; import eu.eudat.model.Reference; diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DataManagementPlanCriteria.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DataManagementPlanCriteria.java index 348e2a4f4..3061a5639 100644 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DataManagementPlanCriteria.java +++ b/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DataManagementPlanCriteria.java @@ -2,7 +2,6 @@ package eu.eudat.data.dao.criteria; import eu.eudat.data.DmpBlueprintEntity; import eu.eudat.data.DmpEntity; -import eu.eudat.data.old.Grant; import java.util.Date; import java.util.List; @@ -12,7 +11,6 @@ public class DataManagementPlanCriteria extends Criteria { private Date periodStart; private Date periodEnd; private DmpBlueprintEntity profile; - private List grants; private boolean allVersions; private List groupIds; private Integer status; @@ -46,13 +44,6 @@ public class DataManagementPlanCriteria extends Criteria { this.profile = profile; } - public List getGrants() { - return grants; - } - public void setGrants(List grants) { - this.grants = grants; - } - public boolean getAllVersions() { return allVersions; } diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DataRepositoryCriteria.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DataRepositoryCriteria.java deleted file mode 100644 index e1e9b73e5..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DataRepositoryCriteria.java +++ /dev/null @@ -1,17 +0,0 @@ -package eu.eudat.data.dao.criteria; - -import eu.eudat.data.old.DataRepository; - -import java.util.UUID; - -public class DataRepositoryCriteria extends Criteria { - - private UUID creationUserId; - - public UUID getCreationUserId() { - return creationUserId; - } - public void setCreationUserId(UUID creationUserId) { - this.creationUserId = creationUserId; - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/ExternalDatasetCriteria.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/ExternalDatasetCriteria.java deleted file mode 100644 index 7b5f501a4..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/ExternalDatasetCriteria.java +++ /dev/null @@ -1,15 +0,0 @@ -package eu.eudat.data.dao.criteria; - -import eu.eudat.data.old.ExternalDataset; -import java.util.UUID; - -public class ExternalDatasetCriteria extends Criteria { - private UUID creationUserId; - - public UUID getCreationUserId() { - return creationUserId; - } - public void setCreationUserId(UUID creationUserId) { - this.creationUserId = creationUserId; - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/FunderCriteria.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/FunderCriteria.java deleted file mode 100644 index 52b952170..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/FunderCriteria.java +++ /dev/null @@ -1,34 +0,0 @@ -package eu.eudat.data.dao.criteria; - -import eu.eudat.data.old.Funder; - -import java.util.Date; - -public class FunderCriteria extends Criteria { - private String reference; - private String exactReference; - private Date periodStart; - - public String getReference() { - return reference; - } - public void setReference(String reference) { - this.reference = reference; - } - - public String getExactReference() { - return exactReference; - } - - public void setExactReference(String exactReference) { - this.exactReference = exactReference; - } - - public Date getPeriodStart() { - return periodStart; - } - - public void setPeriodStart(Date periodStart) { - this.periodStart = periodStart; - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/GrantCriteria.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/GrantCriteria.java deleted file mode 100644 index 1b0996b67..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/GrantCriteria.java +++ /dev/null @@ -1,82 +0,0 @@ -package eu.eudat.data.dao.criteria; - -import eu.eudat.data.old.Grant; - -import java.util.Date; - -public class GrantCriteria extends Criteria { - private Date periodStart; - private Date periodEnd; - private String reference; - private Integer grantStateType; - private boolean isPublic; - private String funderId; - private String funderReference; - private String exactReference; - private boolean isActive; - - public Date getPeriodStart() { - return periodStart; - } - public void setPeriodStart(Date periodStart) { - this.periodStart = periodStart; - } - - public Date getPeriodEnd() { - return periodEnd; - } - public void setPeriodEnd(Date periodEnd) { - this.periodEnd = periodEnd; - } - - public String getReference() { - return reference; - } - public void setReference(String reference) { - this.reference = reference; - } - - public Integer getGrantStateType() { - return grantStateType; - } - public void setGrantStateType(Integer grantStateType) { - this.grantStateType = grantStateType; - } - - public boolean isPublic() { - return isPublic; - } - public void setPublic(boolean aPublic) { - isPublic = aPublic; - } - - public String getFunderId() { - return funderId; - } - public void setFunderId(String funderId) { - this.funderId = funderId; - } - - public String getFunderReference() { - return funderReference; - } - public void setFunderReference(String funderReference) { - this.funderReference = funderReference; - } - - public String getExactReference() { - return exactReference; - } - - public void setExactReference(String exactReference) { - this.exactReference = exactReference; - } - - public boolean isActive() { - return isActive; - } - - public void setActive(boolean active) { - isActive = active; - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/OrganisationCriteria.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/OrganisationCriteria.java deleted file mode 100644 index 6fa34499e..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/OrganisationCriteria.java +++ /dev/null @@ -1,31 +0,0 @@ -package eu.eudat.data.dao.criteria; - -import eu.eudat.data.old.Organisation; - -public class OrganisationCriteria extends Criteria { - private String labelLike; - private Boolean isPublic; - private boolean isActive; - - public String getLabelLike() { - return labelLike; - } - public void setLabelLike(String labelLike) { - this.labelLike = labelLike; - } - - public Boolean getPublic() { - return isPublic; - } - public void setPublic(Boolean aPublic) { - isPublic = aPublic; - } - - public boolean isActive() { - return isActive; - } - - public void setActive(boolean active) { - isActive = active; - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/ProjectCriteria.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/ProjectCriteria.java deleted file mode 100644 index 61a1d2dfe..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/ProjectCriteria.java +++ /dev/null @@ -1,34 +0,0 @@ -package eu.eudat.data.dao.criteria; - -import eu.eudat.data.old.Project; - -import java.util.Date; - -public class ProjectCriteria extends Criteria { - private String reference; - private String exactReference; - private Date periodStart; - - public String getReference() { - return reference; - } - public void setReference(String reference) { - this.reference = reference; - } - - public String getExactReference() { - return exactReference; - } - - public void setExactReference(String exactReference) { - this.exactReference = exactReference; - } - - public Date getPeriodStart() { - return periodStart; - } - - public void setPeriodStart(Date periodStart) { - this.periodStart = periodStart; - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/RegistryCriteria.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/RegistryCriteria.java deleted file mode 100644 index ccd9dce71..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/RegistryCriteria.java +++ /dev/null @@ -1,17 +0,0 @@ -package eu.eudat.data.dao.criteria; - -import eu.eudat.data.old.Registry; - -import java.util.UUID; - -public class RegistryCriteria extends Criteria { - - private UUID creationUserId; - - public UUID getCreationUserId() { - return creationUserId; - } - public void setCreationUserId(UUID creationUserId) { - this.creationUserId = creationUserId; - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/ResearcherCriteria.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/ResearcherCriteria.java deleted file mode 100644 index f656cced3..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/ResearcherCriteria.java +++ /dev/null @@ -1,35 +0,0 @@ -package eu.eudat.data.dao.criteria; - -import eu.eudat.data.old.Researcher; - -import java.util.Date; - -public class ResearcherCriteria extends Criteria { - private String name; - private String reference; - private Date periodStart; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getReference() { - return reference; - } - - public void setReference(String reference) { - this.reference = reference; - } - - public Date getPeriodStart() { - return periodStart; - } - - public void setPeriodStart(Date periodStart) { - this.periodStart = periodStart; - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/ServiceCriteria.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/ServiceCriteria.java deleted file mode 100644 index 7bf9e277f..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/ServiceCriteria.java +++ /dev/null @@ -1,17 +0,0 @@ -package eu.eudat.data.dao.criteria; - -import eu.eudat.data.old.Service; - -import java.util.UUID; - -public class ServiceCriteria extends Criteria { - - private UUID creationUserId; - - public UUID getCreationUserId() { - return creationUserId; - } - public void setCreationUserId(UUID creationUserId) { - this.creationUserId = creationUserId; - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DMPDaoImpl.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DMPDaoImpl.java index ef89f7afc..dd7dd104e 100644 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DMPDaoImpl.java +++ b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DMPDaoImpl.java @@ -47,8 +47,8 @@ public class DMPDaoImpl extends DatabaseAccess implements DMPDao { query.where((builder, root) -> builder.greaterThan(root.get("created"), criteria.getPeriodStart())); if (criteria.getProfile() != null) query.where((builder, root) -> builder.equal(root.get("profile"), criteria.getProfile())); - if (criteria.getGrants() != null && !criteria.getGrants().isEmpty()) - query.where(((builder, root) -> root.get("grant").in(criteria.getGrants()))); +// if (criteria.getGrants() != null && !criteria.getGrants().isEmpty()) //TODO +// query.where(((builder, root) -> root.get("grant").in(criteria.getGrants()))); if (!criteria.getAllVersions()) query.initSubQuery(String.class).where((builder, root) -> builder.equal(root.get("version"), query.subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.and( diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DataRepositoryDao.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DataRepositoryDao.java deleted file mode 100644 index fc3839342..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DataRepositoryDao.java +++ /dev/null @@ -1,12 +0,0 @@ -package eu.eudat.data.dao.entities; - -import eu.eudat.data.dao.DatabaseAccessLayer; -import eu.eudat.data.dao.criteria.DataRepositoryCriteria; -import eu.eudat.data.old.DataRepository; -import eu.eudat.queryable.QueryableList; - -import java.util.UUID; - -public interface DataRepositoryDao extends DatabaseAccessLayer { - QueryableList getWithCriteria(DataRepositoryCriteria criteria); -} \ No newline at end of file diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DataRepositoryDaoImpl.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DataRepositoryDaoImpl.java deleted file mode 100644 index 7175ed1cb..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/DataRepositoryDaoImpl.java +++ /dev/null @@ -1,66 +0,0 @@ -package eu.eudat.data.dao.entities; - -import eu.eudat.data.dao.DatabaseAccess; -import eu.eudat.data.dao.criteria.DataRepositoryCriteria; -import eu.eudat.data.dao.databaselayer.service.DatabaseService; -import eu.eudat.data.old.DataRepository; -import eu.eudat.queryable.QueryableList; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Async; -import org.springframework.stereotype.Component; - -import javax.management.InvalidApplicationException; -import java.util.UUID; -import java.util.concurrent.CompletableFuture; - -@Component("dataRepositoryDao") -public class DataRepositoryDaoImpl extends DatabaseAccess implements DataRepositoryDao { - - @Autowired - public DataRepositoryDaoImpl(DatabaseService databaseService) { - super(databaseService); - } - - @Override - public QueryableList getWithCriteria(DataRepositoryCriteria criteria) { - QueryableList query = this.getDatabaseService().getQueryable(DataRepository.class); - if (criteria.getLike() != null) - query.where((builder, root) -> builder.or( - builder.like(builder.upper(root.get("reference")), "%" + criteria.getLike().toUpperCase() + "%"), - builder.equal(builder.upper(root.get("label")), criteria.getLike().toUpperCase()))); - if (criteria.getCreationUserId() != null) - query.where((builder, root) -> builder.equal(root.get("creationUser").get("id"), criteria.getCreationUserId())); - return query; - } - - @Override - public DataRepository find(UUID id) throws InvalidApplicationException { - return this.getDatabaseService().getQueryable(DataRepository.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle(); - } - - @Override - public DataRepository createOrUpdate(DataRepository item) { - return getDatabaseService().createOrUpdate(item, DataRepository.class); - } - - @Override - @Async - public CompletableFuture createOrUpdateAsync(DataRepository item) { - return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item)); - } - - @Override - public DataRepository find(UUID id, String hint) { - throw new UnsupportedOperationException(); - } - - @Override - public void delete(DataRepository item) { - this.getDatabaseService().delete(item); - } - - @Override - public QueryableList asQueryable() { - return this.getDatabaseService().getQueryable(DataRepository.class); - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ExternalDatasetDao.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ExternalDatasetDao.java deleted file mode 100644 index be21dc3f6..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ExternalDatasetDao.java +++ /dev/null @@ -1,15 +0,0 @@ -package eu.eudat.data.dao.entities; - -import eu.eudat.data.dao.DatabaseAccessLayer; -import eu.eudat.data.dao.criteria.ExternalDatasetCriteria; -import eu.eudat.data.old.ExternalDataset; -import eu.eudat.queryable.QueryableList; - -import java.util.UUID; - - -public interface ExternalDatasetDao extends DatabaseAccessLayer { - - QueryableList getWithCriteria(ExternalDatasetCriteria criteria); - -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ExternalDatasetDaoImpl.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ExternalDatasetDaoImpl.java deleted file mode 100644 index c90abfc5a..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ExternalDatasetDaoImpl.java +++ /dev/null @@ -1,67 +0,0 @@ -package eu.eudat.data.dao.entities; - -import eu.eudat.data.dao.DatabaseAccess; -import eu.eudat.data.dao.criteria.ExternalDatasetCriteria; -import eu.eudat.data.dao.databaselayer.service.DatabaseService; -import eu.eudat.data.old.ExternalDataset; -import eu.eudat.queryable.QueryableList; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Async; -import org.springframework.stereotype.Component; - -import javax.management.InvalidApplicationException; -import java.util.UUID; -import java.util.concurrent.CompletableFuture; - - -@Component("externalDatasetDao") -public class ExternalDatasetDaoImpl extends DatabaseAccess implements ExternalDatasetDao { - - @Autowired - public ExternalDatasetDaoImpl(DatabaseService databaseService) { - super(databaseService); - } - - @Override - public QueryableList getWithCriteria(ExternalDatasetCriteria criteria) { - QueryableList query = this.getDatabaseService().getQueryable(ExternalDataset.class); - if (criteria.getLike() != null && !criteria.getLike().isEmpty()) - query.where((builder, root) -> builder.or( - builder.like(builder.upper(root.get("reference")), "%" + criteria.getLike().toUpperCase() + "%"), - builder.equal(builder.upper(root.get("label")), criteria.getLike().toUpperCase()))); - if (criteria.getCreationUserId() != null) - query.where((builder, root) -> builder.equal(root.join("creationUser").get("id"), criteria.getCreationUserId())); - return query; - } - - @Override - public ExternalDataset createOrUpdate(ExternalDataset item) { - return this.getDatabaseService().createOrUpdate(item, ExternalDataset.class); - } - - @Override - public ExternalDataset find(UUID id) throws InvalidApplicationException { - return this.getDatabaseService().getQueryable(ExternalDataset.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle(); - } - - @Override - public void delete(ExternalDataset item) { - this.getDatabaseService().delete(item); - } - - @Override - public QueryableList asQueryable() { - return this.getDatabaseService().getQueryable(ExternalDataset.class); - } - - @Async - @Override - public CompletableFuture createOrUpdateAsync(ExternalDataset item) { - return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item)); - } - - @Override - public ExternalDataset find(UUID id, String hint) { - throw new UnsupportedOperationException(); - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/FunderDao.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/FunderDao.java deleted file mode 100644 index f0321f85b..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/FunderDao.java +++ /dev/null @@ -1,16 +0,0 @@ -package eu.eudat.data.dao.entities; - -import eu.eudat.data.dao.DatabaseAccessLayer; -import eu.eudat.data.dao.criteria.FunderCriteria; -import eu.eudat.data.old.Funder; -import eu.eudat.data.UserEntity; -import eu.eudat.queryable.QueryableList; - -import java.util.UUID; - -public interface FunderDao extends DatabaseAccessLayer { - - QueryableList getWithCritetia(FunderCriteria criteria); - - QueryableList getAuthenticated(QueryableList query, UserEntity principal); -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/FunderDaoImpl.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/FunderDaoImpl.java deleted file mode 100644 index 00e0228e4..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/FunderDaoImpl.java +++ /dev/null @@ -1,76 +0,0 @@ -package eu.eudat.data.dao.entities; - -import eu.eudat.data.dao.DatabaseAccess; -import eu.eudat.data.dao.criteria.FunderCriteria; -import eu.eudat.data.dao.databaselayer.service.DatabaseService; -import eu.eudat.data.old.Funder; -import eu.eudat.data.UserEntity; -import eu.eudat.queryable.QueryableList; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import javax.management.InvalidApplicationException; -import java.util.UUID; -import java.util.concurrent.CompletableFuture; - -@Component("funderDao") -public class FunderDaoImpl extends DatabaseAccess implements FunderDao { - - @Autowired - public FunderDaoImpl(DatabaseService databaseService) { - super(databaseService); - } - - @Override - public QueryableList getWithCritetia(FunderCriteria criteria) { - QueryableList query = getDatabaseService().getQueryable(Funder.class); - if (criteria.getLike() != null && !criteria.getLike().isEmpty()) - query.where((builder, root) -> - builder.or(builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"), - builder.or(builder.like(builder.upper(root.get("definition")), "%" + criteria.getLike().toUpperCase() + "%")))); - if (criteria.getReference() != null) - query.where((builder, root) -> builder.like(builder.upper(root.get("reference")), "%" + criteria.getReference().toUpperCase() + "%")); - if (criteria.getExactReference() != null) - query.where((builder, root) -> builder.like(builder.upper(root.get("reference")), criteria.getExactReference().toUpperCase())); - if (criteria.getPeriodStart() != null) - query.where((builder, root) -> builder.greaterThanOrEqualTo(root.get("created"), criteria.getPeriodStart())); - query.where((builder, root) -> builder.notEqual(root.get("status"), Funder.Status.DELETED.getValue())); - return query; - } - - @Override - public QueryableList getAuthenticated(QueryableList query, UserEntity principal) { - query.where((builder, root) -> builder.equal(root.get("creationUser"), principal)); - return query; - } - - @Override - public Funder createOrUpdate(Funder item) { - return this.getDatabaseService().createOrUpdate(item, Funder.class); - } - - @Override - public CompletableFuture createOrUpdateAsync(Funder item) { - return null; - } - - @Override - public Funder find(UUID id) throws InvalidApplicationException { - return this.getDatabaseService().getQueryable(Funder.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle(); - } - - @Override - public Funder find(UUID id, String hint) { - throw new UnsupportedOperationException(); - } - - @Override - public void delete(Funder item) { - throw new UnsupportedOperationException(); - } - - @Override - public QueryableList asQueryable() { - return this.getDatabaseService().getQueryable(Funder.class); - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/GrantDao.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/GrantDao.java deleted file mode 100644 index 25986b2bb..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/GrantDao.java +++ /dev/null @@ -1,17 +0,0 @@ -package eu.eudat.data.dao.entities; - -import eu.eudat.data.dao.DatabaseAccessLayer; -import eu.eudat.data.dao.criteria.GrantCriteria; -import eu.eudat.data.old.Grant; -import eu.eudat.data.UserEntity; -import eu.eudat.queryable.QueryableList; - -import java.util.UUID; - -public interface GrantDao extends DatabaseAccessLayer { - - QueryableList getWithCriteria(GrantCriteria criteria); - - QueryableList getAuthenticated(QueryableList query, UserEntity principal); - -} \ No newline at end of file diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/GrantDaoImpl.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/GrantDaoImpl.java deleted file mode 100644 index 56181a3e5..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/GrantDaoImpl.java +++ /dev/null @@ -1,104 +0,0 @@ -package eu.eudat.data.dao.entities; - -import eu.eudat.commons.enums.DmpStatus; -import eu.eudat.commons.enums.IsActive; -import eu.eudat.data.dao.DatabaseAccess; -import eu.eudat.data.dao.criteria.GrantCriteria; -import eu.eudat.data.dao.databaselayer.service.DatabaseService; -import eu.eudat.data.old.Grant; -import eu.eudat.data.UserEntity; -import eu.eudat.queryable.QueryableList; -import eu.eudat.types.grant.GrantStateType; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Async; -import org.springframework.stereotype.Component; - -import jakarta.persistence.criteria.JoinType; - -import javax.management.InvalidApplicationException; -import java.util.Date; -import java.util.UUID; -import java.util.concurrent.CompletableFuture; - -@Component("grantDao") -public class GrantDaoImpl extends DatabaseAccess implements GrantDao { - - @Autowired - public GrantDaoImpl(DatabaseService databaseService) { - super(databaseService); - } - - @Override - public QueryableList getWithCriteria(GrantCriteria criteria) { - QueryableList query = getDatabaseService().getQueryable(Grant.class); - if (criteria.getLike() != null && !criteria.getLike().isEmpty()) - query.where((builder, root) -> - builder.or(builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"), - builder.or(builder.like(builder.upper(root.get("description")), "%" + criteria.getLike().toUpperCase() + "%")))); - if (criteria.getPeriodEnd() != null) - query.where((builder, root) -> builder.lessThan(root.get("enddate"), criteria.getPeriodEnd())); - if (criteria.getPeriodStart() != null) - query.where((builder, root) -> builder.greaterThan(root.get("startdate"), criteria.getPeriodStart())); - if (criteria.getReference() != null) - query.where((builder, root) -> builder.like(root.get("reference"), "%" + criteria.getReference() + "%")); - if (criteria.getExactReference() != null) - query.where((builder, root) -> builder.like(root.get("reference"), criteria.getExactReference())); - if (criteria.getGrantStateType() != null) { - if (criteria.getGrantStateType().equals(GrantStateType.FINISHED.getValue())) - query.where((builder, root) -> builder.lessThan(root.get("enddate"), new Date())); - if (criteria.getGrantStateType().equals(GrantStateType.ONGOING.getValue())) - query.where((builder, root) -> - builder.or(builder.greaterThan(root.get("enddate"), new Date()) - , builder.isNull(root.get("enddate")))); - } - if (criteria.isPublic()) { - query.where((builder, root) -> builder.equal(root.join("dmps").get("status"), DmpStatus.Finalized.getValue())).distinct(); - } - - if (criteria.isActive()) { - query.where((builder, root) -> builder.notEqual(root.join("dmps").get("isActive"), IsActive.Inactive.getValue())).distinct(); - } - if (criteria.getFunderId() != null && !criteria.getFunderId().trim().isEmpty()) - query.where((builder, root) -> builder.equal(root.get("funder").get("id"), UUID.fromString(criteria.getFunderId()))); - if (criteria.getFunderReference() != null && !criteria.getFunderReference().isEmpty()) - query.where((builder, root) -> builder.or(builder.like(root.join("funder", JoinType.LEFT).get("reference"), "%" + criteria.getFunderReference()))); - query.where((builder, root) -> builder.notEqual(root.get("status"), Grant.Status.DELETED.getValue())); - return query; - } - - @Override - public Grant createOrUpdate(Grant item) { - return getDatabaseService().createOrUpdate(item, Grant.class); - } - - @Override - public Grant find(UUID id) throws InvalidApplicationException { - return getDatabaseService().getQueryable(Grant.class).where((builder, root) -> builder.equal((root.get("id")), id)).getSingle(); - } - - @Override - public void delete(Grant item) { - this.getDatabaseService().delete(item); - } - - @Override - public QueryableList asQueryable() { - return this.getDatabaseService().getQueryable(Grant.class); - } - - public QueryableList getAuthenticated(QueryableList query, UserEntity principal) { - query.where((builder, root) -> builder.equal(root.get("creationUser").get("id"), principal.getId())).distinct(); - return query; - } - - @Async - @Override - public CompletableFuture createOrUpdateAsync(Grant item) { - return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item)); - } - - @Override - public Grant find(UUID id, String hint) { - throw new UnsupportedOperationException(); - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/OrganisationDao.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/OrganisationDao.java deleted file mode 100644 index 97c8dc8b4..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/OrganisationDao.java +++ /dev/null @@ -1,16 +0,0 @@ -package eu.eudat.data.dao.entities; - -import eu.eudat.data.dao.DatabaseAccessLayer; -import eu.eudat.data.dao.criteria.OrganisationCriteria; -import eu.eudat.data.old.Organisation; -import eu.eudat.data.UserEntity; -import eu.eudat.queryable.QueryableList; - -import java.util.UUID; - -public interface OrganisationDao extends DatabaseAccessLayer { - - QueryableList getWithCriteria(OrganisationCriteria criteria); - QueryableList getAuthenticated(QueryableList query, UserEntity principal); - -} \ No newline at end of file diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/OrganisationDaoImpl.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/OrganisationDaoImpl.java deleted file mode 100644 index b05647864..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/OrganisationDaoImpl.java +++ /dev/null @@ -1,87 +0,0 @@ -package eu.eudat.data.dao.entities; - -import eu.eudat.commons.enums.DmpStatus; -import eu.eudat.commons.enums.IsActive; -import eu.eudat.data.dao.DatabaseAccess; -import eu.eudat.data.dao.criteria.OrganisationCriteria; -import eu.eudat.data.dao.databaselayer.service.DatabaseService; -import eu.eudat.data.old.Organisation; -import eu.eudat.data.UserEntity; -import eu.eudat.queryable.QueryableList; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Async; -import org.springframework.stereotype.Component; - -import jakarta.persistence.criteria.JoinType; - -import javax.management.InvalidApplicationException; -import java.util.UUID; -import java.util.concurrent.CompletableFuture; - -@Component("organisationDao") -public class OrganisationDaoImpl extends DatabaseAccess implements OrganisationDao { - - @Autowired - public OrganisationDaoImpl(DatabaseService databaseService) { - super(databaseService); - } - - @Override - public QueryableList getWithCriteria(OrganisationCriteria criteria) { - QueryableList query = this.getDatabaseService().getQueryable(Organisation.class); - if (criteria.getLabelLike() != null && criteria.getLike() != null) { - query.where((builder, root) -> builder.or(builder.equal(root.get("reference"), criteria.getLike()), builder.like(builder.upper(root.get("label")), "%" + criteria.getLabelLike().toUpperCase() + "%"))); - } else { - if (criteria.getLike() != null) - query.where((builder, root) -> builder.equal(root.get("reference"), criteria.getLike())); - if (criteria.getLabelLike() != null) { - query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + criteria.getLabelLike().toUpperCase() + "%")); - } - if (criteria.getPublic() != null && criteria.getPublic()) { - query.where((builder, root) -> builder.equal(root.join("dmps", JoinType.LEFT).get("status"), DmpStatus.Finalized.getValue())); - } - } - - if (criteria.isActive()) { - query.where((builder, root) -> builder.notEqual(root.join("dmps").get("isActive"), IsActive.Inactive.getValue())).distinct(); - } - - return query; - } - - @Override - public Organisation createOrUpdate(Organisation item) { - return this.getDatabaseService().createOrUpdate(item, Organisation.class); - } - - @Override - public Organisation find(UUID id) throws InvalidApplicationException { - return this.getDatabaseService().getQueryable(Organisation.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle(); - } - - @Override - public void delete(Organisation item) { - this.getDatabaseService().delete(item); - } - - @Override - public QueryableList asQueryable() { - return this.getDatabaseService().getQueryable(Organisation.class); - } - - @Async - @Override - public CompletableFuture createOrUpdateAsync(Organisation item) { - return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item)); - } - - public QueryableList getAuthenticated(QueryableList query, UserEntity principal) { - query.where((builder, root) -> builder.equal(root.join("dmps").join("users").get("user"), principal)); - return query; - } - - @Override - public Organisation find(UUID id, String hint) { - throw new UnsupportedOperationException(); - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ProjectDao.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ProjectDao.java deleted file mode 100644 index 042cacb72..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ProjectDao.java +++ /dev/null @@ -1,16 +0,0 @@ -package eu.eudat.data.dao.entities; - -import eu.eudat.data.dao.DatabaseAccessLayer; -import eu.eudat.data.dao.criteria.ProjectCriteria; -import eu.eudat.data.old.Project; -import eu.eudat.data.UserEntity; -import eu.eudat.queryable.QueryableList; - -import java.util.UUID; - -public interface ProjectDao extends DatabaseAccessLayer { - - QueryableList getWithCritetia(ProjectCriteria criteria); - - QueryableList getAuthenticated(QueryableList query, UserEntity principal); -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ProjectDaoImpl.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ProjectDaoImpl.java deleted file mode 100644 index 10985800f..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ProjectDaoImpl.java +++ /dev/null @@ -1,75 +0,0 @@ -package eu.eudat.data.dao.entities; - -import eu.eudat.data.dao.DatabaseAccess; -import eu.eudat.data.dao.criteria.ProjectCriteria; -import eu.eudat.data.dao.databaselayer.service.DatabaseService; -import eu.eudat.data.old.Project; -import eu.eudat.data.UserEntity; -import eu.eudat.queryable.QueryableList; -import org.springframework.stereotype.Service; - -import jakarta.persistence.criteria.JoinType; - -import javax.management.InvalidApplicationException; -import java.util.UUID; -import java.util.concurrent.CompletableFuture; - -@Service("projectDao") -public class ProjectDaoImpl extends DatabaseAccess implements ProjectDao { - - public ProjectDaoImpl(DatabaseService databaseService) { - super(databaseService); - } - - @Override - public QueryableList getWithCritetia(ProjectCriteria criteria) { - QueryableList query = getDatabaseService().getQueryable(Project.class); - if (criteria.getLike() != null && !criteria.getLike().isEmpty()) - query.where((builder, root) -> - builder.or(builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"), - builder.or(builder.like(builder.upper(root.get("description")), "%" + criteria.getLike().toUpperCase() + "%")))); - if (criteria.getReference() != null) - query.where((builder, root) -> builder.like(root.get("reference"), "%" + criteria.getReference() + "%")); - if (criteria.getExactReference() != null) - query.where((builder, root) -> builder.like(root.get("reference"), criteria.getExactReference())); - if (criteria.getPeriodStart() != null) - query.where((builder, root) -> builder.greaterThanOrEqualTo(root.get("startdate"), criteria.getPeriodStart())); - query.where((builder, root) -> builder.notEqual(root.get("status"), Project.Status.DELETED.getValue())); - return query; - } - - public QueryableList getAuthenticated(QueryableList query, UserEntity principal) { - query.where((builder, root) -> builder.or(builder.equal(root.get("creationUser"), principal), builder.equal(root.join("dmps", JoinType.LEFT).join("users", JoinType.LEFT).join("user", JoinType.LEFT).get("id"), principal.getId()))).distinct(); - return query; - } - - @Override - public Project createOrUpdate(Project item) { - return this.getDatabaseService().createOrUpdate(item, Project.class); - } - - @Override - public CompletableFuture createOrUpdateAsync(Project item) { - return null; - } - - @Override - public Project find(UUID id) throws InvalidApplicationException { - return this.getDatabaseService().getQueryable(Project.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle(); - } - - @Override - public Project find(UUID id, String hint) { - throw new UnsupportedOperationException(); - } - - @Override - public void delete(Project item) { - throw new UnsupportedOperationException(); - } - - @Override - public QueryableList asQueryable() { - return this.getDatabaseService().getQueryable(Project.class); - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/RegistryDao.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/RegistryDao.java deleted file mode 100644 index 41fdab6fc..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/RegistryDao.java +++ /dev/null @@ -1,14 +0,0 @@ -package eu.eudat.data.dao.entities; - -import eu.eudat.data.dao.DatabaseAccessLayer; -import eu.eudat.data.dao.criteria.RegistryCriteria; -import eu.eudat.data.old.Registry; -import eu.eudat.queryable.QueryableList; - -import java.util.UUID; - -public interface RegistryDao extends DatabaseAccessLayer { - - QueryableList getWithCriteria(RegistryCriteria criteria); - -} \ No newline at end of file diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/RegistryDaoImpl.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/RegistryDaoImpl.java deleted file mode 100644 index 2ff6dc619..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/RegistryDaoImpl.java +++ /dev/null @@ -1,67 +0,0 @@ -package eu.eudat.data.dao.entities; - -import eu.eudat.data.dao.DatabaseAccess; -import eu.eudat.data.dao.criteria.RegistryCriteria; -import eu.eudat.data.dao.databaselayer.service.DatabaseService; -import eu.eudat.data.old.Registry; -import eu.eudat.queryable.QueryableList; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Async; -import org.springframework.stereotype.Component; - -import javax.management.InvalidApplicationException; -import java.util.UUID; -import java.util.concurrent.CompletableFuture; - -@Component("registryDao") -public class RegistryDaoImpl extends DatabaseAccess implements RegistryDao { - - @Autowired - public RegistryDaoImpl(DatabaseService databaseService) { - super(databaseService); - } - - @Override - public QueryableList getWithCriteria(RegistryCriteria criteria) { - QueryableList query = this.getDatabaseService().getQueryable(Registry.class); - if (criteria.getLike() != null) - if (criteria.getLike() != null) - query.where((builder, root) -> builder.or( - builder.like(builder.upper(root.get("reference")), "%" + criteria.getLike().toUpperCase() + "%"), - builder.equal(builder.upper(root.get("label")), criteria.getLike().toUpperCase()))); - if (criteria.getCreationUserId() != null) - query.where((builder, root) -> builder.equal(root.get("creationUser").get("id"), criteria.getCreationUserId())); - return query; - } - - @Override - public Registry createOrUpdate(Registry item) { - return this.getDatabaseService().createOrUpdate(item, Registry.class); - } - - @Override - public Registry find(UUID id) throws InvalidApplicationException { - return this.getDatabaseService().getQueryable(Registry.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle(); - } - - @Override - public void delete(Registry item) { - this.getDatabaseService().delete(item); - } - - @Override - public QueryableList asQueryable() { - return this.getDatabaseService().getQueryable(Registry.class); - } - - @Async - @Override - public CompletableFuture createOrUpdateAsync(Registry item) { - return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item)); - } - - @Override - public Registry find(UUID id, String hint) { - throw new UnsupportedOperationException(); - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ResearcherDao.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ResearcherDao.java deleted file mode 100644 index 869f49792..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ResearcherDao.java +++ /dev/null @@ -1,14 +0,0 @@ -package eu.eudat.data.dao.entities; - -import eu.eudat.data.dao.DatabaseAccessLayer; -import eu.eudat.data.dao.criteria.ResearcherCriteria; -import eu.eudat.data.old.Researcher; -import eu.eudat.queryable.QueryableList; - -import java.util.UUID; - -public interface ResearcherDao extends DatabaseAccessLayer { - - QueryableList getWithCriteria(ResearcherCriteria criteria); - -} \ No newline at end of file diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ResearcherDaoImpl.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ResearcherDaoImpl.java deleted file mode 100644 index 2e37cf91b..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ResearcherDaoImpl.java +++ /dev/null @@ -1,68 +0,0 @@ -package eu.eudat.data.dao.entities; - -import eu.eudat.data.dao.DatabaseAccess; -import eu.eudat.data.dao.criteria.ResearcherCriteria; -import eu.eudat.data.dao.databaselayer.service.DatabaseService; -import eu.eudat.data.old.Researcher; -import eu.eudat.queryable.QueryableList; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Async; -import org.springframework.stereotype.Component; - -import javax.management.InvalidApplicationException; -import java.util.UUID; -import java.util.concurrent.CompletableFuture; - -@Component("researcherDao") -public class ResearcherDaoImpl extends DatabaseAccess implements ResearcherDao { - - @Autowired - public ResearcherDaoImpl(DatabaseService databaseService) { - super(databaseService); - } - - @Override - public QueryableList getWithCriteria(ResearcherCriteria criteria) { - QueryableList query = asQueryable(); - if (criteria.getLike() != null && !criteria.getLike().isEmpty()) - query.where((builder, root) ->builder.or(builder.like(builder.lower(root.get("reference")), "%" + criteria.getLike().toLowerCase() + "%"))); - if (criteria.getName() != null && !criteria.getName().isEmpty()) - query.where((builder, root) ->builder.or(builder.like(builder.lower(root.get("label")), "%" + criteria.getName().toLowerCase() + "%"))); - if (criteria.getReference() != null && !criteria.getReference().isEmpty()) - query.where((builder, root) ->builder.or(builder.like(root.get("reference"), criteria.getReference()))); - if (criteria.getPeriodStart() != null) - query.where((builder, root) -> builder.greaterThanOrEqualTo(root.get("created"), criteria.getPeriodStart())); - return query; - } - - @Override - public Researcher createOrUpdate(Researcher item) { - return this.getDatabaseService().createOrUpdate(item, Researcher.class); - } - - @Override - public Researcher find(UUID id) throws InvalidApplicationException { - return this.getDatabaseService().getQueryable(Researcher.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle(); - } - - @Override - public void delete(Researcher item) { - this.getDatabaseService().delete(item); - } - - @Override - public QueryableList asQueryable() { - return this.getDatabaseService().getQueryable(Researcher.class); - } - - @Async - @Override - public CompletableFuture createOrUpdateAsync(Researcher item) { - return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item)); - } - - @Override - public Researcher find(UUID id, String hint) { - throw new UnsupportedOperationException(); - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ServiceDao.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ServiceDao.java deleted file mode 100644 index 8b5400ba1..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ServiceDao.java +++ /dev/null @@ -1,14 +0,0 @@ -package eu.eudat.data.dao.entities; - -import eu.eudat.data.dao.DatabaseAccessLayer; -import eu.eudat.data.dao.criteria.ServiceCriteria; -import eu.eudat.data.old.Service; -import eu.eudat.queryable.QueryableList; - -import java.util.UUID; - -public interface ServiceDao extends DatabaseAccessLayer { - - QueryableList getWithCriteria(ServiceCriteria criteria); - -} \ No newline at end of file diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ServiceDaoImpl.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ServiceDaoImpl.java deleted file mode 100644 index b39d95d2f..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ServiceDaoImpl.java +++ /dev/null @@ -1,66 +0,0 @@ -package eu.eudat.data.dao.entities; - -import eu.eudat.data.dao.DatabaseAccess; -import eu.eudat.data.dao.criteria.ServiceCriteria; -import eu.eudat.data.dao.databaselayer.service.DatabaseService; -import eu.eudat.data.old.Service; -import eu.eudat.queryable.QueryableList; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Async; -import org.springframework.stereotype.Component; - -import javax.management.InvalidApplicationException; -import java.util.UUID; -import java.util.concurrent.CompletableFuture; - -@Component("serviceDao") -public class ServiceDaoImpl extends DatabaseAccess implements ServiceDao { - - @Autowired - public ServiceDaoImpl(DatabaseService databaseService) { - super(databaseService); - } - - @Override - public QueryableList getWithCriteria(ServiceCriteria criteria) { - QueryableList query = this.getDatabaseService().getQueryable(Service.class); - if (criteria.getLike() != null) - query.where((builder, root) -> builder.or( - builder.like(builder.upper(root.get("reference")), "%" + criteria.getLike().toUpperCase() + "%"), - builder.equal(builder.upper(root.get("label")), criteria.getLike().toUpperCase()))); - if (criteria.getCreationUserId() != null) - query.where((builder, root) -> builder.equal(root.get("creationUser").get("id"), criteria.getCreationUserId())); - return query; - } - - @Override - public Service createOrUpdate(Service item) { - return this.getDatabaseService().createOrUpdate(item, Service.class); - } - - @Override - public Service find(UUID id) throws InvalidApplicationException { - return this.getDatabaseService().getQueryable(Service.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle(); - } - - @Override - public void delete(Service item) { - this.getDatabaseService().delete(item); - } - - @Override - public QueryableList asQueryable() { - return this.getDatabaseService().getQueryable(Service.class); - } - - @Async - @Override - public CompletableFuture createOrUpdateAsync(Service item) { - return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item)); - } - - @Override - public Service find(UUID id, String hint) { - throw new UnsupportedOperationException(); - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/query/items/item/dmp/DataManagementPlanCriteriaRequest.java b/dmp-backend/data/src/main/java/eu/eudat/data/query/items/item/dmp/DataManagementPlanCriteriaRequest.java deleted file mode 100644 index 511012538..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/query/items/item/dmp/DataManagementPlanCriteriaRequest.java +++ /dev/null @@ -1,34 +0,0 @@ -package eu.eudat.data.query.items.item.dmp; - -import eu.eudat.commons.enums.IsActive; -import eu.eudat.data.DmpEntity; -import eu.eudat.data.dao.criteria.DataManagementPlanCriteria; -import eu.eudat.data.query.definition.Query; -import eu.eudat.queryable.QueryableList; -import eu.eudat.queryable.types.FieldSelectionType; -import eu.eudat.queryable.types.SelectionField; - -import java.util.Arrays; - -public class DataManagementPlanCriteriaRequest extends Query { - @Override - public QueryableList applyCriteria() { - QueryableList query = this.getQuery(); - if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty()) - query.where((builder, root) -> builder.or( - builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"), - builder.like(builder.upper(root.get("description")), "%" + this.getCriteria().getLike().toUpperCase() + "%"))); - if (this.getCriteria().getPeriodEnd() != null) - query.where((builder, root) -> builder.lessThan(root.get("created"), this.getCriteria().getPeriodEnd())); - if (this.getCriteria().getPeriodStart() != null) - query.where((builder, root) -> builder.greaterThan(root.get("created"), this.getCriteria().getPeriodStart())); - if (this.getCriteria().getGrants() != null && !this.getCriteria().getGrants().isEmpty()) - query.where(((builder, root) -> root.get("grant").in(this.getCriteria().getGrants()))); - if (!this.getCriteria().getAllVersions()) - query.initSubQuery(String.class).where((builder, root) -> builder.equal(root.get("version"), query.subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.equal(externalRoot.get("groupId"), nestedRoot.get("groupId")), Arrays.asList(new SelectionField(FieldSelectionType.FIELD, "version")), String.class))); - if (this.getCriteria().getGroupIds() != null && !this.getCriteria().getGroupIds().isEmpty()) - query.where((builder, root) -> root.get("groupId").in(this.getCriteria().getGroupIds())); - query.where((builder, root) -> builder.notEqual(root.get("isActive"), IsActive.Inactive.getValue())); - return query; - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/query/items/item/funder/FunderCriteriaRequest.java b/dmp-backend/data/src/main/java/eu/eudat/data/query/items/item/funder/FunderCriteriaRequest.java deleted file mode 100644 index b5893c2a4..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/query/items/item/funder/FunderCriteriaRequest.java +++ /dev/null @@ -1,17 +0,0 @@ -package eu.eudat.data.query.items.item.funder; - -import eu.eudat.data.dao.criteria.FunderCriteria; -import eu.eudat.data.old.Funder; -import eu.eudat.data.query.definition.Query; -import eu.eudat.queryable.QueryableList; - -public class FunderCriteriaRequest extends Query { - @Override - public QueryableList applyCriteria() { - QueryableList query = this.getQuery(); - if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty()) - query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%")); - query.where((builder, root) -> builder.notEqual(root.get("status"), Funder.Status.DELETED.getValue())); - return query; - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/query/items/item/grant/GrantCriteriaRequest.java b/dmp-backend/data/src/main/java/eu/eudat/data/query/items/item/grant/GrantCriteriaRequest.java deleted file mode 100644 index 8182cf3c1..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/query/items/item/grant/GrantCriteriaRequest.java +++ /dev/null @@ -1,38 +0,0 @@ -package eu.eudat.data.query.items.item.grant; - -import eu.eudat.data.dao.criteria.GrantCriteria; -import eu.eudat.data.old.Grant; -import eu.eudat.data.query.definition.Query; -import eu.eudat.queryable.QueryableList; - -public class GrantCriteriaRequest extends Query { - private Integer length; - - public Integer getLength() { - return length; - } - - public void setLength(Integer length) { - this.length = length; - } - - private GrantCriteriaRequest() { - } - - @Override - public QueryableList applyCriteria() { - QueryableList query = this.getQuery(); - if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty()) - query.where((builder, root) -> builder.or( - builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"), - builder.like(builder.upper(root.get("description")), "%" + this.getCriteria().getLike().toUpperCase() + "%"))); - if (this.getCriteria().getPeriodEnd() != null) - query.where((builder, root) -> builder.lessThan(root.get("enddate"), this.getCriteria().getPeriodEnd())); - if (this.getCriteria().getPeriodStart() != null) - query.where((builder, root) -> builder.greaterThan(root.get("startdate"), this.getCriteria().getPeriodStart())); - if (this.getCriteria().getReference() != null) - query.where((builder, root) -> builder.equal(root.get("reference"), this.getCriteria().getReference())); - query.where((builder, root) -> builder.notEqual(root.get("status"), Grant.Status.DELETED.getValue())); - return query; - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/query/items/item/project/ProjectCriteriaRequest.java b/dmp-backend/data/src/main/java/eu/eudat/data/query/items/item/project/ProjectCriteriaRequest.java deleted file mode 100644 index cb780ec8e..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/query/items/item/project/ProjectCriteriaRequest.java +++ /dev/null @@ -1,17 +0,0 @@ -package eu.eudat.data.query.items.item.project; - -import eu.eudat.data.dao.criteria.ProjectCriteria; -import eu.eudat.data.old.Project; -import eu.eudat.data.query.definition.Query; -import eu.eudat.queryable.QueryableList; - -public class ProjectCriteriaRequest extends Query { - @Override - public QueryableList applyCriteria() { - QueryableList query = this.getQuery(); - if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty()) - query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%")); - query.where((builder, root) -> builder.notEqual(root.get("status"), Project.Status.DELETED.getValue())); - return query; - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/query/items/item/researcher/ResearcherCriteriaRequest.java b/dmp-backend/data/src/main/java/eu/eudat/data/query/items/item/researcher/ResearcherCriteriaRequest.java deleted file mode 100644 index 7fb8355e4..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/query/items/item/researcher/ResearcherCriteriaRequest.java +++ /dev/null @@ -1,21 +0,0 @@ -package eu.eudat.data.query.items.item.researcher; - -import eu.eudat.data.dao.criteria.ResearcherCriteria; -import eu.eudat.data.old.Researcher; -import eu.eudat.data.query.definition.Query; -import eu.eudat.queryable.QueryableList; - -/** - * Created by ikalyvas on 3/6/2018. - */ -public class ResearcherCriteriaRequest extends Query { - @Override - public QueryableList applyCriteria() { - QueryableList query = this.getQuery(); - if (this.getCriteria().getLike() != null) - query.where((builder, root) -> builder.equal(root.get("reference"), this.getCriteria().getLike())); - if (this.getCriteria().getName() != null) - query.where((builder, root) -> builder.equal(root.get("label"), this.getCriteria().getName())); - return query; - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/query/items/table/dmp/DataManagementPlanTableRequest.java b/dmp-backend/data/src/main/java/eu/eudat/data/query/items/table/dmp/DataManagementPlanTableRequest.java index feeba453d..513df940b 100644 --- a/dmp-backend/data/src/main/java/eu/eudat/data/query/items/table/dmp/DataManagementPlanTableRequest.java +++ b/dmp-backend/data/src/main/java/eu/eudat/data/query/items/table/dmp/DataManagementPlanTableRequest.java @@ -24,8 +24,8 @@ public class DataManagementPlanTableRequest extends TableQuery builder.lessThan(root.get("created"), this.getCriteria().getPeriodEnd())); if (this.getCriteria().getPeriodStart() != null) query.where((builder, root) -> builder.greaterThan(root.get("created"), this.getCriteria().getPeriodStart())); - if (this.getCriteria().getGrants() != null && !this.getCriteria().getGrants().isEmpty()) - query.where(((builder, root) -> root.get("grant").in(this.getCriteria().getGrants()))); +// if (this.getCriteria().getGrants() != null && !this.getCriteria().getGrants().isEmpty()) +// query.where(((builder, root) -> root.get("grant").in(this.getCriteria().getGrants()))); //TODO if (!this.getCriteria().getAllVersions()) query.initSubQuery(String.class).where((builder, root) -> builder.equal(root.get("version"), query.subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.equal(externalRoot.get("groupId"), nestedRoot.get("groupId")), Arrays.asList(new SelectionField(FieldSelectionType.FIELD, "version")), String.class))); if (this.getCriteria().getGroupIds() != null && !this.getCriteria().getGroupIds().isEmpty()) diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/query/items/table/externaldataset/ExternalDatasetTableRequest.java b/dmp-backend/data/src/main/java/eu/eudat/data/query/items/table/externaldataset/ExternalDatasetTableRequest.java deleted file mode 100644 index cdedd781d..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/query/items/table/externaldataset/ExternalDatasetTableRequest.java +++ /dev/null @@ -1,23 +0,0 @@ -package eu.eudat.data.query.items.table.externaldataset; - -import eu.eudat.data.dao.criteria.ExternalDatasetCriteria; -import eu.eudat.data.old.ExternalDataset; -import eu.eudat.data.query.definition.TableQuery; -import eu.eudat.queryable.QueryableList; - -import java.util.UUID; - -public class ExternalDatasetTableRequest extends TableQuery { - @Override - public QueryableList applyCriteria() { - QueryableList query = this.getQuery(); - if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty()) - query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%")); - return query; - } - - @Override - public QueryableList applyPaging(QueryableList items) { - return null; - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/query/items/table/grant/GrantTableRequest.java b/dmp-backend/data/src/main/java/eu/eudat/data/query/items/table/grant/GrantTableRequest.java deleted file mode 100644 index 0162f8c6b..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/query/items/table/grant/GrantTableRequest.java +++ /dev/null @@ -1,32 +0,0 @@ -package eu.eudat.data.query.items.table.grant; - -import eu.eudat.data.dao.criteria.GrantCriteria; -import eu.eudat.data.old.Grant; -import eu.eudat.data.query.definition.TableQuery; -import eu.eudat.queryable.QueryableList; - -import java.util.UUID; - -public class GrantTableRequest extends TableQuery { - @Override - public QueryableList applyCriteria() { - QueryableList query = this.getQuery(); - if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty()) - query.where((builder, root) -> builder.or( - builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"), - builder.like(builder.upper(root.get("description")), "%" + this.getCriteria().getLike().toUpperCase() + "%"))); - if (this.getCriteria().getPeriodEnd() != null) - query.where((builder, root) -> builder.lessThan(root.get("enddate"), this.getCriteria().getPeriodEnd())); - if (this.getCriteria().getPeriodStart() != null) - query.where((builder, root) -> builder.greaterThan(root.get("startdate"), this.getCriteria().getPeriodStart())); - if (this.getCriteria().getReference() != null) - query.where((builder, root) -> builder.equal(root.get("reference"), this.getCriteria().getReference())); - query.where((builder, root) -> builder.notEqual(root.get("status"), Grant.Status.DELETED.getValue())); - return query; - } - - @Override - public QueryableList applyPaging(QueryableList items) { - return null; - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/query/items/table/organisations/OrganisationsTableRequest.java b/dmp-backend/data/src/main/java/eu/eudat/data/query/items/table/organisations/OrganisationsTableRequest.java deleted file mode 100644 index 3c0e6f86c..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/query/items/table/organisations/OrganisationsTableRequest.java +++ /dev/null @@ -1,25 +0,0 @@ -package eu.eudat.data.query.items.table.organisations; - -import eu.eudat.data.dao.criteria.OrganisationCriteria; -import eu.eudat.data.old.Organisation; -import eu.eudat.data.query.PaginationService; -import eu.eudat.data.query.definition.TableQuery; -import eu.eudat.queryable.QueryableList; - -import java.util.UUID; - -public class OrganisationsTableRequest extends TableQuery { - @Override - public QueryableList applyCriteria() { - QueryableList query = this.getQuery(); - if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty()) { - query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%")); - } - return query; - } - - @Override - public QueryableList applyPaging(QueryableList items) { - return PaginationService.applyPaging(items, this); - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/query/DMPQuery.java b/dmp-backend/data/src/main/java/eu/eudat/query/DMPQuery.java index c2d9ba5a4..6eb14bda5 100644 --- a/dmp-backend/data/src/main/java/eu/eudat/query/DMPQuery.java +++ b/dmp-backend/data/src/main/java/eu/eudat/query/DMPQuery.java @@ -3,8 +3,6 @@ package eu.eudat.query; import eu.eudat.data.DmpEntity; import eu.eudat.data.dao.DatabaseAccessLayer; import eu.eudat.data.DescriptionEntity; -import eu.eudat.data.old.Grant; -import eu.eudat.data.UserEntity; import eu.eudat.queryable.QueryableList; import eu.eudat.queryable.types.FieldSelectionType; import eu.eudat.queryable.types.SelectionField; @@ -22,7 +20,6 @@ public class DMPQuery extends Query { private UUID groupId; private String label; private int version; - private GrantQuery grantQuery; // private UserQueryOld userQuery; private DatasetQuery datasetQuery; private List statuses; @@ -69,13 +66,6 @@ public class DMPQuery extends Query { this.version = version; } - public GrantQuery getGrantQuery() { - return grantQuery; - } - - public void setGrantQuery(GrantQuery grantQuery) { - this.grantQuery = grantQuery; - } public List getStatuses() { return statuses; @@ -122,10 +112,10 @@ public class DMPQuery extends Query { if (this.id != null) { query.where((builder, root) -> builder.equal(root.get("id"), this.id)); } - if (this.grantQuery != null) { - Subquery grantQuery = this.grantQuery.getQuery().query(Arrays.asList(new SelectionField(FieldSelectionType.FIELD, "id"))); - query.where((builder, root) -> root.get("grant").get("id").in(grantQuery)); - } +// if (this.grantQuery != null) { //TODO +// Subquery grantQuery = this.grantQuery.getQuery().query(Arrays.asList(new SelectionField(FieldSelectionType.FIELD, "id"))); +// query.where((builder, root) -> root.get("grant").get("id").in(grantQuery)); +// } if (this.getStatuses() != null && !this.getStatuses().isEmpty()) { query.where((builder, root) -> root.get("status").in(this.getStatuses())); } diff --git a/dmp-backend/data/src/main/java/eu/eudat/query/GrantQuery.java b/dmp-backend/data/src/main/java/eu/eudat/query/GrantQuery.java deleted file mode 100644 index 14f5e375b..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/query/GrantQuery.java +++ /dev/null @@ -1,110 +0,0 @@ -package eu.eudat.query; - -import eu.eudat.data.dao.DatabaseAccessLayer; -import eu.eudat.data.old.Grant; -import eu.eudat.data.UserEntity; -import eu.eudat.queryable.QueryableList; -import eu.eudat.queryable.types.FieldSelectionType; -import eu.eudat.queryable.types.SelectionField; - -import jakarta.persistence.criteria.Subquery; - -import javax.management.InvalidApplicationException; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.UUID; - -public class GrantQuery extends Query { - - private UUID id; - private List ids; - private String label; - private List statuses; - private Date created; - private Date modified; -// private UserQueryOld userQuery; - - public GrantQuery(DatabaseAccessLayer databaseAccessLayer) { - super(databaseAccessLayer); - } - - public GrantQuery(DatabaseAccessLayer databaseAccessLayer, List selectionFields) { - super(databaseAccessLayer, selectionFields); - } - - public UUID getId() { - return id; - } - - public void setId(UUID id) { - this.id = id; - } - - public List getIds() { - return ids; - } - - public void setIds(List ids) { - this.ids = ids; - } - - public String getLabel() { - return label; - } - - public void setLabel(String label) { - this.label = label; - } - - public List getStatuses() { - return statuses; - } - - public void setStatuses(List statuses) { - statuses = statuses; - } - - public Date getCreated() { - return created; - } - - public void setCreated(Date created) { - this.created = created; - } - - public Date getModified() { - return modified; - } - - public void setModified(Date modified) { - this.modified = modified; - } - -// public UserQueryOld getUserQuery() { -// return userQuery; -// } -// -// public void setUserQuery(UserQueryOld userQuery) { -// this.userQuery = userQuery; -// } - - @Override - public QueryableList getQuery() throws InvalidApplicationException { - QueryableList query = this.databaseAccessLayer.asQueryable(); - if (this.id != null) - query.where((builder, root) -> builder.equal(root.get("id"), this.id)); - if (this.ids != null && !this.ids.isEmpty()) - query.where((builder, root) -> root.get("id").in(this.ids)); - if (this.getStatuses() != null && !this.getStatuses().isEmpty()) - query.where((builder, root) -> root.get("status").in(this.getStatuses())); -// if (this.userQuery != null) { -// Subquery userInfoSubQuery = this.userQuery.getQuery().query(Arrays.asList(new SelectionField(FieldSelectionType.FIELD, "id"))); -// query.where((builder, root) -> root.get("creationUser").get("id").in(userInfoSubQuery)); -// } - if (!this.getSelectionFields().isEmpty() && this.getSelectionFields() != null) { - query.withFields(this.getSelectionFields()); - } - return query; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/BaseController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/BaseController.java index 6e897e39a..bf6249f18 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/BaseController.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/BaseController.java @@ -23,12 +23,6 @@ public abstract class BaseController { protected void initBinder(WebDataBinder binder) { if (binder.getTarget() != null && DataManagementPlanTableRequestValidator.supportsType((binder.getTarget().getClass()))) binder.addValidators(this.apiContext.getOperationsContext().getApplicationContext().getBean("dataManagementPlanTableRequestValidator", DataManagementPlanTableRequestValidator.class)); - if (binder.getTarget() != null && GrantTableRequestValidator.supportsType((binder.getTarget().getClass()))) - binder.addValidators(this.apiContext.getOperationsContext().getApplicationContext().getBean("grantTableRequestValidator", GrantTableRequestValidator.class)); - if (binder.getTarget() != null && DatasetProfileValidator.supportsType((binder.getTarget().getClass()))) - binder.addValidators(this.apiContext.getOperationsContext().getApplicationContext().getBean("datasetProfileValidator", DatasetProfileValidator.class)); - if (binder.getTarget() != null && GrantModelValidator.supportsType((binder.getTarget().getClass()))) - binder.addValidators(this.apiContext.getOperationsContext().getApplicationContext().getBean("grantModelValidator", GrantModelValidator.class)); if (binder.getTarget() != null && DataManagementPlanNewVersionValidator.supportsType((binder.getTarget().getClass()))) binder.addValidators(this.apiContext.getOperationsContext().getApplicationContext().getBean("dataManagementPlanNewVersionValidator", DataManagementPlanNewVersionValidator.class)); } diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/DashBoardController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/DashBoardController.java deleted file mode 100644 index dffcb4810..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/DashBoardController.java +++ /dev/null @@ -1,81 +0,0 @@ -package eu.eudat.controllers; - -import eu.eudat.authorization.Permission; -import eu.eudat.logic.managers.DashBoardManager; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.models.data.dashboard.recent.RecentActivity; -import eu.eudat.models.data.dashboard.recent.model.RecentActivityModel; -import eu.eudat.models.data.dashboard.recent.tablerequest.RecentActivityTableRequest; -import eu.eudat.models.data.dashboard.searchbar.SearchBarItem; -import eu.eudat.models.data.dashboard.statistics.DashBoardStatistics; -import eu.eudat.models.data.helpers.responses.ResponseItem; -import eu.eudat.types.ApiMessageCode; -import gr.cite.commons.web.authz.service.AuthorizationService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; - -import jakarta.transaction.Transactional; - -import javax.management.InvalidApplicationException; -import java.io.IOException; -import java.util.List; - -@RestController -@CrossOrigin -@RequestMapping(value = {"/api"}) -public class DashBoardController extends BaseController { - - private DashBoardManager dashBoardManager; - private final AuthorizationService authorizationService; - @Autowired - public DashBoardController(ApiContext apiContext, DashBoardManager dashBoardManager, AuthorizationService authorizationService) { - super(apiContext); - this.dashBoardManager = dashBoardManager; - this.authorizationService = authorizationService; - } - - @RequestMapping(method = RequestMethod.GET, value = {"/dashboard/me/getStatistics"}, produces = "application/json") - public ResponseEntity> getMyStatistics() throws IOException, InvalidApplicationException { - this.authorizationService.authorizeForce(Permission.BrowseStatistics); - - DashBoardStatistics statistics = dashBoardManager.getMeStatistics(); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().status(ApiMessageCode.NO_MESSAGE).payload(statistics)); - } - - @RequestMapping(method = RequestMethod.GET, value = {"/dashboard/getStatistics"}, produces = "application/json") - public ResponseEntity> getStatistics() throws InvalidApplicationException { - this.authorizationService.authorizeForce(Permission.BrowsePublicStatistics); - - DashBoardStatistics statistics = dashBoardManager.getStatistics(); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().status(ApiMessageCode.NO_MESSAGE).payload(statistics)); - } - - @RequestMapping(method = RequestMethod.POST, value = {"/dashboard/recentActivity"}, produces = "application/json") - @Transactional - public ResponseEntity>> getNewRecentActivity(@RequestBody RecentActivityTableRequest tableRequest) throws Exception { - this.authorizationService.authorizeForce(Permission.AdminRole, Permission.ManagerRole, Permission.UserRole, Permission.AnonymousRole); - - List statistics = dashBoardManager.getNewRecentActivity(tableRequest); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().status(ApiMessageCode.NO_MESSAGE).payload(statistics)); - } - - @Deprecated - @RequestMapping(method = RequestMethod.GET, value = {"/user/recentActivity"}, produces = "application/json") - public ResponseEntity> getRecentActivity(@RequestParam(name = "numOfActivities", required = false, defaultValue = "5") Integer numberOfActivities) throws InvalidApplicationException { - this.authorizationService.authorizeForce(Permission.AuthenticatedRole); - - - RecentActivity statistics = dashBoardManager.getRecentActivity(numberOfActivities); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().status(ApiMessageCode.NO_MESSAGE).payload(statistics)); - } - - @RequestMapping(method = RequestMethod.GET, value = {"/dashboard/search"}, produces = "application/json") - public ResponseEntity>> search(@RequestParam(name = "like") String like) throws InvalidApplicationException { - this.authorizationService.authorizeForce(Permission.AdminRole, Permission.ManagerRole, Permission.UserRole, Permission.AnonymousRole); - - List searchBarItemList = dashBoardManager.searchUserData(like); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().status(ApiMessageCode.NO_MESSAGE).payload(searchBarItemList)); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/DataRepositories.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/DataRepositories.java deleted file mode 100644 index 27a5fb7fd..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/DataRepositories.java +++ /dev/null @@ -1,60 +0,0 @@ -package eu.eudat.controllers; - -import eu.eudat.authorization.Permission; -import eu.eudat.data.old.DataRepository; -import eu.eudat.logic.managers.DataRepositoryManager; -import eu.eudat.commons.exceptions.HugeResultSetException; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.models.data.datarepository.DataRepositoryModel; -import eu.eudat.models.data.helpers.responses.ResponseItem; -import eu.eudat.types.ApiMessageCode; -import gr.cite.commons.web.authz.service.AuthorizationService; -import gr.cite.tools.exception.MyNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.bind.annotation.*; - -import javax.management.InvalidApplicationException; -import java.util.List; - - -@RestController -@CrossOrigin -@RequestMapping(value = {"/api/external/datarepos"}) -public class DataRepositories extends BaseController { - - private DataRepositoryManager dataRepositoryManager; - private final AuthorizationService authorizationService; - - @Autowired - public DataRepositories(ApiContext apiContext, DataRepositoryManager dataRepositoryManager, AuthorizationService authorizationService) { - super(apiContext); - this.dataRepositoryManager = dataRepositoryManager; - this.authorizationService = authorizationService; - } - - @RequestMapping(method = RequestMethod.GET, produces = "application/json") - public @ResponseBody - ResponseEntity>> listExternalDataRepositories( - @RequestParam(value = "query", required = false) String query, @RequestParam(value = "type", required = false) String type - ) throws HugeResultSetException, MyNotFoundException, InvalidApplicationException { - this.authorizationService.authorizeForce(Permission.AuthenticatedRole); - - List dataRepositoryModels = this.dataRepositoryManager.getDataRepositories(query, type); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().status(ApiMessageCode.NO_MESSAGE).payload(dataRepositoryModels)); - } - - @Transactional - @RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json") - public @ResponseBody - ResponseEntity> create(@RequestBody eu.eudat.models.data.datarepository.DataRepositoryModel dataRepositoryModel) throws Exception { - this.authorizationService.authorizeForce(Permission.AuthenticatedRole); - - DataRepository dataRepository = this.dataRepositoryManager.create(dataRepositoryModel); - DataRepositoryModel dataRepositoryModel1 = new DataRepositoryModel().fromDataModel(dataRepository); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().payload(dataRepositoryModel1).status(ApiMessageCode.SUCCESS_MESSAGE)); - } -} - diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/ExternalDatasets.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/ExternalDatasets.java deleted file mode 100644 index d4b10a9df..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/ExternalDatasets.java +++ /dev/null @@ -1,80 +0,0 @@ -package eu.eudat.controllers; - -import eu.eudat.authorization.Permission; -import eu.eudat.data.old.ExternalDataset; -import eu.eudat.data.query.items.table.externaldataset.ExternalDatasetTableRequest; -import eu.eudat.logic.managers.ExternalDatasetManager; -import eu.eudat.commons.exceptions.HugeResultSetException; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.models.data.externaldataset.ExternalDatasetListingModel; -import eu.eudat.models.data.helpers.common.DataTableData; -import eu.eudat.models.data.helpers.responses.ResponseItem; -import eu.eudat.types.ApiMessageCode; -import gr.cite.commons.web.authz.service.AuthorizationService; -import gr.cite.tools.exception.MyNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.bind.annotation.*; - -import javax.management.InvalidApplicationException; -import java.util.List; -import java.util.UUID; - - -@RestController -@CrossOrigin -@RequestMapping(value = {"/api"}) -public class ExternalDatasets extends BaseController { - - private ExternalDatasetManager externalDatasetManager; - private final AuthorizationService authorizationService; - - @Autowired - public ExternalDatasets(ApiContext apiContext, ExternalDatasetManager externalDatasetManager, AuthorizationService authorizationService) { - super(apiContext); - this.externalDatasetManager = externalDatasetManager; - this.authorizationService = authorizationService; - } - - @RequestMapping(method = RequestMethod.POST, value = {"/externaldatasets/getPaged"}, consumes = "application/json", produces = "application/json") - public @ResponseBody - ResponseEntity>> getPaged(@RequestBody ExternalDatasetTableRequest datasetTableRequest) throws Exception { - this.authorizationService.authorizeForce(Permission.AuthenticatedRole); - - DataTableData dataTable = externalDatasetManager.getPaged(datasetTableRequest); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable)); - } - - @RequestMapping(method = RequestMethod.GET, value = {"/external/datasets"}, produces = "application/json") - public @ResponseBody - ResponseEntity>> getWithExternal( - @RequestParam(value = "query", required = false) String query, @RequestParam(value = "type", required = false) String type - ) throws MyNotFoundException, InstantiationException, HugeResultSetException, IllegalAccessException, InvalidApplicationException { - this.authorizationService.authorizeForce(Permission.AuthenticatedRole); - - List dataTable = externalDatasetManager.getWithExternal(query, type); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().payload(dataTable).status(ApiMessageCode.NO_MESSAGE)); - } - - @RequestMapping(method = RequestMethod.POST, value = {"/externaldatasets/getSingle/{id}"}, consumes = "application/json", produces = "application/json") - public @ResponseBody - ResponseItem getWithExternal(@PathVariable UUID id) throws MyNotFoundException, InstantiationException, HugeResultSetException, IllegalAccessException, InvalidApplicationException { - this.authorizationService.authorizeForce(Permission.AuthenticatedRole); - - ExternalDatasetListingModel externalDatasetModel = externalDatasetManager.getSingle(id); - return new ResponseItem().payload(externalDatasetModel).status(ApiMessageCode.NO_MESSAGE); - } - - @Transactional - @RequestMapping(method = RequestMethod.POST, value = {"/externaldatasets"}, consumes = "application/json", produces = "application/json") - public @ResponseBody - ResponseEntity> create(@RequestBody eu.eudat.models.data.externaldataset.ExternalDatasetModel externalDatasetModel) throws Exception { - this.authorizationService.authorizeForce(Permission.AuthenticatedRole); - - ExternalDataset externalDataset = this.externalDatasetManager.create(externalDatasetModel); - ExternalDatasetListingModel externalDatasetListingModel = new ExternalDatasetListingModel().fromDataModel(externalDataset); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().payload(externalDatasetListingModel).status(ApiMessageCode.SUCCESS_MESSAGE)); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/Funders.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/Funders.java deleted file mode 100644 index e451ef4d7..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/Funders.java +++ /dev/null @@ -1,41 +0,0 @@ -package eu.eudat.controllers; - -import eu.eudat.authorization.Permission; -import eu.eudat.data.query.items.item.funder.FunderCriteriaRequest; -import eu.eudat.logic.managers.FunderManager; -import eu.eudat.commons.exceptions.HugeResultSetException; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.models.data.funder.Funder; -import eu.eudat.models.data.helpers.responses.ResponseItem; -import eu.eudat.types.ApiMessageCode; -import gr.cite.commons.web.authz.service.AuthorizationService; -import gr.cite.tools.exception.MyNotFoundException; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; - -import javax.management.InvalidApplicationException; -import java.util.List; - -@RestController -@CrossOrigin -@RequestMapping(value = {"/api/funders/"}) -public class Funders extends BaseController { - private FunderManager funderManager; - private final AuthorizationService authorizationService; - - public Funders(ApiContext apiContext, FunderManager funderManager, AuthorizationService authorizationService) { - super(apiContext); - this.funderManager = funderManager; - this.authorizationService = authorizationService; - } - - @RequestMapping(method = RequestMethod.POST, value = {"/external"}, consumes = "application/json", produces = "application/json") - public @ResponseBody - ResponseEntity>> getWithExternal(@RequestBody FunderCriteriaRequest funderCriteria) throws MyNotFoundException, InstantiationException, HugeResultSetException, IllegalAccessException, InvalidApplicationException { - this.authorizationService.authorizeForce(Permission.AuthenticatedRole); - - List dataTable = this.funderManager.getCriteriaWithExternal(funderCriteria); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().payload(dataTable).status(ApiMessageCode.NO_MESSAGE)); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/Grants.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/Grants.java deleted file mode 100644 index 090f455c0..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/Grants.java +++ /dev/null @@ -1,100 +0,0 @@ -package eu.eudat.controllers; - -import eu.eudat.authorization.Permission; -import eu.eudat.data.query.items.item.grant.GrantCriteriaRequest; -import eu.eudat.data.query.items.table.grant.GrantTableRequest; -import eu.eudat.logic.managers.GrantManager; -import eu.eudat.commons.exceptions.HugeResultSetException; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.models.data.helpers.common.DataTableData; -import eu.eudat.models.data.helpers.responses.ResponseItem; -import eu.eudat.models.data.grant.GrantListingModel; -import eu.eudat.types.ApiMessageCode; -import gr.cite.commons.web.authz.service.AuthorizationService; -import gr.cite.tools.exception.MyNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; -import jakarta.validation.Valid; - -import javax.management.InvalidApplicationException; -import java.util.List; - - - -@RestController -@CrossOrigin -@RequestMapping(value = {"/api/grants/"}) -public class Grants extends BaseController { - private GrantManager grantManager; - private final AuthorizationService authorizationService; - - @Autowired - public Grants(ApiContext apiContext, GrantManager grantManager, AuthorizationService authorizationService) { - super(apiContext); - this.grantManager = grantManager; - this.authorizationService = authorizationService; - } - - @RequestMapping(method = RequestMethod.POST, value = {"/paged"}, consumes = "application/json", produces = "application/json") - public @ResponseBody - ResponseEntity>> getPaged(@Valid @RequestBody GrantTableRequest grantTableRequest, @RequestParam String fieldsGroup) throws Exception { - this.authorizationService.authorizeForce(Permission.AuthenticatedRole); - - DataTableData dataTable = this.grantManager.getPaged(grantTableRequest, fieldsGroup); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().payload(dataTable).status(ApiMessageCode.NO_MESSAGE)); - } - - @RequestMapping(method = RequestMethod.POST, value = {"public/paged"}, consumes = "application/json", produces = "application/json") - public @ResponseBody - ResponseEntity>> getPaged(@Valid @RequestBody GrantTableRequest grantTableRequest) throws Exception { - DataTableData dataTable = this.grantManager.getPublicPaged(grantTableRequest); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().payload(dataTable).status(ApiMessageCode.NO_MESSAGE)); - } - - @RequestMapping(method = RequestMethod.GET, value = {"{id}"}, produces = "application/json") - public @ResponseBody - ResponseEntity> getSingle(@PathVariable String id) throws IllegalAccessException, InstantiationException, InvalidApplicationException { - this.authorizationService.authorizeForce(Permission.AuthenticatedRole); - - eu.eudat.models.data.grant.Grant grant = this.grantManager.getSingle(id); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().payload(grant).status(ApiMessageCode.NO_MESSAGE)); - } - - /*@Transactional - @RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json") - public @ResponseBody - ResponseEntity> addGrant(@Valid @RequestBody eu.eudat.models.data.grant.Grant grant) throws IOException, ParseException { - this.grantManager.createOrUpdate(grant, principal); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().status(ApiMessageCode.SUCCESS_MESSAGE).message("Created")); - }*/ - - /*@Transactional - @RequestMapping(method = RequestMethod.DELETE, value = {"{id}"}, consumes = "application/json", produces = "application/json") - public @ResponseBody - ResponseEntity> inactivate(@PathVariable String id) throws IllegalAccessException, InstantiationException { - this.grantManager.inactivate(id); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().status(ApiMessageCode.SUCCESS_MESSAGE)); - }*/ - - @RequestMapping(method = RequestMethod.POST, value = {"/external"}, consumes = "application/json", produces = "application/json") - public @ResponseBody - ResponseEntity>> getWithExternal(@RequestBody GrantCriteriaRequest grantCriteria) throws MyNotFoundException, InstantiationException, HugeResultSetException, IllegalAccessException, InvalidApplicationException { - this.authorizationService.authorizeForce(Permission.AuthenticatedRole); - - List dataTable = this.grantManager.getCriteriaWithExternal(grantCriteria); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().payload(dataTable).status(ApiMessageCode.NO_MESSAGE)); - } - - @RequestMapping(method = RequestMethod.POST, value = {"get"}, consumes = "application/json", produces = "application/json") - public @ResponseBody - ResponseEntity>> get(@RequestBody GrantCriteriaRequest grantCriteria) throws MyNotFoundException, InstantiationException, HugeResultSetException, IllegalAccessException, InvalidApplicationException { - this.authorizationService.authorizeForce(Permission.AnonymousRole); - - List dataTable = this.grantManager.getCriteria(grantCriteria); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().payload(dataTable).status(ApiMessageCode.NO_MESSAGE)); - } - -} - diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/JournalsController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/JournalsController.java deleted file mode 100644 index a64207499..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/JournalsController.java +++ /dev/null @@ -1,49 +0,0 @@ -package eu.eudat.controllers; - -import eu.eudat.authorization.Permission; -import eu.eudat.logic.managers.DataRepositoryManager; -import eu.eudat.commons.exceptions.HugeResultSetException; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.models.data.datarepository.DataRepositoryModel; -import eu.eudat.models.data.helpers.responses.ResponseItem; -import eu.eudat.types.ApiMessageCode; -import gr.cite.commons.web.authz.service.AuthorizationService; -import gr.cite.tools.exception.MyNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; - -import javax.management.InvalidApplicationException; -import java.util.List; - - -@RestController -@CrossOrigin -@RequestMapping(value = {"/api/external/journals"}) -public class JournalsController extends BaseController { - - private DataRepositoryManager dataRepositoryManager; - private final AuthorizationService authorizationService; - - @Autowired - public JournalsController(ApiContext apiContext, DataRepositoryManager dataRepositoryManager, AuthorizationService authorizationService) { - super(apiContext); - this.dataRepositoryManager = dataRepositoryManager; - this.authorizationService = authorizationService; - } - - @RequestMapping(method = RequestMethod.GET, produces = "application/json") - public @ResponseBody - ResponseEntity>> listExternalDataRepositories( - @RequestParam(value = "query", required = false) String query, @RequestParam(value = "type", required = false) String type - ) throws HugeResultSetException, MyNotFoundException, InvalidApplicationException { - this.authorizationService.authorizeForce(Permission.AuthenticatedRole); - - List dataRepositoryModels = this.dataRepositoryManager.getJournals(query, type); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().status(ApiMessageCode.NO_MESSAGE).payload(dataRepositoryModels)); - } - - -} - diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/Licenses.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/Licenses.java deleted file mode 100644 index 36226f7ff..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/Licenses.java +++ /dev/null @@ -1,46 +0,0 @@ -package eu.eudat.controllers; - -import eu.eudat.authorization.Permission; -import eu.eudat.logic.managers.LicenseManager; -import eu.eudat.commons.exceptions.HugeResultSetException; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.models.data.helpers.responses.ResponseItem; -import eu.eudat.models.data.license.LicenseModel; -import eu.eudat.types.ApiMessageCode; -import gr.cite.commons.web.authz.service.AuthorizationService; -import gr.cite.tools.exception.MyNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - - -@RestController -@CrossOrigin -@RequestMapping(value = {"/api/external/licenses"}) -public class Licenses extends BaseController { - - private LicenseManager licenseManager; - private final AuthorizationService authorizationService; - - @Autowired - public Licenses(ApiContext apiContext, LicenseManager licenseManager, AuthorizationService authorizationService) { - super(apiContext); - this.licenseManager = licenseManager; - this.authorizationService = authorizationService; - } - - @RequestMapping(method = RequestMethod.GET, produces = "application/json") - public @ResponseBody - ResponseEntity>> listExternalLicenses( - @RequestParam(value = "query", required = false) String query, @RequestParam(value = "type", required = false) String type - ) throws HugeResultSetException, MyNotFoundException { - this.authorizationService.authorizeForce(Permission.AuthenticatedRole); - - List licenseModels = this.licenseManager.getLicenses(query, type); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().status(ApiMessageCode.NO_MESSAGE).payload(licenseModels)); - } -} - diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/Organisations.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/Organisations.java deleted file mode 100644 index 4b6f86f67..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/Organisations.java +++ /dev/null @@ -1,74 +0,0 @@ -package eu.eudat.controllers; - -import eu.eudat.authorization.Permission; -import eu.eudat.data.query.items.table.organisations.OrganisationsTableRequest; -import eu.eudat.logic.managers.OrganisationsManager; -import eu.eudat.commons.exceptions.HugeResultSetException; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.models.data.dmp.Organisation; -import eu.eudat.models.data.helpers.common.DataTableData; -import eu.eudat.models.data.helpers.responses.ResponseItem; -import eu.eudat.types.ApiMessageCode; -import gr.cite.commons.web.authz.service.AuthorizationService; -import gr.cite.tools.exception.MyNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; - -import jakarta.validation.Valid; -import java.util.List; - - -@RestController -@CrossOrigin -@RequestMapping(value = {"/api"}) -public class Organisations extends BaseController { - - private OrganisationsManager organisationsManager; - private final AuthorizationService authorizationService; - private ApiContext apiContext; - - @Autowired - public Organisations(ApiContext apiContext, OrganisationsManager organisationsManager, AuthorizationService authorizationService, ApiContext apiContext1) { - super(apiContext); - this.organisationsManager = organisationsManager; - this.authorizationService = authorizationService; - this.apiContext = apiContext1; - } - - @RequestMapping(method = RequestMethod.GET, value = {"/external/organisations"}, produces = "application/json") - public @ResponseBody - ResponseEntity>> listExternalOrganisations( - @RequestParam(value = "query", required = false) String query, @RequestParam(value = "type", required = false) String type - ) throws HugeResultSetException, MyNotFoundException { - List organisations = organisationsManager.getCriteriaWithExternal(query, type); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().payload(organisations).status(ApiMessageCode.NO_MESSAGE)); - } - - @RequestMapping(method = RequestMethod.POST, value = {"/general/organisations"}, produces = "application/json") - public @ResponseBody - ResponseEntity>> listGeneralOrganisations(@RequestBody OrganisationsTableRequest organisationsTableRequest) throws Exception { - this.authorizationService.authorizeForce(Permission.AuthenticatedRole); - - List organisations = organisationsManager.getWithExternal(organisationsTableRequest); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().payload(organisations).status(ApiMessageCode.NO_MESSAGE)); - } - - @RequestMapping(method = RequestMethod.POST, value = {"/internal/organisations"}, produces = "application/json") - public @ResponseBody - ResponseEntity>> getPaged(@Valid @RequestBody OrganisationsTableRequest organisationsTableRequest) throws Exception{ - this.authorizationService.authorizeForce(Permission.AuthenticatedRole); - - DataTableData organisationDataTableData = this.organisationsManager.getPagedOrganisations(organisationsTableRequest); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().payload(organisationDataTableData).status(ApiMessageCode.NO_MESSAGE)); - } - - @RequestMapping(method = RequestMethod.POST, value = {"/public/organisations"}, produces = "application/json") - public @ResponseBody - ResponseEntity>> getPublicPaged(@Valid @RequestBody OrganisationsTableRequest organisationsTableRequest) throws Exception{ - DataTableData organisationDataTableData = this.organisationsManager.getPublicPagedOrganisations(organisationsTableRequest); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().payload(organisationDataTableData).status(ApiMessageCode.NO_MESSAGE)); - } -} - diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/Projects.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/Projects.java deleted file mode 100644 index f8e1cb11e..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/Projects.java +++ /dev/null @@ -1,43 +0,0 @@ -package eu.eudat.controllers; - -import eu.eudat.authorization.Permission; -import eu.eudat.data.query.items.item.project.ProjectCriteriaRequest; -import eu.eudat.logic.managers.ProjectManager; -import eu.eudat.commons.exceptions.HugeResultSetException; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.models.data.helpers.responses.ResponseItem; -import eu.eudat.models.data.project.Project; -import eu.eudat.types.ApiMessageCode; -import gr.cite.commons.web.authz.service.AuthorizationService; -import gr.cite.tools.exception.MyNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; - -import javax.management.InvalidApplicationException; -import java.util.List; - -@RestController -@CrossOrigin -@RequestMapping(value = {"/api/projects/"}) -public class Projects extends BaseController { - private ProjectManager projectManager; - private final AuthorizationService authorizationService; - - @Autowired - public Projects(ApiContext apiContext, ProjectManager projectManager, AuthorizationService authorizationService) { - super(apiContext); - this.projectManager = projectManager; - this.authorizationService = authorizationService; - } - - @RequestMapping(method = RequestMethod.POST, value = {"/external"}, consumes = "application/json", produces = "application/json") - public @ResponseBody - ResponseEntity>> getWithExternal(@RequestBody ProjectCriteriaRequest projectCriteria) throws MyNotFoundException, InstantiationException, HugeResultSetException, IllegalAccessException, InvalidApplicationException { - this.authorizationService.authorizeForce(Permission.AuthenticatedRole); - - List dataTable = this.projectManager.getCriteriaWithExternal(projectCriteria); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().payload(dataTable).status(ApiMessageCode.NO_MESSAGE)); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/PubRepositoriesController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/PubRepositoriesController.java deleted file mode 100644 index 4a3a4e403..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/PubRepositoriesController.java +++ /dev/null @@ -1,49 +0,0 @@ -package eu.eudat.controllers; - -import eu.eudat.authorization.Permission; -import eu.eudat.logic.managers.DataRepositoryManager; -import eu.eudat.commons.exceptions.HugeResultSetException; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.models.data.datarepository.DataRepositoryModel; -import eu.eudat.models.data.helpers.responses.ResponseItem; -import eu.eudat.types.ApiMessageCode; -import gr.cite.commons.web.authz.service.AuthorizationService; -import gr.cite.tools.exception.MyNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; - -import javax.management.InvalidApplicationException; -import java.util.List; - - -@RestController -@CrossOrigin -@RequestMapping(value = {"/api/external/pubrepos"}) -public class PubRepositoriesController extends BaseController { - - private DataRepositoryManager dataRepositoryManager; - private final AuthorizationService authorizationService; - - @Autowired - public PubRepositoriesController(ApiContext apiContext, DataRepositoryManager dataRepositoryManager, AuthorizationService authorizationService) { - super(apiContext); - this.dataRepositoryManager = dataRepositoryManager; - this.authorizationService = authorizationService; - } - - @RequestMapping(method = RequestMethod.GET, produces = "application/json") - public @ResponseBody - ResponseEntity>> listExternalDataRepositories( - @RequestParam(value = "query", required = false) String query, @RequestParam(value = "type", required = false) String type - ) throws HugeResultSetException, MyNotFoundException, InvalidApplicationException { - this.authorizationService.authorizeForce(Permission.AuthenticatedRole); - - List dataRepositoryModels = this.dataRepositoryManager.getPubRepositories(query, type); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().status(ApiMessageCode.NO_MESSAGE).payload(dataRepositoryModels)); - } - - -} - diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/PublicationsController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/PublicationsController.java deleted file mode 100644 index 21af8b6f1..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/PublicationsController.java +++ /dev/null @@ -1,46 +0,0 @@ -package eu.eudat.controllers; - -import eu.eudat.authorization.Permission; -import eu.eudat.logic.managers.PublicationManager; -import eu.eudat.commons.exceptions.HugeResultSetException; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.models.data.helpers.responses.ResponseItem; -import eu.eudat.models.data.publication.PublicationModel; -import eu.eudat.types.ApiMessageCode; -import gr.cite.commons.web.authz.service.AuthorizationService; -import gr.cite.tools.exception.MyNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - - -@RestController -@CrossOrigin -@RequestMapping(value = {"/api/external/publications"}) -public class PublicationsController extends BaseController { - - private PublicationManager publicationManager; - private final AuthorizationService authorizationService; - - @Autowired - public PublicationsController(ApiContext apiContext, PublicationManager publicationManager, AuthorizationService authorizationService) { - super(apiContext); - this.publicationManager = publicationManager; - this.authorizationService = authorizationService; - } - - @RequestMapping(method = RequestMethod.GET, produces = "application/json") - public @ResponseBody - ResponseEntity>> listExternalPublications( - @RequestParam(value = "query", required = false) String query, @RequestParam(value = "type", required = false) String type - ) throws HugeResultSetException, MyNotFoundException { - this.authorizationService.authorizeForce(Permission.AuthenticatedRole); - - List publicationModels = this.publicationManager.getPublications(query, type); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().status(ApiMessageCode.NO_MESSAGE).payload(publicationModels)); - } -} - diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/QuickWizardController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/QuickWizardController.java index 966469ab4..151efae87 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/QuickWizardController.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/QuickWizardController.java @@ -5,9 +5,6 @@ import eu.eudat.authorization.Permission; import eu.eudat.commons.scope.user.UserScope; import eu.eudat.data.DescriptionTemplateEntity; import eu.eudat.data.DmpEntity; -import eu.eudat.data.old.Funder; -import eu.eudat.data.old.Project; -import eu.eudat.data.old.Grant; import eu.eudat.logic.managers.DatasetManager; import eu.eudat.logic.managers.QuickWizardManager; import eu.eudat.logic.services.ApiContext; @@ -53,49 +50,49 @@ public class QuickWizardController extends BaseController { this.authorizationService.authorizeForce(Permission.AuthenticatedRole); - Funder funderEntity; - //Create Funder - if (quickWizard.getFunder() == null) { - funderEntity = null; - } else if (quickWizard.getFunder().getExistFunder() == null && quickWizard.getFunder().getLabel() == null) { - funderEntity = null; - } else if (quickWizard.getFunder().getExistFunder() == null && quickWizard.getFunder().getLabel() != null) { - funderEntity = this.quickWizardManager.createOrUpdate(quickWizard.getFunder().toDataFunder()); - } else { - funderEntity = quickWizard.getFunder().getExistFunder().toDataModel(); - } +// Funder funderEntity;//TODO +// //Create Funder +// if (quickWizard.getFunder() == null) { +// funderEntity = null; +// } else if (quickWizard.getFunder().getExistFunder() == null && quickWizard.getFunder().getLabel() == null) { +// funderEntity = null; +// } else if (quickWizard.getFunder().getExistFunder() == null && quickWizard.getFunder().getLabel() != null) { +// funderEntity = this.quickWizardManager.createOrUpdate(quickWizard.getFunder().toDataFunder()); +// } else { +// funderEntity = quickWizard.getFunder().getExistFunder().toDataModel(); +// } - Grant grantEntity; - //Create Grant - if (quickWizard.getGrant() == null) { - grantEntity = null; - } else if (quickWizard.getGrant().getExistGrant() == null && quickWizard.getGrant().getLabel() == null) { - grantEntity = null; - } else if (quickWizard.getGrant().getExistGrant() == null) { - grantEntity = this.quickWizardManager.createOrUpdate(quickWizard.getGrant().toDataGrant()); - } else { - grantEntity = quickWizard.getGrant().getExistGrant().toDataModel(); - } +// Grant grantEntity; //TODO +// //Create Grant +// if (quickWizard.getGrant() == null) { +// grantEntity = null; +// } else if (quickWizard.getGrant().getExistGrant() == null && quickWizard.getGrant().getLabel() == null) { +// grantEntity = null; +// } else if (quickWizard.getGrant().getExistGrant() == null) { +// grantEntity = this.quickWizardManager.createOrUpdate(quickWizard.getGrant().toDataGrant()); +// } else { +// grantEntity = quickWizard.getGrant().getExistGrant().toDataModel(); +// } - Project projectEntity; - //Create Project - if (quickWizard.getProject().getExistProject() == null - && quickWizard.getProject().getLabel() == null) { - projectEntity = null; - } else if (quickWizard.getProject().getExistProject() == null && quickWizard.getProject().getLabel() != null) { - projectEntity = this.quickWizardManager.createOrUpdate(quickWizard.getProject().toDataProject()); - } else { - projectEntity = quickWizard.getProject().getExistProject().toDataModel(); - } +// Project projectEntity; //TODO +// //Create Project +// if (quickWizard.getProject().getExistProject() == null +// && quickWizard.getProject().getLabel() == null) { +// projectEntity = null; +// } else if (quickWizard.getProject().getExistProject() == null && quickWizard.getProject().getLabel() != null) { +// projectEntity = this.quickWizardManager.createOrUpdate(quickWizard.getProject().toDataProject()); +// } else { +// projectEntity = quickWizard.getProject().getExistProject().toDataModel(); +// } //Create Dmp - DataManagementPlan dataManagementPlan = quickWizard.getDmp().toDataDmp(grantEntity, projectEntity, userScope); - DmpEntity dmpEntity = this.quickWizardManager.createOrUpdate(dataManagementPlan, funderEntity); + DataManagementPlan dataManagementPlan = quickWizard.getDmp().toDataDmp(/*grantEntity,*/ userScope); + DmpEntity dmpEntity = this.quickWizardManager.createOrUpdate(dataManagementPlan/*, funderEntity*/); //Create Datasets quickWizard.getDmp().setId(dmpEntity.getId()); for (DatasetDescriptionQuickWizardModel dataset : quickWizard.getDatasets().getDatasetsList()) { - DataManagementPlan dmp = quickWizard.getDmp().toDataDmp(grantEntity, projectEntity, userScope); + DataManagementPlan dmp = quickWizard.getDmp().toDataDmp(/*grantEntity , projectEntity, */ userScope); DescriptionTemplateEntity profile = quickWizard.getDmp().getDatasetProfile(); DatasetWizardModel datasetWizardModel = dataset.toDataModel(dmp, profile); this.datasetManager.createOrUpdate(datasetWizardModel); diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/Registries.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/Registries.java deleted file mode 100644 index 23fad4582..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/Registries.java +++ /dev/null @@ -1,59 +0,0 @@ -package eu.eudat.controllers; - -import eu.eudat.authorization.Permission; -import eu.eudat.data.old.Registry; -import eu.eudat.logic.managers.RegistryManager; -import eu.eudat.commons.exceptions.HugeResultSetException; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.models.data.helpers.responses.ResponseItem; -import eu.eudat.models.data.registries.RegistryModel; -import eu.eudat.types.ApiMessageCode; -import gr.cite.commons.web.authz.service.AuthorizationService; -import gr.cite.tools.exception.MyNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.bind.annotation.*; - -import javax.management.InvalidApplicationException; -import java.util.List; - - -@RestController -@CrossOrigin -@RequestMapping(value = {"/api"}) -public class Registries extends BaseController { - - private RegistryManager registryManager; - private final AuthorizationService authorizationService; - - @Autowired - public Registries(ApiContext apiContext, RegistryManager registryManager, AuthorizationService authorizationService) { - super(apiContext); - this.registryManager = registryManager; - this.authorizationService = authorizationService; - } - - @RequestMapping(method = RequestMethod.GET, value = {"/external/registries"}, produces = "application/json") - public @ResponseBody - ResponseEntity>> listExternalRegistries(@RequestParam(value = "query", required = false) String query - , @RequestParam(value = "type", required = false) String type) throws HugeResultSetException, MyNotFoundException, InvalidApplicationException { - this.authorizationService.authorizeForce(Permission.AuthenticatedRole); - - List registryModels = this.registryManager.getRegistries(query, type); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().payload(registryModels).status(ApiMessageCode.NO_MESSAGE)); - } - - @Transactional - @RequestMapping(method = RequestMethod.POST, value = {"/registries"}, consumes = "application/json", produces = "application/json") - public @ResponseBody - ResponseEntity> create(@RequestBody RegistryModel registryModel) throws Exception { - this.authorizationService.authorizeForce(Permission.AuthenticatedRole); - - Registry registry = this.registryManager.create(registryModel); - RegistryModel registryModel1 = new RegistryModel().fromDataModel(registry); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().payload(registryModel1).status(ApiMessageCode.SUCCESS_MESSAGE)); - } -} - diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/Researchers.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/Researchers.java deleted file mode 100644 index 78e4774f4..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/Researchers.java +++ /dev/null @@ -1,58 +0,0 @@ -package eu.eudat.controllers; - -import eu.eudat.authorization.Permission; -import eu.eudat.data.query.items.item.researcher.ResearcherCriteriaRequest; -import eu.eudat.logic.managers.ResearcherManager; -import eu.eudat.commons.exceptions.HugeResultSetException; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.models.data.dmp.Researcher; -import eu.eudat.models.data.helpers.responses.ResponseItem; -import eu.eudat.types.ApiMessageCode; -import gr.cite.commons.web.authz.service.AuthorizationService; -import gr.cite.tools.exception.MyNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.bind.annotation.*; - -import javax.management.InvalidApplicationException; -import java.util.List; - - -@RestController -@CrossOrigin -@RequestMapping(value = {"/api/researchers"}) - -public class Researchers extends BaseController { - - private ResearcherManager researcherManager; - private final AuthorizationService authorizationService; - @Autowired - public Researchers(ApiContext apiContext, ResearcherManager researcherManager, AuthorizationService authorizationService) { - super(apiContext); - this.researcherManager = researcherManager; - this.authorizationService = authorizationService; - } - - @RequestMapping(method = RequestMethod.POST, value = {"/getWithExternal"}, consumes = "application/json", produces = "application/json") - public @ResponseBody - ResponseEntity>> getWithExternal(@RequestBody ResearcherCriteriaRequest researcherCriteriaRequest) throws HugeResultSetException, MyNotFoundException, InvalidApplicationException { - this.authorizationService.authorizeForce(Permission.AuthenticatedRole); - - List dataTable = this.researcherManager.getCriteriaWithExternal(researcherCriteriaRequest); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().payload(dataTable).status(ApiMessageCode.NO_MESSAGE)); - } - - @Transactional - @RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json") - public @ResponseBody - ResponseEntity> create(@RequestBody eu.eudat.models.data.researcher.Researcher researcher) throws Exception { - this.authorizationService.authorizeForce(Permission.AuthenticatedRole); - - this.researcherManager.create(researcher); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().status(ApiMessageCode.SUCCESS_MESSAGE)); - } - -} - diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/Services.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/Services.java deleted file mode 100644 index 814c5ca7c..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/Services.java +++ /dev/null @@ -1,58 +0,0 @@ -package eu.eudat.controllers; - -import eu.eudat.authorization.Permission; -import eu.eudat.data.old.Service; -import eu.eudat.logic.managers.ServiceManager; -import eu.eudat.commons.exceptions.HugeResultSetException; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.models.data.helpers.responses.ResponseItem; -import eu.eudat.models.data.services.ServiceModel; -import eu.eudat.types.ApiMessageCode; -import gr.cite.commons.web.authz.service.AuthorizationService; -import gr.cite.tools.exception.MyNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.bind.annotation.*; - -import javax.management.InvalidApplicationException; -import java.util.List; - - -@RestController -@CrossOrigin -@RequestMapping(value = {"/api"}) -public class Services extends BaseController { - - private ServiceManager serviceManager; - private final AuthorizationService authorizationService; - - @Autowired - public Services(ApiContext apiContext, ServiceManager serviceManager, AuthorizationService authorizationService) { - super(apiContext); - this.serviceManager = serviceManager; - this.authorizationService = authorizationService; - } - - @RequestMapping(method = RequestMethod.GET, value = {"/external/services"}, produces = "application/json") - public @ResponseBody - ResponseEntity>> listExternalServices( - @RequestParam(value = "query", required = false) String query, @RequestParam(value = "type", required = false) String type - ) throws HugeResultSetException, MyNotFoundException, InvalidApplicationException { - this.authorizationService.authorizeForce(Permission.AuthenticatedRole); - List serviceModels = this.serviceManager.getServices(query, type); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().payload(serviceModels).status(ApiMessageCode.NO_MESSAGE)); - } - - @Transactional - @RequestMapping(method = RequestMethod.POST, value = {"/services"}, consumes = "application/json", produces = "application/json") - public @ResponseBody - ResponseEntity> create(@RequestBody ServiceModel serviceModel) throws Exception { - this.authorizationService.authorizeForce(Permission.AuthenticatedRole); - Service service = serviceManager.create(serviceModel); - ServiceModel serviceModel1 = new ServiceModel().fromDataModel(service); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().payload(serviceModel1).status(ApiMessageCode.SUCCESS_MESSAGE)); - } -} - diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/TaxonomiesController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/TaxonomiesController.java deleted file mode 100644 index 87798b30b..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/TaxonomiesController.java +++ /dev/null @@ -1,46 +0,0 @@ -package eu.eudat.controllers; - -import eu.eudat.authorization.Permission; -import eu.eudat.logic.managers.TaxonomyManager; -import eu.eudat.commons.exceptions.HugeResultSetException; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.models.data.helpers.responses.ResponseItem; -import eu.eudat.models.data.taxonomy.TaxonomyModel; -import eu.eudat.types.ApiMessageCode; -import gr.cite.commons.web.authz.service.AuthorizationService; -import gr.cite.tools.exception.MyNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - - -@RestController -@CrossOrigin -@RequestMapping(value = {"/api/external/taxonomies"}) -public class TaxonomiesController extends BaseController { - - private TaxonomyManager taxonomyManager; - private final AuthorizationService authorizationService; - - @Autowired - public TaxonomiesController(ApiContext apiContext, TaxonomyManager taxonomyManager, AuthorizationService authorizationService) { - super(apiContext); - this.taxonomyManager = taxonomyManager; - this.authorizationService = authorizationService; - } - - @RequestMapping(method = RequestMethod.GET, produces = "application/json") - public @ResponseBody - ResponseEntity>> listExternalPublications( - @RequestParam(value = "query", required = false) String query, @RequestParam(value = "type", required = false) String type - ) throws HugeResultSetException, MyNotFoundException { - this.authorizationService.authorizeForce(Permission.AuthenticatedRole); - - List taxonomyModels = this.taxonomyManager.getTaxonomies(query, type); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().status(ApiMessageCode.NO_MESSAGE).payload(taxonomyModels)); - } -} - diff --git a/dmp-backend/web/src/main/java/eu/eudat/criteria/DMPCriteria.java b/dmp-backend/web/src/main/java/eu/eudat/criteria/DMPCriteria.java index 5260be439..a9c850b56 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/criteria/DMPCriteria.java +++ b/dmp-backend/web/src/main/java/eu/eudat/criteria/DMPCriteria.java @@ -12,7 +12,6 @@ public class DMPCriteria { private Criteria groupId; private Criteria label; private Criteria version; - private GrantCriteria grant; private DateCriteria created; private DateCriteria modified; private UserCriteria creator; @@ -74,14 +73,6 @@ public class DMPCriteria { this.version = criteria; } - public GrantCriteria getGrant() { - return grant; - } - - public void setGrant(GrantCriteria grant) { - this.grant = grant; - } - public DateCriteria getCreated() { return created; } @@ -131,7 +122,7 @@ public class DMPCriteria { path = path != null && !path.isEmpty() ? path + "." : ""; if (this.id != null) fields.add(path + this.id.getAs()); if (this.label != null) fields.add(path + this.label.getAs()); - if (this.grant != null) fields.addAll(this.grant.buildFields(path + "grant")); +// if (this.grant != null) fields.addAll(this.grant.buildFields(path + "grant")); if (this.creator != null) fields.addAll(this.creator.buildFields(path + "creator")); if (this.dataset != null) fields.addAll(this.dataset.buildFields(path + "dataset")); if (!fields.contains(path + "id")) fields.add(path + "id"); @@ -142,7 +133,7 @@ public class DMPCriteria { List fields = this.buildFields(""); DMPQuery dmpQuery = new DMPQuery(dao.getDmpDao(), fields); if (this.id != null) dmpQuery.setId(this.id.getValue()); - if (this.grant != null) dmpQuery.setGrantQuery(this.grant.buildQuery(dao)); +// if (this.grant != null) dmpQuery.setGrantQuery(this.grant.buildQuery(dao)); // if (this.creator != null) dmpQuery.setUserQuery(this.creator.buildQuery(dao)); if (this.dataset != null) dmpQuery.setDatasetQuery(this.dataset.buildQuery(dao)); return dmpQuery; diff --git a/dmp-backend/web/src/main/java/eu/eudat/criteria/GrantCriteria.java b/dmp-backend/web/src/main/java/eu/eudat/criteria/GrantCriteria.java deleted file mode 100644 index 1b88e7694..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/criteria/GrantCriteria.java +++ /dev/null @@ -1,109 +0,0 @@ -package eu.eudat.criteria; - -import eu.eudat.criteria.entities.Criteria; -import eu.eudat.criteria.entities.DateCriteria; -import eu.eudat.logic.services.operations.DatabaseRepository; -import eu.eudat.query.GrantQuery; -import java.util.*; - -public class GrantCriteria { - private Criteria id; - private List ids; - private Criteria label; - private List statuses; - private DateCriteria created; - private DateCriteria modified; - private UserCriteria creator; - - public Criteria getId() { - return id; - } - - public void setId(Criteria id) { - this.id = id; - } - - public List getIds() { - return ids; - } - - public void setIds(List ids) { - this.ids = ids; - } - - public Criteria getLabel() { - return label; - } - - public void setLabel(Criteria label) { - this.label = label; - } - - public void setLabel(String label) { - Criteria criteria = new Criteria<>(); - criteria.setAs(label); - this.label = criteria; - } - - public List getStatuses() { - return statuses; - } - - public void setStatuses(List statuses) { - this.statuses = statuses; - } - - public DateCriteria getCreated() { - return created; - } - - public void setCreated(DateCriteria created) { - this.created = created; - } - - public void setCreated(String created) { - DateCriteria criteria = new DateCriteria(); - criteria.setAs(created); - this.created = criteria; - } - - public DateCriteria getModified() { - return modified; - } - - public void setModified(DateCriteria modified) { - this.modified = modified; - } - - public void setModified(String modified) { - DateCriteria criteria = new DateCriteria(); - criteria.setAs(modified); - this.modified = criteria; - } - - public UserCriteria getCreator() { - return creator; - } - - public void setCreator(UserCriteria creator) { - this.creator = creator; - } - - protected List buildFields(String path) { - Set fields = new LinkedHashSet<>(); - path = path != null && !path.isEmpty() ? path + "." : ""; - if (this.id != null) fields.add(path + this.id.getAs()); - if (this.label != null) fields.add(path + this.label.getAs()); - if (!fields.contains(path + "id")) fields.add(path + "id"); - if (this.creator != null) fields.addAll(this.creator.buildFields(path + "creationUser")); - return new LinkedList<>(fields); - } - - public GrantQuery buildQuery(DatabaseRepository dao) { - List fields = this.buildFields(""); - GrantQuery query = new GrantQuery(dao.getGrantDao(), fields); - query.setId(this.id.getValue()); -// if (this.creator != null) query.setUserQuery(this.creator.buildQuery(dao)); - return query; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/BuilderFactoryImpl.java b/dmp-backend/web/src/main/java/eu/eudat/logic/builders/BuilderFactoryImpl.java index 74798d574..7158e7ef2 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/BuilderFactoryImpl.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/builders/BuilderFactoryImpl.java @@ -1,9 +1,6 @@ package eu.eudat.logic.builders; import eu.eudat.logic.builders.entity.*; -import eu.eudat.logic.builders.model.criteria.DataRepositoryCriteriaBuilder; -import eu.eudat.logic.builders.model.criteria.ExternalDatasetCriteriaBuilder; -import eu.eudat.logic.builders.model.criteria.RegistryCriteriaBuilder; import eu.eudat.logic.builders.model.models.*; import org.springframework.stereotype.Service; @@ -12,19 +9,11 @@ import org.springframework.stereotype.Service; public class BuilderFactoryImpl implements BuilderFactory { public T getBuilder(Class tClass) { - if (tClass.equals(DataRepositoryCriteriaBuilder.class)) return (T) new DataRepositoryCriteriaBuilder(); if (tClass.equals(DatasetProfileBuilder.class)) return (T) new DatasetProfileBuilder(); if (tClass.equals(DataTableDataBuilder.class)) return (T) new DataTableDataBuilder<>(); - if (tClass.equals(GrantBuilder.class)) return (T) new GrantBuilder(); - if (tClass.equals(ProjectBuilder.class)) return (T) new ProjectBuilder(); - if (tClass.equals(FunderBuilder.class)) return (T) new FunderBuilder(); - if (tClass.equals(RegistryCriteriaBuilder.class)) return (T) new RegistryCriteriaBuilder(); if (tClass.equals(UserInfoBuilder.class)) return (T) new UserInfoBuilder(); if (tClass.equals(UserRoleBuilder.class)) return (T) new UserRoleBuilder(); - if (tClass.equals(ResearcherBuilder.class)) return (T) new ResearcherBuilder(); - if (tClass.equals(ExternalDatasetCriteriaBuilder.class)) return (T) new ExternalDatasetCriteriaBuilder(); if (tClass.equals(RecentActivityDataBuilder.class)) return (T) new RecentActivityDataBuilder(); - if (tClass.equals(OrganisationBuilder.class)) return (T) new OrganisationBuilder(); return null; } diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/criteria/DataRepositoryCriteriaBuilder.java b/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/criteria/DataRepositoryCriteriaBuilder.java deleted file mode 100644 index eae4b0a94..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/criteria/DataRepositoryCriteriaBuilder.java +++ /dev/null @@ -1,23 +0,0 @@ -package eu.eudat.logic.builders.model.criteria; - -import eu.eudat.logic.builders.Builder; -import eu.eudat.data.dao.criteria.DataRepositoryCriteria; - -/** - * Created by ikalyvas on 2/15/2018. - */ -public class DataRepositoryCriteriaBuilder extends Builder { - private String like; - - public DataRepositoryCriteriaBuilder like(String like) { - this.like = like; - return this; - } - - @Override - public DataRepositoryCriteria build() { - DataRepositoryCriteria dataRepositoryCriteria = new DataRepositoryCriteria(); - dataRepositoryCriteria.setLike(like); - return dataRepositoryCriteria; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/criteria/ExternalDatasetCriteriaBuilder.java b/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/criteria/ExternalDatasetCriteriaBuilder.java deleted file mode 100644 index e6a99ae6a..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/criteria/ExternalDatasetCriteriaBuilder.java +++ /dev/null @@ -1,23 +0,0 @@ -package eu.eudat.logic.builders.model.criteria; - -import eu.eudat.logic.builders.Builder; -import eu.eudat.data.dao.criteria.ExternalDatasetCriteria; - -/** - * Created by ikalyvas on 2/15/2018. - */ -public class ExternalDatasetCriteriaBuilder extends Builder { - private String like; - - public ExternalDatasetCriteriaBuilder like(String like) { - this.like = like; - return this; - } - - @Override - public ExternalDatasetCriteria build() { - ExternalDatasetCriteria externalDatasetCriteria = new ExternalDatasetCriteria(); - externalDatasetCriteria.setLike(like); - return externalDatasetCriteria; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/criteria/RegistryCriteriaBuilder.java b/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/criteria/RegistryCriteriaBuilder.java deleted file mode 100644 index d5121ae51..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/criteria/RegistryCriteriaBuilder.java +++ /dev/null @@ -1,23 +0,0 @@ -package eu.eudat.logic.builders.model.criteria; - -import eu.eudat.logic.builders.Builder; -import eu.eudat.data.dao.criteria.RegistryCriteria; - -/** - * Created by ikalyvas on 2/15/2018. - */ -public class RegistryCriteriaBuilder extends Builder { - private String like; - - public RegistryCriteriaBuilder like(String like) { - this.like = like; - return this; - } - - @Override - public RegistryCriteria build() { - RegistryCriteria registryCriteria = new RegistryCriteria(); - registryCriteria.setLike(like); - return registryCriteria; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/criteria/ServiceCriteriaBuilder.java b/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/criteria/ServiceCriteriaBuilder.java deleted file mode 100644 index 1a5d1302c..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/criteria/ServiceCriteriaBuilder.java +++ /dev/null @@ -1,23 +0,0 @@ -package eu.eudat.logic.builders.model.criteria; - -import eu.eudat.logic.builders.Builder; -import eu.eudat.data.dao.criteria.ServiceCriteria; - -/** - * Created by ikalyvas on 2/15/2018. - */ -public class ServiceCriteriaBuilder extends Builder { - private String like; - - public ServiceCriteriaBuilder setLike(String like) { - this.like = like; - return this; - } - - @Override - public ServiceCriteria build() { - ServiceCriteria serviceCriteria = new ServiceCriteria(); - serviceCriteria.setLike(like); - return serviceCriteria; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/models/FunderBuilder.java b/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/models/FunderBuilder.java deleted file mode 100644 index 3b5020ec2..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/models/FunderBuilder.java +++ /dev/null @@ -1,87 +0,0 @@ -package eu.eudat.logic.builders.model.models; - -import eu.eudat.logic.builders.Builder; -import eu.eudat.models.data.funder.Funder; - -import java.util.Date; -import java.util.UUID; - -public class FunderBuilder extends Builder { - - private UUID id; - private String label; - private String reference; - private String definition; - private eu.eudat.data.old.Funder.Status status; - private Date created; - private Date modified; - private Integer type; - private String source; - private String key; - - public FunderBuilder id(UUID id) { - this.id = id; - return this; - } - - public FunderBuilder label(String label) { - this.label = label; - return this; - } - - public FunderBuilder reference(String reference) { - this.reference = reference; - return this; - } - - public FunderBuilder definition(String definition) { - this.definition = definition; - return this; - } - - public FunderBuilder status(eu.eudat.data.old.Funder.Status status) { - this.status = status; - return this; - } - - public FunderBuilder created(Date created) { - this.created = created; - return this; - } - - public FunderBuilder modified(Date modified) { - this.modified = modified; - return this; - } - - public FunderBuilder type(int type) { - this.type = type; - return this; - } - - public FunderBuilder source(String source) { - this.source = source; - return this; - } - - public FunderBuilder key(String key) { - this.key = key; - return this; - } - - @Override - public Funder build() { - Funder funder = new Funder(); - funder.setId(id); - funder.setLabel(label); - funder.setReference(reference); - funder.setDefinition(definition); - if (status != null) funder.setStatus(status.getValue()); - funder.setCreated(created); - funder.setModified(modified); - funder.setType(type); - funder.setSource(source); - funder.setKey(key); - return funder; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/models/GrantBuilder.java b/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/models/GrantBuilder.java deleted file mode 100644 index be37a54e5..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/models/GrantBuilder.java +++ /dev/null @@ -1,147 +0,0 @@ -package eu.eudat.logic.builders.model.models; - -import eu.eudat.logic.builders.Builder; -import eu.eudat.data.UserEntity; -import eu.eudat.models.data.dmp.DataManagementPlan; -import eu.eudat.models.data.grant.Grant; - -import java.util.Date; -import java.util.List; -import java.util.UUID; - -public class GrantBuilder extends Builder { - - private UUID id; - - private List dmps; - - private String label; - - private String abbreviation; - - private String reference; - - private String uri; - - private String definition; - - private Date startDate; - - private Date endDate; - - private eu.eudat.data.old.Grant.Status status; - - private UserEntity creationUser; - - private Date created; - - private Date modified; - - private String description; - - private String source; - - private String key; - - public GrantBuilder id(UUID id) { - this.id = id; - return this; - } - - public GrantBuilder dmps(List dmps) { - this.dmps = dmps; - return this; - } - - public GrantBuilder label(String label) { - this.label = label; - return this; - } - - public GrantBuilder abbreviation(String abbreviation) { - this.abbreviation = abbreviation; - return this; - } - - public GrantBuilder reference(String reference) { - this.reference = reference; - return this; - } - - public GrantBuilder uri(String uri) { - this.uri = uri; - return this; - } - - public GrantBuilder definition(String definition) { - this.definition = definition; - return this; - } - - public GrantBuilder startDate(Date startDate) { - this.startDate = startDate; - return this; - } - - public GrantBuilder endDate(Date endDate) { - this.endDate = endDate; - return this; - } - - public GrantBuilder status(eu.eudat.data.old.Grant.Status status) { - this.status = status; - return this; - } - - public GrantBuilder creationUser(UserEntity creationUser) { - this.creationUser = creationUser; - return this; - } - - public GrantBuilder created(Date created) { - this.created = created; - return this; - } - - public GrantBuilder modified(Date modified) { - this.modified = modified; - return this; - } - - public GrantBuilder description(String description) { - this.description = description; - return this; - } - - public GrantBuilder source(String source) { - this.source = source; - return this; - } - - public GrantBuilder key(String key) { - this.key = key; - return this; - } - - @Override - public Grant build() { - Grant grant = new Grant(); - grant.setStatus(status.getValue()); - grant.setAbbreviation(abbreviation); - grant.setCreated(created); - grant.setCreationUser(creationUser); - grant.setDefinition(definition); - grant.setDescription(description); - grant.setDmps(dmps); - grant.setEndDate(endDate); - grant.setId(id); - grant.setLabel(label); - grant.setModified(modified); - grant.setReference(reference); - grant.setCreationUser(creationUser); - grant.setStartDate(startDate); - grant.setSource(source); - grant.setKey(key); - return grant; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/models/OrganisationBuilder.java b/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/models/OrganisationBuilder.java deleted file mode 100644 index 04e2ab7e8..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/models/OrganisationBuilder.java +++ /dev/null @@ -1,88 +0,0 @@ -package eu.eudat.logic.builders.model.models; - -import eu.eudat.logic.builders.Builder; -import eu.eudat.models.data.dmp.Organisation; - -public class OrganisationBuilder extends Builder { - private String label; - private String name; - private String id; - private String reference; - private int status; - private String tag; - private String key; - - public String getLabel() { - return label; - } - - public OrganisationBuilder label(String label) { - this.label = label; - return this; - } - - public String getName() { - return name; - } - - public OrganisationBuilder name(String name) { - this.name = name; - return this; - } - - public String getId() { - return id; - } - - public OrganisationBuilder id(String id) { - this.id = id; - return this; - } - - public String getReference() { return reference; } - - public OrganisationBuilder reference(String reference) { - this.reference = reference; - return this; - } - - public int getStatus() { - return status; - } - - public OrganisationBuilder status(int status) { - this.status = status; - return this; - } - - public String getTag() { - return tag; - } - - public OrganisationBuilder tag(String tag) { - this.tag = tag; - return this; - } - - public String getKey() { - return key; - } - - public OrganisationBuilder key(String key) { - this.key = key; - return this; - } - - @Override - public Organisation build() { - Organisation Organisation = new Organisation(); - Organisation.setId(id); - Organisation.setReference(reference); - Organisation.setLabel(label); - Organisation.setName(name); - Organisation.setStatus(status); - Organisation.setTag(tag); - Organisation.setKey(key); - return Organisation; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/models/ProjectBuilder.java b/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/models/ProjectBuilder.java deleted file mode 100644 index e8d9f009e..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/models/ProjectBuilder.java +++ /dev/null @@ -1,139 +0,0 @@ -package eu.eudat.logic.builders.model.models; - - -import eu.eudat.data.UserEntity; -import eu.eudat.logic.builders.Builder; -import eu.eudat.models.data.dmp.DataManagementPlan; -import eu.eudat.models.data.project.Project; - -import java.util.Date; -import java.util.List; -import java.util.UUID; - -public class ProjectBuilder extends Builder { - - private UUID id; - private List dmps; - private String label; - private int type; - private String abbreviation; - private String reference; - private String uri; - private String definition; - private Date startDate; - private Date endDate; - private eu.eudat.data.old.Project.Status status; - private UserEntity creationUser; - private Date created; - private Date modified; - private String description; - private String source; - private String key; - - public ProjectBuilder id(UUID id) { - this.id = id; - return this; - } - - public ProjectBuilder dmps(List dmps) { - this.dmps = dmps; - return this; - } - - public ProjectBuilder label(String label) { - this.label = label; - return this; - } - - public ProjectBuilder type(int type) { - this.type = type; - return this; - } - - public ProjectBuilder abbreviation(String abbreviation) { - this.abbreviation = abbreviation; - return this; - } - - public ProjectBuilder reference(String reference) { - this.reference = reference; - return this; - } - - public ProjectBuilder uri(String uri) { - this.uri = uri; - return this; - } - - public ProjectBuilder definition(String definition) { - this.definition = definition; - return this; - } - - public ProjectBuilder startDate(Date startDate) { - this.startDate = startDate; - return this; - } - - public ProjectBuilder endDate(Date endDate) { - this.endDate = endDate; - return this; - } - - public ProjectBuilder status(eu.eudat.data.old.Project.Status status) { - this.status = status; - return this; - } - - public ProjectBuilder creationUser(UserEntity creationUser) { - this.creationUser = creationUser; - return this; - } - - public ProjectBuilder created(Date created) { - this.created = created; - return this; - } - - public ProjectBuilder modified(Date modified) { - this.modified = modified; - return this; - } - - public ProjectBuilder description(String description) { - this.description = description; - return this; - } - - public ProjectBuilder source(String source) { - this.source = source; - return this; - } - - public ProjectBuilder key(String key) { - this.key = key; - return this; - } - - @Override - public Project build() { - Project project = new Project(); - project.setStatus(status.getValue()); - project.setAbbreviation(abbreviation); - project.setCreated(created); - project.setCreationUser(creationUser); - project.setDefinition(definition); - project.setDescription(description); - project.setDmps(dmps); - project.setEndDate(endDate); - project.setId(id); - project.setLabel(label); - project.setModified(modified); - project.setReference(reference); - project.setCreationUser(creationUser); - project.setStartDate(startDate); - project.setSource(source); - project.setKey(key); - return project; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/models/ResearcherBuilder.java b/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/models/ResearcherBuilder.java deleted file mode 100644 index c8f9f0084..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/models/ResearcherBuilder.java +++ /dev/null @@ -1,88 +0,0 @@ -package eu.eudat.logic.builders.model.models; - -import eu.eudat.logic.builders.Builder; -import eu.eudat.models.data.dmp.Researcher; - -public class ResearcherBuilder extends Builder { - private String label; - private String name; - private String id; - private String reference; - private int status; - private String tag; - private String key; - - public String getLabel() { - return label; - } - - public ResearcherBuilder label(String label) { - this.label = label; - return this; - } - - public String getName() { - return name; - } - - public ResearcherBuilder name(String name) { - this.name = name; - return this; - } - - public String getId() { - return id; - } - - public ResearcherBuilder id(String id) { - this.id = id; - return this; - } - - public String getReference() { return reference; } - - public ResearcherBuilder reference(String reference) { - this.reference = reference; - return this; - } - - public int getStatus() { - return status; - } - - public ResearcherBuilder status(int status) { - this.status = status; - return this; - } - - public String getTag() { - return tag; - } - - public ResearcherBuilder tag(String tag) { - this.tag = tag; - return this; - } - - public String getKey() { - return key; - } - - public ResearcherBuilder key(String key) { - this.key = key; - return this; - } - - @Override - public Researcher build() { - Researcher researcher = new Researcher(); - researcher.setId(id); - researcher.setReference(reference); - researcher.setLabel(label); - researcher.setName(name); - researcher.setStatus(status); - researcher.setTag(tag); - researcher.setKey(key); - return researcher; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DashBoardManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DashBoardManager.java deleted file mode 100644 index d570d2759..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DashBoardManager.java +++ /dev/null @@ -1,360 +0,0 @@ -package eu.eudat.logic.managers; - -import eu.eudat.commons.enums.DescriptionStatus; -import eu.eudat.commons.enums.IsActive; -import eu.eudat.commons.scope.user.UserScope; -import eu.eudat.data.DmpEntity; -import eu.eudat.data.dao.criteria.DataManagementPlanCriteria; -import eu.eudat.data.dao.criteria.DatasetCriteria; -import eu.eudat.data.dao.criteria.GrantCriteria; -import eu.eudat.data.dao.criteria.OrganisationCriteria; -import eu.eudat.data.dao.entities.DMPDao; -import eu.eudat.data.dao.entities.DatasetDao; -import eu.eudat.data.dao.entities.GrantDao; -import eu.eudat.data.dao.entities.OrganisationDao; -import eu.eudat.data.DescriptionEntity; -import eu.eudat.data.old.Grant; -import eu.eudat.data.UserEntity; -import eu.eudat.data.query.items.table.dataset.DatasetTableRequest; -import eu.eudat.data.query.items.table.dmp.DataManagementPlanTableRequest; -import eu.eudat.logic.builders.model.models.RecentActivityDataBuilder; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.logic.services.operations.DatabaseRepository; -import eu.eudat.models.data.dashboard.recent.RecentActivity; -import eu.eudat.models.data.dashboard.recent.RecentActivityData; -import eu.eudat.models.data.dashboard.recent.model.RecentActivityModel; -import eu.eudat.models.data.dashboard.recent.model.RecentDatasetModel; -import eu.eudat.models.data.dashboard.recent.model.RecentDmpModel; -import eu.eudat.models.data.dashboard.recent.tablerequest.RecentActivityTableRequest; -import eu.eudat.models.data.dashboard.searchbar.SearchBarItem; -import eu.eudat.models.data.dashboard.statistics.DashBoardStatistics; -import eu.eudat.models.data.helpers.common.DataTableData; -import eu.eudat.models.data.listingmodels.DataManagementPlanListingModel; -import eu.eudat.models.data.listingmodels.DatasetListingModel; -import eu.eudat.types.searchbar.SearchBarItemType; -import gr.cite.commons.web.oidc.principal.CurrentPrincipalResolver; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import jakarta.transaction.Transactional; - -import javax.management.InvalidApplicationException; -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.util.*; -import java.util.concurrent.CompletableFuture; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -@Component -public class DashBoardManager { - private static final Logger logger = LoggerFactory.getLogger(DashBoardManager.class); - - private final Map> comparators = Stream.of(new Object[][] { - { "modified", Comparator.comparing(o -> ((RecentActivityModel)o).getModified()).reversed()}, - { "created", Comparator.comparing(o -> ((RecentActivityModel)o).getCreated()).reversed()}, - { "label", Comparator.comparing(o -> ((RecentActivityModel)o).getTitle())}, - { "status", Comparator.comparing(o -> ((RecentActivityModel)o).getStatus()).reversed()}, - { "finalizedAt", Comparator.comparing(o -> ((RecentActivityModel)o).getFinalizedAt(), Comparator.nullsLast(Comparator.naturalOrder())).reversed()}, - { "publishedAt", Comparator.comparing(o -> ((RecentActivityModel)o).getPublishedAt(), Comparator.nullsLast(Comparator.naturalOrder())).reversed()} - }).collect(Collectors.toMap(data -> (String) data[0], data -> (Comparator)data[1])); - - private final ApiContext apiContext; - private final DatabaseRepository databaseRepository; - private final DataManagementPlanManager dataManagementPlanManager; - private final DatasetManager datasetManager; - private final CurrentPrincipalResolver currentPrincipalResolver; - private final UserScope userScope; - - @Autowired - public DashBoardManager(ApiContext apiContext, DataManagementPlanManager dataManagementPlanManager, DatasetManager datasetManager, CurrentPrincipalResolver currentPrincipalResolver, UserScope userScope) { - this.apiContext = apiContext; - this.databaseRepository = apiContext.getOperationsContext().getDatabaseRepository(); - this.dataManagementPlanManager = dataManagementPlanManager; - this.datasetManager = datasetManager; - this.currentPrincipalResolver = currentPrincipalResolver; - this.userScope = userScope; - } - - public DashBoardStatistics getStatistics() throws InvalidApplicationException { - DashBoardStatistics statistics = new DashBoardStatistics(); - - DataManagementPlanCriteria publicCriteria = new DataManagementPlanCriteria(); - publicCriteria.setIsPublic(true); - publicCriteria.setOnlyPublic(true); - publicCriteria.setAllVersions(false); - - List dmps = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getWithCriteria(publicCriteria).toList(); - -// DataManagementPlanCriteria dataManagementPlanCriteria = new DataManagementPlanCriteria(); - OrganisationCriteria organisationCriteria = new OrganisationCriteria(); - /*dataManagementPlanCriteria.setAllVersions(false); - dataManagementPlanCriteria.setIsPublic(true);*/ - organisationCriteria.setPublic(true); - -// List dmps = databaseRepository.getDmpDao().getWithCriteria(dataManagementPlanCriteria).toList(); - long numberOfDatasets = 0; - LinkedList grants = new LinkedList<>(); - for (DmpEntity dmp : dmps) { -// numberOfDatasets = numberOfDatasets + dmp.getDataset().stream() //TODO -// .filter(item -> item.getStatus() == DescriptionStatus.Finalized).count(); -// if (dmp.getGrant() != null) { -// grants.add(dmp.getGrant()); -// } - } - - statistics.setTotalDataManagementPlanCount((long) dmps.size()); - statistics.setTotalDataSetCount(numberOfDatasets); - statistics.setTotalGrantCount(grants.stream().distinct().count()); - statistics.setTotalOrganisationCount(databaseRepository.getOrganisationDao().getWithCriteria(organisationCriteria).count()); - - return statistics; - } - - public DashBoardStatistics getMeStatistics() throws IOException, InvalidApplicationException { - Long datasets = 0L; - Long dmps = 0L; - DashBoardStatistics statistics = new DashBoardStatistics(); - DMPDao dataManagementPlanRepository = databaseRepository.getDmpDao(); - DatasetDao datasetRepository = databaseRepository.getDatasetDao(); - GrantDao grantRepository = databaseRepository.getGrantDao(); - OrganisationDao organisationRepository = databaseRepository.getOrganisationDao(); - UserEntity user = new UserEntity(); - user.setId(this.userScope.getUserId()); - DatasetCriteria datasetCriteria = new DatasetCriteria(); -// if (apiContext.getOperationsContext().getElasticRepository().getDatasetRepository() != null) { //TODO -// try { -// eu.eudat.elastic.criteria.DatasetCriteria datasetElasticCriteria = new eu.eudat.elastic.criteria.DatasetCriteria(); -// datasetElasticCriteria.setAllowAllVersions(false); -// datasetElasticCriteria.setPublic(false); -// datasetElasticCriteria.setCollaborators(Collections.singletonList(this.userScope.getUserId())); -// datasets = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().count(datasetElasticCriteria); -// }catch (Exception e) { -// logger.warn(e.getMessage(), e); -// datasets = null; -// } -// } - datasetCriteria.setAllVersions(false); - datasetCriteria.setIsPublic(false); - DataManagementPlanCriteria dataManagementPlanCriteria = new DataManagementPlanCriteria(); -// if (apiContext.getOperationsContext().getElasticRepository().getDmpRepository() != null) { //TODO -// try { -// eu.eudat.elastic.criteria.DmpCriteria dmpElasticCriteria = new eu.eudat.elastic.criteria.DmpCriteria(); -// dmpElasticCriteria.setAllowAllVersions(false); -// dmpElasticCriteria.setPublic(false); -// dmpElasticCriteria.setCollaborators(Collections.singletonList(this.userScope.getUserId())); -// dmps = apiContext.getOperationsContext().getElasticRepository().getDmpRepository().count(dmpElasticCriteria); -// }catch (Exception e) { -// logger.warn(e.getMessage(), e); -// dmps = null; -// } -// } - dataManagementPlanCriteria.setAllVersions(false); - dataManagementPlanCriteria.setOnlyPublic(false); - dataManagementPlanCriteria.setIsPublic(false); - - GrantCriteria grantCriteria = new GrantCriteria(); - grantCriteria.setActive(true); - - OrganisationCriteria organisationCriteria = new OrganisationCriteria(); - organisationCriteria.setActive(true); - - List roles = new LinkedList<>(); - if ((dmps == null || dmps == 0L) && (datasets == null || datasets == 0L)) { - CompletableFuture dmpFuture = dataManagementPlanRepository.getAuthenticated(dataManagementPlanRepository.getWithCriteria(dataManagementPlanCriteria), this.userScope.getUserId(), roles).distinct().countAsync() - .whenComplete((dmpsStats, throwable) -> statistics.setTotalDataManagementPlanCount(dmpsStats)); - CompletableFuture datasetFuture = datasetRepository.getAuthenticated( datasetRepository.getWithCriteria(datasetCriteria), user, roles).distinct().countAsync() - .whenComplete((datasetsStats, throwable) -> statistics.setTotalDataSetCount(datasetsStats)); - CompletableFuture.allOf(dmpFuture, datasetFuture).join(); - } else { - statistics.setTotalDataManagementPlanCount(dmps); - statistics.setTotalDataSetCount(datasets); - } - CompletableFuture grantFuture = grantRepository.getAuthenticated(grantRepository.getWithCriteria(grantCriteria), user).countAsync() - .whenComplete((grantsStats, throwable) -> statistics.setTotalGrantCount(grantsStats)); - CompletableFuture orgnanisationFuture = organisationRepository.getAuthenticated(organisationRepository.getWithCriteria(organisationCriteria).withHint("organisationRecentActivity"), user).countAsync() - .whenComplete((organisationStats, throwable) -> statistics.setTotalOrganisationCount(organisationStats)); - - CompletableFuture.allOf( grantFuture, orgnanisationFuture).join(); - return statistics; - } - - @Deprecated - public RecentActivity getRecentActivity(Integer numberofactivities) throws InvalidApplicationException { - RecentActivity activity = new RecentActivity(); - DMPDao dataManagementPlanRepository = databaseRepository.getDmpDao(); - DatasetDao datasetRepository = databaseRepository.getDatasetDao(); - GrantDao grantRepository = databaseRepository.getGrantDao(); - UserEntity user = new UserEntity(); - user.setId(this.userScope.getUserId()); - DatasetCriteria datasetCriteria = new DatasetCriteria(); - datasetCriteria.setAllVersions(false); - DataManagementPlanCriteria dataManagementPlanCriteria = new DataManagementPlanCriteria(); - dataManagementPlanCriteria.setAllVersions(false); - GrantCriteria grantCriteria = new GrantCriteria(); - RecentActivityDataBuilder recentActivityDataBuilder = apiContext.getOperationsContext().getBuilderFactory().getBuilder(RecentActivityDataBuilder.class); - - List roles = new LinkedList<>(); - CompletableFuture> dmps = dataManagementPlanRepository.getAuthenticated(dataManagementPlanRepository.getWithCriteria(dataManagementPlanCriteria), this.userScope.getUserId(), roles) - .withHint("dmpRecentActivity") - .orderBy((builder, root) -> builder.desc(root.get("modified"))) - .take(numberofactivities) - .selectAsync(item -> recentActivityDataBuilder.label(item.getLabel()).timestamp(Date.from(item.getUpdatedAt())).id(item.getId().toString()).build()) - .whenComplete((dmpActivities, throwable) -> activity.setRecentDmpActivities(dmpActivities)); - - CompletableFuture> datasets = datasetRepository.getAuthenticated(datasetRepository.getWithCriteria(datasetCriteria), user, roles).distinct() - .withHint("datasetRecentActivity") - .orderBy((builder, root) -> builder.desc(root.get("modified"))) - .take(numberofactivities) - .selectAsync(item -> recentActivityDataBuilder.label(item.getLabel()).timestamp(Date.from(item.getUpdatedAt())).id(item.getId().toString()).build()) - .whenComplete((datasetActivities, throwable) -> activity.setRecentDatasetActivities(datasetActivities)); - - CompletableFuture> grants = grantRepository.getAuthenticated(grantRepository.getWithCriteria(grantCriteria), user) - .withHint("grantRecentActivity") - .orderBy((builder, root) -> builder.desc(root.get("modified"))) - .take(numberofactivities) - .selectAsync(item -> recentActivityDataBuilder.label(item.getLabel()).timestamp(item.getModified()).id(item.getId().toString()).build()) - .whenComplete((grantActivities, throwable) -> activity.setRecentGrantActivities(grantActivities)); - - CompletableFuture.allOf(grants, dmps, datasets).join(); - return activity; - } - - @Transactional - public List getNewRecentActivity(RecentActivityTableRequest tableRequest) throws Exception { - boolean isAuthenticated = this.currentPrincipalResolver.currentPrincipal().isAuthenticated(); - List recentActivityModels = new ArrayList<>(); - UserEntity user = new UserEntity(); - if (isAuthenticated) { - user.setId(userScope.getUserId()); - } - DatasetCriteria datasetCriteria = new DatasetCriteria(); - datasetCriteria.setLike(tableRequest.getCriteria().getLike()); - if(tableRequest.getCriteria().getStatus() != null) { - datasetCriteria.setStatus(tableRequest.getCriteria().getStatus()); - } - datasetCriteria.setAllVersions(false); - datasetCriteria.setIsPublic(!isAuthenticated); - DataManagementPlanCriteria dataManagementPlanCriteria = new DataManagementPlanCriteria(); - dataManagementPlanCriteria.setAllVersions(false); - dataManagementPlanCriteria.setLike(tableRequest.getCriteria().getLike()); - if(tableRequest.getCriteria().getStatus() != null) { - dataManagementPlanCriteria.setStatus(tableRequest.getCriteria().getStatus()); - } - dataManagementPlanCriteria.setIsPublic(!isAuthenticated); - dataManagementPlanCriteria.setOnlyPublic(!isAuthenticated); - - //GK: Use the managers to get the data in order to be better synced with other lists - DataManagementPlanTableRequest dataManagementPlanTableRequest = new DataManagementPlanTableRequest(); - dataManagementPlanTableRequest.setCriteria(dataManagementPlanCriteria); - dataManagementPlanTableRequest.setOrderings(tableRequest.getOrderings()); - dataManagementPlanTableRequest.setLength(tableRequest.getLength()); - dataManagementPlanTableRequest.setOffset(tableRequest.getDmpOffset()); - DataTableData dmps = this.dataManagementPlanManager.getPaged(dataManagementPlanTableRequest, "listing"); - recentActivityModels.addAll(dmps.getData().stream().map(dataManagementPlanListingModel -> new RecentDmpModel().fromDataModel(dataManagementPlanListingModel.toDataModel())).collect(Collectors.toList())); - DatasetTableRequest datasetTableRequest = new DatasetTableRequest(); - datasetCriteria.setCollaborators(new ArrayList<>()); - datasetTableRequest.setCriteria(datasetCriteria); - datasetTableRequest.setOrderings(tableRequest.getOrderings()); - datasetTableRequest.getOrderings().getFields().addAll(datasetTableRequest.getOrderings().getFields().stream().filter(s -> s.contains("publishedAt")).map(s -> s.charAt(0) + "dmp:" + s.substring(1) + "|join|").collect(Collectors.toList())); - datasetTableRequest.getOrderings().getFields().removeIf(s -> s.contains("publishedAt") && !s.endsWith("|join|")); - datasetTableRequest.setLength(tableRequest.getLength()); - datasetTableRequest.setOffset(tableRequest.getDatasetOffset()); - DataTableData datasets = this.datasetManager.getPaged(datasetTableRequest); - recentActivityModels.addAll(datasets.getData().stream().map(datasetListingModel -> new RecentDatasetModel().fromDataModel(datasetListingModel.toDataModel())).collect(Collectors.toList())); - - //GK: Shuffle the deck otherwise we will summon the DMPodia when sorting with status - /*int pos = -1; - for (int i = (recentActivityModels.size() / 2); i < recentActivityModels.size(); i++) { - RecentActivityModel recentActivityModel = recentActivityModels.remove(i); - while (pos < recentActivityModels.size()) { - pos++; - if (pos % 2 != 0) { - break; - } - } - recentActivityModels.add(pos, recentActivityModel); - }*/ - //GK: No one likes to play shuffle with the recent activities. So just re-sort them based on how they have been sorted already - - String order = tableRequest.getOrderings().getFields().get(0).toCharArray()[0] + ""; - String field = tableRequest.getOrderings().getFields().get(0).substring(1); - if (field.contains(":") && field.contains("|")) { - field = field.substring(field.lastIndexOf(":") + 1, field.indexOf("|")); - } - field = field.equals("label") ? "title" : field; - field = field.substring(0, 1).toUpperCase() + field.substring(1); - String finalField = field; - recentActivityModels = recentActivityModels.stream().sorted((o1, o2) -> { - try { - return (order.equals("+") ? 1 : -1 ) * ((Comparable)o1.getClass().getMethod("get" + finalField).invoke(o1)).compareTo(o2.getClass().getMethod("get" + finalField).invoke(o2)); - } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { - logger.error(e.getLocalizedMessage(), e); - } - return 0; - }).collect(Collectors.toList()); - - return recentActivityModels; - } - - public List searchUserData(String like) throws InvalidApplicationException { - UserEntity user = new UserEntity(); - user.setId(this.userScope.getUserIdSafe()); - DMPDao dataManagementPlanRepository = databaseRepository.getDmpDao(); - DatasetDao datasetRepository = databaseRepository.getDatasetDao(); - GrantDao grantRepository = databaseRepository.getGrantDao(); - - List roles = new LinkedList<>(); - List searchBarItems = new LinkedList<>(); - - CompletableFuture> publicDmps = dataManagementPlanRepository.asQueryable() - .where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + like.toUpperCase() + "%")) - .where((builder, root) -> builder.notEqual(root.get("isActive"), IsActive.Inactive)) - .where((builder, root) -> builder.equal(root.get("isPublic"), true)) - .orderBy((builder, root) -> builder.desc(root.get("modified"))) - .selectAsync(item -> new SearchBarItem(item.getId().toString(), item.getLabel(), SearchBarItemType.DMP.getValue(), true)) - .whenComplete((dmpItems, throwable) -> searchBarItems.addAll(dmpItems)); - - CompletableFuture> publicDatasets = datasetRepository.asQueryable() - .where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + like.toUpperCase() + "%")) - .where((builder, root) -> builder.equal(root.get("status"), DescriptionStatus.Finalized)) - .where((builder, root) -> builder.equal(root.get("dmp").get("isPublic"), true)) - .orderBy((builder, root) -> builder.desc(root.get("modified"))) - .selectAsync(item -> new SearchBarItem(item.getId().toString(), item.getLabel(), SearchBarItemType.DATASET.getValue(), true)) - .whenComplete((dataSetItems, throwable) -> searchBarItems.addAll(dataSetItems)); - - if (this.userScope.isSet()) { - CompletableFuture> dmps = dataManagementPlanRepository.getAuthenticated(dataManagementPlanRepository.asQueryable(), this.userScope.getUserId(), roles) - .withHint("dmpRecentActivity") - .where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + like.toUpperCase() + "%")) - .where((builder, root) -> builder.notEqual(root.get("isActive"), IsActive.Inactive)) - .orderBy((builder, root) -> builder.desc(root.get("modified"))) - .selectAsync(item -> new SearchBarItem(item.getId().toString(), item.getLabel(), SearchBarItemType.DMP.getValue(), false)) - .whenComplete((dmpItems, throwable) -> searchBarItems.addAll(dmpItems)); - - CompletableFuture> datasets = datasetRepository.getAuthenticated(datasetRepository.asQueryable(), user, roles) - .withHint("datasetRecentActivity") - .where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + like.toUpperCase() + "%")) - .where((builder, root) -> builder.notEqual(root.get(DescriptionEntity._isActive), IsActive.Inactive)) - .where((builder, root) -> builder.notEqual(root.get("status"), DescriptionStatus.Canceled)) - .orderBy((builder, root) -> builder.desc(root.get("modified"))) - .selectAsync(item -> new SearchBarItem(item.getId().toString(), item.getLabel(), SearchBarItemType.DATASET.getValue(), false)) - .whenComplete((dataSetItems, throwable) -> searchBarItems.addAll(dataSetItems)); - - CompletableFuture> grants = grantRepository.getAuthenticated(grantRepository.asQueryable(), user) - .withHint("grantRecentActivity") - .where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + like.toUpperCase() + "%")) - .orderBy((builder, root) -> builder.desc(root.get("modified"))) - .selectAsync(item -> new SearchBarItem(item.getId().toString(), item.getLabel(), SearchBarItemType.GRANT.getValue(), false)) - .whenComplete((grantItems, throwable) -> searchBarItems.addAll(grantItems)); - - CompletableFuture.allOf(grants, dmps, datasets, publicDmps, publicDatasets).join(); - } else { - CompletableFuture.allOf(publicDmps, publicDatasets).join(); - } - - return searchBarItems; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataManagementPlanManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataManagementPlanManager.java index 6a83c202e..a692646c1 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataManagementPlanManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataManagementPlanManager.java @@ -46,12 +46,9 @@ import eu.eudat.models.data.datasetwizard.DatasetWizardModel; import eu.eudat.models.data.datasetwizard.DatasetsToBeFinalized; import eu.eudat.models.data.dmp.*; import eu.eudat.models.data.dynamicfields.DynamicFieldWithValue; -import eu.eudat.models.data.funder.FunderDMPEditorModel; -import eu.eudat.models.data.grant.GrantDMPEditorModel; import eu.eudat.models.data.helpermodels.Tuple; import eu.eudat.models.data.helpers.common.DataTableData; import eu.eudat.models.data.listingmodels.*; -import eu.eudat.models.data.project.ProjectDMPEditorModel; import eu.eudat.models.data.user.composite.PagedDatasetProfile; import eu.eudat.queryable.QueryableList; import eu.eudat.service.deposit.DepositService; @@ -505,24 +502,24 @@ public class DataManagementPlanManager { newDmp.setCreatorId(user.getId()); DmpBlueprintEntity dmpBlueprint = this.queryFactory.query(DmpBlueprintQuery.class).ids(newDmp.getBlueprintId()).first(); - if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Organizations)) { - createOrganisationsIfTheyDontExist(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getOrganisationDao()); - } - if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Researchers)) { - createResearchersIfTheyDontExist(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getResearcherDao(), user); - } - if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Funder)) { - createFunderIfItDoesntExist(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getFunderDao()); - } - if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Grant)) { - createGrantIfItDoesntExist(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getGrantDao()); - if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Project)) { -// if (newDmp.getProject() != null && newDmp.getGrant() != null && (newDmp.getProject().getLabel() == null || newDmp.getProject().getLabel().trim().isEmpty())) { //TODO -// newDmp.setProject(newDmp.getProject().projectFromGrant(newDmp.getGrant())); -// } - createProjectIfItDoesntExist(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getProjectDao()); - } - } +// if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Organizations)) { +// createOrganisationsIfTheyDontExist(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getOrganisationDao()); +// } +// if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Researchers)) { +// createResearchersIfTheyDontExist(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getResearcherDao(), user); +// } //TODO +// if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Funder)) { +// createFunderIfItDoesntExist(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getFunderDao()); +// }/TODO +// if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Grant)) { +// createGrantIfItDoesntExist(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getGrantDao()); +// if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Project)) { +//// if (newDmp.getProject() != null && newDmp.getGrant() != null && (newDmp.getProject().getLabel() == null || newDmp.getProject().getLabel().trim().isEmpty())) { //TODO +//// newDmp.setProject(newDmp.getProject().projectFromGrant(newDmp.getGrant())); +//// } +//// createProjectIfItDoesntExist(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getProjectDao()); //TODO +// } +// } DmpEntity dmp; if (dataManagementPlan.getId() != null) { @@ -666,18 +663,18 @@ public class DataManagementPlanManager { UserEntity user = this.queryFactory.query(UserQuery.class).ids(this.userScope.getUserId()).first(); DmpBlueprintEntity dmpBlueprint = this.queryFactory.query(DmpBlueprintQuery.class).ids(tempDMP.getBlueprintId()).first(); - if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Organizations)) { - createOrganisationsIfTheyDontExist(tempDMP, apiContext.getOperationsContext().getDatabaseRepository().getOrganisationDao()); - } - if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Researchers)) { - createResearchersIfTheyDontExist(tempDMP, apiContext.getOperationsContext().getDatabaseRepository().getResearcherDao(), user); - } - if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Funder)) { - createFunderIfItDoesntExist(tempDMP, apiContext.getOperationsContext().getDatabaseRepository().getFunderDao()); - } - if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Grant)) { - createGrantIfItDoesntExist(tempDMP, apiContext.getOperationsContext().getDatabaseRepository().getGrantDao()); - } +// if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Organizations)) { +// createOrganisationsIfTheyDontExist(tempDMP, apiContext.getOperationsContext().getDatabaseRepository().getOrganisationDao()); +// } +// if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Researchers)) { +// createResearchersIfTheyDontExist(tempDMP, apiContext.getOperationsContext().getDatabaseRepository().getResearcherDao(), user); +// } +// if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Funder)) { +// createFunderIfItDoesntExist(tempDMP, apiContext.getOperationsContext().getDatabaseRepository().getFunderDao()); +// } +// if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Grant)) { +// createGrantIfItDoesntExist(tempDMP, apiContext.getOperationsContext().getDatabaseRepository().getGrantDao()); +// }//TODO DmpEntity result = createOrUpdate(dataManagementPlan); @@ -716,25 +713,25 @@ public class DataManagementPlanManager { UserEntity user = apiContext.getOperationsContext().getBuilderFactory().getBuilder(UserInfoBuilder.class).id(this.userScope.getUserId()).build(); newDmp.setCreatorId(user.getId()); DmpBlueprintEntity dmpBlueprint = this.queryFactory.query(DmpBlueprintQuery.class).ids(newDmp.getBlueprintId()).first(); - if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Organizations)) { - createOrganisationsIfTheyDontExist(newDmp, databaseRepository.getOrganisationDao()); - } - if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Researchers)) { - createResearchersIfTheyDontExist(newDmp, databaseRepository.getResearcherDao(), user); - } - if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Funder)) { - createFunderIfItDoesntExist(newDmp, databaseRepository.getFunderDao()); - } - if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Grant)) { - createGrantIfItDoesntExist(newDmp, databaseRepository.getGrantDao()); - if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Project)) { - //TODO -// if (newDmp.getProject() != null && newDmp.getGrant() != null && (newDmp.getProject().getLabel() == null || newDmp.getProject().getLabel().trim().isEmpty())) { -// newDmp.setProject(newDmp.getProject().projectFromGrant(newDmp.getGrant())); -// } - createProjectIfItDoesntExist(newDmp, databaseRepository.getProjectDao()); - } - } +// if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Organizations)) { +// createOrganisationsIfTheyDontExist(newDmp, databaseRepository.getOrganisationDao()); +// } +// if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Researchers)) { +// createResearchersIfTheyDontExist(newDmp, databaseRepository.getResearcherDao(), user); +// }//TODO +// if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Funder)) { +// createFunderIfItDoesntExist(newDmp, databaseRepository.getFunderDao()); +// }//TODO +// if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Grant)) { +// createGrantIfItDoesntExist(newDmp, databaseRepository.getGrantDao()); +// if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Project)) { +// //TODO +//// if (newDmp.getProject() != null && newDmp.getGrant() != null && (newDmp.getProject().getLabel() == null || newDmp.getProject().getLabel().trim().isEmpty())) { +//// newDmp.setProject(newDmp.getProject().projectFromGrant(newDmp.getGrant())); +//// } +//// createProjectIfItDoesntExist(newDmp, databaseRepository.getProjectDao()); //TODO +// } +// }//TODO newDmp.setGroupId(oldDmp.getGroupId()); newDmp.setVersion((short)(oldDmp.getVersion() + 1)); @@ -811,25 +808,25 @@ public class DataManagementPlanManager { UserEntity user = apiContext.getOperationsContext().getBuilderFactory().getBuilder(UserInfoBuilder.class).id(this.userScope.getUserId()).build(); newDmp.setCreatorId(user.getId()); DmpBlueprintEntity dmpBlueprint = this.queryFactory.query(DmpBlueprintQuery.class).ids(newDmp.getBlueprintId()).first(); - if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Organizations)) { - createOrganisationsIfTheyDontExist(newDmp, databaseRepository.getOrganisationDao()); - } - if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Researchers)) { - createResearchersIfTheyDontExist(newDmp, databaseRepository.getResearcherDao(), user); - } - if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Funder)) { - createFunderIfItDoesntExist(newDmp, databaseRepository.getFunderDao()); - } - if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Grant)) { - createGrantIfItDoesntExist(newDmp, databaseRepository.getGrantDao()); - //TODO -// if(this.dmpBlueprintService.fieldInBlueprint(newDmp.getProfile(), DmpBlueprintSystemFieldType.Project)) { -// if (newDmp.getProject() != null && newDmp.getGrant() != null && (newDmp.getProject().getLabel() == null || newDmp.getProject().getLabel().trim().isEmpty())) { -// newDmp.setProject(newDmp.getProject().projectFromGrant(newDmp.getGrant())); -// } -// createProjectIfItDoesntExist(newDmp, databaseRepository.getProjectDao()); -// } - } +// if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Organizations)) { +// createOrganisationsIfTheyDontExist(newDmp, databaseRepository.getOrganisationDao()); +// } +// if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Researchers)) { +// createResearchersIfTheyDontExist(newDmp, databaseRepository.getResearcherDao(), user); +// } +// if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Funder)) { +// createFunderIfItDoesntExist(newDmp, databaseRepository.getFunderDao()); +// } +// if(this.dmpBlueprintService.fieldInBlueprint(dmpBlueprint, DmpBlueprintSystemFieldType.Grant)) { +// createGrantIfItDoesntExist(newDmp, databaseRepository.getGrantDao()); +// //TODO +//// if(this.dmpBlueprintService.fieldInBlueprint(newDmp.getProfile(), DmpBlueprintSystemFieldType.Project)) { +//// if (newDmp.getProject() != null && newDmp.getGrant() != null && (newDmp.getProject().getLabel() == null || newDmp.getProject().getLabel().trim().isEmpty())) { +//// newDmp.setProject(newDmp.getProject().projectFromGrant(newDmp.getGrant())); +//// } +//// createProjectIfItDoesntExist(newDmp, databaseRepository.getProjectDao()); +//// } +// }//TODO newDmp.setGroupId(UUID.randomUUID()); newDmp.setVersion((short)0); @@ -938,7 +935,7 @@ public class DataManagementPlanManager { }); } - private void createResearchersIfTheyDontExist(DmpEntity newDmp, ResearcherDao researcherRepository, UserEntity user) throws InvalidApplicationException { +// private void createResearchersIfTheyDontExist(DmpEntity newDmp, ResearcherDao researcherRepository, UserEntity user) throws InvalidApplicationException { // if (newDmp.getResearchers() != null && !newDmp.getResearchers().isEmpty()) { //TODO // for (eu.eudat.data.old.Researcher researcher : newDmp.getResearchers()) { // ResearcherCriteria criteria = new ResearcherCriteria(); @@ -952,9 +949,9 @@ public class DataManagementPlanManager { // } // } // } - } +// } - private void createOrganisationsIfTheyDontExist(DmpEntity newDmp, OrganisationDao organisationRepository) throws InvalidApplicationException { +// private void createOrganisationsIfTheyDontExist(DmpEntity newDmp, OrganisationDao organisationRepository) throws InvalidApplicationException { // if (newDmp.getOrganisations() != null && !newDmp.getOrganisations().isEmpty()) { //TODO // for (Organisation organisation : newDmp.getOrganisations()) { // boolean createNew = false; @@ -976,9 +973,9 @@ public class DataManagementPlanManager { // } // } // } - } +// } - private void createGrantIfItDoesntExist(DmpEntity newDmp, GrantDao grantDao) throws InvalidApplicationException { +// private void createGrantIfItDoesntExist(DmpEntity newDmp, GrantDao grantDao) throws InvalidApplicationException { // if (newDmp.getGrant() != null) { //TODO // Grant grant = newDmp.getGrant(); // GrantCriteria criteria = new GrantCriteria(); @@ -1004,9 +1001,9 @@ public class DataManagementPlanManager { // grantDao.createOrUpdate(grant); // } // } - } +// } - private void createFunderIfItDoesntExist(DmpEntity newDmp, FunderDao funderDao) throws InvalidApplicationException { +// private void createFunderIfItDoesntExist(DmpEntity newDmp, FunderDao funderDao) throws InvalidApplicationException { // if (newDmp.getGrant() != null && newDmp.getGrant().getFunder() != null) { //TODO // Funder funder = newDmp.getGrant().getFunder(); // FunderCriteria criteria = new FunderCriteria(); @@ -1022,9 +1019,9 @@ public class DataManagementPlanManager { // funderDao.createOrUpdate(funder); // } // } - } +// } - private void createProjectIfItDoesntExist(DmpEntity newDmp, ProjectDao projectDao) throws InvalidApplicationException { //TODO +// private void createProjectIfItDoesntExist(DmpEntity newDmp, ProjectDao projectDao) throws InvalidApplicationException { //TODO // if (newDmp.getProject() != null) { // Project project = newDmp.getProject(); // ProjectCriteria criteria = new ProjectCriteria(); @@ -1040,16 +1037,16 @@ public class DataManagementPlanManager { // createExternalProject(project, projectDao); // } // } - } - - private void createExternalProject(Project project, ProjectDao projectDao) { - if (project.getStartdate() == null) project.setStartdate(new Date()); - if (project.getEnddate() == null) project.setEnddate(new Date()); - project.setType(Project.ProjectType.EXTERNAL.getValue()); - if (project.getId() == null) project.setId(UUID.randomUUID()); - projectDao.createOrUpdate(project); - metricsManager.increaseValue(MetricNames.PROJECT, 1, null); - } +// } +// +// private void createExternalProject(Project project, ProjectDao projectDao) { +// if (project.getStartdate() == null) project.setStartdate(new Date()); +// if (project.getEnddate() == null) project.setEnddate(new Date()); +// project.setType(Project.ProjectType.EXTERNAL.getValue()); +// if (project.getId() == null) project.setId(UUID.randomUUID()); +// projectDao.createOrUpdate(project); +// metricsManager.increaseValue(MetricNames.PROJECT, 1, null); +// } private void copyDatasets(DmpEntity newDmp, DatasetDao datasetDao) throws InvalidApplicationException { List> futures = new LinkedList<>(); @@ -2162,41 +2159,42 @@ public class DataManagementPlanManager { } } dm.setProperties(dmpPropertiesMap); +//TODO +// if (this.dmpBlueprintService.fieldInBlueprint(dmpProfileImportModel.getDmpProfileId(), DmpBlueprintSystemFieldType.Funder)) { +// eu.eudat.models.data.funder.Funder funder = new eu.eudat.models.data.funder.Funder(); +// FunderImportModels funderImport = dataManagementPlans.get(0).getFunderImportModels(); +// funder.setId(funderImport.getId()); +// funder.setLabel(funderImport.getLabel()); +// FunderDMPEditorModel funderEditor = new FunderDMPEditorModel(); +// funderEditor.setExistFunder(funder); +// +// dm.setFunder(funderEditor); +// } + //TODO +// if (this.dmpBlueprintService.fieldInBlueprint(dmpProfileImportModel.getDmpProfileId(), DmpBlueprintSystemFieldType.Grant)) { +// eu.eudat.models.data.grant.Grant grant = new eu.eudat.models.data.grant.Grant(); +// GrantImportModels grantImport = dataManagementPlans.get(0).getGrantImport(); +// grant.setId(grantImport.getId()); +// grant.setLabel(grantImport.getLabel()); +// grant.setAbbreviation(grantImport.getAbbreviation()); +// grant.setDescription(grantImport.getDescription()); +// GrantDMPEditorModel grantEditor = new GrantDMPEditorModel(); +// grantEditor.setExistGrant(grant); +// +// dm.setGrant(grantEditor); +// } - if (this.dmpBlueprintService.fieldInBlueprint(dmpProfileImportModel.getDmpProfileId(), DmpBlueprintSystemFieldType.Funder)) { - eu.eudat.models.data.funder.Funder funder = new eu.eudat.models.data.funder.Funder(); - FunderImportModels funderImport = dataManagementPlans.get(0).getFunderImportModels(); - funder.setId(funderImport.getId()); - funder.setLabel(funderImport.getLabel()); - FunderDMPEditorModel funderEditor = new FunderDMPEditorModel(); - funderEditor.setExistFunder(funder); - - dm.setFunder(funderEditor); - } - - if (this.dmpBlueprintService.fieldInBlueprint(dmpProfileImportModel.getDmpProfileId(), DmpBlueprintSystemFieldType.Grant)) { - eu.eudat.models.data.grant.Grant grant = new eu.eudat.models.data.grant.Grant(); - GrantImportModels grantImport = dataManagementPlans.get(0).getGrantImport(); - grant.setId(grantImport.getId()); - grant.setLabel(grantImport.getLabel()); - grant.setAbbreviation(grantImport.getAbbreviation()); - grant.setDescription(grantImport.getDescription()); - GrantDMPEditorModel grantEditor = new GrantDMPEditorModel(); - grantEditor.setExistGrant(grant); - - dm.setGrant(grantEditor); - } - - if (this.dmpBlueprintService.fieldInBlueprint(dmpProfileImportModel.getDmpProfileId(), DmpBlueprintSystemFieldType.Project)) { - eu.eudat.models.data.project.Project project = new eu.eudat.models.data.project.Project(); - ProjectImportModels projectImport = dataManagementPlans.get(0).getProjectImportModels(); - project.setId(projectImport.getId()); - project.setLabel(projectImport.getLabel()); - ProjectDMPEditorModel projectEditor = new ProjectDMPEditorModel(); - projectEditor.setExistProject(project); - - dm.setProject(projectEditor); - } + //TODO +// if (this.dmpBlueprintService.fieldInBlueprint(dmpProfileImportModel.getDmpProfileId(), DmpBlueprintSystemFieldType.Project)) { +// eu.eudat.models.data.project.Project project = new eu.eudat.models.data.project.Project(); +// ProjectImportModels projectImport = dataManagementPlans.get(0).getProjectImportModels(); +// project.setId(projectImport.getId()); +// project.setLabel(projectImport.getLabel()); +// ProjectDMPEditorModel projectEditor = new ProjectDMPEditorModel(); +// projectEditor.setExistProject(project); +// +// dm.setProject(projectEditor); +// } List associatedProfiles = new LinkedList<>(); // if (profiles != null && profiles.length > 0) { @@ -2220,24 +2218,24 @@ public class DataManagementPlanManager { } } - List organisations = new ArrayList<>(); - for (OrganisationImportModel org : dataManagementPlans.get(0).getOrganisationImportModels()) { - eu.eudat.models.data.dmp.Organisation organisation = new eu.eudat.models.data.dmp.Organisation(); - organisation.setName(org.getOrganaisationNameImport()); - organisation.setReference(org.getOrganaisationReferenceImport()); - organisation.setKey(organisation.getReference().split(":")[0]); - organisations.add(organisation); - } +// List organisations = new ArrayList<>(); +// for (OrganisationImportModel org : dataManagementPlans.get(0).getOrganisationImportModels()) { +// eu.eudat.models.data.dmp.Organisation organisation = new eu.eudat.models.data.dmp.Organisation(); +// organisation.setName(org.getOrganaisationNameImport()); +// organisation.setReference(org.getOrganaisationReferenceImport()); +// organisation.setKey(organisation.getReference().split(":")[0]); +// organisations.add(organisation); +// }//TODO - List researchers = new LinkedList<>(); - for (ResearcherImportModels res : dataManagementPlans.get(0).getResearchersImportModels()) { - eu.eudat.models.data.dmp.Researcher researcher = new eu.eudat.models.data.dmp.Researcher(); - researcher.setLabel(res.getResearcherImportName()); - researcher.setName(res.getResearcherImportName()); - researcher.setReference(res.getResearcherImportReference()); - researcher.setKey(researcher.getReference().split(":")[0]); - researchers.add(researcher); - } +// List researchers = new LinkedList<>(); +// for (ResearcherImportModels res : dataManagementPlans.get(0).getResearchersImportModels()) { +// eu.eudat.models.data.dmp.Researcher researcher = new eu.eudat.models.data.dmp.Researcher(); +// researcher.setLabel(res.getResearcherImportName()); +// researcher.setName(res.getResearcherImportName()); +// researcher.setReference(res.getResearcherImportReference()); +// researcher.setKey(researcher.getReference().split(":")[0]); +// researchers.add(researcher); +// } //TODO //List associatedUsers = new LinkedList<>(); List dynamicFields = new LinkedList<>(); @@ -2246,8 +2244,8 @@ public class DataManagementPlanManager { dm.setLabel(files[0].getOriginalFilename()); // Sets label. dm.setDescription(dataManagementPlans.get(0).getDescriptionImport()); // Sets description property. dm.setProfiles(associatedProfiles); - dm.setOrganisations(organisations); // Sets organisations property. - dm.setResearchers(researchers); // Sets researchers property. +// dm.setOrganisations(organisations); // Sets organisations property. +// dm.setResearchers(researchers); // Sets researchers property. //dm.setAssociatedUsers(associatedUsers); // Sets associatedUsers property. dm.setDynamicFields(dynamicFields); // Sets dynamicFields property. //dm.setDefinition(dmpProfile); diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataRepositoryManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataRepositoryManager.java deleted file mode 100644 index 3e92784bb..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataRepositoryManager.java +++ /dev/null @@ -1,100 +0,0 @@ -package eu.eudat.logic.managers; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import eu.eudat.commons.enums.ReferenceType; -import eu.eudat.commons.scope.user.UserScope; -import eu.eudat.data.dao.criteria.DataRepositoryCriteria; -import eu.eudat.data.old.DataRepository; -import eu.eudat.service.reference.external.criteria.ExternalReferenceCriteria; -import eu.eudat.commons.exceptions.HugeResultSetException; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.models.data.datarepository.DataRepositoryModel; -import gr.cite.tools.exception.MyNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import javax.management.InvalidApplicationException; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * Created by ikalyvas on 9/3/2018. - */ -@Component -public class DataRepositoryManager { - private ApiContext apiContext; - private UserScope userScope; - - @Autowired - public DataRepositoryManager(ApiContext apiContext, UserScope userScope) { - this.apiContext = apiContext; - this.userScope = userScope; - } - - public DataRepository create(eu.eudat.models.data.datarepository.DataRepositoryModel dataRepositoryModel) throws Exception { - DataRepository dataRepository = dataRepositoryModel.toDataModel(); - dataRepository.getCreationUser().setId(userScope.getUserId()); - return apiContext.getOperationsContext().getDatabaseRepository().getDataRepositoryDao().createOrUpdate(dataRepository); - } - - public List getDataRepositories(String query, String type) throws HugeResultSetException, MyNotFoundException, InvalidApplicationException { - ExternalReferenceCriteria externalReferenceCriteria = new ExternalReferenceCriteria(query); - List> remoteRepos = this.apiContext.getOperationsContext().getRemoteFetcher().getReferences(ReferenceType.DataRepositories, externalReferenceCriteria, type); - - DataRepositoryCriteria criteria = new DataRepositoryCriteria(); - if (!query.isEmpty()) criteria.setLike(query); - criteria.setCreationUserId(userScope.getUserId()); - - List dataRepositoryModels = new LinkedList<>(); - if (type.equals("")) { - List dataRepositoryList = (this.apiContext.getOperationsContext().getDatabaseRepository().getDataRepositoryDao().getWithCriteria(criteria)).toList(); - dataRepositoryModels = dataRepositoryList.stream().map(item -> new DataRepositoryModel().fromDataModel(item)).collect(Collectors.toList()); - } - - ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - dataRepositoryModels.addAll(remoteRepos.stream().map(item -> mapper.convertValue(item, DataRepositoryModel.class)).collect(Collectors.toList())); - - return dataRepositoryModels; - } - public List getPubRepositories(String query, String type) throws HugeResultSetException, MyNotFoundException, InvalidApplicationException { - ExternalReferenceCriteria externalReferenceCriteria = new ExternalReferenceCriteria(query); - List> remoteRepos = this.apiContext.getOperationsContext().getRemoteFetcher().getReferences(ReferenceType.PubRepositories, externalReferenceCriteria, type); - - DataRepositoryCriteria criteria = new DataRepositoryCriteria(); - if (!query.isEmpty()) criteria.setLike(query); - criteria.setCreationUserId(userScope.getUserId()); - - List dataRepositoryModels = new LinkedList<>(); - if (type.equals("")) { - List dataRepositoryList = (this.apiContext.getOperationsContext().getDatabaseRepository().getDataRepositoryDao().getWithCriteria(criteria)).toList(); - dataRepositoryModels = dataRepositoryList.stream().map(item -> new DataRepositoryModel().fromDataModel(item)).collect(Collectors.toList()); - } - - ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - dataRepositoryModels.addAll(remoteRepos.stream().map(item -> mapper.convertValue(item, DataRepositoryModel.class)).collect(Collectors.toList())); - - return dataRepositoryModels; - } - public List getJournals(String query, String type) throws HugeResultSetException, MyNotFoundException, InvalidApplicationException { - ExternalReferenceCriteria externalReferenceCriteria = new ExternalReferenceCriteria(query); - List> remoteRepos = this.apiContext.getOperationsContext().getRemoteFetcher().getReferences(ReferenceType.Journals, externalReferenceCriteria, type); - - DataRepositoryCriteria criteria = new DataRepositoryCriteria(); - if (!query.isEmpty()) criteria.setLike(query); - criteria.setCreationUserId(userScope.getUserId()); - - List dataRepositoryModels = new LinkedList<>(); - if (type.equals("")) { - List dataRepositoryList = (this.apiContext.getOperationsContext().getDatabaseRepository().getDataRepositoryDao().getWithCriteria(criteria)).toList(); - dataRepositoryModels = dataRepositoryList.stream().map(item -> new DataRepositoryModel().fromDataModel(item)).collect(Collectors.toList()); - } - - ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - dataRepositoryModels.addAll(remoteRepos.stream().map(item -> mapper.convertValue(item, DataRepositoryModel.class)).collect(Collectors.toList())); - - return dataRepositoryModels; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetManager.java index 3ec4d2ef4..37119d681 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetManager.java @@ -12,9 +12,7 @@ import eu.eudat.commons.enums.IsActive; import eu.eudat.commons.scope.user.UserScope; import eu.eudat.data.*; import eu.eudat.data.dao.criteria.*; -import eu.eudat.data.dao.entities.DataRepositoryDao; import eu.eudat.data.dao.entities.DatasetDao; -import eu.eudat.data.dao.entities.RegistryDao; import eu.eudat.commons.enums.old.notification.ActiveStatus; import eu.eudat.commons.enums.old.notification.ContactType; import eu.eudat.commons.enums.old.notification.NotificationType; @@ -659,17 +657,17 @@ public class DatasetManager { UserEntity userInfo = apiContext.getOperationsContext().getBuilderFactory().getBuilder(UserInfoBuilder.class).id(this.userScope.getUserId()).build(); descriptionEntity.setDmpDescriptionTemplateId(userInfo.getId()); - createDataRepositoriesIfTheyDontExist(apiContext.getOperationsContext().getDatabaseRepository().getDataRepositoryDao(), descriptionEntity); +// createDataRepositoriesIfTheyDontExist(apiContext.getOperationsContext().getDatabaseRepository().getDataRepositoryDao(), descriptionEntity);//TODO createExternalDatasetsIfTheyDontExist(descriptionEntity); - createRegistriesIfTheyDontExist(apiContext.getOperationsContext().getDatabaseRepository().getRegistryDao(), descriptionEntity); +// createRegistriesIfTheyDontExist(apiContext.getOperationsContext().getDatabaseRepository().getRegistryDao(), descriptionEntity); createServicesIfTheyDontExist(descriptionEntity); DescriptionEntity descriptionEntity1 = apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao().createOrUpdate(descriptionEntity); datasetWizardModel.setId(descriptionEntity1.getId()); - if (datasetWizardModel.getDmp().getGrant() == null) { - DmpEntity dmp1 = databaseRepository.getDmpDao().find(this.queryFactory.query(DmpDescriptionTemplateQuery.class).ids(descriptionEntity1.getDmpDescriptionTemplateId()).isActive(IsActive.Active).first().getDmpId()); - - datasetWizardModel.setDmp(new DataManagementPlan().fromDataModelNoDatasets(dmp1)); - } +// if (datasetWizardModel.getDmp().getGrant() == null) { //TODO +// DmpEntity dmp1 = databaseRepository.getDmpDao().find(this.queryFactory.query(DmpDescriptionTemplateQuery.class).ids(descriptionEntity1.getDmpDescriptionTemplateId()).isActive(IsActive.Active).first().getDmpId()); +// +// datasetWizardModel.setDmp(new DataManagementPlan().fromDataModelNoDatasets(dmp1)); +// } // descriptionEntity1.setDescriptionTemplateId(datasetWizardModel.getProfile().getId()); //TODO // datasetWizardModel.setDatasetProfileDefinition(getPagedProfile(datasetWizardModel, dataset1)); UUID dmpId = this.queryFactory.query(DmpDescriptionTemplateQuery.class).ids(descriptionEntity1.getDmpDescriptionTemplateId()).isActive(IsActive.Active).first().getDmpId(); @@ -894,9 +892,9 @@ public class DatasetManager { } - - private void createRegistriesIfTheyDontExist(RegistryDao registryDao, DescriptionEntity descriptionEntity) throws InvalidApplicationException { - //TODO implement it on create + //TODO implement it on create +// private void createRegistriesIfTheyDontExist(RegistryDao registryDao, DescriptionEntity descriptionEntity) throws InvalidApplicationException { +// // if (descriptionEntity.getRegistries() != null && !descriptionEntity.getRegistries().isEmpty()) { // for (Registry registry : descriptionEntity.getRegistries()) { // RegistryCriteria criteria = new RegistryCriteria(); @@ -909,10 +907,11 @@ public class DatasetManager { // } // } // } - } +// } - private void createDataRepositoriesIfTheyDontExist(DataRepositoryDao dataRepositoryDao, DescriptionEntity descriptionEntity) throws InvalidApplicationException { - //TODO implement it on create + //TODO implement it on create +// private void createDataRepositoriesIfTheyDontExist(DataRepositoryDao dataRepositoryDao, DescriptionEntity descriptionEntity) throws InvalidApplicationException { +// // if (descriptionEntity.getDatasetDataRepositories() != null && !descriptionEntity.getDatasetDataRepositories().isEmpty()) { // for (DatasetDataRepository datasetDataRepository : descriptionEntity.getDatasetDataRepositories()) { // DataRepositoryCriteria criteria = new DataRepositoryCriteria(); @@ -931,7 +930,7 @@ public class DatasetManager { // } // } // } - } +// } private void createServicesIfTheyDontExist(DescriptionEntity descriptionEntity) throws InvalidApplicationException { //TODO implement it on create @@ -1063,8 +1062,8 @@ public class DatasetManager { entity.setDmpDescriptionTemplateId(userInfo.getId()); updateTagsXmlImportDataset(entity); - createRegistriesIfTheyDontExist(apiContext.getOperationsContext().getDatabaseRepository().getRegistryDao(), entity); - createDataRepositoriesIfTheyDontExist(apiContext.getOperationsContext().getDatabaseRepository().getDataRepositoryDao(), entity); +// createRegistriesIfTheyDontExist(apiContext.getOperationsContext().getDatabaseRepository().getRegistryDao(), entity); +// createDataRepositoriesIfTheyDontExist(apiContext.getOperationsContext().getDatabaseRepository().getDataRepositoryDao(), entity);//TODO createServicesIfTheyDontExist(entity); createExternalDatasetsIfTheyDontExist(entity); diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/ExternalDatasetManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/ExternalDatasetManager.java deleted file mode 100644 index ded355f9c..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/ExternalDatasetManager.java +++ /dev/null @@ -1,88 +0,0 @@ -package eu.eudat.logic.managers; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import eu.eudat.commons.enums.ReferenceType; -import eu.eudat.commons.scope.user.UserScope; -import eu.eudat.data.old.ExternalDataset; -import eu.eudat.logic.builders.model.criteria.ExternalDatasetCriteriaBuilder; -import eu.eudat.logic.builders.model.models.DataTableDataBuilder; -import eu.eudat.data.dao.criteria.ExternalDatasetCriteria; -import eu.eudat.service.reference.external.criteria.ExternalReferenceCriteria; -import eu.eudat.logic.services.operations.DatabaseRepository; -import eu.eudat.models.data.externaldataset.ExternalDatasetListingModel; -import eu.eudat.data.query.items.table.externaldataset.ExternalDatasetTableRequest; -import eu.eudat.models.data.helpers.common.DataTableData; -import eu.eudat.commons.exceptions.HugeResultSetException; -import eu.eudat.service.reference.external.RemoteFetcher; -import eu.eudat.queryable.QueryableList; -import eu.eudat.logic.services.ApiContext; -import gr.cite.tools.exception.MyNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import javax.management.InvalidApplicationException; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.stream.Collectors; - -@Component -public class ExternalDatasetManager { - - private ApiContext apiContext; - private DatabaseRepository databaseRepository; - private RemoteFetcher remoteFetcher; - private final UserScope userScope; - @Autowired - public ExternalDatasetManager(ApiContext apiContext, UserScope userScope) { - this.apiContext = apiContext; - this.databaseRepository = apiContext.getOperationsContext().getDatabaseRepository(); - this.remoteFetcher = apiContext.getOperationsContext().getRemoteFetcher(); - this.userScope = userScope; - } - - public DataTableData getPaged(ExternalDatasetTableRequest externalDatasetTableRequest) throws Exception { - QueryableList items = apiContext.getOperationsContext().getDatabaseRepository().getExternalDatasetDao().getWithCriteria(externalDatasetTableRequest.getCriteria()); - QueryableList pagedItems = PaginationManager.applyPaging(items, externalDatasetTableRequest); - List externalDatasetListingmodels = pagedItems.select(item -> new ExternalDatasetListingModel().fromDataModel(item)); - return apiContext.getOperationsContext().getBuilderFactory().getBuilder(DataTableDataBuilder.class).data(externalDatasetListingmodels).totalCount(items.count()).build(); - } - - public List getWithExternal(String query, String type) throws HugeResultSetException, MyNotFoundException, InvalidApplicationException { - // Fetch the local saved external Datasets that belong to the user. - ExternalDatasetCriteria criteria = apiContext.getOperationsContext().getBuilderFactory().getBuilder(ExternalDatasetCriteriaBuilder.class).like(query).build(); - criteria.setCreationUserId(this.userScope.getUserId()); - QueryableList items = apiContext.getOperationsContext().getDatabaseRepository().getExternalDatasetDao().getWithCriteria(criteria); - - // Fetch external Datasets from external sources. - ExternalReferenceCriteria externalReferenceCriteria = new ExternalReferenceCriteria(query); - List> remoteRepos = this.apiContext.getOperationsContext().getRemoteFetcher().getReferences(ReferenceType.Datasets, externalReferenceCriteria, type); - - // Parse items from external sources to listing models. - ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - List externalDatasetModels = remoteRepos.stream() - .map(item -> mapper.convertValue(item, ExternalDatasetListingModel.class)) - .collect(Collectors.toCollection(LinkedList::new)); - - // Merge fetched and local. - List externalDatasets = items.select(item -> new ExternalDatasetListingModel().fromDataModel(item)); - externalDatasets.addAll(externalDatasetModels); - - return externalDatasets; - } - - public ExternalDatasetListingModel getSingle(UUID id) throws HugeResultSetException, MyNotFoundException, InstantiationException, IllegalAccessException, InvalidApplicationException { - ExternalDataset externalDataset = databaseRepository.getExternalDatasetDao().find(id); - ExternalDatasetListingModel externalDatasetModel = new ExternalDatasetListingModel(); - externalDatasetModel.fromDataModel(externalDataset); - return externalDatasetModel; - } - - public ExternalDataset create(eu.eudat.models.data.externaldataset.ExternalDatasetModel externalDatasetModel) throws Exception { - ExternalDataset externalDataset = externalDatasetModel.toDataModel(); - externalDataset.getCreationUser().setId(this.userScope.getUserId()); - return apiContext.getOperationsContext().getDatabaseRepository().getExternalDatasetDao().createOrUpdate(externalDataset); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/FunderManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/FunderManager.java deleted file mode 100644 index 1352e2e5e..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/FunderManager.java +++ /dev/null @@ -1,70 +0,0 @@ -package eu.eudat.logic.managers; - -import eu.eudat.commons.enums.ReferenceType; -import eu.eudat.commons.scope.user.UserScope; -import eu.eudat.data.UserEntity; -import eu.eudat.data.query.items.item.funder.FunderCriteriaRequest; -import eu.eudat.logic.builders.model.models.FunderBuilder; -import eu.eudat.service.reference.external.criteria.ExternalReferenceCriteria; -import eu.eudat.commons.exceptions.HugeResultSetException; -import eu.eudat.service.reference.external.RemoteFetcher; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.logic.utilities.helpers.ListHelper; -import eu.eudat.models.data.external.ExternalSourcesItemModel; -import eu.eudat.models.data.external.FundersExternalSourcesModel; -import eu.eudat.models.data.funder.Funder; -import eu.eudat.queryable.QueryableList; -import gr.cite.tools.exception.MyNotFoundException; -import org.springframework.stereotype.Component; - -import javax.management.InvalidApplicationException; -import java.util.Comparator; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -@Component -public class FunderManager { - - private ApiContext apiContext; - private RemoteFetcher remoteFetcher; - private ListHelper listHelper; - private final UserScope userScope; - - public FunderManager(ApiContext apiContext, RemoteFetcher remoteFetcher, ListHelper listHelper, UserScope userScope) { - this.apiContext = apiContext; - this.remoteFetcher = remoteFetcher; - this.listHelper = listHelper; - this.userScope = userScope; - } - - public List getCriteriaWithExternal(FunderCriteriaRequest funderCriteria) throws HugeResultSetException, MyNotFoundException, InvalidApplicationException { - UserEntity userInfo = new UserEntity(); - userInfo.setId(this.userScope.getUserId()); - funderCriteria.getCriteria().setReference("dmp:"); - QueryableList items = apiContext.getOperationsContext().getDatabaseRepository().getFunderDao().getWithCritetia(funderCriteria.getCriteria()); - QueryableList authItems = apiContext.getOperationsContext().getDatabaseRepository().getFunderDao().getAuthenticated(items, userInfo); - List funders = authItems.select(item -> new eu.eudat.models.data.funder.Funder().fromDataModel(item)); - ExternalReferenceCriteria externalReferenceCriteria = new ExternalReferenceCriteria(funderCriteria.getCriteria().getLike()); - List> remoteRepos = this.apiContext.getOperationsContext().getRemoteFetcher().getReferences(ReferenceType.Funder, externalReferenceCriteria, null); - FundersExternalSourcesModel fundersExternalSourcesModel = new FundersExternalSourcesModel().fromExternalItem(remoteRepos); - for (ExternalSourcesItemModel externalListingItem : fundersExternalSourcesModel) { - eu.eudat.models.data.funder.Funder funder = apiContext.getOperationsContext().getBuilderFactory().getBuilder(FunderBuilder.class) - .reference(externalListingItem.getRemoteId()).label(externalListingItem.getName()) - .status(eu.eudat.data.old.Funder.Status.fromInteger(0)) - .key(externalListingItem.getKey()) - .source(externalListingItem.getTag()) - .build(); - if (externalListingItem.getSource() != null) { - funder.setSource(externalListingItem.getSource()); - } else { - funder.setSource(externalListingItem.getTag()); - } - - funders.add(funder); - } - funders.sort(Comparator.comparing(Funder::getLabel)); - funders = funders.stream().filter(listHelper.distinctByKey(Funder::getLabel)).collect(Collectors.toList()); - return funders; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/GrantManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/GrantManager.java deleted file mode 100644 index a3371201c..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/GrantManager.java +++ /dev/null @@ -1,188 +0,0 @@ -package eu.eudat.logic.managers; - -import eu.eudat.commons.enums.ReferenceType; -import eu.eudat.commons.scope.user.UserScope; -import eu.eudat.data.UserEntity; -import eu.eudat.data.query.items.table.grant.GrantTableRequest; -import eu.eudat.logic.builders.model.models.GrantBuilder; -import eu.eudat.data.dao.entities.GrantDao; -import eu.eudat.service.reference.external.criteria.ExternalReferenceCriteria; -import eu.eudat.logic.services.operations.DatabaseRepository; -import eu.eudat.logic.utilities.helpers.ListHelper; -import eu.eudat.models.data.external.ExternalSourcesItemModel; -import eu.eudat.models.data.external.GrantsExternalSourcesModel; -import eu.eudat.models.data.grant.Grant; -import eu.eudat.models.data.helpers.common.DataTableData; -import eu.eudat.data.query.items.item.grant.GrantCriteriaRequest; -import eu.eudat.models.data.grant.GrantListingModel; -import eu.eudat.commons.exceptions.HugeResultSetException; -import eu.eudat.service.reference.external.RemoteFetcher; -import eu.eudat.queryable.QueryableList; -import eu.eudat.logic.services.ApiContext; -import gr.cite.tools.exception.MyNotFoundException; -import org.springframework.stereotype.Component; - -import javax.management.InvalidApplicationException; -import java.util.Comparator; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.CompletableFuture; -import java.util.stream.Collectors; - -@Component -public class GrantManager { - - private ApiContext apiContext; - private DatabaseRepository databaseRepository; -// private FileStorageService fileStorageService; - private RemoteFetcher remoteFetcher; - private ListHelper listHelper; - private final UserScope userScope; - - public GrantManager(ApiContext apiContext, ListHelper listHelper, UserScope userScope) { - this.apiContext = apiContext; - this.databaseRepository = apiContext.getOperationsContext().getDatabaseRepository(); -// this.fileStorageService = apiContext.getOperationsContext().getFileStorageService(); - this.remoteFetcher = apiContext.getOperationsContext().getRemoteFetcher(); - this.listHelper = listHelper; - this.userScope = userScope; - } - - public DataTableData getPaged(GrantTableRequest grantTableRequest, String fieldsGroup) throws Exception { - UserEntity userInfo = new UserEntity(); - userInfo.setId(this.userScope.getUserId()); - GrantDao grantRepository = databaseRepository.getGrantDao(); - QueryableList items = grantRepository.getWithCriteria(grantTableRequest.getCriteria()); - QueryableList authItems = grantRepository.getAuthenticated(items, userInfo); - QueryableList pagedItems = PaginationManager.applyPaging(authItems, grantTableRequest); - DataTableData dataTable = new DataTableData<>(); - CompletableFuture grantsFuture; - if (fieldsGroup.equals("listing")) { - grantsFuture = pagedItems.selectAsync(item -> new GrantListingModel().fromDataModelDetails(item)) - .whenComplete((results, throwable) -> - dataTable.setData(results) - ); - } else { - grantsFuture = pagedItems.selectAsync(item -> new GrantListingModel().fromDataModel(item)) - .whenComplete((results, throwable) -> - dataTable.setData(results) - ); - } - CompletableFuture countFuture = pagedItems.countAsync().whenComplete((count, throwable) -> dataTable.setTotalCount(count)); - - CompletableFuture.allOf(grantsFuture, countFuture).join(); - return dataTable; - } - - public DataTableData getPublicPaged(GrantTableRequest grantTableRequest) throws Exception { - GrantDao grantRepository = databaseRepository.getGrantDao(); - grantTableRequest.getCriteria().setPublic(true); - QueryableList items = grantRepository.getWithCriteria(grantTableRequest.getCriteria()); - QueryableList pagedItems = PaginationManager.applyPaging(items, grantTableRequest); - DataTableData dataTable = new DataTableData<>(); - CompletableFuture grantsFuture; - grantsFuture = pagedItems.selectAsync(item -> new GrantListingModel().fromDataModel(item)) - .whenComplete((results, throwable) -> { - dataTable.setData(results); - }); - CompletableFuture countFuture = pagedItems.countAsync().whenComplete((count, throwable) -> dataTable.setTotalCount(count)); - - CompletableFuture.allOf(grantsFuture, countFuture).join(); - return dataTable; - } - - public eu.eudat.models.data.grant.Grant getSingle(String id) throws InstantiationException, IllegalAccessException, InvalidApplicationException { - eu.eudat.models.data.grant.Grant grant = new eu.eudat.models.data.grant.Grant(); - grant.fromDataModel(databaseRepository.getGrantDao().find(UUID.fromString(id))); - return grant; - } - - /*public eu.eudat.data.old.Grant inactivate(String id) throws InstantiationException, IllegalAccessException { - GrantDao grantRepository = databaseRepository.getGrantDao(); - eu.eudat.data.old.Grant grant = grantRepository.find(UUID.fromString(id)); - grant.setStatus(eu.eudat.data.old.Grant.Status.DELETED.getValue()); - grant = grantRepository.createOrUpdate(grant); - return grant; - }*/ - - public List getCriteriaWithExternal(GrantCriteriaRequest grantCriteria) throws HugeResultSetException, MyNotFoundException, InvalidApplicationException { - UserEntity userInfo = new UserEntity(); - userInfo.setId(this.userScope.getUserId()); - /*if (grantCriteria.getCriteria().getFunderReference() != null && !grantCriteria.getCriteria().getFunderReference().trim().isEmpty()) { - FunderCriteria funderCriteria = new FunderCriteria(); - funderCriteria.setReference(grantCriteria.getCriteria().getFunderReference()); - Funder funder = apiContext.getOperationsContext().getDatabaseRepository().getFunderDao().getWithCritetia(funderCriteria).getSingleOrDefault(); - if (funder != null) { - grantCriteria.getCriteria().setFunderId(funder.getId().toString()); - } - }*/ - ExternalReferenceCriteria externalReferenceCriteria = new ExternalReferenceCriteria(grantCriteria.getCriteria().getLike()); - if (grantCriteria.getCriteria().getFunderReference() != null) { - externalReferenceCriteria.setFunderId(grantCriteria.getCriteria().getFunderReference()); - grantCriteria.getCriteria().setFunderReference(null); - } - grantCriteria.getCriteria().setReference("dmp:"); - QueryableList items = apiContext.getOperationsContext().getDatabaseRepository().getGrantDao().getWithCriteria(grantCriteria.getCriteria()); - QueryableList authItems = apiContext.getOperationsContext().getDatabaseRepository().getGrantDao().getAuthenticated(items, userInfo); - List grants = authItems.select(item -> new Grant().fromDataModel(item)); - - List> remoteRepos = remoteFetcher.getReferences(ReferenceType.Grants, externalReferenceCriteria, null); - - GrantsExternalSourcesModel grantsExternalSourcesModel = new GrantsExternalSourcesModel().fromExternalItem(remoteRepos); - for (ExternalSourcesItemModel externalListingItem : grantsExternalSourcesModel) { - eu.eudat.models.data.grant.Grant grant = apiContext.getOperationsContext().getBuilderFactory().getBuilder(GrantBuilder.class) - .reference(externalListingItem.getRemoteId()).label(externalListingItem.getName()) - .description(externalListingItem.getDescription()).uri(externalListingItem.getUri()) - .key(externalListingItem.getKey()) - .abbreviation(externalListingItem.getAbbreviation()).status(eu.eudat.data.old.Grant.Status.fromInteger(0)) - .source(externalListingItem.getTag()) - .build(); - - grants.add(grant); - } - grants.sort(Comparator.comparing(Grant::getLabel)); - grants = grants.stream().filter(listHelper.distinctByKey(Grant::getLabel)).collect(Collectors.toList()); - return grants; - } - - public List getCriteria(GrantCriteriaRequest grantCriteria) throws IllegalAccessException, InstantiationException, HugeResultSetException, MyNotFoundException, InvalidApplicationException { - GrantDao grantRepository = databaseRepository.getGrantDao(); - QueryableList items = grantRepository.getWithCriteria(grantCriteria.getCriteria()); - if (grantCriteria.getLength() != null) items.take(grantCriteria.getLength()); - List grants = items.select(item -> new Grant().fromDataModel(item)); - return grants; - } - - /*public void createOrUpdate(eu.eudat.models.data.grant.Grant grant, Principal principal) throws ParseException, IOException { - eu.eudat.data.old.Grant grantEntity = grant.toDataModel(); - if (grant.getFiles() != null) { - for (ContentFile file : grant.getFiles()) { - try { - ContentFile storedFile = fileStorageService.copyFromTempFileSystem(file); - Content content = new ContentBuilder().extension(file.getType()) - .label(file.getFilename()) - .locationType(Content.LocationType.INTERNAL.getValue()) - .parentType(Content.ParentType.GRANT.getValue()) - .uri("LOCAL:" + storedFile.getId()) - .build(); - grantEntity.setContent(databaseRepository.getContentDao().createOrUpdate(content)); - } catch (TempFileNotFoundException e) { - continue; - } - } - } - grantEntity.setType(eu.eudat.data.old.Grant.GrantType.INTERNAL.getValue()); - grantEntity.setCreationUser(databaseRepository.getUserInfoDao().find(principal.getId())); - databaseRepository.getGrantDao().createOrUpdate(grantEntity); - }*/ - - public void delete(UUID uuid) throws InvalidApplicationException { - eu.eudat.data.old.Grant oldGrant = apiContext.getOperationsContext().getDatabaseRepository().getGrantDao().find(uuid); - //TODO -// if (oldGrant.getDmps().size() > 0) -// throw new GrantWithDMPsDeleteException("You cannot Remove Grants with DMPs"); -// oldGrant.setStatus(DMP.DMPStatus.DELETED.getValue()); - apiContext.getOperationsContext().getDatabaseRepository().getGrantDao().createOrUpdate(oldGrant); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/LicenseManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/LicenseManager.java deleted file mode 100644 index cfa549372..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/LicenseManager.java +++ /dev/null @@ -1,46 +0,0 @@ -package eu.eudat.logic.managers; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import eu.eudat.commons.enums.ReferenceType; -import eu.eudat.data.dao.criteria.DataRepositoryCriteria; -import eu.eudat.service.reference.external.criteria.ExternalReferenceCriteria; -import eu.eudat.commons.exceptions.HugeResultSetException; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.models.data.license.LicenseModel; -import gr.cite.tools.exception.MyNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * Created by ikalyvas on 9/3/2018. - */ -@Component -public class LicenseManager { - private ApiContext apiContext; - - @Autowired - public LicenseManager(ApiContext apiContext) { - this.apiContext = apiContext; - } - - public List getLicenses(String query, String type) throws HugeResultSetException, MyNotFoundException { - ExternalReferenceCriteria externalReferenceCriteria = new ExternalReferenceCriteria(query); - List> remoteRepos = this.apiContext.getOperationsContext().getRemoteFetcher().getReferences(ReferenceType.Licenses, externalReferenceCriteria, type); - - DataRepositoryCriteria criteria = new DataRepositoryCriteria(); - if (!query.isEmpty()) criteria.setLike(query); - - List licenseModels = new LinkedList<>(); - - ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - licenseModels.addAll(remoteRepos.stream().map(item -> mapper.convertValue(item, LicenseModel.class)).collect(Collectors.toList())); - licenseModels = licenseModels.stream().filter(licenseModel -> licenseModel.getName().toLowerCase().contains(query.toLowerCase())).collect(Collectors.toList()); - return licenseModels; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/MetricsManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/MetricsManager.java index 3d3e7d0be..919a7ecc7 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/MetricsManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/MetricsManager.java @@ -299,9 +299,10 @@ public class MetricsManager { } private long countAllResearchers(boolean countNexus) throws InvalidApplicationException { - ResearcherCriteria criteria = new ResearcherCriteria(); - if (countNexus) criteria.setPeriodStart(getNexusDate()); - return apiContext.getOperationsContext().getDatabaseRepository().getResearcherDao().getWithCriteria(criteria).count(); +// ResearcherCriteria criteria = new ResearcherCriteria(); +// if (countNexus) criteria.setPeriodStart(getNexusDate()); +// return apiContext.getOperationsContext().getDatabaseRepository().getResearcherDao().getWithCriteria(criteria).count(); + return 0; } private long countAllProjects() throws InvalidApplicationException { @@ -309,9 +310,10 @@ public class MetricsManager { } private long countAllProjects(boolean countNexus) throws InvalidApplicationException { - ProjectCriteria criteria = new ProjectCriteria(); - if (countNexus) criteria.setPeriodStart(getNexusDate()); - return apiContext.getOperationsContext().getDatabaseRepository().getProjectDao().getWithCritetia(criteria).count(); +// ProjectCriteria criteria = new ProjectCriteria(); +// if (countNexus) criteria.setPeriodStart(getNexusDate()); +// return apiContext.getOperationsContext().getDatabaseRepository().getProjectDao().getWithCritetia(criteria).count(); + return 0; } private long countAllFunders() throws InvalidApplicationException { @@ -319,9 +321,10 @@ public class MetricsManager { } private long countAllFunders(boolean countNexus) throws InvalidApplicationException { - FunderCriteria criteria = new FunderCriteria(); - if (countNexus) criteria.setPeriodStart(getNexusDate()); - return apiContext.getOperationsContext().getDatabaseRepository().getFunderDao().getWithCritetia(criteria).count(); +// FunderCriteria criteria = new FunderCriteria(); +// if (countNexus) criteria.setPeriodStart(getNexusDate()); +// return apiContext.getOperationsContext().getDatabaseRepository().getFunderDao().getWithCritetia(criteria).count(); + return 0; } private long countAllGrants() throws InvalidApplicationException { @@ -329,9 +332,10 @@ public class MetricsManager { } private long countAllGrants(boolean countNexus) throws InvalidApplicationException { - GrantCriteria criteria = new GrantCriteria(); - if (countNexus) criteria.setPeriodStart(getNexusDate()); - return apiContext.getOperationsContext().getDatabaseRepository().getGrantDao().getWithCriteria(criteria).count(); +// GrantCriteria criteria = new GrantCriteria(); +// if (countNexus) criteria.setPeriodStart(getNexusDate()); +// return apiContext.getOperationsContext().getDatabaseRepository().getGrantDao().getWithCriteria(criteria).count(); + return 0; } public long countAllDraftDatasets() throws InvalidApplicationException { diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/OrganisationsManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/OrganisationsManager.java deleted file mode 100644 index 127df205f..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/OrganisationsManager.java +++ /dev/null @@ -1,115 +0,0 @@ -package eu.eudat.logic.managers; - -import eu.eudat.commons.enums.ReferenceType; -import eu.eudat.commons.scope.user.UserScope; -import eu.eudat.data.dao.entities.OrganisationDao; -import eu.eudat.data.UserEntity; -import eu.eudat.data.query.items.table.organisations.OrganisationsTableRequest; -import eu.eudat.logic.builders.model.models.OrganisationBuilder; -import eu.eudat.service.reference.external.criteria.ExternalReferenceCriteria; -import eu.eudat.commons.exceptions.HugeResultSetException; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.logic.services.operations.DatabaseRepository; -import eu.eudat.models.data.dmp.Organisation; -import eu.eudat.models.data.external.ExternalSourcesItemModel; -import eu.eudat.models.data.external.OrganisationsExternalSourcesModel; -import eu.eudat.models.data.helpers.common.DataTableData; -import eu.eudat.queryable.QueryableList; -import gr.cite.tools.exception.MyNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -@Component -public class OrganisationsManager { - - private ApiContext apiContext; - private DatabaseRepository databaseRepository; - private final UserScope userScope; - - @Autowired - public OrganisationsManager(ApiContext apiContext, UserScope userScope) { - this.apiContext = apiContext; - this.databaseRepository = apiContext.getOperationsContext().getDatabaseRepository(); - this.userScope = userScope; - } - - public DataTableData getPagedOrganisations(OrganisationsTableRequest organisationsTableRequest) throws Exception { - UserEntity userInfo = new UserEntity(); - userInfo.setId(this.userScope.getUserId()); - OrganisationDao organisationDao = databaseRepository.getOrganisationDao(); - - QueryableList items = organisationDao.getWithCriteria(organisationsTableRequest.getCriteria()); - QueryableList authItems = organisationDao.getAuthenticated(items, userInfo); - QueryableList pagedItems = PaginationManager.applyPaging(authItems, organisationsTableRequest); - - List org = pagedItems.toList().stream().distinct().map(item -> new Organisation().fromDataModel(item)).collect(Collectors.toList()); - DataTableData organisationDataTableData = new DataTableData<>(); - organisationDataTableData.setData(org); - organisationDataTableData.setTotalCount(pagedItems.count()); - - return organisationDataTableData; - } - - public DataTableData getPublicPagedOrganisations(OrganisationsTableRequest organisationsTableRequest) throws Exception { - organisationsTableRequest.getCriteria().setPublic(true); - OrganisationDao organisationDao = databaseRepository.getOrganisationDao(); - - QueryableList items = organisationDao.getWithCriteria(organisationsTableRequest.getCriteria()); - QueryableList pagedItems = PaginationManager.applyPaging(items, organisationsTableRequest); - - List org = pagedItems.toList().stream().distinct().map(item -> new Organisation().fromDataModel(item)).collect(Collectors.toList()); - DataTableData organisationDataTableData = new DataTableData<>(); - organisationDataTableData.setData(org); - organisationDataTableData.setTotalCount(pagedItems.count()); - - return organisationDataTableData; - } - - public List getWithExternal(OrganisationsTableRequest organisationsTableRequest) throws Exception { - UserEntity userInfo = new UserEntity(); - userInfo.setId(this.userScope.getUserId()); - OrganisationDao organisationDao = databaseRepository.getOrganisationDao(); - - QueryableList items = organisationDao.getWithCriteria(organisationsTableRequest.getCriteria()); - QueryableList authItems = organisationDao.getAuthenticated(items, userInfo); - QueryableList pagedItems = PaginationManager.applyPaging(authItems, organisationsTableRequest); - - List org = pagedItems.toList().stream().distinct().map(item -> new Organisation().fromDataModel(item)).collect(Collectors.toList()); - - ExternalReferenceCriteria externalReferenceCriteria = new ExternalReferenceCriteria(organisationsTableRequest.getCriteria().getLabelLike()); - List> remoteRepos = this.apiContext.getOperationsContext().getRemoteFetcher().getReferences(ReferenceType.Organizations, externalReferenceCriteria, null); - OrganisationsExternalSourcesModel organisationsExternalSourcesModel = new OrganisationsExternalSourcesModel().fromExternalItem(remoteRepos); - for (ExternalSourcesItemModel externalListingItem : organisationsExternalSourcesModel) { - Organisation organisation = apiContext.getOperationsContext().getBuilderFactory().getBuilder(OrganisationBuilder.class) - .name(externalListingItem.getName()) - .reference(externalListingItem.getRemoteId()) - .tag(externalListingItem.getTag()) - .key(externalListingItem.getKey()) - .build(); - org.add(organisation); - } - return org; - } - - public List getCriteriaWithExternal(String query, String type) throws HugeResultSetException, MyNotFoundException { - ExternalReferenceCriteria externalReferenceCriteria = new ExternalReferenceCriteria(query); - List> remoteRepos = this.apiContext.getOperationsContext().getRemoteFetcher().getReferences(ReferenceType.Organizations, externalReferenceCriteria, type); - OrganisationsExternalSourcesModel organisationsExternalSourcesModel = new OrganisationsExternalSourcesModel().fromExternalItem(remoteRepos); - List organisations = new LinkedList<>(); - for (ExternalSourcesItemModel externalListingItem : organisationsExternalSourcesModel) { - Organisation organisation = apiContext.getOperationsContext().getBuilderFactory().getBuilder(OrganisationBuilder.class) - .name(externalListingItem.getName()) - .reference(externalListingItem.getRemoteId()) - .tag(externalListingItem.getTag()) - .key(externalListingItem.getKey()) - .build(); - organisations.add(organisation); - } - return organisations.stream().distinct().collect(Collectors.toList()); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/PrefillingManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/PrefillingManager.java index 1442b9727..78966a461 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/PrefillingManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/PrefillingManager.java @@ -35,18 +35,18 @@ public class PrefillingManager { private final ApiContext apiContext; private final ObjectMapper objectMapper; private final DatasetManager datasetManager; - private final LicenseManager licenseManager; +// private final LicenseManager licenseManager; private final PrefillingMapper prefillingMapper; private final ExternalUrlConfigProvider externalUrlConfigProvider; @Autowired - public PrefillingManager(ApiContext apiContext, DatasetManager datasetManager, LicenseManager licenseManager, PrefillingMapper prefillingMapper, ExternalUrlConfigProvider externalUrlConfigProvider) { + public PrefillingManager(ApiContext apiContext, DatasetManager datasetManager /*, LicenseManager licenseManager*/, PrefillingMapper prefillingMapper, ExternalUrlConfigProvider externalUrlConfigProvider) { this.apiContext = apiContext; this.prefillingMapper = prefillingMapper; this.externalUrlConfigProvider = externalUrlConfigProvider; this.objectMapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); this.datasetManager = datasetManager; - this.licenseManager = licenseManager; +// this.licenseManager = licenseManager; } public List getPrefillings(String like) { @@ -74,14 +74,14 @@ public class PrefillingManager { PrefillingGet prefillingGet = prefillingConfig.getPrefillingGet(); Map prefillingEntity = getSingle(prefillingGet.getUrl(), prefillId); DescriptionTemplateEntity descriptionTemplateEntity = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(profileId); - return prefillingMapper.mapPrefilledEntityToDatasetWizard(prefillingEntity, prefillingGet, prefillingConfig.getType(), descriptionTemplateEntity, datasetManager, licenseManager); + return prefillingMapper.mapPrefilledEntityToDatasetWizard(prefillingEntity, prefillingGet, prefillingConfig.getType(), descriptionTemplateEntity, datasetManager/*, licenseManager*/); } public DatasetWizardModel getPrefilledDatasetUsingData(Map data, String configId, UUID profileId) throws Exception { PrefillingConfig prefillingConfig = this.externalUrlConfigProvider.getExternalUrls().getPrefillings().get(configId); PrefillingGet prefillingGet = prefillingConfig.getPrefillingGet(); DescriptionTemplateEntity descriptionTemplateEntity = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(profileId); - return prefillingMapper.mapPrefilledEntityToDatasetWizard(data, prefillingGet, prefillingConfig.getType(), descriptionTemplateEntity, datasetManager, licenseManager); + return prefillingMapper.mapPrefilledEntityToDatasetWizard(data, prefillingGet, prefillingConfig.getType(), descriptionTemplateEntity, datasetManager/*, licenseManager*/); } private Map getSingle(String url, String id) { diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/ProjectManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/ProjectManager.java deleted file mode 100644 index 7d9930c1a..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/ProjectManager.java +++ /dev/null @@ -1,66 +0,0 @@ -package eu.eudat.logic.managers; - -import eu.eudat.commons.enums.ReferenceType; -import eu.eudat.commons.scope.user.UserScope; -import eu.eudat.data.UserEntity; -import eu.eudat.service.reference.external.criteria.ExternalReferenceCriteria; -import eu.eudat.logic.utilities.helpers.ListHelper; -import eu.eudat.models.data.external.ProjectsExternalSourcesModel; -import eu.eudat.models.data.project.Project; -import eu.eudat.data.query.items.item.project.ProjectCriteriaRequest; -import eu.eudat.logic.builders.model.models.ProjectBuilder; -import eu.eudat.commons.exceptions.HugeResultSetException; -import eu.eudat.service.reference.external.RemoteFetcher; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.models.data.external.ExternalSourcesItemModel; -import eu.eudat.queryable.QueryableList; -import gr.cite.tools.exception.MyNotFoundException; -import org.springframework.stereotype.Component; - -import javax.management.InvalidApplicationException; -import java.util.Comparator; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -@Component -public class ProjectManager { - - private ApiContext apiContext; - private RemoteFetcher remoteFetcher; - private ListHelper listHelper; - private final UserScope userScope; - - public ProjectManager(ApiContext apiContext, ListHelper listHelper, UserScope userScope) { - this.apiContext = apiContext; - this.remoteFetcher = apiContext.getOperationsContext().getRemoteFetcher(); - this.listHelper = listHelper; - this.userScope = userScope; - } - - public List getCriteriaWithExternal(ProjectCriteriaRequest projectCriteria) throws HugeResultSetException, MyNotFoundException, InvalidApplicationException { - UserEntity userInfo = new UserEntity(); - userInfo.setId(this.userScope.getUserId()); - projectCriteria.getCriteria().setReference("dmp:"); - QueryableList items = apiContext.getOperationsContext().getDatabaseRepository().getProjectDao().getWithCritetia(projectCriteria.getCriteria()); - QueryableList authItems = apiContext.getOperationsContext().getDatabaseRepository().getProjectDao().getAuthenticated(items, userInfo); - List projects = authItems.select(item -> new Project().fromDataModel(item)); - ExternalReferenceCriteria externalReferenceCriteria = new ExternalReferenceCriteria(projectCriteria.getCriteria().getLike()); - List> remoteRepos = this.apiContext.getOperationsContext().getRemoteFetcher().getReferences(ReferenceType.DataRepositories, externalReferenceCriteria, null); - ProjectsExternalSourcesModel projectsExternalSourcesModel = new ProjectsExternalSourcesModel().fromExternalItem(remoteRepos); - for (ExternalSourcesItemModel externalListingItem : projectsExternalSourcesModel) { - eu.eudat.models.data.project.Project project = apiContext.getOperationsContext().getBuilderFactory().getBuilder(ProjectBuilder.class) - .reference(externalListingItem.getRemoteId()).label(externalListingItem.getName()) - .description(externalListingItem.getDescription()).uri(externalListingItem.getUri()) - .abbreviation(externalListingItem.getAbbreviation()).status(eu.eudat.data.old.Project.Status.fromInteger(0)) - .key(externalListingItem.getKey()) - .source(externalListingItem.getTag()) - .build(); - - projects.add(project); - } - projects.sort(Comparator.comparing(Project::getLabel)); - projects = projects.stream().filter(listHelper.distinctByKey(Project::getLabel)).collect(Collectors.toList()); - return projects; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/PublicationManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/PublicationManager.java deleted file mode 100644 index c60476231..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/PublicationManager.java +++ /dev/null @@ -1,43 +0,0 @@ -package eu.eudat.logic.managers; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import eu.eudat.commons.enums.ReferenceType; -import eu.eudat.data.dao.criteria.DataRepositoryCriteria; -import eu.eudat.service.reference.external.criteria.ExternalReferenceCriteria; -import eu.eudat.commons.exceptions.HugeResultSetException; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.models.data.publication.PublicationModel; -import gr.cite.tools.exception.MyNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -@Component -public class PublicationManager { - private ApiContext apiContext; - - @Autowired - public PublicationManager(ApiContext apiContext) { - this.apiContext = apiContext; - } - - public List getPublications(String query, String type) throws HugeResultSetException, MyNotFoundException { - ExternalReferenceCriteria externalReferenceCriteria = new ExternalReferenceCriteria(query); - List> remoteRepos = this.apiContext.getOperationsContext().getRemoteFetcher().getReferences(ReferenceType.Publications, externalReferenceCriteria, type); - - DataRepositoryCriteria criteria = new DataRepositoryCriteria(); - if (!query.isEmpty()) criteria.setLike(query); - - List publicationModels = new LinkedList<>(); - - ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - publicationModels.addAll(remoteRepos.stream().map(item -> mapper.convertValue(item, PublicationModel.class)).collect(Collectors.toList())); -// publicationModels = publicationModels.stream().filter(publicationModel -> publicationModel.getName().toLowerCase().contains(query.toLowerCase())).collect(Collectors.toList()); - return publicationModels; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/QuickWizardManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/QuickWizardManager.java index 4398b6951..3d64abe32 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/QuickWizardManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/QuickWizardManager.java @@ -36,31 +36,31 @@ public class QuickWizardManager { this.queryFactory = queryFactory; this.userScope = userScope; } + //TODO +// public Funder createOrUpdate(eu.eudat.models.data.funder.Funder funder) { +// Funder funderEntity = funder.toDataModel(); +// return databaseRepository.getFunderDao().createOrUpdate(funderEntity); +// } + //TODO +// public Grant createOrUpdate(eu.eudat.models.data.grant.Grant grant) throws ParseException, IOException, InvalidApplicationException { +// Grant grantEntity = grant.toDataModel(); +// grantEntity.setType(Grant.GrantType.INTERNAL.getValue()); +// grantEntity.setCreationUser(this.queryFactory.query(UserQuery.class).ids(this.userScope.getUserId()).first()); +// return databaseRepository.getGrantDao().createOrUpdate(grantEntity); +// } + //TODO +// public Project createOrUpdate(eu.eudat.models.data.project.Project project) throws InvalidApplicationException { +// Project projectEntity = project.toDataModel(); +// projectEntity.setCreationUser(this.queryFactory.query(UserQuery.class).ids(this.userScope.getUserId()).first()); +// return databaseRepository.getProjectDao().createOrUpdate(projectEntity); +// } - public Funder createOrUpdate(eu.eudat.models.data.funder.Funder funder) { - Funder funderEntity = funder.toDataModel(); - return databaseRepository.getFunderDao().createOrUpdate(funderEntity); - } - - public Grant createOrUpdate(eu.eudat.models.data.grant.Grant grant) throws ParseException, IOException, InvalidApplicationException { - Grant grantEntity = grant.toDataModel(); - grantEntity.setType(Grant.GrantType.INTERNAL.getValue()); - grantEntity.setCreationUser(this.queryFactory.query(UserQuery.class).ids(this.userScope.getUserId()).first()); - return databaseRepository.getGrantDao().createOrUpdate(grantEntity); - } - - public Project createOrUpdate(eu.eudat.models.data.project.Project project) throws InvalidApplicationException { - Project projectEntity = project.toDataModel(); - projectEntity.setCreationUser(this.queryFactory.query(UserQuery.class).ids(this.userScope.getUserId()).first()); - return databaseRepository.getProjectDao().createOrUpdate(projectEntity); - } - - public DmpEntity createOrUpdate(DataManagementPlan dataManagementPlan, Funder funderEntity) throws Exception { + public DmpEntity createOrUpdate(DataManagementPlan dataManagementPlan/*, Funder funderEntity*/) throws Exception { DmpEntity newDmp = dataManagementPlan.toDataModel(); - if (funderEntity != null) { - //TODO - //newDmp.getGrant().setFunder(funderEntity); - } +// if (funderEntity != null) { +// //TODO +// //newDmp.getGrant().setFunder(funderEntity); +// } UserEntity user = this.queryFactory.query(UserQuery.class).ids(this.userScope.getUserId()).first(); createFunderIfItDoesntExist(newDmp, user); createGrantIfItDoesntExist(newDmp, user); diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/RegistryManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/RegistryManager.java deleted file mode 100644 index 6fa12edcd..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/RegistryManager.java +++ /dev/null @@ -1,61 +0,0 @@ -package eu.eudat.logic.managers; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import eu.eudat.commons.enums.ReferenceType; -import eu.eudat.commons.scope.user.UserScope; -import eu.eudat.data.dao.criteria.RegistryCriteria; -import eu.eudat.data.old.Registry; -import eu.eudat.service.reference.external.criteria.ExternalReferenceCriteria; -import eu.eudat.commons.exceptions.HugeResultSetException; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.models.data.registries.RegistryModel; -import gr.cite.tools.exception.MyNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import javax.management.InvalidApplicationException; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -@Component -public class RegistryManager { - - private ApiContext apiContext; - private final UserScope userScope; - - @Autowired - public RegistryManager(ApiContext apiContext, UserScope userScope) { - this.apiContext = apiContext; - this.userScope = userScope; - } - - public Registry create(RegistryModel registryModel) throws Exception { - if (registryModel.getLabel() == null || registryModel.getAbbreviation() == null || registryModel.getUri() == null) { - throw new Exception("Missing mandatory entity."); - } - Registry registry = registryModel.toDataModel(); - registry.getCreationUser().setId(this.userScope.getUserId()); - return apiContext.getOperationsContext().getDatabaseRepository().getRegistryDao().createOrUpdate(registry); - } - - public List getRegistries(String query, String type) throws HugeResultSetException, MyNotFoundException, InvalidApplicationException { - ExternalReferenceCriteria externalReferenceCriteria = new ExternalReferenceCriteria(query); - List> remoteRepos = this.apiContext.getOperationsContext().getRemoteFetcher().getReferences(ReferenceType.Registries, externalReferenceCriteria, type); - - RegistryCriteria criteria = new RegistryCriteria(); - if (!query.isEmpty()) criteria.setLike(query); - criteria.setCreationUserId(this.userScope.getUserId()); - List registryModels = new LinkedList<>(); - if (type.equals("")) { - List registryList = (this.apiContext.getOperationsContext().getDatabaseRepository().getRegistryDao().getWithCriteria(criteria)).toList(); - registryModels = registryList.stream().map(item -> new RegistryModel().fromDataModel(item)).collect(Collectors.toList()); - } - ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - registryModels.addAll(remoteRepos.stream().map(item -> mapper.convertValue(item, RegistryModel.class)).collect(Collectors.toList())); - - return registryModels; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/ResearcherManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/ResearcherManager.java deleted file mode 100644 index 9918f954e..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/ResearcherManager.java +++ /dev/null @@ -1,83 +0,0 @@ -package eu.eudat.logic.managers; - -import eu.eudat.commons.enums.ReferenceType; -import eu.eudat.commons.scope.user.UserScope; -import eu.eudat.logic.builders.model.models.ResearcherBuilder; -import eu.eudat.data.old.Researcher; -import eu.eudat.service.reference.external.criteria.ExternalReferenceCriteria; -import eu.eudat.logic.proxy.config.configloaders.ConfigLoader; -import eu.eudat.models.data.external.ExternalSourcesItemModel; -import eu.eudat.models.data.external.ResearchersExternalSourcesModel; -import eu.eudat.data.query.items.item.researcher.ResearcherCriteriaRequest; -import eu.eudat.commons.exceptions.HugeResultSetException; -import eu.eudat.service.reference.external.RemoteFetcher; -import eu.eudat.query.UserQuery; -import eu.eudat.queryable.QueryableList; -import eu.eudat.logic.services.ApiContext; -import gr.cite.tools.data.query.QueryFactory; -import gr.cite.tools.exception.MyNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import javax.management.InvalidApplicationException; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * Created by ikalyvas on 2/5/2018. - */ -@Component -public class ResearcherManager { - - private ApiContext apiContext; - private RemoteFetcher remoteFetcher; - private ConfigLoader configLoader; - private final UserScope userScope; - private final QueryFactory queryFactory; - - @Autowired - public ResearcherManager(ApiContext apiContext, ConfigLoader configLoader, UserScope userScope, QueryFactory queryFactory) { - this.apiContext = apiContext; - this.remoteFetcher = apiContext.getOperationsContext().getRemoteFetcher(); - this.configLoader = configLoader; - this.userScope = userScope; - this.queryFactory = queryFactory; - } - - public Researcher create(eu.eudat.models.data.researcher.Researcher researcher) throws Exception { - Researcher researcherEntity = researcher.toDataModel(); - researcherEntity.setCreationUser(this.queryFactory.query(UserQuery.class).ids(this.userScope.getUserId()).first()); - return apiContext.getOperationsContext().getDatabaseRepository().getResearcherDao().createOrUpdate(researcherEntity); - } - - public List getCriteriaWithExternal(ResearcherCriteriaRequest researcherCriteriaRequest) throws HugeResultSetException, MyNotFoundException, InvalidApplicationException { - - QueryableList items = apiContext.getOperationsContext().getDatabaseRepository().getResearcherDao().getWithCriteria(researcherCriteriaRequest.getCriteria()); - items.where((builder, root) -> builder.equal(root.get("creationUser").get("id"), this.userScope.getUserId())); - List researchers = items.select(item -> new eu.eudat.models.data.dmp.Researcher().fromDataModel(item)); - researchers = researchers.stream().filter(item -> item.getKey().equals("Internal")).collect(Collectors.toList()); - Map keyToSourceMap = configLoader.getKeyToSourceMap(); - for (eu.eudat.models.data.dmp.Researcher item : researchers) { - if (item.getKey().equals("Internal")) - item.setTag(item.getKey()); - else - item.setTag(keyToSourceMap.get(item.getKey())); - } - ExternalReferenceCriteria externalReferenceCriteria = new ExternalReferenceCriteria(researcherCriteriaRequest.getCriteria().getName()); - List> remoteRepos = this.apiContext.getOperationsContext().getRemoteFetcher().getReferences(ReferenceType.Researcher, externalReferenceCriteria, null); - ResearchersExternalSourcesModel researchersExternalSourcesModel = new ResearchersExternalSourcesModel().fromExternalItem(remoteRepos); - for (ExternalSourcesItemModel externalListingItem : researchersExternalSourcesModel) { - eu.eudat.models.data.dmp.Researcher researcher = apiContext.getOperationsContext().getBuilderFactory().getBuilder(ResearcherBuilder.class) - .label(externalListingItem.getAbbreviation()) - .id(externalListingItem.getId()) - .reference(externalListingItem.getRemoteId()) - .name(externalListingItem.getName()) - .tag(externalListingItem.getTag()) - .key(externalListingItem.getKey()) - .build(); - researchers.add(researcher); - } - return researchers.stream().distinct().collect(Collectors.toList()); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/ServiceManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/ServiceManager.java deleted file mode 100644 index ddea54567..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/ServiceManager.java +++ /dev/null @@ -1,66 +0,0 @@ -package eu.eudat.logic.managers; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import eu.eudat.authorization.Permission; -import eu.eudat.commons.enums.ReferenceType; -import eu.eudat.commons.scope.user.UserScope; -import eu.eudat.data.dao.criteria.ServiceCriteria; -import eu.eudat.data.old.Service; -import eu.eudat.service.reference.external.criteria.ExternalReferenceCriteria; -import eu.eudat.commons.exceptions.HugeResultSetException; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.models.data.services.ServiceModel; -import gr.cite.commons.web.authz.service.AuthorizationService; -import gr.cite.tools.exception.MyNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import javax.management.InvalidApplicationException; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -@Component -public class ServiceManager { - - private ApiContext apiContext; - private final AuthorizationService authorizationService; - private final UserScope userScope; - - @Autowired - public ServiceManager(ApiContext apiContext, AuthorizationService authorizationService, UserScope userScope) { - this.apiContext = apiContext; - this.authorizationService = authorizationService; - this.userScope = userScope; - } - - public Service create(ServiceModel serviceModel) throws Exception { - this.authorizationService.authorizeForce(Permission.AuthenticatedRole); - - Service service = serviceModel.toDataModel(); - service.getCreationUser().setId(userScope.getUserId()); - return apiContext.getOperationsContext().getDatabaseRepository().getServiceDao().createOrUpdate(service); - } - - public List getServices(String query, String type) throws HugeResultSetException, MyNotFoundException, InvalidApplicationException { - this.authorizationService.authorizeForce(Permission.AuthenticatedRole); - - ExternalReferenceCriteria externalReferenceCriteria = new ExternalReferenceCriteria(query); - List> remoteRepos = this.apiContext.getOperationsContext().getRemoteFetcher().getReferences(ReferenceType.Services, externalReferenceCriteria, type); - - ServiceCriteria criteria = new ServiceCriteria(); - if (!query.isEmpty()) criteria.setLike(query); - criteria.setCreationUserId(userScope.getUserId()); - List serviceModels = new LinkedList<>(); - if (type.equals("")) { - List serviceList = (this.apiContext.getOperationsContext().getDatabaseRepository().getServiceDao().getWithCriteria(criteria)).toList(); - serviceModels = serviceList.stream().map(item -> new ServiceModel().fromDataModel(item)).collect(Collectors.toList()); - } - ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - serviceModels.addAll(remoteRepos.stream().map(item -> mapper.convertValue(item, ServiceModel.class)).collect(Collectors.toList())); - - return serviceModels; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/TaxonomyManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/TaxonomyManager.java deleted file mode 100644 index f27cbfe6f..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/TaxonomyManager.java +++ /dev/null @@ -1,44 +0,0 @@ -package eu.eudat.logic.managers; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import eu.eudat.commons.enums.ReferenceType; -import eu.eudat.data.dao.criteria.DataRepositoryCriteria; -import eu.eudat.service.reference.external.criteria.ExternalReferenceCriteria; -import eu.eudat.commons.exceptions.HugeResultSetException; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.models.data.taxonomy.TaxonomyModel; -import gr.cite.tools.exception.MyNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - - -@Component -public class TaxonomyManager { - private ApiContext apiContext; - - @Autowired - public TaxonomyManager(ApiContext apiContext) { - this.apiContext = apiContext; - } - - public List getTaxonomies(String query, String type) throws HugeResultSetException, MyNotFoundException { - ExternalReferenceCriteria externalReferenceCriteria = new ExternalReferenceCriteria(query); - List> remoteRepos = this.apiContext.getOperationsContext().getRemoteFetcher().getReferences(ReferenceType.Taxonomies, externalReferenceCriteria, type); - - DataRepositoryCriteria criteria = new DataRepositoryCriteria(); - if (!query.isEmpty()) criteria.setLike(query); - - List taxonomyModels = new LinkedList<>(); - - ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - taxonomyModels.addAll(remoteRepos.stream().map(item -> mapper.convertValue(item, TaxonomyModel.class)).collect(Collectors.toList())); - taxonomyModels = taxonomyModels.stream().filter(licenseModel -> licenseModel.getName().toLowerCase().contains(query.toLowerCase())).collect(Collectors.toList()); - return taxonomyModels; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/mapper/prefilling/PrefillingMapper.java b/dmp-backend/web/src/main/java/eu/eudat/logic/mapper/prefilling/PrefillingMapper.java index d25567f72..5d212ddbd 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/mapper/prefilling/PrefillingMapper.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/mapper/prefilling/PrefillingMapper.java @@ -9,7 +9,6 @@ import eu.eudat.data.DescriptionTemplateEntity; import eu.eudat.data.TagEntity; import eu.eudat.logic.managers.DatasetManager; import eu.eudat.logic.managers.DatasetProfileManager; -import eu.eudat.logic.managers.LicenseManager; import eu.eudat.service.reference.external.config.entities.DefaultPrefillingMapping; import eu.eudat.service.reference.external.config.entities.PrefillingFixedMapping; import eu.eudat.service.reference.external.config.entities.PrefillingGet; @@ -21,7 +20,6 @@ import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEnti import eu.eudat.models.data.datasetprofile.DatasetProfileOverviewModel; import eu.eudat.models.data.datasetwizard.DatasetWizardModel; import eu.eudat.models.data.externaldataset.ExternalAutocompleteFieldModel; -import eu.eudat.models.data.license.LicenseModel; import gr.cite.tools.exception.MyNotFoundException; import org.json.JSONObject; import org.slf4j.Logger; @@ -49,7 +47,7 @@ public class PrefillingMapper { } public DatasetWizardModel mapPrefilledEntityToDatasetWizard(Map prefilledEntity, PrefillingGet prefillingGet, String type, - DescriptionTemplateEntity profile, DatasetManager datasetManager, LicenseManager licenseManager) throws Exception { + DescriptionTemplateEntity profile, DatasetManager datasetManager /*, LicenseManager licenseManager*/) throws Exception { DatasetWizardModel datasetWizardModel = new DatasetWizardModel(); datasetWizardModel.setProfile(new DatasetProfileOverviewModel().fromDataModel(profile)); DescriptionEntity descriptionEntity = new DescriptionEntity(); @@ -67,7 +65,7 @@ public class PrefillingMapper { } } try { - setValue(prefillingMapping, mapper.writeValueAsString(sourceValue), datasetWizardModel, parentNode, properties, type, licenseManager); + setValue(prefillingMapping, mapper.writeValueAsString(sourceValue), datasetWizardModel, parentNode, properties, type/*, licenseManager*/); } catch (Exception e) { if (prefillingMapping.getSemanticTarget() != null && !prefillingMapping.getSemanticTarget().isEmpty()) { @@ -79,14 +77,14 @@ public class PrefillingMapper { } } for (PrefillingFixedMapping fixedMapping: prefillingGet.getFixedMappings()) { - setValue(fixedMapping, fixedMapping.getValue(), datasetWizardModel, parentNode, properties, type, licenseManager); + setValue(fixedMapping, fixedMapping.getValue(), datasetWizardModel, parentNode, properties, type/*, licenseManager*/); } descriptionEntity.setProperties(mapper.writeValueAsString(properties)); datasetWizardModel.setDatasetProfileDefinition(datasetManager.getPagedProfile(datasetWizardModel, descriptionEntity)); return datasetWizardModel; } - private void setValue(PrefillingMapping prefillingMapping, String value, DatasetWizardModel datasetWizardModel, JsonNode parentNode, Map properties, String type, LicenseManager licenseManager) throws InvocationTargetException, IllegalAccessException, JsonProcessingException { + private void setValue(PrefillingMapping prefillingMapping, String value, DatasetWizardModel datasetWizardModel, JsonNode parentNode, Map properties, String type/*, LicenseManager licenseManager*/) throws InvocationTargetException, IllegalAccessException, JsonProcessingException { String trimRegex = prefillingMapping.getTrimRegex() != null ? prefillingMapping.getTrimRegex() : ""; if (!value.startsWith("\"") && !value.startsWith("[") && !value.equals("null")) { value = "\"" + value + "\""; @@ -194,24 +192,24 @@ public class PrefillingMapper { properties.put(id, datasetID.toString()); break; case LICENSES: - try { - List licenses = licenseManager.getLicenses("", ""); - String finalParsedValue = parsedValue; - licenses = licenses.stream().filter(license -> license.getPid().equals(finalParsedValue)).collect(Collectors.toList()); - boolean isMultiAutocomplete = node.isArray() ? node.get(0).get("data").get("multiAutoComplete").booleanValue() : node.get("data").get("multiAutoComplete").booleanValue(); - if(isMultiAutocomplete){ - List lic = new ArrayList<>(); - for(LicenseModel license: licenses){ - lic.add(mapper.writeValueAsString(license)); - } - properties.put(id, mapper.writeValueAsString(lic)); - } else { - properties.put(id, mapper.writeValueAsString(licenses.get(0))); - } - } - catch (MyNotFoundException | HugeResultSetException e){ - properties.put(id, parsedValue); - } +// try { +// List licenses = licenseManager.getLicenses("", ""); +// String finalParsedValue = parsedValue; +// licenses = licenses.stream().filter(license -> license.getPid().equals(finalParsedValue)).collect(Collectors.toList()); +// boolean isMultiAutocomplete = node.isArray() ? node.get(0).get("data").get("multiAutoComplete").booleanValue() : node.get("data").get("multiAutoComplete").booleanValue(); +// if(isMultiAutocomplete){ +// List lic = new ArrayList<>(); +// for(LicenseModel license: licenses){ +// lic.add(mapper.writeValueAsString(license)); +// } +// properties.put(id, mapper.writeValueAsString(lic)); +// } else { +// properties.put(id, mapper.writeValueAsString(licenses.get(0))); +// } +// } +// catch (MyNotFoundException | HugeResultSetException e){ +// properties.put(id, parsedValue); +// } break; default: if (!parsedValues.isEmpty()) diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/services/operations/DatabaseRepository.java b/dmp-backend/web/src/main/java/eu/eudat/logic/services/operations/DatabaseRepository.java index 59cf96c93..eb8364d24 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/services/operations/DatabaseRepository.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/services/operations/DatabaseRepository.java @@ -4,7 +4,6 @@ import eu.eudat.data.dao.entities.*; public interface DatabaseRepository { - DataRepositoryDao getDataRepositoryDao(); DatasetDao getDatasetDao(); @@ -12,27 +11,13 @@ public interface DatabaseRepository { DMPDao getDmpDao(); - OrganisationDao getOrganisationDao(); - - GrantDao getGrantDao(); - - RegistryDao getRegistryDao(); - - ResearcherDao getResearcherDao(); - - ServiceDao getServiceDao(); InvitationDao getInvitationDao(); - ExternalDatasetDao getExternalDatasetDao(); - ContentDao getContentDao(); EmailConfirmationDao getLoginConfirmationEmailDao(); - ProjectDao getProjectDao(); - - FunderDao getFunderDao(); LockDao getLockDao(); diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/services/operations/DatabaseRepositoryImpl.java b/dmp-backend/web/src/main/java/eu/eudat/logic/services/operations/DatabaseRepositoryImpl.java index d87baff0f..db281130e 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/services/operations/DatabaseRepositoryImpl.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/services/operations/DatabaseRepositoryImpl.java @@ -8,35 +8,19 @@ import org.springframework.stereotype.Service; @Service("databaseRepository") public class DatabaseRepositoryImpl implements DatabaseRepository { - private DataRepositoryDao dataRepositoryDao; - private DatasetDao datasetDao; private DatasetProfileDao datasetProfileDao; private DMPDao dmpDao; - private OrganisationDao organisationDao; - - private GrantDao GrantDao; - - private RegistryDao registryDao; - - private ResearcherDao researcherDao; - - private ServiceDao serviceDao; private InvitationDao invitationDao; - private ExternalDatasetDao externalDatasetDao; - private ContentDao contentDao; private EmailConfirmationDao loginConfirmationEmailDao; - private ProjectDao projectDao; - - private FunderDao funderDao; private LockDao lockDao; @@ -46,10 +30,6 @@ public class DatabaseRepositoryImpl implements DatabaseRepository { private EntityManager entityManager; - @Autowired - private void setDataRepositoryDao(DataRepositoryDao dataRepositoryDao) { - this.dataRepositoryDao = dataRepositoryDao; - } @Autowired private void setDatasetDao(DatasetDao datasetDao) { @@ -67,35 +47,6 @@ public class DatabaseRepositoryImpl implements DatabaseRepository { } @Autowired - private void setOrganisationDao(OrganisationDao organisationDao) { - this.organisationDao = organisationDao; - } - - @Autowired - private void setGrantDao(GrantDao GrantDao) { - this.GrantDao = GrantDao; - } - - @Autowired - private void setRegistryDao(RegistryDao registryDao) { - this.registryDao = registryDao; - } - - @Autowired - private void setResearcherDao(ResearcherDao researcherDao) { - this.researcherDao = researcherDao; - } - - @Autowired - public void setServiceDao(ServiceDao serviceDao) { - this.serviceDao = serviceDao; - } - - @Autowired - @Override - public DataRepositoryDao getDataRepositoryDao() { - return dataRepositoryDao; - } @Override public DatasetDao getDatasetDao() { @@ -112,30 +63,6 @@ public class DatabaseRepositoryImpl implements DatabaseRepository { return dmpDao; } - @Override - public OrganisationDao getOrganisationDao() { - return organisationDao; - } - - @Override - public GrantDao getGrantDao() { - return GrantDao; - } - - @Override - public RegistryDao getRegistryDao() { - return registryDao; - } - - @Override - public ResearcherDao getResearcherDao() { - return researcherDao; - } - - @Override - public ServiceDao getServiceDao() { - return serviceDao; - } @Override public InvitationDao getInvitationDao() { @@ -147,16 +74,6 @@ public class DatabaseRepositoryImpl implements DatabaseRepository { this.invitationDao = invitationDao; } - @Override - public ExternalDatasetDao getExternalDatasetDao() { - return externalDatasetDao; - } - - @Autowired - public void setExternalDatasetDao(ExternalDatasetDao externalDatasetDao) { - this.externalDatasetDao = externalDatasetDao; - } - @Autowired public void setEntityManager(EntityManager entityManager) { this.entityManager = entityManager; @@ -182,26 +99,6 @@ public class DatabaseRepositoryImpl implements DatabaseRepository { this.loginConfirmationEmailDao = loginConfirmationEmailDao; } - @Override - public ProjectDao getProjectDao() { - return projectDao; - } - - @Autowired - public void setProjectDao(ProjectDao projectDao) { - this.projectDao = projectDao; - } - - @Override - public FunderDao getFunderDao() { - return funderDao; - } - - @Autowired - public void setFunderDao(FunderDao funderDao) { - this.funderDao = funderDao; - } - @Autowired public void setLockDao(LockDao lockDao) { this.lockDao = lockDao; diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/WordBuilder.java b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/WordBuilder.java index 3e7a392fd..2b92d3aa1 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/WordBuilder.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/WordBuilder.java @@ -1,14 +1,11 @@ package eu.eudat.logic.utilities.documents.word; -import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import eu.eudat.commons.enums.FieldDataComboBoxType; import eu.eudat.commons.types.descriptiontemplate.fielddata.*; import eu.eudat.data.DescriptionEntity; import eu.eudat.data.DmpEntity; -import eu.eudat.data.old.Organisation; -import eu.eudat.data.old.Researcher; import eu.eudat.logic.proxy.config.configloaders.ConfigLoader; import eu.eudat.logic.services.forms.VisibilityRuleService; import eu.eudat.logic.utilities.documents.types.ParagraphStyle; diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/FetcherReference.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/FetcherReference.java index 747f3b496..ccef82936 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/FetcherReference.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/FetcherReference.java @@ -154,91 +154,91 @@ public class FetcherReference { return fetcherReference; } - public FetcherReference fromDataRepository(DataRepository entity) { -// this.setAbbreviation(entity.getAbbreviation()); - this.setName(entity.getLabel()); - this.setUri(entity.getUri()); - this.setId(entity.getId().toString()); - this.setPid(entity.getReference()); - String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":")); - if (source1.equals("dmp")) { - this.source = "Internal"; - } else { - this.source = source1; - } - return this; - } +// public FetcherReference fromDataRepository(DataRepository entity) { +//// this.setAbbreviation(entity.getAbbreviation()); +// this.setName(entity.getLabel()); +// this.setUri(entity.getUri()); +// this.setId(entity.getId().toString()); +// this.setPid(entity.getReference()); +// String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":")); +// if (source1.equals("dmp")) { +// this.source = "Internal"; +// } else { +// this.source = source1; +// } +// return this; +// } - public FetcherReference fromRegistry(Registry entity){ - this.id = entity.getId().toString(); -// this.abbreviation = entity.getAbbreviation(); -// this.created = entity.getCreated(); -// this.label = entity.getLabel(); - this.name = entity.getLabel(); -// this.modified = entity.getModified(); - this.uri = entity.getUri(); - String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":")); - if (source1.equals("dmp")) { - this.source = "Internal"; - } else { - this.source = source1; - } -// this.reference = entity.getReference(); - return this; - } - public FetcherReference fromService(Service entity) { -// this.abbreviation = entity.getAbbreviation(); -// this.created = entity.getCreated(); - this.id = entity.getId().toString(); -// this.label = entity.getLabel(); - this.name = entity.getLabel(); -// this.modified = entity.getModified(); - this.uri = entity.getUri(); - String source = entity.getReference().substring(0, entity.getReference().indexOf(":")); - if (source.equals("dmp")) { - this.source = "Internal"; - } else { - this.source = source; - } - return this; - } - - public FetcherReference fromResearcher(Researcher entity){ - this.id = entity.getId().toString(); - this.name = entity.getLabel(); - String refParts[] = entity.getReference().split(":"); - String source = refParts[0]; -// if (source.equals("dmp")) { -// this.key = "Internal"; -// }else { -// this.key = source; +// public FetcherReference fromRegistry(Registry entity){ +// this.id = entity.getId().toString(); +//// this.abbreviation = entity.getAbbreviation(); +//// this.created = entity.getCreated(); +//// this.label = entity.getLabel(); +// this.name = entity.getLabel(); +//// this.modified = entity.getModified(); +// this.uri = entity.getUri(); +// String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":")); +// if (source1.equals("dmp")) { +// this.source = "Internal"; +// } else { +// this.source = source1; // } - return this; - } - - public FetcherReference fromOrganisation(Organisation entity){ - this.id = entity.getId().toString(); - this.name = entity.getLabel(); - String refParts[] = entity.getReference().split(":"); - String source = refParts[0]; +//// this.reference = entity.getReference(); +// return this; +// } +// public FetcherReference fromService(Service entity) { +//// this.abbreviation = entity.getAbbreviation(); +//// this.created = entity.getCreated(); +// this.id = entity.getId().toString(); +//// this.label = entity.getLabel(); +// this.name = entity.getLabel(); +//// this.modified = entity.getModified(); +// this.uri = entity.getUri(); +// String source = entity.getReference().substring(0, entity.getReference().indexOf(":")); // if (source.equals("dmp")) { -// this.key = "Internal"; -// }else { -// this.key = source; +// this.source = "Internal"; +// } else { +// this.source = source; // } - return this; - } +// return this; +// } - public FetcherReference fromDataset(ExternalDataset entity){ - this.id = entity.getId().toString(); - this.name = entity.getLabel(); - String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":")); - if (source1.equals("dmp")) { - this.source = "Internal"; - } else { - this.source = source1; - } - return this; - } +// public FetcherReference fromResearcher(Researcher entity){ +// this.id = entity.getId().toString(); +// this.name = entity.getLabel(); +// String refParts[] = entity.getReference().split(":"); +// String source = refParts[0]; +//// if (source.equals("dmp")) { +//// this.key = "Internal"; +//// }else { +//// this.key = source; +//// } +// return this; +// } + +// public FetcherReference fromOrganisation(Organisation entity){ +// this.id = entity.getId().toString(); +// this.name = entity.getLabel(); +// String refParts[] = entity.getReference().split(":"); +// String source = refParts[0]; +//// if (source.equals("dmp")) { +//// this.key = "Internal"; +//// }else { +//// this.key = source; +//// } +// return this; +// } + +// public FetcherReference fromDataset(ExternalDataset entity){ +// this.id = entity.getId().toString(); +// this.name = entity.getLabel(); +// String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":")); +// if (source1.equals("dmp")) { +// this.source = "Internal"; +// } else { +// this.source = source1; +// } +// return this; +// } } diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/datarepository/DataRepositoryModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/datarepository/DataRepositoryModel.java deleted file mode 100644 index b6e01e379..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/datarepository/DataRepositoryModel.java +++ /dev/null @@ -1,127 +0,0 @@ -package eu.eudat.models.data.datarepository; - -import eu.eudat.data.old.DataRepository; -import eu.eudat.data.UserEntity; -import eu.eudat.models.DataModel; - -import java.util.Date; -import java.util.UUID; - -public class DataRepositoryModel implements DataModel { - private UUID id; - private String name; - private String pid; - private String abbreviation; - private String uri; - private Date created; - private Date modified; - private String tag; // Api fetching the data - private String source; // Actual harvested source - - public UUID getId() { - return id; - } - public void setId(UUID id) { - this.id = id; - } - - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - public String getPid() { - return pid; - } - public void setPid(String pid) { - this.pid = pid; - } - - public String getAbbreviation() { - return abbreviation; - } - public void setAbbreviation(String abbreviation) { - this.abbreviation = abbreviation; - } - - public String getUri() { - return uri; - } - public void setUri(String uri) { - this.uri = uri; - } - - public Date getCreated() { - return created; - } - public void setCreated(Date created) { - this.created = created; - } - - public Date getModified() { - return modified; - } - public void setModified(Date modified) { - this.modified = modified; - } - - public String getTag() { - return tag; - } - public void setTag(String tag) { - this.tag = tag; - } - - public String getSource() { - return source; - } - public void setSource(String source) { - this.source = source; - } - - @Override - public DataRepositoryModel fromDataModel(DataRepository entity) { - this.setAbbreviation(entity.getAbbreviation()); - this.setName(entity.getLabel()); - this.setUri(entity.getUri()); - this.setId(entity.getId()); - this.setPid(entity.getReference()); - String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":")); - if (source1.equals("dmp")) { - this.source = "Internal"; - } else { - this.source = source1; - } - return this; - } - - @Override - public DataRepository toDataModel() throws Exception { - DataRepository dataRepository = new DataRepository(); - dataRepository.setId(this.id != null ? this.id : UUID.randomUUID()); - dataRepository.setAbbreviation(this.abbreviation); - dataRepository.setCreated(this.created != null ? this.created : new Date()); - dataRepository.setModified(new Date()); - dataRepository.setLabel(this.name); - if (this.source != null) { - if (this.source.equals("Internal") || this.source.equals(this.id.toString().substring(0, this.source.length()))) { - dataRepository.setReference(this.id.toString()); - } else { - dataRepository.setReference(this.source + ":" + dataRepository.getId()); - } - } else { - dataRepository.setReference("dmp:" + dataRepository.getId()); - } - dataRepository.setUri(this.uri); - dataRepository.setStatus((short) 0); - dataRepository.setCreationUser(new UserEntity()); - return dataRepository; - } - - @Override - public String getHint() { - return null; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dataset/DataRepository.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dataset/DataRepository.java deleted file mode 100644 index 475b9882f..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dataset/DataRepository.java +++ /dev/null @@ -1,135 +0,0 @@ -package eu.eudat.models.data.dataset; - -import eu.eudat.models.DataModel; -import eu.eudat.logic.utilities.helpers.LabelGenerator; - -import java.util.Date; -import java.util.UUID; - -public class DataRepository implements DataModel, LabelGenerator { - private String id; - private String pid; - private String name; - private String uri; - private String info; - private String reference; - private String abbreviation; - private String tag; - private String source; - - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - - public String getPid() { - return pid; - } - public void setPid(String pid) { - this.pid = pid; - } - - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - public String getUri() { - return uri; - } - public void setUri(String uri) { - this.uri = uri; - } - - public String getInfo() { - return info; - } - public void setInfo(String info) { - this.info = info; - } - - public String getReference() { - return reference; - } - public void setReference(String reference) { - this.reference = reference; - } - - public String getAbbreviation() { - return abbreviation; - } - public void setAbbreviation(String abbreviation) { - this.abbreviation = abbreviation; - } - - public String getTag() { - return tag; - } - public void setTag(String tag) { - this.tag = tag; - } - - public String getSource() { - return source; - } - public void setSource(String source) { - this.source = source; - } - - public DataRepository fromDataModel(eu.eudat.data.old.DataRepository entity) { - this.id = entity.getId().toString(); - this.pid = entity.getReference(); - this.name = entity.getLabel(); - this.uri = entity.getUri(); - this.abbreviation = entity.getAbbreviation(); - this.reference = entity.getReference(); - String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":")); - if (source1.equals("dmp")) { - this.source = "Internal"; - } else { - this.source = source1; - } - return this; - } - - public eu.eudat.data.old.DataRepository toDataModel() { - eu.eudat.data.old.DataRepository entity = new eu.eudat.data.old.DataRepository(); - if (this.id != null) { - entity.setId(UUID.fromString(this.id)); - } - entity.setReference(this.pid); - entity.setLabel(this.name); - entity.setUri(this.uri); - entity.setCreated(new Date()); - entity.setModified(new Date()); - entity.setStatus((short) 0); - if (this.source != null && this.source.equals("Internal")) this.source = "dmp"; - if (this.reference != null && !this.reference.trim().isEmpty() - && this.source != null && !this.source.trim().isEmpty()) { - if (this.source.equals(this.reference.substring(0, this.source.length()))) { - entity.setReference(this.reference); - } else { - entity.setReference(this.source.toLowerCase() + ":" + this.reference); - } - } - - if (this.abbreviation != null) - entity.setAbbreviation(this.abbreviation); - - return entity; - } - - @Override - public String generateLabel() { - return this.getName(); - } - - @Override - public String getHint() { - return null; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dataset/Dataset.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dataset/Dataset.java index 516201374..220864efc 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dataset/Dataset.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/dataset/Dataset.java @@ -20,9 +20,6 @@ public class Dataset implements DataModel { private Date created; private DataManagementPlan dmp; private DatasetProfileListingModel profile; - private List registries; - private List services; - private List dataRepositories; public UUID getId() { return id; @@ -72,29 +69,6 @@ public class Dataset implements DataModel { this.properties = properties; } - public List getRegistries() { - return registries; - } - - public void setRegistries(List registries) { - this.registries = registries; - } - - public List getServices() { - return services; - } - - public void setServices(List services) { - this.services = services; - } - - public List getDataRepositories() { - return dataRepositories; - } - - public void setDataRepositories(List dataRepositories) { - this.dataRepositories = dataRepositories; - } public Date getCreated() { return created; diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dataset/DatasetOverviewModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dataset/DatasetOverviewModel.java index 77a9cdd9a..6b8a3752c 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dataset/DatasetOverviewModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/dataset/DatasetOverviewModel.java @@ -5,7 +5,6 @@ import eu.eudat.data.DescriptionEntity; import eu.eudat.model.DmpUser; import eu.eudat.models.DataModel; import eu.eudat.models.data.datasetprofile.DatasetProfileOverviewModel; -import eu.eudat.models.data.grant.GrantOverviewModel; import eu.eudat.models.data.listingmodels.DataManagementPlanOverviewModel; import java.time.Instant; @@ -20,7 +19,6 @@ public class DatasetOverviewModel implements DataModel users; private DataManagementPlanOverviewModel dmp; - private GrantOverviewModel grant; private String description; private Boolean isPublic; private Instant modified; @@ -70,14 +68,6 @@ public class DatasetOverviewModel implements DataModel, LabelGenerator { - private UUID id; - private String label; - private String abbreviation; - private String reference; - private String uri; - private String definition; - private String source; - - public UUID getId() { - return id; - } - public void setId(UUID id) { - this.id = id; - } - - public String getLabel() { - return label; - } - public void setLabel(String label) { - this.label = label; - } - - public String getAbbreviation() { - return abbreviation; - } - @Override - public String generateLabel() { - return getLabel(); - } - public void setAbbreviation(String abbreviation) { - this.abbreviation = abbreviation; - } - - public String getReference() { - return reference; - } - public void setReference(String reference) { - this.reference = reference; - } - - public String getUri() { - return uri; - } - public void setUri(String uri) { - this.uri = uri; - } - - public String getDefinition() { - return definition; - } - public void setDefinition(String definition) { - this.definition = definition; - } - - public String getSource() { - return source; - } - public void setSource(String source) { - this.source = source; - } - - public Registry fromDataModel(eu.eudat.data.old.Registry entity) { - this.id = entity.getId(); - this.label = entity.getLabel(); - this.abbreviation = entity.getAbbreviation(); - this.reference = entity.getReference(); - this.uri = entity.getUri(); - this.definition = entity.getDefinition(); - String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":")); - if (source1.equals("dmp")) { - this.source = "Internal"; - } else { - this.source = source1; - } - return this; - } - - public eu.eudat.data.old.Registry toDataModel() { - eu.eudat.data.old.Registry entity = new eu.eudat.data.old.Registry(); - entity.setId(this.id != null ? this.id : UUID.randomUUID()); - entity.setLabel(this.label); - entity.setAbbreviation(this.abbreviation); - if (this.source != null && this.source.equals("Internal")) this.source = "dmp"; - if (this.reference != null && !this.reference.trim().isEmpty() - && this.source != null && !this.source.trim().isEmpty()) { - if (this.source.equals(this.reference.substring(0, this.source.length()))) { - entity.setReference(this.reference); - } else { - entity.setReference(this.source.toLowerCase() + ":" + this.reference); - } - } - entity.setUri(this.uri); - entity.setModified(new Date()); - entity.setStatus((short)0); - return entity; - } - - @Override - public String getHint() { - return null; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dataset/Service.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dataset/Service.java deleted file mode 100644 index ecda90def..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dataset/Service.java +++ /dev/null @@ -1,113 +0,0 @@ -package eu.eudat.models.data.dataset; - -import eu.eudat.models.DataModel; -import eu.eudat.logic.utilities.helpers.LabelGenerator; - -import java.util.Date; -import java.util.UUID; - -public class Service implements DataModel, LabelGenerator { - - private UUID id; - private String label; - private String abbreviation; - private String reference; - private String uri; - private String definition; - private String source; - - public UUID getId() { - return id; - } - public void setId(UUID id) { - this.id = id; - } - - public String getLabel() { - return label; - } - public void setLabel(String label) { - this.label = label; - } - - public String getAbbreviation() { - return abbreviation; - } - public void setAbbreviation(String abbreviation) { - this.abbreviation = abbreviation; - } - - public String getReference() { - return reference; - } - public void setReference(String reference) { - this.reference = reference; - } - - public String getUri() { - return uri; - } - public void setUri(String uri) { - this.uri = uri; - } - - public String getDefinition() { - return definition; - } - public void setDefinition(String definition) { - this.definition = definition; - } - - public String getSource() { - return source; - } - public void setSource(String source) { - this.source = source; - } - - public Service fromDataModel(eu.eudat.data.old.Service entity) { - this.id = entity.getId(); - this.label = entity.getLabel(); - this.abbreviation = entity.getAbbreviation(); - this.reference = entity.getReference(); - this.uri = entity.getUri(); - this.definition = entity.getDefinition(); - String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":")); - if (source1.equals("dmp")) { - this.source = "Internal"; - } else { - this.source = source1; - } - return this; - } - - public eu.eudat.data.old.Service toDataModel() { - eu.eudat.data.old.Service entity = new eu.eudat.data.old.Service(); - entity.setId(this.id != null ? this.id : UUID.randomUUID()); - entity.setLabel(this.label); - entity.setAbbreviation(this.abbreviation); - if (this.source != null && this.source.equals("Internal")) this.source = "dmp"; - if (this.reference != null && !this.reference.trim().isEmpty() - && this.source != null && !this.source.trim().isEmpty()) { - if (this.source.equals(this.reference.substring(0, this.source.length()))) { - entity.setReference(this.reference); - } else { - entity.setReference(this.source.toLowerCase() + ":" + this.reference); - } - } - entity.setUri(this.uri); - entity.setModified(new Date()); - entity.setStatus((short)0); - return entity; - } - - @Override - public String generateLabel() { - return this.label; - } - - @Override - public String getHint() { - return null; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetwizard/DatasetWizardModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetwizard/DatasetWizardModel.java index f261f44ec..d6fb42fb1 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetwizard/DatasetWizardModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetwizard/DatasetWizardModel.java @@ -3,12 +3,8 @@ package eu.eudat.models.data.datasetwizard; import eu.eudat.commons.enums.DescriptionStatus; import eu.eudat.data.DescriptionEntity; import eu.eudat.models.DataModel; -import eu.eudat.models.data.dataset.DataRepository; -import eu.eudat.models.data.dataset.Registry; -import eu.eudat.models.data.dataset.Service; import eu.eudat.models.data.datasetprofile.DatasetProfileOverviewModel; import eu.eudat.models.data.dmp.DataManagementPlan; -import eu.eudat.models.data.externaldataset.ExternalDatasetListingModel; import eu.eudat.models.data.user.composite.PagedDatasetProfile; import java.time.Instant; @@ -28,11 +24,7 @@ public class DatasetWizardModel implements DataModel registries; - private List services; - private List dataRepositories; // private List tags; //TODO - private List externalDatasets; private DatasetProfileOverviewModel profile; private Boolean isProfileLatestVersion; private Instant modified; @@ -107,26 +99,6 @@ public class DatasetWizardModel implements DataModel getRegistries() { - return registries; - } - public void setRegistries(List registries) { - this.registries = registries; - } - - public List getServices() { - return services; - } - public void setServices(List services) { - this.services = services; - } - - public List getDataRepositories() { - return dataRepositories; - } - public void setDataRepositories(List dataRepositories) { - this.dataRepositories = dataRepositories; - } public DatasetProfileOverviewModel getProfile() { return profile; @@ -136,12 +108,6 @@ public class DatasetWizardModel implements DataModel getExternalDatasets() { - return externalDatasets; - } - public void setExternalDatasets(List externalDatasets) { - this.externalDatasets = externalDatasets; - } // public List getTags() { // return tags; diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DataManagementPlan.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DataManagementPlan.java index 286116e59..e8838aee9 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DataManagementPlan.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DataManagementPlan.java @@ -6,10 +6,7 @@ import eu.eudat.model.EntityDoi; import eu.eudat.models.DataModel; import eu.eudat.models.data.datasetwizard.DatasetWizardModel; import eu.eudat.models.data.dynamicfields.DynamicFieldWithValue; -import eu.eudat.models.data.funder.Funder; import eu.eudat.models.data.helpermodels.Tuple; -import eu.eudat.models.data.grant.Grant; -import eu.eudat.models.data.project.Project; import java.util.*; @@ -24,9 +21,6 @@ public class DataManagementPlan implements DataModel datasets; private List profiles; - private Grant grant; - private List organisations; - private List researchers; private List extraFields; private Date modified; private Date created; @@ -34,8 +28,6 @@ public class DataManagementPlan implements DataModel properties; private List users; private List dois; - private Project project; - private Funder funder; private Boolean isPublic; private Map extraProperties; @@ -74,20 +66,6 @@ public class DataManagementPlan implements DataModel getOrganisations() { - return organisations; - } - public void setOrganisations(List organizations) { - this.organisations = organizations; - } - - public List getResearchers() { - return researchers; - } - public void setResearchers(List researchers) { - this.researchers = researchers; - } - public int getStatus() { return status; } @@ -95,13 +73,6 @@ public class DataManagementPlan implements DataModel getProfiles() { return profiles; } @@ -180,20 +151,6 @@ public class DataManagementPlan implements DataModel datasets; private List profiles; - private eu.eudat.models.data.grant.GrantDMPEditorModel grant; - private List organisations; - private List researchers; private List extraFields; private Date modified; private Date created; @@ -37,7 +32,6 @@ public class DataManagementPlanEditorModel implements DataModel users; private List datasetsToBeFinalized; private ProjectDMPEditorModel project; - private FunderDMPEditorModel funder; private Map extraProperties; public UUID getId() { @@ -72,20 +66,6 @@ public class DataManagementPlanEditorModel implements DataModel getOrganisations() { - return organisations; - } - public void setOrganisations(List organizations) { - this.organisations = organizations; - } - - public List getResearchers() { - return researchers; - } - public void setResearchers(List researchers) { - this.researchers = researchers; - } - public int getStatus() { return status; } @@ -93,13 +73,6 @@ public class DataManagementPlanEditorModel implements DataModel getProfiles() { return profiles; } @@ -185,13 +158,6 @@ public class DataManagementPlanEditorModel implements DataModel getExtraProperties() { return extraProperties; } diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DataManagementPlanNewVersionModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DataManagementPlanNewVersionModel.java index 0b83a8f83..53024ec49 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DataManagementPlanNewVersionModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DataManagementPlanNewVersionModel.java @@ -1,23 +1,19 @@ package eu.eudat.models.data.dmp; -import com.fasterxml.jackson.databind.ObjectMapper; import eu.eudat.commons.enums.DmpStatus; import eu.eudat.data.DescriptionEntity; import eu.eudat.data.DmpEntity; -import eu.eudat.data.DmpUserEntity; -import eu.eudat.data.old.*; import eu.eudat.models.DataModel; import eu.eudat.models.data.dataset.Dataset; -import eu.eudat.models.data.funder.FunderDMPEditorModel; -import eu.eudat.models.data.grant.GrantDMPEditorModel; import eu.eudat.models.data.project.ProjectDMPEditorModel; -import net.minidev.json.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.time.Instant; -import java.util.*; -import java.util.stream.Collectors; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.UUID; /** * Created by ikalyvas on 2/5/2018. @@ -32,12 +28,8 @@ public class DataManagementPlanNewVersionModel implements DataModel profiles; - private eu.eudat.models.data.grant.GrantDMPEditorModel grant; - private List organisations; - private List researchers; private List datasets; private ProjectDMPEditorModel project; - private FunderDMPEditorModel funder; private Map extraProperties; public UUID getId() { @@ -89,26 +81,6 @@ public class DataManagementPlanNewVersionModel implements DataModel getOrganisations() { - return organisations; - } - public void setOrganisations(List organisations) { - this.organisations = organisations; - } - - public List getResearchers() { - return researchers; - } - public void setResearchers(List researchers) { - this.researchers = researchers; - } public List getDatasets() { return datasets; @@ -124,12 +96,6 @@ public class DataManagementPlanNewVersionModel implements DataModel getExtraProperties() { return extraProperties; diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/Organisation.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/Organisation.java deleted file mode 100644 index 611f84288..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/Organisation.java +++ /dev/null @@ -1,123 +0,0 @@ -package eu.eudat.models.data.dmp; - -import eu.eudat.models.DataModel; -import eu.eudat.logic.utilities.helpers.LabelGenerator; - -import java.util.Date; -import java.util.HashMap; -import java.util.UUID; - -public class Organisation implements DataModel, LabelGenerator { - private String label; - private String name; - private String id; - private String reference; - private int status; - private String tag; // how the external source is displayed. ex: "Cristin". - private String key; // the external source. ex: "cristin". - - public String getLabel() { - return label; - } - public void setLabel(String label) { - this.label = label; - } - - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - - public String getReference() { - return reference; - } - public void setReference(String reference) { - this.reference = reference; - } - - public int getStatus() { - return status; - } - public void setStatus(int status) { - this.status = status; - } - - public String getTag() { - return tag; - } - public void setTag(String tag) { - this.tag = tag; - } - - public String getKey() { - return key; - } - public void setKey(String key) { - this.key = key; - } - - @Override - public Organisation fromDataModel(eu.eudat.data.old.Organisation entity) { - this.id = entity.getId().toString(); - this.name = entity.getLabel(); - this.label = entity.getUri(); - if (entity.getReference() != null) { - this.reference = entity.getReference(); - this.key = entity.getReference().substring(0, entity.getReference().indexOf(":")); - } - return this; - } - - @Override - public eu.eudat.data.old.Organisation toDataModel() { - eu.eudat.data.old.Organisation organisationEntity = new eu.eudat.data.old.Organisation(); - if (this.key != null && this.reference != null) { - if (this.reference.startsWith(this.key + ":")) { - organisationEntity.setReference(this.reference); - } else { - organisationEntity.setReference(this.key + ":" + this.reference); - } - } - if (this.id != null) { - organisationEntity.setId(UUID.fromString(this.id)); - } - organisationEntity.setLabel(this.name); - organisationEntity.setUri(this.label); - organisationEntity.setCreated(new Date()); - organisationEntity.setStatus((short) this.status); - return organisationEntity; - } - - public static Organisation fromMap(HashMap map) { - Organisation model = new Organisation(); - if (map != null) { - model.id = (String) map.get("id"); - model.key = (String) map.get("key"); - model.label = (String) map.get("label"); - model.name = (String) map.get("name"); - model.reference = (String) map.get("reference"); - model.status = (int) map.get("status"); - model.tag = (String) map.get("tag"); - } - return model; - } - - @Override - public String generateLabel() { - return this.getName(); - } - - @Override - public String getHint() { - return null; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/Researcher.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/Researcher.java deleted file mode 100644 index 250dfbf9f..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/Researcher.java +++ /dev/null @@ -1,150 +0,0 @@ -package eu.eudat.models.data.dmp; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import eu.eudat.models.DataModel; -import eu.eudat.logic.utilities.helpers.LabelGenerator; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Date; -import java.util.UUID; - -@JsonIgnoreProperties(ignoreUnknown = true) -public class Researcher implements DataModel, LabelGenerator { - private static final Logger logger = LoggerFactory.getLogger(Researcher.class); - private String label; - private String name; - private String id; - private String reference; - private int status; - private String tag; - private String key; - - public String getLabel() { - return label; - } - public void setLabel(String label) { - this.label = label; - } - - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - - public String getReference() { - return reference; - } - public void setReference(String reference) { - this.reference = reference; - } - - public int getStatus() { - return status; - } - public void setStatus(int status) { - this.status = status; - } - - public String getTag() { - return tag; - } - public void setTag(String tag) { - this.tag = tag; - } - - public String getKey() { - return key; - } - public void setKey(String key) { - this.key = key; - } - - @Override - public Researcher fromDataModel(eu.eudat.data.old.Researcher entity) { - this.id = entity.getId().toString(); - this.label = entity.getUri(); - this.name = entity.getLabel(); - this.status = entity.getStatus(); - this.reference = entity.getReference(); - String refParts[] = entity.getReference().split(":"); - String source = refParts[0]; - if (source.equals("dmp")) - this.key = "Internal"; - else - this.key = source; - return this; - } - - @Override - public eu.eudat.data.old.Researcher toDataModel() { - eu.eudat.data.old.Researcher researcher = new eu.eudat.data.old.Researcher(); - if (this.id == null) { - this.id = UUID.randomUUID().toString(); - } - researcher.setId(UUID.fromString(this.id)); - if (this.key != null) { - if (this.key.toLowerCase().equals("internal")) { - if (this.reference != null && !this.reference.startsWith("dmp:")) { - researcher.setReference("dmp:" + this.reference); - } else if (this.reference == null) { - researcher.setReference("dmp:" + this.id); - } else { - researcher.setReference(this.reference); - } - } else { - if ((this.key + ":").equals(this.reference.substring(0, this.key.length() + 1))) { - researcher.setReference(this.reference); - } else { - researcher.setReference(this.key + ":" + this.reference); - } - } - } else { - try { - throw new Exception("Researcher has no key value"); - } catch (Exception e) { - logger.error(e.getMessage(), e); - } - } - - researcher.setLabel(this.name); - researcher.setUri(this.label); - researcher.setCreated(new Date()); - researcher.setStatus((short) this.status); - return researcher; - } - - @Override - public String generateLabel() { - return this.getName(); - } - - @Override - public String getHint() { - return null; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Researcher that = (Researcher) o; - - return id.equals(that.id); - } - - @Override - public int hashCode() { - return reference.hashCode(); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/externaldataset/ExternalDatasetListingModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/externaldataset/ExternalDatasetListingModel.java deleted file mode 100644 index 5e7619387..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/externaldataset/ExternalDatasetListingModel.java +++ /dev/null @@ -1,162 +0,0 @@ -package eu.eudat.models.data.externaldataset; - -import eu.eudat.data.old.ExternalDataset; -import eu.eudat.models.DataModel; -import eu.eudat.model.publicapi.datasetwizard.ExternalDatasetType; - -import java.util.Date; -import java.util.UUID; - -public class ExternalDatasetListingModel implements DataModel { - - private UUID id; - private String name; - private String abbreviation; - private String reference; - private Date created; - private Date modified; - private String info; - private ExternalDatasetType type; - private String pid; - private String pidTypeField; - private String uri; - private String tag; // Api fetching the data - private String source; // Actual harvested source - - public UUID getId() { - return id; - } - public void setId(UUID id) { - this.id = id; - } - - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - public String getAbbreviation() { - return abbreviation; - } - public void setAbbreviation(String abbreviation) { - this.abbreviation = abbreviation; - } - - public String getReference() { - return reference; - } - public void setReference(String reference) { - this.reference = reference; - } - - public Date getCreated() { - return created; - } - public void setCreated(Date created) { - this.created = created; - } - - public Date getModified() { - return modified; - } - public void setModified(Date modified) { - this.modified = modified; - } - - public Integer getType() { - return type != null ? type.getValue() : null; - } - public void setType(Integer type) { - this.type = ExternalDatasetType.fromInteger(type); - } - - public String getInfo() { - return info; - } - public void setInfo(String info) { - this.info = info; - } - - public String getPid() { - return pid; - } - public void setPid(String pid) { - this.pid = pid; - } - - public String getPidTypeField() { - return pidTypeField; - } - public void setPidTypeField(String pidTypeField) { - this.pidTypeField = pidTypeField; - } - - public String getUri() { - return uri; - } - public void setUri(String uri) { - this.uri = uri; - } - - public String getTag() { - return tag; - } - public void setTag(String tag) { - this.tag = tag; - } - - public String getSource() { - return source; - } - public void setSource(String source) { - this.source = source; - } - - @Override - public ExternalDatasetListingModel fromDataModel(ExternalDataset entity) { - this.id = entity.getId(); - this.abbreviation = entity.getAbbreviation(); - this.name = entity.getLabel(); - this.modified = entity.getModified(); - this.created = entity.getCreated(); - this.reference = entity.getReference(); - String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":")); - if (source1.equals("dmp")) { - this.source = "Internal"; - } else { - this.source = source1; - } - return this; - } - - @Override - public ExternalDataset toDataModel() throws Exception { - ExternalDataset externalDataset = new ExternalDataset(); - externalDataset.setAbbreviation(this.abbreviation); - externalDataset.setCreated(this.created != null ? this.created : new Date()); - externalDataset.setLabel(this.name); - externalDataset.setId(this.id); - externalDataset.setModified(this.modified); - if (this.source != null && this.source.equals("Internal")) this.source = "dmp"; - if (this.reference != null && !this.reference.trim().isEmpty() - && this.source != null && !this.source.trim().isEmpty()) { - if (this.source.equals(this.reference.substring(0, this.source.length()))) { - externalDataset.setReference(this.reference); - } else { - externalDataset.setReference(this.source.toLowerCase() + ":" + this.reference); - } - } - if (externalDataset.getReference() == null) { - externalDataset.setReference(this.pid); - } - externalDataset.setModified(new Date()); - return externalDataset; - } - - @Override - public String getHint() { - return null; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/externaldataset/ExternalDatasetModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/externaldataset/ExternalDatasetModel.java deleted file mode 100644 index 7640f2b89..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/externaldataset/ExternalDatasetModel.java +++ /dev/null @@ -1,93 +0,0 @@ -package eu.eudat.models.data.externaldataset; - -import eu.eudat.data.old.ExternalDataset; -import eu.eudat.data.UserEntity; -import eu.eudat.models.DataModel; - -import java.util.Date; -import java.util.UUID; - -public class ExternalDatasetModel implements DataModel { - public UUID id; - public String name; - public String abbreviation; - public Date created; - public Date modified; - private String source; - - public UUID getId() { - return id; - } - public void setId(UUID id) { - this.id = id; - } - - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - public String getAbbreviation() { - return abbreviation; - } - public void setAbbreviation(String abbreviation) { - this.abbreviation = abbreviation; - } - - public Date getCreated() { - return created; - } - public void setCreated(Date created) { - this.created = created; - } - - public Date getModified() { - return modified; - } - public void setModified(Date modified) { - this.modified = modified; - } - - public String getSource() { - return source; - } - public void setSource(String source) { - this.source = source; - } - - @Override - public ExternalDatasetModel fromDataModel(ExternalDataset entity) { - this.id = entity.getId(); - this.name = entity.getLabel(); - this.abbreviation = entity.getAbbreviation(); - this.created = entity.getCreated(); - this.modified = new Date(); - String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":")); - if (source1.equals("dmp")) { - this.source = "Internal"; - } else { - this.source = source1; - } - return this; - } - - @Override - public ExternalDataset toDataModel() throws Exception { - ExternalDataset externalDataset = new ExternalDataset(); - externalDataset.setAbbreviation(this.abbreviation); - externalDataset.setCreated(this.created != null ? this.created : new Date()); - externalDataset.setModified(new Date()); - externalDataset.setId(this.id != null ? this.id : UUID.randomUUID()); - externalDataset.setLabel(this.name); - externalDataset.setReference("dmp:" + externalDataset.getId()); - externalDataset.setCreationUser(new UserEntity()); - return externalDataset; - } - - @Override - public String getHint() { - return null; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/funder/Funder.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/funder/Funder.java deleted file mode 100644 index d274f976d..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/funder/Funder.java +++ /dev/null @@ -1,150 +0,0 @@ -package eu.eudat.models.data.funder; - -import eu.eudat.data.old.Grant; -import eu.eudat.models.DataModel; - -import java.util.Date; -import java.util.UUID; - -public class Funder implements DataModel { - - private UUID id; - private String label; - private String reference; - private String definition; - private Short status; - private Date created; - private Date modified; - private Integer type; - private String source; - private String key; - - public UUID getId() { - return id; - } - public void setId(UUID id) { - this.id = id; - } - - public String getLabel() { - return label; - } - public void setLabel(String label) { - this.label = label; - } - - public String getReference() { - return reference; - } - public void setReference(String reference) { - this.reference = reference; - } - - public String getDefinition() { - return definition; - } - public void setDefinition(String definition) { - this.definition = definition; - } - - public Short getStatus() { - return status; - } - public void setStatus(Short status) { - this.status = status; - } - - public Date getCreated() { - return created; - } - public void setCreated(Date created) { - this.created = created; - } - - public Date getModified() { - return modified; - } - public void setModified(Date modified) { - this.modified = modified; - } - - public Integer getType() { - return type; - } - public void setType(Integer type) { - this.type = type; - } - - public String getSource() { - return source; - } - public void setSource(String source) { - this.source = source; - } - - public String getKey() { - return key; - } - public void setKey(String key) { - this.key = key; - } - - @Override - public Funder fromDataModel(eu.eudat.data.old.Funder entity) { - this.id = entity.getId(); - this.label = entity.getLabel(); - this.reference = entity.getReference(); - this.type = entity.getType(); - this.definition = entity.getDefinition(); - this.status = entity.getStatus(); - this.created = entity.getCreated(); - this.modified = entity.getModified(); - if (entity.getReference() != null) { - String source = entity.getReference().substring(0, entity.getReference().indexOf(":")); - if (source.equals("dmp")) { - this.key = "Internal"; - } else { - this.key = source; - } - } - - return this; - } - - @Override - public eu.eudat.data.old.Funder toDataModel() { - eu.eudat.data.old.Funder entity = new eu.eudat.data.old.Funder(); - if (this.getId() != null) { - entity.setId(this.getId()); - } else { - entity.setId(UUID.randomUUID()); - } - entity.setLabel(this.label); - entity.setType(this.type); - // If internal, key has no value, fill it. - if ((this.source != null && this.source.equals("Internal")) || (this.key != null && this.key.equals("Internal"))) this.key = "dmp"; - // Logic for the different "key" cases. - if ((this.key == null || this.key.trim().isEmpty()) && (this.source != null && !this.source.trim().isEmpty())) { - this.key = this.source; - } - if (this.reference != null && this.reference.startsWith("dmp:")) { - entity.setReference(this.reference); - } else if (this.reference != null && !this.reference.trim().isEmpty() && this.key != null && !this.key.trim().isEmpty()) { - if (this.key.equals(this.reference.substring(0, this.key.length()))) { - entity.setReference(this.reference); - } else { - entity.setReference(this.key.toLowerCase() + ":" + this.reference); - } - } - entity.setDefinition(this.definition); - entity.setCreated(this.created == null ? new Date() : this.created); - entity.setStatus(this.status != null ? this.getStatus() : Grant.Status.ACTIVE.getValue()); - entity.setModified(new Date()); - return entity; - } - - @Override - public String getHint() { - return null; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/funder/FunderDMPEditorModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/funder/FunderDMPEditorModel.java deleted file mode 100644 index 043cdb53b..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/funder/FunderDMPEditorModel.java +++ /dev/null @@ -1,29 +0,0 @@ -package eu.eudat.models.data.funder; - -public class FunderDMPEditorModel { - private Funder existFunder; - private String label; - private String reference; - - public Funder getExistFunder() { - return existFunder; - } - public void setExistFunder(Funder existFunder) { - this.existFunder = existFunder; - } - - public String getLabel() { - return label; - } - public void setLabel(String label) { - this.label = label; - } - - public String getReference() { - return reference; - } - - public void setReference(String reference) { - this.reference = reference; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/funder/FunderOverviewModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/funder/FunderOverviewModel.java deleted file mode 100644 index 77bfa049c..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/funder/FunderOverviewModel.java +++ /dev/null @@ -1,42 +0,0 @@ -package eu.eudat.models.data.funder; - -import eu.eudat.data.old.Funder; -import eu.eudat.models.DataModel; - -import java.util.UUID; - -public class FunderOverviewModel implements DataModel { - private UUID id; - private String label; - - public UUID getId() { - return id; - } - public void setId(UUID id) { - this.id = id; - } - - public String getLabel() { - return label; - } - public void setLabel(String label) { - this.label = label; - } - - @Override - public FunderOverviewModel fromDataModel(Funder entity) { - this.id = entity.getId(); - this.label = entity.getLabel(); - return this; - } - - @Override - public Funder toDataModel() throws Exception { - return null; - } - - @Override - public String getHint() { - return null; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/grant/Grant.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/grant/Grant.java deleted file mode 100644 index fb198ed39..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/grant/Grant.java +++ /dev/null @@ -1,241 +0,0 @@ -package eu.eudat.models.data.grant; - -import eu.eudat.data.old.Funder; -import eu.eudat.data.UserEntity; -import eu.eudat.models.DataModel; -import eu.eudat.models.data.dmp.DataManagementPlan; -import eu.eudat.models.data.files.ContentFile; - -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.UUID; - - -public class Grant implements DataModel { - - private UUID id; - private List dmps; - private String label; - private int type; - private String abbreviation; - private String reference; - private String uri; - private String definition; - private Date startDate; - private Date endDate; - private eu.eudat.data.old.Grant.Status status; - private UserEntity creationUser; - private Date created; - private Date modified; - private String description; - private List files; - private UUID funderId; - private String source; - private String key; - - public UUID getId() { - return id; - } - public void setId(UUID id) { - this.id = id; - } - - public int getType() { - return type; - } - public void setType(int type) { - this.type = type; - } - - public List getDmps() { - return dmps; - } - public void setDmps(List dmps) { - this.dmps = dmps; - } - - public String getLabel() { - return label; - } - public void setLabel(String label) { - this.label = label; - } - - public String getAbbreviation() { - return abbreviation; - } - public void setAbbreviation(String abbreviation) { - this.abbreviation = abbreviation; - } - - public String getReference() { - return reference; - } - public void setReference(String reference) { - this.reference = reference; - } - - public String getUri() { - return uri; - } - public void setUri(String uri) { - this.uri = uri; - } - - public String getDefinition() { - return definition; - } - public void setDefinition(String definition) { - this.definition = definition; - } - - public Date getStartDate() { - return startDate; - } - public void setStartDate(Date startDate) { - this.startDate = startDate; - } - - public Date getEndDate() { - return endDate; - } - public void setEndDate(Date endDate) { - this.endDate = endDate; - } - - public short getStatus() { - return status.getValue(); - } - public void setStatus(Short status) { - this.status = eu.eudat.data.old.Grant.Status.fromInteger(status); - } - - public UserEntity getCreationUser() { - return creationUser; - } - public void setCreationUser(UserEntity creationUser) { - this.creationUser = creationUser; - } - - public Date getCreated() { - return created; - } - public void setCreated(Date created) { - this.created = created; - } - - public Date getModified() { - return modified; - } - public void setModified(Date modified) { - this.modified = modified; - } - - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - - public List getFiles() { - return files; - } - public void setFiles(List files) { - this.files = files; - } - - public UUID getFunderId() { - return funderId; - } - public void setFunderId(UUID funderId) { - this.funderId = funderId; - } - - public String getSource() { - return source; - } - public void setSource(String source) { - this.source = source; - } - - public String getKey() { - return key; - } - public void setKey(String key) { - this.key = key; - } - - @Override - public Grant fromDataModel(eu.eudat.data.old.Grant entity) { - this.id = entity.getId(); - this.label = entity.getLabel(); - this.abbreviation = entity.getAbbreviation(); - this.reference = entity.getReference(); - this.uri = entity.getUri(); - this.type = entity.getType(); - this.definition = entity.getDefinition(); - this.startDate = entity.getStartdate(); - this.endDate = entity.getEnddate(); - this.setStatus(entity.getStatus()); - this.created = entity.getCreated(); - this.modified = entity.getModified(); - this.description = entity.getDescription(); - this.files = entity.getContent() != null ? Arrays.asList(new ContentFile(entity.getContent().getLabel(), UUID.fromString(entity.getContent().getUri().split(":")[1]), "final", entity.getContent().getExtension())) : Arrays.asList(new ContentFile("default.png", null, null, null)); - if (entity.getFunder() != null) - this.funderId = entity.getFunder().getId(); - if (entity.getReference() != null) { - String source = entity.getReference().substring(0, entity.getReference().indexOf(":")); - if (source.equals("dmp")) { - this.key = "Internal"; - } else { - this.key = source; - } - } - - return this; - } - - @Override - public eu.eudat.data.old.Grant toDataModel() { - eu.eudat.data.old.Grant entity = new eu.eudat.data.old.Grant(); - if (this.getId() != null) { - entity.setId(this.getId()); - } else { - entity.setId(UUID.randomUUID()); - } - entity.setAbbreviation(this.abbreviation); - entity.setLabel(this.label); - entity.setType(this.type); - if ((this.source != null && this.source.equals("Internal")) || (this.key != null && this.key.equals("Internal"))) this.key = "dmp"; - if (this.reference != null && this.reference.startsWith("dmp:")) { - entity.setReference(this.reference); - } else if (this.reference != null && !this.reference.trim().isEmpty() && this.key != null && !this.key.trim().isEmpty()) { - if (this.key.equals(this.reference.substring(0, this.key.length()))) { - entity.setReference(this.reference); - } else { - entity.setReference(this.key.toLowerCase() + ":" + this.reference); - } - } - entity.setUri(this.uri); - entity.setDefinition(this.definition); - entity.setStartdate(this.startDate); - entity.setCreated(this.created == null ? new Date() : this.created); - entity.setEnddate(this.endDate); - entity.setStatus(this.status != null ? this.getStatus() : eu.eudat.data.old.Grant.Status.ACTIVE.getValue()); - entity.setModified(new Date()); - entity.setDescription(this.description); - if (this.funderId != null) { - entity.setFunder(new Funder()); - entity.getFunder().setId(this.funderId); - } - - return entity; - } - - @Override - public String getHint() { - return null; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/grant/GrantCriteriaModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/grant/GrantCriteriaModel.java deleted file mode 100644 index 7eff562fa..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/grant/GrantCriteriaModel.java +++ /dev/null @@ -1,37 +0,0 @@ -package eu.eudat.models.data.grant; - -import eu.eudat.data.old.Grant; -import eu.eudat.models.DataModel; - -import java.util.UUID; - - -public class GrantCriteriaModel implements DataModel { - private UUID id; - - public UUID getId() { - return id; - } - - public void setId(UUID id) { - this.id = id; - } - - @Override - public GrantCriteriaModel fromDataModel(Grant entity) { - this.id = entity.getId(); - return this; - } - - @Override - public Grant toDataModel() { - Grant grant = new Grant(); - grant.setId(this.id); - return grant; - } - - @Override - public String getHint() { - return null; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/grant/GrantDMPEditorModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/grant/GrantDMPEditorModel.java deleted file mode 100644 index 1a165d61e..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/grant/GrantDMPEditorModel.java +++ /dev/null @@ -1,37 +0,0 @@ -package eu.eudat.models.data.grant; - -public class GrantDMPEditorModel { - private Grant existGrant; - private String label; - private String description; - private String reference; - - public Grant getExistGrant() { - return existGrant; - } - public void setExistGrant(Grant existGrant) { - this.existGrant = existGrant; - } - - public String getLabel() { - return label; - } - public void setLabel(String label) { - this.label = label; - } - - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - - public String getReference() { - return reference; - } - - public void setReference(String reference) { - this.reference = reference; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/grant/GrantListingModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/grant/GrantListingModel.java deleted file mode 100644 index a1c6989db..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/grant/GrantListingModel.java +++ /dev/null @@ -1,220 +0,0 @@ -package eu.eudat.models.data.grant; - -import eu.eudat.data.old.Grant; -import eu.eudat.data.UserEntity; -import eu.eudat.models.DataModel; -import eu.eudat.models.data.files.ContentFile; -import eu.eudat.models.data.urls.DataManagementPlanUrlListing; - -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.UUID; - - -public class GrantListingModel implements DataModel { - - private UUID id; - - private String label; - - private String abbreviation; - - private String reference; - - private String uri; - - private String definition; - - private Date startDate; - - private Date endDate; - - private Grant.Status status; - - private UserEntity creationUser; - - private Date created; - - private Date modified; - - private String description; - - private List files; - - private List dmps; - - - public UUID getId() { - return id; - } - - public void setId(UUID id) { - this.id = id; - } - - public List getDmps() { - return dmps; - } - - public void setDmps(List dmps) { - this.dmps = dmps; - } - - public String getLabel() { - return label; - } - - public void setLabel(String label) { - this.label = label; - } - - public String getAbbreviation() { - return abbreviation; - } - - public void setAbbreviation(String abbreviation) { - this.abbreviation = abbreviation; - } - - public String getReference() { - return reference; - } - - public void setReference(String reference) { - this.reference = reference; - } - - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - public String getDefinition() { - return definition; - } - - public void setDefinition(String definition) { - this.definition = definition; - } - - public Short getStatus() { - return status != null ? status.getValue() : null; - } - - public void setStatus(Short status) { - this.status = Grant.Status.fromInteger(status); - } - - public UserEntity getCreationUser() { - return creationUser; - } - - public void setCreationUser(UserEntity creationUser) { - this.creationUser = creationUser; - } - - public Date getStartDate() { - return startDate; - } - - public void setStartDate(Date startDate) { - this.startDate = startDate; - } - - public Date getEndDate() { - return endDate; - } - - public void setEndDate(Date endDate) { - this.endDate = endDate; - } - - public void setStatus(Grant.Status status) { - this.status = status; - } - - public Date getCreated() { - return created; - } - - public void setCreated(Date created) { - this.created = created; - } - - public Date getModified() { - return modified; - } - - public void setModified(Date modified) { - this.modified = modified; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public List getFiles() { - return files; - } - - public void setFiles(List files) { - this.files = files; - } - - @Override - public GrantListingModel fromDataModel(eu.eudat.data.old.Grant entity) { - this.id = entity.getId(); - this.label = entity.getLabel(); - return this; - } - - public GrantListingModel fromDataModelWIthDmps(eu.eudat.data.old.Grant entity) { - this.fromDataModel(entity); - this.abbreviation = entity.getAbbreviation(); - this.reference = entity.getReference(); - this.uri = entity.getUri(); - this.definition = entity.getDefinition(); - this.startDate = entity.getStartdate(); - this.endDate = entity.getEnddate(); - this.setStatus(entity.getStatus()); - this.created = entity.getCreated(); - this.modified = entity.getModified(); - this.description = entity.getDescription(); - this.files = entity.getContent() != null ? Arrays.asList(new ContentFile(entity.getContent().getLabel(), UUID.fromString(entity.getContent().getUri().split(":")[1]), "final", entity.getContent().getExtension())) : Arrays.asList(new ContentFile("default.png", null, null, null)); - //this.dmps = entity.getDmps().stream().map(item -> new DataManagementPlanUrlListing().fromDataModel(item)).collect(Collectors.toList()); //TODO - return this; - } - - public GrantListingModel fromDataModelDetails(Grant entity) { - this.fromDataModel(entity); - this.abbreviation = entity.getAbbreviation(); - this.reference = entity.getReference(); - this.uri = entity.getUri(); - this.definition = entity.getDefinition(); - this.startDate = entity.getStartdate(); - this.endDate = entity.getEnddate(); - this.setStatus(entity.getStatus()); - this.created = entity.getCreated(); - this.modified = entity.getModified(); - this.description = entity.getDescription(); - return this; - } - - @Override - public eu.eudat.data.old.Grant toDataModel() throws Exception { - throw new Exception("Not Implemented"); - } - - @Override - public String getHint() { - return "grantListingItem"; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/grant/GrantOverviewModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/grant/GrantOverviewModel.java deleted file mode 100644 index e73a62bd1..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/grant/GrantOverviewModel.java +++ /dev/null @@ -1,100 +0,0 @@ -package eu.eudat.models.data.grant; - -import eu.eudat.data.old.Grant; -import eu.eudat.models.DataModel; -import eu.eudat.models.data.funder.FunderOverviewModel; - -import java.util.Date; -import java.util.UUID; - -public class GrantOverviewModel implements DataModel { - private UUID id; - private String label; - private String abbreviation; - private String description; - private Date startDate; - private Date endDate; - private String uri; - private FunderOverviewModel funder; - - public UUID getId() { - return id; - } - public void setId(UUID id) { - this.id = id; - } - - public String getLabel() { - return label; - } - public void setLabel(String label) { - this.label = label; - } - - public String getAbbreviation() { - return abbreviation; - } - public void setAbbreviation(String abbreviation) { - this.abbreviation = abbreviation; - } - - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - - public Date getStartDate() { - return startDate; - } - public void setStartDate(Date startDate) { - this.startDate = startDate; - } - - public Date getEndDate() { - return endDate; - } - public void setEndDate(Date endDate) { - this.endDate = endDate; - } - - public String getUri() { - return uri; - } - public void setUri(String uri) { - this.uri = uri; - } - - public FunderOverviewModel getFunder() { - return funder; - } - public void setFunder(FunderOverviewModel funder) { - this.funder = funder; - } - - @Override - public GrantOverviewModel fromDataModel(Grant entity) { - this.id = entity.getId(); - this.label = entity.getLabel(); - this.abbreviation = entity.getAbbreviation(); - this.description = entity.getDescription(); - this.startDate = entity.getStartdate(); - this.endDate = entity.getEnddate(); - this.uri = entity.getUri(); - this.funder = new FunderOverviewModel(); - if (entity.getFunder() != null) - this.funder.fromDataModel(entity.getFunder()); - return this; - } - - @Override - public Grant toDataModel() throws Exception { - return null; - } - - @Override - public String getHint() { - return null; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/license/LicenseModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/license/LicenseModel.java deleted file mode 100644 index ccd309556..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/license/LicenseModel.java +++ /dev/null @@ -1,127 +0,0 @@ -package eu.eudat.models.data.license; - -import eu.eudat.data.old.DataRepository; -import eu.eudat.data.UserEntity; -import eu.eudat.models.DataModel; - -import java.util.Date; -import java.util.UUID; - -public class LicenseModel implements DataModel { - private UUID id; - private String name; - private String pid; - private String abbreviation; - private String uri; - private Date created; - private Date modified; - private String tag; // Api fetching the data - private String source; // Actual harvested source - - public UUID getId() { - return id; - } - public void setId(UUID id) { - this.id = id; - } - - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - public String getPid() { - return pid; - } - public void setPid(String pid) { - this.pid = pid; - } - - public String getAbbreviation() { - return abbreviation; - } - public void setAbbreviation(String abbreviation) { - this.abbreviation = abbreviation; - } - - public String getUri() { - return uri; - } - public void setUri(String uri) { - this.uri = uri; - } - - public Date getCreated() { - return created; - } - public void setCreated(Date created) { - this.created = created; - } - - public Date getModified() { - return modified; - } - public void setModified(Date modified) { - this.modified = modified; - } - - public String getTag() { - return tag; - } - public void setTag(String tag) { - this.tag = tag; - } - - public String getSource() { - return source; - } - public void setSource(String source) { - this.source = source; - } - - @Override - public LicenseModel fromDataModel(DataRepository entity) { - this.setAbbreviation(entity.getAbbreviation()); - this.setName(entity.getLabel()); - this.setUri(entity.getUri()); - this.setId(entity.getId()); - this.setPid(entity.getReference()); - String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":")); - if (source1.equals("dmp")) { - this.source = "Internal"; - } else { - this.source = source1; - } - return this; - } - - @Override - public DataRepository toDataModel() throws Exception { - DataRepository dataRepository = new DataRepository(); - dataRepository.setId(this.id != null ? this.id : UUID.randomUUID()); - dataRepository.setAbbreviation(this.abbreviation); - dataRepository.setCreated(this.created != null ? this.created : new Date()); - dataRepository.setModified(new Date()); - dataRepository.setLabel(this.name); - if (this.source != null) { - if (this.source.equals("Internal") || this.source.equals(this.id.toString().substring(0, this.source.length()))) { - dataRepository.setReference(this.id.toString()); - } else { - dataRepository.setReference(this.source + ":" + dataRepository.getId()); - } - } else { - dataRepository.setReference("dmp:" + dataRepository.getId()); - } - dataRepository.setUri(this.uri); - dataRepository.setStatus((short) 0); - dataRepository.setCreationUser(new UserEntity()); - return dataRepository; - } - - @Override - public String getHint() { - return null; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/listingmodels/DataManagementPlanListingModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/listingmodels/DataManagementPlanListingModel.java index 12eb0c3e5..cc412a201 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/listingmodels/DataManagementPlanListingModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/listingmodels/DataManagementPlanListingModel.java @@ -1,7 +1,6 @@ package eu.eudat.models.data.listingmodels; import eu.eudat.data.DmpEntity; -import eu.eudat.data.old.Grant; import eu.eudat.model.DmpUser; import eu.eudat.models.DataModel; import eu.eudat.models.data.urls.DatasetUrlListing; diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/listingmodels/DataManagementPlanOverviewModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/listingmodels/DataManagementPlanOverviewModel.java index f80e0c3a9..ec3346b41 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/listingmodels/DataManagementPlanOverviewModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/listingmodels/DataManagementPlanOverviewModel.java @@ -6,9 +6,6 @@ import eu.eudat.model.EntityDoi; import eu.eudat.models.DataModel; import eu.eudat.models.data.dataset.DatasetOverviewModel; import eu.eudat.models.data.dmp.AssociatedProfile; -import eu.eudat.models.data.dmp.Organisation; -import eu.eudat.models.data.dmp.Researcher; -import eu.eudat.models.data.grant.GrantOverviewModel; import java.util.Date; import java.util.List; @@ -18,17 +15,14 @@ public class DataManagementPlanOverviewModel implements DataModel organisations; private int version; private int status; private UUID groupId; private List datasets; private List associatedProfiles; - private List researchers; private List users; private String description; private boolean isPublic; @@ -57,13 +51,6 @@ public class DataManagementPlanOverviewModel implements DataModel getOrganisations() { - return organisations; - } - public void setOrganisations(List organizations) { - this.organisations = organizations; - } - public int getVersion() { return version; } @@ -141,12 +121,6 @@ public class DataManagementPlanOverviewModel implements DataModel getResearchers() { - return researchers; - } - public void setResearchers(List researchers) { - this.researchers = researchers; - } public boolean getIsPublic() { return isPublic; diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/project/Project.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/project/Project.java deleted file mode 100644 index c804a42ab..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/project/Project.java +++ /dev/null @@ -1,223 +0,0 @@ -package eu.eudat.models.data.project; - -import eu.eudat.data.old.Grant; -import eu.eudat.data.UserEntity; -import eu.eudat.models.DataModel; -import eu.eudat.models.data.dmp.DataManagementPlan; -import eu.eudat.models.data.files.ContentFile; - -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.UUID; - -public class Project implements DataModel { - - private UUID id; - private List dmps; - private String label; - private int type; - private String abbreviation; - private String reference; - private String uri; - private String definition; - private Date startDate; - private Date endDate; - private Short status; - private UserEntity creationUser; - private Date created; - private Date modified; - private String description; - private List files; - private String source; - private String key; - - public UUID getId() { - return id; - } - public void setId(UUID id) { - this.id = id; - } - - public List getDmps() { - return dmps; - } - public void setDmps(List dmps) { - this.dmps = dmps; - } - - public String getLabel() { - return label; - } - public void setLabel(String label) { - this.label = label; - } - - public int getType() { - return type; - } - public void setType(int type) { - this.type = type; - } - - public String getAbbreviation() { - return abbreviation; - } - public void setAbbreviation(String abbreviation) { - this.abbreviation = abbreviation; - } - - public String getReference() { - return reference; - } - public void setReference(String reference) { - this.reference = reference; - } - - public String getUri() { - return uri; - } - public void setUri(String uri) { - this.uri = uri; - } - - public String getDefinition() { - return definition; - } - public void setDefinition(String definition) { - this.definition = definition; - } - - public Date getStartDate() { - return startDate; - } - public void setStartDate(Date startDate) { - this.startDate = startDate; - } - - public Date getEndDate() { - return endDate; - } - public void setEndDate(Date endDate) { - this.endDate = endDate; - } - - public Short getStatus() { - return status; - } - public void setStatus(Short status) { - this.status = status; - } - - public UserEntity getCreationUser() { - return creationUser; - } - public void setCreationUser(UserEntity creationUser) { - this.creationUser = creationUser; - } - - public Date getCreated() { - return created; - } - public void setCreated(Date created) { - this.created = created; - } - - public Date getModified() { - return modified; - } - public void setModified(Date modified) { - this.modified = modified; - } - - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - - public List getFiles() { - return files; - } - public void setFiles(List files) { - this.files = files; - } - - public String getSource() { - return source; - } - public void setSource(String source) { - this.source = source; - } - - public String getKey() { - return key; - } - public void setKey(String key) { - this.key = key; - } - - @Override - public Project fromDataModel(eu.eudat.data.old.Project entity) { - this.id = entity.getId(); - this.label = entity.getLabel(); - this.abbreviation = entity.getAbbreviation(); - this.reference = entity.getReference(); - this.uri = entity.getUri(); - if (entity.getType() != null) { - this.type = entity.getType(); - } - this.definition = entity.getDefinition(); - this.startDate = entity.getStartdate(); - this.endDate = entity.getEnddate(); - this.setStatus(entity.getStatus()); - this.created = entity.getCreated(); - this.modified = entity.getModified(); - this.description = entity.getDescription(); - this.files = entity.getContent() != null ? Arrays.asList(new ContentFile(entity.getContent().getLabel(), UUID.fromString(entity.getContent().getUri().split(":")[1]), "final", entity.getContent().getExtension())) : Arrays.asList(new ContentFile("default.png", null, null, null)); - if (entity.getReference() != null) { - String source = entity.getReference().substring(0, entity.getReference().indexOf(":")); - if (source.equals("dmp")) { - this.key = "Internal"; - } else { - this.key = source; - } - } - - return this; - } - - @Override - public eu.eudat.data.old.Project toDataModel() { - eu.eudat.data.old.Project entity = new eu.eudat.data.old.Project(); - entity.setId(UUID.randomUUID()); - entity.setAbbreviation(this.abbreviation); - entity.setLabel(this.label); - entity.setType(this.type); - if ((this.source != null && this.source.equals("Internal")) || (this.key != null && this.key.equals("Internal"))) this.key = "dmp"; - if (this.reference != null && this.reference.startsWith("dmp:")) { - entity.setReference(this.reference); - } else if (this.reference != null && !this.reference.trim().isEmpty() && this.key != null && !this.key.trim().isEmpty()) { - if (this.key.equals(this.reference.substring(0, this.key.length()))) { - entity.setReference(this.reference); - } else { - entity.setReference(this.key.toLowerCase() + ":" + this.reference); - } - } - entity.setUri(this.uri); - entity.setDefinition(this.definition); - entity.setStartdate(this.startDate); - entity.setCreated(this.created == null ? new Date() : this.created); - entity.setEnddate(this.endDate); - entity.setStatus(this.status != null ? this.getStatus() : Grant.Status.ACTIVE.getValue()); - entity.setModified(new Date()); - entity.setDescription(this.description); - return entity; - } - - @Override - public String getHint() { - return null; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/project/ProjectDMPEditorModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/project/ProjectDMPEditorModel.java index c7ffbac35..1cee018a6 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/project/ProjectDMPEditorModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/project/ProjectDMPEditorModel.java @@ -1,18 +1,10 @@ package eu.eudat.models.data.project; public class ProjectDMPEditorModel { - private Project existProject; private String label; private String description; private String reference; - public Project getExistProject() { - return existProject; - } - public void setExistProject(Project existProject) { - this.existProject = existProject; - } - public String getLabel() { return label; } diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/publication/PublicationModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/publication/PublicationModel.java deleted file mode 100644 index 48a7d2602..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/publication/PublicationModel.java +++ /dev/null @@ -1,166 +0,0 @@ -package eu.eudat.models.data.publication; - -import eu.eudat.data.old.DataRepository; -import eu.eudat.data.UserEntity; -import eu.eudat.models.DataModel; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.UUID; - -public class PublicationModel implements DataModel { - private UUID id; - private List titles; - private List ids; - private String name; - private String pid; - private String pidTypeField; - private String abbreviation; - private String uri; - private Date created; - private Date modified; - private String tag; // Api fetching the data - private String source; // Actual harvested source - - public UUID getId() { - return id; - } - public void setId(UUID id) { - this.id = id; - } - - public List getTitles() { - return titles; - } - - public void setTitles(List titles) { - this.titles = titles; - } - - public List getIds() { - return ids; - } - - public void setIds(List ids) { - this.ids = ids; - } - - public String getAbbreviation() { - return abbreviation; - } - - public void setAbbreviation(String abbreviation) { - this.abbreviation = abbreviation; - } - - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - public Date getCreated() { - return created; - } - - public void setCreated(Date created) { - this.created = created; - } - - public Date getModified() { - return modified; - } - - public void setModified(Date modified) { - this.modified = modified; - } - - public String getTag() { - return tag; - } - - public void setTag(String tag) { - this.tag = tag; - } - - public String getSource() { - return source; - } - - public void setSource(String source) { - this.source = source; - } - - public String getPid() { - return pid; - } - - public void setPid(String pid) { - this.pid = pid; - } - - public String getPidTypeField() { - return pidTypeField; - } - - public void setPidTypeField(String pidTypeField) { - this.pidTypeField = pidTypeField; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - @Override - public PublicationModel fromDataModel(DataRepository entity) { - this.setAbbreviation(entity.getAbbreviation()); - this.setName(entity.getLabel()); - - this.setTitles(new ArrayList<>()); - this.getTitles().add(entity.getLabel()); - this.setUri(entity.getUri()); - this.setId(entity.getId()); - this.setPid(entity.getReference()); - String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":")); - if (source1.equals("dmp")) { - this.source = "Internal"; - } else { - this.source = source1; - } - return this; - } - - @Override - public DataRepository toDataModel() throws Exception { - DataRepository dataRepository = new DataRepository(); - dataRepository.setId(this.id != null ? this.id : UUID.randomUUID()); - dataRepository.setAbbreviation(this.abbreviation); - dataRepository.setCreated(this.created != null ? this.created : new Date()); - dataRepository.setModified(new Date()); - dataRepository.setLabel(this.name); - if (this.source != null) { - if (this.source.equals("Internal") || this.source.equals(this.id.toString().substring(0, this.source.length()))) { - dataRepository.setReference(this.id.toString()); - } else { - dataRepository.setReference(this.source + ":" + dataRepository.getId()); - } - } else { - dataRepository.setReference("dmp:" + dataRepository.getId()); - } - dataRepository.setUri(this.uri); - dataRepository.setStatus((short) 0); - dataRepository.setCreationUser(new UserEntity()); - return dataRepository; - } - - @Override - public String getHint() { - return null; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/quickwizard/DmpQuickWizardModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/quickwizard/DmpQuickWizardModel.java index d763297e7..3a24bfa30 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/quickwizard/DmpQuickWizardModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/quickwizard/DmpQuickWizardModel.java @@ -2,8 +2,6 @@ package eu.eudat.models.data.quickwizard; import eu.eudat.commons.scope.user.UserScope; import eu.eudat.data.DescriptionTemplateEntity; -import eu.eudat.data.old.Grant; -import eu.eudat.data.old.Project; import eu.eudat.model.User; import eu.eudat.models.data.dmp.AssociatedProfile; @@ -17,7 +15,6 @@ public class DmpQuickWizardModel { private int status; private AssociatedProfile datasetProfile; private String description; - private eu.eudat.models.data.grant.Grant grant; private String language; @@ -57,13 +54,6 @@ public class DmpQuickWizardModel { this.description = description; } - public eu.eudat.models.data.grant.Grant getGrant() { - return grant; - } - - public void setGrant(eu.eudat.models.data.grant.Grant grant) { - this.grant = grant; - } public String getLanguage() { return language; @@ -73,21 +63,22 @@ public class DmpQuickWizardModel { this.language = language; } - public eu.eudat.models.data.dmp.DataManagementPlan toDataDmp(Grant grant, Project project, UserScope userScope) throws InvalidApplicationException { + public eu.eudat.models.data.dmp.DataManagementPlan toDataDmp(/*Grant grant, Project project,*/ UserScope userScope) throws InvalidApplicationException { eu.eudat.models.data.dmp.DataManagementPlan dataManagementPlanEntity = new eu.eudat.models.data.dmp.DataManagementPlan(); dataManagementPlanEntity.setId(this.id); dataManagementPlanEntity.setVersion(0); dataManagementPlanEntity.setLabel(this.label); - if (grant != null) { - eu.eudat.models.data.grant.Grant importGrant = new eu.eudat.models.data.grant.Grant(); - dataManagementPlanEntity.setGrant(importGrant.fromDataModel(grant)); - } - if (project != null) { - eu.eudat.models.data.project.Project importProject = new eu.eudat.models.data.project.Project(); - dataManagementPlanEntity.setProject(importProject.fromDataModel(project)); - } + //TODO +// if (grant != null) { +// eu.eudat.models.data.grant.Grant importGrant = new eu.eudat.models.data.grant.Grant(); +// dataManagementPlanEntity.setGrant(importGrant.fromDataModel(grant)); +// } +// if (project != null) { +// eu.eudat.models.data.project.Project importProject = new eu.eudat.models.data.project.Project(); +// dataManagementPlanEntity.setProject(importProject.fromDataModel(project)); +// } if (this.datasetProfile != null) { List assProfile = new LinkedList<>(); assProfile.add(this.datasetProfile); diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/quickwizard/FunderQuickWizardModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/quickwizard/FunderQuickWizardModel.java deleted file mode 100644 index 81d9803b8..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/quickwizard/FunderQuickWizardModel.java +++ /dev/null @@ -1,34 +0,0 @@ -package eu.eudat.models.data.quickwizard; - -import eu.eudat.models.data.funder.Funder; - -import java.util.UUID; - -public class FunderQuickWizardModel { - private String label; - private Funder existFunder; - - public String getLabel() { - return label; - } - public void setLabel(String label) { - this.label = label; - } - - public Funder getExistFunder() { - return existFunder; - } - public void setExistFunder(Funder existFunder) { - this.existFunder = existFunder; - } - - public Funder toDataFunder() { - Funder toFunder = new Funder(); - toFunder.setId(UUID.randomUUID()); - toFunder.setLabel(this.label); - toFunder.setReference("dmp:" + toFunder.getId()); - toFunder.setDefinition(""); - toFunder.setType(eu.eudat.data.old.Funder.FunderType.INTERNAL.getValue()); - return toFunder; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/quickwizard/GrantQuickWizardModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/quickwizard/GrantQuickWizardModel.java deleted file mode 100644 index e71995759..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/quickwizard/GrantQuickWizardModel.java +++ /dev/null @@ -1,49 +0,0 @@ -package eu.eudat.models.data.quickwizard; - - -import eu.eudat.models.data.grant.Grant; - -import java.util.UUID; - -public class GrantQuickWizardModel { - private String label; - private String description; - private Grant existGrant; - - - public String getLabel() { - return label; - } - - public void setLabel(String label) { - this.label = label; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Grant getExistGrant() { - return existGrant; - } - - public void setExistGrant(Grant existGrant) { - this.existGrant = existGrant; - } - - public eu.eudat.models.data.grant.Grant toDataGrant() { - eu.eudat.models.data.grant.Grant toGrant = new eu.eudat.models.data.grant.Grant(); - toGrant.setId(UUID.randomUUID()); - toGrant.setAbbreviation(""); - toGrant.setLabel(this.label); - toGrant.setReference("dmp:" + toGrant.getId()); - toGrant.setUri(""); - toGrant.setDefinition(""); - toGrant.setDescription(this.description); - return toGrant; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/quickwizard/ProjectQuickWizardModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/quickwizard/ProjectQuickWizardModel.java deleted file mode 100644 index 9ede36773..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/quickwizard/ProjectQuickWizardModel.java +++ /dev/null @@ -1,44 +0,0 @@ -package eu.eudat.models.data.quickwizard; - -import eu.eudat.models.data.project.Project; - -import java.util.UUID; - -public class ProjectQuickWizardModel { - private String label; - private String description; - private Project existProject; - - public String getLabel() { - return label; - } - public void setLabel(String label) { - this.label = label; - } - - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - - public Project getExistProject() { - return existProject; - } - public void setExistProject(Project existProject) { - this.existProject = existProject; - } - - public Project toDataProject() { - Project toProject = new Project(); - toProject.setId(UUID.randomUUID()); - toProject.setAbbreviation(""); - toProject.setLabel(this.label); - toProject.setReference("dmp:" + toProject.getId()); - toProject.setUri(""); - toProject.setDefinition(""); - toProject.setDescription(this.description); - return toProject; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/quickwizard/QuickWizardModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/quickwizard/QuickWizardModel.java index 9d4fc2d11..5a565dd00 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/quickwizard/QuickWizardModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/quickwizard/QuickWizardModel.java @@ -3,34 +3,10 @@ package eu.eudat.models.data.quickwizard; public class QuickWizardModel { - private FunderQuickWizardModel funder; - private GrantQuickWizardModel grant; - private ProjectQuickWizardModel project; private DmpQuickWizardModel dmp; private DatasetQuickWizardModel datasets; private int status; - public FunderQuickWizardModel getFunder() { - return funder; - } - public void setFunder(FunderQuickWizardModel funder) { - this.funder = funder; - } - - public GrantQuickWizardModel getGrant() { - return grant; - } - public void setGrant(GrantQuickWizardModel grant) { - this.grant = grant; - } - - public ProjectQuickWizardModel getProject() { - return project; - } - public void setProject(ProjectQuickWizardModel project) { - this.project = project; - } - public DmpQuickWizardModel getDmp() { return dmp; } diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/FundingRDAExportModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/FundingRDAExportModel.java index a8b672cad..5c659903e 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/FundingRDAExportModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/FundingRDAExportModel.java @@ -1,7 +1,5 @@ package eu.eudat.models.data.rda; -import eu.eudat.data.old.Funder; -import eu.eudat.data.old.Grant; public class FundingRDAExportModel { private IdRDAExportModel funder_id; @@ -29,15 +27,15 @@ public class FundingRDAExportModel { this.funding_status = funding_status; } - public FundingRDAExportModel fromDataModel(Funder funder, Grant grant) { + public FundingRDAExportModel fromDataModel(/*Funder funder, Grant grant*/) { FundingRDAExportModel funding = new FundingRDAExportModel(); funding.funding_status = "planned"; // mock data - if (funder != null) { - funding.funder_id = new IdRDAExportModel(funder.getReference(), "other"); - } - if (grant != null) { - funding.grant_id = new IdRDAExportModel(grant.getReference(), "other"); - } +// if (funder != null) { //TODO +// funding.funder_id = new IdRDAExportModel(funder.getReference(), "other"); +// } +// if (grant != null) { +// funding.grant_id = new IdRDAExportModel(grant.getReference(), "other"); +// } return funding; } } diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/ProjectRDAExportModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/ProjectRDAExportModel.java index d9162667b..003bb7e63 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/ProjectRDAExportModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/ProjectRDAExportModel.java @@ -1,6 +1,5 @@ package eu.eudat.models.data.rda; -import eu.eudat.data.old.Grant; import java.util.Date; @@ -47,8 +46,8 @@ public class ProjectRDAExportModel { } - public ProjectRDAExportModel fromDataModel(Grant grant) { - this.funding = new FundingRDAExportModel().fromDataModel(grant.getFunder(), grant); + public ProjectRDAExportModel fromDataModel(/*Grant grant*/) { +// this.funding = new FundingRDAExportModel().fromDataModel(grant.getFunder(), grant); //TODO return this; } } diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/registries/RegistryModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/registries/RegistryModel.java deleted file mode 100644 index 4a6abc457..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/registries/RegistryModel.java +++ /dev/null @@ -1,143 +0,0 @@ -package eu.eudat.models.data.registries; - -import eu.eudat.data.old.Registry; -import eu.eudat.data.UserEntity; -import eu.eudat.models.DataModel; - -import java.util.Date; -import java.util.UUID; - -public class RegistryModel implements DataModel { - private UUID id; - private String name; - private String label; - private String pid; - private String abbreviation; - private String uri; - private Date created; - private Date modified; - private String reference; - private String tag; // Api fetching the data - private String source; // Actual harvested source - - public UUID getId() { - return id; - } - public void setId(UUID id) { - this.id = id; - } - - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - public String getLabel() { - return label; - } - public void setLabel(String label) { - this.label = label; - } - - public String getAbbreviation() { - return abbreviation; - } - public void setAbbreviation(String abbreviation) { - this.abbreviation = abbreviation; - } - - public String getUri() { - return uri; - } - public void setUri(String uri) { - this.uri = uri; - } - - public Date getCreated() { - return created; - } - public void setCreated(Date created) { - this.created = created; - } - - public Date getModified() { - return modified; - } - public void setModified(Date modified) { - this.modified = modified; - } - - public String getReference() { - return reference; - } - public void setReference(String reference) { - this.reference = reference; - } - - public String getTag() { - return tag; - } - public void setTag(String tag) { - this.tag = tag; - } - - public String getPid() { - return pid; - } - public void setPid(String pid) { - this.pid = pid; - } - - public String getSource() { - return source; - } - public void setSource(String source) { - this.source = source; - } - - @Override - public RegistryModel fromDataModel(Registry entity) { - this.id = entity.getId(); - this.abbreviation = entity.getAbbreviation(); - this.created = entity.getCreated(); - this.label = entity.getLabel(); - this.name = entity.getLabel(); - this.modified = entity.getModified(); - this.uri = entity.getUri(); - String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":")); - if (source1.equals("dmp")) { - this.source = "Internal"; - } else { - this.source = source1; - } - this.reference = entity.getReference(); - return this; - } - - @Override - public Registry toDataModel() throws Exception { - Registry registry = new Registry(); - registry.setAbbreviation(this.abbreviation); - registry.setCreated(this.created != null ? this.created : new Date()); - registry.setId(this.id != null ? this.id : UUID.randomUUID()); - registry.setLabel(this.label != null ? this.label : this.name); - registry.setUri(this.uri); - registry.setModified(new Date()); - if (this.source == null) this.source = "dmp"; - if (this.source.equals(registry.getId().toString().substring(0, this.source.length()))) { - registry.setReference(registry.getId().toString()); - } else { - registry.setReference(this.source + ":" + registry.getId()); - } - registry.setStatus((short)0); - registry.setCreationUser(new UserEntity()); - return registry; - } - - @Override - public String getHint() { - return null; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/researcher/Researcher.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/researcher/Researcher.java deleted file mode 100644 index 57f9314bc..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/researcher/Researcher.java +++ /dev/null @@ -1,52 +0,0 @@ -package eu.eudat.models.data.researcher; - -import eu.eudat.models.DataModel; - -import java.util.Date; - -/** - * Created by ikalyvas on 2/5/2018. - */ -public class Researcher implements DataModel { - - private String firstName; - - private String lastName; - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - @Override - public Researcher fromDataModel(eu.eudat.data.old.Researcher entity) { - return null; - } - - @Override - public eu.eudat.data.old.Researcher toDataModel() throws Exception { - eu.eudat.data.old.Researcher researcher = new eu.eudat.data.old.Researcher(); - researcher.setCreated(new Date()); - researcher.setLabel(this.firstName + " " + this.lastName); - researcher.setModified(new Date()); - researcher.setReference("dmp:" + researcher.getReference()); - researcher.setStatus((short) 0); - return researcher; - } - - @Override - public String getHint() { - return null; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/services/ServiceModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/services/ServiceModel.java deleted file mode 100644 index 93364bd36..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/services/ServiceModel.java +++ /dev/null @@ -1,144 +0,0 @@ -package eu.eudat.models.data.services; - -import eu.eudat.data.old.Service; -import eu.eudat.data.UserEntity; -import eu.eudat.models.DataModel; - -import java.util.Date; -import java.util.UUID; - -public class ServiceModel implements DataModel { - private UUID id; - private String label; - private String name; - private String pid; - private String abbreviation; - private String uri; - private Date created; - private Date modified; - private String reference; - private String tag; - private String source; - - public UUID getId() { - return id; - } - public void setId(UUID id) { - this.id = id; - } - - public String getLabel() { - return label; - } - public void setLabel(String label) { - this.label = label; - } - - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - public String getPid() { - return pid; - } - public void setPid(String pid) { - this.pid = pid; - } - - public String getAbbreviation() { - return abbreviation; - } - public void setAbbreviation(String abbreviation) { - this.abbreviation = abbreviation; - } - - public String getUri() { - return uri; - } - public void setUri(String uri) { - this.uri = uri; - } - - public Date getCreated() { - return created; - } - public void setCreated(Date created) { - this.created = created; - } - - public Date getModified() { - return modified; - } - public void setModified(Date modified) { - this.modified = modified; - } - - public String getReference() { - return reference; - } - public void setReference(String reference) { - this.reference = reference; - } - - public String getTag() { - return tag; - } - public void setTag(String tag) { - this.tag = tag; - } - - public String getSource() { - return source; - } - public void setSource(String source) { - this.source = source; - } - - @Override - public ServiceModel fromDataModel(Service entity) { - this.abbreviation = entity.getAbbreviation(); - this.created = entity.getCreated(); - this.id = entity.getId(); - this.label = entity.getLabel(); - this.name = entity.getLabel(); - this.modified = entity.getModified(); - this.uri = entity.getUri(); - String source = entity.getReference().substring(0, entity.getReference().indexOf(":")); - if (source.equals("dmp")) { - this.source = "Internal"; - } else { - this.source = source; - } - return this; - } - - @Override - public Service toDataModel() throws Exception { - Service service = new Service(); - service.setId(this.id != null ? this.id : UUID.randomUUID()); - service.setAbbreviation(this.abbreviation); - service.setCreated(this.created != null ? this.created : new Date()); - service.setLabel(this.label != null ? this.label : this.name); - service.setModified(new Date()); - service.setUri(this.uri); - if (this.source == null) this.source = "dmp"; - if (this.reference == null) this.reference = service.getId().toString(); - if (this.source.equals(this.reference.substring(0, this.source.length()))) { - service.setReference(this.reference); - } else { - service.setReference(this.source + ":" + this.reference); - } - service.setModified(new Date()); - service.setStatus((short) 0); - service.setCreationUser(new UserEntity()); - return service; - } - - @Override - public String getHint() { - return null; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/taxonomy/TaxonomyModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/taxonomy/TaxonomyModel.java deleted file mode 100644 index 05d9f9d3d..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/taxonomy/TaxonomyModel.java +++ /dev/null @@ -1,134 +0,0 @@ -package eu.eudat.models.data.taxonomy; - -import eu.eudat.data.old.DataRepository; -import eu.eudat.data.UserEntity; -import eu.eudat.models.DataModel; -import java.util.Date; -import java.util.UUID; - -public class TaxonomyModel implements DataModel { - private UUID id; - private String name; - private String pid; - private String abbreviation; - private String uri; - private Date created; - private Date modified; - private String tag; // Api fetching the data - private String source; // Actual harvested source - - public UUID getId() { - return id; - } - public void setId(UUID id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getAbbreviation() { - return abbreviation; - } - - public void setAbbreviation(String abbreviation) { - this.abbreviation = abbreviation; - } - - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - public Date getCreated() { - return created; - } - - public void setCreated(Date created) { - this.created = created; - } - - public Date getModified() { - return modified; - } - - public void setModified(Date modified) { - this.modified = modified; - } - - public String getTag() { - return tag; - } - - public void setTag(String tag) { - this.tag = tag; - } - - public String getSource() { - return source; - } - - public void setSource(String source) { - this.source = source; - } - - public String getPid() { - return pid; - } - - public void setPid(String pid) { - this.pid = pid; - } - - @Override - public TaxonomyModel fromDataModel(DataRepository entity) { - this.setAbbreviation(entity.getAbbreviation()); - this.setName(entity.getLabel()); - this.setUri(entity.getUri()); - this.setId(entity.getId()); - this.setPid(entity.getReference()); - String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":")); - if (source1.equals("dmp")) { - this.source = "Internal"; - } else { - this.source = source1; - } - return this; - } - - @Override - public DataRepository toDataModel() throws Exception { - DataRepository dataRepository = new DataRepository(); - dataRepository.setId(this.id != null ? this.id : UUID.randomUUID()); - dataRepository.setAbbreviation(this.abbreviation); - dataRepository.setCreated(this.created != null ? this.created : new Date()); - dataRepository.setModified(new Date()); - dataRepository.setLabel(this.name); - if (this.source != null) { - if (this.source.equals("Internal") || this.source.equals(this.id.toString().substring(0, this.source.length()))) { - dataRepository.setReference(this.id.toString()); - } else { - dataRepository.setReference(this.source + ":" + dataRepository.getId()); - } - } else { - dataRepository.setReference("dmp:" + dataRepository.getId()); - } - dataRepository.setUri(this.uri); - dataRepository.setStatus((short) 0); - dataRepository.setCreationUser(new UserEntity()); - return dataRepository; - } - - @Override - public String getHint() { - return null; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/ContributorRDAMapper.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/ContributorRDAMapper.java index e587e2f87..0d8e25426 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/ContributorRDAMapper.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/ContributorRDAMapper.java @@ -2,7 +2,6 @@ package eu.eudat.models.rda.mapper; import com.fasterxml.jackson.databind.ObjectMapper; import eu.eudat.data.DmpUserEntity; -import eu.eudat.data.old.Researcher; import eu.eudat.models.rda.Contributor; import eu.eudat.models.rda.ContributorId; import org.slf4j.Logger; @@ -25,48 +24,48 @@ public class ContributorRDAMapper { return rda; } - public static Contributor toRDA(Researcher researcher) { - Contributor rda = new Contributor(); - rda.setContributorId(ContributorIdRDAMapper.toRDA(researcher.getReference())); - rda.setName(researcher.getLabel()); - rda.setMbox(researcher.getPrimaryEmail()); -// rda.setRole(new HashSet<>(Arrays.asList(UserDMP.UserDMPRoles.fromInteger(userDMP.getRole()).name()))); - return rda; - } - +// public static Contributor toRDA(Researcher researcher) { +// Contributor rda = new Contributor(); +// rda.setContributorId(ContributorIdRDAMapper.toRDA(researcher.getReference())); +// rda.setName(researcher.getLabel()); +// rda.setMbox(researcher.getPrimaryEmail()); +//// rda.setRole(new HashSet<>(Arrays.asList(UserDMP.UserDMPRoles.fromInteger(userDMP.getRole()).name()))); +// return rda; +// } +// public static Contributor toRDA(String value) { ObjectMapper mapper = new ObjectMapper(); - try { - eu.eudat.models.data.dmp.Researcher researcher = mapper.readValue(value, eu.eudat.models.data.dmp.Researcher.class); - return toRDA(researcher.toDataModel()); - } catch (IOException e) { - logger.error(e.getMessage(), e); - } +// try { +// eu.eudat.models.data.dmp.Researcher researcher = mapper.readValue(value, eu.eudat.models.data.dmp.Researcher.class); +// return toRDA(researcher.toDataModel()); +// } catch (IOException e) { +// logger.error(e.getMessage(), e); +// } return null; } - - public static Researcher toEntity(Contributor rda) { - Researcher entity = new Researcher(); - String reference; - if (rda.getContributorId() != null) { - if (rda.getContributorId().getType() == ContributorId.Type.ORCID) { - String id = rda.getContributorId().getIdentifier().replace("http://orcid.org/", ""); - reference = "orcid:" + id; - } else { - String idParts[] = rda.getContributorId().getIdentifier().split(":"); - if (idParts.length == 1) { - reference = "dmp:" + rda.getContributorId().getIdentifier(); - } else { - reference = rda.getContributorId().getIdentifier(); - } - } - entity.setReference(reference); - entity.setLabel(rda.getName()); - entity.setPrimaryEmail(rda.getMbox()); - } else { - return null; - } - - return entity; - } +// +// public static Researcher toEntity(Contributor rda) { +// Researcher entity = new Researcher(); +// String reference; +// if (rda.getContributorId() != null) { +// if (rda.getContributorId().getType() == ContributorId.Type.ORCID) { +// String id = rda.getContributorId().getIdentifier().replace("http://orcid.org/", ""); +// reference = "orcid:" + id; +// } else { +// String idParts[] = rda.getContributorId().getIdentifier().split(":"); +// if (idParts.length == 1) { +// reference = "dmp:" + rda.getContributorId().getIdentifier(); +// } else { +// reference = rda.getContributorId().getIdentifier(); +// } +// } +// entity.setReference(reference); +// entity.setLabel(rda.getName()); +// entity.setPrimaryEmail(rda.getMbox()); +// } else { +// return null; +// } +// +// return entity; +// } } diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/FundingRDAMapper.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/FundingRDAMapper.java deleted file mode 100644 index 3fea3d499..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/FundingRDAMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package eu.eudat.models.rda.mapper; - -import eu.eudat.data.dao.criteria.GrantCriteria; -import eu.eudat.data.old.Funder; -import eu.eudat.data.old.Grant; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.models.rda.Funding; - -import jakarta.transaction.Transactional; -import java.util.Date; -import java.util.UUID; - -public class FundingRDAMapper { - - @Transactional - public static Funding toRDA(Grant grant) { - Funding rda = new Funding(); - String referencePrefix; - String shortReference; - if (grant.getFunder().getReference() != null) { - referencePrefix = grant.getFunder().getReference().split(":")[0]; - shortReference = grant.getFunder().getReference().substring(referencePrefix.length() + 1); - rda.setFunderId(FunderIdRDAMapper.toRDA(shortReference)); - } else { - rda.setFunderId(FunderIdRDAMapper.toRDA(grant.getFunder().getId())); - } - if (grant.getReference() != null) { - referencePrefix = grant.getReference().split(":")[0]; - shortReference = grant.getReference().substring(referencePrefix.length() + 1); - rda.setGrantId(GrantIdRDAMapper.toRDA(shortReference)); - } else { - rda.setGrantId(GrantIdRDAMapper.toRDA(grant.getId().toString())); - } - return rda; - } - - public static Grant toEntity(Funding rda, ApiContext apiContext) { - GrantCriteria criteria = new GrantCriteria(); - criteria.setReference(rda.getGrantId().getIdentifier()); - Grant grant; - try { - grant = apiContext.getOperationsContext().getDatabaseRepository().getGrantDao().getWithCriteria(criteria).getSingle(); - }catch (Exception e) { - grant = new Grant(); - grant.setId(UUID.randomUUID()); - grant.setLabel(rda.getGrantId().getIdentifier()); - grant.setStatus((short)1); - grant.setCreated(new Date()); - grant.setModified(new Date()); - grant.setType(0); - grant.setFunder(new Funder()); - grant.getFunder().setId(UUID.randomUUID()); - grant.getFunder().setLabel(rda.getFunderId().getIdentifier()); - grant.getFunder().setStatus((short)1); - grant.getFunder().setCreated(new Date()); - grant.getFunder().setModified(new Date()); - grant.getFunder().setType(0); - grant.getFunder().setReference(rda.getFunderId().getType().toString()+"::"+rda.getFunderId().getIdentifier()); - grant.setReference(rda.getGrantId().getType().toString()+"::"+rda.getGrantId().getIdentifier()); - Funder funder = apiContext.getOperationsContext().getDatabaseRepository().getFunderDao().createOrUpdate(grant.getFunder()); - grant = apiContext.getOperationsContext().getDatabaseRepository().getGrantDao().createOrUpdate(grant); - } - return grant; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/ProjectRDAMapper.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/ProjectRDAMapper.java deleted file mode 100644 index bea495085..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/ProjectRDAMapper.java +++ /dev/null @@ -1,59 +0,0 @@ -package eu.eudat.models.rda.mapper; - -import eu.eudat.data.old.Grant; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.models.rda.Project; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import jakarta.transaction.Transactional; -import java.util.*; - -public class ProjectRDAMapper { - private final static Logger logger = LoggerFactory.getLogger(ProjectRDAMapper.class); - - @Transactional - public static Project toRDA(eu.eudat.data.old.Project project, Grant grant) { - Project rda = new Project(); - try { - rda.setTitle(project.getLabel()); - rda.setDescription(project.getDescription()); - if (project.getStartdate() != null) { - rda.setStart(project.getStartdate().toString()); - } - if (project.getEnddate() != null) { - rda.setEnd(project.getEnddate().toString()); - } - rda.setFunding(Collections.singletonList(FundingRDAMapper.toRDA(grant))); - - if (rda.getTitle() == null) { - throw new IllegalArgumentException("Project Title is missing"); - } - } catch (Exception e) { - logger.error(e.getLocalizedMessage(), e); - } - - return rda; - } - - public static Map toEntity(Project rda, ApiContext apiContext) { - Map entities = new HashMap<>(); - - entities.put("project", new eu.eudat.data.old.Project()); - ((eu.eudat.data.old.Project) entities.get("project")).setLabel(rda.getTitle()); - ((eu.eudat.data.old.Project) entities.get("project")).setDescription(rda.getDescription()); - ((eu.eudat.data.old.Project) entities.get("project")).setId(UUID.randomUUID()); - ((eu.eudat.data.old.Project) entities.get("project")).setStatus((short)1); - ((eu.eudat.data.old.Project) entities.get("project")).setCreated(new Date()); - ((eu.eudat.data.old.Project) entities.get("project")).setModified(new Date()); - ((eu.eudat.data.old.Project) entities.get("project")).setStartdate(new Date()); - ((eu.eudat.data.old.Project) entities.get("project")).setEnddate(new Date()); - ((eu.eudat.data.old.Project) entities.get("project")).setType(0); - apiContext.getOperationsContext().getDatabaseRepository().getProjectDao().createOrUpdate(((eu.eudat.data.old.Project) entities.get("project"))); - for (int i = 0; i < rda.getFunding().size(); i++) { - entities.put("grant" + (i + 1), FundingRDAMapper.toEntity(rda.getFunding().get(i), apiContext)); - } - - return entities; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/validators/DatasetProfileValidator.java b/dmp-backend/web/src/main/java/eu/eudat/models/validators/DatasetProfileValidator.java deleted file mode 100644 index 66975a595..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/validators/DatasetProfileValidator.java +++ /dev/null @@ -1,26 +0,0 @@ -package eu.eudat.models.validators; - -import eu.eudat.models.data.admin.composite.DatasetProfile; -import eu.eudat.models.data.grant.Grant; -import eu.eudat.models.validators.fluentvalidator.FluentValidator; -import org.springframework.stereotype.Component; - - -@Component("datasetProfileValidator") -public class DatasetProfileValidator extends FluentValidator { - - public DatasetProfileValidator() { - ruleFor(x -> x.getLabel()).notEmpty() - .withName("label").withMessage("datasetprofile.label.null"); - } - - @Override - public boolean supports(Class aClass) { - return DatasetProfile.class.equals(aClass); - } - - public static boolean supportsType(Class clazz) { - return DatasetProfile.class.equals(clazz); - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/validators/GrantModelValidator.java b/dmp-backend/web/src/main/java/eu/eudat/models/validators/GrantModelValidator.java deleted file mode 100644 index 8e0588071..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/validators/GrantModelValidator.java +++ /dev/null @@ -1,28 +0,0 @@ -package eu.eudat.models.validators; - -import eu.eudat.models.data.grant.Grant; -import eu.eudat.models.validators.fluentvalidator.FluentValidator; -import org.springframework.stereotype.Component; - - -@Component("grantModelValidator") -public class GrantModelValidator extends FluentValidator { - - public GrantModelValidator() { - ruleFor(x -> x.getType()).compareAs((x -> eu.eudat.data.old.Grant.GrantType.EXTERNAL.getValue()), (leftItem, rightItem) -> leftItem == rightItem) - .withName("type").withMessage("grant.external.edit"); - ruleFor(x -> x.getStartDate()).compareAs((x -> x.getEndDate()), (leftItem, rightItem) -> leftItem.after(rightItem)) - .withName("startDate").withMessage("grant.startDate.overlapping") - .ruleIf(x -> x.getStartDate() != null && x.getEndDate() != null); - - } - - @Override - public boolean supports(Class aClass) { - return Grant.class.equals(aClass); - } - - public static boolean supportsType(Class aClass) { - return Grant.class.equals(aClass); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/validators/GrantTableRequestValidator.java b/dmp-backend/web/src/main/java/eu/eudat/models/validators/GrantTableRequestValidator.java deleted file mode 100644 index 17860cf73..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/validators/GrantTableRequestValidator.java +++ /dev/null @@ -1,32 +0,0 @@ -package eu.eudat.models.validators; - -import eu.eudat.data.query.items.table.grant.GrantTableRequest; -import eu.eudat.models.validators.fluentvalidator.FluentValidator; -import org.springframework.stereotype.Component; - - -@Component("grantTableRequestValidator") -public class GrantTableRequestValidator extends FluentValidator { - - public GrantTableRequestValidator() { - ruleFor(x -> x.getOffset()).compareAs(x -> 0, (leftItem, rightItem) -> leftItem < rightItem) - .withName("offset").withMessage("grantTableRequest.offset.negative"); - - ruleFor(x -> x.getLength()).compareAs(x -> 0, (leftItem, rightItem) -> leftItem < rightItem) - .withName("length").withMessage("grantTableRequest.length.negative"); - - ruleFor(x -> x.getCriteria().getPeriodStart()) - .compareAs(x -> x.getCriteria().getPeriodEnd(), (leftItem, rightItem) -> rightItem.before(leftItem)) - .withName("criteria.periodStart").withMessage("grantTableRequest.periodStart.overlapping") - .ruleIf(x -> x.getCriteria() != null && x.getCriteria().getPeriodStart() != null && x.getCriteria().getPeriodEnd() != null); - } - - @Override - public boolean supports(Class aClass) { - return GrantTableRequest.class.equals(aClass); - } - - public static boolean supportsType(Class clazz) { - return GrantTableRequest.class.equals(clazz); - } -}