From 57facf98e5b00c90f14e979ecf1624e411f61fc0 Mon Sep 17 00:00:00 2001 From: sgiannopoulos Date: Fri, 27 Oct 2023 18:46:34 +0300 Subject: [PATCH] DescriptionTemplate refactor --- .../java/eu/eudat/audit/AuditableAction.java | 5 + .../eu/eudat/authorization/Permission.java | 5 + .../eu/eudat/commons/XmlHandlingService.java | 64 +++-- .../enums/DescriptionTemplateStatus.java | 30 +++ .../commons/enums/FieldDataComboBoxType.java | 27 +++ .../enums/FieldDataExternalDatasetType.java | 28 +++ .../enums/FieldDataInternalDmpEntryType.java | 28 +++ .../eu/eudat/commons/enums/FieldType.java | 50 ++++ .../commons/enums/FieldValidationType.java | 33 +++ .../types/common/DatabaseDefinition.java | 5 + .../types/common/DatabaseModelDefinition.java | 7 + .../common/DatabaseViewStyleDefinition.java | 7 + .../DefinitionEntity.java} | 34 +-- .../descriptiontemplate/FieldEntity.java} | 126 +++++----- .../descriptiontemplate/FieldSetEntity.java} | 50 ++-- .../MultiplicityEntity.java} | 4 +- .../descriptiontemplate/PageEntity.java} | 7 +- .../types/descriptiontemplate/RuleEntity.java | 52 ++++ .../descriptiontemplate/SectionEntity.java} | 41 ++-- .../fielddata/AutoCompleteDataEntity.java} | 56 ++--- .../fielddata/BaseFieldDataEntity.java} | 17 +- .../fielddata/BooleanDecisionDataEntity.java} | 8 +- .../fielddata/CheckBoxDataEntity.java} | 8 +- .../fielddata/ComboBoxDataEntity.java} | 23 +- .../fielddata/CurrencyDataEntity.java} | 8 +- .../fielddata/DataRepositoryDataEntity.java} | 8 +- .../DatasetAutoCompleteDataEntity.java} | 8 +- .../DatasetIdentifierDataEntity.java | 42 ++++ .../fielddata/DatePickerDataEntity.java} | 8 +- .../fielddata/DmpAutoCompleteDataEntity.java} | 8 +- .../fielddata/ExternalDatasetDataEntity.java} | 21 +- .../fielddata/FieldDataHelper.java | 84 +++++++ .../fielddata/FreeTextDataEntity.java} | 8 +- .../fielddata/InternalDmpBaseDataEntity.java} | 21 +- .../fielddata/LicenseDataEntity.java} | 8 +- .../fielddata/OrganizationDataEntity.java} | 8 +- .../fielddata/PublicationDataEntity.java} | 8 +- .../fielddata/RadioBoxDataEntity.java} | 8 +- .../fielddata/RegistryDataEntity.java} | 8 +- .../ResearcherAutoCompleteDataEntity.java} | 8 +- .../fielddata/ResearcherDataEntity.java} | 8 +- .../fielddata/RichTextAreaDataEntity.java} | 8 +- .../fielddata/ServiceDataEntity.java} | 8 +- .../fielddata/TagDataEntity.java} | 8 +- .../fielddata/TaxonomyDataEntity.java} | 8 +- .../fielddata/TextAreaDataEntity.java} | 8 +- .../fielddata/UploadDataEntity.java} | 24 +- .../fielddata/ValidationDataEntity.java} | 8 +- .../fielddata/WordListDataEntity.java} | 9 +- .../todelete/DefaultValueEntity.java} | 4 +- .../todelete/FieldDescriptionEntity.java | 26 ++ .../todelete/VisibilityEntity.java} | 17 +- .../types/dmpblueprint/DefinitionEntity.java | 5 + .../DescriptionTemplateEntity.java | 9 + .../ExternalAutoCompleteEntity.java | 68 ------ .../types/dmpblueprint/ExtraFieldEntity.java | 5 + .../types/dmpblueprint/FieldEntity.java | 18 ++ .../types/dmpblueprint/SectionEntity.java | 16 ++ .../types/dmpblueprint/SystemFieldEntity.java | 5 + .../eudat/data/DescriptionTemplateEntity.java | 174 ++++++++++++++ .../data/DescriptionTemplateTypeEntity.java | 3 +- .../eu/eudat/data/DmpBlueprintEntity.java | 22 +- .../DescriptionTemplateStatusConverter.java | 11 + .../eu/eudat/data/old/DMPDatasetProfile.java | 7 +- .../main/java/eu/eudat/data/old/Dataset.java | 7 +- .../eudat/data/old/DescriptionTemplate.java | 199 --------------- .../eu/eudat/data/old/UserDatasetProfile.java | 9 +- .../eu/eudat/model/DescriptionTemplate.java | 155 ++++++++++++ .../eudat/model/DescriptionTemplateType.java | 12 + .../builder/DescriptionTemplateBuilder.java | 118 +++++++++ .../model/builder/DmpBlueprintBuilder.java | 3 +- .../DefinitionBuilder.java | 61 +++++ .../FieldBuilder.java | 79 ++++++ .../FieldSetBuilder.java | 65 +++++ .../PageBuilder.java | 55 +++++ .../RuleBuilder.java | 54 +++++ .../SectionBuilder.java | 69 ++++++ .../AuthAutoCompleteDataBuilder.java | 57 +++++ .../fielddata/AutoCompleteDataBuilder.java | 36 +++ .../AutoCompleteSingleDataBuilder.java | 64 +++++ .../fielddata/BaseFieldDataBuilder.java | 56 +++++ .../fielddata/BooleanDecisionDataBuilder.java | 30 +++ .../fielddata/CheckBoxDataBuilder.java | 29 +++ .../fielddata/ComboBoxDataBuilder.java | 22 ++ .../fielddata/ComboBoxOptionBuilder.java | 56 +++++ .../fielddata/CurrencyDataBuilder.java | 30 +++ .../fielddata/DataRepositoryDataBuilder.java | 32 +++ .../DatasetAutoCompleteDataBuilder.java | 31 +++ .../DatasetIdentifierDataBuilder.java | 30 +++ .../fielddata/DatePickerDataBuilder.java | 29 +++ .../fielddata/DmpAutoCompleteDataBuilder.java | 31 +++ .../fielddata/ExternalDatasetDataBuilder.java | 32 +++ .../fielddata/FreeTextDataBuilder.java | 29 +++ .../fielddata/InternalDmpBaseDataBuilder.java | 22 ++ .../fielddata/LicenseDataBuilder.java | 31 +++ .../fielddata/OrganizationDataBuilder.java | 30 +++ .../fielddata/PublicationDataBuilder.java | 30 +++ .../fielddata/RadioBoxDataBuilder.java | 36 +++ .../fielddata/RadioBoxOptionBuilder.java | 54 +++++ .../fielddata/RegistryDataBuilder.java | 30 +++ .../ResearcherAutoCompleteDataBuilder.java | 32 +++ .../fielddata/ResearcherDataBuilder.java | 30 +++ .../fielddata/RichTextAreaDataBuilder.java | 29 +++ .../fielddata/ServiceDataBuilder.java | 30 +++ .../fielddata/TagDataBuilder.java | 29 +++ .../fielddata/TaxonomyDataBuilder.java | 30 +++ .../fielddata/TextAreaDataBuilder.java | 29 +++ .../fielddata/UploadDataBuilder.java | 34 +++ .../fielddata/UploadOptionBuilder.java | 54 +++++ .../fielddata/ValidationDataBuilder.java | 29 +++ .../fielddata/WordListDataBuilder.java | 36 +++ .../DefinitionBuilder.java | 2 +- .../DescriptionTemplateBuilder.java | 2 +- .../dmpblueprintdefinition/FieldBuilder.java | 2 +- .../SectionBuilder.java | 2 +- .../censorship/DescriptionTemplateCensor.java | 46 ++++ .../DefinitionCensor.java | 48 ++++ .../FieldCensor.java | 49 ++++ .../FieldDataCensor.java | 40 +++ .../FieldSetCensor.java | 48 ++++ .../MultiplicityCensor.java | 39 +++ .../PageCensor.java | 43 ++++ .../RuleCensor.java | 39 +++ .../SectionCensor.java | 46 ++++ .../DefinitionCensor.java | 2 +- .../DescriptionTemplatesCensor.java | 2 +- .../dmpblueprintdefinition/FieldCensor.java | 2 +- .../dmpblueprintdefinition/SectionCensor.java | 2 +- .../Definition.java | 28 +++ .../descriptiontemplatedefinition/Field.java | 120 +++++++++ .../FieldSet.java | 116 +++++++++ .../Multiplicity.java | 52 ++++ .../descriptiontemplatedefinition/Page.java | 42 ++++ .../descriptiontemplatedefinition/Rule.java | 29 +++ .../Section.java | 130 ++++++++++ .../fielddata/AuthAutoCompleteData.java | 54 +++++ .../fielddata/AutoCompleteData.java | 22 ++ .../fielddata/AutoCompleteSingleData.java | 76 ++++++ .../fielddata/BaseFieldData.java | 15 ++ .../fielddata/BooleanDecisionData.java | 5 + .../fielddata/CheckBoxData.java | 6 + .../fielddata/ComboBoxData.java | 20 ++ .../fielddata/ComboBoxOption.java | 46 ++++ .../fielddata/CurrencyData.java | 5 + .../fielddata/DataRepositoryData.java | 14 ++ .../fielddata/DatasetAutoCompleteData.java | 13 + .../fielddata/DatasetIdentifierData.java | 6 + .../fielddata/DatePickerData.java | 4 + .../fielddata/DmpAutoCompleteData.java | 13 + .../fielddata/ExternalDatasetData.java | 27 +++ .../fielddata/FreeTextData.java | 4 + .../fielddata/InternalDmpBaseData.java | 15 ++ .../fielddata/LicenseData.java | 15 ++ .../fielddata/OrganizationData.java | 15 ++ .../fielddata/PublicationData.java | 16 ++ .../fielddata/RadioBoxData.java | 19 ++ .../fielddata/RadioBoxOption.java | 24 ++ .../fielddata/RegistryData.java | 16 ++ .../fielddata/ResearcherAutoCompleteData.java | 13 + .../fielddata/ResearcherData.java | 16 ++ .../fielddata/RichTextAreaData.java | 7 + .../fielddata/ServiceData.java | 15 ++ .../fielddata/TagData.java | 5 + .../fielddata/TaxonomyData.java | 16 ++ .../fielddata/TextAreaData.java | 5 + .../fielddata/UploadData.java | 30 +++ .../fielddata/UploadOption.java | 24 ++ .../fielddata/ValidationData.java | 5 + .../fielddata/WordListData.java | 26 ++ .../model/dmpblueprintdefinition/Field.java | 6 +- .../DescriptionTemplateTypePersist.java | 10 +- .../eudat/query/DescriptionTemplateQuery.java | 227 ++++++++++++++++++ .../lookup/DescriptionTemplateLookup.java | 94 ++++++++ .../lookup/DescriptionTemplateTypeLookup.java | 8 + .../dmpblueprint/DmpBlueprintService.java | 2 +- .../dmpblueprint/DmpBlueprintServiceImpl.java | 10 +- .../BaseFieldDataHelperService.java | 43 ++++ ...BooleanDecisionFieldDataHelperService.java | 56 +++++ .../CheckBoxFieldDataHelperService.java | 59 +++++ .../ComboBoxFieldDataHelperService.java | 96 ++++++++ .../CurrencyFieldDataHelperService.java | 59 +++++ .../DataRepositoryFieldDataHelperService.java | 59 +++++ ...tasetIdentifierFieldDataHelperService.java | 59 +++++ .../DatePickerFieldDataHelperService.java | 59 +++++ ...ExternalDatasetFieldDataHelperService.java | 59 +++++ .../FieldDataHelperService.java | 23 ++ .../FieldDataHelperServiceProvider.java | 119 +++++++++ .../FreeTextFieldDataHelperService.java | 59 +++++ ...InternalDmpBaseFieldDataHelperService.java | 100 ++++++++ .../LicenseFieldDataHelperService.java | 59 +++++ .../OrganizationFieldDataHelperService.java | 59 +++++ .../PublicationFieldDataHelperService.java | 59 +++++ .../RadioBoxFieldDataHelperService.java | 59 +++++ .../RegistryFieldDataHelperService.java | 59 +++++ .../ResearcherFieldDataHelperService.java | 59 +++++ ...ichTextAreaDataFieldDataHelperService.java | 59 +++++ .../ServiceFieldDataHelperService.java | 59 +++++ .../TagFieldDataHelperService.java | 59 +++++ .../TaxonomyFieldDataHelperService.java | 59 +++++ .../TextAreaFieldDataHelperService.java | 59 +++++ .../UploadFieldDataHelperService.java | 59 +++++ .../ValidationFieldDataHelperService.java | 59 +++++ .../dao/criteria/DatasetProfileCriteria.java | 4 +- .../DatasetProfileWizardCriteria.java | 4 +- .../data/dao/entities/DatasetProfileDao.java | 12 +- .../dao/entities/DatasetProfileDaoImpl.java | 48 ++-- .../DatasetProfileAutocompleteRequest.java | 10 +- ...tasetProfileWizardAutocompleteRequest.java | 6 +- .../DatasetProfileTableRequestItem.java | 10 +- .../main/java/eu/eudat/controllers/Admin.java | 51 ++-- .../controllers/DatasetProfileController.java | 17 +- .../java/eu/eudat/controllers/Datasets.java | 4 +- .../controllers/QuickWizardController.java | 6 +- .../v2/DescriptionTemplateController.java | 125 ++++++++++ .../v2/DmpBlueprintController.java | 2 +- .../logic/builders/BuilderFactoryImpl.java | 1 - .../builders/entity/CredentialBuilder.java | 101 -------- .../entity/DatasetProfileBuilder.java | 62 +++-- .../eu/eudat/logic/managers/AdminManager.java | 46 ++-- .../managers/DataManagementPlanManager.java | 22 +- .../eudat/logic/managers/DatasetManager.java | 30 +-- .../logic/managers/DatasetProfileManager.java | 98 ++++---- .../logic/managers/DatasetWizardManager.java | 10 +- .../eudat/logic/managers/MetricsManager.java | 11 +- .../logic/managers/PrefillingManager.java | 10 +- .../eu/eudat/logic/managers/UserManager.java | 7 +- .../mapper/prefilling/PrefillingMapper.java | 12 +- .../utilities/builders/ModelBuilder.java | 101 +------- .../utilities/documents/word/WordBuilder.java | 117 ++++----- .../documents/xml/ExportXmlBuilder.java | 6 +- .../ExportXmlBuilderDatasetProfile.java | 133 +++++----- .../datasetProfileModel/DatasetProfile.java | 4 +- .../Fields/DefaultValue.java | 5 +- .../datasetProfileModel/Fields/Field.java | 7 +- .../datasetProfileModel/Fields/Rule.java | 10 +- .../datasetProfileModel/Fields/ViewStyle.java | 12 +- .../datasetProfileModel/Fields/Visible.java | 8 +- .../datasetProfileModel/Multiplicity.java | 5 +- .../helpers/ModelBuilderCollector.java | 21 +- .../utilities/helpers/ModelSerializer.java | 5 +- .../interfaces/DatabaseDefinition.java | 5 - .../utilities/interfaces/ModelDefinition.java | 2 +- .../utilities/interfaces/ModelSerializer.java | 5 +- .../interfaces/ViewStyleDefinition.java | 4 +- .../components/datasetprofile/Field.java | 104 ++++---- .../components/datasetprofile/FieldSet.java | 22 +- .../admin/components/datasetprofile/Page.java | 7 +- .../components/datasetprofile/Section.java | 14 +- .../data/admin/composite/DatasetProfile.java | 6 +- .../models/data/components/commons/Rule.java | 86 ------- .../data/components/commons/ViewStyle.java | 71 ------ .../commons/datafield/ValidationData.java | 42 ---- .../datasetImport/DatasetImportField.java | 5 +- .../DatasetProfileAutocompleteItem.java | 10 +- .../DatasetProfileListingModel.java | 16 +- .../DatasetProfileOverviewModel.java | 10 +- .../datasetwizard/DatasetWizardModel.java | 3 +- .../models/data/dmp/AssociatedProfile.java | 8 +- .../DatabaseViewStyleDefinition.java | 7 - .../DatabaseModelDefinition.java | 7 - .../common/AutoCompleteOptionsLookupItem.java | 8 +- .../eudat/models/data/login/Credentials.java | 23 -- .../eu/eudat/models/data/login/LoginInfo.java | 24 -- .../DatasetDescriptionQuickWizardModel.java | 4 +- .../data/quickwizard/DmpQuickWizardModel.java | 14 +- .../data/user/components/commons/Rule.java | 5 +- .../user/components/datasetprofile/Field.java | 89 +++---- .../components/datasetprofile/FieldSet.java | 25 +- .../components/datasetprofile/Section.java | 14 +- .../data/user/composite/DatasetProfile.java | 5 +- .../models/rda/mapper/DatasetRDAMapper.java | 6 +- .../eudat/models/rda/mapper/DmpRDAMapper.java | 3 +- .../managers/DatasetPublicManager.java | 7 +- .../AssociatedProfilePublicModel.java | 8 +- .../DatasetProfilePublicModel.java | 10 +- .../DataManagementPlanPublicModel.java | 7 +- .../overviewmodels/DatasetPublicModel.java | 3 +- .../src/main/resources/config/permissions.yml | 20 ++ ...1.005_Align_DescriptionTemplatet_table.sql | 34 +++ 279 files changed, 7200 insertions(+), 1736 deletions(-) create mode 100644 dmp-backend/core/src/main/java/eu/eudat/commons/enums/DescriptionTemplateStatus.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldDataComboBoxType.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldDataExternalDatasetType.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldDataInternalDmpEntryType.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldType.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldValidationType.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/commons/types/common/DatabaseDefinition.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/commons/types/common/DatabaseModelDefinition.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/commons/types/common/DatabaseViewStyleDefinition.java rename dmp-backend/{web/src/main/java/eu/eudat/models/data/entities/xmlmodels/datasetprofiledefinition/ViewStyleModel.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/DefinitionEntity.java} (63%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/entities/xmlmodels/datasetprofiledefinition/Field.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/FieldEntity.java} (59%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/entities/xmlmodels/datasetprofiledefinition/FieldSet.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/FieldSetEntity.java} (81%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/Multiplicity.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/MultiplicityEntity.java} (88%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/entities/xmlmodels/datasetprofiledefinition/Page.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/PageEntity.java} (80%) create mode 100644 dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/RuleEntity.java rename dmp-backend/{web/src/main/java/eu/eudat/models/data/entities/xmlmodels/datasetprofiledefinition/Section.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/SectionEntity.java} (80%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/datafield/AutoCompleteData.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/AutoCompleteDataEntity.java} (90%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/datafield/FieldData.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/BaseFieldDataEntity.java} (64%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/datafield/BooleanDecisionData.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/BooleanDecisionDataEntity.java} (75%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/datafield/CheckBoxData.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/CheckBoxDataEntity.java} (78%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/datafield/ComboBoxData.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/ComboBoxDataEntity.java} (79%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/datafield/DatePickerData.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/CurrencyDataEntity.java} (77%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/datafield/LicensesData.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/DataRepositoryDataEntity.java} (86%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/datafield/DatasetsAutoCompleteData.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/DatasetAutoCompleteDataEntity.java} (81%) create mode 100644 dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/DatasetIdentifierDataEntity.java rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/datafield/CurrencyData.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/DatePickerDataEntity.java} (76%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/datafield/DMPsAutoCompleteData.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/DmpAutoCompleteDataEntity.java} (82%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/datafield/ExternalDatasetsData.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/ExternalDatasetDataEntity.java} (71%) create mode 100644 dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/FieldDataHelper.java rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/datafield/FreeTextData.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/FreeTextDataEntity.java} (76%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/datafield/InternalDmpEntitiesData.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/InternalDmpBaseDataEntity.java} (60%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/datafield/PublicationsData.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/LicenseDataEntity.java} (87%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/datafield/ServicesData.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/OrganizationDataEntity.java} (87%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/datafield/TaxonomiesData.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/PublicationDataEntity.java} (87%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/datafield/RadioBoxData.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/RadioBoxDataEntity.java} (94%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/datafield/RegistriesData.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/RegistryDataEntity.java} (87%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/datafield/ResearchersAutoCompleteData.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/ResearcherAutoCompleteDataEntity.java} (81%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/datafield/ResearcherData.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/ResearcherDataEntity.java} (87%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/datafield/RichTextAreaData.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/RichTextAreaDataEntity.java} (75%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/datafield/OrganizationsData.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/ServiceDataEntity.java} (88%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/datafield/TagsData.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/TagDataEntity.java} (78%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/datafield/DataRepositoriesData.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/TaxonomyDataEntity.java} (87%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/datafield/TextAreaData.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/TextAreaDataEntity.java} (76%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/datafield/UploadData.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/UploadDataEntity.java} (85%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/datafield/DatasetIdentifierData.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/ValidationDataEntity.java} (76%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/datafield/WordListData.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/WordListDataEntity.java} (94%) rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/DefaultValue.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/todelete/DefaultValueEntity.java} (77%) create mode 100644 dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/todelete/FieldDescriptionEntity.java rename dmp-backend/{web/src/main/java/eu/eudat/models/data/components/commons/Visibility.java => core/src/main/java/eu/eudat/commons/types/descriptiontemplate/todelete/VisibilityEntity.java} (69%) delete mode 100644 dmp-backend/core/src/main/java/eu/eudat/commons/types/dmpblueprint/ExternalAutoCompleteEntity.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/data/DescriptionTemplateEntity.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/data/converters/enums/DescriptionTemplateStatusConverter.java delete mode 100644 dmp-backend/core/src/main/java/eu/eudat/data/old/DescriptionTemplate.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/DescriptionTemplate.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/DescriptionTemplateBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/DefinitionBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/FieldBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/FieldSetBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/PageBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/RuleBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/SectionBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/AuthAutoCompleteDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/AutoCompleteDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/AutoCompleteSingleDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/BaseFieldDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/BooleanDecisionDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/CheckBoxDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/ComboBoxDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/ComboBoxOptionBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/CurrencyDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/DataRepositoryDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/DatasetAutoCompleteDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/DatasetIdentifierDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/DatePickerDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/DmpAutoCompleteDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/ExternalDatasetDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/FreeTextDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/InternalDmpBaseDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/LicenseDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/OrganizationDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/PublicationDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/RadioBoxDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/RadioBoxOptionBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/RegistryDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/ResearcherAutoCompleteDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/ResearcherDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/RichTextAreaDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/ServiceDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/TagDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/TaxonomyDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/TextAreaDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/UploadDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/UploadOptionBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/ValidationDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/builder/descriptiontemplatedefinition/fielddata/WordListDataBuilder.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/censorship/DescriptionTemplateCensor.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/censorship/descriptiontemplatedefinition/DefinitionCensor.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/censorship/descriptiontemplatedefinition/FieldCensor.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/censorship/descriptiontemplatedefinition/FieldDataCensor.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/censorship/descriptiontemplatedefinition/FieldSetCensor.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/censorship/descriptiontemplatedefinition/MultiplicityCensor.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/censorship/descriptiontemplatedefinition/PageCensor.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/censorship/descriptiontemplatedefinition/RuleCensor.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/censorship/descriptiontemplatedefinition/SectionCensor.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/Definition.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/Field.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/FieldSet.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/Multiplicity.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/Page.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/Rule.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/Section.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/AuthAutoCompleteData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/AutoCompleteData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/AutoCompleteSingleData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/BaseFieldData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/BooleanDecisionData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/CheckBoxData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/ComboBoxData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/ComboBoxOption.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/CurrencyData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/DataRepositoryData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/DatasetAutoCompleteData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/DatasetIdentifierData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/DatePickerData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/DmpAutoCompleteData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/ExternalDatasetData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/FreeTextData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/InternalDmpBaseData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/LicenseData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/OrganizationData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/PublicationData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/RadioBoxData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/RadioBoxOption.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/RegistryData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/ResearcherAutoCompleteData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/ResearcherData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/RichTextAreaData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/ServiceData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/TagData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/TaxonomyData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/TextAreaData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/UploadData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/UploadOption.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/ValidationData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/model/descriptiontemplatedefinition/fielddata/WordListData.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/query/DescriptionTemplateQuery.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/query/lookup/DescriptionTemplateLookup.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/BaseFieldDataHelperService.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/BooleanDecisionFieldDataHelperService.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/CheckBoxFieldDataHelperService.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/ComboBoxFieldDataHelperService.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/CurrencyFieldDataHelperService.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/DataRepositoryFieldDataHelperService.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/DatasetIdentifierFieldDataHelperService.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/DatePickerFieldDataHelperService.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/ExternalDatasetFieldDataHelperService.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/FieldDataHelperService.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/FieldDataHelperServiceProvider.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/FreeTextFieldDataHelperService.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/InternalDmpBaseFieldDataHelperService.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/LicenseFieldDataHelperService.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/OrganizationFieldDataHelperService.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/PublicationFieldDataHelperService.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/RadioBoxFieldDataHelperService.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/RegistryFieldDataHelperService.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/ResearcherFieldDataHelperService.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/RichTextAreaDataFieldDataHelperService.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/ServiceFieldDataHelperService.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/TagFieldDataHelperService.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/TaxonomyFieldDataHelperService.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/TextAreaFieldDataHelperService.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/UploadFieldDataHelperService.java create mode 100644 dmp-backend/core/src/main/java/eu/eudat/service/fielddatahelper/ValidationFieldDataHelperService.java create mode 100644 dmp-backend/web/src/main/java/eu/eudat/controllers/v2/DescriptionTemplateController.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/builders/entity/CredentialBuilder.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/utilities/interfaces/DatabaseDefinition.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/Rule.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/ViewStyle.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/datafield/ValidationData.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/entities/xmlmodels/datasetprofiledefinition/DatabaseViewStyleDefinition.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/entities/xmlmodels/modeldefinition/DatabaseModelDefinition.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/login/Credentials.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/login/LoginInfo.java create mode 100644 dmp-db-scema/updates/00.01.005_Align_DescriptionTemplatet_table.sql diff --git a/dmp-backend/core/src/main/java/eu/eudat/audit/AuditableAction.java b/dmp-backend/core/src/main/java/eu/eudat/audit/AuditableAction.java index bc17a621b..9bb65aee2 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/audit/AuditableAction.java +++ b/dmp-backend/core/src/main/java/eu/eudat/audit/AuditableAction.java @@ -31,4 +31,9 @@ public class AuditableAction { public static final EventId Dmp_Persist = new EventId(5002, "Dmp_Persist"); public static final EventId Dmp_Delete = new EventId(5003, "Dmp_Delete"); + public static final EventId DescriptionTemplate_Query = new EventId(6000, "DescriptionTemplate_Query"); + public static final EventId DescriptionTemplate_Lookup = new EventId(6001, "DescriptionTemplate_Lookup"); + public static final EventId DescriptionTemplate_Persist = new EventId(6002, "DescriptionTemplate_Persist"); + public static final EventId DescriptionTemplate_Delete = new EventId(6003, "DescriptionTemplate_Delete"); + } diff --git a/dmp-backend/core/src/main/java/eu/eudat/authorization/Permission.java b/dmp-backend/core/src/main/java/eu/eudat/authorization/Permission.java index 5937257bf..0e2c78393 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/authorization/Permission.java +++ b/dmp-backend/core/src/main/java/eu/eudat/authorization/Permission.java @@ -22,6 +22,11 @@ public final class Permission { //Language public static String BrowseStatistics = "BrowseStatistics"; public static String BrowsePublicStatistics = "BrowsePublicStatistics"; + + //DescriptionTemplate + public static String BrowseDescriptionTemplate = "BrowseDescriptionTemplate"; + public static String EditDescriptionTemplate = "EditDescriptionTemplate"; + public static String DeleteDescriptionTemplate = "DeleteDescriptionTemplate"; //DescriptionTemplateType public static String BrowseDescriptionTemplateType = "BrowseDescriptionTemplateType"; diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/XmlHandlingService.java b/dmp-backend/core/src/main/java/eu/eudat/commons/XmlHandlingService.java index a808c9ff7..b87b52851 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/XmlHandlingService.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/XmlHandlingService.java @@ -32,22 +32,6 @@ import java.io.StringWriter; @Scope(value = ConfigurableBeanFactory.SCOPE_SINGLETON) public class XmlHandlingService { - public String xmlSerializableToXml(XmlSerializable item) throws InvalidApplicationException, TransformerException, ParserConfigurationException { - Document document = this.getDocument(); - if (document == null) throw new InvalidApplicationException("Can not create document"); - document.appendChild(item.toXml(document)); - return this.generateXml(document); - } - - public String xmlSerializableToXmlSafe(XmlSerializable item) { - if (item == null) return null; - try { - return this.xmlSerializableToXml(item); - } catch (Exception ex) { - return null; - } - } - public String generateXml(Document doc) throws TransformerException { TransformerFactory tFact = TransformerFactory.newInstance(); Transformer trans = tFact.newTransformer(); @@ -60,7 +44,14 @@ public class XmlHandlingService { return writer.toString(); } - public String toXml(Object item) throws JsonProcessingException, JAXBException { + public String toXml(Object item) throws JsonProcessingException, JAXBException, ParserConfigurationException, InvalidApplicationException, TransformerException { + if (XmlSerializable.class.isAssignableFrom(item.getClass())){ + Document document = this.getDocument(); + if (document == null) throw new InvalidApplicationException("Can not create document"); + document.appendChild(((XmlSerializable)item).toXml(document)); + return this.generateXml(document); + } + JAXBContext context = JAXBContext.newInstance(item.getClass()); Marshaller marshaller = context.createMarshaller(); StringWriter out = new StringWriter(); @@ -77,11 +68,16 @@ public class XmlHandlingService { } } - public T fromXml(Class type, String xmlString) throws JAXBException { - JAXBContext jaxbContext = JAXBContext.newInstance(type); - Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); + public T fromXml(Class type, String xmlString) throws JAXBException, InstantiationException, IllegalAccessException, ParserConfigurationException, IOException, SAXException { + if (XmlSerializable.class.isAssignableFrom(type)){ + XmlSerializable object = (XmlSerializable)type.newInstance(); + return (T) object.fromXml(this.getDocument(xmlString).getDocumentElement()); + } else { + JAXBContext jaxbContext = JAXBContext.newInstance(type); + Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); - return (T) jaxbUnmarshaller.unmarshal(new StringReader(xmlString)); + return (T) jaxbUnmarshaller.unmarshal(new StringReader(xmlString)); + } } public T fromXmlSafe(Class type, String xmlString) { @@ -93,19 +89,19 @@ public class XmlHandlingService { } } - public > T xmlSerializableFromXml(Class type, String xmlString) throws JAXBException, InstantiationException, IllegalAccessException, ParserConfigurationException, IOException, SAXException { - T object = type.newInstance(); - return (T) object.fromXml(this.getDocument(xmlString).getDocumentElement()); - } - - public > T xmlSerializableFromXmlSafe(Class type, String xmlString) { - if (xmlString == null) return null; - try { - return this.xmlSerializableFromXml(type, xmlString); - } catch (Exception ex) { - return null; - } - } +// public > T xmlSerializableFromXml(Class type, String xmlString) throws JAXBException, InstantiationException, IllegalAccessException, ParserConfigurationException, IOException, SAXException { +// T object = type.newInstance(); +// return (T) object.fromXml(this.getDocument(xmlString).getDocumentElement()); +// } +// +// public > T xmlSerializableFromXmlSafe(Class type, String xmlString) { +// if (xmlString == null) return null; +// try { +// return this.xmlSerializableFromXml(type, xmlString); +// } catch (Exception ex) { +// return null; +// } +// } public Document getDocument(String xml) throws ParserConfigurationException, IOException, SAXException { DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/enums/DescriptionTemplateStatus.java b/dmp-backend/core/src/main/java/eu/eudat/commons/enums/DescriptionTemplateStatus.java new file mode 100644 index 000000000..fbecc1018 --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/enums/DescriptionTemplateStatus.java @@ -0,0 +1,30 @@ +package eu.eudat.commons.enums; + +import com.fasterxml.jackson.annotation.JsonValue; +import eu.eudat.data.converters.enums.DatabaseEnum; + +import java.util.Map; + +public enum DescriptionTemplateStatus implements DatabaseEnum { + + Draft((short) 0), + Finalized((short) 1); + + private final Short value; + + DescriptionTemplateStatus(Short value) { + this.value = value; + } + + @JsonValue + public Short getValue() { + return value; + } + + private static final Map map = EnumUtils.getEnumValueMap(DescriptionTemplateStatus.class); + + public static DescriptionTemplateStatus of(Short i) { + return map.get(i); + } + +} diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldDataComboBoxType.java b/dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldDataComboBoxType.java new file mode 100644 index 000000000..d60621343 --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldDataComboBoxType.java @@ -0,0 +1,27 @@ +package eu.eudat.commons.enums; + +import com.fasterxml.jackson.annotation.JsonValue; +import eu.eudat.data.converters.enums.DatabaseEnum; + +import java.util.Map; + +public enum FieldDataComboBoxType implements DatabaseEnum { + Autocomplete("autocomplete"), + Wordlist("wordlist"); + private final String value; + + FieldDataComboBoxType(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + private static final Map map = EnumUtils.getEnumValueMap(FieldDataComboBoxType.class); + + public static FieldDataComboBoxType of(String i) { + return map.get(i); + } +} diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldDataExternalDatasetType.java b/dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldDataExternalDatasetType.java new file mode 100644 index 000000000..d2b75a913 --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldDataExternalDatasetType.java @@ -0,0 +1,28 @@ +package eu.eudat.commons.enums; + +import com.fasterxml.jackson.annotation.JsonValue; +import eu.eudat.data.converters.enums.DatabaseEnum; + +import java.util.Map; + +public enum FieldDataExternalDatasetType implements DatabaseEnum { + ReusedDataset("reused_dataset"), + ProducedDataset("produced_dataset"), + Other("other"); + private final String value; + + FieldDataExternalDatasetType(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + private static final Map map = EnumUtils.getEnumValueMap(FieldDataExternalDatasetType.class); + + public static FieldDataExternalDatasetType of(String i) { + return map.get(i); + } +} diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldDataInternalDmpEntryType.java b/dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldDataInternalDmpEntryType.java new file mode 100644 index 000000000..2281f0eb6 --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldDataInternalDmpEntryType.java @@ -0,0 +1,28 @@ +package eu.eudat.commons.enums; + +import com.fasterxml.jackson.annotation.JsonValue; +import eu.eudat.data.converters.enums.DatabaseEnum; + +import java.util.Map; + +public enum FieldDataInternalDmpEntryType implements DatabaseEnum { + Researchers("researchers"), + Dmps("dmps"), + Datasets("datasets"); + private final String value; + + FieldDataInternalDmpEntryType(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + private static final Map map = EnumUtils.getEnumValueMap(FieldDataInternalDmpEntryType.class); + + public static FieldDataInternalDmpEntryType of(String i) { + return map.get(i); + } +} diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldType.java b/dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldType.java new file mode 100644 index 000000000..04efa40c0 --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldType.java @@ -0,0 +1,50 @@ +package eu.eudat.commons.enums; + +import com.fasterxml.jackson.annotation.JsonValue; +import eu.eudat.data.converters.enums.DatabaseEnum; + +import java.util.Map; + +public enum FieldType implements DatabaseEnum { + COMBO_BOX("combobox"), + BOOLEAN_DECISION("booleanDecision"), + RADIO_BOX("radiobox"), + INTERNAL_DMP_ENTRIES("internalDmpEntities"), + CHECK_BOX("checkBox"), + FREE_TEXT("freetext"), + TEXT_AREA("textarea"), + RICH_TEXT_AREA("richTextarea"), + UPLOAD("upload"), + DATE_PICKER("datePicker"), + EXTERNAL_DATASETS("externalDatasets"), + DATA_REPOSITORIES("dataRepositories"), + JOURNAL_REPOSITORIES("journalRepositories"), + PUB_REPOSITORIES("pubRepositories"), + LICENSES("licenses"), + TAXONOMIES("taxonomies"), + PUBLICATIONS("publications"), + REGISTRIES("registries"), + SERVICES("services"), + TAGS("tags"), + RESEARCHERS("researchers"), + ORGANIZATIONS("organizations"), + DATASET_IDENTIFIER("datasetIdentifier"), + CURRENCY("currency"), + VALIDATION("validation");; + private final String value; + + FieldType(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + private static final Map map = EnumUtils.getEnumValueMap(FieldType.class); + + public static FieldType of(String i) { + return map.get(i); + } +} diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldValidationType.java b/dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldValidationType.java new file mode 100644 index 000000000..fb74fb142 --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/enums/FieldValidationType.java @@ -0,0 +1,33 @@ +package eu.eudat.commons.enums; + +import com.fasterxml.jackson.annotation.JsonValue; +import eu.eudat.data.converters.enums.DatabaseEnum; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public enum FieldValidationType implements DatabaseEnum { + + None((short) 0), + Required((short) 1), + Url((short) 2); + + private final Short value; + + FieldValidationType(Short value) { + this.value = value; + } + + @JsonValue + public Short getValue() { + return value; + } + + private static final Map map = EnumUtils.getEnumValueMap(FieldValidationType.class); + + public static FieldValidationType of(Short i) { + return map.get(i); + } + +} \ No newline at end of file diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/common/DatabaseDefinition.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/common/DatabaseDefinition.java new file mode 100644 index 000000000..10d336fd0 --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/common/DatabaseDefinition.java @@ -0,0 +1,5 @@ +package eu.eudat.commons.types.common; + + +public interface DatabaseDefinition { +} diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/common/DatabaseModelDefinition.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/common/DatabaseModelDefinition.java new file mode 100644 index 000000000..f8d64308f --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/common/DatabaseModelDefinition.java @@ -0,0 +1,7 @@ +package eu.eudat.commons.types.common; + +import eu.eudat.commons.types.common.DatabaseDefinition; + +public interface DatabaseModelDefinition extends DatabaseDefinition { + +} diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/common/DatabaseViewStyleDefinition.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/common/DatabaseViewStyleDefinition.java new file mode 100644 index 000000000..7aa75c2d8 --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/common/DatabaseViewStyleDefinition.java @@ -0,0 +1,7 @@ +package eu.eudat.commons.types.common; + +import eu.eudat.commons.types.common.DatabaseDefinition; + +public interface DatabaseViewStyleDefinition extends DatabaseDefinition { + +} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/entities/xmlmodels/datasetprofiledefinition/ViewStyleModel.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/DefinitionEntity.java similarity index 63% rename from dmp-backend/web/src/main/java/eu/eudat/models/data/entities/xmlmodels/datasetprofiledefinition/ViewStyleModel.java rename to dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/DefinitionEntity.java index cc98dbbb2..8d4a8b12f 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/entities/xmlmodels/datasetprofiledefinition/ViewStyleModel.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/DefinitionEntity.java @@ -1,4 +1,4 @@ -package eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition; +package eu.eudat.commons.types.descriptiontemplate; import eu.eudat.commons.types.xml.XmlBuilder; import eu.eudat.commons.types.xml.XmlSerializable; @@ -10,24 +10,24 @@ import org.w3c.dom.NodeList; import java.util.LinkedList; import java.util.List; -public class ViewStyleModel implements XmlSerializable { - private List
sections; - private List pages; +public class DefinitionEntity implements XmlSerializable { + private List sections; + private List pages; - public List
getSections() { + public List getSections() { return sections; } - public void setSections(List
sections) { + public void setSections(List sections) { this.sections = sections; } - public List getPages() { + public List getPages() { return pages; } - public void setPages(List pages) { - this.pages = pages; + public void setPages(List pageEntities) { + this.pages = pageEntities; } @Override @@ -35,13 +35,13 @@ public class ViewStyleModel implements XmlSerializable { Element root = doc.createElement("root"); Element sections = doc.createElement("sections"); Element pages = doc.createElement("pages"); - for (Section section : this.sections) { - section.setNumbering("" + (this.sections.indexOf(section) + 1)); - sections.appendChild(section.toXml(doc)); + for (SectionEntity sectionEntity : this.sections) { + sectionEntity.setNumbering("" + (this.sections.indexOf(sectionEntity) + 1)); + sections.appendChild(sectionEntity.toXml(doc)); } - for (Page page : this.pages) { - pages.appendChild(page.toXml(doc)); + for (PageEntity pageEntity : this.pages) { + pages.appendChild(pageEntity.toXml(doc)); } root.appendChild(pages); @@ -50,7 +50,7 @@ public class ViewStyleModel implements XmlSerializable { } @Override - public ViewStyleModel fromXml(Element element) { + public DefinitionEntity fromXml(Element element) { this.sections = new LinkedList(); Element sections = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "sections"); @@ -59,7 +59,7 @@ public class ViewStyleModel implements XmlSerializable { for (int temp = 0; temp < sectionElements.getLength(); temp++) { Node sectionElement = sectionElements.item(temp); if (sectionElement.getNodeType() == Node.ELEMENT_NODE) { - this.sections.add(new Section().fromXml((Element) sectionElement)); + this.sections.add(new SectionEntity().fromXml((Element) sectionElement)); } } } @@ -70,7 +70,7 @@ public class ViewStyleModel implements XmlSerializable { for (int temp = 0; temp < pagesElements.getLength(); temp++) { Node pageElement = pagesElements.item(temp); if (pageElement.getNodeType() == Node.ELEMENT_NODE) { - this.pages.add(new Page().fromXml((Element) pageElement)); + this.pages.add(new PageEntity().fromXml((Element) pageElement)); } } } diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/entities/xmlmodels/datasetprofiledefinition/Field.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/FieldEntity.java similarity index 59% rename from dmp-backend/web/src/main/java/eu/eudat/models/data/entities/xmlmodels/datasetprofiledefinition/Field.java rename to dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/FieldEntity.java index 271f78e35..9f3ec2064 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/entities/xmlmodels/datasetprofiledefinition/Field.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/FieldEntity.java @@ -1,11 +1,11 @@ -package eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition; +package eu.eudat.commons.types.descriptiontemplate; -import eu.eudat.models.data.components.commons.DefaultValue; -import eu.eudat.models.data.components.commons.ViewStyle; -import eu.eudat.models.data.components.commons.Visibility; -import eu.eudat.models.data.components.commons.datafield.FieldData; +import eu.eudat.commons.enums.FieldValidationType; +import eu.eudat.commons.enums.FieldType; +import eu.eudat.commons.types.common.DatabaseViewStyleDefinition; +import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity; +import eu.eudat.commons.types.descriptiontemplate.fielddata.FieldDataHelper; import eu.eudat.commons.types.xml.XmlSerializable; -import eu.eudat.logic.utilities.builders.ModelBuilder; import eu.eudat.commons.types.xml.XmlBuilder; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -15,18 +15,17 @@ import org.w3c.dom.NodeList; import java.util.LinkedList; import java.util.List; -public class Field implements DatabaseViewStyleDefinition, XmlSerializable { +public class FieldEntity implements DatabaseViewStyleDefinition, XmlSerializable { private String id; private int ordinal; private List schematics; private String numbering; - private ViewStyle viewStyle; - private DefaultValue defaultValue; - private Visibility visible; - private FieldData data; - private List validations; - - private Boolean export; + private String defaultValue; + private List visibilityRules; + private BaseFieldDataEntity data; + private List validations; + private FieldType fieldType; + private Boolean includeInExport; public String getId() { return id; @@ -49,38 +48,33 @@ public class Field implements DatabaseViewStyleDefinition, XmlSerializable getData() { return data; } - public void setData(FieldData data) { + public void setData(BaseFieldDataEntity data) { this.data = data; } - public DefaultValue getDefaultValue() { + public FieldType getFieldType() { + return fieldType; + } + + public void setFieldType(FieldType fieldType) { + this.fieldType = fieldType; + } + + public String getDefaultValue() { return defaultValue; } - public void setDefaultValue(DefaultValue defaultValue) { + public void setDefaultValue(String defaultValue) { this.defaultValue = defaultValue; } - public Visibility getVisible() { - return visible; - } - public void setVisible(Visibility visible) { - this.visible = visible; - } - public List getValidations() { + public List getValidations() { return validations; } - public void setValidations(List validations) { + public void setValidations(List validations) { this.validations = validations; } @@ -91,12 +85,20 @@ public class Field implements DatabaseViewStyleDefinition, XmlSerializable getVisibilityRules() { + return visibilityRules; + } + + public void setVisibilityRules(List visibilityRules) { + this.visibilityRules = visibilityRules; } @Override @@ -115,17 +117,19 @@ public class Field implements DatabaseViewStyleDefinition, XmlSerializable(); @@ -193,16 +199,16 @@ public class Field implements DatabaseViewStyleDefinition, XmlSerializable { +public class FieldSetEntity implements DatabaseViewStyleDefinition, XmlSerializable { private String id; private int ordinal; - private List fields; + private List fields; private String numbering; private String title; private String description; private String extendedDescription; private String additionalInformation; - private Multiplicity multiplicity; + private MultiplicityEntity multiplicity; private boolean hasCommentField; - private String commentFieldValue; + private String commentFieldValue; //TODO: DescriptionTemplate - public List getFields() { + public List getFields() { return fields; } - public void setFields(List fields) { - this.fields = fields; + public void setFields(List fieldEntities) { + this.fields = fieldEntities; } public String getId() { @@ -66,10 +66,10 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable { +public class PageEntity implements DatabaseViewStyleDefinition, XmlSerializable { private String id; private int ordinal; private String title; @@ -44,7 +45,7 @@ public class Page implements DatabaseViewStyleDefinition, XmlSerializable } @Override - public Page fromXml(Element item) { + public PageEntity fromXml(Element item) { this.ordinal = Integer.parseInt(item.getAttribute("ordinal")); this.id = item.getAttribute("id"); this.title = item.getAttribute("title"); diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/RuleEntity.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/RuleEntity.java new file mode 100644 index 000000000..6740f18ad --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/RuleEntity.java @@ -0,0 +1,52 @@ +package eu.eudat.commons.types.descriptiontemplate; + +import eu.eudat.commons.types.xml.XmlSerializable; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +public class RuleEntity implements XmlSerializable { + private String target; + private String value; + + public String getTarget() { + return target; + } + + public void setTarget(String target) { + this.target = target; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + @Override + public Element toXml(Document doc) { + Element rule = doc.createElement("rule"); + rule.setAttribute("target", this.target); + + Element value = doc.createElement("value"); + value.setTextContent(this.value); + + rule.appendChild(value); + return rule; + } + + @Override + public RuleEntity fromXml(Element item) { + this.target = item.getAttribute("target"); + + Element value = (Element) item.getElementsByTagName("value").item(0); + if (value != null) { + this.value = value.getTextContent(); + } + + return this; + } + + +} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/entities/xmlmodels/datasetprofiledefinition/Section.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/SectionEntity.java similarity index 80% rename from dmp-backend/web/src/main/java/eu/eudat/models/data/entities/xmlmodels/datasetprofiledefinition/Section.java rename to dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/SectionEntity.java index 6e4b28a9f..a38831b5b 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/entities/xmlmodels/datasetprofiledefinition/Section.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/SectionEntity.java @@ -1,5 +1,6 @@ -package eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition; +package eu.eudat.commons.types.descriptiontemplate; +import eu.eudat.commons.types.common.DatabaseViewStyleDefinition; import eu.eudat.commons.types.xml.XmlBuilder; import eu.eudat.commons.types.xml.XmlSerializable; import org.w3c.dom.Document; @@ -10,7 +11,7 @@ import org.w3c.dom.NodeList; import java.util.LinkedList; import java.util.List; -public class Section implements DatabaseViewStyleDefinition, XmlSerializable
{ +public class SectionEntity implements DatabaseViewStyleDefinition, XmlSerializable { private String id; private int ordinal; private boolean defaultVisibility; @@ -19,8 +20,8 @@ public class Section implements DatabaseViewStyleDefinition, XmlSerializable sections; - private List
fieldSets; + private List sections; + private List fieldSets; private Boolean multiplicity; public String getId() { @@ -71,20 +72,20 @@ public class Section implements DatabaseViewStyleDefinition, XmlSerializable getSections() { + public List getSections() { return sections; } - public void setSections(List
sections) { + public void setSections(List sections) { this.sections = sections; } - public List
getFieldSets() { + public List getFieldSets() { return fieldSets; } - public void setFieldSets(List
fieldSets) { - this.fieldSets = fieldSets; + public void setFieldSets(List fieldSetEntities) { + this.fieldSets = fieldSetEntities; } public String getExtendedDescription() { @@ -134,18 +135,18 @@ public class Section implements DatabaseViewStyleDefinition, XmlSerializable(); + this.sections = new LinkedList(); Element sections = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "sections"); if (sections != null) { NodeList sectionElements = sections.getChildNodes(); for (int temp = 0; temp < sectionElements.getLength(); temp++) { Node sectionElement = sectionElements.item(temp); if (sectionElement.getNodeType() == Node.ELEMENT_NODE) { - this.sections.add(new Section().fromXml((Element) sectionElement)); + this.sections.add(new SectionEntity().fromXml((Element) sectionElement)); } } } - this.fieldSets = new LinkedList
(); + this.fieldSets = new LinkedList(); Element fieldGroups = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "fieldSets"); if (fieldGroups != null) { @@ -199,7 +200,7 @@ public class Section implements DatabaseViewStyleDefinition, XmlSerializable { +public class AutoCompleteDataEntity extends ComboBoxDataEntity { public static class AuthAutoCompleteData { private String url; @@ -59,19 +62,19 @@ public class AutoCompleteData extends ComboBoxData { } } public static class AutoCompleteSingleData { - private int autocompleteType; + private AutocompleteType autocompleteType; private String url; - private ComboBoxData.Option autoCompleteOptions; + private ComboBoxDataEntity.Option autoCompleteOptions; private String optionsRoot; private Boolean hasAuth; private AuthAutoCompleteData auth; private String method; - public int getAutocompleteType() { + public AutocompleteType getAutocompleteType() { return autocompleteType; } - public void setAutocompleteType(int autocompleteType) { + public void setAutocompleteType(AutocompleteType autocompleteType) { this.autocompleteType = autocompleteType; } @@ -105,10 +108,10 @@ public class AutoCompleteData extends ComboBoxData { this.auth = auth; } - public ComboBoxData.Option getAutoCompleteOptions() { + public ComboBoxDataEntity.Option getAutoCompleteOptions() { return autoCompleteOptions; } - public void setAutoCompleteOptions(ComboBoxData.Option autoCompleteOptions) { + public void setAutoCompleteOptions(ComboBoxDataEntity.Option autoCompleteOptions) { this.autoCompleteOptions = autoCompleteOptions; } @@ -144,7 +147,7 @@ public class AutoCompleteData extends ComboBoxData { Element parent = doc.createElement("autocompleteSingle"); parent.setAttribute("url", singleData.url); parent.setAttribute("optionsRoot", singleData.optionsRoot); - parent.setAttribute("autoCompleteType", Integer.toString(singleData.autocompleteType)); + parent.setAttribute("autoCompleteType", Integer.toString(singleData.autocompleteType.getValue())); parent.setAttribute("hasAuth", Boolean.toString(singleData.hasAuth)); parent.setAttribute("method", singleData.method); Element element = doc.createElement("option"); @@ -167,7 +170,7 @@ public class AutoCompleteData extends ComboBoxData { } @Override - public AutoCompleteData fromXml(Element item) { + public AutoCompleteDataEntity fromXml(Element item) { super.fromXml(item); this.autoCompleteSingleDataList = new ArrayList<>(); NodeList items = item.getElementsByTagName("autocompleteSingle"); @@ -190,9 +193,9 @@ public class AutoCompleteData extends ComboBoxData { singleData.optionsRoot = item.getAttribute("optionsRoot"); this.multiAutoComplete = Boolean.parseBoolean(item.getAttribute("multiAutoComplete")); if (item.getAttribute("autoCompleteType") == null || item.getAttribute("autoCompleteType").equals("") ) { - singleData.autocompleteType = AutocompleteType.UNCACHED.getValue(); + singleData.autocompleteType = AutocompleteType.UNCACHED; } else { - singleData.autocompleteType = AutocompleteType.fromValue(Integer.parseInt(item.getAttribute("autoCompleteType"))).getValue(); + singleData.autocompleteType = AutocompleteType.of(Integer.parseInt(item.getAttribute("autoCompleteType"))); } singleData.hasAuth = Boolean.parseBoolean(item.getAttribute("hasAuth")); singleData.method = item.hasAttribute("method") ? item.getAttribute("method") : "GET"; @@ -218,7 +221,7 @@ public class AutoCompleteData extends ComboBoxData { } @Override - public AutoCompleteData fromData(Object data) { + public AutoCompleteDataEntity fromData(Object data) { super.fromData(data); this.autoCompleteSingleDataList = new ArrayList<>(); @@ -244,9 +247,9 @@ public class AutoCompleteData extends ComboBoxData { this.autoCompleteSingleDataList.get(i).method = singleData.containsKey("method") ? (String) singleData.get("method") : "GET"; if (singleData.get("autoCompleteType") == null) { - this.autoCompleteSingleDataList.get(i).autocompleteType = AutocompleteType.UNCACHED.getValue(); + this.autoCompleteSingleDataList.get(i).autocompleteType = AutocompleteType.UNCACHED; } else { - this.autoCompleteSingleDataList.get(i).autocompleteType = AutocompleteType.fromValue((Integer) singleData.get("autoCompleteType")).getValue(); + this.autoCompleteSingleDataList.get(i).autocompleteType = AutocompleteType.of((Integer) singleData.get("autoCompleteType")); } Map options = (Map) singleData.get("autoCompleteOptions"); if (options != null) { @@ -354,26 +357,25 @@ public class AutoCompleteData extends ComboBoxData { return dataMap; } - public enum AutocompleteType { - UNCACHED(0), CACHED(1); + public enum AutocompleteType implements DatabaseEnum { + UNCACHED(0), + CACHED(1); - int value; + private final int value; AutocompleteType(int value) { this.value = value; } - public int getValue() { - return this.value; + @JsonValue + public Integer getValue() { + return value; } - public static AutocompleteType fromValue(int value) { - for (AutocompleteType type: AutocompleteType.values()) { - if (type.getValue() == value) { - return type; - } - } - return UNCACHED; + private static final Map map = EnumUtils.getEnumValueMap(AutocompleteType.class); + + public static AutocompleteType of(int i) { + return map.get(i); } } } diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/datafield/FieldData.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/BaseFieldDataEntity.java similarity index 64% rename from dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/datafield/FieldData.java rename to dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/BaseFieldDataEntity.java index eafde3782..e0ead5a54 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/datafield/FieldData.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/BaseFieldDataEntity.java @@ -1,4 +1,4 @@ -package eu.eudat.models.data.components.commons.datafield; +package eu.eudat.commons.types.descriptiontemplate.fielddata; import eu.eudat.commons.types.xml.XmlSerializable; import org.w3c.dom.Document; @@ -6,8 +6,9 @@ import org.w3c.dom.Element; import java.util.Map; -public abstract class FieldData implements XmlSerializable { +public abstract class BaseFieldDataEntity implements XmlSerializable { private String label; + private String subType; public String getLabel() { return label; @@ -17,6 +18,14 @@ public abstract class FieldData implements XmlSerializable { this.label = label; } + public String getSubType() { + return subType; + } + + public void setSubType(String subType) { + this.subType = subType; + } + public T fromData(Object data) { return null; } @@ -29,9 +38,5 @@ public abstract class FieldData implements XmlSerializable { return null; } - public T fromXml(Element item) { - return null; - } - public abstract Map toMap(Element item); } diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/datafield/BooleanDecisionData.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/BooleanDecisionDataEntity.java similarity index 75% rename from dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/datafield/BooleanDecisionData.java rename to dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/BooleanDecisionDataEntity.java index 1f0f24cf5..ee37fbcd9 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/datafield/BooleanDecisionData.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/BooleanDecisionDataEntity.java @@ -1,4 +1,4 @@ -package eu.eudat.models.data.components.commons.datafield; +package eu.eudat.commons.types.descriptiontemplate.fielddata; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -6,10 +6,10 @@ import org.w3c.dom.Element; import java.util.HashMap; import java.util.Map; -public class BooleanDecisionData extends FieldData { +public class BooleanDecisionDataEntity extends BaseFieldDataEntity { @Override - public BooleanDecisionData fromData(Object data) { + public BooleanDecisionDataEntity fromData(Object data) { if (data != null) { this.setLabel((String) ((Map) data).get("label")); } @@ -29,7 +29,7 @@ public class BooleanDecisionData extends FieldData { } @Override - public BooleanDecisionData fromXml(Element item) { + public BooleanDecisionDataEntity fromXml(Element item) { this.setLabel(item.getAttribute("label")); return this; } diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/datafield/CheckBoxData.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/CheckBoxDataEntity.java similarity index 78% rename from dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/datafield/CheckBoxData.java rename to dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/CheckBoxDataEntity.java index ca00ecf5b..b6cdb3c04 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/datafield/CheckBoxData.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/CheckBoxDataEntity.java @@ -1,4 +1,4 @@ -package eu.eudat.models.data.components.commons.datafield; +package eu.eudat.commons.types.descriptiontemplate.fielddata; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -6,7 +6,7 @@ import org.w3c.dom.Element; import java.util.HashMap; import java.util.Map; -public class CheckBoxData extends FieldData { +public class CheckBoxDataEntity extends BaseFieldDataEntity { @Override public Element toXml(Document doc) { @@ -16,13 +16,13 @@ public class CheckBoxData extends FieldData { } @Override - public CheckBoxData fromXml(Element item) { + public CheckBoxDataEntity fromXml(Element item) { this.setLabel(item != null ? item.getAttribute("label") : ""); return this; } @Override - public CheckBoxData fromData(Object data) { + public CheckBoxDataEntity fromData(Object data) { if (data != null) { this.setLabel((String) ((Map) data).get("label")); } diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/datafield/ComboBoxData.java b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/ComboBoxDataEntity.java similarity index 79% rename from dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/datafield/ComboBoxData.java rename to dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/ComboBoxDataEntity.java index 4d6e2cb3f..3695a68c9 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/datafield/ComboBoxData.java +++ b/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/ComboBoxDataEntity.java @@ -1,5 +1,6 @@ -package eu.eudat.models.data.components.commons.datafield; +package eu.eudat.commons.types.descriptiontemplate.fielddata; +import eu.eudat.commons.enums.FieldDataComboBoxType; import eu.eudat.commons.types.xml.XmlSerializable; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -7,7 +8,7 @@ import org.w3c.dom.Element; import java.util.HashMap; import java.util.Map; -public abstract class ComboBoxData extends FieldData { +public abstract class ComboBoxDataEntity extends BaseFieldDataEntity { public static class Option implements XmlSerializable