From ab653e4f94edf5412a039bf3df17270b5569c476 Mon Sep 17 00:00:00 2001 From: sgiannopoulos Date: Thu, 8 Feb 2024 11:04:38 +0200 Subject: [PATCH] code clean up --- .../DataManagementPlanBlueprintCriteria.java | 17 - .../criteria/DataManagementPlanCriteria.java | 126 -- .../DataManagementPlanProfileCriteria.java | 9 - .../DataManagementPlanPublicCriteria.java | 66 - .../data/dao/criteria/DatasetCriteria.java | 142 -- .../dao/criteria/DatasetProfileCriteria.java | 101 -- .../DatasetProfileWizardCriteria.java | 18 - .../DatasetWizardUserDmpCriteria.java | 17 - .../dao/criteria/DynamicFieldsCriteria.java | 51 - .../data/dao/criteria/ReferenceCriteria.java | 17 - .../eudat/data/dao/criteria/RequestItem.java | 16 - .../data/dao/criteria/UserInfoCriteria.java | 33 - .../data/dao/criteria/UserRoleCriteria.java | 20 - .../context/DatabaseContext.java | 49 - .../service/DatabaseService.java | 40 - .../data/query/definition/TableQuery.java | 1 - .../table/dataset/DatasetTableRequest.java | 40 - .../eu/eudat/controllers/BaseController.java | 18 - .../eudat/controllers/CurrencyController.java | 4 +- .../controllers/ManagementController.java | 16 +- .../java/eu/eudat/controllers/Validation.java | 8 +- ...ublicDatasetsDescriptionDocumentation.java | 8 +- .../publicapi/PublicDmpsDocumentation.java | 8 +- .../controllers/v2/DepositController.java | 8 +- .../v2/DescriptionTemplateTypeController.java | 4 - .../eudat/controllers/v2/DmpController.java | 7 +- .../v2/ExternalValidationController.java | 9 +- .../v2/FileTransformerController.java | 12 +- .../controllers/v2/MaintenanceController.java | 7 - .../controllers/v2/PrincipalController.java | 4 +- .../controllers/v2/ReferenceController.java | 18 +- .../v2/ReferenceTypeController.java | 6 +- .../eudat/controllers/v2/TagController.java | 4 - .../eu/eudat/criteria/DatasetCriteria.java | 59 - .../criteria/RecentActivityCriteria.java | 31 - .../eu/eudat/criteria/entities/Criteria.java | 36 - .../eudat/criteria/entities/CriteriaType.java | 4 - .../eudat/criteria/entities/DateCriteria.java | 32 - .../serialzier/CriteriaSerializer.java | 41 - .../DMPNewVersionException.java | 8 - .../DMPWithDatasetsDeleteException.java | 22 - .../DatasetWizardCannotUnlockException.java | 22 - .../HasConfirmedEmailException.java | 8 - .../TokenExpiredException.java | 8 - .../security/ForbiddenException.java | 19 - .../security/UnauthorisedException.java | 24 - .../java/eu/eudat/logic/builders/Builder.java | 8 - .../eudat/logic/builders/BuilderFactory.java | 8 - .../logic/builders/BuilderFactoryImpl.java | 20 - .../entity/DatasetProfileBuilder.java | 100 -- .../builders/entity/UserInfoBuilder.java | 90 -- .../builders/entity/UserRoleBuilder.java | 43 - .../builders/helpers/BuilderApplier.java | 8 - .../model/models/DataTableDataBuilder.java | 33 - .../models/RecentActivityDataBuilder.java | 52 - .../eudat/logic/managers/CommonsManager.java | 29 - .../logic/managers/DatasetProfileManager.java | 189 +-- .../logic/managers/LocalFetchManager.java | 2 +- .../eudat/logic/managers/MaterialManager.java | 51 - .../eudat/logic/managers/MetricsManager.java | 119 +- .../eu/eudat/logic/managers/RDAManager.java | 50 - .../main/java/eu/eudat/logic/proxy/Proxy.java | 64 - .../eu/eudat/logic/proxy/config/AuthType.java | 23 - .../proxy/config/DataSearchConfiguration.java | 24 - .../config/configloaders/ConfigLoader.java | 5 - .../configloaders/DefaultConfigLoader.java | 120 +- .../configloaders/ProductionConfigLoader.java | 240 ---- .../eu/eudat/logic/services/ApiContext.java | 12 - .../eudat/logic/services/ApiContextImpl.java | 31 - .../services/forms/VisibilityContext.java | 45 - .../logic/services/forms/VisibilityRule.java | 27 - .../services/forms/VisibilityRuleService.java | 17 - .../forms/VisibilityRuleServiceImpl.java | 60 - .../services/forms/VisibilityRuleSource.java | 25 - .../services/helpers/HelpersService.java | 13 - .../services/helpers/HelpersServiceImpl.java | 31 - .../logic/services/helpers/LoggerService.java | 12 - .../operations/OperationsContext.java | 21 - .../operations/OperationsContextImpl.java | 55 - .../documents/types/ParagraphStyle.java | 49 - .../utilities/documents/types/TextStyle.java | 31 - .../documents/word/HtmlToWorldBuilder.java | 289 ---- .../utilities/documents/word/WordBuilder.java | 1160 ----------------- .../documents/word/XWPFHtmlDocument.java | 63 - .../documents/word/XWPFHtmlRelation.java | 11 - .../documents/xml/ExportXmlBuilder.java | 152 --- .../ExportXmlBuilderDatasetProfile.java | 371 ------ .../ImportXmlBuilderDatasetProfile.java | 29 - .../logic/utilities/helpers/LabelBuilder.java | 25 - .../utilities/helpers/LabelGenerator.java | 6 - .../logic/utilities/helpers/ListHelper.java | 17 - .../helpers/ModelBuilderCollector.java | 46 - .../utilities/helpers/MyStringUtils.java | 21 - .../logic/utilities/interfaces/Applier.java | 8 - .../interfaces/ApplierWithValue.java | 8 - .../logic/utilities/interfaces/Cloneable.java | 8 - .../interfaces/ViewStyleDefinition.java | 9 - .../logic/utilities/json/JavaToJson.java | 13 - .../logic/utilities/json/JsonSearcher.java | 81 -- .../utilities/json/MultiDateDeserializer.java | 41 - .../java/eu/eudat/logic/xml/XmlBuilder.java | 87 -- .../eu/eudat/logic/xml/XmlSerializable.java | 11 - .../eu/eudat/models/{v2 => }/Account.java | 2 +- .../eudat/models/{v2 => }/AccountBuilder.java | 5 +- .../main/java/eu/eudat/models/DataModel.java | 10 - .../eu/eudat/models/HintedModelFactory.java | 21 - .../data/ContactEmail/ContactEmailModel.java | 21 - .../ContactEmail/PublicContactEmailModel.java | 41 - .../eudat/models/data/FetcherReference.java | 243 ---- .../components/datasetprofile/Field.java | 157 --- .../components/datasetprofile/FieldSet.java | 140 -- .../admin/components/datasetprofile/Page.java | 55 - .../components/datasetprofile/Section.java | 150 --- .../data/admin/composite/DatasetProfile.java | 105 -- .../data/dashboard/recent/RecentActivity.java | 36 - .../RecentActivityTableRequest.java | 52 - .../dashboard/searchbar/SearchBarItem.java | 47 - .../statistics/DashBoardStatistics.java | 41 - .../DatasetImportDefaultValue.java | 20 - .../datasetImport/DatasetImportField.java | 125 -- .../datasetImport/DatasetImportFieldSet.java | 120 -- .../datasetImport/DatasetImportFieldSets.java | 25 - .../datasetImport/DatasetImportFields.java | 22 - .../DatasetImportMultiplicity.java | 20 - .../data/datasetImport/DatasetImportPage.java | 35 - .../DatasetImportPagedDatasetProfile.java | 33 - .../data/datasetImport/DatasetImportRule.java | 44 - .../datasetImport/DatasetImportSection.java | 92 -- .../datasetImport/DatasetImportSections.java | 19 - .../datasetImport/DatasetImportViewStyle.java | 20 - .../DatasetImportVisibility.java | 22 - .../models/data/dmp/AssociatedProfile.java | 77 -- .../dmp/AssociatedProfileImportModels.java | 31 - .../models/data/dmp/DatasetImportModels.java | 56 - .../eudat/models/data/dmp/DmpImportModel.java | 163 --- .../data/dmp/DmpProfileImportModel.java | 25 - .../DynamicFieldWithValueImportModels.java | 7 - .../models/data/dmp/ExtraFieldModel.java | 20 - .../data/dmp/ExtraFieldsImportModels.java | 36 - .../models/data/dmp/FieldImportModels.java | 27 - .../models/data/dmp/FunderImportModels.java | 26 - .../models/data/dmp/GrantImportModels.java | 40 - .../data/dmp/OrganisationImportModel.java | 40 - .../models/data/dmp/ProjectImportModels.java | 26 - .../data/dmp/ResearcherImportModels.java | 49 - .../models/data/dmp/UserInfoImportModels.java | 7 - .../models/data/dmp/adpter/PageAdapter.java | 36 - .../models/data/dynamicfields/Dependency.java | 25 - .../data/dynamicfields/DynamicField.java | 55 - .../dynamicfields/DynamicFieldWithValue.java | 65 - .../errormodels/ValidationErrorContext.java | 15 - .../external/ExternalDatasetSourcesModel.java | 20 - .../models/data/external/ExternalItem.java | 9 - .../data/external/ExternalListingItem.java | 8 - .../external/ExternalSourcesItemModel.java | 85 -- .../external/FundersExternalSourcesModel.java | 23 - .../external/GrantsExternalSourcesModel.java | 22 - .../LicensesExternalSourcesModel.java | 19 - .../OrganisationsExternalSourcesModel.java | 23 - .../ProjectsExternalSourcesModel.java | 72 - .../RegistriesExternalSourcesModel.java | 20 - .../ResearchersExternalSourcesModel.java | 27 - .../external/ServiceExternalSourcesModel.java | 20 - .../external/TagExternalSourcesModel.java | 23 - .../data/external/orcid/ExpandedResult.java | 44 - .../data/external/orcid/ExpandedSearch.java | 18 - .../data/external/orcid/PersonalDetails.java | 26 - .../data/external/orcid/PersonalName.java | 44 - .../ExternalSourcesConfiguration.java | 81 -- .../eudat/models/data/files/ContentFile.java | 55 - .../eudat/models/data/helpermodels/Pair.java | 7 - .../eudat/models/data/helpermodels/Tuple.java | 51 - .../common/AutoCompleteLookupItem.java | 25 - .../common/AutoCompleteOptionsLookupItem.java | 19 - .../models/data/invitation/Invitation.java | 37 - .../models/data/invitation/Properties.java | 18 - .../data/loginprovider/LoginProviderUser.java | 59 - .../eu/eudat/models/data/pid/PidLink.java | 21 - .../eu/eudat/models/data/pid/PidLinks.java | 16 - .../data/project/ProjectDMPEditorModel.java | 29 - .../data/properties/DatasetProfilePage.java | 34 - .../eudat/models/data/properties/Field.java | 35 - .../models/data/properties/FieldSet.java | 62 - .../eudat/models/data/properties/Group.java | 29 - .../data/properties/PropertiesGenerator.java | 9 - .../data/properties/PropertiesModel.java | 37 - .../eudat/models/data/properties/Section.java | 38 - .../data/rda/ContactRDAExportModel.java | 44 - .../DatasetDistributionRDAExportModel.java | 93 -- .../rda/DatasetMetadataRDAExportModel.java | 47 - .../data/rda/DatasetRDAExportModel.java | 476 ------- ...tasetSecurityAndPrivacyRDAExportModel.java | 29 - ...atasetTechnicalResourceRDAExportModel.java | 28 - .../rda/DmpContributorRDAExportModel.java | 52 - .../data/rda/DmpCostRDAExportModel.java | 36 - .../models/data/rda/DmpRDAExportModel.java | 166 --- .../data/rda/FundingRDAExportModel.java | 41 - .../models/data/rda/HostRDAExportModel.java | 86 -- .../models/data/rda/IdRDAExportModel.java | 25 - .../data/rda/LicenseRDAExportModel.java | 20 - .../data/rda/ProjectRDAExportModel.java | 53 - .../eudat/models/data/rda/RDAExportModel.java | 19 - .../eu/eudat/models/data/rda/RdaField.java | 36 - .../data/user/components/commons/Rule.java | 49 - .../user/components/datasetprofile/Field.java | 304 ----- .../components/datasetprofile/FieldSet.java | 220 ---- .../components/datasetprofile/Section.java | 161 --- .../data/user/composite/DatasetProfile.java | 96 -- .../user/composite/DatasetProfilePage.java | 36 - .../user/composite/PagedDatasetProfile.java | 67 - .../composite/PropertiesModelBuilder.java | 9 - .../models/data/userguide/UserGuide.java | 23 - .../dashboard/recent/RecentActivityData.java | 2 +- .../helpers/common/DataTableData.java | 2 +- .../helpers/responses/ResponseItem.java | 2 +- .../{data => old}/local/LocalFetchModel.java | 2 +- .../java/eu/eudat/models/rda/Contact.java | 142 -- .../java/eu/eudat/models/rda/ContactId.java | 148 --- .../java/eu/eudat/models/rda/Contributor.java | 177 --- .../eu/eudat/models/rda/ContributorId.java | 149 --- .../main/java/eu/eudat/models/rda/Cost.java | 368 ------ .../java/eu/eudat/models/rda/Dataset.java | 612 --------- .../java/eu/eudat/models/rda/DatasetId.java | 158 --- .../eu/eudat/models/rda/Distribution.java | 407 ------ .../main/java/eu/eudat/models/rda/Dmp.java | 551 -------- .../main/java/eu/eudat/models/rda/DmpId.java | 150 --- .../java/eu/eudat/models/rda/FunderId.java | 148 --- .../java/eu/eudat/models/rda/Funding.java | 181 --- .../java/eu/eudat/models/rda/GrantId.java | 147 --- .../main/java/eu/eudat/models/rda/Host.java | 769 ----------- .../java/eu/eudat/models/rda/Language.java | 229 ---- .../java/eu/eudat/models/rda/License.java | 109 -- .../eudat/models/rda/MetadataStandardId.java | 147 --- .../java/eu/eudat/models/rda/Metadatum.java | 363 ------ .../java/eu/eudat/models/rda/PidSystem.java | 63 - .../java/eu/eudat/models/rda/Project.java | 208 --- .../java/eu/eudat/models/rda/RDAModel.java | 61 - .../eudat/models/rda/SecurityAndPrivacy.java | 106 -- .../eudat/models/rda/TechnicalResource.java | 106 -- .../models/rda/mapper/ContactIdRDAMapper.java | 19 - .../models/rda/mapper/ContactRDAMapper.java | 30 - .../rda/mapper/ContributorIdRDAMapper.java | 24 - .../rda/mapper/ContributorRDAMapper.java | 71 - .../models/rda/mapper/CostRDAMapper.java | 121 -- .../models/rda/mapper/DatasetIdRDAMapper.java | 141 -- .../models/rda/mapper/DatasetRDAMapper.java | 421 ------ .../rda/mapper/DistributionRDAMapper.java | 457 ------- .../models/rda/mapper/DmpIdRDAMapper.java | 19 - .../eudat/models/rda/mapper/DmpRDAMapper.java | 190 --- .../models/rda/mapper/FunderIdRDAMapper.java | 19 - .../models/rda/mapper/GrantIdRDAMapper.java | 13 - .../models/rda/mapper/HostRDAMapper.java | 264 ---- .../models/rda/mapper/KeywordRDAMapper.java | 28 - .../models/rda/mapper/LanguageRDAMapper.java | 45 - .../models/rda/mapper/LicenseRDAMapper.java | 139 -- .../models/rda/mapper/MetadataRDAMapper.java | 223 ---- .../mapper/MetadataStandardIdRDAMapper.java | 13 - .../mapper/SecurityAndPrivacyRDAMapper.java | 157 --- .../mapper/TechnicalResourceRDAMapper.java | 158 --- .../fluentvalidator/FluentValidator.java | 32 - .../FluentValidatorBuilder.java | 75 -- .../FluentValidatorResult.java | 32 - .../validators/fluentvalidator/Rule.java | 8 - .../predicates/ComparisonOperator.java | 8 - .../predicates/ConditionalOperator.java | 8 - .../predicates/FieldSelector.java | 10 - .../rules/AbstractFluentValidatorRule.java | 22 - .../fluentvalidator/rules/CompareRule.java | 26 - .../fluentvalidator/rules/NotEmptyRule.java | 20 - .../src/main/java/eu/eudat/types/Rights.java | 31 - .../java/eu/eudat/types/WarningLevel.java | 8 - .../types/searchbar/SearchBarItemType.java | 32 - 272 files changed, 97 insertions(+), 19585 deletions(-) delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DataManagementPlanBlueprintCriteria.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DataManagementPlanCriteria.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DataManagementPlanProfileCriteria.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DataManagementPlanPublicCriteria.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DatasetCriteria.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DatasetProfileCriteria.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DatasetProfileWizardCriteria.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DatasetWizardUserDmpCriteria.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DynamicFieldsCriteria.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/ReferenceCriteria.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/RequestItem.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/UserInfoCriteria.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/UserRoleCriteria.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/databaselayer/context/DatabaseContext.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/databaselayer/service/DatabaseService.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/query/items/table/dataset/DatasetTableRequest.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/controllers/BaseController.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/criteria/DatasetCriteria.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/criteria/RecentActivityCriteria.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/criteria/entities/Criteria.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/criteria/entities/CriteriaType.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/criteria/entities/DateCriteria.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/criteria/serialzier/CriteriaSerializer.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/exceptions/datamanagementplan/DMPNewVersionException.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/exceptions/datamanagementplan/DMPWithDatasetsDeleteException.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/exceptions/datasetwizard/DatasetWizardCannotUnlockException.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/exceptions/emailconfirmation/HasConfirmedEmailException.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/exceptions/emailconfirmation/TokenExpiredException.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/exceptions/security/ForbiddenException.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/exceptions/security/UnauthorisedException.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/builders/Builder.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/builders/BuilderFactory.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/builders/BuilderFactoryImpl.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/builders/entity/DatasetProfileBuilder.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/builders/entity/UserInfoBuilder.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/builders/entity/UserRoleBuilder.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/builders/helpers/BuilderApplier.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/models/DataTableDataBuilder.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/models/RecentActivityDataBuilder.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/managers/CommonsManager.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/managers/MaterialManager.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/managers/RDAManager.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/proxy/Proxy.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/AuthType.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/DataSearchConfiguration.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/configloaders/ProductionConfigLoader.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/services/ApiContext.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/services/ApiContextImpl.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/services/forms/VisibilityContext.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/services/forms/VisibilityRule.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/services/forms/VisibilityRuleService.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/services/forms/VisibilityRuleServiceImpl.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/services/forms/VisibilityRuleSource.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/services/helpers/HelpersService.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/services/helpers/HelpersServiceImpl.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/services/helpers/LoggerService.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/services/operations/OperationsContext.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/services/operations/OperationsContextImpl.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/types/ParagraphStyle.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/types/TextStyle.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/HtmlToWorldBuilder.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/WordBuilder.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/XWPFHtmlDocument.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/XWPFHtmlRelation.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/xml/ExportXmlBuilder.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/xml/datasetProfileXml/ExportXmlBuilderDatasetProfile.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/xml/datasetProfileXml/ImportXmlBuilderDatasetProfile.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/utilities/helpers/LabelBuilder.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/utilities/helpers/LabelGenerator.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/utilities/helpers/ListHelper.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/utilities/helpers/ModelBuilderCollector.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/utilities/helpers/MyStringUtils.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/utilities/interfaces/Applier.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/utilities/interfaces/ApplierWithValue.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/utilities/interfaces/Cloneable.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/utilities/interfaces/ViewStyleDefinition.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/utilities/json/JavaToJson.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/utilities/json/JsonSearcher.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/utilities/json/MultiDateDeserializer.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/xml/XmlBuilder.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/xml/XmlSerializable.java rename dmp-backend/web/src/main/java/eu/eudat/models/{v2 => }/Account.java (99%) rename dmp-backend/web/src/main/java/eu/eudat/models/{v2 => }/AccountBuilder.java (97%) delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/DataModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/HintedModelFactory.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/ContactEmail/ContactEmailModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/ContactEmail/PublicContactEmailModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/FetcherReference.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/admin/components/datasetprofile/Field.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/admin/components/datasetprofile/FieldSet.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/admin/components/datasetprofile/Page.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/admin/components/datasetprofile/Section.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/admin/composite/DatasetProfile.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/dashboard/recent/RecentActivity.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/dashboard/recent/tablerequest/RecentActivityTableRequest.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/dashboard/searchbar/SearchBarItem.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/dashboard/statistics/DashBoardStatistics.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportDefaultValue.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportField.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportFieldSet.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportFieldSets.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportFields.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportMultiplicity.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportPage.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportPagedDatasetProfile.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportRule.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportSection.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportSections.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportViewStyle.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportVisibility.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/AssociatedProfile.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/AssociatedProfileImportModels.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DatasetImportModels.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DmpImportModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DmpProfileImportModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DynamicFieldWithValueImportModels.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/ExtraFieldModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/ExtraFieldsImportModels.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/FieldImportModels.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/FunderImportModels.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/GrantImportModels.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/OrganisationImportModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/ProjectImportModels.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/ResearcherImportModels.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/UserInfoImportModels.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/adpter/PageAdapter.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/dynamicfields/Dependency.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/dynamicfields/DynamicField.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/dynamicfields/DynamicFieldWithValue.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/errormodels/ValidationErrorContext.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/external/ExternalDatasetSourcesModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/external/ExternalItem.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/external/ExternalListingItem.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/external/ExternalSourcesItemModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/external/FundersExternalSourcesModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/external/GrantsExternalSourcesModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/external/LicensesExternalSourcesModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/external/OrganisationsExternalSourcesModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/external/ProjectsExternalSourcesModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/external/RegistriesExternalSourcesModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/external/ResearchersExternalSourcesModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/external/ServiceExternalSourcesModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/external/TagExternalSourcesModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/external/orcid/ExpandedResult.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/external/orcid/ExpandedSearch.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/external/orcid/PersonalDetails.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/external/orcid/PersonalName.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/externalurl/ExternalSourcesConfiguration.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/files/ContentFile.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/helpermodels/Pair.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/helpermodels/Tuple.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/helpers/common/AutoCompleteLookupItem.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/helpers/common/AutoCompleteOptionsLookupItem.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/invitation/Invitation.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/invitation/Properties.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/loginprovider/LoginProviderUser.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/pid/PidLink.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/pid/PidLinks.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/project/ProjectDMPEditorModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/properties/DatasetProfilePage.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/properties/Field.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/properties/FieldSet.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/properties/Group.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/properties/PropertiesGenerator.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/properties/PropertiesModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/properties/Section.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/rda/ContactRDAExportModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DatasetDistributionRDAExportModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DatasetMetadataRDAExportModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DatasetRDAExportModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DatasetSecurityAndPrivacyRDAExportModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DatasetTechnicalResourceRDAExportModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DmpContributorRDAExportModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DmpCostRDAExportModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DmpRDAExportModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/rda/FundingRDAExportModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/rda/HostRDAExportModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/rda/IdRDAExportModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/rda/LicenseRDAExportModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/rda/ProjectRDAExportModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/rda/RDAExportModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/rda/RdaField.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/user/components/commons/Rule.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/user/components/datasetprofile/Field.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/user/components/datasetprofile/FieldSet.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/user/components/datasetprofile/Section.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/user/composite/DatasetProfile.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/user/composite/DatasetProfilePage.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/user/composite/PagedDatasetProfile.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/user/composite/PropertiesModelBuilder.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/userguide/UserGuide.java rename dmp-backend/web/src/main/java/eu/eudat/models/{data => old}/dashboard/recent/RecentActivityData.java (92%) rename dmp-backend/web/src/main/java/eu/eudat/models/{data => old}/helpers/common/DataTableData.java (90%) rename dmp-backend/web/src/main/java/eu/eudat/models/{data => old}/helpers/responses/ResponseItem.java (96%) rename dmp-backend/web/src/main/java/eu/eudat/models/{data => old}/local/LocalFetchModel.java (91%) delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/Contact.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/ContactId.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/Contributor.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/ContributorId.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/Cost.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/Dataset.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/DatasetId.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/Distribution.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/Dmp.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/DmpId.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/FunderId.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/Funding.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/GrantId.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/Host.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/Language.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/License.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/MetadataStandardId.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/Metadatum.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/PidSystem.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/Project.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/RDAModel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/SecurityAndPrivacy.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/TechnicalResource.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/ContactIdRDAMapper.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/ContactRDAMapper.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/ContributorIdRDAMapper.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/ContributorRDAMapper.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/CostRDAMapper.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DatasetIdRDAMapper.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DatasetRDAMapper.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DistributionRDAMapper.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DmpIdRDAMapper.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DmpRDAMapper.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/FunderIdRDAMapper.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/GrantIdRDAMapper.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/HostRDAMapper.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/KeywordRDAMapper.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/LanguageRDAMapper.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/LicenseRDAMapper.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/MetadataRDAMapper.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/MetadataStandardIdRDAMapper.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/SecurityAndPrivacyRDAMapper.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/TechnicalResourceRDAMapper.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/FluentValidator.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/FluentValidatorBuilder.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/FluentValidatorResult.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/Rule.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/predicates/ComparisonOperator.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/predicates/ConditionalOperator.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/predicates/FieldSelector.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/rules/AbstractFluentValidatorRule.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/rules/CompareRule.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/rules/NotEmptyRule.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/types/Rights.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/types/WarningLevel.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/types/searchbar/SearchBarItemType.java diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DataManagementPlanBlueprintCriteria.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DataManagementPlanBlueprintCriteria.java deleted file mode 100644 index 9ffe48dc4..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DataManagementPlanBlueprintCriteria.java +++ /dev/null @@ -1,17 +0,0 @@ -package eu.eudat.data.dao.criteria; - -import eu.eudat.commons.enums.DmpBlueprintStatus; -import eu.eudat.data.DmpBlueprintEntity; - -public class DataManagementPlanBlueprintCriteria extends Criteria { - - private DmpBlueprintStatus status; - - public DmpBlueprintStatus getStatus() { - return status; - } - public void setStatus(DmpBlueprintStatus status) { - this.status = status; - } - -} 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 deleted file mode 100644 index 3061a5639..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DataManagementPlanCriteria.java +++ /dev/null @@ -1,126 +0,0 @@ -package eu.eudat.data.dao.criteria; - -import eu.eudat.data.DmpBlueprintEntity; -import eu.eudat.data.DmpEntity; - -import java.util.Date; -import java.util.List; -import java.util.UUID; - -public class DataManagementPlanCriteria extends Criteria { - private Date periodStart; - private Date periodEnd; - private DmpBlueprintEntity profile; - private boolean allVersions; - private List groupIds; - private Integer status; - private List organisations; - private Integer role; - private List collaborators; - private List datasetTemplates; - private boolean isPublic; - private boolean onlyPublic; - private Short grantStatus; - private boolean hasDoi; - - 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 DmpBlueprintEntity getProfile() { - return profile; - } - public void setProfile(DmpBlueprintEntity profile) { - this.profile = profile; - } - - public boolean getAllVersions() { - return allVersions; - } - public void setAllVersions(boolean allVersions) { - this.allVersions = allVersions; - } - - public List getGroupIds() { - return groupIds; - } - public void setGroupIds(List groupIds) { - this.groupIds = groupIds; - } - - public Integer getStatus() { - return status; - } - public void setStatus(Integer status) { - this.status = status; - } - - public List getOrganisations() { - return organisations; - } - public void setOrganisations(List organisations) { - this.organisations = organisations; - } - - public Integer getRole() { - return role; - } - public void setRole(Integer role) { - this.role = role; - } - - public List getCollaborators() { - return collaborators; - } - public void setCollaborators(List collaborators) { - this.collaborators = collaborators; - } - - public List getDatasetTemplates() { - return datasetTemplates; - } - public void setDatasetTemplates(List datasetTemplates) { - this.datasetTemplates = datasetTemplates; - } - - public boolean getIsPublic() { - return isPublic; - } - public void setIsPublic(boolean isPublic) { - this.isPublic = isPublic; - } - - public boolean isOnlyPublic() { - return onlyPublic; - } - - public void setOnlyPublic(boolean onlyPublic) { - this.onlyPublic = onlyPublic; - } - - public Short getGrantStatus() { - return grantStatus; - } - - public void setGrantStatus(Short grantStatus) { - this.grantStatus = grantStatus; - } - - public boolean hasDoi() { - return hasDoi; - } - - public void setHasDoi(boolean hasDoi) { - this.hasDoi = hasDoi; - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DataManagementPlanProfileCriteria.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DataManagementPlanProfileCriteria.java deleted file mode 100644 index 56e4519d8..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DataManagementPlanProfileCriteria.java +++ /dev/null @@ -1,9 +0,0 @@ -package eu.eudat.data.dao.criteria; - -import eu.eudat.data.DmpBlueprintEntity; - -/** - * Created by ikalyvas on 3/21/2018. - */ -public class DataManagementPlanProfileCriteria extends Criteria { -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DataManagementPlanPublicCriteria.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DataManagementPlanPublicCriteria.java deleted file mode 100644 index a9a2d9d02..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DataManagementPlanPublicCriteria.java +++ /dev/null @@ -1,66 +0,0 @@ -package eu.eudat.data.dao.criteria; - -import eu.eudat.data.DmpEntity; -import eu.eudat.types.grant.GrantStateType; - -import java.util.List; -import java.util.UUID; - -public class DataManagementPlanPublicCriteria extends Criteria { - private GrantStateType grantStatus; - private List grants; - public List datasetProfile; - private List dmpOrganisations; - private Integer role; - private boolean allVersions; - private List groupIds; - - public GrantStateType getGrantStatus() { - return grantStatus; - } - public void setGrantStatus(GrantStateType grantStatus) { - this.grantStatus = grantStatus; - } - - public List getGrants() { - return grants; - } - public void setGrants(List grants) { - this.grants = grants; - } - - public List getDatasetProfile() { - return datasetProfile; - } - public void setDatasetProfile(List datasetProfile) { - this.datasetProfile = datasetProfile; - } - - public List getDmpOrganisations() { - return dmpOrganisations; - } - public void setDmpOrganisations(List dmpOrganisations) { - this.dmpOrganisations = dmpOrganisations; - } - - public Integer getRole() { - return role; - } - public void setRole(Integer role) { - this.role = role; - } - - public boolean getAllVersions() { - return allVersions; - } - public void setAllVersions(boolean allVersions) { - this.allVersions = allVersions; - } - - public List getGroupIds() { - return groupIds; - } - public void setGroupIds(List groupIds) { - this.groupIds = groupIds; - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DatasetCriteria.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DatasetCriteria.java deleted file mode 100644 index f911b8a52..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DatasetCriteria.java +++ /dev/null @@ -1,142 +0,0 @@ -package eu.eudat.data.dao.criteria; - -import eu.eudat.data.DescriptionEntity; - -import java.util.Date; -import java.util.List; -import java.util.UUID; - - -public class DatasetCriteria extends Criteria { - private Integer status; - private Date periodStart; - private Date periodEnd; - private List dmpIds; -// private List tags; //TODO - private boolean allVersions; - private UUID profileDatasetId; - private List organisations; - private Integer role; - private List grants; - private List collaborators; - private List datasetTemplates; - private List groupIds; - private Boolean isPublic; - private Short grantStatus; - private boolean hasDoi; - - public boolean getAllVersions() { - return allVersions; - } - public void setAllVersions(boolean allVersions) { - this.allVersions = allVersions; - } - - public Integer getStatus() { - return status; - } - public void setStatus(Integer status) { - this.status = status; - } - - 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 List getDmpIds() { - return dmpIds; - } - public void setDmpIds(List dmpIds) { - this.dmpIds = dmpIds; - } - -// public List getTags() { -// return tags; -// } -// public void setTags(List tags) { -// this.tags = tags; -// } - - public UUID getProfileDatasetId() { - return profileDatasetId; - } - public void setProfileDatasetId(UUID profileDatasetId) { - this.profileDatasetId = profileDatasetId; - } - - public List getOrganisations() { - return organisations; - } - public void setOrganisations(List organisations) { - this.organisations = organisations; - } - - public Integer getRole() { - return role; - } - public void setRole(Integer role) { - this.role = role; - } - - public List getGrants() { - return grants; - } - public void setGrants(List grants) { - this.grants = grants; - } - - public List getCollaborators() { - return collaborators; - } - public void setCollaborators(List collaborators) { - this.collaborators = collaborators; - } - - public List getDatasetTemplates() { - return datasetTemplates; - } - public void setDatasetTemplates(List datasetTemplates) { - this.datasetTemplates = datasetTemplates; - } - - public List getGroupIds() { - return groupIds; - } - public void setGroupIds(List groupIds) { - this.groupIds = groupIds; - } - - public Boolean getIsPublic() { - return isPublic; - } - - public void setIsPublic(Boolean isPublic) { - this.isPublic = isPublic; - } - - public Short getGrantStatus() { - return grantStatus; - } - - public void setGrantStatus(Short grantStatus) { - this.grantStatus = grantStatus; - } - - public boolean hasDoi() { - return hasDoi; - } - - public void setHasDoi(boolean hasDoi) { - this.hasDoi = hasDoi; - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DatasetProfileCriteria.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DatasetProfileCriteria.java deleted file mode 100644 index 17f3ce63a..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DatasetProfileCriteria.java +++ /dev/null @@ -1,101 +0,0 @@ -package eu.eudat.data.dao.criteria; - - -import eu.eudat.data.DescriptionTemplateEntity; - -import java.util.Date; -import java.util.List; -import java.util.UUID; - -public class DatasetProfileCriteria extends Criteria { - - public enum DatasetProfileFilter { - DMPs((short) 0), Datasets((short) 1); - - private short value; - private DatasetProfileFilter(short value) { - this.value = value; - } - public short getValue() { return value; } - - public static DatasetProfileFilter fromInteger(short value) { - switch (value) { - case 0: - return DMPs; - case 1: - return Datasets; - default: - throw new RuntimeException("Unsupported DescriptionTemplate filter"); - } - } - } - - private boolean allVersions; - private List groupIds; - private Short filter; - private UUID userId; - private boolean finalized; - private Integer status; - private Integer role; - private List ids; - private Date periodStart; - - public boolean getAllVersions() { return allVersions; } - public void setAllVersions(boolean allVersions) { this.allVersions = allVersions; } - - public List getGroupIds() { return groupIds; } - public void setGroupIds(List groupIds) { this.groupIds = groupIds; } - - public Short getFilter() { - return filter; - } - public void setFilter(Short filter) { - this.filter = filter; - } - - public UUID getUserId() { - return userId; - } - public void setUserId(UUID userId) { - this.userId = userId; - } - - public boolean getFinalized() { - return finalized; - } - public void setFinalized(boolean finalized) { - this.finalized = finalized; - } - - public Integer getStatus() { - return status; - } - - public void setStatus(Integer status) { - this.status = status; - } - - public Integer getRole() { - return role; - } - - public void setRole(Integer role) { - this.role = role; - } - - public List getIds() { - return ids; - } - - public void setIds(List ids) { - this.ids = ids; - } - - 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/DatasetProfileWizardCriteria.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DatasetProfileWizardCriteria.java deleted file mode 100644 index 90fd4f3c5..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DatasetProfileWizardCriteria.java +++ /dev/null @@ -1,18 +0,0 @@ -package eu.eudat.data.dao.criteria; - -import eu.eudat.data.DescriptionTemplateEntity; - -import java.util.UUID; - - -public class DatasetProfileWizardCriteria extends Criteria { - private UUID id; - - public UUID getId() { - return id; - } - - public void setId(UUID id) { - this.id = id; - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DatasetWizardUserDmpCriteria.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DatasetWizardUserDmpCriteria.java deleted file mode 100644 index 71f29e8cb..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DatasetWizardUserDmpCriteria.java +++ /dev/null @@ -1,17 +0,0 @@ -package eu.eudat.data.dao.criteria; - - -import eu.eudat.data.DmpEntity; -import eu.eudat.data.UserEntity; - -public class DatasetWizardUserDmpCriteria extends Criteria { - private UserEntity userInfo; - - public UserEntity getUserInfo() { - return userInfo; - } - - public void setUserInfo(UserEntity userInfo) { - this.userInfo = userInfo; - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DynamicFieldsCriteria.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DynamicFieldsCriteria.java deleted file mode 100644 index 1367e8068..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/DynamicFieldsCriteria.java +++ /dev/null @@ -1,51 +0,0 @@ -package eu.eudat.data.dao.criteria; - -import java.util.List; - -/** - * Created by ikalyvas on 3/26/2018. - */ -public class DynamicFieldsCriteria extends Criteria { - public static class DynamicFieldDependencyCriteria { - private String property; - private String value; - - public DynamicFieldDependencyCriteria() { - } - - public String getProperty() { - return property; - } - - public void setProperty(String property) { - this.property = property; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - } - - private String id; - private List dynamicFields; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public List getDynamicFields() { - return dynamicFields; - } - - public void setDynamicFields(List dynamicFields) { - this.dynamicFields = dynamicFields; - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/ReferenceCriteria.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/ReferenceCriteria.java deleted file mode 100644 index f6bdc83a5..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/ReferenceCriteria.java +++ /dev/null @@ -1,17 +0,0 @@ -package eu.eudat.data.dao.criteria; - -import eu.eudat.data.ReferenceEntity; - -import java.util.UUID; - -public class ReferenceCriteria 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/RequestItem.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/RequestItem.java deleted file mode 100644 index 85bc7522c..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/RequestItem.java +++ /dev/null @@ -1,16 +0,0 @@ -package eu.eudat.data.dao.criteria; - -/** - * Created by ikalyvas on 3/26/2018. - */ -public class RequestItem { - T criteria; - - public T getCriteria() { - return criteria; - } - - public void setCriteria(T criteria) { - this.criteria = criteria; - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/UserInfoCriteria.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/UserInfoCriteria.java deleted file mode 100644 index 587bafa6f..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/UserInfoCriteria.java +++ /dev/null @@ -1,33 +0,0 @@ -package eu.eudat.data.dao.criteria; - -import eu.eudat.data.UserEntity; - -import java.util.List; - - -public class UserInfoCriteria extends Criteria { - private String email; - private List appRoles; - private String collaboratorLike; - - public List getAppRoles() { - return appRoles; - } - public void setAppRoles(List appRoles) { - this.appRoles = appRoles; - } - - public String getEmail() { - return email; - } - public void setEmail(String email) { - this.email = email; - } - - public String getCollaboratorLike() { - return collaboratorLike; - } - public void setCollaboratorLike(String collaboratorLike) { - this.collaboratorLike = collaboratorLike; - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/UserRoleCriteria.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/UserRoleCriteria.java deleted file mode 100644 index f23f05456..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/UserRoleCriteria.java +++ /dev/null @@ -1,20 +0,0 @@ -package eu.eudat.data.dao.criteria; - -import eu.eudat.data.UserRoleEntity; - -import java.util.List; - -/** - * Created by ikalyvas on 2/1/2018. - */ -public class UserRoleCriteria extends Criteria { - private List appRoles; - - public List getAppRoles() { - return appRoles; - } - - public void setAppRoles(List appRoles) { - this.appRoles = appRoles; - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/databaselayer/context/DatabaseContext.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/databaselayer/context/DatabaseContext.java deleted file mode 100644 index e15f51bb2..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/databaselayer/context/DatabaseContext.java +++ /dev/null @@ -1,49 +0,0 @@ -package eu.eudat.data.dao.databaselayer.context; - -import eu.eudat.queryable.QueryableList; -import eu.eudat.queryable.jpa.hibernatequeryablelist.QueryableHibernateList; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; - -import jakarta.persistence.EntityManager; -import jakarta.persistence.EntityManagerFactory; -import jakarta.persistence.PersistenceContext; - - -@Repository("databaseCtx") -public class DatabaseContext { - - @PersistenceContext - private EntityManager entityManager; - - @Autowired - public DatabaseContext(EntityManagerFactory entityManagerFactory) { - this.entityManager = entityManagerFactory.createEntityManager(); - } - - public QueryableList getQueryable(Class type) { - return new QueryableHibernateList<>(this.entityManager, type).setEntity(type); - } - - @Transactional - public T createOrUpdate(T item, Class type) { - EntityManager entityManager = this.entityManager; -// if (item.getKeys() != null) { -// T oldItem = entityManager.find(type, item.getKeys()); -// if (oldItem != null) { -// oldItem.update(item); -// entityManager.merge(oldItem); -// return oldItem; -// } else { -// entityManager.persist(item); -// } -// } else - entityManager.persist(item); - return item; - } - - public void delete(T item) { - this.entityManager.remove(item); - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/databaselayer/service/DatabaseService.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/databaselayer/service/DatabaseService.java deleted file mode 100644 index 1c394d307..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/databaselayer/service/DatabaseService.java +++ /dev/null @@ -1,40 +0,0 @@ -package eu.eudat.data.dao.databaselayer.service; - - -import eu.eudat.data.dao.databaselayer.context.DatabaseContext; -import eu.eudat.queryable.QueryableList; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.Set; - - -@Service("databaseService") -public class DatabaseService { - - private DatabaseContext databaseCtx; - - @Autowired - public DatabaseService(DatabaseContext databaseCtx) { - this.databaseCtx = databaseCtx; - } - - public QueryableList getQueryable(Class tClass) { - return this.databaseCtx.getQueryable(tClass); - } - - public QueryableList getQueryable(Set hints, Class tClass) { - return this.databaseCtx.getQueryable(tClass); - } - - @Transactional - public T createOrUpdate(T item, Class tClass) { - return this.databaseCtx.createOrUpdate(item, tClass); - } - - public void delete(T item) { - this.databaseCtx.delete(item); - } - -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/query/definition/TableQuery.java b/dmp-backend/data/src/main/java/eu/eudat/data/query/definition/TableQuery.java index 3334390b3..9eb755d8a 100644 --- a/dmp-backend/data/src/main/java/eu/eudat/data/query/definition/TableQuery.java +++ b/dmp-backend/data/src/main/java/eu/eudat/data/query/definition/TableQuery.java @@ -1,6 +1,5 @@ package eu.eudat.data.query.definition; - import eu.eudat.data.dao.criteria.Criteria; import eu.eudat.data.query.definition.helpers.ColumnOrderings; import eu.eudat.data.query.definition.helpers.SelectionFields; diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/query/items/table/dataset/DatasetTableRequest.java b/dmp-backend/data/src/main/java/eu/eudat/data/query/items/table/dataset/DatasetTableRequest.java deleted file mode 100644 index 8aed206f2..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/query/items/table/dataset/DatasetTableRequest.java +++ /dev/null @@ -1,40 +0,0 @@ -package eu.eudat.data.query.items.table.dataset; - -import eu.eudat.commons.enums.DescriptionStatus; -import eu.eudat.data.dao.criteria.DatasetCriteria; -import eu.eudat.data.DescriptionEntity; -import eu.eudat.data.query.definition.TableQuery; -import eu.eudat.queryable.QueryableList; -import eu.eudat.queryable.types.FieldSelectionType; -import eu.eudat.queryable.types.SelectionField; - -import java.util.Arrays; -import java.util.UUID; - -public class DatasetTableRequest 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().getStatus() != null) - query.where((builder, root) -> builder.equal(root.get("status"), this.getCriteria().getStatus())); - 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().getAllVersions()) - query.initSubQuery(String.class).where((builder, root) -> builder.equal(root.get("dmp").get("version"), query.subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.equal(externalRoot.get("dmp").get("groupId"), nestedRoot.get("dmp").get("groupId")), Arrays.asList(new SelectionField(FieldSelectionType.COMPOSITE_FIELD, "dmp:version")), String.class))); - if (this.getCriteria().getDmpIds() != null && !this.getCriteria().getDmpIds().isEmpty()) - query.where((builder, root) -> root.get("dmp").get("id").in(this.getCriteria().getDmpIds())); - query.where((builder, root) -> builder.equal(root.get("status"), DescriptionStatus.Finalized)); - return query; - } - - @Override - public QueryableList applyPaging(QueryableList items) { - return null; - } -} 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 deleted file mode 100644 index 9eb9e0401..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/BaseController.java +++ /dev/null @@ -1,18 +0,0 @@ -package eu.eudat.controllers; - -import eu.eudat.logic.services.ApiContext; - - -public abstract class BaseController { - - private ApiContext apiContext; - - public ApiContext getApiContext() { - return apiContext; - } - - public BaseController(ApiContext apiContext) { - - this.apiContext = apiContext; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/CurrencyController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/CurrencyController.java index e562eadfb..26c58cac1 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/CurrencyController.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/CurrencyController.java @@ -1,8 +1,8 @@ package eu.eudat.controllers; import eu.eudat.logic.managers.LocalFetchManager; -import eu.eudat.models.data.helpers.responses.ResponseItem; -import eu.eudat.models.data.local.LocalFetchModel; +import eu.eudat.models.old.helpers.responses.ResponseItem; +import eu.eudat.models.old.local.LocalFetchModel; import eu.eudat.types.ApiMessageCode; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/ManagementController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/ManagementController.java index f037aa365..786f5b955 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/ManagementController.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/ManagementController.java @@ -2,28 +2,28 @@ package eu.eudat.controllers; import eu.eudat.authorization.Permission; import eu.eudat.logic.managers.DatasetProfileManager; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.models.data.helpers.responses.ResponseItem; +import eu.eudat.models.old.helpers.responses.ResponseItem; import eu.eudat.types.ApiMessageCode; import gr.cite.commons.web.authz.service.AuthorizationService; +import jakarta.transaction.Transactional; 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 org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; @RestController @CrossOrigin @RequestMapping(value = {"/api/management/"}) -public class ManagementController extends BaseController { +public class ManagementController{ private final DatasetProfileManager datasetProfileManager; private final AuthorizationService authorizationService; @Autowired - public ManagementController(ApiContext apiContext, DatasetProfileManager datasetProfileManager, AuthorizationService authorizationService){ - super(apiContext); + public ManagementController(DatasetProfileManager datasetProfileManager, AuthorizationService authorizationService){ this.datasetProfileManager = datasetProfileManager; this.authorizationService = authorizationService; } diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/Validation.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/Validation.java index 023def822..cc22a105f 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/Validation.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/Validation.java @@ -3,8 +3,7 @@ package eu.eudat.controllers; import eu.eudat.authorization.Permission; import eu.eudat.logic.managers.ValidationManager; import eu.eudat.commons.exceptions.HugeResultSetException; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.models.data.helpers.responses.ResponseItem; +import eu.eudat.models.old.helpers.responses.ResponseItem; import eu.eudat.types.ApiMessageCode; import gr.cite.commons.web.authz.service.AuthorizationService; import gr.cite.tools.exception.MyNotFoundException; @@ -16,14 +15,13 @@ import org.springframework.web.bind.annotation.*; @RestController @CrossOrigin @RequestMapping(value = {"/api"}) -public class Validation extends BaseController { +public class Validation { private ValidationManager validationManager; private final AuthorizationService authorizationService; @Autowired - public Validation(ApiContext apiContext, ValidationManager validationManager, AuthorizationService authorizationService) { - super(apiContext); + public Validation(ValidationManager validationManager, AuthorizationService authorizationService) { this.validationManager = validationManager; this.authorizationService = authorizationService; } diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/PublicDatasetsDescriptionDocumentation.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/PublicDatasetsDescriptionDocumentation.java index 8b111707b..9c246d1f9 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/PublicDatasetsDescriptionDocumentation.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/PublicDatasetsDescriptionDocumentation.java @@ -2,11 +2,9 @@ package eu.eudat.controllers.publicapi; import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.commons.enums.IsActive; -import eu.eudat.controllers.BaseController; import eu.eudat.controllers.publicapi.request.dataset.DatasetPublicTableRequest; import eu.eudat.controllers.publicapi.response.DataTableData; import eu.eudat.data.DescriptionEntity; -import eu.eudat.logic.services.ApiContext; import eu.eudat.model.*; import eu.eudat.model.builder.DescriptionBuilder; import eu.eudat.model.builder.DmpBuilder; @@ -17,7 +15,7 @@ import eu.eudat.model.mapper.publicapi.DescriptionToPublicApiDatasetMapper; import eu.eudat.model.mapper.publicapi.DmpToPublicApiDmpListingMapper; import eu.eudat.model.publicapi.listingmodels.DatasetPublicListingModel; import eu.eudat.model.publicapi.overviewmodels.DatasetPublicModel; -import eu.eudat.models.data.helpers.responses.ResponseItem; +import eu.eudat.models.old.helpers.responses.ResponseItem; import eu.eudat.query.DescriptionQuery; import eu.eudat.query.DmpQuery; import eu.eudat.query.lookup.DescriptionLookup; @@ -55,7 +53,7 @@ import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; @RestController @CrossOrigin @RequestMapping(value = {"/api/public/datasets/"}) -public class PublicDatasetsDescriptionDocumentation extends BaseController { +public class PublicDatasetsDescriptionDocumentation { private static final Logger logger = LoggerFactory.getLogger(PublicDatasetsDescriptionDocumentation.class); @@ -73,13 +71,11 @@ public class PublicDatasetsDescriptionDocumentation extends BaseController { @Autowired public PublicDatasetsDescriptionDocumentation( - ApiContext apiContext, QueryFactory queryFactory, BuilderFactory builderFactory, MessageSource messageSource, DescriptionToPublicApiDatasetMapper descriptionToPublicApiDatasetMapper, DescriptionToPublicApiDatasetListingMapper descriptionToPublicApiDatasetListingMapper, DmpToPublicApiDmpListingMapper dmpToPublicApiDmpListingMapper) { - super(apiContext); this.queryFactory = queryFactory; this.builderFactory = builderFactory; this.messageSource = messageSource; diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/PublicDmpsDocumentation.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/PublicDmpsDocumentation.java index e739797ff..872e8bebb 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/PublicDmpsDocumentation.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/PublicDmpsDocumentation.java @@ -2,11 +2,9 @@ package eu.eudat.controllers.publicapi; import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.commons.enums.IsActive; -import eu.eudat.controllers.BaseController; import eu.eudat.controllers.publicapi.request.dmp.DataManagmentPlanPublicTableRequest; import eu.eudat.controllers.publicapi.response.DataTableData; import eu.eudat.data.DmpEntity; -import eu.eudat.logic.services.ApiContext; import eu.eudat.model.*; import eu.eudat.model.builder.DmpBuilder; import eu.eudat.model.builder.DmpDescriptionTemplateBuilder; @@ -17,7 +15,7 @@ import eu.eudat.model.publicapi.listingmodels.DataManagementPlanPublicListingMod import eu.eudat.model.publicapi.overviewmodels.DataManagementPlanPublicModel; import eu.eudat.model.referencedefinition.Definition; import eu.eudat.model.referencedefinition.Field; -import eu.eudat.models.data.helpers.responses.ResponseItem; +import eu.eudat.models.old.helpers.responses.ResponseItem; import eu.eudat.query.DmpDescriptionTemplateQuery; import eu.eudat.query.DmpQuery; import eu.eudat.query.EntityDoiQuery; @@ -55,7 +53,7 @@ import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; @RestController @CrossOrigin @RequestMapping(value = {"/api/public/dmps"}) -public class PublicDmpsDocumentation extends BaseController { +public class PublicDmpsDocumentation { private static final Logger logger = LoggerFactory.getLogger(PublicDmpsDocumentation.class); @@ -71,13 +69,11 @@ public class PublicDmpsDocumentation extends BaseController { @Autowired public PublicDmpsDocumentation( - ApiContext apiContext, QueryFactory queryFactory, BuilderFactory builderFactory, MessageSource messageSource, DmpToPublicApiDmpMapper dmpToPublicApiDmpMapper, DmpToPublicApiDmpListingMapper dmpToPublicApiDmpListingMapper) { - super(apiContext); this.queryFactory = queryFactory; this.builderFactory = builderFactory; this.messageSource = messageSource; diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/DepositController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/DepositController.java index e14926c55..1bc418467 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/DepositController.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/DepositController.java @@ -2,8 +2,6 @@ package eu.eudat.controllers.v2; import eu.eudat.audit.AuditableAction; import gr.cite.tools.validation.ValidationFilterAnnotation; -import eu.eudat.controllers.BaseController; -import eu.eudat.logic.services.ApiContext; import eu.eudat.model.EntityDoi; import eu.eudat.model.censorship.EntityDoiCensor; import eu.eudat.model.censorship.deposit.DepositConfigurationCensor; @@ -11,7 +9,6 @@ import eu.eudat.model.deposit.DepositConfiguration; import eu.eudat.model.persist.deposit.DepositAuthenticateRequest; import eu.eudat.model.persist.deposit.DepositRequest; import eu.eudat.service.deposit.DepositService; -import gr.cite.commons.web.authz.service.AuthorizationService; import gr.cite.tools.auditing.AuditService; import gr.cite.tools.data.censor.CensorFactory; import gr.cite.tools.fieldset.FieldSet; @@ -29,7 +26,7 @@ import java.util.Map; @RestController @CrossOrigin @RequestMapping(value = {"/api/deposit/"}) -public class DepositController extends BaseController { +public class DepositController { private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DepositController.class)); @@ -41,8 +38,7 @@ public class DepositController extends BaseController { private final AuditService auditService; @Autowired - public DepositController(ApiContext apiContext, AuthorizationService authorizationService, DepositService depositService, CensorFactory censorFactory, AuditService auditService) { - super(apiContext); + public DepositController(DepositService depositService, CensorFactory censorFactory, AuditService auditService) { this.depositService = depositService; this.censorFactory = censorFactory; this.auditService = auditService; diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/DescriptionTemplateTypeController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/DescriptionTemplateTypeController.java index 9477aa2fc..579cb4a83 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/DescriptionTemplateTypeController.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/DescriptionTemplateTypeController.java @@ -3,7 +3,6 @@ package eu.eudat.controllers.v2; import eu.eudat.audit.AuditableAction; import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.data.DescriptionTemplateTypeEntity; -import eu.eudat.logic.services.ApiContext; import eu.eudat.model.DescriptionTemplateType; import eu.eudat.model.builder.DescriptionTemplateTypeBuilder; import eu.eudat.model.censorship.DescriptionTemplateTypeCensor; @@ -38,9 +37,6 @@ import java.util.*; public class DescriptionTemplateTypeController { private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DescriptionTemplateTypeController.class)); - @Autowired - private ApiContext apiContext; - private final BuilderFactory builderFactory; private final AuditService auditService; diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/DmpController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/DmpController.java index 9a6d476b5..46260cf13 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/DmpController.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/DmpController.java @@ -1,24 +1,19 @@ package eu.eudat.controllers.v2; -import com.fasterxml.jackson.core.JsonProcessingException; import eu.eudat.audit.AuditableAction; import eu.eudat.authorization.AuthorizationFlags; import gr.cite.tools.validation.ValidationFilterAnnotation; -import eu.eudat.data.DmpEntity; import eu.eudat.model.*; import eu.eudat.model.builder.DmpBuilder; import eu.eudat.model.censorship.DmpCensor; -import eu.eudat.model.censorship.PublicDescriptionCensor; import eu.eudat.model.censorship.PublicDmpCensor; import eu.eudat.model.persist.*; import eu.eudat.model.result.QueryResult; -import eu.eudat.models.data.helpers.responses.ResponseItem; +import eu.eudat.models.old.helpers.responses.ResponseItem; import eu.eudat.query.DmpQuery; -import eu.eudat.query.lookup.DescriptionLookup; import eu.eudat.query.lookup.DmpLookup; import eu.eudat.service.dmp.DmpService; import eu.eudat.service.elastic.ElasticQueryHelperService; -import eu.eudat.service.transformer.FileTransformerService; import eu.eudat.types.ApiMessageCode; import gr.cite.tools.auditing.AuditService; import gr.cite.tools.data.builder.BuilderFactory; diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/ExternalValidationController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/ExternalValidationController.java index 1f8baf9a0..919dfaa0b 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/ExternalValidationController.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/ExternalValidationController.java @@ -1,11 +1,9 @@ package eu.eudat.controllers.v2; import eu.eudat.authorization.Permission; -import eu.eudat.controllers.BaseController; import eu.eudat.commons.exceptions.HugeResultSetException; -import eu.eudat.logic.services.ApiContext; import eu.eudat.logic.services.ExternalValidationService; -import eu.eudat.models.data.helpers.responses.ResponseItem; +import eu.eudat.models.old.helpers.responses.ResponseItem; import eu.eudat.types.ApiMessageCode; import gr.cite.commons.web.authz.service.AuthorizationService; import gr.cite.tools.exception.MyNotFoundException; @@ -16,14 +14,13 @@ import org.springframework.web.bind.annotation.*; @RestController @RequestMapping(path = {"api/validation"}) -public class ExternalValidationController extends BaseController { +public class ExternalValidationController { private ExternalValidationService externalValidationService; private final AuthorizationService authorizationService; @Autowired - public ExternalValidationController(ApiContext apiContext, ExternalValidationService externalValidationService, AuthorizationService authorizationService) { - super(apiContext); + public ExternalValidationController(ExternalValidationService externalValidationService, AuthorizationService authorizationService) { this.externalValidationService = externalValidationService; this.authorizationService = authorizationService; } diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/FileTransformerController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/FileTransformerController.java index a4434f382..613a8c216 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/FileTransformerController.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/FileTransformerController.java @@ -1,9 +1,7 @@ package eu.eudat.controllers.v2; import eu.eudat.audit.AuditableAction; -import eu.eudat.controllers.BaseController; import eu.eudat.file.transformer.models.misc.FileFormat; -import eu.eudat.logic.services.ApiContext; import eu.eudat.model.file.ExportRequestModel; import eu.eudat.model.file.FileEnvelope; import eu.eudat.service.transformer.FileTransformerService; @@ -24,26 +22,20 @@ import javax.management.InvalidApplicationException; import java.io.IOException; import java.nio.file.Files; import java.util.List; -import java.util.UUID; @RestController @CrossOrigin @RequestMapping(value = {"/api/file-transformer/"}) -public class FileTransformerController extends BaseController { +public class FileTransformerController { private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(FileTransformerController.class)); - private final AuthorizationService authorizationService; private final FileTransformerService fileTransformerService; - private final CensorFactory censorFactory; private final AuditService auditService; @Autowired - public FileTransformerController(ApiContext apiContext, AuthorizationService authorizationService, FileTransformerService fileTransformerService, CensorFactory censorFactory, AuditService auditService){ - super(apiContext); - this.authorizationService = authorizationService; + public FileTransformerController(FileTransformerService fileTransformerService, AuditService auditService){ this.fileTransformerService = fileTransformerService; - this.censorFactory = censorFactory; this.auditService = auditService; } diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/MaintenanceController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/MaintenanceController.java index 644fa84b5..d7725e85c 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/MaintenanceController.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/MaintenanceController.java @@ -2,21 +2,14 @@ package eu.eudat.controllers.v2; import eu.eudat.audit.AuditableAction; import eu.eudat.authorization.Permission; -import eu.eudat.data.DescriptionEntity; -import eu.eudat.model.Lock; -import eu.eudat.models.data.helpers.responses.ResponseItem; import eu.eudat.service.elastic.ElasticService; -import eu.eudat.types.ApiMessageCode; import gr.cite.commons.web.authz.service.AuthorizationService; import gr.cite.tools.auditing.AuditService; import gr.cite.tools.logging.LoggerService; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; @RestController diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/PrincipalController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/PrincipalController.java index 7fbf9588f..5d3078f1e 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/PrincipalController.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/PrincipalController.java @@ -1,8 +1,8 @@ package eu.eudat.controllers.v2; import eu.eudat.audit.AuditableAction; -import eu.eudat.models.v2.Account; -import eu.eudat.models.v2.AccountBuilder; +import eu.eudat.models.Account; +import eu.eudat.models.AccountBuilder; import gr.cite.commons.web.oidc.principal.CurrentPrincipalResolver; import gr.cite.commons.web.oidc.principal.MyPrincipal; import gr.cite.tools.auditing.AuditService; diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/ReferenceController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/ReferenceController.java index 93646f972..23e1bc185 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/ReferenceController.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/ReferenceController.java @@ -3,25 +3,18 @@ package eu.eudat.controllers.v2; import com.fasterxml.jackson.core.JsonProcessingException; import eu.eudat.audit.AuditableAction; import eu.eudat.authorization.AuthorizationFlags; -import eu.eudat.authorization.Permission; -import gr.cite.tools.validation.ValidationFilterAnnotation; -import eu.eudat.controllers.BaseController; -import eu.eudat.data.ReferenceEntity; import eu.eudat.commons.exceptions.HugeResultSetException; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.service.reference.ReferenceService; +import eu.eudat.data.ReferenceEntity; import eu.eudat.model.Reference; import eu.eudat.model.builder.ReferenceBuilder; import eu.eudat.model.censorship.ReferenceCensor; import eu.eudat.model.persist.ReferencePersist; import eu.eudat.model.result.QueryResult; -import eu.eudat.models.data.helpers.responses.ResponseItem; import eu.eudat.query.ReferenceQuery; import eu.eudat.query.lookup.ReferenceDefinitionSearchLookup; import eu.eudat.query.lookup.ReferenceLookup; import eu.eudat.query.lookup.ReferenceSearchLookup; -import eu.eudat.types.ApiMessageCode; -import gr.cite.commons.web.authz.service.AuthorizationService; +import eu.eudat.service.reference.ReferenceService; import gr.cite.tools.auditing.AuditService; import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.censor.CensorFactory; @@ -32,14 +25,13 @@ import gr.cite.tools.exception.MyNotFoundException; import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.logging.LoggerService; import gr.cite.tools.logging.MapLogEntry; +import gr.cite.tools.validation.ValidationFilterAnnotation; import jakarta.transaction.Transactional; import jakarta.xml.bind.JAXBException; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.MessageSource; import org.springframework.context.i18n.LocaleContextHolder; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import javax.management.InvalidApplicationException; @@ -52,7 +44,7 @@ import java.util.UUID; @RestController @RequestMapping(path = {"api/reference"}) -public class ReferenceController extends BaseController { +public class ReferenceController { private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(ReferenceController.class)); @@ -71,14 +63,12 @@ public class ReferenceController extends BaseController { @Autowired public ReferenceController( - ApiContext apiContext, BuilderFactory builderFactory, ReferenceService referenceService, AuditService auditService, CensorFactory censorFactory, QueryFactory queryFactory, MessageSource messageSource) { - super(apiContext); this.builderFactory = builderFactory; this.referenceService = referenceService; this.auditService = auditService; diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/ReferenceTypeController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/ReferenceTypeController.java index 7103e7c7b..870c3e526 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/ReferenceTypeController.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/ReferenceTypeController.java @@ -4,9 +4,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import eu.eudat.audit.AuditableAction; import eu.eudat.authorization.AuthorizationFlags; import gr.cite.tools.validation.ValidationFilterAnnotation; -import eu.eudat.controllers.BaseController; import eu.eudat.data.ReferenceTypeEntity; -import eu.eudat.logic.services.ApiContext; import eu.eudat.model.Reference; import eu.eudat.model.ReferenceType; import eu.eudat.model.builder.ReferenceTypeBuilder; @@ -43,7 +41,7 @@ import java.util.UUID; @RestController @RequestMapping(path = {"api/reference-type"}) -public class ReferenceTypeController extends BaseController { +public class ReferenceTypeController{ private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(ReferenceTypeController.class)); @@ -63,13 +61,11 @@ public class ReferenceTypeController extends BaseController { @Autowired public ReferenceTypeController( - ApiContext apiContext, BuilderFactory builderFactory, AuditService auditService, CensorFactory censorFactory, QueryFactory queryFactory, MessageSource messageSource, AuthorizationService authorizationService, ReferenceTypeService referenceTypeService) { - super(apiContext); this.builderFactory = builderFactory; this.auditService = auditService; this.censorFactory = censorFactory; diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/TagController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/TagController.java index 543b0e66c..de6117d74 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/TagController.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/TagController.java @@ -4,7 +4,6 @@ import eu.eudat.audit.AuditableAction; import eu.eudat.authorization.AuthorizationFlags; import gr.cite.tools.validation.ValidationFilterAnnotation; import eu.eudat.data.TagEntity; -import eu.eudat.logic.services.ApiContext; import eu.eudat.model.Tag; import eu.eudat.model.builder.TagBuilder; import eu.eudat.model.censorship.TagCensor; @@ -39,9 +38,6 @@ public class TagController { private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(TagController.class)); - @Autowired - private ApiContext apiContext; - private final BuilderFactory builderFactory; private final AuditService auditService; diff --git a/dmp-backend/web/src/main/java/eu/eudat/criteria/DatasetCriteria.java b/dmp-backend/web/src/main/java/eu/eudat/criteria/DatasetCriteria.java deleted file mode 100644 index 73bff6cc8..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/criteria/DatasetCriteria.java +++ /dev/null @@ -1,59 +0,0 @@ -package eu.eudat.criteria; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.ObjectReader; -import com.fasterxml.jackson.databind.node.JsonNodeType; -import eu.eudat.criteria.entities.Criteria; - -import java.io.IOException; -import java.util.*; - -public class DatasetCriteria { - private Criteria id; - private Criteria label; - - public Criteria getId() { - return id; - } - - public void setId(JsonNode jsonNode) throws IOException { - if (jsonNode.getNodeType().equals(JsonNodeType.STRING)) { - Criteria criteria = new Criteria<>(); - criteria.setAs(jsonNode.asText()); - this.id = criteria; - } else if (jsonNode.getNodeType().equals(JsonNodeType.OBJECT)) { - ObjectReader reader = new ObjectMapper().readerFor(new TypeReference>() { - }); - this.id = reader.readValue(jsonNode); - } - } - - public Criteria getLabel() { - return label; - } - - public void setLabel(JsonNode jsonNode) throws IOException { - if (jsonNode.getNodeType().equals(JsonNodeType.STRING)) { - Criteria criteria = new Criteria<>(); - criteria.setAs(jsonNode.asText()); - this.label = criteria; - } else if (jsonNode.getNodeType().equals(JsonNodeType.OBJECT)) { - ObjectReader reader = new ObjectMapper().readerFor(new TypeReference>() { - }); - this.label = reader.readValue(jsonNode); - } - } - - - protected List buildFields(String path) { - Set fields = new HashSet<>(); - 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"); - return new LinkedList<>(fields); - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/criteria/RecentActivityCriteria.java b/dmp-backend/web/src/main/java/eu/eudat/criteria/RecentActivityCriteria.java deleted file mode 100644 index a7891b49f..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/criteria/RecentActivityCriteria.java +++ /dev/null @@ -1,31 +0,0 @@ -package eu.eudat.criteria; - -public class RecentActivityCriteria { - private String like; - private String order; - private Integer status; - - public String getLike() { - return like; - } - - public void setLike(String like) { - this.like = like; - } - - public String getOrder() { - return order; - } - - public void setOrder(String order) { - this.order = order; - } - - public Integer getStatus() { - return status; - } - - public void setStatus(Integer status) { - this.status = status; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/criteria/entities/Criteria.java b/dmp-backend/web/src/main/java/eu/eudat/criteria/entities/Criteria.java deleted file mode 100644 index d855e4c61..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/criteria/entities/Criteria.java +++ /dev/null @@ -1,36 +0,0 @@ -package eu.eudat.criteria.entities; - -enum BaseCriteriaType implements CriteriaType { - EQUALS, - NOT_EQUALS -} - -public class Criteria { - private String as; - private BaseCriteriaType type; - private T value; - - public String getAs() { - return as; - } - - public void setAs(String as) { - this.as = as; - } - - public CriteriaType getType() { - return type; - } - - public void setType(BaseCriteriaType type) { - this.type = type; - } - - public T getValue() { - return value; - } - - public void setValue(T value) { - this.value = value; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/criteria/entities/CriteriaType.java b/dmp-backend/web/src/main/java/eu/eudat/criteria/entities/CriteriaType.java deleted file mode 100644 index 734cb4a94..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/criteria/entities/CriteriaType.java +++ /dev/null @@ -1,4 +0,0 @@ -package eu.eudat.criteria.entities; - -public interface CriteriaType { -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/criteria/entities/DateCriteria.java b/dmp-backend/web/src/main/java/eu/eudat/criteria/entities/DateCriteria.java deleted file mode 100644 index 52a78f780..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/criteria/entities/DateCriteria.java +++ /dev/null @@ -1,32 +0,0 @@ -package eu.eudat.criteria.entities; - -import java.util.Date; - -enum DateCriteriaType implements CriteriaType { - EQUALS, - NOT_EQUALS, - BEFORE, - BETWEEN, - AFTER -} - -public class DateCriteria extends Criteria { - private Date values; - private CriteriaType type; - - public Date getValues() { - return values; - } - - public void setValues(Date values) { - this.values = values; - } - - public CriteriaType getType() { - return type; - } - - public void setType(DateCriteriaType type) { - this.type = type; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/criteria/serialzier/CriteriaSerializer.java b/dmp-backend/web/src/main/java/eu/eudat/criteria/serialzier/CriteriaSerializer.java deleted file mode 100644 index b6614d81c..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/criteria/serialzier/CriteriaSerializer.java +++ /dev/null @@ -1,41 +0,0 @@ -package eu.eudat.criteria.serialzier; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.ObjectCodec; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.*; -import com.fasterxml.jackson.databind.deser.ContextualDeserializer; -import com.fasterxml.jackson.databind.node.JsonNodeType; -import eu.eudat.criteria.entities.Criteria; - -import java.io.IOException; - -public class CriteriaSerializer extends JsonDeserializer> implements ContextualDeserializer { - - private JavaType valueType; - - @Override - public JsonDeserializer createContextual(DeserializationContext ctxt, BeanProperty property) { - JavaType wrapperType = property.getType(); - JavaType valueType = wrapperType.containedType(0); - CriteriaSerializer deserializer = new CriteriaSerializer(); - deserializer.valueType = valueType; - return deserializer; - } - - @Override - public Criteria deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { - ObjectCodec oc = jp.getCodec(); - JsonNode jsonNode = oc.readTree(jp); - if (jsonNode.getNodeType().equals(JsonNodeType.STRING)) { - Criteria criteria = new Criteria<>(); - criteria.setAs(jsonNode.asText()); - return criteria; - } else if (jsonNode.getNodeType().equals(JsonNodeType.OBJECT)) { - ObjectReader reader = new ObjectMapper().readerFor(new TypeReference>() { - }); - return reader.readValue(jsonNode); - } - return null; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/exceptions/datamanagementplan/DMPNewVersionException.java b/dmp-backend/web/src/main/java/eu/eudat/exceptions/datamanagementplan/DMPNewVersionException.java deleted file mode 100644 index 8c789c41d..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/exceptions/datamanagementplan/DMPNewVersionException.java +++ /dev/null @@ -1,8 +0,0 @@ -package eu.eudat.exceptions.datamanagementplan; - -public class DMPNewVersionException extends RuntimeException { - - public DMPNewVersionException(String message) { - super(message); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/exceptions/datamanagementplan/DMPWithDatasetsDeleteException.java b/dmp-backend/web/src/main/java/eu/eudat/exceptions/datamanagementplan/DMPWithDatasetsDeleteException.java deleted file mode 100644 index 4bf9c7dde..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/exceptions/datamanagementplan/DMPWithDatasetsDeleteException.java +++ /dev/null @@ -1,22 +0,0 @@ -package eu.eudat.exceptions.datamanagementplan; - -/** - * Created by ikalyvas on 2/5/2018. - */ -public class DMPWithDatasetsDeleteException extends RuntimeException { - public DMPWithDatasetsDeleteException() { - super(); - } - - public DMPWithDatasetsDeleteException(String message, Throwable cause) { - super(message, cause); - } - - public DMPWithDatasetsDeleteException(String message) { - super(message); - } - - public DMPWithDatasetsDeleteException(Throwable cause) { - super(cause); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/exceptions/datasetwizard/DatasetWizardCannotUnlockException.java b/dmp-backend/web/src/main/java/eu/eudat/exceptions/datasetwizard/DatasetWizardCannotUnlockException.java deleted file mode 100644 index 83434eb27..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/exceptions/datasetwizard/DatasetWizardCannotUnlockException.java +++ /dev/null @@ -1,22 +0,0 @@ -package eu.eudat.exceptions.datasetwizard; - -/** - * Created by ikalyvas on 10/12/2018. - */ -public class DatasetWizardCannotUnlockException extends RuntimeException { - public DatasetWizardCannotUnlockException() { - super(); - } - - public DatasetWizardCannotUnlockException(String message, Throwable cause) { - super(message, cause); - } - - public DatasetWizardCannotUnlockException(String message) { - super(message); - } - - public DatasetWizardCannotUnlockException(Throwable cause) { - super(cause); - } -} \ No newline at end of file diff --git a/dmp-backend/web/src/main/java/eu/eudat/exceptions/emailconfirmation/HasConfirmedEmailException.java b/dmp-backend/web/src/main/java/eu/eudat/exceptions/emailconfirmation/HasConfirmedEmailException.java deleted file mode 100644 index 048460073..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/exceptions/emailconfirmation/HasConfirmedEmailException.java +++ /dev/null @@ -1,8 +0,0 @@ -package eu.eudat.exceptions.emailconfirmation; - -public class HasConfirmedEmailException extends Exception { - - public HasConfirmedEmailException(String msg) { - super(msg); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/exceptions/emailconfirmation/TokenExpiredException.java b/dmp-backend/web/src/main/java/eu/eudat/exceptions/emailconfirmation/TokenExpiredException.java deleted file mode 100644 index 8a31b183c..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/exceptions/emailconfirmation/TokenExpiredException.java +++ /dev/null @@ -1,8 +0,0 @@ -package eu.eudat.exceptions.emailconfirmation; - -public class TokenExpiredException extends Exception { - - public TokenExpiredException(String msg) { - super(msg); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/exceptions/security/ForbiddenException.java b/dmp-backend/web/src/main/java/eu/eudat/exceptions/security/ForbiddenException.java deleted file mode 100644 index dfd623dae..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/exceptions/security/ForbiddenException.java +++ /dev/null @@ -1,19 +0,0 @@ -package eu.eudat.exceptions.security; - -import org.springframework.http.HttpStatus; -import org.springframework.web.bind.annotation.ResponseStatus; - -@ResponseStatus(value = HttpStatus.FORBIDDEN) -public class ForbiddenException extends RuntimeException { - public ForbiddenException() { - super(); - } - - public ForbiddenException(String message) { - super(message); - } - - public ForbiddenException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/exceptions/security/UnauthorisedException.java b/dmp-backend/web/src/main/java/eu/eudat/exceptions/security/UnauthorisedException.java deleted file mode 100644 index 6995f0be3..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/exceptions/security/UnauthorisedException.java +++ /dev/null @@ -1,24 +0,0 @@ -package eu.eudat.exceptions.security; - -import org.springframework.http.HttpStatus; -import org.springframework.web.bind.annotation.ResponseStatus; - - -@ResponseStatus(value = HttpStatus.UNAUTHORIZED) -public class UnauthorisedException extends RuntimeException { - public UnauthorisedException() { - super(); - } - - public UnauthorisedException(String message, Throwable cause) { - super(message, cause); - } - - public UnauthorisedException(String message) { - super(message); - } - - public UnauthorisedException(Throwable cause) { - super(cause); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/Builder.java b/dmp-backend/web/src/main/java/eu/eudat/logic/builders/Builder.java deleted file mode 100644 index daf57400b..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/Builder.java +++ /dev/null @@ -1,8 +0,0 @@ -package eu.eudat.logic.builders; - -/** - * Created by ikalyvas on 2/15/2018. - */ -public abstract class Builder { - public abstract T build(); -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/BuilderFactory.java b/dmp-backend/web/src/main/java/eu/eudat/logic/builders/BuilderFactory.java deleted file mode 100644 index 06f94723a..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/BuilderFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package eu.eudat.logic.builders; - -/** - * Created by ikalyvas on 2/15/2018. - */ -public interface BuilderFactory { - T getBuilder(Class tClass); -} 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 deleted file mode 100644 index 7158e7ef2..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/BuilderFactoryImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package eu.eudat.logic.builders; - -import eu.eudat.logic.builders.entity.*; -import eu.eudat.logic.builders.model.models.*; -import org.springframework.stereotype.Service; - - -@Service -public class BuilderFactoryImpl implements BuilderFactory { - - public T getBuilder(Class tClass) { - if (tClass.equals(DatasetProfileBuilder.class)) return (T) new DatasetProfileBuilder(); - if (tClass.equals(DataTableDataBuilder.class)) return (T) new DataTableDataBuilder<>(); - if (tClass.equals(UserInfoBuilder.class)) return (T) new UserInfoBuilder(); - if (tClass.equals(UserRoleBuilder.class)) return (T) new UserRoleBuilder(); - if (tClass.equals(RecentActivityDataBuilder.class)) return (T) new RecentActivityDataBuilder(); - - return null; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/entity/DatasetProfileBuilder.java b/dmp-backend/web/src/main/java/eu/eudat/logic/builders/entity/DatasetProfileBuilder.java deleted file mode 100644 index 1c148c99f..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/entity/DatasetProfileBuilder.java +++ /dev/null @@ -1,100 +0,0 @@ -package eu.eudat.logic.builders.entity; - -import eu.eudat.commons.enums.DescriptionTemplateStatus; -import eu.eudat.data.DescriptionTemplateEntity; -import eu.eudat.logic.builders.Builder; - -import java.time.Instant; -import java.util.UUID; - -/** - * Created by ikalyvas on 2/15/2018. - */ -public class DatasetProfileBuilder extends Builder { - - private UUID id; - - private String label; - - private UUID type; - -// private Set dataset; - - private String definition; - - private DescriptionTemplateStatus status; - - private Instant created; - - private Instant modified = Instant.now(); - - private String description; - - private String language; - - public DatasetProfileBuilder id(UUID id) { - this.id = id; - return this; - } - - public DatasetProfileBuilder label(String label) { - this.label = label; - return this; - } - - public DatasetProfileBuilder type(UUID type) { - this.type = type; - return this; - } - -// public DatasetProfileBuilder dataset(Set dataset) { -// this.dataset = dataset; -// return this; -// } - - public DatasetProfileBuilder definition(String definition) { - this.definition = definition; - return this; - } - - public DatasetProfileBuilder status(DescriptionTemplateStatus status) { - this.status = status; - return this; - } - - public DatasetProfileBuilder created(Instant created) { - this.created = created; - return this; - } - - public DatasetProfileBuilder modified(Instant modified) { - this.modified = modified; - return this; - } - - public DatasetProfileBuilder description(String description) { - this.description = description; - return this; - } - - public DatasetProfileBuilder language(String language) { - this.language = language; - return this; - } - - @Override - public DescriptionTemplateEntity build() { - DescriptionTemplateEntity descriptionTemplateEntity = new DescriptionTemplateEntity(); - descriptionTemplateEntity.setCreatedAt(created); - descriptionTemplateEntity.setStatus(status); - descriptionTemplateEntity.setId(id); -// descriptionTemplate.setDataset(dataset); - descriptionTemplateEntity.setDefinition(definition); - descriptionTemplateEntity.setDescription(description); - descriptionTemplateEntity.setUpdatedAt(modified); - descriptionTemplateEntity.setLabel(label); - descriptionTemplateEntity.setLanguage(language); - descriptionTemplateEntity.setTypeId(type); - return descriptionTemplateEntity; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/entity/UserInfoBuilder.java b/dmp-backend/web/src/main/java/eu/eudat/logic/builders/entity/UserInfoBuilder.java deleted file mode 100644 index 3396e2091..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/entity/UserInfoBuilder.java +++ /dev/null @@ -1,90 +0,0 @@ -package eu.eudat.logic.builders.entity; - -import eu.eudat.commons.enums.IsActive; -import eu.eudat.data.UserCredentialEntity; -import eu.eudat.data.DmpEntity; -import eu.eudat.logic.builders.Builder; -import eu.eudat.data.UserEntity; -import eu.eudat.data.UserRoleEntity; - -import java.time.Instant; -import java.util.HashSet; -import java.util.Set; -import java.util.UUID; - -/** - * Created by ikalyvas on 2/15/2018. - */ -public class UserInfoBuilder extends Builder { - - private UUID id; - - private String name = null; - - private Instant created = null; - - private String additionalinfo; - - private Set dmps; - - private Set credentials = new HashSet<>(); - - private Set userRoles = new HashSet<>(); - - private IsActive userStatus; - - public UserInfoBuilder id(UUID id) { - this.id = id; - return this; - } - - - public UserInfoBuilder name(String name) { - this.name = name; - return this; - } - - public UserInfoBuilder created(Instant created) { - this.created = created; - return this; - } - - public UserInfoBuilder additionalinfo(String additionalinfo) { - this.additionalinfo = additionalinfo; - return this; - } - - public UserInfoBuilder dmps(Set dmps) { - this.dmps = dmps; - return this; - } - - public UserInfoBuilder credentials(Set credentials) { - this.credentials = credentials; - return this; - } - - public UserInfoBuilder userRoles(Set userRoles) { - this.userRoles = userRoles; - return this; - } - - public UserInfoBuilder userStatus(IsActive userStatus) { - this.userStatus = userStatus; - return this; - } - - @Override - public UserEntity build() { - UserEntity userInfo = new UserEntity(); - userInfo.setId(id); - userInfo.setCreatedAt(created); - userInfo.setName(name); - userInfo.setAdditionalInfo(additionalinfo); -// userInfo.setUserRoles(userRoles); -// userInfo.setCredentials(credentials); -// userInfo.setDmps(dmps); //TODO - userInfo.setIsActive(userStatus); - return userInfo; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/entity/UserRoleBuilder.java b/dmp-backend/web/src/main/java/eu/eudat/logic/builders/entity/UserRoleBuilder.java deleted file mode 100644 index 4e7112fae..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/entity/UserRoleBuilder.java +++ /dev/null @@ -1,43 +0,0 @@ -package eu.eudat.logic.builders.entity; - -import eu.eudat.logic.builders.Builder; -import eu.eudat.data.UserEntity; -import eu.eudat.data.UserRoleEntity; - -import java.util.UUID; - -/** - * Created by ikalyvas on 2/15/2018. - */ -public class UserRoleBuilder extends Builder { - - private UUID id; - - private String role; - - private UUID userId; - - public UserRoleBuilder id(UUID id) { - this.id = id; - return this; - } - - public UserRoleBuilder role(String role) { - this.role = role; - return this; - } - - public UserRoleBuilder userInfo(UserEntity userInfo) { - this.userId = userInfo.getId(); - return this; - } - - @Override - public UserRoleEntity build() { - UserRoleEntity userRole = new UserRoleEntity(); - userRole.setUserId(userId); - userRole.setRole(role); - userRole.setId(id); - return userRole; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/helpers/BuilderApplier.java b/dmp-backend/web/src/main/java/eu/eudat/logic/builders/helpers/BuilderApplier.java deleted file mode 100644 index ccd11b77d..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/helpers/BuilderApplier.java +++ /dev/null @@ -1,8 +0,0 @@ -package eu.eudat.logic.builders.helpers; - -/** - * Created by ikalyvas on 3/15/2018. - */ -public interface BuilderApplier { - void apply(T builder); -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/models/DataTableDataBuilder.java b/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/models/DataTableDataBuilder.java deleted file mode 100644 index edccfb614..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/models/DataTableDataBuilder.java +++ /dev/null @@ -1,33 +0,0 @@ -package eu.eudat.logic.builders.model.models; - -import eu.eudat.logic.builders.Builder; -import eu.eudat.models.data.helpers.common.DataTableData; - -import java.util.List; - -/** - * Created by ikalyvas on 2/15/2018. - */ -public class DataTableDataBuilder extends Builder> { - - private Long totalCount; - private List data; - - public DataTableDataBuilder totalCount(Long totalCount) { - this.totalCount = totalCount; - return this; - } - - public DataTableDataBuilder data(List data) { - this.data = data; - return this; - } - - @Override - public DataTableData build() { - DataTableData dataTableData = new DataTableData<>(); - dataTableData.setTotalCount(totalCount); - dataTableData.setData(data); - return dataTableData; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/models/RecentActivityDataBuilder.java b/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/models/RecentActivityDataBuilder.java deleted file mode 100644 index 61756e6be..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/model/models/RecentActivityDataBuilder.java +++ /dev/null @@ -1,52 +0,0 @@ -package eu.eudat.logic.builders.model.models; - -import eu.eudat.logic.builders.Builder; -import eu.eudat.models.data.dashboard.recent.RecentActivityData; - -import java.util.Date; - -/** - * Created by ikalyvas on 3/14/2018. - */ -public class RecentActivityDataBuilder extends Builder { - - private String label; - private String id; - private Date timestamp; - - public String getLabel() { - return label; - } - - public RecentActivityDataBuilder label(String label) { - this.label = label; - return this; - } - - public String getId() { - return id; - } - - public RecentActivityDataBuilder id(String id) { - this.id = id; - return this; - } - - public Date getTimestamp() { - return timestamp; - } - - public RecentActivityDataBuilder timestamp(Date timestamp) { - this.timestamp = timestamp; - return this; - } - - @Override - public RecentActivityData build() { - RecentActivityData recentActivityData = new RecentActivityData(); - recentActivityData.setLabel(label); - recentActivityData.setTimestamp(timestamp); - recentActivityData.setId(id); - return recentActivityData; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/CommonsManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/CommonsManager.java deleted file mode 100644 index 1c5a6a69a..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/CommonsManager.java +++ /dev/null @@ -1,29 +0,0 @@ -package eu.eudat.logic.managers; - -import eu.eudat.models.data.externalurl.ExternalSourcesConfiguration; -import eu.eudat.logic.proxy.config.configloaders.ConfigLoader; -import eu.eudat.service.remotefetcher.ExternalUrlConfigProvider; - -import java.util.stream.Collectors; - -/** - * Created by ikalyvas on 5/17/2018. - */ -public class CommonsManager { - - - public static ExternalSourcesConfiguration getExternalSourcesConfiguration(ConfigLoader configLoader, ExternalUrlConfigProvider externalUrlConfigProvider){ - ExternalSourcesConfiguration externalSourcesConfiguration = new ExternalSourcesConfiguration(); - externalSourcesConfiguration.setDataRepositories(externalUrlConfigProvider.getExternalUrls().getRepositories().getUrls().stream() - .map(item-> new ExternalSourcesConfiguration.ExternalSourcesUrlModel(item.getKey(),item.getLabel())).collect(Collectors.toList())); - externalSourcesConfiguration.setExternalDatasets(externalUrlConfigProvider.getExternalUrls().getDatasets().getUrls().stream() - .map(item-> new ExternalSourcesConfiguration.ExternalSourcesUrlModel(item.getKey(),item.getLabel())).collect(Collectors.toList())); - externalSourcesConfiguration.setRegistries(externalUrlConfigProvider.getExternalUrls().getRegistries().getUrls().stream() - .map(item-> new ExternalSourcesConfiguration.ExternalSourcesUrlModel(item.getKey(),item.getLabel())).collect(Collectors.toList())); - externalSourcesConfiguration.setServices(externalUrlConfigProvider.getExternalUrls().getServices().getUrls().stream() - .map(item-> new ExternalSourcesConfiguration.ExternalSourcesUrlModel(item.getKey(),item.getLabel())).collect(Collectors.toList())); - /*externalSourcesConfiguration.setTags(configLoader.getExternalUrls().getTags().getUrls().stream() - .map(item-> new ExternalSourcesConfiguration.ExternalSourcesUrlModel(item.getKey(),item.getLabel())).collect(Collectors.toList()));*/ - return externalSourcesConfiguration; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetProfileManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetProfileManager.java index f82b7f721..ffdc9e914 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetProfileManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetProfileManager.java @@ -1,34 +1,15 @@ package eu.eudat.logic.managers; -import eu.eudat.commons.types.descriptiontemplate.FieldEntity; -import eu.eudat.commons.types.descriptiontemplate.fielddata.ExternalSelectDataEntity; -import eu.eudat.logic.xml.XmlBuilder; -import eu.eudat.data.DescriptionTemplateEntity; import eu.eudat.logic.proxy.config.configloaders.ConfigLoader; -import eu.eudat.service.remotefetcher.config.entities.GeneralUrls; import eu.eudat.service.remotefetcher.RemoteFetcherService; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.service.remotefetcher.models.ExternalAutocompleteFieldResult; -import eu.eudat.service.remotefetcher.config.AuthenticationConfiguration; -import eu.eudat.service.remotefetcher.config.DataFieldsUrlConfiguration; -import eu.eudat.service.remotefetcher.config.DataUrlConfiguration; -import eu.eudat.service.remotefetcher.config.UrlConfiguration; -import eu.eudat.service.remotefetcher.criteria.ExternalReferenceCriteria; -import eu.eudat.service.remotefetcher.criteria.FetchStrategy; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.MediaType; import org.springframework.stereotype.Component; -import org.w3c.dom.Document; -import org.w3c.dom.Element; import javax.management.InvalidApplicationException; -import javax.xml.xpath.*; -import java.net.URI; -import java.net.URISyntaxException; +import javax.xml.xpath.XPathExpressionException; import java.util.ArrayList; -import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -42,156 +23,10 @@ public class DatasetProfileManager { private final RemoteFetcherService remoteFetcherService; @Autowired - public DatasetProfileManager(ApiContext apiContext, ConfigLoader configLoader, RemoteFetcherService remoteFetcherService) { + public DatasetProfileManager(ConfigLoader configLoader, RemoteFetcherService remoteFetcherService) { this.configLoader = configLoader; this.remoteFetcherService = remoteFetcherService; } - - public FieldEntity queryForField(String xml, String fieldId) throws XPathExpressionException { - FieldEntity fieldEntity = new FieldEntity(); - Document document = XmlBuilder.fromXml(xml); - XPathFactory xpathFactory = XPathFactory.newInstance(); - XPath xpath = xpathFactory.newXPath(); - XPathExpression expr = - xpath.compile("//field[@id='" + fieldId + "']"); - Element name = (Element) expr.evaluate(document, XPathConstants.NODE); -// fieldEntity.fromXml(name); - return fieldEntity; - } - - public List getAutocomplete(ExternalSelectDataEntity data, String like) { - /*List result = new LinkedList<>(); - SimpleClientHttpRequestFactory simpleFactory = new SimpleClientHttpRequestFactory(); - - RestTemplate restTemplate = new RestTemplate(simpleFactory); - HttpHeaders headers = new HttpHeaders(); - DocumentContext jsonContext = null; - HttpEntity entity; - ResponseEntity response; - List> jsonItems; - int i = 0; - for (AutoCompleteData.AutoCompleteSingleData singleData: data.getAutoCompleteSingleDataList()) { - switch (AutoCompleteData.AutocompleteType.fromValue(singleData.getAutocompleteType())) { - case UNCACHED: - - String url = singleData.getUrl(); - String mediaType = ""; - if (url.contains("openaire") || url.contains("zenodo")) { - mediaType = "application/json; charset=utf-8"; - if (url.contains("zenodo")) { - url = url.replace("?", "/?"); - } - - url = url.replace("{like}", like.equals("") ? "*" : like); - url = url.replace("%20", " "); - url = url.replace("%22", "\""); - url = url.replace("&", "&"); - } else { - mediaType = "application/vnd.api+json; charset=utf-8"; - url += "?search=" + like; - } - - if (!url.contains("zenodo")) { - headers.setAccept(Collections.singletonList(MediaType.valueOf(mediaType))); - } - headers.setContentType(MediaType.APPLICATION_JSON); - entity = new HttpEntity<>("parameters", headers); - - - response = restTemplate.exchange(url, HttpMethod.GET, entity, Object.class); - jsonContext = JsonPath.parse(response.getBody()); - jsonItems = jsonContext.read(singleData.getOptionsRoot() + "['" + singleData.getAutoCompleteOptions().getLabel() + "','" + singleData.getAutoCompleteOptions().getValue() + "','" + singleData.getAutoCompleteOptions().getSource() + "','" + "uri" + "']"); - jsonItems.forEach(item -> result.add(new ExternalAutocompleteFieldModel(parseItem(item.get(singleData.getAutoCompleteOptions().getValue())), parseItem(item.get(singleData.getAutoCompleteOptions().getLabel())), item.get(singleData.getAutoCompleteOptions().getSource()) != null ? parseItem(item.get(singleData.getAutoCompleteOptions().getSource())) : singleData.getAutoCompleteOptions().getSource(), parseItem(item.get("uri"))))); - break; - case CACHED: - headers.setAccept(Collections.singletonList(MediaType.valueOf("text/plain; charset=utf-8"))); - headers.setContentType(MediaType.TEXT_PLAIN); - entity = new HttpEntity<>("parameters", headers); - - if (cache.size() <= i) { - response = restTemplate.exchange(singleData.getUrl(), HttpMethod.GET, entity, String.class); - cache.add((String) response.getBody()); - } - jsonContext = JsonPath.parse(cache.get(i)); - jsonItems = jsonContext.read(singleData.getOptionsRoot() + "['" + singleData.getAutoCompleteOptions().getLabel() + "','" + singleData.getAutoCompleteOptions().getValue() + "','" + singleData.getAutoCompleteOptions().getSource() + "','" + "uri" + "']"); - jsonItems.stream().filter(item -> item.get(singleData.getAutoCompleteOptions().getLabel()).toLowerCase().contains(like.toLowerCase())) - .forEach(item -> result.add(new ExternalAutocompleteFieldModel(item.get(singleData.getAutoCompleteOptions().getValue()), item.get(singleData.getAutoCompleteOptions().getLabel()), item.get(singleData.getAutoCompleteOptions().getSource()) != null ? item.get(singleData.getAutoCompleteOptions().getSource()) : singleData.getAutoCompleteOptions().getSource(), item.get("uri")))); - i++; - break; - } - - } - - return result.stream().sorted(Comparator.comparing(ExternalAutocompleteFieldModel::getLabel)).collect(Collectors.toList()); -*/ - List result = new LinkedList<>(); - ExternalReferenceCriteria urlCriteria = new ExternalReferenceCriteria(); - GeneralUrls genericUrls = new GeneralUrls(); - int ordinal = 1; - List> rawResults = new ArrayList<>(); - genericUrls.setFetchMode(FetchStrategy.FIRST); - urlCriteria.setLike(like); - for (ExternalSelectDataEntity.ExternalSelectSourceEntity singleData : data.getSources()) { - UrlConfiguration urlConfiguration = new UrlConfiguration(); - try { - URI uri; - if (singleData.getUrl().contains("?")) { - uri = new URI(singleData.getUrl().substring(0, singleData.getUrl().lastIndexOf("?"))); - } else { - uri = new URI(singleData.getUrl()); - } - String source = singleData.getSourceBinding().getSource(); - source = source != null && !source.isEmpty() ? source : uri.getHost(); -// String uriString = singleData.getSourceBinding().getUri(); -// uriString = uriString != null && !uriString.isEmpty() ? uriString : "uri"; - String uriString = "uri"; - String parsedUrl = singleData.getUrl(); - parsedUrl = parsedUrl.replace("%20", " "); - parsedUrl = parsedUrl.replace("%22", "\""); - while (parsedUrl.contains("&")) { - parsedUrl = parsedUrl.replace("&", "&"); - } - urlConfiguration.setUrl(parsedUrl); - urlConfiguration.setOrdinal(ordinal); - urlConfiguration.setType("External"); - urlConfiguration.setContentType(MediaType.APPLICATION_JSON_VALUE); - urlConfiguration.setFirstpage("1"); - urlConfiguration.setRequestType(singleData.getMethod() != null ? singleData.getMethod() : "GET"); - DataUrlConfiguration dataUrlConfiguration = new DataUrlConfiguration(); - dataUrlConfiguration.setPath(singleData.getOptionsRoot()); - DataFieldsUrlConfiguration fieldsUrlConfiguration = new DataFieldsUrlConfiguration(); - fieldsUrlConfiguration.setId(singleData.getSourceBinding().getValue()); - fieldsUrlConfiguration.setName(singleData.getSourceBinding().getLabel()); - fieldsUrlConfiguration.setSource(singleData.getSourceBinding().getSource().isEmpty()? null : singleData.getSourceBinding().getSource()); - fieldsUrlConfiguration.setUri(uriString); - dataUrlConfiguration.setFieldsUrlConfiguration(fieldsUrlConfiguration); - urlConfiguration.setKey(source); - urlConfiguration.setLabel(source); - urlConfiguration.setData(dataUrlConfiguration); - if (singleData.getHasAuth()) { - AuthenticationConfiguration authenticationConfiguration = new AuthenticationConfiguration(); - authenticationConfiguration.setAuthUrl(singleData.getAuth().getUrl()); - authenticationConfiguration.setAuthMethod(singleData.getAuth().getMethod()); - authenticationConfiguration.setAuthTokenPath(singleData.getAuth().getPath()); - authenticationConfiguration.setAuthRequestBody(singleData.getAuth().getBody()); - authenticationConfiguration.setType(singleData.getAuth().getType()); - urlConfiguration.setAuth(authenticationConfiguration); - } - genericUrls.getUrls().add(urlConfiguration); - List> singleResults = this.remoteFetcherService.getExternalGeneric(urlCriteria, genericUrls); - if (!singleResults.isEmpty() && !singleResults.get(0).containsKey("source") && !singleData.getSourceBinding().getSource().isEmpty()) { - singleResults.forEach(singleResult -> singleResult.put("source", singleData.getSourceBinding().getSource())); - } - rawResults.addAll(singleResults); - genericUrls.getUrls().clear(); - } catch (URISyntaxException e) { - logger.error(e.getMessage(), e); - } - } - rawResults.forEach(item -> result.add(new ExternalAutocompleteFieldResult(parseItem(item.get("pid")), parseItem(item.get("name")), parseItem(item.get("source")), parseItem(item.get("uri"))))); - return result; - } - private static String parseItem(Object item) { if (item instanceof String) { return (String) item; @@ -249,26 +84,6 @@ public class DatasetProfileManager { // } // } // this.updateDatasetProfileXml(document, descriptionTemplateEntity); -// } - } - - private void updateDatasetProfileXml(Document document, DescriptionTemplateEntity descriptionTemplateEntity) { -// try { -// DOMSource domSource = new DOMSource(document); -// StringWriter writer = new StringWriter(); -// StreamResult result = new StreamResult(writer); -// TransformerFactory tf = TransformerFactory.newInstance(); -// Transformer transformer = tf.newTransformer(); -// transformer.setOutputProperty(OutputKeys.INDENT, "yes"); -// transformer.transform(domSource, result); -// String newDefinition = writer.toString(); -// if(newDefinition != null){ -// descriptionTemplateEntity.setDefinition(newDefinition); -// this.databaseRepository.getDatasetProfileDao().createOrUpdate(descriptionTemplateEntity); -// } -// } -// catch(TransformerException ex) { -// logger.error(ex.getMessage(), ex); // } } } diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/LocalFetchManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/LocalFetchManager.java index d04b8a57a..dabfa803f 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/LocalFetchManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/LocalFetchManager.java @@ -2,7 +2,7 @@ package eu.eudat.logic.managers; import eu.eudat.logic.proxy.fetching.LocalFetcher; import eu.eudat.utilities.helpers.StreamDistinctBy; -import eu.eudat.models.data.local.LocalFetchModel; +import eu.eudat.models.old.local.LocalFetchModel; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/MaterialManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/MaterialManager.java deleted file mode 100644 index 344fe24b3..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/MaterialManager.java +++ /dev/null @@ -1,51 +0,0 @@ -package eu.eudat.logic.managers; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Component; - -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -@Component -public class MaterialManager { - - @Autowired - public MaterialManager(){} - - public ResponseEntity getResponseEntity(String lang, Stream paths) throws IOException { - List result = paths.filter(Files::isRegularFile) - .map(Path::toString).collect(Collectors.toList()); - - String fileName = result.stream().filter(about -> about.contains("_" + lang)).findFirst().orElse(null); - if (fileName == null) { - fileName = result.stream().filter(about -> about.contains("_en")).findFirst().get(); - } - InputStream is = new FileInputStream(fileName); - - Path path = Paths.get(fileName); - - HttpHeaders responseHeaders = new HttpHeaders(); - responseHeaders.setContentLength(is.available()); - responseHeaders.setContentType(MediaType.TEXT_HTML); - responseHeaders.set("Content-Disposition", "attachment;filename=" + path.getFileName().toString()); - responseHeaders.set("Access-Control-Expose-Headers", "Content-Disposition"); - responseHeaders.get("Access-Control-Expose-Headers").add("Content-Type"); - - byte[] content = new byte[is.available()]; - is.read(content); - is.close(); - - return new ResponseEntity<>(content, responseHeaders, HttpStatus.OK); - } -} 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 1939569a8..9881aa269 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 @@ -1,32 +1,25 @@ package eu.eudat.logic.managers; import eu.eudat.commons.enums.DescriptionTemplateStatus; -import eu.eudat.commons.enums.IsActive; -import eu.eudat.data.dao.criteria.*; -import eu.eudat.data.DescriptionTemplateEntity; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.query.DmpDescriptionTemplateQuery; import eu.eudat.types.MetricNames; -import gr.cite.tools.data.query.QueryFactory; import io.micrometer.prometheus.PrometheusMeterRegistry; import io.prometheus.client.Gauge; +import jakarta.annotation.PostConstruct; +import jakarta.transaction.Transactional; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.env.Environment; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; -import jakarta.annotation.PostConstruct; -import jakarta.transaction.Transactional; - import javax.management.InvalidApplicationException; import java.io.IOException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.ZoneId; -import java.util.*; +import java.util.Date; +import java.util.Map; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -77,15 +70,9 @@ public class MetricsManager { } } - private final ApiContext apiContext; - private final Environment environment; - private final QueryFactory queryFactory; @Autowired - public MetricsManager(ApiContext apiContext, Environment environment, PrometheusMeterRegistry registry, QueryFactory queryFactory) { - this.apiContext = apiContext; - this.environment = environment; - this.queryFactory = queryFactory; + public MetricsManager(PrometheusMeterRegistry registry) { registry.clear(); this.gauges = Stream.of( new Object[][]{ {MetricNames.DMP, Gauge.build().name(MetricNames.DMP).help("Number of managed DMPs").labelNames("status").register(registry.getPrometheusRegistry())}, @@ -207,9 +194,9 @@ public class MetricsManager { } private long countAllDraftDMPs(boolean countNexus) throws InvalidApplicationException { - DataManagementPlanCriteria criteria = new DataManagementPlanCriteria(); - criteria.setStatus(0); - if (countNexus) criteria.setPeriodStart(getNexusDate()); +// DataManagementPlanCriteria criteria = new DataManagementPlanCriteria(); +// criteria.setStatus(0); +// if (countNexus) criteria.setPeriodStart(getNexusDate()); // return apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getWithCriteria(criteria).count(); return 0; } @@ -219,9 +206,9 @@ public class MetricsManager { } private long countAllFinalizedDMPs(boolean countNexus) throws InvalidApplicationException { - DataManagementPlanCriteria criteria = new DataManagementPlanCriteria(); - criteria.setStatus(1); - if (countNexus) criteria.setPeriodStart(getNexusDate()); +// DataManagementPlanCriteria criteria = new DataManagementPlanCriteria(); +// criteria.setStatus(1); +// if (countNexus) criteria.setPeriodStart(getNexusDate()); // return apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getWithCriteria(criteria).count(); return 0; } @@ -231,10 +218,10 @@ public class MetricsManager { } private long countAllPublishedDMPs(boolean countNexus) throws InvalidApplicationException { - DataManagementPlanCriteria criteria = new DataManagementPlanCriteria(); - criteria.setIsPublic(true); - criteria.setOnlyPublic(true); - if (countNexus) criteria.setPeriodStart(getNexusDate()); +// DataManagementPlanCriteria criteria = new DataManagementPlanCriteria(); +// criteria.setIsPublic(true); +// criteria.setOnlyPublic(true); +// if (countNexus) criteria.setPeriodStart(getNexusDate()); // return apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getWithCriteria(criteria).count(); return 0; } @@ -244,9 +231,9 @@ public class MetricsManager { } private long countAllDoiedDMPs(boolean countNexus) throws InvalidApplicationException { - DataManagementPlanCriteria criteria = new DataManagementPlanCriteria(); - criteria.setHasDoi(true); - if (countNexus) criteria.setPeriodStart(getNexusDate()); +// DataManagementPlanCriteria criteria = new DataManagementPlanCriteria(); +// criteria.setHasDoi(true); +// if (countNexus) criteria.setPeriodStart(getNexusDate()); // return apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getWithCriteria(criteria).count(); return 0; } @@ -256,9 +243,9 @@ public class MetricsManager { } private long countAllDraftDMPsWithGrantId(boolean countNexus) throws InvalidApplicationException { - DataManagementPlanCriteria criteria = new DataManagementPlanCriteria(); - criteria.setStatus(0); - if (countNexus) criteria.setPeriodStart(getNexusDate()); +// DataManagementPlanCriteria criteria = new DataManagementPlanCriteria(); +// criteria.setStatus(0); +// if (countNexus) criteria.setPeriodStart(getNexusDate()); // return apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getWithCriteria(criteria).groupBy((builder, root) -> root.get("grant")).count(); return 0; } @@ -268,9 +255,9 @@ public class MetricsManager { } private long countAllFinalizedDMPsWithGrantId(boolean countNexus) throws InvalidApplicationException { - DataManagementPlanCriteria criteria = new DataManagementPlanCriteria(); - criteria.setStatus(1); - if (countNexus) criteria.setPeriodStart(getNexusDate()); +// DataManagementPlanCriteria criteria = new DataManagementPlanCriteria(); +// criteria.setStatus(1); +// if (countNexus) criteria.setPeriodStart(getNexusDate()); // return apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getWithCriteria(criteria).groupBy((builder, root) -> root.get("grant")).count(); return 0; } @@ -280,10 +267,10 @@ public class MetricsManager { } private long countAllPublishedDMPsWithGrantId(boolean countNexus) throws InvalidApplicationException { - DataManagementPlanCriteria criteria = new DataManagementPlanCriteria(); - criteria.setIsPublic(true); - criteria.setOnlyPublic(true); - if (countNexus) criteria.setPeriodStart(getNexusDate()); +// DataManagementPlanCriteria criteria = new DataManagementPlanCriteria(); +// criteria.setIsPublic(true); +// criteria.setOnlyPublic(true); +// if (countNexus) criteria.setPeriodStart(getNexusDate()); // return apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getWithCriteria(criteria).groupBy((builder, root) -> root.get("grant")).count(); return 0; } @@ -293,9 +280,9 @@ public class MetricsManager { } private long countAllDoiedDMPsWithGrantId(boolean countNexus) throws InvalidApplicationException { - DataManagementPlanCriteria criteria = new DataManagementPlanCriteria(); - criteria.setHasDoi(true); - if (countNexus) criteria.setPeriodStart(getNexusDate()); +// DataManagementPlanCriteria criteria = new DataManagementPlanCriteria(); +// criteria.setHasDoi(true); +// if (countNexus) criteria.setPeriodStart(getNexusDate()); // return apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getWithCriteria(criteria).groupBy((builder, root) -> root.get("grant")).count(); return 0; } @@ -349,9 +336,9 @@ public class MetricsManager { } public long countAllDraftDatasets(boolean countNexus) throws InvalidApplicationException { - eu.eudat.data.dao.criteria.DatasetCriteria criteria = new eu.eudat.data.dao.criteria.DatasetCriteria(); - criteria.setStatus(0); - if (countNexus) criteria.setPeriodStart(getNexusDate()); +// eu.eudat.data.dao.criteria.DatasetCriteria criteria = new eu.eudat.data.dao.criteria.DatasetCriteria(); +// criteria.setStatus(0); +// if (countNexus) criteria.setPeriodStart(getNexusDate()); // return apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao().getWithCriteria(criteria).count(); return 0; } @@ -361,9 +348,9 @@ public class MetricsManager { } public long countAllFinalizedDatasets(boolean countNexus) throws InvalidApplicationException { - eu.eudat.data.dao.criteria.DatasetCriteria criteria = new eu.eudat.data.dao.criteria.DatasetCriteria(); - criteria.setStatus(1); - if (countNexus) criteria.setPeriodStart(getNexusDate()); +// eu.eudat.data.dao.criteria.DatasetCriteria criteria = new eu.eudat.data.dao.criteria.DatasetCriteria(); +// criteria.setStatus(1); +// if (countNexus) criteria.setPeriodStart(getNexusDate()); // return apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao().getWithCriteria(criteria).count(); return 0; } @@ -373,9 +360,9 @@ public class MetricsManager { } public long countAllPublicDatasets(boolean countNexus) throws InvalidApplicationException { - eu.eudat.data.dao.criteria.DatasetCriteria criteria = new eu.eudat.data.dao.criteria.DatasetCriteria(); - criteria.setIsPublic(true); - if (countNexus) criteria.setPeriodStart(getNexusDate()); +// eu.eudat.data.dao.criteria.DatasetCriteria criteria = new eu.eudat.data.dao.criteria.DatasetCriteria(); +// criteria.setIsPublic(true); +// if (countNexus) criteria.setPeriodStart(getNexusDate()); // return apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao().getWithCriteria(criteria).count(); return 0; } @@ -385,9 +372,9 @@ public class MetricsManager { } public long countAllDatasetsWithDoi(boolean countNexus) throws InvalidApplicationException { - eu.eudat.data.dao.criteria.DatasetCriteria criteria = new eu.eudat.data.dao.criteria.DatasetCriteria(); - criteria.setHasDoi(true); - if (countNexus) criteria.setPeriodStart(getNexusDate()); +// eu.eudat.data.dao.criteria.DatasetCriteria criteria = new eu.eudat.data.dao.criteria.DatasetCriteria(); +// criteria.setHasDoi(true); +// if (countNexus) criteria.setPeriodStart(getNexusDate()); // return apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao().getWithCriteria(criteria).count(); return 0; } @@ -397,9 +384,9 @@ public class MetricsManager { } public long countAllDraftTemplates(boolean countNexus) throws InvalidApplicationException { - DatasetProfileCriteria criteria = new DatasetProfileCriteria(); - criteria.setStatus(0); - if (countNexus) criteria.setPeriodStart(getNexusDate()); +// DatasetProfileCriteria criteria = new DatasetProfileCriteria(); +// criteria.setStatus(0); +// if (countNexus) criteria.setPeriodStart(getNexusDate()); return 0; //return apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().getWithCriteria(criteria).count(); } @@ -409,9 +396,9 @@ public class MetricsManager { } public long countAllFinalizedTemplates(boolean countNexus) throws InvalidApplicationException { - DatasetProfileCriteria criteria = new DatasetProfileCriteria(); - criteria.setStatus(1); - if (countNexus) criteria.setPeriodStart(getNexusDate()); +// DatasetProfileCriteria criteria = new DatasetProfileCriteria(); +// criteria.setStatus(1); +// if (countNexus) criteria.setPeriodStart(getNexusDate()); return 0; // return apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().getWithCriteria(criteria).count(); } @@ -423,10 +410,10 @@ public class MetricsManager { @Transactional public long countAllUsedTemplates(boolean countNexus) throws InvalidApplicationException { - DatasetProfileCriteria criteria = new DatasetProfileCriteria(); - criteria.setStatus(1); - criteria.setAllVersions(false); - if (countNexus) criteria.setPeriodStart(getNexusDate()); +// DatasetProfileCriteria criteria = new DatasetProfileCriteria(); +// criteria.setStatus(1); +// criteria.setAllVersions(false); +// if (countNexus) criteria.setPeriodStart(getNexusDate()); // List descriptionTemplateEntities = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().getWithCriteria(criteria).withFields(Collections.singletonList("id")).toList(); // DatasetCriteria datasetCriteria = new DatasetCriteria(); // datasetCriteria.setDatasetTemplates(descriptionTemplateEntities.stream().map(DescriptionTemplateEntity::getId).collect(Collectors.toList())); diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/RDAManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/RDAManager.java deleted file mode 100644 index 6d9c99a79..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/RDAManager.java +++ /dev/null @@ -1,50 +0,0 @@ -package eu.eudat.logic.managers; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import eu.eudat.data.DmpEntity; -import eu.eudat.models.rda.Dmp; -import eu.eudat.models.rda.RDAModel; -import eu.eudat.models.rda.mapper.DmpRDAMapper; -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.text.SimpleDateFormat; - -@Component -public class RDAManager { - - private DmpRDAMapper dmpRDAMapper; - - @Autowired - public RDAManager(DmpRDAMapper dmpRDAMapper) { - this.dmpRDAMapper = dmpRDAMapper; - } - - @Transactional - public String convertToRDA(DmpEntity dmp) throws JsonProcessingException, InvalidApplicationException { - String result = ""; - - Dmp rdaDmp = dmpRDAMapper.toRDA(dmp); - - ObjectMapper mapper = new ObjectMapper(); - mapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")); - - RDAModel model = new RDAModel(); - model.setDmp(rdaDmp); - result = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(model); - - return result; - } - - public DmpEntity convertToEntity(String json, String[] profiles) throws IOException, InvalidApplicationException { - ObjectMapper mapper = new ObjectMapper(); - - Dmp rda = mapper.readValue(json, RDAModel.class).getDmp(); - return dmpRDAMapper.toEntity(rda, profiles); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/Proxy.java b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/Proxy.java deleted file mode 100644 index 3f1489350..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/Proxy.java +++ /dev/null @@ -1,64 +0,0 @@ -package eu.eudat.logic.proxy; - -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.*; - - -@RestController -@CrossOrigin -public class Proxy { - - private String allowedHost; - - public Proxy(String allowedHost) throws MalformedURLException { - this.allowedHost = new URL(allowedHost).getHost(); - } - - public Proxy() { - - } - - @RequestMapping(method = RequestMethod.GET, value = {"/eu/eudat/logic/proxy"}, produces = "application/json") - public @ResponseBody - ResponseEntity proxy(@RequestParam("url") String remoteUrl) { - - StringBuffer response = new StringBuffer(); - URL url; - try { - URL tempUrl = new URL(remoteUrl); -// URI uri = new URI(scheme, userInfo, host, port, path, query, fragment); - URI uri = new URI(tempUrl.getProtocol(), null, tempUrl.getHost(), tempUrl.getPort(), tempUrl.getPath(), (tempUrl.getQuery() != null) ? URLEncoder.encode(tempUrl.getQuery()) : null, tempUrl.getRef()); - url = uri.toURL(); - - if (!url.getHost().equals(allowedHost)) - return ResponseEntity.status(HttpStatus.FORBIDDEN).body("{'reason': 'You are not allowed to eu.eudat.logic.proxy -> " + url.getHost() + "'}"); - //if allowed, proceed - HttpURLConnection con = (HttpURLConnection) url.openConnection(); - con.setRequestMethod("GET"); - con.setRequestProperty("Accept", "application/vnd.api+json; charset=utf-8"); - - int responseCode = con.getResponseCode(); - if (responseCode == HttpURLConnection.HTTP_OK) { // success - BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); - String inputLine; - while ((inputLine = in.readLine()) != null) - response.append(inputLine); - in.close(); - return ResponseEntity.status(HttpStatus.OK).body(response.toString()); - } else { - return ResponseEntity.status(HttpStatus.FORBIDDEN).body("{'reason': 'Remote server responded with: " + responseCode + "'}"); - } - - } catch (IOException | URISyntaxException e) { - return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{'reason': 'Could not eu.eudat.logic.proxy to given host'}"); - } - - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/AuthType.java b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/AuthType.java deleted file mode 100644 index b26ef708a..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/AuthType.java +++ /dev/null @@ -1,23 +0,0 @@ -package eu.eudat.logic.proxy.config; - -public enum AuthType { - ; - private final String name; - - AuthType(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public static AuthType fromName(String name) { - for (AuthType authType : AuthType.values()) { - if (authType.getName().equals(name)) { - return authType; - } - } - throw new IllegalArgumentException("AuthType [" + name + "] is not supported"); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/DataSearchConfiguration.java b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/DataSearchConfiguration.java deleted file mode 100644 index aecf16e18..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/DataSearchConfiguration.java +++ /dev/null @@ -1,24 +0,0 @@ -package eu.eudat.logic.proxy.config; - -import jakarta.xml.bind.annotation.XmlElement; - -public class DataSearchConfiguration { - private String type; - private String queryParam; - - public String getType() { - return type; - } - @XmlElement(name = "type") - public void setType(String type) { - this.type = type; - } - - public String getQueryParam() { - return queryParam; - } - @XmlElement(name = "queryparam") - public void setQueryParam(String queryParam) { - this.queryParam = queryParam; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/configloaders/ConfigLoader.java b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/configloaders/ConfigLoader.java index 496d73f83..8f98669bd 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/configloaders/ConfigLoader.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/configloaders/ConfigLoader.java @@ -1,13 +1,8 @@ package eu.eudat.logic.proxy.config.configloaders; -import eu.eudat.models.data.pid.PidLinks; import org.apache.poi.xwpf.usermodel.XWPFDocument; -import java.util.Map; public interface ConfigLoader { XWPFDocument getDocument(); - XWPFDocument getDatasetDocument(); - PidLinks getPidLinks(); - Map getKeyToSourceMap(); } diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/configloaders/DefaultConfigLoader.java b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/configloaders/DefaultConfigLoader.java index 885db8bdb..ffe6006f2 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/configloaders/DefaultConfigLoader.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/configloaders/DefaultConfigLoader.java @@ -1,8 +1,6 @@ package eu.eudat.logic.proxy.config.configloaders; -import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; -import eu.eudat.models.data.pid.PidLinks; import eu.eudat.service.storage.StorageFileService; import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.slf4j.Logger; @@ -12,18 +10,14 @@ import org.springframework.stereotype.Service; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; -import java.io.*; -import java.util.*; -import java.util.stream.Collectors; +import java.io.ByteArrayInputStream; +import java.util.LinkedList; +import java.util.List; @Service("configLoader") public class DefaultConfigLoader implements ConfigLoader { @@ -31,9 +25,6 @@ public class DefaultConfigLoader implements ConfigLoader { private static final ObjectMapper mapper = new ObjectMapper(); private XWPFDocument document; - private XWPFDocument datasetDocument; - private PidLinks pidLinks; - private Map keyToSourceMap; @Autowired private StorageFileService storageFileService; @@ -48,107 +39,11 @@ public class DefaultConfigLoader implements ConfigLoader { } } - private void setDatasetDocument() { - byte[] bytes = this.storageFileService.getH2020DescriptionTemplateFile(); - try { - this.datasetDocument = new XWPFDocument(new ByteArrayInputStream(bytes)); - } catch (Exception ex) { - logger.error("Cannot find resource", ex); - } - } - - private void setPidLinks() { - byte[] bytes = this.storageFileService.getPidLinksFile(); - try { - ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - this.pidLinks = mapper.readValue(new ByteArrayInputStream(bytes), PidLinks.class); - } catch (Exception ex) { - logger.error("Cannot find resource", ex); - } - } - - private void setKeyToSourceMap() { - byte[] bytes = this.storageFileService.getExternalUrlsFile(); - - try { - ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - this.pidLinks = mapper.readValue(new ByteArrayInputStream(bytes), PidLinks.class); - DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); - Document doc = documentBuilder.parse(new ByteArrayInputStream(bytes)); - if (doc == null) { - this.keyToSourceMap = null; - return; - } - String xpathExpression = "//key"; - Map keysToSourceMap = new HashMap<>(); - List keys = getXmlValuesFromXPath(doc, xpathExpression); - keys = keys.stream().distinct().collect(Collectors.toList()); - for (String key : keys) { - String sourceExpression = String.format("//urlConfig[key='%s']/label", key); - List sources = getXmlValuesFromXPath(doc, sourceExpression); - if (sources.size() != 0) { - keysToSourceMap.put(key, sources.get(0)); - } - } - this.keyToSourceMap = keysToSourceMap; - - } catch (Exception ex) { - logger.error("Cannot find resource", ex); - } - } - - - public XWPFDocument getDocument() { this.setDocument(); return document; } - public XWPFDocument getDatasetDocument() { - this.setDatasetDocument(); - return datasetDocument; - } - - public PidLinks getPidLinks() { - if (pidLinks == null) { - pidLinks = new PidLinks(); - this.setPidLinks(); - } - return pidLinks; - } - - public Map getKeyToSourceMap() { - if (keyToSourceMap == null) { - keyToSourceMap = new HashMap<>(); - this.setKeyToSourceMap(); - } - return keyToSourceMap; - } - - - private Document getXmlDocumentFromFilePath(String filePath) { - InputStream is = null; - Document doc; - try { - is = getStreamFromPath(filePath); - DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); - doc = documentBuilder.parse(is); - return doc; - } catch (IOException | ParserConfigurationException | SAXException | NullPointerException e) { - logger.error(e.getMessage(), e); - } finally { - try { - if (is != null) { - is.close(); - } - } catch (IOException e) { - logger.warn("Warning: Could not close a stream after reading from file: " + filePath, e); - } - } - return null; - } private List getXmlValuesFromXPath(Document doc, String expression) { XPath xPath = XPathFactory.newInstance().newXPath(); @@ -169,13 +64,4 @@ public class DefaultConfigLoader implements ConfigLoader { } return values; } - - private InputStream getStreamFromPath(String filePath) { - try { - return new FileInputStream(filePath); - } catch (FileNotFoundException e) { - logger.info("loading from classpath"); - return getClass().getClassLoader().getResourceAsStream(filePath); - } - } } diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/configloaders/ProductionConfigLoader.java b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/configloaders/ProductionConfigLoader.java deleted file mode 100644 index debb81b17..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/configloaders/ProductionConfigLoader.java +++ /dev/null @@ -1,240 +0,0 @@ -/*package eu.eudat.logic.proxy.config.configloaders; - -import com.fasterxml.jackson.databind.ObjectMapper; -import eu.eudat.logic.proxy.config.ExternalUrls; -import eu.eudat.logic.security.customproviders.ConfigurableProvider.entities.ConfigurableProviders; -import org.apache.poi.xwpf.usermodel.XWPFDocument; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Profile; -import org.springframework.core.env.Environment; -import org.springframework.stereotype.Service; -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; - -import jakarta.xml.bind.JAXBContext; -import jakarta.xml.bind.Unmarshaller; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFactory; -import java.io.*; -import java.net.URL; -import java.nio.file.Paths; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - - -@Service("configLoader") -@Profile({ "production", "staging" }) -public class ProductionConfigLoader implements ConfigLoader { - private static final Logger logger = LoggerFactory.getLogger(ProductionConfigLoader.class); - - private ExternalUrls externalUrls; - private List rdaProperties; - private XWPFDocument document; - private ConfigurableProviders configurableProviders; - private Map keyToSourceMap; - - @Autowired - private Environment environment; - - private void setExternalUrls() { - String fileUrl = this.environment.getProperty("configuration.externalUrls"); - logger.info("Loaded also config file: " + fileUrl); - String current = null; - InputStream is = null; - try { - current = new java.io.File(".").getCanonicalPath(); - JAXBContext jaxbContext = JAXBContext.newInstance(ExternalUrls.class); - Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); - is = new URL(Paths.get(fileUrl).toUri().toURL().toString()).openStream(); - externalUrls = (ExternalUrls) jaxbUnmarshaller.unmarshal(is); - - } catch (Exception ex) { - logger.error("Cannot find in folder" + current, ex); - } finally { - try { - if (is != null) is.close(); - } catch (IOException e) { - logger.warn("Warning: Could not close a stream after reading from file: " + fileUrl, e); - } - } - } - - private void setRdaProperties() { - String filePath = environment.getProperty("configuration.rda"); - BufferedReader reader; - List rdaList = new LinkedList<>(); - for (int i = 0; i < 2; i++) { - try { - if (i == 0) { - reader = new BufferedReader(new FileReader(filePath)); - } else { - reader = new BufferedReader(new FileReader(getClass().getClassLoader().getResource(filePath).getFile())); - } - String line = reader.readLine(); - while (line != null) { - rdaList.add(line); - line = reader.readLine(); - } - reader.close(); - break; - } catch (IOException e) { - if (i == 1) { - logger.error(e.getMessage(), e); - } - } - } - - rdaProperties = rdaList; - } - - private void setDocument() { - String filePath = environment.getProperty("configuration.h2020template"); - InputStream is = null; - for (int i = 0; i < 2; i++) { - try { - if (i == 0) { - is = new URL(Paths.get(filePath).toUri().toURL().toString()).openStream(); - } else { - is = getClass().getClassLoader().getResource(filePath).openStream(); - } - this.document = new XWPFDocument(is); - is.close(); - is = null; - break; - } catch (IOException e) { - logger.error(e.getMessage(), e); - } finally { - try { - if (is != null) is.close(); - } catch (IOException e) { - logger.warn("Warning: Could not close a stream after reading from file: " + filePath, e); - } - } - } - } - - private void setConfigurableProviders() { - String filePath = environment.getProperty("configuration.configurable_login_providers"); - InputStream is = null; - try { - File tempFile = new File(filePath); - if (tempFile.exists()) { - is = new URL(Paths.get(filePath).toUri().toURL().toString()).openStream(); - } else { - is = getClass().getClassLoader().getResource(filePath).openStream(); - } - ObjectMapper objectMapper = new ObjectMapper(); - this.configurableProviders = objectMapper.readValue(is, ConfigurableProviders.class); - } catch (IOException e) { - logger.error(e.getMessage(), e); - } finally { - try { - if (is != null) is.close(); - } catch (IOException e) { - logger.warn("Warning: Could not close a stream after reading from file: " + filePath, e); - } - } - } - private void setKeyToSourceMap() { - String filePath = this.environment.getProperty("configuration.externalUrls"); - logger.info("Loaded also config file: " + filePath); - Document doc = getXmlDocumentFromFilePath(filePath); - if (doc == null) { - this.keyToSourceMap = null; - return; - } - String xpathExpression = "//key"; - Map keysToSourceMap = new HashMap<>(); - List keys = getXmlValuesFromXPath(doc, xpathExpression); - keys = keys.stream().distinct().collect(Collectors.toList()); - for (String key : keys) { - String sourceExpression = String.format("//urlConfig[key='%s']/label", key); - List sources = getXmlValuesFromXPath(doc, sourceExpression); - if (sources.size() != 0) { - keysToSourceMap.put(key, sources.get(0)); - } - } - this.keyToSourceMap = keysToSourceMap; - } - - public ExternalUrls getExternalUrls() { - this.setExternalUrls(); - return externalUrls; - } - - public List getRdaProperties() { - this.setRdaProperties(); - return rdaProperties; - } - - public XWPFDocument getDocument() { - this.setDocument(); - return document; - } - - public ConfigurableProviders getConfigurableProviders() { - this.setConfigurableProviders(); - return configurableProviders; - } - - public Map getKeyToSourceMap() { - this.setKeyToSourceMap(); - return keyToSourceMap; - } - - private Document getXmlDocumentFromFilePath(String filePath) { - InputStream is = null; - Document doc; - try { - System.out.println(filePath); - is = new URL(Paths.get(filePath).toUri().toURL().toString()).openStream(); - DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); - doc = documentBuilder.parse(is); - return doc; - } catch (IOException | ParserConfigurationException | SAXException e) { - logger.error(e.getMessage(), e); - } finally { - try { - if (is != null) { - is.close(); - } - } catch (IOException e) { - logger.warn("Warning: Could not close a stream after reading from file: " + filePath, e); - } - } - return null; - } - - private List getXmlValuesFromXPath(Document doc, String expression) { - XPath xPath = XPathFactory.newInstance().newXPath(); - NodeList nodeList = null; - List values = new LinkedList<>(); - try { - nodeList = (NodeList) xPath.compile(expression).evaluate(doc, XPathConstants.NODESET); - } catch (XPathExpressionException e) { - logger.error(e.getMessage(), e); - } - if (nodeList != null) { - for (int i = 0; i < nodeList.getLength(); i++) { - Node node = nodeList.item(i); - if (node.hasChildNodes()) { - values.add(nodeList.item(i).getChildNodes().item(0).getNodeValue()); - } - } - } - return values; - } -}*/ diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/services/ApiContext.java b/dmp-backend/web/src/main/java/eu/eudat/logic/services/ApiContext.java deleted file mode 100644 index eae6fd695..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/services/ApiContext.java +++ /dev/null @@ -1,12 +0,0 @@ -package eu.eudat.logic.services; - -import eu.eudat.logic.services.helpers.HelpersService; -import eu.eudat.logic.services.operations.OperationsContext; - -public interface ApiContext { - - HelpersService getHelpersService(); - - OperationsContext getOperationsContext(); - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/services/ApiContextImpl.java b/dmp-backend/web/src/main/java/eu/eudat/logic/services/ApiContextImpl.java deleted file mode 100644 index ec88e7ccb..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/services/ApiContextImpl.java +++ /dev/null @@ -1,31 +0,0 @@ -package eu.eudat.logic.services; - -import eu.eudat.logic.services.helpers.HelpersService; -import eu.eudat.logic.services.operations.OperationsContext; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - - -@Service("apiContext") -public class ApiContextImpl implements ApiContext { - - private OperationsContext operationsContext; - private HelpersService helpersService; - - @Autowired - public ApiContextImpl(OperationsContext operationsContext, HelpersService helpersService) { - this.operationsContext = operationsContext; - this.helpersService = helpersService; - } - - @Override - public OperationsContext getOperationsContext() { - return operationsContext; - } - - @Override - public HelpersService getHelpersService() { - return helpersService; - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/services/forms/VisibilityContext.java b/dmp-backend/web/src/main/java/eu/eudat/logic/services/forms/VisibilityContext.java deleted file mode 100644 index bd663f208..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/services/forms/VisibilityContext.java +++ /dev/null @@ -1,45 +0,0 @@ -package eu.eudat.logic.services.forms; - -import eu.eudat.models.data.user.components.commons.Rule; - -import java.util.LinkedList; -import java.util.List; -import java.util.Optional; - -/** - * Created by ikalyvas on 3/5/2018. - */ -public class VisibilityContext { - private List visibilityRules = new LinkedList<>(); - - public List getVisibilityRules() { - return visibilityRules; - } - - public VisibilityRule get(String id) { - Optional rule = visibilityRules.stream().filter(item -> item.getVisibilityRuleTargetId().equals(id)).findFirst(); - if (rule.isPresent()) return rule.get(); - return null; - } - - public void buildVisibilityContext(List sources) { - sources.forEach(this::addToVisibilityRulesContext); - } - - private void addToVisibilityRulesContext(Rule item) { - VisibilityRuleSource source = new VisibilityRuleSource(); - source.setVisibilityRuleSourceId(item.getSourceField()); - source.setVisibilityRuleSourceValue(item.getRequiredValue()); - - Optional visibilityRuleOptional = visibilityRules.stream().filter(rule -> rule.getVisibilityRuleTargetId().equals(item.getTargetField())).findFirst(); - if (visibilityRuleOptional.isPresent()) visibilityRuleOptional.get().getVisibilityRuleSources().add(source); - else { - List sources = new LinkedList<>(); - sources.add(source); - VisibilityRule visibilityRule = new VisibilityRule(); - visibilityRule.setVisibilityRuleTargetId(item.getTargetField()); - visibilityRule.setVisibilityRuleSources(sources); - this.visibilityRules.add(visibilityRule); - } - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/services/forms/VisibilityRule.java b/dmp-backend/web/src/main/java/eu/eudat/logic/services/forms/VisibilityRule.java deleted file mode 100644 index 87deeb285..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/services/forms/VisibilityRule.java +++ /dev/null @@ -1,27 +0,0 @@ -package eu.eudat.logic.services.forms; - -import java.util.List; - -/** - * Created by ikalyvas on 3/5/2018. - */ -public class VisibilityRule { - private String visibilityRuleTargetId; - private List visibilityRuleSources; - - public String getVisibilityRuleTargetId() { - return visibilityRuleTargetId; - } - - public void setVisibilityRuleTargetId(String visibilityRuleTargetId) { - this.visibilityRuleTargetId = visibilityRuleTargetId; - } - - public List getVisibilityRuleSources() { - return visibilityRuleSources; - } - - public void setVisibilityRuleSources(List visibilityRuleSources) { - this.visibilityRuleSources = visibilityRuleSources; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/services/forms/VisibilityRuleService.java b/dmp-backend/web/src/main/java/eu/eudat/logic/services/forms/VisibilityRuleService.java deleted file mode 100644 index 5b664b36a..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/services/forms/VisibilityRuleService.java +++ /dev/null @@ -1,17 +0,0 @@ -package eu.eudat.logic.services.forms; - -import eu.eudat.models.data.user.components.commons.Rule; - -import java.util.List; -import java.util.Map; - -/** - * Created by ikalyvas on 3/5/2018. - */ -public interface VisibilityRuleService { - boolean isElementVisible(String id); - - void buildVisibilityContext(List sources); - - void setProperties(Map properties); -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/services/forms/VisibilityRuleServiceImpl.java b/dmp-backend/web/src/main/java/eu/eudat/logic/services/forms/VisibilityRuleServiceImpl.java deleted file mode 100644 index dc63bcf42..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/services/forms/VisibilityRuleServiceImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -package eu.eudat.logic.services.forms; - -import eu.eudat.models.data.user.components.commons.Rule; - -import java.util.*; - -/** - * Created by ikalyvas on 3/5/2018. - */ -public class VisibilityRuleServiceImpl implements VisibilityRuleService { - private final Map elementVisibility = new HashMap<>(); - private Map properties; - - public boolean isElementVisible(String id) { - return !this.elementVisibility.containsKey(id) || this.elementVisibility.get(id); - } - - public void setProperties(Map properties) { - this.properties = properties; - this.properties.entrySet().stream() - .filter(stringObjectEntry -> stringObjectEntry.getValue() instanceof String && ((String) stringObjectEntry.getValue()).startsWith("[") - && ((String) stringObjectEntry.getValue()).endsWith("]")) - .forEach(stringObjectEntry -> stringObjectEntry.setValue(parseArray((String) stringObjectEntry.getValue()))); - } - - private List parseArray(String original) { - String parsed = original.replace("[", "").replace("\"", "").replace("]", ""); - return Arrays.asList(parsed.split(",")); - } - - public void buildVisibilityContext(List sources) { - VisibilityContext visibilityContext = new VisibilityContext(); - visibilityContext.buildVisibilityContext(sources); - visibilityContext.getVisibilityRules().forEach(this::evaluateVisibility); - } - - private void evaluateVisibility(VisibilityRule rule) { - List sources = rule.getVisibilityRuleSources(); - for(VisibilityRuleSource source: sources){ - if (properties.containsKey(source.getVisibilityRuleSourceId()) - && isContained(properties.get(source.getVisibilityRuleSourceId()), source.getVisibilityRuleSourceValue())) { - this.elementVisibility.put(rule.getVisibilityRuleTargetId(), true); - } else { - this.elementVisibility.put(rule.getVisibilityRuleTargetId(), - this.elementVisibility.getOrDefault(rule.getVisibilityRuleTargetId(), false)); - } - } - } - - private Boolean isContained(Object values, String source) { - if (values instanceof List) { - return ((Collection) values).contains(source); - } else { - if (values != null) { - return values.equals(source); - } - return false; - } - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/services/forms/VisibilityRuleSource.java b/dmp-backend/web/src/main/java/eu/eudat/logic/services/forms/VisibilityRuleSource.java deleted file mode 100644 index 6c710d9ec..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/services/forms/VisibilityRuleSource.java +++ /dev/null @@ -1,25 +0,0 @@ -package eu.eudat.logic.services.forms; - -/** - * Created by ikalyvas on 3/5/2018. - */ -public class VisibilityRuleSource { - private String visibilityRuleSourceId; - private String visibilityRuleSourceValue; - - public String getVisibilityRuleSourceId() { - return visibilityRuleSourceId; - } - - public void setVisibilityRuleSourceId(String visibilityRuleSourceId) { - this.visibilityRuleSourceId = visibilityRuleSourceId; - } - - public String getVisibilityRuleSourceValue() { - return visibilityRuleSourceValue; - } - - public void setVisibilityRuleSourceValue(String visibilityRuleSourceValue) { - this.visibilityRuleSourceValue = visibilityRuleSourceValue; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/services/helpers/HelpersService.java b/dmp-backend/web/src/main/java/eu/eudat/logic/services/helpers/HelpersService.java deleted file mode 100644 index df4fdaa64..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/services/helpers/HelpersService.java +++ /dev/null @@ -1,13 +0,0 @@ -package eu.eudat.logic.services.helpers; - -import org.springframework.context.MessageSource; - -/** - * Created by ikalyvas on 3/1/2018. - */ -public interface HelpersService { - - MessageSource getMessageSource(); - -// LoggerService getLoggerService(); -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/services/helpers/HelpersServiceImpl.java b/dmp-backend/web/src/main/java/eu/eudat/logic/services/helpers/HelpersServiceImpl.java deleted file mode 100644 index c09003c23..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/services/helpers/HelpersServiceImpl.java +++ /dev/null @@ -1,31 +0,0 @@ -package eu.eudat.logic.services.helpers; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.MessageSource; -import org.springframework.stereotype.Service; - -/** - * Created by ikalyvas on 3/1/2018. - */ -@Service("helpersService") -public class HelpersServiceImpl implements HelpersService { - - private MessageSource messageSource; -// private LoggerService loggerService; - - @Autowired - public HelpersServiceImpl(MessageSource messageSource/*, LoggerService loggerService*/) { - this.messageSource = messageSource; -// this.loggerService = loggerService; - } - - @Override - public MessageSource getMessageSource() { - return messageSource; - } - - /*@Override - public LoggerService getLoggerService() { - return loggerService; - }*/ -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/services/helpers/LoggerService.java b/dmp-backend/web/src/main/java/eu/eudat/logic/services/helpers/LoggerService.java deleted file mode 100644 index 0fc4efdc5..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/services/helpers/LoggerService.java +++ /dev/null @@ -1,12 +0,0 @@ -package eu.eudat.logic.services.helpers; - -import eu.eudat.types.WarningLevel; - -/** - * Created by ikalyvas on 3/1/2018. - */ -public interface LoggerService { - void log(String message); - - void log(String message, WarningLevel level); -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/services/operations/OperationsContext.java b/dmp-backend/web/src/main/java/eu/eudat/logic/services/operations/OperationsContext.java deleted file mode 100644 index 154a1d1ca..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/services/operations/OperationsContext.java +++ /dev/null @@ -1,21 +0,0 @@ -package eu.eudat.logic.services.operations; - -import eu.eudat.logic.builders.BuilderFactory; -import eu.eudat.service.remotefetcher.RemoteFetcherService; -import org.springframework.context.ApplicationContext; - -/** - * Created by ikalyvas on 3/1/2018. - */ -public interface OperationsContext { - - ApplicationContext getApplicationContext(); - - BuilderFactory getBuilderFactory(); - - RemoteFetcherService getRemoteFetcher(); - -// FileStorageService getFileStorageService(); - -// ElasticRepository getElasticRepository(); -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/services/operations/OperationsContextImpl.java b/dmp-backend/web/src/main/java/eu/eudat/logic/services/operations/OperationsContextImpl.java deleted file mode 100644 index 31eec326d..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/services/operations/OperationsContextImpl.java +++ /dev/null @@ -1,55 +0,0 @@ -package eu.eudat.logic.services.operations; - -import eu.eudat.logic.builders.BuilderFactory; -import eu.eudat.service.remotefetcher.RemoteFetcherService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext; -import org.springframework.stereotype.Service; - -/** - * Created by ikalyvas on 3/1/2018. - */ -@Service("operationsContext") -public class OperationsContextImpl implements OperationsContext { - - private final ApplicationContext applicationContext; - private final RemoteFetcherService remoteFetcherService; - private final BuilderFactory builderFactory; -// private final FileStorageService fileStorageService; -// private final ElasticRepository elasticRepository; - - @Autowired - public OperationsContextImpl(ApplicationContext applicationContext, RemoteFetcherService remoteFetcherService - , BuilderFactory builderFactory/*FileStorageService fileStorageService, ElasticRepository elasticRepository*/) { - this.applicationContext = applicationContext; - this.remoteFetcherService = remoteFetcherService; - this.builderFactory = builderFactory; -// this.fileStorageService = fileStorageService; -// this.elasticRepository = elasticRepository; - } - - @Override - public ApplicationContext getApplicationContext() { - return applicationContext; - } - - @Override - public RemoteFetcherService getRemoteFetcher() { - return remoteFetcherService; - } - - @Override - public BuilderFactory getBuilderFactory() { - return builderFactory; - } - -// @Override -// public FileStorageService getFileStorageService() { -// return fileStorageService; -// } - -// @Override -// public ElasticRepository getElasticRepository() { -// return elasticRepository; -// } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/types/ParagraphStyle.java b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/types/ParagraphStyle.java deleted file mode 100644 index dc88ef736..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/types/ParagraphStyle.java +++ /dev/null @@ -1,49 +0,0 @@ -package eu.eudat.logic.utilities.documents.types; - -/** - * Created by ikalyvas on 2/26/2018. - */ -public enum ParagraphStyle { - TEXT(0), HEADER1(1), HEADER2(2), HEADER3(3), HEADER4(4), TITLE(5), FOOTER(6), COMMENT(7), HEADER5(8), HEADER6(9), HTML(10), IMAGE(11); - - private Integer value; - - private ParagraphStyle(Integer value) { - this.value = value; - } - - public Integer getValue() { - return value; - } - - public static ParagraphStyle fromInteger(Integer value) { - switch (value) { - case 0: - return TEXT; - case 1: - return HEADER1; - case 2: - return HEADER2; - case 3: - return HEADER3; - case 4: - return HEADER4; - case 5: - return TITLE; - case 6: - return FOOTER; - case 7: - return COMMENT; - case 8: - return HEADER5; - case 9: - return HEADER6; - case 10: - return HTML; - case 11: - return IMAGE; - default: - throw new RuntimeException("Unsupported ParagraphStyle Code"); - } - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/types/TextStyle.java b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/types/TextStyle.java deleted file mode 100644 index 15a85f78b..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/types/TextStyle.java +++ /dev/null @@ -1,31 +0,0 @@ -package eu.eudat.logic.utilities.documents.types; - -/** - * Created by ikalyvas on 2/27/2018. - */ -public enum TextStyle { - ITALIC(0), BOLD(1), CAPS(2); - - private Integer value; - - private TextStyle(Integer value) { - this.value = value; - } - - public Integer getValue() { - return value; - } - - public static TextStyle fromInteger(Integer value) { - switch (value) { - case 0: - return ITALIC; - case 1: - return BOLD; - case 2: - return CAPS; - default: - throw new RuntimeException("Unsupported TextStyle Code"); - } - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/HtmlToWorldBuilder.java b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/HtmlToWorldBuilder.java deleted file mode 100644 index 5badc0f67..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/HtmlToWorldBuilder.java +++ /dev/null @@ -1,289 +0,0 @@ -package eu.eudat.logic.utilities.documents.word; - -import org.apache.poi.xwpf.usermodel.*; -import org.apache.xmlbeans.XmlCursor; -import org.jsoup.nodes.Document; -import org.jsoup.nodes.Node; -import org.jsoup.nodes.TextNode; -import org.jsoup.select.NodeTraversor; -import org.jsoup.select.NodeVisitor; -import org.openxmlformats.schemas.wordprocessingml.x2006.main.*; - -import java.math.BigInteger; -import java.util.*; - -public class HtmlToWorldBuilder implements NodeVisitor { - - private final Map properties = new LinkedHashMap<>(); - private XWPFParagraph paragraph; - private XWPFRun run; - private Boolean dumpRun; - private final float indentation; - private Boolean isIdentationUsed; - private XWPFNumbering numbering; - private Queue abstractNumId; - private BigInteger numberingLevel; - private XmlCursor cursor; - - public static HtmlToWorldBuilder convertInTable(XWPFTableCell document, Document htmlDocument, float indentation) { - XWPFParagraph paragraph = document.addParagraph(); - paragraph.setIndentFromLeft(Math.round(400 * indentation)); - HtmlToWorldBuilder htmlToWorldBuilder = new HtmlToWorldBuilder(paragraph, indentation, null); - NodeTraversor.traverse(htmlToWorldBuilder, htmlDocument); - return htmlToWorldBuilder; - } - - public static HtmlToWorldBuilder convert(XWPFDocument document, Document htmlDocument, float indentation) { - XWPFParagraph paragraph = document.createParagraph(); - paragraph.setIndentFromLeft(Math.round(400 * indentation)); - HtmlToWorldBuilder htmlToWorldBuilder = new HtmlToWorldBuilder(paragraph, indentation, null); - NodeTraversor.traverse(htmlToWorldBuilder, htmlDocument); - return htmlToWorldBuilder; - } - - public HtmlToWorldBuilder(XWPFParagraph paragraph, float indentation, XmlCursor cursor) { - this.paragraph = paragraph; - this.run = this.paragraph.createRun(); - this.dumpRun = false; - this.indentation = indentation; - this.isIdentationUsed = false; - this.run.setFontSize(11); - this.abstractNumId = new ArrayDeque<>(); - this.numberingLevel = BigInteger.valueOf(-1); - this.setDefaultIndentation(); - this.cursor = cursor; - } - - @Override - public void head(Node node, int i) { - String name = node.nodeName(); - if (name.equals("#text")) { - String text = ((TextNode)node).text(); - this.run.setText(text); - this.dumpRun = true; - } else { - properties.put(name, true); - } - if (dumpRun) { - this.run = this.paragraph.createRun(); - this.run.setFontSize(11); - this.dumpRun = false; - } - parseProperties(node); - properties.clear(); - } - - private void parseProperties(Node node) { - properties.entrySet().forEach(stringBooleanEntry -> { - switch (stringBooleanEntry.getKey()) { - case "i" : - case "em": - this.run.setItalic(stringBooleanEntry.getValue()); - break; - case "b": - case "strong": - this.run.setBold(stringBooleanEntry.getValue()); - break; - case "u": - case "ins": - this.run.setUnderline(stringBooleanEntry.getValue() ? UnderlinePatterns.SINGLE : UnderlinePatterns.NONE); - break; - case "small": - this.run.setFontSize(stringBooleanEntry.getValue() ? 8 : 11); - break; - case "del": - case "strike": - case "strikethrough": - case "s": - this.run.setStrikeThrough(stringBooleanEntry.getValue()); - break; - case "mark": - this.run.setTextHighlightColor(stringBooleanEntry.getValue() ? STHighlightColor.YELLOW.toString() : STHighlightColor.NONE.toString()); - break; - case "sub": - this.run.setSubscript(stringBooleanEntry.getValue() ? VerticalAlign.SUBSCRIPT : VerticalAlign.BASELINE); - break; - case "sup": - this.run.setSubscript(stringBooleanEntry.getValue() ? VerticalAlign.SUPERSCRIPT : VerticalAlign.BASELINE); - break; - case "div": - case "p": - if(this.cursor != null) { - this.paragraph = this.paragraph.getDocument().insertNewParagraph(this.cursor); - this.cursor = this.paragraph.getCTP().newCursor(); - this.cursor.toNextSibling(); - } else { - this.paragraph = this.paragraph.getDocument().createParagraph(); - } - this.run = this.paragraph.createRun(); - this.isIdentationUsed = false; - this.setDefaultIndentation(); - if (stringBooleanEntry.getValue()) { - if (node.hasAttr("align")) { - String alignment = node.attr("align"); - this.paragraph.setAlignment(ParagraphAlignment.valueOf(alignment.toUpperCase(Locale.ROOT))); - } - } - break; - case "blockquote": - if(this.cursor != null) { - this.paragraph = this.paragraph.getDocument().insertNewParagraph(this.cursor); - this.cursor = this.paragraph.getCTP().newCursor(); - } else { - this.paragraph = this.paragraph.getDocument().createParagraph(); - } - this.run = this.paragraph.createRun(); - if (stringBooleanEntry.getValue()) { - this.paragraph.setIndentationLeft(400); - } else { - this.isIdentationUsed = false; - this.setDefaultIndentation(); - } - break; - case "ul": - if (stringBooleanEntry.getValue()) { - createNumbering(STNumberFormat.BULLET); - } else { - if(this.cursor != null) { - this.paragraph = this.paragraph.getDocument().insertNewParagraph(this.cursor); - this.cursor = this.paragraph.getCTP().newCursor(); - } else { - this.paragraph = this.paragraph.getDocument().createParagraph(); - } - this.run = this.paragraph.createRun(); - this.isIdentationUsed = false; - this.setDefaultIndentation(); - this.numberingLevel = this.numberingLevel.subtract(BigInteger.ONE); - ((ArrayDeque)this.abstractNumId).removeLast(); - } - break; - case "ol": - if (stringBooleanEntry.getValue()) { - createNumbering(STNumberFormat.DECIMAL); - } else { - if(this.cursor != null) { - this.paragraph = this.paragraph.getDocument().insertNewParagraph(this.cursor); - this.cursor = this.paragraph.getCTP().newCursor(); - } else { - this.paragraph = this.paragraph.getDocument().createParagraph(); - } - this.run = this.paragraph.createRun(); - this.isIdentationUsed = false; - this.setDefaultIndentation(); - this.numberingLevel = this.numberingLevel.subtract(BigInteger.ONE); - ((ArrayDeque)this.abstractNumId).removeLast(); - } - break; - case "li": - if (stringBooleanEntry.getValue()) { - if(this.cursor != null) { - this.paragraph = this.paragraph.getDocument().insertNewParagraph(this.cursor); - this.cursor = this.paragraph.getCTP().newCursor(); - } else { - this.paragraph = this.paragraph.getDocument().createParagraph(); - } - // this.paragraph.setIndentationLeft(Math.round(indentation * 720) * (numberingLevel.intValue() + 1)); - this.paragraph.setIndentFromLeft(Math.round(numberingLevel.intValue() * 400 + this.indentation*400)); - this.run = this.paragraph.createRun(); - this.paragraph.setNumID(((ArrayDeque)abstractNumId).getLast()); - } - break; - case "font": - if (stringBooleanEntry.getValue()) { - if (node.hasAttr("color")) { - this.run.setColor(node.attr("color").substring(1)); - } - } else { - this.run.setColor("000000"); - } - break; - case "a": - if (stringBooleanEntry.getValue()) { - if (node.hasAttr("href")) { - this.run = createHyperLinkRun(node.attr("href")); - this.run.setColor("0000FF"); - this.run.setUnderline(UnderlinePatterns.SINGLE); - } - } else { - this.run = paragraph.createRun(); - } - break; - case "br": - if (stringBooleanEntry.getValue()) { - this.run.addBreak(); - } - break; - } - }); - } - - @Override - public void tail(Node node, int i) { - String name = node.nodeName(); - properties.put(name, false); - parseProperties(node); - properties.clear(); - } - - //GK: This function creates one numbering.xml for the word document and adds a specific format. - //It imitates the numbering.xml that is usually generated by word editors like LibreOffice - private void createNumbering(STNumberFormat.Enum format) { - CTAbstractNum ctAbstractNum = CTAbstractNum.Factory.newInstance(); - if (this.numbering == null) this.numbering = this.paragraph.getDocument().createNumbering(); - BigInteger tempNumId = BigInteger.ONE; - boolean found = false; - while (!found) { - Object o = numbering.getAbstractNum(tempNumId); - found = (o == null); - if (!found) tempNumId = tempNumId.add(BigInteger.ONE); - } - ctAbstractNum.setAbstractNumId(tempNumId); - CTLvl ctLvl = ctAbstractNum.addNewLvl(); - this.numberingLevel = numberingLevel.add(BigInteger.ONE); - ctLvl.setIlvl(numberingLevel); - ctLvl.addNewNumFmt().setVal(format); - ctLvl.addNewStart().setVal(BigInteger.ONE); - if (format == STNumberFormat.BULLET) { - ctLvl.addNewLvlJc().setVal(STJc.LEFT); - ctLvl.addNewLvlText().setVal("\u2022"); - ctLvl.addNewRPr(); //Set the Symbol font - CTFonts f = ctLvl.getRPr().addNewRFonts(); - f.setAscii("Symbol"); - f.setHAnsi("Symbol"); - f.setCs("Symbol"); - f.setHint(STHint.DEFAULT); - } else { - ctLvl.addNewLvlText().setVal("%1."); - } - XWPFAbstractNum xwpfAbstractNum = new XWPFAbstractNum(ctAbstractNum); - - this.abstractNumId.add(this.numbering.addAbstractNum(xwpfAbstractNum)); - this.numbering.addNum(((ArrayDeque)abstractNumId).getLast()); - } - - private XWPFHyperlinkRun createHyperLinkRun(String uri) { - String rId = this.paragraph.getDocument().getPackagePart().addExternalRelationship(uri, XWPFRelation.HYPERLINK.getRelation()).getId(); - - CTHyperlink cthyperLink=paragraph.getCTP().addNewHyperlink(); - cthyperLink.setId(rId); - cthyperLink.addNewR(); - - return new XWPFHyperlinkRun( - cthyperLink, - cthyperLink.getRArray(0), - paragraph - ); - } - - private void setDefaultIndentation() { - if (!isIdentationUsed) { -// this.paragraph.setIndentationLeft(Math.round(indentation * 720.0F)); - this.paragraph.setIndentFromLeft(Math.round(indentation * 400)); - this.isIdentationUsed = true; - } - } - - public XWPFParagraph getParagraph() { - return paragraph; - } -} 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 deleted file mode 100644 index 2f0b91fa4..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/WordBuilder.java +++ /dev/null @@ -1,1160 +0,0 @@ -package eu.eudat.logic.utilities.documents.word; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import eu.eudat.commons.types.descriptiontemplate.fielddata.*; -import eu.eudat.data.DescriptionEntity; -import eu.eudat.data.DmpEntity; -import eu.eudat.logic.proxy.config.configloaders.ConfigLoader; -import eu.eudat.logic.services.forms.VisibilityRuleService; -import eu.eudat.logic.utilities.documents.types.ParagraphStyle; -import eu.eudat.logic.utilities.interfaces.ApplierWithValue; -import eu.eudat.logic.utilities.json.JavaToJson; -import eu.eudat.models.data.pid.PidLink; -import eu.eudat.models.data.user.components.datasetprofile.Field; -import eu.eudat.models.data.user.components.datasetprofile.FieldSet; -import eu.eudat.models.data.user.components.datasetprofile.Section; -import eu.eudat.models.data.user.composite.DatasetProfilePage; -import eu.eudat.models.data.user.composite.PagedDatasetProfile; -import org.apache.poi.openxml4j.exceptions.InvalidFormatException; -import org.apache.poi.util.Units; -import org.apache.poi.xwpf.usermodel.*; -import org.apache.xmlbeans.XmlCursor; -import org.json.JSONArray; -import org.json.JSONException; -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; -import org.jsoup.select.NodeTraversor; -import org.openxmlformats.schemas.wordprocessingml.x2006.main.*; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.core.env.Environment; - -import javax.imageio.ImageIO; -import javax.imageio.ImageReader; -import javax.imageio.stream.ImageInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.math.BigInteger; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.time.Instant; -import java.time.LocalDate; -import java.time.ZoneId; -import java.time.ZoneOffset; -import java.time.format.DateTimeFormatter; -import java.time.format.DateTimeParseException; -import java.util.*; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static org.apache.poi.xwpf.usermodel.Document.*; - -public class WordBuilder { - private static final Logger logger = LoggerFactory.getLogger(WordBuilder.class); - private static final Map IMAGE_TYPE_MAP = Stream.of(new Object[][] { - {"image/jpeg", PICTURE_TYPE_JPEG}, - {"image/png", PICTURE_TYPE_PNG}, - {"image/gif", PICTURE_TYPE_GIF}, - {"image/tiff", PICTURE_TYPE_TIFF}, - {"image/bmp", PICTURE_TYPE_BMP}, - {"image/wmf", PICTURE_TYPE_WMF} - } - ).collect(Collectors.toMap(objects -> (String)objects[0], o -> (Integer)o[1])); - - private Map> options = new HashMap<>(); - private Map> optionsInTable = new HashMap<>(); - private CTAbstractNum cTAbstractNum; - private BigInteger numId; - private Integer indent; - private final ObjectMapper mapper; - private Integer imageCount; - private ConfigLoader configLoader; - - public WordBuilder(Environment environment, ConfigLoader configLoader) { - this.cTAbstractNum = CTAbstractNum.Factory.newInstance(); - this.cTAbstractNum.setAbstractNumId(BigInteger.valueOf(1)); - this.indent = 0; - this.imageCount = 0; - this.mapper = new ObjectMapper(); - this.buildOptions(environment); - this.buildOptionsInTable(environment); - this.configLoader = configLoader; - } - - private void buildOptionsInTable(Environment environment) { - this.optionsInTable.put(ParagraphStyle.TEXT, (mainDocumentPart, item) -> { - XWPFParagraph paragraph = mainDocumentPart.addParagraph(); - XWPFRun run = paragraph.createRun(); - if (item != null) - run.setText("" + item); - run.setFontSize(11); - return paragraph; - }); - this.optionsInTable.put(ParagraphStyle.HTML, (mainDocumentPart, item) -> { - Document htmlDoc = Jsoup.parse(((String)item).replaceAll("\n", "
")); - HtmlToWorldBuilder htmlToWorldBuilder = HtmlToWorldBuilder.convertInTable(mainDocumentPart, htmlDoc, 0); - return htmlToWorldBuilder.getParagraph(); - }); - this.optionsInTable.put(ParagraphStyle.TITLE, (mainDocumentPart, item) -> { - XWPFParagraph paragraph = mainDocumentPart.addParagraph(); - paragraph.setStyle("Title"); - paragraph.setAlignment(ParagraphAlignment.CENTER); - XWPFRun run = paragraph.createRun(); - run.setText((String)item); - run.setBold(true); - run.setFontSize(14); - return paragraph; - }); - this.optionsInTable.put(ParagraphStyle.IMAGE, (mainDocumentPart, item) -> { - XWPFParagraph paragraph = mainDocumentPart.addParagraph(); - XWPFRun run = paragraph.createRun(); - if (item != null) - run.setText(((Map)item).get("name")); - run.setFontSize(11); - run.setItalic(true); - return paragraph; - }); - } - - private void buildOptions(Environment environment) { - this.options.put(ParagraphStyle.TEXT, (mainDocumentPart, item) -> { - XWPFParagraph paragraph = mainDocumentPart.createParagraph(); - XWPFRun run = paragraph.createRun(); - if (item != null) - run.setText("" + item); - run.setFontSize(11); - return paragraph; - }); - this.options.put(ParagraphStyle.HTML, (mainDocumentPart, item) -> { - Document htmlDoc = Jsoup.parse(((String)item).replaceAll("\n", "
")); - HtmlToWorldBuilder htmlToWorldBuilder = HtmlToWorldBuilder.convert(mainDocumentPart, htmlDoc, this.indent); - return htmlToWorldBuilder.getParagraph(); - }); - this.options.put(ParagraphStyle.TITLE, (mainDocumentPart, item) -> { - XWPFParagraph paragraph = mainDocumentPart.createParagraph(); - paragraph.setStyle("Title"); - paragraph.setAlignment(ParagraphAlignment.CENTER); - XWPFRun run = paragraph.createRun(); - run.setText((String)item); - run.setBold(true); - run.setFontSize(14); - return paragraph; - }); - this.options.put(ParagraphStyle.HEADER1, (mainDocumentPart, item) -> { - XWPFParagraph paragraph = mainDocumentPart.createParagraph(); - paragraph.setStyle("Heading1"); - XWPFRun run = paragraph.createRun(); - run.setText((String)item); -// run.setBold(true); -// run.setFontSize(12); -// run.setStyle("0"); - return paragraph; - }); - this.options.put(ParagraphStyle.HEADER2, (mainDocumentPart, item) -> { - XWPFParagraph paragraph = mainDocumentPart.createParagraph(); - paragraph.setStyle("Heading2"); - XWPFRun run = paragraph.createRun(); - run.setText("" + item); -// run.setBold(true); -// run.setFontSize(12); - return paragraph; - }); - this.options.put(ParagraphStyle.HEADER3, (mainDocumentPart, item) -> { - XWPFParagraph paragraph = mainDocumentPart.createParagraph(); - paragraph.setStyle("Heading3"); - XWPFRun run = paragraph.createRun(); - run.setText("" + item); -// run.setBold(true); -// run.setFontSize(11); - return paragraph; - }); - this.options.put(ParagraphStyle.HEADER4, (mainDocumentPart, item) -> { - XWPFParagraph paragraph = mainDocumentPart.createParagraph(); - paragraph.setStyle("Heading4"); - XWPFRun run = paragraph.createRun(); - run.setText((String)item); - return paragraph; - }); - this.options.put(ParagraphStyle.HEADER5, (mainDocumentPart, item) -> { - XWPFParagraph paragraph = mainDocumentPart.createParagraph(); - paragraph.setStyle("Heading5"); - XWPFRun run = paragraph.createRun(); - run.setText("" + item); - return paragraph; - }); - this.options.put(ParagraphStyle.HEADER6, (mainDocumentPart, item) -> { - XWPFParagraph paragraph = mainDocumentPart.createParagraph(); - paragraph.setStyle("Heading6"); - XWPFRun run = paragraph.createRun(); - run.setText("" + item); - return paragraph; - }); - this.options.put(ParagraphStyle.FOOTER, (mainDocumentPart, item) -> { - XWPFParagraph paragraph = mainDocumentPart.createParagraph(); - XWPFRun run = paragraph.createRun(); - run.setText((String)item); - return paragraph; - }); - this.options.put(ParagraphStyle.COMMENT, (mainDocumentPart, item) -> { - XWPFParagraph paragraph = mainDocumentPart.createParagraph(); - XWPFRun run = paragraph.createRun(); - run.setText("" + item); - run.setItalic(true); - return paragraph; - }); - this.options.put(ParagraphStyle.IMAGE, (mainDocumentPart, item) -> { - XWPFParagraph paragraph = mainDocumentPart.createParagraph(); - paragraph.setPageBreak(true); - paragraph.setSpacingAfter(0); - paragraph.setAlignment(ParagraphAlignment.CENTER); //GK: Center the image if it is too small - XWPFRun run = paragraph.createRun(); - String imageId = ((Map)item).get("id"); - String fileName = ((Map)item).get("name"); - String fileType = ((Map)item).get("type"); - int format; - format = IMAGE_TYPE_MAP.getOrDefault(fileType, 0); - try { - FileInputStream image = new FileInputStream(environment.getProperty("file.storage") + imageId); - ImageInputStream iis = ImageIO.createImageInputStream(new File(environment.getProperty("file.storage") + imageId)); - Iterator readers = ImageIO.getImageReaders(iis); - if (readers.hasNext()) { - ImageReader reader = readers.next(); - reader.setInput(iis); - - int initialImageWidth = reader.getWidth(0); - int initialImageHeight = reader.getHeight(0); - - float ratio = initialImageHeight / (float)initialImageWidth; - - int marginLeftInDXA = mainDocumentPart.getDocument().getBody().getSectPr().getPgMar().getLeft().intValue(); - int marginRightInDXA = mainDocumentPart.getDocument().getBody().getSectPr().getPgMar().getRight().intValue(); - int pageWidthInDXA = mainDocumentPart.getDocument().getBody().getSectPr().getPgSz().getW().intValue(); - int pageWidth = Math.round((pageWidthInDXA - marginLeftInDXA - marginRightInDXA) / (float)20); // /20 converts dxa to points - - int imageWidth = Math.round(initialImageWidth*(float)0.75); // *0.75 converts pixels to points - int width = Math.min(imageWidth, pageWidth); - - int marginTopInDXA = mainDocumentPart.getDocument().getBody().getSectPr().getPgMar().getTop().intValue(); - int marginBottomInDXA = mainDocumentPart.getDocument().getBody().getSectPr().getPgMar().getBottom().intValue(); - int pageHeightInDXA = mainDocumentPart.getDocument().getBody().getSectPr().getPgSz().getH().intValue(); - int pageHeight = Math.round((pageHeightInDXA - marginTopInDXA - marginBottomInDXA) / (float)20); // /20 converts dxa to points - - int imageHeight = Math.round(initialImageHeight * ((float)0.75)); // *0.75 converts pixels to points - - int height = Math.round(width*ratio); - if(height > pageHeight) { - // height calculated with ratio is too large. Image may have Portrait (vertical) orientation. Recalculate image dimensions. - height = Math.min(imageHeight, pageHeight); - width = Math.round(height/ratio); - } - - XWPFPicture picture = run.addPicture(image, format, fileName, Units.toEMU(width), Units.toEMU(height)); - paragraph.setPageBreak(false); - imageCount++; - XWPFParagraph captionParagraph = mainDocumentPart.createParagraph(); - captionParagraph.setAlignment(ParagraphAlignment.CENTER); - captionParagraph.setSpacingBefore(0); - captionParagraph.setStyle("Caption"); - XWPFRun captionRun = captionParagraph.createRun(); - captionRun.setText("Image " + imageCount); - - } - } catch (IOException | InvalidFormatException e){ - logger.error(e.getMessage(), e); - } - return paragraph; - }); - } - - public XWPFDocument build(XWPFDocument document, PagedDatasetProfile pagedDatasetProfile, VisibilityRuleService visibilityRuleService) throws IOException { -// createPages(pagedDatasetProfile.getPages(), document, true, visibilityRuleService); -// XWPFNumbering numbering = document.createNumbering(); -// BigInteger tempNumId = BigInteger.ONE; -// boolean found = false; -// while (!found) { -// Object o = numbering.getAbstractNum(tempNumId); -// found = (o == null); -// if (!found) tempNumId = tempNumId.add(BigInteger.ONE); -// } -// cTAbstractNum.setAbstractNumId(tempNumId); -// XWPFAbstractNum abstractNum = new XWPFAbstractNum(cTAbstractNum); -// BigInteger abstractNumID = numbering.addAbstractNum(abstractNum); -// this.numId = numbering.addNum(abstractNumID); - - createPages(pagedDatasetProfile.getPages(), document, false, visibilityRuleService); - return document; - } - - private void createPages(List datasetProfilePages, XWPFDocument mainDocumentPart, Boolean createListing, VisibilityRuleService visibilityRuleService) { - datasetProfilePages.forEach(item -> { - try { - createSections(item.getSections(), mainDocumentPart, ParagraphStyle.HEADER5, 0, createListing, visibilityRuleService, item.getOrdinal() + 1, null); - } catch (Exception e) { - logger.error(e.getMessage(), e); - } - }); - } - - private void createSections(List
sections, XWPFDocument mainDocumentPart, ParagraphStyle style, Integer indent, Boolean createListing, VisibilityRuleService visibilityRuleService, Integer page, String sectionString) { - if (createListing) this.addListing(mainDocumentPart, indent, false, true); - boolean hasValue = false; - for (Section section: sections) { - int paragraphPos = -1; - String tempSectionString = sectionString != null ? sectionString + "." + (section.getOrdinal() + 1) : "" + (section.getOrdinal() + 1); - if (visibilityRuleService.isElementVisible(section.getId())) { - if (!createListing) { - XWPFParagraph paragraph = addParagraphContent(page + "." + tempSectionString + " " + section.getTitle(), mainDocumentPart, style, numId, indent); -// CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl(); -// number.setVal(BigInteger.valueOf(indent)); - paragraphPos = mainDocumentPart.getPosOfParagraph(paragraph); - } - createSections(section.getSections(), mainDocumentPart, ParagraphStyle.HEADER5, indent+1, createListing, visibilityRuleService, page, tempSectionString); - hasValue = createCompositeFields(section.getCompositeFields(), mainDocumentPart, indent+1, createListing, visibilityRuleService, page, tempSectionString); - - if (!hasValue && paragraphPos > -1) { - mainDocumentPart.removeBodyElement(paragraphPos); - } - } - } - } - - private Boolean createCompositeFields(List
compositeFields, XWPFDocument mainDocumentPart, Integer indent, Boolean createListing, VisibilityRuleService visibilityRuleService, Integer page, String section) { - if (createListing) this.addListing(mainDocumentPart, indent, true, true); - boolean hasValue = false; - boolean returnedValue = false; - - for (FieldSet compositeField: compositeFields) { - if (visibilityRuleService.isElementVisible(compositeField.getId()) && hasVisibleFields(compositeField, visibilityRuleService)) { - char c = 'a'; - int multiplicityItems = 0; - boolean hasMultiplicityItems = false; - int paragraphPos = -1; - int paragraphPosInner = -1; - if (compositeField.getTitle() != null && !compositeField.getTitle().isEmpty() && !createListing) { - XWPFParagraph paragraph = addParagraphContent(page + "." + section + "." + (compositeField.getOrdinal() +1) + " " + compositeField.getTitle(), mainDocumentPart, ParagraphStyle.HEADER6, numId, indent); -// CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl(); -// number.setVal(BigInteger.valueOf(indent)); - paragraphPos = mainDocumentPart.getPosOfParagraph(paragraph); - if(!compositeField.getMultiplicity().getTableView() && compositeField.getMultiplicityItems() != null && !compositeField.getMultiplicityItems().isEmpty()){ - XWPFParagraph paragraphInner = addParagraphContent(c + ". ", mainDocumentPart, ParagraphStyle.TEXT, numId, indent); - paragraphPosInner = mainDocumentPart.getPosOfParagraph(paragraphInner); - hasMultiplicityItems = true; - multiplicityItems++; - } - } - XWPFTable tbl = null; - XWPFTableRow row = null; - int numOfRows = 0; - if(compositeField.getMultiplicity().getTableView()) { - tbl = mainDocumentPart.createTable(); - tbl.setTableAlignment(TableRowAlign.CENTER); - mainDocumentPart.createParagraph(); - createHeadersInTable(compositeField.getFields(), tbl, visibilityRuleService); - numOfRows = tbl.getRows().size(); - row = tbl.createRow(); - } - if(compositeField.getMultiplicity().getTableView()) { - hasValue = createFieldsInTable(compositeField.getFields(), row, indent, createListing, visibilityRuleService, hasMultiplicityItems, numOfRows); - numOfRows++; - } else { - hasValue = createFields(compositeField.getFields(), mainDocumentPart, indent, createListing, visibilityRuleService, hasMultiplicityItems); - } - if(hasValue){ - returnedValue = true; - } else if(paragraphPosInner > -1){ - mainDocumentPart.removeBodyElement(paragraphPosInner); - c--; - multiplicityItems--; - } - if (compositeField.getMultiplicityItems() != null && !compositeField.getMultiplicityItems().isEmpty()) { - List
list = compositeField.getMultiplicityItems().stream().sorted(Comparator.comparingInt(FieldSet::getOrdinal)).collect(Collectors.toList()); - for (FieldSet multiplicityFieldset : list) { - paragraphPosInner = -1; - if(!compositeField.getMultiplicity().getTableView() && !createListing){ - c++; -// addParagraphContent(c + ". ", mainDocumentPart, ParagraphStyle.HEADER6, numId); - XWPFParagraph paragraphInner = addParagraphContent(c + ". ", mainDocumentPart, ParagraphStyle.TEXT, numId, indent); - paragraphPosInner = mainDocumentPart.getPosOfParagraph(paragraphInner); - hasMultiplicityItems = true; - multiplicityItems++; - } -// hasValue = createFields(multiplicityFieldset.getFields(), mainDocumentPart, 3, createListing, visibilityRuleService, hasMultiplicityItems); - boolean hasValueInner = false; - if(compositeField.getMultiplicity().getTableView()) { - row = tbl.createRow(); - hasValueInner = createFieldsInTable(multiplicityFieldset.getFields(), row, indent, createListing, visibilityRuleService, hasMultiplicityItems, numOfRows); - numOfRows++; - } else { - hasValueInner = createFields(multiplicityFieldset.getFields(), mainDocumentPart, indent, createListing, visibilityRuleService, hasMultiplicityItems); - } -// if(hasValue){ - if(hasValueInner){ - hasValue = true; - returnedValue = true; - } else if(paragraphPosInner > -1){ - mainDocumentPart.removeBodyElement(paragraphPosInner); - c--; - multiplicityItems--; - } - } - if(multiplicityItems == 1) { - String text = mainDocumentPart.getLastParagraph().getRuns().get(0).getText(0); - if(text.equals("a. ")) { - mainDocumentPart.getLastParagraph().removeRun(0); - } - } - } - //TODO: Dataset Profile -// if (hasValue && compositeField.getHasCommentField() && compositeField.getCommentFieldValue() != null && !compositeField.getCommentFieldValue().isEmpty() && !createListing) { -// XWPFParagraph paragraph = addParagraphContent("Comment:\n"+compositeField.getCommentFieldValue(), mainDocumentPart, ParagraphStyle.HTML, numId, indent); -//// CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl(); -//// number.setVal(BigInteger.valueOf(indent)); -// } - if (!hasValue && paragraphPos > -1) { - mainDocumentPart.removeBodyElement(paragraphPos); - } - } - } - - return returnedValue; - } - - private void createHeadersInTable(List fields, XWPFTable table, VisibilityRuleService visibilityRuleService) { - boolean atLeastOneHeader = false; - List tempFields = fields.stream().sorted(Comparator.comparingInt(Field::getOrdinal)).collect(Collectors.toList()); - int index = 0; - XWPFTableRow row = table.getRow(0); - for (Field field: tempFields) { - if (visibilityRuleService.isElementVisible(field.getId()) && field.getExport()) { - XWPFTableCell cell; - if(index == 0) { - cell = row.getCell(0); - } else { - cell = row.createCell(); - } - cell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.valueOf("CENTER")); - String label = ((BaseFieldDataEntity) field.getData()).getLabel(); - if(label != null && label != "") { - XWPFParagraph paragraph = cell.getParagraphs().get(0); - paragraph.setIndentationFirstLine(50); - XWPFRun run = paragraph.createRun(); - run.setText(label); - run.setBold(true); - run.setFontSize(12); - paragraph.setAlignment(ParagraphAlignment.CENTER); - paragraph.setSpacingBefore(100); - - atLeastOneHeader = true; - } - } - index++; - } - - if(!atLeastOneHeader) { - table.removeRow(0); - } - } - - private Boolean createFieldsInTable(List fields, XWPFTableRow mainDocumentPart, Integer indent, Boolean createListing, VisibilityRuleService visibilityRuleService, boolean hasMultiplicityItems, int numOfRows) { - int numOfCells = 0; - boolean hasValue = false; - List tempFields = fields.stream().sorted(Comparator.comparingInt(Field::getOrdinal)).collect(Collectors.toList()); - for (Field field: tempFields) { - if (visibilityRuleService.isElementVisible(field.getId()) && field.getExport()) { - if (!createListing) { - try { - if(field.getViewStyle().getFieldType().equals("upload")){ - boolean isImage = false; - for(UploadDataEntity.UploadDataOptionEntity type: ((UploadDataEntity)field.getData()).getTypes()){ - String fileFormat = type.getValue(); - if(IMAGE_TYPE_MAP.containsKey(fileFormat)){ - isImage = true; - break; - } - } - if(isImage){ - if (field.getValue() != null && !field.getValue().toString().isEmpty()) { - XWPFParagraph paragraph = addCellContent(mapper.convertValue(field.getValue(), Map.class), mainDocumentPart, ParagraphStyle.IMAGE, numId, 0, numOfRows, numOfCells, 0); - if (paragraph != null) { - hasValue = true; - } - if(hasMultiplicityItems){ - hasMultiplicityItems = false; - } - } - } - } - else if (field.getValue() != null && !field.getValue().toString().isEmpty()) { - this.indent = indent; - String format = this.formatter(field); - if (field.getViewStyle().getFieldType().equals("tags")) { - format = getCommaSeparatedFormatsFromJson(format, "name"); - } else if (field.getViewStyle().getFieldType().equals("combobox") && field.getData() instanceof ExternalSelectDataEntity) { - format = getCommaSeparatedFormatsFromJson(format, "label"); - } - boolean isResearcher = field.getViewStyle().getFieldType().equals("researchers"); - if(format != null && !format.isEmpty()){ - Object hasMultiAutoComplete = mapper.convertValue(field.getData(), Map.class).get("multiAutoComplete"); - boolean isMultiAutoComplete = hasMultiAutoComplete != null && (boolean)hasMultiAutoComplete; - boolean arrayStringFormat = format.charAt(0) == '['; - if(arrayStringFormat || isMultiAutoComplete){ - List values = (arrayStringFormat) ? Arrays.asList(format.substring(1, format.length() - 1).split(",[ ]*")) : Arrays.asList(format.split(",[ ]*")); - if(values.size() > 1) { - boolean orcidResearcher; - int numOfValuesInCell = 0; - for (String val : values) { - orcidResearcher = false; - String orcId = null; - if(isResearcher && val.contains("orcid:")){ - orcId = val.substring(val.indexOf(':') + 1, val.indexOf(')')); - val = val.substring(0, val.indexOf(':') + 1) + " "; - orcidResearcher = true; - } - format = "• " + val; - if(hasMultiplicityItems){ - XWPFParagraph paragraph = mainDocumentPart.getCell(mainDocumentPart.getTableCells().size()).addParagraph(); - paragraph.createRun().setText(format); - if(orcidResearcher){ - XWPFHyperlinkRun run = paragraph.createHyperlinkRun("https://orcid.org/" + orcId); - run.setText(orcId); - run.setUnderline(UnderlinePatterns.SINGLE); - run.setColor("0000FF"); - paragraph.createRun().setText(")"); - } - hasMultiplicityItems = false; - } - else{ - XWPFParagraph paragraph = addCellContent(format, mainDocumentPart, field.getViewStyle().getFieldType().equals("richTextarea") ? ParagraphStyle.HTML : ParagraphStyle.TEXT, numId, indent, numOfRows, numOfCells, numOfValuesInCell); - numOfValuesInCell++; - if(orcidResearcher){ - XWPFHyperlinkRun run = paragraph.createHyperlinkRun("https://orcid.org/" + orcId); - run.setText(orcId); - run.setUnderline(UnderlinePatterns.SINGLE); - run.setColor("0000FF"); - paragraph.createRun().setText(")"); - } - if (paragraph != null) { - hasValue = true; - } - } - format = null; - } - } - else if(values.size() == 1){ - format = values.get(0); - } - } - } - if(hasMultiplicityItems && format != null){ - XWPFParagraph paragraph = mainDocumentPart.getCell(mainDocumentPart.getTableCells().size()).addParagraph(); - paragraph.createRun().setText(format); - hasMultiplicityItems = false; - hasValue = true; - } - else{ - XWPFParagraph paragraph = addCellContent(format, mainDocumentPart, field.getViewStyle().getFieldType().equals("richTextarea") ? ParagraphStyle.HTML : ParagraphStyle.TEXT, numId, indent, numOfRows, numOfCells, 0); - if (paragraph != null) { - hasValue = true; - } - } - } - } catch (IOException e) { - logger.error(e.getMessage(), e); - } - } - numOfCells++; - } - } - return hasValue; - } - - private void createHypeLink(XWPFDocument mainDocumentPart, String format, String pidType, String pid, boolean hasMultiplicityItems, boolean isMultiAutoComplete){ - PidLink pidLink = this.configLoader.getPidLinks().getPidLinks().stream().filter(pl -> pl.getPid().equals(pidType)).findFirst().orElse(null); - if (pidLink != null) { - if (!hasMultiplicityItems) { - XWPFParagraph paragraph = mainDocumentPart.createParagraph(); - paragraph.setIndentFromLeft(400 * indent); - if (numId != null) { - paragraph.setNumID(numId); - } - } - if (isMultiAutoComplete) { - XWPFRun r = mainDocumentPart.getLastParagraph().createRun(); - r.setText("• "); - } - XWPFHyperlinkRun run = mainDocumentPart.getLastParagraph().createHyperlinkRun(pidLink.getLink().replace("{pid}", pid)); - run.setText(format); - run.setUnderline(UnderlinePatterns.SINGLE); - run.setColor("0000FF"); - run.setFontSize(11); - } - else { - String newFormat = (isMultiAutoComplete) ? "• " + format : format; - if (hasMultiplicityItems) { - mainDocumentPart.getLastParagraph().createRun().setText(newFormat); - } - else { - addParagraphContent(newFormat, mainDocumentPart, ParagraphStyle.TEXT, numId, indent); - } - } - } - - private Boolean createFields(List fields, XWPFDocument mainDocumentPart, Integer indent, Boolean createListing, VisibilityRuleService visibilityRuleService, boolean hasMultiplicityItems) { - if (createListing) this.addListing(mainDocumentPart, indent, false, false); - boolean hasValue = false; - List tempFields = fields.stream().sorted(Comparator.comparingInt(Field::getOrdinal)).collect(Collectors.toList()); - for (Field field: tempFields) { - if (visibilityRuleService.isElementVisible(field.getId()) && field.getExport()) { - if (!createListing) { - try { - if(field.getViewStyle().getFieldType().equals("upload")){ - boolean isImage = false; - for(UploadDataEntity.UploadDataOptionEntity type: ((UploadDataEntity)field.getData()).getTypes()){ - String fileFormat = type.getValue(); - if(IMAGE_TYPE_MAP.containsKey(fileFormat)){ - isImage = true; - break; - } - } - if(isImage){ - if (field.getValue() != null && !field.getValue().toString().isEmpty()) { - XWPFParagraph paragraph = addParagraphContent(mapper.convertValue(field.getValue(), Map.class), mainDocumentPart, ParagraphStyle.IMAGE, numId, 0); - if (paragraph != null) { -// CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl(); -// number.setVal(BigInteger.valueOf(indent)); - hasValue = true; - } - if(hasMultiplicityItems){ - hasMultiplicityItems = false; - } - } - } - } - else if (field.getValue() != null && !field.getValue().toString().isEmpty()) { - this.indent = indent; - String format = this.formatter(field); - if (field.getViewStyle().getFieldType().equals("tags")) { - format = getCommaSeparatedFormatsFromJson(format, "name"); - } else if (field.getViewStyle().getFieldType().equals("combobox") && field.getData() instanceof ExternalSelectDataEntity) { - format = getCommaSeparatedFormatsFromJson(format, "label"); - } - switch (field.getViewStyle().getFieldType().getValue()) { - case "organizations": - case "externalDatasets": - case "publications": - if(format != null && !format.isEmpty()){ - Object hasMultiAutoComplete = mapper.convertValue(field.getData(), Map.class).get("multiAutoComplete"); - boolean isMultiAutoComplete = hasMultiAutoComplete != null && (boolean)hasMultiAutoComplete; - if(!isMultiAutoComplete){ - Map value = mapper.readValue((String)field.getValue(), Map.class); - if(hasMultiplicityItems){ - createHypeLink(mainDocumentPart, format, value.get("pidTypeField"), value.get("pid"), true, false); - hasMultiplicityItems = false; - } - else{ - createHypeLink(mainDocumentPart, format, value.get("pidTypeField"), value.get("pid"), false, false); - } - } - else{ - mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); - List> values = new ArrayList<>(); - try { - values = Arrays.asList(mapper.readValue(field.getValue().toString(), HashMap[].class)); - } - catch (Exception e) { - Map map = new HashMap<>(); - map.put("label", field.getValue()); - values.add(map); - } - if (values.size() > 1) { - for (Map value : values) { - if(hasMultiplicityItems){ - createHypeLink(mainDocumentPart, (String) value.get("name"), (String) value.get("pidTypeField"), (String) value.get("pid"), true, true); - hasMultiplicityItems = false; - } - else{ - createHypeLink(mainDocumentPart, (String) value.get("name"), (String) value.get("pidTypeField"), (String) value.get("pid"), false, true); - } - } - } - else if(values.size() == 1){ - if(hasMultiplicityItems){ - createHypeLink(mainDocumentPart, format, (String) values.get(0).get("pidTypeField"), (String) values.get(0).get("pid"), true, false); - hasMultiplicityItems = false; - } - else{ - createHypeLink(mainDocumentPart, format, (String) values.get(0).get("pidTypeField"), (String) values.get(0).get("pid"), false, false); - } - } - } - hasValue = true; - } - break; - default: - boolean isResearcher = field.getViewStyle().getFieldType().equals("researchers"); - if(format != null && !format.isEmpty()){ - Object hasMultiAutoComplete = mapper.convertValue(field.getData(), Map.class).get("multiAutoComplete"); - boolean isMultiAutoComplete = hasMultiAutoComplete != null && (boolean)hasMultiAutoComplete; - boolean arrayStringFormat = format.charAt(0) == '['; - if(arrayStringFormat || isMultiAutoComplete){ - List values = (arrayStringFormat) ? Arrays.asList(format.substring(1, format.length() - 1).split(",[ ]*")) : Arrays.asList(format.split(",[ ]*")); - if(values.size() > 1) { - boolean orcidResearcher; - for (String val : values) { - orcidResearcher = false; - String orcId = null; - if(isResearcher && val.contains("orcid:")){ - orcId = val.substring(val.indexOf(':') + 1, val.indexOf(')')); - val = val.substring(0, val.indexOf(':') + 1) + " "; - orcidResearcher = true; - } - format = "• " + val; - if(hasMultiplicityItems){ - mainDocumentPart.getLastParagraph().createRun().setText(format); - if(orcidResearcher){ - XWPFHyperlinkRun run = mainDocumentPart.getLastParagraph().createHyperlinkRun("https://orcid.org/" + orcId); - run.setText(orcId); - run.setUnderline(UnderlinePatterns.SINGLE); - run.setColor("0000FF"); - mainDocumentPart.getLastParagraph().createRun().setText(")"); - } - hasMultiplicityItems = false; - } - else{ - XWPFParagraph paragraph = addParagraphContent(format, mainDocumentPart, field.getViewStyle().getFieldType().equals("richTextarea") ? ParagraphStyle.HTML : ParagraphStyle.TEXT, numId, indent); - if(orcidResearcher){ - XWPFHyperlinkRun run = paragraph.createHyperlinkRun("https://orcid.org/" + orcId); - run.setText(orcId); - run.setUnderline(UnderlinePatterns.SINGLE); - run.setColor("0000FF"); - paragraph.createRun().setText(")"); - } - if (paragraph != null) { -// CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl(); -// number.setVal(BigInteger.valueOf(indent)); - hasValue = true; - } - } - format = null; - } - } - else if(values.size() == 1){ - format = values.get(0); - } - } - } - if (format != null) { - if (hasMultiplicityItems) { - mainDocumentPart.getLastParagraph().createRun().setText(format); - hasMultiplicityItems = false; - hasValue = true; - } - else { - XWPFParagraph paragraph = addParagraphContent(format, mainDocumentPart, field.getViewStyle().getFieldType().equals("richTextarea") ? ParagraphStyle.HTML : ParagraphStyle.TEXT, numId, indent); - if (paragraph != null) { -// CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl(); -// number.setVal(BigInteger.valueOf(indent)); - hasValue = true; - } - } - } - } - } - } catch (IOException e) { - logger.error(e.getMessage(), e); - } - } - } - } - return hasValue; - } - - private String getCommaSeparatedFormatsFromJson(String format, String attribute){ - if((format == null || format.isEmpty()) || (attribute == null || attribute.isEmpty())){ - return null; - } - try { - JSONArray array = new JSONArray(JavaToJson.objectStringToJson(format)); - StringBuilder multipleFormats = new StringBuilder(); - for (int i = 0; i < array.length(); i++) { - multipleFormats.append(array.getJSONObject(i).getString(attribute)).append(", "); - } - if (multipleFormats.length() > 0) { - multipleFormats.setLength(multipleFormats.length() - 2); - } - return multipleFormats.toString(); - } catch (JSONException e) { - return format; - } - } - - public XWPFParagraph addCellContent(Object content, XWPFTableRow mainDocumentPart, ParagraphStyle style, BigInteger numId, int indent, int numOfRows, int numOfCells, int numOfValuesInCell) { - if (content != null) { - if (content instanceof String && ((String)content).isEmpty()) { - return null; - } - this.indent = indent; - XWPFTableCell cell; - if(numOfRows > 0 || numOfValuesInCell > 0) { - cell = mainDocumentPart.getCell(numOfCells); - } else { - cell = mainDocumentPart.createCell(); - } - cell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.valueOf("CENTER")); - if(numOfValuesInCell == 0) { - cell.removeParagraph(0); - } - - XWPFParagraph paragraph = this.optionsInTable.get(style).apply(cell, content); - if (paragraph != null) { - paragraph.setAlignment(ParagraphAlignment.CENTER); - paragraph.setSpacingBefore(100); - if (numId != null) { - paragraph.setNumID(numId); - } - return paragraph; - } - } - return null; - } - - public XWPFParagraph addParagraphContent(Object content, XWPFDocument mainDocumentPart, ParagraphStyle style, BigInteger numId, int indent) { -// this.indent = 0; - if (content != null) { - if (content instanceof String && ((String)content).isEmpty()) { - return null; - } - this.indent = indent; - XWPFParagraph paragraph = this.options.get(style).apply(mainDocumentPart, content); - if (paragraph != null) { - paragraph.setIndentFromLeft(400*indent); - if (numId != null) { - paragraph.setNumID(numId); - } - return paragraph; - } - } - return null; - } - - private void addListing(XWPFDocument document, int indent, Boolean question, Boolean hasIndication) { - CTLvl cTLvl = this.cTAbstractNum.addNewLvl(); - - String textLevel = ""; - for (int i = 0; i <= indent; i++) { - textLevel += "%" + (i + 1) + "."; - } - - if (question) { - cTLvl.addNewNumFmt().setVal(STNumberFormat.DECIMAL); -// cTLvl.addNewLvlText().setVal(""); - cTLvl.setIlvl(BigInteger.valueOf(indent)); - } else if (!question && hasIndication) { - cTLvl.addNewNumFmt().setVal(STNumberFormat.DECIMAL); -// cTLvl.addNewLvlText().setVal(""); - cTLvl.setIlvl(BigInteger.valueOf(indent)); - } - if (!question && !hasIndication) { - cTLvl.addNewNumFmt().setVal(STNumberFormat.NONE); -// cTLvl.addNewLvlText().setVal(""); - cTLvl.setIlvl(BigInteger.valueOf(indent)); - } - } - - private String formatter(Field field) throws IOException { - if (field.getValue() == null) { - return null; - } - switch (field.getViewStyle().getFieldType()) { - case RESEARCHERS: -// case "projects": //TODO: Description Templatedefinition - case ORGANIZATIONS: - case EXTERNAL_DATASETS: - case DATA_REPOSITORIES: - case PUB_REPOSITORIES: - case JOURNAL_REPOSITORIES: - case TAXONOMIES: - case LICENSES: - case PUBLICATIONS: - case REGISTRIES: - case SERVICES: - case TAGS: -// case CURRENCY: -// comboboxType = FieldDataComboBoxType.Autocomplete; -// case COMBO_BOX: { -// if (comboboxType == null) { -// comboboxType = ((ComboBoxDataEntity) field.getData()).getFieldSubType(); -// } -// if (comboboxType.equals(FieldDataComboBoxType.Autocomplete)) { -// mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); -// if (field.getValue() == null) return null; -// List> mapList = new ArrayList<>(); -// if (!field.getValue().equals("") && field.getValue().toString() != null) { -// try { -// mapList = Arrays.asList(mapper.readValue(field.getValue().toString(), HashMap[].class)); -// }catch (Exception e) { -// // logger.warn(e.getMessage(), e); -// // logger.info("Moving to fallback parsing"); -// Map map = new HashMap<>(); -// map.put("label", field.getValue().toString()); -// mapList.add(map); -// } -// } -// StringBuilder sb = new StringBuilder(); -// int index = 0; -// for (Map map: mapList) { -// for (Map.Entry entry : map.entrySet()) { -// if (entry.getValue() != null && (entry.getKey().equals("label") || entry.getKey().equals("description") || entry.getKey().equals("name"))) { -// sb.append(entry.getValue()); -// break; -// } -// } -// if (index != mapList.size() - 1) sb.append(", "); -// index++; -// } -// return sb.toString(); -// } else if (comboboxType.equals(FieldDataComboBoxType.Wordlist)) { -// WordListDataEntity wordListDataEntity = (WordListDataEntity) field.getData(); -// if (field.getValue() != null){ -// ComboBoxDataEntity.Option selectedOption = null; -// if (!wordListDataEntity.getOptions().isEmpty()) { -// for (ComboBoxDataEntity.Option option : wordListDataEntity.getOptions()) { -// if (option.getValue().equals(field.getValue())) { -// selectedOption = option; -// } -// } -// } -// return selectedOption != null ? selectedOption.getLabel() : field.getValue().toString(); -// } -// return ""; -// } -// } - case BOOLEAN_DECISION: - if (field.getValue() != null && field.getValue().equals("true")) return "Yes"; - if (field.getValue() != null && field.getValue().equals("false")) return "No"; - return null; - case RADIO_BOX: - return field.getValue() != null ? field.getValue().toString() : null; - case CHECK_BOX: - LabelDataEntity data = (LabelDataEntity) field.getData(); - if (field.getValue() == null || field.getValue().equals("false")) return null; - return data.getLabel(); - case DATE_PICKER:{ - Instant instant; - if (!((String)field.getValue()).isEmpty()) { - try { - instant = Instant.parse((String) field.getValue()); - } catch (DateTimeParseException ex) { - instant = LocalDate.parse((String) field.getValue()).atStartOfDay().toInstant(ZoneOffset.UTC); - } - return field.getValue() != null ? DateTimeFormatter.ofPattern("yyyy-MM-dd").withZone(ZoneId.systemDefault()).format(instant) : ""; - } - return (String) field.getValue(); - } - case FREE_TEXT: - case TEXT_AREA: - case RICH_TEXT_AREA: - return field.getValue() != null ? field.getValue().toString(): ""; - case DATASET_IDENTIFIER: - case VALIDATION: - if (field.getValue() != null && !field.getValue().toString().isEmpty()) { - Map identifierData; - try { - identifierData = mapper.readValue(field.getValue().toString(), HashMap.class); - } catch (Exception ex) { - // logger.warn(ex.getLocalizedMessage(), ex); - // logger.info("Reverting to custom parsing"); - identifierData = customParse(field.getValue().toString()); - } - return "id: " + identifierData.get("identifier") + ", Type: " + identifierData.get("type"); - } - return ""; - } - return null; - } - - private boolean hasVisibleFields(FieldSet compositeFields, VisibilityRuleService visibilityRuleService) { - return compositeFields.getFields().stream().anyMatch(field -> visibilityRuleService.isElementVisible(field.getId()) && field.getExport()); - } - - private Map customParse(String value) { - Map result = new LinkedHashMap<>(); - String parsedValue = value.replaceAll("[^a-zA-Z0-9\\s:=,]", ""); - StringTokenizer commaTokens = new StringTokenizer(parsedValue, ", "); - String delimeter = parsedValue.contains("=") ? "=" : ":"; - while (commaTokens.hasMoreTokens()) { - String token = commaTokens.nextToken(); - StringTokenizer delimiterTokens = new StringTokenizer(token, delimeter); - result.put(delimiterTokens.nextToken(), delimiterTokens.nextToken()); - } - return result; - } - - public int findPosOfPoweredBy(XWPFDocument document) { - for (XWPFParagraph p : document.getParagraphs()) { - List runs = p.getRuns(); - if (runs != null) { - for (XWPFRun r : runs) { - String text = r.getText(0); - if (text != null) { - if (text.equals("Powered by")) { - return document.getPosOfParagraph(p) - 1; - } - } - } - } - } - return -1; - } - - public void fillFirstPage(DmpEntity dmpEntity, DescriptionEntity descriptionEntityEntity, XWPFDocument document, boolean isDataset) { - int parPos = 0; - int descrParPos = -1; - XWPFParagraph descrPar = null; - for(XWPFParagraph p: document.getParagraphs()){ - List runs = p.getRuns(); - if(runs != null){ - for(XWPFRun r : runs){ - String text = r.getText(0); - if(text != null){ - if(text.contains("{ARGOS.DMP.TITLE}")) { - text = text.replace("{ARGOS.DMP.TITLE}", dmpEntity.getLabel()); - r.setText(text, 0); - } else if(text.contains("{ARGOS.DMP.VERSION}")) { - text = text.replace("{ARGOS.DMP.VERSION}", "Version " + dmpEntity.getVersion()); - r.setText(text, 0); - } else if(descriptionEntityEntity != null && text.contains("{ARGOS.DATASET.TITLE}")) { - text = text.replace("{ARGOS.DATASET.TITLE}", descriptionEntityEntity.getLabel()); - r.setText(text, 0); -// } else if(text.equals("Description") && ((!isDataset && (dmpEntity == null || dmpEntity.getDescription() != null)) || (isDataset && (datasetEntity == null || datasetEntity.getDescription() == null)))) { -// r.setText("", 0); - } else if((dmpEntity != null && text.contains("{ARGOS.DMP.DESCRIPTION}") && !isDataset) || (descriptionEntityEntity != null && text.contains("{ARGOS.DATASET.DESCRIPTION}") && isDataset)) { - descrParPos = parPos; - descrPar = p; - if(dmpEntity != null && !isDataset) { - text = text.replace("{ARGOS.DMP.DESCRIPTION}", ""); - } else if(descriptionEntityEntity != null && isDataset) { - text = text.replace("{ARGOS.DATASET.DESCRIPTION}", ""); - } - r.setText(text, 0); - } else if(text.equals("{ARGOS.DMP.RESEARCHERS}")) { - String researchersNames = ""; - //TODO -// Set researchers = dmpEntity.getResearchers(); -// int i = 0; -// for(Researcher researcher : researchers){ -// i++; -// researchersNames += researcher.getLabel() + (i < researchers.size() ? ", " : ""); -// } - text = text.replace("{ARGOS.DMP.RESEARCHERS}", researchersNames); - r.setText(text, 0); - r.setFontSize(17); - } else if(text.equals("{ARGOS.DMP.ORGANIZATIONS}")) { - String organisationsNames = ""; - //TODO -// Set organisations = dmpEntity.getOrganisations(); -// int i = 0; -// for(Organisation organisation : organisations){ -// i++; -// organisationsNames += organisation.getLabel() + (i < organisations.size() ? ", " : ""); -// } - text = text.replace("{ARGOS.DMP.ORGANIZATIONS}", organisationsNames); - r.setText(text, 0); - r.setFontSize(17); - } - } - } - } - parPos++; - } - - if((descrParPos != -1) && (dmpEntity!=null) && (dmpEntity.getDescription() != null) && !isDataset) { - XmlCursor cursor = descrPar.getCTP().newCursor(); - cursor.toNextSibling(); - Document htmlDoc = Jsoup.parse(((String)dmpEntity.getDescription()).replaceAll("\n", "
")); - HtmlToWorldBuilder htmlToWorldBuilder = new HtmlToWorldBuilder(descrPar, 0, cursor); - NodeTraversor.traverse(htmlToWorldBuilder, htmlDoc); - } - if((descrParPos != -1) && (descriptionEntityEntity != null) && (descriptionEntityEntity.getDescription() != null) && isDataset) { - XmlCursor cursor = descrPar.getCTP().newCursor(); - cursor.toNextSibling(); - Document htmlDoc = Jsoup.parse(((String) descriptionEntityEntity.getDescription()).replaceAll("\n", "
")); - HtmlToWorldBuilder htmlToWorldBuilder = new HtmlToWorldBuilder(descrPar, 0, cursor); - NodeTraversor.traverse(htmlToWorldBuilder, htmlDoc); - } - - - XWPFTable tbl = document.getTables().get(0); - Iterator it = tbl.getRows().iterator(); - it.next(); // skip first row - //TODO -// if(it.hasNext() && dmpEntity.getGrant() != null){ -// XWPFParagraph p = it.next().getCell(0).getParagraphs().get(0); -// XWPFRun run = p.createRun(); -// run.setText(dmpEntity.getGrant().getFunder().getLabel()); -// run.setFontSize(17); -// p.setAlignment(ParagraphAlignment.CENTER); -// } -// it = tbl.getRows().iterator(); -// it.next(); -// if(it.hasNext() && dmpEntity.getGrant() != null){ -// XWPFParagraph p = it.next().getCell(1).getParagraphs().get(0); -// XWPFRun run = p.createRun(); -// String text = dmpEntity.getGrant().getLabel(); -// String reference = dmpEntity.getGrant().getReference(); -// if(reference != null) { -// String[] parts = reference.split("::"); -// text += parts.length > 1 ? "/ No "+parts[parts.length - 1] : ""; -// } -// run.setText(text); -// run.setFontSize(17); -// p.setAlignment(ParagraphAlignment.CENTER); -// } - } - - public void fillFooter(DmpEntity dmpEntity, DescriptionEntity descriptionEntityEntity, XWPFDocument document, boolean isDataset) { - document.getFooterList().forEach(xwpfFooter -> { - List runs = xwpfFooter.getParagraphs().get(0).getRuns(); - if(runs != null){ - for(XWPFRun r : runs){ - String text = r.getText(0); - if(text != null){ - if(text.contains("{ARGOS.DMP.TITLE}")){ - text = text.replace("{ARGOS.DMP.TITLE}", dmpEntity.getLabel()); - r.setText(text, 0); - } - if(text.contains("{ARGOS.DATASET.TITLE}") && descriptionEntityEntity != null){ - text = text.replace("{ARGOS.DATASET.TITLE}", descriptionEntityEntity.getLabel()); - r.setText(text, 0); - } - //TODO -// if(text.contains("{ARGOS.DMP.LICENSE}")){ -// try{ -// Map license = ((Map) mapper.readValue(dmpEntity.getExtraProperties(), Map.class).get("license")); -// text = text.replace("{ARGOS.DMP.LICENSE}", license.get("pid")); -// } -// catch (JsonProcessingException | NullPointerException e){ -// text = text.replace("{ARGOS.DMP.LICENSE}", "License: -"); -// } -// r.setText(text, 0); -// } -// if(text.contains("{ARGOS.DMP.DOI}")){ -// if(dmpEntity.getDois() != null && !dmpEntity.getDois().isEmpty()) -// text = text.replace("{ARGOS.DMP.DOI}", dmpEntity.getDois().iterator().next().getDoi()); -// else -// text = text.replace("{ARGOS.DMP.DOI}", "-"); -// r.setText(text, 0); -// } - if(text.contains("{ARGOS.DMP.LAST_MODIFIED}")){ - DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); - text = text.replace("{ARGOS.DMP.LAST_MODIFIED}", formatter.format(dmpEntity.getUpdatedAt())); - r.setText(text, 0); - } - } - } - } - }); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/XWPFHtmlDocument.java b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/XWPFHtmlDocument.java deleted file mode 100644 index 526813e10..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/XWPFHtmlDocument.java +++ /dev/null @@ -1,63 +0,0 @@ -package eu.eudat.logic.utilities.documents.word; - -import org.apache.poi.ooxml.POIXMLDocumentPart; -import org.apache.poi.openxml4j.exceptions.InvalidFormatException; -import org.apache.poi.openxml4j.opc.OPCPackage; -import org.apache.poi.openxml4j.opc.PackagePart; -import org.apache.poi.openxml4j.opc.PackagePartName; -import org.apache.poi.openxml4j.opc.PackagingURIHelper; -import org.apache.poi.xwpf.usermodel.XWPFDocument; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.util.UUID; - -public class XWPFHtmlDocument extends POIXMLDocumentPart { - - private String html; - private String id; - - public XWPFHtmlDocument(PackagePart pkg, String id) { - super(pkg); - this.html = "HTML import

"; - this.id = id; - } - - public String getHtml() { - return html; - } - - public void setHtml(String html) { - this.html = this.html.replace("

", html); - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - @Override - protected void commit() throws IOException { - PackagePart packagePart = getPackagePart(); - OutputStream outputStream = packagePart.getOutputStream(); - Writer writer = new OutputStreamWriter(outputStream, "UTF-8"); - writer.write(html); - writer.close(); - outputStream.close(); - } - - public static XWPFHtmlDocument addHtmlDocument(XWPFDocument document) throws InvalidFormatException { - OPCPackage oPCPackage = document.getPackage(); - String id = UUID.randomUUID().toString(); - PackagePartName partName = PackagingURIHelper.createPartName("/word/" + id + ".html"); - PackagePart part = oPCPackage.createPart(partName, "text/html"); - XWPFHtmlDocument xWPFHtmlDocument = new XWPFHtmlDocument(part, id); - document.addRelation(xWPFHtmlDocument.getId(), new XWPFHtmlRelation(), xWPFHtmlDocument); - return xWPFHtmlDocument; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/XWPFHtmlRelation.java b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/XWPFHtmlRelation.java deleted file mode 100644 index 669dc47c9..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/XWPFHtmlRelation.java +++ /dev/null @@ -1,11 +0,0 @@ -package eu.eudat.logic.utilities.documents.word; - -import org.apache.poi.ooxml.POIXMLRelation; - -public class XWPFHtmlRelation extends POIXMLRelation { - public XWPFHtmlRelation() { - super("text/html", - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/aFChunk", - "/word/htmlDoc#.html"); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/xml/ExportXmlBuilder.java b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/xml/ExportXmlBuilder.java deleted file mode 100644 index a857e7054..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/xml/ExportXmlBuilder.java +++ /dev/null @@ -1,152 +0,0 @@ -package eu.eudat.logic.utilities.documents.xml; - -import com.fasterxml.jackson.databind.ObjectMapper; -import eu.eudat.logic.services.forms.VisibilityRuleService; -import eu.eudat.logic.xml.XmlBuilder; -import eu.eudat.commons.types.descriptiontemplate.fielddata.ExternalDatasetDataEntity; -import eu.eudat.models.data.user.components.datasetprofile.Field; -import eu.eudat.models.data.user.components.datasetprofile.FieldSet; -import eu.eudat.models.data.user.components.datasetprofile.Section; -import eu.eudat.models.data.user.composite.DatasetProfilePage; -import eu.eudat.models.data.user.composite.PagedDatasetProfile; -import org.springframework.core.env.Environment; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.time.Instant; -import java.time.ZoneId; -import java.time.format.DateTimeFormatter; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -public class ExportXmlBuilder { - - public File build(PagedDatasetProfile pagedDatasetProfile, UUID datasetProfileId, VisibilityRuleService visibilityRuleService, Environment environment) throws IOException { - - File xmlFile = new File(environment.getProperty("temp.temp") + UUID.randomUUID() + ".xml"); - BufferedWriter writer = new BufferedWriter(new FileWriter(xmlFile, true)); - Document xmlDoc = XmlBuilder.getDocument(); - Element root = xmlDoc.createElement("root"); - Element datasetProfile = xmlDoc.createElement("datasetProfileId"); - datasetProfile.setTextContent(datasetProfileId.toString()); - root.appendChild(datasetProfile); - root.appendChild(createPages(pagedDatasetProfile.getPages(), visibilityRuleService, xmlDoc)); - xmlDoc.appendChild(root); - String xml = XmlBuilder.generateXml(xmlDoc); - writer.write(xml); - writer.close(); - return xmlFile; - } - - public Element createPages(List datasetProfilePages, VisibilityRuleService visibilityRuleService, Document element) { - Element pages = element.createElement("pages"); - datasetProfilePages.forEach(item -> { - Element page = element.createElement("page"); - page.appendChild(createSections(item.getSections(), visibilityRuleService, element)); - pages.appendChild(page); - }); - return pages; - } - - private Element createSections(List
sections, VisibilityRuleService visibilityRuleService, Document element) { - Element elementSections = element.createElement("sections"); - sections.forEach(section -> { - Element elementSection = element.createElement("section"); - if (visibilityRuleService.isElementVisible(section.getId())) { - elementSection.appendChild(createSections(section.getSections(), visibilityRuleService, element)); - elementSection.appendChild(createCompositeFields(section.getCompositeFields(), visibilityRuleService, element)); - elementSections.appendChild(elementSection); - } - }); - return elementSections; - } - - private Element createCompositeFields(List
compositeFields, VisibilityRuleService visibilityRuleService, Document element) { - Element elementComposites = element.createElement("composite-fields"); - compositeFields.forEach(compositeField -> { - if (visibilityRuleService.isElementVisible(compositeField.getId()) && hasVisibleFields(compositeField, visibilityRuleService)) { - Element composite = element.createElement("composite-field"); - composite.setAttribute("id", compositeField.getId()); - if (compositeField.getTitle() != null && !compositeField.getTitle().isEmpty()) { - Element title = element.createElement("title"); - title.setTextContent(compositeField.getTitle()); - composite.appendChild(title); - } - if (compositeField.getDescription() != null && !compositeField.getDescription().isEmpty()) { - Element title = element.createElement("description"); - title.setTextContent(compositeField.getDescription()); - composite.appendChild(title); - } - composite.appendChild(createFields(compositeField.getFields(), visibilityRuleService, element)); - if(compositeField.getHasCommentField()){ - Element comment = element.createElement("comment"); - comment.setTextContent(compositeField.getCommentFieldValue()); - composite.appendChild(comment); - } - elementComposites.appendChild(composite); - - } - }); - return elementComposites; - } - - private Element createFields(List fields, VisibilityRuleService visibilityRuleService, Document element) { - Element elementFields = element.createElement("fields"); - fields.forEach(field -> { - if (visibilityRuleService.isElementVisible(field.getId())) { - Element elementField = element.createElement("field"); - elementField.setAttribute("id", field.getId()); - if (field.getViewStyle().getFieldType().equals("externalDatasets")) { - elementField.setAttribute("type", ((ExternalDatasetDataEntity)field.getData()).getType().getValue()); - } - if (field.getValue() != null) { - Element valueField = element.createElement("value"); - ObjectMapper mapper = new ObjectMapper(); - try { - - List> jsonArray = mapper.readValue(field.getValue().toString(), List.class); -// JSONArray jsonArray = new JSONArray(field.getValue().toString()); - StringBuilder sb = new StringBuilder(); - boolean firstTime = true; - for (Map jsonElement: jsonArray) { - if (!firstTime) { - sb.append(", "); - } - sb.append(jsonElement.get("label") != null ? jsonElement.get("label") : jsonElement.get("name")); - firstTime = false; - - } - /*for (int i = 0; i < jsonArray.length(); i++) { - sb.append(jsonArray.getJSONObject(i).get("label").toString()); - if (i != jsonArray.length() - 1) sb.append(", "); - }*/ - valueField.setTextContent(sb.toString()); - } catch (IOException ex) { - try { - Map jsonElement = mapper.readValue(field.getValue().toString(), Map.class); - valueField.setTextContent((jsonElement.get("label") != null ? jsonElement.get("label").toString() : jsonElement.get("name") != null ? jsonElement.get("name").toString() : "")); - } catch (IOException e) { - try { - valueField.setTextContent(DateTimeFormatter.ofPattern("yyyy-MM-dd").withZone(ZoneId.systemDefault()).format(Instant.parse(field.getValue().toString()))); - } catch (Exception exc) { - valueField.setTextContent(field.getValue().toString()); - } - } - } - elementField.appendChild(valueField); - } - elementFields.appendChild(elementField); - } - }); - return elementFields; - } - - private boolean hasVisibleFields(FieldSet compositeFields, VisibilityRuleService visibilityRuleService) { - return compositeFields.getFields().stream().anyMatch(field -> visibilityRuleService.isElementVisible(field.getId())); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/xml/datasetProfileXml/ExportXmlBuilderDatasetProfile.java b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/xml/datasetProfileXml/ExportXmlBuilderDatasetProfile.java deleted file mode 100644 index e1c1406cf..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/xml/datasetProfileXml/ExportXmlBuilderDatasetProfile.java +++ /dev/null @@ -1,371 +0,0 @@ -package eu.eudat.logic.utilities.documents.xml.datasetProfileXml; - - -import eu.eudat.commons.types.descriptiontemplate.fielddata.*; -import eu.eudat.models.data.admin.components.datasetprofile.Page; -import eu.eudat.models.data.user.components.datasetprofile.Field; -import eu.eudat.models.data.user.components.datasetprofile.FieldSet; -import eu.eudat.models.data.user.components.datasetprofile.Section; -import eu.eudat.logic.xml.XmlBuilder; - -import org.springframework.core.env.Environment; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.util.List; -import java.util.UUID; - - -public class ExportXmlBuilderDatasetProfile { - - - public File build(eu.eudat.models.data.user.composite.DatasetProfile datasetProfile, Environment environment) throws IOException { - - File xmlFile = new File(environment.getProperty("temp.temp") + UUID.randomUUID() + ".xml"); - BufferedWriter writer = new BufferedWriter(new FileWriter(xmlFile, true)); - Document xmlDoc = XmlBuilder.getDocument(); -// Element root = xmlDoc.createElement("root"); -// root.appendChild(createPages(datasetProfile.getPages(), datasetProfile.getSections(), xmlDoc)); - - xmlDoc.appendChild(createPages(datasetProfile.getPages(), datasetProfile.getSections(), xmlDoc)); - Element pages = (Element)xmlDoc.getFirstChild(); - pages.setAttribute("description", datasetProfile.getDescription()); - pages.setAttribute("language", datasetProfile.getLanguage()); - pages.setAttribute("type", datasetProfile.getType()); - String xml = XmlBuilder.generateXml(xmlDoc); - writer.write(xml); - writer.close(); - return xmlFile; - } - - public Element createPages(List datasetProfilePages, List
sections, Document element) { - Element pages = element.createElement("pages"); - datasetProfilePages.forEach(item -> { - Element page = element.createElement("page"); - page.setAttribute("id", "" + item.getId()); - page.setAttribute("ordinal", "" + item.getOrdinal()); - page.setAttribute("title", "" + item.getTitle()); - sections.forEach(sectionFromLis -> { - if (sectionFromLis.getPage().equals(item.getId())) { - Element elementSections = element.createElement("sections"); - page.appendChild(createSections(sectionFromLis, element, elementSections)); - } - }); - pages.appendChild(page); - }); - return pages; - } - - - public Element createSections(Section sections, Document element, Element elementSections) { -// if (sections.getSections() != null) { - sections.getSections().forEach(sectionFor -> { - Element elementSectionsChild = element.createElement("section"); - elementSections.appendChild(createSections(sectionFor, element, elementSectionsChild)); - }); -// } - - elementSections.setAttribute("defaultVisibility", "" + sections.getDefaultVisibility()); - elementSections.setAttribute("id", "" + sections.getId()); - elementSections.setAttribute("ordinal", "" + sections.getOrdinal()); - elementSections.setAttribute("page", "" + sections.getPage()); - elementSections.setAttribute("page", "" + sections.getPage()); - - if (sections.getCompositeFields() != null) { - elementSections.appendChild(createFieldSet(sections.getCompositeFields(), element)); - } - - if (sections.getNumbering() != null) { - Element numbering = element.createElement("numbering"); - numbering.setTextContent(sections.getNumbering()); - elementSections.appendChild(numbering); - } - if (sections.getDescription() != null) { - Element description = element.createElement("description"); - description.setTextContent(sections.getDescription()); - elementSections.appendChild(description); - } - if (sections.getTitle() != null) { - Element title = element.createElement("title"); - title.setTextContent(sections.getTitle()); - elementSections.appendChild(title); - } - - return elementSections; - } - - public Element createFieldSet(List
fieldSet, Document element) { - Element elementFieldSets = element.createElement("field-Sets"); - fieldSet.forEach(field -> { - Element composite = element.createElement("field-Set"); - composite.setAttribute("id", field.getId()); - composite.setAttribute("ordinal", "" + field.getOrdinal()); - - if (field.getNumbering() != null) { - Element numbering = element.createElement("numbering"); - numbering.setTextContent(field.getNumbering()); - composite.appendChild(numbering); - } - Element commentField = element.createElement("CommentField"); - commentField.setTextContent("" + field.getHasCommentField()); - composite.appendChild(commentField); - - composite.appendChild(createFields(field.getFields(), element)); - - if (field.getMultiplicity() != null) { - Element multiplicity = element.createElement("multiplicity"); - multiplicity.setAttribute("max", "" + field.getMultiplicity().getMax()); - multiplicity.setAttribute("min", "" + field.getMultiplicity().getMin()); - multiplicity.setAttribute("placeholder", field.getMultiplicity().getPlaceholder()); - multiplicity.setAttribute("tableView", String.valueOf(field.getMultiplicity().getTableView())); - composite.appendChild(multiplicity); - } - if (field.getTitle() != null && !field.getTitle().isEmpty()) { - Element title = element.createElement("title"); - title.setTextContent(field.getTitle()); - composite.appendChild(title); - } - if (field.getDescription() != null && !field.getDescription().isEmpty()) { - Element title = element.createElement("description"); - title.setTextContent(field.getDescription()); - composite.appendChild(title); - } - if (field.getExtendedDescription() != null && !field.getExtendedDescription().isEmpty()) { - Element extendedDescription = element.createElement("extendedDescription"); - extendedDescription.setTextContent(field.getExtendedDescription()); - composite.appendChild(extendedDescription); - } - if (field.getAdditionalInformation() != null && !field.getAdditionalInformation().isEmpty()) { - Element additionalInformation = element.createElement("additionalInformation"); - additionalInformation.setTextContent(field.getAdditionalInformation()); - composite.appendChild(additionalInformation); - } - - - elementFieldSets.appendChild(composite); - }); - return elementFieldSets; - } - - - public Element createFields(List fields, Document element) { - Element elementFields = element.createElement("fields"); - fields.forEach(field -> { - Element elementField = element.createElement("field"); - elementField.setAttribute("id", field.getId()); - elementField.setAttribute("ordinal", "" + field.getOrdinal()); - - if (field.getNumbering() != null) { - Element numbering = element.createElement("numbering"); - numbering.setTextContent(field.getNumbering()); - elementField.appendChild(numbering); - } - if (field.getSchematics() != null) { - Element schematics = element.createElement("schematics"); - field.getSchematics().forEach(schematic -> { - Element schematicChild = element.createElement("schematic"); - schematicChild.setTextContent(schematic); - schematics.appendChild(schematicChild); - }); - elementField.appendChild(schematics); - } - if (field.getValidations() != null) { - Element validations = element.createElement("validations"); - field.getValidations().forEach(validation -> { - Element validationChild = element.createElement("validation"); - validationChild.setAttribute("type", "" + validation); - validations.appendChild(validationChild); - }); - elementField.appendChild(validations); - } - if (field.getDefaultValue() != null) { - Element defaultValue = element.createElement("defaultValue"); - defaultValue.setAttribute("type", field.getDefaultValue().getType()); - defaultValue.setAttribute("value", field.getDefaultValue().getValue()); - elementField.appendChild(defaultValue); - } - if (field.getVisible() != null) { - Element visible = element.createElement("visible"); - visible.setAttribute("style", "" + field.getVisible().getStyle()); - field.getVisible().getRules().forEach(rule -> { - Element ruleChild = element.createElement("rule"); - ruleChild.setAttribute("target", "" + rule.getTarget()); - Element ruleChildValue = element.createElement("value"); - ruleChildValue.setTextContent(rule.getValue()); - ruleChild.appendChild(ruleChildValue); - visible.appendChild(ruleChild); - - }); - elementField.appendChild(visible); - } - if (field.getViewStyle() != null) { - Element viewStyle = element.createElement("viewStyle"); - viewStyle.setAttribute("cssClass", field.getViewStyle().getCssClass()); - viewStyle.setAttribute("renderStyle", field.getViewStyle().getFieldType().getValue()); - elementField.appendChild(viewStyle); - } - - if (field.getData() != null) { - Element dataOut = element.createElement("data"); - switch (field.getViewStyle().getFieldType()) { - case SELECT: - case EXTERNAL_SELECT: -// ComboBoxDataEntity comboBoxDataEntityObject = (ComboBoxDataEntity) field.getData(); -// if (comboBoxDataEntityObject.getFieldType().equals("wordlist")) { -// SelectDataEntity selectDataEntityObject = (SelectDataEntity) field.getData(); -// dataOut.setAttribute("label", selectDataEntityObject.getLabel()); -// dataOut.setAttribute("type", selectDataEntityObject.getFieldType().getValue()); -// dataOut.setAttribute("multiList", selectDataEntityObject.getMultiList().toString()); -// Element options = element.createElement("options"); -// selectDataEntityObject.getOptions().forEach(optionChildFor -> { -// Element optionChild = element.createElement("option"); -// optionChild.setAttribute("label", optionChildFor.getLabel()); -// optionChild.setAttribute("value", optionChildFor.getValue()); -// options.appendChild(optionChild); -// }); -// dataOut.appendChild(options); -// } else if (comboBoxDataEntityObject.getFieldType().equals("autocomplete")) { -// ExternalSelectDataEntity externalSelectDataEntityObject = (ExternalSelectDataEntity) field.getData(); -// dataOut.setAttribute("label", externalSelectDataEntityObject.getLabel()); -// dataOut.setAttribute("type", externalSelectDataEntityObject.getFieldType().getValue()); -// dataOut.setAttribute("multiAutoComplete", externalSelectDataEntityObject.getMultipleSelect().toString()); -// for (ExternalSelectDataEntity.ExternalSelectSourceEntity singleData: externalSelectDataEntityObject.getSources()) { -// Element singleItem = element.createElement("autocompleteSingle"); -// singleItem.setAttribute("optionsRoot", singleData.getOptionsRoot()); -// singleItem.setAttribute("url", singleData.getUrl()); -// singleItem.setAttribute("autoCompleteType", Integer.toString(singleData.getAutocompleteType().getValue())); -// if (singleData.getSourceBinding() != null) { -// Element optionChild = element.createElement("option"); -// optionChild.setAttribute("label", singleData.getSourceBinding().getLabel()); -// optionChild.setAttribute("value", singleData.getSourceBinding().getValue()); -// singleItem.appendChild(optionChild); -// } -// dataOut.appendChild(singleItem); -// } -// } - break; - case UPLOAD: - UploadDataEntity uploadEntityObject = (UploadDataEntity) field.getData(); - dataOut.setAttribute("label", uploadEntityObject.getLabel()); - dataOut.setAttribute("maxFileSizeInMB", String.valueOf(uploadEntityObject.getMaxFileSizeInMB())); - Element types = element.createElement("types"); - uploadEntityObject.getTypes().forEach(type -> { - Element optionChild = element.createElement("option"); - optionChild.setAttribute("label", type.getLabel()); - optionChild.setAttribute("value", type.getValue()); - types.appendChild(optionChild); - }); - dataOut.appendChild(types); - break; - case BOOLEAN_DECISION: - LabelAndMultiplicityDataEntity booleanDecisionDataEntityObject = (LabelAndMultiplicityDataEntity) field.getData(); - dataOut.setAttribute("label", booleanDecisionDataEntityObject.getLabel()); - break; - case RADIO_BOX: - RadioBoxDataEntity radioBoxDataEntityObject = (RadioBoxDataEntity) field.getData(); - dataOut.setAttribute("label", radioBoxDataEntityObject.getLabel()); - - Element options = element.createElement("options"); - radioBoxDataEntityObject.getOptions().forEach(optionChildFor -> { - Element optionChild = element.createElement("option"); - optionChild.setAttribute("label", optionChildFor.getLabel()); - optionChild.setAttribute("value", optionChildFor.getValue()); - options.appendChild(optionChild); - }); - dataOut.appendChild(options); - break; - case CHECK_BOX: - case FREE_TEXT: - case TEXT_AREA: - case RICH_TEXT_AREA: - case DATE_PICKER: - case DATASET_IDENTIFIER: - case CURRENCY: - case TAGS: - BaseFieldDataEntity baseFieldDataObject = (BaseFieldDataEntity) field.getData(); - dataOut.setAttribute("label", baseFieldDataObject.getLabel()); - break; - case INTERNAL_DMP_ENTRIES_RESEARCHERS: - case INTERNAL_ENTRIES_DESCRIPTIONS: - case INTERNAL_DMP_ENTRIES_DMPS: -// InternalDmpBaseDataEntity internalDmpEntitiesData = (InternalDmpBaseDataEntity) field.getData(); -// dataOut.setAttribute("label", internalDmpEntitiesData.getLabel()); -// dataOut.setAttribute("type", internalDmpEntitiesData.getFieldType().getValue()); -// switch (internalDmpEntitiesData.getFieldType()) { -// case INTERNAL_DMP_ENTRIES_RESEARCHERS: -// InternalDmpBaseDataEntity researchersAutoCompleteData = (InternalDmpBaseDataEntity) internalDmpEntitiesData; -// dataOut.setAttribute("multiAutocomplete", researchersAutoCompleteData.getMultipleSelect().toString()); -// break; -// case INTERNAL_DMP_ENTRIES_DATASETS: -// InternalDmpBaseDataEntity datasetAutoCompleteDataEntity = (InternalDmpBaseDataEntity) internalDmpEntitiesData; -// dataOut.setAttribute("multiAutocomplete", datasetAutoCompleteDataEntity.getMultipleSelect().toString()); -// break; -// case INTERNAL_DMP_ENTRIES_DMPS: -// InternalDmpBaseDataEntity dmpAutoCompleteDataEntity = (InternalDmpBaseDataEntity) internalDmpEntitiesData; -// dataOut.setAttribute("multiAutocomplete", dmpAutoCompleteDataEntity.getMultipleSelect().toString()); -// break; -// } - break; - case EXTERNAL_DATASETS: - ExternalDatasetDataEntity externalDatasetDataEntity = (ExternalDatasetDataEntity) field.getData(); - dataOut.setAttribute("label", externalDatasetDataEntity.getLabel()); - dataOut.setAttribute("multiAutocomplete", externalDatasetDataEntity.getMultipleSelect().toString()); - dataOut.setAttribute("type", externalDatasetDataEntity.getType().getValue()); - break; - case DATA_REPOSITORIES: - case JOURNAL_REPOSITORIES: -// case PUB_REPOSITORIES: -// InternalDmpBaseDataEntity dataRepositoryDataEntity = (InternalDmpBaseDataEntity) field.getData(); -// dataOut.setAttribute("label", dataRepositoryDataEntity.getLabel()); -// dataOut.setAttribute("multiAutocomplete", dataRepositoryDataEntity.getMultipleSelect().toString()); -// break; -// case TAXONOMIES: -// InternalDmpBaseDataEntity taxonomyDataEntity = (InternalDmpBaseDataEntity) field.getData(); -// dataOut.setAttribute("label", taxonomyDataEntity.getLabel()); -// dataOut.setAttribute("multiAutocomplete", taxonomyDataEntity.getMultipleSelect().toString()); -// break; -// case LICENSES: -// InternalDmpBaseDataEntity licensesData = (InternalDmpBaseDataEntity) field.getData(); -// dataOut.setAttribute("label", licensesData.getLabel()); -// dataOut.setAttribute("multiAutocomplete", licensesData.getMultipleSelect().toString()); -// break; -// case PUBLICATIONS: -// InternalDmpBaseDataEntity publicationDataEntity = (InternalDmpBaseDataEntity) field.getData(); -// dataOut.setAttribute("label", publicationDataEntity.getLabel()); -// dataOut.setAttribute("multiAutocomplete", publicationDataEntity.getMultipleSelect().toString()); -// break; -// case ORGANIZATIONS: -// InternalDmpBaseDataEntity organizationDataEntity = (InternalDmpBaseDataEntity) field.getData(); -// dataOut.setAttribute("label", organizationDataEntity.getLabel()); -// dataOut.setAttribute("multiAutocomplete", organizationDataEntity.getMultipleSelect().toString()); -// break; -// case RESEARCHERS: -// InternalDmpBaseDataEntity researcherDataEntity = (InternalDmpBaseDataEntity) field.getData(); -// dataOut.setAttribute("label", researcherDataEntity.getLabel()); -// dataOut.setAttribute("multiAutocomplete", researcherDataEntity.getMultipleSelect().toString()); -// break; -// case REGISTRIES: -// InternalDmpBaseDataEntity registriesEntity = (InternalDmpBaseDataEntity) field.getData(); -// dataOut.setAttribute("label", registriesEntity.getLabel()); -// dataOut.setAttribute("multiAutocomplete", registriesEntity.getMultipleSelect().toString()); -// break; -// case SERVICES: -// InternalDmpBaseDataEntity serviceDataEntity = (InternalDmpBaseDataEntity) field.getData(); -// dataOut.setAttribute("label", serviceDataEntity.getLabel()); -// dataOut.setAttribute("multiAutocomplete", serviceDataEntity.getMultipleSelect().toString()); -// break; - - } - elementField.appendChild(dataOut); - } - - elementFields.appendChild(elementField); - }); - return elementFields; - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/xml/datasetProfileXml/ImportXmlBuilderDatasetProfile.java b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/xml/datasetProfileXml/ImportXmlBuilderDatasetProfile.java deleted file mode 100644 index fc680a2cb..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/xml/datasetProfileXml/ImportXmlBuilderDatasetProfile.java +++ /dev/null @@ -1,29 +0,0 @@ -package eu.eudat.logic.utilities.documents.xml.datasetProfileXml; -import eu.eudat.commons.types.descriptiontemplate.importexport.DescriptionTemplateImportExport; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import jakarta.xml.bind.JAXBContext; -import jakarta.xml.bind.JAXBException; -import jakarta.xml.bind.Unmarshaller; -import java.io.*; - -public class ImportXmlBuilderDatasetProfile { - private static final Logger logger = LoggerFactory.getLogger(ImportXmlBuilderDatasetProfile.class); - - public DescriptionTemplateImportExport build(File xmlFile) throws IOException { - DescriptionTemplateImportExport descriptionTemplateImportXml = new DescriptionTemplateImportExport(); - JAXBContext jaxbContext = null; - try { - jaxbContext = JAXBContext.newInstance(DescriptionTemplateImportExport.class); - Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); - descriptionTemplateImportXml = (DescriptionTemplateImportExport) unmarshaller.unmarshal(xmlFile); - } catch (JAXBException e) { - logger.error(e.getMessage(), e); - } - - return descriptionTemplateImportXml; - } - - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/helpers/LabelBuilder.java b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/helpers/LabelBuilder.java deleted file mode 100644 index d996c2ab9..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/helpers/LabelBuilder.java +++ /dev/null @@ -1,25 +0,0 @@ -package eu.eudat.logic.utilities.helpers; - -import java.util.List; - - -public class LabelBuilder { - private static String generateLabel(List items) { - String label = ""; - for (T item : items) { - if (items.indexOf(item) == 3) { - label += "..."; - break; - } - if (items.indexOf(item) > 1) { - label += ", "; - } - label += item.generateLabel(); - } - return label; - } - - public static String getLabel(List items) { - return generateLabel(items); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/helpers/LabelGenerator.java b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/helpers/LabelGenerator.java deleted file mode 100644 index d510e6ab0..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/helpers/LabelGenerator.java +++ /dev/null @@ -1,6 +0,0 @@ -package eu.eudat.logic.utilities.helpers; - - -public interface LabelGenerator { - String generateLabel(); -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/helpers/ListHelper.java b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/helpers/ListHelper.java deleted file mode 100644 index 8857e4481..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/helpers/ListHelper.java +++ /dev/null @@ -1,17 +0,0 @@ -package eu.eudat.logic.utilities.helpers; - -import org.springframework.stereotype.Component; - -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.function.Function; -import java.util.function.Predicate; - -@Component -public class ListHelper { - - public Predicate distinctByKey(Function keyExtractor) { - Map seen = new ConcurrentHashMap<>(); - return t -> seen.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/helpers/ModelBuilderCollector.java b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/helpers/ModelBuilderCollector.java deleted file mode 100644 index 4b1102b2f..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/helpers/ModelBuilderCollector.java +++ /dev/null @@ -1,46 +0,0 @@ -package eu.eudat.logic.utilities.helpers; - -import eu.eudat.commons.types.descriptiontemplate.RuleEntity; -import eu.eudat.commons.types.descriptiontemplate.SectionEntity; -import eu.eudat.models.data.user.components.commons.Rule; - -import java.util.LinkedList; -import java.util.List; -import java.util.stream.Collectors; - -public class ModelBuilderCollector { - - - /** - * @param sectionEntities - * @return - */ - public static List collectRules(List sectionEntities) { - List rules = new LinkedList(); - for (SectionEntity sectionEntity : sectionEntities) { - if (!sectionEntity.getSections().isEmpty()) { - rules.addAll(collectRules(sectionEntity.getSections())); - } - rules.addAll( - sectionEntity.getFieldSets().stream() - .map(fieldset -> fieldset.getFields()) - .flatMap(List::stream) - .map(field -> getRulesFromField(field.getId(), field.getVisibilityRules())) - .flatMap(List::stream) - .collect(Collectors.toList())); - } - - return rules; - } - - private static List getRulesFromField(String id, List rules) { - List modelRules = new LinkedList(); - for (RuleEntity rule : rules) { - Rule modelRule = new Rule().fromDefinitionRule(rule); - modelRule.setSourceField(id); - modelRules.add(modelRule); - } - return modelRules; - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/helpers/MyStringUtils.java b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/helpers/MyStringUtils.java deleted file mode 100644 index 1a071e04c..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/helpers/MyStringUtils.java +++ /dev/null @@ -1,21 +0,0 @@ -package eu.eudat.logic.utilities.helpers; - -public class MyStringUtils { - - public static int getFirstDifference(String s1, String s2) { - char[] s1ar = s1.toCharArray(); - char[] s2ar = s2.toCharArray(); - - for(int i = 0; i < s1ar.length; i++) { - if (s2ar.length > i) { - if (s1ar[i] != s2ar[i]) { - return i; - } - } else { - return i; - } - } - - return -1; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/interfaces/Applier.java b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/interfaces/Applier.java deleted file mode 100644 index bcff4dc20..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/interfaces/Applier.java +++ /dev/null @@ -1,8 +0,0 @@ -package eu.eudat.logic.utilities.interfaces; - -/** - * Created by ikalyvas on 3/1/2018. - */ -public interface Applier { - void apply(A applier, V value); -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/interfaces/ApplierWithValue.java b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/interfaces/ApplierWithValue.java deleted file mode 100644 index 03d2bcf89..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/interfaces/ApplierWithValue.java +++ /dev/null @@ -1,8 +0,0 @@ -package eu.eudat.logic.utilities.interfaces; - -/** - * Created by ikalyvas on 2/27/2018. - */ -public interface ApplierWithValue { - R apply(A applier, V value); -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/interfaces/Cloneable.java b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/interfaces/Cloneable.java deleted file mode 100644 index 23e8da3e3..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/interfaces/Cloneable.java +++ /dev/null @@ -1,8 +0,0 @@ -package eu.eudat.logic.utilities.interfaces; - -/** - * Created by ikalyvas on 2/5/2018. - */ -public interface Cloneable { - T clone(); -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/interfaces/ViewStyleDefinition.java b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/interfaces/ViewStyleDefinition.java deleted file mode 100644 index 999c1a994..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/interfaces/ViewStyleDefinition.java +++ /dev/null @@ -1,9 +0,0 @@ -package eu.eudat.logic.utilities.interfaces; - - -public interface ViewStyleDefinition { - T toDatabaseDefinition(T item); - - void fromDatabaseDefinition(T item); - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/json/JavaToJson.java b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/json/JavaToJson.java deleted file mode 100644 index 28589e6f9..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/json/JavaToJson.java +++ /dev/null @@ -1,13 +0,0 @@ -package eu.eudat.logic.utilities.json; - -public class JavaToJson { - - public static String objectStringToJson(String object) { - String result = object.replaceAll("=", "\":\"") - .replaceAll("\\{", "{\"") - .replaceAll(", ", "\", \"") - .replaceAll("}", "\"}" ) - .replaceAll("}\", \"\\{", "}, {"); - return result; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/json/JsonSearcher.java b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/json/JsonSearcher.java deleted file mode 100644 index d5cab1d19..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/json/JsonSearcher.java +++ /dev/null @@ -1,81 +0,0 @@ -package eu.eudat.logic.utilities.json; - -import com.fasterxml.jackson.databind.JsonNode; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -public class JsonSearcher { - - public static List findNodes(JsonNode root, String key, String value) { - return findNodes(root, key, value, false); - } - - public static List findNodes(JsonNode root, String key, String value, boolean parent) { - List nodes = new ArrayList<>(); - for (Iterator it = root.elements(); it.hasNext(); ) { - JsonNode node = it.next(); - int found = 0; - for (Iterator iter = node.fieldNames(); iter.hasNext(); ) { - String fieldName = iter.next(); - if (fieldName.equals(key)) { - if (node.get(fieldName).asText().equals(value) || node.get(fieldName).asText().startsWith(value)) { - if (parent) { - nodes.add(root); - } else { - nodes.add(node); - } - found++; - } - else if(node.get(fieldName).isArray()){ - for(JsonNode item: node.get(fieldName)){ - if(item.asText().equals(value) || item.asText().startsWith(value)){ - if (parent) { - nodes.add(root); - } else { - nodes.add(node); - } - found++; - } - } - } - } - - } - if (found == 0) { - nodes.addAll(findNodes(node, key, value, parent)); - } - } - return nodes; - } - - public static List getParentValues(JsonNode root, String childValue, String key) { - List values = new LinkedList<>(); - - for (Iterator it = root.elements(); it.hasNext(); ) { - JsonNode node = it.next(); - int found = 0; - for (Iterator iter = node.fieldNames(); iter.hasNext(); ) { - String fieldName = iter.next(); - if (fieldName.equals(key)) { - if (node.get(fieldName).asText().equals(childValue) || node.get(fieldName).asText().startsWith(childValue)) { - values.add(childValue); - found++; - } - } - - } - if (found == 0) { - values.addAll(getParentValues(node, childValue, key)); - if (!values.isEmpty() && node.has(key)) { - values.add(node.get(key).asText()); - values.remove(childValue); - } - } - } - - return values; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/json/MultiDateDeserializer.java b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/json/MultiDateDeserializer.java deleted file mode 100644 index 636b8faa2..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/json/MultiDateDeserializer.java +++ /dev/null @@ -1,41 +0,0 @@ -package eu.eudat.logic.utilities.json; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.deser.std.StdDeserializer; - -import java.io.IOException; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Arrays; -import java.util.Date; -import java.util.List; - -public class MultiDateDeserializer extends StdDeserializer { - - private static final List DATE_FORMATS = Arrays.asList("yyyy-MM-dd'T'HH:mm:ss'Z'", "yyyy-MM-dd'T'HH:mm:ss.S"); - - - public MultiDateDeserializer() { - super(Date.class); - } - - protected MultiDateDeserializer(Class vc) { - super(vc); - } - - @Override - public Date deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException { - String text = p.getText(); - - for (String dateFormat: DATE_FORMATS) { - try { - return new SimpleDateFormat(dateFormat).parse(text); - } catch (ParseException ignored) { - } - } - throw new JsonParseException(p, "No supported Date format"); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/xml/XmlBuilder.java b/dmp-backend/web/src/main/java/eu/eudat/logic/xml/XmlBuilder.java deleted file mode 100644 index 7824f878f..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/xml/XmlBuilder.java +++ /dev/null @@ -1,87 +0,0 @@ -package eu.eudat.logic.xml; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import java.io.IOException; -import java.io.StringReader; -import java.io.StringWriter; - - -public class XmlBuilder { - private static final Logger logger = LoggerFactory.getLogger(XmlBuilder.class); - - public static Document getDocument() { - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder docBuilder; - try { - docBuilder = docFactory.newDocumentBuilder(); - Document doc = docBuilder.newDocument(); - return doc; - } catch (ParserConfigurationException e) { - // TODO Auto-generated catch block - logger.error(e.getMessage(), e); - return null; - } - } - - public static String generateXml(Document doc) { - TransformerFactory tFact = TransformerFactory.newInstance(); - Transformer trans; - try { - trans = tFact.newTransformer(); - StringWriter writer = new StringWriter(); - StreamResult result = new StreamResult(writer); - DOMSource source = new DOMSource(doc); - trans.setOutputProperty(OutputKeys.INDENT, "yes"); - trans.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); - trans.transform(source, result); - return writer.toString(); - } catch (TransformerException e) { - // TODO Auto-generated catch block - logger.error(e.getMessage(), e); - return null; - } - } - - public static Document fromXml(String xml) { - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder docBuilder; - try { - docBuilder = docFactory.newDocumentBuilder(); - InputSource inputStream = new InputSource(new StringReader(xml)); - Document doc = docBuilder.parse(inputStream); - return doc; - } catch (ParserConfigurationException | SAXException | IOException e) { - // TODO Auto-generated catch block - logger.error(e.getMessage(), e); - return null; - } - } - - - public static Element getNodeFromListByTagName(NodeList list, String tagName) { - for (int temp = 0; temp < list.getLength(); temp++) { - Node element = list.item(temp); - if (element.getNodeType() == Node.ELEMENT_NODE) { - if (element.getNodeName().equals(tagName)) return (Element) element; - } - } - return null; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/xml/XmlSerializable.java b/dmp-backend/web/src/main/java/eu/eudat/logic/xml/XmlSerializable.java deleted file mode 100644 index 79593d8f5..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/xml/XmlSerializable.java +++ /dev/null @@ -1,11 +0,0 @@ -package eu.eudat.logic.xml; - - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public interface XmlSerializable { - Element toXml(Document doc); - - T fromXml(Element item); -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/v2/Account.java b/dmp-backend/web/src/main/java/eu/eudat/models/Account.java similarity index 99% rename from dmp-backend/web/src/main/java/eu/eudat/models/v2/Account.java rename to dmp-backend/web/src/main/java/eu/eudat/models/Account.java index 40ed7e9ad..17ce2dd15 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/v2/Account.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/Account.java @@ -1,4 +1,4 @@ -package eu.eudat.models.v2; +package eu.eudat.models; import gr.cite.tools.logging.annotation.LogSensitive; diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/v2/AccountBuilder.java b/dmp-backend/web/src/main/java/eu/eudat/models/AccountBuilder.java similarity index 97% rename from dmp-backend/web/src/main/java/eu/eudat/models/v2/AccountBuilder.java rename to dmp-backend/web/src/main/java/eu/eudat/models/AccountBuilder.java index ca4b26194..90a7482da 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/v2/AccountBuilder.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/AccountBuilder.java @@ -1,22 +1,19 @@ -package eu.eudat.models.v2; +package eu.eudat.models; import eu.eudat.commons.JsonHandlingService; import eu.eudat.commons.scope.user.UserScope; import eu.eudat.commons.types.user.AdditionalInfoEntity; import eu.eudat.data.UserEntity; -import eu.eudat.model.User; import gr.cite.commons.web.authz.configuration.AuthorizationConfiguration; import gr.cite.commons.web.oidc.principal.CurrentPrincipalResolver; import gr.cite.commons.web.oidc.principal.MyPrincipal; import gr.cite.commons.web.oidc.principal.extractor.ClaimExtractor; import gr.cite.commons.web.oidc.principal.extractor.ClaimExtractorKeys; -import gr.cite.tools.exception.MyNotFoundException; import gr.cite.tools.fieldset.BaseFieldSet; import gr.cite.tools.fieldset.FieldSet; import jakarta.persistence.EntityManager; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; -import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.stereotype.Component; import javax.management.InvalidApplicationException; diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/DataModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/DataModel.java deleted file mode 100644 index e457c68e9..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/DataModel.java +++ /dev/null @@ -1,10 +0,0 @@ -package eu.eudat.models; - - -public interface DataModel { - M fromDataModel(T entity); - - T toDataModel() throws Exception; - - String getHint(); -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/HintedModelFactory.java b/dmp-backend/web/src/main/java/eu/eudat/models/HintedModelFactory.java deleted file mode 100644 index 305aebc7d..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/HintedModelFactory.java +++ /dev/null @@ -1,21 +0,0 @@ -package eu.eudat.models; - - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class HintedModelFactory { - private static final Logger logger = LoggerFactory.getLogger(HintedModelFactory.class); - - public static String getHint(Class clazz) { - try { - return clazz.newInstance().getHint(); - } catch (InstantiationException e) { - logger.error(e.getMessage(), e); - return null; - } catch (IllegalAccessException e) { - logger.error(e.getMessage(), e); - return null; - } - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/ContactEmail/ContactEmailModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/ContactEmail/ContactEmailModel.java deleted file mode 100644 index 92ce9e681..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/ContactEmail/ContactEmailModel.java +++ /dev/null @@ -1,21 +0,0 @@ -package eu.eudat.models.data.ContactEmail; - -public class ContactEmailModel { - - private String subject; - private String description; - - public String getSubject() { - return subject; - } - public void setSubject(String subject) { - this.subject = subject; - } - - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/ContactEmail/PublicContactEmailModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/ContactEmail/PublicContactEmailModel.java deleted file mode 100644 index 44f4996de..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/ContactEmail/PublicContactEmailModel.java +++ /dev/null @@ -1,41 +0,0 @@ -package eu.eudat.models.data.ContactEmail; - -public class PublicContactEmailModel { - - private String fullName; - private String email; - private String affiliation; - private String message; - - public String getFullName() { - return fullName; - } - - public void setFullName(String fullName) { - this.fullName = fullName; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public String getAffiliation() { - return affiliation; - } - - public void setAffiliation(String affiliation) { - this.affiliation = affiliation; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} 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 deleted file mode 100644 index 21265b85e..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/FetcherReference.java +++ /dev/null @@ -1,243 +0,0 @@ -package eu.eudat.models.data; - - -import java.util.Map; - -public class FetcherReference { - - private String id; - private String name; - private String pid; - private String pidTypeField; - private String uri; - private String description; - private String source; - private String count; - private String path; - private String host; - private String types; - private String firstName; - private String lastName; - private String tag; - - public String getId() { - return id; - } - - public void setId(String 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 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 getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getSource() { - return source; - } - - public void setSource(String source) { - this.source = source; - } - - public String getCount() { - return count; - } - - public void setCount(String count) { - this.count = count; - } - - public String getPath() { - return path; - } - - public void setPath(String path) { - this.path = path; - } - - public String getHost() { - return host; - } - - public void setHost(String host) { - this.host = host; - } - - public String getTypes() { - return types; - } - - public void setTypes(String types) { - this.types = types; - } - - 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; - } - - public String getTag() { - return tag; - } - - public void setTag(String tag) { - this.tag = tag; - } - - public static FetcherReference fromRemoteModel(Map data) { - FetcherReference fetcherReference = new FetcherReference(); - if (data == null) return fetcherReference; - - fetcherReference.setId(data.getOrDefault("id", null)); - fetcherReference.setName(data.getOrDefault("name", null)); - fetcherReference.setPid(data.getOrDefault("pid", null)); - fetcherReference.setPidTypeField(data.getOrDefault("pidTypeField", null)); - fetcherReference.setUri(data.getOrDefault("uri", null)); - fetcherReference.setDescription(data.getOrDefault("description", null)); - fetcherReference.setSource(data.getOrDefault("source", null)); - fetcherReference.setCount(data.getOrDefault("count", null)); - fetcherReference.setPath(data.getOrDefault("path", null)); - fetcherReference.setHost(data.getOrDefault("host", null)); - fetcherReference.setTypes(data.getOrDefault("types", null)); - fetcherReference.setFirstName(data.getOrDefault("firstName", null)); - fetcherReference.setLastName(data.getOrDefault("lastName", null)); - fetcherReference.setTag(data.getOrDefault("tag", null)); - 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 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; -//// } -// 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/admin/components/datasetprofile/Field.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/admin/components/datasetprofile/Field.java deleted file mode 100644 index 8db55db75..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/admin/components/datasetprofile/Field.java +++ /dev/null @@ -1,157 +0,0 @@ -package eu.eudat.models.data.admin.components.datasetprofile; - -import eu.eudat.commons.enums.FieldValidationType; -import eu.eudat.model.publicapi.datasetwizard.DefaultValueEntity; -import eu.eudat.model.publicapi.datasetwizard.FieldDescriptionEntity; -import eu.eudat.model.publicapi.datasetwizard.VisibilityEntity; -import eu.eudat.commons.types.descriptiontemplate.FieldEntity; -import eu.eudat.logic.utilities.interfaces.ViewStyleDefinition; -import org.apache.commons.lang3.NotImplementedException; -import org.apache.commons.lang3.RandomStringUtils; - -import java.util.List; -import java.util.stream.Collectors; - -public class Field implements ViewStyleDefinition, Comparable { - - private String id; - private Integer ordinal; - private List schematics; - private String value; - private FieldDescriptionEntity viewStyle; - private String datatype; - private int page; - private DefaultValueEntity defaultValue; - private Object data; - private VisibilityEntity visible; - private List validations; - private Boolean export; - - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - - public int getOrdinal() { - return ordinal; - } - public void setOrdinal(int ordinal) { - this.ordinal = ordinal; - } - - - public List getSchematics() { - return schematics; - } - public void setSchematics(List schematics) { - this.schematics = schematics; - } - - public String getValue() { - return value; - } - public void setValue(String value) { - this.value = value; - } - - public FieldDescriptionEntity getViewStyle() { - return viewStyle; - } - public void setViewStyle(FieldDescriptionEntity viewStyle) { - this.viewStyle = viewStyle; - } - - public int getPage() { - return page; - } - public void setPage(int page) { - this.page = page; - } - - public DefaultValueEntity getDefaultValue() { - return defaultValue; - } - public void setDefaultValue(DefaultValueEntity defaultValue) { - this.defaultValue = defaultValue; - } - - public String getDatatype() { - return datatype; - } - public void setDatatype(String datatype) { - this.datatype = datatype; - } - - public Object getData() { - return data; - } - public void setData(Object data) { - this.data = data; - } - - public VisibilityEntity getVisible() { - return visible; - } - public void setVisible(VisibilityEntity visible) { - this.visible = visible; - } - - public List getValidations() { - return this.validations.stream().map(item -> (int) item.getValue()).collect(Collectors.toList()); - } - public void setValidations(List validations) { - this.validations = validations.stream().map(x-> FieldValidationType.of(x.shortValue())).collect(Collectors.toList()); - } - - public Boolean getExport() { - return export; - } - - public void setExport(Boolean export) { - this.export = export; - } - - @Override - public FieldEntity toDatabaseDefinition(FieldEntity fieldEntity) { - if (this.id == null || this.id.isEmpty()) this.id = "field_" + RandomStringUtils.random(5, true, true); - - fieldEntity.setId(this.id); - fieldEntity.setOrdinal(this.ordinal); - throw new NotImplementedException(" Use new logic"); - //TODO: Use new logic -// fieldEntity.setData(new FieldDataHelper().toFieldData(data, this.viewStyle.getFieldType())); -// fieldEntity.setVisibilityRules(this.visible.getRules()); -// fieldEntity.setDefaultValue(this.defaultValue.getValue()); -// fieldEntity.setValidations(this.validations); -// fieldEntity.setSchematics(this.schematics); -// fieldEntity.setIncludeInExport(this.export); -// return fieldEntity; - } - - @Override - public void fromDatabaseDefinition(FieldEntity item) { - this.id = item.getId(); - this.ordinal = item.getOrdinal(); - FieldDescriptionEntity fieldDescription = new FieldDescriptionEntity(); - fieldDescription.setFieldType(item.getData().getFieldType()); - this.viewStyle = fieldDescription; - this.data = item.getData(); - VisibilityEntity visibilityEntity = new VisibilityEntity(); - visibilityEntity.setRules(item.getVisibilityRules()); - this.visible = visibilityEntity; - DefaultValueEntity defaultValueEntity = new DefaultValueEntity(); - defaultValueEntity.setValue(item.getDefaultValue()); - this.defaultValue = defaultValueEntity; - this.validations = item.getValidations(); - this.schematics = item.getSchematics(); - this.export = item.getIncludeInExport(); - } - - @Override - public int compareTo(Object o) { - return this.ordinal.compareTo(((Field) o).ordinal); - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/admin/components/datasetprofile/FieldSet.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/admin/components/datasetprofile/FieldSet.java deleted file mode 100644 index 6757ea952..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/admin/components/datasetprofile/FieldSet.java +++ /dev/null @@ -1,140 +0,0 @@ -package eu.eudat.models.data.admin.components.datasetprofile; - -import eu.eudat.commons.types.descriptiontemplate.MultiplicityEntity; -import eu.eudat.commons.types.descriptiontemplate.FieldSetEntity; -import eu.eudat.logic.utilities.interfaces.ViewStyleDefinition; -import org.apache.commons.lang3.RandomStringUtils; - -import java.util.Collections; -import java.util.List; - -public class FieldSet implements Comparable, ViewStyleDefinition { - private String id; - private Integer ordinal; - private MultiplicityEntity multiplicity; - private String title; - private String description; - private String extendedDescription; - private String additionalInformation; - private boolean hasCommentField; - private List fields; - - public List getFields() { - return fields; - } - public void setFields(List fields) { - this.fields = fields; - } - - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - - public Integer getOrdinal() { - return ordinal; - } - public void setOrdinal(int ordinal) { - this.ordinal = ordinal; - } - public void setOrdinal(Integer ordinal) { - this.ordinal = ordinal; - } - - public MultiplicityEntity getMultiplicity() { - return multiplicity; - } - public void setMultiplicity(MultiplicityEntity multiplicity) { - this.multiplicity = multiplicity; - } - - public String getTitle() { - return title; - } - public void setTitle(String title) { - this.title = title; - } - - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - - public String getExtendedDescription() { - return extendedDescription; - } - public void setExtendedDescription(String extendedDescription) { - this.extendedDescription = extendedDescription; - } - - public boolean getHasCommentField() { - return hasCommentField; - } - public void setHasCommentField(boolean hasCommentField) { - this.hasCommentField = hasCommentField; - } - - public String getAdditionalInformation() { - return additionalInformation; - } - public void setAdditionalInformation(String additionalInformation) { - this.additionalInformation = additionalInformation; - } - - @Override - public FieldSetEntity toDatabaseDefinition(FieldSetEntity item) { - if (this.id == null || this.id.isEmpty()) this.id = "fieldSet_" + RandomStringUtils.random(5, true, true); -// List viewStyleFieldEntities = new ModelBuilder().toViewStyleDefinition(this.fields, FieldEntity.class); -// item.setFields(viewStyleFieldEntities); - item.setId(this.id); - item.setDescription(this.description); - item.setTitle(this.title); - item.setExtendedDescription(this.extendedDescription); - item.setAdditionalInformation(this.additionalInformation); - item.setOrdinal(this.ordinal); - item.setMultiplicity(this.multiplicity); - item.setHasCommentField(this.hasCommentField); - - return item; - } - - @Override - public void fromDatabaseDefinition(FieldSetEntity item) { -// this.fields = new ModelBuilder().fromViewStyleDefinition(item.getFields(), Field.class); - this.id = item.getId(); - this.ordinal = item.getOrdinal(); - this.description = item.getDescription(); - this.extendedDescription = item.getExtendedDescription(); - this.additionalInformation=item.getAdditionalInformation(); - this.title = item.getTitle(); - this.multiplicity = item.getMultiplicity(); - this.hasCommentField = item.getHasCommentField(); - } - - @Override - public int compareTo(Object o) { - return this.ordinal.compareTo(((FieldSet) o).ordinal); - } - - - public FieldSet toShort() { - FieldSet shortenFieldSet = new FieldSet(); - shortenFieldSet.setId(this.id); - shortenFieldSet.setMultiplicity(this.multiplicity); - shortenFieldSet.setTitle(this.title); - shortenFieldSet.setDescription(this.description); - shortenFieldSet.setExtendedDescription(this.extendedDescription); - shortenFieldSet.setAdditionalInformation(this.additionalInformation); - shortenFieldSet.setHasCommentField(this.hasCommentField); - - List fieldToShort = this.fields; - Collections.sort(fieldToShort); - shortenFieldSet.setFields(fieldToShort); - return shortenFieldSet; - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/admin/components/datasetprofile/Page.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/admin/components/datasetprofile/Page.java deleted file mode 100644 index 1efae128e..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/admin/components/datasetprofile/Page.java +++ /dev/null @@ -1,55 +0,0 @@ -package eu.eudat.models.data.admin.components.datasetprofile; - -import eu.eudat.commons.types.descriptiontemplate.PageEntity; -import eu.eudat.logic.utilities.interfaces.ViewStyleDefinition; - - -public class Page implements Comparable, ViewStyleDefinition { - private String id; - private Integer ordinal; - private String title; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public int getOrdinal() { - return ordinal; - } - - public void setOrdinal(int ordinal) { - this.ordinal = ordinal; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - @Override - public PageEntity toDatabaseDefinition(PageEntity item) { - item.setId(this.id); - item.setOrdinal(this.ordinal); - item.setTitle(this.title); - return item; - } - - @Override - public void fromDatabaseDefinition(PageEntity item) { - this.title = item.getTitle(); - this.ordinal = item.getOrdinal(); - this.id = item.getId(); - } - - @Override - public int compareTo(Object o) { - return this.ordinal.compareTo((Integer) o); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/admin/components/datasetprofile/Section.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/admin/components/datasetprofile/Section.java deleted file mode 100644 index 526423b64..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/admin/components/datasetprofile/Section.java +++ /dev/null @@ -1,150 +0,0 @@ -package eu.eudat.models.data.admin.components.datasetprofile; - -import eu.eudat.commons.types.descriptiontemplate.SectionEntity; -import eu.eudat.logic.utilities.interfaces.ViewStyleDefinition; -import org.apache.commons.lang3.RandomStringUtils; - -import java.util.Collections; -import java.util.List; - -public class Section implements Comparable, ViewStyleDefinition { - private List
sections; - private List
fieldSets; - private Boolean defaultVisibility; - private String page; - private Integer ordinal; - private String id; - private String title; - private String description; - private Boolean multiplicity; - - public List
getSections() { - return sections; - } - - public void setSections(List
sections) { - this.sections = sections; - } - - public List
getFieldSets() { - return fieldSets; - } - - public void setFieldSets(List
fieldSets) { - this.fieldSets = fieldSets; - } - - public Boolean getDefaultVisibility() { - return defaultVisibility; - } - - public void setDefaultVisibility(Boolean defaultVisibility) { - this.defaultVisibility = defaultVisibility; - } - - public String getPage() { - return page; - } - - public void setPage(String page) { - this.page = page; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public int getOrdinal() { - return ordinal; - } - - public void setOrdinal(int ordinal) { - this.ordinal = ordinal; - } - - public Boolean getMultiplicity() { - return multiplicity; - } - - public void setMultiplicity(Boolean multiplicity) { - this.multiplicity = multiplicity; - } - - @Override - public SectionEntity toDatabaseDefinition(SectionEntity item) { - if (this.id == null || this.id.isEmpty()) this.id = "section_" + RandomStringUtils.random(5, true, true); - item.setDefaultVisibility(this.defaultVisibility); - item.setDescription(this.description); - item.setMultiplicity(this.multiplicity); -// if (this.fieldSets != null) -// item.setFieldSets(new ModelBuilder().toViewStyleDefinition(this.fieldSets, FieldSetEntity.class)); - item.setId(this.id); - item.setOrdinal(this.ordinal); -// if (this.sections != null) -// item.setSections(new ModelBuilder().toViewStyleDefinition(this.sections, SectionEntity.class)); - item.setTitle(this.title); - return item; - } - - @Override - public void fromDatabaseDefinition(SectionEntity item) { - - this.defaultVisibility = item.isDefaultVisibility(); - this.description = item.getDescription(); -// this.fieldSets = new ModelBuilder().fromViewStyleDefinition(item.getFieldSets(), FieldSet.class); - this.id = item.getId(); - this.ordinal = item.getOrdinal(); -// this.sections = new ModelBuilder().fromViewStyleDefinition(item.getSections(), Section.class); - this.title = item.getTitle(); - this.multiplicity = item.getMultiplicity(); - } - - @Override - public int compareTo(Object o) { - return this.ordinal.compareTo(((Section) o).getOrdinal()); - } - - public Section toShort(){ - Section shortenSection = new Section(); - - List
toShortsections = this.sections; - List
toShortFieldSets = this.fieldSets; - Collections.sort(toShortsections); - Collections.sort(toShortFieldSets); - for (Section shortsections : toShortsections ) { shortsections.toShort(); } - for (FieldSet shortFieldSets : toShortFieldSets ) { shortFieldSets.toShort(); } - - shortenSection.setSections(toShortsections); - shortenSection.setFieldSets(toShortFieldSets); - - shortenSection.setDefaultVisibility(this.defaultVisibility); - shortenSection.setPage(this.page); - shortenSection.setOrdinal(this.ordinal); - shortenSection.setId(this.id); - shortenSection.setTitle(this.title); - shortenSection.setDescription(this.description); - shortenSection.setMultiplicity(this.multiplicity); - return shortenSection; - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/admin/composite/DatasetProfile.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/admin/composite/DatasetProfile.java deleted file mode 100644 index ab1f1cf57..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/admin/composite/DatasetProfile.java +++ /dev/null @@ -1,105 +0,0 @@ -package eu.eudat.models.data.admin.composite; - -import eu.eudat.commons.types.descriptiontemplate.DefinitionEntity; -import eu.eudat.model.DmpUser; -import eu.eudat.models.data.admin.components.datasetprofile.Page; -import eu.eudat.models.data.admin.components.datasetprofile.Section; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -public class DatasetProfile { - private String label; - private String description; - private String type; - private List pages; - private List
sections; - private Short status; - private Short version; - private String language; - private List users; - - - 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 getType() { - return type; - } - public void setType(String type) { - this.type = type; - } - - public List getPages() { - return pages; - } - public void setPages(List pages) { - this.pages = pages; - } - - public List
getSections() { - return sections; - } - public void setSections(List
sections) { this.sections = sections; } - - public Short getStatus() { - return status; - } - public void setStatus(Short status) { - this.status = status; - } - - public Short getVersion() { return version; } - public void setVersion(Short version) { this.version = version; } - - public String getLanguage() { - return language; - } - public void setLanguage(String language) { - this.language = language; - } - - public List getUsers() { - return users; - } - public void setUsers(List users) { - this.users = users; - } - - public void buildProfile(DefinitionEntity viewStyle) { -// this.sections = new ModelBuilder().fromViewStyleDefinition(viewStyle.getSections(), Section.class); -// this.pages = new ModelBuilder().fromViewStyleDefinition(viewStyle.getPages(), Page.class); - } - - public DatasetProfile toShort() { - DatasetProfile shortProfile = new DatasetProfile(); - shortProfile.setLabel(this.label); - shortProfile.setDescription(this.description); - shortProfile.setType(this.type); - List
shortSection = new LinkedList<>(); - for (Section toshortSection : this.getSections()) { - shortSection.add(toshortSection.toShort()); - } - Collections.sort(shortSection); - shortProfile.setSections(shortSection); - shortProfile.setPages(this.pages); - shortProfile.setStatus(this.status); - shortProfile.setVersion(this.version); - shortProfile.setLanguage(this.language); - shortProfile.setUsers(new ArrayList<>()); - return shortProfile; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dashboard/recent/RecentActivity.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dashboard/recent/RecentActivity.java deleted file mode 100644 index b0edcbeab..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dashboard/recent/RecentActivity.java +++ /dev/null @@ -1,36 +0,0 @@ -package eu.eudat.models.data.dashboard.recent; - -import java.util.List; - -/** - * Created by ikalyvas on 3/14/2018. - */ -public class RecentActivity { - private List recentGrantActivities; - private List recentDatasetActivities; - private List recentDmpActivities; - - public List getRecentGrantActivities() { - return recentGrantActivities; - } - - public void setRecentGrantActivities(List recentGrantActivities) { - this.recentGrantActivities = recentGrantActivities; - } - - public List getRecentDatasetActivities() { - return recentDatasetActivities; - } - - public void setRecentDatasetActivities(List recentDatasetActivities) { - this.recentDatasetActivities = recentDatasetActivities; - } - - public List getRecentDmpActivities() { - return recentDmpActivities; - } - - public void setRecentDmpActivities(List recentDmpActivities) { - this.recentDmpActivities = recentDmpActivities; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dashboard/recent/tablerequest/RecentActivityTableRequest.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dashboard/recent/tablerequest/RecentActivityTableRequest.java deleted file mode 100644 index e50c8336d..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dashboard/recent/tablerequest/RecentActivityTableRequest.java +++ /dev/null @@ -1,52 +0,0 @@ -package eu.eudat.models.data.dashboard.recent.tablerequest; - -import eu.eudat.criteria.RecentActivityCriteria; -import eu.eudat.data.query.definition.helpers.ColumnOrderings; - -public class RecentActivityTableRequest { - private ColumnOrderings orderings; - private RecentActivityCriteria criteria; - private int dmpOffset; - private int datasetOffset; - private int length; - - public int getDmpOffset() { - return dmpOffset; - } - - public void setDmpOffset(int dmpOffset) { - this.dmpOffset = dmpOffset; - } - - public int getDatasetOffset() { - return datasetOffset; - } - - public void setDatasetOffset(int datasetOffset) { - this.datasetOffset = datasetOffset; - } - - public int getLength() { - return length; - } - - public void setLength(int length) { - this.length = length; - } - - public RecentActivityCriteria getCriteria() { - return criteria; - } - - public void setCriteria(RecentActivityCriteria criteria) { - this.criteria = criteria; - } - - public ColumnOrderings getOrderings() { - return orderings; - } - - public void setOrderings(ColumnOrderings orderings) { - this.orderings = orderings; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dashboard/searchbar/SearchBarItem.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dashboard/searchbar/SearchBarItem.java deleted file mode 100644 index a698910f9..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dashboard/searchbar/SearchBarItem.java +++ /dev/null @@ -1,47 +0,0 @@ -package eu.eudat.models.data.dashboard.searchbar; - -public class SearchBarItem { - private String id; - private String label; - private int type; - private boolean isPublished; - - public SearchBarItem(String id, String label, int type, boolean isPublished) { - this.id = id; - this.label = label; - this.type = type; - this.isPublished = isPublished; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - 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 boolean getIsPublished() { - return isPublished; - } - - public void setPublished(boolean published) { - isPublished = published; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dashboard/statistics/DashBoardStatistics.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dashboard/statistics/DashBoardStatistics.java deleted file mode 100644 index 922c1b5e3..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dashboard/statistics/DashBoardStatistics.java +++ /dev/null @@ -1,41 +0,0 @@ -package eu.eudat.models.data.dashboard.statistics; - -public class DashBoardStatistics { - private Long totalDataManagementPlanCount; - private Long totalGrantCount; - private Long totalDataSetCount; - private Long totalOrganisationCount; - - - public Long getTotalDataManagementPlanCount() { - return totalDataManagementPlanCount; - } - - public void setTotalDataManagementPlanCount(Long totalDataManagementPlanCount) { - this.totalDataManagementPlanCount = totalDataManagementPlanCount; - } - - public Long getTotalGrantCount() { - return totalGrantCount; - } - - public void setTotalGrantCount(Long totalGrantCount) { - this.totalGrantCount = totalGrantCount; - } - - public Long getTotalDataSetCount() { - return totalDataSetCount; - } - - public void setTotalDataSetCount(Long totalDataSetCount) { - this.totalDataSetCount = totalDataSetCount; - } - - public Long getTotalOrganisationCount() { - return totalOrganisationCount; - } - - public void setTotalOrganisationCount(Long totalOrganisationCount) { - this.totalOrganisationCount = totalOrganisationCount; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportDefaultValue.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportDefaultValue.java deleted file mode 100644 index 2a0703109..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportDefaultValue.java +++ /dev/null @@ -1,20 +0,0 @@ -package eu.eudat.models.data.datasetImport; - -public class DatasetImportDefaultValue { - private String type; - private String value; - - public String getType() { - return type; - } - public void setType(String type) { - this.type = type; - } - - public String getValue() { - return value; - } - public void setValue(String value) { - this.value = value; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportField.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportField.java deleted file mode 100644 index 36e9ecd5d..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportField.java +++ /dev/null @@ -1,125 +0,0 @@ -package eu.eudat.models.data.datasetImport; - -import eu.eudat.commons.enums.FieldValidationType; -import jakarta.xml.bind.annotation.XmlAttribute; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; -import jakarta.xml.bind.annotation.XmlValue; -import java.util.List; -import java.util.stream.Collectors; - -@XmlRootElement(name = "field") -public class DatasetImportField implements Comparable{ - - private String id; - private Integer ordinal; - private String value; - private DatasetImportViewStyle viewStyle; - private String datatype; - private String numbering; - private int page; - private DatasetImportDefaultValue defaultValue; - private DatasetImportMultiplicity multiplicity; - private Object data; - private List multiplicityItems; - private List validations; - private DatasetImportVisibility visible; - - public List getMultiplicityItems() { - return multiplicityItems; - } - public void setMultiplicityItems(List multiplicityItems) { - this.multiplicityItems = multiplicityItems; - } - - @XmlAttribute(name = "id") - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - - public int getOrdinal() { - return ordinal; - } - public void setOrdinal(Integer ordinal) { - this.ordinal = ordinal; - } - - @XmlElement(name = "value") - public String getValue() { - return value; - } - public void setValue(String value) { - this.value = value; - } - - public DatasetImportViewStyle getViewStyle() { - return viewStyle; - } - public void setViewStyle(DatasetImportViewStyle viewStyle) { - this.viewStyle = viewStyle; - } - - public int getPage() { - return page; - } - public void setPage(int page) { - this.page = page; - } - - public DatasetImportDefaultValue getDefaultValue() { - return defaultValue; - } - public void setDefaultValue(DatasetImportDefaultValue defaultValue) { - this.defaultValue = defaultValue; - } - - public String getDatatype() { - return datatype; - } - public void setDatatype(String datatype) { - this.datatype = datatype; - } - - public DatasetImportMultiplicity getMultiplicity() { - return multiplicity; - } - public void setMultiplicity(DatasetImportMultiplicity multiplicity) { - this.multiplicity = multiplicity; - } - - public Object getData() { - return data; - } - public void setData(Object data) { - this.data = data; - } - - public DatasetImportVisibility getVisible() { - return visible; - } - public void setVisible(DatasetImportVisibility visible) { - this.visible = visible; - } - - public List getValidations() { - return this.validations.stream().map(item -> (int) item.getValue()).collect(Collectors.toList()); - } - public void setValidations(List validations) { - this.validations = validations.stream().map(x-> FieldValidationType.of(x.shortValue())).collect(Collectors.toList()); - } - - public String getNumbering() { - return numbering; - } - public void setNumbering(String numbering) { - this.numbering = numbering; - } - - @Override - public int compareTo(Object o) { - return this.ordinal.compareTo(((DatasetImportField) o).getOrdinal()); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportFieldSet.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportFieldSet.java deleted file mode 100644 index 6a9f767f4..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportFieldSet.java +++ /dev/null @@ -1,120 +0,0 @@ -package eu.eudat.models.data.datasetImport; - -import jakarta.xml.bind.annotation.XmlAttribute; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; -import java.util.Collections; -import java.util.List; - -@XmlRootElement(name = "composite-field") -public class DatasetImportFieldSet implements Comparable{ - //@XmlAttribute(name = "id") - private String id; - private Integer ordinal; - private String title; - private String numbering; - private String description; - private String extendedDescription; - private String additionalInformation; - private DatasetImportMultiplicity multiplicity; - private List fields; - private List compositeFields; - private boolean hasCommentField; - private String commentFieldValue; - - @XmlElement(name = "fields") - public List getFields() { - //Collections.sort(this.fields); - return fields; - } - public void setFields(List fields) { - this.fields = fields; - } - - @XmlElement(name = "title") - public String getTitle() { - return title; - } - public void setTitle(String title) { - this.title = title; - } - - @XmlElement(name = "description") - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - - public String getExtendedDescription() { return extendedDescription; } - public void setExtendedDescription(String extendedDescription) { - this.extendedDescription = extendedDescription; - } - - @XmlAttribute(name = "id") - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - - public int getOrdinal() { - return ordinal; - } - public void setOrdinal(Integer ordinal) { - this.ordinal = ordinal; - } - - public DatasetImportMultiplicity getMultiplicity() { - return multiplicity; - } - public void setMultiplicity(DatasetImportMultiplicity multiplicity) { - this.multiplicity = multiplicity; - } - - @XmlElement(name = "composite-fields") - public List getcompositeFields() { - //if (compositeFields != null) Collections.sort(compositeFields); - return compositeFields; - } - public void setcompositeFields(List compositeFields) { - this.compositeFields = compositeFields; - } - - public String getNumbering() { - return numbering; - } - public void setNumbering(String numbering) { - this.numbering = numbering; - } - - public void setHasCommentField(boolean hasCommentField) { - this.hasCommentField = hasCommentField; - } - public boolean getHasCommentField() { - return hasCommentField; - } - - public String getCommentFieldValue() { - return commentFieldValue; - } - public void setCommentFieldValue(String commentFieldValue) { - this.commentFieldValue = commentFieldValue; - } - - public String getAdditionalInformation() { - return additionalInformation; - } - public void setAdditionalInformation(String additionalInformation) { - this.additionalInformation = additionalInformation; - } - - @Override - public int compareTo(Object o) { - return this.ordinal.compareTo(((DatasetImportFieldSet) o).getOrdinal()); - } - - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportFieldSets.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportFieldSets.java deleted file mode 100644 index 90943b50e..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportFieldSets.java +++ /dev/null @@ -1,25 +0,0 @@ -package eu.eudat.models.data.datasetImport; - -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; -import java.util.Collections; -import java.util.List; - -@XmlRootElement(name = "composite-fields") -public class DatasetImportFieldSets implements Comparable { - private List compositeField; - - @XmlElement(name = "composite-field") - public List getCompositeField() { - //Collections.sort(this.compositeField); - return compositeField; - } - public void setCompositeField(List compositeField) { - this.compositeField = compositeField; - } - - @Override - public int compareTo(Object o) { - return 0; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportFields.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportFields.java deleted file mode 100644 index b50274ffe..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportFields.java +++ /dev/null @@ -1,22 +0,0 @@ -package eu.eudat.models.data.datasetImport; - -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; -import java.util.List; - -@XmlRootElement(name = "fields") -public class DatasetImportFields implements Comparable{ - - private List field; - - @XmlElement(name = "field") - public List getField() { - return field; - } - public void setField(List field) { - this.field = field; - } - - @Override - public int compareTo(Object o) { return 0; } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportMultiplicity.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportMultiplicity.java deleted file mode 100644 index 59f0a8c01..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportMultiplicity.java +++ /dev/null @@ -1,20 +0,0 @@ -package eu.eudat.models.data.datasetImport; - -public class DatasetImportMultiplicity { - private int min; - private int max; - - public int getMin() { - return min; - } - public void setMin(int min) { - this.min = min; - } - - public int getMax() { - return max; - } - public void setMax(int max) { - this.max = max; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportPage.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportPage.java deleted file mode 100644 index 4794e1d84..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportPage.java +++ /dev/null @@ -1,35 +0,0 @@ -package eu.eudat.models.data.datasetImport; - -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlElementWrapper; -import jakarta.xml.bind.annotation.XmlRootElement; -import java.util.List; - -@XmlRootElement(name = "page") -public class DatasetImportPage { - private Integer ordinal; - private String title; - private DatasetImportSections sections; - - public Integer getOrdinal() { - return ordinal; - } - public void setOrdinal(Integer ordinal) { - this.ordinal = ordinal; - } - - public String getTitle() { - return title; - } - public void setTitle(String title) { - this.title = title; - } - - @XmlElement(name = "sections") - public DatasetImportSections getSections() { - return sections; - } - public void setSections(DatasetImportSections sections) { - this.sections = sections; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportPagedDatasetProfile.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportPagedDatasetProfile.java deleted file mode 100644 index 7552b8da8..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportPagedDatasetProfile.java +++ /dev/null @@ -1,33 +0,0 @@ -package eu.eudat.models.data.datasetImport; - -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlElementWrapper; -import jakarta.xml.bind.annotation.XmlRootElement; -import java.util.List; - -@XmlRootElement(name = "root") -public class DatasetImportPagedDatasetProfile { - private String datasetProfileId; - private List pages; - private List rules; - private int status; - - @XmlElement(name = "datasetProfileId") - public String getDatasetProfileId() { - return datasetProfileId; - } - public void setDatasetProfileId(String datasetProfileId) { - this.datasetProfileId = datasetProfileId; - } - - @XmlElementWrapper(name="pages") - @XmlElement(name = "page") - public List getPages() { return pages; } - public void setPages(List pages) { this.pages = pages; } - - public List getRules() { return rules; } - public void setRules(List rules) { this.rules = rules; } - - public int getStatus() { return status; } - public void setStatus(int status) { this.status = status; } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportRule.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportRule.java deleted file mode 100644 index fe4b136df..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportRule.java +++ /dev/null @@ -1,44 +0,0 @@ -package eu.eudat.models.data.datasetImport; - -public class DatasetImportRule { - private String ruleType; - private String target; - private String ruleStyle; - private String value; - private String valueType; - - public String getRuleType() { - return ruleType; - } - public void setRuleType(String ruleType) { - this.ruleType = ruleType; - } - - public String getTarget() { - return target; - } - public void setTarget(String target) { - this.target = target; - } - - public String getRuleStyle() { - return ruleStyle; - } - public void setRuleStyle(String ruleStyle) { - this.ruleStyle = ruleStyle; - } - - public String getValue() { - return value; - } - public void setValue(String value) { - this.value = value; - } - - public String getValueType() { - return valueType; - } - public void setValueType(String valueType) { - this.valueType = valueType; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportSection.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportSection.java deleted file mode 100644 index b6ce7c4b7..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportSection.java +++ /dev/null @@ -1,92 +0,0 @@ -package eu.eudat.models.data.datasetImport; - -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlElementWrapper; -import jakarta.xml.bind.annotation.XmlRootElement; -import java.util.Collections; -import java.util.List; - -@XmlRootElement(name = "section") -public class DatasetImportSection implements Comparable{ - private List sections; - private List compositeFields; - private Boolean defaultVisibility; - private String numbering; - private String page; - private Integer ordinal; - private String id; - private String title; - private String description; - - @XmlElement(name = "sections") - public List getSections() { - //Collections.sort(sections); - return sections; - } - public void setSections(List sections) { - this.sections = sections; - } - - //@XmlElementWrapper(name="composite-field") - @XmlElement(name = "composite-fields") - public List getCompositeFields() { - //Collections.sort(compositeFields); - return compositeFields; - } - public void setCompositeFields(List compositeFields) { - this.compositeFields = compositeFields; - } - - public Boolean getDefaultVisibility() { - return defaultVisibility; - } - public void setDefaultVisibility(Boolean defaultVisibility) { - this.defaultVisibility = defaultVisibility; - } - - public String getPage() { - return page; - } - public void setPage(String page) { - this.page = page; - } - - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - - public String getTitle() { - return title; - } - public void setTitle(String title) { - this.title = title; - } - - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - - public int getOrdinal() { - return ordinal; - } - public void setOrdinal(int ordinal) { - this.ordinal = ordinal; - } - - public String getNumbering() { - return numbering; - } - public void setNumbering(String numbering) { - this.numbering = numbering; - } - - @Override - public int compareTo(Object o) { - return this.ordinal.compareTo(((DatasetImportSection) o).getOrdinal()); } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportSections.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportSections.java deleted file mode 100644 index d4072dc7b..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportSections.java +++ /dev/null @@ -1,19 +0,0 @@ -package eu.eudat.models.data.datasetImport; - -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; -import java.util.Collections; -import java.util.List; - -@XmlRootElement(name = "sections") -public class DatasetImportSections{ - private List section; - - @XmlElement(name = "section") - public List getSection() { - return section; - } - public void setSection(List section) { - this.section = section; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportViewStyle.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportViewStyle.java deleted file mode 100644 index fc9830044..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportViewStyle.java +++ /dev/null @@ -1,20 +0,0 @@ -package eu.eudat.models.data.datasetImport; - -public class DatasetImportViewStyle { - private String renderStyle; - private String cssClass; - - public String getRenderStyle() { - return renderStyle; - } - public void setRenderStyle(String renderStyle) { - this.renderStyle = renderStyle; - } - - public String getCssClass() { - return cssClass; - } - public void setCssClass(String cssClass) { - this.cssClass = cssClass; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportVisibility.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportVisibility.java deleted file mode 100644 index 424caf1be..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/datasetImport/DatasetImportVisibility.java +++ /dev/null @@ -1,22 +0,0 @@ -package eu.eudat.models.data.datasetImport; - -import java.util.List; - -public class DatasetImportVisibility { - private List rules; - private String style; - - public List getRules() { - return rules; - } - public void setRules(List rules) { - this.rules = rules; - } - - public String getStyle() { - return style; - } - public void setStyle(String style) { - this.style = style; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/AssociatedProfile.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/AssociatedProfile.java deleted file mode 100644 index bc08b0435..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/AssociatedProfile.java +++ /dev/null @@ -1,77 +0,0 @@ -package eu.eudat.models.data.dmp; - -import eu.eudat.data.DescriptionTemplateEntity; -import eu.eudat.logic.xml.XmlSerializable; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import java.util.Map; -import java.util.UUID; - - -public class AssociatedProfile implements XmlSerializable { - private UUID id; - private UUID descriptionTemplateId; - private String label; - private Map data; - - public UUID getId() { - return id; - } - - public void setId(UUID id) { - this.id = id; - } - - public UUID getDescriptionTemplateId() { - return descriptionTemplateId; - } - - public void setDescriptionTemplateId(UUID descriptionTemplateId) { - this.descriptionTemplateId = descriptionTemplateId; - } - - public String getLabel() { - return label; - } - - public void setLabel(String label) { - this.label = label; - } - - public Map getData() { - return data; - } - - public void setData(Map data) { - this.data = data; - } - - @Override - public Element toXml(Document doc) { - Element profile = doc.createElement("profile"); - profile.setAttribute("profileId", this.descriptionTemplateId.toString()); - profile.setAttribute("label", this.label); - return profile; - } - - @Override - public AssociatedProfile fromXml(Element item) { - this.descriptionTemplateId = UUID.fromString(item.getAttribute("profileId")); - this.label = item.getAttribute("label"); - return this; - } - - public DescriptionTemplateEntity toData() { - DescriptionTemplateEntity profile = new DescriptionTemplateEntity(); - profile.setId(this.descriptionTemplateId); - profile.setLabel(this.label); - return profile; - } - - public AssociatedProfile fromData(DescriptionTemplateEntity entity) { - this.descriptionTemplateId = entity.getId(); - this.label = entity.getLabel(); - return this; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/AssociatedProfileImportModels.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/AssociatedProfileImportModels.java deleted file mode 100644 index 505a268a5..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/AssociatedProfileImportModels.java +++ /dev/null @@ -1,31 +0,0 @@ -package eu.eudat.models.data.dmp; - -import java.util.List; -import java.util.UUID; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlElementWrapper; -import jakarta.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "profile") -public class AssociatedProfileImportModels { - private UUID id; - private String label; - private List section; - - @XmlElement(name = "profileId") - public UUID getId() { return id; } - public void setId(UUID id) { this.id = id; } - - @XmlElement(name = "profileLabel") - public String getLabel() { return label; } - public void setLabel(String label) { this.label = label; } - - @XmlElementWrapper(name="profileInSections") - @XmlElement(name = "section") - public List getSection() { - return section; - } - public void setSection(List section) { - this.section = section; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DatasetImportModels.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DatasetImportModels.java deleted file mode 100644 index 4574c76a5..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DatasetImportModels.java +++ /dev/null @@ -1,56 +0,0 @@ -package eu.eudat.models.data.dmp; - -import eu.eudat.models.data.dmp.adpter.PageAdapter; - -import jakarta.xml.bind.annotation.XmlAttribute; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlElementWrapper; -import jakarta.xml.bind.annotation.XmlRootElement; -import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -@XmlRootElement(name = "dataset") -public class DatasetImportModels { - - private String name; - private UUID profile; - private int dmpSectionIndex; - private HashMap fieldImportModels; - - @XmlAttribute(name ="name") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - @XmlElement(name = "profile-id") - public UUID getProfile() { - return profile; - } - public void setProfile(UUID profile) { - this.profile = profile; - } - - @XmlElement(name = "dmpSectionIndex") - public int getDmpSectionIndex() { - return dmpSectionIndex; - } - public void setDmpSectionIndex(int dmpSectionIndex) { - this.dmpSectionIndex = dmpSectionIndex; - } - - @XmlJavaTypeAdapter(PageAdapter.class) - @XmlElement(name = "pages") - public HashMap getFieldImportModels() { - return fieldImportModels; - } - - public void setFieldImportModels(HashMap fieldImportModels) { - this.fieldImportModels = fieldImportModels; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DmpImportModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DmpImportModel.java deleted file mode 100644 index 0623141a4..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DmpImportModel.java +++ /dev/null @@ -1,163 +0,0 @@ -package eu.eudat.models.data.dmp; - -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlElementWrapper; -import jakarta.xml.bind.annotation.XmlRootElement; -import java.util.List; - -@XmlRootElement(name = "dmp") -public class DmpImportModel { - private String description; - private String dmpName; - private DmpProfileImportModel profile; - private FunderImportModels funderImportModels; - private GrantImportModels grantImportModels; - private ProjectImportModels projectImportModels; - private List profilesImportModels; - private List organisationImportModels; - private List researchersImportModels; - private List associatedUsersImportModels; - private List extraFieldsImportModels; - private List dynamicFieldsImportModels; - private List datasetImportModels; - private String language; - private Boolean visibility; - private String publicDate; - private String costs; - - @XmlElement(name = "description") - public String getDescriptionImport() { - return description; - } - public void setDescriptionImport(String description) { - this.description = description; - } - - @XmlElement(name = "dmpName") - public String getDmpNameImport() { - return dmpName; - } - public void setDmpNameImport(String dmpName) { - this.dmpName = dmpName; - } - - @XmlElement(name = "dmpProfile") - public DmpProfileImportModel getDmpProfile() { return profile; } - public void setDmpProfile(DmpProfileImportModel profile) { this.profile = profile; } - - @XmlElement(name = "grant") - public GrantImportModels getGrantImport() { - return grantImportModels; - } - public void setGrantImport(GrantImportModels grantImportModels) { - this.grantImportModels = grantImportModels; - } - - @XmlElement(name = "funder") - public FunderImportModels getFunderImportModels() { - return funderImportModels; - } - public void setFunderImportModels(FunderImportModels funderImportModels) { - this.funderImportModels = funderImportModels; - } - - @XmlElement(name = "project") - public ProjectImportModels getProjectImportModels() { - return projectImportModels; - } - public void setProjectImportModels(ProjectImportModels projectImportModels) { - this.projectImportModels = projectImportModels; - } - - @XmlElementWrapper(name="organisations") - @XmlElement(name = "organisation") - public List getOrganisationImportModels() { - return organisationImportModels; - } - public void setOrganisationImportModels(List organisationImportModels) { - this.organisationImportModels = organisationImportModels; - } - - @XmlElementWrapper(name="profiles") - @XmlElement(name = "profile") - public List getProfilesImportModels() { - return profilesImportModels; - } - public void setProfilesImportModels(List profilesImportModels) { - this.profilesImportModels = profilesImportModels; - } - - @XmlElementWrapper(name="researchers") - @XmlElement(name = "researcher") - public List getResearchersImportModels() { - return researchersImportModels; - } - public void setResearchersImportModels(List researchersImportModels) { - this.researchersImportModels = researchersImportModels; - } - - @XmlElementWrapper(name="UserInfos") - @XmlElement(name = "UserInfo") - public List getAssociatedUsersImportModels() { - return associatedUsersImportModels; - } - public void setAssociatedUsersImportModels(List associatedUsersImportModels) { - this.associatedUsersImportModels = associatedUsersImportModels; - } - - @XmlElementWrapper(name="extraFields") - @XmlElement(name = "extraField") - public List getExtraFieldsImportModels() { - return extraFieldsImportModels; - } - public void setExtraFieldsImportModels(List extraFieldsImportModels) { - this.extraFieldsImportModels = extraFieldsImportModels; - } - - @XmlElementWrapper(name="dynamicFieldWithValues") - @XmlElement(name = "dynamicFieldWithValue") - public List getDynamicFieldsImportModels() { - return dynamicFieldsImportModels; - } - public void setDynamicFieldsImportModels(List dynamicFieldsImportModels) { - this.dynamicFieldsImportModels = dynamicFieldsImportModels; - } - - @XmlElementWrapper(name="datasets") - @XmlElement(name = "dataset") - public List getDatasetImportModels() { return datasetImportModels; } - public void setDatasetImportModels(List datasetImportModels) { this.datasetImportModels = datasetImportModels; } - - @XmlElement(name = "language") - public String getLanguage() { - return language; - } - - public void setLanguage(String language) { - this.language = language; - } - @XmlElement(name = "visibility") - public Boolean getVisibility() { - return visibility; - } - - public void setVisibility(Boolean visibility) { - this.visibility = visibility; - } - @XmlElement(name = "publicDate") - public String getPublicDate() { - return publicDate; - } - - public void setPublicDate(String publicDate) { - this.publicDate = publicDate; - } - @XmlElement(name = "costs") - public String getCosts() { - return costs; - } - - public void setCosts(String costs) { - this.costs = costs; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DmpProfileImportModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DmpProfileImportModel.java deleted file mode 100644 index 04aec6abb..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DmpProfileImportModel.java +++ /dev/null @@ -1,25 +0,0 @@ -package eu.eudat.models.data.dmp; - -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; -import java.util.UUID; - -@XmlRootElement(name = "dmpProfile") -public class DmpProfileImportModel { - - private String dmpProfileName; - private UUID dmpProfileId; - private String values; - - @XmlElement(name = "dmpProfileName") - public String getDmpProfileName() { return dmpProfileName; } - public void setDmpProfileName(String dmpProfileName) { this.dmpProfileName = dmpProfileName; } - - @XmlElement(name = "dmpProfileId") - public UUID getDmpProfileId() { return dmpProfileId; } - public void setDmpProfileId(UUID dmpProfileId) { this.dmpProfileId = dmpProfileId; } - - @XmlElement(name = "values") - public String getValues() { return values; } - public void setValues(String values) { this.values = values; } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DynamicFieldWithValueImportModels.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DynamicFieldWithValueImportModels.java deleted file mode 100644 index 0acae369e..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DynamicFieldWithValueImportModels.java +++ /dev/null @@ -1,7 +0,0 @@ -package eu.eudat.models.data.dmp; - -import jakarta.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "dynamicFieldWithValue") -public class DynamicFieldWithValueImportModels { -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/ExtraFieldModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/ExtraFieldModel.java deleted file mode 100644 index 333876a10..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/ExtraFieldModel.java +++ /dev/null @@ -1,20 +0,0 @@ -package eu.eudat.models.data.dmp; - -public class ExtraFieldModel { - private String id; - private String value; - - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - - public String getValue() { - return value; - } - public void setValue(String value) { - this.value = value; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/ExtraFieldsImportModels.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/ExtraFieldsImportModels.java deleted file mode 100644 index 7f6a48899..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/ExtraFieldsImportModels.java +++ /dev/null @@ -1,36 +0,0 @@ -package eu.eudat.models.data.dmp; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "extraField") -public class ExtraFieldsImportModels { - - private String id; - private String label; - private String value; - - @XmlElement(name = "id") - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - - @XmlElement(name = "label") - public String getLabel() { - return label; - } - public void setLabel(String label) { - this.label = label; - } - - @XmlElement(name = "value") - public String getValue() { - return value; - } - public void setValue(String value) { - this.value = value; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/FieldImportModels.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/FieldImportModels.java deleted file mode 100644 index c2d5446ba..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/FieldImportModels.java +++ /dev/null @@ -1,27 +0,0 @@ -package eu.eudat.models.data.dmp; - -import jakarta.xml.bind.annotation.XmlAttribute; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "field") -public class FieldImportModels { - private String id; - private String value; - - @XmlAttribute(name = "id") - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - - @XmlElement(name = "value") - public String getValue() { - return value; - } - public void setValue(String value) { - this.value = value; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/FunderImportModels.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/FunderImportModels.java deleted file mode 100644 index 42c4b3e51..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/FunderImportModels.java +++ /dev/null @@ -1,26 +0,0 @@ -package eu.eudat.models.data.dmp; - -import jakarta.xml.bind.annotation.XmlRootElement; -import java.util.UUID; - -@XmlRootElement(name = "funder") -public class FunderImportModels { - 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; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/GrantImportModels.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/GrantImportModels.java deleted file mode 100644 index 09b32df56..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/GrantImportModels.java +++ /dev/null @@ -1,40 +0,0 @@ -package eu.eudat.models.data.dmp; - -import jakarta.xml.bind.annotation.XmlRootElement; -import java.util.UUID; - -@XmlRootElement(name = "grant") -public class GrantImportModels { - private UUID id; - private String label; - private String abbreviation; - private String description; - - 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; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/OrganisationImportModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/OrganisationImportModel.java deleted file mode 100644 index ec3f0f5ca..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/OrganisationImportModel.java +++ /dev/null @@ -1,40 +0,0 @@ -package eu.eudat.models.data.dmp; - -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "organisation") -public class OrganisationImportModel { - private String source; - private String name; - private String id; - private String reference; - - @XmlElement(name = "source") - public String getOrganaisationSourceImport() { - return source; - } - public void setOrganaisationSourceImport(String source) { - this.source = source; - } - - @XmlElement(name = "name") - public String getOrganaisationNameImport() { - return name; - } - public void setOrganaisationNameImport(String name) { - this.name = name; - } - - @XmlElement(name = "id") - public String getOrganaisationIdImport() { - return id; - } - public void setOrganaisationIdImport(String id) { - this.id = id; - } - - @XmlElement(name = "reference") - public String getOrganaisationReferenceImport() { return reference; } - public void setOrganaisationReferenceImport(String reference) { this.reference = reference; } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/ProjectImportModels.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/ProjectImportModels.java deleted file mode 100644 index ddfd1c2dc..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/ProjectImportModels.java +++ /dev/null @@ -1,26 +0,0 @@ -package eu.eudat.models.data.dmp; - -import jakarta.xml.bind.annotation.XmlRootElement; -import java.util.UUID; - -@XmlRootElement(name = "project") -public class ProjectImportModels { - 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; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/ResearcherImportModels.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/ResearcherImportModels.java deleted file mode 100644 index dfbc1c68b..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/ResearcherImportModels.java +++ /dev/null @@ -1,49 +0,0 @@ -package eu.eudat.models.data.dmp; - -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "researcher") -public class ResearcherImportModels { - private String label; - private String name; - private String id; - private int status; - private String reference; - - @XmlElement(name = "label") - public String getResearcherImportLabel() { - return label; - } - public void setResearcherImportLabel(String label) { - this.label = label; - } - - @XmlElement(name = "name") - public String getResearcherImportName() { - return name; - } - public void setResearcherImportName(String name) { - this.name = name; - } - - @XmlElement(name = "id") - public String getResearcherImportId() { - return id; - } - public void setResearcherImportId(String id) { - this.id = id; - } - - @XmlElement(name = "status") - public int getResearcherImportStatus() { - return status; - } - public void setResearcherImportStatus(int status) { - this.status = status; - } - - @XmlElement(name = "reference") - public String getResearcherImportReference() { return reference; } - public void setResearcherImportReference(String reference) { this.reference = reference; } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/UserInfoImportModels.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/UserInfoImportModels.java deleted file mode 100644 index 708bef7ab..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/UserInfoImportModels.java +++ /dev/null @@ -1,7 +0,0 @@ -package eu.eudat.models.data.dmp; - -import jakarta.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "userInfo") -public class UserInfoImportModels { -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/adpter/PageAdapter.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/adpter/PageAdapter.java deleted file mode 100644 index ca62d7a8a..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/adpter/PageAdapter.java +++ /dev/null @@ -1,36 +0,0 @@ -package eu.eudat.models.data.dmp.adpter; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -import jakarta.xml.bind.annotation.adapters.XmlAdapter; -import java.util.HashMap; -import java.util.Map; - -public class PageAdapter extends XmlAdapter> { - private static final Logger logger = LoggerFactory.getLogger(PageAdapter.class); - @Override - public HashMap unmarshal(Object v) throws Exception { - Element data = (Element)v; - HashMap result = new HashMap<>(); - generateMap(data, result, "field"); - return result; - } - - private void generateMap(Node root, Map result, String target) { - for (int i = 0; i < root.getChildNodes().getLength(); i++) { - if (((Element)root).getTagName().equals(target)) { - result.put(((Element) root).getAttribute("id"), root.getFirstChild().getFirstChild() != null ? root.getFirstChild().getFirstChild().getNodeValue() : ""); - } else { - generateMap(root.getChildNodes().item(i), result, target); - } - } - } - - @Override - public Object marshal(HashMap v) throws Exception { - return null; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dynamicfields/Dependency.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dynamicfields/Dependency.java deleted file mode 100644 index 3bffc273b..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dynamicfields/Dependency.java +++ /dev/null @@ -1,25 +0,0 @@ -package eu.eudat.models.data.dynamicfields; - -/** - * Created by ikalyvas on 3/23/2018. - */ -public class Dependency { - private String id; - private String queryProperty; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getQueryProperty() { - return queryProperty; - } - - public void setQueryProperty(String queryProperty) { - this.queryProperty = queryProperty; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dynamicfields/DynamicField.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dynamicfields/DynamicField.java deleted file mode 100644 index e28ee070b..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dynamicfields/DynamicField.java +++ /dev/null @@ -1,55 +0,0 @@ -package eu.eudat.models.data.dynamicfields; - -import java.util.List; - -/** - * Created by ikalyvas on 3/23/2018. - */ -public class DynamicField { - private String id; - private String name; - private boolean required; - private String queryProperty; - private List dependencies; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getQueryProperty() { - return queryProperty; - } - - public void setQueryProperty(String queryProperty) { - this.queryProperty = queryProperty; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public boolean getRequired() { - return required; - } - - public void setRequired(boolean required) { - this.required = required; - } - - public List getDependencies() { - return dependencies; - } - - public void setDependencies(List dependencies) { - this.dependencies = dependencies; - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dynamicfields/DynamicFieldWithValue.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dynamicfields/DynamicFieldWithValue.java deleted file mode 100644 index 4f4e474a6..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dynamicfields/DynamicFieldWithValue.java +++ /dev/null @@ -1,65 +0,0 @@ -package eu.eudat.models.data.dynamicfields; - -import eu.eudat.models.data.helpermodels.Tuple; - -import java.util.List; - -/** - * Created by ikalyvas on 3/27/2018. - */ -public class DynamicFieldWithValue { - private String id; - private String name; - private boolean required; - private String queryProperty; - private Tuple value; - private List dependencies; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getQueryProperty() { - return queryProperty; - } - - public void setQueryProperty(String queryProperty) { - this.queryProperty = queryProperty; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public boolean getRequired() { - return required; - } - - public void setRequired(boolean required) { - this.required = required; - } - - public List getDependencies() { - return dependencies; - } - - public void setDependencies(List dependencies) { - this.dependencies = dependencies; - } - - public Tuple getValue() { - return value; - } - - public void setValue(Tuple value) { - this.value = value; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/errormodels/ValidationErrorContext.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/errormodels/ValidationErrorContext.java deleted file mode 100644 index 760d0fb41..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/errormodels/ValidationErrorContext.java +++ /dev/null @@ -1,15 +0,0 @@ -package eu.eudat.models.data.errormodels; - -import java.util.HashMap; - - -public class ValidationErrorContext extends HashMap { - - public ValidationErrorContext() { - - } - - public void addFieldError(String path, String message) { - this.put(path, message); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/ExternalDatasetSourcesModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/external/ExternalDatasetSourcesModel.java deleted file mode 100644 index e969b4276..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/ExternalDatasetSourcesModel.java +++ /dev/null @@ -1,20 +0,0 @@ -package eu.eudat.models.data.external; - -import java.util.List; -import java.util.Map; - - -public class ExternalDatasetSourcesModel extends ExternalListingItem { - @Override - public ExternalDatasetSourcesModel fromExternalItem(List> values) { - for (Map item : values) { - ExternalSourcesItemModel model = new ExternalSourcesItemModel(); - model.setId((String)item.get("pid")); - model.setUri((String)item.get("uri")); - model.setName((String)item.get("name")); - model.setSource((String)item.get("source")); - this.add(model); - } - return this; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/ExternalItem.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/external/ExternalItem.java deleted file mode 100644 index a8fed07a2..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/ExternalItem.java +++ /dev/null @@ -1,9 +0,0 @@ -package eu.eudat.models.data.external; - -import java.util.List; -import java.util.Map; - - -public interface ExternalItem { - T fromExternalItem(List> values); -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/ExternalListingItem.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/external/ExternalListingItem.java deleted file mode 100644 index 404738c97..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/ExternalListingItem.java +++ /dev/null @@ -1,8 +0,0 @@ -package eu.eudat.models.data.external; - -import java.util.ArrayList; - - -public abstract class ExternalListingItem extends ArrayList implements ExternalItem { - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/ExternalSourcesItemModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/external/ExternalSourcesItemModel.java deleted file mode 100644 index 38ff752fc..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/ExternalSourcesItemModel.java +++ /dev/null @@ -1,85 +0,0 @@ -package eu.eudat.models.data.external; - - -public class ExternalSourcesItemModel { - private String id; - private String pid; - private String name; - private String description; - private String uri; - private String remoteId; - private String abbreviation; - private String tag; - private String source; - private String key; - - 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 getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - - public String getUri() { - return uri; - } - public void setUri(String uri) { - this.uri = uri; - } - - public String getRemoteId() { - return remoteId; - } - public void setRemoteId(String remoteId) { - this.remoteId = remoteId; - } - - 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 String getKey() { - return key; - } - public void setKey(String key) { - this.key = key; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/FundersExternalSourcesModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/external/FundersExternalSourcesModel.java deleted file mode 100644 index 2f78b024b..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/FundersExternalSourcesModel.java +++ /dev/null @@ -1,23 +0,0 @@ -package eu.eudat.models.data.external; - -import java.util.List; -import java.util.Map; - -public class FundersExternalSourcesModel extends ExternalListingItem { - - @Override - public FundersExternalSourcesModel fromExternalItem(List> values) { - for (Map item : values) { - ExternalSourcesItemModel model = new ExternalSourcesItemModel(); - model.setRemoteId((String)item.get("pid")); - model.setUri((String)item.get("uri")); - model.setName((String)item.get("name")); - model.setDescription((String)item.get("description")); - model.setSource((String)item.get("source")); - model.setTag((String)item.get("tag")); - model.setKey((String)item.get("key")); - this.add(model); - } - return this; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/GrantsExternalSourcesModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/external/GrantsExternalSourcesModel.java deleted file mode 100644 index 99bd8d448..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/GrantsExternalSourcesModel.java +++ /dev/null @@ -1,22 +0,0 @@ -package eu.eudat.models.data.external; - -import java.util.List; -import java.util.Map; - - -public class GrantsExternalSourcesModel extends ExternalListingItem { - @Override - public GrantsExternalSourcesModel fromExternalItem(List> values) { - for (Map item : values) { - ExternalSourcesItemModel model = new ExternalSourcesItemModel(); - model.setRemoteId((String)item.get("pid")); - model.setUri((String)item.get("uri")); - model.setName((String)item.get("name")); - model.setDescription((String)item.get("description")); - model.setTag((String)item.get("tag")); - model.setKey((String)item.get("key")); - this.add(model); - } - return this; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/LicensesExternalSourcesModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/external/LicensesExternalSourcesModel.java deleted file mode 100644 index f2def68c4..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/LicensesExternalSourcesModel.java +++ /dev/null @@ -1,19 +0,0 @@ -package eu.eudat.models.data.external; - -import java.util.List; -import java.util.Map; - - -public class LicensesExternalSourcesModel extends ExternalListingItem { - @Override - public LicensesExternalSourcesModel fromExternalItem(List> values) { - for (Map item : values) { - ExternalSourcesItemModel model = new ExternalSourcesItemModel(); - model.setId((String)item.get("id")); - model.setUri((String)item.get("uri")); - model.setName((String)item.get("name")); - this.add(model); - } - return this; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/OrganisationsExternalSourcesModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/external/OrganisationsExternalSourcesModel.java deleted file mode 100644 index 29743a725..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/OrganisationsExternalSourcesModel.java +++ /dev/null @@ -1,23 +0,0 @@ -package eu.eudat.models.data.external; - -import org.springframework.stereotype.Component; - -import java.util.List; -import java.util.Map; - -@Component -public class OrganisationsExternalSourcesModel extends ExternalListingItem { - @Override - public OrganisationsExternalSourcesModel fromExternalItem(List> values) { - for (Map item : values) { - ExternalSourcesItemModel model = new ExternalSourcesItemModel(); - model.setRemoteId((String)item.get("pid")); - model.setUri((String)item.get("uri")); - model.setName((String)item.get("name")); - model.setTag((String)item.get("tag")); - model.setKey((String)item.get("key")); - this.add(model); - } - return this; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/ProjectsExternalSourcesModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/external/ProjectsExternalSourcesModel.java deleted file mode 100644 index 52de8bc32..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/ProjectsExternalSourcesModel.java +++ /dev/null @@ -1,72 +0,0 @@ -package eu.eudat.models.data.external; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.util.List; -import java.util.Map; - -public class ProjectsExternalSourcesModel extends ExternalListingItem { - private static final Logger logger = LoggerFactory.getLogger(ProjectsExternalSourcesModel.class); - private static final ObjectMapper mapper = new ObjectMapper(); - - @Override - public ProjectsExternalSourcesModel fromExternalItem(List> values) { - for (Map item : values) { - ExternalSourcesItemModel model = new ExternalSourcesItemModel(); - try { - JsonNode node = mapper.readTree(mapper.writeValueAsBytes(item)); - JsonNode name = node.get("name"); - if (name != null && !name.isNull() && name.isObject()) { - model.setName(node.get("name").get("$").asText()); - } else { - model.setName((String)item.get("name")); - } - - JsonNode pid = node.get("pid"); - if (pid != null && !pid.isNull() && pid.isObject()) { - model.setRemoteId(node.get("pid").get("$").asText()); - } else { - model.setRemoteId((String)item.get("pid")); - } - - JsonNode uri = node.get("uri"); - if (uri != null && !uri.isNull() && uri.isObject()) { - model.setUri(node.get("uri").get("$").asText()); - } else { - model.setUri((String)item.get("uri")); - } - - JsonNode description = node.get("description"); - if (description != null && !description.isNull() && description.isObject()) { - model.setDescription(node.get("description").get("$").asText()); - } else { - model.setDescription((String)item.get("description")); - } - - JsonNode tag = node.get("tag"); - if (tag != null && !tag.isNull() && tag.isObject()) { - model.setTag(node.get("tag").get("$").asText()); - } else { - model.setTag((String)item.get("tag")); - } - - JsonNode key = node.get("key"); - if (key != null && !key.isNull() && key.isObject()) { - model.setKey(node.get("key").get("$").asText()); - } else { - model.setKey((String)item.get("key")); - } - - this.add(model); - - } catch (IOException e) { - logger.error(e.getMessage(), e); - } - } - return this; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/RegistriesExternalSourcesModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/external/RegistriesExternalSourcesModel.java deleted file mode 100644 index 380e59ad7..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/RegistriesExternalSourcesModel.java +++ /dev/null @@ -1,20 +0,0 @@ -package eu.eudat.models.data.external; - -import java.util.List; -import java.util.Map; - - -public class RegistriesExternalSourcesModel extends ExternalListingItem { - @Override - public RegistriesExternalSourcesModel fromExternalItem(List> values) { - for (Map item : values) { - ExternalSourcesItemModel model = new ExternalSourcesItemModel(); - model.setId((String)item.get("pid")); - model.setUri((String)item.get("uri")); - model.setName((String)item.get("name")); - model.setTag((String)item.get("tag")); - this.add(model); - } - return this; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/ResearchersExternalSourcesModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/external/ResearchersExternalSourcesModel.java deleted file mode 100644 index 29898fb03..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/ResearchersExternalSourcesModel.java +++ /dev/null @@ -1,27 +0,0 @@ -package eu.eudat.models.data.external; - -import java.util.List; -import java.util.Map; - - -public class ResearchersExternalSourcesModel extends ExternalListingItem { - @Override - public ResearchersExternalSourcesModel fromExternalItem(List> values) { - for (Map item : values) { - ExternalSourcesItemModel model = new ExternalSourcesItemModel(); - model.setRemoteId(item.get("pid")); - model.setUri(item.get("uri")); - switch (item.get("tag")) { - case "ORCID": - model.setName(item.get("name") + " (orcid:" + item.get("pid") + ")"); - break; - default: - model.setName(item.get("name")); - } - model.setTag(item.get("tag")); - model.setKey(item.get("key")); - this.add(model); - } - return this; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/ServiceExternalSourcesModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/external/ServiceExternalSourcesModel.java deleted file mode 100644 index f09013b28..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/ServiceExternalSourcesModel.java +++ /dev/null @@ -1,20 +0,0 @@ -package eu.eudat.models.data.external; - -import java.util.List; -import java.util.Map; - - -public class ServiceExternalSourcesModel extends ExternalListingItem { - @Override - public ServiceExternalSourcesModel fromExternalItem(List> values) { - for (Map item : values) { - ExternalSourcesItemModel model = new ExternalSourcesItemModel(); - model.setId((String)item.get("pid")); - model.setUri((String)item.get("label")); - model.setName((String)item.get("name")); - model.setTag((String)item.get("tag")); - this.add(model); - } - return this; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/TagExternalSourcesModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/external/TagExternalSourcesModel.java deleted file mode 100644 index b23d5afba..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/TagExternalSourcesModel.java +++ /dev/null @@ -1,23 +0,0 @@ -package eu.eudat.models.data.external; - -import java.util.List; -import java.util.Map; - -/** - * Created by ikalyvas on 7/9/2018. - */ -public class TagExternalSourcesModel extends ExternalListingItem { - - @Override - public TagExternalSourcesModel fromExternalItem(List> values) { - for (Map item : values) { - ExternalSourcesItemModel model = new ExternalSourcesItemModel(); - model.setId((String)item.get("pid")); - model.setUri((String)item.get("label")); - model.setName((String)item.get("name")); - model.setTag((String)item.get("tag")); - this.add(model); - } - return this; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/orcid/ExpandedResult.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/external/orcid/ExpandedResult.java deleted file mode 100644 index 116c228db..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/orcid/ExpandedResult.java +++ /dev/null @@ -1,44 +0,0 @@ -package eu.eudat.models.data.external.orcid; - -import jakarta.xml.bind.annotation.XmlAttribute; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "expanded-result", namespace = "http://www.orcid.org/ns/expanded-search") -public class ExpandedResult { - - private String pid; - private String givenNames; - private String familyName; - - public ExpandedResult(String givenNames, String familyName) { - this.givenNames = givenNames; - this.familyName = familyName; - } - - public ExpandedResult() { - } - - @XmlElement(name = "orcid-id", namespace = "http://www.orcid.org/ns/expanded-search") - public String getPid() { - return pid; - } - public void setPid(String pid) { - this.pid = pid; - } - - @XmlElement(name = "given-names", namespace = "http://www.orcid.org/ns/expanded-search") - public String getGivenNames() { - return givenNames; - } - public void setGivenNames(String givenNames) { - this.givenNames = givenNames; - } - @XmlElement(name = "family-names", namespace = "http://www.orcid.org/ns/expanded-search") - public String getFamilyName() { - return familyName; - } - public void setFamilyName(String familyName) { - this.familyName = familyName; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/orcid/ExpandedSearch.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/external/orcid/ExpandedSearch.java deleted file mode 100644 index dd8b1f88d..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/orcid/ExpandedSearch.java +++ /dev/null @@ -1,18 +0,0 @@ -package eu.eudat.models.data.external.orcid; - -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; -import java.util.List; - -@XmlRootElement(name = "expanded-search", namespace = "http://www.orcid.org/ns/expanded-search") -public class ExpandedSearch { - List expandedResults; - - @XmlElement(name = "expanded-result", namespace = "http://www.orcid.org/ns/expanded-search") - public List getExpandedResults() { - return expandedResults; - } - public void setExpandedResults(List expandedResults) { - this.expandedResults = expandedResults; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/orcid/PersonalDetails.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/external/orcid/PersonalDetails.java deleted file mode 100644 index ac31c3254..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/orcid/PersonalDetails.java +++ /dev/null @@ -1,26 +0,0 @@ -package eu.eudat.models.data.external.orcid; - -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; -import java.util.Arrays; - -@XmlRootElement(name = "personal-details", namespace = "http://www.orcid.org/ns/personal-details") -public class PersonalDetails { - - private PersonalName name; - - public PersonalDetails(PersonalName name) { - this.name = name; - } - - public PersonalDetails() { - } - - @XmlElement(name="name", namespace = "http://www.orcid.org/ns/personal-details") - public PersonalName getName() { - return name; - } - public void setName(PersonalName name) { - this.name = name; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/orcid/PersonalName.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/external/orcid/PersonalName.java deleted file mode 100644 index b57f48a19..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/external/orcid/PersonalName.java +++ /dev/null @@ -1,44 +0,0 @@ -package eu.eudat.models.data.external.orcid; - -import jakarta.xml.bind.annotation.XmlAttribute; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name="name", namespace = "http://www.orcid.org/ns/personal-details") -public class PersonalName { - - private String id; - private String givenNames; - private String familyName; - - public PersonalName(String givenNames, String familyName) { - this.givenNames = givenNames; - this.familyName = familyName; - } - - public PersonalName() { - } - - @XmlAttribute(name = "path") - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - - @XmlElement(name = "given-names", namespace = "http://www.orcid.org/ns/personal-details") - public String getGivenNames() { - return givenNames; - } - public void setGivenNames(String givenNames) { - this.givenNames = givenNames; - } - @XmlElement(name = "family-name", namespace = "http://www.orcid.org/ns/personal-details") - public String getFamilyName() { - return familyName; - } - public void setFamilyName(String familyName) { - this.familyName = familyName; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/externalurl/ExternalSourcesConfiguration.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/externalurl/ExternalSourcesConfiguration.java deleted file mode 100644 index 2f8778b0b..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/externalurl/ExternalSourcesConfiguration.java +++ /dev/null @@ -1,81 +0,0 @@ -package eu.eudat.models.data.externalurl; - -import java.util.List; - -/** - * Created by ikalyvas on 5/17/2018. - */ -public class ExternalSourcesConfiguration { - - public static class ExternalSourcesUrlModel{ - private String key; - private String label; - - public ExternalSourcesUrlModel(String key, String label) { - this.key = key; - this.label = label; - } - - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - public String getLabel() { - return label; - } - - public void setLabel(String label) { - this.label = label; - } - } - - private List registries; - private List dataRepositories; - private List services; - private List externalDatasets; - /* private List tags; - - public List getTags() { - return tags; - } - - public void setTags(List tags) { - this.tags = tags; - }*/ - - public List getRegistries() { - return registries; - } - - public void setRegistries(List registries) { - this.registries = registries; - } - - public List getDataRepositories() { - return dataRepositories; - } - - public void setDataRepositories(List dataRepositories) { - this.dataRepositories = dataRepositories; - } - - public List getServices() { - return services; - } - - public void setServices(List services) { - this.services = services; - } - - public List getExternalDatasets() { - return externalDatasets; - } - - public void setExternalDatasets(List externalDatasets) { - this.externalDatasets = externalDatasets; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/files/ContentFile.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/files/ContentFile.java deleted file mode 100644 index 59d85e9fc..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/files/ContentFile.java +++ /dev/null @@ -1,55 +0,0 @@ -package eu.eudat.models.data.files; - -import java.util.UUID; - -/** - * Created by ikalyvas on 3/15/2018. - */ -public class ContentFile { - private String filename; - private UUID id; - private String location; - private String type; - - public ContentFile() { - } - - public ContentFile(String filename, UUID id, String location, String type) { - this.filename = filename; - this.id = id; - this.location = location; - this.type = type; - } - - public UUID getId() { - return id; - } - - public void setId(UUID id) { - this.id = id; - } - - public String getFilename() { - return filename; - } - - public void setFilename(String filename) { - this.filename = filename; - } - - public String getLocation() { - return location; - } - - public void setLocation(String location) { - this.location = location; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/helpermodels/Pair.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/helpermodels/Pair.java deleted file mode 100644 index 9264e2f43..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/helpermodels/Pair.java +++ /dev/null @@ -1,7 +0,0 @@ -package eu.eudat.models.data.helpermodels; - -/** - * Created by ikalyvas on 3/28/2018. - */ -public class Pair { -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/helpermodels/Tuple.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/helpermodels/Tuple.java deleted file mode 100644 index 6927bfe0a..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/helpermodels/Tuple.java +++ /dev/null @@ -1,51 +0,0 @@ -package eu.eudat.models.data.helpermodels; - -/** - * Created by ikalyvas on 3/23/2018. - */ -public class Tuple { - private L id; - private R label; - - public Tuple() { - } - - public Tuple(L id, R label) { - this.id = id; - this.label = label; - } - - public L getId() { - return id; - } - - public void setId(L id) { - this.id = id; - } - - public R getLabel() { - return label; - } - - public void setLabel(R label) { - this.label = label; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Tuple tuple = (Tuple) o; - - if (id != null ? !id.equals(tuple.getId()) : tuple.id != null) return false; - return label != null ? label.equals(tuple.label) : tuple.label == null; - } - - @Override - public int hashCode() { - int result = id != null ? id.hashCode() : 0; - result = 31 * result + (label != null ? label.hashCode() : 0); - return result; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/helpers/common/AutoCompleteLookupItem.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/helpers/common/AutoCompleteLookupItem.java deleted file mode 100644 index d35813db9..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/helpers/common/AutoCompleteLookupItem.java +++ /dev/null @@ -1,25 +0,0 @@ -package eu.eudat.models.data.helpers.common; - -import eu.eudat.data.dao.criteria.Criteria; - -public class AutoCompleteLookupItem extends Criteria{ - private String profileID; - private String fieldID; - - public String getProfileID() { - return profileID; - } - - public void setProfileID(String profileID) { - this.profileID = profileID; - } - - public String getFieldID() { - return fieldID; - } - - public void setFieldID(String fieldID) { - this.fieldID = fieldID; - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/helpers/common/AutoCompleteOptionsLookupItem.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/helpers/common/AutoCompleteOptionsLookupItem.java deleted file mode 100644 index cfaa1bc2f..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/helpers/common/AutoCompleteOptionsLookupItem.java +++ /dev/null @@ -1,19 +0,0 @@ -package eu.eudat.models.data.helpers.common; - -import eu.eudat.data.dao.criteria.Criteria; -import eu.eudat.commons.types.descriptiontemplate.fielddata.ExternalSelectDataEntity; - -import java.util.List; - -public class AutoCompleteOptionsLookupItem extends Criteria { - - private List externalSelectSourceEntityList; - - public List getAutoCompleteSingleDataList() { - return externalSelectSourceEntityList; - } - public void setAutoCompleteSingleDataList(List externalSelectSourceEntityList) { - this.externalSelectSourceEntityList = externalSelectSourceEntityList; - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/invitation/Invitation.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/invitation/Invitation.java deleted file mode 100644 index 1f61973df..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/invitation/Invitation.java +++ /dev/null @@ -1,37 +0,0 @@ -package eu.eudat.models.data.invitation; - -import eu.eudat.model.User; - -import java.util.List; -import java.util.UUID; - - -public class Invitation { - private UUID dataManagementPlan; - private List users; - private Integer role; - - public UUID getDataManagementPlan() { - return dataManagementPlan; - } - - public void setDataManagementPlan(UUID dataManagementPlan) { - this.dataManagementPlan = dataManagementPlan; - } - - public List getUsers() { - return users; - } - - public void setUsers(List users) { - this.users = users; - } - - public Integer getRole() { - return role; - } - - public void setRole(Integer role) { - this.role = role; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/invitation/Properties.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/invitation/Properties.java deleted file mode 100644 index df87dada4..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/invitation/Properties.java +++ /dev/null @@ -1,18 +0,0 @@ -package eu.eudat.models.data.invitation; - -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -public class Properties { - - private Integer role; - - @XmlElement(name = "role") - public Integer getRole() { - return role; - } - public void setRole(Integer role) { - this.role = role; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/loginprovider/LoginProviderUser.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/loginprovider/LoginProviderUser.java deleted file mode 100644 index 08e8303e4..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/loginprovider/LoginProviderUser.java +++ /dev/null @@ -1,59 +0,0 @@ -package eu.eudat.models.data.loginprovider; - - -public class LoginProviderUser { - private String name; - private String id; - private String email; - private String secret; - private String avatarUrl; - private boolean isVerified; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public boolean getIsVerified() { - return isVerified; - } - - public void setIsVerified(boolean verified) { - isVerified = verified; - } - - public String getSecret() { - return secret; - } - - public void setSecret(String secret) { - this.secret = secret; - } - - public String getAvatarUrl() { - return avatarUrl; - } - - public void setAvatarUrl(String avatarUrl) { - this.avatarUrl = avatarUrl; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/pid/PidLink.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/pid/PidLink.java deleted file mode 100644 index bb0b83456..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/pid/PidLink.java +++ /dev/null @@ -1,21 +0,0 @@ -package eu.eudat.models.data.pid; - -public class PidLink { - - private String pid; - private String link; - - public String getPid() { - return pid; - } - public void setPid(String pid) { - this.pid = pid; - } - - public String getLink() { - return link; - } - public void setLink(String link) { - this.link = link; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/pid/PidLinks.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/pid/PidLinks.java deleted file mode 100644 index 4d1ffa3af..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/pid/PidLinks.java +++ /dev/null @@ -1,16 +0,0 @@ -package eu.eudat.models.data.pid; - -import java.util.ArrayList; -import java.util.List; - -public class PidLinks { - - private List pidLinks = new ArrayList<>(); - - public List getPidLinks() { - return pidLinks; - } - public void setPidLinks(List pidLinks) { - this.pidLinks = pidLinks; - } -} 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 deleted file mode 100644 index 1cee018a6..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/project/ProjectDMPEditorModel.java +++ /dev/null @@ -1,29 +0,0 @@ -package eu.eudat.models.data.project; - -public class ProjectDMPEditorModel { - private String label; - private String description; - private String reference; - - 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/properties/DatasetProfilePage.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/properties/DatasetProfilePage.java deleted file mode 100644 index cae5de7ea..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/properties/DatasetProfilePage.java +++ /dev/null @@ -1,34 +0,0 @@ -package eu.eudat.models.data.properties; - -import java.util.List; - - -public class DatasetProfilePage { - private Integer ordinal; - private String title; - private List
sections; - - public Integer getOrdinal() { - return ordinal; - } - - public void setOrdinal(Integer ordinal) { - this.ordinal = ordinal; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public List
getSections() { - return sections; - } - - public void setSections(List
sections) { - this.sections = sections; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/properties/Field.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/properties/Field.java deleted file mode 100644 index 04a46816b..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/properties/Field.java +++ /dev/null @@ -1,35 +0,0 @@ -package eu.eudat.models.data.properties; - -import java.util.Map; - -public class Field implements PropertiesGenerator { - private String id; - - private String value; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public void toMap(Map fieldValues) { - fieldValues.put(this.id, this.value); - } - - @Override - public void toMap(Map fieldValues, int index) { - fieldValues.put(this.id, this.value); - } - -} \ No newline at end of file diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/properties/FieldSet.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/properties/FieldSet.java deleted file mode 100644 index e6766d584..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/properties/FieldSet.java +++ /dev/null @@ -1,62 +0,0 @@ -package eu.eudat.models.data.properties; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class FieldSet implements PropertiesGenerator { - private String id; - private List fields; - private List
multiplicityItems; - private String commentFieldValue; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getCommentFieldValue() { - return commentFieldValue; - } - - public void setCommentFieldValue(String commentFieldValue) { - this.commentFieldValue = commentFieldValue; - } - - public List
getMultiplicityItems() { - return multiplicityItems; - } - - public void setMultiplicityItems(List
multiplicityItems) { - this.multiplicityItems = multiplicityItems; - } - - public List getFields() { - return fields; - } - - public void setFields(List fields) { - this.fields = fields; - } - - @Override - public void toMap(Map fieldValues) { - fieldValues.put("commentFieldValue" + this.id, this.commentFieldValue); - this.fields.forEach(item -> item.toMap(fieldValues)); - Map multiplicity = new HashMap(); - if (this.multiplicityItems != null) { - this.multiplicityItems.forEach(item -> item.toMap(fieldValues, this.multiplicityItems.indexOf(item))); - } - //fieldValues.put(this.id,multiplicity); - } - - @Override - public void toMap(Map fieldValues, int index) { - this.fields.forEach(item -> item.toMap(fieldValues, index)); - //this.multiplicityItems.forEach(item->item.toMap(fieldValues,index)); - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/properties/Group.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/properties/Group.java deleted file mode 100644 index c21646413..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/properties/Group.java +++ /dev/null @@ -1,29 +0,0 @@ -package eu.eudat.models.data.properties; - -import java.util.List; -import java.util.Map; - -public class Group implements PropertiesGenerator { - private List
compositeFields; - - - public List
getCompositeFields() { - return compositeFields; - } - - public void setCompositeFields(List
compositeFields) { - this.compositeFields = compositeFields; - } - - @Override - public void toMap(Map fieldValues) { - this.compositeFields.forEach(item -> item.toMap(fieldValues)); - } - - @Override - public void toMap(Map fieldValues, int index) { - // TODO Auto-generated method stub - - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/properties/PropertiesGenerator.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/properties/PropertiesGenerator.java deleted file mode 100644 index 6b8d12576..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/properties/PropertiesGenerator.java +++ /dev/null @@ -1,9 +0,0 @@ -package eu.eudat.models.data.properties; - -import java.util.Map; - -public interface PropertiesGenerator { - void toMap(Map fieldValues); - - void toMap(Map fieldValues, int index); -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/properties/PropertiesModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/properties/PropertiesModel.java deleted file mode 100644 index 13c936df4..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/properties/PropertiesModel.java +++ /dev/null @@ -1,37 +0,0 @@ -package eu.eudat.models.data.properties; - -import java.util.List; -import java.util.Map; - -public class PropertiesModel implements PropertiesGenerator { - private int status; - private List pages; - - public List getPages() { - return pages; - } - - public void setPages(List pages) { - this.pages = pages; - } - - public int getStatus() { - return status; - } - - public void setStatus(int status) { - this.status = status; - } - - @Override - public void toMap(Map fieldValues) { - this.pages.forEach(item -> item.getSections().forEach(sectionItem -> sectionItem.toMap(fieldValues))); - } - - @Override - public void toMap(Map fieldValues, int index) { - // TODO Auto-generated method stub - - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/properties/Section.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/properties/Section.java deleted file mode 100644 index 46faaee1d..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/properties/Section.java +++ /dev/null @@ -1,38 +0,0 @@ -package eu.eudat.models.data.properties; - -import java.util.List; -import java.util.Map; - -public class Section implements PropertiesGenerator { - - private List
sections; - private List
compositeFields; - - public List
getSections() { - return sections; - } - - public void setSections(List
sections) { - this.sections = sections; - } - - public List
getCompositeFields() { - return compositeFields; - } - - public void setCompositeFields(List
compositeFields) { - this.compositeFields = compositeFields; - } - - @Override - public void toMap(Map fieldValues) { - this.sections.forEach(item -> item.toMap(fieldValues)); - this.compositeFields.forEach(item -> item.toMap(fieldValues)); - } - - @Override - public void toMap(Map fieldValues, int index) { - // TODO Auto-generated method stub - - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/ContactRDAExportModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/ContactRDAExportModel.java deleted file mode 100644 index 8260551b9..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/ContactRDAExportModel.java +++ /dev/null @@ -1,44 +0,0 @@ -package eu.eudat.models.data.rda; - -import eu.eudat.data.UserEntity; - -public class ContactRDAExportModel { - private String mbox; - private String name; - private IdRDAExportModel contact_id; - - public String getMbox() { - return mbox; - } - public void setMbox(String mbox) { - this.mbox = mbox; - } - - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - public IdRDAExportModel getContact_id() { - return contact_id; - } - public void setContact_id(IdRDAExportModel contact_id) { - this.contact_id = contact_id; - } - - public ContactRDAExportModel fromDataModel(UserEntity entity) { - ContactRDAExportModel contact = new ContactRDAExportModel(); - //contact.mbox = entity.getEmail();//TODO: GetEmail - contact.name = entity.getName(); - // TODO: we should use a contact_id and not our UUID. - if (!entity.getId().toString().isEmpty()) { - contact.contact_id = new IdRDAExportModel(entity.getId().toString(), "other"); - } - else { - contact.contact_id = null; - } - return contact; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DatasetDistributionRDAExportModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DatasetDistributionRDAExportModel.java deleted file mode 100644 index 0711822cb..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DatasetDistributionRDAExportModel.java +++ /dev/null @@ -1,93 +0,0 @@ -package eu.eudat.models.data.rda; - -import com.fasterxml.jackson.annotation.JsonIgnore; - -import java.util.List; - -public class DatasetDistributionRDAExportModel { - private String access_url; - private String available_till; - private String byte_size; - private String data_access; // Allowed values: open / shared / closed - private String description; - private String download_url; - private List format; // Format according to: https://www.iana.org/assignments/media-types/media-types.xhtml if appropriate, otherwise use the common name for this format - private HostRDAExportModel host; - private List license; - private String title; - - public String getAccess_url() { - return access_url; - } - public void setAccess_url(String access_url) { - this.access_url = access_url; - } - - public String getAvailable_till() { - return available_till; - } - public void setAvailable_till(String available_till) { - this.available_till = available_till; - } - - public String getByte_size() { - return byte_size; - } - public void setByte_size(String byte_size) { - this.byte_size = byte_size; - } - - public String getData_access() { - return data_access; - } - public void setData_access(String data_access) { - this.data_access = data_access; - } - - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - - public String getDownload_url() { - return download_url; - } - public void setDownload_url(String download_url) { - this.download_url = download_url; - } - - public List getFormat() { - return format; - } - public void setFormat(List format) { - this.format = format; - } - - public HostRDAExportModel getHost() { - return host; - } - public void setHost(HostRDAExportModel host) { - this.host = host; - } - - public List getLicense() { - return license; - } - public void setLicense(List license) { - this.license = license; - } - - public String getTitle() { - return title; - } - public void setTitle(String title) { - this.title = title; - } - - @JsonIgnore - public boolean isValid() { - return title != null || data_access != null; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DatasetMetadataRDAExportModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DatasetMetadataRDAExportModel.java deleted file mode 100644 index 2b5da6abd..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DatasetMetadataRDAExportModel.java +++ /dev/null @@ -1,47 +0,0 @@ -package eu.eudat.models.data.rda; - -import com.fasterxml.jackson.annotation.JsonIgnore; - -public class DatasetMetadataRDAExportModel { - private String description; // Not mandatory. - private String language; - private IdRDAExportModel metadata_standard_id; - - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - - public String getLanguage() { - return language; - } - public void setLanguage(String language) { - this.language = language; - } - - public IdRDAExportModel getMetadata_standard_id() { - return metadata_standard_id; - } - public void setMetadata_standard_id(IdRDAExportModel metadata_standard_id) { - this.metadata_standard_id = metadata_standard_id; - } - - public DatasetMetadataRDAExportModel fromDataModel(String key, Object value) { - DatasetMetadataRDAExportModel metadataRDAExportModel = new DatasetMetadataRDAExportModel(); - if (key.contains("metadata_standard_id")) - metadataRDAExportModel.setMetadata_standard_id(new IdRDAExportModel(value.toString(), "other")); - else if (key.contains("language")) - metadataRDAExportModel.setLanguage(value.toString()); - else if (key.contains("description")) - metadataRDAExportModel.setDescription(value.toString()); - - return metadataRDAExportModel; - } - - @JsonIgnore - public boolean isValid() { - return description != null || language != null || metadata_standard_id != null; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DatasetRDAExportModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DatasetRDAExportModel.java deleted file mode 100644 index 844b89bf7..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DatasetRDAExportModel.java +++ /dev/null @@ -1,476 +0,0 @@ -package eu.eudat.models.data.rda; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.jayway.jsonpath.JsonPath; -import eu.eudat.data.DescriptionEntity; -import eu.eudat.logic.xml.XmlBuilder; -import org.json.JSONArray; -import org.json.JSONObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -import javax.management.InvalidApplicationException; -import javax.xml.xpath.*; -import java.text.DateFormat; -import java.util.*; - -import static java.util.stream.Collectors.groupingBy; - -public class DatasetRDAExportModel { - private static final Logger logger = LoggerFactory.getLogger(DatasetRDAExportModel.class); - - private static final ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - private Map multiplicityIdToFieldSetId = new HashMap<>(); - - private List data_quality_assurance; - private IdRDAExportModel dataset_id; - private String description; - private List distribution; - private String issued; // Created Date, could also use finalized one. - private List keyword; - private String language; - private List metadata; - private String personal_data; // Allowed Values: yes no unknown. - private String preservation_statement; - private List security_and_privacy; - private String sensitive_data; // Allowed Values: yes no unknown. - private List technical_resource; - private String title; - private String type; // Type according to: http://vocabularies.coar-repositories.org/pubby/resource_type.html - - public List getData_quality_assurance() { - return data_quality_assurance; - } - public void setData_quality_assurance(List data_quality_assurance) { - this.data_quality_assurance = data_quality_assurance; - } - - public IdRDAExportModel getDataset_id() { - return dataset_id; - } - public void setDataset_id(IdRDAExportModel dataset_id) { - this.dataset_id = dataset_id; - } - - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - - public List getDistribution() { - return distribution; - } - public void setDistribution(List distribution) { - this.distribution = distribution; - } - - public String getIssued() { - return issued; - } - public void setIssued(String issued) { - this.issued = issued; - } - - public List getKeyword() { - return keyword; - } - public void setKeyword(List keyword) { - this.keyword = keyword; - } - - public String getLanguage() { - return language; - } - public void setLanguage(String language) { - this.language = language; - } - - public List getMetadata() { - return metadata; - } - public void setMetadata(List metadata) { - this.metadata = metadata; - } - - public String getPersonal_data() { - return personal_data; - } - public void setPersonal_data(String personal_data) { - this.personal_data = personal_data; - } - - public String getPreservation_statement() { - return preservation_statement; - } - public void setPreservation_statement(String preservation_statement) { - this.preservation_statement = preservation_statement; - } - - public List getSecurity_and_privacy() { - return security_and_privacy; - } - public void setSecurity_and_privacy(List security_and_privacy) { - this.security_and_privacy = security_and_privacy; - } - - public String getSensitive_data() { - return sensitive_data; - } - public void setSensitive_data(String sensitive_data) { - this.sensitive_data = sensitive_data; - } - - public List getTechnical_resource() { - return technical_resource; - } - public void setTechnical_resource(List technical_resource) { - this.technical_resource = technical_resource; - } - - public String getTitle() { - return title; - } - public void setTitle(String title) { - this.title = title; - } - - public String getType() { - return type; - } - public void setType(String type) { - this.type = type; - } - - - public DatasetRDAExportModel fromDataModel(DescriptionEntity descriptionEntity) { - // Map of template Ids to rda values. - JSONObject jObject = new JSONObject(descriptionEntity.getProperties()); - Map templateIdsToValues = jObject.toMap(); - - /*--------- Building dataset rda export model ---------*/ - DatasetRDAExportModel datasetRDAExportModel = new DatasetRDAExportModel(); - datasetRDAExportModel.setDataset_id(new IdRDAExportModel(descriptionEntity.getId().toString(), "other")); - if (descriptionEntity.getDescription() != null) datasetRDAExportModel.setDescription(descriptionEntity.getDescription().replace("\n", " ")); - datasetRDAExportModel.setIssued(DateFormat.getDateInstance(DateFormat.SHORT).format(descriptionEntity.getCreatedAt())); - datasetRDAExportModel.setLanguage("en"); // mock data - datasetRDAExportModel.setTitle(descriptionEntity.getLabel()); - - // Transform the answered dataset description to json so we can parse it and fill the rda model. - JSONObject datasetDescriptionJson = null; - try { - //TODO - //String jsonResult = mapper.writeValueAsString(datasetManager.getSingle(descriptionEntity.getId().toString()).getDatasetProfileDefinition()); - String jsonResult = mapper.writeValueAsString(null); - datasetDescriptionJson = new JSONObject(jsonResult); - } catch (JsonProcessingException e) { - logger.error(e.getMessage(), e); - } - setMultiplicityIdToFieldSetId(datasetDescriptionJson); - - /*--------- Building personal data. ---------*/ - String personalData = buildSingleProperties("dataset.personal_data", datasetDescriptionJson, templateIdsToValues); - if (personalData != null) { - datasetRDAExportModel.setPersonal_data(personalData); - } else { - datasetRDAExportModel.setPersonal_data("unknown"); - } - - /*--------- Building preservation statement. ---------*/ - datasetRDAExportModel.setPreservation_statement(buildSingleProperties("dataset.preservation_statement", datasetDescriptionJson, templateIdsToValues)); - - /*--------- Building sensitive data. ---------*/ - String sensitiveData = buildSingleProperties("dataset.sensitive_data", datasetDescriptionJson, templateIdsToValues); - if (personalData != null) { - datasetRDAExportModel.setSensitive_data(sensitiveData); - } else { - datasetRDAExportModel.setSensitive_data("unknown"); - } - - //TODO - /*--------- Building type. ---------*/ -// datasetRDAExportModel.setType(buildSingleProperties("dataset.type", datasetDescriptionJson, templateIdsToValues)); -// -// /*--------- Building data_quality_assurance. ---------*/ -// datasetRDAExportModel.setData_quality_assurance(buildDataQualityAssurance(datasetDescriptionJson, templateIdsToValues, descriptionEntity.getProfile().getDefinition())); -// -// /*--------- Building distribution. ---------*/ -// datasetRDAExportModel.setDistribution(buildDistribution(datasetDescriptionJson, templateIdsToValues, descriptionEntity.getProfile().getDefinition())); -// -// /*--------- Building keywords. ---------*/ -// datasetRDAExportModel.setKeyword(buildKeywords(datasetDescriptionJson, templateIdsToValues, descriptionEntity.getProfile().getDefinition())); -// -// /*--------- Building metadata items. ---------*/ -// datasetRDAExportModel.setMetadata(buildMetadata(datasetDescriptionJson, templateIdsToValues, descriptionEntity.getProfile().getDefinition())); -// -// /*--------- Building security and privacy items. ---------*/ -// datasetRDAExportModel.setSecurity_and_privacy(buildSecurityAndPrivacy(datasetDescriptionJson, templateIdsToValues, descriptionEntity.getProfile().getDefinition())); -// -// /*--------- Building technical_resource. ---------*/ -// datasetRDAExportModel.setTechnical_resource(buildTechnicalResource(datasetDescriptionJson, templateIdsToValues, descriptionEntity.getProfile().getDefinition())); - - return datasetRDAExportModel; - } - - private String buildSingleProperties(String rdaKey, JSONObject datasetDescriptionJson, Map templateIdsToValues) { - String expression = "$..fields[*][?(@.rdaProperty == \"" + rdaKey + "\" )].id"; - List list = jsonValueListFromExpression(datasetDescriptionJson, expression); - if (!list.isEmpty()) { - return templateIdsToValues.get(list.get(0)).toString(); - } else { - return null; - } - } - - private List buildDataQualityAssurance(JSONObject datasetDescriptionJson, Map templateIdsToValues, String datasetProfileDefinition) { - List dataQualityFields = getRDAFieldsFromJson(datasetDescriptionJson, new String[]{"dataset.data_quality_assurance"}, datasetProfileDefinition); - for (RdaField rdaField : dataQualityFields) { - rdaField.setRdaValue(templateIdsToValues.get(rdaField.getFieldId()).toString()); - } - List dataQualityAssuranceList = new LinkedList<>(); - for (RdaField rdaField : dataQualityFields) { - dataQualityAssuranceList.add(rdaField.getRdaValue()); - } - - return dataQualityAssuranceList; - } - - private List buildDistribution(JSONObject datasetDescriptionJson, Map templateIdsToValues, String datasetProfileDefinition) { - DatasetDistributionRDAExportModel distributionModel = new DatasetDistributionRDAExportModel(); - distributionModel.setAccess_url(buildSingleProperties("dataset.distribution.access_url", datasetDescriptionJson, templateIdsToValues)); - distributionModel.setAvailable_till(buildSingleProperties("dataset.distribution.available_till", datasetDescriptionJson, templateIdsToValues)); - distributionModel.setByte_size(buildSingleProperties("dataset.distribution.byte_size", datasetDescriptionJson, templateIdsToValues)); - distributionModel.setData_access(buildSingleProperties("dataset.distribution.data_access", datasetDescriptionJson, templateIdsToValues)); - distributionModel.setDescription(buildSingleProperties("dataset.distribution.description", datasetDescriptionJson, templateIdsToValues)); - distributionModel.setDownload_url(buildSingleProperties("dataset.distribution.download_url", datasetDescriptionJson, templateIdsToValues)); - distributionModel.setTitle(buildSingleProperties("dataset.distribution.title", datasetDescriptionJson, templateIdsToValues)); - - /*--------- Building format. ---------*/ - - - // We currently support the return of only one distribution. - List distributionList = new LinkedList<>(); - if (distributionModel.isValid()) { - distributionList.add(distributionModel); - } else { - DatasetDistributionRDAExportModel model = new DatasetDistributionRDAExportModel(); - model.setDescription("Distribution data was not valid"); - distributionList.add(model); - } - - return distributionList; - } - - private List buildKeywords(JSONObject datasetDescriptionJson, Map templateIdsToValues, String datasetProfileDefinition) { - List keywordFields = getRDAFieldsFromJson(datasetDescriptionJson, new String[]{"dataset.keyword"}, datasetProfileDefinition); - for (RdaField rdaField : keywordFields) { - rdaField.setRdaValue(templateIdsToValues.get(rdaField.getFieldId()).toString()); - } - List keywordsList = new LinkedList<>(); - for (RdaField rdaField : keywordFields) { - keywordsList.add(rdaField.getRdaValue()); - } - - return keywordsList; - } - - private List buildMetadata(JSONObject datasetDescriptionJson, Map templateIdsToValues, String datasetProfileDefinition) { - List metadataFields = getRDAFieldsFromJson(datasetDescriptionJson, - new String[]{"dataset.metadata.metadata_standard_id.type", "dataset.metadata.metadata_standard_id.identifier", "dataset.metadata.description", "dataset.metadata.language", "dataset.metadata.metadata_standard_id"}, - datasetProfileDefinition); - - // Adding rdaValue and FieldSetIds on metadataFields. - for (RdaField rdaField : metadataFields) { - rdaField.setRdaValue(templateIdsToValues.get(rdaField.getFieldId()).toString()); - } - // Group metadataFields based on their field set id. - Map> groupedMetadataFields = metadataFields.stream().collect(groupingBy(RdaField::getFieldSetId)); - - // Creating the metadata. - List metadataRDAExportModelList = new LinkedList<>(); - for (String fieldSetId : groupedMetadataFields.keySet()) { - DatasetMetadataRDAExportModel metadataRda = new DatasetMetadataRDAExportModel(); - for (RdaField rdaField : groupedMetadataFields.get(fieldSetId)) { - if (rdaField.getRdaProperty().equals("dataset.metadata.metadata_standard_id.identifier")) { - if (metadataRda.getMetadata_standard_id() != null) { - metadataRda.getMetadata_standard_id().setIdentifier(rdaField.getRdaValue()); - } else { - metadataRda.setMetadata_standard_id(new IdRDAExportModel(rdaField.getRdaValue(), "other")); - } - } - if (rdaField.getRdaProperty().equals("dataset.metadata.metadata_standard_id.type")) { - if (metadataRda.getMetadata_standard_id() != null) { - metadataRda.getMetadata_standard_id().setType(rdaField.getRdaValue()); - } else { - metadataRda.setMetadata_standard_id(new IdRDAExportModel("", rdaField.getRdaValue())); - } - } - if (rdaField.getRdaProperty().equals("dataset.metadata.description")) { - metadataRda.setDescription(rdaField.getRdaValue()); - } - if (rdaField.getRdaProperty().equals("dataset.metadata.language")) { - metadataRda.setLanguage(rdaField.getRdaValue()); - } - if (rdaField.getRdaProperty().equals("dataset.metadata.metadata_standard_id") && !rdaField.getRdaValue().isEmpty()) { - JSONArray jsonArray = new JSONArray(rdaField.getRdaValue()); - for (int i = 0; i < jsonArray.length(); i++) { - JSONObject jsonObject = jsonArray.getJSONObject(i); - Map jsonObjectMap = jsonObject.toMap(); - DatasetMetadataRDAExportModel metadataRda1 = new DatasetMetadataRDAExportModel(); -// metadataRda1.setMetadata_standard_id(new IdRDAExportModel(jsonObjectMap.get("label").toString(), jsonObjectMap.get("source").toString())); - metadataRda1.setMetadata_standard_id(new IdRDAExportModel(jsonObjectMap.get("uri").toString(), "url")); - metadataRDAExportModelList.add(metadataRda1); - } - } - } - if (metadataRda.isValid()) { - metadataRDAExportModelList.add(metadataRda); - } - } - - return new LinkedList<>(metadataRDAExportModelList); - } - - private List buildSecurityAndPrivacy(JSONObject datasetDescriptionJson, Map templateIdsToValues, String datasetProfileDefinition) { - List secAndPrFields = getRDAFieldsFromJson( - datasetDescriptionJson, - new String[]{"dataset.security_and_privacy.description", "dataset.security_and_privacy.title", "dataset.security_and_privacy"}, - datasetProfileDefinition); - for (RdaField rdaField : secAndPrFields) { - rdaField.setRdaValue(templateIdsToValues.get(rdaField.getFieldId()).toString()); - } - Map> groupedSecurityAndPrivacyFields = secAndPrFields.stream().collect(groupingBy(RdaField::getFieldSetId)); - - List securityAndPrivacyRDAExportModelList = new LinkedList<>(); - for (String fieldSetId : groupedSecurityAndPrivacyFields.keySet()) { - DatasetSecurityAndPrivacyRDAExportModel securityAndPrivacyModel = new DatasetSecurityAndPrivacyRDAExportModel(); - for (RdaField rdaField : groupedSecurityAndPrivacyFields.get(fieldSetId)) { - if (rdaField.getRdaProperty().equals("dataset.security_and_privacy.description")) { - securityAndPrivacyModel.setDescription(rdaField.getRdaValue()); - } - if (rdaField.getRdaProperty().equals("dataset.security_and_privacy.title")) { - securityAndPrivacyModel.setTitle(rdaField.getRdaValue()); - } - if (rdaField.getRdaProperty().equals("dataset.security_and_privacy")) { - JSONArray jsonArray = new JSONArray(rdaField.getRdaValue()); - for (int i = 0; i < jsonArray.length(); i++) { - JSONObject jsonObject = jsonArray.getJSONObject(i); - Map jsonObjectMap = jsonObject.toMap(); - DatasetSecurityAndPrivacyRDAExportModel secAndPrivacy = new DatasetSecurityAndPrivacyRDAExportModel(jsonObjectMap.get("label").toString(), jsonObjectMap.get("source").toString()); - securityAndPrivacyRDAExportModelList.add(secAndPrivacy); - } - } - } - securityAndPrivacyRDAExportModelList.add(securityAndPrivacyModel); - } - - return securityAndPrivacyRDAExportModelList; - } - - private List buildTechnicalResource(JSONObject datasetDescriptionJson, Map templateIdsToValues, String datasetProfileDefinition) { - List dataQualityFields = getRDAFieldsFromJson(datasetDescriptionJson, - new String[]{"dataset.technical_resource.technical_resource", "dataset.technical_resource.technical_resource.description", "dataset.technical_resource.technical_resource.name"}, - datasetProfileDefinition); - for (RdaField rdaField : dataQualityFields) { - rdaField.setRdaValue(templateIdsToValues.get(rdaField.getFieldId()).toString()); - } - List technicalResourceList = new LinkedList<>(); - Map> groupedDataQualityFields = dataQualityFields.stream().collect(groupingBy(RdaField::getFieldSetId)); - for (String fieldSetId : groupedDataQualityFields.keySet()) { - DatasetTechnicalResourceRDAExportModel technicalResourceModel = new DatasetTechnicalResourceRDAExportModel(); - for (RdaField rdaField : groupedDataQualityFields.get(fieldSetId)) { - if (rdaField.getRdaProperty().equals("dataset.technical_resource.technical_resource.description")) { - technicalResourceModel.setDescription(rdaField.getRdaValue()); - } - if (rdaField.getRdaProperty().equals("dataset.technical_resource.technical_resource.name")) { - technicalResourceModel.setName(rdaField.getRdaValue()); - } - if (rdaField.getRdaProperty().equals("dataset.security_and_privacy")) { - JSONArray jsonArray = new JSONArray(rdaField.getRdaValue()); - for (int i = 0; i < jsonArray.length(); i++) { - JSONObject jsonObject = jsonArray.getJSONObject(i); - Map jsonObjectMap = jsonObject.toMap(); - DatasetTechnicalResourceRDAExportModel technicalResource = new DatasetTechnicalResourceRDAExportModel(jsonObjectMap.get("label").toString(), jsonObjectMap.get("label").toString()); - technicalResourceList.add(technicalResource); - } - } - } - technicalResourceList.add(technicalResourceModel); - } - - return technicalResourceList; - } - - private void setMultiplicityIdToFieldSetId(JSONObject json) { - String multiplicityItemsFieldSetIdExp = "$..multiplicityItems[*].id"; - List multiplicityItemsFieldSetIdList = jsonValueListFromExpression(json, multiplicityItemsFieldSetIdExp); - for (String fieldSetId : multiplicityItemsFieldSetIdList) { - String fieldsFromFieldSetIdExp = "$..multiplicityItems[*][?(@.id == \""+ fieldSetId +"\")].fields[*].id"; - List fieldsIdList = jsonValueListFromExpression(json, fieldsFromFieldSetIdExp); - for (String fieldId : fieldsIdList) { - this.multiplicityIdToFieldSetId.put(fieldId, fieldSetId); - } - } - } - - private List getRDAFieldsFromJson(JSONObject json, String[] rdaKey, String datasetProfileDefinition) { - List rdaFields = new LinkedList<>(); - for (String key : rdaKey) { - String fieldIdExpression = "$..fields[*][?(@.rdaProperty == \"" + key + "\" )].id"; - List listFromExpression = jsonValueListFromExpression(json, fieldIdExpression); - for (String fieldId : listFromExpression) { - RdaField rdaField = new RdaField(); - rdaField.setRdaProperty(key); - rdaField.setFieldId(fieldId); - if (fieldId.startsWith("multiple_")) { - rdaField.setFieldSetId(this.multiplicityIdToFieldSetId.get(fieldId)); - } else { - rdaField.setFieldSetId(getFieldSetIdForFieldFromXML(datasetProfileDefinition, fieldId)); - } - rdaFields.add(rdaField); - } - } - return rdaFields; - } - - private List jsonValueListFromExpression(JSONObject json, String expression) { - net.minidev.json.JSONArray jsonArray = JsonPath.parse(json.toString()).read(expression); - List valueList = new LinkedList<>(); - for (Object o : jsonArray) { - valueList.add(o.toString()); - } - return valueList; - } - - private String getFieldSetIdForFieldFromXML(String datasetProfileDefinition, String fieldId) { - String fieldSetIdExpression = "//field[@id ='" + fieldId + "']/ancestor::fieldSet/@id"; - List listFromExpression = xmlValueListFromExpression(datasetProfileDefinition, fieldSetIdExpression); - if (listFromExpression.size() == 1) return listFromExpression.get(0); - return null; - } - - private List xmlValueListFromExpression(String xml, String expression) { - List valuesList = new LinkedList<>(); - Document document = XmlBuilder.fromXml(xml); - XPathFactory xpathFactory = XPathFactory.newInstance(); - XPath xpath = xpathFactory.newXPath(); - try { - XPathExpression expr = xpath.compile(expression); - NodeList nodeList = (NodeList) expr.evaluate(document, XPathConstants.NODESET); - for (int i = 0; i < nodeList.getLength(); i++) { - Node node = nodeList.item(i); - valuesList.add(node.getNodeValue()); - } - } catch (XPathExpressionException e) { - logger.error(e.getMessage(), e); - } - - return valuesList; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DatasetSecurityAndPrivacyRDAExportModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DatasetSecurityAndPrivacyRDAExportModel.java deleted file mode 100644 index a2d2a5581..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DatasetSecurityAndPrivacyRDAExportModel.java +++ /dev/null @@ -1,29 +0,0 @@ -package eu.eudat.models.data.rda; - -public class DatasetSecurityAndPrivacyRDAExportModel { - private String description; - private String title; - - public DatasetSecurityAndPrivacyRDAExportModel() { - - } - - public DatasetSecurityAndPrivacyRDAExportModel(String description, String title) { - this.description = description; - this.title = title; - } - - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - - public String getTitle() { - return title; - } - public void setTitle(String title) { - this.title = title; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DatasetTechnicalResourceRDAExportModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DatasetTechnicalResourceRDAExportModel.java deleted file mode 100644 index 6c47ea98e..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DatasetTechnicalResourceRDAExportModel.java +++ /dev/null @@ -1,28 +0,0 @@ -package eu.eudat.models.data.rda; - -public class DatasetTechnicalResourceRDAExportModel { - private String description; - private String name; - - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - public DatasetTechnicalResourceRDAExportModel(String description, String name) { - this.description = description; - this.name = name; - } - - public DatasetTechnicalResourceRDAExportModel() { - } -} \ No newline at end of file diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DmpContributorRDAExportModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DmpContributorRDAExportModel.java deleted file mode 100644 index a2f704aff..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DmpContributorRDAExportModel.java +++ /dev/null @@ -1,52 +0,0 @@ -package eu.eudat.models.data.rda; - -import eu.eudat.data.UserEntity; - -import java.util.LinkedList; -import java.util.List; - -public class DmpContributorRDAExportModel { - private IdRDAExportModel contributor_id; - private String mbox; - private String name; - private List role; - - public IdRDAExportModel getContributor_id() { - return contributor_id; - } - public void setContributor_id(IdRDAExportModel contributor_id) { - this.contributor_id = contributor_id; - } - - public String getMbox() { - return mbox; - } - public void setMbox(String mbox) { - this.mbox = mbox; - } - - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - public List getRole() { - return role; - } - public void setRole(List role) { - this.role = role; - } - - public DmpContributorRDAExportModel fromDataModel(UserEntity user, String role) { - DmpContributorRDAExportModel contributor = new DmpContributorRDAExportModel(); - contributor.contributor_id = new IdRDAExportModel(user.getId().toString(), "other"); -// contributor.mbox = user.getEmail();//TODO: GetEmail - contributor.name = user.getName(); - contributor.role = new LinkedList<>(); - contributor.role.add(role); - - return contributor; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DmpCostRDAExportModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DmpCostRDAExportModel.java deleted file mode 100644 index 98abbadd8..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DmpCostRDAExportModel.java +++ /dev/null @@ -1,36 +0,0 @@ -package eu.eudat.models.data.rda; - -public class DmpCostRDAExportModel { - private String currency_code; //Allowed values defined by ISO 4217. - private String description; - private String title; - private String value; - - public String getCurrency_code() { - return currency_code; - } - public void setCurrency_code(String currency_code) { - this.currency_code = currency_code; - } - - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - - public String getTitle() { - return title; - } - public void setTitle(String title) { - this.title = title; - } - - public String getValue() { - return value; - } - public void setValue(String value) { - this.value = value; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DmpRDAExportModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DmpRDAExportModel.java deleted file mode 100644 index 036eafecd..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/DmpRDAExportModel.java +++ /dev/null @@ -1,166 +0,0 @@ -package eu.eudat.models.data.rda; - -import eu.eudat.data.DmpEntity; - -import java.util.List; - -public class DmpRDAExportModel { - private ContactRDAExportModel contact; - private List contributor; - private List cost; - private String created; - private List dataset; - private String description; - private IdRDAExportModel dmp_id; - private String ethical_issues_description; - private String ethical_issues_exist; // Allowed Values: yes no unknown. - private String ethical_issues_report; - private String language; - private String modified; - private ProjectRDAExportModel project; - private String title; - - public ContactRDAExportModel getContact() { - return contact; - } - public void setContact(ContactRDAExportModel contact) { - this.contact = contact; - } - - public List getContributor() { - return contributor; - } - public void setContributor(List contributor) { - this.contributor = contributor; - } - - public List getCost() { - return cost; - } - public void setCost(List cost) { - this.cost = cost; - } - - public String getCreated() { - return created; - } - public void setCreated(String created) { - this.created = created; - } - - public List getDataset() { - return dataset; - } - public void setDataset(List dataset) { - this.dataset = dataset; - } - - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - - public IdRDAExportModel getDmp_id() { - return dmp_id; - } - public void setDmp_id(IdRDAExportModel dmp_id) { - this.dmp_id = dmp_id; - } - - public String getEthical_issues_description() { - return ethical_issues_description; - } - public void setEthical_issues_description(String ethical_issues_description) { - this.ethical_issues_description = ethical_issues_description; - } - - public String getEthical_issues_exist() { - return ethical_issues_exist; - } - public void setEthical_issues_exist(String ethical_issues_exist) { - this.ethical_issues_exist = ethical_issues_exist; - } - - public String getEthical_issues_report() { - return ethical_issues_report; - } - public void setEthical_issues_report(String ethical_issues_report) { - this.ethical_issues_report = ethical_issues_report; - } - - public String getLanguage() { - return language; - } - public void setLanguage(String language) { - this.language = language; - } - - public String getModified() { - return modified; - } - public void setModified(String modified) { - this.modified = modified; - } - - public ProjectRDAExportModel getProject() { - return project; - } - public void setProject(ProjectRDAExportModel project) { - this.project = project; - } - - public String getTitle() { - return title; - } - public void setTitle(String title) { - this.title = title; - } - - public DmpRDAExportModel fromDataModel(DmpEntity entity) { - DmpRDAExportModel dmpRda = new DmpRDAExportModel(); - //TODO -// dmpRda.contact = new ContactRDAExportModel().fromDataModel(entity.getUsers().stream().filter(x -> x.getRole().equals(UserDMP.UserDMPRoles.OWNER.getValue())).findFirst().get().getUser()); -// if (entity.getUsers().stream().anyMatch(x -> x.getRole().equals(UserDMP.UserDMPRoles.USER.getValue()))) { -// dmpRda.contributor = new LinkedList<>(); -// for (UserDMP userdmp : entity.getUsers().stream().filter(x -> x.getRole().equals(UserDMP.UserDMPRoles.USER.getValue())).collect(Collectors.toList())) { -// dmpRda.contributor.add(new DmpContributorRDAExportModel().fromDataModel(userdmp.getUser(), UserDMP.UserDMPRoles.fromInteger(userdmp.getRole()).toString())); -// } -// } -// dmpRda.cost = null; -// SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy"); -// dmpRda.created = formatter.format(entity.getCreated()); -// dmpRda.dataset = new LinkedList<>(); -// for (DescriptionEntity descriptionEntity : entity.getDataset()) { -// if (descriptionEntity.getIsActive() != IsActive.Inactive && descriptionEntity.getStatus() != DescriptionStatus.Canceled) -// dmpRda.dataset.add(new DatasetRDAExportModel().fromDataModel(descriptionEntity, datasetManager)); -// } -// dmpRda.description = entity.getDescription().replace("\n", " "); -// if (entity.getDois() != null && !entity.getDois().isEmpty()) { -// boolean zenodoDoi = false; -// for(EntityDoiEntity doi: entity.getDois()){ -// if(doi.getRepositoryId().equals("Zenodo")){ -// dmpRda.dmp_id = new IdRDAExportModel(doi.getDoi(), "zenodo"); -// zenodoDoi = true; -// } -// } -// if(!zenodoDoi){ -// dmpRda.dmp_id = new IdRDAExportModel(entity.getId().toString(), "other"); -// } -// } -// else { -// dmpRda.dmp_id = new IdRDAExportModel(entity.getId().toString(), "other"); -// } -// // Mock up data on "language" and "ethical_issues_*" for now. -// dmpRda.ethical_issues_exist = "unknown"; -// dmpRda.language = "en"; -// dmpRda.modified = formatter.format(new Date()); -// if (entity.getGrant() != null) { -// dmpRda.project = new ProjectRDAExportModel().fromDataModel(entity.getGrant()); -// } - dmpRda.title = entity.getLabel(); - - return dmpRda; - } -} 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 deleted file mode 100644 index 5c659903e..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/FundingRDAExportModel.java +++ /dev/null @@ -1,41 +0,0 @@ -package eu.eudat.models.data.rda; - - -public class FundingRDAExportModel { - private IdRDAExportModel funder_id; - private IdRDAExportModel grant_id; - private String funding_status; - - public IdRDAExportModel getFunder_id() { - return funder_id; - } - public void setFunder_id(IdRDAExportModel funder_id) { - this.funder_id = funder_id; - } - - public IdRDAExportModel getGrant_id() { - return grant_id; - } - public void setGrant_id(IdRDAExportModel grant_id) { - this.grant_id = grant_id; - } - - public String getFunding_status() { - return funding_status; - } - public void setFunding_status(String funding_status) { - this.funding_status = funding_status; - } - - public FundingRDAExportModel fromDataModel(/*Funder funder, Grant grant*/) { - FundingRDAExportModel funding = new FundingRDAExportModel(); - funding.funding_status = "planned"; // mock data -// 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/HostRDAExportModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/HostRDAExportModel.java deleted file mode 100644 index bac169259..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/HostRDAExportModel.java +++ /dev/null @@ -1,86 +0,0 @@ -package eu.eudat.models.data.rda; - -import java.util.List; - -public class HostRDAExportModel { - private String availability; - private String backup__frequency; - private String backup_type; - private String certified_with; // Repository certified with one the following standards: DIN31644 / DINI-Zertifikat / DSA / ISO16363 / ISO16919 /TRAC / WDS / CoreTrustSeal - private String description; - private String geo_location; // Physical location of the data expressed using ISO 3166-1 country code. - private List pid_system; // PID System: ark arxiv bibcode doi ean13 eissn handle igsn isbn issn istc lissn lsid pmid purl upc url urn other - private String storage_type; - private String support_versioning; // Allowed values: yes / no / unknown - private String title; - - public String getAvailability() { - return availability; - } - public void setAvailability(String availability) { - this.availability = availability; - } - - public String getBackup__frequency() { - return backup__frequency; - } - public void setBackup__frequency(String backup__frequency) { - this.backup__frequency = backup__frequency; - } - - public String getBackup_type() { - return backup_type; - } - public void setBackup_type(String backup_type) { - this.backup_type = backup_type; - } - - public String getCertified_with() { - return certified_with; - } - public void setCertified_with(String certified_with) { - this.certified_with = certified_with; - } - - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - - public String getGeo_location() { - return geo_location; - } - public void setGeo_location(String geo_location) { - this.geo_location = geo_location; - } - - public List getPid_system() { - return pid_system; - } - public void setPid_system(List pid_system) { - this.pid_system = pid_system; - } - - public String getStorage_type() { - return storage_type; - } - public void setStorage_type(String storage_type) { - this.storage_type = storage_type; - } - - public String getSupport_versioning() { - return support_versioning; - } - public void setSupport_versioning(String support_versioning) { - this.support_versioning = support_versioning; - } - - public String getTitle() { - return title; - } - public void setTitle(String title) { - this.title = title; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/IdRDAExportModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/IdRDAExportModel.java deleted file mode 100644 index 2aef46e5b..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/IdRDAExportModel.java +++ /dev/null @@ -1,25 +0,0 @@ -package eu.eudat.models.data.rda; - -public class IdRDAExportModel { - private String identifier; - private String type; - - public String getIdentifier() { - return identifier; - } - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - public String getType() { - return type; - } - public void setType(String type) { - this.type = type; - } - - IdRDAExportModel(String identifier, String type) { - this.identifier = identifier; - this.type = type; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/LicenseRDAExportModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/LicenseRDAExportModel.java deleted file mode 100644 index dec57a467..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/LicenseRDAExportModel.java +++ /dev/null @@ -1,20 +0,0 @@ -package eu.eudat.models.data.rda; - -public class LicenseRDAExportModel { - private String license_ref; - private String start_date; // If date is set in the future, it indicates embargo period. - - public String getLicense_ref() { - return license_ref; - } - public void setLicense_ref(String license_ref) { - this.license_ref = license_ref; - } - - public String getStart_date() { - return start_date; - } - public void setStart_date(String start_date) { - this.start_date = start_date; - } -} 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 deleted file mode 100644 index 003bb7e63..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/ProjectRDAExportModel.java +++ /dev/null @@ -1,53 +0,0 @@ -package eu.eudat.models.data.rda; - - -import java.util.Date; - -public class ProjectRDAExportModel { - private String title; - private String description; - private Date project_start; - private Date project_end; - private FundingRDAExportModel funding; - - public String getTitle() { - return title; - } - public void setTitle(String title) { - this.title = title; - } - - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - - public Date getProject_start() { - return project_start; - } - public void setProject_start(Date project_start) { - this.project_start = project_start; - } - - public Date getProject_end() { - return project_end; - } - public void setProject_end(Date project_end) { - this.project_end = project_end; - } - - public FundingRDAExportModel getFunding() { - return funding; - } - public void setFunding(FundingRDAExportModel funding) { - this.funding = funding; - } - - - 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/rda/RDAExportModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/RDAExportModel.java deleted file mode 100644 index 7074be825..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/RDAExportModel.java +++ /dev/null @@ -1,19 +0,0 @@ -package eu.eudat.models.data.rda; - -import eu.eudat.data.DmpEntity; - -public class RDAExportModel { - private DmpRDAExportModel dmp; - - public DmpRDAExportModel getDmp() { - return dmp; - } - public void setDmp(DmpRDAExportModel dmp) { - this.dmp = dmp; - } - - public RDAExportModel fromDataModel(DmpEntity dmp) { - this.dmp = new DmpRDAExportModel().fromDataModel(dmp); - return this; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/RdaField.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/RdaField.java deleted file mode 100644 index 31acd5c51..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/rda/RdaField.java +++ /dev/null @@ -1,36 +0,0 @@ -package eu.eudat.models.data.rda; - -public class RdaField { - private String rdaProperty; - private String rdaValue; - private String fieldId; - private String fieldSetId; - - public String getRdaProperty() { - return rdaProperty; - } - public void setRdaProperty(String rdaProperty) { - this.rdaProperty = rdaProperty; - } - - public String getRdaValue() { - return rdaValue; - } - public void setRdaValue(String rdaValue) { - this.rdaValue = rdaValue; - } - - public String getFieldId() { - return fieldId; - } - public void setFieldId(String fieldId) { - this.fieldId = fieldId; - } - - public String getFieldSetId() { - return fieldSetId; - } - public void setFieldSetId(String fieldSetId) { - this.fieldSetId = fieldSetId; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/user/components/commons/Rule.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/user/components/commons/Rule.java deleted file mode 100644 index f8ebe0b6c..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/user/components/commons/Rule.java +++ /dev/null @@ -1,49 +0,0 @@ -package eu.eudat.models.data.user.components.commons; - -import eu.eudat.commons.types.descriptiontemplate.RuleEntity; - -public class Rule { - private String sourceField; - private String targetField; - private String requiredValue; - private String type; - - public String getSourceField() { - return sourceField; - } - - public void setSourceField(String sourceField) { - this.sourceField = sourceField; - } - - public String getTargetField() { - return targetField; - } - - public void setTargetField(String targetField) { - this.targetField = targetField; - } - - public String getRequiredValue() { - return requiredValue; - } - - public void setRequiredValue(String requiredValue) { - this.requiredValue = requiredValue; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public Rule fromDefinitionRule(RuleEntity rule) { - this.targetField = rule.getTarget(); - this.requiredValue = rule.getValue(); - return this; - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/user/components/datasetprofile/Field.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/user/components/datasetprofile/Field.java deleted file mode 100644 index c97a9cfbe..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/user/components/datasetprofile/Field.java +++ /dev/null @@ -1,304 +0,0 @@ -package eu.eudat.models.data.user.components.datasetprofile; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import eu.eudat.commons.enums.FieldValidationType; -import eu.eudat.model.publicapi.datasetwizard.DefaultValueEntity; -import eu.eudat.commons.types.descriptiontemplate.MultiplicityEntity; -import eu.eudat.model.publicapi.datasetwizard.FieldDescriptionEntity; -import eu.eudat.model.publicapi.datasetwizard.VisibilityEntity; -import eu.eudat.commons.types.descriptiontemplate.FieldEntity; -import eu.eudat.models.data.properties.PropertiesGenerator; -import eu.eudat.models.data.user.composite.PropertiesModelBuilder; -import eu.eudat.logic.utilities.interfaces.ViewStyleDefinition; - -import org.apache.commons.lang3.NotImplementedException; -import org.json.JSONException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.util.Collection; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -public class Field implements Comparable, PropertiesModelBuilder, ViewStyleDefinition, PropertiesGenerator { - private static final Logger logger = LoggerFactory.getLogger(Field.class); - private String id; - private Integer ordinal; - private Object value; - private FieldDescriptionEntity viewStyle; - private String datatype; - private String numbering; - private int page; - private DefaultValueEntity defaultValue; - private MultiplicityEntity multiplicity; - private Object data; - private List multiplicityItems; - private List validations; - private VisibilityEntity visible; - private List schematics; - - private Boolean export; - - public List getMultiplicityItems() { - return multiplicityItems; - } - - public void setMultiplicityItems(List multiplicityItems) { - this.multiplicityItems = multiplicityItems; - } - - public void setOrdinal(Integer ordinal) { - this.ordinal = ordinal; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public Integer getOrdinal() { - return ordinal; - } - - public void setOrdinal(int ordinal) { - this.ordinal = ordinal; - } - - public Object getValue() { - return value; - } - - public void setValue(Object value) { - this.value = value; - } - - public FieldDescriptionEntity getViewStyle() { - return viewStyle; - } - - public void setViewStyle(FieldDescriptionEntity viewStyle) { - this.viewStyle = viewStyle; - } - - public int getPage() { - return page; - } - - public void setPage(int page) { - this.page = page; - } - - public DefaultValueEntity getDefaultValue() { - return defaultValue; - } - - public void setDefaultValue(DefaultValueEntity defaultValue) { - this.defaultValue = defaultValue; - } - - public String getDatatype() { - return datatype; - } - - public void setDatatype(String datatype) { - this.datatype = datatype; - } - - public MultiplicityEntity getMultiplicity() { - return multiplicity; - } - - public void setMultiplicity(MultiplicityEntity multiplicity) { - this.multiplicity = multiplicity; - } - - public Object getData() { - return data; - } - - public void setData(Object data) { - this.data = data; - } - - public VisibilityEntity getVisible() { - return visible; - } - - public void setVisible(VisibilityEntity visible) { - this.visible = visible; - } - - public List getValidations() { - if(this.validations == null) { - return null; - } - return this.validations.stream().map(item -> (int) item.getValue()).collect(Collectors.toList()); - } - - public void setValidations(List validations) { - this.validations = validations.stream().map(x-> FieldValidationType.of(x.shortValue())).collect(Collectors.toList()); - } - - public String getNumbering() { - return numbering; - } - - public void setNumbering(String numbering) { - this.numbering = numbering; - } - - public List getSchematics() { - return schematics; - } - - public void setSchematics(List schematics) { - this.schematics = schematics; - } - - public Boolean getExport() { - return export; - } - - public void setExport(Boolean export) { - this.export = export; - } - - Field cloneForMultiplicity(String key, Map properties, int index) { - Field newField = new Field(); - newField.id = key; - newField.ordinal = this.ordinal; - newField.value = properties.containsKey(key)? properties.get(key): null; - newField.viewStyle = this.viewStyle; - newField.datatype = this.datatype; - newField.page = this.page; - newField.defaultValue = this.defaultValue; - newField.data = this.data; - newField.validations = this.validations; - newField.schematics = this.schematics; - newField.numbering = "mult" + index + "_" + this.numbering; - newField.export = this.export; - return newField; - } - - @Override - public FieldEntity toDatabaseDefinition(FieldEntity fieldEntity) { - fieldEntity.setId(this.id); - fieldEntity.setOrdinal(this.ordinal); - throw new NotImplementedException(" Use new logic"); - //TODO: Use new logic -// fieldEntity.setData(new FieldDataHelper().toFieldData(data, this.viewStyle.getFieldType())); -// fieldEntity.setDefaultValue(this.defaultValue.getValue()); -// fieldEntity.setVisibilityRules(this.visible.getRules()); -// fieldEntity.setValidations(this.validations); -// fieldEntity.setSchematics(this.schematics); -// fieldEntity.setIncludeInExport(this.export); -// return fieldEntity; - } - - @Override - public void fromDatabaseDefinition(FieldEntity item) { - this.id = item.getId(); - this.ordinal = item.getOrdinal(); - FieldDescriptionEntity fieldDescription = new FieldDescriptionEntity(); - fieldDescription.setFieldType(item.getData().getFieldType()); - this.viewStyle = fieldDescription; - this.numbering = item.getNumbering(); - this.data = item.getData(); - - DefaultValueEntity defaultValueEntity = new DefaultValueEntity(); - defaultValueEntity.setValue(item.getDefaultValue()); - this.defaultValue = defaultValueEntity; - VisibilityEntity visibilityEntity = new VisibilityEntity(); - visibilityEntity.setRules(item.getVisibilityRules()); - this.visible = visibilityEntity; - this.validations = item.getValidations(); - this.schematics = item.getSchematics(); - this.export = item.getIncludeInExport(); - } - - @Override - public void fromJsonObject(Map properties) { - try { - ObjectMapper mapper = new ObjectMapper(); - List stringList = mapper.readValue(properties.get(this.id).toString(), LinkedList.class); - this.value = stringList; - } catch (JSONException | NullPointerException | IOException e) { - try { - this.value = (String) properties.get(this.id); - } catch (ClassCastException ce) { - this.value = properties.get(this.id); - } - } - this.multiplicityItems = new LinkedList<>(); - List compositeKeys = properties.keySet().stream().filter(keys -> keys.startsWith("multiple_" + this.getId())).collect(Collectors.toList()); - int index = 1; - for (String key : compositeKeys) { - this.multiplicityItems.add(this.cloneForMultiplicity(key, properties, index)); - } - } - - @Override - public int compareTo(Object o) { - Field comparedField = (Field) o; - if(this.ordinal != null) { - return this.ordinal.compareTo(comparedField.getOrdinal()); - } else if (comparedField.getOrdinal() != null) { - return comparedField.getOrdinal().compareTo(this.ordinal); - } else { - return 0; - } - } - - @Override - public void fromJsonObject(Map properties, String path) { - this.value = (String) properties.get(path); - } - - @Override - public void toMap(Map fieldValues) { - if (this.value != null) { - if ((this.viewStyle != null && this.viewStyle.getFieldType().equals("datasetIdentifier") && this.value instanceof Map || this.value instanceof Collection)) { - ObjectMapper mapper = new ObjectMapper(); - String valueString = null; - try { - valueString = mapper.writeValueAsString(this.value); - fieldValues.put(this.id, valueString); - } catch (JsonProcessingException e) { - logger.error(e.getMessage(), e); - } - } /*else if (this.value instanceof Collection) { - Collection valueCollection = (Collection) this.value; - StringBuilder valueBuilder = new StringBuilder(); - valueBuilder.append("["); - for (int i = 0; i < valueCollection.size(); i++) { - valueBuilder.append("\"").append(valueCollection.toArray()[i]).append("\""); - if (i < valueCollection.size() - 1) { - valueBuilder.append(", "); - } - } - valueBuilder.append("]"); - fieldValues.put(this.id, valueBuilder.toString()); - }*/ - else if ((this.viewStyle != null && this.viewStyle.getFieldType().equals("upload"))) { - fieldValues.put(this.id, this.value); - } - else { - fieldValues.put(this.id, this.value.toString()); - } - } else { - fieldValues.put(this.id, ""); - } - } - - @Override - public void toMap(Map fieldValues, int index) { - fieldValues.put(this.id, this.value); - } -} \ No newline at end of file diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/user/components/datasetprofile/FieldSet.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/user/components/datasetprofile/FieldSet.java deleted file mode 100644 index c7a2a6453..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/user/components/datasetprofile/FieldSet.java +++ /dev/null @@ -1,220 +0,0 @@ -package eu.eudat.models.data.user.components.datasetprofile; - -import eu.eudat.commons.types.descriptiontemplate.MultiplicityEntity; -import eu.eudat.commons.types.descriptiontemplate.FieldSetEntity; -import eu.eudat.models.data.properties.PropertiesGenerator; -import eu.eudat.models.data.user.composite.PropertiesModelBuilder; -import eu.eudat.logic.utilities.interfaces.ViewStyleDefinition; - -import java.util.*; -import java.util.stream.Collectors; - -public class FieldSet implements Comparable, PropertiesModelBuilder, ViewStyleDefinition, PropertiesGenerator { - private String id; - private Integer ordinal; - private String title; - private String numbering; - private String description; - private String extendedDescription; - private String additionalInformation; - private MultiplicityEntity multiplicity; - private List fields; - private List
multiplicityItems; - private boolean hasCommentField; - private String commentFieldValue; - - public List getFields() { - Collections.sort(this.fields); - return fields; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getExtendedDescription() { - return extendedDescription; - } - - public void setExtendedDescription(String extendedDescription) { - this.extendedDescription = extendedDescription; - } - - public void setFields(List fields) { - this.fields = fields; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public int getOrdinal() { - return ordinal; - } - - public void setOrdinal(int ordinal) { - this.ordinal = ordinal; - } - - public MultiplicityEntity getMultiplicity() { - return multiplicity; - } - - public void setMultiplicity(MultiplicityEntity multiplicity) { - this.multiplicity = multiplicity; - } - - public List
getMultiplicityItems() { - if (multiplicityItems != null) Collections.sort(multiplicityItems); - return multiplicityItems; - } - - public String getNumbering() { - return numbering; - } - - public void setNumbering(String numbering) { - this.numbering = numbering; - } - - public void setMultiplicityItems(List
multiplicityItems) { - this.multiplicityItems = multiplicityItems; - } - - public void setOrdinal(Integer ordinal) { - this.ordinal = ordinal; - } - - public void setHasCommentField(boolean hasCommentField) { - this.hasCommentField = hasCommentField; - } - - public boolean getHasCommentField() { - return hasCommentField; - } - - public String getCommentFieldValue() { - return commentFieldValue; - } - - public void setCommentFieldValue(String commentFieldValue) { - this.commentFieldValue = commentFieldValue; - } - - public String getAdditionalInformation() { - return additionalInformation; - } - - public void setAdditionalInformation(String additionalInformation) { - this.additionalInformation = additionalInformation; - } - - @Override - public FieldSetEntity toDatabaseDefinition(FieldSetEntity item) { -// List viewStylefields = new ModelBuilder().toViewStyleDefinition(this.fields, FieldEntity.class); -// item.setFields(viewStylefields); - item.setId(this.id); - item.setOrdinal(this.ordinal); - item.setHasCommentField(this.hasCommentField); - item.setMultiplicity(this.multiplicity); -// item.setCommentFieldValue(this.commentFieldValue); - return item; - } - - @Override - public void fromDatabaseDefinition(FieldSetEntity item) { -// this.fields = new ModelBuilder().fromViewStyleDefinition(item.getFields(), Field.class); - this.id = item.getId(); - this.ordinal = item.getOrdinal(); - this.title = item.getTitle(); - this.description = item.getDescription(); - this.additionalInformation=item.getAdditionalInformation(); - this.numbering = item.getNumbering(); - this.extendedDescription = item.getExtendedDescription(); - this.hasCommentField = item.getHasCommentField(); - this.multiplicity = item.getMultiplicity(); -// this.commentFieldValue = item.getCommentFieldValue(); - } - - @Override - public void fromJsonObject(Map properties) { - this.commentFieldValue = (String) properties.get("commentFieldValue" + this.id); - this.multiplicityItems = new LinkedList
(); - this.fields.forEach(item -> { - item.fromJsonObject(properties); - }); - List compositeKeysFather = properties.keySet().stream().filter(keys -> keys.startsWith("multiple_" + this.getId())).collect(Collectors.toList()); - List Ids=new ArrayList<>(); - int index = 1; - for (String composite : compositeKeysFather) { - String[] split = composite.split("_"); - if (!Ids.contains(split[2])) { - Ids.add(split[2]); - this.multiplicityItems.add(this.CloneForMultiplicity2(properties.keySet().stream().filter(keys -> keys.startsWith("multiple_" + this.getId() + "_" + split[2])).collect(Collectors.toList()), properties,split, index)); - index++; - } - } - } - - private FieldSet CloneForMultiplicity2(List key, Map properties,String[] ids, int index){ - FieldSet newFieldSet = new FieldSet(); - newFieldSet.id = ids[0]+"_"+ids[1]+"_"+ids[2] + (ids.length > 4 ? "_" + ids[3] : ""); - newFieldSet.description = this.description; - newFieldSet.extendedDescription = this.extendedDescription; - newFieldSet.additionalInformation=this.additionalInformation; - newFieldSet.title = this.title; - newFieldSet.ordinal = ids.length > 4 ? Integer.valueOf(ids[3]) : this.ordinal; - newFieldSet.fields = new LinkedList(); - - for (Field field: this.fields) { - newFieldSet.fields.add(field.cloneForMultiplicity(newFieldSet.id + "_" + field.getId(), properties, index)); - } - return newFieldSet; - } - - - - @Override - public int compareTo(Object o) { - return this.ordinal.compareTo(((FieldSet) o).getOrdinal()); - } - - @Override - public void fromJsonObject(Map properties, String path) { - // TODO Auto-generated method stub - - } - - @Override - public void toMap(Map fieldValues) { - fieldValues.put("commentFieldValue" + this.id, this.commentFieldValue); - this.fields.forEach(item -> item.toMap(fieldValues)); - Map multiplicity = new HashMap(); - if (this.multiplicityItems != null) { - this.multiplicityItems.forEach(item -> item.toMap(fieldValues, this.multiplicityItems.indexOf(item))); - } - //fieldValues.put(this.id,multiplicity); - } - - @Override - public void toMap(Map fieldValues, int index) { - this.fields.forEach(item -> item.toMap(fieldValues, index)); - //this.multiplicityItems.forEach(item->item.toMap(fieldValues,index)); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/user/components/datasetprofile/Section.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/user/components/datasetprofile/Section.java deleted file mode 100644 index 5f082e4f2..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/user/components/datasetprofile/Section.java +++ /dev/null @@ -1,161 +0,0 @@ -package eu.eudat.models.data.user.components.datasetprofile; - -import eu.eudat.commons.types.descriptiontemplate.SectionEntity; -import eu.eudat.models.data.properties.PropertiesGenerator; -import eu.eudat.models.data.user.composite.PropertiesModelBuilder; -import eu.eudat.logic.utilities.interfaces.ViewStyleDefinition; - -import java.util.Collections; -import java.util.List; -import java.util.Map; - -public class Section implements Comparable, ViewStyleDefinition, PropertiesModelBuilder, PropertiesGenerator { - private List
sections; - private List
compositeFields; - private Boolean defaultVisibility; - private String numbering; - private String page; - private Integer ordinal; - private String id; - private String title; - private String description; - private Boolean multiplicity; - - public List
getSections() { - Collections.sort(sections); - return sections; - } - - public void setSections(List
sections) { - this.sections = sections; - } - - public List
getCompositeFields() { - Collections.sort(compositeFields); - return compositeFields; - } - - public void setCompositeFields(List
compositeFields) { - this.compositeFields = compositeFields; - } - - public Boolean getDefaultVisibility() { - return defaultVisibility; - } - - public void setDefaultVisibility(Boolean defaultVisibility) { - this.defaultVisibility = defaultVisibility; - } - - public String getPage() { - return page; - } - - public void setPage(String page) { - this.page = page; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public int getOrdinal() { - return ordinal; - } - - public void setOrdinal(int ordinal) { - this.ordinal = ordinal; - } - - public String getNumbering() { - return numbering; - } - - public void setNumbering(String numbering) { - this.numbering = numbering; - } - - public Boolean getMultiplicity() { - return multiplicity; - } - - public void setMultiplicity(Boolean multiplicity) { - this.multiplicity = multiplicity; - } - - @Override - public SectionEntity toDatabaseDefinition(SectionEntity item) { - item.setDefaultVisibility(this.defaultVisibility); - item.setDescription(this.description); -// if (this.compositeFields != null) -// item.setFieldSets(new ModelBuilder().toViewStyleDefinition(this.compositeFields, FieldSetEntity.class)); - item.setId(this.id); - item.setOrdinal(this.ordinal); -// if (this.sections != null) -// item.setSections(new ModelBuilder().toViewStyleDefinition(this.sections, SectionEntity.class)); - item.setTitle(this.title); - item.setMultiplicity(this.multiplicity); - return item; - } - - @Override - public void fromDatabaseDefinition(SectionEntity item) { - this.defaultVisibility = item.isDefaultVisibility(); - this.description = item.getDescription(); -// this.compositeFields = new ModelBuilder().fromViewStyleDefinition(item.getFieldSets(), FieldSet.class); - this.id = item.getId(); - this.ordinal = item.getOrdinal(); - this.numbering = item.getNumbering(); -// this.sections = new ModelBuilder().fromViewStyleDefinition(item.getSections(), Section.class); - this.title = item.getTitle(); - this.multiplicity = item.getMultiplicity(); - } - - @Override - public void fromJsonObject(Map properties) { - this.sections.forEach(item -> item.fromJsonObject(properties)); - this.compositeFields.forEach(item -> item.fromJsonObject(properties)); - } - - @Override - public int compareTo(Object o) { - return this.ordinal.compareTo(((Section) o).getOrdinal()); - } - - @Override - public void fromJsonObject(Map properties, String index) { - // TODO Auto-generated method stub - - } - - @Override - public void toMap(Map fieldValues) { - this.sections.forEach(item -> item.toMap(fieldValues)); - this.compositeFields.forEach(item -> item.toMap(fieldValues)); - } - - @Override - public void toMap(Map fieldValues, int index) { - - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/user/composite/DatasetProfile.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/user/composite/DatasetProfile.java deleted file mode 100644 index 1a45e5837..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/user/composite/DatasetProfile.java +++ /dev/null @@ -1,96 +0,0 @@ -package eu.eudat.models.data.user.composite; - -import eu.eudat.commons.types.descriptiontemplate.DefinitionEntity; -import eu.eudat.models.data.admin.components.datasetprofile.Page; -import eu.eudat.models.data.user.components.commons.Rule; -import eu.eudat.models.data.user.components.datasetprofile.Section; -import eu.eudat.logic.utilities.helpers.ModelBuilderCollector; - -import java.util.List; -import java.util.Map; - -public class DatasetProfile implements PropertiesModelBuilder { - private String description; - private String language; - private String type; - private List
sections; - private List rules; - private List pages; - private int status; - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getLanguage() { - return language; - } - - public void setLanguage(String language) { - this.language = language; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public List
getSections() { - return sections; - } - - public void setSections(List
sections) { - this.sections = sections; - } - - - public List getRules() { - return rules; - } - - public void setRules(List rules) { - this.rules = rules; - } - - public int getStatus() { - return status; - } - - public void setStatus(int status) { - this.status = status; - } - - public List getPages() { - return pages; - } - - public void setPages(List pages) { - this.pages = pages; - } - - public void buildProfile(DefinitionEntity viewStyle) { -// this.sections = new ModelBuilder().fromViewStyleDefinition(viewStyle.getPages().stream().map(x-> x.getSections()).flatMap(List::stream).toList(), Section.class); -// this.pages = new ModelBuilder().fromViewStyleDefinition(viewStyle.getPages(), Page.class); - this.rules = ModelBuilderCollector.collectRules(viewStyle.getPages().stream().map(x-> x.getSections()).flatMap(List::stream).toList()); - } - - @Override - public void fromJsonObject(Map properties) { - this.sections.forEach(item -> item.fromJsonObject(properties)); - - } - - @Override - public void fromJsonObject(Map properties, String index) { - // TODO Auto-generated method stub - - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/user/composite/DatasetProfilePage.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/user/composite/DatasetProfilePage.java deleted file mode 100644 index cd3705fbf..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/user/composite/DatasetProfilePage.java +++ /dev/null @@ -1,36 +0,0 @@ -package eu.eudat.models.data.user.composite; - -import eu.eudat.models.data.user.components.datasetprofile.Section; - -import java.util.List; - - -public class DatasetProfilePage { - private Integer ordinal; - private String title; - private List
sections; - - public Integer getOrdinal() { - return ordinal; - } - - public void setOrdinal(Integer ordinal) { - this.ordinal = ordinal; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public List
getSections() { - return sections; - } - - public void setSections(List
sections) { - this.sections = sections; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/user/composite/PagedDatasetProfile.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/user/composite/PagedDatasetProfile.java deleted file mode 100644 index 92a756d72..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/user/composite/PagedDatasetProfile.java +++ /dev/null @@ -1,67 +0,0 @@ -package eu.eudat.models.data.user.composite; - -import eu.eudat.models.data.admin.components.datasetprofile.Page; -import eu.eudat.models.data.properties.PropertiesGenerator; -import eu.eudat.models.data.user.components.commons.Rule; - -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - - -public class PagedDatasetProfile implements PropertiesGenerator { - private List pages; - private List rules; - private int status; - - public List getPages() { - return pages; - } - - public void setPages(List pages) { - this.pages = pages; - } - - public List getRules() { - return rules; - } - - public void setRules(List rules) { - this.rules = rules; - } - - public int getStatus() { - return status; - } - - public void setStatus(int status) { - this.status = status; - } - - public PagedDatasetProfile buildPagedDatasetProfile(DatasetProfile profile) { - this.status = profile.getStatus(); - this.rules = profile.getRules(); - this.pages = new LinkedList<>(); - List pages = profile.getPages(); - for (Page page : pages) { - DatasetProfilePage datasetProfilePage = new DatasetProfilePage(); - datasetProfilePage.setOrdinal(page.getOrdinal()); - datasetProfilePage.setTitle(page.getTitle()); - datasetProfilePage.setSections(profile.getSections().stream().filter(item -> item.getPage().equals(page.getId())).collect(Collectors.toList())); - this.pages.add(datasetProfilePage); - } - - return this; - } - - @Override - public void toMap(Map fieldValues) { - this.pages.forEach(item -> item.getSections().forEach(sectionItem -> sectionItem.toMap(fieldValues))); - } - - @Override - public void toMap(Map fieldValues, int index) { - - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/user/composite/PropertiesModelBuilder.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/user/composite/PropertiesModelBuilder.java deleted file mode 100644 index 712842fba..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/user/composite/PropertiesModelBuilder.java +++ /dev/null @@ -1,9 +0,0 @@ -package eu.eudat.models.data.user.composite; - -import java.util.Map; - -public interface PropertiesModelBuilder { - void fromJsonObject(Map properties); - - void fromJsonObject(Map properties, String pathKey); -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/userguide/UserGuide.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/userguide/UserGuide.java deleted file mode 100644 index 019bcb15e..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/userguide/UserGuide.java +++ /dev/null @@ -1,23 +0,0 @@ -package eu.eudat.models.data.userguide; - -public class UserGuide { - - private String name; - private String html; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getHtml() { - return html; - } - - public void setHtml(String html) { - this.html = html; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dashboard/recent/RecentActivityData.java b/dmp-backend/web/src/main/java/eu/eudat/models/old/dashboard/recent/RecentActivityData.java similarity index 92% rename from dmp-backend/web/src/main/java/eu/eudat/models/data/dashboard/recent/RecentActivityData.java rename to dmp-backend/web/src/main/java/eu/eudat/models/old/dashboard/recent/RecentActivityData.java index fbd83c319..2b4bc9075 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dashboard/recent/RecentActivityData.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/old/dashboard/recent/RecentActivityData.java @@ -1,4 +1,4 @@ -package eu.eudat.models.data.dashboard.recent; +package eu.eudat.models.old.dashboard.recent; import java.util.Date; diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/helpers/common/DataTableData.java b/dmp-backend/web/src/main/java/eu/eudat/models/old/helpers/common/DataTableData.java similarity index 90% rename from dmp-backend/web/src/main/java/eu/eudat/models/data/helpers/common/DataTableData.java rename to dmp-backend/web/src/main/java/eu/eudat/models/old/helpers/common/DataTableData.java index 2c933eb20..fc176523e 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/helpers/common/DataTableData.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/old/helpers/common/DataTableData.java @@ -1,4 +1,4 @@ -package eu.eudat.models.data.helpers.common; +package eu.eudat.models.old.helpers.common; import java.util.List; diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/helpers/responses/ResponseItem.java b/dmp-backend/web/src/main/java/eu/eudat/models/old/helpers/responses/ResponseItem.java similarity index 96% rename from dmp-backend/web/src/main/java/eu/eudat/models/data/helpers/responses/ResponseItem.java rename to dmp-backend/web/src/main/java/eu/eudat/models/old/helpers/responses/ResponseItem.java index fc8cec21d..7bc1539d3 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/helpers/responses/ResponseItem.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/old/helpers/responses/ResponseItem.java @@ -1,4 +1,4 @@ -package eu.eudat.models.data.helpers.responses; +package eu.eudat.models.old.helpers.responses; import eu.eudat.types.ApiMessageCode; import eu.eudat.types.ApiResponseType; diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/local/LocalFetchModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/old/local/LocalFetchModel.java similarity index 91% rename from dmp-backend/web/src/main/java/eu/eudat/models/data/local/LocalFetchModel.java rename to dmp-backend/web/src/main/java/eu/eudat/models/old/local/LocalFetchModel.java index 279971632..723ff8f20 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/local/LocalFetchModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/old/local/LocalFetchModel.java @@ -1,4 +1,4 @@ -package eu.eudat.models.data.local; +package eu.eudat.models.old.local; public class LocalFetchModel { private String name; diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/Contact.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/Contact.java deleted file mode 100644 index b16856537..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/Contact.java +++ /dev/null @@ -1,142 +0,0 @@ - -package eu.eudat.models.rda; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import com.fasterxml.jackson.annotation.*; - - -/** - * The DMP Contact Schema - *

- * - * - */ -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "contact_id", - "mbox", - "name" -}) -@JsonIgnoreProperties(ignoreUnknown = true) -public class Contact implements Serializable -{ - - /** - * The Contact ID Schema - *

- * - * (Required) - * - */ - @JsonProperty("contact_id") - private ContactId contactId; - /** - * The Mailbox Schema - *

- * Contact Person's E-mail address - * (Required) - * - */ - @JsonProperty("mbox") - @JsonPropertyDescription("Contact Person's E-mail address") - private String mbox; - /** - * The Name Schema - *

- * Name of the contact person - * (Required) - * - */ - @JsonProperty("name") - @JsonPropertyDescription("Name of the contact person") - private String name; - @JsonIgnore - private Map additionalProperties = new HashMap(); - private final static long serialVersionUID = -2062619884605400321L; - - /** - * The Contact ID Schema - *

- * - * (Required) - * - */ - @JsonProperty("contact_id") - public ContactId getContactId() { - return contactId; - } - - /** - * The Contact ID Schema - *

- * - * (Required) - * - */ - @JsonProperty("contact_id") - public void setContactId(ContactId contactId) { - this.contactId = contactId; - } - - /** - * The Mailbox Schema - *

- * Contact Person's E-mail address - * (Required) - * - */ - @JsonProperty("mbox") - public String getMbox() { - return mbox; - } - - /** - * The Mailbox Schema - *

- * Contact Person's E-mail address - * (Required) - * - */ - @JsonProperty("mbox") - public void setMbox(String mbox) { - this.mbox = mbox; - } - - /** - * The Name Schema - *

- * Name of the contact person - * (Required) - * - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * The Name Schema - *

- * Name of the contact person - * (Required) - * - */ - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - @JsonProperty("additional_properties") - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonProperty("additional_properties") - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/ContactId.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/ContactId.java deleted file mode 100644 index 240d9e652..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/ContactId.java +++ /dev/null @@ -1,148 +0,0 @@ - -package eu.eudat.models.rda; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import com.fasterxml.jackson.annotation.*; - - -/** - * The Contact ID Schema - *

- * - * - */ -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "identifier", - "type" -}) -@JsonIgnoreProperties(ignoreUnknown = true) -public class ContactId implements Serializable -{ - - /** - * The DMP Contact Identifier Schema - *

- * - * (Required) - * - */ - @JsonProperty("identifier") - private String identifier; - /** - * The DMP Contact Identifier Type Schema - *

- * Identifier type. Allowed values: orcid, isni, openid, other - * (Required) - * - */ - @JsonProperty("type") - @JsonPropertyDescription("Identifier type. Allowed values: orcid, isni, openid, other") - private ContactId.Type type; - @JsonIgnore - private Map additionalProperties = new HashMap(); - private final static long serialVersionUID = -7066973565810615822L; - - /** - * The DMP Contact Identifier Schema - *

- * - * (Required) - * - */ - @JsonProperty("identifier") - public String getIdentifier() { - return identifier; - } - - /** - * The DMP Contact Identifier Schema - *

- * - * (Required) - * - */ - @JsonProperty("identifier") - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - /** - * The DMP Contact Identifier Type Schema - *

- * Identifier type. Allowed values: orcid, isni, openid, other - * (Required) - * - */ - @JsonProperty("type") - public ContactId.Type getType() { - return type; - } - - /** - * The DMP Contact Identifier Type Schema - *

- * Identifier type. Allowed values: orcid, isni, openid, other - * (Required) - * - */ - @JsonProperty("type") - public void setType(ContactId.Type type) { - this.type = type; - } - - @JsonProperty("additional_properties") - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonProperty("additional_properties") - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - - public enum Type { - - ORCID("orcid"), - ISNI("isni"), - OPENID("openid"), - OTHER("other"); - private final String value; - private final static Map CONSTANTS = new HashMap(); - - static { - for (ContactId.Type c: values()) { - CONSTANTS.put(c.value, c); - } - } - - private Type(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - @JsonValue - public String value() { - return this.value; - } - - @JsonCreator - public static ContactId.Type fromValue(String value) { - ContactId.Type constant = CONSTANTS.get(value); - if (constant == null) { - throw new IllegalArgumentException(value); - } else { - return constant; - } - } - - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/Contributor.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/Contributor.java deleted file mode 100644 index e926b8093..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/Contributor.java +++ /dev/null @@ -1,177 +0,0 @@ - -package eu.eudat.models.rda; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import com.fasterxml.jackson.annotation.*; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - - -/** - * The Contributor Items Schema - *

- * - * - */ -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "contributor_id", - "mbox", - "name", - "role" -}) -@JsonIgnoreProperties(ignoreUnknown = true) -public class Contributor implements Serializable -{ - - /** - * The Contributor_id Schema - *

- * - * (Required) - * - */ - @JsonProperty("contributor_id") - private ContributorId contributorId; - /** - * The Contributor Mailbox Schema - *

- * Contributor Mail address - * - */ - @JsonProperty("mbox") - @JsonPropertyDescription("Contributor Mail address") - private String mbox; - /** - * The Name Schema - *

- * Name of the contributor - * (Required) - * - */ - @JsonProperty("name") - @JsonPropertyDescription("Name of the contributor") - private String name; - /** - * The Role Schema - *

- * Type of contributor - * (Required) - * - */ - @JsonProperty("role") - @JsonDeserialize(as = java.util.LinkedHashSet.class) - @JsonPropertyDescription("Type of contributor") - private Set role = null; - @JsonIgnore - private Map additionalProperties = new HashMap(); - private final static long serialVersionUID = 3452606902359513114L; - - /** - * The Contributor_id Schema - *

- * - * (Required) - * - */ - @JsonProperty("contributor_id") - public ContributorId getContributorId() { - return contributorId; - } - - /** - * The Contributor_id Schema - *

- * - * (Required) - * - */ - @JsonProperty("contributor_id") - public void setContributorId(ContributorId contributorId) { - this.contributorId = contributorId; - } - - /** - * The Contributor Mailbox Schema - *

- * Contributor Mail address - * - */ - @JsonProperty("mbox") - public String getMbox() { - return mbox; - } - - /** - * The Contributor Mailbox Schema - *

- * Contributor Mail address - * - */ - @JsonProperty("mbox") - public void setMbox(String mbox) { - this.mbox = mbox; - } - - /** - * The Name Schema - *

- * Name of the contributor - * (Required) - * - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * The Name Schema - *

- * Name of the contributor - * (Required) - * - */ - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - /** - * The Role Schema - *

- * Type of contributor - * (Required) - * - */ - @JsonProperty("role") - public Set getRole() { - return role; - } - - /** - * The Role Schema - *

- * Type of contributor - * (Required) - * - */ - @JsonProperty("role") - public void setRole(Set role) { - this.role = role; - } - - @JsonProperty("additional_properties") - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonProperty("additional_properties") - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/ContributorId.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/ContributorId.java deleted file mode 100644 index deacce048..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/ContributorId.java +++ /dev/null @@ -1,149 +0,0 @@ - -package eu.eudat.models.rda; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import com.fasterxml.jackson.annotation.*; - - -/** - * The Contributor_id Schema - *

- * - * - */ -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "identifier", - "type" -}) -@JsonIgnoreProperties(ignoreUnknown = true) -public class ContributorId implements Serializable -{ - - /** - * The Contributor Identifier Schema - *

- * Identifier for a contact person - * (Required) - * - */ - @JsonProperty("identifier") - @JsonPropertyDescription("Identifier for a contact person") - private String identifier; - /** - * The Contributor Identifier Type Schema - *

- * Identifier type. Allowed values: orcid, isni, openid, other - * (Required) - * - */ - @JsonProperty("type") - @JsonPropertyDescription("Identifier type. Allowed values: orcid, isni, openid, other") - private ContributorId.Type type; - @JsonIgnore - private Map additionalProperties = new HashMap(); - private final static long serialVersionUID = 3089650417960767482L; - - /** - * The Contributor Identifier Schema - *

- * Identifier for a contact person - * (Required) - * - */ - @JsonProperty("identifier") - public String getIdentifier() { - return identifier; - } - - /** - * The Contributor Identifier Schema - *

- * Identifier for a contact person - * (Required) - * - */ - @JsonProperty("identifier") - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - /** - * The Contributor Identifier Type Schema - *

- * Identifier type. Allowed values: orcid, isni, openid, other - * (Required) - * - */ - @JsonProperty("type") - public ContributorId.Type getType() { - return type; - } - - /** - * The Contributor Identifier Type Schema - *

- * Identifier type. Allowed values: orcid, isni, openid, other - * (Required) - * - */ - @JsonProperty("type") - public void setType(ContributorId.Type type) { - this.type = type; - } - - @JsonProperty("additional_properties") - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonProperty("additional_properties") - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - - public enum Type { - - ORCID("orcid"), - ISNI("isni"), - OPENID("openid"), - OTHER("other"); - private final String value; - private final static Map CONSTANTS = new HashMap(); - - static { - for (ContributorId.Type c: values()) { - CONSTANTS.put(c.value, c); - } - } - - private Type(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - @JsonValue - public String value() { - return this.value; - } - - @JsonCreator - public static ContributorId.Type fromValue(String value) { - ContributorId.Type constant = CONSTANTS.get(value); - if (constant == null) { - throw new IllegalArgumentException(value); - } else { - return constant; - } - } - - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/Cost.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/Cost.java deleted file mode 100644 index b5783ed2a..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/Cost.java +++ /dev/null @@ -1,368 +0,0 @@ - -package eu.eudat.models.rda; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import com.fasterxml.jackson.annotation.*; - - -/** - * The Cost Items Schema - *

- * - * - */ -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "currency_code", - "description", - "title", - "value" -}) -@JsonIgnoreProperties(ignoreUnknown = true) -public class Cost implements Serializable -{ - - /** - * The Cost Currency Code Schema - *

- * Allowed values defined by ISO 4217 - * - */ - @JsonProperty("currency_code") - @JsonPropertyDescription("Allowed values defined by ISO 4217") - private Cost.CurrencyCode currencyCode; - /** - * The Cost Description Schema - *

- * Cost(s) Description - * - */ - @JsonProperty("description") - @JsonPropertyDescription("Cost(s) Description") - private String description; - /** - * The Cost Title Schema - *

- * Title - * (Required) - * - */ - @JsonProperty("title") - @JsonPropertyDescription("Title") - private String title; - /** - * The Cost Value Schema - *

- * Value - * - */ - @JsonProperty("value") - @JsonPropertyDescription("Value") - private Double value; - @JsonIgnore - private Map additionalProperties = new HashMap(); - private final static long serialVersionUID = -322637784848035165L; - - /** - * The Cost Currency Code Schema - *

- * Allowed values defined by ISO 4217 - * - */ - @JsonProperty("currency_code") - public Cost.CurrencyCode getCurrencyCode() { - return currencyCode; - } - - /** - * The Cost Currency Code Schema - *

- * Allowed values defined by ISO 4217 - * - */ - @JsonProperty("currency_code") - public void setCurrencyCode(Cost.CurrencyCode currencyCode) { - this.currencyCode = currencyCode; - } - - /** - * The Cost Description Schema - *

- * Cost(s) Description - * - */ - @JsonProperty("description") - public String getDescription() { - return description; - } - - /** - * The Cost Description Schema - *

- * Cost(s) Description - * - */ - @JsonProperty("description") - public void setDescription(String description) { - this.description = description; - } - - /** - * The Cost Title Schema - *

- * Title - * (Required) - * - */ - @JsonProperty("title") - public String getTitle() { - return title; - } - - /** - * The Cost Title Schema - *

- * Title - * (Required) - * - */ - @JsonProperty("title") - public void setTitle(String title) { - this.title = title; - } - - /** - * The Cost Value Schema - *

- * Value - * - */ - @JsonProperty("value") - public Double getValue() { - return value; - } - - /** - * The Cost Value Schema - *

- * Value - * - */ - @JsonProperty("value") - public void setValue(Double value) { - this.value = value; - } - - @JsonProperty("additional_properties") - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonProperty("additional_properties") - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - - public enum CurrencyCode { - - AED("AED"), - AFN("AFN"), - ALL("ALL"), - AMD("AMD"), - ANG("ANG"), - AOA("AOA"), - ARS("ARS"), - AUD("AUD"), - AWG("AWG"), - AZN("AZN"), - BAM("BAM"), - BBD("BBD"), - BDT("BDT"), - BGN("BGN"), - BHD("BHD"), - BIF("BIF"), - BMD("BMD"), - BND("BND"), - BOB("BOB"), - BRL("BRL"), - BSD("BSD"), - BTN("BTN"), - BWP("BWP"), - BYN("BYN"), - BZD("BZD"), - CAD("CAD"), - CDF("CDF"), - CHF("CHF"), - CLP("CLP"), - CNY("CNY"), - COP("COP"), - CRC("CRC"), - CUC("CUC"), - CUP("CUP"), - CVE("CVE"), - CZK("CZK"), - DJF("DJF"), - DKK("DKK"), - DOP("DOP"), - DZD("DZD"), - EGP("EGP"), - ERN("ERN"), - ETB("ETB"), - EUR("EUR"), - FJD("FJD"), - FKP("FKP"), - GBP("GBP"), - GEL("GEL"), - GGP("GGP"), - GHS("GHS"), - GIP("GIP"), - GMD("GMD"), - GNF("GNF"), - GTQ("GTQ"), - GYD("GYD"), - HKD("HKD"), - HNL("HNL"), - HRK("HRK"), - HTG("HTG"), - HUF("HUF"), - IDR("IDR"), - ILS("ILS"), - IMP("IMP"), - INR("INR"), - IQD("IQD"), - IRR("IRR"), - ISK("ISK"), - JEP("JEP"), - JMD("JMD"), - JOD("JOD"), - JPY("JPY"), - KES("KES"), - KGS("KGS"), - KHR("KHR"), - KMF("KMF"), - KPW("KPW"), - KRW("KRW"), - KWD("KWD"), - KYD("KYD"), - KZT("KZT"), - LAK("LAK"), - LBP("LBP"), - LKR("LKR"), - LRD("LRD"), - LSL("LSL"), - LYD("LYD"), - MAD("MAD"), - MDL("MDL"), - MGA("MGA"), - MKD("MKD"), - MMK("MMK"), - MNT("MNT"), - MOP("MOP"), - MRU("MRU"), - MUR("MUR"), - MVR("MVR"), - MWK("MWK"), - MXN("MXN"), - MYR("MYR"), - MZN("MZN"), - NAD("NAD"), - NGN("NGN"), - NIO("NIO"), - NOK("NOK"), - NPR("NPR"), - NZD("NZD"), - OMR("OMR"), - PAB("PAB"), - PEN("PEN"), - PGK("PGK"), - PHP("PHP"), - PKR("PKR"), - PLN("PLN"), - PYG("PYG"), - QAR("QAR"), - RON("RON"), - RSD("RSD"), - RUB("RUB"), - RWF("RWF"), - SAR("SAR"), - SBD("SBD"), - SCR("SCR"), - SDG("SDG"), - SEK("SEK"), - SGD("SGD"), - SHP("SHP"), - SLL("SLL"), - SOS("SOS"), - SPL("SPL*"), - SRD("SRD"), - STN("STN"), - SVC("SVC"), - SYP("SYP"), - SZL("SZL"), - THB("THB"), - TJS("TJS"), - TMT("TMT"), - TND("TND"), - TOP("TOP"), - TRY("TRY"), - TTD("TTD"), - TVD("TVD"), - TWD("TWD"), - TZS("TZS"), - UAH("UAH"), - UGX("UGX"), - USD("USD"), - UYU("UYU"), - UZS("UZS"), - VEF("VEF"), - VND("VND"), - VUV("VUV"), - WST("WST"), - XAF("XAF"), - XCD("XCD"), - XDR("XDR"), - XOF("XOF"), - XPF("XPF"), - YER("YER"), - ZAR("ZAR"), - ZMW("ZMW"), - ZWD("ZWD"); - private final String value; - private final static Map CONSTANTS = new HashMap(); - - static { - for (Cost.CurrencyCode c: values()) { - CONSTANTS.put(c.value, c); - } - } - - private CurrencyCode(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - @JsonValue - public String value() { - return this.value; - } - - @JsonCreator - public static Cost.CurrencyCode fromValue(String value) { - Cost.CurrencyCode constant = CONSTANTS.get(value); - if (constant == null) { - throw new IllegalArgumentException(value); - } else { - return constant; - } - } - - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/Dataset.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/Dataset.java deleted file mode 100644 index b39188065..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/Dataset.java +++ /dev/null @@ -1,612 +0,0 @@ - -package eu.eudat.models.rda; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.annotation.*; - - -/** - * The Dataset Items Schema - *

- * - * - */ -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "data_quality_assurance", - "dataset_id", - "description", - "distribution", - "issued", - "keyword", - "language", - "metadata", - "personal_data", - "preservation_statement", - "security_and_privacy", - "sensitive_data", - "technical_resource", - "title", - "type", - "additional_properties" -}) -@JsonIgnoreProperties(ignoreUnknown = true) -public class Dataset implements Serializable -{ - - /** - * The Data Quality Assurance Schema - *

- * Data Quality Assurance - * - */ - @JsonProperty("data_quality_assurance") - @JsonPropertyDescription("Data Quality Assurance") - private List dataQualityAssurance = null; - /** - * The Dataset ID Schema - *

- * Dataset ID - * (Required) - * - */ - @JsonProperty("dataset_id") - @JsonPropertyDescription("Dataset ID") - private DatasetId datasetId; - /** - * The Dataset Description Schema - *

- * Description is a property in both Dataset and Distribution, in compliance with W3C DCAT. In some cases these might be identical, but in most cases the Dataset represents a more abstract concept, while the distribution can point to a specific file. - * - */ - @JsonProperty("description") - @JsonPropertyDescription("Description is a property in both Dataset and Distribution, in compliance with W3C DCAT. In some cases these might be identical, but in most cases the Dataset represents a more abstract concept, while the distribution can point to a specific file.") - private String description; - /** - * The Dataset Distribution Schema - *

- * To provide technical information on a specific instance of data. - * - */ - @JsonProperty("distribution") - @JsonPropertyDescription("To provide technical information on a specific instance of data.") - private List distribution = null; - /** - * The Dataset Date of Issue Schema - *

- * Date of Issue - * - */ - @JsonProperty("issued") - @JsonPropertyDescription("Date of Issue") - private String issued; - /** - * The Dataset Keyword(s) Schema - *

- * Keywords - * - */ - @JsonProperty("keyword") - @JsonPropertyDescription("Keywords") - private List keyword = null; - /** - * The Dataset Language Schema - *

- * Language of the dataset expressed using ISO 639-3. - * - */ - @JsonProperty("language") - @JsonPropertyDescription("Language of the dataset expressed using ISO 639-3.") - private Language language; - /** - * The Dataset Metadata Schema - *

- * To describe metadata standards used. - * - */ - @JsonProperty("metadata") - @JsonPropertyDescription("To describe metadata standards used.") - private List metadata = null; - /** - * The Dataset Personal Data Schema - *

- * If any personal data is contained. Allowed values: yes, no, unknown - * (Required) - * - */ - @JsonProperty("personal_data") - @JsonPropertyDescription("If any personal data is contained. Allowed values: yes, no, unknown") - private Dataset.PersonalData personalData; - /** - * The Dataset Preservation Statement Schema - *

- * Preservation Statement - * - */ - @JsonProperty("preservation_statement") - @JsonPropertyDescription("Preservation Statement") - private String preservationStatement; - /** - * The Dataset Security and Policy Schema - *

- * To list all issues and requirements related to security and privacy - * - */ - @JsonProperty("security_and_privacy") - @JsonPropertyDescription("To list all issues and requirements related to security and privacy") - private List securityAndPrivacy = null; - /** - * The Dataset Sensitive Data Schema - *

- * If any sensitive data is contained. Allowed values: yes, no, unknown - * (Required) - * - */ - @JsonProperty("sensitive_data") - @JsonPropertyDescription("If any sensitive data is contained. Allowed values: yes, no, unknown") - private Dataset.SensitiveData sensitiveData; - /** - * The Dataset Technical Resource Schema - *

- * To list all technical resources needed to implement a DMP - * - */ - @JsonProperty("technical_resource") - @JsonPropertyDescription("To list all technical resources needed to implement a DMP") - private List technicalResource = null; - /** - * The Dataset Title Schema - *

- * Title is a property in both Dataset and Distribution, in compliance with W3C DCAT. In some cases these might be identical, but in most cases the Dataset represents a more abstract concept, while the distribution can point to a specific file. - * (Required) - * - */ - @JsonProperty("title") - @JsonPropertyDescription("Title is a property in both Dataset and Distribution, in compliance with W3C DCAT. In some cases these might be identical, but in most cases the Dataset represents a more abstract concept, while the distribution can point to a specific file.") - private String title; - /** - * The Dataset Type Schema - *

- * If appropriate, type according to: DataCite and/or COAR dictionary. Otherwise use the common name for the type, e.g. raw data, software, survey, etc. https://schema.datacite.org/meta/kernel-4.1/doc/DataCite-MetadataKernel_v4.1.pdf http://vocabularies.coar-repositories.org/pubby/resource_type.html - * - */ - @JsonProperty("type") - @JsonPropertyDescription("If appropriate, type according to: DataCite and/or COAR dictionary. Otherwise use the common name for the type, e.g. raw data, software, survey, etc. https://schema.datacite.org/meta/kernel-4.1/doc/DataCite-MetadataKernel_v4.1.pdf http://vocabularies.coar-repositories.org/pubby/resource_type.html") - private String type; - @JsonProperty("additional_properties") - private Map additionalProperties = new HashMap(); - private final static long serialVersionUID = -6931119120629009399L; - - /** - * The Data Quality Assurance Schema - *

- * Data Quality Assurance - * - */ - @JsonProperty("data_quality_assurance") - public List getDataQualityAssurance() { - return dataQualityAssurance; - } - - /** - * The Data Quality Assurance Schema - *

- * Data Quality Assurance - * - */ - @JsonProperty("data_quality_assurance") - public void setDataQualityAssurance(List dataQualityAssurance) { - this.dataQualityAssurance = dataQualityAssurance; - } - - /** - * The Dataset ID Schema - *

- * Dataset ID - * (Required) - * - */ - @JsonProperty("dataset_id") - public DatasetId getDatasetId() { - return datasetId; - } - - /** - * The Dataset ID Schema - *

- * Dataset ID - * (Required) - * - */ - @JsonProperty("dataset_id") - public void setDatasetId(DatasetId datasetId) { - this.datasetId = datasetId; - } - - /** - * The Dataset Description Schema - *

- * Description is a property in both Dataset and Distribution, in compliance with W3C DCAT. In some cases these might be identical, but in most cases the Dataset represents a more abstract concept, while the distribution can point to a specific file. - * - */ - @JsonProperty("description") - public String getDescription() { - return description; - } - - /** - * The Dataset Description Schema - *

- * Description is a property in both Dataset and Distribution, in compliance with W3C DCAT. In some cases these might be identical, but in most cases the Dataset represents a more abstract concept, while the distribution can point to a specific file. - * - */ - @JsonProperty("description") - public void setDescription(String description) { - this.description = description; - } - - /** - * The Dataset Distribution Schema - *

- * To provide technical information on a specific instance of data. - * - */ - @JsonProperty("distribution") - public List getDistribution() { - return distribution; - } - - /** - * The Dataset Distribution Schema - *

- * To provide technical information on a specific instance of data. - * - */ - @JsonProperty("distribution") - public void setDistribution(List distribution) { - this.distribution = distribution; - } - - /** - * The Dataset Date of Issue Schema - *

- * Date of Issue - * - */ - @JsonProperty("issued") - public String getIssued() { - return issued; - } - - /** - * The Dataset Date of Issue Schema - *

- * Date of Issue - * - */ - @JsonProperty("issued") - public void setIssued(String issued) { - this.issued = issued; - } - - /** - * The Dataset Keyword(s) Schema - *

- * Keywords - * - */ - @JsonProperty("keyword") - public List getKeyword() { - return keyword; - } - - /** - * The Dataset Keyword(s) Schema - *

- * Keywords - * - */ - @JsonProperty("keyword") - public void setKeyword(List keyword) { - this.keyword = keyword; - } - - /** - * The Dataset Language Schema - *

- * Language of the dataset expressed using ISO 639-3. - * - */ - @JsonProperty("language") - public Language getLanguage() { - return language; - } - - /** - * The Dataset Language Schema - *

- * Language of the dataset expressed using ISO 639-3. - * - */ - @JsonProperty("language") - public void setLanguage(Language language) { - this.language = language; - } - - /** - * The Dataset Metadata Schema - *

- * To describe metadata standards used. - * - */ - @JsonProperty("metadata") - public List getMetadata() { - return metadata; - } - - /** - * The Dataset Metadata Schema - *

- * To describe metadata standards used. - * - */ - @JsonProperty("metadata") - public void setMetadata(List metadata) { - this.metadata = metadata; - } - - /** - * The Dataset Personal Data Schema - *

- * If any personal data is contained. Allowed values: yes, no, unknown - * (Required) - * - */ - @JsonProperty("personal_data") - public Dataset.PersonalData getPersonalData() { - return personalData; - } - - /** - * The Dataset Personal Data Schema - *

- * If any personal data is contained. Allowed values: yes, no, unknown - * (Required) - * - */ - @JsonProperty("personal_data") - public void setPersonalData(Dataset.PersonalData personalData) { - this.personalData = personalData; - } - - /** - * The Dataset Preservation Statement Schema - *

- * Preservation Statement - * - */ - @JsonProperty("preservation_statement") - public String getPreservationStatement() { - return preservationStatement; - } - - /** - * The Dataset Preservation Statement Schema - *

- * Preservation Statement - * - */ - @JsonProperty("preservation_statement") - public void setPreservationStatement(String preservationStatement) { - this.preservationStatement = preservationStatement; - } - - /** - * The Dataset Security and Policy Schema - *

- * To list all issues and requirements related to security and privacy - * - */ - @JsonProperty("security_and_privacy") - public List getSecurityAndPrivacy() { - return securityAndPrivacy; - } - - /** - * The Dataset Security and Policy Schema - *

- * To list all issues and requirements related to security and privacy - * - */ - @JsonProperty("security_and_privacy") - public void setSecurityAndPrivacy(List securityAndPrivacy) { - this.securityAndPrivacy = securityAndPrivacy; - } - - /** - * The Dataset Sensitive Data Schema - *

- * If any sensitive data is contained. Allowed values: yes, no, unknown - * (Required) - * - */ - @JsonProperty("sensitive_data") - public Dataset.SensitiveData getSensitiveData() { - return sensitiveData; - } - - /** - * The Dataset Sensitive Data Schema - *

- * If any sensitive data is contained. Allowed values: yes, no, unknown - * (Required) - * - */ - @JsonProperty("sensitive_data") - public void setSensitiveData(Dataset.SensitiveData sensitiveData) { - this.sensitiveData = sensitiveData; - } - - /** - * The Dataset Technical Resource Schema - *

- * To list all technical resources needed to implement a DMP - * - */ - @JsonProperty("technical_resource") - public List getTechnicalResource() { - return technicalResource; - } - - /** - * The Dataset Technical Resource Schema - *

- * To list all technical resources needed to implement a DMP - * - */ - @JsonProperty("technical_resource") - public void setTechnicalResource(List technicalResource) { - this.technicalResource = technicalResource; - } - - /** - * The Dataset Title Schema - *

- * Title is a property in both Dataset and Distribution, in compliance with W3C DCAT. In some cases these might be identical, but in most cases the Dataset represents a more abstract concept, while the distribution can point to a specific file. - * (Required) - * - */ - @JsonProperty("title") - public String getTitle() { - return title; - } - - /** - * The Dataset Title Schema - *

- * Title is a property in both Dataset and Distribution, in compliance with W3C DCAT. In some cases these might be identical, but in most cases the Dataset represents a more abstract concept, while the distribution can point to a specific file. - * (Required) - * - */ - @JsonProperty("title") - public void setTitle(String title) { - this.title = title; - } - - /** - * The Dataset Type Schema - *

- * If appropriate, type according to: DataCite and/or COAR dictionary. Otherwise use the common name for the type, e.g. raw data, software, survey, etc. https://schema.datacite.org/meta/kernel-4.1/doc/DataCite-MetadataKernel_v4.1.pdf http://vocabularies.coar-repositories.org/pubby/resource_type.html - * - */ - @JsonProperty("type") - public String getType() { - return type; - } - - /** - * The Dataset Type Schema - *

- * If appropriate, type according to: DataCite and/or COAR dictionary. Otherwise use the common name for the type, e.g. raw data, software, survey, etc. https://schema.datacite.org/meta/kernel-4.1/doc/DataCite-MetadataKernel_v4.1.pdf http://vocabularies.coar-repositories.org/pubby/resource_type.html - * - */ - @JsonProperty("type") - public void setType(String type) { - this.type = type; - } - - @JsonProperty("additional_properties") - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonProperty("additional_properties") - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - - public enum PersonalData { - - YES("yes"), - NO("no"), - UNKNOWN("unknown"); - private final String value; - private final static Map CONSTANTS = new HashMap(); - - static { - for (Dataset.PersonalData c: values()) { - CONSTANTS.put(c.value, c); - } - } - - private PersonalData(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - @JsonValue - public String value() { - return this.value; - } - - @JsonCreator - public static Dataset.PersonalData fromValue(String value) { - Dataset.PersonalData constant = CONSTANTS.get(value); - if (constant == null) { - throw new IllegalArgumentException(value); - } else { - return constant; - } - } - - } - - public enum SensitiveData { - - YES("yes"), - NO("no"), - UNKNOWN("unknown"); - private final String value; - private final static Map CONSTANTS = new HashMap(); - - static { - for (Dataset.SensitiveData c: values()) { - CONSTANTS.put(c.value, c); - } - } - - private SensitiveData(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - @JsonValue - public String value() { - return this.value; - } - - @JsonCreator - public static Dataset.SensitiveData fromValue(String value) { - Dataset.SensitiveData constant = CONSTANTS.get(value); - if (constant == null) { - throw new IllegalArgumentException(value); - } else { - return constant; - } - } - - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/DatasetId.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/DatasetId.java deleted file mode 100644 index b099c9cc8..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/DatasetId.java +++ /dev/null @@ -1,158 +0,0 @@ - -package eu.eudat.models.rda; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import com.fasterxml.jackson.annotation.*; - - -/** - * The Dataset ID Schema - *

- * Dataset ID - * - */ -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "identifier", - "type" -}) -@JsonIgnoreProperties(ignoreUnknown = true) -public class DatasetId implements Serializable -{ - - /** - * The Dataset Identifier Schema - *

- * Identifier for a dataset - * (Required) - * - */ - @JsonProperty("identifier") - @JsonPropertyDescription("Identifier for a dataset") - private String identifier; - /** - * The Dataset Identifier Type Schema - *

- * Dataset identifier type. Allowed values: handle, doi, ark, url, other - * (Required) - * - */ - @JsonProperty("type") - @JsonPropertyDescription("Dataset identifier type. Allowed values: handle, doi, ark, url, other") - private DatasetId.Type type; - @JsonIgnore - private Map additionalProperties = new HashMap(); - private final static long serialVersionUID = -6295164005851378031L; - - public DatasetId() { - } - - public DatasetId(String identifier, Type type) { - this.identifier = identifier; - this.type = type; - } - - /** - * The Dataset Identifier Schema - *

- * Identifier for a dataset - * (Required) - * - */ - @JsonProperty("identifier") - public String getIdentifier() { - return identifier; - } - - /** - * The Dataset Identifier Schema - *

- * Identifier for a dataset - * (Required) - * - */ - @JsonProperty("identifier") - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - /** - * The Dataset Identifier Type Schema - *

- * Dataset identifier type. Allowed values: handle, doi, ark, url, other - * (Required) - * - */ - @JsonProperty("type") - public DatasetId.Type getType() { - return type; - } - - /** - * The Dataset Identifier Type Schema - *

- * Dataset identifier type. Allowed values: handle, doi, ark, url, other - * (Required) - * - */ - @JsonProperty("type") - public void setType(DatasetId.Type type) { - this.type = type; - } - - @JsonProperty("additional_properties") - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonProperty("additional_properties") - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - - public enum Type { - - HANDLE("handle"), - DOI("doi"), - ARK("ark"), - URL("url"), - OTHER("other"); - private final String value; - private final static Map CONSTANTS = new HashMap(); - - static { - for (DatasetId.Type c: values()) { - CONSTANTS.put(c.value, c); - } - } - - private Type(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - @JsonValue - public String value() { - return this.value; - } - - @JsonCreator - public static DatasetId.Type fromValue(String value) { - DatasetId.Type constant = CONSTANTS.get(value); - if (constant == null) { - throw new IllegalArgumentException(value); - } else { - return constant; - } - } - - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/Distribution.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/Distribution.java deleted file mode 100644 index b47a08ba4..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/Distribution.java +++ /dev/null @@ -1,407 +0,0 @@ - -package eu.eudat.models.rda; - -import java.io.Serializable; -import java.net.URI; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.annotation.*; - - -/** - * The Dataset Distribution Items Schema - *

- * - * - */ -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "access_url", - "available_until", - "byte_size", - "data_access", - "description", - "download_url", - "format", - "host", - "license", - "title", - "additional_properties" -}) -@JsonIgnoreProperties(ignoreUnknown = true) -public class Distribution implements Serializable -{ - - /** - * The Dataset Distribution Access URL Schema - *

- * A URL of the resource that gives access to a distribution of the dataset. e.g. landing page. - * - */ - @JsonProperty("access_url") - @JsonPropertyDescription("A URL of the resource that gives access to a distribution of the dataset. e.g. landing page.") - private String accessUrl; - /** - * The Dataset Distribution Available Until Schema - *

- * Indicates how long this distribution will be / should be available. - * - */ - @JsonProperty("available_until") - @JsonPropertyDescription("Indicates how long this distribution will be / should be available.") - private String availableUntil; - /** - * The Dataset Distribution Byte Size Schema - *

- * Size in bytes. - * - */ - @JsonProperty("byte_size") - @JsonPropertyDescription("Size in bytes.") - private Integer byteSize; - /** - * The Dataset Distribution Data Access Schema - *

- * Indicates access mode for data. Allowed values: open, shared, closed - * (Required) - * - */ - @JsonProperty("data_access") - @JsonPropertyDescription("Indicates access mode for data. Allowed values: open, shared, closed") - private Distribution.DataAccess dataAccess; - /** - * The Dataset Distribution Description Schema - *

- * Description is a property in both Dataset and Distribution, in compliance with W3C DCAT. In some cases these might be identical, but in most cases the Dataset represents a more abstract concept, while the distribution can point to a specific file. - * - */ - @JsonProperty("description") - @JsonPropertyDescription("Description is a property in both Dataset and Distribution, in compliance with W3C DCAT. In some cases these might be identical, but in most cases the Dataset represents a more abstract concept, while the distribution can point to a specific file.") - private String description; - /** - * The Dataset Distribution Download URL Schema - *

- * The URL of the downloadable file in a given format. E.g. CSV file or RDF file. - * - */ - @JsonProperty("download_url") - @JsonPropertyDescription("The URL of the downloadable file in a given format. E.g. CSV file or RDF file.") - private URI downloadUrl; - /** - * The Dataset Distribution Format Schema - *

- * Format according to: https://www.iana.org/assignments/media-types/media-types.xhtml if appropriate, otherwise use the common name for this format. - * - */ - @JsonProperty("format") - @JsonPropertyDescription("Format according to: https://www.iana.org/assignments/media-types/media-types.xhtml if appropriate, otherwise use the common name for this format.") - private List format = null; - /** - * The Dataset Distribution Host Schema - *

- * To provide information on quality of service provided by infrastructure (e.g. repository) where data is stored. - * - */ - @JsonProperty("host") - @JsonPropertyDescription("To provide information on quality of service provided by infrastructure (e.g. repository) where data is stored.") - private Host host; - /** - * The Dataset Distribution License(s) Schema - *

- * To list all licenses applied to a specific distribution of data. - * - */ - @JsonProperty("license") - @JsonPropertyDescription("To list all licenses applied to a specific distribution of data.") - private List license = null; - /** - * The Dataset Distribution Title Schema - *

- * Title is a property in both Dataset and Distribution, in compliance with W3C DCAT. In some cases these might be identical, but in most cases the Dataset represents a more abstract concept, while the distribution can point to a specific file. - * (Required) - * - */ - @JsonProperty("title") - @JsonPropertyDescription("Title is a property in both Dataset and Distribution, in compliance with W3C DCAT. In some cases these might be identical, but in most cases the Dataset represents a more abstract concept, while the distribution can point to a specific file.") - private String title; - @JsonProperty("additional_properties") - private Map additionalProperties = new HashMap(); - private final static long serialVersionUID = -6018365280419917902L; - - /** - * The Dataset Distribution Access URL Schema - *

- * A URL of the resource that gives access to a distribution of the dataset. e.g. landing page. - * - */ - @JsonProperty("access_url") - public String getAccessUrl() { - return accessUrl; - } - - /** - * The Dataset Distribution Access URL Schema - *

- * A URL of the resource that gives access to a distribution of the dataset. e.g. landing page. - * - */ - @JsonProperty("access_url") - public void setAccessUrl(String accessUrl) { - this.accessUrl = accessUrl; - } - - /** - * The Dataset Distribution Available Until Schema - *

- * Indicates how long this distribution will be / should be available. - * - */ - @JsonProperty("available_until") - public String getAvailableUntil() { - return availableUntil; - } - - /** - * The Dataset Distribution Available Until Schema - *

- * Indicates how long this distribution will be / should be available. - * - */ - @JsonProperty("available_until") - public void setAvailableUntil(String availableUntil) { - this.availableUntil = availableUntil; - } - - /** - * The Dataset Distribution Byte Size Schema - *

- * Size in bytes. - * - */ - @JsonProperty("byte_size") - public Integer getByteSize() { - return byteSize; - } - - /** - * The Dataset Distribution Byte Size Schema - *

- * Size in bytes. - * - */ - @JsonProperty("byte_size") - public void setByteSize(Integer byteSize) { - this.byteSize = byteSize; - } - - /** - * The Dataset Distribution Data Access Schema - *

- * Indicates access mode for data. Allowed values: open, shared, closed - * (Required) - * - */ - @JsonProperty("data_access") - public Distribution.DataAccess getDataAccess() { - return dataAccess; - } - - /** - * The Dataset Distribution Data Access Schema - *

- * Indicates access mode for data. Allowed values: open, shared, closed - * (Required) - * - */ - @JsonProperty("data_access") - public void setDataAccess(Distribution.DataAccess dataAccess) { - this.dataAccess = dataAccess; - } - - /** - * The Dataset Distribution Description Schema - *

- * Description is a property in both Dataset and Distribution, in compliance with W3C DCAT. In some cases these might be identical, but in most cases the Dataset represents a more abstract concept, while the distribution can point to a specific file. - * - */ - @JsonProperty("description") - public String getDescription() { - return description; - } - - /** - * The Dataset Distribution Description Schema - *

- * Description is a property in both Dataset and Distribution, in compliance with W3C DCAT. In some cases these might be identical, but in most cases the Dataset represents a more abstract concept, while the distribution can point to a specific file. - * - */ - @JsonProperty("description") - public void setDescription(String description) { - this.description = description; - } - - /** - * The Dataset Distribution Download URL Schema - *

- * The URL of the downloadable file in a given format. E.g. CSV file or RDF file. - * - */ - @JsonProperty("download_url") - public URI getDownloadUrl() { - return downloadUrl; - } - - /** - * The Dataset Distribution Download URL Schema - *

- * The URL of the downloadable file in a given format. E.g. CSV file or RDF file. - * - */ - @JsonProperty("download_url") - public void setDownloadUrl(URI downloadUrl) { - this.downloadUrl = downloadUrl; - } - - /** - * The Dataset Distribution Format Schema - *

- * Format according to: https://www.iana.org/assignments/media-types/media-types.xhtml if appropriate, otherwise use the common name for this format. - * - */ - @JsonProperty("format") - public List getFormat() { - return format; - } - - /** - * The Dataset Distribution Format Schema - *

- * Format according to: https://www.iana.org/assignments/media-types/media-types.xhtml if appropriate, otherwise use the common name for this format. - * - */ - @JsonProperty("format") - public void setFormat(List format) { - this.format = format; - } - - /** - * The Dataset Distribution Host Schema - *

- * To provide information on quality of service provided by infrastructure (e.g. repository) where data is stored. - * - */ - @JsonProperty("host") - public Host getHost() { - return host; - } - - /** - * The Dataset Distribution Host Schema - *

- * To provide information on quality of service provided by infrastructure (e.g. repository) where data is stored. - * - */ - @JsonProperty("host") - public void setHost(Host host) { - this.host = host; - } - - /** - * The Dataset Distribution License(s) Schema - *

- * To list all licenses applied to a specific distribution of data. - * - */ - @JsonProperty("license") - public List getLicense() { - return license; - } - - /** - * The Dataset Distribution License(s) Schema - *

- * To list all licenses applied to a specific distribution of data. - * - */ - @JsonProperty("license") - public void setLicense(List license) { - this.license = license; - } - - /** - * The Dataset Distribution Title Schema - *

- * Title is a property in both Dataset and Distribution, in compliance with W3C DCAT. In some cases these might be identical, but in most cases the Dataset represents a more abstract concept, while the distribution can point to a specific file. - * (Required) - * - */ - @JsonProperty("title") - public String getTitle() { - return title; - } - - /** - * The Dataset Distribution Title Schema - *

- * Title is a property in both Dataset and Distribution, in compliance with W3C DCAT. In some cases these might be identical, but in most cases the Dataset represents a more abstract concept, while the distribution can point to a specific file. - * (Required) - * - */ - @JsonProperty("title") - public void setTitle(String title) { - this.title = title; - } - - @JsonProperty("additional_properties") - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonProperty("additional_properties") - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - - public enum DataAccess { - - OPEN("open"), - SHARED("shared"), - CLOSED("closed"); - private final String value; - private final static Map CONSTANTS = new HashMap(); - - static { - for (Distribution.DataAccess c: values()) { - CONSTANTS.put(c.value, c); - } - } - - private DataAccess(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - @JsonValue - public String value() { - return this.value; - } - - @JsonCreator - public static Distribution.DataAccess fromValue(String value) { - Distribution.DataAccess constant = CONSTANTS.get(value); - if (constant == null) { - throw new IllegalArgumentException(value); - } else { - return constant; - } - } - - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/Dmp.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/Dmp.java deleted file mode 100644 index 9594fedb6..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/Dmp.java +++ /dev/null @@ -1,551 +0,0 @@ - -package eu.eudat.models.rda; - -import java.io.Serializable; -import java.net.URI; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.annotation.*; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import eu.eudat.logic.utilities.json.MultiDateDeserializer; - - -/** - * The DMP Schema - *

- * - * - */ -@JsonIgnoreProperties(value = { "schema" }, ignoreUnknown = true) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "contact", - "contributor", - "cost", - "created", - "dataset", - "description", - "dmp_id", - "ethical_issues_description", - "ethical_issues_exist", - "ethical_issues_report", - "language", - "modified", - "project", - "title", - "additional_properties" -}) -public class Dmp implements Serializable -{ - - /** - * The DMP Contact Schema - *

- * - * (Required) - * - */ - @JsonProperty("contact") - private Contact contact; - /** - * The Contributor Schema - *

- * - * - */ - @JsonProperty("contributor") - private List contributor = null; - /** - * The Cost Schema - *

- * - * - */ - @JsonProperty("cost") - private List cost = null; - /** - * The DMP Creation Schema - *

- * - * - */ - @JsonProperty("created") - @JsonDeserialize(using = MultiDateDeserializer.class) - @JsonPropertyDescription("") - private Date created; - /** - * The Dataset Schema - *

- * - * (Required) - * - */ - @JsonProperty("dataset") - private List dataset = null; - /** - * The DMP Description Schema - *

- * To provide any free-form text information on a DMP - * - */ - @JsonProperty("description") - @JsonPropertyDescription("To provide any free-form text information on a DMP") - private String description; - /** - * The DMP Identifier Schema - *

- * Identifier for the DMP itself - * (Required) - * - */ - @JsonProperty("dmp_id") - @JsonPropertyDescription("Identifier for the DMP itself") - private DmpId dmpId; - /** - * The DMP Ethical Issues Description Schema - *

- * To describe ethical issues directly in a DMP - * - */ - @JsonProperty("ethical_issues_description") - @JsonPropertyDescription("To describe ethical issues directly in a DMP") - private String ethicalIssuesDescription; - /** - * The DMP Ethical Issues Exist Schema - *

- * To indicate whether there are ethical issues related to data that this DMP describes. Allowed values: yes, no, unknown - * (Required) - * - */ - @JsonProperty("ethical_issues_exist") - @JsonPropertyDescription("To indicate whether there are ethical issues related to data that this DMP describes. Allowed values: yes, no, unknown") - private Dmp.EthicalIssuesExist ethicalIssuesExist; - /** - * The DMP Ethical Issues Report Schema - *

- * To indicate where a protocol from a meeting with an ethical commitee can be found - * - */ - @JsonProperty("ethical_issues_report") - @JsonPropertyDescription("To indicate where a protocol from a meeting with an ethical commitee can be found") - private URI ethicalIssuesReport; - /** - * The DMP Language Schema - *

- * Language of the DMP expressed using ISO 639-3. - * (Required) - * - */ - @JsonProperty("language") - @JsonPropertyDescription("Language of the DMP expressed using ISO 639-3.") - private Language language; - /** - * The DMP Modification Schema - *

- * Must be set each time DMP is modified. Indicates DMP version. - * (Required) - * - */ - @JsonProperty("modified") - @JsonDeserialize(using = MultiDateDeserializer.class) - @JsonPropertyDescription("Must be set each time DMP is modified. Indicates DMP version.") - private Date modified; - /** - * The DMP Project Schema - *

- * Project related to a DMP - * - */ - @JsonProperty("project") - @JsonPropertyDescription("Project related to a DMP") - private List project = null; - /** - * The DMP Title Schema - *

- * Title of a DMP - * (Required) - * - */ - @JsonProperty("title") - @JsonPropertyDescription("Title of a DMP") - private String title; - @JsonProperty("additional_properties") - private Map additionalProperties = new HashMap(); - private final static long serialVersionUID = 4599713332472772292L; - - /** - * The DMP Contact Schema - *

- * - * (Required) - * - */ - @JsonProperty("contact") - public Contact getContact() { - return contact; - } - - /** - * The DMP Contact Schema - *

- * - * (Required) - * - */ - @JsonProperty("contact") - public void setContact(Contact contact) { - this.contact = contact; - } - - /** - * The Contributor Schema - *

- * - * - */ - @JsonProperty("contributor") - public List getContributor() { - return contributor; - } - - /** - * The Contributor Schema - *

- * - * - */ - @JsonProperty("contributor") - public void setContributor(List contributor) { - this.contributor = contributor; - } - - /** - * The Cost Schema - *

- * - * - */ - @JsonProperty("cost") - public List getCost() { - return cost; - } - - /** - * The Cost Schema - *

- * - * - */ - @JsonProperty("cost") - public void setCost(List cost) { - this.cost = cost; - } - - /** - * The DMP Creation Schema - *

- * - * - */ - @JsonProperty("created") - public Date getCreated() { - return created; - } - - /** - * The DMP Creation Schema - *

- * - * - */ - @JsonProperty("created") - public void setCreated(Date created) { - this.created = created; - } - - /** - * The Dataset Schema - *

- * - * (Required) - * - */ - @JsonProperty("dataset") - public List getDataset() { - return dataset; - } - - /** - * The Dataset Schema - *

- * - * (Required) - * - */ - @JsonProperty("dataset") - public void setDataset(List dataset) { - this.dataset = dataset; - } - - /** - * The DMP Description Schema - *

- * To provide any free-form text information on a DMP - * - */ - @JsonProperty("description") - public String getDescription() { - return description; - } - - /** - * The DMP Description Schema - *

- * To provide any free-form text information on a DMP - * - */ - @JsonProperty("description") - public void setDescription(String description) { - this.description = description; - } - - /** - * The DMP Identifier Schema - *

- * Identifier for the DMP itself - * (Required) - * - */ - @JsonProperty("dmp_id") - public DmpId getDmpId() { - return dmpId; - } - - /** - * The DMP Identifier Schema - *

- * Identifier for the DMP itself - * (Required) - * - */ - @JsonProperty("dmp_id") - public void setDmpId(DmpId dmpId) { - this.dmpId = dmpId; - } - - /** - * The DMP Ethical Issues Description Schema - *

- * To describe ethical issues directly in a DMP - * - */ - @JsonProperty("ethical_issues_description") - public String getEthicalIssuesDescription() { - return ethicalIssuesDescription; - } - - /** - * The DMP Ethical Issues Description Schema - *

- * To describe ethical issues directly in a DMP - * - */ - @JsonProperty("ethical_issues_description") - public void setEthicalIssuesDescription(String ethicalIssuesDescription) { - this.ethicalIssuesDescription = ethicalIssuesDescription; - } - - /** - * The DMP Ethical Issues Exist Schema - *

- * To indicate whether there are ethical issues related to data that this DMP describes. Allowed values: yes, no, unknown - * (Required) - * - */ - @JsonProperty("ethical_issues_exist") - public Dmp.EthicalIssuesExist getEthicalIssuesExist() { - return ethicalIssuesExist; - } - - /** - * The DMP Ethical Issues Exist Schema - *

- * To indicate whether there are ethical issues related to data that this DMP describes. Allowed values: yes, no, unknown - * (Required) - * - */ - @JsonProperty("ethical_issues_exist") - public void setEthicalIssuesExist(Dmp.EthicalIssuesExist ethicalIssuesExist) { - this.ethicalIssuesExist = ethicalIssuesExist; - } - - /** - * The DMP Ethical Issues Report Schema - *

- * To indicate where a protocol from a meeting with an ethical commitee can be found - * - */ - @JsonProperty("ethical_issues_report") - public URI getEthicalIssuesReport() { - return ethicalIssuesReport; - } - - /** - * The DMP Ethical Issues Report Schema - *

- * To indicate where a protocol from a meeting with an ethical commitee can be found - * - */ - @JsonProperty("ethical_issues_report") - public void setEthicalIssuesReport(URI ethicalIssuesReport) { - this.ethicalIssuesReport = ethicalIssuesReport; - } - - /** - * The DMP Language Schema - *

- * Language of the DMP expressed using ISO 639-3. - * (Required) - * - */ - @JsonProperty("language") - public Language getLanguage() { - return language; - } - - /** - * The DMP Language Schema - *

- * Language of the DMP expressed using ISO 639-3. - * (Required) - * - */ - @JsonProperty("language") - public void setLanguage(Language language) { - this.language = language; - } - - /** - * The DMP Modification Schema - *

- * Must be set each time DMP is modified. Indicates DMP version. - * (Required) - * - */ - @JsonProperty("modified") - public Date getModified() { - return modified; - } - - /** - * The DMP Modification Schema - *

- * Must be set each time DMP is modified. Indicates DMP version. - * (Required) - * - */ - @JsonProperty("modified") - public void setModified(Date modified) { - this.modified = modified; - } - - /** - * The DMP Project Schema - *

- * Project related to a DMP - * - */ - @JsonProperty("project") - public List getProject() { - return project; - } - - /** - * The DMP Project Schema - *

- * Project related to a DMP - * - */ - @JsonProperty("project") - public void setProject(List project) { - this.project = project; - } - - /** - * The DMP Title Schema - *

- * Title of a DMP - * (Required) - * - */ - @JsonProperty("title") - public String getTitle() { - return title; - } - - /** - * The DMP Title Schema - *

- * Title of a DMP - * (Required) - * - */ - @JsonProperty("title") - public void setTitle(String title) { - this.title = title; - } - - @JsonProperty("additional_properties") - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonProperty("additional_properties") - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - - public enum EthicalIssuesExist { - - YES("yes"), - NO("no"), - UNKNOWN("unknown"); - private final String value; - private final static Map CONSTANTS = new HashMap(); - - static { - for (Dmp.EthicalIssuesExist c: values()) { - CONSTANTS.put(c.value, c); - } - } - - private EthicalIssuesExist(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - @JsonValue - public String value() { - return this.value; - } - - @JsonCreator - public static Dmp.EthicalIssuesExist fromValue(String value) { - Dmp.EthicalIssuesExist constant = CONSTANTS.get(value); - if (constant == null) { - throw new IllegalArgumentException(value); - } else { - return constant; - } - } - - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/DmpId.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/DmpId.java deleted file mode 100644 index 7557c169d..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/DmpId.java +++ /dev/null @@ -1,150 +0,0 @@ - -package eu.eudat.models.rda; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import com.fasterxml.jackson.annotation.*; - - -/** - * The DMP Identifier Schema - *

- * Identifier for the DMP itself - * - */ -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "identifier", - "type" -}) -@JsonIgnoreProperties(ignoreUnknown = true) -public class DmpId implements Serializable -{ - - /** - * The DMP Identifier Value Schema - *

- * Identifier for a DMP - * (Required) - * - */ - @JsonProperty("identifier") - @JsonPropertyDescription("Identifier for a DMP") - private String identifier; - /** - * The DMP Identifier Type Schema - *

- * The DMP Identifier Type. Allowed values: handle, doi, ark, url, other - * (Required) - * - */ - @JsonProperty("type") - @JsonPropertyDescription("The DMP Identifier Type. Allowed values: handle, doi, ark, url, other") - private DmpId.Type type; - @JsonIgnore - private Map additionalProperties = new HashMap(); - private final static long serialVersionUID = -6059908070202476841L; - - /** - * The DMP Identifier Value Schema - *

- * Identifier for a DMP - * (Required) - * - */ - @JsonProperty("identifier") - public String getIdentifier() { - return identifier; - } - - /** - * The DMP Identifier Value Schema - *

- * Identifier for a DMP - * (Required) - * - */ - @JsonProperty("identifier") - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - /** - * The DMP Identifier Type Schema - *

- * The DMP Identifier Type. Allowed values: handle, doi, ark, url, other - * (Required) - * - */ - @JsonProperty("type") - public DmpId.Type getType() { - return type; - } - - /** - * The DMP Identifier Type Schema - *

- * The DMP Identifier Type. Allowed values: handle, doi, ark, url, other - * (Required) - * - */ - @JsonProperty("type") - public void setType(DmpId.Type type) { - this.type = type; - } - - @JsonProperty("additional_properties") - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonProperty("additional_properties") - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - - public enum Type { - - HANDLE("handle"), - DOI("doi"), - ARK("ark"), - URL("url"), - OTHER("other"); - private final String value; - private final static Map CONSTANTS = new HashMap(); - - static { - for (DmpId.Type c: values()) { - CONSTANTS.put(c.value, c); - } - } - - private Type(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - @JsonValue - public String value() { - return this.value; - } - - @JsonCreator - public static DmpId.Type fromValue(String value) { - DmpId.Type constant = CONSTANTS.get(value); - if (constant == null) { - throw new IllegalArgumentException(value); - } else { - return constant; - } - } - - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/FunderId.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/FunderId.java deleted file mode 100644 index 0787f63b9..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/FunderId.java +++ /dev/null @@ -1,148 +0,0 @@ - -package eu.eudat.models.rda; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import com.fasterxml.jackson.annotation.*; - - -/** - * The Funder ID Schema - *

- * Funder ID of the associated project - * - */ -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "identifier", - "type" -}) -@JsonIgnoreProperties(ignoreUnknown = true) -public class FunderId implements Serializable -{ - - /** - * The Funder ID Value Schema - *

- * Funder ID, recommended to use CrossRef Funder Registry. See: https://www.crossref.org/services/funder-registry/ - * (Required) - * - */ - @JsonProperty("identifier") - @JsonPropertyDescription("Funder ID, recommended to use CrossRef Funder Registry. See: https://www.crossref.org/services/funder-registry/") - private String identifier; - /** - * The Funder ID Type Schema - *

- * Identifier type. Allowed values: fundref, url, other - * (Required) - * - */ - @JsonProperty("type") - @JsonPropertyDescription("Identifier type. Allowed values: fundref, url, other") - private FunderId.Type type; - @JsonIgnore - private Map additionalProperties = new HashMap(); - private final static long serialVersionUID = 1783349151334366078L; - - /** - * The Funder ID Value Schema - *

- * Funder ID, recommended to use CrossRef Funder Registry. See: https://www.crossref.org/services/funder-registry/ - * (Required) - * - */ - @JsonProperty("identifier") - public String getIdentifier() { - return identifier; - } - - /** - * The Funder ID Value Schema - *

- * Funder ID, recommended to use CrossRef Funder Registry. See: https://www.crossref.org/services/funder-registry/ - * (Required) - * - */ - @JsonProperty("identifier") - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - /** - * The Funder ID Type Schema - *

- * Identifier type. Allowed values: fundref, url, other - * (Required) - * - */ - @JsonProperty("type") - public FunderId.Type getType() { - return type; - } - - /** - * The Funder ID Type Schema - *

- * Identifier type. Allowed values: fundref, url, other - * (Required) - * - */ - @JsonProperty("type") - public void setType(FunderId.Type type) { - this.type = type; - } - - @JsonProperty("additional_properties") - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonProperty("additional_properties") - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - - public enum Type { - - FUNDREF("fundref"), - URL("url"), - OTHER("other"); - private final String value; - private final static Map CONSTANTS = new HashMap(); - - static { - for (FunderId.Type c: values()) { - CONSTANTS.put(c.value, c); - } - } - - private Type(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - @JsonValue - public String value() { - return this.value; - } - - @JsonCreator - public static FunderId.Type fromValue(String value) { - FunderId.Type constant = CONSTANTS.get(value); - if (constant == null) { - throw new IllegalArgumentException(value); - } else { - return constant; - } - } - - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/Funding.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/Funding.java deleted file mode 100644 index d97ca6938..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/Funding.java +++ /dev/null @@ -1,181 +0,0 @@ - -package eu.eudat.models.rda; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import com.fasterxml.jackson.annotation.*; - - -/** - * The DMP Project Funding Items Schema - *

- * - * - */ -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "funder_id", - "funding_status", - "grant_id" -}) -@JsonIgnoreProperties(ignoreUnknown = true) -public class Funding implements Serializable -{ - - /** - * The Funder ID Schema - *

- * Funder ID of the associated project - * (Required) - * - */ - @JsonProperty("funder_id") - @JsonPropertyDescription("Funder ID of the associated project") - private FunderId funderId; - /** - * The Funding Status Schema - *

- * To express different phases of project lifecycle. Allowed values: planned, applied, granted, rejected - * - */ - @JsonProperty("funding_status") - @JsonPropertyDescription("To express different phases of project lifecycle. Allowed values: planned, applied, granted, rejected") - private Funding.FundingStatus fundingStatus; - /** - * The Funding Grant ID Schema - *

- * Grant ID of the associated project - * (Required) - * - */ - @JsonProperty("grant_id") - @JsonPropertyDescription("Grant ID of the associated project") - private GrantId grantId; - @JsonIgnore - private Map additionalProperties = new HashMap(); - private final static long serialVersionUID = 8962229321225336165L; - - /** - * The Funder ID Schema - *

- * Funder ID of the associated project - * (Required) - * - */ - @JsonProperty("funder_id") - public FunderId getFunderId() { - return funderId; - } - - /** - * The Funder ID Schema - *

- * Funder ID of the associated project - * (Required) - * - */ - @JsonProperty("funder_id") - public void setFunderId(FunderId funderId) { - this.funderId = funderId; - } - - /** - * The Funding Status Schema - *

- * To express different phases of project lifecycle. Allowed values: planned, applied, granted, rejected - * - */ - @JsonProperty("funding_status") - public Funding.FundingStatus getFundingStatus() { - return fundingStatus; - } - - /** - * The Funding Status Schema - *

- * To express different phases of project lifecycle. Allowed values: planned, applied, granted, rejected - * - */ - @JsonProperty("funding_status") - public void setFundingStatus(Funding.FundingStatus fundingStatus) { - this.fundingStatus = fundingStatus; - } - - /** - * The Funding Grant ID Schema - *

- * Grant ID of the associated project - * (Required) - * - */ - @JsonProperty("grant_id") - public GrantId getGrantId() { - return grantId; - } - - /** - * The Funding Grant ID Schema - *

- * Grant ID of the associated project - * (Required) - * - */ - @JsonProperty("grant_id") - public void setGrantId(GrantId grantId) { - this.grantId = grantId; - } - - @JsonProperty("additional_properties") - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonProperty("additional_properties") - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - - public enum FundingStatus { - - PLANNED("planned"), - APPLIED("applied"), - GRANTED("granted"), - REJECTED("rejected"); - private final String value; - private final static Map CONSTANTS = new HashMap(); - - static { - for (Funding.FundingStatus c: values()) { - CONSTANTS.put(c.value, c); - } - } - - private FundingStatus(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - @JsonValue - public String value() { - return this.value; - } - - @JsonCreator - public static Funding.FundingStatus fromValue(String value) { - Funding.FundingStatus constant = CONSTANTS.get(value); - if (constant == null) { - throw new IllegalArgumentException(value); - } else { - return constant; - } - } - - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/GrantId.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/GrantId.java deleted file mode 100644 index 0974b51cf..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/GrantId.java +++ /dev/null @@ -1,147 +0,0 @@ - -package eu.eudat.models.rda; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import com.fasterxml.jackson.annotation.*; - - -/** - * The Funding Grant ID Schema - *

- * Grant ID of the associated project - * - */ -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "identifier", - "type" -}) -@JsonIgnoreProperties(ignoreUnknown = true) -public class GrantId implements Serializable -{ - - /** - * The Funding Grant ID Value Schema - *

- * Grant ID - * (Required) - * - */ - @JsonProperty("identifier") - @JsonPropertyDescription("Grant ID") - private String identifier; - /** - * The Funding Grant ID Type Schema - *

- * Identifier type. Allowed values: url, other - * (Required) - * - */ - @JsonProperty("type") - @JsonPropertyDescription("Identifier type. Allowed values: url, other") - private GrantId.Type type; - @JsonIgnore - private Map additionalProperties = new HashMap(); - private final static long serialVersionUID = -7738072672837592065L; - - /** - * The Funding Grant ID Value Schema - *

- * Grant ID - * (Required) - * - */ - @JsonProperty("identifier") - public String getIdentifier() { - return identifier; - } - - /** - * The Funding Grant ID Value Schema - *

- * Grant ID - * (Required) - * - */ - @JsonProperty("identifier") - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - /** - * The Funding Grant ID Type Schema - *

- * Identifier type. Allowed values: url, other - * (Required) - * - */ - @JsonProperty("type") - public GrantId.Type getType() { - return type; - } - - /** - * The Funding Grant ID Type Schema - *

- * Identifier type. Allowed values: url, other - * (Required) - * - */ - @JsonProperty("type") - public void setType(GrantId.Type type) { - this.type = type; - } - - @JsonProperty("additional_properties") - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonProperty("additional_properties") - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - - public enum Type { - - URL("url"), - OTHER("other"); - private final String value; - private final static Map CONSTANTS = new HashMap(); - - static { - for (GrantId.Type c: values()) { - CONSTANTS.put(c.value, c); - } - } - - private Type(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - @JsonValue - public String value() { - return this.value; - } - - @JsonCreator - public static GrantId.Type fromValue(String value) { - GrantId.Type constant = CONSTANTS.get(value); - if (constant == null) { - throw new IllegalArgumentException(value); - } else { - return constant; - } - } - - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/Host.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/Host.java deleted file mode 100644 index cd4b17e9d..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/Host.java +++ /dev/null @@ -1,769 +0,0 @@ - -package eu.eudat.models.rda; - -import java.io.Serializable; -import java.net.URI; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.annotation.*; - - -/** - * The Dataset Distribution Host Schema - *

- * To provide information on quality of service provided by infrastructure (e.g. repository) where data is stored. - * - */ -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "availability", - "backup_frequency", - "backup_type", - "certified_with", - "description", - "geo_location", - "pid_system", - "storage_type", - "support_versioning", - "title", - "url" -}) -@JsonIgnoreProperties(ignoreUnknown = true) -public class Host implements Serializable -{ - - /** - * The Dataset Distribution Host Availability Schema - *

- * Availability - * - */ - @JsonProperty("availability") - @JsonPropertyDescription("Availability") - private String availability; - /** - * The Dataset Distribution Host Backup Frequency Schema - *

- * Backup Frequency - * - */ - @JsonProperty("backup_frequency") - @JsonPropertyDescription("Backup Frequency") - private String backupFrequency; - /** - * The Dataset Distribution Host Backup Type Schema - *

- * Backup Type - * - */ - @JsonProperty("backup_type") - @JsonPropertyDescription("Backup Type") - private String backupType; - /** - * The Dataset Distribution Host Certification Type Schema - *

- * Repository certified to a recognised standard. Allowed values: din31644, dini-zertifikat, dsa, iso16363, iso16919, trac, wds, coretrustseal - * - */ - @JsonProperty("certified_with") - @JsonPropertyDescription("Repository certified to a recognised standard. Allowed values: din31644, dini-zertifikat, dsa, iso16363, iso16919, trac, wds, coretrustseal") - private Host.CertifiedWith certifiedWith; - /** - * The Dataset Distribution Host Description Schema - *

- * Description - * - */ - @JsonProperty("description") - @JsonPropertyDescription("Description") - private String description; - /** - * The Dataset Distribution Host Geographical Location Schema - *

- * Physical location of the data expressed using ISO 3166-1 country code. - * - */ - @JsonProperty("geo_location") - @JsonPropertyDescription("Physical location of the data expressed using ISO 3166-1 country code.") - private Host.GeoLocation geoLocation; - /** - * The Dataset Distribution Host PID System Schema - *

- * PID system(s). Allowed values: ark, arxiv, bibcode, doi, ean13, eissn, handle, igsn, isbn, issn, istc, lissn, lsid, pmid, purl, upc, url, urn, other - * - */ - @JsonProperty("pid_system") - @JsonPropertyDescription("PID system(s). Allowed values: ark, arxiv, bibcode, doi, ean13, eissn, handle, igsn, isbn, issn, istc, lissn, lsid, pmid, purl, upc, url, urn, other") - private List pidSystem = null; - /** - * The Dataset Distribution Host Storage Type Schema - *

- * The type of storage required - * - */ - @JsonProperty("storage_type") - @JsonPropertyDescription("The type of storage required") - private String storageType; - /** - * The Dataset Distribution Host Support Versioning Schema - *

- * If host supports versioning. Allowed values: yes, no, unknown - * - */ - @JsonProperty("support_versioning") - @JsonPropertyDescription("If host supports versioning. Allowed values: yes, no, unknown") - private Host.SupportVersioning supportVersioning; - /** - * The Dataset Distribution Host Title Schema - *

- * Title - * (Required) - * - */ - @JsonProperty("title") - @JsonPropertyDescription("Title") - private String title; - /** - * The Dataset Distribution Host Title Schema - *

- * The URL of the system hosting a distribution of a dataset - * (Required) - * - */ - @JsonProperty("url") - @JsonPropertyDescription("The URL of the system hosting a distribution of a dataset") - private URI url; - @JsonIgnore - private Map additionalProperties = new HashMap(); - private final static long serialVersionUID = 8564338806797654115L; - - /** - * The Dataset Distribution Host Availability Schema - *

- * Availability - * - */ - @JsonProperty("availability") - public String getAvailability() { - return availability; - } - - /** - * The Dataset Distribution Host Availability Schema - *

- * Availability - * - */ - @JsonProperty("availability") - public void setAvailability(String availability) { - this.availability = availability; - } - - /** - * The Dataset Distribution Host Backup Frequency Schema - *

- * Backup Frequency - * - */ - @JsonProperty("backup_frequency") - public String getBackupFrequency() { - return backupFrequency; - } - - /** - * The Dataset Distribution Host Backup Frequency Schema - *

- * Backup Frequency - * - */ - @JsonProperty("backup_frequency") - public void setBackupFrequency(String backupFrequency) { - this.backupFrequency = backupFrequency; - } - - /** - * The Dataset Distribution Host Backup Type Schema - *

- * Backup Type - * - */ - @JsonProperty("backup_type") - public String getBackupType() { - return backupType; - } - - /** - * The Dataset Distribution Host Backup Type Schema - *

- * Backup Type - * - */ - @JsonProperty("backup_type") - public void setBackupType(String backupType) { - this.backupType = backupType; - } - - /** - * The Dataset Distribution Host Certification Type Schema - *

- * Repository certified to a recognised standard. Allowed values: din31644, dini-zertifikat, dsa, iso16363, iso16919, trac, wds, coretrustseal - * - */ - @JsonProperty("certified_with") - public Host.CertifiedWith getCertifiedWith() { - return certifiedWith; - } - - /** - * The Dataset Distribution Host Certification Type Schema - *

- * Repository certified to a recognised standard. Allowed values: din31644, dini-zertifikat, dsa, iso16363, iso16919, trac, wds, coretrustseal - * - */ - @JsonProperty("certified_with") - public void setCertifiedWith(Host.CertifiedWith certifiedWith) { - this.certifiedWith = certifiedWith; - } - - /** - * The Dataset Distribution Host Description Schema - *

- * Description - * - */ - @JsonProperty("description") - public String getDescription() { - return description; - } - - /** - * The Dataset Distribution Host Description Schema - *

- * Description - * - */ - @JsonProperty("description") - public void setDescription(String description) { - this.description = description; - } - - /** - * The Dataset Distribution Host Geographical Location Schema - *

- * Physical location of the data expressed using ISO 3166-1 country code. - * - */ - @JsonProperty("geo_location") - public Host.GeoLocation getGeoLocation() { - return geoLocation; - } - - /** - * The Dataset Distribution Host Geographical Location Schema - *

- * Physical location of the data expressed using ISO 3166-1 country code. - * - */ - @JsonProperty("geo_location") - public void setGeoLocation(Host.GeoLocation geoLocation) { - this.geoLocation = geoLocation; - } - - /** - * The Dataset Distribution Host PID System Schema - *

- * PID system(s). Allowed values: ark, arxiv, bibcode, doi, ean13, eissn, handle, igsn, isbn, issn, istc, lissn, lsid, pmid, purl, upc, url, urn, other - * - */ - @JsonProperty("pid_system") - public List getPidSystem() { - return pidSystem; - } - - /** - * The Dataset Distribution Host PID System Schema - *

- * PID system(s). Allowed values: ark, arxiv, bibcode, doi, ean13, eissn, handle, igsn, isbn, issn, istc, lissn, lsid, pmid, purl, upc, url, urn, other - * - */ - @JsonProperty("pid_system") - public void setPidSystem(List pidSystem) { - this.pidSystem = pidSystem; - } - - /** - * The Dataset Distribution Host Storage Type Schema - *

- * The type of storage required - * - */ - @JsonProperty("storage_type") - public String getStorageType() { - return storageType; - } - - /** - * The Dataset Distribution Host Storage Type Schema - *

- * The type of storage required - * - */ - @JsonProperty("storage_type") - public void setStorageType(String storageType) { - this.storageType = storageType; - } - - /** - * The Dataset Distribution Host Support Versioning Schema - *

- * If host supports versioning. Allowed values: yes, no, unknown - * - */ - @JsonProperty("support_versioning") - public Host.SupportVersioning getSupportVersioning() { - return supportVersioning; - } - - /** - * The Dataset Distribution Host Support Versioning Schema - *

- * If host supports versioning. Allowed values: yes, no, unknown - * - */ - @JsonProperty("support_versioning") - public void setSupportVersioning(Host.SupportVersioning supportVersioning) { - this.supportVersioning = supportVersioning; - } - - /** - * The Dataset Distribution Host Title Schema - *

- * Title - * (Required) - * - */ - @JsonProperty("title") - public String getTitle() { - return title; - } - - /** - * The Dataset Distribution Host Title Schema - *

- * Title - * (Required) - * - */ - @JsonProperty("title") - public void setTitle(String title) { - this.title = title; - } - - /** - * The Dataset Distribution Host Title Schema - *

- * The URL of the system hosting a distribution of a dataset - * (Required) - * - */ - @JsonProperty("url") - public URI getUrl() { - return url; - } - - /** - * The Dataset Distribution Host Title Schema - *

- * The URL of the system hosting a distribution of a dataset - * (Required) - * - */ - @JsonProperty("url") - public void setUrl(URI url) { - this.url = url; - } - - @JsonProperty("additional_properties") - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonProperty("additional_properties") - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - - public enum CertifiedWith { - - DIN_31644("din31644"), - DINI_ZERTIFIKAT("dini-zertifikat"), - DSA("dsa"), - ISO_16363("iso16363"), - ISO_16919("iso16919"), - TRAC("trac"), - WDS("wds"), - CORETRUSTSEAL("coretrustseal"); - private final String value; - private final static Map CONSTANTS = new HashMap(); - - static { - for (Host.CertifiedWith c: values()) { - CONSTANTS.put(c.value, c); - } - } - - private CertifiedWith(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - @JsonValue - public String value() { - return this.value; - } - - @JsonCreator - public static Host.CertifiedWith fromValue(String value) { - Host.CertifiedWith constant = CONSTANTS.get(value); - if (constant == null) { - throw new IllegalArgumentException(value); - } else { - return constant; - } - } - - } - - public enum GeoLocation { - - AD("AD"), - AE("AE"), - AF("AF"), - AG("AG"), - AI("AI"), - AL("AL"), - AM("AM"), - AO("AO"), - AQ("AQ"), - AR("AR"), - AS("AS"), - AT("AT"), - AU("AU"), - AW("AW"), - AX("AX"), - AZ("AZ"), - BA("BA"), - BB("BB"), - BD("BD"), - BE("BE"), - BF("BF"), - BG("BG"), - BH("BH"), - BI("BI"), - BJ("BJ"), - BL("BL"), - BM("BM"), - BN("BN"), - BO("BO"), - BQ("BQ"), - BR("BR"), - BS("BS"), - BT("BT"), - BV("BV"), - BW("BW"), - BY("BY"), - BZ("BZ"), - CA("CA"), - CC("CC"), - CD("CD"), - CF("CF"), - CG("CG"), - CH("CH"), - CI("CI"), - CK("CK"), - CL("CL"), - CM("CM"), - CN("CN"), - CO("CO"), - CR("CR"), - CU("CU"), - CV("CV"), - CW("CW"), - CX("CX"), - CY("CY"), - CZ("CZ"), - DE("DE"), - DJ("DJ"), - DK("DK"), - DM("DM"), - DO("DO"), - DZ("DZ"), - EC("EC"), - EE("EE"), - EG("EG"), - EH("EH"), - ER("ER"), - ES("ES"), - ET("ET"), - FI("FI"), - FJ("FJ"), - FK("FK"), - FM("FM"), - FO("FO"), - FR("FR"), - GA("GA"), - GB("GB"), - GD("GD"), - GE("GE"), - GF("GF"), - GG("GG"), - GH("GH"), - GI("GI"), - GL("GL"), - GM("GM"), - GN("GN"), - GP("GP"), - GQ("GQ"), - GR("GR"), - GS("GS"), - GT("GT"), - GU("GU"), - GW("GW"), - GY("GY"), - HK("HK"), - HM("HM"), - HN("HN"), - HR("HR"), - HT("HT"), - HU("HU"), - ID("ID"), - IE("IE"), - IL("IL"), - IM("IM"), - IN("IN"), - IO("IO"), - IQ("IQ"), - IR("IR"), - IS("IS"), - IT("IT"), - JE("JE"), - JM("JM"), - JO("JO"), - JP("JP"), - KE("KE"), - KG("KG"), - KH("KH"), - KI("KI"), - KM("KM"), - KN("KN"), - KP("KP"), - KR("KR"), - KW("KW"), - KY("KY"), - KZ("KZ"), - LA("LA"), - LB("LB"), - LC("LC"), - LI("LI"), - LK("LK"), - LR("LR"), - LS("LS"), - LT("LT"), - LU("LU"), - LV("LV"), - LY("LY"), - MA("MA"), - MC("MC"), - MD("MD"), - ME("ME"), - MF("MF"), - MG("MG"), - MH("MH"), - MK("MK"), - ML("ML"), - MM("MM"), - MN("MN"), - MO("MO"), - MP("MP"), - MQ("MQ"), - MR("MR"), - MS("MS"), - MT("MT"), - MU("MU"), - MV("MV"), - MW("MW"), - MX("MX"), - MY("MY"), - MZ("MZ"), - NA("NA"), - NC("NC"), - NE("NE"), - NF("NF"), - NG("NG"), - NI("NI"), - NL("NL"), - NO("NO"), - NP("NP"), - NR("NR"), - NU("NU"), - NZ("NZ"), - OM("OM"), - PA("PA"), - PE("PE"), - PF("PF"), - PG("PG"), - PH("PH"), - PK("PK"), - PL("PL"), - PM("PM"), - PN("PN"), - PR("PR"), - PS("PS"), - PT("PT"), - PW("PW"), - PY("PY"), - QA("QA"), - RE("RE"), - RO("RO"), - RS("RS"), - RU("RU"), - RW("RW"), - SA("SA"), - SB("SB"), - SC("SC"), - SD("SD"), - SE("SE"), - SG("SG"), - SH("SH"), - SI("SI"), - SJ("SJ"), - SK("SK"), - SL("SL"), - SM("SM"), - SN("SN"), - SO("SO"), - SR("SR"), - SS("SS"), - ST("ST"), - SV("SV"), - SX("SX"), - SY("SY"), - SZ("SZ"), - TC("TC"), - TD("TD"), - TF("TF"), - TG("TG"), - TH("TH"), - TJ("TJ"), - TK("TK"), - TL("TL"), - TM("TM"), - TN("TN"), - TO("TO"), - TR("TR"), - TT("TT"), - TV("TV"), - TW("TW"), - TZ("TZ"), - UA("UA"), - UG("UG"), - UM("UM"), - US("US"), - UY("UY"), - UZ("UZ"), - VA("VA"), - VC("VC"), - VE("VE"), - VG("VG"), - VI("VI"), - VN("VN"), - VU("VU"), - WF("WF"), - WS("WS"), - YE("YE"), - YT("YT"), - ZA("ZA"), - ZM("ZM"), - ZW("ZW"); - private final String value; - private final static Map CONSTANTS = new HashMap(); - - static { - for (Host.GeoLocation c: values()) { - CONSTANTS.put(c.value, c); - } - } - - private GeoLocation(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - @JsonValue - public String value() { - return this.value; - } - - @JsonCreator - public static Host.GeoLocation fromValue(String value) { - Host.GeoLocation constant = CONSTANTS.get(value); - if (constant == null) { - throw new IllegalArgumentException(value); - } else { - return constant; - } - } - - } - - public enum SupportVersioning { - - YES("yes"), - NO("no"), - UNKNOWN("unknown"); - private final String value; - private final static Map CONSTANTS = new HashMap(); - - static { - for (Host.SupportVersioning c: values()) { - CONSTANTS.put(c.value, c); - } - } - - private SupportVersioning(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - @JsonValue - public String value() { - return this.value; - } - - @JsonCreator - public static Host.SupportVersioning fromValue(String value) { - Host.SupportVersioning constant = CONSTANTS.get(value); - if (constant == null) { - throw new IllegalArgumentException(value); - } else { - return constant; - } - } - - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/Language.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/Language.java deleted file mode 100644 index b9e85c889..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/Language.java +++ /dev/null @@ -1,229 +0,0 @@ -package eu.eudat.models.rda; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -import java.util.HashMap; -import java.util.Map; - -public enum Language { - - AAR("aar"), - ABK("abk"), - AFR("afr"), - AKA("aka"), - AMH("amh"), - ARA("ara"), - ARG("arg"), - ASM("asm"), - AVA("ava"), - AVE("ave"), - AYM("aym"), - AZE("aze"), - BAK("bak"), - BAM("bam"), - BEL("bel"), - BEN("ben"), - BIH("bih"), - BIS("bis"), - BOD("bod"), - BOS("bos"), - BRE("bre"), - BUL("bul"), - CAT("cat"), - CES("ces"), - CHA("cha"), - CHE("che"), - CHU("chu"), - CHV("chv"), - COR("cor"), - COS("cos"), - CRE("cre"), - CYM("cym"), - DAN("dan"), - DEU("deu"), - DIV("div"), - DZO("dzo"), - ELL("ell"), - ENG("eng"), - EPO("epo"), - EST("est"), - EUS("eus"), - EWE("ewe"), - FAO("fao"), - FAS("fas"), - FIJ("fij"), - FIN("fin"), - FRA("fra"), - FRY("fry"), - FUL("ful"), - GLA("gla"), - GLE("gle"), - GLG("glg"), - GLV("glv"), - GRN("grn"), - GUJ("guj"), - HAT("hat"), - HAU("hau"), - HBS("hbs"), - HEB("heb"), - HER("her"), - HIN("hin"), - HMO("hmo"), - HRV("hrv"), - HUN("hun"), - HYE("hye"), - IBO("ibo"), - IDO("ido"), - III("iii"), - IKU("iku"), - ILE("ile"), - INA("ina"), - IND("ind"), - IPK("ipk"), - ISL("isl"), - ITA("ita"), - JAV("jav"), - JPN("jpn"), - KAL("kal"), - KAN("kan"), - KAS("kas"), - KAT("kat"), - KAU("kau"), - KAZ("kaz"), - KHM("khm"), - KIK("kik"), - KIN("kin"), - KIR("kir"), - KOM("kom"), - KON("kon"), - KOR("kor"), - KUA("kua"), - KUR("kur"), - LAO("lao"), - LAT("lat"), - LAV("lav"), - LIM("lim"), - LIN("lin"), - LIT("lit"), - LTZ("ltz"), - LUB("lub"), - LUG("lug"), - MAH("mah"), - MAL("mal"), - MAR("mar"), - MKD("mkd"), - MLG("mlg"), - MLT("mlt"), - MON("mon"), - MRI("mri"), - MSA("msa"), - MYA("mya"), - NAU("nau"), - NAV("nav"), - NBL("nbl"), - NDE("nde"), - NDO("ndo"), - NEP("nep"), - NLD("nld"), - NNO("nno"), - NOB("nob"), - NOR("nor"), - NYA("nya"), - OCI("oci"), - OJI("oji"), - ORI("ori"), - ORM("orm"), - OSS("oss"), - PAN("pan"), - PLI("pli"), - POL("pol"), - POR("por"), - PUS("pus"), - QUE("que"), - ROH("roh"), - RON("ron"), - RUN("run"), - RUS("rus"), - SAG("sag"), - SAN("san"), - SIN("sin"), - SLK("slk"), - SLV("slv"), - SME("sme"), - SMO("smo"), - SNA("sna"), - SND("snd"), - SOM("som"), - SOT("sot"), - SPA("spa"), - SQI("sqi"), - SRD("srd"), - SRP("srp"), - SSW("ssw"), - SUN("sun"), - SWA("swa"), - SWE("swe"), - TAH("tah"), - TAM("tam"), - TAT("tat"), - TEL("tel"), - TGK("tgk"), - TGL("tgl"), - THA("tha"), - TIR("tir"), - TON("ton"), - TSN("tsn"), - TSO("tso"), - TUK("tuk"), - TUR("tur"), - TWI("twi"), - UIG("uig"), - UKR("ukr"), - URD("urd"), - UZB("uzb"), - VEN("ven"), - VIE("vie"), - VOL("vol"), - WLN("wln"), - WOL("wol"), - XHO("xho"), - YID("yid"), - YOR("yor"), - ZHA("zha"), - ZHO("zho"), - ZUL("zul"); - private final String value; - private final static Map CONSTANTS = new HashMap<>(); - - static { - for (Language c: values()) { - CONSTANTS.put(c.value, c); - } - } - - private Language(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - @JsonValue - public String value() { - return this.value; - } - - @JsonCreator - public static Language fromValue(String value) { - Language constant = CONSTANTS.get(value); - if (constant == null) { - throw new IllegalArgumentException(value); - } else { - return constant; - } - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/License.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/License.java deleted file mode 100644 index 3b9b5a205..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/License.java +++ /dev/null @@ -1,109 +0,0 @@ - -package eu.eudat.models.rda; - -import java.io.Serializable; -import java.net.URI; -import java.util.HashMap; -import java.util.Map; - -import com.fasterxml.jackson.annotation.*; - - -/** - * The Dataset Distribution License Items - *

- * - * - */ -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "license_ref", - "start_date" -}) -@JsonIgnoreProperties(ignoreUnknown = true) -public class License implements Serializable -{ - - /** - * The Dataset Distribution License Reference Schema - *

- * Link to license document. - * (Required) - * - */ - @JsonProperty("license_ref") - @JsonPropertyDescription("Link to license document.") - private URI licenseRef; - /** - * The Dataset Distribution License Start Date Schema - *

- * Starting date of license. If date is set in the future, it indicates embargo period. - * (Required) - * - */ - @JsonProperty("start_date") - @JsonPropertyDescription("Starting date of license. If date is set in the future, it indicates embargo period.") - private String startDate; - @JsonIgnore - private Map additionalProperties = new HashMap(); - private final static long serialVersionUID = 4148207295817559010L; - - /** - * The Dataset Distribution License Reference Schema - *

- * Link to license document. - * (Required) - * - */ - @JsonProperty("license_ref") - public URI getLicenseRef() { - return licenseRef; - } - - /** - * The Dataset Distribution License Reference Schema - *

- * Link to license document. - * (Required) - * - */ - @JsonProperty("license_ref") - public void setLicenseRef(URI licenseRef) { - this.licenseRef = licenseRef; - } - - /** - * The Dataset Distribution License Start Date Schema - *

- * Starting date of license. If date is set in the future, it indicates embargo period. - * (Required) - * - */ - @JsonProperty("start_date") - public String getStartDate() { - return startDate; - } - - /** - * The Dataset Distribution License Start Date Schema - *

- * Starting date of license. If date is set in the future, it indicates embargo period. - * (Required) - * - */ - @JsonProperty("start_date") - public void setStartDate(String startDate) { - this.startDate = startDate; - } - - @JsonProperty("additional_properties") - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonProperty("additional_properties") - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/MetadataStandardId.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/MetadataStandardId.java deleted file mode 100644 index b23ac73a0..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/MetadataStandardId.java +++ /dev/null @@ -1,147 +0,0 @@ - -package eu.eudat.models.rda; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import com.fasterxml.jackson.annotation.*; - - -/** - * The Dataset Metadata Standard ID Schema - *

- * - * - */ -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "identifier", - "type" -}) -@JsonIgnoreProperties(ignoreUnknown = true) -public class MetadataStandardId implements Serializable -{ - - /** - * The Dataset Metadata Standard Identifier Value Schema - *

- * Identifier for the metadata standard used. - * (Required) - * - */ - @JsonProperty("identifier") - @JsonPropertyDescription("Identifier for the metadata standard used.") - private String identifier; - /** - * The Dataset Metadata Standard Identifier Type Schema - *

- * Identifier type. Allowed values: url, other - * (Required) - * - */ - @JsonProperty("type") - @JsonPropertyDescription("Identifier type. Allowed values: url, other") - private MetadataStandardId.Type type; - @JsonIgnore - private Map additionalProperties = new HashMap(); - private final static long serialVersionUID = -7641042701935397947L; - - /** - * The Dataset Metadata Standard Identifier Value Schema - *

- * Identifier for the metadata standard used. - * (Required) - * - */ - @JsonProperty("identifier") - public String getIdentifier() { - return identifier; - } - - /** - * The Dataset Metadata Standard Identifier Value Schema - *

- * Identifier for the metadata standard used. - * (Required) - * - */ - @JsonProperty("identifier") - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - /** - * The Dataset Metadata Standard Identifier Type Schema - *

- * Identifier type. Allowed values: url, other - * (Required) - * - */ - @JsonProperty("type") - public MetadataStandardId.Type getType() { - return type; - } - - /** - * The Dataset Metadata Standard Identifier Type Schema - *

- * Identifier type. Allowed values: url, other - * (Required) - * - */ - @JsonProperty("type") - public void setType(MetadataStandardId.Type type) { - this.type = type; - } - - @JsonProperty("additional_properties") - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonProperty("additional_properties") - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - - public enum Type { - - URL("url"), - OTHER("other"); - private final String value; - private final static Map CONSTANTS = new HashMap(); - - static { - for (MetadataStandardId.Type c: values()) { - CONSTANTS.put(c.value, c); - } - } - - private Type(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - @JsonValue - public String value() { - return this.value; - } - - @JsonCreator - public static MetadataStandardId.Type fromValue(String value) { - MetadataStandardId.Type constant = CONSTANTS.get(value); - if (constant == null) { - throw new IllegalArgumentException(value); - } else { - return constant; - } - } - - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/Metadatum.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/Metadatum.java deleted file mode 100644 index 2e10b8df1..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/Metadatum.java +++ /dev/null @@ -1,363 +0,0 @@ - -package eu.eudat.models.rda; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import com.fasterxml.jackson.annotation.*; - - -/** - * The Dataset Metadata Items Schema - *

- * - * - */ -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "description", - "language", - "metadata_standard_id", - "additional_properties" -}) -@JsonIgnoreProperties(ignoreUnknown = true) -public class Metadatum implements Serializable -{ - - /** - * The Dataset Metadata Description Schema - *

- * Description - * - */ - @JsonProperty("description") - @JsonPropertyDescription("Description") - private String description; - /** - * The Dataset Metadata Language Schema - *

- * Language of the metadata expressed using ISO 639-3. - * (Required) - * - */ - @JsonProperty("language") - @JsonPropertyDescription("Language of the metadata expressed using ISO 639-3.") - private Metadatum.Language language; - /** - * The Dataset Metadata Standard ID Schema - *

- * - * (Required) - * - */ - @JsonProperty("metadata_standard_id") - private MetadataStandardId metadataStandardId; - @JsonProperty("additional_properties") - private Map additionalProperties = new HashMap(); - private final static long serialVersionUID = 6511312853153406190L; - - /** - * The Dataset Metadata Description Schema - *

- * Description - * - */ - @JsonProperty("description") - public String getDescription() { - return description; - } - - /** - * The Dataset Metadata Description Schema - *

- * Description - * - */ - @JsonProperty("description") - public void setDescription(String description) { - this.description = description; - } - - /** - * The Dataset Metadata Language Schema - *

- * Language of the metadata expressed using ISO 639-3. - * (Required) - * - */ - @JsonProperty("language") - public Metadatum.Language getLanguage() { - return language; - } - - /** - * The Dataset Metadata Language Schema - *

- * Language of the metadata expressed using ISO 639-3. - * (Required) - * - */ - @JsonProperty("language") - public void setLanguage(Metadatum.Language language) { - this.language = language; - } - - /** - * The Dataset Metadata Standard ID Schema - *

- * - * (Required) - * - */ - @JsonProperty("metadata_standard_id") - public MetadataStandardId getMetadataStandardId() { - return metadataStandardId; - } - - /** - * The Dataset Metadata Standard ID Schema - *

- * - * (Required) - * - */ - @JsonProperty("metadata_standard_id") - public void setMetadataStandardId(MetadataStandardId metadataStandardId) { - this.metadataStandardId = metadataStandardId; - } - - @JsonProperty("additional_properties") - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonProperty("additional_properties") - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - - public enum Language { - - AAR("aar"), - ABK("abk"), - AFR("afr"), - AKA("aka"), - AMH("amh"), - ARA("ara"), - ARG("arg"), - ASM("asm"), - AVA("ava"), - AVE("ave"), - AYM("aym"), - AZE("aze"), - BAK("bak"), - BAM("bam"), - BEL("bel"), - BEN("ben"), - BIH("bih"), - BIS("bis"), - BOD("bod"), - BOS("bos"), - BRE("bre"), - BUL("bul"), - CAT("cat"), - CES("ces"), - CHA("cha"), - CHE("che"), - CHU("chu"), - CHV("chv"), - COR("cor"), - COS("cos"), - CRE("cre"), - CYM("cym"), - DAN("dan"), - DEU("deu"), - DIV("div"), - DZO("dzo"), - ELL("ell"), - ENG("eng"), - EPO("epo"), - EST("est"), - EUS("eus"), - EWE("ewe"), - FAO("fao"), - FAS("fas"), - FIJ("fij"), - FIN("fin"), - FRA("fra"), - FRY("fry"), - FUL("ful"), - GLA("gla"), - GLE("gle"), - GLG("glg"), - GLV("glv"), - GRN("grn"), - GUJ("guj"), - HAT("hat"), - HAU("hau"), - HBS("hbs"), - HEB("heb"), - HER("her"), - HIN("hin"), - HMO("hmo"), - HRV("hrv"), - HUN("hun"), - HYE("hye"), - IBO("ibo"), - IDO("ido"), - III("iii"), - IKU("iku"), - ILE("ile"), - INA("ina"), - IND("ind"), - IPK("ipk"), - ISL("isl"), - ITA("ita"), - JAV("jav"), - JPN("jpn"), - KAL("kal"), - KAN("kan"), - KAS("kas"), - KAT("kat"), - KAU("kau"), - KAZ("kaz"), - KHM("khm"), - KIK("kik"), - KIN("kin"), - KIR("kir"), - KOM("kom"), - KON("kon"), - KOR("kor"), - KUA("kua"), - KUR("kur"), - LAO("lao"), - LAT("lat"), - LAV("lav"), - LIM("lim"), - LIN("lin"), - LIT("lit"), - LTZ("ltz"), - LUB("lub"), - LUG("lug"), - MAH("mah"), - MAL("mal"), - MAR("mar"), - MKD("mkd"), - MLG("mlg"), - MLT("mlt"), - MON("mon"), - MRI("mri"), - MSA("msa"), - MYA("mya"), - NAU("nau"), - NAV("nav"), - NBL("nbl"), - NDE("nde"), - NDO("ndo"), - NEP("nep"), - NLD("nld"), - NNO("nno"), - NOB("nob"), - NOR("nor"), - NYA("nya"), - OCI("oci"), - OJI("oji"), - ORI("ori"), - ORM("orm"), - OSS("oss"), - PAN("pan"), - PLI("pli"), - POL("pol"), - POR("por"), - PUS("pus"), - QUE("que"), - ROH("roh"), - RON("ron"), - RUN("run"), - RUS("rus"), - SAG("sag"), - SAN("san"), - SIN("sin"), - SLK("slk"), - SLV("slv"), - SME("sme"), - SMO("smo"), - SNA("sna"), - SND("snd"), - SOM("som"), - SOT("sot"), - SPA("spa"), - SQI("sqi"), - SRD("srd"), - SRP("srp"), - SSW("ssw"), - SUN("sun"), - SWA("swa"), - SWE("swe"), - TAH("tah"), - TAM("tam"), - TAT("tat"), - TEL("tel"), - TGK("tgk"), - TGL("tgl"), - THA("tha"), - TIR("tir"), - TON("ton"), - TSN("tsn"), - TSO("tso"), - TUK("tuk"), - TUR("tur"), - TWI("twi"), - UIG("uig"), - UKR("ukr"), - URD("urd"), - UZB("uzb"), - VEN("ven"), - VIE("vie"), - VOL("vol"), - WLN("wln"), - WOL("wol"), - XHO("xho"), - YID("yid"), - YOR("yor"), - ZHA("zha"), - ZHO("zho"), - ZUL("zul"); - private final String value; - private final static Map CONSTANTS = new HashMap(); - - static { - for (Metadatum.Language c: values()) { - CONSTANTS.put(c.value, c); - } - } - - private Language(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - @JsonValue - public String value() { - return this.value; - } - - @JsonCreator - public static Metadatum.Language fromValue(String value) { - Metadatum.Language constant = CONSTANTS.get(value); - if (constant == null) { - return null; -// throw new IllegalArgumentException(value); - } else { - return constant; - } - } - - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/PidSystem.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/PidSystem.java deleted file mode 100644 index 0e29d1153..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/PidSystem.java +++ /dev/null @@ -1,63 +0,0 @@ - -package eu.eudat.models.rda; - -import java.util.HashMap; -import java.util.Map; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public enum PidSystem { - - ARK("ark"), - ARXIV("arxiv"), - BIBCODE("bibcode"), - DOI("doi"), - EAN_13("ean13"), - EISSN("eissn"), - HANDLE("handle"), - IGSN("igsn"), - ISBN("isbn"), - ISSN("issn"), - ISTC("istc"), - LISSN("lissn"), - LSID("lsid"), - PMID("pmid"), - PURL("purl"), - UPC("upc"), - URL("url"), - URN("urn"), - OTHER("other"); - private final String value; - private final static Map CONSTANTS = new HashMap(); - - static { - for (PidSystem c: values()) { - CONSTANTS.put(c.value, c); - } - } - - private PidSystem(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - @JsonValue - public String value() { - return this.value; - } - - @JsonCreator - public static PidSystem fromValue(String value) { - PidSystem constant = CONSTANTS.get(value); - if (constant == null) { - throw new IllegalArgumentException(value); - } else { - return constant; - } - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/Project.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/Project.java deleted file mode 100644 index d16c3957d..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/Project.java +++ /dev/null @@ -1,208 +0,0 @@ - -package eu.eudat.models.rda; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.annotation.*; - - -/** - * The DMP Project Items Schema - *

- * - * - */ -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "description", - "end", - "funding", - "start", - "title" -}) -@JsonIgnoreProperties(ignoreUnknown = true) -public class Project implements Serializable -{ - - /** - * The DMP Project Description Schema - *

- * Project description - * - */ - @JsonProperty("description") - @JsonPropertyDescription("Project description") - private String description; - /** - * The DMP Project End Date Schema - *

- * Project end date - * (Required) - * - */ - @JsonProperty("end") - @JsonPropertyDescription("Project end date") - private String end; - /** - * The DMP Project Funding Schema - *

- * Funding related with a project - * - */ - @JsonProperty("funding") - @JsonPropertyDescription("Funding related with a project") - private List funding = null; - /** - * The DMP Project Start Date Schema - *

- * Project start date - * (Required) - * - */ - @JsonProperty("start") - @JsonPropertyDescription("Project start date") - private String start; - /** - * The DMP Project Title Schema - *

- * Project title - * (Required) - * - */ - @JsonProperty("title") - @JsonPropertyDescription("Project title") - private String title; - @JsonIgnore - private Map additionalProperties = new HashMap(); - private final static long serialVersionUID = 1437619307195890472L; - - /** - * The DMP Project Description Schema - *

- * Project description - * - */ - @JsonProperty("description") - public String getDescription() { - return description; - } - - /** - * The DMP Project Description Schema - *

- * Project description - * - */ - @JsonProperty("description") - public void setDescription(String description) { - this.description = description; - } - - /** - * The DMP Project End Date Schema - *

- * Project end date - * (Required) - * - */ - @JsonProperty("end") - public String getEnd() { - return end; - } - - /** - * The DMP Project End Date Schema - *

- * Project end date - * (Required) - * - */ - @JsonProperty("end") - public void setEnd(String end) { - this.end = end; - } - - /** - * The DMP Project Funding Schema - *

- * Funding related with a project - * - */ - @JsonProperty("funding") - public List getFunding() { - return funding; - } - - /** - * The DMP Project Funding Schema - *

- * Funding related with a project - * - */ - @JsonProperty("funding") - public void setFunding(List funding) { - this.funding = funding; - } - - /** - * The DMP Project Start Date Schema - *

- * Project start date - * (Required) - * - */ - @JsonProperty("start") - public String getStart() { - return start; - } - - /** - * The DMP Project Start Date Schema - *

- * Project start date - * (Required) - * - */ - @JsonProperty("start") - public void setStart(String start) { - this.start = start; - } - - /** - * The DMP Project Title Schema - *

- * Project title - * (Required) - * - */ - @JsonProperty("title") - public String getTitle() { - return title; - } - - /** - * The DMP Project Title Schema - *

- * Project title - * (Required) - * - */ - @JsonProperty("title") - public void setTitle(String title) { - this.title = title; - } - - @JsonProperty("additional_properties") - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonProperty("additional_properties") - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/RDAModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/RDAModel.java deleted file mode 100644 index 8d9b7e8d2..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/RDAModel.java +++ /dev/null @@ -1,61 +0,0 @@ - -package eu.eudat.models.rda; - -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - - -/** - * RDA DMP Common Standard Schema - *

- * JSON Schema for the RDA DMP Common Standard - * - */ -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "dmp" -}) -@JsonIgnoreProperties(ignoreUnknown = true) -public class RDAModel implements Serializable -{ - - /** - * The DMP Schema - *

- * - * (Required) - * - */ - @JsonProperty("dmp") - private Dmp dmp; - private final static long serialVersionUID = 7331666133368350998L; - - /** - * The DMP Schema - *

- * - * (Required) - * - */ - @JsonProperty("dmp") - public Dmp getDmp() { - return dmp; - } - - /** - * The DMP Schema - *

- * - * (Required) - * - */ - @JsonProperty("dmp") - public void setDmp(Dmp dmp) { - this.dmp = dmp; - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/SecurityAndPrivacy.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/SecurityAndPrivacy.java deleted file mode 100644 index d962b3713..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/SecurityAndPrivacy.java +++ /dev/null @@ -1,106 +0,0 @@ - -package eu.eudat.models.rda; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import com.fasterxml.jackson.annotation.*; - - -/** - * The Dataset Security & Policy Items Schema - *

- * - * - */ -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "description", - "title", - "additional_properties" -}) -@JsonIgnoreProperties(ignoreUnknown = true) -public class SecurityAndPrivacy implements Serializable -{ - - /** - * The Dataset Security & Policy Description Schema - *

- * Description - * - */ - @JsonProperty("description") - @JsonPropertyDescription("Description") - private String description; - /** - * The Dataset Security & Policy Title Schema - *

- * Title - * (Required) - * - */ - @JsonProperty("title") - @JsonPropertyDescription("Title") - private String title; - @JsonProperty("additional_properties") - private Map additionalProperties = new HashMap(); - private final static long serialVersionUID = 7863747935827682977L; - - /** - * The Dataset Security & Policy Description Schema - *

- * Description - * - */ - @JsonProperty("description") - public String getDescription() { - return description; - } - - /** - * The Dataset Security & Policy Description Schema - *

- * Description - * - */ - @JsonProperty("description") - public void setDescription(String description) { - this.description = description; - } - - /** - * The Dataset Security & Policy Title Schema - *

- * Title - * (Required) - * - */ - @JsonProperty("title") - public String getTitle() { - return title; - } - - /** - * The Dataset Security & Policy Title Schema - *

- * Title - * (Required) - * - */ - @JsonProperty("title") - public void setTitle(String title) { - this.title = title; - } - - @JsonProperty("additional_properties") - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonProperty("additional_properties") - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/TechnicalResource.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/TechnicalResource.java deleted file mode 100644 index 87683fd5b..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/TechnicalResource.java +++ /dev/null @@ -1,106 +0,0 @@ - -package eu.eudat.models.rda; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import com.fasterxml.jackson.annotation.*; - - -/** - * The Dataset Technical Resource Items Schema - *

- * - * - */ -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "description", - "name", - "additional_properties" -}) -@JsonIgnoreProperties(ignoreUnknown = true) -public class TechnicalResource implements Serializable -{ - - /** - * The Dataset Technical Resource Description Schema - *

- * Description of the technical resource - * - */ - @JsonProperty("description") - @JsonPropertyDescription("Description of the technical resource") - private String description; - /** - * The Dataset Technical Resource Name Schema - *

- * Name of the technical resource - * (Required) - * - */ - @JsonProperty("name") - @JsonPropertyDescription("Name of the technical resource") - private String name; - @JsonProperty("additional_properties") - private Map additionalProperties = new HashMap(); - private final static long serialVersionUID = -7451757227129483110L; - - /** - * The Dataset Technical Resource Description Schema - *

- * Description of the technical resource - * - */ - @JsonProperty("description") - public String getDescription() { - return description; - } - - /** - * The Dataset Technical Resource Description Schema - *

- * Description of the technical resource - * - */ - @JsonProperty("description") - public void setDescription(String description) { - this.description = description; - } - - /** - * The Dataset Technical Resource Name Schema - *

- * Name of the technical resource - * (Required) - * - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * The Dataset Technical Resource Name Schema - *

- * Name of the technical resource - * (Required) - * - */ - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - @JsonProperty("additional_properties") - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonProperty("additional_properties") - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/ContactIdRDAMapper.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/ContactIdRDAMapper.java deleted file mode 100644 index c9eac2009..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/ContactIdRDAMapper.java +++ /dev/null @@ -1,19 +0,0 @@ -package eu.eudat.models.rda.mapper; - -import eu.eudat.models.rda.ContactId; - -import java.util.UUID; - -public class ContactIdRDAMapper { - - public static ContactId toRDA(UUID id) { - ContactId rda = new ContactId(); - rda.setIdentifier(id.toString()); - rda.setType(ContactId.Type.OTHER); - return rda; - } - - public static UUID toEntity(ContactId rda) { - return UUID.fromString(rda.getIdentifier()); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/ContactRDAMapper.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/ContactRDAMapper.java deleted file mode 100644 index 0b24487cf..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/ContactRDAMapper.java +++ /dev/null @@ -1,30 +0,0 @@ -package eu.eudat.models.rda.mapper; - -import eu.eudat.data.UserEntity; -import eu.eudat.models.rda.Contact; - -public class ContactRDAMapper { - - public static Contact toRDA(UserEntity creator) { - Contact rda = new Contact(); - if (creator.getName() == null) { - throw new IllegalArgumentException("Contact Name is missing"); - } - rda.setName(creator.getName()); - //TODO: GetEmail -// if (creator.getEmail() == null) { -// throw new IllegalArgumentException("Contact Email is missing"); -// } -// rda.setMbox(creator.getEmail()); - rda.setContactId(ContactIdRDAMapper.toRDA(creator.getId())); - return rda; - } - - public static UserEntity toEntity(Contact rda) { - UserEntity entity = new UserEntity(); - entity.setId(ContactIdRDAMapper.toEntity(rda.getContactId())); - entity.setName(rda.getName()); -// entity.setEmail(rda.getMbox());//TODO: GetEmail - return entity; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/ContributorIdRDAMapper.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/ContributorIdRDAMapper.java deleted file mode 100644 index be05ea625..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/ContributorIdRDAMapper.java +++ /dev/null @@ -1,24 +0,0 @@ -package eu.eudat.models.rda.mapper; - -import eu.eudat.models.rda.Contributor; -import eu.eudat.models.rda.ContributorId; - -import java.util.UUID; - -public class ContributorIdRDAMapper { - - public static ContributorId toRDA(Object id) { - ContributorId rda = new ContributorId(); - String idParts[] = id.toString().split(":"); - String prefix = idParts.length > 1 ? idParts[0] : id.toString(); - if (prefix.equals("orcid")) { - String finalId = id.toString().replace(prefix + ":", ""); - rda.setIdentifier("http://orcid.org/" + finalId); - rda.setType(ContributorId.Type.ORCID); - } else { - rda.setIdentifier(id.toString()); - rda.setType(ContributorId.Type.OTHER); - } - return rda; - } -} 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 deleted file mode 100644 index 0d8e25426..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/ContributorRDAMapper.java +++ /dev/null @@ -1,71 +0,0 @@ -package eu.eudat.models.rda.mapper; - -import com.fasterxml.jackson.databind.ObjectMapper; -import eu.eudat.data.DmpUserEntity; -import eu.eudat.models.rda.Contributor; -import eu.eudat.models.rda.ContributorId; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; - -public class ContributorRDAMapper { - private static final Logger logger = LoggerFactory.getLogger(ContributorRDAMapper.class); - - public static Contributor toRDA(DmpUserEntity userDMP) { - Contributor rda = new Contributor(); - rda.setContributorId(ContributorIdRDAMapper.toRDA(userDMP.getUserId())); -// if (userDMP.getUser().getName() == null) { //TODO -// throw new IllegalArgumentException("Contributor Name is missing"); -// } -// rda.setName(userDMP.getUser().getName()); -// rda.setMbox(userDMP.getUser().getEmail()); -// 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); -// } - 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; -// } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/CostRDAMapper.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/CostRDAMapper.java deleted file mode 100644 index 6f31e570e..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/CostRDAMapper.java +++ /dev/null @@ -1,121 +0,0 @@ -package eu.eudat.models.rda.mapper; - -import java.util.*; -import java.util.stream.Collectors; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import eu.eudat.logic.utilities.json.JavaToJson; -import eu.eudat.models.rda.Cost; -import eu.eudat.models.rda.PidSystem; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class CostRDAMapper { - private static final Logger logger = LoggerFactory.getLogger(DatasetRDAMapper.class); - - public static Cost toRDA(Map cost) { - Cost rda = new Cost(); - Map code = new org.json.JSONObject((String) cost.get("code")).toMap(); - rda.setCurrencyCode(Cost.CurrencyCode.fromValue((String) code.get("value"))); - rda.setDescription((String) cost.get("description")); - if (cost.get("title") == null) { - throw new IllegalArgumentException("Cost Title is missing"); - } - rda.setTitle((String) cost.get("title")); - rda.setValue(((Integer) cost.get("value")).doubleValue()); - return rda; - } - - public static List toRDAList(List nodes) throws JsonProcessingException { - Map rdaMap = new HashMap<>(); - for(JsonNode node: nodes){ - String rdaProperty = ""; - JsonNode schematics = node.get("schematics"); - if(schematics.isArray()){ - int index = 0; - for(JsonNode schematic: schematics){ - if(schematic.asText().startsWith("rda.dmp.cost")){ - rdaProperty = schematic.asText(); - ((ArrayNode)schematics).remove(index); - break; - } - index++; - } - } - else{ - continue; - } - String rdaValue = node.get("value").asText(); - if(rdaValue == null || (rdaValue.isEmpty() && !node.get("value").isArray())){ - continue; - } - String key = node.get("numbering").asText(); - if(!key.contains("mult")){ - key = "0"; - } - else{ - key = "" + key.charAt(4); - } - Cost rda; - if(rdaMap.containsKey(key)){ - rda = rdaMap.get(key); - } - else{ - rda = new Cost(); - rdaMap.put(key, rda); - } - if(rdaProperty.contains("value")){ - try { - rda.setValue(Double.valueOf(rdaValue)); - } - catch (NumberFormatException e) { - logger.warn("Dmp cost value " + rdaValue + " is not valid. Cost value will not be set."); - } - } - else if(rdaProperty.contains("currency_code")){ - try { - HashMap result = - new ObjectMapper().readValue(rdaValue, HashMap.class); - rda.setCurrencyCode(Cost.CurrencyCode.fromValue(result.get("value"))); - } - catch (Exception e) { - logger.warn("Dmp cost currency code is not valid and will not be set."); - } - } - else if(rdaProperty.contains("title")){ - Iterator iter = node.get("value").elements(); - StringBuilder title = new StringBuilder(); - while(iter.hasNext()){ - String next = iter.next().asText(); - if(!next.equals("Other")) { - title.append(next).append(", "); - } - } - if(title.length() > 2){ - rda.setTitle(title.substring(0, title.length() - 2)); - } - else{ - String t = rda.getTitle(); - if(t == null){ // only other as title - rda.setTitle(rdaValue); - } - else{ // option + other - rda.setTitle(t + ", " + rdaValue); - } - } - } - else if(rdaProperty.contains("description")){ - rda.setDescription(rdaValue); - } - } - List rdaList = rdaMap.values().stream() - .filter(cost -> cost.getTitle() != null) - .collect(Collectors.toList()); - return rdaList; - - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DatasetIdRDAMapper.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DatasetIdRDAMapper.java deleted file mode 100644 index 50d535348..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DatasetIdRDAMapper.java +++ /dev/null @@ -1,141 +0,0 @@ -package eu.eudat.models.rda.mapper; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import eu.eudat.logic.utilities.json.JsonSearcher; -import eu.eudat.models.rda.DatasetId; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -public class DatasetIdRDAMapper { - private static final Logger logger = LoggerFactory.getLogger(DatasetIdRDAMapper.class); - - /*public static DatasetId toRDA(UUID id) { - DatasetId rda = new DatasetId(); - rda.setIdentifier(id.toString()); - rda.setType(DatasetId.Type.OTHER); - - return rda; - }*/ - - public static DatasetId toRDA(List nodes) { - DatasetId data = new DatasetId(); - for (JsonNode node: nodes) { - String rdaProperty = ""; - JsonNode schematics = node.get("schematics"); - if(schematics.isArray()){ - int index = 0; - for(JsonNode schematic: schematics){ - if(schematic.asText().startsWith("rda.dataset.dataset_id")){ - rdaProperty = schematic.asText(); - ((ArrayNode)schematics).remove(index); - break; - } - index++; - } - } - else{ - continue; - } - String rdaValue = node.get("value").asText(); - if(rdaValue == null || rdaValue.isEmpty()){ - continue; - } - - ObjectMapper mapper = new ObjectMapper(); - try { - Map values = mapper.readValue(rdaValue, HashMap.class); - if (!values.isEmpty()) { - values.entrySet().forEach(entry -> finalRDAMap(data, entry.getKey(), (String) entry.getValue())); - } else { - finalRDAMap(data, rdaProperty, rdaValue); - } - } catch (IOException e) { - logger.warn(e.getMessage() + ".Passing value as is"); - finalRDAMap(data, rdaProperty, rdaValue); - - } - - } - - if (data.getIdentifier() != null && data.getType() != null) { - return data; - } - return null; - } - - private static void finalRDAMap(DatasetId rda, String property, String value) { - if (value != null) { - for (DatasetIdProperties datasetIdProperties : DatasetIdProperties.values()) { - if (property.contains(datasetIdProperties.getName())) { - switch (datasetIdProperties) { - case IDENTIFIER: - rda.setIdentifier(value); - break; - case TYPE: - try { - rda.setType(DatasetId.Type.fromValue(value)); - } - catch (IllegalArgumentException e){ - logger.warn("Type " + value + " from semantic rda.dataset.dataset_id.type was not found. Setting type to OTHER."); - rda.setType(DatasetId.Type.OTHER); - } - break; - } - } - } - } - - - } - - public static Map toProperties(DatasetId rda, JsonNode node) { - Map properties = new HashMap<>(); - - List idNodes = JsonSearcher.findNodes(node, "schematics", "rda.dataset.dataset_id"); - - for (JsonNode idNode: idNodes) { - for (DatasetIdProperties datasetIdProperties : DatasetIdProperties.values()) { - JsonNode schematics = idNode.get("schematics"); - if(schematics.isArray()){ - for(JsonNode schematic: schematics){ - if(schematic.asText().endsWith(datasetIdProperties.getName())){ - switch (datasetIdProperties) { - case IDENTIFIER: - properties.put(idNode.get("id").asText(), rda.getIdentifier()); - break; - case TYPE: - properties.put(idNode.get("id").asText(), rda.getType().value()); - break; - } - break; - } - } - } - } - } - return properties; - } - - private enum DatasetIdProperties { - IDENTIFIER("identifier"), - TYPE("type"); - - private final String name; - - DatasetIdProperties(String name) { - this.name = name; - } - - public String getName() { - return name; - } - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DatasetRDAMapper.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DatasetRDAMapper.java deleted file mode 100644 index 0a4b50e2b..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DatasetRDAMapper.java +++ /dev/null @@ -1,421 +0,0 @@ -package eu.eudat.models.rda.mapper; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import eu.eudat.data.DescriptionEntity; -import eu.eudat.data.DescriptionTemplateEntity; -import eu.eudat.data.TagEntity; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.logic.utilities.json.JsonSearcher; -import eu.eudat.models.rda.*; -import eu.eudat.query.DmpDescriptionTemplateQuery; -import gr.cite.tools.data.query.QueryFactory; -import org.json.JSONObject; -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 java.time.Instant; -import java.time.ZoneId; -import java.time.format.DateTimeFormatter; -import java.time.format.DateTimeParseException; -import java.util.*; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import java.util.stream.StreamSupport; - -@Component -public class DatasetRDAMapper { - private static final Logger logger = LoggerFactory.getLogger(DatasetRDAMapper.class); - - private ApiContext apiContext; - private final QueryFactory queryFactory; - - @Autowired - public DatasetRDAMapper(ApiContext apiContext, QueryFactory queryFactory) { - this.apiContext = apiContext; - this.queryFactory = queryFactory; - } - - @Transactional - public Dataset toRDA(DescriptionEntity descriptionEntity, eu.eudat.models.rda.Dmp dmp) { - Dataset rda = new Dataset(); -// rda.setDatasetId(DatasetIdRDAMapper.toRDA(dataset.getId())); - if (descriptionEntity.getLabel() == null) { - throw new IllegalArgumentException("Dataset Label is missing"); - } - rda.setTitle(descriptionEntity.getLabel()); - rda.setDescription(descriptionEntity.getDescription()); - rda.setAdditionalProperty("template", this.queryFactory.query(DmpDescriptionTemplateQuery.class).ids(descriptionEntity.getDescriptionTemplateId())); //TODO - try { - JSONObject jObject = new JSONObject(descriptionEntity.getProperties()); - Map templateIdsToValues = jObject.toMap(); -// DatasetWizardModel datasetWizardModel = new DatasetWizardModel().fromDataModel(descriptionEntity); -// datasetWizardModel.setDatasetProfileDefinition(datasetManager.getPagedProfile(datasetWizardModel, descriptionEntity)); - ObjectMapper mapper = new ObjectMapper(); -// String datasetDescriptionJson = mapper.writeValueAsString(datasetWizardModel.getDatasetProfileDefinition()); - String datasetDescriptionJson = mapper.writeValueAsString(null); - JsonNode datasetDescriptionObj = mapper.readTree(datasetDescriptionJson); - List idNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.dataset_id"); - if (!idNodes.isEmpty()) { - rda.setDatasetId(DatasetIdRDAMapper.toRDA(idNodes)); - } - if (rda.getDatasetId() == null) { - rda.setDatasetId(new DatasetId(descriptionEntity.getId().toString(), DatasetId.Type.OTHER)); - } - List typeNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.type"); - if (!typeNodes.isEmpty() && !typeNodes.get(0).get("value").asText().isEmpty()) { - rda.setType(typeNodes.get(0).get("value").asText()); - } else { - rda.setType("DMP Dataset"); - } - List languageNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.language"); - if (!languageNodes.isEmpty() && !languageNodes.get(0).get("value").asText().isEmpty()) { - String lang = languageNodes.get(0).get("value").asText(); - try { - rda.setLanguage(Language.fromValue(lang)); - } - catch (IllegalArgumentException e){ - //TODO -// logger.warn("Language " + lang + " from semantic rda.dataset.language was not found. Setting '" + descriptionEntity.getProfile().getLanguage() +"' as language from the dataset profile."); -// rda.setLanguage(LanguageRDAMapper.mapLanguageIsoToRDAIso(descriptionEntity.getProfile().getLanguage())); - } - } else { - //TODO -// rda.setLanguage(LanguageRDAMapper.mapLanguageIsoToRDAIso(descriptionEntity.getProfile().getLanguage())); - } - List metadataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.metadata"); - if (!metadataNodes.isEmpty()) { - rda.setMetadata(MetadataRDAMapper.toRDAList(metadataNodes)); - }else{ - rda.setMetadata(new ArrayList<>()); - } - List qaNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.data_quality_assurance"); - if (!qaNodes.isEmpty()) { - /*rda.setDataQualityAssurance(qaNodes.stream().map(qaNode -> qaNode.get("value").asText()).collect(Collectors.toList())); - for (int i = 0; i < qaNodes.size(); i++) { - rda.setAdditionalProperty("qaId" + (i + 1), qaNodes.get(i).get("id").asText()); - }*/ - List qaList = new ArrayList<>(); - String qa; - for(JsonNode node: qaNodes){ - if(node.get("value").isArray()){ - Iterator iter = node.get("value").elements(); - while(iter.hasNext()) { - qa = iter.next().asText(); - qaList.add(qa); - } - } - } - String data_quality; - for(JsonNode dqa: qaNodes){ - data_quality = dqa.get("value").asText(); - if(!data_quality.isEmpty()){ - qaList.add(data_quality); - rda.setAdditionalProperty("otherDQAID", dqa.get("id")); - rda.setAdditionalProperty("otherDQA", data_quality); - break; - } - } - rda.setDataQualityAssurance(qaList); - }else{ - rda.setDataQualityAssurance(new ArrayList<>()); - } - List preservationNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.preservation_statement"); - if (!preservationNodes.isEmpty() && !preservationNodes.get(0).get("value").asText().isEmpty()) { - rda.setPreservationStatement(preservationNodes.get(0).get("value").asText()); - } - List distributionNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.distribution"); - if (!distributionNodes.isEmpty()) { - rda.setDistribution(DistributionRDAMapper.toRDAList(distributionNodes)); - }else{ - rda.setDistribution(new ArrayList<>()); - } - List keywordNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.keyword"); - if (!keywordNodes.isEmpty()) { - rda.setKeyword(keywordNodes.stream().map(keywordNode -> { - JsonNode value = keywordNode.get("value"); - if (value.isArray()) { - return StreamSupport.stream(value.spliterator(), false).map(node -> KeywordRDAMapper.toRDA(node.toString())).flatMap(Collection::stream).collect(Collectors.toList()); - } else { - return KeywordRDAMapper.toRDA(keywordNode.get("value").asText()); - } - }).flatMap(Collection::stream).collect(Collectors.toList())); - for (int i = 0; i < keywordNodes.size(); i++) { - rda.setAdditionalProperty("keyword" + (i + 1), keywordNodes.get(i).get("id").asText()); - } - } -// else if (apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().exists()) { //TODO -// List tags = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(descriptionEntity.getId().toString()).getTags().stream().map(Tag::getName).collect(Collectors.toList()); -// rda.setKeyword(tags); -// } - List personalDataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.personal_data"); - if (!personalDataNodes.isEmpty()) { - try{ - rda.setPersonalData(personalDataNodes.stream().map(personalDataNode -> Dataset.PersonalData.fromValue(personalDataNode.get("value").asText())).findFirst().get()); - }catch(IllegalArgumentException e){ - rda.setPersonalData(Dataset.PersonalData.UNKNOWN); - } - } else { - rda.setPersonalData(Dataset.PersonalData.UNKNOWN); - } - List securityAndPrivacyNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.security_and_privacy"); - if (!securityAndPrivacyNodes.isEmpty()) { - rda.setSecurityAndPrivacy(SecurityAndPrivacyRDAMapper.toRDAList(securityAndPrivacyNodes)); - }else{ - rda.setSecurityAndPrivacy(new ArrayList<>()); - } - List sensitiveDataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.sensitive_data"); - if (!sensitiveDataNodes.isEmpty()) { - try{ - rda.setSensitiveData(sensitiveDataNodes.stream().map(sensitiveDataNode -> Dataset.SensitiveData.fromValue(sensitiveDataNode.get("value").asText())).findFirst().get()); - }catch(IllegalArgumentException e){ - rda.setSensitiveData(Dataset.SensitiveData.UNKNOWN); - } - } else { - rda.setSensitiveData(Dataset.SensitiveData.UNKNOWN); - } - List technicalResourceNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.technical_resource"); - if (!technicalResourceNodes.isEmpty()) { - rda.setTechnicalResource(TechnicalResourceRDAMapper.toRDAList(technicalResourceNodes)); - }else{ - rda.setTechnicalResource(new ArrayList<>()); - } - List issuedNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.issued"); - if (!issuedNodes.isEmpty() && !issuedNodes.get(0).get("value").asText().isEmpty()) { - rda.setIssued(issuedNodes.get(0).get("value").asText()); - } - List contributorNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dmp.contributor"); - if (!contributorNodes.isEmpty()) { - dmp.getContributor().addAll(contributorNodes.stream().map(contributorNode -> { - JsonNode value = contributorNode.get("value"); - if (value.isArray()) { - return StreamSupport.stream(value.spliterator(), false).map(node -> ContributorRDAMapper.toRDA(node.asText())).collect(Collectors.toList()); - } else { - return Collections.singletonList(new Contributor()); - } - }).flatMap(Collection::stream).collect(Collectors.toList())); - dmp.setContributor(dmp.getContributor().stream().filter(contributor -> contributor.getContributorId() != null && contributor.getName() != null).collect(Collectors.toList())); - } - List costNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dmp.cost"); - if (!costNodes.isEmpty()) { - dmp.getCost().addAll(CostRDAMapper.toRDAList(costNodes)); - } - List ethicsNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dmp.ethical_issues"); - if (!ethicsNodes.isEmpty()) { - for(JsonNode node: ethicsNodes){ - String rdaProperty = ""; - JsonNode schematics = node.get("schematics"); - if(schematics.isArray()){ - int index = 0; - for(JsonNode schematic: schematics){ - if(schematic.asText().startsWith("rda.dmp.ethical_issues")){ - rdaProperty = schematic.asText(); - ((ArrayNode)schematics).remove(index); - break; - } - index++; - } - } - else{ - continue; - } - String rdaValue = node.get("value").asText(); - if(rdaValue == null || rdaValue.isEmpty()){ - continue; - } - if(rdaProperty.contains("exist")){ - try { - Dmp.EthicalIssuesExist exists = dmp.getEthicalIssuesExist(); - if(exists == null - || ((exists == Dmp.EthicalIssuesExist.NO || exists == Dmp.EthicalIssuesExist.UNKNOWN) && rdaValue.equals("yes")) - || (exists == Dmp.EthicalIssuesExist.YES && !(rdaValue.equals("no") || rdaValue.equals("unknown"))) - || (exists == Dmp.EthicalIssuesExist.UNKNOWN && rdaValue.equals("no"))){ - dmp.setEthicalIssuesExist(Dmp.EthicalIssuesExist.fromValue(rdaValue)); - } - }catch(IllegalArgumentException e){ - logger.warn(e.getLocalizedMessage() + ". Setting ethical_issues_exist to unknown"); - dmp.setEthicalIssuesExist(Dmp.EthicalIssuesExist.UNKNOWN); - } - } -// else if(rdaProperty.contains("description")){ -// if(dmp.getEthicalIssuesDescription() == null){ -// dmp.setEthicalIssuesDescription(rdaValue); -// } -// else{ -// dmp.setEthicalIssuesDescription(dmp.getEthicalIssuesDescription() + ", " + rdaValue); -// } -// } -// else if(rdaProperty.contains("report")){ -// try { -// dmp.setEthicalIssuesReport(URI.create(rdaValue)); -// } catch (IllegalArgumentException e) { -// logger.warn(e.getLocalizedMessage() + ". Skipping url parsing"); -// } -// } - } - } - List foundNodes = Stream.of(typeNodes, languageNodes, metadataNodes, qaNodes, preservationNodes, distributionNodes, - keywordNodes, personalDataNodes, securityAndPrivacyNodes, sensitiveDataNodes, technicalResourceNodes).flatMap(Collection::stream).collect(Collectors.toList()); - templateIdsToValues.entrySet().forEach(entry -> { - boolean isFound = foundNodes.stream().anyMatch(node -> node.get("id").asText().equals(entry.getKey())); - if (!isFound && entry.getValue() != null && !entry.getValue().toString().isEmpty()) { - try { - Instant time = Instant.parse(entry.getValue().toString()); - rda.setAdditionalProperty(entry.getKey(), DateTimeFormatter.ofPattern("yyyy-MM-dd").withZone(ZoneId.systemDefault()).format(time)); - } catch (DateTimeParseException e) { - rda.setAdditionalProperty(entry.getKey(), entry.getValue()); - } - } - }); - - - } catch (Exception e) { - logger.error(e.getMessage(), e); - } - - - return rda; - } - - - public DescriptionEntity toEntity(Dataset rda, DescriptionTemplateEntity defaultProfile) { - DescriptionEntity entity = new DescriptionEntity(); - entity.setLabel(rda.getTitle()); - entity.setDescription(rda.getDescription()); - try { - //DescriptionTemplateEntity profile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(rda.getAdditionalProperties().get("template").toString())); - //entity.setDescriptionTemplateId(profile.getId()); //TODO - }catch(Exception e) { - logger.warn(e.getMessage(), e); -// entity.setDescriptionTemplateId(defaultProfile.getId()); //TODO - } - try { - Map properties = new HashMap<>(); - //TODO - //DatasetWizardModel datasetWizardModel = new DatasetWizardModel(); - //datasetWizardModel.setProfile(new DatasetProfileOverviewModel().fromDataModel(entity.getProfile())); -// datasetWizardModel.setDatasetProfileDefinition(datasetManager.getPagedProfile(datasetWizardModel, entity)); - ObjectMapper mapper = new ObjectMapper(); -// String datasetDescriptionJson = mapper.writeValueAsString(datasetWizardModel.getDatasetProfileDefinition()); - String datasetDescriptionJson = mapper.writeValueAsString(null); - JsonNode datasetDescriptionObj = mapper.readTree(datasetDescriptionJson); - - List typeNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.type"); - if (!typeNodes.isEmpty()) { - properties.put(typeNodes.get(0).get("id").asText(), rda.getType()); - } - - List languageNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.language"); - if (!languageNodes.isEmpty() && rda.getLanguage() != null) { - properties.put(languageNodes.get(0).get("id").asText(), rda.getLanguage().value()); - } - - if (rda.getMetadata() != null) { - properties.putAll(MetadataRDAMapper.toProperties(rda.getMetadata())); - } - - if (rda.getDatasetId() != null) { - properties.putAll(DatasetIdRDAMapper.toProperties(rda.getDatasetId(), datasetDescriptionObj)); - } - - /*List qaIds = rda.getAdditionalProperties().entrySet().stream().filter(entry -> entry.getKey().startsWith("qaId")).map(entry -> entry.getValue().toString()).collect(Collectors.toList()); - for (int i = 0; i < qaIds.size(); i++) { - properties.put(qaIds.get(i), rda.getDataQualityAssurance().get(i)); - }*/ - List qaNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.data_quality_assurance"); - if (!qaNodes.isEmpty() && rda.getDataQualityAssurance() != null && !rda.getDataQualityAssurance().isEmpty()) { - ObjectMapper m = new ObjectMapper(); - List qas = new ArrayList<>(rda.getDataQualityAssurance()); - if(!qas.isEmpty()){ - properties.put(qaNodes.get(0).get("id").asText(), m.writeValueAsString(qas)); - if(rda.getAdditionalProperties().containsKey("otherDQAID")){ - properties.put((String)rda.getAdditionalProperties().get("otherDQAID"), rda.getAdditionalProperties().get("otherDQA")); - } - } - } - - List preservationNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.preservation_statement"); - if (!preservationNodes.isEmpty()) { - properties.put(preservationNodes.get(0).get("id").asText(), rda.getPreservationStatement()); - } - - List issuedNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.issued"); - if (!issuedNodes.isEmpty()) { - properties.put(issuedNodes.get(0).get("id").asText(), rda.getIssued()); - } - - if (rda.getDistribution() != null && !rda.getDistribution().isEmpty()) { - properties.putAll(DistributionRDAMapper.toProperties(rda.getDistribution().get(0), datasetDescriptionObj)); - } - - if (rda.getKeyword() != null) { - List keywordIds = rda.getAdditionalProperties().entrySet().stream().filter(entry -> entry.getKey().startsWith("keyword")).map(entry -> entry.getValue().toString()).collect(Collectors.toList()); -// boolean takeAll = false; -// if (keywordIds.size() < rda.getKeyword().size()) { -// takeAll = true; -// } - //TODO -// DatasetCriteria criteria = new DatasetCriteria(); -// criteria.setHasTags(true); -// List tags = this.apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().query(criteria).stream().map(eu.eudat.elastic.entities.Dataset::getTags).flatMap(Collection::stream).filter(StreamDistinctBy.distinctByKey(Tag::getId)).collect(Collectors.toList()); -// if(!rda.getKeyword().isEmpty()){ -// List templateTags = tags.stream().filter(tag -> rda.getKeyword().contains(tag.getName())).collect(Collectors.toList()); -// if(!templateTags.isEmpty()) { -// properties.put(keywordIds.get(0), mapper.writeValueAsString(templateTags)); -// } -//// for (int i = 0; i < keywordIds.size(); i++) { -//// //if (takeAll) { -//// List tags = new ArrayList<>(); -//// for (String keyword : rda.getKeyword()) { -//// tags.add(mapper.writeValueAsString(toTagEntity(keyword))); -//// } -//// properties.put(keywordIds.get(i), tags); -//// } else { -//// properties.put(keywordIds.get(i), mapper.writeValueAsString(toTagEntity(rda.getKeyword().get(i)))); -//// } -//// properties.put(keywordIds.get(i), rda.getKeyword().get(i)); -//// } -// } - } - - List personalDataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.personal_data"); - if (!personalDataNodes.isEmpty()) { - properties.put(personalDataNodes.get(0).get("id").asText(), rda.getPersonalData().value()); - } - - if (rda.getSecurityAndPrivacy() != null) { - properties.putAll(SecurityAndPrivacyRDAMapper.toProperties(rda.getSecurityAndPrivacy())); - } - - List sensitiveDataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "schematics", "rda.dataset.sensitive_data"); - if (!sensitiveDataNodes.isEmpty()) { - properties.put(sensitiveDataNodes.get(0).get("id").asText(), rda.getSensitiveData().value()); - } - - if (rda.getTechnicalResource() != null) { - properties.putAll(TechnicalResourceRDAMapper.toProperties(rda.getTechnicalResource())); - } - - rda.getAdditionalProperties().entrySet().stream() - .filter(entry -> !entry.getKey().equals("template") && !entry.getKey().startsWith("qaId") && !entry.getKey().startsWith("keyword")) - .forEach(entry -> properties.put(entry.getKey(), entry.getValue())); - entity.setProperties(new ObjectMapper().writeValueAsString(properties)); - } catch (Exception e) { - logger.error(e.getMessage(), e); - } - - - return entity; - } - - private static TagEntity toTagEntity(String name) { - TagEntity tag = new TagEntity(); - tag.setId(UUID.randomUUID()); - tag.setLabel(name); - return tag; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DistributionRDAMapper.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DistributionRDAMapper.java deleted file mode 100644 index 046d73d91..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DistributionRDAMapper.java +++ /dev/null @@ -1,457 +0,0 @@ -package eu.eudat.models.rda.mapper; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import eu.eudat.logic.utilities.helpers.MyStringUtils; -import eu.eudat.logic.utilities.json.JavaToJson; -import eu.eudat.logic.utilities.json.JsonSearcher; -import eu.eudat.models.rda.Distribution; -import eu.eudat.models.rda.License; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.net.URI; -import java.util.*; -import java.util.stream.Collectors; - -public class DistributionRDAMapper { - private static final Logger logger = LoggerFactory.getLogger(DistributionRDAMapper.class); - private static final ObjectMapper mapper = new ObjectMapper(); - - public static List toRDAList(List nodes) { - Map rdaMap = new HashMap<>(); - - for (JsonNode node: nodes) { - String rdaProperty = getRdaDistributionProperty(node); - if(rdaProperty.isEmpty()){ - continue; - } - String rdaValue = node.get("value").asText(); - //if(rdaValue == null || rdaValue.isEmpty()){ - if(rdaValue == null || (rdaValue.isEmpty() && !node.get("value").isArray())){ - continue; - } - String key = node.get("numbering").asText(); - if(!key.contains("mult")){ - key = "0"; - } - else{ - key = "" + key.charAt(4); - } - Distribution rda; - if(rdaMap.containsKey(key)){ - rda = rdaMap.get(key); - } - else { - rda = new Distribution(); - rdaMap.put(key, rda); - } - /* Distribution rda = getRelative(rdaMap, node.get("numbering").asText()); - if (!rdaMap.containsValue(rda)) { - rdaMap.put(node.get("numbering").asText(), rda); - } */ - for (ExportPropertyName exportPropertyName : ExportPropertyName.values()) { - if (rdaProperty.contains(exportPropertyName.getName())) { - switch (exportPropertyName) { - case ACCESS_URL: - rda.setAccessUrl(rdaValue); - rda.setAdditionalProperty(ImportPropertyName.ACCESS_URL.getName(), node.get("id").asText()); - break; - case AVAILABLE_UNTIL: - rda.setAvailableUntil(rdaValue); - rda.setAdditionalProperty(ImportPropertyName.AVAILABLE_UNTIL.getName(), node.get("id").asText()); - break; - case DOWNLOAD_URL: - rda.setDownloadUrl(URI.create(rdaValue)); - rda.setAdditionalProperty(ImportPropertyName.DOWNLOAD_URL.getName(), node.get("id").asText()); - break; - case DESCRIPTION: - if(!rdaProperty.contains("host")) { - rda.setDescription(rdaValue); - rda.setAdditionalProperty(ImportPropertyName.DESCRIPTION.getName(), node.get("id").asText()); - } - break; - case DATA_ACCESS: - try { - rda.setDataAccess(Distribution.DataAccess.fromValue(rdaValue)); - rda.setAdditionalProperty(ImportPropertyName.DATA_ACCESS.getName(), node.get("id").asText()); - } - catch (IllegalArgumentException e) { - logger.warn("Distribution data access " + rdaValue + " from semantic distribution.data_access is not valid. Data access will not be set set."); - } - break; - case BYTE_SIZE: - rda.setByteSize(Integer.parseInt(rdaValue)); - rda.setAdditionalProperty(ImportPropertyName.BYTE_SIZE.getName(), node.get("id").asText()); - break; - case LICENSE: - List licenseNodes = nodes.stream().filter(lnode -> { - if(lnode.get("schematics").isArray()){ - for(JsonNode schematic: lnode.get("schematics")){ - if(schematic.asText().startsWith("rda.dataset.distribution.license")){ - return true; - } - } - } - return false; - }).collect(Collectors.toList()); - License license = LicenseRDAMapper.toRDA(licenseNodes); - rda.setLicense(license != null? Collections.singletonList(license): new ArrayList<>()); - break; - case FORMAT: - if(node.get("value").isArray()){ - Iterator iter = node.get("value").elements(); - List formats = new ArrayList<>(); - int i = 1; - while(iter.hasNext()) { - JsonNode current = iter.next(); - String format = current.toString(); - try { - Map result = mapper.readValue(format, HashMap.class); - format = result.get("label"); - formats.add(format); - rda.setAdditionalProperty("format" + i++, mapper.readTree(current.toString())); - } - catch(JsonProcessingException e){ - logger.warn(e.getMessage()); - } - } - rda.setFormat(formats); - } - else{ - if(rda.getFormat() == null || rda.getFormat().isEmpty()){ - rda.setFormat(new ArrayList<>(Arrays.asList(rdaValue.replace(" ", "").split(",")))); - } - else{ - rda.getFormat().addAll(Arrays.asList(rdaValue.replace(" ", "").split(","))); - } - } - rda.setAdditionalProperty(ImportPropertyName.FORMAT.getName(), node.get("id").asText()); - break; - case TITLE: - if(!rdaProperty.contains("host")) { - rda.setTitle(rdaValue); - rda.setAdditionalProperty(ImportPropertyName.TITLE.getName(), node.get("id").asText()); - } - break; - case HOST: - rda.setHost(HostRDAMapper.toRDA(nodes, node.get("numbering").asText())); - break; - } - } - } - } - return rdaMap.values().stream() - .filter(distro -> distro.getTitle() != null).collect(Collectors.toList()); - } - - public static Map toProperties(List rdas) { - Map properties = new HashMap<>(); - - rdas.forEach(rda -> { - rda.getAdditionalProperties().entrySet().forEach(entry -> { - try { - ImportPropertyName importPropertyName = ImportPropertyName.fromString(entry.getKey()); - switch (importPropertyName) { - case ACCESS_URL: - properties.put(entry.getValue().toString(), rda.getAccessUrl()); - break; - case TITLE: - properties.put(entry.getValue().toString(), rda.getTitle()); - break; - case DESCRIPTION: - properties.put(entry.getValue().toString(), rda.getDescription()); - break; - case FORMAT: - properties.put(entry.getValue().toString(), rda.getFormat().get(0)); - break; - case BYTE_SIZE: - properties.put(entry.getValue().toString(), rda.getByteSize().toString()); - break; - case DATA_ACCESS: - properties.put(entry.getValue().toString(), rda.getDataAccess().value()); - break; - case DOWNLOAD_URL: - properties.put(entry.getValue().toString(), rda.getDownloadUrl().toString()); - break; - case AVAILABLE_UNTIL: - properties.put(entry.getValue().toString(), rda.getAvailableUntil()); - break; - } - } catch (Exception e) { - logger.error(e.getMessage(), e); - } - - }); - if (rda.getHost() != null) { - properties.putAll(HostRDAMapper.toProperties(rda.getHost())); - } - if (rda.getLicense() != null && !rda.getLicense().isEmpty()) { - properties.putAll(LicenseRDAMapper.toProperties(rda.getLicense())); - } - }); - - return properties; - } - - public static Map toProperties(Distribution rda, JsonNode root) { - Map properties = new HashMap<>(); - - List distributionNodes = JsonSearcher.findNodes(root, "schematics", "rda.dataset.distribution"); - - for (JsonNode distributionNode: distributionNodes) { - for (ExportPropertyName exportPropertyName: ExportPropertyName.values()) { - JsonNode schematics = distributionNode.get("schematics"); - if(schematics.isArray()){ - for(JsonNode schematic: schematics){ - if(schematic.asText().contains(exportPropertyName.getName())){ - switch (exportPropertyName) { - case ACCESS_URL: - properties.put(distributionNode.get("id").asText(), rda.getAccessUrl()); - break; - case DESCRIPTION: - properties.put(distributionNode.get("id").asText(), rda.getDescription()); - break; - case TITLE: - properties.put(distributionNode.get("id").asText(), rda.getTitle()); - break; - case AVAILABLE_UNTIL: - properties.put(distributionNode.get("id").asText(), rda.getAvailableUntil()); - break; - case DOWNLOAD_URL: - if (rda.getDownloadUrl() != null) { - properties.put(distributionNode.get("id").asText(), rda.getDownloadUrl().toString()); - } - break; - case DATA_ACCESS: - properties.put(distributionNode.get("id").asText(), rda.getDataAccess().value()); - break; - case BYTE_SIZE: - if (rda.getByteSize() != null) { - properties.put(distributionNode.get("id").asText(), rda.getByteSize().toString()); - } - break; - case FORMAT: - if (rda.getFormat() != null && !rda.getFormat().isEmpty()) { - String style = distributionNode.get("viewStyle").get("renderStyle").asText(); - if(style.equals("combobox")) { - if (distributionNode.get("data").get("type").asText().equals("autocomplete")) { - Map additionalProperties = rda.getAdditionalProperties(); - List standardFormats = new ArrayList<>(); - rda.getAdditionalProperties().forEach((key, value) -> { - try { - if (key.matches("format\\d+")) { - standardFormats.add(additionalProperties.get(key)); - properties.put(distributionNode.get("id").asText(), mapper.writeValueAsString(standardFormats)); - } - } catch (JsonProcessingException e) { - logger.error(e.getMessage(), e); - } - }); - } - } - else if(style.equals("freetext")){ - properties.put(distributionNode.get("id").asText(), String.join(", ", rda.getFormat())); - } - } - break; - case LICENSE: - if (rda.getLicense() != null && !rda.getLicense().isEmpty()) { - properties.putAll(LicenseRDAMapper.toProperties(rda.getLicense().get(0), root)); - } - break; - case HOST: - if (rda.getHost() != null) { - properties.putAll(HostRDAMapper.toProperties(rda.getHost())); - } - break; - } - break; - } - } - } - } - } - - return properties; - } - - public static Distribution toRDA(List nodes) { - Distribution rda = new Distribution(); - for (JsonNode node: nodes) { - String rdaProperty = getRdaDistributionProperty(node); - if(rdaProperty.isEmpty()){ - continue; - } - String rdaValue = node.get("value").asText(); - for (ExportPropertyName exportPropertyName: ExportPropertyName.values()) { - if (rdaProperty.contains(exportPropertyName.getName())) { - switch (exportPropertyName) { - case ACCESS_URL: - rda.setAccessUrl(rdaValue); - break; - case DESCRIPTION: - rda.setDescription(rdaValue); - break; - case TITLE: - rda.setTitle(rdaValue); - break; - case AVAILABLE_UNTIL: - rda.setAvailableUntil(rdaValue); - break; - case DOWNLOAD_URL: - rda.setDownloadUrl(URI.create(rdaValue)); - break; - case DATA_ACCESS: - rda.setDataAccess(Distribution.DataAccess.fromValue(rdaValue)); - break; - case BYTE_SIZE: - rda.setByteSize(Integer.parseInt(rdaValue)); - break; - case FORMAT: - rda.setFormat(Collections.singletonList(rdaValue)); - break; - case LICENSE: - List licenseNodes = nodes.stream().filter(lnode -> { - if(lnode.get("schematics").isArray()){ - for(JsonNode schematic: lnode.get("schematics")){ - if(schematic.asText().startsWith("rda.dataset.distribution.license")){ - return true; - } - } - } - return false; - }).collect(Collectors.toList()); - rda.setLicense(Collections.singletonList(LicenseRDAMapper.toRDA(licenseNodes))); - break; - case HOST: - List hostNodes = nodes.stream().filter(lnode -> { - if(lnode.get("schematics").isArray()){ - for(JsonNode schematic: lnode.get("schematics")){ - if(schematic.asText().startsWith("rda.dataset.distribution.host")){ - return true; - } - } - } - return false; - }).collect(Collectors.toList()); - rda.setHost(HostRDAMapper.toRDA(hostNodes, "0")); - break; - } - } - } - /*if (rdaProperty.contains("access_url")) { - rda.setAccessUrl(rdaValue); - } else if (rdaProperty.contains("available_util")) { - rda.setAvailableUntil(rdaValue); - } else if (rdaProperty.contains("byte_size")) { - rda.setByteSize(Integer.parseInt(rdaValue)); - } else if (rdaProperty.contains("data_access")) { - rda.setDataAccess(Distribution.DataAccess.fromValue(rdaValue)); - } else if (rdaProperty.contains("description")) { - rda.setDescription(rdaValue); - } else if (rdaProperty.contains("download_url")) { - rda.setDownloadUrl(URI.create(rdaValue)); - } else if (rdaProperty.contains("format")) { - rda.setFormat(Collections.singletonList(rdaValue)); - } else if (rdaProperty.contains("host")) { -// rda.setHost(HostRDAMapper.toRDA(node)); - } else if (rdaProperty.contains("license")) { - rda.setLicense(Collections.singletonList(LicenseRDAMapper.toRDA(node))); - } else if (rdaProperty.contains("title")) { - rda.setTitle(rdaValue); - }*/ - - } - - if (rda.getTitle() == null) { - throw new IllegalArgumentException("Distribution title is missing"); - } - - if (rda.getDataAccess() == null) { - throw new IllegalArgumentException("Distribution Data Access is missing"); - } - - return rda; - } - - private static String getRdaDistributionProperty(JsonNode node) { - String rdaProperty = ""; - JsonNode schematics = node.get("schematics"); - if(schematics.isArray()){ - int index = 0; - for(JsonNode schematic: schematics){ - if(schematic.asText().startsWith("rda.dataset.distribution")){ - rdaProperty = schematic.asText(); - ((ArrayNode)schematics).remove(index); - break; - } - index++; - } - } - return rdaProperty; - } - - private static Distribution getRelative( Map rdaMap, String numbering) { - return rdaMap.entrySet().stream().filter(entry -> MyStringUtils.getFirstDifference(entry.getKey(), numbering) > 0) - .max(Comparator.comparingInt(entry -> MyStringUtils.getFirstDifference(entry.getKey(), numbering))).map(Map.Entry::getValue).orElse(new Distribution()); - } - - private enum ExportPropertyName { - ACCESS_URL("access_url"), - AVAILABLE_UNTIL("available_until"), - BYTE_SIZE("byte_size"), - DATA_ACCESS("data_access"), - DESCRIPTION("description"), - DOWNLOAD_URL("download_url"), - FORMAT("format"), - HOST("host"), - LICENSE("license"), - TITLE("title"); - - private final String name; - - ExportPropertyName(String name) { - this.name = name; - } - - public String getName() { - return name; - } - } - - private enum ImportPropertyName { - ACCESS_URL("accessurlId"), - AVAILABLE_UNTIL("availableUtilId"), - BYTE_SIZE("byteSizeId"), - DATA_ACCESS("dataAccessId"), - DESCRIPTION("descriptionId"), - DOWNLOAD_URL("downloadUrlId"), - FORMAT("formatId"), - /*HOST("host"), - LICENSE("license"),*/ - TITLE("titleId"); - - private final String name; - - ImportPropertyName(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public static ImportPropertyName fromString(String name) throws Exception { - for (ImportPropertyName importPropertyName: ImportPropertyName.values()) { - if (importPropertyName.getName().equals(name)) { - return importPropertyName; - } - } - throw new Exception("No name available"); - } - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DmpIdRDAMapper.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DmpIdRDAMapper.java deleted file mode 100644 index 095c26e11..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DmpIdRDAMapper.java +++ /dev/null @@ -1,19 +0,0 @@ -package eu.eudat.models.rda.mapper; - -import eu.eudat.models.rda.DmpId; - -import java.util.UUID; - -public class DmpIdRDAMapper { - - public static DmpId toRDA(Object id) { - DmpId rda = new DmpId(); - rda.setIdentifier(id.toString()); - if (id instanceof UUID) { - rda.setType(DmpId.Type.OTHER); - } else { - rda.setType(DmpId.Type.DOI); - } - return rda; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DmpRDAMapper.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DmpRDAMapper.java deleted file mode 100644 index 5198d453f..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DmpRDAMapper.java +++ /dev/null @@ -1,190 +0,0 @@ -package eu.eudat.models.rda.mapper; - -import eu.eudat.data.DmpDescriptionTemplateEntity; -import eu.eudat.data.DmpEntity; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.models.rda.Dmp; -import eu.eudat.query.DmpDescriptionTemplateQuery; -import gr.cite.tools.data.query.QueryFactory; -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.util.*; - -@Component -public class DmpRDAMapper { - - private static final Logger logger = LoggerFactory.getLogger(DmpRDAMapper.class); - - private DatasetRDAMapper datasetRDAMapper; - private ApiContext apiContext; - private final QueryFactory queryFactory; - - - @Autowired - public DmpRDAMapper(DatasetRDAMapper datasetRDAMapper, ApiContext apiContext, QueryFactory queryFactory) throws IOException { - this.datasetRDAMapper = datasetRDAMapper; - this.apiContext = apiContext; - - this.queryFactory = queryFactory; - } - - @Transactional - public Dmp toRDA(DmpEntity dmp) throws InvalidApplicationException { -// if (dmp.getDataset() == null || dmp.getDataset().isEmpty()) { //TODO -// throw new IllegalArgumentException("DMP has no Datasets"); -// } -// Map extraProperties; -// if (dmp.getExtraProperties() == null) { -// throw new IllegalArgumentException("DMP is missing language and contact properties"); -// } else { -// extraProperties = new org.json.JSONObject(dmp.getExtraProperties()).toMap(); -// /*if (extraProperties.get("language") == null) { -// throw new IllegalArgumentException("DMP must have it's language property defined"); -// }*/ -// if (extraProperties.get("contact") == null) { -// throw new IllegalArgumentException("DMP must have it's contact property defined"); -// } -// } - Dmp rda = new Dmp(); -// if (dmp.getDois() != null && !dmp.getDois().isEmpty()) { -// for(EntityDoiEntity doi: dmp.getDois()){ -// if(doi.getRepositoryId().equals("Zenodo")){ -// rda.setDmpId(DmpIdRDAMapper.toRDA(doi.getDoi())); -// } -// } -// } else { -// rda.setDmpId(DmpIdRDAMapper.toRDA(dmp.getId())); -// } - if (dmp.getCreatedAt() == null) { - throw new IllegalArgumentException("DMP Created is missing"); - } - if (dmp.getUpdatedAt() == null) { - throw new IllegalArgumentException("DMP Modified is missing"); - } - if (dmp.getLabel() == null) { - throw new IllegalArgumentException("DMP Label is missing"); - } -// rda.setCreated(dmp.getCreated()); //TODO -// rda.setDescription(dmp.getDescription()); -// rda.setModified(dmp.getModified()); -// rda.setTitle(dmp.getLabel()); -// -// if (!extraProperties.isEmpty()) { -// if (extraProperties.get("ethicalIssues") != null) { -// rda.setEthicalIssuesExist(Dmp.EthicalIssuesExist.fromValue(extraProperties.get("ethicalIssues").toString())); -// } else { -// rda.setEthicalIssuesExist(Dmp.EthicalIssuesExist.UNKNOWN); -// } -// rda.setLanguage(LanguageRDAMapper.mapLanguageIsoToRDAIso(extraProperties.get("language") != null ? extraProperties.get("language").toString() : "en")); -// if (extraProperties.get("costs") != null) { -// rda.setCost(new ArrayList<>()); -// ((List) extraProperties.get("costs")).forEach(costl -> { -// rda.getCost().add(CostRDAMapper.toRDA((Map)costl)); -// }); -// } -// try { -// UserInfo contactDb = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().find(UUID.fromString((String) extraProperties.get("contact"))); -// UserInfo contact = new UserInfo(); -// contact.setId(contactDb.getId()); -// contact.setName(contactDb.getName()); -// contact.setEmail(contactDb.getEmail()); -// if (contact.getEmail() == null) { -// for (UserDMP userDMP : dmp.getUsers()) { -// if (userDMP.getDmp().getId() == dmp.getId() && userDMP.getUser().getEmail() != null) { -// contact.setEmail(userDMP.getUser().getEmail()); -// break; -// } -// } -// } -// rda.setContact(ContactRDAMapper.toRDA(contact)); -// } catch (NoResultException e) { -// logger.error(e.getMessage(), e); -// } -// } -// -// /*UserInfo creator; -// if (dmp.getCreator() != null) { -// creator = dmp.getCreator(); -// } else { -// creator = dmp.getUsers().stream().filter(userDMP -> userDMP.getRole().equals(UserDMP.UserDMPRoles.OWNER.getValue())).map(UserDMP::getUser).findFirst().orElse(new UserInfo()); -// } -// rda.setContact(ContactRDAMapper.toRDA(creator));*/ -// rda.setContributor(new ArrayList<>()); -// if (dmp.getResearchers() != null && !dmp.getResearchers().isEmpty()) { -// rda.getContributor().addAll(dmp.getResearchers().stream().map(ContributorRDAMapper::toRDA).collect(Collectors.toList())); -// } -//// rda.getContributor().addAll(dmp.getUsers().stream().map(ContributorRDAMapper::toRDA).collect(Collectors.toList())); -// rda.setDataset(dmp.getDataset().stream().filter(dataset -> dataset.getIsActive() != IsActive.Inactive).map(dataset -> datasetRDAMapper.toRDA(dataset, rda)).collect(Collectors.toList())); -// if (dmp.getProject() != null) { -// rda.setProject(Collections.singletonList(ProjectRDAMapper.toRDA(dmp.getProject(), dmp.getGrant()))); -// } -// rda.setAdditionalProperty("templates", dmp.getAssociatedDmps().stream().map(datasetProfile -> datasetProfile.getId().toString()).toArray()); - return rda; - } - - public DmpEntity toEntity(Dmp rda, String[] profiles) throws InvalidApplicationException { - DmpEntity entity = new DmpEntity(); - entity.setLabel(rda.getTitle()); -// if (rda.getDmpId().getType() == DmpId.Type.DOI) { //TODO -// try { -// //TODO: Find from doi = rda.getDmpId().getIdentifier() -// EntityDoiEntity doi = new EntityDoiEntity(); -// Set dois = new HashSet<>(); -// dois.add(doi); -// entity.setDois(dois); -// } -// catch (NoResultException e) { -// logger.warn("No entity doi: " + rda.getDmpId().getIdentifier() + " found in database. No dois are added to dmp."); -// entity.setDois(new HashSet<>()); -// } -// } -// if (((List) rda.getAdditionalProperties().get("templates")) != null && !((List) rda.getAdditionalProperties().get("templates")).isEmpty() && entity.getId() != null) { -// entity.setAssociatedDmps(((List) rda.getAdditionalProperties().get("templates")).stream().map(x -> { -// try { -// return this.getProfile(x, entity.getId()); -// } catch (InvalidApplicationException e) { -// throw new RuntimeException(e); -// } -// }).filter(Objects::nonNull).collect(Collectors.toSet())); -// } -// if (entity.getAssociatedDmps() == null) { -// entity.setAssociatedDmps(new HashSet<>()); -// } -// if (profiles != null && entity.getId() != null) { -// for (String profile : profiles) { -// entity.getAssociatedDmps().add(this.getProfile(profile, entity.getId())); -// } -// } -// if (rda.getContributor() != null && !rda.getContributor().isEmpty() && rda.getContributor().get(0).getContributorId() != null) { -// entity.setResearchers(rda.getContributor().stream().filter(r -> r.getContributorId() != null).map(ContributorRDAMapper::toEntity).filter(StreamDistinctBy.distinctByKey(Researcher::getReference)).collect(Collectors.toSet())); -// } -// entity.setCreated(rda.getCreated()); -// entity.setModified(rda.getModified()); -// entity.setDescription(rda.getDescription()); -// DescriptionTemplateEntity defaultProfile = ((DescriptionTemplateEntity)entity.getAssociatedDmps().toArray()[0]); -// entity.setDataset(rda.getDataset().stream().map(rda1 -> datasetRDAMapper.toEntity(rda1, defaultProfile)).collect(Collectors.toSet())); -// if (rda.getProject().size() > 0) { -// Map result = ProjectRDAMapper.toEntity(rda.getProject().get(0), apiContext); -// entity.setProject((Project) result.get("project")); -// result.entrySet().stream().filter(entry -> entry.getKey().startsWith("grant")).forEach(entry -> entity.setGrant((Grant) entry.getValue())); -// } -// -// Map extraProperties = new HashMap<>(); -// extraProperties.put("language", LanguageRDAMapper.mapRDAIsoToLanguageIso(rda.getLanguage())); -// -// entity.setExtraProperties(JSONObject.toJSONString(extraProperties)); - - return entity; - } - -// private DmpDescriptionTemplateEntity getProfile(String descriptionTemplateId, UUID dmpId) throws InvalidApplicationException { -// return this.queryFactory.query(DmpDescriptionTemplateQuery.class).dmpIds(dmpId).descriptionTemplateIds(UUID.fromString(descriptionTemplateId)).first(); -// } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/FunderIdRDAMapper.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/FunderIdRDAMapper.java deleted file mode 100644 index f0dc5ff4a..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/FunderIdRDAMapper.java +++ /dev/null @@ -1,19 +0,0 @@ -package eu.eudat.models.rda.mapper; - -import eu.eudat.models.rda.FunderId; - -import java.util.UUID; - -public class FunderIdRDAMapper { - - public static FunderId toRDA(Object id) { - FunderId rda = new FunderId(); - rda.setIdentifier(id.toString()); - if (id instanceof UUID) { - rda.setType(FunderId.Type.OTHER); - } else { - rda.setType(FunderId.Type.FUNDREF); - } - return rda; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/GrantIdRDAMapper.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/GrantIdRDAMapper.java deleted file mode 100644 index d05ec5d02..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/GrantIdRDAMapper.java +++ /dev/null @@ -1,13 +0,0 @@ -package eu.eudat.models.rda.mapper; - -import eu.eudat.models.rda.GrantId; - -public class GrantIdRDAMapper { - - public static GrantId toRDA(String id) { - GrantId rda = new GrantId(); - rda.setIdentifier(id); - rda.setType(GrantId.Type.OTHER); - return rda; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/HostRDAMapper.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/HostRDAMapper.java deleted file mode 100644 index 74e5c2e64..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/HostRDAMapper.java +++ /dev/null @@ -1,264 +0,0 @@ -package eu.eudat.models.rda.mapper; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import eu.eudat.logic.utilities.helpers.MyStringUtils; -import eu.eudat.models.rda.Host; -import eu.eudat.models.rda.PidSystem; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.net.URI; -import java.util.*; -import java.util.stream.Collectors; - -public class HostRDAMapper { - private static final Logger logger = LoggerFactory.getLogger(HostRDAMapper.class); - - public static Host toRDA(List nodes, String numbering) { - Host rda = new Host(); - for (JsonNode node: nodes) { - String rdaProperty = ""; - JsonNode schematics = node.get("schematics"); - if(schematics.isArray()){ - int index = 0; - for(JsonNode schematic: schematics){ - if(schematic.asText().startsWith("rda.dataset.distribution.host")){ - rdaProperty = schematic.asText(); - ((ArrayNode)schematics).remove(index); - break; - } - index++; - } - } - else{ - continue; - } - if (rdaProperty.contains("host")) { - int firstDiff = MyStringUtils.getFirstDifference(numbering, node.get("numbering").asText()); - if (firstDiff == -1 || firstDiff >= 2) { - String rdaValue = node.get("value").asText(); - if(rdaValue == null || (rdaValue.isEmpty() && !node.get("value").isArray())){ - continue; - } - for (ExportPropertyName propertyName: ExportPropertyName.values()) { - if (rdaProperty.contains(propertyName.getName())) { - switch (propertyName) { - case AVAILABILITY: - rda.setAvailability(rdaValue); - rda.setAdditionalProperty(ImportPropertyName.AVAILABILITY.getName(), node.get("id").asText()); - break; - case BACKUP_FREQUENCY: - rda.setBackupFrequency(rdaValue); - rda.setAdditionalProperty(ImportPropertyName.BACKUP_FREQUENCY.getName(), node.get("id").asText()); - break; - case BACKUP_TYPE: - rda.setBackupType(rdaValue); - rda.setAdditionalProperty(ImportPropertyName.BACKUP_TYPE.getName(), node.get("id").asText()); - break; - case CERTIFIED_WITH: - try { - rda.setCertifiedWith(Host.CertifiedWith.fromValue(rdaValue)); - rda.setAdditionalProperty(ImportPropertyName.CERTIFIED_WITH.getName(), node.get("id").asText()); - } - catch (IllegalArgumentException e) { - logger.warn("Distribution host certified with " + rdaValue + "from semantic distribution.host.certified_with is not valid. Certified_with will not be set set."); - } - break; - case DESCRIPTION: - rda.setDescription(rdaValue); - rda.setAdditionalProperty(ImportPropertyName.DESCRIPTION.getName(), node.get("id").asText()); - break; - case GEO_LOCATION: - if (rdaValue.startsWith("{")) { - try { - rdaValue = new ObjectMapper().readValue(rdaValue, Map.class).get("id").toString(); - } catch (JsonProcessingException e) { - logger.warn(e.getLocalizedMessage() + ". Try to pass value as is"); - } - } - try { - rda.setGeoLocation(Host.GeoLocation.fromValue(rdaValue)); - rda.setAdditionalProperty(ImportPropertyName.GEO_LOCATION.getName(), node.get("id").asText()); - } - catch (IllegalArgumentException e) { - logger.warn("Distribution host geo location " + rdaValue + "from semantic distribution.host.geo_location is not valid. Geo location will not be set set."); - } - break; - case PID_SYSTEM: - try{ - Iterator iter = node.get("value").elements(); - List pList = new ArrayList<>(); - while(iter.hasNext()) { - pList.add(iter.next().asText()); - } - List pidList; - if(pList.size() == 0){ - pidList = Arrays.stream(rdaValue.replaceAll("[\\[\"\\]]","").split(",")) - .map(PidSystem::fromValue).collect(Collectors.toList()); - } - else{ - pidList = pList.stream().map(PidSystem::fromValue).collect(Collectors.toList()); - } - rda.setPidSystem(pidList); - rda.setAdditionalProperty(ImportPropertyName.PID_SYSTEM.getName(), node.get("id").asText()); - } - catch (IllegalArgumentException e){ - rda.setPidSystem(new ArrayList<>()); - break; - } - break; - case STORAGE_TYPE: - rda.setStorageType(rdaValue); - rda.setAdditionalProperty(ImportPropertyName.STORAGE_TYPE.getName(), node.get("id").asText()); - break; - case SUPPORT_VERSIONING: - try { - rda.setSupportVersioning(Host.SupportVersioning.fromValue(rdaValue)); - rda.setAdditionalProperty(ImportPropertyName.SUPPORT_VERSIONING.getName(), node.get("id").asText()); - } - catch (IllegalArgumentException e) { - logger.warn("Distribution host support versioning " + rdaValue + "from semantic distribution.host.support_versioning is not valid. Support versioning will not be set set."); - } - break; - case TITLE: - rda.setTitle(rdaValue); - rda.setAdditionalProperty(ImportPropertyName.TITLE.getName(), node.get("id").asText()); - break; - case URL: - try { - rda.setUrl(URI.create(rdaValue)); - rda.setAdditionalProperty(ImportPropertyName.URL.getName(), node.get("id").asText()); - } catch (IllegalArgumentException e) { - logger.warn(e.getLocalizedMessage() + ". Skipping url parsing"); - } - break; - } - } - } - } - } - } - - if(rda.getTitle() == null || rda.getUrl() == null){ - return null; - } - - return rda; - } - - public static Map toProperties(Host rda) { - Map properties = new HashMap<>(); - rda.getAdditionalProperties().entrySet().forEach(entry -> { - try { - ImportPropertyName importPropertyName = ImportPropertyName.fromString(entry.getKey()); - switch (importPropertyName) { - case AVAILABILITY: - properties.put(entry.getValue().toString(), rda.getAvailability()); - break; - case TITLE: - properties.put(entry.getValue().toString(), rda.getTitle()); - break; - case DESCRIPTION: - properties.put(entry.getValue().toString(), rda.getDescription()); - break; - case BACKUP_FREQUENCY: - properties.put(entry.getValue().toString(), rda.getBackupFrequency()); - break; - case BACKUP_TYPE: - properties.put(entry.getValue().toString(), rda.getBackupType()); - break; - case CERTIFIED_WITH: - properties.put(entry.getValue().toString(), rda.getCertifiedWith().value()); - break; - case GEO_LOCATION: - properties.put(entry.getValue().toString(), rda.getGeoLocation().value()); - break; - case PID_SYSTEM: - List pids = new ArrayList<>(); - ObjectMapper mapper = new ObjectMapper(); - for(PidSystem pid: rda.getPidSystem()){ - pids.add(pid.value()); - } - if(!pids.isEmpty()){ - properties.put(entry.getValue().toString(), mapper.writeValueAsString(pids)); - } - break; - case STORAGE_TYPE: - properties.put(entry.getValue().toString(), rda.getStorageType()); - break; - case SUPPORT_VERSIONING: - properties.put(entry.getValue().toString(), rda.getSupportVersioning().value()); - break; - case URL: - properties.put(entry.getValue().toString(), rda.getUrl().toString()); - break; - } - } catch (Exception e) { - logger.error(e.getMessage(), e); - } - - }); - - return properties; - } - - private enum ExportPropertyName { - AVAILABILITY("availability"), - BACKUP_FREQUENCY("backup_frequency"), - BACKUP_TYPE("backup_type"), - CERTIFIED_WITH("certified_with"), - DESCRIPTION("description"), - GEO_LOCATION("geo_location"), - PID_SYSTEM("pid_system"), - STORAGE_TYPE("storage_type"), - SUPPORT_VERSIONING("support_versioning"), - TITLE("title"), - URL("url"); - - private final String name; - - ExportPropertyName(String name) { - this.name = name; - } - - public String getName() { - return name; - } - } - - private enum ImportPropertyName { - AVAILABILITY("availabilityId"), - BACKUP_FREQUENCY("backup_frequencyId"), - BACKUP_TYPE("backup_typeId"), - CERTIFIED_WITH("certified_withId"), - DESCRIPTION("descriptionId"), - GEO_LOCATION("geo_locationId"), - PID_SYSTEM("pid_systemId"), - STORAGE_TYPE("storage_typeId"), - SUPPORT_VERSIONING("support_versioningId"), - TITLE("titleId"), - URL("urlId"); - - private final String name; - - ImportPropertyName(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public static ImportPropertyName fromString(String name) throws Exception { - for (ImportPropertyName importPropertyName: ImportPropertyName.values()) { - if (importPropertyName.getName().equals(name)) { - return importPropertyName; - } - } - throw new Exception("No name available"); - } - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/KeywordRDAMapper.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/KeywordRDAMapper.java deleted file mode 100644 index 9d5409b0b..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/KeywordRDAMapper.java +++ /dev/null @@ -1,28 +0,0 @@ -package eu.eudat.models.rda.mapper; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import eu.eudat.data.TagEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.*; -import java.util.stream.Collectors; -public class KeywordRDAMapper { - private static final Logger logger = LoggerFactory.getLogger(KeywordRDAMapper.class); - private static final ObjectMapper mapper = new ObjectMapper(); - - public static List toRDA(String value) { - if (!value.isEmpty() && !value.equals("null")) { - try { - TagEntity tag = mapper.readValue(value, TagEntity.class); - return new ArrayList<>(Collections.singletonList(tag.getLabel())); - } catch (JsonProcessingException e) { - logger.warn(e.getMessage() + ". Attempting to parse it as a String since its a new tag."); - return new ArrayList<>(Collections.singletonList(value)); - } - } - - return new ArrayList<>(); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/LanguageRDAMapper.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/LanguageRDAMapper.java deleted file mode 100644 index dd2343a2d..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/LanguageRDAMapper.java +++ /dev/null @@ -1,45 +0,0 @@ -package eu.eudat.models.rda.mapper; - -import com.fasterxml.jackson.databind.ObjectMapper; -import eu.eudat.models.rda.Language; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.io.InputStreamReader; -import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; - -public class LanguageRDAMapper { - private final static Map langMap = new HashMap<>(); - private static final Logger logger = LoggerFactory.getLogger(LanguageRDAMapper.class); - - static { - try { - ObjectMapper mapper = new ObjectMapper(); - InputStreamReader isr = new InputStreamReader(LanguageRDAMapper.class.getClassLoader().getResource("internal/rda-lang-map.json").openStream(), StandardCharsets.UTF_8); - langMap.putAll(mapper.readValue(isr, LinkedHashMap.class)); - isr.close(); - - } catch (IOException e) { - logger.error(e.getMessage(), e); - } - } - - public static Language mapLanguageIsoToRDAIso(String code) { - return langMap.entrySet().stream().map(entry -> { - if (entry.getValue().toString().equals(code)) { - return Language.fromValue(entry.getKey()); - } else { - return null; - } - }).filter(Objects::nonNull).findFirst().get(); - } - - public static String mapRDAIsoToLanguageIso(Language lang) { - return langMap.get(lang.value()).toString(); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/LicenseRDAMapper.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/LicenseRDAMapper.java deleted file mode 100644 index d7e178c14..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/LicenseRDAMapper.java +++ /dev/null @@ -1,139 +0,0 @@ -package eu.eudat.models.rda.mapper; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ArrayNode; -import eu.eudat.logic.utilities.json.JsonSearcher; -import eu.eudat.models.rda.License; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.net.URI; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class LicenseRDAMapper { - private static final Logger logger = LoggerFactory.getLogger(LicenseRDAMapper.class); - - public static License toRDA(List nodes) { - License rda = new License(); - for (JsonNode node: nodes) { - String rdaProperty = ""; - JsonNode schematics = node.get("schematics"); - if(schematics.isArray()){ - int index = 0; - for(JsonNode schematic: schematics){ - if(schematic.asText().startsWith("rda.dataset.distribution.license")){ - rdaProperty = schematic.asText(); - ((ArrayNode)schematics).remove(index); - break; - } - index++; - } - } - else{ - continue; - } - String value = node.get("value").asText(); - if(value == null || value.isEmpty()){ - continue; - } - for (LicenceProperties licenceProperties: LicenceProperties.values()) { - if (rdaProperty.contains(licenceProperties.getName())) { - switch (licenceProperties) { - case LICENSE_REF: - try { - rda.setLicenseRef(URI.create(value)); - } catch (IllegalArgumentException e) { - logger.warn(e.getLocalizedMessage() + ". Skipping url parsing"); - } - break; - case START_DATE: - rda.setStartDate(value); - break; - } - } - } - - /*if (rdaProperty.contains("license_ref")) { - rda.setLicenseRef(URI.create(value)); - rda.setAdditionalProperty("license_refId", node.get("id").asText()); - } else if (rdaProperty.contains("start_date")) { - rda.setStartDate(value); - rda.setAdditionalProperty("start_dateId", node.get("id").asText()); - }*/ - } - - if(rda.getLicenseRef() == null || rda.getStartDate() == null){ - return null; - } - - return rda; - } - - public static Map toProperties(List rdas) { - Map properties = new HashMap<>(); - - rdas.forEach(rda -> { - rda.getAdditionalProperties().entrySet().forEach(entry -> { - switch (entry.getKey()) { - case "license_refId": - properties.put(entry.getValue().toString(), rda.getLicenseRef().toString()); - break; - case "start_dateId": - properties.put(entry.getValue().toString(), rda.getStartDate()); - break; - } - - }); - }); - - return properties; - } - - public static Map toProperties(License rda, JsonNode root) { - Map properties = new HashMap<>(); - - List licenseNodes = JsonSearcher.findNodes(root, "schematics", "rda.dataset.distribution.license"); - - for (JsonNode licenseNode: licenseNodes) { - for (LicenceProperties licenceProperty: LicenceProperties.values()) { - JsonNode schematics = licenseNode.get("schematics"); - if(schematics.isArray()) { - for (JsonNode schematic : schematics) { - if (schematic.asText().endsWith(licenceProperty.getName())) { - switch (licenceProperty) { - case LICENSE_REF: - if (rda.getLicenseRef() != null) { - properties.put(licenseNode.get("id").asText(), rda.getLicenseRef().toString()); - } - break; - case START_DATE: - properties.put(licenseNode.get("id").asText(), rda.getStartDate()); - break; - } - } - break; - } - } - } - } - - return properties; - } - - public enum LicenceProperties { - LICENSE_REF("license_ref"), - START_DATE("start_date"); - - private String name; - - LicenceProperties(String name) { - this.name = name; - } - - public String getName() { - return name; - } - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/MetadataRDAMapper.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/MetadataRDAMapper.java deleted file mode 100644 index e8c28b7bb..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/MetadataRDAMapper.java +++ /dev/null @@ -1,223 +0,0 @@ -package eu.eudat.models.rda.mapper; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.TextNode; -import eu.eudat.logic.utilities.helpers.MyStringUtils; -import eu.eudat.models.rda.Metadatum; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.util.*; -import java.util.stream.Collectors; - -public class MetadataRDAMapper { - private static final Logger logger = LoggerFactory.getLogger(MetadataRDAMapper.class); - - public static List toRDAList(List nodes) { - Map rdaMap = new HashMap<>(); - List rdas = new ArrayList<>(); - for (JsonNode node: nodes) { - String rdaProperty = ""; - JsonNode schematics = node.get("schematics"); - if(schematics.isArray()){ - int index = 0; - for(JsonNode schematic: schematics){ - if(schematic.asText().startsWith("rda.dataset.metadata")){ - rdaProperty = schematic.asText(); - ((ArrayNode)schematics).remove(index); - break; - } - index++; - } - } - else{ - continue; - } - JsonNode rdaValue = node.get("value"); - - for (PropertyName propertyName: PropertyName.values()) { - if (rdaProperty.contains(propertyName.getName())) { - switch (propertyName) { - case METADATA_STANDARD_ID: - if (rdaValue instanceof ArrayNode) { - try { - ObjectMapper mapper = new ObjectMapper(); - for (Iterator it = rdaValue.elements(); it.hasNext(); ) { - JsonNode data = null; - data = mapper.readTree(it.next().asText()); - if (data.get("uri") != null) { - rdas.add(new Metadatum()); - rdas.get(rdas.size() - 1).setMetadataStandardId(MetadataStandardIdRDAMapper.toRDA(data.get("uri").asText())); - rdas.get(rdas.size() - 1).setDescription(data.get("label").asText()); - rdas.get(rdas.size() - 1).setAdditionalProperty("fieldId", node.get("id").asText()); - rdas.get(rdas.size() - 1).setAdditionalProperty("valueId", data.get("id").asText()); - rdaMap.put(data.get("uri").asText(), node.get("numbering").asText()); - } - } - } catch (IOException e) { - logger.error(e.getMessage(), e); - } - } else if (rdaValue instanceof TextNode && rdaProperty.contains("identifier") && !rdaValue.asText().isEmpty()) { - rdas.add(new Metadatum()); - rdas.get(rdas.size() - 1).setMetadataStandardId(MetadataStandardIdRDAMapper.toRDA(rdaValue.asText())); - rdas.get(rdas.size() - 1).setAdditionalProperty("identifierId", node.get("id").asText()); - rdaMap.put(rdaValue.asText(), node.get("numbering").asText()); - } - break; - case DESCRIPTION: - if (!rdaValue.asText().isEmpty()) { - Metadatum rda = getRelative(rdas, rdaMap, node.get("numbering").asText()); - if (rda != null) { - rda.setDescription(rdaValue.asText()); - rda.setAdditionalProperty("descriptionId", node.get("id").asText()); - } else { - rdas.stream().filter(rda1 -> rda1.getDescription() == null || rda1.getDescription().isEmpty()).forEach(rda1 -> rda1.setDescription(rdaValue.asText())); - } - } - break; - case LANGUAGE: - String language = rdaValue.asText(); - Metadatum.Language lang = Metadatum.Language.fromValue(language); - Metadatum rda = getRelative(rdas, rdaMap, node.get("numbering").asText()); - if (rda != null) { - rda.setLanguage(lang); - rda.setAdditionalProperty("languageId", node.get("id").asText()); - } else { - rdas.forEach(rda1 -> rda1.setLanguage(lang)); - } - break; - } - } - } - - } - - return rdas; - } - - public static Map toProperties(List rdas) { - Map properties = new HashMap<>(); - List standardIds = new ArrayList<>(); - ObjectMapper mapper = new ObjectMapper(); - rdas.forEach(rda -> { - rda.getAdditionalProperties().entrySet().forEach(entry -> { - try { - switch (entry.getKey()) { - case "fieldId": - Map metadata = toMap(rda); - standardIds.add(metadata); - properties.put(entry.getValue().toString(), mapper.writeValueAsString(standardIds)); - break; - case "identifierId": - properties.put(entry.getValue().toString(), rda.getMetadataStandardId().getIdentifier()); - break; - case "descriptionId": - properties.put(entry.getValue().toString(), rda.getDescription()); - break; - case "languageId": - if (rda.getLanguage() != null) { - properties.put(entry.getValue().toString(), rda.getLanguage().value()); - } - break; - } - }catch (Exception e) { - logger.error(e.getMessage(), e); - } - }); - }); - - return properties; - } - - public static Metadatum toRDA(JsonNode node) { - Metadatum rda = new Metadatum(); - String rdaProperty = ""; - JsonNode schematics = node.get("schematics"); - if(schematics.isArray()){ - for(JsonNode schematic: schematics){ - if(schematic.asText().startsWith("rda.dataset.metadata")){ - rdaProperty = schematic.asText(); - break; - } - } - } - JsonNode rdaValue = node.get("value"); - if (rdaProperty.contains("metadata_standard_id")) { - if (rdaValue instanceof ArrayNode) { - for (Iterator it = rdaValue.elements(); it.hasNext(); ) { - JsonNode data = it.next(); - if (data.get("uri") != null) { - rda.setMetadataStandardId(MetadataStandardIdRDAMapper.toRDA(data.get("uri").asText())); - } - } - } - } else if (rdaProperty.contains("description")) { - rda.setDescription(rdaValue.asText()); - } else if (rdaProperty.contains("language")) { - String language = rdaValue.asText(); - Metadatum.Language lang = Metadatum.Language.fromValue(language); - rda.setLanguage(lang); - } - - return rda; - } - - private static Metadatum getRelative(List rdas, Map rdaMap, String numbering) { - String target = rdaMap.entrySet().stream().filter(entry -> MyStringUtils.getFirstDifference(entry.getValue(), numbering) > 0) - .max(Comparator.comparingInt(entry -> MyStringUtils.getFirstDifference(entry.getValue(), numbering))).map(Map.Entry::getKey).orElse(""); - return rdas.stream().filter(rda -> rda.getMetadataStandardId().getIdentifier().equals(target)).distinct().findFirst().orElse(null); - } - - private enum PropertyName { - METADATA_STANDARD_ID("metadata_standard_id"), - DESCRIPTION("description"), - LANGUAGE("language"); - - private final String name; - - PropertyName(String name) { - this.name = name; - } - - public String getName() { - return name; - } - } - - private static Map toMap(Metadatum rda) { - Map result = new HashMap<>(); - - ObjectMapper mapper = new ObjectMapper(); - - Map metadata = mapper.convertValue(rda, Map.class); - - Map additionalProperties = mapper.convertValue(metadata.get("additional_properties"), Map.class); - - String id = additionalProperties.remove("valueId"); - additionalProperties.clear(); - additionalProperties.put("id", id); - - Map metadataStandardId = mapper.convertValue(metadata.get("metadata_standard_id"), Map.class); - - String url = metadataStandardId.remove("identifier"); - metadataStandardId.remove("type"); - metadataStandardId.put("uri", url); - - metadata.remove("additional_properties"); - metadata.remove("metadata_standard_id"); - - Map newMetadata = metadata.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().toString())); - - String label = newMetadata.remove("description"); - newMetadata.put("label", label); - - result.putAll(newMetadata); - result.putAll(metadataStandardId); - result.putAll(additionalProperties); - - return result; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/MetadataStandardIdRDAMapper.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/MetadataStandardIdRDAMapper.java deleted file mode 100644 index 586446e02..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/MetadataStandardIdRDAMapper.java +++ /dev/null @@ -1,13 +0,0 @@ -package eu.eudat.models.rda.mapper; - -import eu.eudat.models.rda.MetadataStandardId; - -public class MetadataStandardIdRDAMapper { - - public static MetadataStandardId toRDA(String uri) { - MetadataStandardId rda = new MetadataStandardId(); - rda.setIdentifier(uri); - rda.setType(MetadataStandardId.Type.URL); - return rda; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/SecurityAndPrivacyRDAMapper.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/SecurityAndPrivacyRDAMapper.java deleted file mode 100644 index 1d560b91b..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/SecurityAndPrivacyRDAMapper.java +++ /dev/null @@ -1,157 +0,0 @@ -package eu.eudat.models.rda.mapper; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ArrayNode; -import eu.eudat.logic.utilities.helpers.MyStringUtils; -import eu.eudat.models.rda.SecurityAndPrivacy; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.*; -import java.util.stream.Collectors; - -public class SecurityAndPrivacyRDAMapper { - private static final Logger logger = LoggerFactory.getLogger(SecurityAndPrivacyRDAMapper.class); - - public static List toRDAList(List nodes) { - Map rdaMap = new HashMap<>(); - - for (JsonNode node: nodes) { - String rdaProperty = ""; - JsonNode schematics = node.get("schematics"); - if(schematics.isArray()){ - int index = 0; - for(JsonNode schematic: schematics){ - if(schematic.asText().startsWith("rda.dataset.security_and_privacy")){ - rdaProperty = schematic.asText(); - ((ArrayNode)schematics).remove(index); - break; - } - index++; - } - } - else{ - continue; - } - String rdaValue = node.get("value").asText(); - if(rdaValue == null || rdaValue.isEmpty()){ - continue; - } - SecurityAndPrivacy rda = getRelative(rdaMap, node.get("numbering").asText()); - if (!rdaMap.containsValue(rda)) { - rdaMap.put(node.get("numbering").asText(), rda); - } - for (ExportPropertyName exportPropertyName : ExportPropertyName.values()) { - if (rdaProperty.contains(exportPropertyName.getName())) { - switch (exportPropertyName) { - case TITLE: - rda.setTitle(rdaValue); - rda.getAdditionalProperties().put(ImportPropertyName.TITLE.getName(), node.get("id").asText()); - break; - case DESCRIPTION: - rda.setDescription(rdaValue); - rda.getAdditionalProperties().put(ImportPropertyName.DESCRIPTION.getName(), node.get("id").asText()); - break; - } - } - } - } - - return rdaMap.values().stream() - .filter(sap -> sap.getTitle() != null) - .collect(Collectors.toList()); - } - - public static Map toProperties(List rdas) { - Map properties = new HashMap<>(); - rdas.forEach(rda -> rda.getAdditionalProperties().entrySet().forEach(entry -> { - try { - ImportPropertyName importPropertyName = ImportPropertyName.fromString(entry.getKey()); - switch(importPropertyName) { - case TITLE: - properties.put(entry.getValue().toString(), rda.getTitle()); - break; - case DESCRIPTION: - properties.put(entry.getValue().toString(), rda.getDescription()); - break; - } - } catch (Exception e) { - logger.error(e.getMessage(), e); - } - })); - - return properties; - } - - public static SecurityAndPrivacy toRDA(JsonNode node) { - SecurityAndPrivacy rda = new SecurityAndPrivacy(); - String rdaProperty = ""; - JsonNode schematics = node.get("schematics"); - if(schematics.isArray()){ - for(JsonNode schematic: schematics){ - if(schematic.asText().startsWith("rda.dataset.security_and_privacy")){ - rdaProperty = schematic.asText(); - break; - } - } - } - String value = node.get("value").asText(); - - if (rdaProperty.contains("description")) { - rda.setDescription(value); - } - if (rdaProperty.contains("title")) { - rda.setTitle(value); - } - - if (rda.getTitle() == null) { - throw new IllegalArgumentException("Security And Privacy Title is missing"); - } - - return rda; - } - - private static SecurityAndPrivacy getRelative(Map rdaMap, String numbering) { - return rdaMap.entrySet().stream().filter(entry -> MyStringUtils.getFirstDifference(entry.getKey(), numbering) > 0) - .max(Comparator.comparingInt(entry -> MyStringUtils.getFirstDifference(entry.getKey(), numbering))).map(Map.Entry::getValue).orElse(new SecurityAndPrivacy()); - } - - private enum ExportPropertyName { - TITLE("title"), - DESCRIPTION("description"); - - private String name; - - ExportPropertyName(String name) { - this.name = name; - } - - public String getName() { - return name; - } - } - - private enum ImportPropertyName { - TITLE("titleId"), - DESCRIPTION("descriptionId"); - - private String name; - - ImportPropertyName(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public static ImportPropertyName fromString(String name) throws Exception { - for (ImportPropertyName importPropertyName: ImportPropertyName.values()) { - if (importPropertyName.getName().equals(name)) { - return importPropertyName; - } - } - throw new Exception("Property not available"); - } - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/TechnicalResourceRDAMapper.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/TechnicalResourceRDAMapper.java deleted file mode 100644 index 31ad744fe..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/TechnicalResourceRDAMapper.java +++ /dev/null @@ -1,158 +0,0 @@ -package eu.eudat.models.rda.mapper; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ArrayNode; -import eu.eudat.logic.utilities.helpers.MyStringUtils; -import eu.eudat.models.rda.TechnicalResource; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.*; -import java.util.stream.Collectors; - -public class TechnicalResourceRDAMapper { - private static final Logger logger = LoggerFactory.getLogger(TechnicalResourceRDAMapper.class); - - public static List toRDAList(List nodes) { - Map rdaMap = new HashMap<>(); - - for (JsonNode node: nodes) { - String rdaProperty = ""; - JsonNode schematics = node.get("schematics"); - if(schematics.isArray()){ - int index = 0; - for(JsonNode schematic: schematics){ - if(schematic.asText().startsWith("rda.dataset.technical_resource")){ - rdaProperty = schematic.asText(); - ((ArrayNode)schematics).remove(index); - break; - } - index++; - } - } - else{ - continue; - } - String rdaValue = node.get("value").asText(); - if(rdaValue == null || rdaValue.isEmpty()){ - continue; - } - TechnicalResource rda = getRelative(rdaMap, node.get("numbering").asText()); - if (!rdaMap.containsValue(rda)) { - rdaMap.put(node.get("numbering").asText(), rda); - } - for (ExportPropertyName exportPropertyName : ExportPropertyName.values()) { - if (rdaProperty.contains(exportPropertyName.getName())) { - switch (exportPropertyName) { - case NAME: - rda.setName(rdaValue); - rda.setAdditionalProperty(ImportPropertyName.NAME.getName(), node.get("id").asText()); - break; - case DESCRIPTION: - rda.setDescription(rdaValue); - rda.setAdditionalProperty(ImportPropertyName.DESCRIPTION.getName(), node.get("id").asText()); - break; - } - } - } - } - - return rdaMap.values().stream() - .filter(tr -> tr.getName() != null) - .collect(Collectors.toList()); - } - - public static Map toProperties(List rdas) { - Map properties = new HashMap<>(); - - rdas.forEach(rda -> rda.getAdditionalProperties().entrySet().forEach(entry -> { - try { - ImportPropertyName importPropertyName = ImportPropertyName.fromString(entry.getKey()); - switch(importPropertyName) { - case DESCRIPTION: - properties.put(entry.getValue().toString(), rda.getDescription()); - break; - case NAME: - properties.put(entry.getValue().toString(), rda.getName()); - break; - } - } catch (Exception e) { - logger.error(e.getMessage(), e); - } - })); - - return properties; - } - - public static TechnicalResource toRDA(JsonNode node) { - TechnicalResource rda = new TechnicalResource(); - String rdaProperty = ""; - JsonNode schematics = node.get("schematics"); - if(schematics.isArray()){ - for(JsonNode schematic: schematics){ - if(schematic.asText().startsWith("rda.dataset.technical_resource")){ - rdaProperty = schematic.asText(); - break; - } - } - } - String value = node.get("value").asText(); - - if (rdaProperty.contains("description")) { - rda.setDescription(value); - } - if (rdaProperty.contains("name")) { - rda.setName(value); - } - - if (rda.getName() == null) { - throw new IllegalArgumentException("Technical Resources Name is missing"); - } - - return rda; - } - - private static TechnicalResource getRelative(Map rdaMap, String numbering) { - return rdaMap.entrySet().stream().filter(entry -> MyStringUtils.getFirstDifference(entry.getKey(), numbering) > 0) - .max(Comparator.comparingInt(entry -> MyStringUtils.getFirstDifference(entry.getKey(), numbering))).map(Map.Entry::getValue).orElse(new TechnicalResource()); - } - - private enum ExportPropertyName { - NAME("name"), - DESCRIPTION("description"); - - private String name; - - ExportPropertyName(String name) { - this.name = name; - } - - public String getName() { - return name; - } - } - - private enum ImportPropertyName { - NAME("nameId"), - DESCRIPTION("descriptionId"); - - private String name; - - ImportPropertyName(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public static ImportPropertyName fromString(String name) throws Exception { - for (ImportPropertyName importPropertyName: ImportPropertyName.values()) { - if (importPropertyName.getName().equals(name)) { - return importPropertyName; - } - } - throw new Exception("Property name not available"); - } - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/FluentValidator.java b/dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/FluentValidator.java deleted file mode 100644 index 28e19797c..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/FluentValidator.java +++ /dev/null @@ -1,32 +0,0 @@ -package eu.eudat.models.validators.fluentvalidator; - -import eu.eudat.models.validators.fluentvalidator.predicates.FieldSelector; -import org.springframework.validation.Errors; -import org.springframework.validation.Validator; - -import java.util.LinkedList; -import java.util.List; - -/** - * Created by ikalyvas on 8/28/2018. - */ -public abstract class FluentValidator implements Validator { - - private List fluentValidatorBuilders = new LinkedList<>(); - - public FluentValidatorBuilder ruleFor(FieldSelector selector) { - FluentValidatorBuilder fluentValidatorBuilder = new FluentValidatorBuilder<>(selector); - this.fluentValidatorBuilders.add(fluentValidatorBuilder); - return fluentValidatorBuilder; - } - - @Override - public abstract boolean supports(Class clazz); - - @Override - public void validate(Object target, Errors errors) { - List validatorResults = new LinkedList<>(); - //this.fluentValidatorBuilders.forEach(x-> validatorResults.addAll(x.validate(target))); - //validatorResults.forEach(x-> errors.rejectValue(x.getField(),x.getError())); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/FluentValidatorBuilder.java b/dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/FluentValidatorBuilder.java deleted file mode 100644 index bfe3f607e..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/FluentValidatorBuilder.java +++ /dev/null @@ -1,75 +0,0 @@ -package eu.eudat.models.validators.fluentvalidator; - -import eu.eudat.models.validators.fluentvalidator.predicates.ComparisonOperator; -import eu.eudat.models.validators.fluentvalidator.predicates.ConditionalOperator; -import eu.eudat.models.validators.fluentvalidator.predicates.FieldSelector; -import eu.eudat.models.validators.fluentvalidator.rules.AbstractFluentValidatorRule; -import eu.eudat.models.validators.fluentvalidator.rules.CompareRule; -import eu.eudat.models.validators.fluentvalidator.rules.NotEmptyRule; - -import javax.management.InvalidApplicationException; -import java.util.LinkedList; -import java.util.List; -import java.util.stream.Collectors; - -/** - * Created by ikalyvas on 8/31/2018. - */ -public class FluentValidatorBuilder { - private FieldSelector selector; - private T item; - private String name; - private String message; - private List validationMessages = new LinkedList<>(); - private List rules = new LinkedList<>(); - private ConditionalOperator conditionalOperator; - public FluentValidatorBuilder(FieldSelector selector) { - this.selector = selector; - } - - public FluentValidatorBuilder notEmpty() { - this.rules.add(new NotEmptyRule<>(this.selector)); - return this; - } - - public FluentValidatorBuilder ruleIf(ConditionalOperator conditionalOperator) { - this.conditionalOperator = conditionalOperator; - return this; - } - - public FluentValidatorBuilder compareAs(FieldSelector comparisonSelector, ComparisonOperator comparisonOperator) { - this.rules.add(new CompareRule<>(this.selector, comparisonSelector, comparisonOperator)); - return this; - } - - public FluentValidatorBuilder withName(String name) { - this.name = name; - return this; - } - - public FluentValidatorBuilder withMessage(String message) { - this.message = message; - return this; - } - - public List validate(T item) { - this.item = item; - List errors = new LinkedList<>(); - if(this.conditionalOperator != null && !this.conditionalOperator.apply(this.item)) return errors; - this.rules.forEach(x -> { - try { - errors.add(this.evaluateError(x)); - } catch (InvalidApplicationException e) { - throw new RuntimeException(e); - } - }); - return errors.stream().filter(x -> x != null).collect(Collectors.toList()); - } - - private FluentValidatorResult evaluateError(AbstractFluentValidatorRule rule) throws InvalidApplicationException { - if (rule.assertValue(this.item)) { - return new FluentValidatorResult(this.name, this.message); - } - return null; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/FluentValidatorResult.java b/dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/FluentValidatorResult.java deleted file mode 100644 index ca3480065..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/FluentValidatorResult.java +++ /dev/null @@ -1,32 +0,0 @@ -package eu.eudat.models.validators.fluentvalidator; - -import java.util.List; - -/** - * Created by ikalyvas on 8/31/2018. - */ -public class FluentValidatorResult { - private String field; - private String error; - - public FluentValidatorResult(String field, String error) { - this.field = field; - this.error = error; - } - - public String getField() { - return field; - } - - public void setField(String field) { - this.field = field; - } - - public String getError() { - return error; - } - - public void setError(String error) { - this.error = error; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/Rule.java b/dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/Rule.java deleted file mode 100644 index f06cc290c..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/Rule.java +++ /dev/null @@ -1,8 +0,0 @@ -package eu.eudat.models.validators.fluentvalidator; - -/** - * Created by ikalyvas on 8/31/2018. - */ -public enum Rule { - NOT_EMPTY, GREATER, GREATER_THAN, EQUAL, LESS, LESS_THAN, -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/predicates/ComparisonOperator.java b/dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/predicates/ComparisonOperator.java deleted file mode 100644 index 386df83ed..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/predicates/ComparisonOperator.java +++ /dev/null @@ -1,8 +0,0 @@ -package eu.eudat.models.validators.fluentvalidator.predicates; - -/** - * Created by ikalyvas on 8/31/2018. - */ -public interface ComparisonOperator { - boolean compare(L leftItem, R rightItem); -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/predicates/ConditionalOperator.java b/dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/predicates/ConditionalOperator.java deleted file mode 100644 index 8392c61c1..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/predicates/ConditionalOperator.java +++ /dev/null @@ -1,8 +0,0 @@ -package eu.eudat.models.validators.fluentvalidator.predicates; - -/** - * Created by ikalyvas on 8/31/2018. - */ -public interface ConditionalOperator { - boolean apply(T item); -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/predicates/FieldSelector.java b/dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/predicates/FieldSelector.java deleted file mode 100644 index cd06ef9c6..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/predicates/FieldSelector.java +++ /dev/null @@ -1,10 +0,0 @@ -package eu.eudat.models.validators.fluentvalidator.predicates; - -import javax.management.InvalidApplicationException; - -/** - * Created by ikalyvas on 8/28/2018. - */ -public interface FieldSelector { - R apply(T item) throws InvalidApplicationException; -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/rules/AbstractFluentValidatorRule.java b/dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/rules/AbstractFluentValidatorRule.java deleted file mode 100644 index cdc50b34a..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/rules/AbstractFluentValidatorRule.java +++ /dev/null @@ -1,22 +0,0 @@ -package eu.eudat.models.validators.fluentvalidator.rules; - -import eu.eudat.models.validators.fluentvalidator.predicates.FieldSelector; - -import javax.management.InvalidApplicationException; - -/** - * Created by ikalyvas on 8/31/2018. - */ -public abstract class AbstractFluentValidatorRule { - private FieldSelector fieldSelector; - - public FieldSelector getFieldSelector() { - return fieldSelector; - } - - public AbstractFluentValidatorRule(FieldSelector fieldSelector) { - this.fieldSelector = fieldSelector; - } - - public abstract boolean assertValue(T item) throws InvalidApplicationException; -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/rules/CompareRule.java b/dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/rules/CompareRule.java deleted file mode 100644 index bb12f63a3..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/rules/CompareRule.java +++ /dev/null @@ -1,26 +0,0 @@ -package eu.eudat.models.validators.fluentvalidator.rules; - -import eu.eudat.models.validators.fluentvalidator.predicates.ComparisonOperator; -import eu.eudat.models.validators.fluentvalidator.predicates.FieldSelector; - -import javax.management.InvalidApplicationException; - -/** - * Created by ikalyvas on 8/31/2018. - */ -public class CompareRule extends AbstractFluentValidatorRule { - - private FieldSelector comparisonSelector; - private ComparisonOperator comparisonOperator; - - public CompareRule(FieldSelector fieldSelector, FieldSelector comparisonSelector, ComparisonOperator comparisonOperator) { - super(fieldSelector); - this.comparisonOperator = comparisonOperator; - this.comparisonSelector = comparisonSelector; - } - - @Override - public boolean assertValue(T item) throws InvalidApplicationException { - return this.comparisonOperator.compare(this.getFieldSelector().apply(item), this.comparisonSelector.apply(item)); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/rules/NotEmptyRule.java b/dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/rules/NotEmptyRule.java deleted file mode 100644 index 8f47809e5..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/models/validators/fluentvalidator/rules/NotEmptyRule.java +++ /dev/null @@ -1,20 +0,0 @@ -package eu.eudat.models.validators.fluentvalidator.rules; - -import eu.eudat.models.validators.fluentvalidator.predicates.FieldSelector; - -import javax.management.InvalidApplicationException; - -/** - * Created by ikalyvas on 8/31/2018. - */ -public class NotEmptyRule extends AbstractFluentValidatorRule { - - public NotEmptyRule(FieldSelector fieldSelector) { - super(fieldSelector); - } - - @Override - public boolean assertValue(T item) throws InvalidApplicationException { - return this.getFieldSelector().apply(item) != null; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/types/Rights.java b/dmp-backend/web/src/main/java/eu/eudat/types/Rights.java deleted file mode 100644 index ed2edf8ec..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/types/Rights.java +++ /dev/null @@ -1,31 +0,0 @@ -package eu.eudat.types; - -/** - * Created by ikalyvas on 2/8/2018. - */ -public enum Rights { - CAN_EDIT_ROLES(0), CAN_INVITE_USERS(1), CAN_CREATE_DMP(2); - - private Integer value; - - private Rights(Integer value) { - this.value = value; - } - - public Integer getValue() { - return value; - } - - public static Rights fromInteger(Integer value) { - switch (value) { - case 0: - return CAN_EDIT_ROLES; - case 1: - return CAN_INVITE_USERS; - case 2: - return CAN_CREATE_DMP; - default: - throw new RuntimeException("Unsupported Rights Type"); - } - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/types/WarningLevel.java b/dmp-backend/web/src/main/java/eu/eudat/types/WarningLevel.java deleted file mode 100644 index 8ac07413d..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/types/WarningLevel.java +++ /dev/null @@ -1,8 +0,0 @@ -package eu.eudat.types; - -/** - * Created by ikalyvas on 3/1/2018. - */ -public enum WarningLevel { - INFO, WARN, DEBUG, ERROR -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/types/searchbar/SearchBarItemType.java b/dmp-backend/web/src/main/java/eu/eudat/types/searchbar/SearchBarItemType.java deleted file mode 100644 index 0ae7803af..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/types/searchbar/SearchBarItemType.java +++ /dev/null @@ -1,32 +0,0 @@ -package eu.eudat.types.searchbar; - -/** - * Created by ikalyvas on 7/26/2018. - */ -public enum SearchBarItemType { - DATASET(0), DMP(1), GRANT(2); - - private Integer value; - - private SearchBarItemType(Integer value) { - this.value = value; - } - - public Integer getValue() { - return value; - } - - public static SearchBarItemType fromInteger(Integer value) { - switch (value) { - case 0: - return DATASET; - case 1: - return DMP; - case 2: - return GRANT; - default: - throw new RuntimeException("Unsupported Search bar item Code"); - } - } - -}