From e2f330de47145be227074ed8be3565efc8f8f1b4 Mon Sep 17 00:00:00 2001 From: sgiannopoulos Date: Thu, 4 Jul 2024 16:44:30 +0300 Subject: [PATCH 1/6] migration fix --- .../java/eu/old/eudat/migration/DatasetMigrationService.java | 1 + 1 file changed, 1 insertion(+) diff --git a/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DatasetMigrationService.java b/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DatasetMigrationService.java index d7125f5e7..172310e31 100644 --- a/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DatasetMigrationService.java +++ b/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DatasetMigrationService.java @@ -179,6 +179,7 @@ public class DatasetMigrationService { if (data.getCreatedById() == null){ throw new MyApplicationException("Migration skipped creator not found " + item.getId()); } + if (data.getFinalizedAt() == null && data.getStatus().equals(DescriptionStatus.Finalized)) data.setFinalizedAt(data.getUpdatedAt()); org.opencdmp.commons.types.descriptiontemplate.DefinitionEntity descriptionTemplateDefinitionEntity = descriptionTemplateDefinitionMap.getOrDefault(profileId, null); this.entityManager.persist(data); From a6ecac7524a70767f2f559d0e80f163c191eea0a Mon Sep 17 00:00:00 2001 From: amentis Date: Thu, 4 Jul 2024 16:48:22 +0300 Subject: [PATCH 2/6] rename backend dmp to plan (in progress) --- .../org/opencdmp/audit/AuditableAction.java | 56 +- .../authorization/AffiliatedResource.java | 14 +- .../opencdmp/authorization/Permission.java | 74 +- .../AuthorizationContentResolver.java | 4 +- .../AuthorizationContentResolverImpl.java | 64 +- .../commons/enums/ActionConfirmationType.java | 2 +- .../enums/DmpBlueprintExtraFieldDataType.java | 45 - ...DmpAccessType.java => PlanAccessType.java} | 8 +- .../PlanBlueprintExtraFieldDataType.java | 45 + ...y.java => PlanBlueprintFieldCategory.java} | 8 +- ...ntStatus.java => PlanBlueprintStatus.java} | 8 +- ...java => PlanBlueprintSystemFieldType.java} | 8 +- ...s.java => PlanBlueprintVersionStatus.java} | 8 +- .../enums/{DmpStatus.java => PlanStatus.java} | 8 +- .../{DmpUserRole.java => PlanUserRole.java} | 8 +- ...nOutput.java => PlanValidationOutput.java} | 8 +- ...sionStatus.java => PlanVersionStatus.java} | 8 +- .../commons/enums/RecentActivityItemType.java | 2 +- ...nEntity.java => PlanInvitationEntity.java} | 20 +- .../types/dmp/DmpPropertiesEntity.java | 27 - .../types/dmpblueprint/ExtraFieldEntity.java | 23 - .../PlanBlueprintValueEntity.java} | 4 +- .../PlanContactEntity.java} | 4 +- .../types/plan/PlanPropertiesEntity.java | 27 + .../PlanBlueprintValueImportExport.java} | 4 +- .../PlanContactImportExport.java} | 4 +- .../PlanDescriptionTemplateImportExport.java} | 4 +- .../importexport/PlanImportExport.java} | 44 +- .../PlanReferenceImportExport.java} | 10 +- .../PlanReferenceTypeImportExport.java} | 6 +- .../importexport/PlanUserImportExport.java} | 12 +- .../DefinitionEntity.java | 2 +- .../DescriptionTemplateEntity.java | 2 +- .../types/planblueprint/ExtraFieldEntity.java | 21 + .../FieldEntity.java | 10 +- .../ReferenceTypeFieldEntity.java | 2 +- .../SectionEntity.java | 10 +- .../SystemFieldEntity.java | 10 +- .../BlueprintDefinitionImportExport.java | 2 +- ...eprintDescriptionTemplateImportExport.java | 2 +- .../BlueprintExtraFieldImportExport.java | 10 +- .../importexport/BlueprintImportExport.java | 12 +- ...BlueprintPrefillingSourceImportExport.java | 2 +- ...ueprintReferenceTypeFieldImportExport.java | 2 +- .../BlueprintSectionImportExport.java | 2 +- .../BlueprintSystemFieldImportExport.java | 10 +- .../PlanReferenceDataEntity.java} | 4 +- .../org/opencdmp/data/DescriptionEntity.java | 24 +- ...ntEntity.java => PlanBlueprintEntity.java} | 28 +- ...ava => PlanDescriptionTemplateEntity.java} | 14 +- .../data/{DmpEntity.java => PlanEntity.java} | 38 +- ...ceEntity.java => PlanReferenceEntity.java} | 14 +- ...DmpUserEntity.java => PlanUserEntity.java} | 26 +- .../DmpBlueprintVersionStatusConverter.java | 15 - .../PlanBlueprintVersionStatusConverter.java | 15 + .../enums/DmpAccessTypeNullableConverter.java | 25 - .../enums/DmpBlueprintStatusConverter.java | 12 - .../converters/enums/DmpStatusConverter.java | 14 - .../enums/DmpUserRoleConverter.java | 14 - .../enums/DmpVersionStatusConverter.java | 14 - .../PlanAccessTypeNullableConverter.java | 25 + .../enums/PlanBlueprintStatusConverter.java | 11 + .../converters/enums/PlanStatusConverter.java | 14 + .../enums/PlanUserRoleConverter.java | 14 + .../enums/PlanVersionStatusConverter.java | 14 + .../elastic/ElasticConfiguration.java | 19 +- .../DescriptionStatusToShortConverter.java | 1 - .../converter/IsActiveToShortConverter.java | 1 - ...va => PlanAccessTypeToShortConverter.java} | 6 +- ...r.java => PlanStatusToShortConverter.java} | 6 +- ...java => PlanUserRoleToShortConverter.java} | 6 +- ...=> PlanVersionStatusToShortConverter.java} | 6 +- .../ShortToDmpAccessTypeConverter.java | 14 - .../ShortToDmpUserRoleConverter.java | 14 - .../ShortToDmpVersionStatusConverter.java | 14 - .../ShortToPlanAccessTypeConverter.java | 13 + ...r.java => ShortToPlanStatusConverter.java} | 6 +- .../ShortToPlanUserRoleConverter.java | 13 + .../ShortToPlanVersionStatusConverter.java | 13 + .../data/DescriptionElasticEntity.java | 8 +- ...sticEntity.java => PlanElasticEntity.java} | 74 +- .../NestedCollaboratorElasticEntity.java | 8 +- .../NestedDescriptionElasticEntity.java | 10 +- ...PlanDescriptionTemplateElasticEntity.java} | 18 +- ...tity.java => NestedPlanElasticEntity.java} | 55 +- .../DescriptionElasticBuilder.java | 22 +- ...icBuilder.java => PlanElasticBuilder.java} | 74 +- .../NestedCollaboratorElasticBuilder.java | 10 +- .../NestedDescriptionElasticBuilder.java | 2 +- ...lanDescriptionTemplateElasticBuilder.java} | 20 +- ...der.java => NestedPlanElasticBuilder.java} | 64 +- .../query/DescriptionElasticQuery.java | 30 +- .../elastic/query/DmpElasticQuery.java | 403 ------ .../query/InnerObjectDmpElasticQuery.java | 112 +- .../query/NestedCollaboratorElasticQuery.java | 14 +- .../query/NestedDescriptionElasticQuery.java | 2 +- ...tedDmpDescriptionTemplateElasticQuery.java | 199 --- ...edPlanDescriptionTemplateElasticQuery.java | 199 +++ .../elastic/query/PlanElasticQuery.java | 403 ++++++ .../java/org/opencdmp/event/EventBroker.java | 2 +- ...ouchedEvent.java => PlanTouchedEvent.java} | 6 +- ...ityCreatedIntegrationEventHandlerImpl.java | 8 +- ...ityChangedIntegrationEventHandlerImpl.java | 8 +- ...nEntityRemovalIntegrationEventHandler.java | 2 +- ...ityRemovalIntegrationEventHandlerImpl.java | 14 +- ...nEntityTouchedIntegrationEventHandler.java | 2 +- ...ityTouchedIntegrationEventHandlerImpl.java | 22 +- ...iatedUser.java => PlanAssociatedUser.java} | 2 +- ...late.java => PlanDescriptionTemplate.java} | 16 +- .../model/{DmpUser.java => PlanUser.java} | 24 +- ...nResult.java => PlanValidationResult.java} | 14 +- .../org/opencdmp/model/PublicDescription.java | 24 +- .../model/PublicDmpDescriptionTemplate.java | 34 - .../model/{PublicDmp.java => PublicPlan.java} | 55 +- .../model/PublicPlanDescriptionTemplate.java | 31 + ...eference.java => PublicPlanReference.java} | 15 +- ...PublicDmpUser.java => PublicPlanUser.java} | 22 +- .../opencdmp/model/RecentActivityItem.java | 14 +- .../model/RecentActivityItemLookup.java | 46 +- .../ActionConfirmation.java | 10 +- .../actionconfirmation/DmpInvitation.java | 42 - .../actionconfirmation/PlanInvitation.java | 42 + ...er.java => PlanAssociatedUserBuilder.java} | 20 +- ...va => PlanDescriptionTemplateBuilder.java} | 82 +- ...pUserBuilder.java => PlanUserBuilder.java} | 78 +- .../builder/PublicDescriptionBuilder.java | 64 +- .../model/builder/PublicDmpBuilder.java | 194 --- .../model/builder/PublicPlanBuilder.java | 193 +++ ...PublicPlanDescriptionTemplateBuilder.java} | 54 +- ...r.java => PublicPlanReferenceBuilder.java} | 64 +- ...uilder.java => PublicPlanUserBuilder.java} | 64 +- .../builder/RecentActivityItemBuilder.java | 34 +- .../builder/SupportiveMaterialBuilder.java | 7 - .../ActionConfirmationBuilder.java | 8 +- ...uilder.java => PlanInvitationBuilder.java} | 27 +- ...r.java => PlanUserCommonModelBuilder.java} | 20 +- .../DescriptionCommonModelBuilder.java | 34 +- ...PlanBlueprintValueCommonModelBuilder.java} | 36 +- .../PlanCommonModelBuilder.java} | 122 +- .../PlanContactCommonModelBuilder.java} | 18 +- .../PlanPropertiesCommonModelBuilder.java} | 28 +- .../DefinitionCommonModelBuilder.java | 5 +- .../ExtraFieldCommonModelBuilder.java | 4 +- .../FieldCommonModelBuilder.java | 4 +- .../PlanBlueprintCommonModelBuilder.java} | 22 +- .../ReferenceTypeFieldCommonModelBuilder.java | 4 +- .../SectionCommonModelBuilder.java | 18 +- .../SystemFieldCommonModelBuilder.java | 4 +- .../PlanReferenceCommonModelBuilder.java} | 28 +- .../PlanReferenceDataCommonModelBuilder.java} | 18 +- .../description/DescriptionBuilder.java | 64 +- .../DescriptionTemplateBuilder.java | 4 +- .../model/builder/dmp/DmpBuilder.java | 344 ----- .../PlanBlueprintValueBuilder.java} | 50 +- .../model/builder/plan/PlanBuilder.java | 344 +++++ .../PlanContactBuilder.java} | 30 +- .../PlanPropertiesBuilder.java} | 36 +- .../DefinitionBuilder.java | 6 +- .../DescriptionTemplateBuilder.java | 6 +- .../ExtraFieldBuilder.java | 6 +- .../FieldBuilder.java | 6 +- .../PlanBlueprintBuilder.java} | 48 +- .../ReferenceFieldBuilder.java | 6 +- .../SectionBuilder.java | 20 +- .../SystemFieldBuilder.java | 6 +- .../PlanReferenceBuilder.java} | 84 +- .../PlanReferenceDataBuilder.java} | 27 +- .../builder/reference/ReferenceBuilder.java | 26 +- ...sor.java => PlanAssociatedUserCensor.java} | 8 +- ...ava => PlanDescriptionTemplateCensor.java} | 22 +- ...DmpUserCensor.java => PlanUserCensor.java} | 18 +- .../censorship/PublicDescriptionCensor.java | 4 +- ...icDmpCensor.java => PublicPlanCensor.java} | 26 +- ... PublicPlanDescriptionTemplateCensor.java} | 16 +- ...or.java => PublicPlanReferenceCensor.java} | 22 +- ...rCensor.java => PublicPlanUserCensor.java} | 14 +- .../censorship/PublicReferenceTypeCensor.java | 1 - .../censorship/RecentActivityItemCensor.java | 6 +- .../description/DescriptionCensor.java | 10 +- .../PlanBlueprintValueCensor.java} | 14 +- .../DmpCensor.java => plan/PlanCensor.java} | 38 +- .../PlanContactCensor.java} | 12 +- .../PlanPropertiesCensor.java} | 24 +- .../DefinitionCensor.java | 6 +- .../DescriptionTemplatesCensor.java | 4 +- .../FieldCensor.java | 4 +- .../PlanBlueprintCensor.java} | 18 +- .../SectionCensor.java | 6 +- .../PlanReferenceCensor.java} | 28 +- .../PlanReferenceDataCensor.java} | 12 +- .../censorship/reference/ReferenceCensor.java | 6 +- .../deleter/DescriptionTemplateDeleter.java | 6 - ...Deleter.java => PlanBlueprintDeleter.java} | 18 +- .../{DmpDeleter.java => PlanDeleter.java} | 46 +- ...va => PlanDescriptionTemplateDeleter.java} | 18 +- ...Deleter.java => PlanReferenceDeleter.java} | 18 +- ...pUserDeleter.java => PlanUserDeleter.java} | 18 +- .../model/deleter/ReferenceDeleter.java | 8 +- .../model/description/Description.java | 26 +- .../org/opencdmp/model/dmp/DmpProperties.java | 31 - .../model/dmpblueprint/ExtraField.java | 19 - .../model/dmpblueprint/SystemField.java | 17 - ...iptionToPublicApiDatasetListingMapper.java | 4 +- .../PlanToPublicApiPlanListingMapper.java | 22 +- .../publicapi/PlanToPublicApiPlanMapper.java | 38 +- .../persist/ActionConfirmationPersist.java | 28 +- ...eDmpPersist.java => ClonePlanPersist.java} | 22 +- .../model/persist/DescriptionPersist.java | 66 +- .../persist/DescriptionReferencePersist.java | 4 +- .../DescriptionSectionPermissionResolver.java | 16 +- .../DescriptionTemplateTypePersist.java | 3 - ...va => NewVersionPlanBlueprintPersist.java} | 40 +- ... => NewVersionPlanDescriptionPersist.java} | 20 +- ...ersist.java => NewVersionPlanPersist.java} | 40 +- ...Persist.java => PlanBlueprintPersist.java} | 46 +- ...Config.java => PlanCommonModelConfig.java} | 34 +- ...va => PlanDescriptionTemplatePersist.java} | 24 +- .../{DmpPersist.java => PlanPersist.java} | 146 +- ...Persist.java => PlanReferencePersist.java} | 34 +- ...ersist.java => PlanUserInvitePersist.java} | 28 +- ...pUserPersist.java => PlanUserPersist.java} | 35 +- ...ersist.java => PlanUserRemovePersist.java} | 44 +- .../DmpInvitationPersist.java | 96 -- .../PlanInvitationPersist.java | 96 ++ .../model/persist/deposit/DepositRequest.java | 16 +- .../ExtraFieldPersist.java | 8 +- .../dmpblueprintdefinition/FieldPersist.java | 8 +- .../SystemFieldPersist.java | 9 +- .../dmpproperties/DmpPropertiesPersist.java | 134 -- .../PlanBlueprintValuePersist.java} | 60 +- .../PlanContactPersist.java} | 27 +- .../planproperties/PlanPropertiesPersist.java | 134 ++ .../PlanReferenceDataPersist.java} | 21 +- .../model/{dmp/Dmp.java => plan/Plan.java} | 92 +- .../PlanBlueprintValue.java} | 4 +- .../DmpContact.java => plan/PlanContact.java} | 4 +- .../opencdmp/model/plan/PlanProperties.java | 31 + .../Definition.java | 2 +- .../DescriptionTemplate.java | 2 +- .../model/planblueprint/ExtraField.java | 19 + .../Field.java | 10 +- .../PlanBlueprint.java} | 21 +- .../ReferenceTypeField.java | 2 +- .../Section.java | 2 +- .../model/planblueprint/SystemField.java | 17 + .../PlanReference.java} | 24 +- .../PlanReferenceData.java} | 4 +- .../AssociatedProfilePublicModel.java | 18 +- .../grant/GrantPublicOverviewModel.java | 14 +- .../organisation/OrganizationPublicModel.java | 8 +- .../DataManagementPlanPublicModel.java | 4 +- .../researcher/ResearcherPublicModel.java | 10 +- .../publicapi/user/UserInfoPublicModel.java | 10 +- .../opencdmp/model/reference/Reference.java | 14 +- .../org/opencdmp/query/DescriptionQuery.java | 84 +- .../query/DescriptionTemplateQuery.java | 18 +- .../org/opencdmp/query/EntityDoiQuery.java | 4 +- ...rintQuery.java => PlanBlueprintQuery.java} | 168 +-- ...java => PlanDescriptionTemplateQuery.java} | 170 +-- .../query/{DmpQuery.java => PlanQuery.java} | 304 ++-- ...enceQuery.java => PlanReferenceQuery.java} | 130 +- .../{DmpUserQuery.java => PlanUserQuery.java} | 158 +- .../org/opencdmp/query/ReferenceQuery.java | 22 +- .../opencdmp/query/UserContactInfoQuery.java | 8 +- .../java/org/opencdmp/query/UserQuery.java | 22 +- .../query/lookup/DescriptionLookup.java | 12 +- ...ntLookup.java => PlanBlueprintLookup.java} | 24 +- ...ava => PlanDescriptionTemplateLookup.java} | 28 +- .../{DmpLookup.java => PlanLookup.java} | 86 +- ...ceLookup.java => PlanReferenceLookup.java} | 21 +- ...DmpUserLookup.java => PlanUserLookup.java} | 28 +- .../query/utils/QueryUtilsServiceImpl.java | 46 +- .../ActionConfirmationServiceImpl.java | 16 +- .../dashborad/DashboardServiceImpl.java | 38 +- .../service/deposit/DepositService.java | 2 +- .../service/deposit/DepositServiceImpl.java | 58 +- .../description/DescriptionService.java | 4 +- .../description/DescriptionServiceImpl.java | 134 +- .../org/opencdmp/service/dmp/DmpService.java | 65 - .../dmpblueprint/DmpBlueprintService.java | 47 - .../elastic/ElasticQueryHelperService.java | 10 +- .../ElasticQueryHelperServiceImpl.java | 34 +- .../service/elastic/ElasticService.java | 14 +- .../service/elastic/ElasticServiceImpl.java | 152 +- .../FileTransformerService.java | 4 +- .../FileTransformerServiceImpl.java | 46 +- .../service/language/LanguageServiceImpl.java | 4 +- .../maintenance/MaintenanceServiceImpl.java | 10 +- .../service/metrics/MetricsServiceImpl.java | 90 +- .../opencdmp/service/plan/PlanService.java | 65 + .../PlanServiceImpl.java} | 1288 ++++++++--------- .../planblueprint/PlanBlueprintService.java | 47 + .../PlanBlueprintServiceImpl.java} | 282 ++-- .../SupportiveMaterialServiceImpl.java | 4 +- .../service/user/UserServiceImpl.java | 16 +- .../AffiliatedAuthorizationHandler.java | 14 +- .../CustomPermissionAttributesProperties.java | 6 +- .../OwnedAuthorizationHandler.java | 4 - .../{DmpRole.java => PlanRole.java} | 10 +- .../controllers/DescriptionController.java | 14 +- .../DescriptionTemplateController.java | 8 +- .../controllers/MaintenanceController.java | 6 +- .../controllers/PlanBlueprintController.java | 124 +- .../opencdmp/controllers/PlanController.java | 242 ++-- .../opencdmp/controllers/UserController.java | 18 +- ...ublicDatasetsDescriptionDocumentation.java | 56 +- .../publicapi/PublicPlansDocumentation.java | 136 +- .../DataManagementPlanPublicCriteria.java | 4 +- .../DataManagmentPlanPublicTableRequest.java | 10 +- .../src/main/resources/config/permissions.yml | 72 +- 310 files changed, 6136 insertions(+), 6192 deletions(-) delete mode 100644 backend/core/src/main/java/org/opencdmp/commons/enums/DmpBlueprintExtraFieldDataType.java rename backend/core/src/main/java/org/opencdmp/commons/enums/{DmpAccessType.java => PlanAccessType.java} (62%) create mode 100644 backend/core/src/main/java/org/opencdmp/commons/enums/PlanBlueprintExtraFieldDataType.java rename backend/core/src/main/java/org/opencdmp/commons/enums/{DmpBlueprintFieldCategory.java => PlanBlueprintFieldCategory.java} (67%) rename backend/core/src/main/java/org/opencdmp/commons/enums/{DmpBlueprintStatus.java => PlanBlueprintStatus.java} (59%) rename backend/core/src/main/java/org/opencdmp/commons/enums/{DmpBlueprintSystemFieldType.java => PlanBlueprintSystemFieldType.java} (60%) rename backend/core/src/main/java/org/opencdmp/commons/enums/{DmpBlueprintVersionStatus.java => PlanBlueprintVersionStatus.java} (58%) rename backend/core/src/main/java/org/opencdmp/commons/enums/{DmpStatus.java => PlanStatus.java} (64%) rename backend/core/src/main/java/org/opencdmp/commons/enums/{DmpUserRole.java => PlanUserRole.java} (66%) rename backend/core/src/main/java/org/opencdmp/commons/enums/{DmpValidationOutput.java => PlanValidationOutput.java} (58%) rename backend/core/src/main/java/org/opencdmp/commons/enums/{DmpVersionStatus.java => PlanVersionStatus.java} (62%) rename backend/core/src/main/java/org/opencdmp/commons/types/actionconfirmation/{DmpInvitationEntity.java => PlanInvitationEntity.java} (60%) delete mode 100644 backend/core/src/main/java/org/opencdmp/commons/types/dmp/DmpPropertiesEntity.java delete mode 100644 backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/ExtraFieldEntity.java rename backend/core/src/main/java/org/opencdmp/commons/types/{dmp/DmpBlueprintValueEntity.java => plan/PlanBlueprintValueEntity.java} (90%) rename backend/core/src/main/java/org/opencdmp/commons/types/{dmp/DmpContactEntity.java => plan/PlanContactEntity.java} (88%) create mode 100644 backend/core/src/main/java/org/opencdmp/commons/types/plan/PlanPropertiesEntity.java rename backend/core/src/main/java/org/opencdmp/commons/types/{dmp/importexport/DmpBlueprintValueImportExport.java => plan/importexport/PlanBlueprintValueImportExport.java} (92%) rename backend/core/src/main/java/org/opencdmp/commons/types/{dmp/importexport/DmpContactImportExport.java => plan/importexport/PlanContactImportExport.java} (91%) rename backend/core/src/main/java/org/opencdmp/commons/types/{dmp/importexport/DmpDescriptionTemplateImportExport.java => plan/importexport/PlanDescriptionTemplateImportExport.java} (88%) rename backend/core/src/main/java/org/opencdmp/commons/types/{dmp/importexport/DmpImportExport.java => plan/importexport/PlanImportExport.java} (72%) rename backend/core/src/main/java/org/opencdmp/commons/types/{dmp/importexport/DmpReferenceImportExport.java => plan/importexport/PlanReferenceImportExport.java} (86%) rename backend/core/src/main/java/org/opencdmp/commons/types/{dmp/importexport/DmpReferenceTypeImportExport.java => plan/importexport/PlanReferenceTypeImportExport.java} (79%) rename backend/core/src/main/java/org/opencdmp/commons/types/{dmp/importexport/DmpUserImportExport.java => plan/importexport/PlanUserImportExport.java} (78%) rename backend/core/src/main/java/org/opencdmp/commons/types/{dmpblueprint => planblueprint}/DefinitionEntity.java (94%) rename backend/core/src/main/java/org/opencdmp/commons/types/{dmpblueprint => planblueprint}/DescriptionTemplateEntity.java (96%) create mode 100644 backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/ExtraFieldEntity.java rename backend/core/src/main/java/org/opencdmp/commons/types/{dmpblueprint => planblueprint}/FieldEntity.java (86%) rename backend/core/src/main/java/org/opencdmp/commons/types/{dmpblueprint => planblueprint}/ReferenceTypeFieldEntity.java (94%) rename backend/core/src/main/java/org/opencdmp/commons/types/{dmpblueprint => planblueprint}/SectionEntity.java (85%) rename backend/core/src/main/java/org/opencdmp/commons/types/{dmpblueprint => planblueprint}/SystemFieldEntity.java (55%) rename backend/core/src/main/java/org/opencdmp/commons/types/{dmpblueprint => planblueprint}/importexport/BlueprintDefinitionImportExport.java (88%) rename backend/core/src/main/java/org/opencdmp/commons/types/{dmpblueprint => planblueprint}/importexport/BlueprintDescriptionTemplateImportExport.java (96%) rename backend/core/src/main/java/org/opencdmp/commons/types/{dmpblueprint => planblueprint}/importexport/BlueprintExtraFieldImportExport.java (86%) rename backend/core/src/main/java/org/opencdmp/commons/types/{dmpblueprint => planblueprint}/importexport/BlueprintImportExport.java (69%) rename backend/core/src/main/java/org/opencdmp/commons/types/{dmpblueprint => planblueprint}/importexport/BlueprintPrefillingSourceImportExport.java (90%) rename backend/core/src/main/java/org/opencdmp/commons/types/{dmpblueprint => planblueprint}/importexport/BlueprintReferenceTypeFieldImportExport.java (97%) rename backend/core/src/main/java/org/opencdmp/commons/types/{dmpblueprint => planblueprint}/importexport/BlueprintSectionImportExport.java (98%) rename backend/core/src/main/java/org/opencdmp/commons/types/{dmpblueprint => planblueprint}/importexport/BlueprintSystemFieldImportExport.java (87%) rename backend/core/src/main/java/org/opencdmp/commons/types/{dmpreference/DmpReferenceDataEntity.java => planreference/PlanReferenceDataEntity.java} (72%) rename backend/core/src/main/java/org/opencdmp/data/{DmpBlueprintEntity.java => PlanBlueprintEntity.java} (78%) rename backend/core/src/main/java/org/opencdmp/data/{DmpDescriptionTemplateEntity.java => PlanDescriptionTemplateEntity.java} (89%) rename backend/core/src/main/java/org/opencdmp/data/{DmpEntity.java => PlanEntity.java} (83%) rename backend/core/src/main/java/org/opencdmp/data/{DmpReferenceEntity.java => PlanReferenceEntity.java} (89%) rename backend/core/src/main/java/org/opencdmp/data/{DmpUserEntity.java => PlanUserEntity.java} (81%) delete mode 100644 backend/core/src/main/java/org/opencdmp/data/converters/DmpBlueprintVersionStatusConverter.java create mode 100644 backend/core/src/main/java/org/opencdmp/data/converters/PlanBlueprintVersionStatusConverter.java delete mode 100644 backend/core/src/main/java/org/opencdmp/data/converters/enums/DmpAccessTypeNullableConverter.java delete mode 100644 backend/core/src/main/java/org/opencdmp/data/converters/enums/DmpBlueprintStatusConverter.java delete mode 100644 backend/core/src/main/java/org/opencdmp/data/converters/enums/DmpStatusConverter.java delete mode 100644 backend/core/src/main/java/org/opencdmp/data/converters/enums/DmpUserRoleConverter.java delete mode 100644 backend/core/src/main/java/org/opencdmp/data/converters/enums/DmpVersionStatusConverter.java create mode 100644 backend/core/src/main/java/org/opencdmp/data/converters/enums/PlanAccessTypeNullableConverter.java create mode 100644 backend/core/src/main/java/org/opencdmp/data/converters/enums/PlanBlueprintStatusConverter.java create mode 100644 backend/core/src/main/java/org/opencdmp/data/converters/enums/PlanStatusConverter.java create mode 100644 backend/core/src/main/java/org/opencdmp/data/converters/enums/PlanUserRoleConverter.java create mode 100644 backend/core/src/main/java/org/opencdmp/data/converters/enums/PlanVersionStatusConverter.java rename backend/core/src/main/java/org/opencdmp/elastic/converter/{DmpAccessTypeToShortConverter.java => PlanAccessTypeToShortConverter.java} (54%) rename backend/core/src/main/java/org/opencdmp/elastic/converter/{DmpStatusToShortConverter.java => PlanStatusToShortConverter.java} (56%) rename backend/core/src/main/java/org/opencdmp/elastic/converter/{DmpUserRoleToShortConverter.java => PlanUserRoleToShortConverter.java} (55%) rename backend/core/src/main/java/org/opencdmp/elastic/converter/{DmpVersionStatusToShortConverter.java => PlanVersionStatusToShortConverter.java} (52%) delete mode 100644 backend/core/src/main/java/org/opencdmp/elastic/converter/ShortToDmpAccessTypeConverter.java delete mode 100644 backend/core/src/main/java/org/opencdmp/elastic/converter/ShortToDmpUserRoleConverter.java delete mode 100644 backend/core/src/main/java/org/opencdmp/elastic/converter/ShortToDmpVersionStatusConverter.java create mode 100644 backend/core/src/main/java/org/opencdmp/elastic/converter/ShortToPlanAccessTypeConverter.java rename backend/core/src/main/java/org/opencdmp/elastic/converter/{ShortToDmpStatusConverter.java => ShortToPlanStatusConverter.java} (57%) create mode 100644 backend/core/src/main/java/org/opencdmp/elastic/converter/ShortToPlanUserRoleConverter.java create mode 100644 backend/core/src/main/java/org/opencdmp/elastic/converter/ShortToPlanVersionStatusConverter.java rename backend/core/src/main/java/org/opencdmp/elastic/data/{DmpElasticEntity.java => PlanElasticEntity.java} (64%) rename backend/core/src/main/java/org/opencdmp/elastic/data/nested/{NestedDmpDescriptionTemplateElasticEntity.java => NestedPlanDescriptionTemplateElasticEntity.java} (69%) rename backend/core/src/main/java/org/opencdmp/elastic/data/nested/{NestedDmpElasticEntity.java => NestedPlanElasticEntity.java} (65%) rename backend/core/src/main/java/org/opencdmp/elastic/elasticbuilder/{DmpElasticBuilder.java => PlanElasticBuilder.java} (64%) rename backend/core/src/main/java/org/opencdmp/elastic/elasticbuilder/nested/{NestedDmpDescriptionTemplateElasticBuilder.java => NestedPlanDescriptionTemplateElasticBuilder.java} (58%) rename backend/core/src/main/java/org/opencdmp/elastic/elasticbuilder/nested/{NestedDmpElasticBuilder.java => NestedPlanElasticBuilder.java} (68%) delete mode 100644 backend/core/src/main/java/org/opencdmp/elastic/query/DmpElasticQuery.java delete mode 100644 backend/core/src/main/java/org/opencdmp/elastic/query/NestedDmpDescriptionTemplateElasticQuery.java create mode 100644 backend/core/src/main/java/org/opencdmp/elastic/query/NestedPlanDescriptionTemplateElasticQuery.java create mode 100644 backend/core/src/main/java/org/opencdmp/elastic/query/PlanElasticQuery.java rename backend/core/src/main/java/org/opencdmp/event/{DmpTouchedEvent.java => PlanTouchedEvent.java} (68%) rename backend/core/src/main/java/org/opencdmp/model/{DmpAssociatedUser.java => PlanAssociatedUser.java} (94%) rename backend/core/src/main/java/org/opencdmp/model/{DmpDescriptionTemplate.java => PlanDescriptionTemplate.java} (92%) rename backend/core/src/main/java/org/opencdmp/model/{DmpUser.java => PlanUser.java} (84%) rename backend/core/src/main/java/org/opencdmp/model/{DmpValidationResult.java => PlanValidationResult.java} (64%) delete mode 100644 backend/core/src/main/java/org/opencdmp/model/PublicDmpDescriptionTemplate.java rename backend/core/src/main/java/org/opencdmp/model/{PublicDmp.java => PublicPlan.java} (68%) create mode 100644 backend/core/src/main/java/org/opencdmp/model/PublicPlanDescriptionTemplate.java rename backend/core/src/main/java/org/opencdmp/model/{PublicDmpReference.java => PublicPlanReference.java} (76%) rename backend/core/src/main/java/org/opencdmp/model/{PublicDmpUser.java => PublicPlanUser.java} (59%) delete mode 100644 backend/core/src/main/java/org/opencdmp/model/actionconfirmation/DmpInvitation.java create mode 100644 backend/core/src/main/java/org/opencdmp/model/actionconfirmation/PlanInvitation.java rename backend/core/src/main/java/org/opencdmp/model/builder/{DmpAssociatedUserBuilder.java => PlanAssociatedUserBuilder.java} (85%) rename backend/core/src/main/java/org/opencdmp/model/builder/{DmpDescriptionTemplateBuilder.java => PlanDescriptionTemplateBuilder.java} (63%) rename backend/core/src/main/java/org/opencdmp/model/builder/{DmpUserBuilder.java => PlanUserBuilder.java} (57%) delete mode 100644 backend/core/src/main/java/org/opencdmp/model/builder/PublicDmpBuilder.java create mode 100644 backend/core/src/main/java/org/opencdmp/model/builder/PublicPlanBuilder.java rename backend/core/src/main/java/org/opencdmp/model/builder/{PublicDmpDescriptionTemplateBuilder.java => PublicPlanDescriptionTemplateBuilder.java} (51%) rename backend/core/src/main/java/org/opencdmp/model/builder/{PublicDmpReferenceBuilder.java => PublicPlanReferenceBuilder.java} (61%) rename backend/core/src/main/java/org/opencdmp/model/builder/{PublicDmpUserBuilder.java => PublicPlanUserBuilder.java} (62%) rename backend/core/src/main/java/org/opencdmp/model/builder/actionconfirmation/{DmpInvitationBuilder.java => PlanInvitationBuilder.java} (61%) rename backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/{DmpUserCommonModelBuilder.java => PlanUserCommonModelBuilder.java} (80%) rename backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/{dmp/DmpBlueprintValueCommonModelBuilder.java => plan/PlanBlueprintValueCommonModelBuilder.java} (63%) rename backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/{dmp/DmpCommonModelBuilder.java => plan/PlanCommonModelBuilder.java} (58%) rename backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/{dmp/DmpContactCommonModelBuilder.java => plan/PlanContactCommonModelBuilder.java} (75%) rename backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/{dmp/DmpPropertiesCommonModelBuilder.java => plan/PlanPropertiesCommonModelBuilder.java} (62%) rename backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/{dmpblueprint => planblueprint}/DefinitionCommonModelBuilder.java (92%) rename backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/{dmpblueprint => planblueprint}/ExtraFieldCommonModelBuilder.java (91%) rename backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/{dmpblueprint => planblueprint}/FieldCommonModelBuilder.java (96%) rename backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/{dmpblueprint/DmpBlueprintCommonModelBuilder.java => planblueprint/PlanBlueprintCommonModelBuilder.java} (75%) rename backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/{dmpblueprint => planblueprint}/ReferenceTypeFieldCommonModelBuilder.java (92%) rename backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/{dmpblueprint => planblueprint}/SectionCommonModelBuilder.java (80%) rename backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/{dmpblueprint => planblueprint}/SystemFieldCommonModelBuilder.java (92%) rename backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/{dmpreference/DmpReferenceCommonModelBuilder.java => planreference/PlanReferenceCommonModelBuilder.java} (72%) rename backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/{dmpreference/DmpReferenceDataCommonModelBuilder.java => planreference/PlanReferenceDataCommonModelBuilder.java} (74%) delete mode 100644 backend/core/src/main/java/org/opencdmp/model/builder/dmp/DmpBuilder.java rename backend/core/src/main/java/org/opencdmp/model/builder/{dmp/DmpBlueprintValueBuilder.java => plan/PlanBlueprintValueBuilder.java} (55%) create mode 100644 backend/core/src/main/java/org/opencdmp/model/builder/plan/PlanBuilder.java rename backend/core/src/main/java/org/opencdmp/model/builder/{dmp/DmpContactBuilder.java => plan/PlanContactBuilder.java} (66%) rename backend/core/src/main/java/org/opencdmp/model/builder/{dmp/DmpPropertiesBuilder.java => plan/PlanPropertiesBuilder.java} (59%) rename backend/core/src/main/java/org/opencdmp/model/builder/{dmpblueprint => planblueprint}/DefinitionBuilder.java (93%) rename backend/core/src/main/java/org/opencdmp/model/builder/{dmpblueprint => planblueprint}/DescriptionTemplateBuilder.java (93%) rename backend/core/src/main/java/org/opencdmp/model/builder/{dmpblueprint => planblueprint}/ExtraFieldBuilder.java (85%) rename backend/core/src/main/java/org/opencdmp/model/builder/{dmpblueprint => planblueprint}/FieldBuilder.java (94%) rename backend/core/src/main/java/org/opencdmp/model/builder/{dmpblueprint/DmpBlueprintBuilder.java => planblueprint/PlanBlueprintBuilder.java} (64%) rename backend/core/src/main/java/org/opencdmp/model/builder/{dmpblueprint => planblueprint}/ReferenceFieldBuilder.java (91%) rename backend/core/src/main/java/org/opencdmp/model/builder/{dmpblueprint => planblueprint}/SectionBuilder.java (85%) rename backend/core/src/main/java/org/opencdmp/model/builder/{dmpblueprint => planblueprint}/SystemFieldBuilder.java (85%) rename backend/core/src/main/java/org/opencdmp/model/builder/{dmpreference/DmpReferenceBuilder.java => planreference/PlanReferenceBuilder.java} (57%) rename backend/core/src/main/java/org/opencdmp/model/builder/{dmpreference/DmpReferenceDataBuilder.java => planreference/PlanReferenceDataBuilder.java} (62%) rename backend/core/src/main/java/org/opencdmp/model/censorship/{DmpAssociatedUserCensor.java => PlanAssociatedUserCensor.java} (77%) rename backend/core/src/main/java/org/opencdmp/model/censorship/{DmpDescriptionTemplateCensor.java => PlanDescriptionTemplateCensor.java} (67%) rename backend/core/src/main/java/org/opencdmp/model/censorship/{DmpUserCensor.java => PlanUserCensor.java} (68%) rename backend/core/src/main/java/org/opencdmp/model/censorship/{PublicDmpCensor.java => PublicPlanCensor.java} (55%) rename backend/core/src/main/java/org/opencdmp/model/censorship/{PublicDmpDescriptionTemplateCensor.java => PublicPlanDescriptionTemplateCensor.java} (65%) rename backend/core/src/main/java/org/opencdmp/model/censorship/{PublicDmpReferenceCensor.java => PublicPlanReferenceCensor.java} (65%) rename backend/core/src/main/java/org/opencdmp/model/censorship/{PublicDmpUserCensor.java => PublicPlanUserCensor.java} (73%) rename backend/core/src/main/java/org/opencdmp/model/censorship/{dmp/DmpBlueprintValueCensor.java => plan/PlanBlueprintValueCensor.java} (69%) rename backend/core/src/main/java/org/opencdmp/model/censorship/{dmp/DmpCensor.java => plan/PlanCensor.java} (54%) rename backend/core/src/main/java/org/opencdmp/model/censorship/{dmp/DmpContactCensor.java => plan/PlanContactCensor.java} (74%) rename backend/core/src/main/java/org/opencdmp/model/censorship/{dmp/DmpPropertiesCensor.java => plan/PlanPropertiesCensor.java} (62%) rename backend/core/src/main/java/org/opencdmp/model/censorship/{dmpblueprint => planblueprint}/DefinitionCensor.java (90%) rename backend/core/src/main/java/org/opencdmp/model/censorship/{dmpblueprint => planblueprint}/DescriptionTemplatesCensor.java (91%) rename backend/core/src/main/java/org/opencdmp/model/censorship/{dmpblueprint => planblueprint}/FieldCensor.java (91%) rename backend/core/src/main/java/org/opencdmp/model/censorship/{dmpblueprint/DmpBlueprintCensor.java => planblueprint/PlanBlueprintCensor.java} (71%) rename backend/core/src/main/java/org/opencdmp/model/censorship/{dmpblueprint => planblueprint}/SectionCensor.java (91%) rename backend/core/src/main/java/org/opencdmp/model/censorship/{dmpreference/DmpReferenceCensor.java => planreference/PlanReferenceCensor.java} (61%) rename backend/core/src/main/java/org/opencdmp/model/censorship/{dmpreference/DmpReferenceDataCensor.java => planreference/PlanReferenceDataCensor.java} (72%) rename backend/core/src/main/java/org/opencdmp/model/deleter/{DmpBlueprintDeleter.java => PlanBlueprintDeleter.java} (80%) rename backend/core/src/main/java/org/opencdmp/model/deleter/{DmpDeleter.java => PlanDeleter.java} (66%) rename backend/core/src/main/java/org/opencdmp/model/deleter/{DmpDescriptionTemplateDeleter.java => PlanDescriptionTemplateDeleter.java} (78%) rename backend/core/src/main/java/org/opencdmp/model/deleter/{DmpReferenceDeleter.java => PlanReferenceDeleter.java} (80%) rename backend/core/src/main/java/org/opencdmp/model/deleter/{DmpUserDeleter.java => PlanUserDeleter.java} (81%) delete mode 100644 backend/core/src/main/java/org/opencdmp/model/dmp/DmpProperties.java delete mode 100644 backend/core/src/main/java/org/opencdmp/model/dmpblueprint/ExtraField.java delete mode 100644 backend/core/src/main/java/org/opencdmp/model/dmpblueprint/SystemField.java rename backend/core/src/main/java/org/opencdmp/model/persist/{CloneDmpPersist.java => ClonePlanPersist.java} (66%) rename backend/core/src/main/java/org/opencdmp/model/persist/{NewVersionDmpBlueprintPersist.java => NewVersionPlanBlueprintPersist.java} (59%) rename backend/core/src/main/java/org/opencdmp/model/persist/{NewVersionDmpDescriptionPersist.java => NewVersionPlanDescriptionPersist.java} (58%) rename backend/core/src/main/java/org/opencdmp/model/persist/{NewVersionDmpPersist.java => NewVersionPlanPersist.java} (61%) rename backend/core/src/main/java/org/opencdmp/model/persist/{DmpBlueprintPersist.java => PlanBlueprintPersist.java} (61%) rename backend/core/src/main/java/org/opencdmp/model/persist/{DmpCommonModelConfig.java => PlanCommonModelConfig.java} (64%) rename backend/core/src/main/java/org/opencdmp/model/persist/{DmpDescriptionTemplatePersist.java => PlanDescriptionTemplatePersist.java} (58%) rename backend/core/src/main/java/org/opencdmp/model/persist/{DmpPersist.java => PlanPersist.java} (56%) rename backend/core/src/main/java/org/opencdmp/model/persist/{DmpReferencePersist.java => PlanReferencePersist.java} (59%) rename backend/core/src/main/java/org/opencdmp/model/persist/{DmpUserInvitePersist.java => PlanUserInvitePersist.java} (57%) rename backend/core/src/main/java/org/opencdmp/model/persist/{DmpUserPersist.java => PlanUserPersist.java} (60%) rename backend/core/src/main/java/org/opencdmp/model/persist/{DmpUserRemovePersist.java => PlanUserRemovePersist.java} (51%) delete mode 100644 backend/core/src/main/java/org/opencdmp/model/persist/actionconfirmation/DmpInvitationPersist.java create mode 100644 backend/core/src/main/java/org/opencdmp/model/persist/actionconfirmation/PlanInvitationPersist.java delete mode 100644 backend/core/src/main/java/org/opencdmp/model/persist/dmpproperties/DmpPropertiesPersist.java rename backend/core/src/main/java/org/opencdmp/model/persist/{dmpproperties/DmpBlueprintValuePersist.java => planproperties/PlanBlueprintValuePersist.java} (65%) rename backend/core/src/main/java/org/opencdmp/model/persist/{dmpproperties/DmpContactPersist.java => planproperties/PlanContactPersist.java} (59%) create mode 100644 backend/core/src/main/java/org/opencdmp/model/persist/planproperties/PlanPropertiesPersist.java rename backend/core/src/main/java/org/opencdmp/model/persist/{dmpreference/DmpReferenceDataPersist.java => planreference/PlanReferenceDataPersist.java} (57%) rename backend/core/src/main/java/org/opencdmp/model/{dmp/Dmp.java => plan/Plan.java} (70%) rename backend/core/src/main/java/org/opencdmp/model/{dmp/DmpBlueprintValue.java => plan/PlanBlueprintValue.java} (94%) rename backend/core/src/main/java/org/opencdmp/model/{dmp/DmpContact.java => plan/PlanContact.java} (92%) create mode 100644 backend/core/src/main/java/org/opencdmp/model/plan/PlanProperties.java rename backend/core/src/main/java/org/opencdmp/model/{dmpblueprint => planblueprint}/Definition.java (87%) rename backend/core/src/main/java/org/opencdmp/model/{dmpblueprint => planblueprint}/DescriptionTemplate.java (96%) create mode 100644 backend/core/src/main/java/org/opencdmp/model/planblueprint/ExtraField.java rename backend/core/src/main/java/org/opencdmp/model/{dmpblueprint => planblueprint}/Field.java (86%) rename backend/core/src/main/java/org/opencdmp/model/{dmpblueprint/DmpBlueprint.java => planblueprint/PlanBlueprint.java} (83%) rename backend/core/src/main/java/org/opencdmp/model/{dmpblueprint => planblueprint}/ReferenceTypeField.java (93%) rename backend/core/src/main/java/org/opencdmp/model/{dmpblueprint => planblueprint}/Section.java (98%) create mode 100644 backend/core/src/main/java/org/opencdmp/model/planblueprint/SystemField.java rename backend/core/src/main/java/org/opencdmp/model/{dmpreference/DmpReference.java => planreference/PlanReference.java} (82%) rename backend/core/src/main/java/org/opencdmp/model/{dmpreference/DmpReferenceData.java => planreference/PlanReferenceData.java} (80%) rename backend/core/src/main/java/org/opencdmp/query/{DmpBlueprintQuery.java => PlanBlueprintQuery.java} (52%) rename backend/core/src/main/java/org/opencdmp/query/{DmpDescriptionTemplateQuery.java => PlanDescriptionTemplateQuery.java} (54%) rename backend/core/src/main/java/org/opencdmp/query/{DmpQuery.java => PlanQuery.java} (51%) rename backend/core/src/main/java/org/opencdmp/query/{DmpReferenceQuery.java => PlanReferenceQuery.java} (55%) rename backend/core/src/main/java/org/opencdmp/query/{DmpUserQuery.java => PlanUserQuery.java} (58%) rename backend/core/src/main/java/org/opencdmp/query/lookup/{DmpBlueprintLookup.java => PlanBlueprintLookup.java} (72%) rename backend/core/src/main/java/org/opencdmp/query/lookup/{DmpDescriptionTemplateLookup.java => PlanDescriptionTemplateLookup.java} (71%) rename backend/core/src/main/java/org/opencdmp/query/lookup/{DmpLookup.java => PlanLookup.java} (54%) rename backend/core/src/main/java/org/opencdmp/query/lookup/{DmpReferenceLookup.java => PlanReferenceLookup.java} (60%) rename backend/core/src/main/java/org/opencdmp/query/lookup/{DmpUserLookup.java => PlanUserLookup.java} (75%) delete mode 100644 backend/core/src/main/java/org/opencdmp/service/dmp/DmpService.java delete mode 100644 backend/core/src/main/java/org/opencdmp/service/dmpblueprint/DmpBlueprintService.java create mode 100644 backend/core/src/main/java/org/opencdmp/service/plan/PlanService.java rename backend/core/src/main/java/org/opencdmp/service/{dmp/DmpServiceImpl.java => plan/PlanServiceImpl.java} (55%) create mode 100644 backend/core/src/main/java/org/opencdmp/service/planblueprint/PlanBlueprintService.java rename backend/core/src/main/java/org/opencdmp/service/{dmpblueprint/DmpBlueprintServiceImpl.java => planblueprint/PlanBlueprintServiceImpl.java} (75%) rename backend/web/src/main/java/org/opencdmp/authorization/{DmpRole.java => PlanRole.java} (52%) diff --git a/backend/core/src/main/java/org/opencdmp/audit/AuditableAction.java b/backend/core/src/main/java/org/opencdmp/audit/AuditableAction.java index c498f903d..bcb01ecb5 100644 --- a/backend/core/src/main/java/org/opencdmp/audit/AuditableAction.java +++ b/backend/core/src/main/java/org/opencdmp/audit/AuditableAction.java @@ -14,39 +14,39 @@ public class AuditableAction { public static final EventId EntityDoi_Persist = new EventId(2002, "EntityDoi_Persist"); public static final EventId EntityDoi_Delete = new EventId(2003, "EntityDoi_Delete"); - public static final EventId DmpBlueprint_Query = new EventId(3000, "DmpBlueprint_Query"); - public static final EventId DmpBlueprint_Lookup = new EventId(3001, "DmpBlueprint_Lookup"); - public static final EventId DmpBlueprint_Persist = new EventId(3002, "DmpBlueprint_Persist"); - public static final EventId DmpBlueprint_Delete = new EventId(3003, "DmpBlueprint_Delete"); - public static final EventId DmpBlueprint_Clone = new EventId(3004, "DmpBlueprint_Clone"); + public static final EventId PlanBlueprint_Query = new EventId(3000, "PlanBlueprint_Query"); + public static final EventId PlanBlueprint_Lookup = new EventId(3001, "PlanBlueprint_Lookup"); + public static final EventId PlanBlueprint_Persist = new EventId(3002, "PlanBlueprint_Persist"); + public static final EventId PlanBlueprint_Delete = new EventId(3003, "PlanBlueprint_Delete"); + public static final EventId PlanBlueprint_Clone = new EventId(3004, "PlanBlueprint_Clone"); - public static final EventId DmpBlueprint_PersistNewVersion = new EventId(3005, "DmpBlueprint_PersistNewVersion"); - public static final EventId DmpBlueprint_GetXml = new EventId(3006, "DmpBlueprint_GetXml"); - public static final EventId DmpBlueprint_Import = new EventId(3007, "DmpBlueprint_Import"); + public static final EventId PlanBlueprint_PersistNewVersion = new EventId(3005, "PlanBlueprint_PersistNewVersion"); + public static final EventId PlanBlueprint_GetXml = new EventId(3006, "PlanBlueprint_GetXml"); + public static final EventId PlanBlueprint_Import = new EventId(3007, "PlanBlueprint_Import"); public static final EventId User_Settings_Query = new EventId(4000, "User_Settings_Query"); public static final EventId User_Settings_Lookup = new EventId(4001, "User_Settings_Lookup"); public static final EventId User_Settings_Persist = new EventId(4002, "User_Settings_Persist"); public static final EventId User_Settings_Delete = new EventId(4003, "User_Settings_Delete"); - public static final EventId Dmp_Query = new EventId(5000, "Dmp_Query"); - public static final EventId Dmp_Lookup = new EventId(5001, "Dmp_Lookup"); - 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 Dmp_Clone = new EventId(5004, "Dmp_Clone"); - public static final EventId Dmp_PersistNewVersion = new EventId(5005, "Dmp_PersistNewVersion"); - public static final EventId Dmp_Assign_Users = new EventId(5006, "Dmp_Assign_Users"); - public static final EventId Dmp_RemoveUser = new EventId(5007, "Dmp_RemoveUser"); - public static final EventId Dmp_Invite_Users = new EventId(5008, "Dmp_Invite_Users"); - public static final EventId Dmp_Invite_Accept = new EventId(5009, "Dmp_Invite_Accept"); - public static final EventId Dmp_PublicQuery = new EventId(5010, "Dmp_PublicQuery"); - public static final EventId Dmp_Export = new EventId(5011, "Dmp_Export"); - public static final EventId Dmp_PublicLookup = new EventId(5012, "Dmp_PublicLookup"); - public static final EventId Dmp_Finalize = new EventId(5013, "Dmp_Finalize"); - public static final EventId Dmp_Undo_Finalize = new EventId(5014, "Dmp_Undo_Finalize"); - public static final EventId Dmp_Validate = new EventId(5015, "Dmp_Validate"); - public static final EventId Dmp_GetXml = new EventId(5016, "Dmp_GetXml"); - public static final EventId Dmp_Import = new EventId(5017, "Dmp_Import"); + public static final EventId Plan_Query = new EventId(5000, "Plan_Query"); + public static final EventId Plan_Lookup = new EventId(5001, "Plan_Lookup"); + public static final EventId Plan_Persist = new EventId(5002, "Plan_Persist"); + public static final EventId Plan_Delete = new EventId(5003, "Plan_Delete"); + public static final EventId Plan_Clone = new EventId(5004, "Plan_Clone"); + public static final EventId Plan_PersistNewVersion = new EventId(5005, "Plan_PersistNewVersion"); + public static final EventId Plan_Assign_Users = new EventId(5006, "Plan_Assign_Users"); + public static final EventId Plan_RemoveUser = new EventId(5007, "Plan_RemoveUser"); + public static final EventId Plan_Invite_Users = new EventId(5008, "Plan_Invite_Users"); + public static final EventId Plan_Invite_Accept = new EventId(5009, "Plan_Invite_Accept"); + public static final EventId Plan_PublicQuery = new EventId(5010, "Plan_PublicQuery"); + public static final EventId Plan_Export = new EventId(5011, "Plan_Export"); + public static final EventId Plan_PublicLookup = new EventId(5012, "Plan_PublicLookup"); + public static final EventId Plan_Finalize = new EventId(5013, "Plan_Finalize"); + public static final EventId Plan_Undo_Finalize = new EventId(5014, "Plan_Undo_Finalize"); + public static final EventId Plan_Validate = new EventId(5015, "Plan_Validate"); + public static final EventId Plan_GetXml = new EventId(5016, "Plan_GetXml"); + public static final EventId Plan_Import = new EventId(5017, "Plan_Import"); public static final EventId Description_Query = new EventId(6000, "Description_Query"); @@ -102,7 +102,7 @@ public class AuditableAction { public static final EventId User_MergeConfirm = new EventId(11011, "User_MergeConfirm"); public static final EventId User_RemoveCredentialRequest = new EventId(11012, "User_RemoveCredentialRequest"); public static final EventId User_RemoveCredentialConfirm = new EventId(11013, "User_RemoveCredentialConfirm"); - public static final EventId User_DmpAssociatedQuery = new EventId(11014, "User_DmpAssociatedQuery"); + public static final EventId User_PlanAssociatedQuery = new EventId(11014, "User_PlanAssociatedQuery"); public static final EventId User_AllowMergeAccount = new EventId(11015, "User_AllowMergeAccount"); public static final EventId User_InviteToTenant = new EventId(11016, "User_InviteToTenant"); public static final EventId User_InviteToTenantConfirm = new EventId(11017, "User_InviteToTenantConfirm"); @@ -156,7 +156,7 @@ public class AuditableAction { public static final EventId Maintenance_ClearElastic = new EventId(230000, "Maintenance_ClearElastic"); public static final EventId Maintenance_SendUserTouchEvents = new EventId(230001, "Maintenance_SendUserTouchEvents"); public static final EventId Maintenance_SendTenantTouchEvents = new EventId(230002, "Maintenance_SendTenantTouchEvents"); - public static final EventId Maintenance_SendDmpTouchEvents = new EventId(230003, "Maintenance_SendDmpTouchEvents"); + public static final EventId Maintenance_SendPlanTouchEvents = new EventId(230003, "Maintenance_SendPlanTouchEvents"); public static final EventId Maintenance_SendDescriptionTouchEvents = new EventId(230004, "Maintenance_SendDescriptionTouchEvents"); public static final EventId Principal_Lookup = new EventId(240000, "Principal_Lookup"); diff --git a/backend/core/src/main/java/org/opencdmp/authorization/AffiliatedResource.java b/backend/core/src/main/java/org/opencdmp/authorization/AffiliatedResource.java index 7c5a1c53f..2b2ecde24 100644 --- a/backend/core/src/main/java/org/opencdmp/authorization/AffiliatedResource.java +++ b/backend/core/src/main/java/org/opencdmp/authorization/AffiliatedResource.java @@ -1,26 +1,26 @@ package org.opencdmp.authorization; import gr.cite.commons.web.authz.policy.AuthorizationResource; -import org.opencdmp.commons.enums.DmpUserRole; +import org.opencdmp.commons.enums.PlanUserRole; import org.opencdmp.commons.enums.UserDescriptionTemplateRole; import java.util.HashSet; public class AffiliatedResource extends AuthorizationResource { - private HashSet dmpUserRoles; + private HashSet planUserRoles; private HashSet userDescriptionTemplateRoles; public AffiliatedResource() { - this.dmpUserRoles = new HashSet<>(); + this.planUserRoles = new HashSet<>(); this.userDescriptionTemplateRoles = new HashSet<>(); } - public HashSet getDmpUserRoles() { - return this.dmpUserRoles; + public HashSet getPlanUserRoles() { + return this.planUserRoles; } - public void setDmpUserRoles(HashSet dmpUserRoles) { - this.dmpUserRoles = dmpUserRoles; + public void setPlanUserRoles(HashSet planUserRoles) { + this.planUserRoles = planUserRoles; } public HashSet getUserDescriptionTemplateRoles() { diff --git a/backend/core/src/main/java/org/opencdmp/authorization/Permission.java b/backend/core/src/main/java/org/opencdmp/authorization/Permission.java index 6f5f98f49..df9ac7e43 100644 --- a/backend/core/src/main/java/org/opencdmp/authorization/Permission.java +++ b/backend/core/src/main/java/org/opencdmp/authorization/Permission.java @@ -59,7 +59,7 @@ public final class Permission { public static String ExportUsers = "ExportUsers"; public static String EditTenantUserRole = "EditTenantUserRole"; public static String InviteTenantUser = "InviteTenantUser"; - public static String BrowseDmpAssociatedUser = "BrowseDmpAssociatedUser"; + public static String BrowsePlanAssociatedUser = "BrowsePlanAssociatedUser"; //StorageFile @@ -72,38 +72,38 @@ public final class Permission { public static String EditDescriptionTemplateType = "EditDescriptionTemplateType"; public static String DeleteDescriptionTemplateType = "DeleteDescriptionTemplateType"; - //Dmp - public static String BrowseDmp = "BrowseDmp"; - public static String EditDmp = "EditDmp"; - public static String NewDmp = "NewDmp"; - public static String DepositDmp = "DepositDmp"; - public static String DeleteDmp = "DeleteDmp"; - public static String CloneDmp = "CloneDmp"; - public static String ExportDmp = "ExportDmp"; - public static String CreateNewVersionDmp = "CreateNewVersionDmp"; - public static String FinalizeDmp = "FinalizeDmp"; - public static String UndoFinalizeDmp = "UndoFinalizeDmp"; - public static String AssignDmpUsers = "AssignDmpUsers"; - public static String InviteDmpUsers = "InviteDmpUsers"; + //Plan + public static String BrowsePlan = "BrowsePlan"; + public static String EditPlan = "EditPlan"; + public static String NewPlan = "NewPlan"; + public static String DepositPlan = "DepositPlan"; + public static String DeletePlan = "DeletePlan"; + public static String ClonePlan = "ClonePlan"; + public static String ExportPlan = "ExportPlan"; + public static String CreateNewVersionPlan = "CreateNewVersionPlan"; + public static String FinalizePlan = "FinalizePlan"; + public static String UndoFinalizePlan = "UndoFinalizePlan"; + public static String AssignPlanUsers = "AssignPlanUsers"; + public static String InvitePlanUsers = "InvitePlanUsers"; - //DmpBlueprint - public static String BrowseDmpBlueprint = "BrowseDmpBlueprint"; - public static String EditDmpBlueprint = "EditDmpBlueprint"; - public static String DeleteDmpBlueprint = "DeleteDmpBlueprint"; - public static String CloneDmpBlueprint = "CloneDmpBlueprint"; - public static String CreateNewVersionDmpBlueprint = "CreateNewVersionDmpBlueprint"; - public static String ExportDmpBlueprint = "ExportDmpBlueprint"; - public static String ImportDmpBlueprint = "ImportDmpBlueprint"; + //PlanBlueprint + public static String BrowsePlanBlueprint = "BrowsePlanBlueprint"; + public static String EditPlanBlueprint = "EditPlanBlueprint"; + public static String DeletePlanBlueprint = "DeletePlanBlueprint"; + public static String ClonePlanBlueprint = "ClonePlanBlueprint"; + public static String CreateNewVersionPlanBlueprint = "CreateNewVersionPlanBlueprint"; + public static String ExportPlanBlueprint = "ExportPlanBlueprint"; + public static String ImportPlanBlueprint = "ImportPlanBlueprint"; - //DmpDescriptionTemplate - public static String BrowseDmpDescriptionTemplate = "BrowseDmpDescriptionTemplate"; - public static String EditDmpDescriptionTemplate = "EditDmpDescriptionTemplate"; - public static String DeleteDmpDescriptionTemplate = "DeleteDmpDescriptionTemplate"; + //PlanDescriptionTemplate + public static String BrowsePlanDescriptionTemplate = "BrowsePlanDescriptionTemplate"; + public static String EditPlanDescriptionTemplate = "EditPlanDescriptionTemplate"; + public static String DeletePlanDescriptionTemplate = "DeletePlanDescriptionTemplate"; - //DmpUser - public static String BrowseDmpUser = "BrowseDmpUser"; - public static String EditDmpUser = "EditDmpUser"; - public static String DeleteDmpUser = "DeleteDmpUser"; + //PlanUser + public static String BrowsePlanUser = "BrowsePlanUser"; + public static String EditPlanUser = "EditPlanUser"; + public static String DeletePlanUser = "DeletePlanUser"; //Description public static String BrowseDescription = "BrowseDescription"; @@ -142,10 +142,10 @@ public final class Permission { public static String EditTag = "EditTag"; public static String DeleteTag = "DeleteTag"; - //DmpReference - public static String BrowseDmpReference = "BrowseDmpReference"; - public static String EditDmpReference = "EditDmpReference"; - public static String DeleteDmpReference = "DeleteDmpReference"; + //PlanReference + public static String BrowsePlanReference = "BrowsePlanReference"; + public static String EditPlanReference = "EditPlanReference"; + public static String DeletePlanReference = "DeletePlanReference"; //DescriptionReference public static String BrowseDescriptionReference = "BrowseDescriptionReference"; @@ -218,14 +218,14 @@ public final class Permission { public static String ViewTenantPage = "ViewTenantPage"; public static String ViewPrefillingSourcePage = "ViewPrefillingSourcePage"; public static String ViewReferenceTypePage = "ViewReferenceTypePage"; - public static String ViewReferencePage = "ViewReferencePage"; + public static String ViewReferencePaPlge = "ViewReferencePage"; public static String ViewEntityLockPage = "ViewEntityLockPage"; public static String ViewDescriptionTemplatePage = "ViewDescriptionTemplatePage"; - public static String ViewDmpBlueprintPage = "ViewDmpBlueprintPage"; + public static String ViewPlanBlueprintPage = "ViewPlanBlueprintPage"; public static String ViewPublicDescriptionPage = "ViewPublicDescriptionPage"; public static String ViewPublicDmpPage = "ViewPublicDmpPage"; public static String ViewMyDescriptionPage = "ViewMyDescriptionPage"; - public static String ViewMyDmpPage = "ViewMyDmpPage"; + public static String ViewMyPlanPage = "ViewMyPlanPage"; public static String ViewHomePage = "ViewHomePage"; public static String ViewMineInAppNotificationPage = "ViewMineInAppNotificationPage"; public static String ViewTenantConfigurationPage = "ViewTenantConfigurationPage"; diff --git a/backend/core/src/main/java/org/opencdmp/authorization/authorizationcontentresolver/AuthorizationContentResolver.java b/backend/core/src/main/java/org/opencdmp/authorization/authorizationcontentresolver/AuthorizationContentResolver.java index 3e38bd9d9..3baf91b5b 100644 --- a/backend/core/src/main/java/org/opencdmp/authorization/authorizationcontentresolver/AuthorizationContentResolver.java +++ b/backend/core/src/main/java/org/opencdmp/authorization/authorizationcontentresolver/AuthorizationContentResolver.java @@ -23,7 +23,7 @@ public interface AuthorizationContentResolver { Map descriptionsAffiliation(List ids); - AffiliatedResource descriptionsAffiliationBySection(UUID dmpId, UUID sectionId); + AffiliatedResource descriptionsAffiliationBySection(UUID planId, UUID sectionId); - Map descriptionsAffiliationBySections(UUID dmpId, List sectionIds); + Map descriptionsAffiliationBySections(UUID planId, List sectionIds); } diff --git a/backend/core/src/main/java/org/opencdmp/authorization/authorizationcontentresolver/AuthorizationContentResolverImpl.java b/backend/core/src/main/java/org/opencdmp/authorization/authorizationcontentresolver/AuthorizationContentResolverImpl.java index 25cd25865..5e6621364 100644 --- a/backend/core/src/main/java/org/opencdmp/authorization/authorizationcontentresolver/AuthorizationContentResolverImpl.java +++ b/backend/core/src/main/java/org/opencdmp/authorization/authorizationcontentresolver/AuthorizationContentResolverImpl.java @@ -10,13 +10,13 @@ import org.opencdmp.commons.enums.IsActive; import org.opencdmp.commons.scope.tenant.TenantScope; import org.opencdmp.commons.scope.user.UserScope; import org.opencdmp.data.*; -import org.opencdmp.model.DmpDescriptionTemplate; -import org.opencdmp.model.DmpUser; +import org.opencdmp.model.PlanDescriptionTemplate; +import org.opencdmp.model.PlanUser; import org.opencdmp.model.UserDescriptionTemplate; import org.opencdmp.model.description.Description; import org.opencdmp.query.DescriptionQuery; -import org.opencdmp.query.DmpDescriptionTemplateQuery; -import org.opencdmp.query.DmpUserQuery; +import org.opencdmp.query.PlanDescriptionTemplateQuery; +import org.opencdmp.query.PlanUserQuery; import org.opencdmp.query.UserDescriptionTemplateQuery; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -65,12 +65,12 @@ public class AuthorizationContentResolverImpl implements AuthorizationContentRes } if (userId == null || !this.userScope.isSet()) return affiliatedResources; - List idsToResolve = this.getAffiliatedFromCache(ids, userId, affiliatedResources, DmpEntity.class.getSimpleName()); + List idsToResolve = this.getAffiliatedFromCache(ids, userId, affiliatedResources, PlanEntity.class.getSimpleName()); if (idsToResolve.isEmpty()) return affiliatedResources; - List dmpUsers; + List dmpUsers; try { this.tenantEntityManager.loadExplictTenantFilters(); - dmpUsers = this.queryFactory.query(DmpUserQuery.class).disableTracking().dmpIds(ids).sectionIsEmpty(true).userIds(userId).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(DmpUser._role).ensure(DmpUser._dmp)); + dmpUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking().planIds(ids).sectionIsEmpty(true).userIds(userId).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(PlanUser._role).ensure(PlanUser._plan)); } catch (InvalidApplicationException e) { log.error(e.getMessage(), e); throw new MyApplicationException(e.getMessage()); @@ -82,11 +82,11 @@ public class AuthorizationContentResolverImpl implements AuthorizationContentRes throw new MyApplicationException(e.getMessage()); } } - for (DmpUserEntity dmpUser : dmpUsers){ - affiliatedResources.get(dmpUser.getDmpId()).getDmpUserRoles().add(dmpUser.getRole()); + for (PlanUserEntity dmpUser : dmpUsers){ + affiliatedResources.get(dmpUser.getPlanId()).getPlanUserRoles().add(dmpUser.getRole()); } - this.ensureAffiliatedInCache(idsToResolve, userId, affiliatedResources, DmpEntity.class.getSimpleName()); + this.ensureAffiliatedInCache(idsToResolve, userId, affiliatedResources, PlanEntity.class.getSimpleName()); return affiliatedResources; } @@ -172,14 +172,14 @@ public class AuthorizationContentResolverImpl implements AuthorizationContentRes List idsToResolve = this.getAffiliatedFromCache(ids, userId, affiliatedResources, DescriptionEntity.class.getSimpleName()); if (idsToResolve.isEmpty()) return affiliatedResources; - List dmpDescriptionTemplateEntities; - List dmpUsers; + List planDescriptionTemplateEntities; + List planUsers; List descriptionEntities; try { this.tenantEntityManager.loadExplictTenantFilters(); - descriptionEntities = this.queryFactory.query(DescriptionQuery.class).disableTracking().ids(ids).collectAs(new BaseFieldSet().ensure(Description._id).ensure(Description._dmpDescriptionTemplate).ensure(Description._dmp)); - dmpDescriptionTemplateEntities = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking().ids(descriptionEntities.stream().map(DescriptionEntity::getDmpDescriptionTemplateId).distinct().toList()).collectAs(new BaseFieldSet().ensure(DmpDescriptionTemplate._id).ensure(DmpDescriptionTemplate._sectionId)); - dmpUsers = this.queryFactory.query(DmpUserQuery.class).disableTracking().descriptionIds(ids).userIds(userId).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(DmpUser._role).ensure(DmpUser._sectionId).ensure(DmpUser._dmp)); + descriptionEntities = this.queryFactory.query(DescriptionQuery.class).disableTracking().ids(ids).collectAs(new BaseFieldSet().ensure(Description._id).ensure(Description._planDescriptionTemplate).ensure(Description._plan)); + planDescriptionTemplateEntities = this.queryFactory.query(PlanDescriptionTemplateQuery.class).disableTracking().ids(descriptionEntities.stream().map(DescriptionEntity::getPlanDescriptionTemplateId).distinct().toList()).collectAs(new BaseFieldSet().ensure(PlanDescriptionTemplate._id).ensure(PlanDescriptionTemplate._sectionId)); + planUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking().descriptionIds(ids).userIds(userId).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(PlanUser._role).ensure(PlanUser._sectionId).ensure(PlanUser._plan)); } catch (InvalidApplicationException e) { log.error(e.getMessage(), e); @@ -195,17 +195,17 @@ public class AuthorizationContentResolverImpl implements AuthorizationContentRes - Map dmpDescriptionTemplateEntityMap = dmpDescriptionTemplateEntities == null ? new HashMap<>() : dmpDescriptionTemplateEntities.stream().collect(Collectors.toMap(DmpDescriptionTemplateEntity::getId, x-> x)); - Map> dmpUsersMap = dmpUsers.stream().collect(Collectors.groupingBy(DmpUserEntity::getDmpId)); + Map planDescriptionTemplateEntityMap = planDescriptionTemplateEntities == null ? new HashMap<>() : planDescriptionTemplateEntities.stream().collect(Collectors.toMap(PlanDescriptionTemplateEntity::getId, x-> x)); + Map> planUsersMap = planUsers.stream().collect(Collectors.groupingBy(PlanUserEntity::getPlanId)); for (DescriptionEntity description : descriptionEntities){ - List dmpDescriptionUsers = dmpUsersMap.getOrDefault(description.getDmpId(), new ArrayList<>()); - for (DmpUserEntity dmpUser : dmpDescriptionUsers) { - if (dmpUser.getSectionId() == null) affiliatedResources.get(description.getId()).getDmpUserRoles().add(dmpUser.getRole()); + List dmpDescriptionUsers = planUsersMap.getOrDefault(description.getPlanId(), new ArrayList<>()); + for (PlanUserEntity dmpUser : dmpDescriptionUsers) { + if (dmpUser.getSectionId() == null) affiliatedResources.get(description.getId()).getPlanUserRoles().add(dmpUser.getRole()); else { - DmpDescriptionTemplateEntity dmpDescriptionTemplateEntity = dmpDescriptionTemplateEntityMap.getOrDefault(description.getDmpDescriptionTemplateId(), null); - if (dmpDescriptionTemplateEntity != null && dmpUser.getSectionId().equals(dmpDescriptionTemplateEntity.getSectionId())){ - affiliatedResources.get(description.getId()).getDmpUserRoles().add(dmpUser.getRole()); + PlanDescriptionTemplateEntity planDescriptionTemplateEntity = planDescriptionTemplateEntityMap.getOrDefault(description.getPlanDescriptionTemplateId(), null); + if (planDescriptionTemplateEntity != null && dmpUser.getSectionId().equals(planDescriptionTemplateEntity.getSectionId())){ + affiliatedResources.get(description.getId()).getPlanUserRoles().add(dmpUser.getRole()); } } } @@ -216,12 +216,12 @@ public class AuthorizationContentResolverImpl implements AuthorizationContentRes } @Override - public AffiliatedResource descriptionsAffiliationBySection(UUID dmpId, UUID sectionId){ - return this.descriptionsAffiliationBySections(dmpId, List.of(sectionId)).getOrDefault(sectionId, new AffiliatedResource()); + public AffiliatedResource descriptionsAffiliationBySection(UUID planId, UUID sectionId){ + return this.descriptionsAffiliationBySections(planId, List.of(sectionId)).getOrDefault(sectionId, new AffiliatedResource()); } @Override - public Map descriptionsAffiliationBySections(UUID dmpId, List sectionIds){ + public Map descriptionsAffiliationBySections(UUID planId, List sectionIds){ UUID userId = this.userScope.getUserIdSafe(); Map affiliatedResources = new HashMap<>(); for (UUID id : sectionIds){ @@ -230,10 +230,10 @@ public class AuthorizationContentResolverImpl implements AuthorizationContentRes if (userId == null || !this.userScope.isSet()) return affiliatedResources; - List dmpUsers; + List dmpUsers; try { this.tenantEntityManager.loadExplictTenantFilters(); - dmpUsers = this.queryFactory.query(DmpUserQuery.class).disableTracking().dmpIds(dmpId).userIds(userId).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(DmpUser._role).ensure(DmpUser._sectionId).ensure(DmpUser._dmp)); + dmpUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking().planIds(planId).userIds(userId).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(PlanUser._role).ensure(PlanUser._sectionId).ensure(PlanUser._plan)); } catch (InvalidApplicationException e) { log.error(e.getMessage(), e); throw new MyApplicationException(e.getMessage()); @@ -247,12 +247,12 @@ public class AuthorizationContentResolverImpl implements AuthorizationContentRes } for (UUID sectionId : sectionIds.stream().distinct().toList()){ - List dmpSectionUsers = dmpUsers.stream().filter(x-> x.getSectionId() == null || x.getSectionId().equals(sectionId)).toList(); - for (DmpUserEntity dmpUser : dmpSectionUsers) { - if (dmpUser.getSectionId() == null) affiliatedResources.get(sectionId).getDmpUserRoles().add(dmpUser.getRole()); + List dmpSectionUsers = dmpUsers.stream().filter(x-> x.getSectionId() == null || x.getSectionId().equals(sectionId)).toList(); + for (PlanUserEntity dmpUser : dmpSectionUsers) { + if (dmpUser.getSectionId() == null) affiliatedResources.get(sectionId).getPlanUserRoles().add(dmpUser.getRole()); else { if (dmpUser.getSectionId().equals(sectionId)){ - affiliatedResources.get(sectionId).getDmpUserRoles().add(dmpUser.getRole()); + affiliatedResources.get(sectionId).getPlanUserRoles().add(dmpUser.getRole()); } } } diff --git a/backend/core/src/main/java/org/opencdmp/commons/enums/ActionConfirmationType.java b/backend/core/src/main/java/org/opencdmp/commons/enums/ActionConfirmationType.java index 237ab3f7a..d5cc7382a 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/enums/ActionConfirmationType.java +++ b/backend/core/src/main/java/org/opencdmp/commons/enums/ActionConfirmationType.java @@ -9,7 +9,7 @@ public enum ActionConfirmationType implements DatabaseEnum { MergeAccount((short) 0), RemoveCredential((short) 1), - DmpInvitation((short) 2), + PlanInvitation((short) 2), UserInviteToTenant ((short) 3); private final Short value; diff --git a/backend/core/src/main/java/org/opencdmp/commons/enums/DmpBlueprintExtraFieldDataType.java b/backend/core/src/main/java/org/opencdmp/commons/enums/DmpBlueprintExtraFieldDataType.java deleted file mode 100644 index c36a4c0e2..000000000 --- a/backend/core/src/main/java/org/opencdmp/commons/enums/DmpBlueprintExtraFieldDataType.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.opencdmp.commons.enums; - -import com.fasterxml.jackson.annotation.JsonValue; -import org.opencdmp.data.converters.enums.DatabaseEnum; - -import java.util.Map; - -public enum DmpBlueprintExtraFieldDataType implements DatabaseEnum { - - Text((short) 0), - RichTex((short) 1), - Date((short) 2), - Number((short) 3), - ; - - private final Short value; - - DmpBlueprintExtraFieldDataType(Short value) { - this.value = value; - } - - @JsonValue - public Short getValue() { - return value; - } - - private static final Map map = EnumUtils.getEnumValueMap(DmpBlueprintExtraFieldDataType.class); - - public static DmpBlueprintExtraFieldDataType of(Short i) { - return map.get(i); - } - - public static boolean isTextType(DmpBlueprintExtraFieldDataType fieldType){ - return fieldType.equals(DmpBlueprintExtraFieldDataType.Text) || fieldType.equals(DmpBlueprintExtraFieldDataType.RichTex); - } - - public static boolean isDateType(DmpBlueprintExtraFieldDataType fieldType){ - return fieldType.equals(DmpBlueprintExtraFieldDataType.Date); - } - - public static boolean isNumberType(DmpBlueprintExtraFieldDataType fieldType){ - return fieldType.equals(DmpBlueprintExtraFieldDataType.Number); - } - -} diff --git a/backend/core/src/main/java/org/opencdmp/commons/enums/DmpAccessType.java b/backend/core/src/main/java/org/opencdmp/commons/enums/PlanAccessType.java similarity index 62% rename from backend/core/src/main/java/org/opencdmp/commons/enums/DmpAccessType.java rename to backend/core/src/main/java/org/opencdmp/commons/enums/PlanAccessType.java index 9418774db..bb241e5d9 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/enums/DmpAccessType.java +++ b/backend/core/src/main/java/org/opencdmp/commons/enums/PlanAccessType.java @@ -5,13 +5,13 @@ import org.opencdmp.data.converters.enums.DatabaseEnum; import java.util.Map; -public enum DmpAccessType implements DatabaseEnum { +public enum PlanAccessType implements DatabaseEnum { Public((short) 0), Restricted((short) 1); private final Short value; - DmpAccessType(Short value) { + PlanAccessType(Short value) { this.value = value; } @@ -21,9 +21,9 @@ public enum DmpAccessType implements DatabaseEnum { return value; } - private static final Map map = EnumUtils.getEnumValueMap(DmpAccessType.class); + private static final Map map = EnumUtils.getEnumValueMap(PlanAccessType.class); - public static DmpAccessType of(Short i) { + public static PlanAccessType of(Short i) { return map.get(i); } diff --git a/backend/core/src/main/java/org/opencdmp/commons/enums/PlanBlueprintExtraFieldDataType.java b/backend/core/src/main/java/org/opencdmp/commons/enums/PlanBlueprintExtraFieldDataType.java new file mode 100644 index 000000000..e00c6bc41 --- /dev/null +++ b/backend/core/src/main/java/org/opencdmp/commons/enums/PlanBlueprintExtraFieldDataType.java @@ -0,0 +1,45 @@ +package org.opencdmp.commons.enums; + +import com.fasterxml.jackson.annotation.JsonValue; +import org.opencdmp.data.converters.enums.DatabaseEnum; + +import java.util.Map; + +public enum PlanBlueprintExtraFieldDataType implements DatabaseEnum { + + Text((short) 0), + RichTex((short) 1), + Date((short) 2), + Number((short) 3), + ; + + private final Short value; + + PlanBlueprintExtraFieldDataType(Short value) { + this.value = value; + } + + @JsonValue + public Short getValue() { + return value; + } + + private static final Map map = EnumUtils.getEnumValueMap(PlanBlueprintExtraFieldDataType.class); + + public static PlanBlueprintExtraFieldDataType of(Short i) { + return map.get(i); + } + + public static boolean isTextType(PlanBlueprintExtraFieldDataType fieldType){ + return fieldType.equals(PlanBlueprintExtraFieldDataType.Text) || fieldType.equals(PlanBlueprintExtraFieldDataType.RichTex); + } + + public static boolean isDateType(PlanBlueprintExtraFieldDataType fieldType){ + return fieldType.equals(PlanBlueprintExtraFieldDataType.Date); + } + + public static boolean isNumberType(PlanBlueprintExtraFieldDataType fieldType){ + return fieldType.equals(PlanBlueprintExtraFieldDataType.Number); + } + +} diff --git a/backend/core/src/main/java/org/opencdmp/commons/enums/DmpBlueprintFieldCategory.java b/backend/core/src/main/java/org/opencdmp/commons/enums/PlanBlueprintFieldCategory.java similarity index 67% rename from backend/core/src/main/java/org/opencdmp/commons/enums/DmpBlueprintFieldCategory.java rename to backend/core/src/main/java/org/opencdmp/commons/enums/PlanBlueprintFieldCategory.java index 2db7c80b2..5faffe198 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/enums/DmpBlueprintFieldCategory.java +++ b/backend/core/src/main/java/org/opencdmp/commons/enums/PlanBlueprintFieldCategory.java @@ -5,7 +5,7 @@ import org.opencdmp.data.converters.enums.DatabaseEnum; import java.util.Map; -public enum DmpBlueprintFieldCategory implements DatabaseEnum { +public enum PlanBlueprintFieldCategory implements DatabaseEnum { System((short) 0), Extra((short) 1), ReferenceType((short) 2); @@ -18,7 +18,7 @@ public enum DmpBlueprintFieldCategory implements DatabaseEnum { private final Short value; - DmpBlueprintFieldCategory(Short value) { + PlanBlueprintFieldCategory(Short value) { this.value = value; } @@ -27,9 +27,9 @@ public enum DmpBlueprintFieldCategory implements DatabaseEnum { return value; } - private static final Map map = EnumUtils.getEnumValueMap(DmpBlueprintFieldCategory.class); + private static final Map map = EnumUtils.getEnumValueMap(PlanBlueprintFieldCategory.class); - public static DmpBlueprintFieldCategory of(Short i) { + public static PlanBlueprintFieldCategory of(Short i) { return map.get(i); } } diff --git a/backend/core/src/main/java/org/opencdmp/commons/enums/DmpBlueprintStatus.java b/backend/core/src/main/java/org/opencdmp/commons/enums/PlanBlueprintStatus.java similarity index 59% rename from backend/core/src/main/java/org/opencdmp/commons/enums/DmpBlueprintStatus.java rename to backend/core/src/main/java/org/opencdmp/commons/enums/PlanBlueprintStatus.java index d82f48001..8e1045750 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/enums/DmpBlueprintStatus.java +++ b/backend/core/src/main/java/org/opencdmp/commons/enums/PlanBlueprintStatus.java @@ -5,14 +5,14 @@ import org.opencdmp.data.converters.enums.DatabaseEnum; import java.util.Map; -public enum DmpBlueprintStatus implements DatabaseEnum { +public enum PlanBlueprintStatus implements DatabaseEnum { Draft((short) 0), Finalized((short) 1); private final Short value; - DmpBlueprintStatus(Short value) { + PlanBlueprintStatus(Short value) { this.value = value; } @@ -21,9 +21,9 @@ public enum DmpBlueprintStatus implements DatabaseEnum { return value; } - private static final Map map = EnumUtils.getEnumValueMap(DmpBlueprintStatus.class); + private static final Map map = EnumUtils.getEnumValueMap(PlanBlueprintStatus.class); - public static DmpBlueprintStatus of(Short i) { + public static PlanBlueprintStatus of(Short i) { return map.get(i); } diff --git a/backend/core/src/main/java/org/opencdmp/commons/enums/DmpBlueprintSystemFieldType.java b/backend/core/src/main/java/org/opencdmp/commons/enums/PlanBlueprintSystemFieldType.java similarity index 60% rename from backend/core/src/main/java/org/opencdmp/commons/enums/DmpBlueprintSystemFieldType.java rename to backend/core/src/main/java/org/opencdmp/commons/enums/PlanBlueprintSystemFieldType.java index a04509453..63b8a2db9 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/enums/DmpBlueprintSystemFieldType.java +++ b/backend/core/src/main/java/org/opencdmp/commons/enums/PlanBlueprintSystemFieldType.java @@ -5,7 +5,7 @@ import org.opencdmp.data.converters.enums.DatabaseEnum; import java.util.Map; -public enum DmpBlueprintSystemFieldType implements DatabaseEnum { +public enum PlanBlueprintSystemFieldType implements DatabaseEnum { Title((short)0), Description((short)1), @@ -15,7 +15,7 @@ public enum DmpBlueprintSystemFieldType implements DatabaseEnum { User((short)5); private final Short value; - DmpBlueprintSystemFieldType(Short value) { + PlanBlueprintSystemFieldType(Short value) { this.value = value; } @@ -24,9 +24,9 @@ public enum DmpBlueprintSystemFieldType implements DatabaseEnum { return value; } - private static final Map map = EnumUtils.getEnumValueMap(DmpBlueprintSystemFieldType.class); + private static final Map map = EnumUtils.getEnumValueMap(PlanBlueprintSystemFieldType.class); - public static DmpBlueprintSystemFieldType of(Short i) { + public static PlanBlueprintSystemFieldType of(Short i) { return map.get(i); } } \ No newline at end of file diff --git a/backend/core/src/main/java/org/opencdmp/commons/enums/DmpBlueprintVersionStatus.java b/backend/core/src/main/java/org/opencdmp/commons/enums/PlanBlueprintVersionStatus.java similarity index 58% rename from backend/core/src/main/java/org/opencdmp/commons/enums/DmpBlueprintVersionStatus.java rename to backend/core/src/main/java/org/opencdmp/commons/enums/PlanBlueprintVersionStatus.java index 80fa6c976..2cfa01223 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/enums/DmpBlueprintVersionStatus.java +++ b/backend/core/src/main/java/org/opencdmp/commons/enums/PlanBlueprintVersionStatus.java @@ -5,7 +5,7 @@ import org.opencdmp.data.converters.enums.DatabaseEnum; import java.util.Map; -public enum DmpBlueprintVersionStatus implements DatabaseEnum { +public enum PlanBlueprintVersionStatus implements DatabaseEnum { Current((short) 0), Previous((short) 1), @@ -13,7 +13,7 @@ public enum DmpBlueprintVersionStatus implements DatabaseEnum { private final Short value; - DmpBlueprintVersionStatus(Short value) { + PlanBlueprintVersionStatus(Short value) { this.value = value; } @@ -23,9 +23,9 @@ public enum DmpBlueprintVersionStatus implements DatabaseEnum { return value; } - private static final Map map = EnumUtils.getEnumValueMap(DmpBlueprintVersionStatus.class); + private static final Map map = EnumUtils.getEnumValueMap(PlanBlueprintVersionStatus.class); - public static DmpBlueprintVersionStatus of(Short i) { + public static PlanBlueprintVersionStatus of(Short i) { return map.get(i); } diff --git a/backend/core/src/main/java/org/opencdmp/commons/enums/DmpStatus.java b/backend/core/src/main/java/org/opencdmp/commons/enums/PlanStatus.java similarity index 64% rename from backend/core/src/main/java/org/opencdmp/commons/enums/DmpStatus.java rename to backend/core/src/main/java/org/opencdmp/commons/enums/PlanStatus.java index 0cb33f250..7254750aa 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/enums/DmpStatus.java +++ b/backend/core/src/main/java/org/opencdmp/commons/enums/PlanStatus.java @@ -5,13 +5,13 @@ import org.opencdmp.data.converters.enums.DatabaseEnum; import java.util.Map; -public enum DmpStatus implements DatabaseEnum { +public enum PlanStatus implements DatabaseEnum { Draft((short) 0), Finalized((short) 1); private final Short value; - DmpStatus(Short value) { + PlanStatus(Short value) { this.value = value; } @@ -21,9 +21,9 @@ public enum DmpStatus implements DatabaseEnum { return value; } - private static final Map map = EnumUtils.getEnumValueMap(DmpStatus.class); + private static final Map map = EnumUtils.getEnumValueMap(PlanStatus.class); - public static DmpStatus of(Short i) { + public static PlanStatus of(Short i) { return map.get(i); } diff --git a/backend/core/src/main/java/org/opencdmp/commons/enums/DmpUserRole.java b/backend/core/src/main/java/org/opencdmp/commons/enums/PlanUserRole.java similarity index 66% rename from backend/core/src/main/java/org/opencdmp/commons/enums/DmpUserRole.java rename to backend/core/src/main/java/org/opencdmp/commons/enums/PlanUserRole.java index a8c8e252b..9c0ae19a6 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/enums/DmpUserRole.java +++ b/backend/core/src/main/java/org/opencdmp/commons/enums/PlanUserRole.java @@ -5,7 +5,7 @@ import org.opencdmp.data.converters.enums.DatabaseEnum; import java.util.Map; -public enum DmpUserRole implements DatabaseEnum { +public enum PlanUserRole implements DatabaseEnum { Owner((short) 0), Viewer((short) 1), @@ -14,7 +14,7 @@ public enum DmpUserRole implements DatabaseEnum { private final Short value; - DmpUserRole(Short value) { + PlanUserRole(Short value) { this.value = value; } @@ -24,9 +24,9 @@ public enum DmpUserRole implements DatabaseEnum { return this.value; } - private static final Map map = EnumUtils.getEnumValueMap(DmpUserRole.class); + private static final Map map = EnumUtils.getEnumValueMap(PlanUserRole.class); - public static DmpUserRole of(Short i) { + public static PlanUserRole of(Short i) { return map.get(i); } diff --git a/backend/core/src/main/java/org/opencdmp/commons/enums/DmpValidationOutput.java b/backend/core/src/main/java/org/opencdmp/commons/enums/PlanValidationOutput.java similarity index 58% rename from backend/core/src/main/java/org/opencdmp/commons/enums/DmpValidationOutput.java rename to backend/core/src/main/java/org/opencdmp/commons/enums/PlanValidationOutput.java index 2245df5b6..a770660e3 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/enums/DmpValidationOutput.java +++ b/backend/core/src/main/java/org/opencdmp/commons/enums/PlanValidationOutput.java @@ -5,14 +5,14 @@ import org.opencdmp.data.converters.enums.DatabaseEnum; import java.util.Map; -public enum DmpValidationOutput implements DatabaseEnum { +public enum PlanValidationOutput implements DatabaseEnum { Valid((short) 1), Invalid((short) 2); private final Short value; - DmpValidationOutput(Short value) { + PlanValidationOutput(Short value) { this.value = value; } @@ -21,9 +21,9 @@ public enum DmpValidationOutput implements DatabaseEnum { return value; } - private static final Map map = EnumUtils.getEnumValueMap(DmpValidationOutput.class); + private static final Map map = EnumUtils.getEnumValueMap(PlanValidationOutput.class); - public static DmpValidationOutput of(Short i) { + public static PlanValidationOutput of(Short i) { return map.get(i); } diff --git a/backend/core/src/main/java/org/opencdmp/commons/enums/DmpVersionStatus.java b/backend/core/src/main/java/org/opencdmp/commons/enums/PlanVersionStatus.java similarity index 62% rename from backend/core/src/main/java/org/opencdmp/commons/enums/DmpVersionStatus.java rename to backend/core/src/main/java/org/opencdmp/commons/enums/PlanVersionStatus.java index af6601322..70ad4a31d 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/enums/DmpVersionStatus.java +++ b/backend/core/src/main/java/org/opencdmp/commons/enums/PlanVersionStatus.java @@ -5,7 +5,7 @@ import org.opencdmp.data.converters.enums.DatabaseEnum; import java.util.Map; -public enum DmpVersionStatus implements DatabaseEnum { +public enum PlanVersionStatus implements DatabaseEnum { Current((short) 0), Previous((short) 1), @@ -13,7 +13,7 @@ public enum DmpVersionStatus implements DatabaseEnum { private final Short value; - DmpVersionStatus(Short value) { + PlanVersionStatus(Short value) { this.value = value; } @@ -23,9 +23,9 @@ public enum DmpVersionStatus implements DatabaseEnum { return value; } - private static final Map map = EnumUtils.getEnumValueMap(DmpVersionStatus.class); + private static final Map map = EnumUtils.getEnumValueMap(PlanVersionStatus.class); - public static DmpVersionStatus of(Short i) { + public static PlanVersionStatus of(Short i) { return map.get(i); } diff --git a/backend/core/src/main/java/org/opencdmp/commons/enums/RecentActivityItemType.java b/backend/core/src/main/java/org/opencdmp/commons/enums/RecentActivityItemType.java index e752e2c85..be6214eb9 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/enums/RecentActivityItemType.java +++ b/backend/core/src/main/java/org/opencdmp/commons/enums/RecentActivityItemType.java @@ -7,7 +7,7 @@ import java.util.Map; public enum RecentActivityItemType implements DatabaseEnum { - Dmp((short) 0), + Plan((short) 0), Description((short) 1); private final Short value; diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/actionconfirmation/DmpInvitationEntity.java b/backend/core/src/main/java/org/opencdmp/commons/types/actionconfirmation/PlanInvitationEntity.java similarity index 60% rename from backend/core/src/main/java/org/opencdmp/commons/types/actionconfirmation/DmpInvitationEntity.java rename to backend/core/src/main/java/org/opencdmp/commons/types/actionconfirmation/PlanInvitationEntity.java index e01d2ccc6..95c65b086 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/types/actionconfirmation/DmpInvitationEntity.java +++ b/backend/core/src/main/java/org/opencdmp/commons/types/actionconfirmation/PlanInvitationEntity.java @@ -1,22 +1,22 @@ package org.opencdmp.commons.types.actionconfirmation; -import org.opencdmp.commons.enums.DmpUserRole; +import org.opencdmp.commons.enums.PlanUserRole; import jakarta.xml.bind.annotation.*; import java.util.UUID; @XmlRootElement(name = "dmp-invitation") @XmlAccessorType(XmlAccessType.FIELD) -public class DmpInvitationEntity { +public class PlanInvitationEntity { @XmlAttribute(name = "email") private String email; @XmlAttribute(name = "dmp") - private UUID dmpId; + private UUID planId; @XmlAttribute(name = "dmp-role") - private DmpUserRole role; + private PlanUserRole role; public String getEmail() { return email; @@ -26,19 +26,19 @@ public class DmpInvitationEntity { this.email = email; } - public UUID getDmpId() { - return dmpId; + public UUID getPlanId() { + return planId; } - public void setDmpId(UUID dmpId) { - this.dmpId = dmpId; + public void setPlanId(UUID planId) { + this.planId = planId; } - public DmpUserRole getRole() { + public PlanUserRole getRole() { return role; } - public void setRole(DmpUserRole role) { + public void setRole(PlanUserRole role) { this.role = role; } } diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/dmp/DmpPropertiesEntity.java b/backend/core/src/main/java/org/opencdmp/commons/types/dmp/DmpPropertiesEntity.java deleted file mode 100644 index f32378fec..000000000 --- a/backend/core/src/main/java/org/opencdmp/commons/types/dmp/DmpPropertiesEntity.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.opencdmp.commons.types.dmp; - -import java.util.List; - -public class DmpPropertiesEntity { - - private List dmpBlueprintValues; - - private List contacts; - - public List getDmpBlueprintValues() { - return this.dmpBlueprintValues; - } - - public void setDmpBlueprintValues(List dmpBlueprintValues) { - this.dmpBlueprintValues = dmpBlueprintValues; - } - - public List getContacts() { - return this.contacts; - } - - public void setContacts(List contacts) { - this.contacts = contacts; - } - -} diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/ExtraFieldEntity.java b/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/ExtraFieldEntity.java deleted file mode 100644 index 9196add10..000000000 --- a/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/ExtraFieldEntity.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.opencdmp.commons.types.dmpblueprint; - -import org.opencdmp.commons.enums.DmpBlueprintExtraFieldDataType; -import org.opencdmp.commons.enums.DmpBlueprintFieldCategory; -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlAttribute; -import org.w3c.dom.Element; - -@XmlAccessorType(XmlAccessType.FIELD) -public class ExtraFieldEntity extends FieldEntity { - - @XmlAttribute(name="type") - private DmpBlueprintExtraFieldDataType type; - - public DmpBlueprintExtraFieldDataType getType() { - return type; - } - public void setType(DmpBlueprintExtraFieldDataType type) { - this.type = type; - } - -} diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/dmp/DmpBlueprintValueEntity.java b/backend/core/src/main/java/org/opencdmp/commons/types/plan/PlanBlueprintValueEntity.java similarity index 90% rename from backend/core/src/main/java/org/opencdmp/commons/types/dmp/DmpBlueprintValueEntity.java rename to backend/core/src/main/java/org/opencdmp/commons/types/plan/PlanBlueprintValueEntity.java index 1814f72c5..1223ec31e 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/types/dmp/DmpBlueprintValueEntity.java +++ b/backend/core/src/main/java/org/opencdmp/commons/types/plan/PlanBlueprintValueEntity.java @@ -1,9 +1,9 @@ -package org.opencdmp.commons.types.dmp; +package org.opencdmp.commons.types.plan; import java.time.Instant; import java.util.UUID; -public class DmpBlueprintValueEntity { +public class PlanBlueprintValueEntity { private UUID fieldId; diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/dmp/DmpContactEntity.java b/backend/core/src/main/java/org/opencdmp/commons/types/plan/PlanContactEntity.java similarity index 88% rename from backend/core/src/main/java/org/opencdmp/commons/types/dmp/DmpContactEntity.java rename to backend/core/src/main/java/org/opencdmp/commons/types/plan/PlanContactEntity.java index 9bdefd8be..dd4826162 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/types/dmp/DmpContactEntity.java +++ b/backend/core/src/main/java/org/opencdmp/commons/types/plan/PlanContactEntity.java @@ -1,7 +1,7 @@ -package org.opencdmp.commons.types.dmp; +package org.opencdmp.commons.types.plan; -public class DmpContactEntity { +public class PlanContactEntity { private String firstName; diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/plan/PlanPropertiesEntity.java b/backend/core/src/main/java/org/opencdmp/commons/types/plan/PlanPropertiesEntity.java new file mode 100644 index 000000000..1c9bb9fdf --- /dev/null +++ b/backend/core/src/main/java/org/opencdmp/commons/types/plan/PlanPropertiesEntity.java @@ -0,0 +1,27 @@ +package org.opencdmp.commons.types.plan; + +import java.util.List; + +public class PlanPropertiesEntity { + + private List planBlueprintValues; + + private List contacts; + + public List getPlanBlueprintValues() { + return this.planBlueprintValues; + } + + public void setPlanBlueprintValues(List planBlueprintValues) { + this.planBlueprintValues = planBlueprintValues; + } + + public List getContacts() { + return this.contacts; + } + + public void setContacts(List contacts) { + this.contacts = contacts; + } + +} diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/dmp/importexport/DmpBlueprintValueImportExport.java b/backend/core/src/main/java/org/opencdmp/commons/types/plan/importexport/PlanBlueprintValueImportExport.java similarity index 92% rename from backend/core/src/main/java/org/opencdmp/commons/types/dmp/importexport/DmpBlueprintValueImportExport.java rename to backend/core/src/main/java/org/opencdmp/commons/types/plan/importexport/PlanBlueprintValueImportExport.java index f31ad5b6c..f6693ed8e 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/types/dmp/importexport/DmpBlueprintValueImportExport.java +++ b/backend/core/src/main/java/org/opencdmp/commons/types/plan/importexport/PlanBlueprintValueImportExport.java @@ -1,4 +1,4 @@ -package org.opencdmp.commons.types.dmp.importexport; +package org.opencdmp.commons.types.plan.importexport; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; @@ -11,7 +11,7 @@ import java.util.UUID; @XmlAccessorType(XmlAccessType.FIELD) -public class DmpBlueprintValueImportExport { +public class PlanBlueprintValueImportExport { @XmlElement(name = "fieldId") private UUID fieldId; diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/dmp/importexport/DmpContactImportExport.java b/backend/core/src/main/java/org/opencdmp/commons/types/plan/importexport/PlanContactImportExport.java similarity index 91% rename from backend/core/src/main/java/org/opencdmp/commons/types/dmp/importexport/DmpContactImportExport.java rename to backend/core/src/main/java/org/opencdmp/commons/types/plan/importexport/PlanContactImportExport.java index 8cd41a94a..014b41098 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/types/dmp/importexport/DmpContactImportExport.java +++ b/backend/core/src/main/java/org/opencdmp/commons/types/plan/importexport/PlanContactImportExport.java @@ -1,4 +1,4 @@ -package org.opencdmp.commons.types.dmp.importexport; +package org.opencdmp.commons.types.plan.importexport; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; @@ -6,7 +6,7 @@ import jakarta.xml.bind.annotation.XmlElement; @XmlAccessorType(XmlAccessType.FIELD) -public class DmpContactImportExport { +public class PlanContactImportExport { @XmlElement(name = "name") private String name; diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/dmp/importexport/DmpDescriptionTemplateImportExport.java b/backend/core/src/main/java/org/opencdmp/commons/types/plan/importexport/PlanDescriptionTemplateImportExport.java similarity index 88% rename from backend/core/src/main/java/org/opencdmp/commons/types/dmp/importexport/DmpDescriptionTemplateImportExport.java rename to backend/core/src/main/java/org/opencdmp/commons/types/plan/importexport/PlanDescriptionTemplateImportExport.java index b066aed0d..bb2b8af23 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/types/dmp/importexport/DmpDescriptionTemplateImportExport.java +++ b/backend/core/src/main/java/org/opencdmp/commons/types/plan/importexport/PlanDescriptionTemplateImportExport.java @@ -1,4 +1,4 @@ -package org.opencdmp.commons.types.dmp.importexport; +package org.opencdmp.commons.types.plan.importexport; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; @@ -7,7 +7,7 @@ import jakarta.xml.bind.annotation.XmlElement; import java.util.UUID; @XmlAccessorType(XmlAccessType.FIELD) -public class DmpDescriptionTemplateImportExport { +public class PlanDescriptionTemplateImportExport { @XmlElement(name = "descriptionTemplateGroupId") private UUID descriptionTemplateGroupId; diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/dmp/importexport/DmpImportExport.java b/backend/core/src/main/java/org/opencdmp/commons/types/plan/importexport/PlanImportExport.java similarity index 72% rename from backend/core/src/main/java/org/opencdmp/commons/types/dmp/importexport/DmpImportExport.java rename to backend/core/src/main/java/org/opencdmp/commons/types/plan/importexport/PlanImportExport.java index 9c9868b2d..1b8800ca5 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/types/dmp/importexport/DmpImportExport.java +++ b/backend/core/src/main/java/org/opencdmp/commons/types/plan/importexport/PlanImportExport.java @@ -1,10 +1,10 @@ -package org.opencdmp.commons.types.dmp.importexport; +package org.opencdmp.commons.types.plan.importexport; import jakarta.xml.bind.annotation.*; import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import org.opencdmp.commons.enums.DmpAccessType; +import org.opencdmp.commons.enums.PlanAccessType; import org.opencdmp.commons.types.description.importexport.DescriptionImportExport; -import org.opencdmp.commons.types.dmpblueprint.importexport.BlueprintImportExport; +import org.opencdmp.commons.types.planblueprint.importexport.BlueprintImportExport; import org.opencdmp.commons.xmladapter.InstantXmlAdapter; import java.time.Instant; @@ -13,7 +13,7 @@ import java.util.UUID; @XmlRootElement(name = "dmp") @XmlAccessorType(XmlAccessType.FIELD) -public class DmpImportExport { +public class PlanImportExport { @XmlElement(name = "id") private UUID id; @@ -28,18 +28,18 @@ public class DmpImportExport { private String language; @XmlElement(name = "access") - private DmpAccessType access; + private PlanAccessType access; @XmlElement(name = "version") private Short version; @XmlElementWrapper(name = "contacts") @XmlElement(name = "contact") - private List contacts; + private List contacts; @XmlElementWrapper(name = "users") @XmlElement(name = "user") - private List users; + private List users; @XmlElement(name = "finalizedAt") @XmlJavaTypeAdapter(InstantXmlAdapter.class) @@ -54,15 +54,15 @@ public class DmpImportExport { @XmlElementWrapper(name = "blueprintValues") @XmlElement(name = "blueprintValue") - private List blueprintValues; + private List blueprintValues; @XmlElementWrapper(name = "descriptionTemplates") @XmlElement(name = "descriptionTemplate") - private List descriptionTemplates; + private List descriptionTemplates; @XmlElementWrapper(name = "references") @XmlElement(name = "reference") - private List references; + private List references; @XmlElementWrapper(name = "descriptions") @XmlElement(name = "description") @@ -101,27 +101,27 @@ public class DmpImportExport { } - public DmpAccessType getAccess() { + public PlanAccessType getAccess() { return this.access; } - public void setAccess(DmpAccessType access) { + public void setAccess(PlanAccessType access) { this.access = access; } - public List getContacts() { + public List getContacts() { return this.contacts; } - public void setContacts(List contacts) { + public void setContacts(List contacts) { this.contacts = contacts; } - public List getUsers() { + public List getUsers() { return this.users; } - public void setUsers(List users) { + public void setUsers(List users) { this.users = users; } @@ -149,27 +149,27 @@ public class DmpImportExport { this.blueprint = blueprint; } - public List getBlueprintValues() { + public List getBlueprintValues() { return this.blueprintValues; } - public void setBlueprintValues(List blueprintValues) { + public void setBlueprintValues(List blueprintValues) { this.blueprintValues = blueprintValues; } - public List getDescriptionTemplates() { + public List getDescriptionTemplates() { return this.descriptionTemplates; } - public void setDescriptionTemplates(List descriptionTemplates) { + public void setDescriptionTemplates(List descriptionTemplates) { this.descriptionTemplates = descriptionTemplates; } - public List getReferences() { + public List getReferences() { return this.references; } - public void setReferences(List references) { + public void setReferences(List references) { this.references = references; } diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/dmp/importexport/DmpReferenceImportExport.java b/backend/core/src/main/java/org/opencdmp/commons/types/plan/importexport/PlanReferenceImportExport.java similarity index 86% rename from backend/core/src/main/java/org/opencdmp/commons/types/dmp/importexport/DmpReferenceImportExport.java rename to backend/core/src/main/java/org/opencdmp/commons/types/plan/importexport/PlanReferenceImportExport.java index 3cb6ed966..fe6ab6154 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/types/dmp/importexport/DmpReferenceImportExport.java +++ b/backend/core/src/main/java/org/opencdmp/commons/types/plan/importexport/PlanReferenceImportExport.java @@ -1,4 +1,4 @@ -package org.opencdmp.commons.types.dmp.importexport; +package org.opencdmp.commons.types.plan.importexport; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; @@ -8,7 +8,7 @@ import org.opencdmp.commons.enums.ReferenceSourceType; import java.util.UUID; @XmlAccessorType(XmlAccessType.FIELD) -public class DmpReferenceImportExport { +public class PlanReferenceImportExport { @XmlElement(name = "id") private UUID id; @@ -19,7 +19,7 @@ public class DmpReferenceImportExport { @XmlElement(name = "fieldId") private UUID fieldId; @XmlElement(name = "type") - private DmpReferenceTypeImportExport type; + private PlanReferenceTypeImportExport type; @XmlElement(name = "source") private String source; @XmlElement(name = "sourceType") @@ -49,11 +49,11 @@ public class DmpReferenceImportExport { this.reference = reference; } - public DmpReferenceTypeImportExport getType() { + public PlanReferenceTypeImportExport getType() { return this.type; } - public void setType(DmpReferenceTypeImportExport type) { + public void setType(PlanReferenceTypeImportExport type) { this.type = type; } diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/dmp/importexport/DmpReferenceTypeImportExport.java b/backend/core/src/main/java/org/opencdmp/commons/types/plan/importexport/PlanReferenceTypeImportExport.java similarity index 79% rename from backend/core/src/main/java/org/opencdmp/commons/types/dmp/importexport/DmpReferenceTypeImportExport.java rename to backend/core/src/main/java/org/opencdmp/commons/types/plan/importexport/PlanReferenceTypeImportExport.java index c1f4de9ea..f6f5f2825 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/types/dmp/importexport/DmpReferenceTypeImportExport.java +++ b/backend/core/src/main/java/org/opencdmp/commons/types/plan/importexport/PlanReferenceTypeImportExport.java @@ -1,15 +1,13 @@ -package org.opencdmp.commons.types.dmp.importexport; +package org.opencdmp.commons.types.plan.importexport; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlAttribute; import jakarta.xml.bind.annotation.XmlElement; -import org.opencdmp.commons.enums.DmpUserRole; import java.util.UUID; @XmlAccessorType(XmlAccessType.FIELD) -public class DmpReferenceTypeImportExport { +public class PlanReferenceTypeImportExport { @XmlElement(name = "id") private UUID id; diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/dmp/importexport/DmpUserImportExport.java b/backend/core/src/main/java/org/opencdmp/commons/types/plan/importexport/PlanUserImportExport.java similarity index 78% rename from backend/core/src/main/java/org/opencdmp/commons/types/dmp/importexport/DmpUserImportExport.java rename to backend/core/src/main/java/org/opencdmp/commons/types/plan/importexport/PlanUserImportExport.java index 49c5a6d4c..29868289f 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/types/dmp/importexport/DmpUserImportExport.java +++ b/backend/core/src/main/java/org/opencdmp/commons/types/plan/importexport/PlanUserImportExport.java @@ -1,14 +1,14 @@ -package org.opencdmp.commons.types.dmp.importexport; +package org.opencdmp.commons.types.plan.importexport; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; -import org.opencdmp.commons.enums.DmpUserRole; +import org.opencdmp.commons.enums.PlanUserRole; import java.util.UUID; @XmlAccessorType(XmlAccessType.FIELD) -public class DmpUserImportExport { +public class PlanUserImportExport { @XmlElement(name = "id") private UUID id; @@ -17,7 +17,7 @@ public class DmpUserImportExport { private String name; @XmlElement(name = "role") - private DmpUserRole role; + private PlanUserRole role; @XmlElement(name = "sectionId") private UUID sectionId; @@ -38,11 +38,11 @@ public class DmpUserImportExport { this.name = name; } - public DmpUserRole getRole() { + public PlanUserRole getRole() { return this.role; } - public void setRole(DmpUserRole role) { + public void setRole(PlanUserRole role) { this.role = role; } diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/DefinitionEntity.java b/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/DefinitionEntity.java similarity index 94% rename from backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/DefinitionEntity.java rename to backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/DefinitionEntity.java index 12446b555..cdde1ca78 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/DefinitionEntity.java +++ b/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/DefinitionEntity.java @@ -1,4 +1,4 @@ -package org.opencdmp.commons.types.dmpblueprint; +package org.opencdmp.commons.types.planblueprint; import jakarta.xml.bind.annotation.*; diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/DescriptionTemplateEntity.java b/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/DescriptionTemplateEntity.java similarity index 96% rename from backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/DescriptionTemplateEntity.java rename to backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/DescriptionTemplateEntity.java index 8dd51c1c0..fb1f775f6 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/DescriptionTemplateEntity.java +++ b/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/DescriptionTemplateEntity.java @@ -1,4 +1,4 @@ -package org.opencdmp.commons.types.dmpblueprint; +package org.opencdmp.commons.types.planblueprint; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/ExtraFieldEntity.java b/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/ExtraFieldEntity.java new file mode 100644 index 000000000..248857946 --- /dev/null +++ b/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/ExtraFieldEntity.java @@ -0,0 +1,21 @@ +package org.opencdmp.commons.types.planblueprint; + +import org.opencdmp.commons.enums.PlanBlueprintExtraFieldDataType; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; + +@XmlAccessorType(XmlAccessType.FIELD) +public class ExtraFieldEntity extends FieldEntity { + + @XmlAttribute(name="type") + private PlanBlueprintExtraFieldDataType type; + + public PlanBlueprintExtraFieldDataType getType() { + return type; + } + public void setType(PlanBlueprintExtraFieldDataType type) { + this.type = type; + } + +} diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/FieldEntity.java b/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/FieldEntity.java similarity index 86% rename from backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/FieldEntity.java rename to backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/FieldEntity.java index ab217c93d..0e0dd3d2f 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/FieldEntity.java +++ b/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/FieldEntity.java @@ -1,9 +1,9 @@ -package org.opencdmp.commons.types.dmpblueprint; +package org.opencdmp.commons.types.planblueprint; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlAttribute; -import org.opencdmp.commons.enums.DmpBlueprintFieldCategory; +import org.opencdmp.commons.enums.PlanBlueprintFieldCategory; import java.util.List; import java.util.UUID; @@ -14,7 +14,7 @@ public abstract class FieldEntity { private UUID id; @XmlAttribute(name="category") - private DmpBlueprintFieldCategory category; + private PlanBlueprintFieldCategory category; @XmlAttribute(name="label") private String label; @@ -41,10 +41,10 @@ public abstract class FieldEntity { this.id = id; } - public DmpBlueprintFieldCategory getCategory() { + public PlanBlueprintFieldCategory getCategory() { return this.category; } - public void setCategory(DmpBlueprintFieldCategory category) { + public void setCategory(PlanBlueprintFieldCategory category) { this.category = category; } diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/ReferenceTypeFieldEntity.java b/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/ReferenceTypeFieldEntity.java similarity index 94% rename from backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/ReferenceTypeFieldEntity.java rename to backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/ReferenceTypeFieldEntity.java index baaaadfe3..911ca05e7 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/ReferenceTypeFieldEntity.java +++ b/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/ReferenceTypeFieldEntity.java @@ -1,4 +1,4 @@ -package org.opencdmp.commons.types.dmpblueprint; +package org.opencdmp.commons.types.planblueprint; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/SectionEntity.java b/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/SectionEntity.java similarity index 85% rename from backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/SectionEntity.java rename to backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/SectionEntity.java index 1555a8a9e..cbd329a0b 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/SectionEntity.java +++ b/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/SectionEntity.java @@ -1,7 +1,7 @@ -package org.opencdmp.commons.types.dmpblueprint; +package org.opencdmp.commons.types.planblueprint; import jakarta.xml.bind.annotation.*; -import org.opencdmp.commons.enums.DmpBlueprintFieldCategory; +import org.opencdmp.commons.enums.PlanBlueprintFieldCategory; import java.util.ArrayList; import java.util.List; @@ -24,9 +24,9 @@ public class SectionEntity { @XmlElementWrapper(name = "fields") @XmlElements({ - @XmlElement(name = DmpBlueprintFieldCategory.Names.Extra, type = ExtraFieldEntity.class), - @XmlElement(name = DmpBlueprintFieldCategory.Names.System, type = SystemFieldEntity.class), - @XmlElement(name = DmpBlueprintFieldCategory.Names.ReferenceType, type = ReferenceTypeFieldEntity.class), + @XmlElement(name = PlanBlueprintFieldCategory.Names.Extra, type = ExtraFieldEntity.class), + @XmlElement(name = PlanBlueprintFieldCategory.Names.System, type = SystemFieldEntity.class), + @XmlElement(name = PlanBlueprintFieldCategory.Names.ReferenceType, type = ReferenceTypeFieldEntity.class), }) private List fields; diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/SystemFieldEntity.java b/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/SystemFieldEntity.java similarity index 55% rename from backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/SystemFieldEntity.java rename to backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/SystemFieldEntity.java index 9983e1800..8b4c022d6 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/SystemFieldEntity.java +++ b/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/SystemFieldEntity.java @@ -1,20 +1,20 @@ -package org.opencdmp.commons.types.dmpblueprint; +package org.opencdmp.commons.types.planblueprint; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlAttribute; -import org.opencdmp.commons.enums.DmpBlueprintSystemFieldType; +import org.opencdmp.commons.enums.PlanBlueprintSystemFieldType; @XmlAccessorType(XmlAccessType.FIELD) public class SystemFieldEntity extends FieldEntity { @XmlAttribute(name="type") - private DmpBlueprintSystemFieldType type; + private PlanBlueprintSystemFieldType type; - public DmpBlueprintSystemFieldType getType() { + public PlanBlueprintSystemFieldType getType() { return this.type; } - public void setType(DmpBlueprintSystemFieldType type) { + public void setType(PlanBlueprintSystemFieldType type) { this.type = type; } } diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/importexport/BlueprintDefinitionImportExport.java b/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/importexport/BlueprintDefinitionImportExport.java similarity index 88% rename from backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/importexport/BlueprintDefinitionImportExport.java rename to backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/importexport/BlueprintDefinitionImportExport.java index df7167fa8..a5e646854 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/importexport/BlueprintDefinitionImportExport.java +++ b/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/importexport/BlueprintDefinitionImportExport.java @@ -1,4 +1,4 @@ -package org.opencdmp.commons.types.dmpblueprint.importexport; +package org.opencdmp.commons.types.planblueprint.importexport; import jakarta.xml.bind.annotation.*; diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/importexport/BlueprintDescriptionTemplateImportExport.java b/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/importexport/BlueprintDescriptionTemplateImportExport.java similarity index 96% rename from backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/importexport/BlueprintDescriptionTemplateImportExport.java rename to backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/importexport/BlueprintDescriptionTemplateImportExport.java index 213e41643..c58563429 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/importexport/BlueprintDescriptionTemplateImportExport.java +++ b/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/importexport/BlueprintDescriptionTemplateImportExport.java @@ -1,4 +1,4 @@ -package org.opencdmp.commons.types.dmpblueprint.importexport; +package org.opencdmp.commons.types.planblueprint.importexport; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/importexport/BlueprintExtraFieldImportExport.java b/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/importexport/BlueprintExtraFieldImportExport.java similarity index 86% rename from backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/importexport/BlueprintExtraFieldImportExport.java rename to backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/importexport/BlueprintExtraFieldImportExport.java index ea2dbdd7d..e9b534432 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/importexport/BlueprintExtraFieldImportExport.java +++ b/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/importexport/BlueprintExtraFieldImportExport.java @@ -1,10 +1,10 @@ -package org.opencdmp.commons.types.dmpblueprint.importexport; +package org.opencdmp.commons.types.planblueprint.importexport; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlAttribute; import jakarta.xml.bind.annotation.XmlElement; -import org.opencdmp.commons.enums.DmpBlueprintExtraFieldDataType; +import org.opencdmp.commons.enums.PlanBlueprintExtraFieldDataType; import java.util.List; import java.util.UUID; @@ -15,7 +15,7 @@ public class BlueprintExtraFieldImportExport { @XmlElement(name = "id") private UUID id; @XmlElement(name = "type") - private DmpBlueprintExtraFieldDataType type; + private PlanBlueprintExtraFieldDataType type; @XmlElement(name = "label") private String label; @XmlElement(name = "placeholder") @@ -37,11 +37,11 @@ public class BlueprintExtraFieldImportExport { this.id = id; } - public DmpBlueprintExtraFieldDataType getType() { + public PlanBlueprintExtraFieldDataType getType() { return this.type; } - public void setType(DmpBlueprintExtraFieldDataType type) { + public void setType(PlanBlueprintExtraFieldDataType type) { this.type = type; } diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/importexport/BlueprintImportExport.java b/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/importexport/BlueprintImportExport.java similarity index 69% rename from backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/importexport/BlueprintImportExport.java rename to backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/importexport/BlueprintImportExport.java index 402de9720..534d6970a 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/importexport/BlueprintImportExport.java +++ b/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/importexport/BlueprintImportExport.java @@ -1,4 +1,4 @@ -package org.opencdmp.commons.types.dmpblueprint.importexport; +package org.opencdmp.commons.types.planblueprint.importexport; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; @@ -18,7 +18,7 @@ public class BlueprintImportExport { private String label; @XmlElement(name = "definition") - private BlueprintDefinitionImportExport dmpBlueprintDefinition; + private BlueprintDefinitionImportExport planBlueprintDefinition; @XmlElement(name = "groupId") private UUID groupId; @@ -39,12 +39,12 @@ public class BlueprintImportExport { this.label = label; } - public BlueprintDefinitionImportExport getDmpBlueprintDefinition() { - return this.dmpBlueprintDefinition; + public BlueprintDefinitionImportExport getPlanBlueprintDefinition() { + return this.planBlueprintDefinition; } - public void setDmpBlueprintDefinition(BlueprintDefinitionImportExport dmpBlueprintDefinition) { - this.dmpBlueprintDefinition = dmpBlueprintDefinition; + public void setPlanBlueprintDefinition(BlueprintDefinitionImportExport planBlueprintDefinition) { + this.planBlueprintDefinition = planBlueprintDefinition; } public UUID getGroupId() { diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/importexport/BlueprintPrefillingSourceImportExport.java b/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/importexport/BlueprintPrefillingSourceImportExport.java similarity index 90% rename from backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/importexport/BlueprintPrefillingSourceImportExport.java rename to backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/importexport/BlueprintPrefillingSourceImportExport.java index 15ac45059..032578379 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/importexport/BlueprintPrefillingSourceImportExport.java +++ b/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/importexport/BlueprintPrefillingSourceImportExport.java @@ -1,4 +1,4 @@ -package org.opencdmp.commons.types.dmpblueprint.importexport; +package org.opencdmp.commons.types.planblueprint.importexport; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/importexport/BlueprintReferenceTypeFieldImportExport.java b/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/importexport/BlueprintReferenceTypeFieldImportExport.java similarity index 97% rename from backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/importexport/BlueprintReferenceTypeFieldImportExport.java rename to backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/importexport/BlueprintReferenceTypeFieldImportExport.java index 252e3be99..165bb74a1 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/importexport/BlueprintReferenceTypeFieldImportExport.java +++ b/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/importexport/BlueprintReferenceTypeFieldImportExport.java @@ -1,4 +1,4 @@ -package org.opencdmp.commons.types.dmpblueprint.importexport; +package org.opencdmp.commons.types.planblueprint.importexport; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/importexport/BlueprintSectionImportExport.java b/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/importexport/BlueprintSectionImportExport.java similarity index 98% rename from backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/importexport/BlueprintSectionImportExport.java rename to backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/importexport/BlueprintSectionImportExport.java index 890f0ff71..d5023448c 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/importexport/BlueprintSectionImportExport.java +++ b/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/importexport/BlueprintSectionImportExport.java @@ -1,4 +1,4 @@ -package org.opencdmp.commons.types.dmpblueprint.importexport; +package org.opencdmp.commons.types.planblueprint.importexport; import jakarta.xml.bind.annotation.*; diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/importexport/BlueprintSystemFieldImportExport.java b/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/importexport/BlueprintSystemFieldImportExport.java similarity index 87% rename from backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/importexport/BlueprintSystemFieldImportExport.java rename to backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/importexport/BlueprintSystemFieldImportExport.java index 0fa4ef93e..b7fe22e4c 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/types/dmpblueprint/importexport/BlueprintSystemFieldImportExport.java +++ b/backend/core/src/main/java/org/opencdmp/commons/types/planblueprint/importexport/BlueprintSystemFieldImportExport.java @@ -1,10 +1,10 @@ -package org.opencdmp.commons.types.dmpblueprint.importexport; +package org.opencdmp.commons.types.planblueprint.importexport; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlAttribute; import jakarta.xml.bind.annotation.XmlElement; -import org.opencdmp.commons.enums.DmpBlueprintSystemFieldType; +import org.opencdmp.commons.enums.PlanBlueprintSystemFieldType; import java.util.List; import java.util.UUID; @@ -15,7 +15,7 @@ public class BlueprintSystemFieldImportExport { @XmlElement(name = "id") private UUID id; @XmlElement(name = "type") - private DmpBlueprintSystemFieldType type; + private PlanBlueprintSystemFieldType type; @XmlElement(name = "label") private String label; @XmlElement(name = "placeholder") @@ -37,11 +37,11 @@ public class BlueprintSystemFieldImportExport { this.id = id; } - public DmpBlueprintSystemFieldType getType() { + public PlanBlueprintSystemFieldType getType() { return this.type; } - public void setType(DmpBlueprintSystemFieldType type) { + public void setType(PlanBlueprintSystemFieldType type) { this.type = type; } diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/dmpreference/DmpReferenceDataEntity.java b/backend/core/src/main/java/org/opencdmp/commons/types/planreference/PlanReferenceDataEntity.java similarity index 72% rename from backend/core/src/main/java/org/opencdmp/commons/types/dmpreference/DmpReferenceDataEntity.java rename to backend/core/src/main/java/org/opencdmp/commons/types/planreference/PlanReferenceDataEntity.java index 430e7e507..03c9970ee 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/types/dmpreference/DmpReferenceDataEntity.java +++ b/backend/core/src/main/java/org/opencdmp/commons/types/planreference/PlanReferenceDataEntity.java @@ -1,8 +1,8 @@ -package org.opencdmp.commons.types.dmpreference; +package org.opencdmp.commons.types.planreference; import java.util.UUID; -public class DmpReferenceDataEntity { +public class PlanReferenceDataEntity { private UUID blueprintFieldId; public UUID getBlueprintFieldId() { diff --git a/backend/core/src/main/java/org/opencdmp/data/DescriptionEntity.java b/backend/core/src/main/java/org/opencdmp/data/DescriptionEntity.java index e0cfab537..4eee26ace 100644 --- a/backend/core/src/main/java/org/opencdmp/data/DescriptionEntity.java +++ b/backend/core/src/main/java/org/opencdmp/data/DescriptionEntity.java @@ -71,12 +71,12 @@ public class DescriptionEntity extends TenantScopedBaseEntity { public static final String _createdById = "createdById"; @Column(name = "dmp_description_template", columnDefinition = "uuid", nullable = false) - private UUID dmpDescriptionTemplateId; - public static final String _dmpDescriptionTemplateId = "dmpDescriptionTemplateId"; + private UUID planDescriptionTemplateId; + public static final String _planDescriptionTemplateId = "planDescriptionTemplateId"; @Column(name = "dmp", columnDefinition = "uuid", nullable = false) - private UUID dmpId; - public static final String _dmpId = "dmpId"; + private UUID planId; + public static final String _planId = "planId"; @Column(name = "description_template", columnDefinition = "uuid", nullable = false) private UUID descriptionTemplateId; @@ -164,20 +164,20 @@ public class DescriptionEntity extends TenantScopedBaseEntity { this.createdById = createdById; } - public UUID getDmpDescriptionTemplateId() { - return this.dmpDescriptionTemplateId; + public UUID getPlanDescriptionTemplateId() { + return this.planDescriptionTemplateId; } - public void setDmpDescriptionTemplateId(UUID dmpDescriptionTemplateId) { - this.dmpDescriptionTemplateId = dmpDescriptionTemplateId; + public void setPlanDescriptionTemplateId(UUID planDescriptionTemplateId) { + this.planDescriptionTemplateId = planDescriptionTemplateId; } - public UUID getDmpId() { - return this.dmpId; + public UUID getPlanId() { + return this.planId; } - public void setDmpId(UUID dmpId) { - this.dmpId = dmpId; + public void setPlanId(UUID planId) { + this.planId = planId; } public UUID getDescriptionTemplateId() { diff --git a/backend/core/src/main/java/org/opencdmp/data/DmpBlueprintEntity.java b/backend/core/src/main/java/org/opencdmp/data/PlanBlueprintEntity.java similarity index 78% rename from backend/core/src/main/java/org/opencdmp/data/DmpBlueprintEntity.java rename to backend/core/src/main/java/org/opencdmp/data/PlanBlueprintEntity.java index bb6fabd6a..fd0cd835b 100644 --- a/backend/core/src/main/java/org/opencdmp/data/DmpBlueprintEntity.java +++ b/backend/core/src/main/java/org/opencdmp/data/PlanBlueprintEntity.java @@ -1,10 +1,10 @@ package org.opencdmp.data; -import org.opencdmp.commons.enums.DmpBlueprintStatus; -import org.opencdmp.commons.enums.DmpBlueprintVersionStatus; +import org.opencdmp.commons.enums.PlanBlueprintStatus; +import org.opencdmp.commons.enums.PlanBlueprintVersionStatus; import org.opencdmp.commons.enums.IsActive; -import org.opencdmp.data.converters.DmpBlueprintVersionStatusConverter; -import org.opencdmp.data.converters.enums.DmpBlueprintStatusConverter; +import org.opencdmp.data.converters.PlanBlueprintVersionStatusConverter; +import org.opencdmp.data.converters.enums.PlanBlueprintStatusConverter; import org.opencdmp.data.converters.enums.IsActiveConverter; import org.opencdmp.data.tenant.TenantScopedBaseEntity; import org.opencdmp.data.types.SQLXMLType; @@ -16,7 +16,7 @@ import java.util.UUID; @Entity @Table(name = "\"DmpBlueprint\"") -public class DmpBlueprintEntity extends TenantScopedBaseEntity { +public class PlanBlueprintEntity extends TenantScopedBaseEntity { @Id @Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false) @@ -24,7 +24,7 @@ public class DmpBlueprintEntity extends TenantScopedBaseEntity { public static final String _id = "id"; - @Column(name = "label", length = DmpBlueprintEntity._labelLength, nullable = false) + @Column(name = "label", length = PlanBlueprintEntity._labelLength, nullable = false) private String label; public static final String _label = "label"; @@ -38,8 +38,8 @@ public class DmpBlueprintEntity extends TenantScopedBaseEntity { public static final String _definition = "definition"; @Column(name = "status", nullable = false) - @Convert(converter = DmpBlueprintStatusConverter.class) - private DmpBlueprintStatus status; + @Convert(converter = PlanBlueprintStatusConverter.class) + private PlanBlueprintStatus status; public static final String _status = "status"; @@ -54,8 +54,8 @@ public class DmpBlueprintEntity extends TenantScopedBaseEntity { public static final String _version = "version"; @Column(name = "version_status", nullable = false) - @Convert(converter = DmpBlueprintVersionStatusConverter.class) - private DmpBlueprintVersionStatus versionStatus; + @Convert(converter = PlanBlueprintVersionStatusConverter.class) + private PlanBlueprintVersionStatus versionStatus; public static final String _versionStatus = "versionStatus"; @@ -99,11 +99,11 @@ public class DmpBlueprintEntity extends TenantScopedBaseEntity { this.definition = definition; } - public DmpBlueprintStatus getStatus() { + public PlanBlueprintStatus getStatus() { return status; } - public void setStatus(DmpBlueprintStatus status) { + public void setStatus(PlanBlueprintStatus status) { this.status = status; } @@ -123,11 +123,11 @@ public class DmpBlueprintEntity extends TenantScopedBaseEntity { this.version = version; } - public DmpBlueprintVersionStatus getVersionStatus() { + public PlanBlueprintVersionStatus getVersionStatus() { return versionStatus; } - public void setVersionStatus(DmpBlueprintVersionStatus versionStatus) { + public void setVersionStatus(PlanBlueprintVersionStatus versionStatus) { this.versionStatus = versionStatus; } diff --git a/backend/core/src/main/java/org/opencdmp/data/DmpDescriptionTemplateEntity.java b/backend/core/src/main/java/org/opencdmp/data/PlanDescriptionTemplateEntity.java similarity index 89% rename from backend/core/src/main/java/org/opencdmp/data/DmpDescriptionTemplateEntity.java rename to backend/core/src/main/java/org/opencdmp/data/PlanDescriptionTemplateEntity.java index 039dcb26b..b5186d56b 100644 --- a/backend/core/src/main/java/org/opencdmp/data/DmpDescriptionTemplateEntity.java +++ b/backend/core/src/main/java/org/opencdmp/data/PlanDescriptionTemplateEntity.java @@ -10,7 +10,7 @@ import java.util.UUID; @Entity @Table(name = "\"DmpDescriptionTemplate\"") -public class DmpDescriptionTemplateEntity extends TenantScopedBaseEntity { +public class PlanDescriptionTemplateEntity extends TenantScopedBaseEntity { @Id @Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)") @@ -19,9 +19,9 @@ public class DmpDescriptionTemplateEntity extends TenantScopedBaseEntity { public static final String _id = "id"; @Column(name = "dmp", columnDefinition = "uuid", nullable = false) - private UUID dmpId; + private UUID planId; - public static final String _dmpId = "dmpId"; + public static final String _planId = "planId"; @Column(name = "description_template_group", columnDefinition = "uuid", nullable = false) private UUID descriptionTemplateGroupId; @@ -57,12 +57,12 @@ public class DmpDescriptionTemplateEntity extends TenantScopedBaseEntity { this.id = id; } - public UUID getDmpId() { - return this.dmpId; + public UUID getPlanId() { + return this.planId; } - public void setDmpId(UUID dmpId) { - this.dmpId = dmpId; + public void setPlanId(UUID planId) { + this.planId = planId; } public UUID getDescriptionTemplateGroupId() { diff --git a/backend/core/src/main/java/org/opencdmp/data/DmpEntity.java b/backend/core/src/main/java/org/opencdmp/data/PlanEntity.java similarity index 83% rename from backend/core/src/main/java/org/opencdmp/data/DmpEntity.java rename to backend/core/src/main/java/org/opencdmp/data/PlanEntity.java index 970734a60..f976078a1 100644 --- a/backend/core/src/main/java/org/opencdmp/data/DmpEntity.java +++ b/backend/core/src/main/java/org/opencdmp/data/PlanEntity.java @@ -1,13 +1,13 @@ package org.opencdmp.data; import jakarta.persistence.*; -import org.opencdmp.commons.enums.DmpAccessType; -import org.opencdmp.commons.enums.DmpStatus; -import org.opencdmp.commons.enums.DmpVersionStatus; +import org.opencdmp.commons.enums.PlanAccessType; +import org.opencdmp.commons.enums.PlanStatus; +import org.opencdmp.commons.enums.PlanVersionStatus; import org.opencdmp.commons.enums.IsActive; -import org.opencdmp.data.converters.enums.DmpAccessTypeNullableConverter; -import org.opencdmp.data.converters.enums.DmpStatusConverter; -import org.opencdmp.data.converters.enums.DmpVersionStatusConverter; +import org.opencdmp.data.converters.enums.PlanAccessTypeNullableConverter; +import org.opencdmp.data.converters.enums.PlanStatusConverter; +import org.opencdmp.data.converters.enums.PlanVersionStatusConverter; import org.opencdmp.data.converters.enums.IsActiveConverter; import org.opencdmp.data.tenant.TenantScopedBaseEntity; @@ -16,7 +16,7 @@ import java.util.UUID; @Entity @Table(name = "\"Dmp\"") -public class DmpEntity extends TenantScopedBaseEntity { +public class PlanEntity extends TenantScopedBaseEntity { @Id @Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)") @@ -36,14 +36,14 @@ public class DmpEntity extends TenantScopedBaseEntity { public static final String _version = "version"; @Column(name = "version_status", nullable = false) - @Convert(converter = DmpVersionStatusConverter.class) - private DmpVersionStatus versionStatus; + @Convert(converter = PlanVersionStatusConverter.class) + private PlanVersionStatus versionStatus; public static final String _versionStatus = "versionStatus"; @Column(name = "status", nullable = false) - @Convert(converter = DmpStatusConverter.class) - private DmpStatus status; + @Convert(converter = PlanStatusConverter.class) + private PlanStatus status; public static final String _status = "status"; @@ -89,8 +89,8 @@ public class DmpEntity extends TenantScopedBaseEntity { public static final String _creatorId = "creatorId"; @Column(name = "access_type", nullable = true) - @Convert(converter = DmpAccessTypeNullableConverter.class) - private DmpAccessType accessType; + @Convert(converter = PlanAccessTypeNullableConverter.class) + private PlanAccessType accessType; public static final String _accessType = "accessType"; @@ -133,11 +133,11 @@ public class DmpEntity extends TenantScopedBaseEntity { this.version = version; } - public DmpStatus getStatus() { + public PlanStatus getStatus() { return this.status; } - public void setStatus(DmpStatus status) { + public void setStatus(PlanStatus status) { this.status = status; } @@ -205,11 +205,11 @@ public class DmpEntity extends TenantScopedBaseEntity { this.creatorId = creatorId; } - public DmpAccessType getAccessType() { + public PlanAccessType getAccessType() { return this.accessType; } - public void setAccessType(DmpAccessType accessType) { + public void setAccessType(PlanAccessType accessType) { this.accessType = accessType; } @@ -237,11 +237,11 @@ public class DmpEntity extends TenantScopedBaseEntity { this.publicAfter = publicAfter; } - public DmpVersionStatus getVersionStatus() { + public PlanVersionStatus getVersionStatus() { return this.versionStatus; } - public void setVersionStatus(DmpVersionStatus versionStatus) { + public void setVersionStatus(PlanVersionStatus versionStatus) { this.versionStatus = versionStatus; } } diff --git a/backend/core/src/main/java/org/opencdmp/data/DmpReferenceEntity.java b/backend/core/src/main/java/org/opencdmp/data/PlanReferenceEntity.java similarity index 89% rename from backend/core/src/main/java/org/opencdmp/data/DmpReferenceEntity.java rename to backend/core/src/main/java/org/opencdmp/data/PlanReferenceEntity.java index dd1649a23..39dc8f6d8 100644 --- a/backend/core/src/main/java/org/opencdmp/data/DmpReferenceEntity.java +++ b/backend/core/src/main/java/org/opencdmp/data/PlanReferenceEntity.java @@ -10,7 +10,7 @@ import java.util.UUID; @Entity @Table(name = "\"DmpReference\"") -public class DmpReferenceEntity extends TenantScopedBaseEntity { +public class PlanReferenceEntity extends TenantScopedBaseEntity { @Id @Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false) @@ -18,8 +18,8 @@ public class DmpReferenceEntity extends TenantScopedBaseEntity { public static final String _id = "id"; @Column(name = "dmp_id", columnDefinition = "uuid", nullable = false) - private UUID dmpId; - public static final String _dmpId = "dmpId"; + private UUID planId; + public static final String _planId = "planId"; @Column(name = "reference_id", columnDefinition = "uuid", nullable = false) private UUID referenceId; @@ -50,12 +50,12 @@ public class DmpReferenceEntity extends TenantScopedBaseEntity { this.id = id; } - public UUID getDmpId() { - return dmpId; + public UUID getPlanId() { + return planId; } - public void setDmpId(UUID dmpId) { - this.dmpId = dmpId; + public void setPlanId(UUID planId) { + this.planId = planId; } public UUID getReferenceId() { diff --git a/backend/core/src/main/java/org/opencdmp/data/DmpUserEntity.java b/backend/core/src/main/java/org/opencdmp/data/PlanUserEntity.java similarity index 81% rename from backend/core/src/main/java/org/opencdmp/data/DmpUserEntity.java rename to backend/core/src/main/java/org/opencdmp/data/PlanUserEntity.java index bc0027d55..e00558a3d 100644 --- a/backend/core/src/main/java/org/opencdmp/data/DmpUserEntity.java +++ b/backend/core/src/main/java/org/opencdmp/data/PlanUserEntity.java @@ -1,9 +1,9 @@ package org.opencdmp.data; import jakarta.persistence.*; -import org.opencdmp.commons.enums.DmpUserRole; +import org.opencdmp.commons.enums.PlanUserRole; import org.opencdmp.commons.enums.IsActive; -import org.opencdmp.data.converters.enums.DmpUserRoleConverter; +import org.opencdmp.data.converters.enums.PlanUserRoleConverter; import org.opencdmp.data.converters.enums.IsActiveConverter; import org.opencdmp.data.tenant.TenantScopedBaseEntity; @@ -12,7 +12,7 @@ import java.util.UUID; @Entity @Table(name = "\"DmpUser\"") -public class DmpUserEntity extends TenantScopedBaseEntity { +public class PlanUserEntity extends TenantScopedBaseEntity { @Id @Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)") @@ -21,9 +21,9 @@ public class DmpUserEntity extends TenantScopedBaseEntity { public static final String _id = "id"; @Column(name = "dmp", columnDefinition = "uuid", nullable = false) - private UUID dmpId; + private UUID planId; - public static final String _dmpId = "dmpId"; + public static final String _planId = "planId"; @Column(name = "\"user\"", columnDefinition = "uuid", nullable = false) private UUID userId; @@ -31,8 +31,8 @@ public class DmpUserEntity extends TenantScopedBaseEntity { public static final String _userId = "userId"; @Column(name = "role", nullable = false) - @Convert(converter = DmpUserRoleConverter.class) - private DmpUserRole role; + @Convert(converter = PlanUserRoleConverter.class) + private PlanUserRole role; public static final String _role = "role"; @@ -64,12 +64,12 @@ public class DmpUserEntity extends TenantScopedBaseEntity { this.id = id; } - public UUID getDmpId() { - return this.dmpId; + public UUID getPlanId() { + return this.planId; } - public void setDmpId(UUID dmpId) { - this.dmpId = dmpId; + public void setPlanId(UUID planId) { + this.planId = planId; } public UUID getUserId() { @@ -80,11 +80,11 @@ public class DmpUserEntity extends TenantScopedBaseEntity { this.userId = userId; } - public DmpUserRole getRole() { + public PlanUserRole getRole() { return this.role; } - public void setRole(DmpUserRole role) { + public void setRole(PlanUserRole role) { this.role = role; } diff --git a/backend/core/src/main/java/org/opencdmp/data/converters/DmpBlueprintVersionStatusConverter.java b/backend/core/src/main/java/org/opencdmp/data/converters/DmpBlueprintVersionStatusConverter.java deleted file mode 100644 index b09a827fc..000000000 --- a/backend/core/src/main/java/org/opencdmp/data/converters/DmpBlueprintVersionStatusConverter.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.opencdmp.data.converters; - -import org.opencdmp.commons.enums.DmpBlueprintVersionStatus; -import org.opencdmp.data.converters.enums.DatabaseEnumConverter; -import jakarta.persistence.Converter; - -@Converter -public class DmpBlueprintVersionStatusConverter extends DatabaseEnumConverter { - - @Override - protected DmpBlueprintVersionStatus of(Short i) { - return DmpBlueprintVersionStatus.of(i); - } - -} diff --git a/backend/core/src/main/java/org/opencdmp/data/converters/PlanBlueprintVersionStatusConverter.java b/backend/core/src/main/java/org/opencdmp/data/converters/PlanBlueprintVersionStatusConverter.java new file mode 100644 index 000000000..1fe184fe8 --- /dev/null +++ b/backend/core/src/main/java/org/opencdmp/data/converters/PlanBlueprintVersionStatusConverter.java @@ -0,0 +1,15 @@ +package org.opencdmp.data.converters; + +import org.opencdmp.commons.enums.PlanBlueprintVersionStatus; +import org.opencdmp.data.converters.enums.DatabaseEnumConverter; +import jakarta.persistence.Converter; + +@Converter +public class PlanBlueprintVersionStatusConverter extends DatabaseEnumConverter { + + @Override + protected PlanBlueprintVersionStatus of(Short i) { + return PlanBlueprintVersionStatus.of(i); + } + +} diff --git a/backend/core/src/main/java/org/opencdmp/data/converters/enums/DmpAccessTypeNullableConverter.java b/backend/core/src/main/java/org/opencdmp/data/converters/enums/DmpAccessTypeNullableConverter.java deleted file mode 100644 index 46df1d1a2..000000000 --- a/backend/core/src/main/java/org/opencdmp/data/converters/enums/DmpAccessTypeNullableConverter.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.opencdmp.data.converters.enums; - -import org.opencdmp.commons.enums.DmpAccessType; -import jakarta.persistence.Converter; - -@Converter -public class DmpAccessTypeNullableConverter extends DatabaseEnumConverter { - - @Override - protected DmpAccessType of(Short i) { - return DmpAccessType.of(i); - } - - - @Override - public Short convertToDatabaseColumn(DmpAccessType value) { - if (value == null) return null; - return value.getValue(); - } - - @Override - public DmpAccessType convertToEntityAttribute(Short dbData) { - return dbData == null ? null : this.of(dbData); - } -} diff --git a/backend/core/src/main/java/org/opencdmp/data/converters/enums/DmpBlueprintStatusConverter.java b/backend/core/src/main/java/org/opencdmp/data/converters/enums/DmpBlueprintStatusConverter.java deleted file mode 100644 index e1a740578..000000000 --- a/backend/core/src/main/java/org/opencdmp/data/converters/enums/DmpBlueprintStatusConverter.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.opencdmp.data.converters.enums; - -import org.opencdmp.commons.enums.DescriptionTemplateTypeStatus; -import org.opencdmp.commons.enums.DmpBlueprintStatus; -import jakarta.persistence.Converter; - -@Converter -public class DmpBlueprintStatusConverter extends DatabaseEnumConverter { - public DmpBlueprintStatus of(Short i) { - return DmpBlueprintStatus.of(i); - } -} diff --git a/backend/core/src/main/java/org/opencdmp/data/converters/enums/DmpStatusConverter.java b/backend/core/src/main/java/org/opencdmp/data/converters/enums/DmpStatusConverter.java deleted file mode 100644 index 940a4e197..000000000 --- a/backend/core/src/main/java/org/opencdmp/data/converters/enums/DmpStatusConverter.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.opencdmp.data.converters.enums; - -import org.opencdmp.commons.enums.DmpStatus; -import jakarta.persistence.Converter; - -@Converter -public class DmpStatusConverter extends DatabaseEnumConverter { - - @Override - protected DmpStatus of(Short i) { - return DmpStatus.of(i); - } - -} diff --git a/backend/core/src/main/java/org/opencdmp/data/converters/enums/DmpUserRoleConverter.java b/backend/core/src/main/java/org/opencdmp/data/converters/enums/DmpUserRoleConverter.java deleted file mode 100644 index 78c6f662f..000000000 --- a/backend/core/src/main/java/org/opencdmp/data/converters/enums/DmpUserRoleConverter.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.opencdmp.data.converters.enums; - -import org.opencdmp.commons.enums.DmpUserRole; -import jakarta.persistence.Converter; - -@Converter -public class DmpUserRoleConverter extends DatabaseEnumConverter { - - @Override - protected DmpUserRole of(Short i) { - return DmpUserRole.of(i); - } - -} diff --git a/backend/core/src/main/java/org/opencdmp/data/converters/enums/DmpVersionStatusConverter.java b/backend/core/src/main/java/org/opencdmp/data/converters/enums/DmpVersionStatusConverter.java deleted file mode 100644 index 16c9a7cdf..000000000 --- a/backend/core/src/main/java/org/opencdmp/data/converters/enums/DmpVersionStatusConverter.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.opencdmp.data.converters.enums; - -import org.opencdmp.commons.enums.DmpVersionStatus; -import jakarta.persistence.Converter; - -@Converter -public class DmpVersionStatusConverter extends DatabaseEnumConverter { - - @Override - protected DmpVersionStatus of(Short i) { - return DmpVersionStatus.of(i); - } - -} diff --git a/backend/core/src/main/java/org/opencdmp/data/converters/enums/PlanAccessTypeNullableConverter.java b/backend/core/src/main/java/org/opencdmp/data/converters/enums/PlanAccessTypeNullableConverter.java new file mode 100644 index 000000000..68466b5fc --- /dev/null +++ b/backend/core/src/main/java/org/opencdmp/data/converters/enums/PlanAccessTypeNullableConverter.java @@ -0,0 +1,25 @@ +package org.opencdmp.data.converters.enums; + +import org.opencdmp.commons.enums.PlanAccessType; +import jakarta.persistence.Converter; + +@Converter +public class PlanAccessTypeNullableConverter extends DatabaseEnumConverter { + + @Override + protected PlanAccessType of(Short i) { + return PlanAccessType.of(i); + } + + + @Override + public Short convertToDatabaseColumn(PlanAccessType value) { + if (value == null) return null; + return value.getValue(); + } + + @Override + public PlanAccessType convertToEntityAttribute(Short dbData) { + return dbData == null ? null : this.of(dbData); + } +} diff --git a/backend/core/src/main/java/org/opencdmp/data/converters/enums/PlanBlueprintStatusConverter.java b/backend/core/src/main/java/org/opencdmp/data/converters/enums/PlanBlueprintStatusConverter.java new file mode 100644 index 000000000..502c0ea01 --- /dev/null +++ b/backend/core/src/main/java/org/opencdmp/data/converters/enums/PlanBlueprintStatusConverter.java @@ -0,0 +1,11 @@ +package org.opencdmp.data.converters.enums; + +import org.opencdmp.commons.enums.PlanBlueprintStatus; +import jakarta.persistence.Converter; + +@Converter +public class PlanBlueprintStatusConverter extends DatabaseEnumConverter { + public PlanBlueprintStatus of(Short i) { + return PlanBlueprintStatus.of(i); + } +} diff --git a/backend/core/src/main/java/org/opencdmp/data/converters/enums/PlanStatusConverter.java b/backend/core/src/main/java/org/opencdmp/data/converters/enums/PlanStatusConverter.java new file mode 100644 index 000000000..db790afb6 --- /dev/null +++ b/backend/core/src/main/java/org/opencdmp/data/converters/enums/PlanStatusConverter.java @@ -0,0 +1,14 @@ +package org.opencdmp.data.converters.enums; + +import org.opencdmp.commons.enums.PlanStatus; +import jakarta.persistence.Converter; + +@Converter +public class PlanStatusConverter extends DatabaseEnumConverter { + + @Override + protected PlanStatus of(Short i) { + return PlanStatus.of(i); + } + +} diff --git a/backend/core/src/main/java/org/opencdmp/data/converters/enums/PlanUserRoleConverter.java b/backend/core/src/main/java/org/opencdmp/data/converters/enums/PlanUserRoleConverter.java new file mode 100644 index 000000000..031b90ca6 --- /dev/null +++ b/backend/core/src/main/java/org/opencdmp/data/converters/enums/PlanUserRoleConverter.java @@ -0,0 +1,14 @@ +package org.opencdmp.data.converters.enums; + +import org.opencdmp.commons.enums.PlanUserRole; +import jakarta.persistence.Converter; + +@Converter +public class PlanUserRoleConverter extends DatabaseEnumConverter { + + @Override + protected PlanUserRole of(Short i) { + return PlanUserRole.of(i); + } + +} diff --git a/backend/core/src/main/java/org/opencdmp/data/converters/enums/PlanVersionStatusConverter.java b/backend/core/src/main/java/org/opencdmp/data/converters/enums/PlanVersionStatusConverter.java new file mode 100644 index 000000000..b67db9b76 --- /dev/null +++ b/backend/core/src/main/java/org/opencdmp/data/converters/enums/PlanVersionStatusConverter.java @@ -0,0 +1,14 @@ +package org.opencdmp.data.converters.enums; + +import org.opencdmp.commons.enums.PlanVersionStatus; +import jakarta.persistence.Converter; + +@Converter +public class PlanVersionStatusConverter extends DatabaseEnumConverter { + + @Override + protected PlanVersionStatus of(Short i) { + return PlanVersionStatus.of(i); + } + +} diff --git a/backend/core/src/main/java/org/opencdmp/elastic/ElasticConfiguration.java b/backend/core/src/main/java/org/opencdmp/elastic/ElasticConfiguration.java index a8325dafe..219bca825 100644 --- a/backend/core/src/main/java/org/opencdmp/elastic/ElasticConfiguration.java +++ b/backend/core/src/main/java/org/opencdmp/elastic/ElasticConfiguration.java @@ -7,7 +7,6 @@ import gr.cite.tools.elastic.configuration.ElasticCertificateProvider; import gr.cite.tools.elastic.configuration.ElasticProperties; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.elasticsearch.core.convert.ElasticsearchCustomConversions; @@ -28,22 +27,22 @@ public class ElasticConfiguration extends AbstractElasticConfiguration { public ElasticsearchCustomConversions elasticsearchCustomConversions() { return new ElasticsearchCustomConversions( List.of( - new DmpUserRoleToShortConverter(), + new PlanUserRoleToShortConverter(), new DescriptionTemplateVersionStatusToShortConverter(), - new DmpStatusToShortConverter(), + new PlanStatusToShortConverter(), new DescriptionStatusToShortConverter(), new IsActiveToShortConverter(), - new DmpVersionStatusToShortConverter(), - new DmpAccessTypeToShortConverter(), + new PlanVersionStatusToShortConverter(), + new PlanAccessTypeToShortConverter(), - new ShortToDmpStatusConverter(), - new ShortToDmpUserRoleConverter(), + new ShortToPlanStatusConverter(), + new ShortToPlanUserRoleConverter(), new ShortToDescriptionTemplateVersionStatusConverter(), - new ShortToDmpStatusConverter(), + new ShortToPlanStatusConverter(), new ShortToDescriptionStatusConverter(), new ShortToIsActiveConverter(), - new ShortToDmpVersionStatusConverter(), - new ShortToDmpAccessTypeConverter() + new ShortToPlanVersionStatusConverter(), + new ShortToPlanAccessTypeConverter() )); } } diff --git a/backend/core/src/main/java/org/opencdmp/elastic/converter/DescriptionStatusToShortConverter.java b/backend/core/src/main/java/org/opencdmp/elastic/converter/DescriptionStatusToShortConverter.java index 55aaa86a3..4f163e6ee 100644 --- a/backend/core/src/main/java/org/opencdmp/elastic/converter/DescriptionStatusToShortConverter.java +++ b/backend/core/src/main/java/org/opencdmp/elastic/converter/DescriptionStatusToShortConverter.java @@ -1,7 +1,6 @@ package org.opencdmp.elastic.converter; import org.opencdmp.commons.enums.DescriptionStatus; -import org.opencdmp.commons.enums.DmpStatus; import org.springframework.core.convert.converter.Converter; import org.springframework.data.convert.WritingConverter; diff --git a/backend/core/src/main/java/org/opencdmp/elastic/converter/IsActiveToShortConverter.java b/backend/core/src/main/java/org/opencdmp/elastic/converter/IsActiveToShortConverter.java index c8c93d851..c337a0721 100644 --- a/backend/core/src/main/java/org/opencdmp/elastic/converter/IsActiveToShortConverter.java +++ b/backend/core/src/main/java/org/opencdmp/elastic/converter/IsActiveToShortConverter.java @@ -1,6 +1,5 @@ package org.opencdmp.elastic.converter; -import org.opencdmp.commons.enums.DmpStatus; import org.opencdmp.commons.enums.IsActive; import org.springframework.core.convert.converter.Converter; import org.springframework.data.convert.WritingConverter; diff --git a/backend/core/src/main/java/org/opencdmp/elastic/converter/DmpAccessTypeToShortConverter.java b/backend/core/src/main/java/org/opencdmp/elastic/converter/PlanAccessTypeToShortConverter.java similarity index 54% rename from backend/core/src/main/java/org/opencdmp/elastic/converter/DmpAccessTypeToShortConverter.java rename to backend/core/src/main/java/org/opencdmp/elastic/converter/PlanAccessTypeToShortConverter.java index edd116619..2cb171c0d 100644 --- a/backend/core/src/main/java/org/opencdmp/elastic/converter/DmpAccessTypeToShortConverter.java +++ b/backend/core/src/main/java/org/opencdmp/elastic/converter/PlanAccessTypeToShortConverter.java @@ -1,13 +1,13 @@ package org.opencdmp.elastic.converter; -import org.opencdmp.commons.enums.DmpAccessType; +import org.opencdmp.commons.enums.PlanAccessType; import org.springframework.core.convert.converter.Converter; import org.springframework.data.convert.WritingConverter; @WritingConverter -public class DmpAccessTypeToShortConverter implements Converter { +public class PlanAccessTypeToShortConverter implements Converter { @Override - public Short convert(DmpAccessType source) { + public Short convert(PlanAccessType source) { return source.getValue(); } } diff --git a/backend/core/src/main/java/org/opencdmp/elastic/converter/DmpStatusToShortConverter.java b/backend/core/src/main/java/org/opencdmp/elastic/converter/PlanStatusToShortConverter.java similarity index 56% rename from backend/core/src/main/java/org/opencdmp/elastic/converter/DmpStatusToShortConverter.java rename to backend/core/src/main/java/org/opencdmp/elastic/converter/PlanStatusToShortConverter.java index fef1380e6..c80020e6d 100644 --- a/backend/core/src/main/java/org/opencdmp/elastic/converter/DmpStatusToShortConverter.java +++ b/backend/core/src/main/java/org/opencdmp/elastic/converter/PlanStatusToShortConverter.java @@ -1,13 +1,13 @@ package org.opencdmp.elastic.converter; -import org.opencdmp.commons.enums.DmpStatus; +import org.opencdmp.commons.enums.PlanStatus; import org.springframework.core.convert.converter.Converter; import org.springframework.data.convert.WritingConverter; @WritingConverter -public class DmpStatusToShortConverter implements Converter { +public class PlanStatusToShortConverter implements Converter { @Override - public Short convert(DmpStatus source) { + public Short convert(PlanStatus source) { return source.getValue(); } } diff --git a/backend/core/src/main/java/org/opencdmp/elastic/converter/DmpUserRoleToShortConverter.java b/backend/core/src/main/java/org/opencdmp/elastic/converter/PlanUserRoleToShortConverter.java similarity index 55% rename from backend/core/src/main/java/org/opencdmp/elastic/converter/DmpUserRoleToShortConverter.java rename to backend/core/src/main/java/org/opencdmp/elastic/converter/PlanUserRoleToShortConverter.java index 7b74c6b14..065904809 100644 --- a/backend/core/src/main/java/org/opencdmp/elastic/converter/DmpUserRoleToShortConverter.java +++ b/backend/core/src/main/java/org/opencdmp/elastic/converter/PlanUserRoleToShortConverter.java @@ -1,13 +1,13 @@ package org.opencdmp.elastic.converter; -import org.opencdmp.commons.enums.DmpUserRole; +import org.opencdmp.commons.enums.PlanUserRole; import org.springframework.core.convert.converter.Converter; import org.springframework.data.convert.WritingConverter; @WritingConverter -public class DmpUserRoleToShortConverter implements Converter { +public class PlanUserRoleToShortConverter implements Converter { @Override - public Short convert(DmpUserRole source) { + public Short convert(PlanUserRole source) { return source.getValue(); } } diff --git a/backend/core/src/main/java/org/opencdmp/elastic/converter/DmpVersionStatusToShortConverter.java b/backend/core/src/main/java/org/opencdmp/elastic/converter/PlanVersionStatusToShortConverter.java similarity index 52% rename from backend/core/src/main/java/org/opencdmp/elastic/converter/DmpVersionStatusToShortConverter.java rename to backend/core/src/main/java/org/opencdmp/elastic/converter/PlanVersionStatusToShortConverter.java index 0709ee264..0b3e114a6 100644 --- a/backend/core/src/main/java/org/opencdmp/elastic/converter/DmpVersionStatusToShortConverter.java +++ b/backend/core/src/main/java/org/opencdmp/elastic/converter/PlanVersionStatusToShortConverter.java @@ -1,13 +1,13 @@ package org.opencdmp.elastic.converter; -import org.opencdmp.commons.enums.DmpVersionStatus; +import org.opencdmp.commons.enums.PlanVersionStatus; import org.springframework.core.convert.converter.Converter; import org.springframework.data.convert.WritingConverter; @WritingConverter -public class DmpVersionStatusToShortConverter implements Converter { +public class PlanVersionStatusToShortConverter implements Converter { @Override - public Short convert(DmpVersionStatus source) { + public Short convert(PlanVersionStatus source) { return source.getValue(); } } diff --git a/backend/core/src/main/java/org/opencdmp/elastic/converter/ShortToDmpAccessTypeConverter.java b/backend/core/src/main/java/org/opencdmp/elastic/converter/ShortToDmpAccessTypeConverter.java deleted file mode 100644 index 93fead4a5..000000000 --- a/backend/core/src/main/java/org/opencdmp/elastic/converter/ShortToDmpAccessTypeConverter.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.opencdmp.elastic.converter; - -import org.opencdmp.commons.enums.DmpAccessType; -import org.springframework.core.convert.converter.Converter; -import org.springframework.data.convert.ReadingConverter; -import org.springframework.data.convert.WritingConverter; - -@ReadingConverter -public class ShortToDmpAccessTypeConverter implements Converter { - @Override - public DmpAccessType convert(Integer source) { - return DmpAccessType.of(source.shortValue()); - } -} diff --git a/backend/core/src/main/java/org/opencdmp/elastic/converter/ShortToDmpUserRoleConverter.java b/backend/core/src/main/java/org/opencdmp/elastic/converter/ShortToDmpUserRoleConverter.java deleted file mode 100644 index 0a9356c75..000000000 --- a/backend/core/src/main/java/org/opencdmp/elastic/converter/ShortToDmpUserRoleConverter.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.opencdmp.elastic.converter; - -import org.opencdmp.commons.enums.DmpUserRole; -import org.springframework.core.convert.converter.Converter; -import org.springframework.data.convert.ReadingConverter; -import org.springframework.data.convert.WritingConverter; - -@ReadingConverter -public class ShortToDmpUserRoleConverter implements Converter { - @Override - public DmpUserRole convert(Integer source) { - return DmpUserRole.of(source.shortValue()); - } -} diff --git a/backend/core/src/main/java/org/opencdmp/elastic/converter/ShortToDmpVersionStatusConverter.java b/backend/core/src/main/java/org/opencdmp/elastic/converter/ShortToDmpVersionStatusConverter.java deleted file mode 100644 index 7e1b47f55..000000000 --- a/backend/core/src/main/java/org/opencdmp/elastic/converter/ShortToDmpVersionStatusConverter.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.opencdmp.elastic.converter; - -import org.opencdmp.commons.enums.DmpVersionStatus; -import org.springframework.core.convert.converter.Converter; -import org.springframework.data.convert.ReadingConverter; -import org.springframework.data.convert.WritingConverter; - -@ReadingConverter -public class ShortToDmpVersionStatusConverter implements Converter { - @Override - public DmpVersionStatus convert(Integer source) { - return DmpVersionStatus.of(source.shortValue()); - } -} diff --git a/backend/core/src/main/java/org/opencdmp/elastic/converter/ShortToPlanAccessTypeConverter.java b/backend/core/src/main/java/org/opencdmp/elastic/converter/ShortToPlanAccessTypeConverter.java new file mode 100644 index 000000000..dcceb3c6b --- /dev/null +++ b/backend/core/src/main/java/org/opencdmp/elastic/converter/ShortToPlanAccessTypeConverter.java @@ -0,0 +1,13 @@ +package org.opencdmp.elastic.converter; + +import org.opencdmp.commons.enums.PlanAccessType; +import org.springframework.core.convert.converter.Converter; +import org.springframework.data.convert.ReadingConverter; + +@ReadingConverter +public class ShortToPlanAccessTypeConverter implements Converter { + @Override + public PlanAccessType convert(Integer source) { + return PlanAccessType.of(source.shortValue()); + } +} diff --git a/backend/core/src/main/java/org/opencdmp/elastic/converter/ShortToDmpStatusConverter.java b/backend/core/src/main/java/org/opencdmp/elastic/converter/ShortToPlanStatusConverter.java similarity index 57% rename from backend/core/src/main/java/org/opencdmp/elastic/converter/ShortToDmpStatusConverter.java rename to backend/core/src/main/java/org/opencdmp/elastic/converter/ShortToPlanStatusConverter.java index 17b2722bb..aa4c8f748 100644 --- a/backend/core/src/main/java/org/opencdmp/elastic/converter/ShortToDmpStatusConverter.java +++ b/backend/core/src/main/java/org/opencdmp/elastic/converter/ShortToPlanStatusConverter.java @@ -5,10 +5,10 @@ import org.springframework.core.convert.converter.Converter; import org.springframework.data.convert.ReadingConverter; @ReadingConverter -public class ShortToDmpStatusConverter implements Converter { +public class ShortToPlanStatusConverter implements Converter { @Override - public DmpStatus convert(Integer source) { - return DmpStatus.of(source.shortValue()); + public PlanStatus convert(Integer source) { + return PlanStatus.of(source.shortValue()); } } diff --git a/backend/core/src/main/java/org/opencdmp/elastic/converter/ShortToPlanUserRoleConverter.java b/backend/core/src/main/java/org/opencdmp/elastic/converter/ShortToPlanUserRoleConverter.java new file mode 100644 index 000000000..0b4d43e61 --- /dev/null +++ b/backend/core/src/main/java/org/opencdmp/elastic/converter/ShortToPlanUserRoleConverter.java @@ -0,0 +1,13 @@ +package org.opencdmp.elastic.converter; + +import org.opencdmp.commons.enums.PlanUserRole; +import org.springframework.core.convert.converter.Converter; +import org.springframework.data.convert.ReadingConverter; + +@ReadingConverter +public class ShortToPlanUserRoleConverter implements Converter { + @Override + public PlanUserRole convert(Integer source) { + return PlanUserRole.of(source.shortValue()); + } +} diff --git a/backend/core/src/main/java/org/opencdmp/elastic/converter/ShortToPlanVersionStatusConverter.java b/backend/core/src/main/java/org/opencdmp/elastic/converter/ShortToPlanVersionStatusConverter.java new file mode 100644 index 000000000..20488c317 --- /dev/null +++ b/backend/core/src/main/java/org/opencdmp/elastic/converter/ShortToPlanVersionStatusConverter.java @@ -0,0 +1,13 @@ +package org.opencdmp.elastic.converter; + +import org.opencdmp.commons.enums.PlanVersionStatus; +import org.springframework.core.convert.converter.Converter; +import org.springframework.data.convert.ReadingConverter; + +@ReadingConverter +public class ShortToPlanVersionStatusConverter implements Converter { + @Override + public PlanVersionStatus convert(Integer source) { + return PlanVersionStatus.of(source.shortValue()); + } +} diff --git a/backend/core/src/main/java/org/opencdmp/elastic/data/DescriptionElasticEntity.java b/backend/core/src/main/java/org/opencdmp/elastic/data/DescriptionElasticEntity.java index 773166327..2b21324cc 100644 --- a/backend/core/src/main/java/org/opencdmp/elastic/data/DescriptionElasticEntity.java +++ b/backend/core/src/main/java/org/opencdmp/elastic/data/DescriptionElasticEntity.java @@ -3,7 +3,7 @@ package org.opencdmp.elastic.data; import gr.cite.tools.elastic.ElasticConstants; import org.opencdmp.commons.enums.DescriptionStatus; import org.opencdmp.elastic.data.nested.NestedDescriptionTemplateElasticEntity; -import org.opencdmp.elastic.data.nested.NestedDmpElasticEntity; +import org.opencdmp.elastic.data.nested.NestedPlanElasticEntity; import org.opencdmp.elastic.data.nested.NestedReferenceElasticEntity; import org.opencdmp.elastic.data.nested.NestedTagElasticEntity; import org.springframework.data.annotation.Id; @@ -50,7 +50,7 @@ public class DescriptionElasticEntity { public final static String _descriptionTemplate = "descriptionTemplate"; @Field(value = DescriptionElasticEntity._dmp, type = FieldType.Object) - private NestedDmpElasticEntity dmp; + private NestedPlanElasticEntity dmp; public final static String _dmp = "dmp"; @Field(value = DescriptionElasticEntity._references, type = FieldType.Nested) @@ -129,11 +129,11 @@ public class DescriptionElasticEntity { this.descriptionTemplate = descriptionTemplate; } - public NestedDmpElasticEntity getDmp() { + public NestedPlanElasticEntity getDmp() { return this.dmp; } - public void setDmp(NestedDmpElasticEntity dmp) { + public void setDmp(NestedPlanElasticEntity dmp) { this.dmp = dmp; } diff --git a/backend/core/src/main/java/org/opencdmp/elastic/data/DmpElasticEntity.java b/backend/core/src/main/java/org/opencdmp/elastic/data/PlanElasticEntity.java similarity index 64% rename from backend/core/src/main/java/org/opencdmp/elastic/data/DmpElasticEntity.java rename to backend/core/src/main/java/org/opencdmp/elastic/data/PlanElasticEntity.java index 72c13cae1..e5419ae3f 100644 --- a/backend/core/src/main/java/org/opencdmp/elastic/data/DmpElasticEntity.java +++ b/backend/core/src/main/java/org/opencdmp/elastic/data/PlanElasticEntity.java @@ -1,9 +1,9 @@ package org.opencdmp.elastic.data; import gr.cite.tools.elastic.ElasticConstants; -import org.opencdmp.commons.enums.DmpAccessType; -import org.opencdmp.commons.enums.DmpStatus; -import org.opencdmp.commons.enums.DmpVersionStatus; +import org.opencdmp.commons.enums.PlanAccessType; +import org.opencdmp.commons.enums.PlanStatus; +import org.opencdmp.commons.enums.PlanVersionStatus; import org.opencdmp.elastic.data.nested.*; import org.springframework.data.annotation.Id; import org.springframework.data.elasticsearch.annotations.*; @@ -13,80 +13,80 @@ import java.util.List; import java.util.UUID; @Document(indexName = "dmp") -public class DmpElasticEntity { +public class PlanElasticEntity { @Id - @Field(value = DmpElasticEntity._id, type = FieldType.Keyword) + @Field(value = PlanElasticEntity._id, type = FieldType.Keyword) private UUID id; public final static String _id = "id"; - @Field(value = DmpElasticEntity._tenantId, type = FieldType.Keyword) + @Field(value = PlanElasticEntity._tenantId, type = FieldType.Keyword) private UUID tenantId; public final static String _tenantId = "tenantId"; - @MultiField(mainField = @Field(value = DmpElasticEntity._label, type = FieldType.Text), otherFields = @InnerField(suffix = ElasticConstants.SubFields.keyword, type = FieldType.Keyword)) + @MultiField(mainField = @Field(value = PlanElasticEntity._label, type = FieldType.Text), otherFields = @InnerField(suffix = ElasticConstants.SubFields.keyword, type = FieldType.Keyword)) private String label; public final static String _label = "label"; - @Field(value = DmpElasticEntity._description, type = FieldType.Text) + @Field(value = PlanElasticEntity._description, type = FieldType.Text) private String description; public final static String _description = "description"; - @Field(value = DmpElasticEntity._version, type = FieldType.Keyword) + @Field(value = PlanElasticEntity._version, type = FieldType.Keyword) private Short version; public final static String _version = "version"; - @Field(value = DmpElasticEntity._status, type = FieldType.Short) - private DmpStatus status; + @Field(value = PlanElasticEntity._status, type = FieldType.Short) + private PlanStatus status; public final static String _status = "status"; - @Field(value = DmpElasticEntity._accessType, type = FieldType.Short) - private DmpAccessType accessType; + @Field(value = PlanElasticEntity._accessType, type = FieldType.Short) + private PlanAccessType accessType; public final static String _accessType = "accessType"; - @Field(value = DmpElasticEntity._versionStatus, type = FieldType.Short) - private DmpVersionStatus versionStatus; + @Field(value = PlanElasticEntity._versionStatus, type = FieldType.Short) + private PlanVersionStatus versionStatus; public final static String _versionStatus = "versionStatus"; - @Field(value = DmpElasticEntity._language, type = FieldType.Keyword) + @Field(value = PlanElasticEntity._language, type = FieldType.Keyword) private String language; public final static String _language = "language"; - @Field(value = DmpElasticEntity._blueprintId, type = FieldType.Keyword) + @Field(value = PlanElasticEntity._blueprintId, type = FieldType.Keyword) private UUID blueprintId; public final static String _blueprintId = "blueprintId"; - @Field(value = DmpElasticEntity._groupId, type = FieldType.Keyword) + @Field(value = PlanElasticEntity._groupId, type = FieldType.Keyword) private UUID groupId; public final static String _groupId = "groupId"; - @Field(value = DmpElasticEntity._finalizedAt, type = FieldType.Date) + @Field(value = PlanElasticEntity._finalizedAt, type = FieldType.Date) private Date finalizedAt; public final static String _finalizedAt = "finalizedAt"; - @Field(value = DmpElasticEntity._references, type = FieldType.Nested) + @Field(value = PlanElasticEntity._references, type = FieldType.Nested) private List references; public final static String _references = "references"; - @Field(value = DmpElasticEntity._collaborators, type = FieldType.Nested) + @Field(value = PlanElasticEntity._collaborators, type = FieldType.Nested) private List collaborators; public final static String _collaborators = "collaborators"; - @Field(value = DmpElasticEntity._descriptions, type = FieldType.Nested) + @Field(value = PlanElasticEntity._descriptions, type = FieldType.Nested) private List descriptions; public final static String _descriptions = "descriptions"; - @Field(value = DmpElasticEntity._dmpDescriptionTemplates, type = FieldType.Nested) - private List dmpDescriptionTemplates; + @Field(value = PlanElasticEntity._dmpDescriptionTemplates, type = FieldType.Nested) + private List planDescriptionTemplates; public final static String _dmpDescriptionTemplates = "dmpDescriptionTemplates"; - @Field(value = DmpElasticEntity._dois, type = FieldType.Nested) + @Field(value = PlanElasticEntity._dois, type = FieldType.Nested) private List dois; public final static String _dois = "dois"; - @Field(value = DmpElasticEntity._updatedAt, type = FieldType.Date) + @Field(value = PlanElasticEntity._updatedAt, type = FieldType.Date) private Date updatedAt; public final static String _updatedAt = "updatedAt"; - @Field(value = DmpElasticEntity._createdAt, type = FieldType.Date) + @Field(value = PlanElasticEntity._createdAt, type = FieldType.Date) private Date createdAt; public final static String _createdAt = "createdAt"; @@ -130,19 +130,19 @@ public class DmpElasticEntity { this.version = version; } - public DmpStatus getStatus() { + public PlanStatus getStatus() { return this.status; } - public void setStatus(DmpStatus status) { + public void setStatus(PlanStatus status) { this.status = status; } - public DmpAccessType getAccessType() { + public PlanAccessType getAccessType() { return this.accessType; } - public void setAccessType(DmpAccessType accessType) { + public void setAccessType(PlanAccessType accessType) { this.accessType = accessType; } @@ -210,20 +210,20 @@ public class DmpElasticEntity { this.dois = dois; } - public DmpVersionStatus getVersionStatus() { + public PlanVersionStatus getVersionStatus() { return this.versionStatus; } - public void setVersionStatus(DmpVersionStatus versionStatus) { + public void setVersionStatus(PlanVersionStatus versionStatus) { this.versionStatus = versionStatus; } - public List getDmpDescriptionTemplates() { - return this.dmpDescriptionTemplates; + public List getPlanDescriptionTemplates() { + return this.planDescriptionTemplates; } - public void setDmpDescriptionTemplates(List dmpDescriptionTemplates) { - this.dmpDescriptionTemplates = dmpDescriptionTemplates; + public void setPlanDescriptionTemplates(List planDescriptionTemplates) { + this.planDescriptionTemplates = planDescriptionTemplates; } public Date getCreatedAt() { diff --git a/backend/core/src/main/java/org/opencdmp/elastic/data/nested/NestedCollaboratorElasticEntity.java b/backend/core/src/main/java/org/opencdmp/elastic/data/nested/NestedCollaboratorElasticEntity.java index 228239eea..77ed3e2aa 100644 --- a/backend/core/src/main/java/org/opencdmp/elastic/data/nested/NestedCollaboratorElasticEntity.java +++ b/backend/core/src/main/java/org/opencdmp/elastic/data/nested/NestedCollaboratorElasticEntity.java @@ -1,7 +1,7 @@ package org.opencdmp.elastic.data.nested; import gr.cite.tools.elastic.ElasticConstants; -import org.opencdmp.commons.enums.DmpUserRole; +import org.opencdmp.commons.enums.PlanUserRole; import org.springframework.data.annotation.Id; import org.springframework.data.elasticsearch.annotations.Field; import org.springframework.data.elasticsearch.annotations.FieldType; @@ -25,7 +25,7 @@ public class NestedCollaboratorElasticEntity { public final static String _name = "name"; @Field(value = NestedCollaboratorElasticEntity._role, type = FieldType.Short) - private DmpUserRole role; + private PlanUserRole role; public final static String _role = "role"; public UUID getId() { @@ -44,11 +44,11 @@ public class NestedCollaboratorElasticEntity { this.name = name; } - public DmpUserRole getRole() { + public PlanUserRole getRole() { return this.role; } - public void setRole(DmpUserRole role) { + public void setRole(PlanUserRole role) { this.role = role; } diff --git a/backend/core/src/main/java/org/opencdmp/elastic/data/nested/NestedDescriptionElasticEntity.java b/backend/core/src/main/java/org/opencdmp/elastic/data/nested/NestedDescriptionElasticEntity.java index 2b42887b9..29ff2675f 100644 --- a/backend/core/src/main/java/org/opencdmp/elastic/data/nested/NestedDescriptionElasticEntity.java +++ b/backend/core/src/main/java/org/opencdmp/elastic/data/nested/NestedDescriptionElasticEntity.java @@ -21,7 +21,7 @@ public class NestedDescriptionElasticEntity { public final static String _id = "id"; @Field(value = NestedDescriptionElasticEntity._dmpId, type = FieldType.Keyword) - private UUID dmpId; + private UUID planId; public final static String _dmpId = "dmpId"; @MultiField(mainField = @Field(value = NestedDescriptionElasticEntity._label, type = FieldType.Text), otherFields = @InnerField(suffix = ElasticConstants.SubFields.keyword, type = FieldType.Keyword)) @@ -60,12 +60,12 @@ public class NestedDescriptionElasticEntity { this.id = id; } - public UUID getDmpId() { - return this.dmpId; + public UUID getPlanId() { + return this.planId; } - public void setDmpId(UUID dmpId) { - this.dmpId = dmpId; + public void setPlanId(UUID planId) { + this.planId = planId; } public String getLabel() { diff --git a/backend/core/src/main/java/org/opencdmp/elastic/data/nested/NestedDmpDescriptionTemplateElasticEntity.java b/backend/core/src/main/java/org/opencdmp/elastic/data/nested/NestedPlanDescriptionTemplateElasticEntity.java similarity index 69% rename from backend/core/src/main/java/org/opencdmp/elastic/data/nested/NestedDmpDescriptionTemplateElasticEntity.java rename to backend/core/src/main/java/org/opencdmp/elastic/data/nested/NestedPlanDescriptionTemplateElasticEntity.java index a01fbb273..e1beffe1d 100644 --- a/backend/core/src/main/java/org/opencdmp/elastic/data/nested/NestedDmpDescriptionTemplateElasticEntity.java +++ b/backend/core/src/main/java/org/opencdmp/elastic/data/nested/NestedPlanDescriptionTemplateElasticEntity.java @@ -6,22 +6,22 @@ import org.springframework.data.elasticsearch.annotations.FieldType; import java.util.UUID; -public class NestedDmpDescriptionTemplateElasticEntity { +public class NestedPlanDescriptionTemplateElasticEntity { @Id - @Field(value = NestedDmpDescriptionTemplateElasticEntity._id, type = FieldType.Keyword) + @Field(value = NestedPlanDescriptionTemplateElasticEntity._id, type = FieldType.Keyword) private UUID id; public final static String _id = "id"; @Field(value = NestedDescriptionElasticEntity._dmpId, type = FieldType.Keyword) - private UUID dmpId; + private UUID planId; public final static String _dmpId = "dmpId"; - @Field(value = NestedDmpDescriptionTemplateElasticEntity._descriptionTemplateGroupId, type = FieldType.Keyword) + @Field(value = NestedPlanDescriptionTemplateElasticEntity._descriptionTemplateGroupId, type = FieldType.Keyword) private UUID descriptionTemplateGroupId; public final static String _descriptionTemplateGroupId = "descriptionTemplateGroupId"; - @Field(value = NestedDmpDescriptionTemplateElasticEntity._sectionId, type = FieldType.Keyword) + @Field(value = NestedPlanDescriptionTemplateElasticEntity._sectionId, type = FieldType.Keyword) private UUID sectionId; public final static String _sectionId = "sectionId"; @@ -50,11 +50,11 @@ public class NestedDmpDescriptionTemplateElasticEntity { this.sectionId = sectionId; } - public UUID getDmpId() { - return this.dmpId; + public UUID getPlanId() { + return this.planId; } - public void setDmpId(UUID dmpId) { - this.dmpId = dmpId; + public void setPlanId(UUID planId) { + this.planId = planId; } } diff --git a/backend/core/src/main/java/org/opencdmp/elastic/data/nested/NestedDmpElasticEntity.java b/backend/core/src/main/java/org/opencdmp/elastic/data/nested/NestedPlanElasticEntity.java similarity index 65% rename from backend/core/src/main/java/org/opencdmp/elastic/data/nested/NestedDmpElasticEntity.java rename to backend/core/src/main/java/org/opencdmp/elastic/data/nested/NestedPlanElasticEntity.java index d0ce3b8d1..cd9d84e06 100644 --- a/backend/core/src/main/java/org/opencdmp/elastic/data/nested/NestedDmpElasticEntity.java +++ b/backend/core/src/main/java/org/opencdmp/elastic/data/nested/NestedPlanElasticEntity.java @@ -1,9 +1,8 @@ package org.opencdmp.elastic.data.nested; -import org.opencdmp.commons.enums.DmpAccessType; -import org.opencdmp.commons.enums.DmpStatus; -import org.opencdmp.commons.enums.DmpVersionStatus; -import org.opencdmp.elastic.data.DmpElasticEntity; +import org.opencdmp.commons.enums.PlanAccessType; +import org.opencdmp.commons.enums.PlanStatus; +import org.opencdmp.commons.enums.PlanVersionStatus; import gr.cite.tools.elastic.ElasticConstants; import org.springframework.data.annotation.Id; import org.springframework.data.elasticsearch.annotations.*; @@ -12,63 +11,63 @@ import java.util.Date; import java.util.List; import java.util.UUID; -public class NestedDmpElasticEntity { +public class NestedPlanElasticEntity { @Id - @Field(value = NestedDmpElasticEntity._id, type = FieldType.Keyword) + @Field(value = NestedPlanElasticEntity._id, type = FieldType.Keyword) private UUID id; public final static String _id = "id"; - @MultiField(mainField = @Field(value = NestedDmpElasticEntity._label, type = FieldType.Text), otherFields = { + @MultiField(mainField = @Field(value = NestedPlanElasticEntity._label, type = FieldType.Text), otherFields = { @InnerField(suffix = ElasticConstants.SubFields.keyword, type = FieldType.Keyword) }) private String label; public final static String _label = "label"; - @Field(value = NestedDmpElasticEntity._description, type = FieldType.Text) + @Field(value = NestedPlanElasticEntity._description, type = FieldType.Text) private String description; public final static String _description = "description"; - @Field(value = NestedDmpElasticEntity._version, type = FieldType.Keyword) + @Field(value = NestedPlanElasticEntity._version, type = FieldType.Keyword) private Short version; public final static String _version = "version"; - @Field(value = NestedDmpElasticEntity._versionStatus, type = FieldType.Short) - private DmpVersionStatus versionStatus; + @Field(value = NestedPlanElasticEntity._versionStatus, type = FieldType.Short) + private PlanVersionStatus versionStatus; public final static String _versionStatus = "versionStatus"; - @Field(value = NestedDmpElasticEntity._status, type = FieldType.Short) - private DmpStatus status; + @Field(value = NestedPlanElasticEntity._status, type = FieldType.Short) + private PlanStatus status; public final static String _status = "status"; - @Field(value = NestedDmpElasticEntity._accessType, type = FieldType.Short) - private DmpAccessType accessType; + @Field(value = NestedPlanElasticEntity._accessType, type = FieldType.Short) + private PlanAccessType accessType; public final static String _accessType = "accessType"; - @Field(value = NestedDmpElasticEntity._language, type = FieldType.Keyword) + @Field(value = NestedPlanElasticEntity._language, type = FieldType.Keyword) private String language; public final static String _language = "language"; - @Field(value = NestedDmpElasticEntity._blueprintId, type = FieldType.Keyword) + @Field(value = NestedPlanElasticEntity._blueprintId, type = FieldType.Keyword) private UUID blueprintId; public final static String _blueprintId = "blueprintId"; - @Field(value = NestedDmpElasticEntity._groupId, type = FieldType.Keyword) + @Field(value = NestedPlanElasticEntity._groupId, type = FieldType.Keyword) private UUID groupId; public final static String _groupId = "groupId"; - @Field(value = NestedDmpElasticEntity._finalizedAt, type = FieldType.Date) + @Field(value = NestedPlanElasticEntity._finalizedAt, type = FieldType.Date) private Date finalizedAt; public final static String _finalizedAt = "finalizedAt"; - @Field(value = NestedDmpElasticEntity._references, type = FieldType.Nested) + @Field(value = NestedPlanElasticEntity._references, type = FieldType.Nested) private List references; public final static String _references = "references"; - @Field(value = NestedDmpElasticEntity._collaborators, type = FieldType.Nested) + @Field(value = NestedPlanElasticEntity._collaborators, type = FieldType.Nested) private List collaborators; public final static String _collaborators = "collaborators"; - @Field(value = NestedDmpElasticEntity._dois, type = FieldType.Nested) + @Field(value = NestedPlanElasticEntity._dois, type = FieldType.Nested) private List dois; public final static String _dois = "dois"; @@ -104,19 +103,19 @@ public class NestedDmpElasticEntity { this.version = version; } - public DmpStatus getStatus() { + public PlanStatus getStatus() { return status; } - public void setStatus(DmpStatus status) { + public void setStatus(PlanStatus status) { this.status = status; } - public DmpAccessType getAccessType() { + public PlanAccessType getAccessType() { return accessType; } - public void setAccessType(DmpAccessType accessType) { + public void setAccessType(PlanAccessType accessType) { this.accessType = accessType; } @@ -176,11 +175,11 @@ public class NestedDmpElasticEntity { this.dois = dois; } - public DmpVersionStatus getVersionStatus() { + public PlanVersionStatus getVersionStatus() { return versionStatus; } - public void setVersionStatus(DmpVersionStatus versionStatus) { + public void setVersionStatus(PlanVersionStatus versionStatus) { this.versionStatus = versionStatus; } } diff --git a/backend/core/src/main/java/org/opencdmp/elastic/elasticbuilder/DescriptionElasticBuilder.java b/backend/core/src/main/java/org/opencdmp/elastic/elasticbuilder/DescriptionElasticBuilder.java index 80528860f..9fde3a84b 100644 --- a/backend/core/src/main/java/org/opencdmp/elastic/elasticbuilder/DescriptionElasticBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/elastic/elasticbuilder/DescriptionElasticBuilder.java @@ -11,17 +11,17 @@ import org.opencdmp.data.DescriptionReferenceEntity; import org.opencdmp.data.DescriptionTagEntity; import org.opencdmp.elastic.data.DescriptionElasticEntity; import org.opencdmp.elastic.data.nested.NestedDescriptionTemplateElasticEntity; -import org.opencdmp.elastic.data.nested.NestedDmpElasticEntity; +import org.opencdmp.elastic.data.nested.NestedPlanElasticEntity; import org.opencdmp.elastic.data.nested.NestedReferenceElasticEntity; import org.opencdmp.elastic.data.nested.NestedTagElasticEntity; import org.opencdmp.elastic.elasticbuilder.nested.NestedDescriptionTemplateElasticBuilder; -import org.opencdmp.elastic.elasticbuilder.nested.NestedDmpElasticBuilder; +import org.opencdmp.elastic.elasticbuilder.nested.NestedPlanElasticBuilder; import org.opencdmp.elastic.elasticbuilder.nested.NestedReferenceElasticBuilder; import org.opencdmp.elastic.elasticbuilder.nested.NestedTagElasticBuilder; import org.opencdmp.model.DescriptionTag; import org.opencdmp.model.descriptionreference.DescriptionReference; import org.opencdmp.model.descriptiontemplate.DescriptionTemplate; -import org.opencdmp.model.dmp.Dmp; +import org.opencdmp.model.plan.Plan; import org.opencdmp.query.*; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -54,7 +54,7 @@ public class DescriptionElasticBuilder extends BaseElasticBuilder> referenceElasticEntityMap = this.collectDescriptionReferences(data); Map> tagElasticEntityMap = this.collectDescriptionTags(data); - Map dmpElasticEntityMap = this.collectDmps(data); + Map planElasticEntityMap = this.collectPlans(data); Map descriptionTemplateElasticEntityMap = this.collectDescriptionTemplates(data); List models = new ArrayList<>(); @@ -74,8 +74,8 @@ public class DescriptionElasticBuilder extends BaseElasticBuilder collectDmps(List data) throws MyApplicationException { + private Map collectPlans(List data) throws MyApplicationException { if (data.isEmpty()) return null; - this.logger.debug("checking related - {}", Dmp.class.getSimpleName()); + this.logger.debug("checking related - {}", Plan.class.getSimpleName()); - Map itemMap; - DmpQuery q = this.queryFactory.query(DmpQuery.class).disableTracking().isActive(IsActive.Active).ids(data.stream().map(DescriptionEntity::getDmpId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(NestedDmpElasticBuilder.class).asForeignKey(q, NestedDmpElasticEntity::getId); + Map itemMap; + PlanQuery q = this.queryFactory.query(PlanQuery.class).disableTracking().isActive(IsActive.Active).ids(data.stream().map(DescriptionEntity::getPlanId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(NestedPlanElasticBuilder.class).asForeignKey(q, NestedPlanElasticEntity::getId); return itemMap; } diff --git a/backend/core/src/main/java/org/opencdmp/elastic/elasticbuilder/DmpElasticBuilder.java b/backend/core/src/main/java/org/opencdmp/elastic/elasticbuilder/PlanElasticBuilder.java similarity index 64% rename from backend/core/src/main/java/org/opencdmp/elastic/elasticbuilder/DmpElasticBuilder.java rename to backend/core/src/main/java/org/opencdmp/elastic/elasticbuilder/PlanElasticBuilder.java index 770d88732..b634f3cb8 100644 --- a/backend/core/src/main/java/org/opencdmp/elastic/elasticbuilder/DmpElasticBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/elastic/elasticbuilder/PlanElasticBuilder.java @@ -7,10 +7,10 @@ import gr.cite.tools.logging.LoggerService; import org.opencdmp.commons.enums.IsActive; import org.opencdmp.convention.ConventionService; import org.opencdmp.data.*; -import org.opencdmp.elastic.data.DmpElasticEntity; +import org.opencdmp.elastic.data.PlanElasticEntity; import org.opencdmp.elastic.data.nested.*; import org.opencdmp.elastic.elasticbuilder.nested.*; -import org.opencdmp.model.dmpreference.DmpReference; +import org.opencdmp.model.planreference.PlanReference; import org.opencdmp.query.*; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -23,33 +23,33 @@ import java.util.stream.Collectors; @Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpElasticBuilder extends BaseElasticBuilder { +public class PlanElasticBuilder extends BaseElasticBuilder { private final QueryFactory queryFactory; private final BuilderFactory builderFactory; @Autowired - public DmpElasticBuilder( + public PlanElasticBuilder( ConventionService conventionService, QueryFactory queryFactory, BuilderFactory builderFactory) { - super(conventionService, new LoggerService(LoggerFactory.getLogger(DmpElasticBuilder.class))); + super(conventionService, new LoggerService(LoggerFactory.getLogger(PlanElasticBuilder.class))); this.queryFactory = queryFactory; this.builderFactory = builderFactory; } @Override - public List build(List data) throws MyApplicationException { + public List build(List data) throws MyApplicationException { if (data == null) return new ArrayList<>(); - Map> referenceElasticEntityMap = this.collectDmpReferences(data); + Map> referenceElasticEntityMap = this.collectPlanReferences(data); Map> descriptionElasticEntityMap = this.collectDescriptions(data); Map> collaboratorElasticEntityMap = this.collectCollaborators(data); Map> doiElasticEntityMap = this.collectDois(data); - Map> dmpDescriptionTemplateElasticEntityMap = this.collectDmpDescriptionTemplates(data); + Map> planDescriptionTemplateElasticEntityMap = this.collectPlanDescriptionTemplates(data); - List models = new ArrayList<>(); - for (DmpEntity d : data) { - DmpElasticEntity m = new DmpElasticEntity(); + List models = new ArrayList<>(); + for (PlanEntity d : data) { + PlanElasticEntity m = new PlanElasticEntity(); m.setId(d.getId()); m.setLabel(d.getLabel()); m.setDescription(d.getDescription()); @@ -71,7 +71,7 @@ public class DmpElasticBuilder extends BaseElasticBuilder> collectDmpReferences(List data) throws MyApplicationException { + private Map> collectPlanReferences(List data) throws MyApplicationException { if (data.isEmpty()) return null; - this.logger.debug("checking related - {}", DmpReference.class.getSimpleName()); + this.logger.debug("checking related - {}", PlanReference.class.getSimpleName()); - DmpReferenceQuery associationQuery = this.queryFactory.query(DmpReferenceQuery.class).disableTracking().dmpIds(data.stream().map(DmpEntity::getId).collect(Collectors.toList())).isActives(IsActive.Active); - List associationEntities = associationQuery.collect(); + PlanReferenceQuery associationQuery = this.queryFactory.query(PlanReferenceQuery.class).disableTracking().planIds(data.stream().map(PlanEntity::getId).collect(Collectors.toList())).isActives(IsActive.Active); + List associationEntities = associationQuery.collect(); - ReferenceQuery query = this.queryFactory.query(ReferenceQuery.class).disableTracking().isActive(IsActive.Active).ids(associationEntities.stream().map(DmpReferenceEntity::getReferenceId).distinct().collect(Collectors.toList())); + ReferenceQuery query = this.queryFactory.query(ReferenceQuery.class).disableTracking().isActive(IsActive.Active).ids(associationEntities.stream().map(PlanReferenceEntity::getReferenceId).distinct().collect(Collectors.toList())); Map itemMapById = this.builderFactory.builder(NestedReferenceElasticBuilder.class).asForeignKey(query, NestedReferenceElasticEntity::getId); Map> itemMap = new HashMap<>(); - for (DmpReferenceEntity associationEntity : associationEntities){ - if (!itemMap.containsKey(associationEntity.getDmpId())) itemMap.put(associationEntity.getDmpId(), new ArrayList<>()); + for (PlanReferenceEntity associationEntity : associationEntities){ + if (!itemMap.containsKey(associationEntity.getPlanId())) itemMap.put(associationEntity.getPlanId(), new ArrayList<>()); NestedReferenceElasticEntity item = itemMapById.getOrDefault(associationEntity.getReferenceId(), null); - if (item != null) itemMap.get(associationEntity.getDmpId()).add(item); + if (item != null) itemMap.get(associationEntity.getPlanId()).add(item); } return itemMap; } - private Map> collectDescriptions(List data) throws MyApplicationException { + private Map> collectDescriptions(List data) throws MyApplicationException { if (data.isEmpty()) return null; this.logger.debug("checking related - {}", DescriptionEntity.class.getSimpleName()); Map> itemMap; - DescriptionQuery q = this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).dmpSubQuery(this.queryFactory.query(DmpQuery.class).ids(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()))); - itemMap = this.builderFactory.builder(NestedDescriptionElasticBuilder.class).asMasterKey(q, NestedDescriptionElasticEntity::getDmpId); + DescriptionQuery q = this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).dmpSubQuery(this.queryFactory.query(PlanQuery.class).ids(data.stream().map(PlanEntity::getId).distinct().collect(Collectors.toList()))); + itemMap = this.builderFactory.builder(NestedDescriptionElasticBuilder.class).asMasterKey(q, NestedDescriptionElasticEntity::getPlanId); return itemMap; } - private Map> collectDmpDescriptionTemplates(List data) throws MyApplicationException { + private Map> collectPlanDescriptionTemplates(List data) throws MyApplicationException { if (data.isEmpty()) return null; - this.logger.debug("checking related - {}", DmpDescriptionTemplateEntity.class.getSimpleName()); + this.logger.debug("checking related - {}", PlanDescriptionTemplateEntity.class.getSimpleName()); - Map> itemMap; - DmpDescriptionTemplateQuery q = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking().isActive(IsActive.Active).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(NestedDmpDescriptionTemplateElasticBuilder.class).asMasterKey(q, NestedDmpDescriptionTemplateElasticEntity::getDmpId); + Map> itemMap; + PlanDescriptionTemplateQuery q = this.queryFactory.query(PlanDescriptionTemplateQuery.class).disableTracking().isActive(IsActive.Active).planIds(data.stream().map(PlanEntity::getId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(NestedPlanDescriptionTemplateElasticBuilder.class).asMasterKey(q, NestedPlanDescriptionTemplateElasticEntity::getPlanId); return itemMap; } - private Map> collectCollaborators(List data) throws MyApplicationException { + private Map> collectCollaborators(List data) throws MyApplicationException { if (data.isEmpty()) return null; - this.logger.debug("checking related - {}", DmpUserEntity.class.getSimpleName()); + this.logger.debug("checking related - {}", PlanUserEntity.class.getSimpleName()); - DmpUserQuery associationQuery = this.queryFactory.query(DmpUserQuery.class).disableTracking().dmpIds(data.stream().map(DmpEntity::getId).collect(Collectors.toList())).isActives(IsActive.Active); - List associationEntities = associationQuery.collect(); + PlanUserQuery associationQuery = this.queryFactory.query(PlanUserQuery.class).disableTracking().planIds(data.stream().map(PlanEntity::getId).collect(Collectors.toList())).isActives(IsActive.Active); + List associationEntities = associationQuery.collect(); Map itemMapById = this.builderFactory.builder(NestedCollaboratorElasticBuilder.class).asForeignKey(associationEntities, NestedCollaboratorElasticEntity::getId); Map> itemMap = new HashMap<>(); - for (DmpUserEntity associationEntity : associationEntities){ - if (!itemMap.containsKey(associationEntity.getId())) itemMap.put(associationEntity.getDmpId(), new ArrayList<>()); + for (PlanUserEntity associationEntity : associationEntities){ + if (!itemMap.containsKey(associationEntity.getId())) itemMap.put(associationEntity.getPlanId(), new ArrayList<>()); NestedCollaboratorElasticEntity item = itemMapById.getOrDefault(associationEntity.getId(), null); - if (item != null) itemMap.get(associationEntity.getDmpId()).add(item); + if (item != null) itemMap.get(associationEntity.getPlanId()).add(item); } return itemMap; } - private Map> collectDois(List data) throws MyApplicationException { + private Map> collectDois(List data) throws MyApplicationException { if (data.isEmpty()) return null; this.logger.debug("checking related - {}", EntityDoiEntity.class.getSimpleName()); - EntityDoiQuery associationQuery = this.queryFactory.query(EntityDoiQuery.class).disableTracking().entityIds(data.stream().map(DmpEntity::getId).collect(Collectors.toList())).isActive(IsActive.Active); + EntityDoiQuery associationQuery = this.queryFactory.query(EntityDoiQuery.class).disableTracking().entityIds(data.stream().map(PlanEntity::getId).collect(Collectors.toList())).isActive(IsActive.Active); List associationEntities = associationQuery.collect(); Map itemMapById = this.builderFactory.builder(NestedDoiElasticBuilder.class).asForeignKey(associationEntities, NestedDoiElasticEntity::getId); diff --git a/backend/core/src/main/java/org/opencdmp/elastic/elasticbuilder/nested/NestedCollaboratorElasticBuilder.java b/backend/core/src/main/java/org/opencdmp/elastic/elasticbuilder/nested/NestedCollaboratorElasticBuilder.java index bb4d0622d..77a17caaa 100644 --- a/backend/core/src/main/java/org/opencdmp/elastic/elasticbuilder/nested/NestedCollaboratorElasticBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/elastic/elasticbuilder/nested/NestedCollaboratorElasticBuilder.java @@ -6,7 +6,7 @@ import gr.cite.tools.fieldset.BaseFieldSet; import gr.cite.tools.logging.LoggerService; import org.opencdmp.commons.enums.IsActive; import org.opencdmp.convention.ConventionService; -import org.opencdmp.data.DmpUserEntity; +import org.opencdmp.data.PlanUserEntity; import org.opencdmp.data.UserEntity; import org.opencdmp.elastic.data.nested.NestedCollaboratorElasticEntity; import org.opencdmp.elastic.elasticbuilder.BaseElasticBuilder; @@ -23,7 +23,7 @@ import java.util.stream.Collectors; @Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class NestedCollaboratorElasticBuilder extends BaseElasticBuilder { +public class NestedCollaboratorElasticBuilder extends BaseElasticBuilder { private final QueryFactory queryFactory; @Autowired @@ -34,14 +34,14 @@ public class NestedCollaboratorElasticBuilder extends BaseElasticBuilder build(List data) throws MyApplicationException { + public List build(List data) throws MyApplicationException { if (data == null) return new ArrayList<>(); List models = new ArrayList<>(); - List users = this.queryFactory.query(UserQuery.class).disableTracking().isActive(IsActive.Active).ids(data.stream().map(DmpUserEntity::getUserId).distinct().collect(Collectors.toList())).collectAs(new BaseFieldSet().ensure(User._id).ensure(User._name)); + List users = this.queryFactory.query(UserQuery.class).disableTracking().isActive(IsActive.Active).ids(data.stream().map(PlanUserEntity::getUserId).distinct().collect(Collectors.toList())).collectAs(new BaseFieldSet().ensure(User._id).ensure(User._name)); Map userNameMap = users == null ? new HashMap<>() : users.stream().collect(Collectors.toMap(UserEntity::getId, UserEntity::getName)); - for (DmpUserEntity d : data) { + for (PlanUserEntity d : data) { NestedCollaboratorElasticEntity m = new NestedCollaboratorElasticEntity(); m.setId(d.getId()); m.setUserId(d.getUserId()); diff --git a/backend/core/src/main/java/org/opencdmp/elastic/elasticbuilder/nested/NestedDescriptionElasticBuilder.java b/backend/core/src/main/java/org/opencdmp/elastic/elasticbuilder/nested/NestedDescriptionElasticBuilder.java index 97f3f0af5..c7a97be50 100644 --- a/backend/core/src/main/java/org/opencdmp/elastic/elasticbuilder/nested/NestedDescriptionElasticBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/elastic/elasticbuilder/nested/NestedDescriptionElasticBuilder.java @@ -55,7 +55,7 @@ public class NestedDescriptionElasticBuilder extends BaseElasticBuilder { +public class NestedPlanDescriptionTemplateElasticBuilder extends BaseElasticBuilder { @Autowired - public NestedDmpDescriptionTemplateElasticBuilder( + public NestedPlanDescriptionTemplateElasticBuilder( ConventionService conventionService) { - super(conventionService, new LoggerService(LoggerFactory.getLogger(NestedDmpDescriptionTemplateElasticBuilder.class))); + super(conventionService, new LoggerService(LoggerFactory.getLogger(NestedPlanDescriptionTemplateElasticBuilder.class))); } @Override - public List build(List data) throws MyApplicationException { + public List build(List data) throws MyApplicationException { if (data == null) return new ArrayList<>(); - List models = new ArrayList<>(); - for (DmpDescriptionTemplateEntity d : data) { - NestedDmpDescriptionTemplateElasticEntity m = new NestedDmpDescriptionTemplateElasticEntity(); + List models = new ArrayList<>(); + for (PlanDescriptionTemplateEntity d : data) { + NestedPlanDescriptionTemplateElasticEntity m = new NestedPlanDescriptionTemplateElasticEntity(); m.setId(d.getId()); - m.setDmpId(d.getDmpId()); + m.setPlanId(d.getPlanId()); m.setSectionId(d.getSectionId()); m.setDescriptionTemplateGroupId(d.getDescriptionTemplateGroupId()); models.add(m); diff --git a/backend/core/src/main/java/org/opencdmp/elastic/elasticbuilder/nested/NestedDmpElasticBuilder.java b/backend/core/src/main/java/org/opencdmp/elastic/elasticbuilder/nested/NestedPlanElasticBuilder.java similarity index 68% rename from backend/core/src/main/java/org/opencdmp/elastic/elasticbuilder/nested/NestedDmpElasticBuilder.java rename to backend/core/src/main/java/org/opencdmp/elastic/elasticbuilder/nested/NestedPlanElasticBuilder.java index 55f67c1e4..7a0385395 100644 --- a/backend/core/src/main/java/org/opencdmp/elastic/elasticbuilder/nested/NestedDmpElasticBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/elastic/elasticbuilder/nested/NestedPlanElasticBuilder.java @@ -6,18 +6,18 @@ import gr.cite.tools.exception.MyApplicationException; import gr.cite.tools.logging.LoggerService; import org.opencdmp.commons.enums.IsActive; import org.opencdmp.convention.ConventionService; -import org.opencdmp.data.DmpEntity; -import org.opencdmp.data.DmpReferenceEntity; -import org.opencdmp.data.DmpUserEntity; +import org.opencdmp.data.PlanEntity; +import org.opencdmp.data.PlanReferenceEntity; +import org.opencdmp.data.PlanUserEntity; import org.opencdmp.data.EntityDoiEntity; import org.opencdmp.elastic.data.nested.NestedCollaboratorElasticEntity; -import org.opencdmp.elastic.data.nested.NestedDmpElasticEntity; +import org.opencdmp.elastic.data.nested.NestedPlanElasticEntity; import org.opencdmp.elastic.data.nested.NestedDoiElasticEntity; import org.opencdmp.elastic.data.nested.NestedReferenceElasticEntity; import org.opencdmp.elastic.elasticbuilder.BaseElasticBuilder; -import org.opencdmp.model.dmpreference.DmpReference; -import org.opencdmp.query.DmpReferenceQuery; -import org.opencdmp.query.DmpUserQuery; +import org.opencdmp.model.planreference.PlanReference; +import org.opencdmp.query.PlanReferenceQuery; +import org.opencdmp.query.PlanUserQuery; import org.opencdmp.query.EntityDoiQuery; import org.opencdmp.query.ReferenceQuery; import org.slf4j.LoggerFactory; @@ -31,31 +31,31 @@ import java.util.stream.Collectors; @Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class NestedDmpElasticBuilder extends BaseElasticBuilder { +public class NestedPlanElasticBuilder extends BaseElasticBuilder { private final QueryFactory queryFactory; private final BuilderFactory builderFactory; @Autowired - public NestedDmpElasticBuilder( + public NestedPlanElasticBuilder( ConventionService conventionService, QueryFactory queryFactory, BuilderFactory builderFactory) { - super(conventionService, new LoggerService(LoggerFactory.getLogger(NestedDmpElasticBuilder.class))); + super(conventionService, new LoggerService(LoggerFactory.getLogger(NestedPlanElasticBuilder.class))); this.queryFactory = queryFactory; this.builderFactory = builderFactory; } @Override - public List build(List data) throws MyApplicationException { + public List build(List data) throws MyApplicationException { if (data == null) return new ArrayList<>(); - Map> referenceElasticEntityMap = this.collectDmpReferences(data); + Map> referenceElasticEntityMap = this.collectPlanReferences(data); Map> collaboratorElasticEntityMap = this.collectCollaborators(data); Map> doiElasticEntityMap = this.collectDois(data); - List models = new ArrayList<>(); - for (DmpEntity d : data) { - NestedDmpElasticEntity m = new NestedDmpElasticEntity(); + List models = new ArrayList<>(); + for (PlanEntity d : data) { + NestedPlanElasticEntity m = new NestedPlanElasticEntity(); m.setId(d.getId()); m.setLabel(d.getLabel()); m.setDescription(d.getDescription()); @@ -79,51 +79,51 @@ public class NestedDmpElasticBuilder extends BaseElasticBuilder> collectDmpReferences(List data) throws MyApplicationException { + private Map> collectPlanReferences(List data) throws MyApplicationException { if (data.isEmpty()) return null; - this.logger.debug("checking related - {}", DmpReference.class.getSimpleName()); + this.logger.debug("checking related - {}", PlanReference.class.getSimpleName()); - DmpReferenceQuery associationQuery = this.queryFactory.query(DmpReferenceQuery.class).disableTracking().dmpIds(data.stream().map(DmpEntity::getId).collect(Collectors.toList())).isActives(IsActive.Active); - List associationEntities = associationQuery.collect(); + PlanReferenceQuery associationQuery = this.queryFactory.query(PlanReferenceQuery.class).disableTracking().planIds(data.stream().map(PlanEntity::getId).collect(Collectors.toList())).isActives(IsActive.Active); + List associationEntities = associationQuery.collect(); - ReferenceQuery query = this.queryFactory.query(ReferenceQuery.class).disableTracking().isActive(IsActive.Active).ids(associationEntities.stream().map(DmpReferenceEntity::getReferenceId).distinct().collect(Collectors.toList())); + ReferenceQuery query = this.queryFactory.query(ReferenceQuery.class).disableTracking().isActive(IsActive.Active).ids(associationEntities.stream().map(PlanReferenceEntity::getReferenceId).distinct().collect(Collectors.toList())); Map itemMapById = this.builderFactory.builder(NestedReferenceElasticBuilder.class).asForeignKey(query, NestedReferenceElasticEntity::getId); Map> itemMap = new HashMap<>(); - for (DmpReferenceEntity associationEntity : associationEntities){ - if (!itemMap.containsKey(associationEntity.getDmpId())) itemMap.put(associationEntity.getDmpId(), new ArrayList<>()); + for (PlanReferenceEntity associationEntity : associationEntities){ + if (!itemMap.containsKey(associationEntity.getPlanId())) itemMap.put(associationEntity.getPlanId(), new ArrayList<>()); NestedReferenceElasticEntity item = itemMapById.getOrDefault(associationEntity.getReferenceId(), null); - if (item != null) itemMap.get(associationEntity.getDmpId()).add(item); + if (item != null) itemMap.get(associationEntity.getPlanId()).add(item); } return itemMap; } - private Map> collectCollaborators(List data) throws MyApplicationException { + private Map> collectCollaborators(List data) throws MyApplicationException { if (data.isEmpty()) return null; - this.logger.debug("checking related - {}", DmpUserEntity.class.getSimpleName()); + this.logger.debug("checking related - {}", PlanUserEntity.class.getSimpleName()); - DmpUserQuery associationQuery = this.queryFactory.query(DmpUserQuery.class).disableTracking().dmpIds(data.stream().map(DmpEntity::getId).collect(Collectors.toList())).isActives(IsActive.Active); - List associationEntities = associationQuery.collect(); + PlanUserQuery associationQuery = this.queryFactory.query(PlanUserQuery.class).disableTracking().planIds(data.stream().map(PlanEntity::getId).collect(Collectors.toList())).isActives(IsActive.Active); + List associationEntities = associationQuery.collect(); Map itemMapById = this.builderFactory.builder(NestedCollaboratorElasticBuilder.class).asForeignKey(associationEntities, NestedCollaboratorElasticEntity::getId); Map> itemMap = new HashMap<>(); - for (DmpUserEntity associationEntity : associationEntities){ - if (!itemMap.containsKey(associationEntity.getId())) itemMap.put(associationEntity.getDmpId(), new ArrayList<>()); + for (PlanUserEntity associationEntity : associationEntities){ + if (!itemMap.containsKey(associationEntity.getId())) itemMap.put(associationEntity.getPlanId(), new ArrayList<>()); NestedCollaboratorElasticEntity item = itemMapById.getOrDefault(associationEntity.getId(), null); - if (item != null) itemMap.get(associationEntity.getDmpId()).add(item); + if (item != null) itemMap.get(associationEntity.getPlanId()).add(item); } return itemMap; } - private Map> collectDois(List data) throws MyApplicationException { + private Map> collectDois(List data) throws MyApplicationException { if (data.isEmpty()) return null; this.logger.debug("checking related - {}", EntityDoiEntity.class.getSimpleName()); - EntityDoiQuery associationQuery = this.queryFactory.query(EntityDoiQuery.class).disableTracking().entityIds(data.stream().map(DmpEntity::getId).collect(Collectors.toList())).isActive(IsActive.Active); + EntityDoiQuery associationQuery = this.queryFactory.query(EntityDoiQuery.class).disableTracking().entityIds(data.stream().map(PlanEntity::getId).collect(Collectors.toList())).isActive(IsActive.Active); List associationEntities = associationQuery.collect(); Map itemMapById = this.builderFactory.builder(NestedDoiElasticBuilder.class).asForeignKey(associationEntities, NestedDoiElasticEntity::getId); diff --git a/backend/core/src/main/java/org/opencdmp/elastic/query/DescriptionElasticQuery.java b/backend/core/src/main/java/org/opencdmp/elastic/query/DescriptionElasticQuery.java index ab1fb2c39..2111fc08a 100644 --- a/backend/core/src/main/java/org/opencdmp/elastic/query/DescriptionElasticQuery.java +++ b/backend/core/src/main/java/org/opencdmp/elastic/query/DescriptionElasticQuery.java @@ -16,13 +16,13 @@ import gr.cite.tools.elastic.query.ElasticQuery; import org.opencdmp.authorization.AuthorizationFlags; import org.opencdmp.authorization.Permission; import org.opencdmp.commons.enums.DescriptionStatus; -import org.opencdmp.commons.enums.DmpAccessType; -import org.opencdmp.commons.enums.DmpStatus; +import org.opencdmp.commons.enums.PlanAccessType; +import org.opencdmp.commons.enums.PlanStatus; import org.opencdmp.commons.scope.tenant.TenantScope; import org.opencdmp.commons.scope.user.UserScope; import org.opencdmp.elastic.data.DescriptionElasticEntity; -import org.opencdmp.elastic.data.DmpElasticEntity; -import org.opencdmp.elastic.data.nested.NestedDmpElasticEntity; +import org.opencdmp.elastic.data.PlanElasticEntity; +import org.opencdmp.elastic.data.nested.NestedPlanElasticEntity; import org.opencdmp.service.elastic.AppElasticConfiguration; import org.opencdmp.service.elastic.ElasticService; import org.springframework.beans.factory.annotation.Autowired; @@ -43,7 +43,7 @@ public class DescriptionElasticQuery extends ElasticQuery ids; private String like; - private InnerObjectDmpElasticQuery dmpSubQuery; + private InnerObjectDmpElasticQuery planSubQuery; private Instant createdAfter; private Instant createdBefore; private Instant finalizedAfter; @@ -72,8 +72,8 @@ public class DescriptionElasticQuery extends ElasticQuery predicates = new ArrayList<>(); if (usePublic ) { predicates.add(this.and( - this.equals(new ElasticField(DescriptionElasticEntity._dmp + "." + DmpElasticEntity._status, this.entityClass()).disableInfer(true), DmpStatus.Finalized.getValue()), - this.equals(new ElasticField(DescriptionElasticEntity._dmp + "." + DmpElasticEntity._accessType, this.entityClass()).disableInfer(true), DmpAccessType.Public.getValue()) + this.equals(new ElasticField(DescriptionElasticEntity._dmp + "." + PlanElasticEntity._status, this.entityClass()).disableInfer(true), PlanStatus.Finalized.getValue()), + this.equals(new ElasticField(DescriptionElasticEntity._dmp + "." + PlanElasticEntity._accessType, this.entityClass()).disableInfer(true), PlanAccessType.Public.getValue()) )); } if (userId != null) { - NestedCollaboratorElasticQuery query = this.queryFactory.query(NestedCollaboratorElasticQuery.class).nestedPath(DescriptionElasticEntity._dmp + "." + NestedDmpElasticEntity._collaborators); + NestedCollaboratorElasticQuery query = this.queryFactory.query(NestedCollaboratorElasticQuery.class).nestedPath(DescriptionElasticEntity._dmp + "." + NestedPlanElasticEntity._collaborators); query.userIds(userId); predicates.add(this.nestedQuery(query).build()._toQuery()); } @@ -230,13 +230,13 @@ public class DescriptionElasticQuery extends ElasticQuery { - - private String like; - private Collection ids; - private Collection excludedIds; - private Collection statuses; - private Collection versionStatuses; - private Collection accessTypes; - private Collection versions; - private Collection groupIds; - private NestedCollaboratorElasticQuery dmpUserSubQuery; - private NestedDescriptionElasticQuery descriptionSubQuery; - private NestedDmpDescriptionTemplateElasticQuery dmpDescriptionTemplateSubQuery; - private EnumSet authorize = EnumSet.of(AuthorizationFlags.None); - - - public DmpElasticQuery dmpSubQuery(NestedCollaboratorElasticQuery subQuery) { - this.dmpUserSubQuery = subQuery; - return this; - } - - public DmpElasticQuery descriptionSubQuery(NestedDescriptionElasticQuery subQuery) { - this.descriptionSubQuery = subQuery; - return this; - } - - public DmpElasticQuery dmpDescriptionTemplateSubQuery(NestedDmpDescriptionTemplateElasticQuery subQuery) { - this.dmpDescriptionTemplateSubQuery = subQuery; - return this; - } - - public DmpElasticQuery like(String value) { - this.like = value; - return this; - } - - public DmpElasticQuery ids(UUID value) { - this.ids = List.of(value); - return this; - } - - public DmpElasticQuery ids(UUID... value) { - this.ids = Arrays.asList(value); - return this; - } - - public DmpElasticQuery ids(Collection values) { - this.ids = values; - return this; - } - - public DmpElasticQuery excludedIds(Collection values) { - this.excludedIds = values; - return this; - } - - public DmpElasticQuery excludedIds(UUID value) { - this.excludedIds = List.of(value); - return this; - } - - public DmpElasticQuery excludedIds(UUID... value) { - this.excludedIds = Arrays.asList(value); - return this; - } - - public DmpElasticQuery versionStatuses(DmpVersionStatus value) { - this.versionStatuses = List.of(value); - return this; - } - - public DmpElasticQuery versionStatuses(DmpVersionStatus... value) { - this.versionStatuses = Arrays.asList(value); - return this; - } - - public DmpElasticQuery versionStatuses(Collection values) { - this.versionStatuses = values; - return this; - } - - public DmpElasticQuery accessTypes(DmpAccessType value) { - this.accessTypes = List.of(value); - return this; - } - - public DmpElasticQuery accessTypes(DmpAccessType... value) { - this.accessTypes = Arrays.asList(value); - return this; - } - - public DmpElasticQuery accessTypes(Collection values) { - this.accessTypes = values; - return this; - } - - public DmpElasticQuery statuses(DmpStatus value) { - this.statuses = List.of(value); - return this; - } - - public DmpElasticQuery statuses(DmpStatus... value) { - this.statuses = Arrays.asList(value); - return this; - } - - public DmpElasticQuery statuses(Collection values) { - this.statuses = values; - return this; - } - - public DmpElasticQuery versions(Integer value) { - this.versions = List.of(value); - return this; - } - - public DmpElasticQuery versions(Integer... value) { - this.versions = Arrays.asList(value); - return this; - } - - public DmpElasticQuery versions(Collection values) { - this.versions = values; - return this; - } - - public DmpElasticQuery groupIds(UUID value) { - this.groupIds = List.of(value); - return this; - } - - public DmpElasticQuery groupIds(UUID... value) { - this.groupIds = Arrays.asList(value); - return this; - } - - public DmpElasticQuery groupIds(Collection values) { - this.groupIds = values; - return this; - } - - public DmpElasticQuery authorize(EnumSet values) { - this.authorize = values; - return this; - } - - private final QueryFactory queryFactory; - private final AppElasticConfiguration appElasticConfiguration; - private final ElasticService elasticService; - private final UserScope userScope; - private final TenantScope tenantScope; - private final AuthorizationService authService; - @Autowired - public DmpElasticQuery(ElasticsearchTemplate elasticsearchTemplate, ElasticProperties elasticProperties, QueryFactory queryFactory, AppElasticConfiguration appElasticConfiguration, ElasticService elasticService, UserScope userScope, TenantScope tenantScope, AuthorizationService authService) { - super(elasticsearchTemplate, elasticProperties); - this.queryFactory = queryFactory; - this.appElasticConfiguration = appElasticConfiguration; - this.elasticService = elasticService; - this.userScope = userScope; - this.tenantScope = tenantScope; - this.authService = authService; - } - - @Override - protected Boolean isFalseQuery() { - return this.isEmpty(this.ids) || this.isEmpty(this.versionStatuses) || this.isEmpty(this.excludedIds) || this.isEmpty(this.accessTypes)|| this.isEmpty(this.statuses); - } - - @Override - protected Class entityClass() { - return DmpElasticEntity.class; - } - - private Query applyTenant(List predicates){ - if (this.tenantScope.isSet()){ - Query tenantQuery; - if (this.tenantScope.isDefaultTenant()){ - tenantQuery = this.fieldNotExists(this.elasticFieldOf(DmpElasticEntity._tenantId))._toQuery(); - } - else { - try { - tenantQuery = this.or(this.fieldNotExists(this.elasticFieldOf(DmpElasticEntity._tenantId))._toQuery(), - this.equals(this.elasticFieldOf(DmpElasticEntity._tenantId), this.tenantScope.getTenant()))._toQuery(); - } catch (InvalidApplicationException e) { - throw new RuntimeException(e); - } - } - if (predicates == null) return tenantQuery; - else return this.and(tenantQuery, this.or(predicates)._toQuery()); - } else { - if (predicates != null) return this.or(predicates)._toQuery(); - } - return null; - } - @Override - protected Query applyAuthZ() { - - if (this.authorize.contains(AuthorizationFlags.None)) return this.applyTenant(null); - if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowseDmp)) return this.applyTenant(null); - UUID userId = null; - boolean usePublic = this.authorize.contains(AuthorizationFlags.Public); - if (this.authorize.contains(AuthorizationFlags.DmpAssociated)) userId = this.userScope.getUserIdSafe(); - - List predicates = new ArrayList<>(); - if (usePublic) { - predicates.add(this.and( - this.equals(this.elasticFieldOf(DmpElasticEntity._status), DmpStatus.Finalized.getValue()), - this.equals(this.elasticFieldOf(DmpElasticEntity._accessType), DmpAccessType.Public.getValue()) - )); - } - if (userId != null) { - NestedCollaboratorElasticQuery query = this.queryFactory.query(NestedCollaboratorElasticQuery.class).nestedPath(DmpElasticEntity._collaborators); - query.userIds(userId); - predicates.add(this.nestedQuery(query).build()._toQuery()); - } - if (!predicates.isEmpty()) { - return this.applyTenant(predicates); - } else { - return this.equals(this.elasticFieldOf(DmpElasticEntity._id), UUID.randomUUID()); - } - } - - @Override - protected Query applyFilters() { - List predicates = new ArrayList<>(); - - if (this.like != null && !this.like.isBlank()) { - - if (!this.like.startsWith("*")) this.like = "*" + this.like; - if (!this.like.endsWith("*")) this.like = this.like + "*"; - ElasticFields elasticFields = this.elasticFieldsOf(); - elasticFields.add("*", null, true); - - predicates.add(this.or( - this.like(elasticFields, List.of(this.like))._toQuery() - , - QueryBuilders.nested().path(DmpElasticEntity._collaborators).query( - this.like(elasticFields, List.of(this.like))._toQuery() - ).build()._toQuery(), - QueryBuilders.nested().path(DmpElasticEntity._references).query( - this.like(elasticFields, List.of(this.like))._toQuery() - ).build()._toQuery(), - QueryBuilders.nested().path(DmpElasticEntity._descriptions + "." + NestedDescriptionElasticEntity._references).query( - this.like(elasticFields, List.of(this.like))._toQuery() - ).build()._toQuery(), - QueryBuilders.nested().path(DmpElasticEntity._descriptions + "." + NestedDescriptionElasticEntity._tags).query( - this.like(elasticFields, List.of(this.like))._toQuery() - ).build()._toQuery(), - QueryBuilders.nested().path(DmpElasticEntity._descriptions).query( - this.like(elasticFields, List.of(this.like))._toQuery() - ).build()._toQuery() - - )._toQuery()); - } - if (this.ids != null) { - predicates.add(this.containsUUID(this.elasticFieldOf(DmpElasticEntity._id), this.ids)._toQuery()); - } - if (this.groupIds != null) { - predicates.add(this.containsUUID(this.elasticFieldOf(DmpElasticEntity._groupId), this.groupIds)._toQuery()); - } - if (this.versions != null) { - predicates.add(this.contains(this.elasticFieldOf(DmpElasticEntity._version), this.versions.toArray(new Integer[this.versions.size()]))._toQuery()); - } - if (this.excludedIds != null) { - predicates.add(this.not(this.containsUUID(this.elasticFieldOf(DmpElasticEntity._id), this.excludedIds)._toQuery())._toQuery()); - } - if (this.statuses != null) { - predicates.add(this.contains(this.elasticFieldOf(DmpElasticEntity._status), this.statuses.stream().map(DmpStatus::getValue).toList().toArray(new Short[this.statuses.size()]))._toQuery()); - } - if (this.versionStatuses != null) { - predicates.add(this.contains(this.elasticFieldOf(DmpElasticEntity._versionStatus), this.versionStatuses.stream().map(DmpVersionStatus::getValue).toList().toArray(new Short[this.versionStatuses.size()]))._toQuery()); - } - if (this.accessTypes != null) { - predicates.add(this.contains(this.elasticFieldOf(DmpElasticEntity._accessType), this.accessTypes.stream().map(DmpAccessType::getValue).toList().toArray(new Short[this.accessTypes.size()]))._toQuery()); - } - if (this.dmpUserSubQuery != null) { - predicates.add(this.nestedQuery( this.dmpUserSubQuery.nestedPath(DmpElasticEntity._collaborators)).build()._toQuery()); - } - if (this.descriptionSubQuery != null) { - predicates.add(this.nestedQuery( this.descriptionSubQuery.nestedPath(DmpElasticEntity._descriptions)).build()._toQuery()); - } - if (this.dmpDescriptionTemplateSubQuery != null) { - predicates.add(this.nestedQuery( this.dmpDescriptionTemplateSubQuery.nestedPath(DmpElasticEntity._dmpDescriptionTemplates)).build()._toQuery()); - } - - if (!predicates.isEmpty()) { - return this.and(predicates); - } else { - return null; - } - } - - @Override - public DmpElasticEntity convert(Map rawData, Set columns) { - DmpElasticEntity mocDoc = new DmpElasticEntity(); - if (columns.contains(DmpElasticEntity._id)) mocDoc.setId(FieldBasedMapper.shallowSafeConversion(rawData.get(DmpElasticEntity._id), UUID.class)); - if (columns.contains(DmpElasticEntity._label)) mocDoc.setLabel(FieldBasedMapper.shallowSafeConversion(rawData.get(DmpElasticEntity._label), String.class)); - if (columns.contains(DmpElasticEntity._description)) mocDoc.setDescription(FieldBasedMapper.shallowSafeConversion(rawData.get(DmpElasticEntity._description), String.class)); - if (columns.contains(DmpElasticEntity._status)) mocDoc.setStatus(FieldBasedMapper.shallowSafeConversion(rawData.get(DmpElasticEntity._status), DmpStatus.class)); - if (columns.contains(DmpElasticEntity._versionStatus)) mocDoc.setVersionStatus(FieldBasedMapper.shallowSafeConversion(rawData.get(DmpElasticEntity._versionStatus), DmpVersionStatus.class)); - if (columns.contains(DmpElasticEntity._version)) mocDoc.setVersion(FieldBasedMapper.shallowSafeConversion(rawData.get(DmpElasticEntity._version), Short.class)); - if (columns.contains(DmpElasticEntity._groupId)) mocDoc.setGroupId(FieldBasedMapper.shallowSafeConversion(rawData.get(DmpElasticEntity._groupId), UUID.class)); - if (columns.contains(DmpElasticEntity._accessType)) mocDoc.setAccessType(FieldBasedMapper.shallowSafeConversion(rawData.get(DmpElasticEntity._accessType), DmpAccessType.class)); - if (columns.contains(DmpElasticEntity._finalizedAt)) mocDoc.setFinalizedAt(FieldBasedMapper.shallowSafeConversion(rawData.get(DmpElasticEntity._finalizedAt), Date.class)); - if (columns.contains(DmpElasticEntity._createdAt)) mocDoc.setCreatedAt(FieldBasedMapper.shallowSafeConversion(rawData.get(DmpElasticEntity._createdAt), Date.class)); - if (columns.contains(DmpElasticEntity._updatedAt)) mocDoc.setUpdatedAt(FieldBasedMapper.shallowSafeConversion(rawData.get(DmpElasticEntity._updatedAt), Date.class)); - mocDoc.setCollaborators(this.convertNested(rawData, columns, this.queryFactory.query(NestedCollaboratorElasticQuery.class), DmpElasticEntity._collaborators, null)); - mocDoc.setReferences(this.convertNested(rawData, columns, this.queryFactory.query(NestedReferenceElasticQuery.class), DmpElasticEntity._references, null)); - mocDoc.setDescriptions(this.convertNested(rawData, columns, this.queryFactory.query(NestedDescriptionElasticQuery.class), DmpElasticEntity._descriptions, null)); - mocDoc.setDmpDescriptionTemplates(this.convertNested(rawData, columns, this.queryFactory.query(NestedDmpDescriptionTemplateElasticQuery.class), DmpElasticEntity._dmpDescriptionTemplates, null)); - return mocDoc; - } - - @Override - protected ElasticField fieldNameOf(FieldResolver item) { - if (item.match(DmpElasticEntity._id)) return this.elasticFieldOf(DmpElasticEntity._id); - else if (item.match(DmpElasticEntity._label)) return item instanceof OrderingFieldResolver ? this.elasticFieldOf(DmpElasticEntity._label).subfield(ElasticConstants.SubFields.keyword) : this.elasticFieldOf(DmpElasticEntity._label); - else if (item.match(DmpElasticEntity._description)) return this.elasticFieldOf(DmpElasticEntity._description); - else if (item.match(DmpElasticEntity._status)) return this.elasticFieldOf(DmpElasticEntity._status); - else if (item.match(DmpElasticEntity._version)) return this.elasticFieldOf(DmpElasticEntity._version); - else if (item.match(DmpElasticEntity._versionStatus)) return this.elasticFieldOf(DmpElasticEntity._versionStatus); - else if (item.match(DmpElasticEntity._groupId)) return this.elasticFieldOf(DmpElasticEntity._groupId); - else if (item.match(DmpElasticEntity._finalizedAt)) return this.elasticFieldOf(DmpElasticEntity._finalizedAt); - else if (item.match(DmpElasticEntity._updatedAt)) return this.elasticFieldOf(DmpElasticEntity._updatedAt); - else if (item.match(DmpElasticEntity._createdAt)) return this.elasticFieldOf(DmpElasticEntity._createdAt); - else if (item.match(DmpElasticEntity._accessType)) return this.elasticFieldOf(DmpElasticEntity._accessType); - else if (item.prefix(DmpElasticEntity._collaborators)) return this.queryFactory.query(NestedCollaboratorElasticQuery.class).nestedPath(DmpElasticEntity._collaborators).fieldNameOf(this.extractPrefixed(item, DmpElasticEntity._collaborators)); - else if (item.prefix(DmpElasticEntity._references)) return this.queryFactory.query(NestedReferenceElasticQuery.class).nestedPath(DmpElasticEntity._references).fieldNameOf(this.extractPrefixed(item, DmpElasticEntity._references)); - else if (item.prefix(DmpElasticEntity._descriptions)) return this.queryFactory.query(NestedDescriptionElasticQuery.class).nestedPath(DmpElasticEntity._descriptions).fieldNameOf(this.extractPrefixed(item, DmpElasticEntity._descriptions)); - else if (item.prefix(DmpElasticEntity._dmpDescriptionTemplates)) return this.queryFactory.query(NestedDmpDescriptionTemplateElasticQuery.class).nestedPath(DmpElasticEntity._dmpDescriptionTemplates).fieldNameOf(this.extractPrefixed(item, DmpElasticEntity._dmpDescriptionTemplates)); - else return null; - } - - @Override - protected String[] getIndex() { - List indexNames = new ArrayList<>(); - indexNames.add(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName()); - try { - this.elasticService.ensureDescriptionIndex(); - } catch (IOException e) { - throw new RuntimeException(e); - } - return indexNames.toArray(new String[indexNames.size()]); - } - - @Override - protected UUID toKey(String key) { - return UUID.fromString(key); - } - - @Override - protected ElasticField getKeyField() { - return this.elasticFieldOf(DmpElasticEntity._id); - } - - @Override - protected ElasticNestedQuery nestedQueryOf(FieldResolver item) { - if (item.prefix(DmpElasticEntity._collaborators)) return this.queryFactory.query(NestedCollaboratorElasticQuery.class).nestedPath(DmpElasticEntity._collaborators); - else if (item.prefix(DmpElasticEntity._references)) return this.queryFactory.query(NestedReferenceElasticQuery.class).nestedPath(DmpElasticEntity._references); - else if (item.prefix(DmpElasticEntity._descriptions)) return this.queryFactory.query(NestedDescriptionElasticQuery.class).nestedPath(DmpElasticEntity._descriptions); - else if (item.prefix(DmpElasticEntity._dmpDescriptionTemplates)) return this.queryFactory.query(NestedDmpDescriptionTemplateElasticQuery.class).nestedPath(DmpElasticEntity._dmpDescriptionTemplates); - else return null; - } -} diff --git a/backend/core/src/main/java/org/opencdmp/elastic/query/InnerObjectDmpElasticQuery.java b/backend/core/src/main/java/org/opencdmp/elastic/query/InnerObjectDmpElasticQuery.java index 848293126..a41efc6f2 100644 --- a/backend/core/src/main/java/org/opencdmp/elastic/query/InnerObjectDmpElasticQuery.java +++ b/backend/core/src/main/java/org/opencdmp/elastic/query/InnerObjectDmpElasticQuery.java @@ -9,11 +9,11 @@ import gr.cite.tools.elastic.query.ElasticField; import gr.cite.tools.elastic.query.ElasticFields; import gr.cite.tools.elastic.query.ElasticInnerObjectQuery; import gr.cite.tools.elastic.query.ElasticNestedQuery; -import org.opencdmp.commons.enums.DmpAccessType; -import org.opencdmp.commons.enums.DmpStatus; -import org.opencdmp.commons.enums.DmpVersionStatus; +import org.opencdmp.commons.enums.PlanAccessType; +import org.opencdmp.commons.enums.PlanStatus; +import org.opencdmp.commons.enums.PlanVersionStatus; import org.opencdmp.elastic.data.DescriptionElasticEntity; -import org.opencdmp.elastic.data.nested.NestedDmpElasticEntity; +import org.opencdmp.elastic.data.nested.NestedPlanElasticEntity; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.context.annotation.Scope; @@ -26,13 +26,13 @@ import java.util.stream.Collectors; @Component //Like in C# make it Transient @Scope(BeanDefinition.SCOPE_PROTOTYPE) -public class InnerObjectDmpElasticQuery extends ElasticInnerObjectQuery { +public class InnerObjectDmpElasticQuery extends ElasticInnerObjectQuery { private String like; private Collection ids; private Collection excludedIds; - private Collection statuses; - private Collection versionStatuses; - private Collection accessTypes; + private Collection statuses; + private Collection versionStatuses; + private Collection accessTypes; private Collection versions; private Collection groupIds; private NestedCollaboratorElasticQuery dmpUserSubQuery; @@ -78,47 +78,47 @@ public class InnerObjectDmpElasticQuery extends ElasticInnerObjectQuery values) { + public InnerObjectDmpElasticQuery versionStatuses(Collection values) { this.versionStatuses = values; return this; } - public InnerObjectDmpElasticQuery accessTypes(DmpAccessType value) { + public InnerObjectDmpElasticQuery accessTypes(PlanAccessType value) { this.accessTypes = List.of(value); return this; } - public InnerObjectDmpElasticQuery accessTypes(DmpAccessType... value) { + public InnerObjectDmpElasticQuery accessTypes(PlanAccessType... value) { this.accessTypes = Arrays.asList(value); return this; } - public InnerObjectDmpElasticQuery accessTypes(Collection values) { + public InnerObjectDmpElasticQuery accessTypes(Collection values) { this.accessTypes = values; return this; } - public InnerObjectDmpElasticQuery statuses(DmpStatus value) { + public InnerObjectDmpElasticQuery statuses(PlanStatus value) { this.statuses = List.of(value); return this; } - public InnerObjectDmpElasticQuery statuses(DmpStatus... value) { + public InnerObjectDmpElasticQuery statuses(PlanStatus... value) { this.statuses = Arrays.asList(value); return this; } - public InnerObjectDmpElasticQuery statuses(Collection values) { + public InnerObjectDmpElasticQuery statuses(Collection values) { this.statuses = values; return this; } @@ -170,8 +170,8 @@ public class InnerObjectDmpElasticQuery extends ElasticInnerObjectQuery entityClass() { - return NestedDmpElasticEntity.class; + protected Class entityClass() { + return NestedPlanElasticEntity.class; } @Override @@ -187,33 +187,33 @@ public class InnerObjectDmpElasticQuery extends ElasticInnerObjectQuery x.getValue()).collect(Collectors.toList()).toArray(new Short[this.statuses.size()]))._toQuery()); + predicates.add(this.contains(this.elasticFieldOf(NestedPlanElasticEntity._status).disableInfer(true), this.statuses.stream().map(x-> x.getValue()).collect(Collectors.toList()).toArray(new Short[this.statuses.size()]))._toQuery()); } if (this.versionStatuses != null) { - predicates.add(this.contains(this.elasticFieldOf(NestedDmpElasticEntity._versionStatus).disableInfer(true), this.versionStatuses.stream().map(x-> x.getValue()).collect(Collectors.toList()).toArray(new Short[this.versionStatuses.size()]))._toQuery()); + predicates.add(this.contains(this.elasticFieldOf(NestedPlanElasticEntity._versionStatus).disableInfer(true), this.versionStatuses.stream().map(x-> x.getValue()).collect(Collectors.toList()).toArray(new Short[this.versionStatuses.size()]))._toQuery()); } if (this.accessTypes != null) { - predicates.add(this.contains(this.elasticFieldOf(NestedDmpElasticEntity._accessType).disableInfer(true), this.accessTypes.stream().map(x-> x.getValue()).collect(Collectors.toList()).toArray(new Short[this.accessTypes.size()]))._toQuery()); + predicates.add(this.contains(this.elasticFieldOf(NestedPlanElasticEntity._accessType).disableInfer(true), this.accessTypes.stream().map(x-> x.getValue()).collect(Collectors.toList()).toArray(new Short[this.accessTypes.size()]))._toQuery()); } if (this.dmpUserSubQuery != null) { - predicates.add(this.nestedQuery( this.dmpUserSubQuery.nestedPath(DescriptionElasticEntity._dmp + "." + NestedDmpElasticEntity._collaborators)).build()._toQuery()); + predicates.add(this.nestedQuery( this.dmpUserSubQuery.nestedPath(DescriptionElasticEntity._dmp + "." + NestedPlanElasticEntity._collaborators)).build()._toQuery()); } if (!predicates.isEmpty()) { @@ -224,35 +224,35 @@ public class InnerObjectDmpElasticQuery extends ElasticInnerObjectQuery rawData, Set columns) { - NestedDmpElasticEntity mocDoc = new NestedDmpElasticEntity(); - if (columns.contains(NestedDmpElasticEntity._id)) mocDoc.setId(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedDmpElasticEntity._id), UUID.class)); - if (columns.contains(NestedDmpElasticEntity._label)) mocDoc.setLabel(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedDmpElasticEntity._label), String.class)); - if (columns.contains(NestedDmpElasticEntity._description)) mocDoc.setDescription(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedDmpElasticEntity._description), String.class)); - if (columns.contains(NestedDmpElasticEntity._status)) mocDoc.setStatus(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedDmpElasticEntity._status), DmpStatus.class)); - if (columns.contains(NestedDmpElasticEntity._versionStatus)) mocDoc.setVersionStatus(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedDmpElasticEntity._versionStatus), DmpVersionStatus.class)); - if (columns.contains(NestedDmpElasticEntity._version)) mocDoc.setVersion(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedDmpElasticEntity._version), Short.class)); - if (columns.contains(NestedDmpElasticEntity._groupId)) mocDoc.setGroupId(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedDmpElasticEntity._groupId), UUID.class)); - if (columns.contains(NestedDmpElasticEntity._accessType)) mocDoc.setAccessType(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedDmpElasticEntity._accessType), DmpAccessType.class)); - if (columns.contains(NestedDmpElasticEntity._finalizedAt)) mocDoc.setFinalizedAt(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedDmpElasticEntity._finalizedAt), Date.class)); - mocDoc.setCollaborators(this.convertNested(rawData, columns, this.queryFactory.query(NestedCollaboratorElasticQuery.class), NestedDmpElasticEntity._collaborators, null)); - mocDoc.setReferences(this.convertNested(rawData, columns, this.queryFactory.query(NestedReferenceElasticQuery.class), NestedDmpElasticEntity._references, null)); + public NestedPlanElasticEntity convert(Map rawData, Set columns) { + NestedPlanElasticEntity mocDoc = new NestedPlanElasticEntity(); + if (columns.contains(NestedPlanElasticEntity._id)) mocDoc.setId(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanElasticEntity._id), UUID.class)); + if (columns.contains(NestedPlanElasticEntity._label)) mocDoc.setLabel(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanElasticEntity._label), String.class)); + if (columns.contains(NestedPlanElasticEntity._description)) mocDoc.setDescription(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanElasticEntity._description), String.class)); + if (columns.contains(NestedPlanElasticEntity._status)) mocDoc.setStatus(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanElasticEntity._status), PlanStatus.class)); + if (columns.contains(NestedPlanElasticEntity._versionStatus)) mocDoc.setVersionStatus(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanElasticEntity._versionStatus), PlanVersionStatus.class)); + if (columns.contains(NestedPlanElasticEntity._version)) mocDoc.setVersion(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanElasticEntity._version), Short.class)); + if (columns.contains(NestedPlanElasticEntity._groupId)) mocDoc.setGroupId(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanElasticEntity._groupId), UUID.class)); + if (columns.contains(NestedPlanElasticEntity._accessType)) mocDoc.setAccessType(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanElasticEntity._accessType), PlanAccessType.class)); + if (columns.contains(NestedPlanElasticEntity._finalizedAt)) mocDoc.setFinalizedAt(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanElasticEntity._finalizedAt), Date.class)); + mocDoc.setCollaborators(this.convertNested(rawData, columns, this.queryFactory.query(NestedCollaboratorElasticQuery.class), NestedPlanElasticEntity._collaborators, null)); + mocDoc.setReferences(this.convertNested(rawData, columns, this.queryFactory.query(NestedReferenceElasticQuery.class), NestedPlanElasticEntity._references, null)); return mocDoc; } @Override protected ElasticField fieldNameOf(FieldResolver item) { - if (item.match(NestedDmpElasticEntity._id)) return this.elasticFieldOf(NestedDmpElasticEntity._id); - else if (item.match(NestedDmpElasticEntity._label)) return this.elasticFieldOf(NestedDmpElasticEntity._label); - else if (item.match(NestedDmpElasticEntity._description)) return this.elasticFieldOf(NestedDmpElasticEntity._description); - else if (item.match(NestedDmpElasticEntity._status)) return this.elasticFieldOf(NestedDmpElasticEntity._status); - else if (item.match(NestedDmpElasticEntity._versionStatus)) return this.elasticFieldOf(NestedDmpElasticEntity._versionStatus); - else if (item.match(NestedDmpElasticEntity._version)) return this.elasticFieldOf(NestedDmpElasticEntity._version); - else if (item.match(NestedDmpElasticEntity._groupId)) return this.elasticFieldOf(NestedDmpElasticEntity._groupId); - else if (item.match(NestedDmpElasticEntity._finalizedAt)) return this.elasticFieldOf(NestedDmpElasticEntity._finalizedAt); - else if (item.match(NestedDmpElasticEntity._accessType)) return this.elasticFieldOf(NestedDmpElasticEntity._accessType); - else if (item.prefix(NestedDmpElasticEntity._collaborators)) return this.queryFactory.query(NestedCollaboratorElasticQuery.class).nestedPath(NestedDmpElasticEntity._collaborators).fieldNameOf(this.extractPrefixed(item, NestedDmpElasticEntity._collaborators)); - else if (item.prefix(NestedDmpElasticEntity._references)) return this.queryFactory.query(NestedReferenceElasticQuery.class).nestedPath(NestedDmpElasticEntity._references).fieldNameOf(this.extractPrefixed(item, NestedDmpElasticEntity._references)); + if (item.match(NestedPlanElasticEntity._id)) return this.elasticFieldOf(NestedPlanElasticEntity._id); + else if (item.match(NestedPlanElasticEntity._label)) return this.elasticFieldOf(NestedPlanElasticEntity._label); + else if (item.match(NestedPlanElasticEntity._description)) return this.elasticFieldOf(NestedPlanElasticEntity._description); + else if (item.match(NestedPlanElasticEntity._status)) return this.elasticFieldOf(NestedPlanElasticEntity._status); + else if (item.match(NestedPlanElasticEntity._versionStatus)) return this.elasticFieldOf(NestedPlanElasticEntity._versionStatus); + else if (item.match(NestedPlanElasticEntity._version)) return this.elasticFieldOf(NestedPlanElasticEntity._version); + else if (item.match(NestedPlanElasticEntity._groupId)) return this.elasticFieldOf(NestedPlanElasticEntity._groupId); + else if (item.match(NestedPlanElasticEntity._finalizedAt)) return this.elasticFieldOf(NestedPlanElasticEntity._finalizedAt); + else if (item.match(NestedPlanElasticEntity._accessType)) return this.elasticFieldOf(NestedPlanElasticEntity._accessType); + else if (item.prefix(NestedPlanElasticEntity._collaborators)) return this.queryFactory.query(NestedCollaboratorElasticQuery.class).nestedPath(NestedPlanElasticEntity._collaborators).fieldNameOf(this.extractPrefixed(item, NestedPlanElasticEntity._collaborators)); + else if (item.prefix(NestedPlanElasticEntity._references)) return this.queryFactory.query(NestedReferenceElasticQuery.class).nestedPath(NestedPlanElasticEntity._references).fieldNameOf(this.extractPrefixed(item, NestedPlanElasticEntity._references)); else return null; } @@ -268,13 +268,13 @@ public class InnerObjectDmpElasticQuery extends ElasticInnerObjectQuery nestedQueryOf(FieldResolver item) { - if (item.prefix(NestedDmpElasticEntity._collaborators)) return this.queryFactory.query(NestedCollaboratorElasticQuery.class).nestedPath(NestedDmpElasticEntity._collaborators); - else if (item.prefix(NestedDmpElasticEntity._references)) return this.queryFactory.query(NestedReferenceElasticQuery.class).nestedPath(NestedDmpElasticEntity._references); + if (item.prefix(NestedPlanElasticEntity._collaborators)) return this.queryFactory.query(NestedCollaboratorElasticQuery.class).nestedPath(NestedPlanElasticEntity._collaborators); + else if (item.prefix(NestedPlanElasticEntity._references)) return this.queryFactory.query(NestedReferenceElasticQuery.class).nestedPath(NestedPlanElasticEntity._references); else return null; } } diff --git a/backend/core/src/main/java/org/opencdmp/elastic/query/NestedCollaboratorElasticQuery.java b/backend/core/src/main/java/org/opencdmp/elastic/query/NestedCollaboratorElasticQuery.java index e2e1760d0..360162908 100644 --- a/backend/core/src/main/java/org/opencdmp/elastic/query/NestedCollaboratorElasticQuery.java +++ b/backend/core/src/main/java/org/opencdmp/elastic/query/NestedCollaboratorElasticQuery.java @@ -6,7 +6,7 @@ import gr.cite.tools.elastic.configuration.ElasticProperties; import gr.cite.tools.elastic.mapper.FieldBasedMapper; import gr.cite.tools.elastic.query.ElasticField; import gr.cite.tools.elastic.query.ElasticNestedQuery; -import org.opencdmp.commons.enums.DmpUserRole; +import org.opencdmp.commons.enums.PlanUserRole; import org.opencdmp.elastic.data.nested.NestedCollaboratorElasticEntity; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; @@ -22,7 +22,7 @@ public class NestedCollaboratorElasticQuery extends ElasticNestedQuery userIds; - private Collection userRoles; + private Collection userRoles; public NestedCollaboratorElasticQuery ids(UUID value) { this.ids = List.of(value); @@ -54,17 +54,17 @@ public class NestedCollaboratorElasticQuery extends ElasticNestedQuery values) { + public NestedCollaboratorElasticQuery userRoles(Collection values) { this.userRoles = values; return this; } @@ -110,7 +110,7 @@ public class NestedCollaboratorElasticQuery extends ElasticNestedQuery { - private Collection ids; - private Collection excludedIds; - private Collection descriptionTemplateGroupIds; - private Collection dmpIds; - private Collection sectionIds; - - private String nestedPath; - - public NestedDmpDescriptionTemplateElasticQuery ids(UUID value) { - this.ids = List.of(value); - return this; - } - - public NestedDmpDescriptionTemplateElasticQuery ids(UUID... value) { - this.ids = Arrays.asList(value); - return this; - } - - public NestedDmpDescriptionTemplateElasticQuery ids(Collection values) { - this.ids = values; - return this; - } - - public NestedDmpDescriptionTemplateElasticQuery excludedIds(UUID value) { - this.excludedIds = List.of(value); - return this; - } - - public NestedDmpDescriptionTemplateElasticQuery excludedIds(UUID... value) { - this.excludedIds = Arrays.asList(value); - return this; - } - - public NestedDmpDescriptionTemplateElasticQuery excludedIds(Collection values) { - this.excludedIds = values; - return this; - } - - public NestedDmpDescriptionTemplateElasticQuery dmpIds(UUID value) { - this.dmpIds = List.of(value); - return this; - } - - public NestedDmpDescriptionTemplateElasticQuery dmpIds(UUID... value) { - this.dmpIds = Arrays.asList(value); - return this; - } - - public NestedDmpDescriptionTemplateElasticQuery dmpIds(Collection values) { - this.dmpIds = values; - return this; - } - - public NestedDmpDescriptionTemplateElasticQuery descriptionTemplateGroupIds(UUID value) { - this.descriptionTemplateGroupIds = List.of(value); - return this; - } - - public NestedDmpDescriptionTemplateElasticQuery descriptionTemplateGroupIds(UUID... value) { - this.descriptionTemplateGroupIds = Arrays.asList(value); - return this; - } - - public NestedDmpDescriptionTemplateElasticQuery descriptionTemplateGroupIds(Collection values) { - this.descriptionTemplateGroupIds = values; - return this; - } - - public NestedDmpDescriptionTemplateElasticQuery sectionIds(UUID value) { - this.sectionIds = List.of(value); - return this; - } - - public NestedDmpDescriptionTemplateElasticQuery sectionIds(UUID... value) { - this.sectionIds = Arrays.asList(value); - return this; - } - - public NestedDmpDescriptionTemplateElasticQuery sectionIds(Collection values) { - this.sectionIds = values; - return this; - } - - @Override - public NestedDmpDescriptionTemplateElasticQuery nestedPath(String value) { - this.nestedPath = value; - return this; - } - - - public NestedDmpDescriptionTemplateElasticQuery( - ElasticsearchTemplate elasticsearchRestTemplate, - ElasticProperties elasticProperties - ) { - super(elasticsearchRestTemplate, elasticProperties); - } - - @Override - protected Class entityClass() { - return NestedDmpDescriptionTemplateElasticEntity.class; - } - - @Override - protected Boolean isFalseQuery() { - return false; - } - - @Override - protected Query applyAuthZ() { - return null; - } - - @Override - protected Query applyFilters() { - List predicates = new ArrayList<>(); - if (this.ids != null) { - predicates.add(this.containsUUID(this.elasticFieldOf(NestedDmpDescriptionTemplateElasticEntity._id), this.ids)._toQuery()); - } - if (this.excludedIds != null) { - predicates.add(this.not(this.containsUUID(this.elasticFieldOf(NestedDmpDescriptionTemplateElasticEntity._id), this.excludedIds)._toQuery())._toQuery()); - } - - if (this.descriptionTemplateGroupIds != null) { - predicates.add(this.containsUUID(this.elasticFieldOf(NestedDmpDescriptionTemplateElasticEntity._descriptionTemplateGroupId), this.descriptionTemplateGroupIds)._toQuery()); - } - - if (this.sectionIds != null) { - predicates.add(this.containsUUID(this.elasticFieldOf(NestedDmpDescriptionTemplateElasticEntity._sectionId), this.sectionIds)._toQuery()); - } - - if (this.dmpIds != null) { - predicates.add(this.containsUUID(this.elasticFieldOf(NestedDmpDescriptionTemplateElasticEntity._dmpId), this.dmpIds)._toQuery()); - } - - if (!predicates.isEmpty()) { - return this.and(predicates); - } else { - return null; - } - } - - @Override - public NestedDmpDescriptionTemplateElasticEntity convert(Map rawData, Set columns) { - NestedDmpDescriptionTemplateElasticEntity mocDoc = new NestedDmpDescriptionTemplateElasticEntity(); - if (columns.contains(NestedDmpDescriptionTemplateElasticEntity._id)) mocDoc.setId(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedDmpDescriptionTemplateElasticEntity._id), UUID.class)); - if (columns.contains(NestedDmpDescriptionTemplateElasticEntity._descriptionTemplateGroupId)) mocDoc.setId(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedDmpDescriptionTemplateElasticEntity._descriptionTemplateGroupId), UUID.class)); - if (columns.contains(NestedDmpDescriptionTemplateElasticEntity._sectionId)) mocDoc.setId(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedDmpDescriptionTemplateElasticEntity._sectionId), UUID.class)); - if (columns.contains(NestedDmpDescriptionTemplateElasticEntity._dmpId)) mocDoc.setId(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedDmpDescriptionTemplateElasticEntity._dmpId), UUID.class)); - return mocDoc; - } - - @Override - protected ElasticField fieldNameOf(FieldResolver item) { - if (item.match(NestedDmpDescriptionTemplateElasticEntity._id)) return this.elasticFieldOf(NestedDmpDescriptionTemplateElasticEntity._id).disableInfer(true); - else if (item.match(NestedDmpDescriptionTemplateElasticEntity._descriptionTemplateGroupId)) return this.elasticFieldOf(NestedDmpDescriptionTemplateElasticEntity._descriptionTemplateGroupId).disableInfer(true); - else if (item.match(NestedDmpDescriptionTemplateElasticEntity._sectionId)) return this.elasticFieldOf(NestedDmpDescriptionTemplateElasticEntity._sectionId).disableInfer(true); - else if (item.match(NestedDmpDescriptionTemplateElasticEntity._dmpId)) return this.elasticFieldOf(NestedDmpDescriptionTemplateElasticEntity._dmpId).disableInfer(true); - else return null; - } - - @Override - protected String getNestedPath() { - return this.nestedPath; - } - - @Override - protected UUID toKey(String key) { - return UUID.fromString(key); - } - - @Override - protected ElasticField getKeyField() { - return this.elasticFieldOf(NestedDmpDescriptionTemplateElasticEntity._id); - } - - @Override - protected ElasticNestedQuery nestedQueryOf(FieldResolver item) { - return null; - } -} diff --git a/backend/core/src/main/java/org/opencdmp/elastic/query/NestedPlanDescriptionTemplateElasticQuery.java b/backend/core/src/main/java/org/opencdmp/elastic/query/NestedPlanDescriptionTemplateElasticQuery.java new file mode 100644 index 000000000..1840374e0 --- /dev/null +++ b/backend/core/src/main/java/org/opencdmp/elastic/query/NestedPlanDescriptionTemplateElasticQuery.java @@ -0,0 +1,199 @@ +package org.opencdmp.elastic.query; + +import co.elastic.clients.elasticsearch._types.query_dsl.Query; +import gr.cite.tools.data.query.FieldResolver; +import gr.cite.tools.elastic.configuration.ElasticProperties; +import gr.cite.tools.elastic.mapper.FieldBasedMapper; +import gr.cite.tools.elastic.query.ElasticField; +import gr.cite.tools.elastic.query.ElasticNestedQuery; +import org.opencdmp.elastic.data.nested.NestedPlanDescriptionTemplateElasticEntity; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.context.annotation.Scope; +import org.springframework.data.elasticsearch.client.elc.ElasticsearchTemplate; +import org.springframework.stereotype.Component; + +import java.util.*; + +@Component +@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) +public class NestedPlanDescriptionTemplateElasticQuery extends ElasticNestedQuery { + private Collection ids; + private Collection excludedIds; + private Collection descriptionTemplateGroupIds; + private Collection planIds; + private Collection sectionIds; + + private String nestedPath; + + public NestedPlanDescriptionTemplateElasticQuery ids(UUID value) { + this.ids = List.of(value); + return this; + } + + public NestedPlanDescriptionTemplateElasticQuery ids(UUID... value) { + this.ids = Arrays.asList(value); + return this; + } + + public NestedPlanDescriptionTemplateElasticQuery ids(Collection values) { + this.ids = values; + return this; + } + + public NestedPlanDescriptionTemplateElasticQuery excludedIds(UUID value) { + this.excludedIds = List.of(value); + return this; + } + + public NestedPlanDescriptionTemplateElasticQuery excludedIds(UUID... value) { + this.excludedIds = Arrays.asList(value); + return this; + } + + public NestedPlanDescriptionTemplateElasticQuery excludedIds(Collection values) { + this.excludedIds = values; + return this; + } + + public NestedPlanDescriptionTemplateElasticQuery planIds(UUID value) { + this.planIds = List.of(value); + return this; + } + + public NestedPlanDescriptionTemplateElasticQuery planIds(UUID... value) { + this.planIds = Arrays.asList(value); + return this; + } + + public NestedPlanDescriptionTemplateElasticQuery planIds(Collection values) { + this.planIds = values; + return this; + } + + public NestedPlanDescriptionTemplateElasticQuery descriptionTemplateGroupIds(UUID value) { + this.descriptionTemplateGroupIds = List.of(value); + return this; + } + + public NestedPlanDescriptionTemplateElasticQuery descriptionTemplateGroupIds(UUID... value) { + this.descriptionTemplateGroupIds = Arrays.asList(value); + return this; + } + + public NestedPlanDescriptionTemplateElasticQuery descriptionTemplateGroupIds(Collection values) { + this.descriptionTemplateGroupIds = values; + return this; + } + + public NestedPlanDescriptionTemplateElasticQuery sectionIds(UUID value) { + this.sectionIds = List.of(value); + return this; + } + + public NestedPlanDescriptionTemplateElasticQuery sectionIds(UUID... value) { + this.sectionIds = Arrays.asList(value); + return this; + } + + public NestedPlanDescriptionTemplateElasticQuery sectionIds(Collection values) { + this.sectionIds = values; + return this; + } + + @Override + public NestedPlanDescriptionTemplateElasticQuery nestedPath(String value) { + this.nestedPath = value; + return this; + } + + + public NestedPlanDescriptionTemplateElasticQuery( + ElasticsearchTemplate elasticsearchRestTemplate, + ElasticProperties elasticProperties + ) { + super(elasticsearchRestTemplate, elasticProperties); + } + + @Override + protected Class entityClass() { + return NestedPlanDescriptionTemplateElasticEntity.class; + } + + @Override + protected Boolean isFalseQuery() { + return false; + } + + @Override + protected Query applyAuthZ() { + return null; + } + + @Override + protected Query applyFilters() { + List predicates = new ArrayList<>(); + if (this.ids != null) { + predicates.add(this.containsUUID(this.elasticFieldOf(NestedPlanDescriptionTemplateElasticEntity._id), this.ids)._toQuery()); + } + if (this.excludedIds != null) { + predicates.add(this.not(this.containsUUID(this.elasticFieldOf(NestedPlanDescriptionTemplateElasticEntity._id), this.excludedIds)._toQuery())._toQuery()); + } + + if (this.descriptionTemplateGroupIds != null) { + predicates.add(this.containsUUID(this.elasticFieldOf(NestedPlanDescriptionTemplateElasticEntity._descriptionTemplateGroupId), this.descriptionTemplateGroupIds)._toQuery()); + } + + if (this.sectionIds != null) { + predicates.add(this.containsUUID(this.elasticFieldOf(NestedPlanDescriptionTemplateElasticEntity._sectionId), this.sectionIds)._toQuery()); + } + + if (this.planIds != null) { + predicates.add(this.containsUUID(this.elasticFieldOf(NestedPlanDescriptionTemplateElasticEntity._dmpId), this.planIds)._toQuery()); + } + + if (!predicates.isEmpty()) { + return this.and(predicates); + } else { + return null; + } + } + + @Override + public NestedPlanDescriptionTemplateElasticEntity convert(Map rawData, Set columns) { + NestedPlanDescriptionTemplateElasticEntity mocDoc = new NestedPlanDescriptionTemplateElasticEntity(); + if (columns.contains(NestedPlanDescriptionTemplateElasticEntity._id)) mocDoc.setId(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanDescriptionTemplateElasticEntity._id), UUID.class)); + if (columns.contains(NestedPlanDescriptionTemplateElasticEntity._descriptionTemplateGroupId)) mocDoc.setId(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanDescriptionTemplateElasticEntity._descriptionTemplateGroupId), UUID.class)); + if (columns.contains(NestedPlanDescriptionTemplateElasticEntity._sectionId)) mocDoc.setId(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanDescriptionTemplateElasticEntity._sectionId), UUID.class)); + if (columns.contains(NestedPlanDescriptionTemplateElasticEntity._dmpId)) mocDoc.setId(FieldBasedMapper.shallowSafeConversion(rawData.get(NestedPlanDescriptionTemplateElasticEntity._dmpId), UUID.class)); + return mocDoc; + } + + @Override + protected ElasticField fieldNameOf(FieldResolver item) { + if (item.match(NestedPlanDescriptionTemplateElasticEntity._id)) return this.elasticFieldOf(NestedPlanDescriptionTemplateElasticEntity._id).disableInfer(true); + else if (item.match(NestedPlanDescriptionTemplateElasticEntity._descriptionTemplateGroupId)) return this.elasticFieldOf(NestedPlanDescriptionTemplateElasticEntity._descriptionTemplateGroupId).disableInfer(true); + else if (item.match(NestedPlanDescriptionTemplateElasticEntity._sectionId)) return this.elasticFieldOf(NestedPlanDescriptionTemplateElasticEntity._sectionId).disableInfer(true); + else if (item.match(NestedPlanDescriptionTemplateElasticEntity._dmpId)) return this.elasticFieldOf(NestedPlanDescriptionTemplateElasticEntity._dmpId).disableInfer(true); + else return null; + } + + @Override + protected String getNestedPath() { + return this.nestedPath; + } + + @Override + protected UUID toKey(String key) { + return UUID.fromString(key); + } + + @Override + protected ElasticField getKeyField() { + return this.elasticFieldOf(NestedPlanDescriptionTemplateElasticEntity._id); + } + + @Override + protected ElasticNestedQuery nestedQueryOf(FieldResolver item) { + return null; + } +} diff --git a/backend/core/src/main/java/org/opencdmp/elastic/query/PlanElasticQuery.java b/backend/core/src/main/java/org/opencdmp/elastic/query/PlanElasticQuery.java new file mode 100644 index 000000000..c96414d73 --- /dev/null +++ b/backend/core/src/main/java/org/opencdmp/elastic/query/PlanElasticQuery.java @@ -0,0 +1,403 @@ +package org.opencdmp.elastic.query; + +import co.elastic.clients.elasticsearch._types.query_dsl.Query; +import co.elastic.clients.elasticsearch._types.query_dsl.QueryBuilders; +import gr.cite.commons.web.authz.service.AuthorizationService; +import gr.cite.tools.data.query.FieldResolver; +import gr.cite.tools.data.query.OrderingFieldResolver; +import gr.cite.tools.data.query.QueryFactory; +import gr.cite.tools.elastic.ElasticConstants; +import gr.cite.tools.elastic.configuration.ElasticProperties; +import gr.cite.tools.elastic.mapper.FieldBasedMapper; +import gr.cite.tools.elastic.query.ElasticField; +import gr.cite.tools.elastic.query.ElasticFields; +import gr.cite.tools.elastic.query.ElasticNestedQuery; +import gr.cite.tools.elastic.query.ElasticQuery; +import org.opencdmp.authorization.AuthorizationFlags; +import org.opencdmp.authorization.Permission; +import org.opencdmp.commons.enums.PlanAccessType; +import org.opencdmp.commons.enums.PlanStatus; +import org.opencdmp.commons.enums.PlanVersionStatus; +import org.opencdmp.commons.scope.tenant.TenantScope; +import org.opencdmp.commons.scope.user.UserScope; +import org.opencdmp.elastic.data.PlanElasticEntity; +import org.opencdmp.elastic.data.nested.NestedDescriptionElasticEntity; +import org.opencdmp.service.elastic.AppElasticConfiguration; +import org.opencdmp.service.elastic.ElasticService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.context.annotation.Scope; +import org.springframework.data.elasticsearch.client.elc.ElasticsearchTemplate; +import org.springframework.stereotype.Component; + +import javax.management.InvalidApplicationException; +import java.io.IOException; +import java.util.*; + +@Component +//Like in C# make it Transient +@Scope(BeanDefinition.SCOPE_PROTOTYPE) +public class PlanElasticQuery extends ElasticQuery { + + private String like; + private Collection ids; + private Collection excludedIds; + private Collection statuses; + private Collection versionStatuses; + private Collection accessTypes; + private Collection versions; + private Collection groupIds; + private NestedCollaboratorElasticQuery planUserSubQuery; + private NestedDescriptionElasticQuery descriptionSubQuery; + private NestedPlanDescriptionTemplateElasticQuery planDescriptionTemplateSubQuery; + private EnumSet authorize = EnumSet.of(AuthorizationFlags.None); + + + public PlanElasticQuery planSubQuery(NestedCollaboratorElasticQuery subQuery) { + this.planUserSubQuery = subQuery; + return this; + } + + public PlanElasticQuery descriptionSubQuery(NestedDescriptionElasticQuery subQuery) { + this.descriptionSubQuery = subQuery; + return this; + } + + public PlanElasticQuery planDescriptionTemplateSubQuery(NestedPlanDescriptionTemplateElasticQuery subQuery) { + this.planDescriptionTemplateSubQuery = subQuery; + return this; + } + + public PlanElasticQuery like(String value) { + this.like = value; + return this; + } + + public PlanElasticQuery ids(UUID value) { + this.ids = List.of(value); + return this; + } + + public PlanElasticQuery ids(UUID... value) { + this.ids = Arrays.asList(value); + return this; + } + + public PlanElasticQuery ids(Collection values) { + this.ids = values; + return this; + } + + public PlanElasticQuery excludedIds(Collection values) { + this.excludedIds = values; + return this; + } + + public PlanElasticQuery excludedIds(UUID value) { + this.excludedIds = List.of(value); + return this; + } + + public PlanElasticQuery excludedIds(UUID... value) { + this.excludedIds = Arrays.asList(value); + return this; + } + + public PlanElasticQuery versionStatuses(PlanVersionStatus value) { + this.versionStatuses = List.of(value); + return this; + } + + public PlanElasticQuery versionStatuses(PlanVersionStatus... value) { + this.versionStatuses = Arrays.asList(value); + return this; + } + + public PlanElasticQuery versionStatuses(Collection values) { + this.versionStatuses = values; + return this; + } + + public PlanElasticQuery accessTypes(PlanAccessType value) { + this.accessTypes = List.of(value); + return this; + } + + public PlanElasticQuery accessTypes(PlanAccessType... value) { + this.accessTypes = Arrays.asList(value); + return this; + } + + public PlanElasticQuery accessTypes(Collection values) { + this.accessTypes = values; + return this; + } + + public PlanElasticQuery statuses(PlanStatus value) { + this.statuses = List.of(value); + return this; + } + + public PlanElasticQuery statuses(PlanStatus... value) { + this.statuses = Arrays.asList(value); + return this; + } + + public PlanElasticQuery statuses(Collection values) { + this.statuses = values; + return this; + } + + public PlanElasticQuery versions(Integer value) { + this.versions = List.of(value); + return this; + } + + public PlanElasticQuery versions(Integer... value) { + this.versions = Arrays.asList(value); + return this; + } + + public PlanElasticQuery versions(Collection values) { + this.versions = values; + return this; + } + + public PlanElasticQuery groupIds(UUID value) { + this.groupIds = List.of(value); + return this; + } + + public PlanElasticQuery groupIds(UUID... value) { + this.groupIds = Arrays.asList(value); + return this; + } + + public PlanElasticQuery groupIds(Collection values) { + this.groupIds = values; + return this; + } + + public PlanElasticQuery authorize(EnumSet values) { + this.authorize = values; + return this; + } + + private final QueryFactory queryFactory; + private final AppElasticConfiguration appElasticConfiguration; + private final ElasticService elasticService; + private final UserScope userScope; + private final TenantScope tenantScope; + private final AuthorizationService authService; + @Autowired + public PlanElasticQuery(ElasticsearchTemplate elasticsearchTemplate, ElasticProperties elasticProperties, QueryFactory queryFactory, AppElasticConfiguration appElasticConfiguration, ElasticService elasticService, UserScope userScope, TenantScope tenantScope, AuthorizationService authService) { + super(elasticsearchTemplate, elasticProperties); + this.queryFactory = queryFactory; + this.appElasticConfiguration = appElasticConfiguration; + this.elasticService = elasticService; + this.userScope = userScope; + this.tenantScope = tenantScope; + this.authService = authService; + } + + @Override + protected Boolean isFalseQuery() { + return this.isEmpty(this.ids) || this.isEmpty(this.versionStatuses) || this.isEmpty(this.excludedIds) || this.isEmpty(this.accessTypes)|| this.isEmpty(this.statuses); + } + + @Override + protected Class entityClass() { + return PlanElasticEntity.class; + } + + private Query applyTenant(List predicates){ + if (this.tenantScope.isSet()){ + Query tenantQuery; + if (this.tenantScope.isDefaultTenant()){ + tenantQuery = this.fieldNotExists(this.elasticFieldOf(PlanElasticEntity._tenantId))._toQuery(); + } + else { + try { + tenantQuery = this.or(this.fieldNotExists(this.elasticFieldOf(PlanElasticEntity._tenantId))._toQuery(), + this.equals(this.elasticFieldOf(PlanElasticEntity._tenantId), this.tenantScope.getTenant()))._toQuery(); + } catch (InvalidApplicationException e) { + throw new RuntimeException(e); + } + } + if (predicates == null) return tenantQuery; + else return this.and(tenantQuery, this.or(predicates)._toQuery()); + } else { + if (predicates != null) return this.or(predicates)._toQuery(); + } + return null; + } + @Override + protected Query applyAuthZ() { + + if (this.authorize.contains(AuthorizationFlags.None)) return this.applyTenant(null); + if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowsePlan)) return this.applyTenant(null); + UUID userId = null; + boolean usePublic = this.authorize.contains(AuthorizationFlags.Public); + if (this.authorize.contains(AuthorizationFlags.DmpAssociated)) userId = this.userScope.getUserIdSafe(); + + List predicates = new ArrayList<>(); + if (usePublic) { + predicates.add(this.and( + this.equals(this.elasticFieldOf(PlanElasticEntity._status), PlanStatus.Finalized.getValue()), + this.equals(this.elasticFieldOf(PlanElasticEntity._accessType), PlanAccessType.Public.getValue()) + )); + } + if (userId != null) { + NestedCollaboratorElasticQuery query = this.queryFactory.query(NestedCollaboratorElasticQuery.class).nestedPath(PlanElasticEntity._collaborators); + query.userIds(userId); + predicates.add(this.nestedQuery(query).build()._toQuery()); + } + if (!predicates.isEmpty()) { + return this.applyTenant(predicates); + } else { + return this.equals(this.elasticFieldOf(PlanElasticEntity._id), UUID.randomUUID()); + } + } + + @Override + protected Query applyFilters() { + List predicates = new ArrayList<>(); + + if (this.like != null && !this.like.isBlank()) { + + if (!this.like.startsWith("*")) this.like = "*" + this.like; + if (!this.like.endsWith("*")) this.like = this.like + "*"; + ElasticFields elasticFields = this.elasticFieldsOf(); + elasticFields.add("*", null, true); + + predicates.add(this.or( + this.like(elasticFields, List.of(this.like))._toQuery() + , + QueryBuilders.nested().path(PlanElasticEntity._collaborators).query( + this.like(elasticFields, List.of(this.like))._toQuery() + ).build()._toQuery(), + QueryBuilders.nested().path(PlanElasticEntity._references).query( + this.like(elasticFields, List.of(this.like))._toQuery() + ).build()._toQuery(), + QueryBuilders.nested().path(PlanElasticEntity._descriptions + "." + NestedDescriptionElasticEntity._references).query( + this.like(elasticFields, List.of(this.like))._toQuery() + ).build()._toQuery(), + QueryBuilders.nested().path(PlanElasticEntity._descriptions + "." + NestedDescriptionElasticEntity._tags).query( + this.like(elasticFields, List.of(this.like))._toQuery() + ).build()._toQuery(), + QueryBuilders.nested().path(PlanElasticEntity._descriptions).query( + this.like(elasticFields, List.of(this.like))._toQuery() + ).build()._toQuery() + + )._toQuery()); + } + if (this.ids != null) { + predicates.add(this.containsUUID(this.elasticFieldOf(PlanElasticEntity._id), this.ids)._toQuery()); + } + if (this.groupIds != null) { + predicates.add(this.containsUUID(this.elasticFieldOf(PlanElasticEntity._groupId), this.groupIds)._toQuery()); + } + if (this.versions != null) { + predicates.add(this.contains(this.elasticFieldOf(PlanElasticEntity._version), this.versions.toArray(new Integer[this.versions.size()]))._toQuery()); + } + if (this.excludedIds != null) { + predicates.add(this.not(this.containsUUID(this.elasticFieldOf(PlanElasticEntity._id), this.excludedIds)._toQuery())._toQuery()); + } + if (this.statuses != null) { + predicates.add(this.contains(this.elasticFieldOf(PlanElasticEntity._status), this.statuses.stream().map(PlanStatus::getValue).toList().toArray(new Short[this.statuses.size()]))._toQuery()); + } + if (this.versionStatuses != null) { + predicates.add(this.contains(this.elasticFieldOf(PlanElasticEntity._versionStatus), this.versionStatuses.stream().map(PlanVersionStatus::getValue).toList().toArray(new Short[this.versionStatuses.size()]))._toQuery()); + } + if (this.accessTypes != null) { + predicates.add(this.contains(this.elasticFieldOf(PlanElasticEntity._accessType), this.accessTypes.stream().map(PlanAccessType::getValue).toList().toArray(new Short[this.accessTypes.size()]))._toQuery()); + } + if (this.planUserSubQuery != null) { + predicates.add(this.nestedQuery( this.planUserSubQuery.nestedPath(PlanElasticEntity._collaborators)).build()._toQuery()); + } + if (this.descriptionSubQuery != null) { + predicates.add(this.nestedQuery( this.descriptionSubQuery.nestedPath(PlanElasticEntity._descriptions)).build()._toQuery()); + } + if (this.planDescriptionTemplateSubQuery != null) { + predicates.add(this.nestedQuery( this.planDescriptionTemplateSubQuery.nestedPath(PlanElasticEntity._dmpDescriptionTemplates)).build()._toQuery()); + } + + if (!predicates.isEmpty()) { + return this.and(predicates); + } else { + return null; + } + } + + @Override + public PlanElasticEntity convert(Map rawData, Set columns) { + PlanElasticEntity mocDoc = new PlanElasticEntity(); + if (columns.contains(PlanElasticEntity._id)) mocDoc.setId(FieldBasedMapper.shallowSafeConversion(rawData.get(PlanElasticEntity._id), UUID.class)); + if (columns.contains(PlanElasticEntity._label)) mocDoc.setLabel(FieldBasedMapper.shallowSafeConversion(rawData.get(PlanElasticEntity._label), String.class)); + if (columns.contains(PlanElasticEntity._description)) mocDoc.setDescription(FieldBasedMapper.shallowSafeConversion(rawData.get(PlanElasticEntity._description), String.class)); + if (columns.contains(PlanElasticEntity._status)) mocDoc.setStatus(FieldBasedMapper.shallowSafeConversion(rawData.get(PlanElasticEntity._status), PlanStatus.class)); + if (columns.contains(PlanElasticEntity._versionStatus)) mocDoc.setVersionStatus(FieldBasedMapper.shallowSafeConversion(rawData.get(PlanElasticEntity._versionStatus), PlanVersionStatus.class)); + if (columns.contains(PlanElasticEntity._version)) mocDoc.setVersion(FieldBasedMapper.shallowSafeConversion(rawData.get(PlanElasticEntity._version), Short.class)); + if (columns.contains(PlanElasticEntity._groupId)) mocDoc.setGroupId(FieldBasedMapper.shallowSafeConversion(rawData.get(PlanElasticEntity._groupId), UUID.class)); + if (columns.contains(PlanElasticEntity._accessType)) mocDoc.setAccessType(FieldBasedMapper.shallowSafeConversion(rawData.get(PlanElasticEntity._accessType), PlanAccessType.class)); + if (columns.contains(PlanElasticEntity._finalizedAt)) mocDoc.setFinalizedAt(FieldBasedMapper.shallowSafeConversion(rawData.get(PlanElasticEntity._finalizedAt), Date.class)); + if (columns.contains(PlanElasticEntity._createdAt)) mocDoc.setCreatedAt(FieldBasedMapper.shallowSafeConversion(rawData.get(PlanElasticEntity._createdAt), Date.class)); + if (columns.contains(PlanElasticEntity._updatedAt)) mocDoc.setUpdatedAt(FieldBasedMapper.shallowSafeConversion(rawData.get(PlanElasticEntity._updatedAt), Date.class)); + mocDoc.setCollaborators(this.convertNested(rawData, columns, this.queryFactory.query(NestedCollaboratorElasticQuery.class), PlanElasticEntity._collaborators, null)); + mocDoc.setReferences(this.convertNested(rawData, columns, this.queryFactory.query(NestedReferenceElasticQuery.class), PlanElasticEntity._references, null)); + mocDoc.setDescriptions(this.convertNested(rawData, columns, this.queryFactory.query(NestedDescriptionElasticQuery.class), PlanElasticEntity._descriptions, null)); + mocDoc.setPlanDescriptionTemplates(this.convertNested(rawData, columns, this.queryFactory.query(NestedPlanDescriptionTemplateElasticQuery.class), PlanElasticEntity._dmpDescriptionTemplates, null)); + return mocDoc; + } + + @Override + protected ElasticField fieldNameOf(FieldResolver item) { + if (item.match(PlanElasticEntity._id)) return this.elasticFieldOf(PlanElasticEntity._id); + else if (item.match(PlanElasticEntity._label)) return item instanceof OrderingFieldResolver ? this.elasticFieldOf(PlanElasticEntity._label).subfield(ElasticConstants.SubFields.keyword) : this.elasticFieldOf(PlanElasticEntity._label); + else if (item.match(PlanElasticEntity._description)) return this.elasticFieldOf(PlanElasticEntity._description); + else if (item.match(PlanElasticEntity._status)) return this.elasticFieldOf(PlanElasticEntity._status); + else if (item.match(PlanElasticEntity._version)) return this.elasticFieldOf(PlanElasticEntity._version); + else if (item.match(PlanElasticEntity._versionStatus)) return this.elasticFieldOf(PlanElasticEntity._versionStatus); + else if (item.match(PlanElasticEntity._groupId)) return this.elasticFieldOf(PlanElasticEntity._groupId); + else if (item.match(PlanElasticEntity._finalizedAt)) return this.elasticFieldOf(PlanElasticEntity._finalizedAt); + else if (item.match(PlanElasticEntity._updatedAt)) return this.elasticFieldOf(PlanElasticEntity._updatedAt); + else if (item.match(PlanElasticEntity._createdAt)) return this.elasticFieldOf(PlanElasticEntity._createdAt); + else if (item.match(PlanElasticEntity._accessType)) return this.elasticFieldOf(PlanElasticEntity._accessType); + else if (item.prefix(PlanElasticEntity._collaborators)) return this.queryFactory.query(NestedCollaboratorElasticQuery.class).nestedPath(PlanElasticEntity._collaborators).fieldNameOf(this.extractPrefixed(item, PlanElasticEntity._collaborators)); + else if (item.prefix(PlanElasticEntity._references)) return this.queryFactory.query(NestedReferenceElasticQuery.class).nestedPath(PlanElasticEntity._references).fieldNameOf(this.extractPrefixed(item, PlanElasticEntity._references)); + else if (item.prefix(PlanElasticEntity._descriptions)) return this.queryFactory.query(NestedDescriptionElasticQuery.class).nestedPath(PlanElasticEntity._descriptions).fieldNameOf(this.extractPrefixed(item, PlanElasticEntity._descriptions)); + else if (item.prefix(PlanElasticEntity._dmpDescriptionTemplates)) return this.queryFactory.query(NestedPlanDescriptionTemplateElasticQuery.class).nestedPath(PlanElasticEntity._dmpDescriptionTemplates).fieldNameOf(this.extractPrefixed(item, PlanElasticEntity._dmpDescriptionTemplates)); + else return null; + } + + @Override + protected String[] getIndex() { + List indexNames = new ArrayList<>(); + indexNames.add(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName()); + try { + this.elasticService.ensureDescriptionIndex(); + } catch (IOException e) { + throw new RuntimeException(e); + } + return indexNames.toArray(new String[indexNames.size()]); + } + + @Override + protected UUID toKey(String key) { + return UUID.fromString(key); + } + + @Override + protected ElasticField getKeyField() { + return this.elasticFieldOf(PlanElasticEntity._id); + } + + @Override + protected ElasticNestedQuery nestedQueryOf(FieldResolver item) { + if (item.prefix(PlanElasticEntity._collaborators)) return this.queryFactory.query(NestedCollaboratorElasticQuery.class).nestedPath(PlanElasticEntity._collaborators); + else if (item.prefix(PlanElasticEntity._references)) return this.queryFactory.query(NestedReferenceElasticQuery.class).nestedPath(PlanElasticEntity._references); + else if (item.prefix(PlanElasticEntity._descriptions)) return this.queryFactory.query(NestedDescriptionElasticQuery.class).nestedPath(PlanElasticEntity._descriptions); + else if (item.prefix(PlanElasticEntity._dmpDescriptionTemplates)) return this.queryFactory.query(NestedPlanDescriptionTemplateElasticQuery.class).nestedPath(PlanElasticEntity._dmpDescriptionTemplates); + else return null; + } +} diff --git a/backend/core/src/main/java/org/opencdmp/event/EventBroker.java b/backend/core/src/main/java/org/opencdmp/event/EventBroker.java index 80c75baa7..defc5be38 100644 --- a/backend/core/src/main/java/org/opencdmp/event/EventBroker.java +++ b/backend/core/src/main/java/org/opencdmp/event/EventBroker.java @@ -49,7 +49,7 @@ public class EventBroker { this.applicationEventPublisher.publishEvent(event); } - public void emit(DmpTouchedEvent event) { + public void emit(PlanTouchedEvent event) { this.applicationEventPublisher.publishEvent(event); } diff --git a/backend/core/src/main/java/org/opencdmp/event/DmpTouchedEvent.java b/backend/core/src/main/java/org/opencdmp/event/PlanTouchedEvent.java similarity index 68% rename from backend/core/src/main/java/org/opencdmp/event/DmpTouchedEvent.java rename to backend/core/src/main/java/org/opencdmp/event/PlanTouchedEvent.java index 93b733cea..13f362c3a 100644 --- a/backend/core/src/main/java/org/opencdmp/event/DmpTouchedEvent.java +++ b/backend/core/src/main/java/org/opencdmp/event/PlanTouchedEvent.java @@ -2,12 +2,12 @@ package org.opencdmp.event; import java.util.UUID; -public class DmpTouchedEvent { +public class PlanTouchedEvent { - public DmpTouchedEvent() { + public PlanTouchedEvent() { } - public DmpTouchedEvent(UUID id) { + public PlanTouchedEvent(UUID id) { this.id = id; } diff --git a/backend/core/src/main/java/org/opencdmp/integrationevent/inbox/annotationentitycreated/AnnotationEntityCreatedIntegrationEventHandlerImpl.java b/backend/core/src/main/java/org/opencdmp/integrationevent/inbox/annotationentitycreated/AnnotationEntityCreatedIntegrationEventHandlerImpl.java index 714d2ad46..b67395dbc 100644 --- a/backend/core/src/main/java/org/opencdmp/integrationevent/inbox/annotationentitycreated/AnnotationEntityCreatedIntegrationEventHandlerImpl.java +++ b/backend/core/src/main/java/org/opencdmp/integrationevent/inbox/annotationentitycreated/AnnotationEntityCreatedIntegrationEventHandlerImpl.java @@ -29,7 +29,7 @@ import org.opencdmp.integrationevent.outbox.notification.NotifyIntegrationEventH import org.opencdmp.model.Tenant; import org.opencdmp.model.description.Description; import org.opencdmp.query.DescriptionQuery; -import org.opencdmp.query.DmpUserQuery; +import org.opencdmp.query.PlanUserQuery; import org.opencdmp.query.TenantQuery; import org.opencdmp.query.UserQuery; import org.slf4j.LoggerFactory; @@ -129,8 +129,8 @@ public class AnnotationEntityCreatedIntegrationEventHandlerImpl implements Annot if (descriptionEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{event.getEntityId(), Description.class.getSimpleName()}, LocaleContextHolder.getLocale())); - List existingUsers = this.queryFactory.query(DmpUserQuery.class).disableTracking() - .dmpIds(descriptionEntity.getDmpId()) + List existingUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking() + .planIds(descriptionEntity.getPlanId()) .isActives(IsActive.Active) .collect(); @@ -143,7 +143,7 @@ public class AnnotationEntityCreatedIntegrationEventHandlerImpl implements Annot if (sender == null) throw new MyApplicationException("Sender user not found"); List existingUSerIDs = existingUsers.stream() - .map(DmpUserEntity::getUserId) + .map(PlanUserEntity::getUserId) .filter(dmpUserId -> !dmpUserId.equals(event.getSubjectId())) .distinct().toList(); for (UUID dmpUserId : existingUSerIDs) { diff --git a/backend/core/src/main/java/org/opencdmp/integrationevent/inbox/annotationstatusentitychanged/AnnotationStatusEntityChangedIntegrationEventHandlerImpl.java b/backend/core/src/main/java/org/opencdmp/integrationevent/inbox/annotationstatusentitychanged/AnnotationStatusEntityChangedIntegrationEventHandlerImpl.java index 7969f9afd..9a534a548 100644 --- a/backend/core/src/main/java/org/opencdmp/integrationevent/inbox/annotationstatusentitychanged/AnnotationStatusEntityChangedIntegrationEventHandlerImpl.java +++ b/backend/core/src/main/java/org/opencdmp/integrationevent/inbox/annotationstatusentitychanged/AnnotationStatusEntityChangedIntegrationEventHandlerImpl.java @@ -29,7 +29,7 @@ import org.opencdmp.integrationevent.outbox.notification.NotifyIntegrationEventH import org.opencdmp.model.Tenant; import org.opencdmp.model.description.Description; import org.opencdmp.query.DescriptionQuery; -import org.opencdmp.query.DmpUserQuery; +import org.opencdmp.query.PlanUserQuery; import org.opencdmp.query.TenantQuery; import org.opencdmp.query.UserQuery; import org.slf4j.LoggerFactory; @@ -129,8 +129,8 @@ public class AnnotationStatusEntityChangedIntegrationEventHandlerImpl implements if (descriptionEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{event.getEntityId(), Description.class.getSimpleName()}, LocaleContextHolder.getLocale())); - List existingUsers = this.queryFactory.query(DmpUserQuery.class).disableTracking() - .dmpIds(descriptionEntity.getDmpId()) + List existingUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking() + .planIds(descriptionEntity.getPlanId()) .isActives(IsActive.Active) .collect(); @@ -143,7 +143,7 @@ public class AnnotationStatusEntityChangedIntegrationEventHandlerImpl implements if (sender == null) throw new MyApplicationException("Sender user not found"); List existingUSerIDs = existingUsers.stream() - .map(DmpUserEntity::getUserId) + .map(PlanUserEntity::getUserId) .filter(dmpUserId -> !dmpUserId.equals(event.getSubjectId())) .distinct().toList(); for (UUID dmpUserId : existingUSerIDs) { diff --git a/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/annotationentityremoval/AnnotationEntityRemovalIntegrationEventHandler.java b/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/annotationentityremoval/AnnotationEntityRemovalIntegrationEventHandler.java index c7150d9cf..c87538353 100644 --- a/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/annotationentityremoval/AnnotationEntityRemovalIntegrationEventHandler.java +++ b/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/annotationentityremoval/AnnotationEntityRemovalIntegrationEventHandler.java @@ -6,5 +6,5 @@ import java.util.UUID; public interface AnnotationEntityRemovalIntegrationEventHandler { void handleDescription(UUID descriptionId) throws InvalidApplicationException; - void handleDmp(UUID dmpId) throws InvalidApplicationException; + void handleDmp(UUID planId) throws InvalidApplicationException; } diff --git a/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/annotationentityremoval/AnnotationEntityRemovalIntegrationEventHandlerImpl.java b/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/annotationentityremoval/AnnotationEntityRemovalIntegrationEventHandlerImpl.java index 2e678baf6..2a3306116 100644 --- a/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/annotationentityremoval/AnnotationEntityRemovalIntegrationEventHandlerImpl.java +++ b/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/annotationentityremoval/AnnotationEntityRemovalIntegrationEventHandlerImpl.java @@ -5,13 +5,13 @@ import gr.cite.tools.fieldset.BaseFieldSet; import gr.cite.tools.logging.LoggerService; import org.opencdmp.commons.scope.tenant.TenantScope; import org.opencdmp.data.DescriptionEntity; -import org.opencdmp.data.DmpEntity; +import org.opencdmp.data.PlanEntity; import org.opencdmp.integrationevent.outbox.OutboxIntegrationEvent; import org.opencdmp.integrationevent.outbox.OutboxService; import org.opencdmp.model.description.Description; -import org.opencdmp.model.dmp.Dmp; +import org.opencdmp.model.plan.Plan; import org.opencdmp.query.DescriptionQuery; -import org.opencdmp.query.DmpQuery; +import org.opencdmp.query.PlanQuery; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; @@ -56,15 +56,15 @@ public class AnnotationEntityRemovalIntegrationEventHandlerImpl implements Annot } @Override - public void handleDmp(UUID dmpId) { - DmpEntity dmp = this.queryFactory.query(DmpQuery.class).disableTracking().ids(dmpId).firstAs(new BaseFieldSet().ensure(Dmp._id).ensure(DmpEntity._tenantId)); + public void handleDmp(UUID planId) { + PlanEntity dmp = this.queryFactory.query(PlanQuery.class).disableTracking().ids(planId).firstAs(new BaseFieldSet().ensure(Plan._id).ensure(PlanEntity._tenantId)); if(dmp == null) return; - List descriptionEntities = this.queryFactory.query(DescriptionQuery.class).disableTracking().dmpIds(dmpId).collectAs(new BaseFieldSet().ensure(Description._id)); + List descriptionEntities = this.queryFactory.query(DescriptionQuery.class).disableTracking().planIds(planId).collectAs(new BaseFieldSet().ensure(Description._id)); AnnotationEntitiesRemovalIntegrationEvent event = new AnnotationEntitiesRemovalIntegrationEvent(); event.setEntityIds(new ArrayList<>()); - event.getEntityIds().add(dmpId); + event.getEntityIds().add(planId); for (DescriptionEntity description : descriptionEntities) event.getEntityIds().add(description.getId()); diff --git a/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/annotationentitytouch/AnnotationEntityTouchedIntegrationEventHandler.java b/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/annotationentitytouch/AnnotationEntityTouchedIntegrationEventHandler.java index 5db2e6ed3..8b87f367e 100644 --- a/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/annotationentitytouch/AnnotationEntityTouchedIntegrationEventHandler.java +++ b/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/annotationentitytouch/AnnotationEntityTouchedIntegrationEventHandler.java @@ -5,5 +5,5 @@ import java.util.UUID; public interface AnnotationEntityTouchedIntegrationEventHandler { void handleDescription(UUID descriptionId); - void handleDmp(UUID dmpId); + void handlePlan(UUID planId); } diff --git a/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/annotationentitytouch/AnnotationEntityTouchedIntegrationEventHandlerImpl.java b/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/annotationentitytouch/AnnotationEntityTouchedIntegrationEventHandlerImpl.java index a2349701a..986e0834f 100644 --- a/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/annotationentitytouch/AnnotationEntityTouchedIntegrationEventHandlerImpl.java +++ b/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/annotationentitytouch/AnnotationEntityTouchedIntegrationEventHandlerImpl.java @@ -5,13 +5,13 @@ import gr.cite.tools.fieldset.BaseFieldSet; import gr.cite.tools.logging.LoggerService; import org.opencdmp.commons.enums.IsActive; import org.opencdmp.data.DescriptionEntity; -import org.opencdmp.data.DmpUserEntity; +import org.opencdmp.data.PlanUserEntity; import org.opencdmp.integrationevent.outbox.OutboxIntegrationEvent; import org.opencdmp.integrationevent.outbox.OutboxService; -import org.opencdmp.model.DmpUser; +import org.opencdmp.model.PlanUser; import org.opencdmp.model.description.Description; import org.opencdmp.query.DescriptionQuery; -import org.opencdmp.query.DmpUserQuery; +import org.opencdmp.query.PlanUserQuery; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; @@ -47,9 +47,9 @@ public class AnnotationEntityTouchedIntegrationEventHandlerImpl implements Annot @Override public void handleDescription(UUID descriptionId) { - DescriptionEntity entity = this.queryFactory.query(DescriptionQuery.class).disableTracking().ids(descriptionId).firstAs(new BaseFieldSet().ensure(Description._dmp).ensure(DescriptionEntity._tenantId)); + DescriptionEntity entity = this.queryFactory.query(DescriptionQuery.class).disableTracking().ids(descriptionId).firstAs(new BaseFieldSet().ensure(Description._plan).ensure(DescriptionEntity._tenantId)); if (entity == null) return; - List dmpUsers = this.queryFactory.query(DmpUserQuery.class).disableTracking().dmpIds(entity.getDmpId()).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(DmpUser._user)); + List dmpUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking().planIds(entity.getPlanId()).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(PlanUser._user)); AnnotationEntitiesTouchedIntegrationEvent event = new AnnotationEntitiesTouchedIntegrationEvent(); event.setEvents(List.of(this.buildEventItem(descriptionId, dmpUsers))); @@ -58,25 +58,25 @@ public class AnnotationEntityTouchedIntegrationEventHandlerImpl implements Annot } @Override - public void handleDmp(UUID dmpId) { - List descriptionEntities = this.queryFactory.query(DescriptionQuery.class).disableTracking().dmpIds(dmpId).collectAs(new BaseFieldSet().ensure(Description._id)); + public void handlePlan(UUID planId) { + List descriptionEntities = this.queryFactory.query(DescriptionQuery.class).disableTracking().planIds(planId).collectAs(new BaseFieldSet().ensure(Description._id)); if (descriptionEntities == null || descriptionEntities.isEmpty()) return; - List dmpUsers = this.queryFactory.query(DmpUserQuery.class).disableTracking().dmpIds(dmpId).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(DmpUser._user)); + List dmpUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking().planIds(planId).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(PlanUser._user)); AnnotationEntitiesTouchedIntegrationEvent event = new AnnotationEntitiesTouchedIntegrationEvent(); event.setEvents(new ArrayList<>()); - event.getEvents().add(this.buildEventItem(dmpId, dmpUsers)); + event.getEvents().add(this.buildEventItem(planId, dmpUsers)); for (DescriptionEntity description : descriptionEntities) event.getEvents().add(this.buildEventItem(description.getId(), dmpUsers)); this.handle(event, descriptionEntities.getFirst().getTenantId()); } - private AnnotationEntitiesTouchedIntegrationEvent.AnnotationEntityTouchedIntegrationEvent buildEventItem(UUID entityId, List dmpUsers){ + private AnnotationEntitiesTouchedIntegrationEvent.AnnotationEntityTouchedIntegrationEvent buildEventItem(UUID entityId, List dmpUsers){ AnnotationEntitiesTouchedIntegrationEvent.AnnotationEntityTouchedIntegrationEvent eventItem = new AnnotationEntitiesTouchedIntegrationEvent.AnnotationEntityTouchedIntegrationEvent(); eventItem.setEntityId(entityId); List users = new ArrayList<>(); - for (DmpUserEntity dmpUser : dmpUsers){ + for (PlanUserEntity dmpUser : dmpUsers){ users.add(dmpUser.getUserId()); } eventItem.setUserIds(users); diff --git a/backend/core/src/main/java/org/opencdmp/model/DmpAssociatedUser.java b/backend/core/src/main/java/org/opencdmp/model/PlanAssociatedUser.java similarity index 94% rename from backend/core/src/main/java/org/opencdmp/model/DmpAssociatedUser.java rename to backend/core/src/main/java/org/opencdmp/model/PlanAssociatedUser.java index aee9a1111..bc0fc28ad 100644 --- a/backend/core/src/main/java/org/opencdmp/model/DmpAssociatedUser.java +++ b/backend/core/src/main/java/org/opencdmp/model/PlanAssociatedUser.java @@ -2,7 +2,7 @@ package org.opencdmp.model; import java.util.UUID; -public class DmpAssociatedUser { +public class PlanAssociatedUser { private UUID id; public static final String _id = "id"; diff --git a/backend/core/src/main/java/org/opencdmp/model/DmpDescriptionTemplate.java b/backend/core/src/main/java/org/opencdmp/model/PlanDescriptionTemplate.java similarity index 92% rename from backend/core/src/main/java/org/opencdmp/model/DmpDescriptionTemplate.java rename to backend/core/src/main/java/org/opencdmp/model/PlanDescriptionTemplate.java index a803cdb35..085c96cf3 100644 --- a/backend/core/src/main/java/org/opencdmp/model/DmpDescriptionTemplate.java +++ b/backend/core/src/main/java/org/opencdmp/model/PlanDescriptionTemplate.java @@ -2,21 +2,21 @@ package org.opencdmp.model; import org.opencdmp.commons.enums.IsActive; import org.opencdmp.model.descriptiontemplate.DescriptionTemplate; -import org.opencdmp.model.dmp.Dmp; +import org.opencdmp.model.plan.Plan; import java.time.Instant; import java.util.List; import java.util.UUID; -public class DmpDescriptionTemplate{ +public class PlanDescriptionTemplate { private UUID id; public static final String _id = "id"; - private Dmp dmp; + private Plan plan; - public static final String _dmp = "dmp"; + public static final String _plan = "plan"; private DescriptionTemplate currentDescriptionTemplate; @@ -61,12 +61,12 @@ public class DmpDescriptionTemplate{ this.id = id; } - public Dmp getDmp() { - return dmp; + public Plan getDmp() { + return plan; } - public void setDmp(Dmp dmp) { - this.dmp = dmp; + public void setDmp(Plan plan) { + this.plan = plan; } public DescriptionTemplate getCurrentDescriptionTemplate() { diff --git a/backend/core/src/main/java/org/opencdmp/model/DmpUser.java b/backend/core/src/main/java/org/opencdmp/model/PlanUser.java similarity index 84% rename from backend/core/src/main/java/org/opencdmp/model/DmpUser.java rename to backend/core/src/main/java/org/opencdmp/model/PlanUser.java index a61dced2a..365efbcd7 100644 --- a/backend/core/src/main/java/org/opencdmp/model/DmpUser.java +++ b/backend/core/src/main/java/org/opencdmp/model/PlanUser.java @@ -1,22 +1,22 @@ package org.opencdmp.model; -import org.opencdmp.commons.enums.DmpUserRole; +import org.opencdmp.commons.enums.PlanUserRole; import org.opencdmp.commons.enums.IsActive; -import org.opencdmp.model.dmp.Dmp; +import org.opencdmp.model.plan.Plan; import org.opencdmp.model.user.User; import java.time.Instant; import java.util.UUID; -public class DmpUser { +public class PlanUser { private UUID id; public static final String _id = "id"; - private Dmp dmp; + private Plan plan; - public static final String _dmp = "dmp"; + public static final String _plan = "plan"; private User user; @@ -25,7 +25,7 @@ public class DmpUser { private String hash; public final static String _hash = "hash"; - private DmpUserRole role; + private PlanUserRole role; public static final String _role = "role"; @@ -54,12 +54,12 @@ public class DmpUser { this.id = id; } - public Dmp getDmp() { - return dmp; + public Plan getPlan() { + return plan; } - public void setDmp(Dmp dmp) { - this.dmp = dmp; + public void setPlan(Plan plan) { + this.plan = plan; } public User getUser() { @@ -70,11 +70,11 @@ public class DmpUser { this.user = user; } - public DmpUserRole getRole() { + public PlanUserRole getRole() { return role; } - public void setRole(DmpUserRole role) { + public void setRole(PlanUserRole role) { this.role = role; } diff --git a/backend/core/src/main/java/org/opencdmp/model/DmpValidationResult.java b/backend/core/src/main/java/org/opencdmp/model/PlanValidationResult.java similarity index 64% rename from backend/core/src/main/java/org/opencdmp/model/DmpValidationResult.java rename to backend/core/src/main/java/org/opencdmp/model/PlanValidationResult.java index 874dfbc2e..37bf7bfc5 100644 --- a/backend/core/src/main/java/org/opencdmp/model/DmpValidationResult.java +++ b/backend/core/src/main/java/org/opencdmp/model/PlanValidationResult.java @@ -1,26 +1,26 @@ package org.opencdmp.model; -import org.opencdmp.commons.enums.DmpValidationOutput; +import org.opencdmp.commons.enums.PlanValidationOutput; import java.util.List; import java.util.UUID; -public class DmpValidationResult { +public class PlanValidationResult { private UUID id; public static final String _id = "id"; - private DmpValidationOutput result; + private PlanValidationOutput result; private List errors; public static final String _result = "result"; - public DmpValidationResult() { + public PlanValidationResult() { } - public DmpValidationResult(UUID id, DmpValidationOutput result) { + public PlanValidationResult(UUID id, PlanValidationOutput result) { this.id = id; this.result = result; } @@ -33,11 +33,11 @@ public class DmpValidationResult { this.id = id; } - public DmpValidationOutput getResult() { + public PlanValidationOutput getResult() { return result; } - public void setResult(DmpValidationOutput result) { + public void setResult(PlanValidationOutput result) { this.result = result; } diff --git a/backend/core/src/main/java/org/opencdmp/model/PublicDescription.java b/backend/core/src/main/java/org/opencdmp/model/PublicDescription.java index 390225e9d..778d1df97 100644 --- a/backend/core/src/main/java/org/opencdmp/model/PublicDescription.java +++ b/backend/core/src/main/java/org/opencdmp/model/PublicDescription.java @@ -35,17 +35,17 @@ public class PublicDescription { public static final String _finalizedAt = "finalizedAt"; - private PublicDmpDescriptionTemplate dmpDescriptionTemplate; + private PublicPlanDescriptionTemplate planDescriptionTemplate; - public static final String _dmpDescriptionTemplate = "dmpDescriptionTemplate"; + public static final String _planDescriptionTemplate = "planDescriptionTemplate"; private PublicDescriptionTemplate descriptionTemplate; public static final String _descriptionTemplate = "descriptionTemplate"; - private PublicDmp dmp; + private PublicPlan plan; - public static final String _dmp = "dmp"; + public static final String _plan = "plan"; public UUID getId() { @@ -105,12 +105,12 @@ public class PublicDescription { this.createdAt = createdAt; } - public PublicDmpDescriptionTemplate getDmpDescriptionTemplate() { - return dmpDescriptionTemplate; + public PublicPlanDescriptionTemplate getPlanDescriptionTemplate() { + return planDescriptionTemplate; } - public void setDmpDescriptionTemplate(PublicDmpDescriptionTemplate dmpDescriptionTemplate) { - this.dmpDescriptionTemplate = dmpDescriptionTemplate; + public void setPlanDescriptionTemplate(PublicPlanDescriptionTemplate planDescriptionTemplate) { + this.planDescriptionTemplate = planDescriptionTemplate; } public PublicDescriptionTemplate getDescriptionTemplate() { @@ -121,11 +121,11 @@ public class PublicDescription { this.descriptionTemplate = descriptionTemplate; } - public PublicDmp getDmp() { - return dmp; + public PublicPlan getPlan() { + return plan; } - public void setDmp(PublicDmp dmp) { - this.dmp = dmp; + public void setPlan(PublicPlan plan) { + this.plan = plan; } } diff --git a/backend/core/src/main/java/org/opencdmp/model/PublicDmpDescriptionTemplate.java b/backend/core/src/main/java/org/opencdmp/model/PublicDmpDescriptionTemplate.java deleted file mode 100644 index 6e3e07e3d..000000000 --- a/backend/core/src/main/java/org/opencdmp/model/PublicDmpDescriptionTemplate.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.opencdmp.model; - -import org.opencdmp.commons.enums.IsActive; - -import java.time.Instant; -import java.util.UUID; - -public class PublicDmpDescriptionTemplate { - - private UUID id; - - public static final String _id = "id"; - - private PublicDmp dmp; - - public static final String _dmp = "dmp"; - - public UUID getId() { - return id; - } - - public void setId(UUID id) { - this.id = id; - } - - public PublicDmp getDmp() { - return dmp; - } - - public void setDmp(PublicDmp dmp) { - this.dmp = dmp; - } - -} diff --git a/backend/core/src/main/java/org/opencdmp/model/PublicDmp.java b/backend/core/src/main/java/org/opencdmp/model/PublicPlan.java similarity index 68% rename from backend/core/src/main/java/org/opencdmp/model/PublicDmp.java rename to backend/core/src/main/java/org/opencdmp/model/PublicPlan.java index d3314df09..b95aded25 100644 --- a/backend/core/src/main/java/org/opencdmp/model/PublicDmp.java +++ b/backend/core/src/main/java/org/opencdmp/model/PublicPlan.java @@ -1,14 +1,13 @@ package org.opencdmp.model; -import org.opencdmp.commons.enums.DmpAccessType; -import org.opencdmp.commons.enums.DmpStatus; -import org.opencdmp.commons.enums.IsActive; +import org.opencdmp.commons.enums.PlanAccessType; +import org.opencdmp.commons.enums.PlanStatus; import java.time.Instant; import java.util.List; import java.util.UUID; -public class PublicDmp { +public class PublicPlan { private UUID id; @@ -37,22 +36,22 @@ public class PublicDmp { public static final String _publishedAt = "publishedAt"; - private DmpStatus status; + private PlanStatus status; public static final String _status = "status"; private UUID groupId; public static final String _groupId = "groupId"; - private DmpAccessType accessType; + private PlanAccessType accessType; public static final String _accessType = "accessType"; - private List dmpUsers; + private List planUsers; - public static final String _dmpUsers = "dmpUsers"; + public static final String _planUsers = "planUsers"; - private List dmpReferences; + private List planReferences; - public static final String _dmpReferences = "dmpReferences"; + public static final String _planReferences = "planReferences"; private List descriptions; public static final String _descriptions = "descriptions"; @@ -60,8 +59,8 @@ public class PublicDmp { private List entityDois; public static final String _entityDois = "entityDois"; - private List otherDmpVersions; - public static final String _otherDmpVersions = "otherDmpVersions"; + private List otherPlanVersions; + public static final String _otherPlanVersions = "otherPlanVersions"; public UUID getId() { return id; @@ -119,11 +118,11 @@ public class PublicDmp { this.publishedAt = publishedAt; } - public DmpStatus getStatus() { + public PlanStatus getStatus() { return status; } - public void setStatus(DmpStatus status) { + public void setStatus(PlanStatus status) { this.status = status; } @@ -135,28 +134,28 @@ public class PublicDmp { this.groupId = groupId; } - public DmpAccessType getAccessType() { + public PlanAccessType getAccessType() { return accessType; } - public void setAccessType(DmpAccessType accessType) { + public void setAccessType(PlanAccessType accessType) { this.accessType = accessType; } - public List getDmpUsers() { - return dmpUsers; + public List getPlanUsers() { + return planUsers; } - public void setDmpUsers(List dmpUsers) { - this.dmpUsers = dmpUsers; + public void setPlanUsers(List planUsers) { + this.planUsers = planUsers; } - public List getDmpReferences() { - return dmpReferences; + public List getPlanReferences() { + return planReferences; } - public void setDmpReferences(List dmpReferences) { - this.dmpReferences = dmpReferences; + public void setPlanReferences(List planReferences) { + this.planReferences = planReferences; } public List getDescriptions() { @@ -175,11 +174,11 @@ public class PublicDmp { this.entityDois = entityDois; } - public List getOtherDmpVersions() { - return otherDmpVersions; + public List getOtherPlanVersions() { + return otherPlanVersions; } - public void setOtherDmpVersions(List otherDmpVersions) { - this.otherDmpVersions = otherDmpVersions; + public void setOtherPlanVersions(List otherPlanVersions) { + this.otherPlanVersions = otherPlanVersions; } } diff --git a/backend/core/src/main/java/org/opencdmp/model/PublicPlanDescriptionTemplate.java b/backend/core/src/main/java/org/opencdmp/model/PublicPlanDescriptionTemplate.java new file mode 100644 index 000000000..00a9e6d17 --- /dev/null +++ b/backend/core/src/main/java/org/opencdmp/model/PublicPlanDescriptionTemplate.java @@ -0,0 +1,31 @@ +package org.opencdmp.model; + +import java.util.UUID; + +public class PublicPlanDescriptionTemplate { + + private UUID id; + + public static final String _id = "id"; + + private PublicPlan plan; + + public static final String _plan = "plan"; + + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public PublicPlan getPlan() { + return plan; + } + + public void setPlan(PublicPlan plan) { + this.plan = plan; + } + +} diff --git a/backend/core/src/main/java/org/opencdmp/model/PublicDmpReference.java b/backend/core/src/main/java/org/opencdmp/model/PublicPlanReference.java similarity index 76% rename from backend/core/src/main/java/org/opencdmp/model/PublicDmpReference.java rename to backend/core/src/main/java/org/opencdmp/model/PublicPlanReference.java index e12fd708b..cfa7def79 100644 --- a/backend/core/src/main/java/org/opencdmp/model/PublicDmpReference.java +++ b/backend/core/src/main/java/org/opencdmp/model/PublicPlanReference.java @@ -2,16 +2,15 @@ package org.opencdmp.model; import org.opencdmp.commons.enums.IsActive; -import java.time.Instant; import java.util.UUID; -public class PublicDmpReference { +public class PublicPlanReference { private UUID id; public static final String _id = "id"; - private PublicDmp dmp; - public static final String _dmp = "dmp"; + private PublicPlan plan; + public static final String _plan = "plan"; private PublicReference reference; public static final String _reference = "reference"; @@ -27,12 +26,12 @@ public class PublicDmpReference { this.id = id; } - public PublicDmp getDmp() { - return dmp; + public PublicPlan getPlan() { + return plan; } - public void setDmp(PublicDmp dmp) { - this.dmp = dmp; + public void setPlan(PublicPlan plan) { + this.plan = plan; } public PublicReference getReference() { diff --git a/backend/core/src/main/java/org/opencdmp/model/PublicDmpUser.java b/backend/core/src/main/java/org/opencdmp/model/PublicPlanUser.java similarity index 59% rename from backend/core/src/main/java/org/opencdmp/model/PublicDmpUser.java rename to backend/core/src/main/java/org/opencdmp/model/PublicPlanUser.java index ecd6befbb..b91d7a250 100644 --- a/backend/core/src/main/java/org/opencdmp/model/PublicDmpUser.java +++ b/backend/core/src/main/java/org/opencdmp/model/PublicPlanUser.java @@ -1,16 +1,16 @@ package org.opencdmp.model; -import org.opencdmp.commons.enums.DmpUserRole; +import org.opencdmp.commons.enums.PlanUserRole; import java.util.UUID; -public class PublicDmpUser { +public class PublicPlanUser { public static final String _id = "id"; private UUID id; - public static final String _dmp = "dmp"; - private PublicDmp dmp; + public static final String _plan = "plan"; + private PublicPlan plan; public static final String _user = "user"; @@ -18,7 +18,7 @@ public class PublicDmpUser { public static final String _role = "role"; - private DmpUserRole role; + private PlanUserRole role; public UUID getId() { return id; @@ -28,12 +28,12 @@ public class PublicDmpUser { this.id = id; } - public PublicDmp getDmp() { - return dmp; + public PublicPlan getPlan() { + return plan; } - public void setDmp(PublicDmp dmp) { - this.dmp = dmp; + public void setPlan(PublicPlan plan) { + this.plan = plan; } public PublicUser getUser() { @@ -44,11 +44,11 @@ public class PublicDmpUser { this.user = user; } - public DmpUserRole getRole() { + public PlanUserRole getRole() { return role; } - public void setRole(DmpUserRole role) { + public void setRole(PlanUserRole role) { this.role = role; } } diff --git a/backend/core/src/main/java/org/opencdmp/model/RecentActivityItem.java b/backend/core/src/main/java/org/opencdmp/model/RecentActivityItem.java index 96c92f6d0..90962003e 100644 --- a/backend/core/src/main/java/org/opencdmp/model/RecentActivityItem.java +++ b/backend/core/src/main/java/org/opencdmp/model/RecentActivityItem.java @@ -2,13 +2,13 @@ package org.opencdmp.model; import org.opencdmp.commons.enums.RecentActivityItemType; import org.opencdmp.model.description.Description; -import org.opencdmp.model.dmp.Dmp; +import org.opencdmp.model.plan.Plan; public class RecentActivityItem { private RecentActivityItemType type; public final static String _type = "type"; - private Dmp dmp; - public final static String _dmp = "dmp"; + private Plan plan; + public final static String _plan = "plan"; private Description description; public final static String _description = "description"; @@ -21,12 +21,12 @@ public class RecentActivityItem { this.type = type; } - public Dmp getDmp() { - return dmp; + public Plan getPlan() { + return plan; } - public void setDmp(Dmp dmp) { - this.dmp = dmp; + public void setPlan(Plan plan) { + this.plan = plan; } public Description getDescription() { diff --git a/backend/core/src/main/java/org/opencdmp/model/RecentActivityItemLookup.java b/backend/core/src/main/java/org/opencdmp/model/RecentActivityItemLookup.java index 793bdc42f..5840b3b3b 100644 --- a/backend/core/src/main/java/org/opencdmp/model/RecentActivityItemLookup.java +++ b/backend/core/src/main/java/org/opencdmp/model/RecentActivityItemLookup.java @@ -1,14 +1,14 @@ package org.opencdmp.model; import org.opencdmp.commons.enums.DescriptionStatus; -import org.opencdmp.commons.enums.DmpStatus; +import org.opencdmp.commons.enums.PlanStatus; import org.opencdmp.commons.enums.IsActive; import org.opencdmp.commons.enums.RecentActivityOrder; import org.opencdmp.model.description.Description; -import org.opencdmp.model.dmp.Dmp; +import org.opencdmp.model.plan.Plan; import org.opencdmp.query.lookup.DescriptionLookup; -import org.opencdmp.query.lookup.DmpLookup; -import org.opencdmp.query.lookup.DmpUserLookup; +import org.opencdmp.query.lookup.PlanLookup; +import org.opencdmp.query.lookup.PlanUserLookup; import gr.cite.tools.data.query.Ordering; import gr.cite.tools.data.query.Paging; import gr.cite.tools.fieldset.BaseFieldSet; @@ -100,13 +100,13 @@ public class RecentActivityItemLookup{ if (this.onlyDraft != null) lookup.setStatuses(List.of(DescriptionStatus.Draft)); else lookup.setStatuses(List.of(DescriptionStatus.Draft, DescriptionStatus.Finalized)); if (this.userIds != null) { - DmpLookup dmpLookup = new DmpLookup(); - DmpUserLookup dmpUserLookup = new DmpUserLookup(); - dmpUserLookup.setUserIds(this.userIds); - dmpUserLookup.setIsActive(List.of(IsActive.Active)); - dmpLookup.setDmpUserSubQuery(dmpUserLookup); - dmpLookup.setIsActive(List.of(IsActive.Active)); - lookup.setDmpSubQuery(dmpLookup); + PlanLookup planLookup = new PlanLookup(); + PlanUserLookup planUserLookup = new PlanUserLookup(); + planUserLookup.setUserIds(this.userIds); + planUserLookup.setIsActive(List.of(IsActive.Active)); + planLookup.setPlanUserSubQuery(planUserLookup); + planLookup.setIsActive(List.of(IsActive.Active)); + lookup.setPlanSubQuery(planLookup); } if (this.page != null) lookup.setPage(new Paging(this.page.getOffset(), this.page.getSize())); Ordering ordering = new Ordering(); @@ -125,33 +125,33 @@ public class RecentActivityItemLookup{ return lookup; } - public DmpLookup asDmpLookup() { + public PlanLookup asDmpLookup() { if (this.onlyDescription != null) return null; - DmpLookup lookup = new DmpLookup(); + PlanLookup lookup = new PlanLookup(); lookup.setIsActive(List.of(IsActive.Active)); if (this.like != null) lookup.setLike(this.like); - if (this.onlyDraft != null) lookup.setStatuses(List.of(DmpStatus.Draft)); + if (this.onlyDraft != null) lookup.setStatuses(List.of(PlanStatus.Draft)); if (this.userIds != null) { - DmpUserLookup dmpUserLookup = new DmpUserLookup(); - dmpUserLookup.setUserIds(this.userIds); - dmpUserLookup.setIsActive(List.of(IsActive.Active)); - lookup.setDmpUserSubQuery(dmpUserLookup); + PlanUserLookup planUserLookup = new PlanUserLookup(); + planUserLookup.setUserIds(this.userIds); + planUserLookup.setIsActive(List.of(IsActive.Active)); + lookup.setPlanUserSubQuery(planUserLookup); } if (this.page != null) lookup.setPage(new Paging(this.page.getOffset(), this.page.getSize())); Ordering ordering = new Ordering(); if (this.orderField != null) { switch (this.orderField){ - case Label -> ordering.addDescending(Dmp._label); - case UpdatedAt -> ordering.addDescending(Dmp._updatedAt); - case Status -> ordering.addDescending(Dmp._status).addDescending(Dmp._updatedAt); + case Label -> ordering.addDescending(Plan._label); + case UpdatedAt -> ordering.addDescending(Plan._updatedAt); + case Status -> ordering.addDescending(Plan._status).addDescending(Plan._updatedAt); default -> throw new IllegalArgumentException("Type not found" + this.orderField) ; } } else { - ordering.addDescending(Dmp._updatedAt); + ordering.addDescending(Plan._updatedAt); } lookup.setOrder(ordering); - if (this.project !=null)lookup.setProject((BaseFieldSet) this.project.extractPrefixed(RecentActivityItem._dmp)); + if (this.project !=null)lookup.setProject((BaseFieldSet) this.project.extractPrefixed(RecentActivityItem._plan)); return lookup; } diff --git a/backend/core/src/main/java/org/opencdmp/model/actionconfirmation/ActionConfirmation.java b/backend/core/src/main/java/org/opencdmp/model/actionconfirmation/ActionConfirmation.java index b41a3547e..38bba2f8e 100644 --- a/backend/core/src/main/java/org/opencdmp/model/actionconfirmation/ActionConfirmation.java +++ b/backend/core/src/main/java/org/opencdmp/model/actionconfirmation/ActionConfirmation.java @@ -30,7 +30,7 @@ public class ActionConfirmation { public static final String _userInviteToTenantRequest = "userInviteToTenantRequest"; - private DmpInvitation dmpInvitation; + private PlanInvitation planInvitation; public static final String _dmpInvitation = "dmpInvitation"; private Instant expiresAt; @@ -79,12 +79,12 @@ public class ActionConfirmation { this.status = status; } - public DmpInvitation getDmpInvitation() { - return dmpInvitation; + public PlanInvitation getDmpInvitation() { + return planInvitation; } - public void setDmpInvitation(DmpInvitation dmpInvitation) { - this.dmpInvitation = dmpInvitation; + public void setDmpInvitation(PlanInvitation planInvitation) { + this.planInvitation = planInvitation; } public Instant getExpiresAt() { diff --git a/backend/core/src/main/java/org/opencdmp/model/actionconfirmation/DmpInvitation.java b/backend/core/src/main/java/org/opencdmp/model/actionconfirmation/DmpInvitation.java deleted file mode 100644 index 8a5687afe..000000000 --- a/backend/core/src/main/java/org/opencdmp/model/actionconfirmation/DmpInvitation.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.opencdmp.model.actionconfirmation; - -import org.opencdmp.commons.enums.DmpUserRole; - -import java.util.UUID; - -public class DmpInvitation { - - private String email; - public static final String _email = "email"; - - private UUID dmpId; - public static final String _dmpId = "dmpId"; - - private DmpUserRole role; - public static final String _role = "role"; - - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public UUID getDmpId() { - return dmpId; - } - - public void setDmpId(UUID dmpId) { - this.dmpId = dmpId; - } - - public DmpUserRole getRole() { - return role; - } - - public void setRole(DmpUserRole role) { - this.role = role; - } -} diff --git a/backend/core/src/main/java/org/opencdmp/model/actionconfirmation/PlanInvitation.java b/backend/core/src/main/java/org/opencdmp/model/actionconfirmation/PlanInvitation.java new file mode 100644 index 000000000..9224208e4 --- /dev/null +++ b/backend/core/src/main/java/org/opencdmp/model/actionconfirmation/PlanInvitation.java @@ -0,0 +1,42 @@ +package org.opencdmp.model.actionconfirmation; + +import org.opencdmp.commons.enums.PlanUserRole; + +import java.util.UUID; + +public class PlanInvitation { + + private String email; + public static final String _email = "email"; + + private UUID planId; + public static final String _planId = "planId"; + + private PlanUserRole role; + public static final String _role = "role"; + + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public UUID getPlanId() { + return planId; + } + + public void setPlanId(UUID planId) { + this.planId = planId; + } + + public PlanUserRole getRole() { + return role; + } + + public void setRole(PlanUserRole role) { + this.role = role; + } +} diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/DmpAssociatedUserBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/PlanAssociatedUserBuilder.java similarity index 85% rename from backend/core/src/main/java/org/opencdmp/model/builder/DmpAssociatedUserBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/PlanAssociatedUserBuilder.java index 0a52542eb..f10dc1d9a 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/DmpAssociatedUserBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/PlanAssociatedUserBuilder.java @@ -11,7 +11,7 @@ import org.opencdmp.authorization.AuthorizationFlags; import org.opencdmp.commons.enums.ContactInfoType; import org.opencdmp.convention.ConventionService; import org.opencdmp.data.UserEntity; -import org.opencdmp.model.DmpAssociatedUser; +import org.opencdmp.model.PlanAssociatedUser; import org.opencdmp.model.UserContactInfo; import org.opencdmp.model.user.User; import org.opencdmp.query.UserContactInfoQuery; @@ -26,7 +26,7 @@ import java.util.stream.Collectors; @Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpAssociatedUserBuilder extends BaseBuilder { +public class PlanAssociatedUserBuilder extends BaseBuilder { private final QueryFactory queryFactory; @@ -35,32 +35,32 @@ public class DmpAssociatedUserBuilder extends BaseBuilder authorize = EnumSet.of(AuthorizationFlags.None); @Autowired - public DmpAssociatedUserBuilder(ConventionService conventionService, - QueryFactory queryFactory, - BuilderFactory builderFactory) { - super(conventionService, new LoggerService(LoggerFactory.getLogger(DmpAssociatedUserBuilder.class))); + public PlanAssociatedUserBuilder(ConventionService conventionService, + QueryFactory queryFactory, + BuilderFactory builderFactory) { + super(conventionService, new LoggerService(LoggerFactory.getLogger(PlanAssociatedUserBuilder.class))); this.queryFactory = queryFactory; this.builderFactory = builderFactory; } - public DmpAssociatedUserBuilder authorize(EnumSet values) { + public PlanAssociatedUserBuilder authorize(EnumSet values) { this.authorize = values; return this; } @Override - public List build(FieldSet fields, List data) throws MyApplicationException { + public List build(FieldSet fields, List data) throws MyApplicationException { this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0)); this.logger.trace(new DataLogEntry("requested fields", fields)); if (fields == null || data == null || fields.isEmpty()) return new ArrayList<>(); - List models = new ArrayList<>(); + List models = new ArrayList<>(); Map> contactsMap = this.collectUserContactInfos(new BaseFieldSet().ensure(UserContactInfo._value).ensure(UserContactInfo._type).ensure(UserContactInfo._ordinal), data); for (UserEntity d : data) { - DmpAssociatedUser m = new DmpAssociatedUser(); + PlanAssociatedUser m = new PlanAssociatedUser(); if (fields.hasField(this.asIndexer(User._id))) m.setId(d.getId()); if (fields.hasField(this.asIndexer(User._name))) m.setName(d.getName()); if (contactsMap != null && contactsMap.containsKey(d.getId())){ diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/DmpDescriptionTemplateBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/PlanDescriptionTemplateBuilder.java similarity index 63% rename from backend/core/src/main/java/org/opencdmp/model/builder/DmpDescriptionTemplateBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/PlanDescriptionTemplateBuilder.java index 2ab87c434..574228ef2 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/DmpDescriptionTemplateBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/PlanDescriptionTemplateBuilder.java @@ -11,15 +11,15 @@ import org.opencdmp.authorization.AuthorizationFlags; import org.opencdmp.commons.enums.DescriptionTemplateVersionStatus; import org.opencdmp.commons.scope.tenant.TenantScope; import org.opencdmp.convention.ConventionService; -import org.opencdmp.data.DmpDescriptionTemplateEntity; +import org.opencdmp.data.PlanDescriptionTemplateEntity; import org.opencdmp.model.DescriptionTemplateType; -import org.opencdmp.model.DmpDescriptionTemplate; +import org.opencdmp.model.PlanDescriptionTemplate; import org.opencdmp.model.builder.descriptiontemplate.DescriptionTemplateBuilder; -import org.opencdmp.model.builder.dmp.DmpBuilder; +import org.opencdmp.model.builder.plan.PlanBuilder; import org.opencdmp.model.descriptiontemplate.DescriptionTemplate; -import org.opencdmp.model.dmp.Dmp; +import org.opencdmp.model.plan.Plan; import org.opencdmp.query.DescriptionTemplateQuery; -import org.opencdmp.query.DmpQuery; +import org.opencdmp.query.PlanQuery; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.ConfigurableBeanFactory; @@ -31,7 +31,7 @@ import java.util.stream.Collectors; @Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpDescriptionTemplateBuilder extends BaseBuilder { +public class PlanDescriptionTemplateBuilder extends BaseBuilder { private final BuilderFactory builderFactory; @@ -41,50 +41,50 @@ public class DmpDescriptionTemplateBuilder extends BaseBuilder authorize = EnumSet.of(AuthorizationFlags.None); @Autowired - public DmpDescriptionTemplateBuilder( + public PlanDescriptionTemplateBuilder( ConventionService conventionService, BuilderFactory builderFactory, QueryFactory queryFactory, TenantScope tenantScope) { - super(conventionService, new LoggerService(LoggerFactory.getLogger(DmpDescriptionTemplateBuilder.class))); + super(conventionService, new LoggerService(LoggerFactory.getLogger(PlanDescriptionTemplateBuilder.class))); this.builderFactory = builderFactory; this.queryFactory = queryFactory; this.tenantScope = tenantScope; } - public DmpDescriptionTemplateBuilder authorize(EnumSet values) { + public PlanDescriptionTemplateBuilder authorize(EnumSet values) { this.authorize = values; return this; } @Override - public List build(FieldSet fields, List data) throws MyApplicationException { + public List build(FieldSet fields, List data) throws MyApplicationException { this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0)); this.logger.trace(new DataLogEntry("requested fields", fields)); if (fields == null || data == null || fields.isEmpty()) return new ArrayList<>(); - FieldSet templateFields = fields.extractPrefixed(this.asPrefix(DmpDescriptionTemplate._descriptionTemplates)); + FieldSet templateFields = fields.extractPrefixed(this.asPrefix(PlanDescriptionTemplate._descriptionTemplates)); Map> templateItemsMap = this.collectDescriptionTemplates(templateFields, data); - FieldSet currentDescriptionTemplateFields = fields.extractPrefixed(this.asPrefix(DmpDescriptionTemplate._currentDescriptionTemplate)); + FieldSet currentDescriptionTemplateFields = fields.extractPrefixed(this.asPrefix(PlanDescriptionTemplate._currentDescriptionTemplate)); Map currentDescriptionTemplateItemsMap = this.collectCurrentDescriptionTemplates(currentDescriptionTemplateFields, data); - FieldSet dmpFields = fields.extractPrefixed(this.asPrefix(DmpDescriptionTemplate._dmp)); - Map dmpItemsMap = this.collectDmps(dmpFields, data); + FieldSet planFields = fields.extractPrefixed(this.asPrefix(PlanDescriptionTemplate._plan)); + Map planItemsMap = this.collectPlans(planFields, data); - List models = new ArrayList<>(); - for (DmpDescriptionTemplateEntity d : data) { - DmpDescriptionTemplate m = new DmpDescriptionTemplate(); - if (fields.hasField(this.asIndexer(DmpDescriptionTemplate._id))) m.setId(d.getId()); - if (fields.hasField(this.asIndexer(DmpDescriptionTemplate._sectionId))) m.setSectionId(d.getSectionId()); - if (fields.hasField(this.asIndexer(DmpDescriptionTemplate._descriptionTemplateGroupId))) m.setDescriptionTemplateGroupId(d.getDescriptionTemplateGroupId()); - if (fields.hasField(this.asIndexer(DmpDescriptionTemplate._createdAt))) m.setCreatedAt(d.getCreatedAt()); - if (fields.hasField(this.asIndexer(DmpDescriptionTemplate._updatedAt))) m.setUpdatedAt(d.getUpdatedAt()); - if (fields.hasField(this.asIndexer(DmpDescriptionTemplate._isActive))) m.setIsActive(d.getIsActive()); - if (fields.hasField(this.asIndexer(DmpDescriptionTemplate._hash))) m.setHash(this.hashValue(d.getUpdatedAt())); + List models = new ArrayList<>(); + for (PlanDescriptionTemplateEntity d : data) { + PlanDescriptionTemplate m = new PlanDescriptionTemplate(); + if (fields.hasField(this.asIndexer(PlanDescriptionTemplate._id))) m.setId(d.getId()); + if (fields.hasField(this.asIndexer(PlanDescriptionTemplate._sectionId))) m.setSectionId(d.getSectionId()); + if (fields.hasField(this.asIndexer(PlanDescriptionTemplate._descriptionTemplateGroupId))) m.setDescriptionTemplateGroupId(d.getDescriptionTemplateGroupId()); + if (fields.hasField(this.asIndexer(PlanDescriptionTemplate._createdAt))) m.setCreatedAt(d.getCreatedAt()); + if (fields.hasField(this.asIndexer(PlanDescriptionTemplate._updatedAt))) m.setUpdatedAt(d.getUpdatedAt()); + if (fields.hasField(this.asIndexer(PlanDescriptionTemplate._isActive))) m.setIsActive(d.getIsActive()); + if (fields.hasField(this.asIndexer(PlanDescriptionTemplate._hash))) m.setHash(this.hashValue(d.getUpdatedAt())); if (fields.hasField(this.asIndexer(DescriptionTemplateType._belongsToCurrentTenant))) m.setBelongsToCurrentTenant(this.getBelongsToCurrentTenant(d, this.tenantScope)); if (!templateFields.isEmpty() && templateItemsMap != null && templateItemsMap.containsKey(d.getDescriptionTemplateGroupId())) m.setDescriptionTemplates(templateItemsMap.get(d.getDescriptionTemplateGroupId())); if (!currentDescriptionTemplateFields.isEmpty() && currentDescriptionTemplateItemsMap != null && currentDescriptionTemplateItemsMap.containsKey(d.getDescriptionTemplateGroupId())) m.setCurrentDescriptionTemplate(currentDescriptionTemplateItemsMap.get(d.getDescriptionTemplateGroupId())); - if (!dmpFields.isEmpty() && dmpItemsMap != null && dmpItemsMap.containsKey(d.getDmpId())) m.setDmp(dmpItemsMap.get(d.getDmpId())); + if (!planFields.isEmpty() && planItemsMap != null && planItemsMap.containsKey(d.getPlanId())) m.setDmp(planItemsMap.get(d.getPlanId())); models.add(m); } this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0)); @@ -92,41 +92,41 @@ public class DmpDescriptionTemplateBuilder extends BaseBuilder collectDmps(FieldSet fields, List data) throws MyApplicationException { + private Map collectPlans(FieldSet fields, List data) throws MyApplicationException { if (fields.isEmpty() || data.isEmpty()) return null; - this.logger.debug("checking related - {}", Dmp.class.getSimpleName()); + this.logger.debug("checking related - {}", Plan.class.getSimpleName()); - Map itemMap; - if (!fields.hasOtherField(this.asIndexer(Dmp._id))) { + Map itemMap; + if (!fields.hasOtherField(this.asIndexer(Plan._id))) { itemMap = this.asEmpty( - data.stream().map(DmpDescriptionTemplateEntity::getDmpId).distinct().collect(Collectors.toList()), + data.stream().map(PlanDescriptionTemplateEntity::getPlanId).distinct().collect(Collectors.toList()), x -> { - Dmp item = new Dmp(); + Plan item = new Plan(); item.setId(x); return item; }, - Dmp::getId); + Plan::getId); } else { - FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Dmp._id); - DmpQuery q = this.queryFactory.query(DmpQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DmpDescriptionTemplateEntity::getDmpId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(DmpBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Dmp::getId); + FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Plan._id); + PlanQuery q = this.queryFactory.query(PlanQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(PlanDescriptionTemplateEntity::getPlanId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(PlanBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Plan::getId); } - if (!fields.hasField(Dmp._id)) { + if (!fields.hasField(Plan._id)) { itemMap.values().stream().filter(Objects::nonNull).forEach(x -> x.setId(null)); } return itemMap; } - private Map> collectDescriptionTemplates(FieldSet fields, List data) throws MyApplicationException { + private Map> collectDescriptionTemplates(FieldSet fields, List data) throws MyApplicationException { if (fields.isEmpty() || data.isEmpty()) return null; this.logger.debug("checking related - {}", DescriptionTemplate.class.getSimpleName()); Map> itemMap; FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(DescriptionTemplate._groupId); - DescriptionTemplateQuery query = this.queryFactory.query(DescriptionTemplateQuery.class).disableTracking().authorize(this.authorize).groupIds(data.stream().map(DmpDescriptionTemplateEntity::getDescriptionTemplateGroupId).distinct().collect(Collectors.toList())); + DescriptionTemplateQuery query = this.queryFactory.query(DescriptionTemplateQuery.class).disableTracking().authorize(this.authorize).groupIds(data.stream().map(PlanDescriptionTemplateEntity::getDescriptionTemplateGroupId).distinct().collect(Collectors.toList())); itemMap = this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(this.authorize).asMasterKey(query, clone, DescriptionTemplate::getGroupId); if (!fields.hasField(DescriptionTemplate._groupId)) { @@ -138,7 +138,7 @@ public class DmpDescriptionTemplateBuilder extends BaseBuilder collectCurrentDescriptionTemplates(FieldSet fields, List data) throws MyApplicationException { + private Map collectCurrentDescriptionTemplates(FieldSet fields, List data) throws MyApplicationException { if (fields.isEmpty() || data.isEmpty()) return null; this.logger.debug("checking related - {}", DescriptionTemplate.class.getSimpleName()); @@ -146,7 +146,7 @@ public class DmpDescriptionTemplateBuilder extends BaseBuilder itemMap; if (!fields.hasOtherField(this.asIndexer(DescriptionTemplate._groupId))) { itemMap = this.asEmpty( - data.stream().map(DmpDescriptionTemplateEntity::getDescriptionTemplateGroupId).distinct().collect(Collectors.toList()), + data.stream().map(PlanDescriptionTemplateEntity::getDescriptionTemplateGroupId).distinct().collect(Collectors.toList()), x -> { DescriptionTemplate item = new DescriptionTemplate(); item.setGroupId(x); @@ -155,7 +155,7 @@ public class DmpDescriptionTemplateBuilder extends BaseBuilder{ +public class PlanUserBuilder extends BaseBuilder{ private final BuilderFactory builderFactory; @@ -38,46 +38,46 @@ public class DmpUserBuilder extends BaseBuilder{ private EnumSet authorize = EnumSet.of(AuthorizationFlags.None); @Autowired - public DmpUserBuilder( + public PlanUserBuilder( ConventionService conventionService, BuilderFactory builderFactory, QueryFactory queryFactory, TenantScope tenantScope) { - super(conventionService, new LoggerService(LoggerFactory.getLogger(DmpUserBuilder.class))); + super(conventionService, new LoggerService(LoggerFactory.getLogger(PlanUserBuilder.class))); this.builderFactory = builderFactory; this.queryFactory = queryFactory; this.tenantScope = tenantScope; } - public DmpUserBuilder authorize(EnumSet values) { + public PlanUserBuilder authorize(EnumSet values) { this.authorize = values; return this; } @Override - public List build(FieldSet fields, List data) throws MyApplicationException { + public List build(FieldSet fields, List data) throws MyApplicationException { this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0)); this.logger.trace(new DataLogEntry("requested fields", fields)); if (fields == null || data == null || fields.isEmpty()) return new ArrayList<>(); - FieldSet dmpFields = fields.extractPrefixed(this.asPrefix(DmpUser._dmp)); - Map dmpItemsMap = this.collectDmps(dmpFields, data); + FieldSet planFields = fields.extractPrefixed(this.asPrefix(PlanUser._plan)); + Map planItemsMap = this.collectPlans(planFields, data); - FieldSet userFields = fields.extractPrefixed(this.asPrefix(DmpUser._user)); + FieldSet userFields = fields.extractPrefixed(this.asPrefix(PlanUser._user)); Map userItemsMap = this.collectUsers(userFields, data); - List models = new ArrayList<>(); - for (DmpUserEntity d : data) { - DmpUser m = new DmpUser(); - if (fields.hasField(this.asIndexer(DmpUser._id))) m.setId(d.getId()); - if (fields.hasField(this.asIndexer(DmpUser._role))) m.setRole(d.getRole()); - if (fields.hasField(this.asIndexer(DmpUser._sectionId))) m.setSectionId(d.getSectionId()); - if (fields.hasField(this.asIndexer(DmpUser._createdAt))) m.setCreatedAt(d.getCreatedAt()); - if (fields.hasField(this.asIndexer(DmpUser._updatedAt))) m.setUpdatedAt(d.getUpdatedAt()); - if (fields.hasField(this.asIndexer(DmpUser._isActive))) m.setIsActive(d.getIsActive()); - if (fields.hasField(this.asIndexer(DmpUser._hash))) m.setHash(this.hashValue(d.getUpdatedAt())); - if (fields.hasField(this.asIndexer(DmpUser._belongsToCurrentTenant))) m.setBelongsToCurrentTenant(this.getBelongsToCurrentTenant(d, this.tenantScope)); + List models = new ArrayList<>(); + for (PlanUserEntity d : data) { + PlanUser m = new PlanUser(); + if (fields.hasField(this.asIndexer(PlanUser._id))) m.setId(d.getId()); + if (fields.hasField(this.asIndexer(PlanUser._role))) m.setRole(d.getRole()); + if (fields.hasField(this.asIndexer(PlanUser._sectionId))) m.setSectionId(d.getSectionId()); + if (fields.hasField(this.asIndexer(PlanUser._createdAt))) m.setCreatedAt(d.getCreatedAt()); + if (fields.hasField(this.asIndexer(PlanUser._updatedAt))) m.setUpdatedAt(d.getUpdatedAt()); + if (fields.hasField(this.asIndexer(PlanUser._isActive))) m.setIsActive(d.getIsActive()); + if (fields.hasField(this.asIndexer(PlanUser._hash))) m.setHash(this.hashValue(d.getUpdatedAt())); + if (fields.hasField(this.asIndexer(PlanUser._belongsToCurrentTenant))) m.setBelongsToCurrentTenant(this.getBelongsToCurrentTenant(d, this.tenantScope)); if (!userFields.isEmpty() && userItemsMap != null && userItemsMap.containsKey(d.getUserId())) m.setUser(userItemsMap.get(d.getUserId())); - if (!dmpFields.isEmpty() && dmpItemsMap != null && dmpItemsMap.containsKey(d.getDmpId())) m.setDmp(dmpItemsMap.get(d.getDmpId())); + if (!planFields.isEmpty() && planItemsMap != null && planItemsMap.containsKey(d.getPlanId())) m.setPlan(planItemsMap.get(d.getPlanId())); if (!userFields.isEmpty() && userItemsMap != null && userItemsMap.containsKey(d.getUserId())) m.setUser(userItemsMap.get(d.getUserId())); models.add(m); } @@ -85,7 +85,7 @@ public class DmpUserBuilder extends BaseBuilder{ return models; } - private Map collectUsers(FieldSet fields, List data) throws MyApplicationException { + private Map collectUsers(FieldSet fields, List data) throws MyApplicationException { if (fields.isEmpty() || data.isEmpty()) return null; this.logger.debug("checking related - {}", User.class.getSimpleName()); @@ -93,7 +93,7 @@ public class DmpUserBuilder extends BaseBuilder{ Map itemMap; if (!fields.hasOtherField(this.asIndexer(User._id))) { itemMap = this.asEmpty( - data.stream().map(DmpUserEntity::getUserId).distinct().collect(Collectors.toList()), + data.stream().map(PlanUserEntity::getUserId).distinct().collect(Collectors.toList()), x -> { User item = new User(); item.setId(x); @@ -102,7 +102,7 @@ public class DmpUserBuilder extends BaseBuilder{ User::getId); } else { FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(User._id); - UserQuery q = this.queryFactory.query(UserQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DmpUserEntity::getUserId).distinct().collect(Collectors.toList())); + UserQuery q = this.queryFactory.query(UserQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(PlanUserEntity::getUserId).distinct().collect(Collectors.toList())); itemMap = this.builderFactory.builder(UserBuilder.class).authorize(this.authorize).asForeignKey(q, clone, User::getId); } if (!fields.hasField(User._id)) { @@ -115,27 +115,27 @@ public class DmpUserBuilder extends BaseBuilder{ return itemMap; } - private Map collectDmps(FieldSet fields, List data) throws MyApplicationException { + private Map collectPlans(FieldSet fields, List data) throws MyApplicationException { if (fields.isEmpty() || data.isEmpty()) return null; - this.logger.debug("checking related - {}", Dmp.class.getSimpleName()); + this.logger.debug("checking related - {}", Plan.class.getSimpleName()); - Map itemMap; - if (!fields.hasOtherField(this.asIndexer(Dmp._id))) { + Map itemMap; + if (!fields.hasOtherField(this.asIndexer(Plan._id))) { itemMap = this.asEmpty( - data.stream().map(DmpUserEntity::getDmpId).distinct().collect(Collectors.toList()), + data.stream().map(PlanUserEntity::getPlanId).distinct().collect(Collectors.toList()), x -> { - Dmp item = new Dmp(); + Plan item = new Plan(); item.setId(x); return item; }, - Dmp::getId); + Plan::getId); } else { - FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Dmp._id); - DmpQuery q = this.queryFactory.query(DmpQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DmpUserEntity::getDmpId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(DmpBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Dmp::getId); + FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Plan._id); + PlanQuery q = this.queryFactory.query(PlanQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(PlanUserEntity::getPlanId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(PlanBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Plan::getId); } - if (!fields.hasField(Dmp._id)) { + if (!fields.hasField(Plan._id)) { itemMap.values().stream().filter(Objects::nonNull).forEach(x -> x.setId(null)); } diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/PublicDescriptionBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/PublicDescriptionBuilder.java index 964a12796..0984191d4 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/PublicDescriptionBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/PublicDescriptionBuilder.java @@ -12,11 +12,11 @@ import org.opencdmp.convention.ConventionService; import org.opencdmp.data.DescriptionEntity; import org.opencdmp.model.PublicDescription; import org.opencdmp.model.PublicDescriptionTemplate; -import org.opencdmp.model.PublicDmp; -import org.opencdmp.model.PublicDmpDescriptionTemplate; +import org.opencdmp.model.PublicPlan; +import org.opencdmp.model.PublicPlanDescriptionTemplate; import org.opencdmp.query.DescriptionTemplateQuery; -import org.opencdmp.query.DmpDescriptionTemplateQuery; -import org.opencdmp.query.DmpQuery; +import org.opencdmp.query.PlanDescriptionTemplateQuery; +import org.opencdmp.query.PlanQuery; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.ConfigurableBeanFactory; @@ -57,14 +57,14 @@ public class PublicDescriptionBuilder extends BaseBuilder(); - FieldSet dmpDescriptionTemplateFields = fields.extractPrefixed(this.asPrefix(PublicDescription._dmpDescriptionTemplate)); - Map dmpDescriptionTemplateItemsMap = this.collectDmpDescriptionTemplates(dmpDescriptionTemplateFields, data); + FieldSet planDescriptionTemplateFields = fields.extractPrefixed(this.asPrefix(PublicDescription._planDescriptionTemplate)); + Map planDescriptionTemplateItemsMap = this.collectPlanDescriptionTemplates(planDescriptionTemplateFields, data); FieldSet descriptionTemplateFields = fields.extractPrefixed(this.asPrefix(PublicDescription._descriptionTemplate)); Map descriptionTemplateItemsMap = this.collectDescriptionTemplates(descriptionTemplateFields, data); - FieldSet dmpFields = fields.extractPrefixed(this.asPrefix(PublicDescription._dmp)); - Map dmpItemsMap = this.collectDmps(dmpFields, data); + FieldSet planFields = fields.extractPrefixed(this.asPrefix(PublicDescription._plan)); + Map planItemsMap = this.collectPlans(planFields, data); List models = new ArrayList<>(); for (DescriptionEntity d : data) { @@ -76,8 +76,8 @@ public class PublicDescriptionBuilder extends BaseBuilder collectDmpDescriptionTemplates(FieldSet fields, List data) throws MyApplicationException { + private Map collectPlanDescriptionTemplates(FieldSet fields, List data) throws MyApplicationException { if (fields.isEmpty() || data.isEmpty()) return null; - this.logger.debug("checking related - {}", PublicDmpDescriptionTemplate.class.getSimpleName()); + this.logger.debug("checking related - {}", PublicPlanDescriptionTemplate.class.getSimpleName()); - Map itemMap; - if (!fields.hasOtherField(this.asIndexer(PublicDmpDescriptionTemplate._id))) { + Map itemMap; + if (!fields.hasOtherField(this.asIndexer(PublicPlanDescriptionTemplate._id))) { itemMap = this.asEmpty( - data.stream().map(DescriptionEntity::getDmpDescriptionTemplateId).distinct().collect(Collectors.toList()), + data.stream().map(DescriptionEntity::getPlanDescriptionTemplateId).distinct().collect(Collectors.toList()), x -> { - PublicDmpDescriptionTemplate item = new PublicDmpDescriptionTemplate(); + PublicPlanDescriptionTemplate item = new PublicPlanDescriptionTemplate(); item.setId(x); return item; }, - PublicDmpDescriptionTemplate::getId); + PublicPlanDescriptionTemplate::getId); } else { - FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PublicDmpDescriptionTemplate._id); - DmpDescriptionTemplateQuery q = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DescriptionEntity::getDmpDescriptionTemplateId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(PublicDmpDescriptionTemplateBuilder.class).authorize(this.authorize).asForeignKey(q, clone, PublicDmpDescriptionTemplate::getId); + FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PublicPlanDescriptionTemplate._id); + PlanDescriptionTemplateQuery q = this.queryFactory.query(PlanDescriptionTemplateQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DescriptionEntity::getPlanDescriptionTemplateId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(PublicPlanDescriptionTemplateBuilder.class).authorize(this.authorize).asForeignKey(q, clone, PublicPlanDescriptionTemplate::getId); } - if (!fields.hasField(PublicDmpDescriptionTemplate._id)) { + if (!fields.hasField(PublicPlanDescriptionTemplate._id)) { itemMap.forEach((id, item) -> { if (item != null) item.setId(null); @@ -147,27 +147,27 @@ public class PublicDescriptionBuilder extends BaseBuilder collectDmps(FieldSet fields, List data) throws MyApplicationException { + private Map collectPlans(FieldSet fields, List data) throws MyApplicationException { if (fields.isEmpty() || data.isEmpty()) return null; - this.logger.debug("checking related - {}", PublicDmp.class.getSimpleName()); + this.logger.debug("checking related - {}", PublicPlan.class.getSimpleName()); - Map itemMap; - if (!fields.hasOtherField(this.asIndexer(PublicDmp._id))) { + Map itemMap; + if (!fields.hasOtherField(this.asIndexer(PublicPlan._id))) { itemMap = this.asEmpty( - data.stream().map(DescriptionEntity::getDmpId).distinct().collect(Collectors.toList()), + data.stream().map(DescriptionEntity::getPlanId).distinct().collect(Collectors.toList()), x -> { - PublicDmp item = new PublicDmp(); + PublicPlan item = new PublicPlan(); item.setId(x); return item; }, - PublicDmp::getId); + PublicPlan::getId); } else { - FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PublicDmp._id); - DmpQuery q = this.queryFactory.query(DmpQuery.class).authorize(this.authorize).disableTracking().ids(data.stream().map(DescriptionEntity::getDmpId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(PublicDmpBuilder.class).authorize(this.authorize).asForeignKey(q, clone, PublicDmp::getId); + FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PublicPlan._id); + PlanQuery q = this.queryFactory.query(PlanQuery.class).authorize(this.authorize).disableTracking().ids(data.stream().map(DescriptionEntity::getPlanId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(PublicPlanBuilder.class).authorize(this.authorize).asForeignKey(q, clone, PublicPlan::getId); } - if (!fields.hasField(PublicDmp._id)) { + if (!fields.hasField(PublicPlan._id)) { itemMap.forEach((id, item) -> { if (item != null) item.setId(null); diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/PublicDmpBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/PublicDmpBuilder.java deleted file mode 100644 index b9ed5f07a..000000000 --- a/backend/core/src/main/java/org/opencdmp/model/builder/PublicDmpBuilder.java +++ /dev/null @@ -1,194 +0,0 @@ -package org.opencdmp.model.builder; - -import gr.cite.tools.data.builder.BuilderFactory; -import gr.cite.tools.data.query.QueryFactory; -import gr.cite.tools.exception.MyApplicationException; -import gr.cite.tools.fieldset.BaseFieldSet; -import gr.cite.tools.fieldset.FieldSet; -import gr.cite.tools.logging.DataLogEntry; -import gr.cite.tools.logging.LoggerService; -import org.opencdmp.authorization.AuthorizationFlags; -import org.opencdmp.commons.enums.EntityType; -import org.opencdmp.commons.enums.IsActive; -import org.opencdmp.convention.ConventionService; -import org.opencdmp.data.DmpEntity; -import org.opencdmp.model.*; -import org.opencdmp.model.dmp.Dmp; -import org.opencdmp.query.*; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.config.ConfigurableBeanFactory; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Component; - -import java.util.*; -import java.util.stream.Collectors; - -@Component -@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class PublicDmpBuilder extends BaseBuilder { - - private final QueryFactory queryFactory; - - private final BuilderFactory builderFactory; - - private EnumSet authorize = EnumSet.of(AuthorizationFlags.None); - - @Autowired - public PublicDmpBuilder(ConventionService conventionService, - QueryFactory queryFactory, - BuilderFactory builderFactory) { - super(conventionService, new LoggerService(LoggerFactory.getLogger(PublicDmpBuilder.class))); - this.queryFactory = queryFactory; - this.builderFactory = builderFactory; - } - - public PublicDmpBuilder authorize(EnumSet values) { - this.authorize = values; - return this; - } - - @Override - public List build(FieldSet fields, List data) throws MyApplicationException { - this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0)); - this.logger.trace(new DataLogEntry("requested fields", fields)); - if (fields == null || data == null || fields.isEmpty()) - return new ArrayList<>(); - - List models = new ArrayList<>(); - - FieldSet dmpReferencesFields = fields.extractPrefixed(this.asPrefix(PublicDmp._dmpReferences)); - Map> dmpReferenceMap = this.collectDmpReferences(dmpReferencesFields, data); - - FieldSet dmpUsersFields = fields.extractPrefixed(this.asPrefix(PublicDmp._dmpUsers)); - Map> dmpUsersMap = this.collectDmpUsers(dmpUsersFields, data); - - FieldSet descriptionsFields = fields.extractPrefixed(this.asPrefix(PublicDmp._descriptions)); - Map> descriptionsMap = this.collectDmpDescriptions(descriptionsFields, data); - - FieldSet entityDoisFields = fields.extractPrefixed(this.asPrefix(PublicDmp._entityDois)); - Map> entityDoisMap = this.collectEntityDois(entityDoisFields, data); - - FieldSet otherDmpVersionsFields = fields.extractPrefixed(this.asPrefix(PublicDmp._otherDmpVersions)); - Map> otherDmpVersionsMap = this.collectOtherDmpVersions(otherDmpVersionsFields, data); - - for (DmpEntity d : data) { - PublicDmp m = new PublicDmp(); - if (fields.hasField(this.asIndexer(PublicDmp._id))) m.setId(d.getId()); - if (fields.hasField(this.asIndexer(PublicDmp._label))) m.setLabel(d.getLabel()); - if (fields.hasField(this.asIndexer(PublicDmp._version))) m.setVersion(d.getVersion()); - if (fields.hasField(this.asIndexer(PublicDmp._description))) m.setDescription(d.getDescription()); - if (fields.hasField(this.asIndexer(PublicDmp._finalizedAt))) m.setFinalizedAt(d.getFinalizedAt()); - if (fields.hasField(this.asIndexer(PublicDmp._updatedAt))) m.setUpdatedAt(d.getUpdatedAt()); - if (fields.hasField(this.asIndexer(PublicDmp._accessType))) m.setAccessType(d.getAccessType()); - if (fields.hasField(this.asIndexer(PublicDmp._status))) m.setStatus(d.getStatus()); - if (fields.hasField(this.asIndexer(PublicDmp._groupId))) m.setGroupId(d.getGroupId()); - if (fields.hasField(this.asIndexer(PublicDmp._accessType))) m.setAccessType(d.getAccessType()); - - if (dmpReferenceMap != null && !dmpReferenceMap.isEmpty() && dmpReferenceMap.containsKey(d.getId())) m.setDmpReferences(dmpReferenceMap.get(d.getId())); - if (dmpUsersMap != null && !dmpUsersMap.isEmpty() && dmpUsersMap.containsKey(d.getId())) m.setDmpUsers(dmpUsersMap.get(d.getId())); - if (descriptionsMap != null && !descriptionsMap.isEmpty() && descriptionsMap.containsKey(d.getId())) m.setDescriptions(descriptionsMap.get(d.getId())); - if (entityDoisMap != null && !entityDoisMap.isEmpty() && entityDoisMap.containsKey(d.getId())) m.setEntityDois(entityDoisMap.get(d.getId())); - if (otherDmpVersionsMap != null && !otherDmpVersionsMap.isEmpty() && otherDmpVersionsMap.containsKey(d.getGroupId())){ - m.setOtherDmpVersions(otherDmpVersionsMap.get(d.getGroupId())); - m.getOtherDmpVersions().sort(Comparator.comparing(PublicDmp::getVersion)); - } - - models.add(m); - } - this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0)); - - return models; - } - - private Map> collectDmpReferences(FieldSet fields, List data) throws MyApplicationException { - if (fields.isEmpty() || data.isEmpty()) return null; - this.logger.debug("checking related - {}", PublicDmpReference.class.getSimpleName()); - - Map> itemMap = null; - FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(PublicDmpReference._dmp, PublicDmp._id)); - DmpReferenceQuery query = this.queryFactory.query(DmpReferenceQuery.class).disableTracking().authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(PublicDmpReferenceBuilder.class).authorize(this.authorize).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId()); - - if (!fields.hasField(this.asIndexer(PublicDmpReference._dmp, PublicDmp._id))) { - itemMap.values().stream().flatMap(List::stream).filter(x -> x != null && x.getDmp() != null).forEach(x -> { - x.getDmp().setId(null); - }); - } - - return itemMap; - } - - private Map> collectDmpUsers(FieldSet fields, List data) throws MyApplicationException { - if (fields.isEmpty() || data.isEmpty()) return null; - this.logger.debug("checking related - {}", PublicDmpUser.class.getSimpleName()); - - Map> itemMap = null; - FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(PublicDmpUser._dmp, PublicDmp._id)); - DmpUserQuery query = this.queryFactory.query(DmpUserQuery.class).disableTracking().authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(PublicDmpUserBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId()); - - if (!fields.hasField(this.asIndexer(PublicDmpUser._dmp, PublicDmp._id))) { - itemMap.values().stream().flatMap(List::stream).filter(x -> x != null && x.getDmp() != null).forEach(x -> { - x.getDmp().setId(null); - }); - } - - return itemMap; - } - - private Map> collectDmpDescriptions(FieldSet fields, List data) throws MyApplicationException { - if (fields.isEmpty() || data.isEmpty()) return null; - this.logger.debug("checking related - {}", PublicDescription.class.getSimpleName()); - - Map> itemMap; - FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(PublicDescription._dmp, PublicDescription._id)); - DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(PublicDescriptionBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId()); - - if (!fields.hasField(this.asIndexer(PublicDescription._dmp, PublicDescription._id))) { - itemMap.values().stream().flatMap(List::stream).filter(x -> x != null && x.getDmp() != null).forEach(x -> { - x.getDmp().setId(null); - }); - } - - return itemMap; - } - - private Map> collectEntityDois(FieldSet fields, List data) throws MyApplicationException { - if (fields.isEmpty() || data.isEmpty()) return null; - this.logger.debug("checking related - {}", PublicEntityDoi.class.getSimpleName()); - - Map> itemMap; - FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(PublicEntityDoi._entityId)); - EntityDoiQuery query = this.queryFactory.query(EntityDoiQuery.class).disableTracking().authorize(this.authorize).types(EntityType.DMP).entityIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(PublicEntityDoiBuilder.class).authorize(this.authorize).asMasterKey(query, clone, PublicEntityDoi::getEntityId); - - if (!fields.hasField(this.asIndexer(PublicEntityDoi._entityId))) { - itemMap.values().stream().flatMap(List::stream).filter(x -> x != null && x.getEntityId() != null).forEach(x -> { - x.setEntityId(null); - }); - } - - return itemMap; - } - - private Map> collectOtherDmpVersions(FieldSet fields, List data) throws MyApplicationException { - if (fields.isEmpty() || data.isEmpty()) return null; - this.logger.debug("checking related - {}", PublicDmp.class.getSimpleName()); - - Map> itemMap; - FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PublicDmp._id); - DmpQuery query = this.queryFactory.query(DmpQuery.class).disableTracking().authorize(this.authorize).groupIds(data.stream().map(DmpEntity::getGroupId).distinct().collect(Collectors.toList())).isActive(IsActive.Active); - itemMap = this.builderFactory.builder(PublicDmpBuilder.class).authorize(this.authorize).asMasterKey(query, clone, PublicDmp::getGroupId); - - if (!fields.hasField(PublicDmp._id)) { - itemMap.values().stream().flatMap(List::stream).filter(Objects::nonNull).forEach(x -> { - x.setId(null); - }); - } - - return itemMap; - } - -} diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/PublicPlanBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/PublicPlanBuilder.java new file mode 100644 index 000000000..3c70007bb --- /dev/null +++ b/backend/core/src/main/java/org/opencdmp/model/builder/PublicPlanBuilder.java @@ -0,0 +1,193 @@ +package org.opencdmp.model.builder; + +import gr.cite.tools.data.builder.BuilderFactory; +import gr.cite.tools.data.query.QueryFactory; +import gr.cite.tools.exception.MyApplicationException; +import gr.cite.tools.fieldset.BaseFieldSet; +import gr.cite.tools.fieldset.FieldSet; +import gr.cite.tools.logging.DataLogEntry; +import gr.cite.tools.logging.LoggerService; +import org.opencdmp.authorization.AuthorizationFlags; +import org.opencdmp.commons.enums.EntityType; +import org.opencdmp.commons.enums.IsActive; +import org.opencdmp.convention.ConventionService; +import org.opencdmp.data.PlanEntity; +import org.opencdmp.model.*; +import org.opencdmp.query.*; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + +import java.util.*; +import java.util.stream.Collectors; + +@Component +@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) +public class PublicPlanBuilder extends BaseBuilder { + + private final QueryFactory queryFactory; + + private final BuilderFactory builderFactory; + + private EnumSet authorize = EnumSet.of(AuthorizationFlags.None); + + @Autowired + public PublicPlanBuilder(ConventionService conventionService, + QueryFactory queryFactory, + BuilderFactory builderFactory) { + super(conventionService, new LoggerService(LoggerFactory.getLogger(PublicPlanBuilder.class))); + this.queryFactory = queryFactory; + this.builderFactory = builderFactory; + } + + public PublicPlanBuilder authorize(EnumSet values) { + this.authorize = values; + return this; + } + + @Override + public List build(FieldSet fields, List data) throws MyApplicationException { + this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0)); + this.logger.trace(new DataLogEntry("requested fields", fields)); + if (fields == null || data == null || fields.isEmpty()) + return new ArrayList<>(); + + List models = new ArrayList<>(); + + FieldSet planReferencesFields = fields.extractPrefixed(this.asPrefix(PublicPlan._planReferences)); + Map> planReferenceMap = this.collectPlanReferences(planReferencesFields, data); + + FieldSet planUsersFields = fields.extractPrefixed(this.asPrefix(PublicPlan._planUsers)); + Map> planUsersMap = this.collectPlanUsers(planUsersFields, data); + + FieldSet descriptionsFields = fields.extractPrefixed(this.asPrefix(PublicPlan._descriptions)); + Map> descriptionsMap = this.collectPlanDescriptions(descriptionsFields, data); + + FieldSet entityDoisFields = fields.extractPrefixed(this.asPrefix(PublicPlan._entityDois)); + Map> entityDoisMap = this.collectEntityDois(entityDoisFields, data); + + FieldSet otherPlanVersionsFields = fields.extractPrefixed(this.asPrefix(PublicPlan._otherPlanVersions)); + Map> otherPlanVersionsMap = this.collectOtherPlanVersions(otherPlanVersionsFields, data); + + for (PlanEntity d : data) { + PublicPlan m = new PublicPlan(); + if (fields.hasField(this.asIndexer(PublicPlan._id))) m.setId(d.getId()); + if (fields.hasField(this.asIndexer(PublicPlan._label))) m.setLabel(d.getLabel()); + if (fields.hasField(this.asIndexer(PublicPlan._version))) m.setVersion(d.getVersion()); + if (fields.hasField(this.asIndexer(PublicPlan._description))) m.setDescription(d.getDescription()); + if (fields.hasField(this.asIndexer(PublicPlan._finalizedAt))) m.setFinalizedAt(d.getFinalizedAt()); + if (fields.hasField(this.asIndexer(PublicPlan._updatedAt))) m.setUpdatedAt(d.getUpdatedAt()); + if (fields.hasField(this.asIndexer(PublicPlan._accessType))) m.setAccessType(d.getAccessType()); + if (fields.hasField(this.asIndexer(PublicPlan._status))) m.setStatus(d.getStatus()); + if (fields.hasField(this.asIndexer(PublicPlan._groupId))) m.setGroupId(d.getGroupId()); + if (fields.hasField(this.asIndexer(PublicPlan._accessType))) m.setAccessType(d.getAccessType()); + + if (planReferenceMap != null && !planReferenceMap.isEmpty() && planReferenceMap.containsKey(d.getId())) m.setPlanReferences(planReferenceMap.get(d.getId())); + if (planUsersMap != null && !planUsersMap.isEmpty() && planUsersMap.containsKey(d.getId())) m.setPlanUsers(planUsersMap.get(d.getId())); + if (descriptionsMap != null && !descriptionsMap.isEmpty() && descriptionsMap.containsKey(d.getId())) m.setDescriptions(descriptionsMap.get(d.getId())); + if (entityDoisMap != null && !entityDoisMap.isEmpty() && entityDoisMap.containsKey(d.getId())) m.setEntityDois(entityDoisMap.get(d.getId())); + if (otherPlanVersionsMap != null && !otherPlanVersionsMap.isEmpty() && otherPlanVersionsMap.containsKey(d.getGroupId())){ + m.setOtherPlanVersions(otherPlanVersionsMap.get(d.getGroupId())); + m.getOtherPlanVersions().sort(Comparator.comparing(PublicPlan::getVersion)); + } + + models.add(m); + } + this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0)); + + return models; + } + + private Map> collectPlanReferences(FieldSet fields, List data) throws MyApplicationException { + if (fields.isEmpty() || data.isEmpty()) return null; + this.logger.debug("checking related - {}", PublicPlanReference.class.getSimpleName()); + + Map> itemMap = null; + FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(PublicPlanReference._plan, PublicPlan._id)); + PlanReferenceQuery query = this.queryFactory.query(PlanReferenceQuery.class).disableTracking().authorize(this.authorize).planIds(data.stream().map(PlanEntity::getId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(PublicPlanReferenceBuilder.class).authorize(this.authorize).authorize(this.authorize).asMasterKey(query, clone, x -> x.getPlan().getId()); + + if (!fields.hasField(this.asIndexer(PublicPlanReference._plan, PublicPlan._id))) { + itemMap.values().stream().flatMap(List::stream).filter(x -> x != null && x.getPlan() != null).forEach(x -> { + x.getPlan().setId(null); + }); + } + + return itemMap; + } + + private Map> collectPlanUsers(FieldSet fields, List data) throws MyApplicationException { + if (fields.isEmpty() || data.isEmpty()) return null; + this.logger.debug("checking related - {}", PublicPlanUser.class.getSimpleName()); + + Map> itemMap = null; + FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(PublicPlanUser._plan, PublicPlan._id)); + PlanUserQuery query = this.queryFactory.query(PlanUserQuery.class).disableTracking().authorize(this.authorize).planIds(data.stream().map(PlanEntity::getId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(PublicPlanUserBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getPlan().getId()); + + if (!fields.hasField(this.asIndexer(PublicPlanUser._plan, PublicPlan._id))) { + itemMap.values().stream().flatMap(List::stream).filter(x -> x != null && x.getPlan() != null).forEach(x -> { + x.getPlan().setId(null); + }); + } + + return itemMap; + } + + private Map> collectPlanDescriptions(FieldSet fields, List data) throws MyApplicationException { + if (fields.isEmpty() || data.isEmpty()) return null; + this.logger.debug("checking related - {}", PublicDescription.class.getSimpleName()); + + Map> itemMap; + FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(PublicDescription._plan, PublicDescription._id)); + DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(this.authorize).planIds(data.stream().map(PlanEntity::getId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(PublicDescriptionBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getPlan().getId()); + + if (!fields.hasField(this.asIndexer(PublicDescription._plan, PublicDescription._id))) { + itemMap.values().stream().flatMap(List::stream).filter(x -> x != null && x.getPlan() != null).forEach(x -> { + x.getPlan().setId(null); + }); + } + + return itemMap; + } + + private Map> collectEntityDois(FieldSet fields, List data) throws MyApplicationException { + if (fields.isEmpty() || data.isEmpty()) return null; + this.logger.debug("checking related - {}", PublicEntityDoi.class.getSimpleName()); + + Map> itemMap; + FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(PublicEntityDoi._entityId)); + EntityDoiQuery query = this.queryFactory.query(EntityDoiQuery.class).disableTracking().authorize(this.authorize).types(EntityType.DMP).entityIds(data.stream().map(PlanEntity::getId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(PublicEntityDoiBuilder.class).authorize(this.authorize).asMasterKey(query, clone, PublicEntityDoi::getEntityId); + + if (!fields.hasField(this.asIndexer(PublicEntityDoi._entityId))) { + itemMap.values().stream().flatMap(List::stream).filter(x -> x != null && x.getEntityId() != null).forEach(x -> { + x.setEntityId(null); + }); + } + + return itemMap; + } + + private Map> collectOtherPlanVersions(FieldSet fields, List data) throws MyApplicationException { + if (fields.isEmpty() || data.isEmpty()) return null; + this.logger.debug("checking related - {}", PublicPlan.class.getSimpleName()); + + Map> itemMap; + FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PublicPlan._id); + PlanQuery query = this.queryFactory.query(PlanQuery.class).disableTracking().authorize(this.authorize).groupIds(data.stream().map(PlanEntity::getGroupId).distinct().collect(Collectors.toList())).isActive(IsActive.Active); + itemMap = this.builderFactory.builder(PublicPlanBuilder.class).authorize(this.authorize).asMasterKey(query, clone, PublicPlan::getGroupId); + + if (!fields.hasField(PublicPlan._id)) { + itemMap.values().stream().flatMap(List::stream).filter(Objects::nonNull).forEach(x -> { + x.setId(null); + }); + } + + return itemMap; + } + +} diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/PublicDmpDescriptionTemplateBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/PublicPlanDescriptionTemplateBuilder.java similarity index 51% rename from backend/core/src/main/java/org/opencdmp/model/builder/PublicDmpDescriptionTemplateBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/PublicPlanDescriptionTemplateBuilder.java index aa80d5907..52232d18d 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/PublicDmpDescriptionTemplateBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/PublicPlanDescriptionTemplateBuilder.java @@ -9,10 +9,10 @@ import gr.cite.tools.logging.DataLogEntry; import gr.cite.tools.logging.LoggerService; import org.opencdmp.authorization.AuthorizationFlags; import org.opencdmp.convention.ConventionService; -import org.opencdmp.data.DmpDescriptionTemplateEntity; -import org.opencdmp.model.PublicDmp; -import org.opencdmp.model.PublicDmpDescriptionTemplate; -import org.opencdmp.query.DmpQuery; +import org.opencdmp.data.PlanDescriptionTemplateEntity; +import org.opencdmp.model.PublicPlan; +import org.opencdmp.model.PublicPlanDescriptionTemplate; +import org.opencdmp.query.PlanQuery; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.ConfigurableBeanFactory; @@ -24,7 +24,7 @@ import java.util.stream.Collectors; @Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class PublicDmpDescriptionTemplateBuilder extends BaseBuilder { +public class PublicPlanDescriptionTemplateBuilder extends BaseBuilder { private final BuilderFactory builderFactory; @@ -33,62 +33,62 @@ public class PublicDmpDescriptionTemplateBuilder extends BaseBuilder authorize = EnumSet.of(AuthorizationFlags.None); @Autowired - public PublicDmpDescriptionTemplateBuilder( + public PublicPlanDescriptionTemplateBuilder( ConventionService conventionService, BuilderFactory builderFactory, QueryFactory queryFactory) { - super(conventionService, new LoggerService(LoggerFactory.getLogger(PublicDmpDescriptionTemplateBuilder.class))); + super(conventionService, new LoggerService(LoggerFactory.getLogger(PublicPlanDescriptionTemplateBuilder.class))); this.builderFactory = builderFactory; this.queryFactory = queryFactory; } - public PublicDmpDescriptionTemplateBuilder authorize(EnumSet values) { + public PublicPlanDescriptionTemplateBuilder authorize(EnumSet values) { this.authorize = values; return this; } @Override - public List build(FieldSet fields, List data) throws MyApplicationException { + public List build(FieldSet fields, List data) throws MyApplicationException { this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0)); this.logger.trace(new DataLogEntry("requested fields", fields)); if (fields == null || data == null || fields.isEmpty()) return new ArrayList<>(); - FieldSet dmpFields = fields.extractPrefixed(this.asPrefix(PublicDmpDescriptionTemplate._dmp)); - Map dmpItemsMap = this.collectDmps(dmpFields, data); + FieldSet planFields = fields.extractPrefixed(this.asPrefix(PublicPlanDescriptionTemplate._plan)); + Map planItemsMap = this.collectPlans(planFields, data); - List models = new ArrayList<>(); - for (DmpDescriptionTemplateEntity d : data) { - PublicDmpDescriptionTemplate m = new PublicDmpDescriptionTemplate(); - if (fields.hasField(this.asIndexer(PublicDmpDescriptionTemplate._id))) m.setId(d.getId()); - if (!dmpFields.isEmpty() && dmpItemsMap != null && dmpItemsMap.containsKey(d.getDmpId())) m.setDmp(dmpItemsMap.get(d.getDmpId())); + List models = new ArrayList<>(); + for (PlanDescriptionTemplateEntity d : data) { + PublicPlanDescriptionTemplate m = new PublicPlanDescriptionTemplate(); + if (fields.hasField(this.asIndexer(PublicPlanDescriptionTemplate._id))) m.setId(d.getId()); + if (!planFields.isEmpty() && planItemsMap != null && planItemsMap.containsKey(d.getPlanId())) m.setPlan(planItemsMap.get(d.getPlanId())); models.add(m); } this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0)); return models; } - private Map collectDmps(FieldSet fields, List data) throws MyApplicationException { + private Map collectPlans(FieldSet fields, List data) throws MyApplicationException { if (fields.isEmpty() || data.isEmpty()) return null; - this.logger.debug("checking related - {}", PublicDmp.class.getSimpleName()); + this.logger.debug("checking related - {}", PublicPlan.class.getSimpleName()); - Map itemMap; - if (!fields.hasOtherField(this.asIndexer(PublicDmp._id))) { + Map itemMap; + if (!fields.hasOtherField(this.asIndexer(PublicPlan._id))) { itemMap = this.asEmpty( - data.stream().map(DmpDescriptionTemplateEntity::getDmpId).distinct().collect(Collectors.toList()), + data.stream().map(PlanDescriptionTemplateEntity::getPlanId).distinct().collect(Collectors.toList()), x -> { - PublicDmp item = new PublicDmp(); + PublicPlan item = new PublicPlan(); item.setId(x); return item; }, - PublicDmp::getId); + PublicPlan::getId); } else { - FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PublicDmp._id); - DmpQuery q = this.queryFactory.query(DmpQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DmpDescriptionTemplateEntity::getDmpId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(PublicDmpBuilder.class).authorize(this.authorize).asForeignKey(q, clone, PublicDmp::getId); + FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PublicPlan._id); + PlanQuery q = this.queryFactory.query(PlanQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(PlanDescriptionTemplateEntity::getPlanId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(PublicPlanBuilder.class).authorize(this.authorize).asForeignKey(q, clone, PublicPlan::getId); } - if (!fields.hasField(PublicDmp._id)) { + if (!fields.hasField(PublicPlan._id)) { itemMap.values().stream().filter(Objects::nonNull).forEach(x -> x.setId(null)); } diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/PublicDmpReferenceBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/PublicPlanReferenceBuilder.java similarity index 61% rename from backend/core/src/main/java/org/opencdmp/model/builder/PublicDmpReferenceBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/PublicPlanReferenceBuilder.java index 82069be30..16665cb69 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/PublicDmpReferenceBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/PublicPlanReferenceBuilder.java @@ -10,11 +10,11 @@ import gr.cite.tools.logging.LoggerService; import org.opencdmp.authorization.AuthorizationFlags; import org.opencdmp.commons.enums.IsActive; import org.opencdmp.convention.ConventionService; -import org.opencdmp.data.DmpReferenceEntity; -import org.opencdmp.model.PublicDmp; -import org.opencdmp.model.PublicDmpReference; +import org.opencdmp.data.PlanReferenceEntity; +import org.opencdmp.model.PublicPlan; +import org.opencdmp.model.PublicPlanReference; import org.opencdmp.model.PublicReference; -import org.opencdmp.query.DmpQuery; +import org.opencdmp.query.PlanQuery; import org.opencdmp.query.ReferenceQuery; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -27,7 +27,7 @@ import java.util.stream.Collectors; @Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class PublicDmpReferenceBuilder extends BaseBuilder { +public class PublicPlanReferenceBuilder extends BaseBuilder { private final BuilderFactory builderFactory; @@ -36,46 +36,46 @@ public class PublicDmpReferenceBuilder extends BaseBuilder authorize = EnumSet.of(AuthorizationFlags.None); @Autowired - public PublicDmpReferenceBuilder( + public PublicPlanReferenceBuilder( ConventionService conventionService, BuilderFactory builderFactory, QueryFactory queryFactory) { - super(conventionService, new LoggerService(LoggerFactory.getLogger(PublicDmpReferenceBuilder.class))); + super(conventionService, new LoggerService(LoggerFactory.getLogger(PublicPlanReferenceBuilder.class))); this.builderFactory = builderFactory; this.queryFactory = queryFactory; } - public PublicDmpReferenceBuilder authorize(EnumSet values) { + public PublicPlanReferenceBuilder authorize(EnumSet values) { this.authorize = values; return this; } @Override - public List build(FieldSet fields, List data) throws MyApplicationException { + public List build(FieldSet fields, List data) throws MyApplicationException { this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0)); this.logger.trace(new DataLogEntry("requested fields", fields)); if (fields == null || data == null || fields.isEmpty()) return new ArrayList<>(); - FieldSet referenceFields = fields.extractPrefixed(this.asPrefix(PublicDmpReference._reference)); + FieldSet referenceFields = fields.extractPrefixed(this.asPrefix(PublicPlanReference._reference)); Map referenceItemsMap = this.collectReferences(referenceFields, data); - FieldSet dmpFields = fields.extractPrefixed(this.asPrefix(PublicDmpReference._dmp)); - Map dmpItemsMap = this.collectDmps(dmpFields, data); + FieldSet planFields = fields.extractPrefixed(this.asPrefix(PublicPlanReference._plan)); + Map planItemsMap = this.collectPlans(planFields, data); - List models = new ArrayList<>(); - for (DmpReferenceEntity d : data) { - PublicDmpReference m = new PublicDmpReference(); - if (fields.hasField(this.asIndexer(PublicDmpReference._id))) m.setId(d.getId()); - if (fields.hasField(this.asIndexer(PublicDmpReference._isActive))) m.setIsActive(d.getIsActive()); + List models = new ArrayList<>(); + for (PlanReferenceEntity d : data) { + PublicPlanReference m = new PublicPlanReference(); + if (fields.hasField(this.asIndexer(PublicPlanReference._id))) m.setId(d.getId()); + if (fields.hasField(this.asIndexer(PublicPlanReference._isActive))) m.setIsActive(d.getIsActive()); if (!referenceFields.isEmpty() && referenceItemsMap != null && referenceItemsMap.containsKey(d.getReferenceId())) m.setReference(referenceItemsMap.get(d.getReferenceId())); - if (!dmpFields.isEmpty() && dmpItemsMap != null && dmpItemsMap.containsKey(d.getDmpId())) m.setDmp(dmpItemsMap.get(d.getDmpId())); + if (!planFields.isEmpty() && planItemsMap != null && planItemsMap.containsKey(d.getPlanId())) m.setPlan(planItemsMap.get(d.getPlanId())); models.add(m); } this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0)); return models; } - private Map collectReferences(FieldSet fields, List data) throws MyApplicationException { + private Map collectReferences(FieldSet fields, List data) throws MyApplicationException { if (fields.isEmpty() || data.isEmpty()) return null; this.logger.debug("checking related - {}", PublicReference.class.getSimpleName()); @@ -83,7 +83,7 @@ public class PublicDmpReferenceBuilder extends BaseBuilder itemMap; if (!fields.hasOtherField(this.asIndexer(PublicReference._id))) { itemMap = this.asEmpty( - data.stream().map(DmpReferenceEntity::getReferenceId).distinct().collect(Collectors.toList()), + data.stream().map(PlanReferenceEntity::getReferenceId).distinct().collect(Collectors.toList()), x -> { PublicReference item = new PublicReference(); item.setId(x); @@ -92,7 +92,7 @@ public class PublicDmpReferenceBuilder extends BaseBuilder collectDmps(FieldSet fields, List data) throws MyApplicationException { + private Map collectPlans(FieldSet fields, List data) throws MyApplicationException { if (fields.isEmpty() || data.isEmpty()) return null; - this.logger.debug("checking related - {}", PublicDmp.class.getSimpleName()); + this.logger.debug("checking related - {}", PublicPlan.class.getSimpleName()); - Map itemMap; - if (!fields.hasOtherField(this.asIndexer(PublicDmp._id))) { + Map itemMap; + if (!fields.hasOtherField(this.asIndexer(PublicPlan._id))) { itemMap = this.asEmpty( - data.stream().map(DmpReferenceEntity::getDmpId).distinct().collect(Collectors.toList()), + data.stream().map(PlanReferenceEntity::getPlanId).distinct().collect(Collectors.toList()), x -> { - PublicDmp item = new PublicDmp(); + PublicPlan item = new PublicPlan(); item.setId(x); return item; }, - PublicDmp::getId); + PublicPlan::getId); } else { - FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PublicDmp._id); - DmpQuery q = this.queryFactory.query(DmpQuery.class).disableTracking().authorize(this.authorize).isActive(IsActive.Active).ids(data.stream().map(DmpReferenceEntity::getDmpId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(PublicDmpBuilder.class).authorize(this.authorize).asForeignKey(q, clone, PublicDmp::getId); + FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PublicPlan._id); + PlanQuery q = this.queryFactory.query(PlanQuery.class).disableTracking().authorize(this.authorize).isActive(IsActive.Active).ids(data.stream().map(PlanReferenceEntity::getPlanId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(PublicPlanBuilder.class).authorize(this.authorize).asForeignKey(q, clone, PublicPlan::getId); } - if (!fields.hasField(PublicDmp._id)) { + if (!fields.hasField(PublicPlan._id)) { itemMap.values().stream().filter(Objects::nonNull).forEach(x -> x.setId(null)); } diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/PublicDmpUserBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/PublicPlanUserBuilder.java similarity index 62% rename from backend/core/src/main/java/org/opencdmp/model/builder/PublicDmpUserBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/PublicPlanUserBuilder.java index 336d4bc0f..e9f126e9e 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/PublicDmpUserBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/PublicPlanUserBuilder.java @@ -9,12 +9,12 @@ import gr.cite.tools.logging.DataLogEntry; import gr.cite.tools.logging.LoggerService; import org.opencdmp.authorization.AuthorizationFlags; import org.opencdmp.convention.ConventionService; -import org.opencdmp.data.DmpUserEntity; -import org.opencdmp.model.PublicDmp; -import org.opencdmp.model.PublicDmpUser; +import org.opencdmp.data.PlanUserEntity; +import org.opencdmp.model.PublicPlan; +import org.opencdmp.model.PublicPlanUser; import org.opencdmp.model.PublicUser; import org.opencdmp.model.user.User; -import org.opencdmp.query.DmpQuery; +import org.opencdmp.query.PlanQuery; import org.opencdmp.query.UserQuery; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -27,7 +27,7 @@ import java.util.stream.Collectors; @Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class PublicDmpUserBuilder extends BaseBuilder{ +public class PublicPlanUserBuilder extends BaseBuilder{ private final BuilderFactory builderFactory; @@ -36,46 +36,46 @@ public class PublicDmpUserBuilder extends BaseBuilder authorize = EnumSet.of(AuthorizationFlags.None); @Autowired - public PublicDmpUserBuilder( + public PublicPlanUserBuilder( ConventionService conventionService, BuilderFactory builderFactory, QueryFactory queryFactory) { - super(conventionService, new LoggerService(LoggerFactory.getLogger(PublicDmpUserBuilder.class))); + super(conventionService, new LoggerService(LoggerFactory.getLogger(PublicPlanUserBuilder.class))); this.builderFactory = builderFactory; this.queryFactory = queryFactory; } - public PublicDmpUserBuilder authorize(EnumSet values) { + public PublicPlanUserBuilder authorize(EnumSet values) { this.authorize = values; return this; } @Override - public List build(FieldSet fields, List data) throws MyApplicationException { + public List build(FieldSet fields, List data) throws MyApplicationException { this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0)); this.logger.trace(new DataLogEntry("requested fields", fields)); if (fields == null || data == null || fields.isEmpty()) return new ArrayList<>(); - FieldSet userFields = fields.extractPrefixed(this.asPrefix(PublicDmpUser._user)); + FieldSet userFields = fields.extractPrefixed(this.asPrefix(PublicPlanUser._user)); Map userItemsMap = this.collectUsers(userFields, data); - FieldSet dmpFields = fields.extractPrefixed(this.asPrefix(PublicDmpUser._dmp)); - Map dmpItemsMap = this.collectDmps(dmpFields, data); + FieldSet planFields = fields.extractPrefixed(this.asPrefix(PublicPlanUser._plan)); + Map planItemsMap = this.collectPlans(planFields, data); - List models = new ArrayList<>(); - for (DmpUserEntity d : data) { - PublicDmpUser m = new PublicDmpUser(); - if (fields.hasField(this.asIndexer(PublicDmpUser._id))) m.setId(d.getId()); - if (fields.hasField(this.asIndexer(PublicDmpUser._role))) m.setRole(d.getRole()); + List models = new ArrayList<>(); + for (PlanUserEntity d : data) { + PublicPlanUser m = new PublicPlanUser(); + if (fields.hasField(this.asIndexer(PublicPlanUser._id))) m.setId(d.getId()); + if (fields.hasField(this.asIndexer(PublicPlanUser._role))) m.setRole(d.getRole()); if (!userFields.isEmpty() && userItemsMap != null && userItemsMap.containsKey(d.getUserId())) m.setUser(userItemsMap.get(d.getUserId())); - if (!dmpFields.isEmpty() && dmpItemsMap != null && dmpItemsMap.containsKey(d.getDmpId())) m.setDmp(dmpItemsMap.get(d.getDmpId())); + if (!planFields.isEmpty() && planItemsMap != null && planItemsMap.containsKey(d.getPlanId())) m.setPlan(planItemsMap.get(d.getPlanId())); models.add(m); } this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0)); return models; } - private Map collectUsers(FieldSet fields, List data) throws MyApplicationException { + private Map collectUsers(FieldSet fields, List data) throws MyApplicationException { if (fields.isEmpty() || data.isEmpty()) return null; this.logger.debug("checking related - {}", User.class.getSimpleName()); @@ -83,7 +83,7 @@ public class PublicDmpUserBuilder extends BaseBuilder itemMap; if (!fields.hasOtherField(this.asIndexer(PublicUser._id))) { itemMap = this.asEmpty( - data.stream().map(DmpUserEntity::getUserId).distinct().collect(Collectors.toList()), + data.stream().map(PlanUserEntity::getUserId).distinct().collect(Collectors.toList()), x -> { PublicUser item = new PublicUser(); item.setId(x); @@ -92,7 +92,7 @@ public class PublicDmpUserBuilder extends BaseBuilder collectDmps(FieldSet fields, List data) throws MyApplicationException { + private Map collectPlans(FieldSet fields, List data) throws MyApplicationException { if (fields.isEmpty() || data.isEmpty()) return null; - this.logger.debug("checking related - {}", PublicDmp.class.getSimpleName()); + this.logger.debug("checking related - {}", PublicPlan.class.getSimpleName()); - Map itemMap; - if (!fields.hasOtherField(this.asIndexer(PublicDmp._id))) { + Map itemMap; + if (!fields.hasOtherField(this.asIndexer(PublicPlan._id))) { itemMap = this.asEmpty( - data.stream().map(DmpUserEntity::getDmpId).distinct().collect(Collectors.toList()), + data.stream().map(PlanUserEntity::getPlanId).distinct().collect(Collectors.toList()), x -> { - PublicDmp item = new PublicDmp(); + PublicPlan item = new PublicPlan(); item.setId(x); return item; }, - PublicDmp::getId); + PublicPlan::getId); } else { - FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PublicDmp._id); - DmpQuery q = this.queryFactory.query(DmpQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DmpUserEntity::getDmpId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(PublicDmpBuilder.class).authorize(this.authorize).asForeignKey(q, clone, PublicDmp::getId); + FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PublicPlan._id); + PlanQuery q = this.queryFactory.query(PlanQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(PlanUserEntity::getPlanId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(PublicPlanBuilder.class).authorize(this.authorize).asForeignKey(q, clone, PublicPlan::getId); } - if (!fields.hasField(PublicDmp._id)) { + if (!fields.hasField(PublicPlan._id)) { itemMap.values().stream().filter(Objects::nonNull).forEach(x -> x.setId(null)); } diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/RecentActivityItemBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/RecentActivityItemBuilder.java index b63f009f5..a2d322b18 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/RecentActivityItemBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/RecentActivityItemBuilder.java @@ -13,11 +13,11 @@ import org.opencdmp.commons.types.dashborad.RecentActivityItemEntity; import org.opencdmp.convention.ConventionService; import org.opencdmp.model.RecentActivityItem; import org.opencdmp.model.builder.description.DescriptionBuilder; -import org.opencdmp.model.builder.dmp.DmpBuilder; +import org.opencdmp.model.builder.plan.PlanBuilder; import org.opencdmp.model.description.Description; -import org.opencdmp.model.dmp.Dmp; +import org.opencdmp.model.plan.Plan; import org.opencdmp.query.DescriptionQuery; -import org.opencdmp.query.DmpQuery; +import org.opencdmp.query.PlanQuery; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.ConfigurableBeanFactory; @@ -61,15 +61,15 @@ public class RecentActivityItemBuilder extends BaseBuilder descriptionItemsMap = this.collectDescriptions(descriptionFields, data); - FieldSet dmpFields = fields.extractPrefixed(this.asPrefix(RecentActivityItem._dmp)); - Map dmpItemsMap = this.collectDmps(dmpFields, data); + FieldSet planFields = fields.extractPrefixed(this.asPrefix(RecentActivityItem._plan)); + Map planItemsMap = this.collectPlans(planFields, data); List models = new ArrayList<>(); for (RecentActivityItemEntity d : data) { RecentActivityItem m = new RecentActivityItem(); if (fields.hasField(this.asIndexer(RecentActivityItem._type))) m.setType(d.getType()); if (!descriptionFields.isEmpty() && descriptionItemsMap != null && descriptionItemsMap.containsKey(d.getId())) m.setDescription(descriptionItemsMap.get(d.getId())); - if (!dmpFields.isEmpty() && dmpItemsMap != null && dmpItemsMap.containsKey(d.getId())) m.setDmp(dmpItemsMap.get(d.getId())); + if (!planFields.isEmpty() && planItemsMap != null && planItemsMap.containsKey(d.getId())) m.setPlan(planItemsMap.get(d.getId())); models.add(m); } this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0)); @@ -77,27 +77,27 @@ public class RecentActivityItemBuilder extends BaseBuilder collectDmps(FieldSet fields, List data) throws MyApplicationException { + private Map collectPlans(FieldSet fields, List data) throws MyApplicationException { if (fields.isEmpty() || data.isEmpty()) return null; - this.logger.debug("checking related - {}", Dmp.class.getSimpleName()); + this.logger.debug("checking related - {}", Plan.class.getSimpleName()); - Map itemMap; - if (!fields.hasOtherField(this.asIndexer(Dmp._id))) { + Map itemMap; + if (!fields.hasOtherField(this.asIndexer(Plan._id))) { itemMap = this.asEmpty( - data.stream().filter(x-> x.getType().equals(RecentActivityItemType.Dmp)).map(RecentActivityItemEntity::getId).distinct().collect(Collectors.toList()), + data.stream().filter(x-> x.getType().equals(RecentActivityItemType.Plan)).map(RecentActivityItemEntity::getId).distinct().collect(Collectors.toList()), x -> { - Dmp item = new Dmp(); + Plan item = new Plan(); item.setId(x); return item; }, - Dmp::getId); + Plan::getId); } else { - FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Dmp._id); - DmpQuery q = this.queryFactory.query(DmpQuery.class).authorize(this.authorize).disableTracking().ids(data.stream().filter(x-> x.getType().equals(RecentActivityItemType.Dmp)).map(RecentActivityItemEntity::getId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(DmpBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Dmp::getId); + FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Plan._id); + PlanQuery q = this.queryFactory.query(PlanQuery.class).authorize(this.authorize).disableTracking().ids(data.stream().filter(x-> x.getType().equals(RecentActivityItemType.Plan)).map(RecentActivityItemEntity::getId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(PlanBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Plan::getId); } - if (!fields.hasField(Dmp._id)) { + if (!fields.hasField(Plan._id)) { itemMap.values().stream().filter(Objects::nonNull).forEach(x -> x.setId(null)); } diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/SupportiveMaterialBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/SupportiveMaterialBuilder.java index 75a14d252..c40eececb 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/SupportiveMaterialBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/SupportiveMaterialBuilder.java @@ -3,15 +3,9 @@ package org.opencdmp.model.builder; import org.opencdmp.authorization.AuthorizationFlags; import org.opencdmp.commons.scope.tenant.TenantScope; import org.opencdmp.convention.ConventionService; -import org.opencdmp.data.DmpReferenceEntity; import org.opencdmp.data.SupportiveMaterialEntity; import org.opencdmp.model.*; -import org.opencdmp.query.DmpQuery; -import org.opencdmp.query.ReferenceQuery; -import gr.cite.tools.data.builder.BuilderFactory; -import gr.cite.tools.data.query.QueryFactory; import gr.cite.tools.exception.MyApplicationException; -import gr.cite.tools.fieldset.BaseFieldSet; import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.logging.DataLogEntry; import gr.cite.tools.logging.LoggerService; @@ -22,7 +16,6 @@ import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; import java.util.*; -import java.util.stream.Collectors; @Component @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/actionconfirmation/ActionConfirmationBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/actionconfirmation/ActionConfirmationBuilder.java index 5f22f13f0..548c76d5a 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/actionconfirmation/ActionConfirmationBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/actionconfirmation/ActionConfirmationBuilder.java @@ -10,7 +10,7 @@ import gr.cite.tools.logging.LoggerService; import org.opencdmp.authorization.AuthorizationFlags; import org.opencdmp.commons.XmlHandlingService; import org.opencdmp.commons.scope.tenant.TenantScope; -import org.opencdmp.commons.types.actionconfirmation.DmpInvitationEntity; +import org.opencdmp.commons.types.actionconfirmation.PlanInvitationEntity; import org.opencdmp.commons.types.actionconfirmation.MergeAccountConfirmationEntity; import org.opencdmp.commons.types.actionconfirmation.RemoveCredentialRequestEntity; import org.opencdmp.commons.types.actionconfirmation.UserInviteToTenantRequestEntity; @@ -83,9 +83,9 @@ public class ActionConfirmationBuilder extends BaseBuilder { - DmpInvitationEntity dmpInvitation = this.xmlHandlingService.fromXmlSafe(DmpInvitationEntity.class, d.getData()); - m.setDmpInvitation(this.builderFactory.builder(DmpInvitationBuilder.class).authorize(this.authorize).build(dmpInvitationFields, dmpInvitation)); + case PlanInvitation -> { + PlanInvitationEntity dmpInvitation = this.xmlHandlingService.fromXmlSafe(PlanInvitationEntity.class, d.getData()); + m.setDmpInvitation(this.builderFactory.builder(PlanInvitationBuilder.class).authorize(this.authorize).build(dmpInvitationFields, dmpInvitation)); } case RemoveCredential -> { RemoveCredentialRequestEntity emailConfirmation = this.xmlHandlingService.fromXmlSafe(RemoveCredentialRequestEntity.class, d.getData()); diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/actionconfirmation/DmpInvitationBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/actionconfirmation/PlanInvitationBuilder.java similarity index 61% rename from backend/core/src/main/java/org/opencdmp/model/builder/actionconfirmation/DmpInvitationBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/actionconfirmation/PlanInvitationBuilder.java index a0889e653..a8fa1163c 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/actionconfirmation/DmpInvitationBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/actionconfirmation/PlanInvitationBuilder.java @@ -1,11 +1,10 @@ package org.opencdmp.model.builder.actionconfirmation; import org.opencdmp.authorization.AuthorizationFlags; -import org.opencdmp.commons.types.actionconfirmation.DmpInvitationEntity; +import org.opencdmp.commons.types.actionconfirmation.PlanInvitationEntity; import org.opencdmp.convention.ConventionService; -import org.opencdmp.model.actionconfirmation.DmpInvitation; +import org.opencdmp.model.actionconfirmation.PlanInvitation; import org.opencdmp.model.builder.BaseBuilder; -import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.exception.MyApplicationException; import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.logging.DataLogEntry; @@ -20,35 +19,35 @@ import java.util.*; @Component @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpInvitationBuilder extends BaseBuilder { +public class PlanInvitationBuilder extends BaseBuilder { private EnumSet authorize = EnumSet.of(AuthorizationFlags.None); @Autowired - public DmpInvitationBuilder( + public PlanInvitationBuilder( ConventionService conventionService) { - super(conventionService, new LoggerService(LoggerFactory.getLogger(DmpInvitationBuilder.class))); + super(conventionService, new LoggerService(LoggerFactory.getLogger(PlanInvitationBuilder.class))); } - public DmpInvitationBuilder authorize(EnumSet values) { + public PlanInvitationBuilder authorize(EnumSet values) { this.authorize = values; return this; } @Override - public List build(FieldSet fields, List data) throws MyApplicationException { + public List build(FieldSet fields, List data) throws MyApplicationException { this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0)); this.logger.trace(new DataLogEntry("requested fields", fields)); if (fields == null || data == null || fields.isEmpty()) return new ArrayList<>(); - List models = new ArrayList<>(); - for (DmpInvitationEntity d : data) { - DmpInvitation m = new DmpInvitation(); - if (fields.hasField(this.asIndexer(DmpInvitation._email))) m.setEmail(d.getEmail()); - if (fields.hasField(this.asIndexer(DmpInvitation._dmpId))) m.setDmpId(d.getDmpId()); - if (fields.hasField(this.asIndexer(DmpInvitation._role))) m.setRole(d.getRole()); + List models = new ArrayList<>(); + for (PlanInvitationEntity d : data) { + PlanInvitation m = new PlanInvitation(); + if (fields.hasField(this.asIndexer(PlanInvitation._email))) m.setEmail(d.getEmail()); + if (fields.hasField(this.asIndexer(PlanInvitation._planId))) m.setPlanId(d.getPlanId()); + if (fields.hasField(this.asIndexer(PlanInvitation._role))) m.setRole(d.getRole()); models.add(m); } diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/DmpUserCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/PlanUserCommonModelBuilder.java similarity index 80% rename from backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/DmpUserCommonModelBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/PlanUserCommonModelBuilder.java index e63413c8b..b14524959 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/DmpUserCommonModelBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/PlanUserCommonModelBuilder.java @@ -10,7 +10,7 @@ import org.opencdmp.commonmodels.models.DmpUserModel; import org.opencdmp.commonmodels.models.UserModel; import org.opencdmp.commons.enums.IsActive; import org.opencdmp.convention.ConventionService; -import org.opencdmp.data.DmpUserEntity; +import org.opencdmp.data.PlanUserEntity; import org.opencdmp.data.UserEntity; import org.opencdmp.query.UserQuery; import org.slf4j.LoggerFactory; @@ -24,7 +24,7 @@ import java.util.stream.Collectors; @Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpUserCommonModelBuilder extends BaseCommonModelBuilder { +public class PlanUserCommonModelBuilder extends BaseCommonModelBuilder { private final BuilderFactory builderFactory; @@ -33,21 +33,21 @@ public class DmpUserCommonModelBuilder extends BaseCommonModelBuilder authorize = EnumSet.of(AuthorizationFlags.None); @Autowired - public DmpUserCommonModelBuilder( + public PlanUserCommonModelBuilder( ConventionService conventionService, BuilderFactory builderFactory, QueryFactory queryFactory) { - super(conventionService, new LoggerService(LoggerFactory.getLogger(DmpUserCommonModelBuilder.class))); + super(conventionService, new LoggerService(LoggerFactory.getLogger(PlanUserCommonModelBuilder.class))); this.builderFactory = builderFactory; this.queryFactory = queryFactory; } - public DmpUserCommonModelBuilder authorize(EnumSet values) { + public PlanUserCommonModelBuilder authorize(EnumSet values) { this.authorize = values; return this; } @Override - protected List> buildInternal(List data) throws MyApplicationException { + protected List> buildInternal(List data) throws MyApplicationException { this.logger.debug("building for {} items ", Optional.ofNullable(data).map(List::size).orElse(0)); if (data == null) return new ArrayList<>(); @@ -55,8 +55,8 @@ public class DmpUserCommonModelBuilder extends BaseCommonModelBuilder userItemsMap = this.collectUsers(data); - List> models = new ArrayList<>(); - for (DmpUserEntity d : data) { + List> models = new ArrayList<>(); + for (PlanUserEntity d : data) { DmpUserModel m = new DmpUserModel(); switch (d.getRole()){ case Viewer -> m.setRole(DmpUserRole.Viewer); @@ -72,13 +72,13 @@ public class DmpUserCommonModelBuilder extends BaseCommonModelBuilder collectUsers(List data) throws MyApplicationException { + private Map collectUsers(List data) throws MyApplicationException { if (data.isEmpty()) return null; this.logger.debug("checking related - {}", UserModel.class.getSimpleName()); Map itemMap; - UserQuery q = this.queryFactory.query(UserQuery.class).disableTracking().isActive(IsActive.Active).authorize(this.authorize).ids(data.stream().map(DmpUserEntity::getUserId).distinct().collect(Collectors.toList())); + UserQuery q = this.queryFactory.query(UserQuery.class).disableTracking().isActive(IsActive.Active).authorize(this.authorize).ids(data.stream().map(PlanUserEntity::getUserId).distinct().collect(Collectors.toList())); itemMap = this.builderFactory.builder(UserCommonModelBuilder.class).authorize(this.authorize).asForeignKey(q, UserEntity::getId); return itemMap; } diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/description/DescriptionCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/description/DescriptionCommonModelBuilder.java index 943388218..6afc75412 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/description/DescriptionCommonModelBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/description/DescriptionCommonModelBuilder.java @@ -17,17 +17,17 @@ import org.opencdmp.commons.types.descriptiontemplate.DefinitionEntity; import org.opencdmp.convention.ConventionService; import org.opencdmp.data.DescriptionEntity; import org.opencdmp.data.DescriptionTemplateEntity; -import org.opencdmp.data.DmpDescriptionTemplateEntity; -import org.opencdmp.data.DmpEntity; -import org.opencdmp.model.DmpDescriptionTemplate; +import org.opencdmp.data.PlanDescriptionTemplateEntity; +import org.opencdmp.data.PlanEntity; +import org.opencdmp.model.PlanDescriptionTemplate; import org.opencdmp.model.builder.commonmodels.BaseCommonModelBuilder; import org.opencdmp.model.builder.commonmodels.CommonModelBuilderItemResponse; import org.opencdmp.model.builder.commonmodels.descriptiontemplate.DescriptionTemplateCommonModelBuilder; -import org.opencdmp.model.builder.commonmodels.dmp.DmpCommonModelBuilder; +import org.opencdmp.model.builder.commonmodels.plan.PlanCommonModelBuilder; import org.opencdmp.model.descriptiontemplate.DescriptionTemplate; import org.opencdmp.query.DescriptionTemplateQuery; -import org.opencdmp.query.DmpDescriptionTemplateQuery; -import org.opencdmp.query.DmpQuery; +import org.opencdmp.query.PlanDescriptionTemplateQuery; +import org.opencdmp.query.PlanQuery; import org.opencdmp.service.visibility.VisibilityService; import org.opencdmp.service.visibility.VisibilityServiceImpl; import org.slf4j.LoggerFactory; @@ -87,10 +87,10 @@ public class DescriptionCommonModelBuilder extends BaseCommonModelBuilder(); Map descriptionTemplates = this.collectDescriptionTemplates(data); - Map dmps = this.collectDmps(data); + Map plans = this.collectPlans(data); Map definitionEntityMap = this.collectDescriptionTemplateDefinitions(data); - Map dmpDescriptionTemplateSections = this.collectDmpDescriptionTemplateSections(data); + Map planDescriptionTemplateSections = this.collectPlanDescriptionTemplateSections(data); List> models = new ArrayList<>(); for (DescriptionEntity d : data) { @@ -106,8 +106,8 @@ public class DescriptionCommonModelBuilder extends BaseCommonModelBuilder collectDmpDescriptionTemplateSections(List data) throws MyApplicationException { + private Map collectPlanDescriptionTemplateSections(List data) throws MyApplicationException { if (data.isEmpty()) return null; this.logger.debug("checking related - {}", DefinitionEntity.class.getSimpleName()); Map itemMap = new HashMap<>(); - DmpDescriptionTemplateQuery q = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DescriptionEntity::getDmpDescriptionTemplateId).distinct().collect(Collectors.toList())); - List items = q.collectAs(new BaseFieldSet().ensure(org.opencdmp.model.DmpDescriptionTemplate._id).ensure(DmpDescriptionTemplate._sectionId)); - for (DmpDescriptionTemplateEntity item : items){ + PlanDescriptionTemplateQuery q = this.queryFactory.query(PlanDescriptionTemplateQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DescriptionEntity::getPlanDescriptionTemplateId).distinct().collect(Collectors.toList())); + List items = q.collectAs(new BaseFieldSet().ensure(PlanDescriptionTemplate._id).ensure(PlanDescriptionTemplate._sectionId)); + for (PlanDescriptionTemplateEntity item : items){ itemMap.put(item.getId(), item.getSectionId()); } return itemMap; } - private Map collectDmps(List data) throws MyApplicationException { + private Map collectPlans(List data) throws MyApplicationException { if (data.isEmpty()) return null; this.logger.debug("checking related - {}", DmpModel.class.getSimpleName()); Map itemMap; - DmpQuery q = this.queryFactory.query(DmpQuery.class).authorize(this.authorize).disableTracking().ids(data.stream().map(DescriptionEntity::getDmpId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(DmpCommonModelBuilder.class).setRepositoryId(this.repositoryId).useSharedStorage(this.useSharedStorage).setDisableDescriptions(true).authorize(this.authorize).asForeignKey(q, DmpEntity::getId); + PlanQuery q = this.queryFactory.query(PlanQuery.class).authorize(this.authorize).disableTracking().ids(data.stream().map(DescriptionEntity::getPlanId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(PlanCommonModelBuilder.class).setRepositoryId(this.repositoryId).useSharedStorage(this.useSharedStorage).setDisableDescriptions(true).authorize(this.authorize).asForeignKey(q, PlanEntity::getId); return itemMap; } diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmp/DmpBlueprintValueCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanBlueprintValueCommonModelBuilder.java similarity index 63% rename from backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmp/DmpBlueprintValueCommonModelBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanBlueprintValueCommonModelBuilder.java index e21ccae22..827519b3a 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmp/DmpBlueprintValueCommonModelBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanBlueprintValueCommonModelBuilder.java @@ -1,13 +1,13 @@ -package org.opencdmp.model.builder.commonmodels.dmp; +package org.opencdmp.model.builder.commonmodels.plan; import org.opencdmp.authorization.AuthorizationFlags; import org.opencdmp.commonmodels.models.dmp.DmpBlueprintValueModel; -import org.opencdmp.commons.enums.DmpBlueprintExtraFieldDataType; -import org.opencdmp.commons.enums.DmpBlueprintFieldCategory; -import org.opencdmp.commons.types.dmp.DmpBlueprintValueEntity; -import org.opencdmp.commons.types.dmpblueprint.DefinitionEntity; -import org.opencdmp.commons.types.dmpblueprint.ExtraFieldEntity; -import org.opencdmp.commons.types.dmpblueprint.FieldEntity; +import org.opencdmp.commons.enums.PlanBlueprintExtraFieldDataType; +import org.opencdmp.commons.enums.PlanBlueprintFieldCategory; +import org.opencdmp.commons.types.plan.PlanBlueprintValueEntity; +import org.opencdmp.commons.types.planblueprint.DefinitionEntity; +import org.opencdmp.commons.types.planblueprint.ExtraFieldEntity; +import org.opencdmp.commons.types.planblueprint.FieldEntity; import org.opencdmp.convention.ConventionService; import org.opencdmp.model.builder.commonmodels.BaseCommonModelBuilder; import org.opencdmp.model.builder.commonmodels.CommonModelBuilderItemResponse; @@ -26,43 +26,43 @@ import java.util.Optional; @Component @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpBlueprintValueCommonModelBuilder extends BaseCommonModelBuilder { +public class PlanBlueprintValueCommonModelBuilder extends BaseCommonModelBuilder { private EnumSet authorize = EnumSet.of(AuthorizationFlags.None); private DefinitionEntity definition; @Autowired - public DmpBlueprintValueCommonModelBuilder( + public PlanBlueprintValueCommonModelBuilder( ConventionService conventionService ) { - super(conventionService, new LoggerService(LoggerFactory.getLogger(DmpBlueprintValueCommonModelBuilder.class))); + super(conventionService, new LoggerService(LoggerFactory.getLogger(PlanBlueprintValueCommonModelBuilder.class))); } - public DmpBlueprintValueCommonModelBuilder authorize(EnumSet values) { + public PlanBlueprintValueCommonModelBuilder authorize(EnumSet values) { this.authorize = values; return this; } - public DmpBlueprintValueCommonModelBuilder withDefinition(DefinitionEntity definition) { + public PlanBlueprintValueCommonModelBuilder withDefinition(DefinitionEntity definition) { this.definition = definition; return this; } @Override - protected List> buildInternal(List data) throws MyApplicationException { + protected List> buildInternal(List data) throws MyApplicationException { this.logger.debug("building for {}", Optional.ofNullable(data).map(List::size).orElse(0)); if (data == null || data.isEmpty()) return new ArrayList<>(); - List> models = new ArrayList<>(); - for (DmpBlueprintValueEntity d : data) { + List> models = new ArrayList<>(); + for (PlanBlueprintValueEntity d : data) { FieldEntity fieldEntity = this.definition != null ? this.definition.getFieldById(d.getFieldId()).stream().findFirst().orElse(null) : null; - if (fieldEntity != null && fieldEntity.getCategory().equals(DmpBlueprintFieldCategory.Extra)) { + if (fieldEntity != null && fieldEntity.getCategory().equals(PlanBlueprintFieldCategory.Extra)) { ExtraFieldEntity extraFieldEntity = (ExtraFieldEntity) fieldEntity; DmpBlueprintValueModel m = new DmpBlueprintValueModel(); m.setFieldId(d.getFieldId()); - if (extraFieldEntity != null && DmpBlueprintExtraFieldDataType.isDateType(extraFieldEntity.getType())){ + if (extraFieldEntity != null && PlanBlueprintExtraFieldDataType.isDateType(extraFieldEntity.getType())){ m.setDateValue(d.getDateValue()); - } else if (extraFieldEntity != null && DmpBlueprintExtraFieldDataType.isNumberType(extraFieldEntity.getType())){ + } else if (extraFieldEntity != null && PlanBlueprintExtraFieldDataType.isNumberType(extraFieldEntity.getType())){ m.setNumberValue(d.getNumberValue()); } else { m.setValue(d.getValue()); diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmp/DmpCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanCommonModelBuilder.java similarity index 58% rename from backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmp/DmpCommonModelBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanCommonModelBuilder.java index dcc08b3b8..0ef4a14d9 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmp/DmpCommonModelBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanCommonModelBuilder.java @@ -1,4 +1,4 @@ -package org.opencdmp.model.builder.commonmodels.dmp; +package org.opencdmp.model.builder.commonmodels.plan; import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.query.Ordering; @@ -20,20 +20,20 @@ import org.opencdmp.commonmodels.models.dmpreference.DmpReferenceModel; import org.opencdmp.commons.JsonHandlingService; import org.opencdmp.commons.XmlHandlingService; import org.opencdmp.commons.enums.IsActive; -import org.opencdmp.commons.types.dmp.DmpPropertiesEntity; -import org.opencdmp.commons.types.dmpblueprint.DefinitionEntity; +import org.opencdmp.commons.types.plan.PlanPropertiesEntity; +import org.opencdmp.commons.types.planblueprint.DefinitionEntity; import org.opencdmp.convention.ConventionService; import org.opencdmp.data.*; -import org.opencdmp.model.DmpUser; +import org.opencdmp.model.PlanUser; import org.opencdmp.model.EntityDoi; import org.opencdmp.model.builder.commonmodels.*; import org.opencdmp.model.builder.commonmodels.description.DescriptionCommonModelBuilder; -import org.opencdmp.model.builder.commonmodels.dmpblueprint.DmpBlueprintCommonModelBuilder; -import org.opencdmp.model.builder.commonmodels.dmpreference.DmpReferenceCommonModelBuilder; +import org.opencdmp.model.builder.commonmodels.planblueprint.PlanBlueprintCommonModelBuilder; +import org.opencdmp.model.builder.commonmodels.planreference.PlanReferenceCommonModelBuilder; import org.opencdmp.model.description.Description; -import org.opencdmp.model.dmp.Dmp; -import org.opencdmp.model.dmpblueprint.DmpBlueprint; -import org.opencdmp.model.dmpreference.DmpReference; +import org.opencdmp.model.plan.Plan; +import org.opencdmp.model.planblueprint.PlanBlueprint; +import org.opencdmp.model.planreference.PlanReference; import org.opencdmp.query.*; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -46,7 +46,7 @@ import java.util.stream.Collectors; @Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpCommonModelBuilder extends BaseCommonModelBuilder { +public class PlanCommonModelBuilder extends BaseCommonModelBuilder { private final QueryFactory queryFactory; @@ -60,64 +60,64 @@ public class DmpCommonModelBuilder extends BaseCommonModelBuilder authorize = EnumSet.of(AuthorizationFlags.None); @Autowired - public DmpCommonModelBuilder(ConventionService conventionService, - QueryFactory queryFactory, - BuilderFactory builderFactory, JsonHandlingService jsonHandlingService, XmlHandlingService xmlHandlingService) { - super(conventionService, new LoggerService(LoggerFactory.getLogger(DmpCommonModelBuilder.class))); + public PlanCommonModelBuilder(ConventionService conventionService, + QueryFactory queryFactory, + BuilderFactory builderFactory, JsonHandlingService jsonHandlingService, XmlHandlingService xmlHandlingService) { + super(conventionService, new LoggerService(LoggerFactory.getLogger(PlanCommonModelBuilder.class))); this.queryFactory = queryFactory; this.builderFactory = builderFactory; this.jsonHandlingService = jsonHandlingService; this.xmlHandlingService = xmlHandlingService; } - public DmpCommonModelBuilder authorize(EnumSet values) { + public PlanCommonModelBuilder authorize(EnumSet values) { this.authorize = values; return this; } - public DmpCommonModelBuilder setPdfFile(FileEnvelopeModel pdfFile) { + public PlanCommonModelBuilder setPdfFile(FileEnvelopeModel pdfFile) { this.pdfFile = pdfFile; return this; } - public DmpCommonModelBuilder setRdaJsonFile(FileEnvelopeModel rdaJsonFile) { + public PlanCommonModelBuilder setRdaJsonFile(FileEnvelopeModel rdaJsonFile) { this.rdaJsonFile = rdaJsonFile; return this; } - public DmpCommonModelBuilder setRepositoryId(String repositoryId) { + public PlanCommonModelBuilder setRepositoryId(String repositoryId) { this.repositoryId = repositoryId; return this; } - public DmpCommonModelBuilder setDisableDescriptions(boolean disableDescriptions) { + public PlanCommonModelBuilder setDisableDescriptions(boolean disableDescriptions) { this.disableDescriptions = disableDescriptions; return this; } private boolean useSharedStorage; - public DmpCommonModelBuilder useSharedStorage(boolean useSharedStorage) { + public PlanCommonModelBuilder useSharedStorage(boolean useSharedStorage) { this.useSharedStorage = useSharedStorage; return this; } @Override - protected List> buildInternal(List data) throws MyApplicationException { + protected List> buildInternal(List data) throws MyApplicationException { this.logger.debug("building for {}", Optional.ofNullable(data).map(List::size).orElse(0)); if (data == null || data.isEmpty()) return new ArrayList<>(); - List> models = new ArrayList<>(); + List> models = new ArrayList<>(); - Map> dmpReferencesMap = this.collectDmpReferences(data); - Map> dmpUsersMap = this.collectDmpUsers(data); - Map> descriptionsMap = this.disableDescriptions ? null : this.collectDmpDescriptions(data); - Map> entityDois = this.collectDmpEntityDois(data); + Map> planReferencesMap = this.collectPlanReferences(data); + Map> planUsersMap = this.collectPlanUsers(data); + Map> descriptionsMap = this.disableDescriptions ? null : this.collectPlanDescriptions(data); + Map> entityDois = this.collectPlanEntityDois(data); Map creators = this.collectCreators(data); - Map dmpBlueprints = this.collectDmpBlueprints(data); - Map definitionEntityMap = this.collectDmpBlueprintDefinitions(data); + Map dmpBlueprints = this.collectPlanBlueprints(data); + Map definitionEntityMap = this.collectPlanBlueprintDefinitions(data); - for (DmpEntity d : data) { + for (PlanEntity d : data) { DmpModel m = new DmpModel(); m.setId(d.getId()); m.setLabel(d.getLabel()); @@ -136,8 +136,8 @@ public class DmpCommonModelBuilder extends BaseCommonModelBuilder throw new MyApplicationException("unrecognized type " + d.getAccessType()); } - if (dmpReferencesMap != null && !dmpReferencesMap.isEmpty() && dmpReferencesMap.containsKey(d.getId())) m.setReferences(dmpReferencesMap.get(d.getId())); - if (dmpUsersMap != null && !dmpUsersMap.isEmpty() && dmpUsersMap.containsKey(d.getId())) m.setUsers(dmpUsersMap.get(d.getId())); + if (planReferencesMap != null && !planReferencesMap.isEmpty() && planReferencesMap.containsKey(d.getId())) m.setReferences(planReferencesMap.get(d.getId())); + if (planUsersMap != null && !planUsersMap.isEmpty() && planUsersMap.containsKey(d.getId())) m.setUsers(planUsersMap.get(d.getId())); if (descriptionsMap != null && !descriptionsMap.isEmpty() && descriptionsMap.containsKey(d.getId())) m.setDescriptions(descriptionsMap.get(d.getId())); models.add(new CommonModelBuilderItemResponse<>(m, d)); @@ -162,96 +162,96 @@ public class DmpCommonModelBuilder extends BaseCommonModelBuilder dmpIds = dmpQuery.groupIds(dmpGroup).excludedIds(currentDmpId).isActive(IsActive.Active).collectAs(new BaseFieldSet().ensure(Dmp._id)).stream().map(DmpEntity::getId).toList(); + PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking(); + planQuery.setOrder(new Ordering().addDescending(Plan._version)); + List planIds = planQuery.groupIds(dmpGroup).excludedIds(currentPlanId).isActive(IsActive.Active).collectAs(new BaseFieldSet().ensure(Plan._id)).stream().map(PlanEntity::getId).toList(); //GK: Step two get it's doiEntity - List dois = this.queryFactory.query(EntityDoiQuery.class).disableTracking().repositoryIds(this.repositoryId).entityIds(dmpIds).isActive(IsActive.Active).collectAs(new BaseFieldSet().ensure(EntityDoi._entityId, EntityDoi._doi)); - for(UUID uuid: dmpIds) { + List dois = this.queryFactory.query(EntityDoiQuery.class).disableTracking().repositoryIds(this.repositoryId).entityIds(planIds).isActive(IsActive.Active).collectAs(new BaseFieldSet().ensure(EntityDoi._entityId, EntityDoi._doi)); + for(UUID uuid: planIds) { EntityDoiEntity doiEntity = dois.stream().filter(x -> x.getEntityId().equals(uuid)).findFirst().orElse(null); if (doiEntity != null) return doiEntity.getDoi(); } return null; } - private Map> collectDmpUsers(List data) throws MyApplicationException { - this.logger.debug("checking related - {}", DmpUser.class.getSimpleName()); + private Map> collectPlanUsers(List data) throws MyApplicationException { + this.logger.debug("checking related - {}", PlanUser.class.getSimpleName()); Map> itemMap; - DmpUserQuery query = this.queryFactory.query(DmpUserQuery.class).disableTracking().isActives(IsActive.Active).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(DmpUserCommonModelBuilder.class).authorize(this.authorize).asMasterKey(query, DmpUserEntity::getDmpId); + PlanUserQuery query = this.queryFactory.query(PlanUserQuery.class).disableTracking().isActives(IsActive.Active).authorize(this.authorize).planIds(data.stream().map(PlanEntity::getId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(PlanUserCommonModelBuilder.class).authorize(this.authorize).asMasterKey(query, PlanUserEntity::getPlanId); return itemMap; } - private Map> collectDmpReferences(List data) throws MyApplicationException { - this.logger.debug("checking related - {}", DmpReference.class.getSimpleName()); + private Map> collectPlanReferences(List data) throws MyApplicationException { + this.logger.debug("checking related - {}", PlanReference.class.getSimpleName()); Map> itemMap; - DmpReferenceQuery query = this.queryFactory.query(DmpReferenceQuery.class).disableTracking().isActives(IsActive.Active).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(DmpReferenceCommonModelBuilder.class).authorize(this.authorize).asMasterKey(query, DmpReferenceEntity::getDmpId); + PlanReferenceQuery query = this.queryFactory.query(PlanReferenceQuery.class).disableTracking().isActives(IsActive.Active).authorize(this.authorize).planIds(data.stream().map(PlanEntity::getId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(PlanReferenceCommonModelBuilder.class).authorize(this.authorize).asMasterKey(query, PlanReferenceEntity::getPlanId); return itemMap; } - private Map> collectDmpDescriptions(List data) throws MyApplicationException { + private Map> collectPlanDescriptions(List data) throws MyApplicationException { if (data.isEmpty()) return null; this.logger.debug("checking related - {}", Description.class.getSimpleName()); Map> itemMap; - DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(DescriptionCommonModelBuilder.class).setRepositoryId(this.repositoryId).useSharedStorage(this.useSharedStorage).authorize(this.authorize).asMasterKey(query, DescriptionEntity::getDmpId); + DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).authorize(this.authorize).planIds(data.stream().map(PlanEntity::getId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(DescriptionCommonModelBuilder.class).setRepositoryId(this.repositoryId).useSharedStorage(this.useSharedStorage).authorize(this.authorize).asMasterKey(query, DescriptionEntity::getPlanId); return itemMap; } - private Map> collectDmpEntityDois(List data) throws MyApplicationException { + private Map> collectPlanEntityDois(List data) throws MyApplicationException { if (data.isEmpty()) return null; this.logger.debug("checking related - {}", EntityDoi.class.getSimpleName()); Map> itemMap; - EntityDoiQuery query = this.queryFactory.query(EntityDoiQuery.class).disableTracking().isActive(IsActive.Active).authorize(this.authorize).entityIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList())); + EntityDoiQuery query = this.queryFactory.query(EntityDoiQuery.class).disableTracking().isActive(IsActive.Active).authorize(this.authorize).entityIds(data.stream().map(PlanEntity::getId).distinct().collect(Collectors.toList())); itemMap = this.builderFactory.builder(EntityDoiCommonModelBuilder.class).authorize(this.authorize).asMasterKey(query, EntityDoiEntity::getEntityId); return itemMap; } - private Map collectCreators(List data) throws MyApplicationException { + private Map collectCreators(List data) throws MyApplicationException { if (data.isEmpty()) return null; this.logger.debug("checking related - {}", UserModel.class.getSimpleName()); Map itemMap; - UserQuery q = this.queryFactory.query(UserQuery.class).disableTracking().disableTracking().isActive(IsActive.Active).authorize(this.authorize).ids(data.stream().filter(x-> x.getCreatorId() != null).map(DmpEntity::getCreatorId).distinct().collect(Collectors.toList())); + UserQuery q = this.queryFactory.query(UserQuery.class).disableTracking().disableTracking().isActive(IsActive.Active).authorize(this.authorize).ids(data.stream().filter(x-> x.getCreatorId() != null).map(PlanEntity::getCreatorId).distinct().collect(Collectors.toList())); itemMap = this.builderFactory.builder(UserCommonModelBuilder.class).authorize(this.authorize).asForeignKey(q, UserEntity::getId); return itemMap; } - private Map collectDmpBlueprints(List data) throws MyApplicationException { + private Map collectPlanBlueprints(List data) throws MyApplicationException { if (data.isEmpty()) return null; this.logger.debug("checking related - {}", DmpBlueprintModel.class.getSimpleName()); Map itemMap; - DmpBlueprintQuery q = this.queryFactory.query(DmpBlueprintQuery.class).isActive(IsActive.Active).authorize(this.authorize).ids(data.stream().filter(x-> x.getBlueprintId() != null).map(DmpEntity::getBlueprintId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(DmpBlueprintCommonModelBuilder.class).authorize(this.authorize).asForeignKey(q, DmpBlueprintEntity::getId); + PlanBlueprintQuery q = this.queryFactory.query(PlanBlueprintQuery.class).isActive(IsActive.Active).authorize(this.authorize).ids(data.stream().filter(x-> x.getBlueprintId() != null).map(PlanEntity::getBlueprintId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(PlanBlueprintCommonModelBuilder.class).authorize(this.authorize).asForeignKey(q, PlanBlueprintEntity::getId); return itemMap; } - private Map collectDmpBlueprintDefinitions(List data) throws MyApplicationException { + private Map collectPlanBlueprintDefinitions(List data) throws MyApplicationException { if (data.isEmpty()) return null; this.logger.debug("checking related - {}", DefinitionEntity.class.getSimpleName()); Map itemMap = new HashMap<>(); - DmpBlueprintQuery q = this.queryFactory.query(DmpBlueprintQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DmpEntity::getBlueprintId).distinct().collect(Collectors.toList())); - List items = q.collectAs(new BaseFieldSet().ensure(DmpBlueprint._id).ensure(DmpBlueprint._definition)); - for (DmpBlueprintEntity item : items){ + PlanBlueprintQuery q = this.queryFactory.query(PlanBlueprintQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(PlanEntity::getBlueprintId).distinct().collect(Collectors.toList())); + List items = q.collectAs(new BaseFieldSet().ensure(PlanBlueprint._id).ensure(PlanBlueprint._definition)); + for (PlanBlueprintEntity item : items){ DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(DefinitionEntity.class, item.getDefinition()); itemMap.put(item.getId(), definition); } diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmp/DmpContactCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanContactCommonModelBuilder.java similarity index 75% rename from backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmp/DmpContactCommonModelBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanContactCommonModelBuilder.java index ce69c18f1..6de7a490a 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmp/DmpContactCommonModelBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanContactCommonModelBuilder.java @@ -1,4 +1,4 @@ -package org.opencdmp.model.builder.commonmodels.dmp; +package org.opencdmp.model.builder.commonmodels.plan; import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.query.QueryFactory; @@ -6,7 +6,7 @@ import gr.cite.tools.exception.MyApplicationException; import gr.cite.tools.logging.LoggerService; import org.opencdmp.authorization.AuthorizationFlags; import org.opencdmp.commonmodels.models.dmp.DmpContactModel; -import org.opencdmp.commons.types.dmp.DmpContactEntity; +import org.opencdmp.commons.types.plan.PlanContactEntity; import org.opencdmp.convention.ConventionService; import org.opencdmp.model.builder.commonmodels.BaseCommonModelBuilder; import org.opencdmp.model.builder.commonmodels.CommonModelBuilderItemResponse; @@ -20,7 +20,7 @@ import java.util.*; @Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpContactCommonModelBuilder extends BaseCommonModelBuilder { +public class PlanContactCommonModelBuilder extends BaseCommonModelBuilder { private EnumSet authorize = EnumSet.of(AuthorizationFlags.None); private final BuilderFactory builderFactory; @@ -28,25 +28,25 @@ public class DmpContactCommonModelBuilder extends BaseCommonModelBuilder values) { + public PlanContactCommonModelBuilder authorize(EnumSet values) { this.authorize = values; return this; } @Override - protected List> buildInternal(List data) throws MyApplicationException { + protected List> buildInternal(List data) throws MyApplicationException { this.logger.debug("building for {}", Optional.ofNullable(data).map(List::size).orElse(0)); if (data == null || data.isEmpty()) return new ArrayList<>(); - List> models = new ArrayList<>(); - for (DmpContactEntity d : data) { + List> models = new ArrayList<>(); + for (PlanContactEntity d : data) { DmpContactModel m = new DmpContactModel(); m.setEmail(d.getEmail()); m.setFirstName(d.getFirstName()); diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmp/DmpPropertiesCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanPropertiesCommonModelBuilder.java similarity index 62% rename from backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmp/DmpPropertiesCommonModelBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanPropertiesCommonModelBuilder.java index 1a5d397d1..8c22130f2 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmp/DmpPropertiesCommonModelBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanPropertiesCommonModelBuilder.java @@ -1,17 +1,15 @@ -package org.opencdmp.model.builder.commonmodels.dmp; +package org.opencdmp.model.builder.commonmodels.plan; import org.opencdmp.authorization.AuthorizationFlags; import org.opencdmp.commonmodels.models.dmp.DmpPropertiesModel; -import org.opencdmp.commons.types.dmp.DmpPropertiesEntity; -import org.opencdmp.commons.types.dmpblueprint.DefinitionEntity; +import org.opencdmp.commons.types.plan.PlanPropertiesEntity; +import org.opencdmp.commons.types.planblueprint.DefinitionEntity; import org.opencdmp.convention.ConventionService; import org.opencdmp.model.builder.commonmodels.BaseCommonModelBuilder; import org.opencdmp.model.builder.commonmodels.CommonModelBuilderItemResponse; -import org.opencdmp.model.builder.commonmodels.descriptiontemplate.PageCommonModelBuilder; import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.exception.MyApplicationException; import gr.cite.tools.logging.LoggerService; -import org.opencdmp.model.builder.dmp.DmpPropertiesBuilder; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.ConfigurableBeanFactory; @@ -25,38 +23,38 @@ import java.util.Optional; @Component @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpPropertiesCommonModelBuilder extends BaseCommonModelBuilder { +public class PlanPropertiesCommonModelBuilder extends BaseCommonModelBuilder { private final BuilderFactory builderFactory; private EnumSet authorize = EnumSet.of(AuthorizationFlags.None); private DefinitionEntity definition; @Autowired - public DmpPropertiesCommonModelBuilder( + public PlanPropertiesCommonModelBuilder( ConventionService conventionService, BuilderFactory builderFactory ) { - super(conventionService, new LoggerService(LoggerFactory.getLogger(DmpPropertiesCommonModelBuilder.class))); + super(conventionService, new LoggerService(LoggerFactory.getLogger(PlanPropertiesCommonModelBuilder.class))); this.builderFactory = builderFactory; } - public DmpPropertiesCommonModelBuilder withDefinition(DefinitionEntity definition) { + public PlanPropertiesCommonModelBuilder withDefinition(DefinitionEntity definition) { this.definition = definition; return this; } - public DmpPropertiesCommonModelBuilder authorize(EnumSet values) { + public PlanPropertiesCommonModelBuilder authorize(EnumSet values) { this.authorize = values; return this; } @Override - protected List> buildInternal(List data) throws MyApplicationException { + protected List> buildInternal(List data) throws MyApplicationException { this.logger.debug("building for {}", Optional.ofNullable(data).map(List::size).orElse(0)); if (data == null || data.isEmpty()) return new ArrayList<>(); - List> models = new ArrayList<>(); - for (DmpPropertiesEntity d : data) { + List> models = new ArrayList<>(); + for (PlanPropertiesEntity d : data) { DmpPropertiesModel m = new DmpPropertiesModel(); - if (d.getDmpBlueprintValues() != null) m.setDmpBlueprintValues(this.builderFactory.builder(DmpBlueprintValueCommonModelBuilder.class).withDefinition(definition).authorize(this.authorize).build(d.getDmpBlueprintValues())); - if (d.getContacts() != null) m.setContacts(this.builderFactory.builder(DmpContactCommonModelBuilder.class).authorize(this.authorize).build(d.getContacts())); + if (d.getPlanBlueprintValues() != null) m.setDmpBlueprintValues(this.builderFactory.builder(PlanBlueprintValueCommonModelBuilder.class).withDefinition(definition).authorize(this.authorize).build(d.getPlanBlueprintValues())); + if (d.getContacts() != null) m.setContacts(this.builderFactory.builder(PlanContactCommonModelBuilder.class).authorize(this.authorize).build(d.getContacts())); models.add(new CommonModelBuilderItemResponse<>(m, d)); } diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmpblueprint/DefinitionCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/DefinitionCommonModelBuilder.java similarity index 92% rename from backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmpblueprint/DefinitionCommonModelBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/DefinitionCommonModelBuilder.java index aa501c008..d1aff143f 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmpblueprint/DefinitionCommonModelBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/DefinitionCommonModelBuilder.java @@ -1,12 +1,11 @@ -package org.opencdmp.model.builder.commonmodels.dmpblueprint; +package org.opencdmp.model.builder.commonmodels.planblueprint; import org.opencdmp.authorization.AuthorizationFlags; import org.opencdmp.commonmodels.models.dmpblueprint.DefinitionModel; -import org.opencdmp.commons.types.dmpblueprint.DefinitionEntity; +import org.opencdmp.commons.types.planblueprint.DefinitionEntity; import org.opencdmp.convention.ConventionService; import org.opencdmp.model.builder.commonmodels.BaseCommonModelBuilder; import org.opencdmp.model.builder.commonmodels.CommonModelBuilderItemResponse; -import org.opencdmp.model.builder.commonmodels.dmp.DmpBlueprintValueCommonModelBuilder; import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.exception.MyApplicationException; import gr.cite.tools.logging.LoggerService; diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmpblueprint/ExtraFieldCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/ExtraFieldCommonModelBuilder.java similarity index 91% rename from backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmpblueprint/ExtraFieldCommonModelBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/ExtraFieldCommonModelBuilder.java index dc4f34670..51f958091 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmpblueprint/ExtraFieldCommonModelBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/ExtraFieldCommonModelBuilder.java @@ -1,8 +1,8 @@ -package org.opencdmp.model.builder.commonmodels.dmpblueprint; +package org.opencdmp.model.builder.commonmodels.planblueprint; import org.opencdmp.commonmodels.enums.DmpBlueprintExtraFieldDataType; import org.opencdmp.commonmodels.models.dmpblueprint.ExtraFieldModel; -import org.opencdmp.commons.types.dmpblueprint.ExtraFieldEntity; +import org.opencdmp.commons.types.planblueprint.ExtraFieldEntity; import org.opencdmp.convention.ConventionService; import gr.cite.tools.exception.MyApplicationException; import org.springframework.beans.factory.annotation.Autowired; diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmpblueprint/FieldCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/FieldCommonModelBuilder.java similarity index 96% rename from backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmpblueprint/FieldCommonModelBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/FieldCommonModelBuilder.java index 620c302c3..b5d0b336b 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmpblueprint/FieldCommonModelBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/FieldCommonModelBuilder.java @@ -1,9 +1,9 @@ -package org.opencdmp.model.builder.commonmodels.dmpblueprint; +package org.opencdmp.model.builder.commonmodels.planblueprint; import org.opencdmp.authorization.AuthorizationFlags; import org.opencdmp.commonmodels.enums.DmpBlueprintFieldCategory; import org.opencdmp.commonmodels.models.dmpblueprint.FieldModel; -import org.opencdmp.commons.types.dmpblueprint.FieldEntity; +import org.opencdmp.commons.types.planblueprint.FieldEntity; import org.opencdmp.convention.ConventionService; import org.opencdmp.model.builder.commonmodels.BaseCommonModelBuilder; import org.opencdmp.model.builder.commonmodels.CommonModelBuilderItemResponse; diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmpblueprint/DmpBlueprintCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/PlanBlueprintCommonModelBuilder.java similarity index 75% rename from backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmpblueprint/DmpBlueprintCommonModelBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/PlanBlueprintCommonModelBuilder.java index dc8abd0c2..6ca616e34 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmpblueprint/DmpBlueprintCommonModelBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/PlanBlueprintCommonModelBuilder.java @@ -1,12 +1,12 @@ -package org.opencdmp.model.builder.commonmodels.dmpblueprint; +package org.opencdmp.model.builder.commonmodels.planblueprint; import org.opencdmp.authorization.AuthorizationFlags; import org.opencdmp.commonmodels.enums.DmpBlueprintStatus; import org.opencdmp.commonmodels.models.dmpblueprint.DmpBlueprintModel; import org.opencdmp.commons.XmlHandlingService; -import org.opencdmp.commons.types.dmpblueprint.DefinitionEntity; +import org.opencdmp.commons.types.planblueprint.DefinitionEntity; import org.opencdmp.convention.ConventionService; -import org.opencdmp.data.DmpBlueprintEntity; +import org.opencdmp.data.PlanBlueprintEntity; import org.opencdmp.model.builder.commonmodels.BaseCommonModelBuilder; import org.opencdmp.model.builder.commonmodels.CommonModelBuilderItemResponse; import gr.cite.tools.data.builder.BuilderFactory; @@ -25,33 +25,33 @@ import java.util.Optional; @Component @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpBlueprintCommonModelBuilder extends BaseCommonModelBuilder { +public class PlanBlueprintCommonModelBuilder extends BaseCommonModelBuilder { private final BuilderFactory builderFactory; private final XmlHandlingService xmlHandlingService; private EnumSet authorize = EnumSet.of(AuthorizationFlags.None); @Autowired - public DmpBlueprintCommonModelBuilder(ConventionService conventionService, - BuilderFactory builderFactory, XmlHandlingService xmlHandlingService) { - super(conventionService, new LoggerService(LoggerFactory.getLogger(DmpBlueprintCommonModelBuilder.class))); + public PlanBlueprintCommonModelBuilder(ConventionService conventionService, + BuilderFactory builderFactory, XmlHandlingService xmlHandlingService) { + super(conventionService, new LoggerService(LoggerFactory.getLogger(PlanBlueprintCommonModelBuilder.class))); this.builderFactory = builderFactory; this.xmlHandlingService = xmlHandlingService; } - public DmpBlueprintCommonModelBuilder authorize(EnumSet values) { + public PlanBlueprintCommonModelBuilder authorize(EnumSet values) { this.authorize = values; return this; } @Override - protected List> buildInternal(List data) throws MyApplicationException { + protected List> buildInternal(List data) throws MyApplicationException { this.logger.debug("building for {}", Optional.ofNullable(data).map(List::size).orElse(0)); if (data == null || data.isEmpty()) return new ArrayList<>(); - List> models = new ArrayList<>(); + List> models = new ArrayList<>(); - for (DmpBlueprintEntity d : data) { + for (PlanBlueprintEntity d : data) { DmpBlueprintModel m = new DmpBlueprintModel(); m.setId(d.getId()); m.setLabel(d.getLabel()); diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmpblueprint/ReferenceTypeFieldCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/ReferenceTypeFieldCommonModelBuilder.java similarity index 92% rename from backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmpblueprint/ReferenceTypeFieldCommonModelBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/ReferenceTypeFieldCommonModelBuilder.java index 588f0a127..2a3fce7ca 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmpblueprint/ReferenceTypeFieldCommonModelBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/ReferenceTypeFieldCommonModelBuilder.java @@ -1,9 +1,9 @@ -package org.opencdmp.model.builder.commonmodels.dmpblueprint; +package org.opencdmp.model.builder.commonmodels.planblueprint; import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.query.QueryFactory; import org.opencdmp.commonmodels.models.dmpblueprint.ReferenceTypeFieldModel; -import org.opencdmp.commons.types.dmpblueprint.ReferenceTypeFieldEntity; +import org.opencdmp.commons.types.planblueprint.ReferenceTypeFieldEntity; import org.opencdmp.convention.ConventionService; import org.opencdmp.model.builder.commonmodels.ReferenceTypeCommonModelBuilder; import org.opencdmp.query.ReferenceTypeQuery; diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmpblueprint/SectionCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/SectionCommonModelBuilder.java similarity index 80% rename from backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmpblueprint/SectionCommonModelBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/SectionCommonModelBuilder.java index 498774159..e50c4d7dc 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmpblueprint/SectionCommonModelBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/SectionCommonModelBuilder.java @@ -1,12 +1,12 @@ -package org.opencdmp.model.builder.commonmodels.dmpblueprint; +package org.opencdmp.model.builder.commonmodels.planblueprint; import org.opencdmp.authorization.AuthorizationFlags; import org.opencdmp.commonmodels.models.dmpblueprint.SectionModel; -import org.opencdmp.commons.enums.DmpBlueprintFieldCategory; -import org.opencdmp.commons.types.dmpblueprint.ExtraFieldEntity; -import org.opencdmp.commons.types.dmpblueprint.ReferenceTypeFieldEntity; -import org.opencdmp.commons.types.dmpblueprint.SectionEntity; -import org.opencdmp.commons.types.dmpblueprint.SystemFieldEntity; +import org.opencdmp.commons.enums.PlanBlueprintFieldCategory; +import org.opencdmp.commons.types.planblueprint.ExtraFieldEntity; +import org.opencdmp.commons.types.planblueprint.ReferenceTypeFieldEntity; +import org.opencdmp.commons.types.planblueprint.SectionEntity; +import org.opencdmp.commons.types.planblueprint.SystemFieldEntity; import org.opencdmp.convention.ConventionService; import org.opencdmp.model.builder.commonmodels.BaseCommonModelBuilder; import org.opencdmp.model.builder.commonmodels.CommonModelBuilderItemResponse; @@ -58,11 +58,11 @@ public class SectionCommonModelBuilder extends BaseCommonModelBuilder()); - List systemFieldEntities = d.getFields().stream().filter(x-> DmpBlueprintFieldCategory.System.equals(x.getCategory())).map(x-> (SystemFieldEntity)x).toList(); + List systemFieldEntities = d.getFields().stream().filter(x-> PlanBlueprintFieldCategory.System.equals(x.getCategory())).map(x-> (SystemFieldEntity)x).toList(); m.getFields().addAll(this.builderFactory.builder(SystemFieldCommonModelBuilder.class).authorize(this.authorize).build(systemFieldEntities)); - List extraFieldEntities = d.getFields().stream().filter(x-> DmpBlueprintFieldCategory.Extra.equals(x.getCategory())).map(x-> (ExtraFieldEntity)x).toList(); + List extraFieldEntities = d.getFields().stream().filter(x-> PlanBlueprintFieldCategory.Extra.equals(x.getCategory())).map(x-> (ExtraFieldEntity)x).toList(); m.getFields().addAll(this.builderFactory.builder(ExtraFieldCommonModelBuilder.class).authorize(this.authorize).build(extraFieldEntities)); - List referenceFieldEntities = d.getFields().stream().filter(x-> DmpBlueprintFieldCategory.ReferenceType.equals(x.getCategory())).map(x-> (ReferenceTypeFieldEntity)x).toList(); + List referenceFieldEntities = d.getFields().stream().filter(x-> PlanBlueprintFieldCategory.ReferenceType.equals(x.getCategory())).map(x-> (ReferenceTypeFieldEntity)x).toList(); m.getFields().addAll(this.builderFactory.builder(ReferenceTypeFieldCommonModelBuilder.class).authorize(this.authorize).build(referenceFieldEntities)); } diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmpblueprint/SystemFieldCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/SystemFieldCommonModelBuilder.java similarity index 92% rename from backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmpblueprint/SystemFieldCommonModelBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/SystemFieldCommonModelBuilder.java index d68449d28..ab6cb0b9f 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmpblueprint/SystemFieldCommonModelBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/SystemFieldCommonModelBuilder.java @@ -1,8 +1,8 @@ -package org.opencdmp.model.builder.commonmodels.dmpblueprint; +package org.opencdmp.model.builder.commonmodels.planblueprint; import org.opencdmp.commonmodels.enums.DmpBlueprintSystemFieldType; import org.opencdmp.commonmodels.models.dmpblueprint.SystemFieldModel; -import org.opencdmp.commons.types.dmpblueprint.SystemFieldEntity; +import org.opencdmp.commons.types.planblueprint.SystemFieldEntity; import org.opencdmp.convention.ConventionService; import gr.cite.tools.exception.MyApplicationException; import org.springframework.beans.factory.annotation.Autowired; diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmpreference/DmpReferenceCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planreference/PlanReferenceCommonModelBuilder.java similarity index 72% rename from backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmpreference/DmpReferenceCommonModelBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planreference/PlanReferenceCommonModelBuilder.java index c79ae4042..5adacde97 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmpreference/DmpReferenceCommonModelBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planreference/PlanReferenceCommonModelBuilder.java @@ -1,4 +1,4 @@ -package org.opencdmp.model.builder.commonmodels.dmpreference; +package org.opencdmp.model.builder.commonmodels.planreference; import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.query.QueryFactory; @@ -8,9 +8,9 @@ import org.opencdmp.authorization.AuthorizationFlags; import org.opencdmp.commonmodels.models.dmpreference.DmpReferenceModel; import org.opencdmp.commonmodels.models.reference.ReferenceModel; import org.opencdmp.commons.JsonHandlingService; -import org.opencdmp.commons.types.dmpreference.DmpReferenceDataEntity; +import org.opencdmp.commons.types.planreference.PlanReferenceDataEntity; import org.opencdmp.convention.ConventionService; -import org.opencdmp.data.DmpReferenceEntity; +import org.opencdmp.data.PlanReferenceEntity; import org.opencdmp.data.ReferenceEntity; import org.opencdmp.model.builder.commonmodels.BaseCommonModelBuilder; import org.opencdmp.model.builder.commonmodels.CommonModelBuilderItemResponse; @@ -27,7 +27,7 @@ import java.util.stream.Collectors; @Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpReferenceCommonModelBuilder extends BaseCommonModelBuilder { +public class PlanReferenceCommonModelBuilder extends BaseCommonModelBuilder { private final BuilderFactory builderFactory; private final QueryFactory queryFactory; @@ -35,33 +35,33 @@ public class DmpReferenceCommonModelBuilder extends BaseCommonModelBuilder authorize = EnumSet.of(AuthorizationFlags.None); @Autowired - public DmpReferenceCommonModelBuilder( + public PlanReferenceCommonModelBuilder( ConventionService conventionService, BuilderFactory builderFactory, QueryFactory queryFactory, JsonHandlingService jsonHandlingService) { - super(conventionService, new LoggerService(LoggerFactory.getLogger(DmpReferenceCommonModelBuilder.class))); + super(conventionService, new LoggerService(LoggerFactory.getLogger(PlanReferenceCommonModelBuilder.class))); this.builderFactory = builderFactory; this.queryFactory = queryFactory; this.jsonHandlingService = jsonHandlingService; } - public DmpReferenceCommonModelBuilder authorize(EnumSet values) { + public PlanReferenceCommonModelBuilder authorize(EnumSet values) { this.authorize = values; return this; } @Override - protected List> buildInternal(List data) throws MyApplicationException { + protected List> buildInternal(List data) throws MyApplicationException { this.logger.debug("building for {}", Optional.ofNullable(data).map(List::size).orElse(0)); if (data == null || data.isEmpty()) return new ArrayList<>(); Map referenceModelMap = this.collectReferences(data); - List> models = new ArrayList<>(); - for (DmpReferenceEntity d : data) { + List> models = new ArrayList<>(); + for (PlanReferenceEntity d : data) { DmpReferenceModel m = new DmpReferenceModel(); m.setId(d.getId()); if (d.getData() != null){ - DmpReferenceDataEntity definition = this.jsonHandlingService.fromJsonSafe(DmpReferenceDataEntity.class, d.getData()); - m.setData(this.builderFactory.builder(DmpReferenceDataCommonModelBuilder.class).authorize(this.authorize).build(definition)); + PlanReferenceDataEntity definition = this.jsonHandlingService.fromJsonSafe(PlanReferenceDataEntity.class, d.getData()); + m.setData(this.builderFactory.builder(PlanReferenceDataCommonModelBuilder.class).authorize(this.authorize).build(definition)); } if (referenceModelMap != null && d.getReferenceId() != null && referenceModelMap.containsKey(d.getReferenceId())) m.setReference(referenceModelMap.get(d.getReferenceId())); @@ -72,13 +72,13 @@ public class DmpReferenceCommonModelBuilder extends BaseCommonModelBuilder collectReferences(List data) throws MyApplicationException { + private Map collectReferences(List data) throws MyApplicationException { if (data.isEmpty()) return null; this.logger.debug("checking related - {}", ReferenceModel.class.getSimpleName()); Map itemMap; - ReferenceQuery q = this.queryFactory.query(ReferenceQuery.class).authorize(this.authorize).disableTracking().ids(data.stream().map(DmpReferenceEntity::getReferenceId).distinct().collect(Collectors.toList())); + ReferenceQuery q = this.queryFactory.query(ReferenceQuery.class).authorize(this.authorize).disableTracking().ids(data.stream().map(PlanReferenceEntity::getReferenceId).distinct().collect(Collectors.toList())); itemMap = this.builderFactory.builder(ReferenceCommonModelBuilder.class).authorize(this.authorize).asForeignKey(q, ReferenceEntity::getId); return itemMap; diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmpreference/DmpReferenceDataCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planreference/PlanReferenceDataCommonModelBuilder.java similarity index 74% rename from backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmpreference/DmpReferenceDataCommonModelBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planreference/PlanReferenceDataCommonModelBuilder.java index 322647251..746572554 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/dmpreference/DmpReferenceDataCommonModelBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planreference/PlanReferenceDataCommonModelBuilder.java @@ -1,8 +1,8 @@ -package org.opencdmp.model.builder.commonmodels.dmpreference; +package org.opencdmp.model.builder.commonmodels.planreference; import org.opencdmp.authorization.AuthorizationFlags; import org.opencdmp.commonmodels.models.dmpreference.DmpReferenceDataModel; -import org.opencdmp.commons.types.dmpreference.DmpReferenceDataEntity; +import org.opencdmp.commons.types.planreference.PlanReferenceDataEntity; import org.opencdmp.convention.ConventionService; import org.opencdmp.model.builder.commonmodels.BaseCommonModelBuilder; import org.opencdmp.model.builder.commonmodels.CommonModelBuilderItemResponse; @@ -22,30 +22,30 @@ import java.util.Optional; @Component @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpReferenceDataCommonModelBuilder extends BaseCommonModelBuilder { +public class PlanReferenceDataCommonModelBuilder extends BaseCommonModelBuilder { private final BuilderFactory builderFactory; private EnumSet authorize = EnumSet.of(AuthorizationFlags.None); @Autowired - public DmpReferenceDataCommonModelBuilder( + public PlanReferenceDataCommonModelBuilder( ConventionService conventionService, BuilderFactory builderFactory) { - super(conventionService, new LoggerService(LoggerFactory.getLogger(DmpReferenceDataCommonModelBuilder.class))); + super(conventionService, new LoggerService(LoggerFactory.getLogger(PlanReferenceDataCommonModelBuilder.class))); this.builderFactory = builderFactory; } - public DmpReferenceDataCommonModelBuilder authorize(EnumSet values) { + public PlanReferenceDataCommonModelBuilder authorize(EnumSet values) { this.authorize = values; return this; } @Override - protected List> buildInternal(List data) throws MyApplicationException { + protected List> buildInternal(List data) throws MyApplicationException { this.logger.debug("building for {}", Optional.ofNullable(data).map(List::size).orElse(0)); if (data == null || data.isEmpty()) return new ArrayList<>(); - List> models = new ArrayList<>(); - for (DmpReferenceDataEntity d : data) { + List> models = new ArrayList<>(); + for (PlanReferenceDataEntity d : data) { DmpReferenceDataModel m = new DmpReferenceDataModel(); m.setBlueprintFieldId(d.getBlueprintFieldId()); models.add(new CommonModelBuilderItemResponse<>(m, d)); diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/description/DescriptionBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/description/DescriptionBuilder.java index c2d964b4b..01bfb85d6 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/description/DescriptionBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/description/DescriptionBuilder.java @@ -20,18 +20,18 @@ import org.opencdmp.convention.ConventionService; import org.opencdmp.data.DescriptionEntity; import org.opencdmp.data.DescriptionTemplateEntity; import org.opencdmp.model.DescriptionTag; -import org.opencdmp.model.DmpDescriptionTemplate; +import org.opencdmp.model.PlanDescriptionTemplate; import org.opencdmp.model.builder.BaseBuilder; import org.opencdmp.model.builder.DescriptionTagBuilder; -import org.opencdmp.model.builder.DmpDescriptionTemplateBuilder; +import org.opencdmp.model.builder.PlanDescriptionTemplateBuilder; import org.opencdmp.model.builder.UserBuilder; import org.opencdmp.model.builder.descriptionreference.DescriptionReferenceBuilder; import org.opencdmp.model.builder.descriptiontemplate.DescriptionTemplateBuilder; -import org.opencdmp.model.builder.dmp.DmpBuilder; +import org.opencdmp.model.builder.plan.PlanBuilder; import org.opencdmp.model.description.Description; import org.opencdmp.model.descriptionreference.DescriptionReference; import org.opencdmp.model.descriptiontemplate.DescriptionTemplate; -import org.opencdmp.model.dmp.Dmp; +import org.opencdmp.model.plan.Plan; import org.opencdmp.model.user.User; import org.opencdmp.query.*; import org.slf4j.LoggerFactory; @@ -85,11 +85,11 @@ public class DescriptionBuilder extends BaseBuilder(); - FieldSet dmpDescriptionTemplateFields = fields.extractPrefixed(this.asPrefix(Description._dmpDescriptionTemplate)); - Map dmpDescriptionTemplateItemsMap = this.collectDmpDescriptionTemplates(dmpDescriptionTemplateFields, data); + FieldSet planDescriptionTemplateFields = fields.extractPrefixed(this.asPrefix(Description._planDescriptionTemplate)); + Map planDescriptionTemplateItemsMap = this.collectPlanDescriptionTemplates(planDescriptionTemplateFields, data); - FieldSet dmpFields = fields.extractPrefixed(this.asPrefix(Description._dmp)); - Map dmpItemsMap = this.collectDmps(dmpFields, data); + FieldSet planFields = fields.extractPrefixed(this.asPrefix(Description._plan)); + Map planItemsMap = this.collectPlans(planFields, data); FieldSet descriptionTemplateFields = fields.extractPrefixed(this.asPrefix(Description._descriptionTemplate)); Map descriptionTemplateItemsMap = this.collectDescriptionTemplates(descriptionTemplateFields, data); @@ -123,8 +123,8 @@ public class DescriptionBuilder extends BaseBuilder collectDmpDescriptionTemplates(FieldSet fields, List data) throws MyApplicationException { + private Map collectPlanDescriptionTemplates(FieldSet fields, List data) throws MyApplicationException { if (fields.isEmpty() || data.isEmpty()) return null; - this.logger.debug("checking related - {}", DmpDescriptionTemplate.class.getSimpleName()); + this.logger.debug("checking related - {}", PlanDescriptionTemplate.class.getSimpleName()); - Map itemMap; - if (!fields.hasOtherField(this.asIndexer(DmpDescriptionTemplate._id))) { + Map itemMap; + if (!fields.hasOtherField(this.asIndexer(PlanDescriptionTemplate._id))) { itemMap = this.asEmpty( - data.stream().map(DescriptionEntity::getDmpDescriptionTemplateId).distinct().collect(Collectors.toList()), + data.stream().map(DescriptionEntity::getPlanDescriptionTemplateId).distinct().collect(Collectors.toList()), x -> { - DmpDescriptionTemplate item = new DmpDescriptionTemplate(); + PlanDescriptionTemplate item = new PlanDescriptionTemplate(); item.setId(x); return item; }, - DmpDescriptionTemplate::getId); + PlanDescriptionTemplate::getId); } else { - FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(DmpDescriptionTemplate._id); - DmpDescriptionTemplateQuery q = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DescriptionEntity::getDmpDescriptionTemplateId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(DmpDescriptionTemplateBuilder.class).authorize(this.authorize).asForeignKey(q, clone, DmpDescriptionTemplate::getId); + FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PlanDescriptionTemplate._id); + PlanDescriptionTemplateQuery q = this.queryFactory.query(PlanDescriptionTemplateQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DescriptionEntity::getPlanDescriptionTemplateId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(PlanDescriptionTemplateBuilder.class).authorize(this.authorize).asForeignKey(q, clone, PlanDescriptionTemplate::getId); } - if (!fields.hasField(DmpDescriptionTemplate._id)) { + if (!fields.hasField(PlanDescriptionTemplate._id)) { itemMap.forEach((id, item) -> { if (item != null) item.setId(null); @@ -248,27 +248,27 @@ public class DescriptionBuilder extends BaseBuilder collectDmps(FieldSet fields, List data) throws MyApplicationException { + private Map collectPlans(FieldSet fields, List data) throws MyApplicationException { if (fields.isEmpty() || data.isEmpty()) return null; - this.logger.debug("checking related - {}", Dmp.class.getSimpleName()); + this.logger.debug("checking related - {}", Plan.class.getSimpleName()); - Map itemMap; - if (!fields.hasOtherField(this.asIndexer(Dmp._id))) { + Map itemMap; + if (!fields.hasOtherField(this.asIndexer(Plan._id))) { itemMap = this.asEmpty( - data.stream().map(DescriptionEntity::getDmpId).distinct().collect(Collectors.toList()), + data.stream().map(DescriptionEntity::getPlanId).distinct().collect(Collectors.toList()), x -> { - Dmp item = new Dmp(); + Plan item = new Plan(); item.setId(x); return item; }, - Dmp::getId); + Plan::getId); } else { - FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Dmp._id); - DmpQuery q = this.queryFactory.query(DmpQuery.class).authorize(this.authorize).disableTracking().ids(data.stream().map(DescriptionEntity::getDmpId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(DmpBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Dmp::getId); + FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Plan._id); + PlanQuery q = this.queryFactory.query(PlanQuery.class).authorize(this.authorize).disableTracking().ids(data.stream().map(DescriptionEntity::getPlanId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(PlanBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Plan::getId); } - if (!fields.hasField(Dmp._id)) { + if (!fields.hasField(Plan._id)) { itemMap.forEach((id, item) -> { if (item != null) item.setId(null); diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/descriptiontemplate/DescriptionTemplateBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/descriptiontemplate/DescriptionTemplateBuilder.java index 316e834b8..b95feedee 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/descriptiontemplate/DescriptionTemplateBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/descriptiontemplate/DescriptionTemplateBuilder.java @@ -22,7 +22,7 @@ import org.opencdmp.model.builder.BaseBuilder; import org.opencdmp.model.builder.DescriptionTemplateTypeBuilder; import org.opencdmp.model.builder.UserDescriptionTemplateBuilder; import org.opencdmp.model.descriptiontemplate.DescriptionTemplate; -import org.opencdmp.model.dmp.Dmp; +import org.opencdmp.model.plan.Plan; import org.opencdmp.query.DescriptionTemplateTypeQuery; import org.opencdmp.query.UserDescriptionTemplateQuery; import org.slf4j.LoggerFactory; @@ -79,7 +79,7 @@ public class DescriptionTemplateBuilder extends BaseBuilder> usersMap = this.collectUserDescriptionTemplates(usersFields, data); - Set authorizationFlags = this.extractAuthorizationFlags(fields, Dmp._authorizationFlags, this.authorizationContentResolver.getPermissionNames()); + Set authorizationFlags = this.extractAuthorizationFlags(fields, Plan._authorizationFlags, this.authorizationContentResolver.getPermissionNames()); Map affiliatedResourceMap = authorizationFlags == null || authorizationFlags.isEmpty() ? null : this.authorizationContentResolver.descriptionTemplateAffiliation(data.stream().map(DescriptionTemplateEntity::getId).collect(Collectors.toList())); FieldSet definitionFields = fields.extractPrefixed(this.asPrefix(DescriptionTemplate._definition)); diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/dmp/DmpBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/dmp/DmpBuilder.java deleted file mode 100644 index a8149da5a..000000000 --- a/backend/core/src/main/java/org/opencdmp/model/builder/dmp/DmpBuilder.java +++ /dev/null @@ -1,344 +0,0 @@ -package org.opencdmp.model.builder.dmp; - -import gr.cite.commons.web.authz.service.AuthorizationService; -import gr.cite.tools.data.builder.BuilderFactory; -import gr.cite.tools.data.query.QueryFactory; -import gr.cite.tools.exception.MyApplicationException; -import gr.cite.tools.fieldset.BaseFieldSet; -import gr.cite.tools.fieldset.FieldSet; -import gr.cite.tools.logging.DataLogEntry; -import gr.cite.tools.logging.LoggerService; -import org.opencdmp.authorization.AffiliatedResource; -import org.opencdmp.authorization.AuthorizationFlags; -import org.opencdmp.authorization.authorizationcontentresolver.AuthorizationContentResolver; -import org.opencdmp.commons.JsonHandlingService; -import org.opencdmp.commons.XmlHandlingService; -import org.opencdmp.commons.enums.EntityType; -import org.opencdmp.commons.scope.tenant.TenantScope; -import org.opencdmp.commons.types.dmp.DmpPropertiesEntity; -import org.opencdmp.commons.types.dmpblueprint.DefinitionEntity; -import org.opencdmp.convention.ConventionService; -import org.opencdmp.data.DmpBlueprintEntity; -import org.opencdmp.data.DmpEntity; -import org.opencdmp.model.DmpDescriptionTemplate; -import org.opencdmp.model.DmpUser; -import org.opencdmp.model.EntityDoi; -import org.opencdmp.model.builder.*; -import org.opencdmp.model.builder.description.DescriptionBuilder; -import org.opencdmp.model.builder.dmpblueprint.DmpBlueprintBuilder; -import org.opencdmp.model.builder.dmpreference.DmpReferenceBuilder; -import org.opencdmp.model.description.Description; -import org.opencdmp.model.dmp.Dmp; -import org.opencdmp.model.dmpblueprint.DmpBlueprint; -import org.opencdmp.model.dmpreference.DmpReference; -import org.opencdmp.model.user.User; -import org.opencdmp.query.*; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.config.ConfigurableBeanFactory; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Component; - -import java.util.*; -import java.util.stream.Collectors; - -@Component -@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpBuilder extends BaseBuilder { - - private final QueryFactory queryFactory; - - private final BuilderFactory builderFactory; - private final JsonHandlingService jsonHandlingService; - private final XmlHandlingService xmlHandlingService; - private final AuthorizationService authorizationService; - private final AuthorizationContentResolver authorizationContentResolver; - private final TenantScope tenantScope; - - private EnumSet authorize = EnumSet.of(AuthorizationFlags.None); - - @Autowired - public DmpBuilder(ConventionService conventionService, - QueryFactory queryFactory, - BuilderFactory builderFactory, JsonHandlingService jsonHandlingService, XmlHandlingService xmlHandlingService, AuthorizationService authorizationService, AuthorizationContentResolver authorizationContentResolver, TenantScope tenantScope) { - super(conventionService, new LoggerService(LoggerFactory.getLogger(DmpBuilder.class))); - this.queryFactory = queryFactory; - this.builderFactory = builderFactory; - this.jsonHandlingService = jsonHandlingService; - this.xmlHandlingService = xmlHandlingService; - this.authorizationService = authorizationService; - this.authorizationContentResolver = authorizationContentResolver; - this.tenantScope = tenantScope; - } - - public DmpBuilder authorize(EnumSet values) { - this.authorize = values; - return this; - } - - @Override - public List build(FieldSet fields, List data) throws MyApplicationException { - this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0)); - this.logger.trace(new DataLogEntry("requested fields", fields)); - if (fields == null || data == null || fields.isEmpty()) - return new ArrayList<>(); - - List models = new ArrayList<>(); - - FieldSet entityDoisFields = fields.extractPrefixed(this.asPrefix(Dmp._entityDois)); - Map> entityDoisMap = this.collectEntityDois(entityDoisFields, data); - - FieldSet dmpReferencesFields = fields.extractPrefixed(this.asPrefix(Dmp._dmpReferences)); - Map> dmpReferencesMap = this.collectDmpReferences(dmpReferencesFields, data); - - FieldSet dmpUsersFields = fields.extractPrefixed(this.asPrefix(Dmp._dmpUsers)); - Map> dmpUsersMap = this.collectDmpUsers(dmpUsersFields, data); - - FieldSet userFields = fields.extractPrefixed(this.asPrefix(Dmp._creator)); - Map userItemsMap = this.collectUsers(userFields, data); - - FieldSet blueprintFields = fields.extractPrefixed(this.asPrefix(Dmp._blueprint)); - Map blueprintItemsMap = this.collectDmpBlueprints(blueprintFields, data); - - FieldSet descriptionsFields = fields.extractPrefixed(this.asPrefix(Dmp._descriptions)); - Map> descriptionsMap = this.collectDmpDescriptions(descriptionsFields, data); - - FieldSet dmpDescriptionTemplatesFields = fields.extractPrefixed(this.asPrefix(Dmp._dmpDescriptionTemplates)); - Map> dmpDescriptionTemplatesMap = this.collectDmpDescriptionTemplates(dmpDescriptionTemplatesFields, data); - - FieldSet otherDmpVersionsFields = fields.extractPrefixed(this.asPrefix(Dmp._otherDmpVersions)); - Map> otherDmpVersionsMap = this.collectOtherDmpVersions(otherDmpVersionsFields, data); - - FieldSet dmpPropertiesFields = fields.extractPrefixed(this.asPrefix(Dmp._properties)); - Map definitionEntityMap = !dmpPropertiesFields.isEmpty() ? this.collectDmpBlueprintDefinitions(data) : null; - - Set authorizationFlags = this.extractAuthorizationFlags(fields, Dmp._authorizationFlags, this.authorizationContentResolver.getPermissionNames()); - Map affiliatedResourceMap = authorizationFlags == null || authorizationFlags.isEmpty() ? null : this.authorizationContentResolver.dmpsAffiliation(data.stream().map(DmpEntity::getId).collect(Collectors.toList())); - - for (DmpEntity d : data) { - Dmp m = new Dmp(); - if (fields.hasField(this.asIndexer(Dmp._id))) m.setId(d.getId()); - if (fields.hasField(this.asIndexer(Dmp._label))) m.setLabel(d.getLabel()); - if (fields.hasField(this.asIndexer(Dmp._version))) m.setVersion(d.getVersion()); - if (fields.hasField(this.asIndexer(Dmp._status))) m.setStatus(d.getStatus()); - if (fields.hasField(this.asIndexer(Dmp._groupId))) m.setGroupId(d.getGroupId()); - if (fields.hasField(this.asIndexer(Dmp._description))) m.setDescription(d.getDescription()); - if (fields.hasField(this.asIndexer(Dmp._createdAt))) m.setCreatedAt(d.getCreatedAt()); - if (fields.hasField(this.asIndexer(Dmp._updatedAt))) m.setUpdatedAt(d.getUpdatedAt()); - if (fields.hasField(this.asIndexer(Dmp._isActive))) m.setIsActive(d.getIsActive()); - if (fields.hasField(this.asIndexer(Dmp._finalizedAt))) m.setFinalizedAt(d.getFinalizedAt()); - if (fields.hasField(this.asIndexer(Dmp._accessType))) m.setAccessType(d.getAccessType()); - if (fields.hasField(this.asIndexer(Dmp._language))) m.setLanguage(d.getLanguage()); - if (fields.hasField(this.asIndexer(Dmp._versionStatus))) m.setVersionStatus(d.getVersionStatus()); - if (fields.hasField(this.asIndexer(Dmp._publicAfter))) m.setPublicAfter(d.getPublicAfter()); - if (fields.hasField(this.asIndexer(Dmp._hash))) m.setHash(this.hashValue(d.getUpdatedAt())); - if (fields.hasField(this.asIndexer(Dmp._belongsToCurrentTenant))) m.setBelongsToCurrentTenant(this.getBelongsToCurrentTenant(d, this.tenantScope)); - if (!userFields.isEmpty() && userItemsMap != null && userItemsMap.containsKey(d.getCreatorId())) m.setCreator(userItemsMap.get(d.getCreatorId())); - if (!blueprintFields.isEmpty() && blueprintItemsMap != null && blueprintItemsMap.containsKey(d.getBlueprintId())) m.setBlueprint(blueprintItemsMap.get(d.getBlueprintId())); - if (entityDoisMap != null && !entityDoisMap.isEmpty() && entityDoisMap.containsKey(d.getId())) m.setEntityDois(entityDoisMap.get(d.getId())); - if (dmpReferencesMap != null && !dmpReferencesMap.isEmpty() && dmpReferencesMap.containsKey(d.getId())) m.setDmpReferences(dmpReferencesMap.get(d.getId())); - if (dmpUsersMap != null && !dmpUsersMap.isEmpty() && dmpUsersMap.containsKey(d.getId())) m.setDmpUsers(dmpUsersMap.get(d.getId())); - if (descriptionsMap != null && !descriptionsMap.isEmpty() && descriptionsMap.containsKey(d.getId())) m.setDescriptions(descriptionsMap.get(d.getId())); - if (dmpDescriptionTemplatesMap != null && !dmpDescriptionTemplatesMap.isEmpty() && dmpDescriptionTemplatesMap.containsKey(d.getId())) m.setDmpDescriptionTemplates(dmpDescriptionTemplatesMap.get(d.getId())); - if (otherDmpVersionsMap != null && !otherDmpVersionsMap.isEmpty() && otherDmpVersionsMap.containsKey(d.getGroupId())) { - m.setOtherDmpVersions(otherDmpVersionsMap.get(d.getGroupId())); - m.getOtherDmpVersions().sort(Comparator.comparing(Dmp::getVersion)); - } - if (!dmpPropertiesFields.isEmpty() && d.getProperties() != null){ - DmpPropertiesEntity propertyDefinition = this.jsonHandlingService.fromJsonSafe(DmpPropertiesEntity.class, d.getProperties()); - m.setProperties(this.builderFactory.builder(DmpPropertiesBuilder.class).withDefinition(definitionEntityMap != null ? definitionEntityMap.getOrDefault(d.getBlueprintId(), null) : null).authorize(this.authorize).build(dmpPropertiesFields, propertyDefinition)); - } - if (affiliatedResourceMap != null && !authorizationFlags.isEmpty()) m.setAuthorizationFlags(this.evaluateAuthorizationFlags(this.authorizationService, authorizationFlags, affiliatedResourceMap.getOrDefault(d.getId(), null))); - models.add(m); - } - this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0)); - - return models; - } - - private Map> collectDmpReferences(FieldSet fields, List data) throws MyApplicationException { - if (fields.isEmpty() || data.isEmpty()) return null; - this.logger.debug("checking related - {}", DmpReference.class.getSimpleName()); - - Map> itemMap; - FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DmpReference._dmp, DmpReference._id)); - DmpReferenceQuery query = this.queryFactory.query(DmpReferenceQuery.class).disableTracking().authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(DmpReferenceBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId()); - - if (!fields.hasField(this.asIndexer(DmpReference._dmp, Dmp._id))) { - itemMap.values().stream().flatMap(List::stream).filter(x -> x != null && x.getDmp() != null).forEach(x -> { - x.getDmp().setId(null); - }); - } - - return itemMap; - } - - private Map> collectEntityDois(FieldSet fields, List data) throws MyApplicationException { - if (fields.isEmpty() || data.isEmpty()) return null; - this.logger.debug("checking related - {}", EntityDoi.class.getSimpleName()); - - Map> itemMap; - FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(EntityDoi._entityId)); - EntityDoiQuery query = this.queryFactory.query(EntityDoiQuery.class).disableTracking().authorize(this.authorize).types(EntityType.DMP).entityIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(EntityDoiBuilder.class).authorize(this.authorize).asMasterKey(query, clone, EntityDoi::getEntityId); - - if (!fields.hasField(this.asIndexer(EntityDoi._entityId))) { - itemMap.values().stream().flatMap(List::stream).filter(x -> x != null && x.getEntityId() != null).forEach(x -> { - x.setEntityId(null); - }); - } - - return itemMap; - } - - private Map collectDmpBlueprints(FieldSet fields, List data) throws MyApplicationException { - if (fields.isEmpty() || data.isEmpty()) - return null; - this.logger.debug("checking related - {}", DmpBlueprint.class.getSimpleName()); - - Map itemMap; - if (!fields.hasOtherField(this.asIndexer(DmpBlueprint._id))) { - itemMap = this.asEmpty( - data.stream().map(DmpEntity::getBlueprintId).distinct().collect(Collectors.toList()), - x -> { - DmpBlueprint item = new DmpBlueprint(); - item.setId(x); - return item; - }, - DmpBlueprint::getId); - } else { - FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(DmpBlueprint._id); - DmpBlueprintQuery q = this.queryFactory.query(DmpBlueprintQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DmpEntity::getBlueprintId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(DmpBlueprintBuilder.class).authorize(this.authorize).asForeignKey(q, clone, DmpBlueprint::getId); - } - if (!fields.hasField(DmpBlueprint._id)) { - itemMap.forEach((id, item) -> { - if (item != null) - item.setId(null); - }); - } - - return itemMap; - } - - private Map collectDmpBlueprintDefinitions(List data) throws MyApplicationException { - if (data.isEmpty()) - return null; - this.logger.debug("checking related - {}", DefinitionEntity.class.getSimpleName()); - - Map itemMap = new HashMap<>(); - DmpBlueprintQuery q = this.queryFactory.query(DmpBlueprintQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DmpEntity::getBlueprintId).distinct().collect(Collectors.toList())); - List items = q.collectAs(new BaseFieldSet().ensure(DmpBlueprint._id).ensure(DmpBlueprint._definition)); - for (DmpBlueprintEntity item : items){ - DefinitionEntity definition =this.xmlHandlingService.fromXmlSafe(DefinitionEntity.class, item.getDefinition()); - itemMap.put(item.getId(), definition); - } - - return itemMap; - } - - private Map collectUsers(FieldSet fields, List data) throws MyApplicationException { - if (fields.isEmpty() || data.isEmpty()) - return null; - this.logger.debug("checking related - {}", User.class.getSimpleName()); - - Map itemMap; - if (!fields.hasOtherField(this.asIndexer(User._id))) { - itemMap = this.asEmpty( - data.stream().map(DmpEntity::getCreatorId).distinct().collect(Collectors.toList()), - x -> { - User item = new User(); - item.setId(x); - return item; - }, - User::getId); - } else { - FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(User._id); - UserQuery q = this.queryFactory.query(UserQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(DmpEntity::getCreatorId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(UserBuilder.class).authorize(this.authorize).asForeignKey(q, clone, User::getId); - } - if (!fields.hasField(User._id)) { - itemMap.forEach((id, item) -> { - if (item != null) - item.setId(null); - }); - } - - return itemMap; - } - - private Map> collectDmpUsers(FieldSet fields, List data) throws MyApplicationException { - if (fields.isEmpty() || data.isEmpty()) - return null; - this.logger.debug("checking related - {}", DmpUser.class.getSimpleName()); - - Map> itemMap; - FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DmpUser._dmp, DmpUser._id)); - DmpUserQuery query = this.queryFactory.query(DmpUserQuery.class).disableTracking().authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(DmpUserBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId()); - - if (!fields.hasField(this.asIndexer(DmpUser._dmp, Dmp._id))) { - itemMap.values().stream().flatMap(List::stream).filter(x -> x != null && x.getDmp() != null).forEach(x -> { - x.getDmp().setId(null); - }); - } - - return itemMap; - } - - private Map> collectDmpDescriptions(FieldSet fields, List data) throws MyApplicationException { - if (fields.isEmpty() || data.isEmpty()) return null; - this.logger.debug("checking related - {}", Description.class.getSimpleName()); - - Map> itemMap; - FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(Description._dmp, Description._id)); - DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(DescriptionBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId()); - - if (!fields.hasField(this.asIndexer(Description._dmp, Dmp._id))) { - itemMap.values().stream().flatMap(List::stream).filter(x -> x != null && x.getDmp() != null).forEach(x -> { - x.getDmp().setId(null); - }); - } - - return itemMap; - } - - private Map> collectDmpDescriptionTemplates(FieldSet fields, List data) throws MyApplicationException { - if (fields.isEmpty() || data.isEmpty()) return null; - this.logger.debug("checking related - {}", Description.class.getSimpleName()); - - Map> itemMap; - FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DmpDescriptionTemplate._dmp, DmpDescriptionTemplate._id)); - DmpDescriptionTemplateQuery query = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking().authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(DmpDescriptionTemplateBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId()); - - if (!fields.hasField(this.asIndexer(DmpDescriptionTemplate._dmp, Dmp._id))) { - itemMap.values().stream().flatMap(List::stream).filter(x -> x != null && x.getDmp() != null).forEach(x -> { - x.getDmp().setId(null); - }); - } - - return itemMap; - } - - private Map> collectOtherDmpVersions(FieldSet fields, List data) throws MyApplicationException { - if (fields.isEmpty() || data.isEmpty()) return null; - this.logger.debug("checking related - {}", Dmp.class.getSimpleName()); - - Map> itemMap; - FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Dmp._id); - DmpQuery query = this.queryFactory.query(DmpQuery.class).disableTracking().authorize(this.authorize).groupIds(data.stream().map(DmpEntity::getGroupId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(DmpBuilder.class).authorize(this.authorize).asMasterKey(query, clone, Dmp::getGroupId); - - if (!fields.hasField(Dmp._id)) { - itemMap.values().stream().flatMap(List::stream).filter(Objects::nonNull).forEach(x -> { - x.setId(null); - }); - } - - return itemMap; - } - -} diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/dmp/DmpBlueprintValueBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/plan/PlanBlueprintValueBuilder.java similarity index 55% rename from backend/core/src/main/java/org/opencdmp/model/builder/dmp/DmpBlueprintValueBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/plan/PlanBlueprintValueBuilder.java index 846ebda78..a9ae2917f 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/dmp/DmpBlueprintValueBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/plan/PlanBlueprintValueBuilder.java @@ -1,19 +1,19 @@ -package org.opencdmp.model.builder.dmp; +package org.opencdmp.model.builder.plan; import gr.cite.tools.exception.MyApplicationException; import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.logging.DataLogEntry; import gr.cite.tools.logging.LoggerService; import org.opencdmp.authorization.AuthorizationFlags; -import org.opencdmp.commons.enums.DmpBlueprintExtraFieldDataType; -import org.opencdmp.commons.enums.DmpBlueprintFieldCategory; -import org.opencdmp.commons.types.dmp.DmpBlueprintValueEntity; -import org.opencdmp.commons.types.dmpblueprint.DefinitionEntity; -import org.opencdmp.commons.types.dmpblueprint.ExtraFieldEntity; -import org.opencdmp.commons.types.dmpblueprint.FieldEntity; +import org.opencdmp.commons.enums.PlanBlueprintExtraFieldDataType; +import org.opencdmp.commons.enums.PlanBlueprintFieldCategory; +import org.opencdmp.commons.types.plan.PlanBlueprintValueEntity; +import org.opencdmp.commons.types.planblueprint.DefinitionEntity; +import org.opencdmp.commons.types.planblueprint.ExtraFieldEntity; +import org.opencdmp.commons.types.planblueprint.FieldEntity; import org.opencdmp.convention.ConventionService; import org.opencdmp.model.builder.BaseBuilder; -import org.opencdmp.model.dmp.DmpBlueprintValue; +import org.opencdmp.model.plan.PlanBlueprintValue; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.ConfigurableBeanFactory; @@ -22,52 +22,52 @@ import org.springframework.stereotype.Component; import java.util.*; -@Component("descriptionpropertiesdefinitionDmpBlueprintValuebuilder") +@Component("planblueprintvaluebuilder") @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpBlueprintValueBuilder extends BaseBuilder { +public class PlanBlueprintValueBuilder extends BaseBuilder { private EnumSet authorize = EnumSet.of(AuthorizationFlags.None); private DefinitionEntity definition; @Autowired - public DmpBlueprintValueBuilder( + public PlanBlueprintValueBuilder( ConventionService conventionService) { - super(conventionService, new LoggerService(LoggerFactory.getLogger(DmpBlueprintValueBuilder.class))); + super(conventionService, new LoggerService(LoggerFactory.getLogger(PlanBlueprintValueBuilder.class))); } - public DmpBlueprintValueBuilder authorize(EnumSet values) { + public PlanBlueprintValueBuilder authorize(EnumSet values) { this.authorize = values; return this; } - public DmpBlueprintValueBuilder withDefinition(DefinitionEntity definition) { + public PlanBlueprintValueBuilder withDefinition(DefinitionEntity definition) { this.definition = definition; return this; } @Override - public List build(FieldSet DmpBlueprintValues, List data) throws MyApplicationException { + public List build(FieldSet DmpBlueprintValues, List data) throws MyApplicationException { this.logger.debug("building for {} items requesting {} DmpBlueprintValues", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(DmpBlueprintValues).map(FieldSet::getFields).map(Set::size).orElse(0)); this.logger.trace(new DataLogEntry("requested DmpBlueprintValues", DmpBlueprintValues)); if (DmpBlueprintValues == null || data == null || DmpBlueprintValues.isEmpty()) return new ArrayList<>(); - List models = new ArrayList<>(); - for (DmpBlueprintValueEntity d : data) { + List models = new ArrayList<>(); + for (PlanBlueprintValueEntity d : data) { FieldEntity fieldEntity = this.definition != null ? this.definition.getFieldById(d.getFieldId()).stream().findFirst().orElse(null) : null; - if (fieldEntity != null && fieldEntity.getCategory().equals(DmpBlueprintFieldCategory.Extra)) { + if (fieldEntity != null && fieldEntity.getCategory().equals(PlanBlueprintFieldCategory.Extra)) { ExtraFieldEntity extraFieldEntity = (ExtraFieldEntity) fieldEntity; - DmpBlueprintValue m = new DmpBlueprintValue(); - if (DmpBlueprintValues.hasField(this.asIndexer(DmpBlueprintValue._fieldId))) m.setFieldId(d.getFieldId()); - if (extraFieldEntity != null && DmpBlueprintExtraFieldDataType.isDateType(extraFieldEntity.getType())){ - if (DmpBlueprintValues.hasField(this.asIndexer(DmpBlueprintValue._dateValue))) m.setDateValue(d.getDateValue()); - } else if (extraFieldEntity != null && DmpBlueprintExtraFieldDataType.isNumberType(extraFieldEntity.getType())){ - if (DmpBlueprintValues.hasField(this.asIndexer(DmpBlueprintValue._numberValue))) m.setNumberValue(d.getNumberValue()); + PlanBlueprintValue m = new PlanBlueprintValue(); + if (DmpBlueprintValues.hasField(this.asIndexer(PlanBlueprintValue._fieldId))) m.setFieldId(d.getFieldId()); + if (extraFieldEntity != null && PlanBlueprintExtraFieldDataType.isDateType(extraFieldEntity.getType())){ + if (DmpBlueprintValues.hasField(this.asIndexer(PlanBlueprintValue._dateValue))) m.setDateValue(d.getDateValue()); + } else if (extraFieldEntity != null && PlanBlueprintExtraFieldDataType.isNumberType(extraFieldEntity.getType())){ + if (DmpBlueprintValues.hasField(this.asIndexer(PlanBlueprintValue._numberValue))) m.setNumberValue(d.getNumberValue()); } else { - if (DmpBlueprintValues.hasField(this.asIndexer(DmpBlueprintValue._fieldValue))) m.setFieldValue(d.getValue()); + if (DmpBlueprintValues.hasField(this.asIndexer(PlanBlueprintValue._fieldValue))) m.setFieldValue(d.getValue()); } models.add(m); diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/plan/PlanBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/plan/PlanBuilder.java new file mode 100644 index 000000000..0302ceeff --- /dev/null +++ b/backend/core/src/main/java/org/opencdmp/model/builder/plan/PlanBuilder.java @@ -0,0 +1,344 @@ +package org.opencdmp.model.builder.plan; + +import gr.cite.commons.web.authz.service.AuthorizationService; +import gr.cite.tools.data.builder.BuilderFactory; +import gr.cite.tools.data.query.QueryFactory; +import gr.cite.tools.exception.MyApplicationException; +import gr.cite.tools.fieldset.BaseFieldSet; +import gr.cite.tools.fieldset.FieldSet; +import gr.cite.tools.logging.DataLogEntry; +import gr.cite.tools.logging.LoggerService; +import org.opencdmp.authorization.AffiliatedResource; +import org.opencdmp.authorization.AuthorizationFlags; +import org.opencdmp.authorization.authorizationcontentresolver.AuthorizationContentResolver; +import org.opencdmp.commons.JsonHandlingService; +import org.opencdmp.commons.XmlHandlingService; +import org.opencdmp.commons.enums.EntityType; +import org.opencdmp.commons.scope.tenant.TenantScope; +import org.opencdmp.commons.types.plan.PlanPropertiesEntity; +import org.opencdmp.commons.types.planblueprint.DefinitionEntity; +import org.opencdmp.convention.ConventionService; +import org.opencdmp.data.PlanBlueprintEntity; +import org.opencdmp.data.PlanEntity; +import org.opencdmp.model.PlanDescriptionTemplate; +import org.opencdmp.model.PlanUser; +import org.opencdmp.model.EntityDoi; +import org.opencdmp.model.builder.*; +import org.opencdmp.model.builder.description.DescriptionBuilder; +import org.opencdmp.model.builder.planblueprint.PlanBlueprintBuilder; +import org.opencdmp.model.builder.planreference.PlanReferenceBuilder; +import org.opencdmp.model.description.Description; +import org.opencdmp.model.plan.Plan; +import org.opencdmp.model.planblueprint.PlanBlueprint; +import org.opencdmp.model.planreference.PlanReference; +import org.opencdmp.model.user.User; +import org.opencdmp.query.*; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + +import java.util.*; +import java.util.stream.Collectors; + +@Component +@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) +public class PlanBuilder extends BaseBuilder { + + private final QueryFactory queryFactory; + + private final BuilderFactory builderFactory; + private final JsonHandlingService jsonHandlingService; + private final XmlHandlingService xmlHandlingService; + private final AuthorizationService authorizationService; + private final AuthorizationContentResolver authorizationContentResolver; + private final TenantScope tenantScope; + + private EnumSet authorize = EnumSet.of(AuthorizationFlags.None); + + @Autowired + public PlanBuilder(ConventionService conventionService, + QueryFactory queryFactory, + BuilderFactory builderFactory, JsonHandlingService jsonHandlingService, XmlHandlingService xmlHandlingService, AuthorizationService authorizationService, AuthorizationContentResolver authorizationContentResolver, TenantScope tenantScope) { + super(conventionService, new LoggerService(LoggerFactory.getLogger(PlanBuilder.class))); + this.queryFactory = queryFactory; + this.builderFactory = builderFactory; + this.jsonHandlingService = jsonHandlingService; + this.xmlHandlingService = xmlHandlingService; + this.authorizationService = authorizationService; + this.authorizationContentResolver = authorizationContentResolver; + this.tenantScope = tenantScope; + } + + public PlanBuilder authorize(EnumSet values) { + this.authorize = values; + return this; + } + + @Override + public List build(FieldSet fields, List data) throws MyApplicationException { + this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0)); + this.logger.trace(new DataLogEntry("requested fields", fields)); + if (fields == null || data == null || fields.isEmpty()) + return new ArrayList<>(); + + List models = new ArrayList<>(); + + FieldSet entityDoisFields = fields.extractPrefixed(this.asPrefix(Plan._entityDois)); + Map> entityDoisMap = this.collectEntityDois(entityDoisFields, data); + + FieldSet plamReferencesFields = fields.extractPrefixed(this.asPrefix(Plan._planReferences)); + Map> planReferencesMap = this.collectPlanReferences(plamReferencesFields, data); + + FieldSet planUsersFields = fields.extractPrefixed(this.asPrefix(Plan._planUsers)); + Map> planUsersMap = this.collectPlanUsers(planUsersFields, data); + + FieldSet userFields = fields.extractPrefixed(this.asPrefix(Plan._creator)); + Map userItemsMap = this.collectUsers(userFields, data); + + FieldSet blueprintFields = fields.extractPrefixed(this.asPrefix(Plan._blueprint)); + Map blueprintItemsMap = this.collectPlanBlueprints(blueprintFields, data); + + FieldSet descriptionsFields = fields.extractPrefixed(this.asPrefix(Plan._descriptions)); + Map> descriptionsMap = this.collectPlanDescriptions(descriptionsFields, data); + + FieldSet planDescriptionTemplatesFields = fields.extractPrefixed(this.asPrefix(Plan._planDescriptionTemplates)); + Map> planDescriptionTemplatesMap = this.collectPlanDescriptionTemplates(planDescriptionTemplatesFields, data); + + FieldSet otherPlanVersionsFields = fields.extractPrefixed(this.asPrefix(Plan._otherPlanVersions)); + Map> otherPlanVersionsMap = this.collectOtherPlanVersions(otherPlanVersionsFields, data); + + FieldSet planPropertiesFields = fields.extractPrefixed(this.asPrefix(Plan._properties)); + Map definitionEntityMap = !planPropertiesFields.isEmpty() ? this.collectPlanBlueprintDefinitions(data) : null; + + Set authorizationFlags = this.extractAuthorizationFlags(fields, Plan._authorizationFlags, this.authorizationContentResolver.getPermissionNames()); + Map affiliatedResourceMap = authorizationFlags == null || authorizationFlags.isEmpty() ? null : this.authorizationContentResolver.dmpsAffiliation(data.stream().map(PlanEntity::getId).collect(Collectors.toList())); + + for (PlanEntity d : data) { + Plan m = new Plan(); + if (fields.hasField(this.asIndexer(Plan._id))) m.setId(d.getId()); + if (fields.hasField(this.asIndexer(Plan._label))) m.setLabel(d.getLabel()); + if (fields.hasField(this.asIndexer(Plan._version))) m.setVersion(d.getVersion()); + if (fields.hasField(this.asIndexer(Plan._status))) m.setStatus(d.getStatus()); + if (fields.hasField(this.asIndexer(Plan._groupId))) m.setGroupId(d.getGroupId()); + if (fields.hasField(this.asIndexer(Plan._description))) m.setDescription(d.getDescription()); + if (fields.hasField(this.asIndexer(Plan._createdAt))) m.setCreatedAt(d.getCreatedAt()); + if (fields.hasField(this.asIndexer(Plan._updatedAt))) m.setUpdatedAt(d.getUpdatedAt()); + if (fields.hasField(this.asIndexer(Plan._isActive))) m.setIsActive(d.getIsActive()); + if (fields.hasField(this.asIndexer(Plan._finalizedAt))) m.setFinalizedAt(d.getFinalizedAt()); + if (fields.hasField(this.asIndexer(Plan._accessType))) m.setAccessType(d.getAccessType()); + if (fields.hasField(this.asIndexer(Plan._language))) m.setLanguage(d.getLanguage()); + if (fields.hasField(this.asIndexer(Plan._versionStatus))) m.setVersionStatus(d.getVersionStatus()); + if (fields.hasField(this.asIndexer(Plan._publicAfter))) m.setPublicAfter(d.getPublicAfter()); + if (fields.hasField(this.asIndexer(Plan._hash))) m.setHash(this.hashValue(d.getUpdatedAt())); + if (fields.hasField(this.asIndexer(Plan._belongsToCurrentTenant))) m.setBelongsToCurrentTenant(this.getBelongsToCurrentTenant(d, this.tenantScope)); + if (!userFields.isEmpty() && userItemsMap != null && userItemsMap.containsKey(d.getCreatorId())) m.setCreator(userItemsMap.get(d.getCreatorId())); + if (!blueprintFields.isEmpty() && blueprintItemsMap != null && blueprintItemsMap.containsKey(d.getBlueprintId())) m.setBlueprint(blueprintItemsMap.get(d.getBlueprintId())); + if (entityDoisMap != null && !entityDoisMap.isEmpty() && entityDoisMap.containsKey(d.getId())) m.setEntityDois(entityDoisMap.get(d.getId())); + if (planReferencesMap != null && !planReferencesMap.isEmpty() && planReferencesMap.containsKey(d.getId())) m.setPlanReferences(planReferencesMap.get(d.getId())); + if (planUsersMap != null && !planUsersMap.isEmpty() && planUsersMap.containsKey(d.getId())) m.setPlanUsers(planUsersMap.get(d.getId())); + if (descriptionsMap != null && !descriptionsMap.isEmpty() && descriptionsMap.containsKey(d.getId())) m.setDescriptions(descriptionsMap.get(d.getId())); + if (planDescriptionTemplatesMap != null && !planDescriptionTemplatesMap.isEmpty() && planDescriptionTemplatesMap.containsKey(d.getId())) m.setPlanDescriptionTemplates(planDescriptionTemplatesMap.get(d.getId())); + if (otherPlanVersionsMap != null && !otherPlanVersionsMap.isEmpty() && otherPlanVersionsMap.containsKey(d.getGroupId())) { + m.setOtherPlanVersions(otherPlanVersionsMap.get(d.getGroupId())); + m.getOtherPlanVersions().sort(Comparator.comparing(Plan::getVersion)); + } + if (!planPropertiesFields.isEmpty() && d.getProperties() != null){ + PlanPropertiesEntity propertyDefinition = this.jsonHandlingService.fromJsonSafe(PlanPropertiesEntity.class, d.getProperties()); + m.setProperties(this.builderFactory.builder(PlanPropertiesBuilder.class).withDefinition(definitionEntityMap != null ? definitionEntityMap.getOrDefault(d.getBlueprintId(), null) : null).authorize(this.authorize).build(planPropertiesFields, propertyDefinition)); + } + if (affiliatedResourceMap != null && !authorizationFlags.isEmpty()) m.setAuthorizationFlags(this.evaluateAuthorizationFlags(this.authorizationService, authorizationFlags, affiliatedResourceMap.getOrDefault(d.getId(), null))); + models.add(m); + } + this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0)); + + return models; + } + + private Map> collectPlanReferences(FieldSet fields, List data) throws MyApplicationException { + if (fields.isEmpty() || data.isEmpty()) return null; + this.logger.debug("checking related - {}", PlanReference.class.getSimpleName()); + + Map> itemMap; + FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(PlanReference._plan, PlanReference._id)); + PlanReferenceQuery query = this.queryFactory.query(PlanReferenceQuery.class).disableTracking().authorize(this.authorize).planIds(data.stream().map(PlanEntity::getId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(PlanReferenceBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getPlan().getId()); + + if (!fields.hasField(this.asIndexer(PlanReference._plan, Plan._id))) { + itemMap.values().stream().flatMap(List::stream).filter(x -> x != null && x.getPlan() != null).forEach(x -> { + x.getPlan().setId(null); + }); + } + + return itemMap; + } + + private Map> collectEntityDois(FieldSet fields, List data) throws MyApplicationException { + if (fields.isEmpty() || data.isEmpty()) return null; + this.logger.debug("checking related - {}", EntityDoi.class.getSimpleName()); + + Map> itemMap; + FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(EntityDoi._entityId)); + EntityDoiQuery query = this.queryFactory.query(EntityDoiQuery.class).disableTracking().authorize(this.authorize).types(EntityType.DMP).entityIds(data.stream().map(PlanEntity::getId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(EntityDoiBuilder.class).authorize(this.authorize).asMasterKey(query, clone, EntityDoi::getEntityId); + + if (!fields.hasField(this.asIndexer(EntityDoi._entityId))) { + itemMap.values().stream().flatMap(List::stream).filter(x -> x != null && x.getEntityId() != null).forEach(x -> { + x.setEntityId(null); + }); + } + + return itemMap; + } + + private Map collectPlanBlueprints(FieldSet fields, List data) throws MyApplicationException { + if (fields.isEmpty() || data.isEmpty()) + return null; + this.logger.debug("checking related - {}", PlanBlueprint.class.getSimpleName()); + + Map itemMap; + if (!fields.hasOtherField(this.asIndexer(PlanBlueprint._id))) { + itemMap = this.asEmpty( + data.stream().map(PlanEntity::getBlueprintId).distinct().collect(Collectors.toList()), + x -> { + PlanBlueprint item = new PlanBlueprint(); + item.setId(x); + return item; + }, + PlanBlueprint::getId); + } else { + FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(PlanBlueprint._id); + PlanBlueprintQuery q = this.queryFactory.query(PlanBlueprintQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(PlanEntity::getBlueprintId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(PlanBlueprintBuilder.class).authorize(this.authorize).asForeignKey(q, clone, PlanBlueprint::getId); + } + if (!fields.hasField(PlanBlueprint._id)) { + itemMap.forEach((id, item) -> { + if (item != null) + item.setId(null); + }); + } + + return itemMap; + } + + private Map collectPlanBlueprintDefinitions(List data) throws MyApplicationException { + if (data.isEmpty()) + return null; + this.logger.debug("checking related - {}", DefinitionEntity.class.getSimpleName()); + + Map itemMap = new HashMap<>(); + PlanBlueprintQuery q = this.queryFactory.query(PlanBlueprintQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(PlanEntity::getBlueprintId).distinct().collect(Collectors.toList())); + List items = q.collectAs(new BaseFieldSet().ensure(PlanBlueprint._id).ensure(PlanBlueprint._definition)); + for (PlanBlueprintEntity item : items){ + DefinitionEntity definition =this.xmlHandlingService.fromXmlSafe(DefinitionEntity.class, item.getDefinition()); + itemMap.put(item.getId(), definition); + } + + return itemMap; + } + + private Map collectUsers(FieldSet fields, List data) throws MyApplicationException { + if (fields.isEmpty() || data.isEmpty()) + return null; + this.logger.debug("checking related - {}", User.class.getSimpleName()); + + Map itemMap; + if (!fields.hasOtherField(this.asIndexer(User._id))) { + itemMap = this.asEmpty( + data.stream().map(PlanEntity::getCreatorId).distinct().collect(Collectors.toList()), + x -> { + User item = new User(); + item.setId(x); + return item; + }, + User::getId); + } else { + FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(User._id); + UserQuery q = this.queryFactory.query(UserQuery.class).disableTracking().authorize(this.authorize).ids(data.stream().map(PlanEntity::getCreatorId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(UserBuilder.class).authorize(this.authorize).asForeignKey(q, clone, User::getId); + } + if (!fields.hasField(User._id)) { + itemMap.forEach((id, item) -> { + if (item != null) + item.setId(null); + }); + } + + return itemMap; + } + + private Map> collectPlanUsers(FieldSet fields, List data) throws MyApplicationException { + if (fields.isEmpty() || data.isEmpty()) + return null; + this.logger.debug("checking related - {}", PlanUser.class.getSimpleName()); + + Map> itemMap; + FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(PlanUser._plan, PlanUser._id)); + PlanUserQuery query = this.queryFactory.query(PlanUserQuery.class).disableTracking().authorize(this.authorize).planIds(data.stream().map(PlanEntity::getId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(PlanUserBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getPlan().getId()); + + if (!fields.hasField(this.asIndexer(PlanUser._plan, Plan._id))) { + itemMap.values().stream().flatMap(List::stream).filter(x -> x != null && x.getPlan() != null).forEach(x -> { + x.getPlan().setId(null); + }); + } + + return itemMap; + } + + private Map> collectPlanDescriptions(FieldSet fields, List data) throws MyApplicationException { + if (fields.isEmpty() || data.isEmpty()) return null; + this.logger.debug("checking related - {}", Description.class.getSimpleName()); + + Map> itemMap; + FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(Description._plan, Description._id)); + DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(this.authorize).planIds(data.stream().map(PlanEntity::getId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(DescriptionBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getPlan().getId()); + + if (!fields.hasField(this.asIndexer(Description._plan, Plan._id))) { + itemMap.values().stream().flatMap(List::stream).filter(x -> x != null && x.getPlan() != null).forEach(x -> { + x.getPlan().setId(null); + }); + } + + return itemMap; + } + + private Map> collectPlanDescriptionTemplates(FieldSet fields, List data) throws MyApplicationException { + if (fields.isEmpty() || data.isEmpty()) return null; + this.logger.debug("checking related - {}", Description.class.getSimpleName()); + + Map> itemMap; + FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(PlanDescriptionTemplate._plan, PlanDescriptionTemplate._id)); + PlanDescriptionTemplateQuery query = this.queryFactory.query(PlanDescriptionTemplateQuery.class).disableTracking().authorize(this.authorize).planIds(data.stream().map(PlanEntity::getId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(PlanDescriptionTemplateBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId()); + + if (!fields.hasField(this.asIndexer(PlanDescriptionTemplate._plan, Plan._id))) { + itemMap.values().stream().flatMap(List::stream).filter(x -> x != null && x.getDmp() != null).forEach(x -> { + x.getDmp().setId(null); + }); + } + + return itemMap; + } + + private Map> collectOtherPlanVersions(FieldSet fields, List data) throws MyApplicationException { + if (fields.isEmpty() || data.isEmpty()) return null; + this.logger.debug("checking related - {}", Plan.class.getSimpleName()); + + Map> itemMap; + FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Plan._id); + PlanQuery query = this.queryFactory.query(PlanQuery.class).disableTracking().authorize(this.authorize).groupIds(data.stream().map(PlanEntity::getGroupId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(PlanBuilder.class).authorize(this.authorize).asMasterKey(query, clone, Plan::getGroupId); + + if (!fields.hasField(Plan._id)) { + itemMap.values().stream().flatMap(List::stream).filter(Objects::nonNull).forEach(x -> { + x.setId(null); + }); + } + + return itemMap; + } + +} diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/dmp/DmpContactBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/plan/PlanContactBuilder.java similarity index 66% rename from backend/core/src/main/java/org/opencdmp/model/builder/dmp/DmpContactBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/plan/PlanContactBuilder.java index 53ff433f5..aa7d0d01f 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/dmp/DmpContactBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/plan/PlanContactBuilder.java @@ -1,4 +1,4 @@ -package org.opencdmp.model.builder.dmp; +package org.opencdmp.model.builder.plan; import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.query.QueryFactory; @@ -7,10 +7,10 @@ import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.logging.DataLogEntry; import gr.cite.tools.logging.LoggerService; import org.opencdmp.authorization.AuthorizationFlags; -import org.opencdmp.commons.types.dmp.DmpContactEntity; +import org.opencdmp.commons.types.plan.PlanContactEntity; import org.opencdmp.convention.ConventionService; import org.opencdmp.model.builder.BaseBuilder; -import org.opencdmp.model.dmp.DmpContact; +import org.opencdmp.model.plan.PlanContact; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.ConfigurableBeanFactory; @@ -19,9 +19,9 @@ import org.springframework.stereotype.Component; import java.util.*; -@Component("dmpcontactbuilder") +@Component("plancontactbuilder") @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpContactBuilder extends BaseBuilder { +public class PlanContactBuilder extends BaseBuilder { private final BuilderFactory builderFactory; @@ -29,20 +29,20 @@ public class DmpContactBuilder extends BaseBuilder private EnumSet authorize = EnumSet.of(AuthorizationFlags.None); @Autowired - public DmpContactBuilder( + public PlanContactBuilder( ConventionService conventionService, BuilderFactory builderFactory, QueryFactory queryFactory) { - super(conventionService, new LoggerService(LoggerFactory.getLogger(DmpContactBuilder.class))); + super(conventionService, new LoggerService(LoggerFactory.getLogger(PlanContactBuilder.class))); this.builderFactory = builderFactory; this.queryFactory = queryFactory; } - public DmpContactBuilder authorize(EnumSet values) { + public PlanContactBuilder authorize(EnumSet values) { this.authorize = values; return this; } @Override - public List build(FieldSet fields, List data) throws MyApplicationException { + public List build(FieldSet fields, List data) throws MyApplicationException { this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0)); this.logger.trace(new DataLogEntry("requested fields", fields)); if (fields == null || data == null || fields.isEmpty()) @@ -50,12 +50,12 @@ public class DmpContactBuilder extends BaseBuilder //Not Bulk Build because is XML no interaction with db - List models = new ArrayList<>(); - for (DmpContactEntity d : data) { - DmpContact m = new DmpContact(); - if (fields.hasField(this.asIndexer(DmpContact._email))) m.setEmail(d.getEmail()); - if (fields.hasField(this.asIndexer(DmpContact._firstName))) m.setFirstName(d.getFirstName()); - if (fields.hasField(this.asIndexer(DmpContact._lastName))) m.setLastName(d.getLastName()); + List models = new ArrayList<>(); + for (PlanContactEntity d : data) { + PlanContact m = new PlanContact(); + if (fields.hasField(this.asIndexer(PlanContact._email))) m.setEmail(d.getEmail()); + if (fields.hasField(this.asIndexer(PlanContact._firstName))) m.setFirstName(d.getFirstName()); + if (fields.hasField(this.asIndexer(PlanContact._lastName))) m.setLastName(d.getLastName()); models.add(m); } this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0)); diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/dmp/DmpPropertiesBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/plan/PlanPropertiesBuilder.java similarity index 59% rename from backend/core/src/main/java/org/opencdmp/model/builder/dmp/DmpPropertiesBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/plan/PlanPropertiesBuilder.java index a36cebb01..1d5347405 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/dmp/DmpPropertiesBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/plan/PlanPropertiesBuilder.java @@ -1,4 +1,4 @@ -package org.opencdmp.model.builder.dmp; +package org.opencdmp.model.builder.plan; import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.exception.MyApplicationException; @@ -6,11 +6,11 @@ import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.logging.DataLogEntry; import gr.cite.tools.logging.LoggerService; import org.opencdmp.authorization.AuthorizationFlags; -import org.opencdmp.commons.types.dmp.DmpPropertiesEntity; -import org.opencdmp.commons.types.dmpblueprint.DefinitionEntity; +import org.opencdmp.commons.types.plan.PlanPropertiesEntity; +import org.opencdmp.commons.types.planblueprint.DefinitionEntity; import org.opencdmp.convention.ConventionService; import org.opencdmp.model.builder.BaseBuilder; -import org.opencdmp.model.dmp.DmpProperties; +import org.opencdmp.model.plan.PlanProperties; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.ConfigurableBeanFactory; @@ -19,47 +19,47 @@ import org.springframework.stereotype.Component; import java.util.*; -@Component("dmppropertiesbuilder") +@Component("planpropertiesbuilder") @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpPropertiesBuilder extends BaseBuilder { +public class PlanPropertiesBuilder extends BaseBuilder { private final BuilderFactory builderFactory; private EnumSet authorize = EnumSet.of(AuthorizationFlags.None); private DefinitionEntity definition; @Autowired - public DmpPropertiesBuilder( + public PlanPropertiesBuilder( ConventionService conventionService, BuilderFactory builderFactory) { - super(conventionService, new LoggerService(LoggerFactory.getLogger(DmpPropertiesBuilder.class))); + super(conventionService, new LoggerService(LoggerFactory.getLogger(PlanPropertiesBuilder.class))); this.builderFactory = builderFactory; } - public DmpPropertiesBuilder withDefinition(DefinitionEntity definition) { + public PlanPropertiesBuilder withDefinition(DefinitionEntity definition) { this.definition = definition; return this; } - public DmpPropertiesBuilder authorize(EnumSet values) { + public PlanPropertiesBuilder authorize(EnumSet values) { this.authorize = values; return this; } @Override - public List build(FieldSet fields, List data) throws MyApplicationException { + public List build(FieldSet fields, List data) throws MyApplicationException { this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0)); this.logger.trace(new DataLogEntry("requested fields", fields)); if (fields == null || data == null || fields.isEmpty()) return new ArrayList<>(); //Not Bulk Build because is XML no interaction with db - FieldSet dmpBlueprintValuesFields = fields.extractPrefixed(this.asPrefix(DmpProperties._dmpBlueprintValues)); - FieldSet contactsFields = fields.extractPrefixed(this.asPrefix(DmpProperties._contacts)); + FieldSet dmpBlueprintValuesFields = fields.extractPrefixed(this.asPrefix(PlanProperties._planBlueprintValues)); + FieldSet contactsFields = fields.extractPrefixed(this.asPrefix(PlanProperties._contacts)); - List models = new ArrayList<>(); - for (DmpPropertiesEntity d : data) { - DmpProperties m = new DmpProperties(); - if (!dmpBlueprintValuesFields.isEmpty() && d.getDmpBlueprintValues() != null) m.setDmpBlueprintValues(this.builderFactory.builder(DmpBlueprintValueBuilder.class).withDefinition(definition).authorize(this.authorize).build(dmpBlueprintValuesFields, d.getDmpBlueprintValues())); - if (!contactsFields.isEmpty() && d.getContacts() != null) m.setContacts(this.builderFactory.builder(DmpContactBuilder.class).authorize(this.authorize).build(contactsFields, d.getContacts())); + List models = new ArrayList<>(); + for (PlanPropertiesEntity d : data) { + PlanProperties m = new PlanProperties(); + if (!dmpBlueprintValuesFields.isEmpty() && d.getPlanBlueprintValues() != null) m.setPlanBlueprintValues(this.builderFactory.builder(PlanBlueprintValueBuilder.class).withDefinition(definition).authorize(this.authorize).build(dmpBlueprintValuesFields, d.getPlanBlueprintValues())); + if (!contactsFields.isEmpty() && d.getContacts() != null) m.setContacts(this.builderFactory.builder(PlanContactBuilder.class).authorize(this.authorize).build(contactsFields, d.getContacts())); models.add(m); } this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0)); diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/dmpblueprint/DefinitionBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/DefinitionBuilder.java similarity index 93% rename from backend/core/src/main/java/org/opencdmp/model/builder/dmpblueprint/DefinitionBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/DefinitionBuilder.java index 4f7fe9582..2d263ac45 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/dmpblueprint/DefinitionBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/DefinitionBuilder.java @@ -1,10 +1,10 @@ -package org.opencdmp.model.builder.dmpblueprint; +package org.opencdmp.model.builder.planblueprint; import org.opencdmp.authorization.AuthorizationFlags; -import org.opencdmp.commons.types.dmpblueprint.DefinitionEntity; +import org.opencdmp.commons.types.planblueprint.DefinitionEntity; import org.opencdmp.convention.ConventionService; import org.opencdmp.model.builder.BaseBuilder; -import org.opencdmp.model.dmpblueprint.Definition; +import org.opencdmp.model.planblueprint.Definition; import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.exception.MyApplicationException; import gr.cite.tools.fieldset.FieldSet; diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/dmpblueprint/DescriptionTemplateBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/DescriptionTemplateBuilder.java similarity index 93% rename from backend/core/src/main/java/org/opencdmp/model/builder/dmpblueprint/DescriptionTemplateBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/DescriptionTemplateBuilder.java index 9fa377322..9440ccba0 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/dmpblueprint/DescriptionTemplateBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/DescriptionTemplateBuilder.java @@ -1,10 +1,10 @@ -package org.opencdmp.model.builder.dmpblueprint; +package org.opencdmp.model.builder.planblueprint; import org.opencdmp.authorization.AuthorizationFlags; -import org.opencdmp.commons.types.dmpblueprint.DescriptionTemplateEntity; +import org.opencdmp.commons.types.planblueprint.DescriptionTemplateEntity; import org.opencdmp.convention.ConventionService; import org.opencdmp.model.builder.BaseBuilder; -import org.opencdmp.model.dmpblueprint.DescriptionTemplate; +import org.opencdmp.model.planblueprint.DescriptionTemplate; import gr.cite.tools.exception.MyApplicationException; import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.logging.DataLogEntry; diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/dmpblueprint/ExtraFieldBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/ExtraFieldBuilder.java similarity index 85% rename from backend/core/src/main/java/org/opencdmp/model/builder/dmpblueprint/ExtraFieldBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/ExtraFieldBuilder.java index 3d9eb8c3b..a02419fff 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/dmpblueprint/ExtraFieldBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/ExtraFieldBuilder.java @@ -1,8 +1,8 @@ -package org.opencdmp.model.builder.dmpblueprint; +package org.opencdmp.model.builder.planblueprint; -import org.opencdmp.commons.types.dmpblueprint.ExtraFieldEntity; +import org.opencdmp.commons.types.planblueprint.ExtraFieldEntity; import org.opencdmp.convention.ConventionService; -import org.opencdmp.model.dmpblueprint.ExtraField; +import org.opencdmp.model.planblueprint.ExtraField; import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.logging.LoggerService; import org.slf4j.LoggerFactory; diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/dmpblueprint/FieldBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/FieldBuilder.java similarity index 94% rename from backend/core/src/main/java/org/opencdmp/model/builder/dmpblueprint/FieldBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/FieldBuilder.java index c9a6e2556..a1ee27494 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/dmpblueprint/FieldBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/FieldBuilder.java @@ -1,10 +1,10 @@ -package org.opencdmp.model.builder.dmpblueprint; +package org.opencdmp.model.builder.planblueprint; import org.opencdmp.authorization.AuthorizationFlags; -import org.opencdmp.commons.types.dmpblueprint.FieldEntity; +import org.opencdmp.commons.types.planblueprint.FieldEntity; import org.opencdmp.convention.ConventionService; import org.opencdmp.model.builder.BaseBuilder; -import org.opencdmp.model.dmpblueprint.Field; +import org.opencdmp.model.planblueprint.Field; import gr.cite.tools.exception.MyApplicationException; import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.logging.DataLogEntry; diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/dmpblueprint/DmpBlueprintBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/PlanBlueprintBuilder.java similarity index 64% rename from backend/core/src/main/java/org/opencdmp/model/builder/dmpblueprint/DmpBlueprintBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/PlanBlueprintBuilder.java index c5181f4f6..1085ed905 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/dmpblueprint/DmpBlueprintBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/PlanBlueprintBuilder.java @@ -1,13 +1,13 @@ -package org.opencdmp.model.builder.dmpblueprint; +package org.opencdmp.model.builder.planblueprint; import org.opencdmp.authorization.AuthorizationFlags; import org.opencdmp.commons.XmlHandlingService; import org.opencdmp.commons.scope.tenant.TenantScope; -import org.opencdmp.commons.types.dmpblueprint.DefinitionEntity; +import org.opencdmp.commons.types.planblueprint.DefinitionEntity; import org.opencdmp.convention.ConventionService; -import org.opencdmp.data.DmpBlueprintEntity; +import org.opencdmp.data.PlanBlueprintEntity; import org.opencdmp.model.builder.BaseBuilder; -import org.opencdmp.model.dmpblueprint.DmpBlueprint; +import org.opencdmp.model.planblueprint.PlanBlueprint; import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.exception.MyApplicationException; import gr.cite.tools.fieldset.FieldSet; @@ -23,7 +23,7 @@ import java.util.*; @Component @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpBlueprintBuilder extends BaseBuilder { +public class PlanBlueprintBuilder extends BaseBuilder { private final BuilderFactory builderFactory; @@ -33,52 +33,52 @@ public class DmpBlueprintBuilder extends BaseBuilder authorize = EnumSet.of(AuthorizationFlags.None); @Autowired - public DmpBlueprintBuilder( + public PlanBlueprintBuilder( ConventionService conventionService, BuilderFactory builderFactory, XmlHandlingService xmlHandlingService, TenantScope tenantScope) { - super(conventionService, new LoggerService(LoggerFactory.getLogger(DmpBlueprintBuilder.class))); + super(conventionService, new LoggerService(LoggerFactory.getLogger(PlanBlueprintBuilder.class))); this.builderFactory = builderFactory; this.xmlHandlingService = xmlHandlingService; this.tenantScope = tenantScope; } - public DmpBlueprintBuilder authorize(EnumSet values) { + public PlanBlueprintBuilder authorize(EnumSet values) { this.authorize = values; return this; } @Override - public List build(FieldSet fields, List data) throws MyApplicationException { + public List build(FieldSet fields, List data) throws MyApplicationException { this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0)); this.logger.trace(new DataLogEntry("requested fields", fields)); if (fields == null || data == null || fields.isEmpty()) return new ArrayList<>(); - FieldSet definitionFields = fields.extractPrefixed(this.asPrefix(DmpBlueprint._definition)); - List models = new ArrayList<>(); - for (DmpBlueprintEntity d : data) { - DmpBlueprint m = new DmpBlueprint(); - if (fields.hasField(this.asIndexer(DmpBlueprint._id))) + FieldSet definitionFields = fields.extractPrefixed(this.asPrefix(PlanBlueprint._definition)); + List models = new ArrayList<>(); + for (PlanBlueprintEntity d : data) { + PlanBlueprint m = new PlanBlueprint(); + if (fields.hasField(this.asIndexer(PlanBlueprint._id))) m.setId(d.getId()); - if (fields.hasField(this.asIndexer(DmpBlueprint._label))) + if (fields.hasField(this.asIndexer(PlanBlueprint._label))) m.setLabel(d.getLabel()); - if (fields.hasField(this.asIndexer(DmpBlueprint._status))) + if (fields.hasField(this.asIndexer(PlanBlueprint._status))) m.setStatus(d.getStatus()); - if (fields.hasField(this.asIndexer(DmpBlueprint._groupId))) + if (fields.hasField(this.asIndexer(PlanBlueprint._groupId))) m.setGroupId(d.getGroupId()); - if (fields.hasField(this.asIndexer(DmpBlueprint._version))) + if (fields.hasField(this.asIndexer(PlanBlueprint._version))) m.setVersion(d.getVersion()); - if (fields.hasField(this.asIndexer(DmpBlueprint._versionStatus))) + if (fields.hasField(this.asIndexer(PlanBlueprint._versionStatus))) m.setVersionStatus(d.getVersionStatus()); - if (fields.hasField(this.asIndexer(DmpBlueprint._createdAt))) + if (fields.hasField(this.asIndexer(PlanBlueprint._createdAt))) m.setCreatedAt(d.getCreatedAt()); - if (fields.hasField(this.asIndexer(DmpBlueprint._updatedAt))) + if (fields.hasField(this.asIndexer(PlanBlueprint._updatedAt))) m.setUpdatedAt(d.getUpdatedAt()); - if (fields.hasField(this.asIndexer(DmpBlueprint._isActive))) + if (fields.hasField(this.asIndexer(PlanBlueprint._isActive))) m.setIsActive(d.getIsActive()); - if (fields.hasField(this.asIndexer(DmpBlueprint._hash))) + if (fields.hasField(this.asIndexer(PlanBlueprint._hash))) m.setHash(this.hashValue(d.getUpdatedAt())); - if (fields.hasField(this.asIndexer(DmpBlueprint._belongsToCurrentTenant))) m.setBelongsToCurrentTenant(this.getBelongsToCurrentTenant(d, this.tenantScope)); + if (fields.hasField(this.asIndexer(PlanBlueprint._belongsToCurrentTenant))) m.setBelongsToCurrentTenant(this.getBelongsToCurrentTenant(d, this.tenantScope)); if (!definitionFields.isEmpty() && d.getDefinition() != null) { DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(DefinitionEntity.class, d.getDefinition()); m.setDefinition(this.builderFactory.builder(DefinitionBuilder.class).authorize(this.authorize).build(definitionFields, definition)); diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/dmpblueprint/ReferenceFieldBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/ReferenceFieldBuilder.java similarity index 91% rename from backend/core/src/main/java/org/opencdmp/model/builder/dmpblueprint/ReferenceFieldBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/ReferenceFieldBuilder.java index 3703ced16..c75b426f2 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/dmpblueprint/ReferenceFieldBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/ReferenceFieldBuilder.java @@ -1,13 +1,13 @@ -package org.opencdmp.model.builder.dmpblueprint; +package org.opencdmp.model.builder.planblueprint; import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.query.QueryFactory; import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.logging.LoggerService; -import org.opencdmp.commons.types.dmpblueprint.ReferenceTypeFieldEntity; +import org.opencdmp.commons.types.planblueprint.ReferenceTypeFieldEntity; import org.opencdmp.convention.ConventionService; import org.opencdmp.model.builder.referencetype.ReferenceTypeBuilder; -import org.opencdmp.model.dmpblueprint.ReferenceTypeField; +import org.opencdmp.model.planblueprint.ReferenceTypeField; import org.opencdmp.query.ReferenceTypeQuery; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/dmpblueprint/SectionBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/SectionBuilder.java similarity index 85% rename from backend/core/src/main/java/org/opencdmp/model/builder/dmpblueprint/SectionBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/SectionBuilder.java index b82b31a9b..c40c2568a 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/dmpblueprint/SectionBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/SectionBuilder.java @@ -1,4 +1,4 @@ -package org.opencdmp.model.builder.dmpblueprint; +package org.opencdmp.model.builder.planblueprint; import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.query.QueryFactory; @@ -7,16 +7,16 @@ import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.logging.DataLogEntry; import gr.cite.tools.logging.LoggerService; import org.opencdmp.authorization.AuthorizationFlags; -import org.opencdmp.commons.enums.DmpBlueprintFieldCategory; -import org.opencdmp.commons.types.dmpblueprint.ExtraFieldEntity; -import org.opencdmp.commons.types.dmpblueprint.ReferenceTypeFieldEntity; -import org.opencdmp.commons.types.dmpblueprint.SectionEntity; -import org.opencdmp.commons.types.dmpblueprint.SystemFieldEntity; +import org.opencdmp.commons.enums.PlanBlueprintFieldCategory; +import org.opencdmp.commons.types.planblueprint.ExtraFieldEntity; +import org.opencdmp.commons.types.planblueprint.ReferenceTypeFieldEntity; +import org.opencdmp.commons.types.planblueprint.SectionEntity; +import org.opencdmp.commons.types.planblueprint.SystemFieldEntity; import org.opencdmp.convention.ConventionService; import org.opencdmp.data.PrefillingSourceEntity; import org.opencdmp.model.builder.BaseBuilder; import org.opencdmp.model.builder.prefillingsource.PrefillingSourceBuilder; -import org.opencdmp.model.dmpblueprint.Section; +import org.opencdmp.model.planblueprint.Section; import org.opencdmp.query.PrefillingSourceQuery; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -70,11 +70,11 @@ public class SectionBuilder extends BaseBuilder { if (!descriptionTemplatesFields.isEmpty() && d.getDescriptionTemplates() != null) m.setDescriptionTemplates(this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(this.authorize).build(descriptionTemplatesFields, d.getDescriptionTemplates())); if (!fieldsFields.isEmpty() && d.getFields() != null) { m.setFields(new ArrayList<>()); - List systemFieldEntities = d.getFields().stream().filter(x-> DmpBlueprintFieldCategory.System.equals(x.getCategory())).map(x-> (SystemFieldEntity)x).toList(); + List systemFieldEntities = d.getFields().stream().filter(x-> PlanBlueprintFieldCategory.System.equals(x.getCategory())).map(x-> (SystemFieldEntity)x).toList(); m.getFields().addAll(this.builderFactory.builder(SystemFieldBuilder.class).authorize(this.authorize).build(fieldsFields, systemFieldEntities)); - List extraFieldEntities = d.getFields().stream().filter(x-> DmpBlueprintFieldCategory.Extra.equals(x.getCategory())).map(x-> (ExtraFieldEntity)x).toList(); + List extraFieldEntities = d.getFields().stream().filter(x-> PlanBlueprintFieldCategory.Extra.equals(x.getCategory())).map(x-> (ExtraFieldEntity)x).toList(); m.getFields().addAll(this.builderFactory.builder(ExtraFieldBuilder.class).authorize(this.authorize).build(fieldsFields, extraFieldEntities)); - List referenceFieldEntities = d.getFields().stream().filter(x-> DmpBlueprintFieldCategory.ReferenceType.equals(x.getCategory())).map(x-> (ReferenceTypeFieldEntity)x).toList(); + List referenceFieldEntities = d.getFields().stream().filter(x-> PlanBlueprintFieldCategory.ReferenceType.equals(x.getCategory())).map(x-> (ReferenceTypeFieldEntity)x).toList(); m.getFields().addAll(this.builderFactory.builder(ReferenceFieldBuilder.class).authorize(this.authorize).build(fieldsFields, referenceFieldEntities)); } if (!prefillingSourcesFields.isEmpty() && d.getPrefillingSourcesIds() != null) { diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/dmpblueprint/SystemFieldBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/SystemFieldBuilder.java similarity index 85% rename from backend/core/src/main/java/org/opencdmp/model/builder/dmpblueprint/SystemFieldBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/SystemFieldBuilder.java index 594a2275a..4b2754e24 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/dmpblueprint/SystemFieldBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/SystemFieldBuilder.java @@ -1,8 +1,8 @@ -package org.opencdmp.model.builder.dmpblueprint; +package org.opencdmp.model.builder.planblueprint; -import org.opencdmp.commons.types.dmpblueprint.SystemFieldEntity; +import org.opencdmp.commons.types.planblueprint.SystemFieldEntity; import org.opencdmp.convention.ConventionService; -import org.opencdmp.model.dmpblueprint.SystemField; +import org.opencdmp.model.planblueprint.SystemField; import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.logging.LoggerService; import org.slf4j.LoggerFactory; diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/dmpreference/DmpReferenceBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/planreference/PlanReferenceBuilder.java similarity index 57% rename from backend/core/src/main/java/org/opencdmp/model/builder/dmpreference/DmpReferenceBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/planreference/PlanReferenceBuilder.java index 50694a364..5785f2f62 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/dmpreference/DmpReferenceBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/planreference/PlanReferenceBuilder.java @@ -1,4 +1,4 @@ -package org.opencdmp.model.builder.dmpreference; +package org.opencdmp.model.builder.planreference; import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.query.QueryFactory; @@ -10,16 +10,16 @@ import gr.cite.tools.logging.LoggerService; import org.opencdmp.authorization.AuthorizationFlags; import org.opencdmp.commons.JsonHandlingService; import org.opencdmp.commons.scope.tenant.TenantScope; -import org.opencdmp.commons.types.dmpreference.DmpReferenceDataEntity; +import org.opencdmp.commons.types.planreference.PlanReferenceDataEntity; import org.opencdmp.convention.ConventionService; -import org.opencdmp.data.DmpReferenceEntity; +import org.opencdmp.data.PlanReferenceEntity; import org.opencdmp.model.builder.BaseBuilder; -import org.opencdmp.model.builder.dmp.DmpBuilder; +import org.opencdmp.model.builder.plan.PlanBuilder; import org.opencdmp.model.builder.reference.ReferenceBuilder; -import org.opencdmp.model.dmp.Dmp; -import org.opencdmp.model.dmpreference.DmpReference; +import org.opencdmp.model.plan.Plan; +import org.opencdmp.model.planreference.PlanReference; import org.opencdmp.model.reference.Reference; -import org.opencdmp.query.DmpQuery; +import org.opencdmp.query.PlanQuery; import org.opencdmp.query.ReferenceQuery; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -32,7 +32,7 @@ import java.util.stream.Collectors; @Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpReferenceBuilder extends BaseBuilder { +public class PlanReferenceBuilder extends BaseBuilder { private final BuilderFactory builderFactory; @@ -43,49 +43,49 @@ public class DmpReferenceBuilder extends BaseBuilder authorize = EnumSet.of(AuthorizationFlags.None); @Autowired - public DmpReferenceBuilder( + public PlanReferenceBuilder( ConventionService conventionService, BuilderFactory builderFactory, QueryFactory queryFactory, JsonHandlingService jsonHandlingService, TenantScope tenantScope) { - super(conventionService, new LoggerService(LoggerFactory.getLogger(DmpReferenceBuilder.class))); + super(conventionService, new LoggerService(LoggerFactory.getLogger(PlanReferenceBuilder.class))); this.builderFactory = builderFactory; this.queryFactory = queryFactory; this.jsonHandlingService = jsonHandlingService; this.tenantScope = tenantScope; } - public DmpReferenceBuilder authorize(EnumSet values) { + public PlanReferenceBuilder authorize(EnumSet values) { this.authorize = values; return this; } @Override - public List build(FieldSet fields, List data) throws MyApplicationException { + public List build(FieldSet fields, List data) throws MyApplicationException { this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0)); this.logger.trace(new DataLogEntry("requested fields", fields)); if (fields == null || data == null || fields.isEmpty()) return new ArrayList<>(); - FieldSet referenceFields = fields.extractPrefixed(this.asPrefix(DmpReference._reference)); + FieldSet referenceFields = fields.extractPrefixed(this.asPrefix(PlanReference._reference)); Map referenceItemsMap = this.collectReferences(referenceFields, data); - FieldSet dmpFields = fields.extractPrefixed(this.asPrefix(DmpReference._dmp)); - Map dmpItemsMap = this.collectDmps(dmpFields, data); + FieldSet planFields = fields.extractPrefixed(this.asPrefix(PlanReference._plan)); + Map planItemsMap = this.collectPlans(planFields, data); - FieldSet dataFields = fields.extractPrefixed(this.asPrefix(DmpReference._data)); - List models = new ArrayList<>(); - for (DmpReferenceEntity d : data) { - DmpReference m = new DmpReference(); - if (fields.hasField(this.asIndexer(DmpReference._id))) m.setId(d.getId()); - if (fields.hasField(this.asIndexer(DmpReference._isActive))) m.setIsActive(d.getIsActive()); - if (fields.hasField(this.asIndexer(DmpReference._createdAt))) m.setCreatedAt(d.getCreatedAt()); - if (fields.hasField(this.asIndexer(DmpReference._updatedAt))) m.setUpdatedAt(d.getUpdatedAt()); - if (fields.hasField(this.asIndexer(DmpReference._hash))) m.setHash(this.hashValue(d.getUpdatedAt())); - if (fields.hasField(this.asIndexer(DmpReference._belongsToCurrentTenant))) m.setBelongsToCurrentTenant(this.getBelongsToCurrentTenant(d, this.tenantScope)); + FieldSet dataFields = fields.extractPrefixed(this.asPrefix(PlanReference._data)); + List models = new ArrayList<>(); + for (PlanReferenceEntity d : data) { + PlanReference m = new PlanReference(); + if (fields.hasField(this.asIndexer(PlanReference._id))) m.setId(d.getId()); + if (fields.hasField(this.asIndexer(PlanReference._isActive))) m.setIsActive(d.getIsActive()); + if (fields.hasField(this.asIndexer(PlanReference._createdAt))) m.setCreatedAt(d.getCreatedAt()); + if (fields.hasField(this.asIndexer(PlanReference._updatedAt))) m.setUpdatedAt(d.getUpdatedAt()); + if (fields.hasField(this.asIndexer(PlanReference._hash))) m.setHash(this.hashValue(d.getUpdatedAt())); + if (fields.hasField(this.asIndexer(PlanReference._belongsToCurrentTenant))) m.setBelongsToCurrentTenant(this.getBelongsToCurrentTenant(d, this.tenantScope)); if (!referenceFields.isEmpty() && referenceItemsMap != null && referenceItemsMap.containsKey(d.getReferenceId())) m.setReference(referenceItemsMap.get(d.getReferenceId())); - if (!dmpFields.isEmpty() && dmpItemsMap != null && dmpItemsMap.containsKey(d.getDmpId())) m.setDmp(dmpItemsMap.get(d.getDmpId())); + if (!planFields.isEmpty() && planItemsMap != null && planItemsMap.containsKey(d.getPlanId())) m.setPlan(planItemsMap.get(d.getPlanId())); if (!dataFields.isEmpty() && d.getData() != null){ - DmpReferenceDataEntity propertyDefinition = this.jsonHandlingService.fromJsonSafe(DmpReferenceDataEntity.class, d.getData()); - m.setData(this.builderFactory.builder(DmpReferenceDataBuilder.class).authorize(this.authorize).build(dataFields, propertyDefinition)); + PlanReferenceDataEntity propertyDefinition = this.jsonHandlingService.fromJsonSafe(PlanReferenceDataEntity.class, d.getData()); + m.setData(this.builderFactory.builder(PlanReferenceDataBuilder.class).authorize(this.authorize).build(dataFields, propertyDefinition)); } models.add(m); } @@ -93,7 +93,7 @@ public class DmpReferenceBuilder extends BaseBuilder collectReferences(FieldSet fields, List data) throws MyApplicationException { + private Map collectReferences(FieldSet fields, List data) throws MyApplicationException { if (fields.isEmpty() || data.isEmpty()) return null; this.logger.debug("checking related - {}", Reference.class.getSimpleName()); @@ -101,7 +101,7 @@ public class DmpReferenceBuilder extends BaseBuilder itemMap; if (!fields.hasOtherField(this.asIndexer(Reference._id))) { itemMap = this.asEmpty( - data.stream().map(DmpReferenceEntity::getReferenceId).distinct().collect(Collectors.toList()), + data.stream().map(PlanReferenceEntity::getReferenceId).distinct().collect(Collectors.toList()), x -> { Reference item = new Reference(); item.setId(x); @@ -110,7 +110,7 @@ public class DmpReferenceBuilder extends BaseBuilder collectDmps(FieldSet fields, List data) throws MyApplicationException { + private Map collectPlans(FieldSet fields, List data) throws MyApplicationException { if (fields.isEmpty() || data.isEmpty()) return null; - this.logger.debug("checking related - {}", Dmp.class.getSimpleName()); + this.logger.debug("checking related - {}", Plan.class.getSimpleName()); - Map itemMap; - if (!fields.hasOtherField(this.asIndexer(Dmp._id))) { + Map itemMap; + if (!fields.hasOtherField(this.asIndexer(Plan._id))) { itemMap = this.asEmpty( - data.stream().map(DmpReferenceEntity::getDmpId).distinct().collect(Collectors.toList()), + data.stream().map(PlanReferenceEntity::getPlanId).distinct().collect(Collectors.toList()), x -> { - Dmp item = new Dmp(); + Plan item = new Plan(); item.setId(x); return item; }, - Dmp::getId); + Plan::getId); } else { - FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Dmp._id); - DmpQuery q = this.queryFactory.query(DmpQuery.class).authorize(this.authorize).disableTracking().ids(data.stream().map(DmpReferenceEntity::getDmpId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(DmpBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Dmp::getId); + FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Plan._id); + PlanQuery q = this.queryFactory.query(PlanQuery.class).authorize(this.authorize).disableTracking().ids(data.stream().map(PlanReferenceEntity::getPlanId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(PlanBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Plan::getId); } - if (!fields.hasField(Dmp._id)) { + if (!fields.hasField(Plan._id)) { itemMap.values().stream().filter(Objects::nonNull).forEach(x -> x.setId(null)); } diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/dmpreference/DmpReferenceDataBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/planreference/PlanReferenceDataBuilder.java similarity index 62% rename from backend/core/src/main/java/org/opencdmp/model/builder/dmpreference/DmpReferenceDataBuilder.java rename to backend/core/src/main/java/org/opencdmp/model/builder/planreference/PlanReferenceDataBuilder.java index 5e6e6a7e4..2490e62af 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/dmpreference/DmpReferenceDataBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/planreference/PlanReferenceDataBuilder.java @@ -1,11 +1,10 @@ -package org.opencdmp.model.builder.dmpreference; +package org.opencdmp.model.builder.planreference; import org.opencdmp.authorization.AuthorizationFlags; -import org.opencdmp.commons.types.dmpreference.DmpReferenceDataEntity; +import org.opencdmp.commons.types.planreference.PlanReferenceDataEntity; import org.opencdmp.convention.ConventionService; import org.opencdmp.model.builder.BaseBuilder; -import org.opencdmp.model.dmpreference.DmpReferenceData; -import gr.cite.tools.data.builder.BuilderFactory; +import org.opencdmp.model.planreference.PlanReferenceData; import gr.cite.tools.exception.MyApplicationException; import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.logging.DataLogEntry; @@ -18,25 +17,25 @@ import org.springframework.stereotype.Component; import java.util.*; -@Component("referencedmpreferencedatabuilder") +@Component("referenceplanreferencedatabuilder") @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpReferenceDataBuilder extends BaseBuilder { +public class PlanReferenceDataBuilder extends BaseBuilder { private EnumSet authorize = EnumSet.of(AuthorizationFlags.None); @Autowired - public DmpReferenceDataBuilder( + public PlanReferenceDataBuilder( ConventionService conventionService) { - super(conventionService, new LoggerService(LoggerFactory.getLogger(DmpReferenceDataBuilder.class))); + super(conventionService, new LoggerService(LoggerFactory.getLogger(PlanReferenceDataBuilder.class))); } - public DmpReferenceDataBuilder authorize(EnumSet values) { + public PlanReferenceDataBuilder authorize(EnumSet values) { this.authorize = values; return this; } @Override - public List build(FieldSet fields, List data) throws MyApplicationException { + public List build(FieldSet fields, List data) throws MyApplicationException { this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0)); this.logger.trace(new DataLogEntry("requested fields", fields)); if (fields == null || data == null || fields.isEmpty()) @@ -44,10 +43,10 @@ public class DmpReferenceDataBuilder extends BaseBuilder models = new ArrayList<>(); - for (DmpReferenceDataEntity d : data) { - DmpReferenceData m = new DmpReferenceData(); - if (fields.hasField(this.asIndexer(DmpReferenceData._blueprintFieldId))) m.setBlueprintFieldId(d.getBlueprintFieldId()); + List models = new ArrayList<>(); + for (PlanReferenceDataEntity d : data) { + PlanReferenceData m = new PlanReferenceData(); + if (fields.hasField(this.asIndexer(PlanReferenceData._blueprintFieldId))) m.setBlueprintFieldId(d.getBlueprintFieldId()); models.add(m); } this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0)); diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/reference/ReferenceBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/reference/ReferenceBuilder.java index e625be10d..fa705e4e8 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/reference/ReferenceBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/reference/ReferenceBuilder.java @@ -15,13 +15,13 @@ import org.opencdmp.convention.ConventionService; import org.opencdmp.data.ReferenceEntity; import org.opencdmp.model.builder.BaseBuilder; import org.opencdmp.model.builder.UserBuilder; -import org.opencdmp.model.builder.dmpreference.DmpReferenceBuilder; +import org.opencdmp.model.builder.planreference.PlanReferenceBuilder; import org.opencdmp.model.builder.referencetype.ReferenceTypeBuilder; -import org.opencdmp.model.dmpreference.DmpReference; +import org.opencdmp.model.planreference.PlanReference; import org.opencdmp.model.reference.Reference; import org.opencdmp.model.referencetype.ReferenceType; import org.opencdmp.model.user.User; -import org.opencdmp.query.DmpReferenceQuery; +import org.opencdmp.query.PlanReferenceQuery; import org.opencdmp.query.ReferenceTypeQuery; import org.opencdmp.query.UserQuery; import org.slf4j.LoggerFactory; @@ -69,8 +69,8 @@ public class ReferenceBuilder extends BaseBuilder { //ToDo FieldSet userInfoFields = fields.extractPrefixed(this.asPrefix(Reference._createdBy)); FieldSet definitionFields = fields.extractPrefixed(this.asPrefix(Reference._definition)); - FieldSet dmpReferencesFields = fields.extractPrefixed(this.asPrefix(Reference._dmpReferences)); - Map> dmpReferenceMap = this.collectDmpReferences(dmpReferencesFields, data); + FieldSet planReferencesFields = fields.extractPrefixed(this.asPrefix(Reference._planReferences)); + Map> planReferenceMap = this.collectPlanReferences(planReferencesFields, data); FieldSet userFields = fields.extractPrefixed(this.asPrefix(Reference._createdBy)); Map userItemsMap = this.collectUsers(userFields, data); @@ -97,7 +97,7 @@ public class ReferenceBuilder extends BaseBuilder { if (fields.hasField(this.asIndexer(Reference._source))) m.setSource(d.getSource()); if (fields.hasField(this.asIndexer(Reference._sourceType))) m.setSourceType(d.getSourceType()); if (!typeFields.isEmpty() && typeItemsMap != null && typeItemsMap.containsKey(d.getTypeId())) m.setType(typeItemsMap.get(d.getTypeId())); - if (dmpReferenceMap != null && !dmpReferenceMap.isEmpty() && dmpReferenceMap.containsKey(d.getId())) m.setDmpReferences(dmpReferenceMap.get(d.getId())); + if (planReferenceMap != null && !planReferenceMap.isEmpty() && planReferenceMap.containsKey(d.getId())) m.setPlanReferences(planReferenceMap.get(d.getId())); if (!userFields.isEmpty() && userItemsMap != null && userItemsMap.containsKey(d.getCreatedById())) m.setCreatedBy(userItemsMap.get(d.getCreatedById())); if (fields.hasField(this.asIndexer(Reference._belongsToCurrentTenant))) m.setBelongsToCurrentTenant(this.getBelongsToCurrentTenant(d, this.tenantScope)); models.add(m); @@ -166,16 +166,16 @@ public class ReferenceBuilder extends BaseBuilder { return itemMap; } - private Map> collectDmpReferences(FieldSet fields, List data) throws MyApplicationException { + private Map> collectPlanReferences(FieldSet fields, List data) throws MyApplicationException { if (fields.isEmpty() || data.isEmpty()) return null; - this.logger.debug("checking related - {}", DmpReference.class.getSimpleName()); + this.logger.debug("checking related - {}", PlanReference.class.getSimpleName()); - Map> itemMap = null; - FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DmpReference._reference, Reference._id)); - DmpReferenceQuery query = this.queryFactory.query(DmpReferenceQuery.class).disableTracking().authorize(this.authorize).referenceIds(data.stream().map(ReferenceEntity::getId).distinct().collect(Collectors.toList())); - itemMap = this.builderFactory.builder(DmpReferenceBuilder.class).authorize(this.authorize).authorize(this.authorize).asMasterKey(query, clone, x -> x.getReference().getId()); + Map> itemMap = null; + FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(PlanReference._reference, Reference._id)); + PlanReferenceQuery query = this.queryFactory.query(PlanReferenceQuery.class).disableTracking().authorize(this.authorize).referenceIds(data.stream().map(ReferenceEntity::getId).distinct().collect(Collectors.toList())); + itemMap = this.builderFactory.builder(PlanReferenceBuilder.class).authorize(this.authorize).authorize(this.authorize).asMasterKey(query, clone, x -> x.getReference().getId()); - if (!fields.hasField(this.asIndexer(DmpReference._reference, Reference._id))) { + if (!fields.hasField(this.asIndexer(PlanReference._reference, Reference._id))) { itemMap.values().stream().flatMap(List::stream).filter(x -> x != null && x.getReference() != null).map(x -> { x.getReference().setId(null); return x; diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/DmpAssociatedUserCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/PlanAssociatedUserCensor.java similarity index 77% rename from backend/core/src/main/java/org/opencdmp/model/censorship/DmpAssociatedUserCensor.java rename to backend/core/src/main/java/org/opencdmp/model/censorship/PlanAssociatedUserCensor.java index bd341b0c2..f9d7c50b2 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/DmpAssociatedUserCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/PlanAssociatedUserCensor.java @@ -17,14 +17,14 @@ import java.util.UUID; @Component @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpAssociatedUserCensor extends BaseCensor { +public class PlanAssociatedUserCensor extends BaseCensor { - private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpAssociatedUserCensor.class)); + private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PlanAssociatedUserCensor.class)); protected final AuthorizationService authService; - public DmpAssociatedUserCensor(ConventionService conventionService, AuthorizationService authService) { + public PlanAssociatedUserCensor(ConventionService conventionService, AuthorizationService authService) { super(conventionService); this.authService = authService; } @@ -33,7 +33,7 @@ public class DmpAssociatedUserCensor extends BaseCensor { logger.debug(new DataLogEntry("censoring fields", fields)); if (fields == null || fields.isEmpty()) return; - this.authService.authorizeAtLeastOneForce(userId != null ? List.of(new OwnedResource(userId)) : null, Permission.BrowseDmpAssociatedUser, Permission.DeferredAffiliation); + this.authService.authorizeAtLeastOneForce(userId != null ? List.of(new OwnedResource(userId)) : null, Permission.BrowsePlanAssociatedUser, Permission.DeferredAffiliation); } } diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/DmpDescriptionTemplateCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/PlanDescriptionTemplateCensor.java similarity index 67% rename from backend/core/src/main/java/org/opencdmp/model/censorship/DmpDescriptionTemplateCensor.java rename to backend/core/src/main/java/org/opencdmp/model/censorship/PlanDescriptionTemplateCensor.java index f10c9cbbf..2a4e19f98 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/DmpDescriptionTemplateCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/PlanDescriptionTemplateCensor.java @@ -2,14 +2,14 @@ package org.opencdmp.model.censorship; import org.opencdmp.authorization.Permission; import org.opencdmp.convention.ConventionService; -import org.opencdmp.model.DmpDescriptionTemplate; +import org.opencdmp.model.PlanDescriptionTemplate; import gr.cite.commons.web.authz.service.AuthorizationService; import gr.cite.tools.data.censor.CensorFactory; import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.logging.DataLogEntry; import gr.cite.tools.logging.LoggerService; import org.opencdmp.model.censorship.descriptiontemplate.DescriptionTemplateCensor; -import org.opencdmp.model.censorship.dmp.DmpCensor; +import org.opencdmp.model.censorship.plan.PlanCensor; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; @@ -19,17 +19,17 @@ import java.util.UUID; @Component @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpDescriptionTemplateCensor extends BaseCensor{ +public class PlanDescriptionTemplateCensor extends BaseCensor{ - private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpDescriptionTemplateCensor.class)); + private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PlanDescriptionTemplateCensor.class)); protected final AuthorizationService authService; protected final CensorFactory censorFactory; - public DmpDescriptionTemplateCensor(ConventionService conventionService, - AuthorizationService authService, - CensorFactory censorFactory) { + public PlanDescriptionTemplateCensor(ConventionService conventionService, + AuthorizationService authService, + CensorFactory censorFactory) { super(conventionService); this.authService = authService; this.censorFactory = censorFactory; @@ -41,11 +41,11 @@ public class DmpDescriptionTemplateCensor extends BaseCensor{ return; this.authService.authorizeForce(Permission.BrowseDescription, Permission.DeferredAffiliation); - FieldSet dmpFields = fields.extractPrefixed(this.asIndexerPrefix(DmpDescriptionTemplate._dmp)); - this.censorFactory.censor(DmpCensor.class).censor(dmpFields, userId); - FieldSet descriptionTemplatesFields = fields.extractPrefixed(this.asIndexerPrefix(DmpDescriptionTemplate._descriptionTemplates)); + FieldSet planFields = fields.extractPrefixed(this.asIndexerPrefix(PlanDescriptionTemplate._plan)); + this.censorFactory.censor(PlanCensor.class).censor(planFields, userId); + FieldSet descriptionTemplatesFields = fields.extractPrefixed(this.asIndexerPrefix(PlanDescriptionTemplate._descriptionTemplates)); this.censorFactory.censor(DescriptionTemplateCensor.class).censor(descriptionTemplatesFields, userId); - FieldSet currentDescriptionTemplateFields = fields.extractPrefixed(this.asIndexerPrefix(DmpDescriptionTemplate._currentDescriptionTemplate)); + FieldSet currentDescriptionTemplateFields = fields.extractPrefixed(this.asIndexerPrefix(PlanDescriptionTemplate._currentDescriptionTemplate)); this.censorFactory.censor(DescriptionTemplateCensor.class).censor(currentDescriptionTemplateFields, userId); } diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/DmpUserCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/PlanUserCensor.java similarity index 68% rename from backend/core/src/main/java/org/opencdmp/model/censorship/DmpUserCensor.java rename to backend/core/src/main/java/org/opencdmp/model/censorship/PlanUserCensor.java index 61a37b93e..5409350b6 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/DmpUserCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/PlanUserCensor.java @@ -2,13 +2,13 @@ package org.opencdmp.model.censorship; import org.opencdmp.authorization.Permission; import org.opencdmp.convention.ConventionService; -import org.opencdmp.model.DmpUser; +import org.opencdmp.model.PlanUser; import gr.cite.commons.web.authz.service.AuthorizationService; import gr.cite.tools.data.censor.CensorFactory; import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.logging.DataLogEntry; import gr.cite.tools.logging.LoggerService; -import org.opencdmp.model.censorship.dmp.DmpCensor; +import org.opencdmp.model.censorship.plan.PlanCensor; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; @@ -18,14 +18,14 @@ import java.util.UUID; @Component @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpUserCensor extends BaseCensor { +public class PlanUserCensor extends BaseCensor { - private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpUserCensor.class)); + private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PlanUserCensor.class)); protected final AuthorizationService authService; protected final CensorFactory censorFactory; - public DmpUserCensor(ConventionService conventionService, AuthorizationService authService, CensorFactory censorFactory) { + public PlanUserCensor(ConventionService conventionService, AuthorizationService authService, CensorFactory censorFactory) { super(conventionService); this.authService = authService; this.censorFactory = censorFactory; @@ -36,10 +36,10 @@ public class DmpUserCensor extends BaseCensor { if (fields == null || fields.isEmpty()) return; - this.authService.authorizeForce(Permission.BrowseDmpUser, Permission.DeferredAffiliation); - FieldSet dmpFields = fields.extractPrefixed(this.asIndexerPrefix(DmpUser._dmp)); - this.censorFactory.censor(DmpCensor.class).censor(dmpFields, userId); - FieldSet userFields = fields.extractPrefixed(this.asIndexerPrefix(DmpUser._user)); + this.authService.authorizeForce(Permission.BrowsePlanUser, Permission.DeferredAffiliation); + FieldSet planFields = fields.extractPrefixed(this.asIndexerPrefix(PlanUser._plan)); + this.censorFactory.censor(PlanCensor.class).censor(planFields, userId); + FieldSet userFields = fields.extractPrefixed(this.asIndexerPrefix(PlanUser._user)); this.censorFactory.censor(UserCensor.class).censor(userFields, userId); } diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/PublicDescriptionCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/PublicDescriptionCensor.java index 50ad32f4e..0ef57ff82 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/PublicDescriptionCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/PublicDescriptionCensor.java @@ -36,8 +36,8 @@ public class PublicDescriptionCensor extends BaseCensor { this.authService.authorizeForce(Permission.PublicBrowseDescription); - FieldSet dmpDescriptionTemplateFields = fields.extractPrefixed(this.asIndexerPrefix(PublicDescription._dmpDescriptionTemplate)); - this.censorFactory.censor(PublicDmpDescriptionTemplateCensor.class).censor(dmpDescriptionTemplateFields); + FieldSet planDescriptionTemplateFields = fields.extractPrefixed(this.asIndexerPrefix(PublicDescription._planDescriptionTemplate)); + this.censorFactory.censor(PublicPlanDescriptionTemplateCensor.class).censor(planDescriptionTemplateFields); FieldSet descriptionTemplateFields = fields.extractPrefixed(this.asIndexerPrefix(PublicDescription._descriptionTemplate)); this.censorFactory.censor(PublicDescriptionTemplateCensor.class).censor(descriptionTemplateFields); diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/PublicDmpCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/PublicPlanCensor.java similarity index 55% rename from backend/core/src/main/java/org/opencdmp/model/censorship/PublicDmpCensor.java rename to backend/core/src/main/java/org/opencdmp/model/censorship/PublicPlanCensor.java index 7e3a43605..28a9d2766 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/PublicDmpCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/PublicPlanCensor.java @@ -2,7 +2,7 @@ package org.opencdmp.model.censorship; import org.opencdmp.authorization.Permission; import org.opencdmp.convention.ConventionService; -import org.opencdmp.model.PublicDmp; +import org.opencdmp.model.PublicPlan; import gr.cite.commons.web.authz.service.AuthorizationService; import gr.cite.tools.data.censor.CensorFactory; import gr.cite.tools.fieldset.FieldSet; @@ -13,21 +13,19 @@ import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; -import java.util.UUID; - @Component @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class PublicDmpCensor extends BaseCensor { +public class PublicPlanCensor extends BaseCensor { - private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PublicDmpCensor.class)); + private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PublicPlanCensor.class)); protected final AuthorizationService authService; protected final CensorFactory censorFactory; - public PublicDmpCensor(ConventionService conventionService, - AuthorizationService authService, - CensorFactory censorFactory) { + public PublicPlanCensor(ConventionService conventionService, + AuthorizationService authService, + CensorFactory censorFactory) { super(conventionService); this.authService = authService; this.censorFactory = censorFactory; @@ -40,12 +38,12 @@ public class PublicDmpCensor extends BaseCensor { this.authService.authorizeForce(Permission.PublicBrowseDmp); - FieldSet dmpDescriptionsFields = fields.extractPrefixed(this.asIndexerPrefix(PublicDmp._dmpUsers)); - this.censorFactory.censor(PublicDmpUserCensor.class).censor(dmpDescriptionsFields); - FieldSet dmpReferencesFields = fields.extractPrefixed(this.asIndexerPrefix(PublicDmp._dmpReferences)); - this.censorFactory.censor(PublicDmpReferenceCensor.class).censor(dmpReferencesFields); - FieldSet otherDmpVersionsFields = fields.extractPrefixed(this.asIndexerPrefix(PublicDmp._otherDmpVersions)); - this.censorFactory.censor(PublicDmpCensor.class).censor(otherDmpVersionsFields); + FieldSet planDescriptionsFields = fields.extractPrefixed(this.asIndexerPrefix(PublicPlan._planUsers)); + this.censorFactory.censor(PublicPlanUserCensor.class).censor(planDescriptionsFields); + FieldSet planReferencesFields = fields.extractPrefixed(this.asIndexerPrefix(PublicPlan._planReferences)); + this.censorFactory.censor(PublicPlanReferenceCensor.class).censor(planReferencesFields); + FieldSet otherPlanVersionsFields = fields.extractPrefixed(this.asIndexerPrefix(PublicPlan._otherPlanVersions)); + this.censorFactory.censor(PublicPlanCensor.class).censor(otherPlanVersionsFields); } } diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/PublicDmpDescriptionTemplateCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/PublicPlanDescriptionTemplateCensor.java similarity index 65% rename from backend/core/src/main/java/org/opencdmp/model/censorship/PublicDmpDescriptionTemplateCensor.java rename to backend/core/src/main/java/org/opencdmp/model/censorship/PublicPlanDescriptionTemplateCensor.java index 20895c2e2..323896e33 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/PublicDmpDescriptionTemplateCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/PublicPlanDescriptionTemplateCensor.java @@ -2,7 +2,7 @@ package org.opencdmp.model.censorship; import org.opencdmp.authorization.Permission; import org.opencdmp.convention.ConventionService; -import org.opencdmp.model.PublicDmpDescriptionTemplate; +import org.opencdmp.model.PublicPlanDescriptionTemplate; import gr.cite.commons.web.authz.service.AuthorizationService; import gr.cite.tools.data.censor.CensorFactory; import gr.cite.tools.fieldset.FieldSet; @@ -15,17 +15,17 @@ import org.springframework.stereotype.Component; @Component @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class PublicDmpDescriptionTemplateCensor extends BaseCensor{ +public class PublicPlanDescriptionTemplateCensor extends BaseCensor{ - private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PublicDmpDescriptionTemplateCensor.class)); + private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PublicPlanDescriptionTemplateCensor.class)); protected final AuthorizationService authService; protected final CensorFactory censorFactory; - public PublicDmpDescriptionTemplateCensor(ConventionService conventionService, - AuthorizationService authService, - CensorFactory censorFactory) { + public PublicPlanDescriptionTemplateCensor(ConventionService conventionService, + AuthorizationService authService, + CensorFactory censorFactory) { super(conventionService); this.authService = authService; this.censorFactory = censorFactory; @@ -37,8 +37,8 @@ public class PublicDmpDescriptionTemplateCensor extends BaseCensor{ return; this.authService.authorizeForce(Permission.PublicBrowseDescription); - FieldSet dmpFields = fields.extractPrefixed(this.asIndexerPrefix(PublicDmpDescriptionTemplate._dmp)); - this.censorFactory.censor(PublicDmpCensor.class).censor(dmpFields); + FieldSet planFields = fields.extractPrefixed(this.asIndexerPrefix(PublicPlanDescriptionTemplate._plan)); + this.censorFactory.censor(PublicPlanCensor.class).censor(planFields); } } diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/PublicDmpReferenceCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/PublicPlanReferenceCensor.java similarity index 65% rename from backend/core/src/main/java/org/opencdmp/model/censorship/PublicDmpReferenceCensor.java rename to backend/core/src/main/java/org/opencdmp/model/censorship/PublicPlanReferenceCensor.java index dbd5129dd..a9ce7f885 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/PublicDmpReferenceCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/PublicPlanReferenceCensor.java @@ -2,9 +2,7 @@ package org.opencdmp.model.censorship; import org.opencdmp.authorization.Permission; import org.opencdmp.convention.ConventionService; -import org.opencdmp.model.DmpDescriptionTemplate; -import org.opencdmp.model.PublicDmpDescriptionTemplate; -import org.opencdmp.model.PublicDmpReference; +import org.opencdmp.model.PublicPlanReference; import gr.cite.commons.web.authz.service.AuthorizationService; import gr.cite.tools.data.censor.CensorFactory; import gr.cite.tools.fieldset.FieldSet; @@ -15,20 +13,18 @@ import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; -import java.util.UUID; - @Component @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class PublicDmpReferenceCensor extends BaseCensor { +public class PublicPlanReferenceCensor extends BaseCensor { - private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PublicDmpReferenceCensor.class)); + private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PublicPlanReferenceCensor.class)); protected final AuthorizationService authService; protected final CensorFactory censorFactory; - public PublicDmpReferenceCensor(ConventionService conventionService, - AuthorizationService authService, - CensorFactory censorFactory) { + public PublicPlanReferenceCensor(ConventionService conventionService, + AuthorizationService authService, + CensorFactory censorFactory) { super(conventionService); this.authService = authService; this.censorFactory = censorFactory; @@ -40,9 +36,9 @@ public class PublicDmpReferenceCensor extends BaseCensor { return; this.authService.authorizeForce(Permission.PublicBrowseDmpReference); - FieldSet dmpFields = fields.extractPrefixed(this.asIndexerPrefix(PublicDmpReference._dmp)); - this.censorFactory.censor(PublicDmpCensor.class).censor(dmpFields); - FieldSet templateFields = fields.extractPrefixed(this.asIndexerPrefix(PublicDmpReference._reference)); + FieldSet planFields = fields.extractPrefixed(this.asIndexerPrefix(PublicPlanReference._plan)); + this.censorFactory.censor(PublicPlanCensor.class).censor(planFields); + FieldSet templateFields = fields.extractPrefixed(this.asIndexerPrefix(PublicPlanReference._reference)); this.censorFactory.censor(PublicReferenceCensor.class).censor(templateFields); } diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/PublicDmpUserCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/PublicPlanUserCensor.java similarity index 73% rename from backend/core/src/main/java/org/opencdmp/model/censorship/PublicDmpUserCensor.java rename to backend/core/src/main/java/org/opencdmp/model/censorship/PublicPlanUserCensor.java index cd65aa18e..728a14cec 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/PublicDmpUserCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/PublicPlanUserCensor.java @@ -2,7 +2,7 @@ package org.opencdmp.model.censorship; import org.opencdmp.authorization.Permission; import org.opencdmp.convention.ConventionService; -import org.opencdmp.model.PublicDmpUser; +import org.opencdmp.model.PublicPlanUser; import gr.cite.commons.web.authz.service.AuthorizationService; import gr.cite.tools.data.censor.CensorFactory; import gr.cite.tools.fieldset.FieldSet; @@ -15,14 +15,14 @@ import org.springframework.stereotype.Component; @Component @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class PublicDmpUserCensor extends BaseCensor { +public class PublicPlanUserCensor extends BaseCensor { - private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PublicDmpUserCensor.class)); + private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PublicPlanUserCensor.class)); protected final AuthorizationService authService; protected final CensorFactory censorFactory; - public PublicDmpUserCensor(ConventionService conventionService, AuthorizationService authService, CensorFactory censorFactory) { + public PublicPlanUserCensor(ConventionService conventionService, AuthorizationService authService, CensorFactory censorFactory) { super(conventionService); this.authService = authService; this.censorFactory = censorFactory; @@ -34,9 +34,9 @@ public class PublicDmpUserCensor extends BaseCensor { return; this.authService.authorizeForce(Permission.PublicBrowseDmpUser); - FieldSet dmpFields = fields.extractPrefixed(this.asIndexerPrefix(PublicDmpUser._dmp)); - this.censorFactory.censor(PublicDmpCensor.class).censor(dmpFields); - FieldSet userFields = fields.extractPrefixed(this.asIndexerPrefix(PublicDmpUser._user)); + FieldSet planFields = fields.extractPrefixed(this.asIndexerPrefix(PublicPlanUser._plan)); + this.censorFactory.censor(PublicPlanCensor.class).censor(planFields); + FieldSet userFields = fields.extractPrefixed(this.asIndexerPrefix(PublicPlanUser._user)); this.censorFactory.censor(PublicUserCensor.class).censor(userFields); } diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/PublicReferenceTypeCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/PublicReferenceTypeCensor.java index f5ae8405d..a6923ecae 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/PublicReferenceTypeCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/PublicReferenceTypeCensor.java @@ -2,7 +2,6 @@ package org.opencdmp.model.censorship; import org.opencdmp.authorization.Permission; import org.opencdmp.convention.ConventionService; -import org.opencdmp.model.PublicDmpUser; import gr.cite.commons.web.authz.service.AuthorizationService; import gr.cite.tools.data.censor.CensorFactory; import gr.cite.tools.fieldset.FieldSet; diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/RecentActivityItemCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/RecentActivityItemCensor.java index dd1bbe2a2..0fa73c008 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/RecentActivityItemCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/RecentActivityItemCensor.java @@ -8,7 +8,7 @@ import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.logging.DataLogEntry; import gr.cite.tools.logging.LoggerService; import org.opencdmp.model.censorship.description.DescriptionCensor; -import org.opencdmp.model.censorship.dmp.DmpCensor; +import org.opencdmp.model.censorship.plan.PlanCensor; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; @@ -37,8 +37,8 @@ public class RecentActivityItemCensor extends BaseCensor { if (fields == null || fields.isEmpty()) return; - FieldSet dmpFields = fields.extractPrefixed(this.asIndexerPrefix(RecentActivityItem._dmp)); - this.censorFactory.censor(DmpCensor.class).censor(dmpFields, userId); + FieldSet planFields = fields.extractPrefixed(this.asIndexerPrefix(RecentActivityItem._plan)); + this.censorFactory.censor(PlanCensor.class).censor(planFields, userId); FieldSet descriptionFields = fields.extractPrefixed(this.asIndexerPrefix(RecentActivityItem._description)); this.censorFactory.censor(DescriptionCensor.class).censor(descriptionFields, userId); diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/description/DescriptionCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/description/DescriptionCensor.java index b25876add..21d7a6568 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/description/DescriptionCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/description/DescriptionCensor.java @@ -5,7 +5,7 @@ import org.opencdmp.convention.ConventionService; import org.opencdmp.model.censorship.*; import org.opencdmp.model.censorship.descriptionreference.DescriptionReferenceCensor; import org.opencdmp.model.censorship.descriptiontemplate.DescriptionTemplateCensor; -import org.opencdmp.model.censorship.dmp.DmpCensor; +import org.opencdmp.model.censorship.plan.PlanCensor; import org.opencdmp.model.description.Description; import gr.cite.commons.web.authz.service.AuthorizationService; import gr.cite.tools.data.censor.CensorFactory; @@ -48,14 +48,14 @@ public class DescriptionCensor extends BaseCensor { FieldSet descriptionTagsFields = fields.extractPrefixed(this.asIndexerPrefix(Description._descriptionTags)); this.censorFactory.censor(DescriptionTagCensor.class).censor(descriptionTagsFields, userId); - FieldSet dmpDescriptionTemplateFields = fields.extractPrefixed(this.asIndexerPrefix(Description._dmpDescriptionTemplate)); - this.censorFactory.censor(DmpDescriptionTemplateCensor.class).censor(dmpDescriptionTemplateFields, userId); + FieldSet planDescriptionTemplateFields = fields.extractPrefixed(this.asIndexerPrefix(Description._planDescriptionTemplate)); + this.censorFactory.censor(PlanDescriptionTemplateCensor.class).censor(planDescriptionTemplateFields, userId); FieldSet descriptionTemplateFields = fields.extractPrefixed(this.asIndexerPrefix(Description._descriptionTemplate)); this.censorFactory.censor(DescriptionTemplateCensor.class).censor(descriptionTemplateFields, userId); - FieldSet dmpFields = fields.extractPrefixed(this.asIndexerPrefix(Description._dmp)); - this.censorFactory.censor(DmpCensor.class).censor(dmpFields, userId); + FieldSet planFields = fields.extractPrefixed(this.asIndexerPrefix(Description._plan)); + this.censorFactory.censor(PlanCensor.class).censor(planFields, userId); FieldSet propertiesFields = fields.extractPrefixed(this.asIndexerPrefix(Description._properties)); this.censorFactory.censor(PropertyDefinitionCensor.class).censor(propertiesFields, userId); diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/dmp/DmpBlueprintValueCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/plan/PlanBlueprintValueCensor.java similarity index 69% rename from backend/core/src/main/java/org/opencdmp/model/censorship/dmp/DmpBlueprintValueCensor.java rename to backend/core/src/main/java/org/opencdmp/model/censorship/plan/PlanBlueprintValueCensor.java index e1335e529..c6b6643dd 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/dmp/DmpBlueprintValueCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/plan/PlanBlueprintValueCensor.java @@ -1,4 +1,4 @@ -package org.opencdmp.model.censorship.dmp; +package org.opencdmp.model.censorship.plan; import org.opencdmp.authorization.Permission; import org.opencdmp.convention.ConventionService; @@ -14,16 +14,16 @@ import org.springframework.stereotype.Component; import java.util.UUID; -@Component("dmpblueprintvaluecensor") +@Component("planblueprintvaluecensor") @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpBlueprintValueCensor extends BaseCensor { +public class PlanBlueprintValueCensor extends BaseCensor { - private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpBlueprintValueCensor.class)); + private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PlanBlueprintValueCensor.class)); protected final AuthorizationService authService; - public DmpBlueprintValueCensor(ConventionService conventionService, - AuthorizationService authService) { + public PlanBlueprintValueCensor(ConventionService conventionService, + AuthorizationService authService) { super(conventionService); this.authService = authService; } @@ -33,7 +33,7 @@ public class DmpBlueprintValueCensor extends BaseCensor { if (fields == null || fields.isEmpty()) return; - this.authService.authorizeForce(Permission.BrowseDmp, Permission.DeferredAffiliation); + this.authService.authorizeForce(Permission.BrowsePlan, Permission.DeferredAffiliation); } } diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/dmp/DmpCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/plan/PlanCensor.java similarity index 54% rename from backend/core/src/main/java/org/opencdmp/model/censorship/dmp/DmpCensor.java rename to backend/core/src/main/java/org/opencdmp/model/censorship/plan/PlanCensor.java index 27ae23df5..691d6612f 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/dmp/DmpCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/plan/PlanCensor.java @@ -1,10 +1,10 @@ -package org.opencdmp.model.censorship.dmp; +package org.opencdmp.model.censorship.plan; import org.opencdmp.authorization.Permission; import org.opencdmp.convention.ConventionService; import org.opencdmp.model.censorship.*; -import org.opencdmp.model.censorship.dmpreference.DmpReferenceCensor; -import org.opencdmp.model.dmp.Dmp; +import org.opencdmp.model.censorship.planreference.PlanReferenceCensor; +import org.opencdmp.model.plan.Plan; import gr.cite.commons.web.authz.service.AuthorizationService; import gr.cite.tools.data.censor.CensorFactory; import gr.cite.tools.fieldset.FieldSet; @@ -19,17 +19,17 @@ import java.util.UUID; @Component @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpCensor extends BaseCensor { +public class PlanCensor extends BaseCensor { - private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpCensor.class)); + private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PlanCensor.class)); protected final AuthorizationService authService; protected final CensorFactory censorFactory; - public DmpCensor(ConventionService conventionService, - AuthorizationService authService, - CensorFactory censorFactory) { + public PlanCensor(ConventionService conventionService, + AuthorizationService authService, + CensorFactory censorFactory) { super(conventionService); this.authService = authService; this.censorFactory = censorFactory; @@ -40,19 +40,19 @@ public class DmpCensor extends BaseCensor { if (fields == null || fields.isEmpty()) return; - this.authService.authorizeForce(Permission.BrowseDmp, Permission.DeferredAffiliation); + this.authService.authorizeForce(Permission.BrowsePlan, Permission.DeferredAffiliation); - FieldSet dmpUsersFields = fields.extractPrefixed(this.asIndexerPrefix(Dmp._dmpUsers)); - this.censorFactory.censor(DmpUserCensor.class).censor(dmpUsersFields, userId); - FieldSet dmpReferencesFields = fields.extractPrefixed(this.asIndexerPrefix(Dmp._dmpReferences)); - this.censorFactory.censor(DmpReferenceCensor.class).censor(dmpReferencesFields, userId); - FieldSet creatorFields = fields.extractPrefixed(this.asIndexerPrefix(Dmp._creator)); + FieldSet planUsersFields = fields.extractPrefixed(this.asIndexerPrefix(Plan._planUsers)); + this.censorFactory.censor(PlanUserCensor.class).censor(planUsersFields, userId); + FieldSet planReferencesFields = fields.extractPrefixed(this.asIndexerPrefix(Plan._planReferences)); + this.censorFactory.censor(PlanReferenceCensor.class).censor(planReferencesFields, userId); + FieldSet creatorFields = fields.extractPrefixed(this.asIndexerPrefix(Plan._creator)); this.censorFactory.censor(UserCensor.class).censor(creatorFields, userId); - FieldSet doisFields = fields.extractPrefixed(this.asIndexerPrefix(Dmp._entityDois)); + FieldSet doisFields = fields.extractPrefixed(this.asIndexerPrefix(Plan._entityDois)); this.censorFactory.censor(EntityDoiCensor.class).censor(doisFields, userId); - FieldSet propertiesFields = fields.extractPrefixed(this.asIndexerPrefix(Dmp._properties)); - this.censorFactory.censor(DmpPropertiesCensor.class).censor(propertiesFields, userId); - FieldSet otherDmpVersionsFields = fields.extractPrefixed(this.asIndexerPrefix(Dmp._otherDmpVersions)); - this.censorFactory.censor(DmpCensor.class).censor(otherDmpVersionsFields, userId); + FieldSet propertiesFields = fields.extractPrefixed(this.asIndexerPrefix(Plan._properties)); + this.censorFactory.censor(PlanPropertiesCensor.class).censor(propertiesFields, userId); + FieldSet otherPlanVersionsFields = fields.extractPrefixed(this.asIndexerPrefix(Plan._otherPlanVersions)); + this.censorFactory.censor(PlanCensor.class).censor(otherPlanVersionsFields, userId); } } diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/dmp/DmpContactCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/plan/PlanContactCensor.java similarity index 74% rename from backend/core/src/main/java/org/opencdmp/model/censorship/dmp/DmpContactCensor.java rename to backend/core/src/main/java/org/opencdmp/model/censorship/plan/PlanContactCensor.java index ef8cc07e7..96bcd6427 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/dmp/DmpContactCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/plan/PlanContactCensor.java @@ -1,4 +1,4 @@ -package org.opencdmp.model.censorship.dmp; +package org.opencdmp.model.censorship.plan; import org.opencdmp.authorization.Permission; import org.opencdmp.convention.ConventionService; @@ -17,15 +17,15 @@ import java.util.UUID; @Component("dmpcontactcensor") @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpContactCensor extends BaseCensor { +public class PlanContactCensor extends BaseCensor { - private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpContactCensor.class)); + private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PlanContactCensor.class)); protected final AuthorizationService authService; protected final CensorFactory censorFactory; - public DmpContactCensor(ConventionService conventionService, - AuthorizationService authService, CensorFactory censorFactory) { + public PlanContactCensor(ConventionService conventionService, + AuthorizationService authService, CensorFactory censorFactory) { super(conventionService); this.authService = authService; this.censorFactory = censorFactory; @@ -36,7 +36,7 @@ public class DmpContactCensor extends BaseCensor { if (fields == null || fields.isEmpty()) return; - this.authService.authorizeForce(Permission.BrowseDmp, Permission.DeferredAffiliation); + this.authService.authorizeForce(Permission.BrowsePlan, Permission.DeferredAffiliation); } } diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/dmp/DmpPropertiesCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/plan/PlanPropertiesCensor.java similarity index 62% rename from backend/core/src/main/java/org/opencdmp/model/censorship/dmp/DmpPropertiesCensor.java rename to backend/core/src/main/java/org/opencdmp/model/censorship/plan/PlanPropertiesCensor.java index 5435f03c7..14b43ca95 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/dmp/DmpPropertiesCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/plan/PlanPropertiesCensor.java @@ -1,9 +1,9 @@ -package org.opencdmp.model.censorship.dmp; +package org.opencdmp.model.censorship.plan; import org.opencdmp.authorization.Permission; import org.opencdmp.convention.ConventionService; import org.opencdmp.model.censorship.BaseCensor; -import org.opencdmp.model.dmp.DmpProperties; +import org.opencdmp.model.plan.PlanProperties; import gr.cite.commons.web.authz.service.AuthorizationService; import gr.cite.tools.data.censor.CensorFactory; import gr.cite.tools.fieldset.FieldSet; @@ -18,16 +18,16 @@ import java.util.UUID; @Component("dmppropertiescensor") @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpPropertiesCensor extends BaseCensor { +public class PlanPropertiesCensor extends BaseCensor { - private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpPropertiesCensor.class)); + private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PlanPropertiesCensor.class)); protected final AuthorizationService authService; protected final CensorFactory censorFactory; - public DmpPropertiesCensor(ConventionService conventionService, - AuthorizationService authService, - CensorFactory censorFactory) { + public PlanPropertiesCensor(ConventionService conventionService, + AuthorizationService authService, + CensorFactory censorFactory) { super(conventionService); this.authService = authService; this.censorFactory = censorFactory; @@ -38,11 +38,11 @@ public class DmpPropertiesCensor extends BaseCensor { if (fields == null || fields.isEmpty()) return; - this.authService.authorizeForce(Permission.BrowseDmp, Permission.DeferredAffiliation); - FieldSet dmpBlueprintValuesFields = fields.extractPrefixed(this.asIndexerPrefix(DmpProperties._dmpBlueprintValues)); - this.censorFactory.censor(DmpBlueprintValueCensor.class).censor(dmpBlueprintValuesFields, userId); - FieldSet contactsFields = fields.extractPrefixed(this.asIndexerPrefix(DmpProperties._contacts)); - this.censorFactory.censor(DmpContactCensor.class).censor(contactsFields, userId); + this.authService.authorizeForce(Permission.BrowsePlan, Permission.DeferredAffiliation); + FieldSet dmpBlueprintValuesFields = fields.extractPrefixed(this.asIndexerPrefix(PlanProperties._planBlueprintValues)); + this.censorFactory.censor(PlanBlueprintValueCensor.class).censor(dmpBlueprintValuesFields, userId); + FieldSet contactsFields = fields.extractPrefixed(this.asIndexerPrefix(PlanProperties._contacts)); + this.censorFactory.censor(PlanContactCensor.class).censor(contactsFields, userId); } } diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/dmpblueprint/DefinitionCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/planblueprint/DefinitionCensor.java similarity index 90% rename from backend/core/src/main/java/org/opencdmp/model/censorship/dmpblueprint/DefinitionCensor.java rename to backend/core/src/main/java/org/opencdmp/model/censorship/planblueprint/DefinitionCensor.java index f1e1e74a7..dfcc6a972 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/dmpblueprint/DefinitionCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/planblueprint/DefinitionCensor.java @@ -1,9 +1,9 @@ -package org.opencdmp.model.censorship.dmpblueprint; +package org.opencdmp.model.censorship.planblueprint; import org.opencdmp.authorization.Permission; import org.opencdmp.convention.ConventionService; import org.opencdmp.model.censorship.BaseCensor; -import org.opencdmp.model.dmpblueprint.Definition; +import org.opencdmp.model.planblueprint.Definition; import gr.cite.commons.web.authz.service.AuthorizationService; import gr.cite.tools.data.censor.CensorFactory; import gr.cite.tools.fieldset.FieldSet; @@ -38,7 +38,7 @@ public class DefinitionCensor extends BaseCensor { if (fields == null || fields.isEmpty()) return; - this.authService.authorizeForce(Permission.BrowseDmpBlueprint); + this.authService.authorizeForce(Permission.BrowsePlanBlueprint); FieldSet sectionsFields = fields.extractPrefixed(this.asIndexerPrefix(Definition._sections)); this.censorFactory.censor(SectionCensor.class).censor(sectionsFields, userId); } diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/dmpblueprint/DescriptionTemplatesCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/planblueprint/DescriptionTemplatesCensor.java similarity index 91% rename from backend/core/src/main/java/org/opencdmp/model/censorship/dmpblueprint/DescriptionTemplatesCensor.java rename to backend/core/src/main/java/org/opencdmp/model/censorship/planblueprint/DescriptionTemplatesCensor.java index d80001199..c45d56710 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/dmpblueprint/DescriptionTemplatesCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/planblueprint/DescriptionTemplatesCensor.java @@ -1,4 +1,4 @@ -package org.opencdmp.model.censorship.dmpblueprint; +package org.opencdmp.model.censorship.planblueprint; import org.opencdmp.authorization.Permission; import org.opencdmp.convention.ConventionService; @@ -33,7 +33,7 @@ public class DescriptionTemplatesCensor extends BaseCensor { if (fields == null || fields.isEmpty()) return; - this.authService.authorizeForce(Permission.BrowseDmpBlueprint); + this.authService.authorizeForce(Permission.BrowsePlanBlueprint); } } diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/dmpblueprint/FieldCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/planblueprint/FieldCensor.java similarity index 91% rename from backend/core/src/main/java/org/opencdmp/model/censorship/dmpblueprint/FieldCensor.java rename to backend/core/src/main/java/org/opencdmp/model/censorship/planblueprint/FieldCensor.java index 8c09e109e..ec5f824f5 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/dmpblueprint/FieldCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/planblueprint/FieldCensor.java @@ -1,4 +1,4 @@ -package org.opencdmp.model.censorship.dmpblueprint; +package org.opencdmp.model.censorship.planblueprint; import org.opencdmp.authorization.Permission; import org.opencdmp.convention.ConventionService; @@ -33,7 +33,7 @@ public class FieldCensor extends BaseCensor { if (fields == null || fields.isEmpty()) return; - this.authService.authorizeForce(Permission.BrowseDmpBlueprint); + this.authService.authorizeForce(Permission.BrowsePlanBlueprint); } } diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/dmpblueprint/DmpBlueprintCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/planblueprint/PlanBlueprintCensor.java similarity index 71% rename from backend/core/src/main/java/org/opencdmp/model/censorship/dmpblueprint/DmpBlueprintCensor.java rename to backend/core/src/main/java/org/opencdmp/model/censorship/planblueprint/PlanBlueprintCensor.java index 63203ab76..bea7f0a1a 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/dmpblueprint/DmpBlueprintCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/planblueprint/PlanBlueprintCensor.java @@ -1,9 +1,9 @@ -package org.opencdmp.model.censorship.dmpblueprint; +package org.opencdmp.model.censorship.planblueprint; import org.opencdmp.authorization.Permission; import org.opencdmp.convention.ConventionService; import org.opencdmp.model.censorship.BaseCensor; -import org.opencdmp.model.dmpblueprint.DmpBlueprint; +import org.opencdmp.model.planblueprint.PlanBlueprint; import gr.cite.commons.web.authz.service.AuthorizationService; import gr.cite.tools.data.censor.CensorFactory; import gr.cite.tools.fieldset.FieldSet; @@ -18,16 +18,16 @@ import java.util.UUID; @Component @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpBlueprintCensor extends BaseCensor { +public class PlanBlueprintCensor extends BaseCensor { - private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpBlueprintCensor.class)); + private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PlanBlueprintCensor.class)); protected final AuthorizationService authService; protected final CensorFactory censorFactory; - public DmpBlueprintCensor(ConventionService conventionService, - AuthorizationService authService, - CensorFactory censorFactory) { + public PlanBlueprintCensor(ConventionService conventionService, + AuthorizationService authService, + CensorFactory censorFactory) { super(conventionService); this.authService = authService; this.censorFactory = censorFactory; @@ -38,8 +38,8 @@ public class DmpBlueprintCensor extends BaseCensor { if (fields == null || fields.isEmpty()) return; - this.authService.authorizeForce(Permission.BrowseDmpBlueprint); - FieldSet definitionFields = fields.extractPrefixed(this.asIndexerPrefix(DmpBlueprint._definition)); + this.authService.authorizeForce(Permission.BrowsePlanBlueprint); + FieldSet definitionFields = fields.extractPrefixed(this.asIndexerPrefix(PlanBlueprint._definition)); this.censorFactory.censor(DefinitionCensor.class).censor(definitionFields, userId); } diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/dmpblueprint/SectionCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/planblueprint/SectionCensor.java similarity index 91% rename from backend/core/src/main/java/org/opencdmp/model/censorship/dmpblueprint/SectionCensor.java rename to backend/core/src/main/java/org/opencdmp/model/censorship/planblueprint/SectionCensor.java index 5fbb97034..44ec3cde1 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/dmpblueprint/SectionCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/planblueprint/SectionCensor.java @@ -1,9 +1,9 @@ -package org.opencdmp.model.censorship.dmpblueprint; +package org.opencdmp.model.censorship.planblueprint; import org.opencdmp.authorization.Permission; import org.opencdmp.convention.ConventionService; import org.opencdmp.model.censorship.BaseCensor; -import org.opencdmp.model.dmpblueprint.Section; +import org.opencdmp.model.planblueprint.Section; import gr.cite.commons.web.authz.service.AuthorizationService; import gr.cite.tools.data.censor.CensorFactory; import gr.cite.tools.fieldset.FieldSet; @@ -38,7 +38,7 @@ public class SectionCensor extends BaseCensor { if (fields == null || fields.isEmpty()) return; - this.authService.authorizeForce(Permission.BrowseDmpBlueprint); + this.authService.authorizeForce(Permission.BrowsePlanBlueprint); FieldSet fieldsFields = fields.extractPrefixed(this.asIndexerPrefix(Section._fields)); this.censorFactory.censor(FieldCensor.class).censor(fieldsFields, userId); FieldSet descriptionTemplatesFields = fields.extractPrefixed(this.asIndexerPrefix(Section._descriptionTemplates)); diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/dmpreference/DmpReferenceCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/planreference/PlanReferenceCensor.java similarity index 61% rename from backend/core/src/main/java/org/opencdmp/model/censorship/dmpreference/DmpReferenceCensor.java rename to backend/core/src/main/java/org/opencdmp/model/censorship/planreference/PlanReferenceCensor.java index d8d6e4df9..9f6832716 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/dmpreference/DmpReferenceCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/planreference/PlanReferenceCensor.java @@ -1,11 +1,11 @@ -package org.opencdmp.model.censorship.dmpreference; +package org.opencdmp.model.censorship.planreference; import org.opencdmp.authorization.Permission; import org.opencdmp.convention.ConventionService; import org.opencdmp.model.censorship.BaseCensor; import org.opencdmp.model.censorship.reference.ReferenceCensor; -import org.opencdmp.model.censorship.dmp.DmpCensor; -import org.opencdmp.model.dmpreference.DmpReference; +import org.opencdmp.model.censorship.plan.PlanCensor; +import org.opencdmp.model.planreference.PlanReference; import gr.cite.commons.web.authz.service.AuthorizationService; import gr.cite.tools.data.censor.CensorFactory; import gr.cite.tools.fieldset.FieldSet; @@ -20,16 +20,16 @@ import java.util.UUID; @Component @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpReferenceCensor extends BaseCensor { +public class PlanReferenceCensor extends BaseCensor { - private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpReferenceCensor.class)); + private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PlanReferenceCensor.class)); protected final AuthorizationService authService; protected final CensorFactory censorFactory; - public DmpReferenceCensor(ConventionService conventionService, - AuthorizationService authService, - CensorFactory censorFactory) { + public PlanReferenceCensor(ConventionService conventionService, + AuthorizationService authService, + CensorFactory censorFactory) { super(conventionService); this.authService = authService; this.censorFactory = censorFactory; @@ -40,13 +40,13 @@ public class DmpReferenceCensor extends BaseCensor { if (fields == null || fields.isEmpty()) return; - this.authService.authorizeForce(Permission.BrowseDmpDescriptionTemplate, Permission.DeferredAffiliation); - FieldSet dmpFields = fields.extractPrefixed(this.asIndexerPrefix(DmpReference._dmp)); - this.censorFactory.censor(DmpCensor.class).censor(dmpFields, userId); - FieldSet templateFields = fields.extractPrefixed(this.asIndexerPrefix(DmpReference._reference)); + this.authService.authorizeForce(Permission.BrowsePlanDescriptionTemplate, Permission.DeferredAffiliation); + FieldSet planFields = fields.extractPrefixed(this.asIndexerPrefix(PlanReference._plan)); + this.censorFactory.censor(PlanCensor.class).censor(planFields, userId); + FieldSet templateFields = fields.extractPrefixed(this.asIndexerPrefix(PlanReference._reference)); this.censorFactory.censor(ReferenceCensor.class).censor(templateFields, userId); - FieldSet dataFields = fields.extractPrefixed(this.asIndexerPrefix(DmpReference._data)); - this.censorFactory.censor(DmpReferenceDataCensor.class).censor(dataFields, userId); + FieldSet dataFields = fields.extractPrefixed(this.asIndexerPrefix(PlanReference._data)); + this.censorFactory.censor(PlanReferenceDataCensor.class).censor(dataFields, userId); } } diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/dmpreference/DmpReferenceDataCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/planreference/PlanReferenceDataCensor.java similarity index 72% rename from backend/core/src/main/java/org/opencdmp/model/censorship/dmpreference/DmpReferenceDataCensor.java rename to backend/core/src/main/java/org/opencdmp/model/censorship/planreference/PlanReferenceDataCensor.java index 706b92ee4..cc053b0fd 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/dmpreference/DmpReferenceDataCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/planreference/PlanReferenceDataCensor.java @@ -1,4 +1,4 @@ -package org.opencdmp.model.censorship.dmpreference; +package org.opencdmp.model.censorship.planreference; import org.opencdmp.authorization.Permission; import org.opencdmp.convention.ConventionService; @@ -17,16 +17,16 @@ import java.util.UUID; @Component @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpReferenceDataCensor extends BaseCensor { +public class PlanReferenceDataCensor extends BaseCensor { - private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpReferenceDataCensor.class)); + private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PlanReferenceDataCensor.class)); protected final AuthorizationService authService; @Autowired - public DmpReferenceDataCensor(ConventionService conventionService, - AuthorizationService authService) { + public PlanReferenceDataCensor(ConventionService conventionService, + AuthorizationService authService) { super(conventionService); this.authService = authService; } @@ -36,7 +36,7 @@ public class DmpReferenceDataCensor extends BaseCensor { if (fields == null || fields.isEmpty()) return; - this.authService.authorizeForce(Permission.BrowseDmpDescriptionTemplate, Permission.DeferredAffiliation); + this.authService.authorizeForce(Permission.BrowsePlanDescriptionTemplate, Permission.DeferredAffiliation); } } diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/reference/ReferenceCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/reference/ReferenceCensor.java index 1930f5bf9..3a15141ac 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/reference/ReferenceCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/reference/ReferenceCensor.java @@ -5,7 +5,7 @@ import org.opencdmp.convention.ConventionService; import org.opencdmp.model.censorship.BaseCensor; import org.opencdmp.model.censorship.referencetype.ReferenceTypeCensor; import org.opencdmp.model.censorship.UserCensor; -import org.opencdmp.model.censorship.dmpreference.DmpReferenceCensor; +import org.opencdmp.model.censorship.planreference.PlanReferenceCensor; import org.opencdmp.model.reference.Reference; import gr.cite.commons.web.authz.service.AuthorizationService; import gr.cite.tools.data.censor.CensorFactory; @@ -44,8 +44,8 @@ public class ReferenceCensor extends BaseCensor { this.authService.authorizeForce(Permission.BrowseReference, Permission.DeferredAffiliation); FieldSet definitionFields = fields.extractPrefixed(this.asIndexerPrefix(Reference._definition)); this.censorFactory.censor(DefinitionCensor.class).censor(definitionFields, userId); - FieldSet dmpReferencesFields = fields.extractPrefixed(this.asIndexerPrefix(Reference._dmpReferences)); - this.censorFactory.censor(DmpReferenceCensor.class).censor(dmpReferencesFields, userId); + FieldSet planReferencesFields = fields.extractPrefixed(this.asIndexerPrefix(Reference._planReferences)); + this.censorFactory.censor(PlanReferenceCensor.class).censor(planReferencesFields, userId); FieldSet createdByFields = fields.extractPrefixed(this.asIndexerPrefix(Reference._createdBy)); this.censorFactory.censor(UserCensor.class).censor(createdByFields, userId); FieldSet typeFields = fields.extractPrefixed(this.asIndexerPrefix(Reference._type)); diff --git a/backend/core/src/main/java/org/opencdmp/model/deleter/DescriptionTemplateDeleter.java b/backend/core/src/main/java/org/opencdmp/model/deleter/DescriptionTemplateDeleter.java index db54fbeaa..50a568403 100644 --- a/backend/core/src/main/java/org/opencdmp/model/deleter/DescriptionTemplateDeleter.java +++ b/backend/core/src/main/java/org/opencdmp/model/deleter/DescriptionTemplateDeleter.java @@ -1,20 +1,14 @@ package org.opencdmp.model.deleter; -import org.opencdmp.commons.enums.DescriptionTemplateVersionStatus; -import org.opencdmp.commons.enums.DmpVersionStatus; import org.opencdmp.commons.enums.IsActive; import org.opencdmp.data.DescriptionTemplateEntity; -import org.opencdmp.data.DmpDescriptionTemplateEntity; import org.opencdmp.data.TenantEntityManager; import org.opencdmp.data.UserDescriptionTemplateEntity; -import org.opencdmp.query.DescriptionQuery; import org.opencdmp.query.DescriptionTemplateQuery; -import org.opencdmp.query.DmpDescriptionTemplateQuery; import org.opencdmp.query.UserDescriptionTemplateQuery; import gr.cite.tools.data.deleter.Deleter; import gr.cite.tools.data.deleter.DeleterFactory; import gr.cite.tools.data.query.QueryFactory; -import gr.cite.tools.exception.MyApplicationException; import gr.cite.tools.logging.LoggerService; import gr.cite.tools.logging.MapLogEntry; import org.slf4j.LoggerFactory; diff --git a/backend/core/src/main/java/org/opencdmp/model/deleter/DmpBlueprintDeleter.java b/backend/core/src/main/java/org/opencdmp/model/deleter/PlanBlueprintDeleter.java similarity index 80% rename from backend/core/src/main/java/org/opencdmp/model/deleter/DmpBlueprintDeleter.java rename to backend/core/src/main/java/org/opencdmp/model/deleter/PlanBlueprintDeleter.java index e34007725..3f3f2938b 100644 --- a/backend/core/src/main/java/org/opencdmp/model/deleter/DmpBlueprintDeleter.java +++ b/backend/core/src/main/java/org/opencdmp/model/deleter/PlanBlueprintDeleter.java @@ -1,9 +1,9 @@ package org.opencdmp.model.deleter; import org.opencdmp.commons.enums.IsActive; -import org.opencdmp.data.DmpBlueprintEntity; +import org.opencdmp.data.PlanBlueprintEntity; import org.opencdmp.data.TenantEntityManager; -import org.opencdmp.query.DmpBlueprintQuery; +import org.opencdmp.query.PlanBlueprintQuery; import gr.cite.tools.data.deleter.Deleter; import gr.cite.tools.data.deleter.DeleterFactory; import gr.cite.tools.data.query.QueryFactory; @@ -23,9 +23,9 @@ import java.util.UUID; @Component @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpBlueprintDeleter implements Deleter { +public class PlanBlueprintDeleter implements Deleter { - private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpBlueprintDeleter.class)); + private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PlanBlueprintDeleter.class)); private final TenantEntityManager entityManager; @@ -34,7 +34,7 @@ public class DmpBlueprintDeleter implements Deleter { protected final DeleterFactory deleterFactory; @Autowired - public DmpBlueprintDeleter( + public PlanBlueprintDeleter( TenantEntityManager entityManager, QueryFactory queryFactory, DeleterFactory deleterFactory @@ -46,12 +46,12 @@ public class DmpBlueprintDeleter implements Deleter { public void deleteAndSaveByIds(List ids) throws InvalidApplicationException { logger.debug(new MapLogEntry("collecting to delete").And("count", Optional.ofNullable(ids).map(List::size).orElse(0)).And("ids", ids)); - List data = this.queryFactory.query(DmpBlueprintQuery.class).ids(ids).collect(); + List data = this.queryFactory.query(PlanBlueprintQuery.class).ids(ids).collect(); logger.trace("retrieved {} items", Optional.ofNullable(data).map(List::size).orElse(0)); this.deleteAndSave(data); } - public void deleteAndSave(List data) throws InvalidApplicationException { + public void deleteAndSave(List data) throws InvalidApplicationException { logger.debug("will delete {} items", Optional.ofNullable(data).map(List::size).orElse(0)); this.delete(data); logger.trace("saving changes"); @@ -59,14 +59,14 @@ public class DmpBlueprintDeleter implements Deleter { logger.trace("changes saved"); } - public void delete(List data) throws InvalidApplicationException { + public void delete(List data) throws InvalidApplicationException { logger.debug("will delete {} items", Optional.ofNullable(data).map(List::size).orElse(0)); if (data == null || data.isEmpty()) return; Instant now = Instant.now(); - for (DmpBlueprintEntity item : data) { + for (PlanBlueprintEntity item : data) { logger.trace("deleting item {}", item.getId()); item.setIsActive(IsActive.Inactive); item.setUpdatedAt(now); diff --git a/backend/core/src/main/java/org/opencdmp/model/deleter/DmpDeleter.java b/backend/core/src/main/java/org/opencdmp/model/deleter/PlanDeleter.java similarity index 66% rename from backend/core/src/main/java/org/opencdmp/model/deleter/DmpDeleter.java rename to backend/core/src/main/java/org/opencdmp/model/deleter/PlanDeleter.java index e455fb756..4935b24a5 100644 --- a/backend/core/src/main/java/org/opencdmp/model/deleter/DmpDeleter.java +++ b/backend/core/src/main/java/org/opencdmp/model/deleter/PlanDeleter.java @@ -7,13 +7,13 @@ import gr.cite.tools.exception.MyApplicationException; import gr.cite.tools.logging.LoggerService; import gr.cite.tools.logging.MapLogEntry; import org.opencdmp.authorization.AuthorizationFlags; -import org.opencdmp.commons.enums.DmpVersionStatus; +import org.opencdmp.commons.enums.PlanVersionStatus; import org.opencdmp.commons.enums.EntityType; import org.opencdmp.commons.enums.IsActive; import org.opencdmp.data.*; -import org.opencdmp.model.DmpDescriptionTemplate; +import org.opencdmp.model.PlanDescriptionTemplate; import org.opencdmp.model.description.Description; -import org.opencdmp.model.dmpreference.DmpReference; +import org.opencdmp.model.planreference.PlanReference; import org.opencdmp.query.*; import org.opencdmp.service.elastic.ElasticService; import org.slf4j.LoggerFactory; @@ -31,9 +31,9 @@ import java.util.UUID; @Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpDeleter implements Deleter { +public class PlanDeleter implements Deleter { - private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpDeleter.class)); + private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PlanDeleter.class)); private final TenantEntityManager entityManager; @@ -43,7 +43,7 @@ public class DmpDeleter implements Deleter { protected final ElasticService elasticService; @Autowired - public DmpDeleter( + public PlanDeleter( TenantEntityManager entityManager, QueryFactory queryFactory, DeleterFactory deleterFactory, @@ -56,12 +56,12 @@ public class DmpDeleter implements Deleter { public void deleteAndSaveByIds(List ids, boolean disableElastic) throws InvalidApplicationException, IOException { logger.debug(new MapLogEntry("collecting to delete").And("count", Optional.ofNullable(ids).map(List::size).orElse(0)).And("ids", ids)); - List data = this.queryFactory.query(DmpQuery.class).ids(ids).collect(); + List data = this.queryFactory.query(PlanQuery.class).ids(ids).collect(); logger.trace("retrieved {} items", Optional.ofNullable(data).map(List::size).orElse(0)); this.deleteAndSave(data, disableElastic); } - public void deleteAndSave(List data, boolean disableElastic) throws InvalidApplicationException, IOException { + public void deleteAndSave(List data, boolean disableElastic) throws InvalidApplicationException, IOException { logger.debug("will delete {} items", Optional.ofNullable(data).map(List::size).orElse(0)); this.delete(data, disableElastic); logger.trace("saving changes"); @@ -69,51 +69,51 @@ public class DmpDeleter implements Deleter { logger.trace("changes saved"); } - public void delete(List data, boolean disableElastic) throws InvalidApplicationException, IOException { + public void delete(List data, boolean disableElastic) throws InvalidApplicationException, IOException { logger.debug("will delete {} items", Optional.ofNullable(data).map(List::size).orElse(0)); if (data == null || data.isEmpty()) return; - List ids = data.stream().map(DmpEntity::getId).distinct().toList(); + List ids = data.stream().map(PlanEntity::getId).distinct().toList(); { - logger.debug("checking related - {}", DmpUserEntity.class.getSimpleName()); - List items = this.queryFactory.query(DmpUserQuery.class).dmpIds(ids).collect(); - DmpUserDeleter deleter = this.deleterFactory.deleter(DmpUserDeleter.class); + logger.debug("checking related - {}", PlanUserEntity.class.getSimpleName()); + List items = this.queryFactory.query(PlanUserQuery.class).planIds(ids).collect(); + PlanUserDeleter deleter = this.deleterFactory.deleter(PlanUserDeleter.class); deleter.delete(items); } { - logger.debug("checking related - {}", DmpDescriptionTemplate.class.getSimpleName()); - List items = this.queryFactory.query(DmpDescriptionTemplateQuery.class).dmpIds(ids).collect(); - DmpDescriptionTemplateDeleter deleter = this.deleterFactory.deleter(DmpDescriptionTemplateDeleter.class); + logger.debug("checking related - {}", PlanDescriptionTemplate.class.getSimpleName()); + List items = this.queryFactory.query(PlanDescriptionTemplateQuery.class).planIds(ids).collect(); + PlanDescriptionTemplateDeleter deleter = this.deleterFactory.deleter(PlanDescriptionTemplateDeleter.class); deleter.delete(items); } { - logger.debug("checking related - {}", DmpReference.class.getSimpleName()); - List items = this.queryFactory.query(DmpReferenceQuery.class).dmpIds(ids).collect(); - DmpReferenceDeleter deleter = this.deleterFactory.deleter(DmpReferenceDeleter.class); + logger.debug("checking related - {}", PlanReference.class.getSimpleName()); + List items = this.queryFactory.query(PlanReferenceQuery.class).planIds(ids).collect(); + PlanReferenceDeleter deleter = this.deleterFactory.deleter(PlanReferenceDeleter.class); deleter.delete(items); } { logger.debug("checking related - {}", Description.class.getSimpleName()); - List items = this.queryFactory.query(DescriptionQuery.class).dmpIds(ids).collect(); + List items = this.queryFactory.query(DescriptionQuery.class).planIds(ids).collect(); DescriptionDeleter deleter = this.deleterFactory.deleter(DescriptionDeleter.class); deleter.delete(items, false); //We delete elastic entities by bmp deleter } Instant now = Instant.now(); - for (DmpEntity item : data) { + for (PlanEntity item : data) { logger.trace("deleting item {}", item.getId()); EntityDoiQuery entityDoiQuery = this.queryFactory.query(EntityDoiQuery.class).authorize(AuthorizationFlags.AllExceptPublic).types(EntityType.DMP).entityIds(item.getId()); if (entityDoiQuery.count() > 0) throw new MyApplicationException("DMP is deposited can not deleted"); - if(item.getVersionStatus().equals(DmpVersionStatus.Current)) throw new MyApplicationException("DMP is current can not deleted"); + if(item.getVersionStatus().equals(PlanVersionStatus.Current)) throw new MyApplicationException("DMP is current can not deleted"); item.setIsActive(IsActive.Inactive); item.setUpdatedAt(now); logger.trace("updating item"); this.entityManager.merge(item); logger.trace("updated item"); - if (!disableElastic) this.elasticService.deleteDmp(item); + if (!disableElastic) this.elasticService.deletePlan(item); } } diff --git a/backend/core/src/main/java/org/opencdmp/model/deleter/DmpDescriptionTemplateDeleter.java b/backend/core/src/main/java/org/opencdmp/model/deleter/PlanDescriptionTemplateDeleter.java similarity index 78% rename from backend/core/src/main/java/org/opencdmp/model/deleter/DmpDescriptionTemplateDeleter.java rename to backend/core/src/main/java/org/opencdmp/model/deleter/PlanDescriptionTemplateDeleter.java index 84d16b7bb..9d2868ed7 100644 --- a/backend/core/src/main/java/org/opencdmp/model/deleter/DmpDescriptionTemplateDeleter.java +++ b/backend/core/src/main/java/org/opencdmp/model/deleter/PlanDescriptionTemplateDeleter.java @@ -1,9 +1,9 @@ package org.opencdmp.model.deleter; import org.opencdmp.commons.enums.IsActive; -import org.opencdmp.data.DmpDescriptionTemplateEntity; +import org.opencdmp.data.PlanDescriptionTemplateEntity; import org.opencdmp.data.TenantEntityManager; -import org.opencdmp.query.DmpDescriptionTemplateQuery; +import org.opencdmp.query.PlanDescriptionTemplateQuery; import gr.cite.tools.data.deleter.Deleter; import gr.cite.tools.data.deleter.DeleterFactory; import gr.cite.tools.data.query.QueryFactory; @@ -23,9 +23,9 @@ import java.util.UUID; @Component @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpDescriptionTemplateDeleter implements Deleter { +public class PlanDescriptionTemplateDeleter implements Deleter { - private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpDescriptionTemplateDeleter.class)); + private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PlanDescriptionTemplateDeleter.class)); private final TenantEntityManager entityManager; protected final QueryFactory queryFactory; @@ -33,7 +33,7 @@ public class DmpDescriptionTemplateDeleter implements Deleter { protected final DeleterFactory deleterFactory; @Autowired - public DmpDescriptionTemplateDeleter( + public PlanDescriptionTemplateDeleter( TenantEntityManager entityManager, QueryFactory queryFactory, DeleterFactory deleterFactory @@ -45,12 +45,12 @@ public class DmpDescriptionTemplateDeleter implements Deleter { public void deleteAndSaveByIds(List ids) throws InvalidApplicationException { logger.debug(new MapLogEntry("collecting to delete").And("count", Optional.ofNullable(ids).map(List::size).orElse(0)).And("ids", ids)); - List data = this.queryFactory.query(DmpDescriptionTemplateQuery.class).ids(ids).collect(); + List data = this.queryFactory.query(PlanDescriptionTemplateQuery.class).ids(ids).collect(); logger.trace("retrieved {} items", Optional.ofNullable(data).map(List::size).orElse(0)); this.deleteAndSave(data); } - public void deleteAndSave(List data) throws InvalidApplicationException { + public void deleteAndSave(List data) throws InvalidApplicationException { logger.debug("will delete {} items", Optional.ofNullable(data).map(List::size).orElse(0)); this.delete(data); logger.trace("saving changes"); @@ -58,12 +58,12 @@ public class DmpDescriptionTemplateDeleter implements Deleter { logger.trace("changes saved"); } - public void delete(List data) throws InvalidApplicationException { + public void delete(List data) throws InvalidApplicationException { logger.debug("will delete {} items", Optional.ofNullable(data).map(List::size).orElse(0)); if (data == null || data.isEmpty()) return; - for (DmpDescriptionTemplateEntity item : data) { + for (PlanDescriptionTemplateEntity item : data) { logger.trace("deleting item {}", item.getId()); logger.trace("updating item"); item.setUpdatedAt(Instant.now()); diff --git a/backend/core/src/main/java/org/opencdmp/model/deleter/DmpReferenceDeleter.java b/backend/core/src/main/java/org/opencdmp/model/deleter/PlanReferenceDeleter.java similarity index 80% rename from backend/core/src/main/java/org/opencdmp/model/deleter/DmpReferenceDeleter.java rename to backend/core/src/main/java/org/opencdmp/model/deleter/PlanReferenceDeleter.java index 9b95d6a4d..6bdffc70a 100644 --- a/backend/core/src/main/java/org/opencdmp/model/deleter/DmpReferenceDeleter.java +++ b/backend/core/src/main/java/org/opencdmp/model/deleter/PlanReferenceDeleter.java @@ -1,9 +1,9 @@ package org.opencdmp.model.deleter; import org.opencdmp.commons.enums.IsActive; -import org.opencdmp.data.DmpReferenceEntity; +import org.opencdmp.data.PlanReferenceEntity; import org.opencdmp.data.TenantEntityManager; -import org.opencdmp.query.DmpReferenceQuery; +import org.opencdmp.query.PlanReferenceQuery; import gr.cite.tools.data.deleter.Deleter; import gr.cite.tools.data.deleter.DeleterFactory; import gr.cite.tools.data.query.QueryFactory; @@ -23,9 +23,9 @@ import java.util.UUID; @Component @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpReferenceDeleter implements Deleter { +public class PlanReferenceDeleter implements Deleter { - private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpReferenceDeleter.class)); + private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PlanReferenceDeleter.class)); private final TenantEntityManager entityManager; protected final QueryFactory queryFactory; @@ -33,7 +33,7 @@ public class DmpReferenceDeleter implements Deleter { protected final DeleterFactory deleterFactory; @Autowired - public DmpReferenceDeleter( + public PlanReferenceDeleter( TenantEntityManager entityManager, QueryFactory queryFactory, DeleterFactory deleterFactory @@ -45,12 +45,12 @@ public class DmpReferenceDeleter implements Deleter { public void deleteAndSaveByIds(List ids) throws InvalidApplicationException { logger.debug(new MapLogEntry("collecting to delete").And("count", Optional.ofNullable(ids).map(List::size).orElse(0)).And("ids", ids)); - List data = this.queryFactory.query(DmpReferenceQuery.class).ids(ids).collect(); + List data = this.queryFactory.query(PlanReferenceQuery.class).ids(ids).collect(); logger.trace("retrieved {} items", Optional.ofNullable(data).map(List::size).orElse(0)); this.deleteAndSave(data); } - public void deleteAndSave(List data) throws InvalidApplicationException { + public void deleteAndSave(List data) throws InvalidApplicationException { logger.debug("will delete {} items", Optional.ofNullable(data).map(List::size).orElse(0)); this.delete(data); logger.trace("saving changes"); @@ -58,12 +58,12 @@ public class DmpReferenceDeleter implements Deleter { logger.trace("changes saved"); } - public void delete(List data) throws InvalidApplicationException { + public void delete(List data) throws InvalidApplicationException { logger.debug("will delete {} items", Optional.ofNullable(data).map(List::size).orElse(0)); if (data == null || data.isEmpty()) return; - for (DmpReferenceEntity item : data) { + for (PlanReferenceEntity item : data) { logger.trace("deleting item {}", item.getId()); logger.trace("updating item"); item.setUpdatedAt(Instant.now()); diff --git a/backend/core/src/main/java/org/opencdmp/model/deleter/DmpUserDeleter.java b/backend/core/src/main/java/org/opencdmp/model/deleter/PlanUserDeleter.java similarity index 81% rename from backend/core/src/main/java/org/opencdmp/model/deleter/DmpUserDeleter.java rename to backend/core/src/main/java/org/opencdmp/model/deleter/PlanUserDeleter.java index b71b9fd46..44d7631bc 100644 --- a/backend/core/src/main/java/org/opencdmp/model/deleter/DmpUserDeleter.java +++ b/backend/core/src/main/java/org/opencdmp/model/deleter/PlanUserDeleter.java @@ -1,9 +1,9 @@ package org.opencdmp.model.deleter; import org.opencdmp.commons.enums.IsActive; -import org.opencdmp.data.DmpUserEntity; +import org.opencdmp.data.PlanUserEntity; import org.opencdmp.data.TenantEntityManager; -import org.opencdmp.query.DmpUserQuery; +import org.opencdmp.query.PlanUserQuery; import gr.cite.tools.data.deleter.Deleter; import gr.cite.tools.data.deleter.DeleterFactory; import gr.cite.tools.data.query.QueryFactory; @@ -23,9 +23,9 @@ import java.util.UUID; @Component @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpUserDeleter implements Deleter { +public class PlanUserDeleter implements Deleter { - private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpUserDeleter.class)); + private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PlanUserDeleter.class)); private final TenantEntityManager entityManager; protected final QueryFactory queryFactory; @@ -33,7 +33,7 @@ public class DmpUserDeleter implements Deleter { protected final DeleterFactory deleterFactory; @Autowired - public DmpUserDeleter( + public PlanUserDeleter( TenantEntityManager entityManager, QueryFactory queryFactory, DeleterFactory deleterFactory @@ -45,12 +45,12 @@ public class DmpUserDeleter implements Deleter { public void deleteAndSaveByIds(List ids) throws InvalidApplicationException { logger.debug(new MapLogEntry("collecting to delete").And("count", Optional.ofNullable(ids).map(List::size).orElse(0)).And("ids", ids)); - List data = this.queryFactory.query(DmpUserQuery.class).ids(ids).collect(); + List data = this.queryFactory.query(PlanUserQuery.class).ids(ids).collect(); logger.trace("retrieved {} items", Optional.ofNullable(data).map(List::size).orElse(0)); this.deleteAndSave(data); } - public void deleteAndSave(List data) throws InvalidApplicationException { + public void deleteAndSave(List data) throws InvalidApplicationException { logger.debug("will delete {} items", Optional.ofNullable(data).map(List::size).orElse(0)); this.delete(data); logger.trace("saving changes"); @@ -58,12 +58,12 @@ public class DmpUserDeleter implements Deleter { logger.trace("changes saved"); } - public void delete(List data) throws InvalidApplicationException { + public void delete(List data) throws InvalidApplicationException { logger.debug("will delete {} items", Optional.ofNullable(data).map(List::size).orElse(0)); if (data == null || data.isEmpty()) return; - for (DmpUserEntity item : data) { + for (PlanUserEntity item : data) { logger.trace("deleting item {}", item.getId()); logger.trace("updating item"); item.setUpdatedAt(Instant.now()); diff --git a/backend/core/src/main/java/org/opencdmp/model/deleter/ReferenceDeleter.java b/backend/core/src/main/java/org/opencdmp/model/deleter/ReferenceDeleter.java index f7990bda8..026077c37 100644 --- a/backend/core/src/main/java/org/opencdmp/model/deleter/ReferenceDeleter.java +++ b/backend/core/src/main/java/org/opencdmp/model/deleter/ReferenceDeleter.java @@ -3,7 +3,7 @@ package org.opencdmp.model.deleter; import org.opencdmp.commons.enums.IsActive; import org.opencdmp.data.*; import org.opencdmp.query.DescriptionReferenceQuery; -import org.opencdmp.query.DmpReferenceQuery; +import org.opencdmp.query.PlanReferenceQuery; import org.opencdmp.query.ReferenceQuery; import gr.cite.tools.data.deleter.Deleter; import gr.cite.tools.data.deleter.DeleterFactory; @@ -73,9 +73,9 @@ public class ReferenceDeleter implements Deleter { deleter.delete(items); } { - logger.debug("checking related - {}", DmpReferenceEntity.class.getSimpleName()); - List items = this.queryFactory.query(DmpReferenceQuery.class).referenceIds(ids).collect(); - DmpReferenceDeleter deleter = this.deleterFactory.deleter(DmpReferenceDeleter.class); + logger.debug("checking related - {}", PlanReferenceEntity.class.getSimpleName()); + List items = this.queryFactory.query(PlanReferenceQuery.class).referenceIds(ids).collect(); + PlanReferenceDeleter deleter = this.deleterFactory.deleter(PlanReferenceDeleter.class); deleter.delete(items); } Instant now = Instant.now(); diff --git a/backend/core/src/main/java/org/opencdmp/model/description/Description.java b/backend/core/src/main/java/org/opencdmp/model/description/Description.java index 387664094..fcf647fed 100644 --- a/backend/core/src/main/java/org/opencdmp/model/description/Description.java +++ b/backend/core/src/main/java/org/opencdmp/model/description/Description.java @@ -5,7 +5,7 @@ import org.opencdmp.commons.enums.IsActive; import org.opencdmp.model.*; import org.opencdmp.model.descriptionreference.DescriptionReference; import org.opencdmp.model.descriptiontemplate.DescriptionTemplate; -import org.opencdmp.model.dmp.Dmp; +import org.opencdmp.model.plan.Plan; import org.opencdmp.model.user.User; import java.time.Instant; @@ -67,9 +67,9 @@ public class Description { public static final String _descriptionTags = "descriptionTags"; - private DmpDescriptionTemplate dmpDescriptionTemplate; + private PlanDescriptionTemplate planDescriptionTemplate; - public static final String _dmpDescriptionTemplate = "dmpDescriptionTemplate"; + public static final String _planDescriptionTemplate = "planDescriptionTemplate"; private DescriptionTemplate descriptionTemplate; @@ -78,9 +78,9 @@ public class Description { private List authorizationFlags; public static final String _authorizationFlags = "authorizationFlags"; - private Dmp dmp; + private Plan plan; - public static final String _dmp = "dmp"; + public static final String _plan = "plan"; private Boolean belongsToCurrentTenant; public static final String _belongsToCurrentTenant = "belongsToCurrentTenant"; @@ -182,12 +182,12 @@ public class Description { this.createdAt = createdAt; } - public DmpDescriptionTemplate getDmpDescriptionTemplate() { - return dmpDescriptionTemplate; + public PlanDescriptionTemplate getPlanDescriptionTemplate() { + return planDescriptionTemplate; } - public void setDmpDescriptionTemplate(DmpDescriptionTemplate dmpDescriptionTemplate) { - this.dmpDescriptionTemplate = dmpDescriptionTemplate; + public void setPlanDescriptionTemplate(PlanDescriptionTemplate planDescriptionTemplate) { + this.planDescriptionTemplate = planDescriptionTemplate; } public List getDescriptionTags() { @@ -198,12 +198,12 @@ public class Description { this.descriptionTags = descriptionTags; } - public Dmp getDmp() { - return dmp; + public Plan getPlan() { + return plan; } - public void setDmp(Dmp dmp) { - this.dmp = dmp; + public void setPlan(Plan plan) { + this.plan = plan; } public DescriptionTemplate getDescriptionTemplate() { diff --git a/backend/core/src/main/java/org/opencdmp/model/dmp/DmpProperties.java b/backend/core/src/main/java/org/opencdmp/model/dmp/DmpProperties.java deleted file mode 100644 index db9ebd404..000000000 --- a/backend/core/src/main/java/org/opencdmp/model/dmp/DmpProperties.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.opencdmp.model.dmp; - -import java.util.List; - -public class DmpProperties { - - private List dmpBlueprintValues; - - public static final String _dmpBlueprintValues = "dmpBlueprintValues"; - - private List contacts; - - public static final String _contacts = "contacts"; - - public List getDmpBlueprintValues() { - return dmpBlueprintValues; - } - - public void setDmpBlueprintValues(List dmpBlueprintValues) { - this.dmpBlueprintValues = dmpBlueprintValues; - } - - public List getContacts() { - return contacts; - } - - public void setContacts(List contacts) { - this.contacts = contacts; - } - -} diff --git a/backend/core/src/main/java/org/opencdmp/model/dmpblueprint/ExtraField.java b/backend/core/src/main/java/org/opencdmp/model/dmpblueprint/ExtraField.java deleted file mode 100644 index 6dcbb749f..000000000 --- a/backend/core/src/main/java/org/opencdmp/model/dmpblueprint/ExtraField.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.opencdmp.model.dmpblueprint; - -import org.opencdmp.commons.enums.DmpBlueprintExtraFieldDataType; - - -public class ExtraField extends Field { - - public final static String _dataType = "dataType"; - private DmpBlueprintExtraFieldDataType dataType; - - public DmpBlueprintExtraFieldDataType getDataType() { - return dataType; - } - - public void setDataType(DmpBlueprintExtraFieldDataType dataType) { - this.dataType = dataType; - } -} - diff --git a/backend/core/src/main/java/org/opencdmp/model/dmpblueprint/SystemField.java b/backend/core/src/main/java/org/opencdmp/model/dmpblueprint/SystemField.java deleted file mode 100644 index d518dcfb4..000000000 --- a/backend/core/src/main/java/org/opencdmp/model/dmpblueprint/SystemField.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.opencdmp.model.dmpblueprint; - -import org.opencdmp.commons.enums.DmpBlueprintSystemFieldType; - -public class SystemField extends Field { - - public final static String _systemFieldType = "systemFieldType"; - private DmpBlueprintSystemFieldType systemFieldType; - - public DmpBlueprintSystemFieldType getSystemFieldType() { - return systemFieldType; - } - - public void setSystemFieldType(DmpBlueprintSystemFieldType systemFieldType) { - this.systemFieldType = systemFieldType; - } -} diff --git a/backend/core/src/main/java/org/opencdmp/model/mapper/publicapi/DescriptionToPublicApiDatasetListingMapper.java b/backend/core/src/main/java/org/opencdmp/model/mapper/publicapi/DescriptionToPublicApiDatasetListingMapper.java index 90aa07a9a..570edf51e 100644 --- a/backend/core/src/main/java/org/opencdmp/model/mapper/publicapi/DescriptionToPublicApiDatasetListingMapper.java +++ b/backend/core/src/main/java/org/opencdmp/model/mapper/publicapi/DescriptionToPublicApiDatasetListingMapper.java @@ -21,8 +21,8 @@ public class DescriptionToPublicApiDatasetListingMapper { model.setDescription(description.getDescription()); model.setVersion(0); - model.setDmp(description.getDmp().getLabel()); - model.setDmpId(description.getDmp().getId().toString()); + model.setDmp(description.getPlan().getLabel()); + model.setDmpId(description.getPlan().getId().toString()); model.setUsers(List.of(UserInfoPublicModel.fromDescriptionCreator(description.getCreatedBy()))); model.setProfile(DatasetProfilePublicModel.fromDataModel(description.getDescriptionTemplate())); model.setGrant(GrantPublicOverviewModel.fromDescriptionReference(description.getDescriptionReferences(), config)); diff --git a/backend/core/src/main/java/org/opencdmp/model/mapper/publicapi/PlanToPublicApiPlanListingMapper.java b/backend/core/src/main/java/org/opencdmp/model/mapper/publicapi/PlanToPublicApiPlanListingMapper.java index 5292dc8e0..f1f83e66e 100644 --- a/backend/core/src/main/java/org/opencdmp/model/mapper/publicapi/PlanToPublicApiPlanListingMapper.java +++ b/backend/core/src/main/java/org/opencdmp/model/mapper/publicapi/PlanToPublicApiPlanListingMapper.java @@ -1,6 +1,6 @@ package org.opencdmp.model.mapper.publicapi; -import org.opencdmp.model.dmp.Dmp; +import org.opencdmp.model.plan.Plan; import org.opencdmp.model.publicapi.listingmodels.DataManagementPlanPublicListingModel; import org.opencdmp.model.publicapi.researcher.ResearcherPublicModel; import org.opencdmp.model.publicapi.user.UserInfoPublicModel; @@ -13,19 +13,19 @@ import java.util.Objects; @Component public class PlanToPublicApiPlanListingMapper { - public DataManagementPlanPublicListingModel toPublicListingModel(Dmp dmp, PublicApiProperties.ReferenceTypeMapConfig config) { + public DataManagementPlanPublicListingModel toPublicListingModel(Plan plan, PublicApiProperties.ReferenceTypeMapConfig config) { DataManagementPlanPublicListingModel model = new DataManagementPlanPublicListingModel(); - model.setId(dmp.getId().toString()); - model.setLabel(dmp.getLabel()); - model.setVersion(dmp.getVersion()); - model.setGroupId(dmp.getGroupId()); + model.setId(plan.getId().toString()); + model.setLabel(plan.getLabel()); + model.setVersion(plan.getVersion()); + model.setGroupId(plan.getGroupId()); - model.setUsers(dmp.getDmpUsers().stream().map(UserInfoPublicModel::fromDmpUser).toList()); - model.setResearchers(dmp.getDmpReferences().stream().map(x-> ResearcherPublicModel.fromDmpReference(x, config)).filter(Objects::nonNull).toList()); + model.setUsers(plan.getPlanUsers().stream().map(UserInfoPublicModel::fromDmpUser).toList()); + model.setResearchers(plan.getPlanReferences().stream().map(x-> ResearcherPublicModel.fromDmpReference(x, config)).filter(Objects::nonNull).toList()); - model.setCreatedAt(Date.from(dmp.getCreatedAt())); - model.setModifiedAt(Date.from(dmp.getUpdatedAt())); - model.setFinalizedAt(Date.from(dmp.getFinalizedAt())); + model.setCreatedAt(Date.from(plan.getCreatedAt())); + model.setModifiedAt(Date.from(plan.getUpdatedAt())); + model.setFinalizedAt(Date.from(plan.getFinalizedAt())); model.setPublishedAt(model.getFinalizedAt()); return model; diff --git a/backend/core/src/main/java/org/opencdmp/model/mapper/publicapi/PlanToPublicApiPlanMapper.java b/backend/core/src/main/java/org/opencdmp/model/mapper/publicapi/PlanToPublicApiPlanMapper.java index 4db1bf1f0..034e430ca 100644 --- a/backend/core/src/main/java/org/opencdmp/model/mapper/publicapi/PlanToPublicApiPlanMapper.java +++ b/backend/core/src/main/java/org/opencdmp/model/mapper/publicapi/PlanToPublicApiPlanMapper.java @@ -1,8 +1,8 @@ package org.opencdmp.model.mapper.publicapi; import org.opencdmp.data.EntityDoiEntity; -import org.opencdmp.model.dmp.Dmp; -import org.opencdmp.model.DmpDescriptionTemplate; +import org.opencdmp.model.PlanDescriptionTemplate; +import org.opencdmp.model.plan.Plan; import org.opencdmp.model.publicapi.associatedprofile.AssociatedProfilePublicModel; import org.opencdmp.model.publicapi.doi.DoiPublicModel; import org.opencdmp.model.publicapi.grant.GrantPublicOverviewModel; @@ -27,31 +27,31 @@ public class PlanToPublicApiPlanMapper { this.descriptionToPublicApiDatasetMapper = descriptionToPublicApiDatasetMapper; } - public DataManagementPlanPublicModel toPublicModel(Dmp dmp, List doiEntities, List descriptionTemplates, PublicApiProperties.ReferenceTypeMapConfig config) { + public DataManagementPlanPublicModel toPublicModel(Plan plan, List doiEntities, List descriptionTemplates, PublicApiProperties.ReferenceTypeMapConfig config) { DataManagementPlanPublicModel model = new DataManagementPlanPublicModel(); - model.setId(dmp.getId().toString()); - model.setLabel(dmp.getLabel()); - model.setDescription(dmp.getDescription()); - model.setVersion(dmp.getVersion()); - model.setGroupId(dmp.getGroupId()); - if (dmp.getBlueprint() != null) model.setProfile(dmp.getBlueprint().getLabel()); + model.setId(plan.getId().toString()); + model.setLabel(plan.getLabel()); + model.setDescription(plan.getDescription()); + model.setVersion(plan.getVersion()); + model.setGroupId(plan.getGroupId()); + if (plan.getBlueprint() != null) model.setProfile(plan.getBlueprint().getLabel()); - if (dmp.getDescriptions() != null) { + if (plan.getDescriptions() != null) { DataManagementPlanPublicListingModel publicListingModel = new DataManagementPlanPublicListingModel(); publicListingModel.setId(model.getId()); - model.setDatasets(dmp.getDescriptions().stream().map(x -> descriptionToPublicApiDatasetMapper.toPublicModel(x, publicListingModel, config)).toList()); + model.setDatasets(plan.getDescriptions().stream().map(x -> descriptionToPublicApiDatasetMapper.toPublicModel(x, publicListingModel, config)).toList()); } - model.setUsers(dmp.getDmpUsers().stream().map(UserInfoPublicModel::fromDmpUser).toList()); - model.setResearchers(dmp.getDmpReferences().stream().map(x-> ResearcherPublicModel.fromDmpReference(x, config)).filter(Objects::nonNull).toList()); - model.setGrant(GrantPublicOverviewModel.fromDmpReferences(dmp.getDmpReferences(), config)); - model.setOrganisations(dmp.getDmpReferences().stream().map(x-> OrganizationPublicModel.fromDmpReference(x, config)).filter(Objects::nonNull).toList()); + model.setUsers(plan.getPlanUsers().stream().map(UserInfoPublicModel::fromDmpUser).toList()); + model.setResearchers(plan.getPlanReferences().stream().map(x-> ResearcherPublicModel.fromDmpReference(x, config)).filter(Objects::nonNull).toList()); + model.setGrant(GrantPublicOverviewModel.fromDmpReferences(plan.getPlanReferences(), config)); + model.setOrganisations(plan.getPlanReferences().stream().map(x-> OrganizationPublicModel.fromDmpReference(x, config)).filter(Objects::nonNull).toList()); model.setDois(doiEntities.stream().map(DoiPublicModel::fromDataModel).toList()); - model.setAssociatedProfiles(descriptionTemplates.stream().map(x -> AssociatedProfilePublicModel.fromDmpDescriptionTemplate(x, dmp.getBlueprint())).toList()); + model.setAssociatedProfiles(descriptionTemplates.stream().map(x -> AssociatedProfilePublicModel.fromPlanDescriptionTemplate(x, plan.getBlueprint())).toList()); - model.setCreatedAt(Date.from(dmp.getCreatedAt())); - model.setModifiedAt(Date.from(dmp.getUpdatedAt())); - model.setFinalizedAt(Date.from(dmp.getFinalizedAt())); + model.setCreatedAt(Date.from(plan.getCreatedAt())); + model.setModifiedAt(Date.from(plan.getUpdatedAt())); + model.setFinalizedAt(Date.from(plan.getFinalizedAt())); return model; } diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/ActionConfirmationPersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/ActionConfirmationPersist.java index ed62e9f83..79e611c0a 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/ActionConfirmationPersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/ActionConfirmationPersist.java @@ -7,7 +7,7 @@ import gr.cite.tools.validation.ValidatorFactory; import gr.cite.tools.validation.specification.Specification; import org.opencdmp.convention.ConventionService; import org.opencdmp.errorcode.ErrorThesaurusProperties; -import org.opencdmp.model.persist.actionconfirmation.DmpInvitationPersist; +import org.opencdmp.model.persist.actionconfirmation.PlanInvitationPersist; import org.opencdmp.model.persist.actionconfirmation.MergeAccountConfirmationPersist; import org.opencdmp.model.persist.actionconfirmation.RemoveCredentialRequestPersist; import org.springframework.beans.factory.config.ConfigurableBeanFactory; @@ -37,9 +37,9 @@ public class ActionConfirmationPersist { private static final String _token = "token"; - private DmpInvitationPersist dmpInvitation; + private PlanInvitationPersist planInvitation; - private static final String _dmpInvitation = "dmpInvitation"; + private static final String _planInvitation = "planInvitation"; private MergeAccountConfirmationPersist mergeAccountConfirmation; @@ -85,12 +85,12 @@ public class ActionConfirmationPersist { this.status = status; } - public DmpInvitationPersist getDmpInvitation() { - return dmpInvitation; + public PlanInvitationPersist getPlanInvitation() { + return planInvitation; } - public void setDmpInvitation(DmpInvitationPersist dmpInvitation) { - this.dmpInvitation = dmpInvitation; + public void setPlanInvitation(PlanInvitationPersist planInvitation) { + this.planInvitation = planInvitation; } public MergeAccountConfirmationPersist getMergeAccountConfirmation() { @@ -191,9 +191,9 @@ public class ActionConfirmationPersist { .must(() -> !this.isNull(item.getMergeAccountConfirmation())) .failOn(ActionConfirmationPersist._mergeAccountConfirmation).failWith(messageSource.getMessage("Validation_Required", new Object[]{ActionConfirmationPersist._mergeAccountConfirmation}, LocaleContextHolder.getLocale())), this.spec() - .iff(() -> ActionConfirmationType.DmpInvitation.equals(item.getType())) - .must(() -> !this.isNull(item.getDmpInvitation())) - .failOn(ActionConfirmationPersist._dmpInvitation).failWith(messageSource.getMessage("Validation_Required", new Object[]{ActionConfirmationPersist._dmpInvitation}, LocaleContextHolder.getLocale())), + .iff(() -> ActionConfirmationType.PlanInvitation.equals(item.getType())) + .must(() -> !this.isNull(item.getPlanInvitation())) + .failOn(ActionConfirmationPersist._planInvitation).failWith(messageSource.getMessage("Validation_Required", new Object[]{ActionConfirmationPersist._planInvitation}, LocaleContextHolder.getLocale())), this.spec() .iff(() -> ActionConfirmationType.RemoveCredential.equals(item.getType())) .must(() -> !this.isNull(item.getRemoveCredentialRequest())) @@ -203,10 +203,10 @@ public class ActionConfirmationPersist { .must(() -> !this.isNull(item.getUserInviteToTenantRequest())) .failOn(ActionConfirmationPersist._userInviteToTenantRequest).failWith(messageSource.getMessage("Validation_Required", new Object[]{ActionConfirmationPersist._userInviteToTenantRequest}, LocaleContextHolder.getLocale())), this.refSpec() - .iff(() -> !this.isNull(item.getDmpInvitation())) - .on(ActionConfirmationPersist._dmpInvitation) - .over(item.getDmpInvitation()) - .using(() -> this.validatorFactory.validator(DmpInvitationPersist.DmpInvitationPersistValidator.class)), + .iff(() -> !this.isNull(item.getPlanInvitation())) + .on(ActionConfirmationPersist._planInvitation) + .over(item.getPlanInvitation()) + .using(() -> this.validatorFactory.validator(PlanInvitationPersist.PlanInvitationPersistValidator.class)), this.refSpec() .iff(() -> !this.isNull(item.getMergeAccountConfirmation())) .on(ActionConfirmationPersist._mergeAccountConfirmation) diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/CloneDmpPersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/ClonePlanPersist.java similarity index 66% rename from backend/core/src/main/java/org/opencdmp/model/persist/CloneDmpPersist.java rename to backend/core/src/main/java/org/opencdmp/model/persist/ClonePlanPersist.java index 957485c6c..26848e8cc 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/CloneDmpPersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/ClonePlanPersist.java @@ -15,7 +15,7 @@ import java.util.Arrays; import java.util.List; import java.util.UUID; -public class CloneDmpPersist { +public class ClonePlanPersist { private UUID id = null; @@ -65,36 +65,36 @@ public class CloneDmpPersist { this.descriptions = descriptions; } - @Component(CloneDmpPersistValidator.ValidatorName) + @Component(ClonePlanPersistValidator.ValidatorName) @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public static class CloneDmpPersistValidator extends BaseValidator { + public static class ClonePlanPersistValidator extends BaseValidator { - public static final String ValidatorName = "CloneDmpPersistValidator"; + public static final String ValidatorName = "ClonePlanPersistValidator"; private final MessageSource messageSource; - protected CloneDmpPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) { + protected ClonePlanPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) { super(conventionService, errors); this.messageSource = messageSource; } @Override - protected Class modelClass() { - return CloneDmpPersist.class; + protected Class modelClass() { + return ClonePlanPersist.class; } @Override - protected List specifications(CloneDmpPersist item) { + protected List specifications(ClonePlanPersist item) { return Arrays.asList( this.spec() .must(() -> this.isValidGuid(item.getId())) - .failOn(CloneDmpPersist._id).failWith(messageSource.getMessage("Validation_Required", new Object[]{CloneDmpPersist._id}, LocaleContextHolder.getLocale())), + .failOn(ClonePlanPersist._id).failWith(messageSource.getMessage("Validation_Required", new Object[]{ClonePlanPersist._id}, LocaleContextHolder.getLocale())), this.spec() .must(() -> !this.isEmpty(item.getLabel())) - .failOn(CloneDmpPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{CloneDmpPersist._label}, LocaleContextHolder.getLocale())), + .failOn(ClonePlanPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{ClonePlanPersist._label}, LocaleContextHolder.getLocale())), this.spec() .must(() -> !this.isEmpty(item.getDescription())) - .failOn(CloneDmpPersist._description).failWith(messageSource.getMessage("Validation_Required", new Object[]{CloneDmpPersist._description}, LocaleContextHolder.getLocale())) + .failOn(ClonePlanPersist._description).failWith(messageSource.getMessage("Validation_Required", new Object[]{ClonePlanPersist._description}, LocaleContextHolder.getLocale())) ); } } diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/DescriptionPersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/DescriptionPersist.java index b37bb69ec..8d83fb872 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/DescriptionPersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/DescriptionPersist.java @@ -8,14 +8,14 @@ import org.opencdmp.commons.XmlHandlingService; import org.opencdmp.commons.enums.DescriptionStatus; import org.opencdmp.commons.enums.IsActive; import org.opencdmp.commons.types.descriptiontemplate.DefinitionEntity; -import org.opencdmp.commons.types.dmpblueprint.SectionEntity; +import org.opencdmp.commons.types.planblueprint.SectionEntity; import org.opencdmp.commons.validation.BaseValidator; import org.opencdmp.convention.ConventionService; import org.opencdmp.data.*; import org.opencdmp.errorcode.ErrorThesaurusProperties; import org.opencdmp.model.persist.descriptionproperties.PropertyDefinitionPersist; import org.opencdmp.query.DescriptionQuery; -import org.opencdmp.query.DmpDescriptionTemplateQuery; +import org.opencdmp.query.PlanDescriptionTemplateQuery; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.MessageSource; import org.springframework.context.annotation.Scope; @@ -35,13 +35,13 @@ public class DescriptionPersist { public static final String _label = "label"; - private UUID dmpId; + private UUID planId; - public static final String _dmpId = "dmpId"; + public static final String _planId = "planId"; - private UUID dmpDescriptionTemplateId; + private UUID planDescriptionTemplateId; - public static final String _dmpDescriptionTemplateId = "dmpDescriptionTemplateId"; + public static final String _planDescriptionTemplateId = "planDescriptionTemplateId"; private UUID descriptionTemplateId; @@ -82,20 +82,20 @@ public class DescriptionPersist { this.label = label; } - public UUID getDmpId() { - return this.dmpId; + public UUID getPlanId() { + return this.planId; } - public void setDmpId(UUID dmpId) { - this.dmpId = dmpId; + public void setPlanId(UUID planId) { + this.planId = planId; } - public UUID getDmpDescriptionTemplateId() { - return this.dmpDescriptionTemplateId; + public UUID getPlanDescriptionTemplateId() { + return this.planDescriptionTemplateId; } - public void setDmpDescriptionTemplateId(UUID dmpDescriptionTemplateId) { - this.dmpDescriptionTemplateId = dmpDescriptionTemplateId; + public void setPlanDescriptionTemplateId(UUID planDescriptionTemplateId) { + this.planDescriptionTemplateId = planDescriptionTemplateId; } public DescriptionStatus getStatus() { @@ -177,18 +177,18 @@ public class DescriptionPersist { @Override protected List specifications(DescriptionPersist item) { DescriptionTemplateEntity descriptionTemplate = null; - DmpEntity dmpEntity = null; - DmpBlueprintEntity dmpBlueprintEntity = null; + PlanEntity planEntity = null; + PlanBlueprintEntity planBlueprintEntity = null; try { descriptionTemplate = this.isValidGuid(item.getDescriptionTemplateId()) ? this.entityManager.find(DescriptionTemplateEntity.class, item.getDescriptionTemplateId(), true) : null; - dmpEntity = this.isValidGuid(item.getDmpId()) ? this.entityManager.find(DmpEntity.class, item.getDmpId(), true) : null; - dmpBlueprintEntity = dmpEntity == null ? null : this.entityManager.find(DmpBlueprintEntity.class, dmpEntity.getBlueprintId()); + planEntity = this.isValidGuid(item.getPlanId()) ? this.entityManager.find(PlanEntity.class, item.getPlanId(), true) : null; + planBlueprintEntity = planEntity == null ? null : this.entityManager.find(PlanBlueprintEntity.class, planEntity.getBlueprintId()); } catch (InvalidApplicationException e) { throw new RuntimeException(e); } DefinitionEntity definition = descriptionTemplate == null ? null : this.xmlHandlingService.fromXmlSafe(DefinitionEntity.class, descriptionTemplate.getDefinition()); - DmpBlueprintEntity finalDmpBlueprintEntity = dmpBlueprintEntity; + PlanBlueprintEntity finalPlanBlueprintEntity = planBlueprintEntity; return Arrays.asList( this.spec() .iff(() -> this.isValidGuid(item.getId())) @@ -206,14 +206,14 @@ public class DescriptionPersist { .must(() -> this.lessEqualLength(item.getLabel(), DescriptionEntity._labelLength)) .failOn(DescriptionPersist._label).failWith(this.messageSource.getMessage("Validation_MaxLength", new Object[]{DescriptionPersist._label}, LocaleContextHolder.getLocale())), this.spec() - .must(() -> this.isValidGuid(item.getDmpId())) - .failOn(DescriptionPersist._dmpId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._dmpId}, LocaleContextHolder.getLocale())), + .must(() -> this.isValidGuid(item.getPlanId())) + .failOn(DescriptionPersist._planId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._planId}, LocaleContextHolder.getLocale())), this.spec() .must(() -> this.isValidGuid(item.getDescriptionTemplateId())) .failOn(DescriptionPersist._descriptionTemplateId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._descriptionTemplateId}, LocaleContextHolder.getLocale())), this.spec() - .must(() -> this.isValidGuid(item.getDmpDescriptionTemplateId())) - .failOn(DescriptionPersist._dmpDescriptionTemplateId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._dmpDescriptionTemplateId}, LocaleContextHolder.getLocale())), + .must(() -> this.isValidGuid(item.getPlanDescriptionTemplateId())) + .failOn(DescriptionPersist._planDescriptionTemplateId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._planDescriptionTemplateId}, LocaleContextHolder.getLocale())), this.spec() .must(() -> !this.isNull(item.getStatus())) .failOn(DescriptionPersist._status).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._status}, LocaleContextHolder.getLocale())), @@ -222,7 +222,7 @@ public class DescriptionPersist { .must(() -> !this.isNull(item.getProperties())) .failOn(DescriptionPersist._properties).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._properties}, LocaleContextHolder.getLocale())), this.spec() - .must(() -> this.isDescriptionTemplateMaxMultiplicityValid(finalDmpBlueprintEntity, item.getDmpId(), item.getDmpDescriptionTemplateId(), this.isValidGuid(item.getId()))) + .must(() -> this.isDescriptionTemplateMaxMultiplicityValid(finalPlanBlueprintEntity, item.getPlanId(), item.getPlanDescriptionTemplateId(), this.isValidGuid(item.getId()))) .failOn(DescriptionPersist._descriptionTemplateId).failWith(this.messageSource.getMessage("Validation.InvalidDescriptionTemplateMultiplicity", new Object[]{DescriptionPersist._descriptionTemplateId}, LocaleContextHolder.getLocale())), this.refSpec() .iff(() -> item.getStatus() == DescriptionStatus.Finalized) @@ -237,25 +237,25 @@ public class DescriptionPersist { ); } - private boolean isDescriptionTemplateMaxMultiplicityValid(DmpBlueprintEntity dmpBlueprintEntity, UUID dmpId, UUID dmpDescriptionTemplateId, Boolean isUpdate){ - org.opencdmp.commons.types.dmpblueprint.DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(org.opencdmp.commons.types.dmpblueprint.DefinitionEntity.class, dmpBlueprintEntity.getDefinition()); + private boolean isDescriptionTemplateMaxMultiplicityValid(PlanBlueprintEntity planBlueprintEntity, UUID planId, UUID planDescriptionTemplateId, Boolean isUpdate){ + org.opencdmp.commons.types.planblueprint.DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(org.opencdmp.commons.types.planblueprint.DefinitionEntity.class, planBlueprintEntity.getDefinition()); if (definition == null || this.isListNullOrEmpty(definition.getSections())) return true; - DmpDescriptionTemplateEntity dmpDescriptionTemplateEntity = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking().ids(dmpDescriptionTemplateId).isActive(IsActive.Active).dmpIds(dmpId).first(); - if (dmpDescriptionTemplateEntity == null) return true; + PlanDescriptionTemplateEntity planDescriptionTemplateEntity = this.queryFactory.query(PlanDescriptionTemplateQuery.class).disableTracking().ids(planDescriptionTemplateId).isActive(IsActive.Active).planIds(planId).first(); + if (planDescriptionTemplateEntity == null) return true; - List descriptionEntities = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).dmpIds(dmpId).dmpDescriptionTemplateIds(dmpDescriptionTemplateId).isActive(IsActive.Active).collect(); + List descriptionEntities = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).planIds(planId).planDescriptionTemplateIds(planDescriptionTemplateId).isActive(IsActive.Active).collect(); for (SectionEntity section: definition.getSections()) { - if (dmpDescriptionTemplateEntity.getSectionId().equals(section.getId()) && section.getHasTemplates() && !this.isListNullOrEmpty(section.getDescriptionTemplates())){ + if (planDescriptionTemplateEntity.getSectionId().equals(section.getId()) && section.getHasTemplates() && !this.isListNullOrEmpty(section.getDescriptionTemplates())){ int descriptionsCount; if (isUpdate) descriptionsCount = -1; else descriptionsCount = 0; - for (org.opencdmp.commons.types.dmpblueprint.DescriptionTemplateEntity sectionDescriptionTemplate: section.getDescriptionTemplates()) { - if (sectionDescriptionTemplate.getDescriptionTemplateGroupId().equals(dmpDescriptionTemplateEntity.getDescriptionTemplateGroupId())){ + for (org.opencdmp.commons.types.planblueprint.DescriptionTemplateEntity sectionDescriptionTemplate: section.getDescriptionTemplates()) { + if (sectionDescriptionTemplate.getDescriptionTemplateGroupId().equals(planDescriptionTemplateEntity.getDescriptionTemplateGroupId())){ for (DescriptionEntity description: descriptionEntities){ - if (description.getDmpDescriptionTemplateId().equals(dmpDescriptionTemplateEntity.getId())) descriptionsCount++; + if (description.getPlanDescriptionTemplateId().equals(planDescriptionTemplateEntity.getId())) descriptionsCount++; } if (sectionDescriptionTemplate.getMaxMultiplicity() != null && sectionDescriptionTemplate.getMaxMultiplicity() <= descriptionsCount) return false; } diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/DescriptionReferencePersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/DescriptionReferencePersist.java index 6a4633c81..1a916cd32 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/DescriptionReferencePersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/DescriptionReferencePersist.java @@ -6,7 +6,7 @@ import org.opencdmp.commons.validation.BaseValidator; import org.opencdmp.convention.ConventionService; import org.opencdmp.errorcode.ErrorThesaurusProperties; import org.opencdmp.model.persist.descriptionreference.DescriptionReferenceDataPersist; -import org.opencdmp.model.persist.dmpreference.DmpReferenceDataPersist; +import org.opencdmp.model.persist.planreference.PlanReferenceDataPersist; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.MessageSource; import org.springframework.context.annotation.Scope; @@ -83,7 +83,7 @@ public class DescriptionReferencePersist { .iff(() -> !this.isNull(item.getData())) .on(DescriptionReferencePersist._data) .over(item.getData()) - .using(() -> this.validatorFactory.validator(DmpReferenceDataPersist.DmpReferenceDataPersistValidator.class)) + .using(() -> this.validatorFactory.validator(PlanReferenceDataPersist.PlanReferenceDataPersistValidator.class)) ); } } diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/DescriptionSectionPermissionResolver.java b/backend/core/src/main/java/org/opencdmp/model/persist/DescriptionSectionPermissionResolver.java index c1520635f..fbc49fd44 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/DescriptionSectionPermissionResolver.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/DescriptionSectionPermissionResolver.java @@ -16,8 +16,8 @@ import java.util.UUID; public class DescriptionSectionPermissionResolver { - private UUID dmpId; - public static final String _dmpId = "dmpId"; + private UUID planId; + public static final String _planId = "planId"; private List sectionIds; @@ -27,12 +27,12 @@ public class DescriptionSectionPermissionResolver { public static final String _permissions = "permissions"; - public UUID getDmpId() { - return dmpId; + public UUID getPlanId() { + return planId; } - public void setDmpId(UUID dmpId) { - this.dmpId = dmpId; + public void setPlanId(UUID planId) { + this.planId = planId; } public List getSectionIds() { @@ -73,8 +73,8 @@ public class DescriptionSectionPermissionResolver { protected List specifications(DescriptionSectionPermissionResolver item) { return Arrays.asList( this.spec() - .must(() -> this.isValidGuid(item.getDmpId())) - .failOn(DescriptionSectionPermissionResolver._dmpId).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionSectionPermissionResolver._dmpId}, LocaleContextHolder.getLocale())), + .must(() -> this.isValidGuid(item.getPlanId())) + .failOn(DescriptionSectionPermissionResolver._planId).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionSectionPermissionResolver._planId}, LocaleContextHolder.getLocale())), this.spec() .must(() -> item.getPermissions() != null && !item.getPermissions().isEmpty()) .failOn(DescriptionSectionPermissionResolver._permissions).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionSectionPermissionResolver._permissions}, LocaleContextHolder.getLocale())), diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/DescriptionTemplateTypePersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/DescriptionTemplateTypePersist.java index 2ae65d4e2..d3d0b0dd0 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/DescriptionTemplateTypePersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/DescriptionTemplateTypePersist.java @@ -4,9 +4,6 @@ package org.opencdmp.model.persist; import org.opencdmp.commons.enums.DescriptionTemplateTypeStatus; import org.opencdmp.commons.validation.*; -import org.opencdmp.model.persist.dmpproperties.DmpBlueprintValuePersist; -import org.opencdmp.model.persist.dmpproperties.DmpPropertiesPersist; -import gr.cite.tools.validation.ValidatorFactory; import gr.cite.tools.validation.specification.Specification; import org.opencdmp.convention.ConventionService; import org.opencdmp.data.DescriptionTemplateTypeEntity; diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/NewVersionDmpBlueprintPersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/NewVersionPlanBlueprintPersist.java similarity index 59% rename from backend/core/src/main/java/org/opencdmp/model/persist/NewVersionDmpBlueprintPersist.java rename to backend/core/src/main/java/org/opencdmp/model/persist/NewVersionPlanBlueprintPersist.java index a20ca5c81..b2f21a00c 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/NewVersionDmpBlueprintPersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/NewVersionPlanBlueprintPersist.java @@ -2,10 +2,10 @@ package org.opencdmp.model.persist; import gr.cite.tools.validation.ValidatorFactory; import gr.cite.tools.validation.specification.Specification; -import org.opencdmp.commons.enums.DmpBlueprintStatus; +import org.opencdmp.commons.enums.PlanBlueprintStatus; import org.opencdmp.commons.validation.BaseValidator; import org.opencdmp.convention.ConventionService; -import org.opencdmp.data.DmpBlueprintEntity; +import org.opencdmp.data.PlanBlueprintEntity; import org.opencdmp.errorcode.ErrorThesaurusProperties; import org.opencdmp.model.persist.dmpblueprintdefinition.DefinitionPersist; import org.springframework.beans.factory.config.ConfigurableBeanFactory; @@ -18,7 +18,7 @@ import java.util.Arrays; import java.util.List; import java.util.UUID; -public class NewVersionDmpBlueprintPersist { +public class NewVersionPlanBlueprintPersist { private UUID id; @@ -30,7 +30,7 @@ public class NewVersionDmpBlueprintPersist { public static final String _definition = "definition"; - private DmpBlueprintStatus status; + private PlanBlueprintStatus status; public static final String _status = "status"; @@ -62,11 +62,11 @@ public class NewVersionDmpBlueprintPersist { this.definition = definition; } - public DmpBlueprintStatus getStatus() { + public PlanBlueprintStatus getStatus() { return this.status; } - public void setStatus(DmpBlueprintStatus status) { + public void setStatus(PlanBlueprintStatus status) { this.status = status; } @@ -78,51 +78,51 @@ public class NewVersionDmpBlueprintPersist { this.hash = hash; } - @Component(NewVersionDmpBlueprintPersistValidator.ValidatorName) + @Component(NewVersionPlanBlueprintPersistValidator.ValidatorName) @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public static class NewVersionDmpBlueprintPersistValidator extends BaseValidator { + public static class NewVersionPlanBlueprintPersistValidator extends BaseValidator { - public static final String ValidatorName = "NewVersionDmpBlueprintPersistValidator"; + public static final String ValidatorName = "NewVersionPlanBlueprintPersistValidator"; private final MessageSource messageSource; private final ValidatorFactory validatorFactory; - public NewVersionDmpBlueprintPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) { + public NewVersionPlanBlueprintPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) { super(conventionService, errors); this.messageSource = messageSource; this.validatorFactory = validatorFactory; } @Override - protected Class modelClass() { - return NewVersionDmpBlueprintPersist.class; + protected Class modelClass() { + return NewVersionPlanBlueprintPersist.class; } @Override - protected List specifications(NewVersionDmpBlueprintPersist item) { + protected List specifications(NewVersionPlanBlueprintPersist item) { return Arrays.asList( this.spec() .iff(() -> this.isValidGuid(item.getId())) .must(() -> this.isValidHash(item.getHash())) - .failOn(NewVersionDmpBlueprintPersist._hash).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{NewVersionDmpBlueprintPersist._hash}, LocaleContextHolder.getLocale())), + .failOn(NewVersionPlanBlueprintPersist._hash).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{NewVersionPlanBlueprintPersist._hash}, LocaleContextHolder.getLocale())), this.spec() .must(() -> !this.isEmpty(item.getLabel())) - .failOn(NewVersionDmpBlueprintPersist._label).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{NewVersionDmpBlueprintPersist._label}, LocaleContextHolder.getLocale())), + .failOn(NewVersionPlanBlueprintPersist._label).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{NewVersionPlanBlueprintPersist._label}, LocaleContextHolder.getLocale())), this.spec() .iff(() -> !this.isEmpty(item.getLabel())) - .must(() -> this.lessEqualLength(item.getLabel(), DmpBlueprintEntity._labelLength)) - .failOn(NewVersionDmpBlueprintPersist._label).failWith(this.messageSource.getMessage("Validation_MaxLength", new Object[]{NewVersionDmpBlueprintPersist._label}, LocaleContextHolder.getLocale())), + .must(() -> this.lessEqualLength(item.getLabel(), PlanBlueprintEntity._labelLength)) + .failOn(NewVersionPlanBlueprintPersist._label).failWith(this.messageSource.getMessage("Validation_MaxLength", new Object[]{NewVersionPlanBlueprintPersist._label}, LocaleContextHolder.getLocale())), this.spec() .must(() -> !this.isNull(item.getStatus())) - .failOn(NewVersionDmpBlueprintPersist._status).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{NewVersionDmpBlueprintPersist._status}, LocaleContextHolder.getLocale())), + .failOn(NewVersionPlanBlueprintPersist._status).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{NewVersionPlanBlueprintPersist._status}, LocaleContextHolder.getLocale())), this.spec() .must(() -> !this.isNull(item.getDefinition())) - .failOn(NewVersionDmpBlueprintPersist._definition).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{NewVersionDmpBlueprintPersist._definition}, LocaleContextHolder.getLocale())), + .failOn(NewVersionPlanBlueprintPersist._definition).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{NewVersionPlanBlueprintPersist._definition}, LocaleContextHolder.getLocale())), this.refSpec() .iff(() -> !this.isNull(item.getDefinition())) - .on(NewVersionDmpBlueprintPersist._definition) + .on(NewVersionPlanBlueprintPersist._definition) .over(item.getDefinition()) .using(() -> this.validatorFactory.validator(DefinitionPersist.DefinitionPersistValidator.class)) ); diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/NewVersionDmpDescriptionPersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/NewVersionPlanDescriptionPersist.java similarity index 58% rename from backend/core/src/main/java/org/opencdmp/model/persist/NewVersionDmpDescriptionPersist.java rename to backend/core/src/main/java/org/opencdmp/model/persist/NewVersionPlanDescriptionPersist.java index f20b9c02f..a80059b18 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/NewVersionDmpDescriptionPersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/NewVersionPlanDescriptionPersist.java @@ -14,7 +14,7 @@ import java.util.Arrays; import java.util.List; import java.util.UUID; -public class NewVersionDmpDescriptionPersist { +public class NewVersionPlanDescriptionPersist { private UUID descriptionId; public static final String _descriptionId = "descriptionId"; @@ -39,33 +39,33 @@ public class NewVersionDmpDescriptionPersist { this.blueprintSectionId = blueprintSectionId; } - @Component(NewVersionDmpDescriptionPersist.NewVersionDmpDescriptionPersistValidator.ValidatorName) + @Component(NewVersionPlanDescriptionPersistValidator.ValidatorName) @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public static class NewVersionDmpDescriptionPersistValidator extends BaseValidator { + public static class NewVersionPlanDescriptionPersistValidator extends BaseValidator { - public static final String ValidatorName = "NewVersionDmpDescriptionPersistValidator"; + public static final String ValidatorName = "NewVersionPlanDescriptionPersistValidator"; private final MessageSource messageSource; - protected NewVersionDmpDescriptionPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) { + protected NewVersionPlanDescriptionPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) { super(conventionService, errors); this.messageSource = messageSource; } @Override - protected Class modelClass() { - return NewVersionDmpDescriptionPersist.class; + protected Class modelClass() { + return NewVersionPlanDescriptionPersist.class; } @Override - protected List specifications(NewVersionDmpDescriptionPersist item) { + protected List specifications(NewVersionPlanDescriptionPersist item) { return Arrays.asList( this.spec() .must(() -> this.isValidGuid(item.getDescriptionId())) - .failOn(NewVersionDmpDescriptionPersist._descriptionId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{NewVersionDmpDescriptionPersist._descriptionId}, LocaleContextHolder.getLocale())), + .failOn(NewVersionPlanDescriptionPersist._descriptionId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{NewVersionPlanDescriptionPersist._descriptionId}, LocaleContextHolder.getLocale())), this.spec() .must(() -> this.isValidGuid(item.getBlueprintSectionId())) - .failOn(NewVersionDmpDescriptionPersist._blueprintSectionId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{NewVersionDmpDescriptionPersist._blueprintSectionId}, LocaleContextHolder.getLocale())) + .failOn(NewVersionPlanDescriptionPersist._blueprintSectionId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{NewVersionPlanDescriptionPersist._blueprintSectionId}, LocaleContextHolder.getLocale())) ); } } diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/NewVersionDmpPersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/NewVersionPlanPersist.java similarity index 61% rename from backend/core/src/main/java/org/opencdmp/model/persist/NewVersionDmpPersist.java rename to backend/core/src/main/java/org/opencdmp/model/persist/NewVersionPlanPersist.java index 5bdf7639c..f39a2accb 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/NewVersionDmpPersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/NewVersionPlanPersist.java @@ -4,7 +4,7 @@ import gr.cite.tools.validation.ValidatorFactory; import gr.cite.tools.validation.specification.Specification; import org.opencdmp.commons.validation.BaseValidator; import org.opencdmp.convention.ConventionService; -import org.opencdmp.data.DmpEntity; +import org.opencdmp.data.PlanEntity; import org.opencdmp.errorcode.ErrorThesaurusProperties; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.MessageSource; @@ -16,7 +16,7 @@ import java.util.Arrays; import java.util.List; import java.util.UUID; -public class NewVersionDmpPersist { +public class NewVersionPlanPersist { private UUID id; public static final String _id = "id"; @@ -33,7 +33,7 @@ public class NewVersionDmpPersist { public static final String _blueprintId = "blueprintId"; - private List descriptions; + private List descriptions; public static final String _descriptions = "descriptions"; @@ -73,11 +73,11 @@ public class NewVersionDmpPersist { this.blueprintId = blueprintId; } - public List getDescriptions() { + public List getDescriptions() { return descriptions; } - public void setDescriptions(List descriptions) { + public void setDescriptions(List descriptions) { this.descriptions = descriptions; } @@ -89,51 +89,51 @@ public class NewVersionDmpPersist { this.hash = hash; } - @Component(NewVersionDmpPersist.NewVersionDmpPersistValidator.ValidatorName) + @Component(NewVersionPlanPersistValidator.ValidatorName) @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public static class NewVersionDmpPersistValidator extends BaseValidator { + public static class NewVersionPlanPersistValidator extends BaseValidator { - public static final String ValidatorName = "NewVersionDmpPersistValidator"; + public static final String ValidatorName = "NewVersionPlanPersistValidator"; private final MessageSource messageSource; private final ValidatorFactory validatorFactory; - protected NewVersionDmpPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) { + protected NewVersionPlanPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) { super(conventionService, errors); this.messageSource = messageSource; this.validatorFactory = validatorFactory; } @Override - protected Class modelClass() { - return NewVersionDmpPersist.class; + protected Class modelClass() { + return NewVersionPlanPersist.class; } @Override - protected List specifications(NewVersionDmpPersist item) { + protected List specifications(NewVersionPlanPersist item) { return Arrays.asList( this.spec() .iff(() -> this.isValidGuid(item.getId())) .must(() -> this.isValidHash(item.getHash())) - .failOn(NewVersionDmpPersist._hash).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{NewVersionDmpPersist._hash}, LocaleContextHolder.getLocale())), + .failOn(NewVersionPlanPersist._hash).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{NewVersionPlanPersist._hash}, LocaleContextHolder.getLocale())), this.spec() .must(() -> !this.isEmpty(item.getLabel())) - .failOn(NewVersionDmpPersist._label).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{NewVersionDmpPersist._label}, LocaleContextHolder.getLocale())), + .failOn(NewVersionPlanPersist._label).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{NewVersionPlanPersist._label}, LocaleContextHolder.getLocale())), this.spec() .iff(() -> !this.isEmpty(item.getLabel())) - .must(() -> this.lessEqualLength(item.getLabel(), DmpEntity._labelLength)) - .failOn(NewVersionDmpPersist._label).failWith(this.messageSource.getMessage("Validation_MaxLength", new Object[]{NewVersionDmpPersist._label}, LocaleContextHolder.getLocale())), + .must(() -> this.lessEqualLength(item.getLabel(), PlanEntity._labelLength)) + .failOn(NewVersionPlanPersist._label).failWith(this.messageSource.getMessage("Validation_MaxLength", new Object[]{NewVersionPlanPersist._label}, LocaleContextHolder.getLocale())), this.spec() .must(() -> !this.isEmpty(item.getDescription())) - .failOn(NewVersionDmpPersist._description).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{NewVersionDmpPersist._description}, LocaleContextHolder.getLocale())), + .failOn(NewVersionPlanPersist._description).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{NewVersionPlanPersist._description}, LocaleContextHolder.getLocale())), this.spec() .must(() -> this.isValidGuid(item.getBlueprintId())) - .failOn(NewVersionDmpPersist._blueprintId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{NewVersionDmpPersist._blueprintId}, LocaleContextHolder.getLocale())), + .failOn(NewVersionPlanPersist._blueprintId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{NewVersionPlanPersist._blueprintId}, LocaleContextHolder.getLocale())), this.navSpec() .iff(() -> !this.isListNullOrEmpty(item.getDescriptions())) - .on(NewVersionDmpPersist._descriptions) + .on(NewVersionPlanPersist._descriptions) .over(item.getDescriptions()) - .using((itm) -> this.validatorFactory.validator(NewVersionDmpDescriptionPersist.NewVersionDmpDescriptionPersistValidator.class)) + .using((itm) -> this.validatorFactory.validator(NewVersionPlanDescriptionPersist.NewVersionPlanDescriptionPersistValidator.class)) ); } } diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/DmpBlueprintPersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/PlanBlueprintPersist.java similarity index 61% rename from backend/core/src/main/java/org/opencdmp/model/persist/DmpBlueprintPersist.java rename to backend/core/src/main/java/org/opencdmp/model/persist/PlanBlueprintPersist.java index deae9dff1..cafb76201 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/DmpBlueprintPersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/PlanBlueprintPersist.java @@ -1,11 +1,11 @@ package org.opencdmp.model.persist; -import org.opencdmp.commons.enums.DmpBlueprintStatus; +import org.opencdmp.commons.enums.PlanBlueprintStatus; import org.opencdmp.commons.validation.BaseValidator; import gr.cite.tools.validation.ValidatorFactory; import gr.cite.tools.validation.specification.Specification; import org.opencdmp.convention.ConventionService; -import org.opencdmp.data.DmpBlueprintEntity; +import org.opencdmp.data.PlanBlueprintEntity; import org.opencdmp.errorcode.ErrorThesaurusProperties; import org.opencdmp.model.persist.dmpblueprintdefinition.DefinitionPersist; import jakarta.validation.constraints.Size; @@ -19,13 +19,13 @@ import java.util.Arrays; import java.util.List; import java.util.UUID; -public class DmpBlueprintPersist { +public class PlanBlueprintPersist { private UUID id; public static final String _id = "id"; - @Size(max = DmpBlueprintEntity._labelLength, message = "{validation.largerthanmax}") + @Size(max = PlanBlueprintEntity._labelLength, message = "{validation.largerthanmax}") private String label = null; public static final String _label = "label"; @@ -34,7 +34,7 @@ public class DmpBlueprintPersist { public static final String _definition = "definition"; - private DmpBlueprintStatus status; + private PlanBlueprintStatus status; public static final String _status = "status"; @@ -66,11 +66,11 @@ public class DmpBlueprintPersist { this.definition = definition; } - public DmpBlueprintStatus getStatus() { + public PlanBlueprintStatus getStatus() { return status; } - public void setStatus(DmpBlueprintStatus status) { + public void setStatus(PlanBlueprintStatus status) { this.status = status; } @@ -82,56 +82,56 @@ public class DmpBlueprintPersist { this.hash = hash; } - @Component(DmpBlueprintPersistValidator.ValidatorName) + @Component(PlanBlueprintPersistValidator.ValidatorName) @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public static class DmpBlueprintPersistValidator extends BaseValidator { + public static class PlanBlueprintPersistValidator extends BaseValidator { - public static final String ValidatorName = "DmpBlueprintPersistValidator"; + public static final String ValidatorName = "PlanBlueprintPersistValidator"; private final MessageSource messageSource; private final ValidatorFactory validatorFactory; - protected DmpBlueprintPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) { + protected PlanBlueprintPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) { super(conventionService, errors); this.messageSource = messageSource; this.validatorFactory = validatorFactory; } @Override - protected Class modelClass() { - return DmpBlueprintPersist.class; + protected Class modelClass() { + return PlanBlueprintPersist.class; } @Override - protected List specifications(DmpBlueprintPersist item) { + protected List specifications(PlanBlueprintPersist item) { return Arrays.asList( this.spec() .iff(() -> this.isValidGuid(item.getId())) .must(() -> this.isValidHash(item.getHash())) - .failOn(DmpBlueprintPersist._hash).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpBlueprintPersist._hash}, LocaleContextHolder.getLocale())), + .failOn(PlanBlueprintPersist._hash).failWith(messageSource.getMessage("Validation_Required", new Object[]{PlanBlueprintPersist._hash}, LocaleContextHolder.getLocale())), this.spec() .iff(() -> !this.isValidGuid(item.getId())) .must(() -> !this.isValidHash(item.getHash())) - .failOn(DmpBlueprintPersist._hash).failWith(messageSource.getMessage("Validation_OverPosting", new Object[]{}, LocaleContextHolder.getLocale())), + .failOn(PlanBlueprintPersist._hash).failWith(messageSource.getMessage("Validation_OverPosting", new Object[]{}, LocaleContextHolder.getLocale())), this.spec() .must(() -> !this.isEmpty(item.getLabel())) - .failOn(DmpBlueprintPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpBlueprintPersist._label}, LocaleContextHolder.getLocale())), + .failOn(PlanBlueprintPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{PlanBlueprintPersist._label}, LocaleContextHolder.getLocale())), this.spec() .iff(() -> !this.isEmpty(item.getLabel())) - .must(() -> this.lessEqualLength(item.getLabel(), DmpBlueprintEntity._labelLength)) - .failOn(DmpBlueprintPersist._label).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{DmpBlueprintPersist._label}, LocaleContextHolder.getLocale())), + .must(() -> this.lessEqualLength(item.getLabel(), PlanBlueprintEntity._labelLength)) + .failOn(PlanBlueprintPersist._label).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{PlanBlueprintPersist._label}, LocaleContextHolder.getLocale())), this.spec() .must(() -> !this.isNull(item.getStatus())) - .failOn(DmpBlueprintPersist._status).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpBlueprintPersist._status}, LocaleContextHolder.getLocale())), + .failOn(PlanBlueprintPersist._status).failWith(messageSource.getMessage("Validation_Required", new Object[]{PlanBlueprintPersist._status}, LocaleContextHolder.getLocale())), this.spec() - .iff(() -> item.getStatus() == DmpBlueprintStatus.Finalized) + .iff(() -> item.getStatus() == PlanBlueprintStatus.Finalized) .must(() -> !this.isNull(item.getDefinition())) - .failOn(DmpBlueprintPersist._definition).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpBlueprintPersist._definition}, LocaleContextHolder.getLocale())), + .failOn(PlanBlueprintPersist._definition).failWith(messageSource.getMessage("Validation_Required", new Object[]{PlanBlueprintPersist._definition}, LocaleContextHolder.getLocale())), this.refSpec() .iff(() -> !this.isNull(item.getDefinition())) - .on(DmpBlueprintPersist._definition) + .on(PlanBlueprintPersist._definition) .over(item.getDefinition()) .using(() -> this.validatorFactory.validator(DefinitionPersist.DefinitionPersistValidator.class)) ); diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/DmpCommonModelConfig.java b/backend/core/src/main/java/org/opencdmp/model/persist/PlanCommonModelConfig.java similarity index 64% rename from backend/core/src/main/java/org/opencdmp/model/persist/DmpCommonModelConfig.java rename to backend/core/src/main/java/org/opencdmp/model/persist/PlanCommonModelConfig.java index e7f26a78f..a832db041 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/DmpCommonModelConfig.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/PlanCommonModelConfig.java @@ -4,7 +4,7 @@ import gr.cite.tools.validation.ValidatorFactory; import gr.cite.tools.validation.specification.Specification; import org.opencdmp.commons.validation.BaseValidator; import org.opencdmp.convention.ConventionService; -import org.opencdmp.data.DmpEntity; +import org.opencdmp.data.PlanEntity; import org.opencdmp.errorcode.ErrorThesaurusProperties; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.MessageSource; @@ -16,7 +16,7 @@ import java.util.Arrays; import java.util.List; import java.util.UUID; -public class DmpCommonModelConfig { +public class PlanCommonModelConfig { private UUID fileId; public static final String _fileId = "fileId"; @@ -73,52 +73,52 @@ public class DmpCommonModelConfig { this.descriptions = descriptions; } - @Component(DmpCommonModelConfigValidator.ValidatorName) + @Component(PlanCommonModelConfigValidator.ValidatorName) @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public static class DmpCommonModelConfigValidator extends BaseValidator { + public static class PlanCommonModelConfigValidator extends BaseValidator { - public static final String ValidatorName = "DmpCommonModelConfigValidator"; + public static final String ValidatorName = "PlanCommonModelConfigValidator"; private final MessageSource messageSource; private final ValidatorFactory validatorFactory; - protected DmpCommonModelConfigValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) { + protected PlanCommonModelConfigValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) { super(conventionService, errors); this.messageSource = messageSource; this.validatorFactory = validatorFactory; } @Override - protected Class modelClass() { - return DmpCommonModelConfig.class; + protected Class modelClass() { + return PlanCommonModelConfig.class; } @Override - protected List specifications(DmpCommonModelConfig item) { + protected List specifications(PlanCommonModelConfig item) { return Arrays.asList( this.spec() .must(() -> this.isValidGuid(item.getFileId())) - .failOn(DmpCommonModelConfig._fileId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DmpCommonModelConfig._fileId}, LocaleContextHolder.getLocale())), + .failOn(PlanCommonModelConfig._fileId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{PlanCommonModelConfig._fileId}, LocaleContextHolder.getLocale())), this.spec() .must(() -> !this.isEmpty(item.getLabel())) - .failOn(DmpCommonModelConfig._label).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DmpCommonModelConfig._label}, LocaleContextHolder.getLocale())), + .failOn(PlanCommonModelConfig._label).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{PlanCommonModelConfig._label}, LocaleContextHolder.getLocale())), this.spec() .iff(() -> !this.isEmpty(item.getLabel())) - .must(() -> this.lessEqualLength(item.getLabel(), DmpEntity._labelLength)) - .failOn(DmpCommonModelConfig._label).failWith(this.messageSource.getMessage("Validation_MaxLength", new Object[]{DmpCommonModelConfig._label}, LocaleContextHolder.getLocale())), + .must(() -> this.lessEqualLength(item.getLabel(), PlanEntity._labelLength)) + .failOn(PlanCommonModelConfig._label).failWith(this.messageSource.getMessage("Validation_MaxLength", new Object[]{PlanCommonModelConfig._label}, LocaleContextHolder.getLocale())), this.spec() .must(() -> !this.isEmpty(item.getRepositoryId())) - .failOn(DmpCommonModelConfig._repositoryId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DmpCommonModelConfig._repositoryId}, LocaleContextHolder.getLocale())), + .failOn(PlanCommonModelConfig._repositoryId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{PlanCommonModelConfig._repositoryId}, LocaleContextHolder.getLocale())), this.spec() .iff(() -> !this.isEmpty(item.getRepositoryId())) .must(() -> this.isValidGuid(UUID.fromString(item.getRepositoryId()))) - .failOn(DmpCommonModelConfig._repositoryId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DmpCommonModelConfig._repositoryId}, LocaleContextHolder.getLocale())), + .failOn(PlanCommonModelConfig._repositoryId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{PlanCommonModelConfig._repositoryId}, LocaleContextHolder.getLocale())), this.spec() .must(() -> this.isValidGuid(item.getBlueprintId())) - .failOn(DmpCommonModelConfig._blueprintId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DmpCommonModelConfig._blueprintId}, LocaleContextHolder.getLocale())), + .failOn(PlanCommonModelConfig._blueprintId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{PlanCommonModelConfig._blueprintId}, LocaleContextHolder.getLocale())), this.navSpec() .iff(() -> !this.isListNullOrEmpty(item.getDescriptions())) - .on(DmpCommonModelConfig._descriptions) + .on(PlanCommonModelConfig._descriptions) .over(item.getDescriptions()) .using((itm) -> this.validatorFactory.validator(DescriptionCommonModelConfig.DescriptionCommonModelConfigValidator.class)) ); diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/DmpDescriptionTemplatePersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/PlanDescriptionTemplatePersist.java similarity index 58% rename from backend/core/src/main/java/org/opencdmp/model/persist/DmpDescriptionTemplatePersist.java rename to backend/core/src/main/java/org/opencdmp/model/persist/PlanDescriptionTemplatePersist.java index c70e08de1..8c7f70b81 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/DmpDescriptionTemplatePersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/PlanDescriptionTemplatePersist.java @@ -1,6 +1,6 @@ package org.opencdmp.model.persist; -import org.opencdmp.commons.enums.DmpStatus; +import org.opencdmp.commons.enums.PlanStatus; import org.opencdmp.commons.validation.BaseValidator; import gr.cite.tools.validation.specification.Specification; import org.opencdmp.convention.ConventionService; @@ -15,7 +15,7 @@ import java.util.Arrays; import java.util.List; import java.util.UUID; -public class DmpDescriptionTemplatePersist { +public class PlanDescriptionTemplatePersist { private UUID descriptionTemplateGroupId; @@ -41,35 +41,35 @@ public class DmpDescriptionTemplatePersist { this.sectionId = sectionId; } - @Component(DmpDescriptionTemplatePersistValidator.ValidatorName) + @Component(PlanDescriptionTemplatePersistValidator.ValidatorName) @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public static class DmpDescriptionTemplatePersistValidator extends BaseValidator { + public static class PlanDescriptionTemplatePersistValidator extends BaseValidator { - public static final String ValidatorName = "DmpDescriptionTemplatePersistValidator"; + public static final String ValidatorName = "PlanDescriptionTemplatePersistValidator"; private final MessageSource messageSource; - private DmpStatus status; + private PlanStatus status; - protected DmpDescriptionTemplatePersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) { + protected PlanDescriptionTemplatePersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) { super(conventionService, errors); this.messageSource = messageSource; } @Override - protected Class modelClass() { - return DmpDescriptionTemplatePersist.class; + protected Class modelClass() { + return PlanDescriptionTemplatePersist.class; } @Override - protected List specifications(DmpDescriptionTemplatePersist item) { + protected List specifications(PlanDescriptionTemplatePersist item) { return Arrays.asList( this.spec() .must(() -> this.isValidGuid(item.getDescriptionTemplateGroupId())) - .failOn(DmpDescriptionTemplatePersist._descriptionTemplateGroupId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DmpDescriptionTemplatePersist._descriptionTemplateGroupId}, LocaleContextHolder.getLocale())), + .failOn(PlanDescriptionTemplatePersist._descriptionTemplateGroupId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{PlanDescriptionTemplatePersist._descriptionTemplateGroupId}, LocaleContextHolder.getLocale())), this.spec() .must(() -> this.isValidGuid(item.getSectionId())) - .failOn(DmpDescriptionTemplatePersist._sectionId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DmpDescriptionTemplatePersist._sectionId}, LocaleContextHolder.getLocale())) + .failOn(PlanDescriptionTemplatePersist._sectionId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{PlanDescriptionTemplatePersist._sectionId}, LocaleContextHolder.getLocale())) ); } diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/DmpPersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/PlanPersist.java similarity index 56% rename from backend/core/src/main/java/org/opencdmp/model/persist/DmpPersist.java rename to backend/core/src/main/java/org/opencdmp/model/persist/PlanPersist.java index 25d017c57..96d556118 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/DmpPersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/PlanPersist.java @@ -6,17 +6,17 @@ import gr.cite.tools.validation.specification.Specification; import org.opencdmp.authorization.AuthorizationFlags; import org.opencdmp.commons.XmlHandlingService; import org.opencdmp.commons.enums.*; -import org.opencdmp.commons.types.dmpblueprint.DefinitionEntity; -import org.opencdmp.commons.types.dmpblueprint.FieldEntity; -import org.opencdmp.commons.types.dmpblueprint.SectionEntity; -import org.opencdmp.commons.types.dmpblueprint.SystemFieldEntity; +import org.opencdmp.commons.types.planblueprint.DefinitionEntity; +import org.opencdmp.commons.types.planblueprint.FieldEntity; +import org.opencdmp.commons.types.planblueprint.SectionEntity; +import org.opencdmp.commons.types.planblueprint.SystemFieldEntity; import org.opencdmp.commons.validation.BaseValidator; import org.opencdmp.convention.ConventionService; import org.opencdmp.data.*; import org.opencdmp.errorcode.ErrorThesaurusProperties; -import org.opencdmp.model.persist.dmpproperties.DmpPropertiesPersist; +import org.opencdmp.model.persist.planproperties.PlanPropertiesPersist; import org.opencdmp.query.DescriptionQuery; -import org.opencdmp.query.DmpDescriptionTemplateQuery; +import org.opencdmp.query.PlanDescriptionTemplateQuery; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.MessageSource; import org.springframework.context.annotation.Scope; @@ -29,7 +29,7 @@ import java.util.List; import java.util.UUID; import java.util.stream.Collectors; -public class DmpPersist { +public class PlanPersist { private UUID id; @@ -37,11 +37,11 @@ public class DmpPersist { public static final String _label = "label"; - private DmpStatus status; + private PlanStatus status; public static final String _status = "status"; - private DmpPropertiesPersist properties; + private PlanPropertiesPersist properties; public static final String _properties = "properties"; @@ -55,18 +55,18 @@ public class DmpPersist { public static final String _blueprint = "blueprint"; - private DmpAccessType accessType; + private PlanAccessType accessType; public static final String _accessType = "accessType"; // private List references; // // public static final String _references = "references"; - private List descriptionTemplates; + private List descriptionTemplates; public static final String _descriptionTemplates = "descriptionTemplates"; - private List users; + private List users; public static final String _users = "users"; private String hash; @@ -89,19 +89,19 @@ public class DmpPersist { this.label = label; } - public DmpStatus getStatus() { + public PlanStatus getStatus() { return this.status; } - public void setStatus(DmpStatus status) { + public void setStatus(PlanStatus status) { this.status = status; } - public DmpPropertiesPersist getProperties() { + public PlanPropertiesPersist getProperties() { return this.properties; } - public void setProperties(DmpPropertiesPersist properties) { + public void setProperties(PlanPropertiesPersist properties) { this.properties = properties; } @@ -129,27 +129,27 @@ public class DmpPersist { this.blueprint = blueprint; } - public DmpAccessType getAccessType() { + public PlanAccessType getAccessType() { return this.accessType; } - public void setAccessType(DmpAccessType accessType) { + public void setAccessType(PlanAccessType accessType) { this.accessType = accessType; } - public List getDescriptionTemplates() { + public List getDescriptionTemplates() { return this.descriptionTemplates; } - public void setDescriptionTemplates(List descriptionTemplates) { + public void setDescriptionTemplates(List descriptionTemplates) { this.descriptionTemplates = descriptionTemplates; } - public List getUsers() { + public List getUsers() { return this.users; } - public void setUsers(List users) { + public void setUsers(List users) { this.users = users; } @@ -161,11 +161,11 @@ public class DmpPersist { this.hash = hash; } - @Component(DmpPersistValidator.ValidatorName) + @Component(PlanPersistValidator.ValidatorName) @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public static class DmpPersistValidator extends BaseValidator { + public static class PlanPersistValidator extends BaseValidator { - public static final String ValidatorName = "DmpPersistValidator"; + public static final String ValidatorName = "PlanPersistValidator"; private final MessageSource messageSource; @@ -174,7 +174,7 @@ public class DmpPersist { private final XmlHandlingService xmlHandlingService; private final QueryFactory queryFactory; - protected DmpPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory, TenantEntityManager entityManager, XmlHandlingService xmlHandlingService, QueryFactory queryFactory) { + protected PlanPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory, TenantEntityManager entityManager, XmlHandlingService xmlHandlingService, QueryFactory queryFactory) { super(conventionService, errors); this.messageSource = messageSource; this.validatorFactory = validatorFactory; @@ -184,116 +184,116 @@ public class DmpPersist { } @Override - protected Class modelClass() { - return DmpPersist.class; + protected Class modelClass() { + return PlanPersist.class; } @Override - protected List specifications(DmpPersist item) { - DmpBlueprintEntity dmpBlueprintEntity = null; + protected List specifications(PlanPersist item) { + PlanBlueprintEntity planBlueprintEntity = null; try { - dmpBlueprintEntity = this.isValidGuid(item.getBlueprint()) ? this.entityManager.find(DmpBlueprintEntity.class, item.getBlueprint(), true) : null; + planBlueprintEntity = this.isValidGuid(item.getBlueprint()) ? this.entityManager.find(PlanBlueprintEntity.class, item.getBlueprint(), true) : null; } catch (InvalidApplicationException e) { throw new RuntimeException(e); } - DmpBlueprintEntity finalDmpBlueprintEntity = dmpBlueprintEntity; - DefinitionEntity definition = dmpBlueprintEntity == null ? null : this.xmlHandlingService.fromXmlSafe(DefinitionEntity.class, dmpBlueprintEntity.getDefinition()); + PlanBlueprintEntity finalPlanBlueprintEntity = planBlueprintEntity; + DefinitionEntity definition = planBlueprintEntity == null ? null : this.xmlHandlingService.fromXmlSafe(DefinitionEntity.class, planBlueprintEntity.getDefinition()); String languageFieldLabel = null; String accessFieldLabel = null; if (definition != null){ - languageFieldLabel = this.getSystemFieldLabel(definition, DmpBlueprintSystemFieldType.Language); - accessFieldLabel = this.getSystemFieldLabel(definition, DmpBlueprintSystemFieldType.AccessRights); + languageFieldLabel = this.getSystemFieldLabel(definition, PlanBlueprintSystemFieldType.Language); + accessFieldLabel = this.getSystemFieldLabel(definition, PlanBlueprintSystemFieldType.AccessRights); } return Arrays.asList( this.spec() .iff(() -> this.isValidGuid(item.getId())) .must(() -> this.isValidHash(item.getHash())) - .failOn(DmpPersist._hash).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DmpPersist._hash}, LocaleContextHolder.getLocale())), + .failOn(PlanPersist._hash).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{PlanPersist._hash}, LocaleContextHolder.getLocale())), this.spec() .iff(() -> !this.isValidGuid(item.getId())) .must(() -> !this.isValidHash(item.getHash())) - .failOn(DmpPersist._hash).failWith(this.messageSource.getMessage("Validation_OverPosting", new Object[]{}, LocaleContextHolder.getLocale())), + .failOn(PlanPersist._hash).failWith(this.messageSource.getMessage("Validation_OverPosting", new Object[]{}, LocaleContextHolder.getLocale())), this.spec() .must(() -> !this.isEmpty(item.getLabel())) - .failOn(DmpPersist._label).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DmpPersist._label}, LocaleContextHolder.getLocale())), + .failOn(PlanPersist._label).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{PlanPersist._label}, LocaleContextHolder.getLocale())), this.spec() .iff(() -> !this.isEmpty(item.getLabel())) - .must(() -> this.lessEqualLength(item.getLabel(), DmpEntity._labelLength)) - .failOn(DmpPersist._label).failWith(this.messageSource.getMessage("Validation_MaxLength", new Object[]{DmpPersist._label}, LocaleContextHolder.getLocale())), + .must(() -> this.lessEqualLength(item.getLabel(), PlanEntity._labelLength)) + .failOn(PlanPersist._label).failWith(this.messageSource.getMessage("Validation_MaxLength", new Object[]{PlanPersist._label}, LocaleContextHolder.getLocale())), this.spec() - .iff(() -> item.getStatus() == DmpStatus.Finalized) + .iff(() -> item.getStatus() == PlanStatus.Finalized) .must(() -> !this.isEmpty(item.getDescription())) - .failOn(DmpPersist._description).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DmpPersist._description}, LocaleContextHolder.getLocale())), + .failOn(PlanPersist._description).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{PlanPersist._description}, LocaleContextHolder.getLocale())), this.spec() .must(() -> !this.isNull(item.getStatus())) - .failOn(DmpPersist._status).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DmpPersist._status}, LocaleContextHolder.getLocale())), + .failOn(PlanPersist._status).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{PlanPersist._status}, LocaleContextHolder.getLocale())), this.spec() - .iff(() -> item.getStatus() == DmpStatus.Finalized) + .iff(() -> item.getStatus() == PlanStatus.Finalized) .must(() -> this.isValidGuid(item.getBlueprint())) - .failOn(DmpPersist._blueprint).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DmpPersist._blueprint}, LocaleContextHolder.getLocale())), + .failOn(PlanPersist._blueprint).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{PlanPersist._blueprint}, LocaleContextHolder.getLocale())), this.spec() - .iff(() -> item.getStatus() == DmpStatus.Finalized) + .iff(() -> item.getStatus() == PlanStatus.Finalized) .must(() -> !this.isNull(item.getProperties())) - .failOn(DmpPersist._properties).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DmpPersist._properties}, LocaleContextHolder.getLocale())), + .failOn(PlanPersist._properties).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{PlanPersist._properties}, LocaleContextHolder.getLocale())), this.spec() - .iff(() -> item.getStatus() == DmpStatus.Finalized) - .must(() -> this.isDescriptionTemplateMultiplicityValid(finalDmpBlueprintEntity, item.getId())) - .failOn(DmpPersist._descriptionTemplates).failWith(this.messageSource.getMessage("Validation.InvalidDescriptionTemplateMultiplicityOnDMP", new Object[]{DmpPersist._descriptionTemplates}, LocaleContextHolder.getLocale())), + .iff(() -> item.getStatus() == PlanStatus.Finalized) + .must(() -> this.isDescriptionTemplateMultiplicityValid(finalPlanBlueprintEntity, item.getId())) + .failOn(PlanPersist._descriptionTemplates).failWith(this.messageSource.getMessage("Validation.InvalidDescriptionTemplateMultiplicityOnDMP", new Object[]{PlanPersist._descriptionTemplates}, LocaleContextHolder.getLocale())), this.refSpec() .iff(() -> !this.isNull(item.getProperties())) - .on(DmpPersist._properties) + .on(PlanPersist._properties) .over(item.getProperties()) - .using(() -> this.validatorFactory.validator(DmpPropertiesPersist.DmpPropertiesPersistValidator.class).setStatus(item.getStatus()).withDefinition(definition)), + .using(() -> this.validatorFactory.validator(PlanPropertiesPersist.PlanPropertiesPersistValidator.class).setStatus(item.getStatus()).withDefinition(definition)), this.spec() - .iff(() -> item.getStatus() == DmpStatus.Finalized) + .iff(() -> item.getStatus() == PlanStatus.Finalized) .must(() -> !this.isNull(item.getLanguage())) - .failOn(DmpPersist._language).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{languageFieldLabel != null ? languageFieldLabel : DmpBlueprintSystemFieldType.Language.name()}, LocaleContextHolder.getLocale())), + .failOn(PlanPersist._language).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{languageFieldLabel != null ? languageFieldLabel : PlanBlueprintSystemFieldType.Language.name()}, LocaleContextHolder.getLocale())), this.spec() - .iff(() -> item.getStatus() == DmpStatus.Finalized) + .iff(() -> item.getStatus() == PlanStatus.Finalized) .must(() -> !this.isNull(item.getAccessType())) - .failOn(DmpPersist._accessType).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{accessFieldLabel != null ? accessFieldLabel : DmpBlueprintSystemFieldType.AccessRights.name()}, LocaleContextHolder.getLocale())), + .failOn(PlanPersist._accessType).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{accessFieldLabel != null ? accessFieldLabel : PlanBlueprintSystemFieldType.AccessRights.name()}, LocaleContextHolder.getLocale())), this.spec() - .iff(() -> item.getStatus() == DmpStatus.Finalized) + .iff(() -> item.getStatus() == PlanStatus.Finalized) .must(() -> !this.isListNullOrEmpty(item.getDescriptionTemplates())) - .failOn(DmpPersist._descriptionTemplates).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DmpPersist._descriptionTemplates}, LocaleContextHolder.getLocale())), + .failOn(PlanPersist._descriptionTemplates).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{PlanPersist._descriptionTemplates}, LocaleContextHolder.getLocale())), this.navSpec() .iff(() -> !this.isListNullOrEmpty(item.getDescriptionTemplates())) - .on(DmpPersist._descriptionTemplates) + .on(PlanPersist._descriptionTemplates) .over(item.getDescriptionTemplates()) - .using((itm) -> this.validatorFactory.validator(DmpDescriptionTemplatePersist.DmpDescriptionTemplatePersistValidator.class)), + .using((itm) -> this.validatorFactory.validator(PlanDescriptionTemplatePersist.PlanDescriptionTemplatePersistValidator.class)), this.navSpec() .iff(() -> !this.isListNullOrEmpty(item.getUsers())) - .on(DmpPersist._users) + .on(PlanPersist._users) .over(item.getUsers()) - .using((itm) -> this.validatorFactory.validator(DmpUserPersist.DmpUserPersistValidator.class)) + .using((itm) -> this.validatorFactory.validator(PlanUserPersist.PlanUserPersistValidator.class)) ); } - private boolean isDescriptionTemplateMultiplicityValid(DmpBlueprintEntity dmpBlueprintEntity, UUID dmpId){ - org.opencdmp.commons.types.dmpblueprint.DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(org.opencdmp.commons.types.dmpblueprint.DefinitionEntity.class, dmpBlueprintEntity.getDefinition()); + private boolean isDescriptionTemplateMultiplicityValid(PlanBlueprintEntity planBlueprintEntity, UUID planId){ + org.opencdmp.commons.types.planblueprint.DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(org.opencdmp.commons.types.planblueprint.DefinitionEntity.class, planBlueprintEntity.getDefinition()); if (definition == null || this.isListNullOrEmpty(definition.getSections())) return true; - List dmpDescriptionTemplateEntities = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).isActive(IsActive.Active).dmpIds(dmpId).collect(); - List descriptionEntities = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).dmpIds(dmpId).isActive(IsActive.Active).collect(); + List planDescriptionTemplateEntities = this.queryFactory.query(PlanDescriptionTemplateQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).isActive(IsActive.Active).planIds(planId).collect(); + List descriptionEntities = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).planIds(planId).isActive(IsActive.Active).collect(); for (SectionEntity section: definition.getSections()) { if (section.getHasTemplates() && !this.isListNullOrEmpty(section.getDescriptionTemplates())){ - for (org.opencdmp.commons.types.dmpblueprint.DescriptionTemplateEntity sectionDescriptionTemplate: section.getDescriptionTemplates()) { + for (org.opencdmp.commons.types.planblueprint.DescriptionTemplateEntity sectionDescriptionTemplate: section.getDescriptionTemplates()) { if (sectionDescriptionTemplate.getMaxMultiplicity() == null && sectionDescriptionTemplate.getMinMultiplicity() == null ) continue; int descriptionsCount = 0; - for (DmpDescriptionTemplateEntity dmpDescriptionTemplate: dmpDescriptionTemplateEntities) { + for (PlanDescriptionTemplateEntity planDescriptionTemplate: planDescriptionTemplateEntities) { - if(dmpDescriptionTemplate.getSectionId().equals(section.getId())) { + if(planDescriptionTemplate.getSectionId().equals(section.getId())) { for (DescriptionEntity description: descriptionEntities){ - if (sectionDescriptionTemplate.getDescriptionTemplateGroupId().equals(dmpDescriptionTemplate.getDescriptionTemplateGroupId())) { - if (description.getDmpDescriptionTemplateId().equals(dmpDescriptionTemplate.getId()) && dmpDescriptionTemplate.getSectionId().equals(section.getId())) + if (sectionDescriptionTemplate.getDescriptionTemplateGroupId().equals(planDescriptionTemplate.getDescriptionTemplateGroupId())) { + if (description.getPlanDescriptionTemplateId().equals(planDescriptionTemplate.getId()) && planDescriptionTemplate.getSectionId().equals(section.getId())) descriptionsCount++; } } @@ -310,12 +310,12 @@ public class DmpPersist { return true; } - private String getSystemFieldLabel(DefinitionEntity definition, DmpBlueprintSystemFieldType type){ + private String getSystemFieldLabel(DefinitionEntity definition, PlanBlueprintSystemFieldType type){ if (this.isListNullOrEmpty(definition.getSections())) return null; for (SectionEntity section: definition.getSections()) { if (!this.isListNullOrEmpty(section.getFields())) { - List fields = section.getFields().stream().filter(x -> x.getCategory().equals(DmpBlueprintFieldCategory.System)).collect(Collectors.toList()); + List fields = section.getFields().stream().filter(x -> x.getCategory().equals(PlanBlueprintFieldCategory.System)).collect(Collectors.toList()); if (!this.isListNullOrEmpty(fields)){ List systemFields = (List)(List) fields; diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/DmpReferencePersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/PlanReferencePersist.java similarity index 59% rename from backend/core/src/main/java/org/opencdmp/model/persist/DmpReferencePersist.java rename to backend/core/src/main/java/org/opencdmp/model/persist/PlanReferencePersist.java index b834529b2..6140e60f0 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/DmpReferencePersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/PlanReferencePersist.java @@ -5,7 +5,7 @@ import gr.cite.tools.validation.ValidatorFactory; import gr.cite.tools.validation.specification.Specification; import org.opencdmp.convention.ConventionService; import org.opencdmp.errorcode.ErrorThesaurusProperties; -import org.opencdmp.model.persist.dmpreference.DmpReferenceDataPersist; +import org.opencdmp.model.persist.planreference.PlanReferenceDataPersist; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.MessageSource; import org.springframework.context.annotation.Scope; @@ -15,14 +15,14 @@ import org.springframework.stereotype.Component; import java.util.Arrays; import java.util.List; -public class DmpReferencePersist { +public class PlanReferencePersist { private ReferencePersist reference; public static final String _reference = "reference"; - private DmpReferenceDataPersist data; + private PlanReferenceDataPersist data; public static final String _data = "data"; @@ -35,54 +35,54 @@ public class DmpReferencePersist { this.reference = reference; } - public DmpReferenceDataPersist getData() { + public PlanReferenceDataPersist getData() { return data; } - public void setData(DmpReferenceDataPersist data) { + public void setData(PlanReferenceDataPersist data) { this.data = data; } - @Component(DmpReferencePersistValidator.ValidatorName) + @Component(PlanReferencePersistValidator.ValidatorName) @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public static class DmpReferencePersistValidator extends BaseValidator { + public static class PlanReferencePersistValidator extends BaseValidator { - public static final String ValidatorName = "DmpReferencePersistValidator"; + public static final String ValidatorName = "PlanReferencePersistValidator"; private final MessageSource messageSource; private final ValidatorFactory validatorFactory; - protected DmpReferencePersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) { + protected PlanReferencePersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) { super(conventionService, errors); this.messageSource = messageSource; this.validatorFactory = validatorFactory; } @Override - protected Class modelClass() { - return DmpReferencePersist.class; + protected Class modelClass() { + return PlanReferencePersist.class; } @Override - protected List specifications(DmpReferencePersist item) { + protected List specifications(PlanReferencePersist item) { return Arrays.asList( this.spec() .must(() -> !this.isNull(item.getReference())) - .failOn(DmpReferencePersist._reference).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpReferencePersist._reference}, LocaleContextHolder.getLocale())), + .failOn(PlanReferencePersist._reference).failWith(messageSource.getMessage("Validation_Required", new Object[]{PlanReferencePersist._reference}, LocaleContextHolder.getLocale())), this.refSpec() .iff(() -> !this.isNull(item.getReference())) - .on(DmpReferencePersist._reference) + .on(PlanReferencePersist._reference) .over(item.getReference()) .using(() -> this.validatorFactory.validator(ReferencePersist.ReferenceWithoutTypePersistValidator.class)), this.spec() .must(() -> !this.isNull(item.getData())) - .failOn(DmpReferencePersist._data).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpReferencePersist._data}, LocaleContextHolder.getLocale())), + .failOn(PlanReferencePersist._data).failWith(messageSource.getMessage("Validation_Required", new Object[]{PlanReferencePersist._data}, LocaleContextHolder.getLocale())), this.refSpec() .iff(() -> !this.isNull(item.getData())) - .on(DmpReferencePersist._data) + .on(PlanReferencePersist._data) .over(item.getData()) - .using(() -> this.validatorFactory.validator(DmpReferenceDataPersist.DmpReferenceDataPersistValidator.class)) + .using(() -> this.validatorFactory.validator(PlanReferenceDataPersist.PlanReferenceDataPersistValidator.class)) ); } diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/DmpUserInvitePersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/PlanUserInvitePersist.java similarity index 57% rename from backend/core/src/main/java/org/opencdmp/model/persist/DmpUserInvitePersist.java rename to backend/core/src/main/java/org/opencdmp/model/persist/PlanUserInvitePersist.java index 96d0d2d1b..b1aabf745 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/DmpUserInvitePersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/PlanUserInvitePersist.java @@ -14,52 +14,52 @@ import org.springframework.stereotype.Component; import java.util.Arrays; import java.util.List; -public class DmpUserInvitePersist { +public class PlanUserInvitePersist { - private List users; + private List users; public static final String _users = "users"; - public List getUsers() { + public List getUsers() { return users; } - public void setUsers(List users) { + public void setUsers(List users) { this.users = users; } - @Component(DmpUserInvitePersistValidator.ValidatorName) + @Component(PlanUserInvitePersistValidator.ValidatorName) @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public static class DmpUserInvitePersistValidator extends BaseValidator { + public static class PlanUserInvitePersistValidator extends BaseValidator { - public static final String ValidatorName = "DmpUserInvitePersistValidator"; + public static final String ValidatorName = "PlanUserInvitePersistValidator"; private final MessageSource messageSource; private final ValidatorFactory validatorFactory; - protected DmpUserInvitePersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) { + protected PlanUserInvitePersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) { super(conventionService, errors); this.messageSource = messageSource; this.validatorFactory = validatorFactory; } @Override - protected Class modelClass() { - return DmpUserInvitePersist.class; + protected Class modelClass() { + return PlanUserInvitePersist.class; } @Override - protected List specifications(DmpUserInvitePersist item) { + protected List specifications(PlanUserInvitePersist item) { return Arrays.asList( this.spec() .must(() -> !this.isListNullOrEmpty(item.getUsers())) - .failOn(DmpUserInvitePersist._users).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpUserInvitePersist._users}, LocaleContextHolder.getLocale())), + .failOn(PlanUserInvitePersist._users).failWith(messageSource.getMessage("Validation_Required", new Object[]{PlanUserInvitePersist._users}, LocaleContextHolder.getLocale())), this.navSpec() .iff(() -> !this.isListNullOrEmpty(item.getUsers())) - .on(DmpUserInvitePersist._users) + .on(PlanUserInvitePersist._users) .over(item.getUsers()) - .using((itm) -> this.validatorFactory.validator(DmpUserPersist.DmpUserPersistValidator.class)) + .using((itm) -> this.validatorFactory.validator(PlanUserPersist.PlanUserPersistValidator.class)) ); } } diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/DmpUserPersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/PlanUserPersist.java similarity index 60% rename from backend/core/src/main/java/org/opencdmp/model/persist/DmpUserPersist.java rename to backend/core/src/main/java/org/opencdmp/model/persist/PlanUserPersist.java index cbcca13c7..2f7051ac9 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/DmpUserPersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/PlanUserPersist.java @@ -1,11 +1,10 @@ package org.opencdmp.model.persist; -import org.opencdmp.commons.enums.DmpUserRole; +import org.opencdmp.commons.enums.PlanUserRole; import org.opencdmp.commons.validation.BaseValidator; import gr.cite.tools.validation.specification.Specification; import org.opencdmp.convention.ConventionService; import org.opencdmp.errorcode.ErrorThesaurusProperties; -import org.opencdmp.model.persist.dmpproperties.DmpContactPersist; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.MessageSource; import org.springframework.context.annotation.Scope; @@ -16,7 +15,7 @@ import java.util.Arrays; import java.util.List; import java.util.UUID; -public class DmpUserPersist { +public class PlanUserPersist { private UUID user; @@ -28,7 +27,7 @@ public class DmpUserPersist { private UUID sectionId; public static final String _sectionId = "sectionId"; - private DmpUserRole role; + private PlanUserRole role; public static final String _role = "role"; @@ -56,54 +55,54 @@ public class DmpUserPersist { this.email = email; } - public DmpUserRole getRole() { + public PlanUserRole getRole() { return role; } - public void setRole(DmpUserRole role) { + public void setRole(PlanUserRole role) { this.role = role; } - @Component(DmpUserPersistValidator.ValidatorName) + @Component(PlanUserPersistValidator.ValidatorName) @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public static class DmpUserPersistValidator extends BaseValidator { + public static class PlanUserPersistValidator extends BaseValidator { - public static final String ValidatorName = "DmpUserPersistValidator"; + public static final String ValidatorName = "PlanUserPersistValidator"; private final MessageSource messageSource; - protected DmpUserPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) { + protected PlanUserPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) { super(conventionService, errors); this.messageSource = messageSource; } @Override - protected Class modelClass() { - return DmpUserPersist.class; + protected Class modelClass() { + return PlanUserPersist.class; } @Override - protected List specifications(DmpUserPersist item) { + protected List specifications(PlanUserPersist item) { return Arrays.asList( this.spec() .iff(() -> this.isEmpty(item.getEmail())) .must(() -> this.isValidGuid(item.getUser())) - .failOn(DmpUserPersist._user).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpUserPersist._user}, LocaleContextHolder.getLocale())), + .failOn(PlanUserPersist._user).failWith(messageSource.getMessage("Validation_Required", new Object[]{PlanUserPersist._user}, LocaleContextHolder.getLocale())), this.spec() .iff(() -> !this.isValidGuid(item.getUser())) .must(() -> !this.isEmpty(item.getEmail())) - .failOn(DmpUserPersist._email).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpUserPersist._email}, LocaleContextHolder.getLocale())), + .failOn(PlanUserPersist._email).failWith(messageSource.getMessage("Validation_Required", new Object[]{PlanUserPersist._email}, LocaleContextHolder.getLocale())), this.spec() .must(() -> !this.isNull(item.getRole())) - .failOn(DmpUserPersist._role).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpUserPersist._role}, LocaleContextHolder.getLocale())), + .failOn(PlanUserPersist._role).failWith(messageSource.getMessage("Validation_Required", new Object[]{PlanUserPersist._role}, LocaleContextHolder.getLocale())), this.spec() .iff(() -> !this.isNull(item.getSectionId())) .must(() -> this.isValidGuid(item.getSectionId())) - .failOn(DmpUserPersist._sectionId).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpUserPersist._sectionId}, LocaleContextHolder.getLocale())), + .failOn(PlanUserPersist._sectionId).failWith(messageSource.getMessage("Validation_Required", new Object[]{PlanUserPersist._sectionId}, LocaleContextHolder.getLocale())), this.spec() .iff(() -> !this.isEmpty(item.getEmail())) .must(() -> this.isValidEmail(item.getEmail())) - .failOn(DmpUserPersist._email).failWith(messageSource.getMessage("Validation_UnexpectedValue", new Object[]{DmpUserPersist._email}, LocaleContextHolder.getLocale())) + .failOn(PlanUserPersist._email).failWith(messageSource.getMessage("Validation_UnexpectedValue", new Object[]{PlanUserPersist._email}, LocaleContextHolder.getLocale())) ); } } diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/DmpUserRemovePersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/PlanUserRemovePersist.java similarity index 51% rename from backend/core/src/main/java/org/opencdmp/model/persist/DmpUserRemovePersist.java rename to backend/core/src/main/java/org/opencdmp/model/persist/PlanUserRemovePersist.java index bcea7a86d..62617b8a0 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/DmpUserRemovePersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/PlanUserRemovePersist.java @@ -1,6 +1,6 @@ package org.opencdmp.model.persist; -import org.opencdmp.commons.enums.DmpUserRole; +import org.opencdmp.commons.enums.PlanUserRole; import org.opencdmp.commons.validation.BaseValidator; import gr.cite.tools.validation.specification.Specification; import org.opencdmp.convention.ConventionService; @@ -15,17 +15,17 @@ import java.util.Arrays; import java.util.List; import java.util.UUID; -public class DmpUserRemovePersist { +public class PlanUserRemovePersist { private UUID id; public static final String _id = "id"; - private UUID dmpId; + private UUID planId; - public static final String _dmpId = "dmpId"; + public static final String _planId = "planId"; - private DmpUserRole role; + private PlanUserRole role; public static final String _role = "role"; @@ -37,52 +37,52 @@ public class DmpUserRemovePersist { this.id = id; } - public UUID getDmpId() { - return dmpId; + public UUID getPlanId() { + return planId; } - public void setDmpId(UUID dmpId) { - this.dmpId = dmpId; + public void setPlanId(UUID planId) { + this.planId = planId; } - public DmpUserRole getRole() { + public PlanUserRole getRole() { return role; } - public void setRole(DmpUserRole role) { + public void setRole(PlanUserRole role) { this.role = role; } - @Component(DmpUserRemovePersistValidator.ValidatorName) + @Component(PlanUserRemovePersistValidator.ValidatorName) @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public static class DmpUserRemovePersistValidator extends BaseValidator { + public static class PlanUserRemovePersistValidator extends BaseValidator { - public static final String ValidatorName = "DmpUserRemovePersistValidator"; + public static final String ValidatorName = "PlanUserRemovePersistValidator"; private final MessageSource messageSource; - protected DmpUserRemovePersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) { + protected PlanUserRemovePersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) { super(conventionService, errors); this.messageSource = messageSource; } @Override - protected Class modelClass() { - return DmpUserRemovePersist.class; + protected Class modelClass() { + return PlanUserRemovePersist.class; } @Override - protected List specifications(DmpUserRemovePersist item) { + protected List specifications(PlanUserRemovePersist item) { return Arrays.asList( this.spec() .must(() -> this.isValidGuid(item.getId())) - .failOn(DmpUserRemovePersist._id).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpUserRemovePersist._id}, LocaleContextHolder.getLocale())), + .failOn(PlanUserRemovePersist._id).failWith(messageSource.getMessage("Validation_Required", new Object[]{PlanUserRemovePersist._id}, LocaleContextHolder.getLocale())), this.spec() - .must(() -> this.isValidGuid(item.getDmpId())) - .failOn(DmpUserRemovePersist._dmpId).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpUserRemovePersist._dmpId}, LocaleContextHolder.getLocale())), + .must(() -> this.isValidGuid(item.getPlanId())) + .failOn(PlanUserRemovePersist._planId).failWith(messageSource.getMessage("Validation_Required", new Object[]{PlanUserRemovePersist._planId}, LocaleContextHolder.getLocale())), this.spec() .must(() -> !this.isNull(item.getRole())) - .failOn(DmpUserRemovePersist._role).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpUserRemovePersist._role}, LocaleContextHolder.getLocale())) + .failOn(PlanUserRemovePersist._role).failWith(messageSource.getMessage("Validation_Required", new Object[]{PlanUserRemovePersist._role}, LocaleContextHolder.getLocale())) ); } } diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/actionconfirmation/DmpInvitationPersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/actionconfirmation/DmpInvitationPersist.java deleted file mode 100644 index fbb880c24..000000000 --- a/backend/core/src/main/java/org/opencdmp/model/persist/actionconfirmation/DmpInvitationPersist.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.opencdmp.model.persist.actionconfirmation; - -import org.opencdmp.commons.enums.DmpUserRole; -import org.opencdmp.commons.validation.BaseValidator; -import gr.cite.tools.validation.specification.Specification; -import org.opencdmp.convention.ConventionService; -import org.opencdmp.errorcode.ErrorThesaurusProperties; -import org.springframework.beans.factory.config.ConfigurableBeanFactory; -import org.springframework.context.MessageSource; -import org.springframework.context.annotation.Scope; -import org.springframework.context.i18n.LocaleContextHolder; -import org.springframework.stereotype.Component; - -import java.util.Arrays; -import java.util.List; -import java.util.UUID; - -public class DmpInvitationPersist { - - private String email; - - public static final String _email = "email"; - - private UUID dmpId; - - public static final String _dmpId = "dmpId"; - - private DmpUserRole role; - - public static final String _role = "role"; - - public DmpInvitationPersist(String email, UUID dmpId, DmpUserRole role) { - this.email = email; - this.dmpId = dmpId; - this.role = role; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public UUID getDmpId() { - return dmpId; - } - - public void setDmpId(UUID dmpId) { - this.dmpId = dmpId; - } - - public DmpUserRole getRole() { - return role; - } - - public void setRole(DmpUserRole role) { - this.role = role; - } - - @Component(DmpInvitationPersistValidator.ValidatorName) - @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public static class DmpInvitationPersistValidator extends BaseValidator { - - public static final String ValidatorName = "DmpInvitationPersistValidator"; - - private final MessageSource messageSource; - - protected DmpInvitationPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) { - super(conventionService, errors); - this.messageSource = messageSource; - } - - @Override - protected Class modelClass() { - return DmpInvitationPersist.class; - } - - @Override - protected List specifications(DmpInvitationPersist item) { - return Arrays.asList( - this.spec() - .must(() -> !this.isEmpty(item.getEmail())) - .failOn(DmpInvitationPersist._email).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpInvitationPersist._email}, LocaleContextHolder.getLocale())), - this.spec() - .must(() -> !this.isNull(item.getDmpId())) - .failOn(DmpInvitationPersist._dmpId).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpInvitationPersist._dmpId}, LocaleContextHolder.getLocale())), - this.spec() - .must(() -> !this.isNull(item.getRole())) - .failOn(DmpInvitationPersist._role).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpInvitationPersist._role}, LocaleContextHolder.getLocale())) - ); - } - } - -} diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/actionconfirmation/PlanInvitationPersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/actionconfirmation/PlanInvitationPersist.java new file mode 100644 index 000000000..2b860e4ce --- /dev/null +++ b/backend/core/src/main/java/org/opencdmp/model/persist/actionconfirmation/PlanInvitationPersist.java @@ -0,0 +1,96 @@ +package org.opencdmp.model.persist.actionconfirmation; + +import org.opencdmp.commons.enums.PlanUserRole; +import org.opencdmp.commons.validation.BaseValidator; +import gr.cite.tools.validation.specification.Specification; +import org.opencdmp.convention.ConventionService; +import org.opencdmp.errorcode.ErrorThesaurusProperties; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.context.MessageSource; +import org.springframework.context.annotation.Scope; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.stereotype.Component; + +import java.util.Arrays; +import java.util.List; +import java.util.UUID; + +public class PlanInvitationPersist { + + private String email; + + public static final String _email = "email"; + + private UUID planId; + + public static final String _planId = "planId"; + + private PlanUserRole role; + + public static final String _role = "role"; + + public PlanInvitationPersist(String email, UUID planId, PlanUserRole role) { + this.email = email; + this.planId = planId; + this.role = role; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public UUID getPlanId() { + return planId; + } + + public void setPlanId(UUID planId) { + this.planId = planId; + } + + public PlanUserRole getRole() { + return role; + } + + public void setRole(PlanUserRole role) { + this.role = role; + } + + @Component(PlanInvitationPersistValidator.ValidatorName) + @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public static class PlanInvitationPersistValidator extends BaseValidator { + + public static final String ValidatorName = "PlanInvitationPersistValidator"; + + private final MessageSource messageSource; + + protected PlanInvitationPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) { + super(conventionService, errors); + this.messageSource = messageSource; + } + + @Override + protected Class modelClass() { + return PlanInvitationPersist.class; + } + + @Override + protected List specifications(PlanInvitationPersist item) { + return Arrays.asList( + this.spec() + .must(() -> !this.isEmpty(item.getEmail())) + .failOn(PlanInvitationPersist._email).failWith(messageSource.getMessage("Validation_Required", new Object[]{PlanInvitationPersist._email}, LocaleContextHolder.getLocale())), + this.spec() + .must(() -> !this.isNull(item.getPlanId())) + .failOn(PlanInvitationPersist._planId).failWith(messageSource.getMessage("Validation_Required", new Object[]{PlanInvitationPersist._planId}, LocaleContextHolder.getLocale())), + this.spec() + .must(() -> !this.isNull(item.getRole())) + .failOn(PlanInvitationPersist._role).failWith(messageSource.getMessage("Validation_Required", new Object[]{PlanInvitationPersist._role}, LocaleContextHolder.getLocale())) + ); + } + } + +} diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/deposit/DepositRequest.java b/backend/core/src/main/java/org/opencdmp/model/persist/deposit/DepositRequest.java index 1bac49f6a..d2e258c71 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/deposit/DepositRequest.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/deposit/DepositRequest.java @@ -21,9 +21,9 @@ public class DepositRequest { public static final String _repositoryId = "repositoryId"; - private UUID dmpId; + private UUID planId; - public static final String _dmpId = "dmpId"; + public static final String _planId = "planId"; private String authorizationCode; @@ -37,12 +37,12 @@ public class DepositRequest { this.repositoryId = repositoryId; } - public UUID getDmpId() { - return this.dmpId; + public UUID getPlanId() { + return this.planId; } - public void setDmpId(UUID dmpId) { - this.dmpId = dmpId; + public void setPlanId(UUID planId) { + this.planId = planId; } public String getAuthorizationCode() { @@ -86,8 +86,8 @@ public class DepositRequest { .must(() -> !this.isEmpty(item.getRepositoryId())) .failOn(DepositRequest._repositoryId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DepositRequest._repositoryId}, LocaleContextHolder.getLocale())), this.spec() - .must(() -> this.isValidGuid(item.getDmpId())) - .failOn(DepositRequest._dmpId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DepositRequest._dmpId}, LocaleContextHolder.getLocale())) + .must(() -> this.isValidGuid(item.getPlanId())) + .failOn(DepositRequest._planId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DepositRequest._planId}, LocaleContextHolder.getLocale())) ); } } diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/dmpblueprintdefinition/ExtraFieldPersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/dmpblueprintdefinition/ExtraFieldPersist.java index 81b86ba5f..4255192c7 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/dmpblueprintdefinition/ExtraFieldPersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/dmpblueprintdefinition/ExtraFieldPersist.java @@ -1,6 +1,6 @@ package org.opencdmp.model.persist.dmpblueprintdefinition; -import org.opencdmp.commons.enums.DmpBlueprintExtraFieldDataType; +import org.opencdmp.commons.enums.PlanBlueprintExtraFieldDataType; import gr.cite.tools.validation.specification.Specification; import org.opencdmp.convention.ConventionService; import org.opencdmp.errorcode.ErrorThesaurusProperties; @@ -15,15 +15,15 @@ import java.util.List; public class ExtraFieldPersist extends FieldPersist { - private DmpBlueprintExtraFieldDataType dataType; + private PlanBlueprintExtraFieldDataType dataType; public static final String _dataType = "dataType"; - public DmpBlueprintExtraFieldDataType getDataType() { + public PlanBlueprintExtraFieldDataType getDataType() { return dataType; } - public void setDataType(DmpBlueprintExtraFieldDataType dataType) { + public void setDataType(PlanBlueprintExtraFieldDataType dataType) { this.dataType = dataType; } diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/dmpblueprintdefinition/FieldPersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/dmpblueprintdefinition/FieldPersist.java index 74707eefb..99f2905e8 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/dmpblueprintdefinition/FieldPersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/dmpblueprintdefinition/FieldPersist.java @@ -2,7 +2,7 @@ package org.opencdmp.model.persist.dmpblueprintdefinition; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; -import org.opencdmp.commons.enums.DmpBlueprintFieldCategory; +import org.opencdmp.commons.enums.PlanBlueprintFieldCategory; import org.opencdmp.commons.validation.BaseValidator; import gr.cite.tools.validation.specification.Specification; import org.opencdmp.convention.ConventionService; @@ -31,7 +31,7 @@ public abstract class FieldPersist { public static final String _id = "id"; - private DmpBlueprintFieldCategory category; + private PlanBlueprintFieldCategory category; public static final String _category = "category"; @@ -64,11 +64,11 @@ public abstract class FieldPersist { this.id = id; } - public DmpBlueprintFieldCategory getCategory() { + public PlanBlueprintFieldCategory getCategory() { return category; } - public void setCategory(DmpBlueprintFieldCategory category) { + public void setCategory(PlanBlueprintFieldCategory category) { this.category = category; } diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/dmpblueprintdefinition/SystemFieldPersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/dmpblueprintdefinition/SystemFieldPersist.java index 4574e718f..a76e165bd 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/dmpblueprintdefinition/SystemFieldPersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/dmpblueprintdefinition/SystemFieldPersist.java @@ -1,6 +1,6 @@ package org.opencdmp.model.persist.dmpblueprintdefinition; -import org.opencdmp.commons.enums.DmpBlueprintSystemFieldType; +import org.opencdmp.commons.enums.PlanBlueprintSystemFieldType; import gr.cite.tools.validation.specification.Specification; import org.opencdmp.convention.ConventionService; import org.opencdmp.errorcode.ErrorThesaurusProperties; @@ -11,19 +11,18 @@ import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.stereotype.Component; import java.util.List; -import java.util.UUID; public class SystemFieldPersist extends FieldPersist { - private DmpBlueprintSystemFieldType systemFieldType; + private PlanBlueprintSystemFieldType systemFieldType; public static final String _systemFieldType = "systemFieldType"; - public DmpBlueprintSystemFieldType getSystemFieldType() { + public PlanBlueprintSystemFieldType getSystemFieldType() { return systemFieldType; } - public void setSystemFieldType(DmpBlueprintSystemFieldType systemFieldType) { + public void setSystemFieldType(PlanBlueprintSystemFieldType systemFieldType) { this.systemFieldType = systemFieldType; } diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/dmpproperties/DmpPropertiesPersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/dmpproperties/DmpPropertiesPersist.java deleted file mode 100644 index 358ac2b15..000000000 --- a/backend/core/src/main/java/org/opencdmp/model/persist/dmpproperties/DmpPropertiesPersist.java +++ /dev/null @@ -1,134 +0,0 @@ -package org.opencdmp.model.persist.dmpproperties; - -import gr.cite.tools.validation.ValidatorFactory; -import gr.cite.tools.validation.specification.Specification; -import org.opencdmp.commons.enums.DmpBlueprintFieldCategory; -import org.opencdmp.commons.enums.DmpBlueprintSystemFieldType; -import org.opencdmp.commons.enums.DmpStatus; -import org.opencdmp.commons.types.dmpblueprint.DefinitionEntity; -import org.opencdmp.commons.types.dmpblueprint.FieldEntity; -import org.opencdmp.commons.types.dmpblueprint.SectionEntity; -import org.opencdmp.commons.types.dmpblueprint.SystemFieldEntity; -import org.opencdmp.commons.validation.BaseValidator; -import org.opencdmp.convention.ConventionService; -import org.opencdmp.errorcode.ErrorThesaurusProperties; -import org.opencdmp.model.persist.validation.StatusAware; -import org.springframework.beans.factory.config.ConfigurableBeanFactory; -import org.springframework.context.MessageSource; -import org.springframework.context.annotation.Scope; -import org.springframework.context.i18n.LocaleContextHolder; -import org.springframework.stereotype.Component; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.stream.Collectors; - -public class DmpPropertiesPersist { - - private Map dmpBlueprintValues; - - public static final String _dmpBlueprintValues = "dmpBlueprintValues"; - - private List contacts; - - public static final String _contacts = "contacts"; - - public Map getDmpBlueprintValues() { - return this.dmpBlueprintValues; - } - - public void setDmpBlueprintValues(Map dmpBlueprintValues) { - this.dmpBlueprintValues = dmpBlueprintValues; - } - - public List getContacts() { - return this.contacts; - } - - public void setContacts(List contacts) { - this.contacts = contacts; - } - - @Component(DmpPropertiesPersistValidator.ValidatorName) - @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public static class DmpPropertiesPersistValidator extends BaseValidator implements StatusAware { - - public static final String ValidatorName = "DmpPropertiesPersistValidator"; - - private final ValidatorFactory validatorFactory; - private final MessageSource messageSource; - - private DmpStatus status; - private DefinitionEntity definition; - - protected DmpPropertiesPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, ValidatorFactory validatorFactory, MessageSource messageSource) { - super(conventionService, errors); - this.validatorFactory = validatorFactory; - this.messageSource = messageSource; - } - - @Override - protected Class modelClass() { - return DmpPropertiesPersist.class; - } - - @Override - protected List specifications(DmpPropertiesPersist item) { - String contactField = this.getContactFieldLabel(); - return Arrays.asList( - this.mapSpec() - .iff(() ->this.status == DmpStatus.Finalized && !this.isNull(item.getDmpBlueprintValues())) - .on(DmpPropertiesPersist._dmpBlueprintValues) - .over(item.getDmpBlueprintValues()) - .mapKey((k) -> ((UUID)k).toString()) - .using((itm) -> this.validatorFactory.validator(DmpBlueprintValuePersist.DmpBlueprintValuePersistValidator.class).withDefinition(this.definition)), - this.spec() - .iff(() -> this.status == DmpStatus.Finalized && contactField != null) - .must(() -> !this.isListNullOrEmpty(item.getContacts())) - .failOn(DmpPropertiesPersist._contacts).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{contactField}, LocaleContextHolder.getLocale())), - this.navSpec() - .iff(() -> this.status == DmpStatus.Finalized && !this.isListNullOrEmpty(item.getContacts())) - .on(DmpPropertiesPersist._contacts) - .over(item.getContacts()) - .using((itm) -> this.validatorFactory.validator(DmpContactPersist.DmpContactPersistValidator.class)) - ); - } - - @Override - public DmpPropertiesPersistValidator setStatus(DmpStatus status) { - this.status = status; - return this; - } - - public DmpPropertiesPersistValidator withDefinition(DefinitionEntity definition) { - this.definition = definition; - return this; - } - - private String getContactFieldLabel(){ - if (this.definition == null || this.isListNullOrEmpty(this.definition.getSections())) return null; - - for (SectionEntity section: this.definition.getSections()) { - if (!this.isListNullOrEmpty(section.getFields())) { - List fields = section.getFields().stream().filter(x -> x.getCategory().equals(DmpBlueprintFieldCategory.System)).collect(Collectors.toList()); - if (!this.isListNullOrEmpty(fields)){ - - List systemFields = (List)(List) fields; - if (!this.isListNullOrEmpty(systemFields)){ - List contactSystemFields = systemFields.stream().filter(x -> x.getType().equals(DmpBlueprintSystemFieldType.Contact) && x.isRequired()).collect(Collectors.toList()); - if(!this.isListNullOrEmpty(contactSystemFields)) { - return contactSystemFields.getFirst().getLabel() != null ? contactSystemFields.getFirst().getLabel() : DmpBlueprintSystemFieldType.Contact.name(); - } - } - - } - } - } - return null; - } - - } - -} diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/dmpproperties/DmpBlueprintValuePersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/planproperties/PlanBlueprintValuePersist.java similarity index 65% rename from backend/core/src/main/java/org/opencdmp/model/persist/dmpproperties/DmpBlueprintValuePersist.java rename to backend/core/src/main/java/org/opencdmp/model/persist/planproperties/PlanBlueprintValuePersist.java index 8301d62dc..81e3bb73c 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/dmpproperties/DmpBlueprintValuePersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/planproperties/PlanBlueprintValuePersist.java @@ -1,16 +1,16 @@ -package org.opencdmp.model.persist.dmpproperties; +package org.opencdmp.model.persist.planproperties; import gr.cite.tools.data.query.QueryFactory; import gr.cite.tools.fieldset.BaseFieldSet; import gr.cite.tools.validation.ValidatorFactory; import gr.cite.tools.validation.specification.Specification; import org.opencdmp.authorization.AuthorizationFlags; -import org.opencdmp.commons.enums.DmpBlueprintExtraFieldDataType; -import org.opencdmp.commons.enums.DmpBlueprintFieldCategory; -import org.opencdmp.commons.types.dmpblueprint.DefinitionEntity; -import org.opencdmp.commons.types.dmpblueprint.ExtraFieldEntity; -import org.opencdmp.commons.types.dmpblueprint.FieldEntity; -import org.opencdmp.commons.types.dmpblueprint.ReferenceTypeFieldEntity; +import org.opencdmp.commons.enums.PlanBlueprintExtraFieldDataType; +import org.opencdmp.commons.enums.PlanBlueprintFieldCategory; +import org.opencdmp.commons.types.planblueprint.DefinitionEntity; +import org.opencdmp.commons.types.planblueprint.ExtraFieldEntity; +import org.opencdmp.commons.types.planblueprint.FieldEntity; +import org.opencdmp.commons.types.planblueprint.ReferenceTypeFieldEntity; import org.opencdmp.commons.validation.BaseValidator; import org.opencdmp.convention.ConventionService; import org.opencdmp.errorcode.ErrorThesaurusProperties; @@ -28,7 +28,7 @@ import java.util.Arrays; import java.util.List; import java.util.UUID; -public class DmpBlueprintValuePersist { +public class PlanBlueprintValuePersist { private UUID fieldId; public static final String _fieldId = "fieldId"; @@ -94,21 +94,21 @@ public class DmpBlueprintValuePersist { this.reference = reference; } - @Component(DmpBlueprintValuePersistValidator.ValidatorName) + @Component(PlanBlueprintValuePersistValidator.ValidatorName) @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public static class DmpBlueprintValuePersistValidator extends BaseValidator { + public static class PlanBlueprintValuePersistValidator extends BaseValidator { private final ValidatorFactory validatorFactory; private final QueryFactory queryFactory; private final MessageSource messageSource; - public static final String ValidatorName = "DmpBlueprintValuePersistValidator"; + public static final String ValidatorName = "PlanBlueprintValuePersistValidator"; private DefinitionEntity definition; private FieldEntity fieldEntity; private ExtraFieldEntity extraFieldEntity; - protected DmpBlueprintValuePersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, ValidatorFactory validatorFactory, QueryFactory queryFactory, MessageSource messageSource) { + protected PlanBlueprintValuePersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, ValidatorFactory validatorFactory, QueryFactory queryFactory, MessageSource messageSource) { super(conventionService, errors); this.validatorFactory = validatorFactory; this.queryFactory = queryFactory; @@ -116,58 +116,58 @@ public class DmpBlueprintValuePersist { } @Override - protected Class modelClass() { - return DmpBlueprintValuePersist.class; + protected Class modelClass() { + return PlanBlueprintValuePersist.class; } @Override - protected List specifications(DmpBlueprintValuePersist item) { + protected List specifications(PlanBlueprintValuePersist item) { this.fieldEntity = this.definition != null && this.isValidGuid(item.getFieldId())? this.definition.getFieldById(item.getFieldId()).stream().findFirst().orElse(null) : null; boolean required = this.fieldEntity != null && this.fieldEntity.isRequired(); - if (this.fieldEntity.getCategory().equals(DmpBlueprintFieldCategory.Extra)) this.extraFieldEntity = (ExtraFieldEntity) this.fieldEntity; + if (this.fieldEntity.getCategory().equals(PlanBlueprintFieldCategory.Extra)) this.extraFieldEntity = (ExtraFieldEntity) this.fieldEntity; return Arrays.asList( this.spec() .must(() -> this.isValidGuid(item.getFieldId())) - .failOn(DmpBlueprintValuePersist._fieldId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DmpBlueprintValuePersist._fieldId}, LocaleContextHolder.getLocale())), + .failOn(PlanBlueprintValuePersist._fieldId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{PlanBlueprintValuePersist._fieldId}, LocaleContextHolder.getLocale())), this.spec() - .iff(() -> this.extraFieldEntity != null && DmpBlueprintExtraFieldDataType.isTextType(this.extraFieldEntity.getType()) && this.isListNullOrEmpty(item.getReferences()) && required) + .iff(() -> this.extraFieldEntity != null && PlanBlueprintExtraFieldDataType.isTextType(this.extraFieldEntity.getType()) && this.isListNullOrEmpty(item.getReferences()) && required) .must(() -> !this.isEmpty(item.getFieldValue())) - .failOn(DmpBlueprintValuePersist._fieldValue).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{this.fieldEntity.getLabel()}, LocaleContextHolder.getLocale())), + .failOn(PlanBlueprintValuePersist._fieldValue).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{this.fieldEntity.getLabel()}, LocaleContextHolder.getLocale())), this.spec() - .iff(() -> this.extraFieldEntity != null && DmpBlueprintExtraFieldDataType.isDateType(this.extraFieldEntity.getType()) && this.isListNullOrEmpty(item.getReferences()) && required) + .iff(() -> this.extraFieldEntity != null && PlanBlueprintExtraFieldDataType.isDateType(this.extraFieldEntity.getType()) && this.isListNullOrEmpty(item.getReferences()) && required) .must(() -> !this.isNull(item.getDateValue())) - .failOn(DmpBlueprintValuePersist._dateValue).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{this.fieldEntity.getLabel()}, LocaleContextHolder.getLocale())), + .failOn(PlanBlueprintValuePersist._dateValue).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{this.fieldEntity.getLabel()}, LocaleContextHolder.getLocale())), this.spec() - .iff(() -> this.extraFieldEntity != null && DmpBlueprintExtraFieldDataType.isNumberType(this.extraFieldEntity.getType()) && this.isListNullOrEmpty(item.getReferences()) && required) + .iff(() -> this.extraFieldEntity != null && PlanBlueprintExtraFieldDataType.isNumberType(this.extraFieldEntity.getType()) && this.isListNullOrEmpty(item.getReferences()) && required) .must(() -> !this.isNull(item.getNumberValue())) - .failOn(DmpBlueprintValuePersist._numberValue).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{this.fieldEntity.getLabel()}, LocaleContextHolder.getLocale())), + .failOn(PlanBlueprintValuePersist._numberValue).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{this.fieldEntity.getLabel()}, LocaleContextHolder.getLocale())), this.spec() - .iff(() -> this.fieldEntity.getCategory().equals(DmpBlueprintFieldCategory.ReferenceType) && this.isEmpty(item.getFieldValue()) && ((ReferenceTypeFieldEntity) this.fieldEntity).getMultipleSelect() && required) + .iff(() -> this.fieldEntity.getCategory().equals(PlanBlueprintFieldCategory.ReferenceType) && this.isEmpty(item.getFieldValue()) && ((ReferenceTypeFieldEntity) this.fieldEntity).getMultipleSelect() && required) .must(() -> !this.isListNullOrEmpty(item.getReferences())) // TODO: Cast Exception // .failOn(DmpBlueprintValuePersist._references).failWith(messageSource.getMessage("Validation_Required", new Object[]{!this.isEmpty(fieldEntity.getLabel()) ? fieldEntity.getLabel() : this.getReferenceTypeName(fieldEntity)}, LocaleContextHolder.getLocale())), - .failOn(DmpBlueprintValuePersist._references).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{!this.isEmpty(this.fieldEntity.getLabel()) ? this.fieldEntity.getLabel() : DmpBlueprintValuePersist._references}, LocaleContextHolder.getLocale())), + .failOn(PlanBlueprintValuePersist._references).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{!this.isEmpty(this.fieldEntity.getLabel()) ? this.fieldEntity.getLabel() : PlanBlueprintValuePersist._references}, LocaleContextHolder.getLocale())), this.spec() - .iff(() -> this.fieldEntity.getCategory().equals(DmpBlueprintFieldCategory.ReferenceType) && this.isEmpty(item.getFieldValue()) && !((ReferenceTypeFieldEntity) this.fieldEntity).getMultipleSelect() && required) + .iff(() -> this.fieldEntity.getCategory().equals(PlanBlueprintFieldCategory.ReferenceType) && this.isEmpty(item.getFieldValue()) && !((ReferenceTypeFieldEntity) this.fieldEntity).getMultipleSelect() && required) .must(() -> !this.isNull(item.getReference())) // TODO: Cast Exception // .failOn(DmpBlueprintValuePersist._references).failWith(messageSource.getMessage("Validation_Required", new Object[]{!this.isEmpty(fieldEntity.getLabel()) ? fieldEntity.getLabel() : this.getReferenceTypeName(fieldEntity)}, LocaleContextHolder.getLocale())), - .failOn(DmpBlueprintValuePersist._reference).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{!this.isEmpty(this.fieldEntity.getLabel()) ? this.fieldEntity.getLabel() : DmpBlueprintValuePersist._reference}, LocaleContextHolder.getLocale())), + .failOn(PlanBlueprintValuePersist._reference).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{!this.isEmpty(this.fieldEntity.getLabel()) ? this.fieldEntity.getLabel() : PlanBlueprintValuePersist._reference}, LocaleContextHolder.getLocale())), this.navSpec() .iff(() -> !this.isListNullOrEmpty(item.getReferences())) - .on(DmpBlueprintValuePersist._references) + .on(PlanBlueprintValuePersist._references) .over(item.getReferences()) .using((itm) -> this.validatorFactory.validator(ReferencePersist.ReferenceWithoutTypePersistValidator.class)), this.refSpec() .iff(() -> !this.isNull(item.getReference())) - .on(DmpBlueprintValuePersist._reference) + .on(PlanBlueprintValuePersist._reference) .over(item.getReferences()) .using(() -> this.validatorFactory.validator(ReferencePersist.ReferenceWithoutTypePersistValidator.class)) ); } - public DmpBlueprintValuePersistValidator withDefinition(DefinitionEntity definition) { + public PlanBlueprintValuePersistValidator withDefinition(DefinitionEntity definition) { this.definition = definition; return this; } diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/dmpproperties/DmpContactPersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/planproperties/PlanContactPersist.java similarity index 59% rename from backend/core/src/main/java/org/opencdmp/model/persist/dmpproperties/DmpContactPersist.java rename to backend/core/src/main/java/org/opencdmp/model/persist/planproperties/PlanContactPersist.java index be4adc629..ad677c411 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/dmpproperties/DmpContactPersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/planproperties/PlanContactPersist.java @@ -1,10 +1,9 @@ -package org.opencdmp.model.persist.dmpproperties; +package org.opencdmp.model.persist.planproperties; import org.opencdmp.commons.validation.BaseValidator; import gr.cite.tools.validation.specification.Specification; import org.opencdmp.convention.ConventionService; import org.opencdmp.errorcode.ErrorThesaurusProperties; -import org.opencdmp.model.persist.UserInviteToTenantRequestPersist; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.MessageSource; import org.springframework.context.annotation.Scope; @@ -14,7 +13,7 @@ import org.springframework.stereotype.Component; import java.util.Arrays; import java.util.List; -public class DmpContactPersist { +public class PlanContactPersist { private String firstName; public static final String _firstName = "firstName"; @@ -49,39 +48,39 @@ public class DmpContactPersist { this.email = email; } - @Component(DmpContactPersistValidator.ValidatorName) + @Component(PlanContactPersistValidator.ValidatorName) @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public static class DmpContactPersistValidator extends BaseValidator { + public static class PlanContactPersistValidator extends BaseValidator { - public static final String ValidatorName = "DmpContactPersistValidator"; + public static final String ValidatorName = "PlanContactPersistValidator"; private final MessageSource messageSource; - protected DmpContactPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) { + protected PlanContactPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) { super(conventionService, errors); this.messageSource = messageSource; } @Override - protected Class modelClass() { - return DmpContactPersist.class; + protected Class modelClass() { + return PlanContactPersist.class; } @Override - protected List specifications(DmpContactPersist item) { + protected List specifications(PlanContactPersist item) { return Arrays.asList( this.spec() .must(() -> !this.isEmpty(item.getEmail())) - .failOn(DmpContactPersist._email).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpContactPersist._email}, LocaleContextHolder.getLocale())), + .failOn(PlanContactPersist._email).failWith(messageSource.getMessage("Validation_Required", new Object[]{PlanContactPersist._email}, LocaleContextHolder.getLocale())), this.spec() .iff(() -> !this.isEmpty(item.getEmail())) .must(() -> this.isValidEmail(item.getEmail())) - .failOn(DmpContactPersist._email).failWith(messageSource.getMessage("Validation_UnexpectedValue", new Object[]{DmpContactPersist._email}, LocaleContextHolder.getLocale())), + .failOn(PlanContactPersist._email).failWith(messageSource.getMessage("Validation_UnexpectedValue", new Object[]{PlanContactPersist._email}, LocaleContextHolder.getLocale())), this.spec() .must(() -> !this.isEmpty(item.getFirstName())) - .failOn(DmpContactPersist._firstName).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpContactPersist._firstName}, LocaleContextHolder.getLocale())), + .failOn(PlanContactPersist._firstName).failWith(messageSource.getMessage("Validation_Required", new Object[]{PlanContactPersist._firstName}, LocaleContextHolder.getLocale())), this.spec() .must(() -> !this.isEmpty(item.getLastName())) - .failOn(DmpContactPersist._lastName).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpContactPersist._lastName}, LocaleContextHolder.getLocale())) + .failOn(PlanContactPersist._lastName).failWith(messageSource.getMessage("Validation_Required", new Object[]{PlanContactPersist._lastName}, LocaleContextHolder.getLocale())) ); } } diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/planproperties/PlanPropertiesPersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/planproperties/PlanPropertiesPersist.java new file mode 100644 index 000000000..7c0caae49 --- /dev/null +++ b/backend/core/src/main/java/org/opencdmp/model/persist/planproperties/PlanPropertiesPersist.java @@ -0,0 +1,134 @@ +package org.opencdmp.model.persist.planproperties; + +import gr.cite.tools.validation.ValidatorFactory; +import gr.cite.tools.validation.specification.Specification; +import org.opencdmp.commons.enums.PlanBlueprintFieldCategory; +import org.opencdmp.commons.enums.PlanBlueprintSystemFieldType; +import org.opencdmp.commons.enums.PlanStatus; +import org.opencdmp.commons.types.planblueprint.DefinitionEntity; +import org.opencdmp.commons.types.planblueprint.FieldEntity; +import org.opencdmp.commons.types.planblueprint.SectionEntity; +import org.opencdmp.commons.types.planblueprint.SystemFieldEntity; +import org.opencdmp.commons.validation.BaseValidator; +import org.opencdmp.convention.ConventionService; +import org.opencdmp.errorcode.ErrorThesaurusProperties; +import org.opencdmp.model.persist.validation.StatusAware; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.context.MessageSource; +import org.springframework.context.annotation.Scope; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.stereotype.Component; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.stream.Collectors; + +public class PlanPropertiesPersist { + + private Map planBlueprintValues; + + public static final String _planBlueprintValues = "planBlueprintValues"; + + private List contacts; + + public static final String _contacts = "contacts"; + + public Map getPlanBlueprintValues() { + return this.planBlueprintValues; + } + + public void setPlanBlueprintValues(Map planBlueprintValues) { + this.planBlueprintValues = planBlueprintValues; + } + + public List getContacts() { + return this.contacts; + } + + public void setContacts(List contacts) { + this.contacts = contacts; + } + + @Component(PlanPropertiesPersistValidator.ValidatorName) + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public static class PlanPropertiesPersistValidator extends BaseValidator implements StatusAware { + + public static final String ValidatorName = "PlanPropertiesPersistValidator"; + + private final ValidatorFactory validatorFactory; + private final MessageSource messageSource; + + private PlanStatus status; + private DefinitionEntity definition; + + protected PlanPropertiesPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, ValidatorFactory validatorFactory, MessageSource messageSource) { + super(conventionService, errors); + this.validatorFactory = validatorFactory; + this.messageSource = messageSource; + } + + @Override + protected Class modelClass() { + return PlanPropertiesPersist.class; + } + + @Override + protected List specifications(PlanPropertiesPersist item) { + String contactField = this.getContactFieldLabel(); + return Arrays.asList( + this.mapSpec() + .iff(() ->this.status == PlanStatus.Finalized && !this.isNull(item.getPlanBlueprintValues())) + .on(PlanPropertiesPersist._planBlueprintValues) + .over(item.getPlanBlueprintValues()) + .mapKey((k) -> ((UUID)k).toString()) + .using((itm) -> this.validatorFactory.validator(PlanBlueprintValuePersist.PlanBlueprintValuePersistValidator.class).withDefinition(this.definition)), + this.spec() + .iff(() -> this.status == PlanStatus.Finalized && contactField != null) + .must(() -> !this.isListNullOrEmpty(item.getContacts())) + .failOn(PlanPropertiesPersist._contacts).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{contactField}, LocaleContextHolder.getLocale())), + this.navSpec() + .iff(() -> this.status == PlanStatus.Finalized && !this.isListNullOrEmpty(item.getContacts())) + .on(PlanPropertiesPersist._contacts) + .over(item.getContacts()) + .using((itm) -> this.validatorFactory.validator(PlanContactPersist.PlanContactPersistValidator.class)) + ); + } + + @Override + public PlanPropertiesPersistValidator setStatus(PlanStatus status) { + this.status = status; + return this; + } + + public PlanPropertiesPersistValidator withDefinition(DefinitionEntity definition) { + this.definition = definition; + return this; + } + + private String getContactFieldLabel(){ + if (this.definition == null || this.isListNullOrEmpty(this.definition.getSections())) return null; + + for (SectionEntity section: this.definition.getSections()) { + if (!this.isListNullOrEmpty(section.getFields())) { + List fields = section.getFields().stream().filter(x -> x.getCategory().equals(PlanBlueprintFieldCategory.System)).collect(Collectors.toList()); + if (!this.isListNullOrEmpty(fields)){ + + List systemFields = (List)(List) fields; + if (!this.isListNullOrEmpty(systemFields)){ + List contactSystemFields = systemFields.stream().filter(x -> x.getType().equals(PlanBlueprintSystemFieldType.Contact) && x.isRequired()).collect(Collectors.toList()); + if(!this.isListNullOrEmpty(contactSystemFields)) { + return contactSystemFields.getFirst().getLabel() != null ? contactSystemFields.getFirst().getLabel() : PlanBlueprintSystemFieldType.Contact.name(); + } + } + + } + } + } + return null; + } + + } + +} diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/dmpreference/DmpReferenceDataPersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/planreference/PlanReferenceDataPersist.java similarity index 57% rename from backend/core/src/main/java/org/opencdmp/model/persist/dmpreference/DmpReferenceDataPersist.java rename to backend/core/src/main/java/org/opencdmp/model/persist/planreference/PlanReferenceDataPersist.java index 55c1525d4..3a6d70375 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/dmpreference/DmpReferenceDataPersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/planreference/PlanReferenceDataPersist.java @@ -1,10 +1,9 @@ -package org.opencdmp.model.persist.dmpreference; +package org.opencdmp.model.persist.planreference; import org.opencdmp.commons.validation.BaseValidator; import gr.cite.tools.validation.specification.Specification; import org.opencdmp.convention.ConventionService; import org.opencdmp.errorcode.ErrorThesaurusProperties; -import org.opencdmp.model.persist.ReferencePersist; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.MessageSource; import org.springframework.context.annotation.Scope; @@ -15,7 +14,7 @@ import java.util.Arrays; import java.util.List; import java.util.UUID; -public class DmpReferenceDataPersist { +public class PlanReferenceDataPersist { private UUID blueprintFieldId; @@ -29,29 +28,29 @@ public class DmpReferenceDataPersist { this.blueprintFieldId = blueprintFieldId; } - @Component(DmpReferenceDataPersistValidator.ValidatorName) + @Component(PlanReferenceDataPersistValidator.ValidatorName) @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public static class DmpReferenceDataPersistValidator extends BaseValidator { + public static class PlanReferenceDataPersistValidator extends BaseValidator { - public static final String ValidatorName = "DmpReferenceDataPersistValidator"; + public static final String ValidatorName = "PlanReferenceDataPersistValidator"; private final MessageSource messageSource; - protected DmpReferenceDataPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) { + protected PlanReferenceDataPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) { super(conventionService, errors); this.messageSource = messageSource; } @Override - protected Class modelClass() { - return DmpReferenceDataPersist.class; + protected Class modelClass() { + return PlanReferenceDataPersist.class; } @Override - protected List specifications(DmpReferenceDataPersist item) { + protected List specifications(PlanReferenceDataPersist item) { return Arrays.asList( this.spec() .must(() -> !this.isNull(item.getBlueprintFieldId())) - .failOn(DmpReferenceDataPersist._blueprintFieldId).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpReferenceDataPersist._blueprintFieldId}, LocaleContextHolder.getLocale())) + .failOn(PlanReferenceDataPersist._blueprintFieldId).failWith(messageSource.getMessage("Validation_Required", new Object[]{PlanReferenceDataPersist._blueprintFieldId}, LocaleContextHolder.getLocale())) ); } } diff --git a/backend/core/src/main/java/org/opencdmp/model/dmp/Dmp.java b/backend/core/src/main/java/org/opencdmp/model/plan/Plan.java similarity index 70% rename from backend/core/src/main/java/org/opencdmp/model/dmp/Dmp.java rename to backend/core/src/main/java/org/opencdmp/model/plan/Plan.java index 2cf87e636..913f847bd 100644 --- a/backend/core/src/main/java/org/opencdmp/model/dmp/Dmp.java +++ b/backend/core/src/main/java/org/opencdmp/model/plan/Plan.java @@ -1,20 +1,20 @@ -package org.opencdmp.model.dmp; +package org.opencdmp.model.plan; -import org.opencdmp.commons.enums.DmpAccessType; -import org.opencdmp.commons.enums.DmpStatus; -import org.opencdmp.commons.enums.DmpVersionStatus; +import org.opencdmp.commons.enums.PlanAccessType; +import org.opencdmp.commons.enums.PlanStatus; +import org.opencdmp.commons.enums.PlanVersionStatus; import org.opencdmp.commons.enums.IsActive; import org.opencdmp.model.*; import org.opencdmp.model.description.Description; -import org.opencdmp.model.dmpblueprint.DmpBlueprint; -import org.opencdmp.model.dmpreference.DmpReference; +import org.opencdmp.model.planblueprint.PlanBlueprint; +import org.opencdmp.model.planreference.PlanReference; import org.opencdmp.model.user.User; import java.time.Instant; import java.util.List; import java.util.UUID; -public class Dmp { +public class Plan { private UUID id; public static final String _id = "id"; @@ -25,13 +25,13 @@ public class Dmp { private Short version; public static final String _version = "version"; - private DmpStatus status; + private PlanStatus status; public static final String _status = "status"; - private DmpVersionStatus versionStatus; + private PlanVersionStatus versionStatus; public static final String _versionStatus = "versionStatus"; - private DmpProperties properties; + private PlanProperties properties; public static final String _properties = "properties"; private UUID groupId; @@ -58,10 +58,10 @@ public class Dmp { private User creator; public static final String _creator = "creator"; - private DmpAccessType accessType; + private PlanAccessType accessType; public static final String _accessType = "accessType"; - private DmpBlueprint blueprint; + private PlanBlueprint blueprint; public static final String _blueprint = "blueprint"; private String language; @@ -73,17 +73,17 @@ public class Dmp { private String hash; public static final String _hash = "hash"; - private List dmpReferences; - public static final String _dmpReferences = "dmpReferences"; + private List planReferences; + public static final String _planReferences = "planReferences"; - private List dmpUsers; - public static final String _dmpUsers = "dmpUsers"; + private List planUsers; + public static final String _planUsers = "planUsers"; private List descriptions; public static final String _descriptions = "descriptions"; - private List dmpDescriptionTemplates; - public static final String _dmpDescriptionTemplates = "dmpDescriptionTemplates"; + private List planDescriptionTemplates; + public static final String _planDescriptionTemplates = "planDescriptionTemplates"; private List entityDois; public static final String _entityDois = "entityDois"; @@ -91,8 +91,8 @@ public class Dmp { private List authorizationFlags; public static final String _authorizationFlags = "authorizationFlags"; - private List otherDmpVersions; - public static final String _otherDmpVersions = "otherDmpVersions"; + private List otherPlanVersions; + public static final String _otherPlanVersions = "otherPlanVersions"; private Boolean belongsToCurrentTenant; @@ -122,19 +122,19 @@ public class Dmp { this.version = version; } - public DmpStatus getStatus() { + public PlanStatus getStatus() { return status; } - public void setStatus(DmpStatus status) { + public void setStatus(PlanStatus status) { this.status = status; } - public DmpProperties getProperties() { + public PlanProperties getProperties() { return properties; } - public void setProperties(DmpProperties properties) { + public void setProperties(PlanProperties properties) { this.properties = properties; } @@ -202,19 +202,19 @@ public class Dmp { this.creator = creator; } - public DmpAccessType getAccessType() { + public PlanAccessType getAccessType() { return accessType; } - public void setAccessType(DmpAccessType accessType) { + public void setAccessType(PlanAccessType accessType) { this.accessType = accessType; } - public DmpBlueprint getBlueprint() { + public PlanBlueprint getBlueprint() { return blueprint; } - public void setBlueprint(DmpBlueprint blueprint) { + public void setBlueprint(PlanBlueprint blueprint) { this.blueprint = blueprint; } @@ -242,27 +242,27 @@ public class Dmp { this.hash = hash; } - public List getDmpReferences() { - return dmpReferences; + public List getPlanReferences() { + return planReferences; } - public void setDmpReferences(List dmpReferences) { - this.dmpReferences = dmpReferences; + public void setPlanReferences(List planReferences) { + this.planReferences = planReferences; } - public List getDmpUsers() { - return dmpUsers; + public List getPlanUsers() { + return planUsers; } - public void setDmpUsers(List dmpUsers) { - this.dmpUsers = dmpUsers; + public void setPlanUsers(List planUsers) { + this.planUsers = planUsers; } - public DmpVersionStatus getVersionStatus() { + public PlanVersionStatus getVersionStatus() { return versionStatus; } - public void setVersionStatus(DmpVersionStatus versionStatus) { + public void setVersionStatus(PlanVersionStatus versionStatus) { this.versionStatus = versionStatus; } @@ -274,12 +274,12 @@ public class Dmp { this.descriptions = descriptions; } - public List getDmpDescriptionTemplates() { - return dmpDescriptionTemplates; + public List getPlanDescriptionTemplates() { + return planDescriptionTemplates; } - public void setDmpDescriptionTemplates(List dmpDescriptionTemplates) { - this.dmpDescriptionTemplates = dmpDescriptionTemplates; + public void setPlanDescriptionTemplates(List planDescriptionTemplates) { + this.planDescriptionTemplates = planDescriptionTemplates; } public List getEntityDois() { @@ -306,11 +306,11 @@ public class Dmp { this.belongsToCurrentTenant = belongsToCurrentTenant; } - public List getOtherDmpVersions() { - return otherDmpVersions; + public List getOtherPlanVersions() { + return otherPlanVersions; } - public void setOtherDmpVersions(List otherDmpVersions) { - this.otherDmpVersions = otherDmpVersions; + public void setOtherPlanVersions(List otherPlanVersions) { + this.otherPlanVersions = otherPlanVersions; } } diff --git a/backend/core/src/main/java/org/opencdmp/model/dmp/DmpBlueprintValue.java b/backend/core/src/main/java/org/opencdmp/model/plan/PlanBlueprintValue.java similarity index 94% rename from backend/core/src/main/java/org/opencdmp/model/dmp/DmpBlueprintValue.java rename to backend/core/src/main/java/org/opencdmp/model/plan/PlanBlueprintValue.java index 3d3ab38a0..b657d8ed3 100644 --- a/backend/core/src/main/java/org/opencdmp/model/dmp/DmpBlueprintValue.java +++ b/backend/core/src/main/java/org/opencdmp/model/plan/PlanBlueprintValue.java @@ -1,9 +1,9 @@ -package org.opencdmp.model.dmp; +package org.opencdmp.model.plan; import java.time.Instant; import java.util.UUID; -public class DmpBlueprintValue { +public class PlanBlueprintValue { private UUID fieldId; public static final String _fieldId = "fieldId"; diff --git a/backend/core/src/main/java/org/opencdmp/model/dmp/DmpContact.java b/backend/core/src/main/java/org/opencdmp/model/plan/PlanContact.java similarity index 92% rename from backend/core/src/main/java/org/opencdmp/model/dmp/DmpContact.java rename to backend/core/src/main/java/org/opencdmp/model/plan/PlanContact.java index 50b79a05f..f988c0f04 100644 --- a/backend/core/src/main/java/org/opencdmp/model/dmp/DmpContact.java +++ b/backend/core/src/main/java/org/opencdmp/model/plan/PlanContact.java @@ -1,7 +1,7 @@ -package org.opencdmp.model.dmp; +package org.opencdmp.model.plan; -public class DmpContact { +public class PlanContact { private String firstName; diff --git a/backend/core/src/main/java/org/opencdmp/model/plan/PlanProperties.java b/backend/core/src/main/java/org/opencdmp/model/plan/PlanProperties.java new file mode 100644 index 000000000..710f64c2f --- /dev/null +++ b/backend/core/src/main/java/org/opencdmp/model/plan/PlanProperties.java @@ -0,0 +1,31 @@ +package org.opencdmp.model.plan; + +import java.util.List; + +public class PlanProperties { + + private List planBlueprintValues; + + public static final String _planBlueprintValues = "planBlueprintValues"; + + private List contacts; + + public static final String _contacts = "contacts"; + + public List getPlanBlueprintValues() { + return planBlueprintValues; + } + + public void setPlanBlueprintValues(List planBlueprintValues) { + this.planBlueprintValues = planBlueprintValues; + } + + public List getContacts() { + return contacts; + } + + public void setContacts(List contacts) { + this.contacts = contacts; + } + +} diff --git a/backend/core/src/main/java/org/opencdmp/model/dmpblueprint/Definition.java b/backend/core/src/main/java/org/opencdmp/model/planblueprint/Definition.java similarity index 87% rename from backend/core/src/main/java/org/opencdmp/model/dmpblueprint/Definition.java rename to backend/core/src/main/java/org/opencdmp/model/planblueprint/Definition.java index 6f4d941be..093fa8015 100644 --- a/backend/core/src/main/java/org/opencdmp/model/dmpblueprint/Definition.java +++ b/backend/core/src/main/java/org/opencdmp/model/planblueprint/Definition.java @@ -1,4 +1,4 @@ -package org.opencdmp.model.dmpblueprint; +package org.opencdmp.model.planblueprint; import java.util.List; diff --git a/backend/core/src/main/java/org/opencdmp/model/dmpblueprint/DescriptionTemplate.java b/backend/core/src/main/java/org/opencdmp/model/planblueprint/DescriptionTemplate.java similarity index 96% rename from backend/core/src/main/java/org/opencdmp/model/dmpblueprint/DescriptionTemplate.java rename to backend/core/src/main/java/org/opencdmp/model/planblueprint/DescriptionTemplate.java index 5f51c4a9e..7515f9e3f 100644 --- a/backend/core/src/main/java/org/opencdmp/model/dmpblueprint/DescriptionTemplate.java +++ b/backend/core/src/main/java/org/opencdmp/model/planblueprint/DescriptionTemplate.java @@ -1,4 +1,4 @@ -package org.opencdmp.model.dmpblueprint; +package org.opencdmp.model.planblueprint; import java.util.UUID; diff --git a/backend/core/src/main/java/org/opencdmp/model/planblueprint/ExtraField.java b/backend/core/src/main/java/org/opencdmp/model/planblueprint/ExtraField.java new file mode 100644 index 000000000..c4aee326a --- /dev/null +++ b/backend/core/src/main/java/org/opencdmp/model/planblueprint/ExtraField.java @@ -0,0 +1,19 @@ +package org.opencdmp.model.planblueprint; + +import org.opencdmp.commons.enums.PlanBlueprintExtraFieldDataType; + + +public class ExtraField extends Field { + + public final static String _dataType = "dataType"; + private PlanBlueprintExtraFieldDataType dataType; + + public PlanBlueprintExtraFieldDataType getDataType() { + return dataType; + } + + public void setDataType(PlanBlueprintExtraFieldDataType dataType) { + this.dataType = dataType; + } +} + diff --git a/backend/core/src/main/java/org/opencdmp/model/dmpblueprint/Field.java b/backend/core/src/main/java/org/opencdmp/model/planblueprint/Field.java similarity index 86% rename from backend/core/src/main/java/org/opencdmp/model/dmpblueprint/Field.java rename to backend/core/src/main/java/org/opencdmp/model/planblueprint/Field.java index cc563fc9b..b2c524ef8 100644 --- a/backend/core/src/main/java/org/opencdmp/model/dmpblueprint/Field.java +++ b/backend/core/src/main/java/org/opencdmp/model/planblueprint/Field.java @@ -1,6 +1,6 @@ -package org.opencdmp.model.dmpblueprint; +package org.opencdmp.model.planblueprint; -import org.opencdmp.commons.enums.DmpBlueprintFieldCategory; +import org.opencdmp.commons.enums.PlanBlueprintFieldCategory; import java.util.List; import java.util.UUID; @@ -11,7 +11,7 @@ public abstract class Field { private UUID id; public final static String _category = "category"; - private DmpBlueprintFieldCategory category; + private PlanBlueprintFieldCategory category; public final static String _label = "label"; private String label; @@ -39,11 +39,11 @@ public abstract class Field { this.id = id; } - public DmpBlueprintFieldCategory getCategory() { + public PlanBlueprintFieldCategory getCategory() { return category; } - public void setCategory(DmpBlueprintFieldCategory category) { + public void setCategory(PlanBlueprintFieldCategory category) { this.category = category; } diff --git a/backend/core/src/main/java/org/opencdmp/model/dmpblueprint/DmpBlueprint.java b/backend/core/src/main/java/org/opencdmp/model/planblueprint/PlanBlueprint.java similarity index 83% rename from backend/core/src/main/java/org/opencdmp/model/dmpblueprint/DmpBlueprint.java rename to backend/core/src/main/java/org/opencdmp/model/planblueprint/PlanBlueprint.java index a158f9b12..fdaed6d40 100644 --- a/backend/core/src/main/java/org/opencdmp/model/dmpblueprint/DmpBlueprint.java +++ b/backend/core/src/main/java/org/opencdmp/model/planblueprint/PlanBlueprint.java @@ -1,14 +1,13 @@ -package org.opencdmp.model.dmpblueprint; +package org.opencdmp.model.planblueprint; -import org.opencdmp.commons.enums.DmpBlueprintStatus; -import org.opencdmp.commons.enums.DmpBlueprintVersionStatus; +import org.opencdmp.commons.enums.PlanBlueprintStatus; +import org.opencdmp.commons.enums.PlanBlueprintVersionStatus; import org.opencdmp.commons.enums.IsActive; -import org.opencdmp.model.dmpblueprint.Definition; import java.time.Instant; import java.util.UUID; -public class DmpBlueprint { +public class PlanBlueprint { private UUID id; @@ -22,7 +21,7 @@ public class DmpBlueprint { public static final String _definition = "definition"; - private DmpBlueprintStatus status; + private PlanBlueprintStatus status; public static final String _status = "status"; @@ -34,7 +33,7 @@ public class DmpBlueprint { public static final String _version = "version"; - private DmpBlueprintVersionStatus versionStatus; + private PlanBlueprintVersionStatus versionStatus; public static final String _versionStatus = "versionStatus"; @@ -81,11 +80,11 @@ public class DmpBlueprint { this.definition = definition; } - public DmpBlueprintStatus getStatus() { + public PlanBlueprintStatus getStatus() { return status; } - public void setStatus(DmpBlueprintStatus status) { + public void setStatus(PlanBlueprintStatus status) { this.status = status; } @@ -105,11 +104,11 @@ public class DmpBlueprint { this.version = version; } - public DmpBlueprintVersionStatus getVersionStatus() { + public PlanBlueprintVersionStatus getVersionStatus() { return versionStatus; } - public void setVersionStatus(DmpBlueprintVersionStatus versionStatus) { + public void setVersionStatus(PlanBlueprintVersionStatus versionStatus) { this.versionStatus = versionStatus; } diff --git a/backend/core/src/main/java/org/opencdmp/model/dmpblueprint/ReferenceTypeField.java b/backend/core/src/main/java/org/opencdmp/model/planblueprint/ReferenceTypeField.java similarity index 93% rename from backend/core/src/main/java/org/opencdmp/model/dmpblueprint/ReferenceTypeField.java rename to backend/core/src/main/java/org/opencdmp/model/planblueprint/ReferenceTypeField.java index df723d0a5..b8224f4c6 100644 --- a/backend/core/src/main/java/org/opencdmp/model/dmpblueprint/ReferenceTypeField.java +++ b/backend/core/src/main/java/org/opencdmp/model/planblueprint/ReferenceTypeField.java @@ -1,4 +1,4 @@ -package org.opencdmp.model.dmpblueprint; +package org.opencdmp.model.planblueprint; import org.opencdmp.model.referencetype.ReferenceType; diff --git a/backend/core/src/main/java/org/opencdmp/model/dmpblueprint/Section.java b/backend/core/src/main/java/org/opencdmp/model/planblueprint/Section.java similarity index 98% rename from backend/core/src/main/java/org/opencdmp/model/dmpblueprint/Section.java rename to backend/core/src/main/java/org/opencdmp/model/planblueprint/Section.java index f91850c2a..a97a0320e 100644 --- a/backend/core/src/main/java/org/opencdmp/model/dmpblueprint/Section.java +++ b/backend/core/src/main/java/org/opencdmp/model/planblueprint/Section.java @@ -1,4 +1,4 @@ -package org.opencdmp.model.dmpblueprint; +package org.opencdmp.model.planblueprint; import org.opencdmp.model.prefillingsource.PrefillingSource; diff --git a/backend/core/src/main/java/org/opencdmp/model/planblueprint/SystemField.java b/backend/core/src/main/java/org/opencdmp/model/planblueprint/SystemField.java new file mode 100644 index 000000000..3a10863ec --- /dev/null +++ b/backend/core/src/main/java/org/opencdmp/model/planblueprint/SystemField.java @@ -0,0 +1,17 @@ +package org.opencdmp.model.planblueprint; + +import org.opencdmp.commons.enums.PlanBlueprintSystemFieldType; + +public class SystemField extends Field { + + public final static String _systemFieldType = "systemFieldType"; + private PlanBlueprintSystemFieldType systemFieldType; + + public PlanBlueprintSystemFieldType getSystemFieldType() { + return systemFieldType; + } + + public void setSystemFieldType(PlanBlueprintSystemFieldType systemFieldType) { + this.systemFieldType = systemFieldType; + } +} diff --git a/backend/core/src/main/java/org/opencdmp/model/dmpreference/DmpReference.java b/backend/core/src/main/java/org/opencdmp/model/planreference/PlanReference.java similarity index 82% rename from backend/core/src/main/java/org/opencdmp/model/dmpreference/DmpReference.java rename to backend/core/src/main/java/org/opencdmp/model/planreference/PlanReference.java index 795c13b37..2f6d11b97 100644 --- a/backend/core/src/main/java/org/opencdmp/model/dmpreference/DmpReference.java +++ b/backend/core/src/main/java/org/opencdmp/model/planreference/PlanReference.java @@ -1,19 +1,19 @@ -package org.opencdmp.model.dmpreference; +package org.opencdmp.model.planreference; import org.opencdmp.commons.enums.IsActive; +import org.opencdmp.model.plan.Plan; import org.opencdmp.model.reference.Reference; -import org.opencdmp.model.dmp.Dmp; import java.time.Instant; import java.util.UUID; -public class DmpReference { +public class PlanReference { private UUID id; public static final String _id = "id"; - private Dmp dmp; - public static final String _dmp = "dmp"; + private Plan plan; + public static final String _plan = "plan"; private Reference reference; public static final String _reference = "reference"; @@ -34,7 +34,7 @@ public class DmpReference { private Boolean belongsToCurrentTenant; public static final String _belongsToCurrentTenant = "belongsToCurrentTenant"; - private DmpReferenceData data; + private PlanReferenceData data; public static final String _data = "data"; public UUID getId() { @@ -45,12 +45,12 @@ public class DmpReference { this.id = id; } - public Dmp getDmp() { - return dmp; + public Plan getPlan() { + return plan; } - public void setDmp(Dmp dmp) { - this.dmp = dmp; + public void setPlan(Plan plan) { + this.plan = plan; } public Reference getReference() { @@ -85,11 +85,11 @@ public class DmpReference { this.hash = hash; } - public void setData(DmpReferenceData data) { + public void setData(PlanReferenceData data) { this.data = data; } - public DmpReferenceData getData() { + public PlanReferenceData getData() { return data; } diff --git a/backend/core/src/main/java/org/opencdmp/model/dmpreference/DmpReferenceData.java b/backend/core/src/main/java/org/opencdmp/model/planreference/PlanReferenceData.java similarity index 80% rename from backend/core/src/main/java/org/opencdmp/model/dmpreference/DmpReferenceData.java rename to backend/core/src/main/java/org/opencdmp/model/planreference/PlanReferenceData.java index f94cdc11a..93897ff6d 100644 --- a/backend/core/src/main/java/org/opencdmp/model/dmpreference/DmpReferenceData.java +++ b/backend/core/src/main/java/org/opencdmp/model/planreference/PlanReferenceData.java @@ -1,8 +1,8 @@ -package org.opencdmp.model.dmpreference; +package org.opencdmp.model.planreference; import java.util.UUID; -public class DmpReferenceData { +public class PlanReferenceData { private UUID blueprintFieldId; public final static String _blueprintFieldId = "blueprintFieldId"; diff --git a/backend/core/src/main/java/org/opencdmp/model/publicapi/associatedprofile/AssociatedProfilePublicModel.java b/backend/core/src/main/java/org/opencdmp/model/publicapi/associatedprofile/AssociatedProfilePublicModel.java index 2f8135eee..f73184694 100644 --- a/backend/core/src/main/java/org/opencdmp/model/publicapi/associatedprofile/AssociatedProfilePublicModel.java +++ b/backend/core/src/main/java/org/opencdmp/model/publicapi/associatedprofile/AssociatedProfilePublicModel.java @@ -1,8 +1,8 @@ package org.opencdmp.model.publicapi.associatedprofile; import org.opencdmp.model.descriptiontemplate.DescriptionTemplate; -import org.opencdmp.model.dmpblueprint.DmpBlueprint; -import org.opencdmp.model.DmpDescriptionTemplate; +import org.opencdmp.model.planblueprint.PlanBlueprint; +import org.opencdmp.model.PlanDescriptionTemplate; import jakarta.xml.bind.annotation.*; import java.util.*; @@ -51,24 +51,24 @@ public class AssociatedProfilePublicModel { this.data = data; } - public static AssociatedProfilePublicModel fromDmpDescriptionTemplate(DmpDescriptionTemplate dmpDescriptionTemplate, DmpBlueprint dmpBlueprint) { - DescriptionTemplate currentDescriptionTemplate = dmpDescriptionTemplate.getCurrentDescriptionTemplate(); - UUID sectionId = dmpDescriptionTemplate.getSectionId(); + public static AssociatedProfilePublicModel fromPlanDescriptionTemplate(PlanDescriptionTemplate planDescriptionTemplate, PlanBlueprint planBlueprint) { + DescriptionTemplate currentDescriptionTemplate = planDescriptionTemplate.getCurrentDescriptionTemplate(); + UUID sectionId = planDescriptionTemplate.getSectionId(); AssociatedProfilePublicModel model = new AssociatedProfilePublicModel(); - model.setId(dmpDescriptionTemplate.getId()); + model.setId(planDescriptionTemplate.getId()); model.setDescriptionTemplateId(currentDescriptionTemplate.getId()); model.setLabel(currentDescriptionTemplate.getLabel()); HashMap data = new HashMap<>(); - data.put("dmpSectionIndex", getDmpSectionIndexes(dmpBlueprint, sectionId)); + data.put("dmpSectionIndex", getDmpSectionIndexes(planBlueprint, sectionId)); model.setData(data); return model; } - private static List getDmpSectionIndexes(DmpBlueprint dmpBlueprint, UUID sectionId) { + private static List getDmpSectionIndexes(PlanBlueprint planBlueprint, UUID sectionId) { ArrayList indexes = new ArrayList<>(); - dmpBlueprint.getDefinition().getSections().forEach(x -> { + planBlueprint.getDefinition().getSections().forEach(x -> { if (Objects.equals(sectionId, x.getId())) indexes.add(x.getOrdinal()); }); diff --git a/backend/core/src/main/java/org/opencdmp/model/publicapi/grant/GrantPublicOverviewModel.java b/backend/core/src/main/java/org/opencdmp/model/publicapi/grant/GrantPublicOverviewModel.java index 92e142180..0452c61fd 100644 --- a/backend/core/src/main/java/org/opencdmp/model/publicapi/grant/GrantPublicOverviewModel.java +++ b/backend/core/src/main/java/org/opencdmp/model/publicapi/grant/GrantPublicOverviewModel.java @@ -1,7 +1,7 @@ package org.opencdmp.model.publicapi.grant; import org.opencdmp.model.descriptionreference.DescriptionReference; -import org.opencdmp.model.dmpreference.DmpReference; +import org.opencdmp.model.planreference.PlanReference; import org.opencdmp.model.reference.Reference; import org.opencdmp.model.publicapi.funder.FunderPublicOverviewModel; import org.opencdmp.model.reference.Field; @@ -79,20 +79,20 @@ public class GrantPublicOverviewModel { this.funder = funder; } - public static GrantPublicOverviewModel fromDmpReferences(List references, PublicApiProperties.ReferenceTypeMapConfig config) { + public static GrantPublicOverviewModel fromDmpReferences(List references, PublicApiProperties.ReferenceTypeMapConfig config) { FunderPublicOverviewModel funder = null; - for (DmpReference dmpReference : references) { - if (!Objects.equals(dmpReference.getReference().getType().getId(), config.getFunderTypeId())) { + for (PlanReference planReference : references) { + if (!Objects.equals(planReference.getReference().getType().getId(), config.getFunderTypeId())) { funder = new FunderPublicOverviewModel(); - Reference reference = dmpReference.getReference(); + Reference reference = planReference.getReference(); funder.setId(reference.getId()); funder.setLabel(reference.getLabel()); continue; } - if (!Objects.equals(dmpReference.getReference().getType().getId(), config.getGrantTypeId())) + if (!Objects.equals(planReference.getReference().getType().getId(), config.getGrantTypeId())) continue; GrantPublicOverviewModel model = new GrantPublicOverviewModel(); - Reference reference = dmpReference.getReference(); + Reference reference = planReference.getReference(); model.setId(reference.getId()); model.setDescription(reference.getDescription()); model.setAbbreviation(reference.getAbbreviation()); diff --git a/backend/core/src/main/java/org/opencdmp/model/publicapi/organisation/OrganizationPublicModel.java b/backend/core/src/main/java/org/opencdmp/model/publicapi/organisation/OrganizationPublicModel.java index 0cbb1d429..b043794af 100644 --- a/backend/core/src/main/java/org/opencdmp/model/publicapi/organisation/OrganizationPublicModel.java +++ b/backend/core/src/main/java/org/opencdmp/model/publicapi/organisation/OrganizationPublicModel.java @@ -1,6 +1,6 @@ package org.opencdmp.model.publicapi.organisation; -import org.opencdmp.model.dmpreference.DmpReference; +import org.opencdmp.model.planreference.PlanReference; import org.opencdmp.model.reference.Reference; import org.opencdmp.service.publicapi.PublicApiProperties; @@ -48,11 +48,11 @@ public class OrganizationPublicModel { this.key = key; } - public static OrganizationPublicModel fromDmpReference(DmpReference dmpReference, PublicApiProperties.ReferenceTypeMapConfig config) { - if (!Objects.equals(dmpReference.getReference().getType().getId(), config.getOrganizationTypeId())) + public static OrganizationPublicModel fromDmpReference(PlanReference planReference, PublicApiProperties.ReferenceTypeMapConfig config) { + if (!Objects.equals(planReference.getReference().getType().getId(), config.getOrganizationTypeId())) return null; OrganizationPublicModel model = new OrganizationPublicModel(); - Reference reference = dmpReference.getReference(); + Reference reference = planReference.getReference(); model.setId(reference.getId().toString()); model.setReference(reference.getReference()); model.setLabel(reference.getLabel()); diff --git a/backend/core/src/main/java/org/opencdmp/model/publicapi/overviewmodels/DataManagementPlanPublicModel.java b/backend/core/src/main/java/org/opencdmp/model/publicapi/overviewmodels/DataManagementPlanPublicModel.java index 0b5cf5927..29d0f3183 100644 --- a/backend/core/src/main/java/org/opencdmp/model/publicapi/overviewmodels/DataManagementPlanPublicModel.java +++ b/backend/core/src/main/java/org/opencdmp/model/publicapi/overviewmodels/DataManagementPlanPublicModel.java @@ -1,6 +1,6 @@ package org.opencdmp.model.publicapi.overviewmodels; -import org.opencdmp.data.DmpEntity; +import org.opencdmp.data.PlanEntity; import org.opencdmp.model.publicapi.associatedprofile.AssociatedProfilePublicModel; import org.opencdmp.model.publicapi.doi.DoiPublicModel; import org.opencdmp.model.publicapi.grant.GrantPublicOverviewModel; @@ -151,7 +151,7 @@ public class DataManagementPlanPublicModel { this.dois = dois; } - public DmpEntity toDataModel() { + public PlanEntity toDataModel() { return null; } diff --git a/backend/core/src/main/java/org/opencdmp/model/publicapi/researcher/ResearcherPublicModel.java b/backend/core/src/main/java/org/opencdmp/model/publicapi/researcher/ResearcherPublicModel.java index d1507f326..0036dfce2 100644 --- a/backend/core/src/main/java/org/opencdmp/model/publicapi/researcher/ResearcherPublicModel.java +++ b/backend/core/src/main/java/org/opencdmp/model/publicapi/researcher/ResearcherPublicModel.java @@ -1,7 +1,7 @@ package org.opencdmp.model.publicapi.researcher; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import org.opencdmp.model.dmpreference.DmpReference; +import org.opencdmp.model.planreference.PlanReference; import org.opencdmp.model.reference.Reference; import org.opencdmp.service.publicapi.PublicApiProperties; import org.slf4j.Logger; @@ -53,16 +53,16 @@ public class ResearcherPublicModel { this.key = key; } - public static ResearcherPublicModel fromDmpReference(DmpReference dmpReference, PublicApiProperties.ReferenceTypeMapConfig config) { - if (!Objects.equals(dmpReference.getReference().getType().getId(), config.getRegistryTypeId())) + public static ResearcherPublicModel fromDmpReference(PlanReference planReference, PublicApiProperties.ReferenceTypeMapConfig config) { + if (!Objects.equals(planReference.getReference().getType().getId(), config.getRegistryTypeId())) return null; ResearcherPublicModel model = new ResearcherPublicModel(); - Reference reference = dmpReference.getReference(); + Reference reference = planReference.getReference(); model.setId(reference.getId().toString()); model.setReference(reference.getReference()); model.setLabel(reference.getLabel()); model.setName(reference.getLabel()); - String[] refParts = dmpReference.getReference().getReference().split(":"); + String[] refParts = planReference.getReference().getReference().split(":"); String source = refParts[0]; if (source.equals("dmp")) model.setKey("Internal"); diff --git a/backend/core/src/main/java/org/opencdmp/model/publicapi/user/UserInfoPublicModel.java b/backend/core/src/main/java/org/opencdmp/model/publicapi/user/UserInfoPublicModel.java index 66cfea071..fa0ef2965 100644 --- a/backend/core/src/main/java/org/opencdmp/model/publicapi/user/UserInfoPublicModel.java +++ b/backend/core/src/main/java/org/opencdmp/model/publicapi/user/UserInfoPublicModel.java @@ -1,6 +1,6 @@ package org.opencdmp.model.publicapi.user; -import org.opencdmp.model.DmpUser; +import org.opencdmp.model.PlanUser; import org.opencdmp.model.user.User; import java.util.UUID; @@ -31,11 +31,11 @@ public class UserInfoPublicModel { this.role = role; } - public static UserInfoPublicModel fromDmpUser(DmpUser dmpUser) { + public static UserInfoPublicModel fromDmpUser(PlanUser planUser) { UserInfoPublicModel model = new UserInfoPublicModel(); - model.setId(dmpUser.getUser().getId()); - model.setName(dmpUser.getUser().getName()); - model.setRole(dmpUser.getRole().getValue()); + model.setId(planUser.getUser().getId()); + model.setName(planUser.getUser().getName()); + model.setRole(planUser.getRole().getValue()); return model; } diff --git a/backend/core/src/main/java/org/opencdmp/model/reference/Reference.java b/backend/core/src/main/java/org/opencdmp/model/reference/Reference.java index 13e325f2c..f63ccb76b 100644 --- a/backend/core/src/main/java/org/opencdmp/model/reference/Reference.java +++ b/backend/core/src/main/java/org/opencdmp/model/reference/Reference.java @@ -2,8 +2,8 @@ package org.opencdmp.model.reference; import org.opencdmp.commons.enums.IsActive; import org.opencdmp.commons.enums.ReferenceSourceType; +import org.opencdmp.model.planreference.PlanReference; import org.opencdmp.model.user.User; -import org.opencdmp.model.dmpreference.DmpReference; import org.opencdmp.model.referencetype.ReferenceType; import java.time.Instant; @@ -51,8 +51,8 @@ public class Reference { private User createdBy; public static final String _createdBy = "createdBy"; - private List dmpReferences; - public static final String _dmpReferences = "dmpReferences"; + private List planReferences; + public static final String _planReferences = "planReferences"; private String hash; public final static String _hash = "hash"; @@ -156,12 +156,12 @@ public class Reference { this.updatedAt = updatedAt; } - public List getDmpReferences() { - return dmpReferences; + public List getPlanReferences() { + return planReferences; } - public void setDmpReferences(List dmpReferences) { - this.dmpReferences = dmpReferences; + public void setPlanReferences(List planReferences) { + this.planReferences = planReferences; } public User getCreatedBy() { diff --git a/backend/core/src/main/java/org/opencdmp/query/DescriptionQuery.java b/backend/core/src/main/java/org/opencdmp/query/DescriptionQuery.java index 2284e8da2..bff0de648 100644 --- a/backend/core/src/main/java/org/opencdmp/query/DescriptionQuery.java +++ b/backend/core/src/main/java/org/opencdmp/query/DescriptionQuery.java @@ -34,9 +34,9 @@ public class DescriptionQuery extends QueryBase { private Collection createdByIds; - private DmpDescriptionTemplateQuery dmpDescriptionTemplateQuery; + private PlanDescriptionTemplateQuery planDescriptionTemplateQuery; - private DmpQuery dmpQuery; + private PlanQuery planQuery; private DescriptionTemplateQuery descriptionTemplateQuery; @@ -58,7 +58,7 @@ public class DescriptionQuery extends QueryBase { private Collection statuses; - private Collection dmpIds; + private Collection planIds; private EnumSet authorize = EnumSet.of(AuthorizationFlags.None); @@ -68,7 +68,7 @@ public class DescriptionQuery extends QueryBase { private final QueryUtilsService queryUtilsService; - private Collection dmpDescriptionTemplateIds; + private Collection planDescriptionTemplateIds; private final TenantEntityManager tenantEntityManager; public DescriptionQuery(UserScope userScope, AuthorizationService authService, QueryUtilsService queryUtilsService, TenantEntityManager tenantEntityManager) { @@ -113,8 +113,8 @@ public class DescriptionQuery extends QueryBase { return this; } - public DescriptionQuery dmpDescriptionTemplateSubQuery(DmpDescriptionTemplateQuery subQuery) { - this.dmpDescriptionTemplateQuery = subQuery; + public DescriptionQuery dmpDescriptionTemplateSubQuery(PlanDescriptionTemplateQuery subQuery) { + this.planDescriptionTemplateQuery = subQuery; return this; } @@ -128,18 +128,18 @@ public class DescriptionQuery extends QueryBase { return this; } - public DescriptionQuery dmpDescriptionTemplateIds(UUID value) { - this.dmpDescriptionTemplateIds = List.of(value); + public DescriptionQuery planDescriptionTemplateIds(UUID value) { + this.planDescriptionTemplateIds = List.of(value); return this; } - public DescriptionQuery dmpDescriptionTemplateIds(UUID... value) { - this.dmpDescriptionTemplateIds = Arrays.asList(value); + public DescriptionQuery planDescriptionTemplateIds(UUID... value) { + this.planDescriptionTemplateIds = Arrays.asList(value); return this; } - public DescriptionQuery dmpDescriptionTemplateIds(Collection values) { - this.dmpDescriptionTemplateIds = values; + public DescriptionQuery planDescriptionTemplateIds(Collection values) { + this.planDescriptionTemplateIds = values; return this; } @@ -153,8 +153,8 @@ public class DescriptionQuery extends QueryBase { return this; } - public DescriptionQuery dmpSubQuery(DmpQuery subQuery) { - this.dmpQuery = subQuery; + public DescriptionQuery dmpSubQuery(PlanQuery subQuery) { + this.planQuery = subQuery; return this; } @@ -218,13 +218,13 @@ public class DescriptionQuery extends QueryBase { return this; } - public DescriptionQuery dmpIds(Collection values) { - this.dmpIds = values; + public DescriptionQuery planIds(Collection values) { + this.planIds = values; return this; } - public DescriptionQuery dmpIds(UUID value) { - this.dmpIds = List.of(value); + public DescriptionQuery planIds(UUID value) { + this.planIds = List.of(value); return this; } @@ -253,8 +253,8 @@ public class DescriptionQuery extends QueryBase { return this.isEmpty(this.ids) || this.isEmpty(this.isActives) || this.isEmpty(this.createdByIds) || - this.isEmpty(this.excludedIds) || this.isFalseQuery(this.dmpQuery) || - this.isEmpty(this.statuses) || this.isFalseQuery(this.dmpDescriptionTemplateQuery); + this.isEmpty(this.excludedIds) || this.isFalseQuery(this.planQuery) || + this.isEmpty(this.statuses) || this.isFalseQuery(this.planDescriptionTemplateQuery); } @Override @@ -326,9 +326,9 @@ public class DescriptionQuery extends QueryBase { notInClause.value(item); predicates.add(notInClause.not()); } - if (this.dmpIds != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionEntity._dmpId)); - for (UUID item : this.dmpIds) + if (this.planIds != null) { + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionEntity._planId)); + for (UUID item : this.planIds) inClause.value(item); predicates.add(inClause); } @@ -344,13 +344,13 @@ public class DescriptionQuery extends QueryBase { inClause.value(item); predicates.add(inClause); } - if (this.dmpDescriptionTemplateQuery != null) { - QueryContext subQuery = this.applySubQuery(this.dmpDescriptionTemplateQuery, queryContext, UUID.class, dmpDescriptionTemplateEntityRoot -> dmpDescriptionTemplateEntityRoot.get(DmpDescriptionTemplateEntity._id)); - predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionEntity._dmpDescriptionTemplateId)).value(subQuery.Query)); + if (this.planDescriptionTemplateQuery != null) { + QueryContext subQuery = this.applySubQuery(this.planDescriptionTemplateQuery, queryContext, UUID.class, dmpDescriptionTemplateEntityRoot -> dmpDescriptionTemplateEntityRoot.get(PlanDescriptionTemplateEntity._id)); + predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionEntity._planDescriptionTemplateId)).value(subQuery.Query)); } - if (this.dmpQuery != null) { - QueryContext subQuery = this.applySubQuery(this.dmpQuery, queryContext, UUID.class, dmpEntityRoot -> dmpEntityRoot.get(DmpEntity._id)); - predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionEntity._dmpId)).value(subQuery.Query)); + if (this.planQuery != null) { + QueryContext subQuery = this.applySubQuery(this.planQuery, queryContext, UUID.class, dmpEntityRoot -> dmpEntityRoot.get(PlanEntity._id)); + predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionEntity._planId)).value(subQuery.Query)); } if (this.descriptionTemplateQuery != null) { QueryContext subQuery = this.applySubQuery(this.descriptionTemplateQuery, queryContext, UUID.class, descriptionTemplateEntityRoot -> descriptionTemplateEntityRoot.get(DescriptionTemplateEntity._id)); @@ -364,9 +364,9 @@ public class DescriptionQuery extends QueryBase { QueryContext subQuery = this.applySubQuery(this.descriptionTagQuery, queryContext, UUID.class, descriptionTagEntityRoot -> descriptionTagEntityRoot.get(DescriptionTagEntity._descriptionId)); predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionEntity._id)).value(subQuery.Query)); } - if (this.dmpDescriptionTemplateIds != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionEntity._dmpDescriptionTemplateId)); - for (UUID item : this.dmpDescriptionTemplateIds) + if (this.planDescriptionTemplateIds != null) { + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionEntity._planDescriptionTemplateId)); + for (UUID item : this.planDescriptionTemplateIds) inClause.value(item); predicates.add(inClause); } @@ -405,18 +405,18 @@ public class DescriptionQuery extends QueryBase { return DescriptionEntity._updatedAt; else if (item.match(Description._finalizedAt) || item.match(PublicDescription._finalizedAt)) return DescriptionEntity._finalizedAt; - else if (item.prefix(Description._dmpDescriptionTemplate) || item.prefix(PublicDescription._dmpDescriptionTemplate)) - return DescriptionEntity._dmpDescriptionTemplateId; - else if (item.match(Description._dmpDescriptionTemplate) || item.match(PublicDescription._dmpDescriptionTemplate)) - return DescriptionEntity._dmpDescriptionTemplateId; + else if (item.prefix(Description._planDescriptionTemplate) || item.prefix(PublicDescription._planDescriptionTemplate)) + return DescriptionEntity._planDescriptionTemplateId; + else if (item.match(Description._planDescriptionTemplate) || item.match(PublicDescription._planDescriptionTemplate)) + return DescriptionEntity._planDescriptionTemplateId; else if (item.prefix(Description._descriptionTemplate) || item.prefix(PublicDescription._descriptionTemplate)) return DescriptionEntity._descriptionTemplateId; else if (item.match(Description._descriptionTemplate) || item.match(PublicDescription._descriptionTemplate)) return DescriptionEntity._descriptionTemplateId; - else if (item.prefix(Description._dmp)) - return DescriptionEntity._dmpId; - else if (item.match(Description._dmp)) - return DescriptionEntity._dmpId; + else if (item.prefix(Description._plan)) + return DescriptionEntity._planId; + else if (item.match(Description._plan)) + return DescriptionEntity._planId; else if (item.match(Description._belongsToCurrentTenant)) return DescriptionEntity._tenantId; else if (item.match(DescriptionEntity._tenantId)) @@ -438,9 +438,9 @@ public class DescriptionQuery extends QueryBase { item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, DescriptionEntity._updatedAt, Instant.class)); item.setIsActive(QueryBase.convertSafe(tuple, columns, DescriptionEntity._isActive, IsActive.class)); item.setFinalizedAt(QueryBase.convertSafe(tuple, columns, DescriptionEntity._finalizedAt, Instant.class)); - item.setDmpDescriptionTemplateId(QueryBase.convertSafe(tuple, columns, DescriptionEntity._dmpDescriptionTemplateId, UUID.class)); + item.setPlanDescriptionTemplateId(QueryBase.convertSafe(tuple, columns, DescriptionEntity._planDescriptionTemplateId, UUID.class)); item.setDescriptionTemplateId(QueryBase.convertSafe(tuple, columns, DescriptionEntity._descriptionTemplateId, UUID.class)); - item.setDmpId(QueryBase.convertSafe(tuple, columns, DescriptionEntity._dmpId, UUID.class)); + item.setPlanId(QueryBase.convertSafe(tuple, columns, DescriptionEntity._planId, UUID.class)); return item; } diff --git a/backend/core/src/main/java/org/opencdmp/query/DescriptionTemplateQuery.java b/backend/core/src/main/java/org/opencdmp/query/DescriptionTemplateQuery.java index b732aa76e..4e16b068b 100644 --- a/backend/core/src/main/java/org/opencdmp/query/DescriptionTemplateQuery.java +++ b/backend/core/src/main/java/org/opencdmp/query/DescriptionTemplateQuery.java @@ -53,7 +53,7 @@ public class DescriptionTemplateQuery extends QueryBase authorize = EnumSet.of(AuthorizationFlags.None); @@ -207,8 +207,8 @@ public class DescriptionTemplateQuery extends QueryBase predicates = new ArrayList<>(); if (userId != null || usePublic) { Subquery dmpDescriptionTemplateSubquery = this.queryUtilsService.buildSubQuery(new BuildSubQueryInput<>( - new BuildSubQueryInput.Builder<>(DmpDescriptionTemplateEntity.class, UUID.class, queryContext) - .keyPathFunc((subQueryRoot) -> subQueryRoot.get(DmpDescriptionTemplateEntity._descriptionTemplateGroupId)) + new BuildSubQueryInput.Builder<>(PlanDescriptionTemplateEntity.class, UUID.class, queryContext) + .keyPathFunc((subQueryRoot) -> subQueryRoot.get(PlanDescriptionTemplateEntity._descriptionTemplateGroupId)) .filterFunc((subQueryRoot, cb) -> - cb.in(subQueryRoot.get(DmpDescriptionTemplateEntity._dmpId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic)) + cb.in(subQueryRoot.get(PlanDescriptionTemplateEntity._planId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic)) ) )); predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionTemplateEntity._groupId)).value(dmpDescriptionTemplateSubquery)); @@ -352,7 +352,7 @@ public class DescriptionTemplateQuery extends QueryBase subQuery = this.applySubQuery(this.dmpDescriptionTemplateQuery, queryContext, UUID.class, dmpDescriptionTemplateEntityRoot -> dmpDescriptionTemplateEntityRoot.get(DmpDescriptionTemplateEntity._descriptionTemplateGroupId)); + if (this.planDescriptionTemplateQuery != null) { + QueryContext subQuery = this.applySubQuery(this.planDescriptionTemplateQuery, queryContext, UUID.class, planDescriptionTemplateEntityRoot -> planDescriptionTemplateEntityRoot.get(PlanDescriptionTemplateEntity._descriptionTemplateGroupId)); predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionTemplateEntity._groupId)).value(subQuery.Query)); } diff --git a/backend/core/src/main/java/org/opencdmp/query/EntityDoiQuery.java b/backend/core/src/main/java/org/opencdmp/query/EntityDoiQuery.java index bec4b92bc..1da0d8c25 100644 --- a/backend/core/src/main/java/org/opencdmp/query/EntityDoiQuery.java +++ b/backend/core/src/main/java/org/opencdmp/query/EntityDoiQuery.java @@ -13,7 +13,7 @@ import org.opencdmp.authorization.Permission; import org.opencdmp.commons.enums.EntityType; import org.opencdmp.commons.enums.IsActive; import org.opencdmp.commons.scope.user.UserScope; -import org.opencdmp.data.DmpEntity; +import org.opencdmp.data.PlanEntity; import org.opencdmp.data.EntityDoiEntity; import org.opencdmp.data.TenantEntityManager; import org.opencdmp.model.EntityDoi; @@ -274,7 +274,7 @@ public class EntityDoiQuery extends QueryBase { predicates.add(inClause); } if (this.after != null) { - Predicate afterClause = queryContext.CriteriaBuilder.greaterThanOrEqualTo(queryContext.Root.get(DmpEntity._createdAt), this.after); + Predicate afterClause = queryContext.CriteriaBuilder.greaterThanOrEqualTo(queryContext.Root.get(PlanEntity._createdAt), this.after); predicates.add(afterClause); } diff --git a/backend/core/src/main/java/org/opencdmp/query/DmpBlueprintQuery.java b/backend/core/src/main/java/org/opencdmp/query/PlanBlueprintQuery.java similarity index 52% rename from backend/core/src/main/java/org/opencdmp/query/DmpBlueprintQuery.java rename to backend/core/src/main/java/org/opencdmp/query/PlanBlueprintQuery.java index 044b8ca68..c64975b8c 100644 --- a/backend/core/src/main/java/org/opencdmp/query/DmpBlueprintQuery.java +++ b/backend/core/src/main/java/org/opencdmp/query/PlanBlueprintQuery.java @@ -9,12 +9,12 @@ import jakarta.persistence.Tuple; import jakarta.persistence.criteria.CriteriaBuilder; import jakarta.persistence.criteria.Predicate; import org.opencdmp.authorization.AuthorizationFlags; -import org.opencdmp.commons.enums.DmpBlueprintStatus; -import org.opencdmp.commons.enums.DmpBlueprintVersionStatus; +import org.opencdmp.commons.enums.PlanBlueprintStatus; +import org.opencdmp.commons.enums.PlanBlueprintVersionStatus; import org.opencdmp.commons.enums.IsActive; -import org.opencdmp.data.DmpBlueprintEntity; +import org.opencdmp.data.PlanBlueprintEntity; import org.opencdmp.data.TenantEntityManager; -import org.opencdmp.model.dmpblueprint.DmpBlueprint; +import org.opencdmp.model.planblueprint.PlanBlueprint; import org.opencdmp.query.utils.QueryUtilsService; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; @@ -25,7 +25,7 @@ import java.util.*; @Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpBlueprintQuery extends QueryBase { +public class PlanBlueprintQuery extends QueryBase { private String like; @@ -35,137 +35,137 @@ public class DmpBlueprintQuery extends QueryBase { private Collection isActives; - private Collection statuses; + private Collection statuses; private Collection groupIds; private Collection versions; - private Collection versionStatuses; + private Collection versionStatuses; private EnumSet authorize = EnumSet.of(AuthorizationFlags.None); - public DmpBlueprintQuery like(String value) { + public PlanBlueprintQuery like(String value) { this.like = value; return this; } - public DmpBlueprintQuery ids(UUID value) { + public PlanBlueprintQuery ids(UUID value) { this.ids = List.of(value); return this; } - public DmpBlueprintQuery ids(UUID... value) { + public PlanBlueprintQuery ids(UUID... value) { this.ids = Arrays.asList(value); return this; } - public DmpBlueprintQuery ids(Collection values) { + public PlanBlueprintQuery ids(Collection values) { this.ids = values; return this; } - public DmpBlueprintQuery excludedIds(Collection values) { + public PlanBlueprintQuery excludedIds(Collection values) { this.excludedIds = values; return this; } - public DmpBlueprintQuery excludedIds(UUID value) { + public PlanBlueprintQuery excludedIds(UUID value) { this.excludedIds = List.of(value); return this; } - public DmpBlueprintQuery excludedIds(UUID... value) { + public PlanBlueprintQuery excludedIds(UUID... value) { this.excludedIds = Arrays.asList(value); return this; } - public DmpBlueprintQuery isActive(IsActive value) { + public PlanBlueprintQuery isActive(IsActive value) { this.isActives = List.of(value); return this; } - public DmpBlueprintQuery isActive(IsActive... value) { + public PlanBlueprintQuery isActive(IsActive... value) { this.isActives = Arrays.asList(value); return this; } - public DmpBlueprintQuery isActive(Collection values) { + public PlanBlueprintQuery isActive(Collection values) { this.isActives = values; return this; } - public DmpBlueprintQuery statuses(DmpBlueprintStatus value) { + public PlanBlueprintQuery statuses(PlanBlueprintStatus value) { this.statuses = List.of(value); return this; } - public DmpBlueprintQuery statuses(DmpBlueprintStatus... value) { + public PlanBlueprintQuery statuses(PlanBlueprintStatus... value) { this.statuses = Arrays.asList(value); return this; } - public DmpBlueprintQuery statuses(Collection values) { + public PlanBlueprintQuery statuses(Collection values) { this.statuses = values; return this; } - public DmpBlueprintQuery groupIds(UUID value) { + public PlanBlueprintQuery groupIds(UUID value) { this.groupIds = List.of(value); return this; } - public DmpBlueprintQuery groupIds(UUID... value) { + public PlanBlueprintQuery groupIds(UUID... value) { this.groupIds = Arrays.asList(value); return this; } - public DmpBlueprintQuery groupIds(Collection values) { + public PlanBlueprintQuery groupIds(Collection values) { this.groupIds = values; return this; } - public DmpBlueprintQuery versions(Short value) { + public PlanBlueprintQuery versions(Short value) { this.versions = List.of(value); return this; } - public DmpBlueprintQuery versions(Short... value) { + public PlanBlueprintQuery versions(Short... value) { this.versions = Arrays.asList(value); return this; } - public DmpBlueprintQuery versions(Collection values) { + public PlanBlueprintQuery versions(Collection values) { this.versions = values; return this; } - public DmpBlueprintQuery versionStatuses(DmpBlueprintVersionStatus value) { + public PlanBlueprintQuery versionStatuses(PlanBlueprintVersionStatus value) { this.versionStatuses = List.of(value); return this; } - public DmpBlueprintQuery versionStatuses(DmpBlueprintVersionStatus... value) { + public PlanBlueprintQuery versionStatuses(PlanBlueprintVersionStatus... value) { this.versionStatuses = Arrays.asList(value); return this; } - public DmpBlueprintQuery versionStatuses(Collection values) { + public PlanBlueprintQuery versionStatuses(Collection values) { this.versionStatuses = values; return this; } - public DmpBlueprintQuery authorize(EnumSet values) { + public PlanBlueprintQuery authorize(EnumSet values) { this.authorize = values; return this; } - public DmpBlueprintQuery enableTracking() { + public PlanBlueprintQuery enableTracking() { this.noTracking = false; return this; } - public DmpBlueprintQuery disableTracking() { + public PlanBlueprintQuery disableTracking() { this.noTracking = true; return this; } @@ -177,7 +177,7 @@ public class DmpBlueprintQuery extends QueryBase { private final QueryUtilsService queryUtilsService; private final TenantEntityManager tenantEntityManager; - public DmpBlueprintQuery( + public PlanBlueprintQuery( AuthorizationService authService, QueryUtilsService queryUtilsService, TenantEntityManager tenantEntityManager ) { this.queryUtilsService = queryUtilsService; @@ -185,8 +185,8 @@ public class DmpBlueprintQuery extends QueryBase { } @Override - protected Class entityClass() { - return DmpBlueprintEntity.class; + protected Class entityClass() { + return PlanBlueprintEntity.class; } @Override @@ -199,54 +199,54 @@ public class DmpBlueprintQuery extends QueryBase { List predicates = new ArrayList<>(); if (this.ids != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpBlueprintEntity._id)); + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanBlueprintEntity._id)); for (UUID item : this.ids) inClause.value(item); predicates.add(inClause); } if (this.excludedIds != null) { - CriteriaBuilder.In notInClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpBlueprintEntity._id)); + CriteriaBuilder.In notInClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanBlueprintEntity._id)); for (UUID item : this.excludedIds) notInClause.value(item); predicates.add(notInClause.not()); } if (this.like != null && !this.like.isBlank()) { - predicates.add(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DmpBlueprintEntity._label), this.like)); + predicates.add(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(PlanBlueprintEntity._label), this.like)); } if (this.isActives != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpBlueprintEntity._isActive)); + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanBlueprintEntity._isActive)); for (IsActive item : this.isActives) inClause.value(item); predicates.add(inClause); } if (this.statuses != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpBlueprintEntity._status)); - for (DmpBlueprintStatus item : this.statuses) + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanBlueprintEntity._status)); + for (PlanBlueprintStatus item : this.statuses) inClause.value(item); predicates.add(inClause); } if (this.groupIds != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpBlueprintEntity._groupId)); + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanBlueprintEntity._groupId)); for (UUID item : this.groupIds) inClause.value(item); predicates.add(inClause); } if (this.versions != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpBlueprintEntity._version)); + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanBlueprintEntity._version)); for (Short item : this.versions) inClause.value(item); predicates.add(inClause); } if (this.versionStatuses != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpBlueprintEntity._versionStatus)); - for (DmpBlueprintVersionStatus item : this.versionStatuses) + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanBlueprintEntity._versionStatus)); + for (PlanBlueprintVersionStatus item : this.versionStatuses) inClause.value(item); predicates.add(inClause); } @@ -260,50 +260,50 @@ public class DmpBlueprintQuery extends QueryBase { } @Override - protected DmpBlueprintEntity convert(Tuple tuple, Set columns) { - DmpBlueprintEntity item = new DmpBlueprintEntity(); - item.setId(QueryBase.convertSafe(tuple, columns, DmpBlueprintEntity._id, UUID.class)); - item.setTenantId(QueryBase.convertSafe(tuple, columns, DmpBlueprintEntity._tenantId, UUID.class)); - item.setLabel(QueryBase.convertSafe(tuple, columns, DmpBlueprintEntity._label, String.class)); - item.setDefinition(QueryBase.convertSafe(tuple, columns, DmpBlueprintEntity._definition, String.class)); - item.setStatus(QueryBase.convertSafe(tuple, columns, DmpBlueprintEntity._status, DmpBlueprintStatus.class)); - item.setGroupId(QueryBase.convertSafe(tuple, columns, DmpBlueprintEntity._groupId, UUID.class)); - item.setVersion(QueryBase.convertSafe(tuple, columns, DmpBlueprintEntity._version, Short.class)); - item.setVersionStatus(QueryBase.convertSafe(tuple, columns, DmpBlueprintEntity._versionStatus, DmpBlueprintVersionStatus.class)); - item.setCreatedAt(QueryBase.convertSafe(tuple, columns, DmpBlueprintEntity._createdAt, Instant.class)); - item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, DmpBlueprintEntity._updatedAt, Instant.class)); - item.setIsActive(QueryBase.convertSafe(tuple, columns, DmpBlueprintEntity._isActive, IsActive.class)); + protected PlanBlueprintEntity convert(Tuple tuple, Set columns) { + PlanBlueprintEntity item = new PlanBlueprintEntity(); + item.setId(QueryBase.convertSafe(tuple, columns, PlanBlueprintEntity._id, UUID.class)); + item.setTenantId(QueryBase.convertSafe(tuple, columns, PlanBlueprintEntity._tenantId, UUID.class)); + item.setLabel(QueryBase.convertSafe(tuple, columns, PlanBlueprintEntity._label, String.class)); + item.setDefinition(QueryBase.convertSafe(tuple, columns, PlanBlueprintEntity._definition, String.class)); + item.setStatus(QueryBase.convertSafe(tuple, columns, PlanBlueprintEntity._status, PlanBlueprintStatus.class)); + item.setGroupId(QueryBase.convertSafe(tuple, columns, PlanBlueprintEntity._groupId, UUID.class)); + item.setVersion(QueryBase.convertSafe(tuple, columns, PlanBlueprintEntity._version, Short.class)); + item.setVersionStatus(QueryBase.convertSafe(tuple, columns, PlanBlueprintEntity._versionStatus, PlanBlueprintVersionStatus.class)); + item.setCreatedAt(QueryBase.convertSafe(tuple, columns, PlanBlueprintEntity._createdAt, Instant.class)); + item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, PlanBlueprintEntity._updatedAt, Instant.class)); + item.setIsActive(QueryBase.convertSafe(tuple, columns, PlanBlueprintEntity._isActive, IsActive.class)); return item; } @Override protected String fieldNameOf(FieldResolver item) { - if (item.match(DmpBlueprint._id)) - return DmpBlueprintEntity._id; - else if (item.match(DmpBlueprint._label)) - return DmpBlueprintEntity._label; - else if (item.match(DmpBlueprint._definition)) - return DmpBlueprintEntity._definition; - else if (item.prefix(DmpBlueprint._definition)) - return DmpBlueprintEntity._definition; - else if (item.match(DmpBlueprint._status)) - return DmpBlueprintEntity._status; - else if (item.match(DmpBlueprint._groupId)) - return DmpBlueprintEntity._groupId; - else if (item.match(DmpBlueprint._version)) - return DmpBlueprintEntity._version; - else if (item.match(DmpBlueprint._versionStatus)) - return DmpBlueprintEntity._versionStatus; - else if (item.match(DmpBlueprint._createdAt)) - return DmpBlueprintEntity._createdAt; - else if (item.match(DmpBlueprint._updatedAt)) - return DmpBlueprintEntity._updatedAt; - else if (item.match(DmpBlueprint._isActive)) - return DmpBlueprintEntity._isActive; - else if (item.match(DmpBlueprint._hash)) - return DmpBlueprintEntity._updatedAt; - else if (item.match(DmpBlueprint._belongsToCurrentTenant)) - return DmpBlueprintEntity._tenantId; + if (item.match(PlanBlueprint._id)) + return PlanBlueprintEntity._id; + else if (item.match(PlanBlueprint._label)) + return PlanBlueprintEntity._label; + else if (item.match(PlanBlueprint._definition)) + return PlanBlueprintEntity._definition; + else if (item.prefix(PlanBlueprint._definition)) + return PlanBlueprintEntity._definition; + else if (item.match(PlanBlueprint._status)) + return PlanBlueprintEntity._status; + else if (item.match(PlanBlueprint._groupId)) + return PlanBlueprintEntity._groupId; + else if (item.match(PlanBlueprint._version)) + return PlanBlueprintEntity._version; + else if (item.match(PlanBlueprint._versionStatus)) + return PlanBlueprintEntity._versionStatus; + else if (item.match(PlanBlueprint._createdAt)) + return PlanBlueprintEntity._createdAt; + else if (item.match(PlanBlueprint._updatedAt)) + return PlanBlueprintEntity._updatedAt; + else if (item.match(PlanBlueprint._isActive)) + return PlanBlueprintEntity._isActive; + else if (item.match(PlanBlueprint._hash)) + return PlanBlueprintEntity._updatedAt; + else if (item.match(PlanBlueprint._belongsToCurrentTenant)) + return PlanBlueprintEntity._tenantId; else return null; } diff --git a/backend/core/src/main/java/org/opencdmp/query/DmpDescriptionTemplateQuery.java b/backend/core/src/main/java/org/opencdmp/query/PlanDescriptionTemplateQuery.java similarity index 54% rename from backend/core/src/main/java/org/opencdmp/query/DmpDescriptionTemplateQuery.java rename to backend/core/src/main/java/org/opencdmp/query/PlanDescriptionTemplateQuery.java index c2be75564..45318bf5f 100644 --- a/backend/core/src/main/java/org/opencdmp/query/DmpDescriptionTemplateQuery.java +++ b/backend/core/src/main/java/org/opencdmp/query/PlanDescriptionTemplateQuery.java @@ -13,10 +13,10 @@ import org.opencdmp.authorization.Permission; import org.opencdmp.commons.enums.IsActive; import org.opencdmp.commons.scope.user.UserScope; import org.opencdmp.data.DescriptionTemplateEntity; -import org.opencdmp.data.DmpDescriptionTemplateEntity; +import org.opencdmp.data.PlanDescriptionTemplateEntity; import org.opencdmp.data.TenantEntityManager; -import org.opencdmp.model.DmpDescriptionTemplate; -import org.opencdmp.model.PublicDmpDescriptionTemplate; +import org.opencdmp.model.PlanDescriptionTemplate; +import org.opencdmp.model.PublicPlanDescriptionTemplate; import org.opencdmp.query.utils.QueryUtilsService; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; @@ -27,11 +27,11 @@ import java.util.*; @Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpDescriptionTemplateQuery extends QueryBase { +public class PlanDescriptionTemplateQuery extends QueryBase { private Collection ids; - private Collection dmpIds; + private Collection planIds; private Collection descriptionTemplateGroupIds; @@ -47,117 +47,117 @@ public class DmpDescriptionTemplateQuery extends QueryBase authorize = EnumSet.of(AuthorizationFlags.None); - public DmpDescriptionTemplateQuery ids(UUID value) { + public PlanDescriptionTemplateQuery ids(UUID value) { this.ids = List.of(value); return this; } - public DmpDescriptionTemplateQuery ids(UUID... value) { + public PlanDescriptionTemplateQuery ids(UUID... value) { this.ids = Arrays.asList(value); return this; } - public DmpDescriptionTemplateQuery ids(Collection values) { + public PlanDescriptionTemplateQuery ids(Collection values) { this.ids = values; return this; } - public DmpDescriptionTemplateQuery excludedIds(Collection values) { + public PlanDescriptionTemplateQuery excludedIds(Collection values) { this.excludedIds = values; return this; } - public DmpDescriptionTemplateQuery excludedIds(UUID value) { + public PlanDescriptionTemplateQuery excludedIds(UUID value) { this.excludedIds = List.of(value); return this; } - public DmpDescriptionTemplateQuery excludedIds(UUID... value) { + public PlanDescriptionTemplateQuery excludedIds(UUID... value) { this.excludedIds = Arrays.asList(value); return this; } - public DmpDescriptionTemplateQuery isActive(IsActive value) { + public PlanDescriptionTemplateQuery isActive(IsActive value) { this.isActives = List.of(value); return this; } - public DmpDescriptionTemplateQuery isActive(IsActive... value) { + public PlanDescriptionTemplateQuery isActive(IsActive... value) { this.isActives = Arrays.asList(value); return this; } - public DmpDescriptionTemplateQuery isActive(Collection values) { + public PlanDescriptionTemplateQuery isActive(Collection values) { this.isActives = values; return this; } - public DmpDescriptionTemplateQuery sectionIds(UUID value) { + public PlanDescriptionTemplateQuery sectionIds(UUID value) { this.sectionIds = List.of(value); return this; } - public DmpDescriptionTemplateQuery sectionIds(UUID... value) { + public PlanDescriptionTemplateQuery sectionIds(UUID... value) { this.sectionIds = Arrays.asList(value); return this; } - public DmpDescriptionTemplateQuery sectionIds(Collection values) { + public PlanDescriptionTemplateQuery sectionIds(Collection values) { this.sectionIds = values; return this; } - public DmpDescriptionTemplateQuery descriptionTemplateGroupIds(UUID value) { + public PlanDescriptionTemplateQuery descriptionTemplateGroupIds(UUID value) { this.descriptionTemplateGroupIds = List.of(value); return this; } - public DmpDescriptionTemplateQuery descriptionTemplateGroupIds(UUID... value) { + public PlanDescriptionTemplateQuery descriptionTemplateGroupIds(UUID... value) { this.descriptionTemplateGroupIds = Arrays.asList(value); return this; } - public DmpDescriptionTemplateQuery descriptionTemplateGroupIds(Collection values) { + public PlanDescriptionTemplateQuery descriptionTemplateGroupIds(Collection values) { this.descriptionTemplateGroupIds = values; return this; } - public DmpDescriptionTemplateQuery dmpIds(UUID value) { - this.dmpIds = List.of(value); + public PlanDescriptionTemplateQuery planIds(UUID value) { + this.planIds = List.of(value); return this; } - public DmpDescriptionTemplateQuery dmpIds(UUID... value) { - this.dmpIds = Arrays.asList(value); + public PlanDescriptionTemplateQuery planIds(UUID... value) { + this.planIds = Arrays.asList(value); return this; } - public DmpDescriptionTemplateQuery dmpIds(Collection values) { - this.dmpIds = values; + public PlanDescriptionTemplateQuery planIds(Collection values) { + this.planIds = values; return this; } - public DmpDescriptionTemplateQuery after(Instant value) { + public PlanDescriptionTemplateQuery after(Instant value) { this.after = value; return this; } - public DmpDescriptionTemplateQuery descriptionTemplateSubQuery(DescriptionTemplateQuery value) { + public PlanDescriptionTemplateQuery descriptionTemplateSubQuery(DescriptionTemplateQuery value) { this.descriptionTemplateQuery = value; return this; } - public DmpDescriptionTemplateQuery authorize(EnumSet values) { + public PlanDescriptionTemplateQuery authorize(EnumSet values) { this.authorize = values; return this; } - public DmpDescriptionTemplateQuery enableTracking() { + public PlanDescriptionTemplateQuery enableTracking() { this.noTracking = false; return this; } - public DmpDescriptionTemplateQuery disableTracking() { + public PlanDescriptionTemplateQuery disableTracking() { this.noTracking = true; return this; } @@ -174,7 +174,7 @@ public class DmpDescriptionTemplateQuery extends QueryBase entityClass() { - return DmpDescriptionTemplateEntity.class; + protected Class entityClass() { + return PlanDescriptionTemplateEntity.class; } @Override protected Boolean isFalseQuery() { - return this.isEmpty(this.ids) || this.isEmpty(this.excludedIds) || this.isEmpty(this.isActives) || this.isEmpty(this.dmpIds) || this.isEmpty(this.descriptionTemplateGroupIds); + return this.isEmpty(this.ids) || this.isEmpty(this.excludedIds) || this.isEmpty(this.isActives) || this.isEmpty(this.planIds) || this.isEmpty(this.descriptionTemplateGroupIds); } @Override protected Predicate applyAuthZ(QueryContext queryContext) { if (this.authorize.contains(AuthorizationFlags.None)) return null; - if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowseDmpDescriptionTemplate)) + if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowsePlanDescriptionTemplate)) return null; UUID userId = null; boolean usePublic = this.authorize.contains(AuthorizationFlags.Public); @@ -205,7 +205,7 @@ public class DmpDescriptionTemplateQuery extends QueryBase predicates = new ArrayList<>(); if (userId != null || usePublic) { - predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpDescriptionTemplateEntity._dmpId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic))); + predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanDescriptionTemplateEntity._planId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic))); } if (!predicates.isEmpty()) { Predicate[] predicatesArray = predicates.toArray(new Predicate[0]); @@ -219,48 +219,48 @@ public class DmpDescriptionTemplateQuery extends QueryBase Predicate applyFilters(QueryContext queryContext) { List predicates = new ArrayList<>(); if (this.ids != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpDescriptionTemplateEntity._id)); + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanDescriptionTemplateEntity._id)); for (UUID item : this.ids) inClause.value(item); predicates.add(inClause); } if (this.excludedIds != null) { - CriteriaBuilder.In notInClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpDescriptionTemplateEntity._id)); + CriteriaBuilder.In notInClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanDescriptionTemplateEntity._id)); for (UUID item : this.excludedIds) notInClause.value(item); predicates.add(notInClause.not()); } - if (this.dmpIds != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpDescriptionTemplateEntity._dmpId)); - for (UUID item : this.dmpIds) + if (this.planIds != null) { + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanDescriptionTemplateEntity._planId)); + for (UUID item : this.planIds) inClause.value(item); predicates.add(inClause); } if (this.descriptionTemplateGroupIds != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpDescriptionTemplateEntity._descriptionTemplateGroupId)); + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanDescriptionTemplateEntity._descriptionTemplateGroupId)); for (UUID item : this.descriptionTemplateGroupIds) inClause.value(item); predicates.add(inClause); } if (this.sectionIds != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpDescriptionTemplateEntity._sectionId)); + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanDescriptionTemplateEntity._sectionId)); for (UUID item : this.sectionIds) inClause.value(item); predicates.add(inClause); } if (this.isActives != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpDescriptionTemplateEntity._isActive)); + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanDescriptionTemplateEntity._isActive)); for (IsActive item : this.isActives) inClause.value(item); predicates.add(inClause); } if (this.after != null) { - Predicate afterClause = queryContext.CriteriaBuilder.greaterThanOrEqualTo(queryContext.Root.get(DmpDescriptionTemplateEntity._createdAt), this.after); + Predicate afterClause = queryContext.CriteriaBuilder.greaterThanOrEqualTo(queryContext.Root.get(PlanDescriptionTemplateEntity._createdAt), this.after); predicates.add(afterClause); } if (this.descriptionTemplateQuery != null) { QueryContext subQuery = this.applySubQuery(this.descriptionTemplateQuery, queryContext, UUID.class, descriptionTemplateEntityRoot -> descriptionTemplateEntityRoot.get(DescriptionTemplateEntity._groupId)); - predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpDescriptionTemplateEntity._descriptionTemplateGroupId)).value(subQuery.Query)); + predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanDescriptionTemplateEntity._descriptionTemplateGroupId)).value(subQuery.Query)); } if (!predicates.isEmpty()) { @@ -272,49 +272,49 @@ public class DmpDescriptionTemplateQuery extends QueryBase columns) { - DmpDescriptionTemplateEntity item = new DmpDescriptionTemplateEntity(); - item.setId(QueryBase.convertSafe(tuple, columns, DmpDescriptionTemplateEntity._id, UUID.class)); - item.setTenantId(QueryBase.convertSafe(tuple, columns, DmpDescriptionTemplateEntity._tenantId, UUID.class)); - item.setDmpId(QueryBase.convertSafe(tuple, columns, DmpDescriptionTemplateEntity._dmpId, UUID.class)); - item.setDescriptionTemplateGroupId(QueryBase.convertSafe(tuple, columns, DmpDescriptionTemplateEntity._descriptionTemplateGroupId, UUID.class)); - item.setSectionId(QueryBase.convertSafe(tuple, columns, DmpDescriptionTemplateEntity._sectionId, UUID.class)); - item.setCreatedAt(QueryBase.convertSafe(tuple, columns, DmpDescriptionTemplateEntity._createdAt, Instant.class)); - item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, DmpDescriptionTemplateEntity._updatedAt, Instant.class)); - item.setIsActive(QueryBase.convertSafe(tuple, columns, DmpDescriptionTemplateEntity._isActive, IsActive.class)); + protected PlanDescriptionTemplateEntity convert(Tuple tuple, Set columns) { + PlanDescriptionTemplateEntity item = new PlanDescriptionTemplateEntity(); + item.setId(QueryBase.convertSafe(tuple, columns, PlanDescriptionTemplateEntity._id, UUID.class)); + item.setTenantId(QueryBase.convertSafe(tuple, columns, PlanDescriptionTemplateEntity._tenantId, UUID.class)); + item.setPlanId(QueryBase.convertSafe(tuple, columns, PlanDescriptionTemplateEntity._planId, UUID.class)); + item.setDescriptionTemplateGroupId(QueryBase.convertSafe(tuple, columns, PlanDescriptionTemplateEntity._descriptionTemplateGroupId, UUID.class)); + item.setSectionId(QueryBase.convertSafe(tuple, columns, PlanDescriptionTemplateEntity._sectionId, UUID.class)); + item.setCreatedAt(QueryBase.convertSafe(tuple, columns, PlanDescriptionTemplateEntity._createdAt, Instant.class)); + item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, PlanDescriptionTemplateEntity._updatedAt, Instant.class)); + item.setIsActive(QueryBase.convertSafe(tuple, columns, PlanDescriptionTemplateEntity._isActive, IsActive.class)); return item; } @Override protected String fieldNameOf(FieldResolver item) { - if (item.match(DmpDescriptionTemplate._id) || item.match(PublicDmpDescriptionTemplate._id)) - return DmpDescriptionTemplateEntity._id; - else if (item.prefix(DmpDescriptionTemplate._dmp) || item.prefix(PublicDmpDescriptionTemplate._dmp)) - return DmpDescriptionTemplateEntity._dmpId; - else if (item.match(DmpDescriptionTemplate._dmp) || item.prefix(PublicDmpDescriptionTemplate._dmp)) - return DmpDescriptionTemplateEntity._dmpId; - else if (item.prefix(DmpDescriptionTemplate._currentDescriptionTemplate)) - return DmpDescriptionTemplateEntity._descriptionTemplateGroupId; - else if (item.match(DmpDescriptionTemplate._currentDescriptionTemplate)) - return DmpDescriptionTemplateEntity._descriptionTemplateGroupId; - else if (item.prefix(DmpDescriptionTemplate._descriptionTemplates)) - return DmpDescriptionTemplateEntity._descriptionTemplateGroupId; - else if (item.match(DmpDescriptionTemplate._descriptionTemplates)) - return DmpDescriptionTemplateEntity._descriptionTemplateGroupId; - else if (item.match(DmpDescriptionTemplate._sectionId)) - return DmpDescriptionTemplateEntity._sectionId; - else if (item.match(DmpDescriptionTemplate._descriptionTemplateGroupId)) - return DmpDescriptionTemplateEntity._descriptionTemplateGroupId; - else if (item.match(DmpDescriptionTemplate._hash)) - return DmpDescriptionTemplateEntity._updatedAt; - else if (item.match(DmpDescriptionTemplate._createdAt)) - return DmpDescriptionTemplateEntity._createdAt; - else if (item.match(DmpDescriptionTemplate._updatedAt)) - return DmpDescriptionTemplateEntity._updatedAt; - else if (item.match(DmpDescriptionTemplate._isActive)) - return DmpDescriptionTemplateEntity._isActive; - else if (item.match(DmpDescriptionTemplate._belongsToCurrentTenant)) - return DmpDescriptionTemplateEntity._tenantId; + if (item.match(PlanDescriptionTemplate._id) || item.match(PublicPlanDescriptionTemplate._id)) + return PlanDescriptionTemplateEntity._id; + else if (item.prefix(PlanDescriptionTemplate._plan) || item.prefix(PublicPlanDescriptionTemplate._plan)) + return PlanDescriptionTemplateEntity._planId; + else if (item.match(PlanDescriptionTemplate._plan) || item.prefix(PublicPlanDescriptionTemplate._plan)) + return PlanDescriptionTemplateEntity._planId; + else if (item.prefix(PlanDescriptionTemplate._currentDescriptionTemplate)) + return PlanDescriptionTemplateEntity._descriptionTemplateGroupId; + else if (item.match(PlanDescriptionTemplate._currentDescriptionTemplate)) + return PlanDescriptionTemplateEntity._descriptionTemplateGroupId; + else if (item.prefix(PlanDescriptionTemplate._descriptionTemplates)) + return PlanDescriptionTemplateEntity._descriptionTemplateGroupId; + else if (item.match(PlanDescriptionTemplate._descriptionTemplates)) + return PlanDescriptionTemplateEntity._descriptionTemplateGroupId; + else if (item.match(PlanDescriptionTemplate._sectionId)) + return PlanDescriptionTemplateEntity._sectionId; + else if (item.match(PlanDescriptionTemplate._descriptionTemplateGroupId)) + return PlanDescriptionTemplateEntity._descriptionTemplateGroupId; + else if (item.match(PlanDescriptionTemplate._hash)) + return PlanDescriptionTemplateEntity._updatedAt; + else if (item.match(PlanDescriptionTemplate._createdAt)) + return PlanDescriptionTemplateEntity._createdAt; + else if (item.match(PlanDescriptionTemplate._updatedAt)) + return PlanDescriptionTemplateEntity._updatedAt; + else if (item.match(PlanDescriptionTemplate._isActive)) + return PlanDescriptionTemplateEntity._isActive; + else if (item.match(PlanDescriptionTemplate._belongsToCurrentTenant)) + return PlanDescriptionTemplateEntity._tenantId; else return null; } diff --git a/backend/core/src/main/java/org/opencdmp/query/DmpQuery.java b/backend/core/src/main/java/org/opencdmp/query/PlanQuery.java similarity index 51% rename from backend/core/src/main/java/org/opencdmp/query/DmpQuery.java rename to backend/core/src/main/java/org/opencdmp/query/PlanQuery.java index b307903a0..dfdcd1ae3 100644 --- a/backend/core/src/main/java/org/opencdmp/query/DmpQuery.java +++ b/backend/core/src/main/java/org/opencdmp/query/PlanQuery.java @@ -13,8 +13,8 @@ import org.opencdmp.authorization.Permission; import org.opencdmp.commons.enums.*; import org.opencdmp.commons.scope.user.UserScope; import org.opencdmp.data.*; -import org.opencdmp.model.PublicDmp; -import org.opencdmp.model.dmp.Dmp; +import org.opencdmp.model.PublicPlan; +import org.opencdmp.model.plan.Plan; import org.opencdmp.query.utils.QueryUtilsService; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; @@ -25,7 +25,7 @@ import java.util.*; @Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpQuery extends QueryBase { +public class PlanQuery extends QueryBase { private String like; @@ -37,11 +37,11 @@ public class DmpQuery extends QueryBase { private Collection isActives; - private Collection statuses; + private Collection statuses; - private Collection versionStatuses; + private Collection versionStatuses; - private Collection accessTypes; + private Collection accessTypes; private Collection versions; @@ -49,13 +49,13 @@ public class DmpQuery extends QueryBase { private Instant after; - private DmpUserQuery dmpUserQuery; + private PlanUserQuery planUserQuery; - private DmpDescriptionTemplateQuery dmpDescriptionTemplateQuery; + private PlanDescriptionTemplateQuery planDescriptionTemplateQuery; - private DmpBlueprintQuery dmpBlueprintQuery; + private PlanBlueprintQuery planBlueprintQuery; - private DmpReferenceQuery dmpReferenceQuery; + private PlanReferenceQuery planReferenceQuery; private EntityDoiQuery entityDoiQuery; @@ -68,195 +68,195 @@ public class DmpQuery extends QueryBase { private final QueryUtilsService queryUtilsService; private final TenantEntityManager tenantEntityManager; - public DmpQuery(UserScope userScope, AuthorizationService authService, QueryUtilsService queryUtilsService, TenantEntityManager tenantEntityManager) { + public PlanQuery(UserScope userScope, AuthorizationService authService, QueryUtilsService queryUtilsService, TenantEntityManager tenantEntityManager) { this.userScope = userScope; this.authService = authService; this.queryUtilsService = queryUtilsService; this.tenantEntityManager = tenantEntityManager; } - public DmpQuery like(String value) { + public PlanQuery like(String value) { this.like = value; return this; } - public DmpQuery ids(UUID value) { + public PlanQuery ids(UUID value) { this.ids = List.of(value); return this; } - public DmpQuery ids(UUID... value) { + public PlanQuery ids(UUID... value) { this.ids = Arrays.asList(value); return this; } - public DmpQuery ids(Collection values) { + public PlanQuery ids(Collection values) { this.ids = values; return this; } - public DmpQuery creatorIds(UUID value) { + public PlanQuery creatorIds(UUID value) { this.creatorIds = List.of(value); return this; } - public DmpQuery creatorIds(UUID... value) { + public PlanQuery creatorIds(UUID... value) { this.creatorIds = Arrays.asList(value); return this; } - public DmpQuery creatorIds(Collection values) { + public PlanQuery creatorIds(Collection values) { this.creatorIds = values; return this; } - public DmpQuery excludedIds(Collection values) { + public PlanQuery excludedIds(Collection values) { this.excludedIds = values; return this; } - public DmpQuery excludedIds(UUID value) { + public PlanQuery excludedIds(UUID value) { this.excludedIds = List.of(value); return this; } - public DmpQuery excludedIds(UUID... value) { + public PlanQuery excludedIds(UUID... value) { this.excludedIds = Arrays.asList(value); return this; } - public DmpQuery isActive(IsActive value) { + public PlanQuery isActive(IsActive value) { this.isActives = List.of(value); return this; } - public DmpQuery isActive(IsActive... value) { + public PlanQuery isActive(IsActive... value) { this.isActives = Arrays.asList(value); return this; } - public DmpQuery isActive(Collection values) { + public PlanQuery isActive(Collection values) { this.isActives = values; return this; } - public DmpQuery versionStatuses(DmpVersionStatus value) { + public PlanQuery versionStatuses(PlanVersionStatus value) { this.versionStatuses = List.of(value); return this; } - public DmpQuery versionStatuses(DmpVersionStatus... value) { + public PlanQuery versionStatuses(PlanVersionStatus... value) { this.versionStatuses = Arrays.asList(value); return this; } - public DmpQuery versionStatuses(Collection values) { + public PlanQuery versionStatuses(Collection values) { this.versionStatuses = values; return this; } - public DmpQuery accessTypes(DmpAccessType value) { + public PlanQuery accessTypes(PlanAccessType value) { this.accessTypes = List.of(value); return this; } - public DmpQuery accessTypes(DmpAccessType... value) { + public PlanQuery accessTypes(PlanAccessType... value) { this.accessTypes = Arrays.asList(value); return this; } - public DmpQuery accessTypes(Collection values) { + public PlanQuery accessTypes(Collection values) { this.accessTypes = values; return this; } - public DmpQuery statuses(DmpStatus value) { + public PlanQuery statuses(PlanStatus value) { this.statuses = List.of(value); return this; } - public DmpQuery statuses(DmpStatus... value) { + public PlanQuery statuses(PlanStatus... value) { this.statuses = Arrays.asList(value); return this; } - public DmpQuery statuses(Collection values) { + public PlanQuery statuses(Collection values) { this.statuses = values; return this; } - public DmpQuery versions(Integer value) { + public PlanQuery versions(Integer value) { this.versions = List.of(value); return this; } - public DmpQuery versions(Integer... value) { + public PlanQuery versions(Integer... value) { this.versions = Arrays.asList(value); return this; } - public DmpQuery versions(Collection values) { + public PlanQuery versions(Collection values) { this.versions = values; return this; } - public DmpQuery groupIds(UUID value) { + public PlanQuery groupIds(UUID value) { this.groupIds = List.of(value); return this; } - public DmpQuery groupIds(UUID... value) { + public PlanQuery groupIds(UUID... value) { this.groupIds = Arrays.asList(value); return this; } - public DmpQuery groupIds(Collection values) { + public PlanQuery groupIds(Collection values) { this.groupIds = values; return this; } - public DmpQuery after(Instant value) { + public PlanQuery after(Instant value) { this.after = value; return this; } - public DmpQuery dmpDescriptionTemplateSubQuery(DmpDescriptionTemplateQuery subQuery) { - this.dmpDescriptionTemplateQuery = subQuery; + public PlanQuery planDescriptionTemplateSubQuery(PlanDescriptionTemplateQuery subQuery) { + this.planDescriptionTemplateQuery = subQuery; return this; } - public DmpQuery dmpBlueprintSubQuery(DmpBlueprintQuery subQuery) { - this.dmpBlueprintQuery = subQuery; + public PlanQuery planBlueprintSubQuery(PlanBlueprintQuery subQuery) { + this.planBlueprintQuery = subQuery; return this; } - public DmpQuery dmpUserSubQuery(DmpUserQuery subQuery) { - this.dmpUserQuery = subQuery; + public PlanQuery planUserSubQuery(PlanUserQuery subQuery) { + this.planUserQuery = subQuery; return this; } - public DmpQuery dmpReferenceSubQuery(DmpReferenceQuery subQuery) { - this.dmpReferenceQuery = subQuery; + public PlanQuery planReferenceSubQuery(PlanReferenceQuery subQuery) { + this.planReferenceQuery = subQuery; return this; } - public DmpQuery entityDoiSubQuery(EntityDoiQuery subQuery) { + public PlanQuery entityDoiSubQuery(EntityDoiQuery subQuery) { this.entityDoiQuery = subQuery; this.entityDoiQuery.types(EntityType.DMP); return this; } - public DmpQuery authorize(EnumSet values) { + public PlanQuery authorize(EnumSet values) { this.authorize = values; return this; } - public DmpQuery enableTracking() { + public PlanQuery enableTracking() { this.noTracking = false; return this; } - public DmpQuery disableTracking() { + public PlanQuery disableTracking() { this.noTracking = true; return this; } @@ -268,19 +268,19 @@ public class DmpQuery extends QueryBase { @Override protected Boolean isFalseQuery() { - return this.isEmpty(this.ids) || this.isEmpty(this.creatorIds) || this.isEmpty(this.isActives) || this.isEmpty(this.versionStatuses) || this.isEmpty(this.excludedIds) || this.isEmpty(this.accessTypes) || this.isEmpty(this.statuses) || this.isFalseQuery(this.dmpDescriptionTemplateQuery) || this.isFalseQuery(this.dmpUserQuery); + return this.isEmpty(this.ids) || this.isEmpty(this.creatorIds) || this.isEmpty(this.isActives) || this.isEmpty(this.versionStatuses) || this.isEmpty(this.excludedIds) || this.isEmpty(this.accessTypes) || this.isEmpty(this.statuses) || this.isFalseQuery(this.planDescriptionTemplateQuery) || this.isFalseQuery(this.planUserQuery); } @Override - protected Class entityClass() { - return DmpEntity.class; + protected Class entityClass() { + return PlanEntity.class; } @Override protected Predicate applyAuthZ(QueryContext queryContext) { if (this.authorize.contains(AuthorizationFlags.None)) return null; - if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowseDmp)) + if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowsePlan)) return null; UUID userId = null; boolean usePublic = this.authorize.contains(AuthorizationFlags.Public); @@ -291,11 +291,11 @@ public class DmpQuery extends QueryBase { if (userId != null || usePublic) { predicates.add(queryContext.CriteriaBuilder.or( usePublic ? queryContext.CriteriaBuilder.and( - queryContext.CriteriaBuilder.equal(queryContext.Root.get(DmpEntity._status), DmpStatus.Finalized), - queryContext.CriteriaBuilder.equal(queryContext.Root.get(DmpEntity._accessType), DmpAccessType.Public) + queryContext.CriteriaBuilder.equal(queryContext.Root.get(PlanEntity._status), PlanStatus.Finalized), + queryContext.CriteriaBuilder.equal(queryContext.Root.get(PlanEntity._accessType), PlanAccessType.Public) ) : queryContext.CriteriaBuilder.or(), //Creates a false query - userId != null ? queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpEntity._id)).value(this.queryUtilsService.buildDmpUserAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId)) : queryContext.CriteriaBuilder.or() //Creates a false query + userId != null ? queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanEntity._id)).value(this.queryUtilsService.buildDmpUserAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId)) : queryContext.CriteriaBuilder.or() //Creates a false query )); } if (!predicates.isEmpty()) { @@ -310,90 +310,90 @@ public class DmpQuery extends QueryBase { protected Predicate applyFilters(QueryContext queryContext) { List predicates = new ArrayList<>(); if (this.like != null && !this.like.isBlank()) { - predicates.add(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DmpEntity._label), this.like)); + predicates.add(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(PlanEntity._label), this.like)); } if (this.ids != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpEntity._id)); + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanEntity._id)); for (UUID item : this.ids) inClause.value(item); predicates.add(inClause); } if (this.creatorIds != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpEntity._creatorId)); + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanEntity._creatorId)); for (UUID item : this.creatorIds) inClause.value(item); predicates.add(inClause); } if (this.excludedIds != null) { - CriteriaBuilder.In notInClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpEntity._id)); + CriteriaBuilder.In notInClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanEntity._id)); for (UUID item : this.excludedIds) notInClause.value(item); predicates.add(notInClause.not()); } if (this.isActives != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpEntity._isActive)); + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanEntity._isActive)); for (IsActive item : this.isActives) inClause.value(item); predicates.add(inClause); } if (this.statuses != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpEntity._status)); - for (DmpStatus item : this.statuses) + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanEntity._status)); + for (PlanStatus item : this.statuses) inClause.value(item); predicates.add(inClause); } if (this.versionStatuses != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpEntity._versionStatus)); - for (DmpVersionStatus item : this.versionStatuses) + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanEntity._versionStatus)); + for (PlanVersionStatus item : this.versionStatuses) inClause.value(item); predicates.add(inClause); } if (this.accessTypes != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpEntity._accessType)); - for (DmpAccessType item : this.accessTypes) + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanEntity._accessType)); + for (PlanAccessType item : this.accessTypes) inClause.value(item); predicates.add(inClause); } if (this.versions != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpEntity._version)); + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanEntity._version)); for (Integer item : this.versions) inClause.value(item); predicates.add(inClause); } if (this.groupIds != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpEntity._groupId)); + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanEntity._groupId)); for (UUID item : this.groupIds) inClause.value(item); predicates.add(inClause); } if (this.after != null) { - Predicate afterClause = queryContext.CriteriaBuilder.greaterThanOrEqualTo(queryContext.Root.get(DmpEntity._createdAt), this.after); + Predicate afterClause = queryContext.CriteriaBuilder.greaterThanOrEqualTo(queryContext.Root.get(PlanEntity._createdAt), this.after); predicates.add(afterClause); } - if (this.dmpUserQuery != null) { - QueryContext subQuery = this.applySubQuery(this.dmpUserQuery, queryContext, UUID.class, root -> root.get(DmpUserEntity._dmpId)); - predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpEntity._id)).value(subQuery.Query)); + if (this.planUserQuery != null) { + QueryContext subQuery = this.applySubQuery(this.planUserQuery, queryContext, UUID.class, root -> root.get(PlanUserEntity._planId)); + predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanEntity._id)).value(subQuery.Query)); } - if (this.dmpDescriptionTemplateQuery != null) { - QueryContext subQuery = this.applySubQuery(this.dmpDescriptionTemplateQuery, queryContext, UUID.class, dmpDescriptionTemplateEntityRoot -> dmpDescriptionTemplateEntityRoot.get(DmpDescriptionTemplateEntity._dmpId)); - predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpEntity._id)).value(subQuery.Query)); + if (this.planDescriptionTemplateQuery != null) { + QueryContext subQuery = this.applySubQuery(this.planDescriptionTemplateQuery, queryContext, UUID.class, planDescriptionTemplateEntityRoot -> planDescriptionTemplateEntityRoot.get(PlanDescriptionTemplateEntity._planId)); + predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanEntity._id)).value(subQuery.Query)); } - if (this.dmpBlueprintQuery != null) { - QueryContext subQuery = this.applySubQuery(this.dmpBlueprintQuery, queryContext, UUID.class, dmpBlueprintEntityRoot -> dmpBlueprintEntityRoot.get(DmpBlueprintEntity._id)); - predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpEntity._blueprintId)).value(subQuery.Query)); + if (this.planBlueprintQuery != null) { + QueryContext subQuery = this.applySubQuery(this.planBlueprintQuery, queryContext, UUID.class, planBlueprintEntityRoot -> planBlueprintEntityRoot.get(PlanBlueprintEntity._id)); + predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanEntity._blueprintId)).value(subQuery.Query)); } - if (this.dmpReferenceQuery != null) { - QueryContext subQuery = this.applySubQuery(this.dmpReferenceQuery, queryContext, UUID.class, dmpReferenceEntityRoot -> dmpReferenceEntityRoot.get(DmpReferenceEntity._dmpId)); - predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpEntity._id)).value(subQuery.Query)); + if (this.planReferenceQuery != null) { + QueryContext subQuery = this.applySubQuery(this.planReferenceQuery, queryContext, UUID.class, planReferenceEntityRoot -> planReferenceEntityRoot.get(PlanReferenceEntity._planId)); + predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanEntity._id)).value(subQuery.Query)); } if (this.entityDoiQuery != null) { QueryContext subQuery = this.applySubQuery(this.entityDoiQuery, queryContext, UUID.class, entityDoiEntityRoot -> entityDoiEntityRoot.get(EntityDoiEntity._entityId)); - predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpEntity._id)).value(subQuery.Query)); + predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanEntity._id)).value(subQuery.Query)); } if (!predicates.isEmpty()) { @@ -406,77 +406,77 @@ public class DmpQuery extends QueryBase { @Override protected String fieldNameOf(FieldResolver item) { - if (item.match(Dmp._id) || item.match(PublicDmp._id)) - return DmpEntity._id; - else if (item.match(Dmp._label) || item.match(PublicDmp._label)) - return DmpEntity._label; - else if (item.match(Dmp._version) || item.match(PublicDmp._version)) - return DmpEntity._version; - else if (item.match(Dmp._status)) - return DmpEntity._status; - else if (item.match(Dmp._properties)) - return DmpEntity._properties; - else if (item.prefix(Dmp._properties)) - return DmpEntity._properties; - else if (item.match(Dmp._groupId)) - return DmpEntity._groupId; - else if (item.match(Dmp._description) || item.match(PublicDmp._description)) - return DmpEntity._description; - else if (item.match(Dmp._createdAt)) - return DmpEntity._createdAt; - else if (item.match(Dmp._updatedAt)) - return DmpEntity._updatedAt; - else if (item.match(Dmp._hash)) - return DmpEntity._updatedAt; - else if (item.match(Dmp._isActive)) - return DmpEntity._isActive; - else if (item.match(Dmp._finalizedAt) || item.match(PublicDmp._finalizedAt)) - return DmpEntity._finalizedAt; - else if (item.match(Dmp._accessType)) - return DmpEntity._accessType; - else if (item.match(Dmp._creator)) - return DmpEntity._creatorId; - else if (item.prefix(Dmp._creator)) - return DmpEntity._blueprintId; - else if (item.match(Dmp._blueprint)) - return DmpEntity._blueprintId; - else if (item.prefix(Dmp._blueprint)) - return DmpEntity._blueprintId; - else if (item.match(Dmp._language)) - return DmpEntity._language; - else if (item.match(Dmp._publicAfter)) - return DmpEntity._publicAfter; - else if (item.match(Dmp._versionStatus)) - return DmpEntity._versionStatus; - else if (item.match(DmpEntity._tenantId)) - return DmpEntity._tenantId; - else if (item.match(Dmp._belongsToCurrentTenant)) - return DmpEntity._tenantId; + if (item.match(Plan._id) || item.match(PublicPlan._id)) + return PlanEntity._id; + else if (item.match(Plan._label) || item.match(PublicPlan._label)) + return PlanEntity._label; + else if (item.match(Plan._version) || item.match(PublicPlan._version)) + return PlanEntity._version; + else if (item.match(Plan._status)) + return PlanEntity._status; + else if (item.match(Plan._properties)) + return PlanEntity._properties; + else if (item.prefix(Plan._properties)) + return PlanEntity._properties; + else if (item.match(Plan._groupId)) + return PlanEntity._groupId; + else if (item.match(Plan._description) || item.match(PublicPlan._description)) + return PlanEntity._description; + else if (item.match(Plan._createdAt)) + return PlanEntity._createdAt; + else if (item.match(Plan._updatedAt)) + return PlanEntity._updatedAt; + else if (item.match(Plan._hash)) + return PlanEntity._updatedAt; + else if (item.match(Plan._isActive)) + return PlanEntity._isActive; + else if (item.match(Plan._finalizedAt) || item.match(PublicPlan._finalizedAt)) + return PlanEntity._finalizedAt; + else if (item.match(Plan._accessType)) + return PlanEntity._accessType; + else if (item.match(Plan._creator)) + return PlanEntity._creatorId; + else if (item.prefix(Plan._creator)) + return PlanEntity._blueprintId; + else if (item.match(Plan._blueprint)) + return PlanEntity._blueprintId; + else if (item.prefix(Plan._blueprint)) + return PlanEntity._blueprintId; + else if (item.match(Plan._language)) + return PlanEntity._language; + else if (item.match(Plan._publicAfter)) + return PlanEntity._publicAfter; + else if (item.match(Plan._versionStatus)) + return PlanEntity._versionStatus; + else if (item.match(PlanEntity._tenantId)) + return PlanEntity._tenantId; + else if (item.match(Plan._belongsToCurrentTenant)) + return PlanEntity._tenantId; else return null; } @Override - protected DmpEntity convert(Tuple tuple, Set columns) { - DmpEntity item = new DmpEntity(); - item.setId(QueryBase.convertSafe(tuple, columns, DmpEntity._id, UUID.class)); - item.setTenantId(QueryBase.convertSafe(tuple, columns, DmpEntity._tenantId, UUID.class)); - item.setLabel(QueryBase.convertSafe(tuple, columns, DmpEntity._label, String.class)); - item.setVersion(QueryBase.convertSafe(tuple, columns, DmpEntity._version, Short.class)); - item.setStatus(QueryBase.convertSafe(tuple, columns, DmpEntity._status, DmpStatus.class)); - item.setVersionStatus(QueryBase.convertSafe(tuple, columns, DmpEntity._versionStatus, DmpVersionStatus.class)); - item.setProperties(QueryBase.convertSafe(tuple, columns, DmpEntity._properties, String.class)); - item.setGroupId(QueryBase.convertSafe(tuple, columns, DmpEntity._groupId, UUID.class)); - item.setDescription(QueryBase.convertSafe(tuple, columns, DmpEntity._description, String.class)); - item.setCreatedAt(QueryBase.convertSafe(tuple, columns, DmpEntity._createdAt, Instant.class)); - item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, DmpEntity._updatedAt, Instant.class)); - item.setIsActive(QueryBase.convertSafe(tuple, columns, DmpEntity._isActive, IsActive.class)); - item.setFinalizedAt(QueryBase.convertSafe(tuple, columns, DmpEntity._finalizedAt, Instant.class)); - item.setAccessType(QueryBase.convertSafe(tuple, columns, DmpEntity._accessType, DmpAccessType.class)); - item.setCreatorId(QueryBase.convertSafe(tuple, columns, DmpEntity._creatorId, UUID.class)); - item.setBlueprintId(QueryBase.convertSafe(tuple, columns, DmpEntity._blueprintId, UUID.class)); - item.setLanguage(QueryBase.convertSafe(tuple, columns, DmpEntity._language, String.class)); - item.setPublicAfter(QueryBase.convertSafe(tuple, columns, DmpEntity._publicAfter, Instant.class)); + protected PlanEntity convert(Tuple tuple, Set columns) { + PlanEntity item = new PlanEntity(); + item.setId(QueryBase.convertSafe(tuple, columns, PlanEntity._id, UUID.class)); + item.setTenantId(QueryBase.convertSafe(tuple, columns, PlanEntity._tenantId, UUID.class)); + item.setLabel(QueryBase.convertSafe(tuple, columns, PlanEntity._label, String.class)); + item.setVersion(QueryBase.convertSafe(tuple, columns, PlanEntity._version, Short.class)); + item.setStatus(QueryBase.convertSafe(tuple, columns, PlanEntity._status, PlanStatus.class)); + item.setVersionStatus(QueryBase.convertSafe(tuple, columns, PlanEntity._versionStatus, PlanVersionStatus.class)); + item.setProperties(QueryBase.convertSafe(tuple, columns, PlanEntity._properties, String.class)); + item.setGroupId(QueryBase.convertSafe(tuple, columns, PlanEntity._groupId, UUID.class)); + item.setDescription(QueryBase.convertSafe(tuple, columns, PlanEntity._description, String.class)); + item.setCreatedAt(QueryBase.convertSafe(tuple, columns, PlanEntity._createdAt, Instant.class)); + item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, PlanEntity._updatedAt, Instant.class)); + item.setIsActive(QueryBase.convertSafe(tuple, columns, PlanEntity._isActive, IsActive.class)); + item.setFinalizedAt(QueryBase.convertSafe(tuple, columns, PlanEntity._finalizedAt, Instant.class)); + item.setAccessType(QueryBase.convertSafe(tuple, columns, PlanEntity._accessType, PlanAccessType.class)); + item.setCreatorId(QueryBase.convertSafe(tuple, columns, PlanEntity._creatorId, UUID.class)); + item.setBlueprintId(QueryBase.convertSafe(tuple, columns, PlanEntity._blueprintId, UUID.class)); + item.setLanguage(QueryBase.convertSafe(tuple, columns, PlanEntity._language, String.class)); + item.setPublicAfter(QueryBase.convertSafe(tuple, columns, PlanEntity._publicAfter, Instant.class)); return item; } diff --git a/backend/core/src/main/java/org/opencdmp/query/DmpReferenceQuery.java b/backend/core/src/main/java/org/opencdmp/query/PlanReferenceQuery.java similarity index 55% rename from backend/core/src/main/java/org/opencdmp/query/DmpReferenceQuery.java rename to backend/core/src/main/java/org/opencdmp/query/PlanReferenceQuery.java index cc6905390..0dbcd75bc 100644 --- a/backend/core/src/main/java/org/opencdmp/query/DmpReferenceQuery.java +++ b/backend/core/src/main/java/org/opencdmp/query/PlanReferenceQuery.java @@ -12,12 +12,12 @@ import org.opencdmp.authorization.AuthorizationFlags; import org.opencdmp.authorization.Permission; import org.opencdmp.commons.enums.IsActive; import org.opencdmp.commons.scope.user.UserScope; -import org.opencdmp.data.DmpEntity; -import org.opencdmp.data.DmpReferenceEntity; +import org.opencdmp.data.PlanEntity; +import org.opencdmp.data.PlanReferenceEntity; import org.opencdmp.data.ReferenceEntity; import org.opencdmp.data.TenantEntityManager; -import org.opencdmp.model.PublicDmpReference; -import org.opencdmp.model.dmpreference.DmpReference; +import org.opencdmp.model.PublicPlanReference; +import org.opencdmp.model.planreference.PlanReference; import org.opencdmp.query.utils.QueryUtilsService; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; @@ -28,102 +28,102 @@ import java.util.*; @Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpReferenceQuery extends QueryBase { +public class PlanReferenceQuery extends QueryBase { private Collection ids; private Collection isActives; - private Collection dmpIds; + private Collection planIds; private Collection referenceIds; - private DmpQuery dmpQuery; + private PlanQuery planQuery; private ReferenceQuery referenceQuery; private EnumSet authorize = EnumSet.of(AuthorizationFlags.None); - public DmpReferenceQuery ids(UUID value) { + public PlanReferenceQuery ids(UUID value) { this.ids = List.of(value); return this; } - public DmpReferenceQuery ids(UUID... value) { + public PlanReferenceQuery ids(UUID... value) { this.ids = Arrays.asList(value); return this; } - public DmpReferenceQuery ids(Collection values) { + public PlanReferenceQuery ids(Collection values) { this.ids = values; return this; } - public DmpReferenceQuery isActives(IsActive value) { + public PlanReferenceQuery isActives(IsActive value) { this.isActives = List.of(value); return this; } - public DmpReferenceQuery isActives(IsActive... value) { + public PlanReferenceQuery isActives(IsActive... value) { this.isActives = Arrays.asList(value); return this; } - public DmpReferenceQuery isActives(Collection values) { + public PlanReferenceQuery isActives(Collection values) { this.isActives = values; return this; } - public DmpReferenceQuery dmpIds(UUID value) { - this.dmpIds = List.of(value); + public PlanReferenceQuery planIds(UUID value) { + this.planIds = List.of(value); return this; } - public DmpReferenceQuery dmpIds(UUID... value) { - this.dmpIds = Arrays.asList(value); + public PlanReferenceQuery planIds(UUID... value) { + this.planIds = Arrays.asList(value); return this; } - public DmpReferenceQuery dmpIds(Collection values) { - this.dmpIds = values; + public PlanReferenceQuery planIds(Collection values) { + this.planIds = values; return this; } - public DmpReferenceQuery referenceIds(UUID value) { + public PlanReferenceQuery referenceIds(UUID value) { this.referenceIds = List.of(value); return this; } - public DmpReferenceQuery referenceIds(UUID... value) { + public PlanReferenceQuery referenceIds(UUID... value) { this.referenceIds = Arrays.asList(value); return this; } - public DmpReferenceQuery referenceIds(Collection values) { + public PlanReferenceQuery referenceIds(Collection values) { this.referenceIds = values; return this; } - public DmpReferenceQuery dmpSubQuery(DmpQuery value) { - this.dmpQuery = value; + public PlanReferenceQuery dmpSubQuery(PlanQuery value) { + this.planQuery = value; return this; } - public DmpReferenceQuery referenceSubQuery(ReferenceQuery value) { + public PlanReferenceQuery referenceSubQuery(ReferenceQuery value) { this.referenceQuery = value; return this; } - public DmpReferenceQuery authorize(EnumSet values) { + public PlanReferenceQuery authorize(EnumSet values) { this.authorize = values; return this; } - public DmpReferenceQuery enableTracking() { + public PlanReferenceQuery enableTracking() { this.noTracking = false; return this; } - public DmpReferenceQuery disableTracking() { + public PlanReferenceQuery disableTracking() { this.noTracking = true; return this; } @@ -134,7 +134,7 @@ public class DmpReferenceQuery extends QueryBase { private final QueryUtilsService queryUtilsService; private final TenantEntityManager tenantEntityManager; - public DmpReferenceQuery( + public PlanReferenceQuery( UserScope userScope, AuthorizationService authService, QueryUtilsService queryUtilsService, TenantEntityManager tenantEntityManager) { @@ -150,19 +150,19 @@ public class DmpReferenceQuery extends QueryBase { } @Override - protected Class entityClass() { - return DmpReferenceEntity.class; + protected Class entityClass() { + return PlanReferenceEntity.class; } @Override protected Boolean isFalseQuery() { - return this.isEmpty(this.ids) || this.isEmpty(this.dmpIds) || this.isEmpty(this.referenceIds) || this.isFalseQuery(this.dmpQuery) || this.isFalseQuery(this.referenceQuery); + return this.isEmpty(this.ids) || this.isEmpty(this.planIds) || this.isEmpty(this.referenceIds) || this.isFalseQuery(this.planQuery) || this.isFalseQuery(this.referenceQuery); } @Override protected Predicate applyAuthZ(QueryContext queryContext) { if (this.authorize.contains(AuthorizationFlags.None)) return null; - if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowseDmpReference)) return null; + if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowsePlanReference)) return null; UUID userId; boolean usePublic = this.authorize.contains(AuthorizationFlags.Public); if (this.authorize.contains(AuthorizationFlags.DmpAssociated)) userId = this.userScope.getUserIdSafe(); @@ -170,7 +170,7 @@ public class DmpReferenceQuery extends QueryBase { List predicates = new ArrayList<>(); if (userId != null || usePublic ) { - predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpReferenceEntity._dmpId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic))); + predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanReferenceEntity._planId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic))); } if (!predicates.isEmpty()) { Predicate[] predicatesArray = predicates.toArray(new Predicate[0]); @@ -184,36 +184,36 @@ public class DmpReferenceQuery extends QueryBase { protected Predicate applyFilters(QueryContext queryContext) { List predicates = new ArrayList<>(); if (this.ids != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpReferenceEntity._id)); + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanReferenceEntity._id)); for (UUID item : this.ids) inClause.value(item); predicates.add(inClause); } if (this.isActives != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpReferenceEntity._isActive)); + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanReferenceEntity._isActive)); for (IsActive item : this.isActives) inClause.value(item); predicates.add(inClause); } - if (this.dmpIds != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpReferenceEntity._dmpId)); - for (UUID item : this.dmpIds) + if (this.planIds != null) { + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanReferenceEntity._planId)); + for (UUID item : this.planIds) inClause.value(item); predicates.add(inClause); } if (this.referenceIds != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpReferenceEntity._referenceId)); + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanReferenceEntity._referenceId)); for (UUID item : this.referenceIds) inClause.value(item); predicates.add(inClause); } - if (this.dmpQuery != null) { - QueryContext subQuery = this.applySubQuery(this.dmpQuery, queryContext, UUID.class, dmpEntityRoot -> dmpEntityRoot.get(DmpEntity._id)); - predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpReferenceEntity._dmpId)).value(subQuery.Query)); + if (this.planQuery != null) { + QueryContext subQuery = this.applySubQuery(this.planQuery, queryContext, UUID.class, dmpEntityRoot -> dmpEntityRoot.get(PlanEntity._id)); + predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanReferenceEntity._planId)).value(subQuery.Query)); } if (this.referenceQuery != null) { QueryContext subQuery = this.applySubQuery(this.referenceQuery, queryContext, UUID.class, root -> root.get(ReferenceEntity._id)); - predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpReferenceEntity._referenceId)).value(subQuery.Query)); + predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanReferenceEntity._referenceId)).value(subQuery.Query)); } if (!predicates.isEmpty()) { Predicate[] predicatesArray = predicates.toArray(new Predicate[0]); @@ -224,32 +224,32 @@ public class DmpReferenceQuery extends QueryBase { } @Override - protected DmpReferenceEntity convert(Tuple tuple, Set columns) { - DmpReferenceEntity item = new DmpReferenceEntity(); - item.setId(QueryBase.convertSafe(tuple, columns, DmpReferenceEntity._id, UUID.class)); - item.setTenantId(QueryBase.convertSafe(tuple, columns, DmpReferenceEntity._tenantId, UUID.class)); - item.setDmpId(QueryBase.convertSafe(tuple, columns, DmpReferenceEntity._dmpId, UUID.class)); - item.setReferenceId(QueryBase.convertSafe(tuple, columns, DmpReferenceEntity._referenceId, UUID.class)); - item.setData(QueryBase.convertSafe(tuple, columns, DmpReferenceEntity._data, String.class)); - item.setIsActive(QueryBase.convertSafe(tuple, columns, DmpReferenceEntity._isActive, IsActive.class)); - item.setCreatedAt(QueryBase.convertSafe(tuple, columns, DmpReferenceEntity._createdAt, Instant.class)); - item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, DmpReferenceEntity._updatedAt, Instant.class)); + protected PlanReferenceEntity convert(Tuple tuple, Set columns) { + PlanReferenceEntity item = new PlanReferenceEntity(); + item.setId(QueryBase.convertSafe(tuple, columns, PlanReferenceEntity._id, UUID.class)); + item.setTenantId(QueryBase.convertSafe(tuple, columns, PlanReferenceEntity._tenantId, UUID.class)); + item.setPlanId(QueryBase.convertSafe(tuple, columns, PlanReferenceEntity._planId, UUID.class)); + item.setReferenceId(QueryBase.convertSafe(tuple, columns, PlanReferenceEntity._referenceId, UUID.class)); + item.setData(QueryBase.convertSafe(tuple, columns, PlanReferenceEntity._data, String.class)); + item.setIsActive(QueryBase.convertSafe(tuple, columns, PlanReferenceEntity._isActive, IsActive.class)); + item.setCreatedAt(QueryBase.convertSafe(tuple, columns, PlanReferenceEntity._createdAt, Instant.class)); + item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, PlanReferenceEntity._updatedAt, Instant.class)); return item; } @Override protected String fieldNameOf(FieldResolver item) { - if (item.match(DmpReference._id) || item.match(PublicDmpReference._id)) return DmpReferenceEntity._id; - else if (item.prefix(DmpReference._dmp) || item.prefix(PublicDmpReference._dmp)) return DmpReferenceEntity._dmpId; - else if (item.prefix(DmpReference._reference) || item.prefix(PublicDmpReference._reference)) return DmpReferenceEntity._referenceId; - else if (item.match(DmpReference._dmp) || item.match(PublicDmpReference._dmp)) return DmpReferenceEntity._dmpId; - else if (item.match(DmpReference._reference) || item.match(PublicDmpReference._reference)) return DmpReferenceEntity._referenceId; - else if (item.prefix(DmpReference._data)) return DmpReferenceEntity._data; - else if (item.match(DmpReference._isActive)) return DmpReferenceEntity._isActive; - else if (item.match(DmpReference._createdAt)) return DmpReferenceEntity._createdAt; - else if (item.match(DmpReference._updatedAt)) return DmpReferenceEntity._updatedAt; - else if (item.match(DmpReference._hash)) return DmpReferenceEntity._updatedAt; - else if (item.match(DmpReference._belongsToCurrentTenant)) return DmpReferenceEntity._tenantId; + if (item.match(PlanReference._id) || item.match(PublicPlanReference._id)) return PlanReferenceEntity._id; + else if (item.prefix(PlanReference._plan) || item.prefix(PublicPlanReference._plan)) return PlanReferenceEntity._planId; + else if (item.prefix(PlanReference._reference) || item.prefix(PublicPlanReference._reference)) return PlanReferenceEntity._referenceId; + else if (item.match(PlanReference._plan) || item.match(PublicPlanReference._plan)) return PlanReferenceEntity._planId; + else if (item.match(PlanReference._reference) || item.match(PublicPlanReference._reference)) return PlanReferenceEntity._referenceId; + else if (item.prefix(PlanReference._data)) return PlanReferenceEntity._data; + else if (item.match(PlanReference._isActive)) return PlanReferenceEntity._isActive; + else if (item.match(PlanReference._createdAt)) return PlanReferenceEntity._createdAt; + else if (item.match(PlanReference._updatedAt)) return PlanReferenceEntity._updatedAt; + else if (item.match(PlanReference._hash)) return PlanReferenceEntity._updatedAt; + else if (item.match(PlanReference._belongsToCurrentTenant)) return PlanReferenceEntity._tenantId; else return null; } diff --git a/backend/core/src/main/java/org/opencdmp/query/DmpUserQuery.java b/backend/core/src/main/java/org/opencdmp/query/PlanUserQuery.java similarity index 58% rename from backend/core/src/main/java/org/opencdmp/query/DmpUserQuery.java rename to backend/core/src/main/java/org/opencdmp/query/PlanUserQuery.java index c23b3ef19..13776eff4 100644 --- a/backend/core/src/main/java/org/opencdmp/query/DmpUserQuery.java +++ b/backend/core/src/main/java/org/opencdmp/query/PlanUserQuery.java @@ -11,14 +11,14 @@ import jakarta.persistence.criteria.Predicate; import jakarta.persistence.criteria.Subquery; import org.opencdmp.authorization.AuthorizationFlags; import org.opencdmp.authorization.Permission; -import org.opencdmp.commons.enums.DmpUserRole; +import org.opencdmp.commons.enums.PlanUserRole; import org.opencdmp.commons.enums.IsActive; import org.opencdmp.commons.scope.user.UserScope; import org.opencdmp.data.DescriptionEntity; -import org.opencdmp.data.DmpUserEntity; +import org.opencdmp.data.PlanUserEntity; import org.opencdmp.data.TenantEntityManager; -import org.opencdmp.model.DmpUser; -import org.opencdmp.model.PublicDmpUser; +import org.opencdmp.model.PlanUser; +import org.opencdmp.model.PublicPlanUser; import org.opencdmp.query.utils.BuildSubQueryInput; import org.opencdmp.query.utils.QueryUtilsService; import org.springframework.beans.factory.config.ConfigurableBeanFactory; @@ -30,146 +30,146 @@ import java.util.*; @Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) -public class DmpUserQuery extends QueryBase { +public class PlanUserQuery extends QueryBase { private Collection ids; private Collection isActives; - private Collection dmpIds; + private Collection planIds; private Collection descriptionIds; private Collection userIds; - private Collection userRoles; + private Collection userRoles; private Collection sectionIds; private Boolean sectionIsEmpty; private EnumSet authorize = EnumSet.of(AuthorizationFlags.None); - public DmpUserQuery ids(UUID value) { + public PlanUserQuery ids(UUID value) { this.ids = List.of(value); return this; } - public DmpUserQuery ids(UUID... value) { + public PlanUserQuery ids(UUID... value) { this.ids = Arrays.asList(value); return this; } - public DmpUserQuery ids(Collection values) { + public PlanUserQuery ids(Collection values) { this.ids = values; return this; } - public DmpUserQuery isActives(IsActive value) { + public PlanUserQuery isActives(IsActive value) { this.isActives = List.of(value); return this; } - public DmpUserQuery isActives(IsActive... value) { + public PlanUserQuery isActives(IsActive... value) { this.isActives = Arrays.asList(value); return this; } - public DmpUserQuery isActives(Collection values) { + public PlanUserQuery isActives(Collection values) { this.isActives = values; return this; } - public DmpUserQuery dmpIds(UUID value) { - this.dmpIds = List.of(value); + public PlanUserQuery planIds(UUID value) { + this.planIds = List.of(value); return this; } - public DmpUserQuery dmpIds(UUID... value) { - this.dmpIds = Arrays.asList(value); + public PlanUserQuery planIds(UUID... value) { + this.planIds = Arrays.asList(value); return this; } - public DmpUserQuery dmpIds(Collection values) { - this.dmpIds = values; + public PlanUserQuery planIds(Collection values) { + this.planIds = values; return this; } - public DmpUserQuery descriptionIds(UUID value) { + public PlanUserQuery descriptionIds(UUID value) { this.descriptionIds = List.of(value); return this; } - public DmpUserQuery descriptionIds(UUID... value) { + public PlanUserQuery descriptionIds(UUID... value) { this.descriptionIds = Arrays.asList(value); return this; } - public DmpUserQuery descriptionIds(Collection values) { + public PlanUserQuery descriptionIds(Collection values) { this.descriptionIds = values; return this; } - public DmpUserQuery userRoles(DmpUserRole value) { + public PlanUserQuery userRoles(PlanUserRole value) { this.userRoles = List.of(value); return this; } - public DmpUserQuery userRoles(DmpUserRole... value) { + public PlanUserQuery userRoles(PlanUserRole... value) { this.userRoles = Arrays.asList(value); return this; } - public DmpUserQuery userRoles(Collection values) { + public PlanUserQuery userRoles(Collection values) { this.userRoles = values; return this; } - public DmpUserQuery userIds(UUID value) { + public PlanUserQuery userIds(UUID value) { this.userIds = List.of(value); return this; } - public DmpUserQuery userIds(UUID... value) { + public PlanUserQuery userIds(UUID... value) { this.userIds = Arrays.asList(value); return this; } - public DmpUserQuery userIds(Collection values) { + public PlanUserQuery userIds(Collection values) { this.userIds = values; return this; } - public DmpUserQuery sectionIds(UUID value) { + public PlanUserQuery sectionIds(UUID value) { this.sectionIds = List.of(value); return this; } - public DmpUserQuery sectionIds(UUID... value) { + public PlanUserQuery sectionIds(UUID... value) { this.sectionIds = Arrays.asList(value); return this; } - public DmpUserQuery sectionIds(Collection values) { + public PlanUserQuery sectionIds(Collection values) { this.sectionIds = values; return this; } - public DmpUserQuery sectionIsEmpty(Boolean sectionIsEmpty) { + public PlanUserQuery sectionIsEmpty(Boolean sectionIsEmpty) { this.sectionIsEmpty = sectionIsEmpty; return this; } - public DmpUserQuery authorize(EnumSet values) { + public PlanUserQuery authorize(EnumSet values) { this.authorize = values; return this; } - public DmpUserQuery enableTracking() { + public PlanUserQuery enableTracking() { this.noTracking = false; return this; } - public DmpUserQuery disableTracking() { + public PlanUserQuery disableTracking() { this.noTracking = true; return this; } @@ -181,7 +181,7 @@ public class DmpUserQuery extends QueryBase { private final QueryUtilsService queryUtilsService; private final TenantEntityManager tenantEntityManager; - public DmpUserQuery( + public PlanUserQuery( UserScope userScope, AuthorizationService authService, QueryUtilsService queryUtilsService, TenantEntityManager tenantEntityManager) { @@ -197,19 +197,19 @@ public class DmpUserQuery extends QueryBase { } @Override - protected Class entityClass() { - return DmpUserEntity.class; + protected Class entityClass() { + return PlanUserEntity.class; } @Override protected Boolean isFalseQuery() { - return this.isEmpty(this.ids) || this.isEmpty(this.dmpIds) || this.isEmpty(this.descriptionIds) || this.isEmpty(this.userIds); + return this.isEmpty(this.ids) || this.isEmpty(this.planIds) || this.isEmpty(this.descriptionIds) || this.isEmpty(this.userIds); } @Override protected Predicate applyAuthZ(QueryContext queryContext) { if (this.authorize.contains(AuthorizationFlags.None)) return null; - if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowseDmp)) return null; + if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowsePlan)) return null; UUID userId = null; boolean usePublic = this.authorize.contains(AuthorizationFlags.Public); if (this.authorize.contains(AuthorizationFlags.DmpAssociated)) userId = this.userScope.getUserIdSafe(); @@ -217,8 +217,8 @@ public class DmpUserQuery extends QueryBase { List predicates = new ArrayList<>(); if (userId != null || usePublic ) { predicates.add(queryContext.CriteriaBuilder.or( - usePublic ? queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpUserEntity._dmpId)).value(this.queryUtilsService.buildPublicDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, usePublic)) : queryContext.CriteriaBuilder.or(), //Creates a false query - userId != null ? queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpUserEntity._dmpId)).value(this.queryUtilsService.buildDmpUserAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId)) : queryContext.CriteriaBuilder.or() //Creates a false query + usePublic ? queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanUserEntity._planId)).value(this.queryUtilsService.buildPublicDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, usePublic)) : queryContext.CriteriaBuilder.or(), //Creates a false query + userId != null ? queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanUserEntity._planId)).value(this.queryUtilsService.buildDmpUserAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId)) : queryContext.CriteriaBuilder.or() //Creates a false query )); } if (!predicates.isEmpty()) { @@ -233,55 +233,55 @@ public class DmpUserQuery extends QueryBase { protected Predicate applyFilters(QueryContext queryContext) { List predicates = new ArrayList<>(); if (this.ids != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpUserEntity._id)); + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanUserEntity._id)); for (UUID item : this.ids) inClause.value(item); predicates.add(inClause); } if (this.isActives != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpUserEntity._isActive)); + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanUserEntity._isActive)); for (IsActive item : this.isActives) inClause.value(item); predicates.add(inClause); } - if (this.dmpIds != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpUserEntity._dmpId)); - for (UUID item : this.dmpIds) + if (this.planIds != null) { + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanUserEntity._planId)); + for (UUID item : this.planIds) inClause.value(item); predicates.add(inClause); } if (this.sectionIsEmpty != null){ - if(this.sectionIsEmpty) predicates.add(queryContext.CriteriaBuilder.isNull(queryContext.Root.get(DmpUserEntity._sectionId))); - else predicates.add(queryContext.CriteriaBuilder.isNotNull(queryContext.Root.get(DmpUserEntity._sectionId))); + if(this.sectionIsEmpty) predicates.add(queryContext.CriteriaBuilder.isNull(queryContext.Root.get(PlanUserEntity._sectionId))); + else predicates.add(queryContext.CriteriaBuilder.isNotNull(queryContext.Root.get(PlanUserEntity._sectionId))); } if (this.descriptionIds != null) { Subquery descriptionSubquery = this.queryUtilsService.buildSubQuery(new BuildSubQueryInput<>( new BuildSubQueryInput.Builder<>(DescriptionEntity.class, UUID.class, queryContext) - .keyPathFunc((subQueryRoot) -> subQueryRoot.get(DescriptionEntity._dmpId)) + .keyPathFunc((subQueryRoot) -> subQueryRoot.get(DescriptionEntity._planId)) .filterFunc((subQueryRoot, cb) -> { - CriteriaBuilder.In inClause = cb.in(subQueryRoot.get(DmpUserEntity._id)); + CriteriaBuilder.In inClause = cb.in(subQueryRoot.get(PlanUserEntity._id)); for (UUID item : this.descriptionIds) inClause.value(item); return inClause; }) )); - predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpUserEntity._dmpId)).value(descriptionSubquery)); + predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanUserEntity._planId)).value(descriptionSubquery)); } if (this.userIds != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpUserEntity._userId)); + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanUserEntity._userId)); for (UUID item : this.userIds) inClause.value(item); predicates.add(inClause); } if (this.sectionIds != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpUserEntity._sectionId)); + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanUserEntity._sectionId)); for (UUID item : this.sectionIds) inClause.value(item); predicates.add(inClause); } if (this.userRoles != null) { - CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpUserEntity._role)); - for (DmpUserRole item : this.userRoles) + CriteriaBuilder.In inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanUserEntity._role)); + for (PlanUserRole item : this.userRoles) inClause.value(item); predicates.add(inClause); } @@ -294,34 +294,34 @@ public class DmpUserQuery extends QueryBase { } @Override - protected DmpUserEntity convert(Tuple tuple, Set columns) { - DmpUserEntity item = new DmpUserEntity(); - item.setId(QueryBase.convertSafe(tuple, columns, DmpUserEntity._id, UUID.class)); - item.setTenantId(QueryBase.convertSafe(tuple, columns, DmpUserEntity._tenantId, UUID.class)); - item.setDmpId(QueryBase.convertSafe(tuple, columns, DmpUserEntity._dmpId, UUID.class)); - item.setUserId(QueryBase.convertSafe(tuple, columns, DmpUserEntity._userId, UUID.class)); - item.setSectionId(QueryBase.convertSafe(tuple, columns, DmpUserEntity._sectionId, UUID.class)); - item.setRole(QueryBase.convertSafe(tuple, columns, DmpUserEntity._role, DmpUserRole.class)); - item.setCreatedAt(QueryBase.convertSafe(tuple, columns, DmpUserEntity._createdAt, Instant.class)); - item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, DmpUserEntity._updatedAt, Instant.class)); - item.setIsActive(QueryBase.convertSafe(tuple, columns, DmpUserEntity._isActive, IsActive.class)); + protected PlanUserEntity convert(Tuple tuple, Set columns) { + PlanUserEntity item = new PlanUserEntity(); + item.setId(QueryBase.convertSafe(tuple, columns, PlanUserEntity._id, UUID.class)); + item.setTenantId(QueryBase.convertSafe(tuple, columns, PlanUserEntity._tenantId, UUID.class)); + item.setPlanId(QueryBase.convertSafe(tuple, columns, PlanUserEntity._planId, UUID.class)); + item.setUserId(QueryBase.convertSafe(tuple, columns, PlanUserEntity._userId, UUID.class)); + item.setSectionId(QueryBase.convertSafe(tuple, columns, PlanUserEntity._sectionId, UUID.class)); + item.setRole(QueryBase.convertSafe(tuple, columns, PlanUserEntity._role, PlanUserRole.class)); + item.setCreatedAt(QueryBase.convertSafe(tuple, columns, PlanUserEntity._createdAt, Instant.class)); + item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, PlanUserEntity._updatedAt, Instant.class)); + item.setIsActive(QueryBase.convertSafe(tuple, columns, PlanUserEntity._isActive, IsActive.class)); return item; } @Override protected String fieldNameOf(FieldResolver item) { - if (item.match(DmpUser._id) || item.match(PublicDmpUser._id)) return DmpUserEntity._id; - else if (item.prefix(DmpUser._dmp) || item.prefix(PublicDmpUser._dmp)) return DmpUserEntity._dmpId; - else if (item.prefix(DmpUser._user) || item.prefix(PublicDmpUser._user)) return DmpUserEntity._userId; - else if (item.match(DmpUser._role) || item.match(PublicDmpUser._role)) return DmpUserEntity._role; - else if (item.match(DmpUser._sectionId)) return DmpUserEntity._sectionId; - else if (item.match(DmpUser._createdAt)) return DmpUserEntity._createdAt; - else if (item.match(DmpUser._updatedAt)) return DmpUserEntity._updatedAt; - else if (item.match(DmpUser._isActive)) return DmpUserEntity._isActive; - else if (item.match(DmpUser._hash)) return DmpUserEntity._updatedAt; - else if (item.match(DmpUser._dmp)) return DmpUserEntity._dmpId; - else if (item.match(DmpUser._user)) return DmpUserEntity._userId; - else if (item.match(DmpUser._belongsToCurrentTenant)) return DmpUserEntity._tenantId; + if (item.match(PlanUser._id) || item.match(PublicPlanUser._id)) return PlanUserEntity._id; + else if (item.prefix(PlanUser._plan) || item.prefix(PublicPlanUser._plan)) return PlanUserEntity._planId; + else if (item.prefix(PlanUser._user) || item.prefix(PublicPlanUser._user)) return PlanUserEntity._userId; + else if (item.match(PlanUser._role) || item.match(PublicPlanUser._role)) return PlanUserEntity._role; + else if (item.match(PlanUser._sectionId)) return PlanUserEntity._sectionId; + else if (item.match(PlanUser._createdAt)) return PlanUserEntity._createdAt; + else if (item.match(PlanUser._updatedAt)) return PlanUserEntity._updatedAt; + else if (item.match(PlanUser._isActive)) return PlanUserEntity._isActive; + else if (item.match(PlanUser._hash)) return PlanUserEntity._updatedAt; + else if (item.match(PlanUser._plan)) return PlanUserEntity._planId; + else if (item.match(PlanUser._user)) return PlanUserEntity._userId; + else if (item.match(PlanUser._belongsToCurrentTenant)) return PlanUserEntity._tenantId; else return null; } diff --git a/backend/core/src/main/java/org/opencdmp/query/ReferenceQuery.java b/backend/core/src/main/java/org/opencdmp/query/ReferenceQuery.java index 6589e6ca9..7888e0e98 100644 --- a/backend/core/src/main/java/org/opencdmp/query/ReferenceQuery.java +++ b/backend/core/src/main/java/org/opencdmp/query/ReferenceQuery.java @@ -47,7 +47,7 @@ public class ReferenceQuery extends QueryBase { private Instant after; - private DmpReferenceQuery dmpReferenceQuery; + private PlanReferenceQuery planReferenceQuery; private EnumSet authorize = EnumSet.of(AuthorizationFlags.None); @@ -166,8 +166,8 @@ public class ReferenceQuery extends QueryBase { return this; } - public ReferenceQuery dmpReferenceSubQuery(DmpReferenceQuery value) { - this.dmpReferenceQuery = value; + public ReferenceQuery dmpReferenceSubQuery(PlanReferenceQuery value) { + this.planReferenceQuery = value; return this; } @@ -213,7 +213,7 @@ public class ReferenceQuery extends QueryBase { @Override protected Boolean isFalseQuery() { - return this.isEmpty(this.ids) || this.isEmpty(this.isActives) || this.isEmpty(this.sources) || this.isEmpty(this.excludedIds) || this.isEmpty(this.typeIds) || this.isEmpty(this.referenceSourceTypes) || this.isFalseQuery(this.dmpReferenceQuery); + return this.isEmpty(this.ids) || this.isEmpty(this.isActives) || this.isEmpty(this.sources) || this.isEmpty(this.excludedIds) || this.isEmpty(this.typeIds) || this.isEmpty(this.referenceSourceTypes) || this.isFalseQuery(this.planReferenceQuery); } @Override @@ -234,12 +234,12 @@ public class ReferenceQuery extends QueryBase { predicates.add(queryContext.CriteriaBuilder.or( this.authService.authorize(Permission.BrowseExternalReference) ? queryContext.CriteriaBuilder.equal(queryContext.Root.get(ReferenceEntity._sourceType), ReferenceSourceType.External) : queryContext.CriteriaBuilder.or(), userId != null ? queryContext.CriteriaBuilder.equal(queryContext.Root.get(ReferenceEntity._createdById), userId) : queryContext.CriteriaBuilder.or(), //Creates a false query - queryContext.CriteriaBuilder.in(queryContext.Root.get(ReferenceEntity._id)).value(this.queryUtilsService.buildSubQuery(new BuildSubQueryInput<>(new BuildSubQueryInput.Builder<>(DmpReferenceEntity.class, UUID.class) + queryContext.CriteriaBuilder.in(queryContext.Root.get(ReferenceEntity._id)).value(this.queryUtilsService.buildSubQuery(new BuildSubQueryInput<>(new BuildSubQueryInput.Builder<>(PlanReferenceEntity.class, UUID.class) .query(queryContext.Query) .criteriaBuilder(queryContext.CriteriaBuilder) - .keyPathFunc((subQueryRoot) -> subQueryRoot.get(DmpReferenceEntity._referenceId)) + .keyPathFunc((subQueryRoot) -> subQueryRoot.get(PlanReferenceEntity._referenceId)) .filterFunc((subQueryRoot, cb) -> - cb.in(subQueryRoot.get(DmpReferenceEntity._dmpId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic)) + cb.in(subQueryRoot.get(PlanReferenceEntity._planId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic)) ) ))), queryContext.CriteriaBuilder.in(queryContext.Root.get(ReferenceEntity._id)).value(this.queryUtilsService.buildSubQuery(new BuildSubQueryInput<>(new BuildSubQueryInput.Builder<>(DescriptionReferenceEntity.class, UUID.class) @@ -312,13 +312,13 @@ public class ReferenceQuery extends QueryBase { predicates.add(notInClause.not()); } if (this.after != null) { - Predicate afterClause = queryContext.CriteriaBuilder.greaterThanOrEqualTo(queryContext.Root.get(DmpEntity._createdAt), this.after); + Predicate afterClause = queryContext.CriteriaBuilder.greaterThanOrEqualTo(queryContext.Root.get(PlanEntity._createdAt), this.after); predicates.add(afterClause); } - if (this.dmpReferenceQuery != null) { - QueryContext subQuery = this.applySubQuery(this.dmpReferenceQuery, queryContext, UUID.class, root -> root.get(DmpReferenceEntity._referenceId)); - predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpReferenceEntity._id)).value(subQuery.Query)); + if (this.planReferenceQuery != null) { + QueryContext subQuery = this.applySubQuery(this.planReferenceQuery, queryContext, UUID.class, root -> root.get(PlanReferenceEntity._referenceId)); + predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanReferenceEntity._id)).value(subQuery.Query)); } if (!predicates.isEmpty()) { Predicate[] predicatesArray = predicates.toArray(new Predicate[0]); diff --git a/backend/core/src/main/java/org/opencdmp/query/UserContactInfoQuery.java b/backend/core/src/main/java/org/opencdmp/query/UserContactInfoQuery.java index f40423fd6..3ee6c1dd4 100644 --- a/backend/core/src/main/java/org/opencdmp/query/UserContactInfoQuery.java +++ b/backend/core/src/main/java/org/opencdmp/query/UserContactInfoQuery.java @@ -12,7 +12,7 @@ import org.opencdmp.authorization.AuthorizationFlags; import org.opencdmp.authorization.Permission; import org.opencdmp.commons.enums.ContactInfoType; import org.opencdmp.commons.scope.user.UserScope; -import org.opencdmp.data.DmpUserEntity; +import org.opencdmp.data.PlanUserEntity; import org.opencdmp.data.TenantEntityManager; import org.opencdmp.data.UserContactInfoEntity; import org.opencdmp.model.UserContactInfo; @@ -183,12 +183,12 @@ public class UserContactInfoQuery extends QueryBase { if (userId != null) { predicates.add(queryContext.CriteriaBuilder.or( queryContext.CriteriaBuilder.in(queryContext.Root.get(UserContactInfoEntity._userId)).value(userId), //Creates a false query - queryContext.CriteriaBuilder.in(queryContext.Root.get(UserContactInfoEntity._userId)).value(this.queryUtilsService.buildSubQuery(new BuildSubQueryInput<>(new BuildSubQueryInput.Builder<>(DmpUserEntity.class, UUID.class) + queryContext.CriteriaBuilder.in(queryContext.Root.get(UserContactInfoEntity._userId)).value(this.queryUtilsService.buildSubQuery(new BuildSubQueryInput<>(new BuildSubQueryInput.Builder<>(PlanUserEntity.class, UUID.class) .query(queryContext.Query) .criteriaBuilder(queryContext.CriteriaBuilder) - .keyPathFunc((subQueryRoot) -> subQueryRoot.get(DmpUserEntity._userId)) + .keyPathFunc((subQueryRoot) -> subQueryRoot.get(PlanUserEntity._userId)) .filterFunc((subQueryRoot, cb) -> - cb.in(subQueryRoot.get(DmpUserEntity._dmpId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, false)) + cb.in(subQueryRoot.get(PlanUserEntity._planId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, false)) ) ))) )); diff --git a/backend/core/src/main/java/org/opencdmp/query/UserQuery.java b/backend/core/src/main/java/org/opencdmp/query/UserQuery.java index d02b2fc4c..06c6cb0dc 100644 --- a/backend/core/src/main/java/org/opencdmp/query/UserQuery.java +++ b/backend/core/src/main/java/org/opencdmp/query/UserQuery.java @@ -30,7 +30,7 @@ import java.util.*; @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class UserQuery extends QueryBase { private String like; - private Boolean dmpAssociated; + private Boolean planAssociated; private Collection ids; private Collection emails; private Collection excludedIds; @@ -126,8 +126,8 @@ public class UserQuery extends QueryBase { return this; } - public UserQuery dmpAssociated(Boolean dmpAssociated) { - this.dmpAssociated = dmpAssociated; + public UserQuery planAssociated(Boolean planAssociated) { + this.planAssociated = planAssociated; return this; } @@ -183,12 +183,12 @@ public class UserQuery extends QueryBase { UUID finalUserId = userId; predicates.add(queryContext.CriteriaBuilder.or( userId != null ? queryContext.CriteriaBuilder.in(queryContext.Root.get(UserEntity._id)).value(userId) : queryContext.CriteriaBuilder.or(), //Creates a false query - queryContext.CriteriaBuilder.in(queryContext.Root.get(UserEntity._id)).value(this.queryUtilsService.buildSubQuery(new BuildSubQueryInput<>(new BuildSubQueryInput.Builder<>(DmpUserEntity.class, UUID.class) + queryContext.CriteriaBuilder.in(queryContext.Root.get(UserEntity._id)).value(this.queryUtilsService.buildSubQuery(new BuildSubQueryInput<>(new BuildSubQueryInput.Builder<>(PlanUserEntity.class, UUID.class) .query(queryContext.Query) .criteriaBuilder(queryContext.CriteriaBuilder) - .keyPathFunc((subQueryRoot) -> subQueryRoot.get(DmpUserEntity._userId)) + .keyPathFunc((subQueryRoot) -> subQueryRoot.get(PlanUserEntity._userId)) .filterFunc((subQueryRoot, cb) -> - cb.in(subQueryRoot.get(DmpUserEntity._dmpId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, finalUserId, usePublic)) + cb.in(subQueryRoot.get(PlanUserEntity._planId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, finalUserId, usePublic)) ) ))), queryContext.CriteriaBuilder.in(queryContext.Root.get(UserEntity._id)).value(this.queryUtilsService.buildSubQuery(new BuildSubQueryInput<>(new BuildSubQueryInput.Builder<>(UserDescriptionTemplateEntity.class, UUID.class) @@ -255,17 +255,17 @@ public class UserQuery extends QueryBase { QueryContext subQuery = this.applySubQuery(this.tenantUserQuery, queryContext, UUID.class, tenantUserEntityRoot -> tenantUserEntityRoot.get(TenantUserEntity._userId)); predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(UserEntity._id)).value(subQuery.Query)); } - if (this.dmpAssociated != null){ + if (this.planAssociated != null){ UUID userId; if (this.userScope.isSet()) userId = this.userScope.getUserIdSafe(); else throw new MyNotFoundException("Only user scoped allowed"); Subquery dmpUserUserQuery = this.queryUtilsService.buildSubQuery(new BuildSubQueryInput<>( - new BuildSubQueryInput.Builder<>(DmpUserEntity.class, UUID.class, queryContext) - .keyPathFunc((subQueryRoot) -> subQueryRoot.get(DmpUserEntity._userId)) + new BuildSubQueryInput.Builder<>(PlanUserEntity.class, UUID.class, queryContext) + .keyPathFunc((subQueryRoot) -> subQueryRoot.get(PlanUserEntity._userId)) .filterFunc((subQueryRoot, cb) -> cb.and( - cb.in(subQueryRoot.get(DmpUserEntity._dmpId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, false)) , - cb.equal(subQueryRoot.get(DmpUserEntity._isActive), IsActive.Active) + cb.in(subQueryRoot.get(PlanUserEntity._planId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, false)) , + cb.equal(subQueryRoot.get(PlanUserEntity._isActive), IsActive.Active) )) )); predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(UserEntity._id)).value(dmpUserUserQuery)); diff --git a/backend/core/src/main/java/org/opencdmp/query/lookup/DescriptionLookup.java b/backend/core/src/main/java/org/opencdmp/query/lookup/DescriptionLookup.java index 59867f460..f79f9d5f2 100644 --- a/backend/core/src/main/java/org/opencdmp/query/lookup/DescriptionLookup.java +++ b/backend/core/src/main/java/org/opencdmp/query/lookup/DescriptionLookup.java @@ -24,7 +24,7 @@ public class DescriptionLookup extends Lookup { private Instant finalizedAfter; private Instant finalizedBefore; - private DmpLookup dmpSubQuery; + private PlanLookup planSubQuery; private DescriptionTemplateLookup descriptionTemplateSubQuery; private DescriptionReferenceLookup descriptionReferenceSubQuery; private DescriptionTagLookup descriptionTagSubQuery; @@ -73,11 +73,11 @@ public class DescriptionLookup extends Lookup { this.statuses = statuses; } - public DmpLookup getDmpSubQuery() { - return this.dmpSubQuery; + public PlanLookup getPlanSubQuery() { + return this.planSubQuery; } - public void setDmpSubQuery(DmpLookup dmpSubQuery) { this.dmpSubQuery = dmpSubQuery; } + public void setPlanSubQuery(PlanLookup planSubQuery) { this.planSubQuery = planSubQuery; } public DescriptionTemplateLookup getDescriptionTemplateSubQuery() { return this.descriptionTemplateSubQuery; } @@ -128,7 +128,7 @@ public class DescriptionLookup extends Lookup { if (this.like != null) query.like(this.like); if (this.ids != null) query.ids(this.ids); if (this.excludedIds != null) query.excludedIds(this.excludedIds); - if (this.dmpSubQuery != null) query.dmpSubQuery(this.dmpSubQuery.enrich(queryFactory)); + if (this.planSubQuery != null) query.dmpSubQuery(this.planSubQuery.enrich(queryFactory)); if (this.descriptionTemplateSubQuery != null) query.descriptionTemplateSubQuery(this.descriptionTemplateSubQuery.enrich(queryFactory)); if (this.descriptionReferenceSubQuery != null) query.descriptionReferenceSubQuery(this.descriptionReferenceSubQuery.enrich(queryFactory)); if (this.descriptionTagSubQuery != null) query.descriptionTagSubQuery(this.descriptionTagSubQuery.enrich(queryFactory)); @@ -154,7 +154,7 @@ public class DescriptionLookup extends Lookup { if (this.createdBefore != null) query.createdBefore(this.createdBefore); if (this.finalizedAfter != null) query.finalizedAfter(this.finalizedAfter); if (this.finalizedBefore != null) query.finalizedBefore(this.finalizedBefore); - if (this.dmpSubQuery != null) query.dmpSubQuery(this.dmpSubQuery.enrichElasticInner(queryFactory)); + if (this.planSubQuery != null) query.planSubQuery(this.planSubQuery.enrichElasticInner(queryFactory)); // TODO: add reference ? this.enrichCommon(query); diff --git a/backend/core/src/main/java/org/opencdmp/query/lookup/DmpBlueprintLookup.java b/backend/core/src/main/java/org/opencdmp/query/lookup/PlanBlueprintLookup.java similarity index 72% rename from backend/core/src/main/java/org/opencdmp/query/lookup/DmpBlueprintLookup.java rename to backend/core/src/main/java/org/opencdmp/query/lookup/PlanBlueprintLookup.java index 414472427..4a614cb29 100644 --- a/backend/core/src/main/java/org/opencdmp/query/lookup/DmpBlueprintLookup.java +++ b/backend/core/src/main/java/org/opencdmp/query/lookup/PlanBlueprintLookup.java @@ -1,22 +1,22 @@ package org.opencdmp.query.lookup; -import org.opencdmp.commons.enums.DmpBlueprintStatus; -import org.opencdmp.commons.enums.DmpBlueprintVersionStatus; +import org.opencdmp.commons.enums.PlanBlueprintStatus; +import org.opencdmp.commons.enums.PlanBlueprintVersionStatus; import org.opencdmp.commons.enums.IsActive; -import org.opencdmp.query.DmpBlueprintQuery; +import org.opencdmp.query.PlanBlueprintQuery; import gr.cite.tools.data.query.Lookup; import gr.cite.tools.data.query.QueryFactory; import java.util.List; import java.util.UUID; -public class DmpBlueprintLookup extends Lookup { +public class PlanBlueprintLookup extends Lookup { private String like; private List isActive; - private List statuses; + private List statuses; private List ids; @@ -24,7 +24,7 @@ public class DmpBlueprintLookup extends Lookup { private List groupIds; - private List versionStatuses; + private List versionStatuses; public String getLike() { return like; @@ -42,11 +42,11 @@ public class DmpBlueprintLookup extends Lookup { this.isActive = isActive; } - public List getStatuses() { + public List getStatuses() { return statuses; } - public void setStatuses(List statuses) { + public void setStatuses(List statuses) { this.statuses = statuses; } @@ -66,11 +66,11 @@ public class DmpBlueprintLookup extends Lookup { this.excludedIds = excludedIds; } - public List getVersionStatuses() { + public List getVersionStatuses() { return versionStatuses; } - public void setVersionStatuses(List versionStatuses) { + public void setVersionStatuses(List versionStatuses) { this.versionStatuses = versionStatuses; } @@ -82,8 +82,8 @@ public class DmpBlueprintLookup extends Lookup { this.groupIds = groupIds; } - public DmpBlueprintQuery enrich(QueryFactory queryFactory) { - DmpBlueprintQuery query = queryFactory.query(DmpBlueprintQuery.class); + public PlanBlueprintQuery enrich(QueryFactory queryFactory) { + PlanBlueprintQuery query = queryFactory.query(PlanBlueprintQuery.class); if (this.like != null) query.like(this.like); if (this.isActive != null) diff --git a/backend/core/src/main/java/org/opencdmp/query/lookup/DmpDescriptionTemplateLookup.java b/backend/core/src/main/java/org/opencdmp/query/lookup/PlanDescriptionTemplateLookup.java similarity index 71% rename from backend/core/src/main/java/org/opencdmp/query/lookup/DmpDescriptionTemplateLookup.java rename to backend/core/src/main/java/org/opencdmp/query/lookup/PlanDescriptionTemplateLookup.java index bac88a1eb..2d456cc6b 100644 --- a/backend/core/src/main/java/org/opencdmp/query/lookup/DmpDescriptionTemplateLookup.java +++ b/backend/core/src/main/java/org/opencdmp/query/lookup/PlanDescriptionTemplateLookup.java @@ -3,16 +3,16 @@ package org.opencdmp.query.lookup; import gr.cite.tools.data.query.Lookup; import gr.cite.tools.data.query.QueryFactory; import org.opencdmp.commons.enums.IsActive; -import org.opencdmp.elastic.query.NestedDmpDescriptionTemplateElasticQuery; -import org.opencdmp.query.DmpDescriptionTemplateQuery; +import org.opencdmp.elastic.query.NestedPlanDescriptionTemplateElasticQuery; +import org.opencdmp.query.PlanDescriptionTemplateQuery; import java.util.List; import java.util.UUID; -public class DmpDescriptionTemplateLookup extends Lookup { +public class PlanDescriptionTemplateLookup extends Lookup { private List ids; - private List dmpIds; + private List planIds; private List descriptionTemplateGroupIds; private List sectionIds; @@ -44,12 +44,12 @@ public class DmpDescriptionTemplateLookup extends Lookup { this.isActive = isActive; } - public List getDmpIds() { - return this.dmpIds; + public List getPlanIds() { + return this.planIds; } - public void setDmpIds(List dmpIds) { - this.dmpIds = dmpIds; + public void setPlanIds(List planIds) { + this.planIds = planIds; } public List getDescriptionTemplateGroupIds() { @@ -68,10 +68,10 @@ public class DmpDescriptionTemplateLookup extends Lookup { this.descriptionTemplateGroupIds = descriptionTemplateGroupIds; } - public DmpDescriptionTemplateQuery enrich(QueryFactory queryFactory) { - DmpDescriptionTemplateQuery query = queryFactory.query(DmpDescriptionTemplateQuery.class); + public PlanDescriptionTemplateQuery enrich(QueryFactory queryFactory) { + PlanDescriptionTemplateQuery query = queryFactory.query(PlanDescriptionTemplateQuery.class); if (this.ids != null) query.ids(this.ids); - if (this.dmpIds != null) query.ids(this.dmpIds); + if (this.planIds != null) query.planIds(this.planIds); if (this.descriptionTemplateGroupIds != null) query.descriptionTemplateGroupIds(this.descriptionTemplateGroupIds); if (this.sectionIds != null) query.sectionIds(this.sectionIds); if (this.excludedIds != null) query.excludedIds(this.excludedIds); @@ -82,10 +82,10 @@ public class DmpDescriptionTemplateLookup extends Lookup { return query; } - public NestedDmpDescriptionTemplateElasticQuery enrichElasticInner(QueryFactory queryFactory) { - NestedDmpDescriptionTemplateElasticQuery query = queryFactory.query(NestedDmpDescriptionTemplateElasticQuery.class); + public NestedPlanDescriptionTemplateElasticQuery enrichElasticInner(QueryFactory queryFactory) { + NestedPlanDescriptionTemplateElasticQuery query = queryFactory.query(NestedPlanDescriptionTemplateElasticQuery.class); if (this.ids != null) query.ids(this.ids); - if (this.dmpIds != null) query.dmpIds(this.dmpIds); + if (this.planIds != null) query.planIds(this.planIds); if (this.descriptionTemplateGroupIds != null) query.descriptionTemplateGroupIds(this.descriptionTemplateGroupIds); if (this.sectionIds != null) query.sectionIds(this.sectionIds); if (this.excludedIds != null) query.descriptionTemplateGroupIds(this.excludedIds); diff --git a/backend/core/src/main/java/org/opencdmp/query/lookup/DmpLookup.java b/backend/core/src/main/java/org/opencdmp/query/lookup/PlanLookup.java similarity index 54% rename from backend/core/src/main/java/org/opencdmp/query/lookup/DmpLookup.java rename to backend/core/src/main/java/org/opencdmp/query/lookup/PlanLookup.java index 8a61e38eb..5417e4d14 100644 --- a/backend/core/src/main/java/org/opencdmp/query/lookup/DmpLookup.java +++ b/backend/core/src/main/java/org/opencdmp/query/lookup/PlanLookup.java @@ -3,18 +3,18 @@ package org.opencdmp.query.lookup; import gr.cite.tools.data.query.Lookup; import gr.cite.tools.data.query.QueryFactory; import org.apache.commons.lang3.StringUtils; -import org.opencdmp.commons.enums.DmpAccessType; -import org.opencdmp.commons.enums.DmpStatus; -import org.opencdmp.commons.enums.DmpVersionStatus; +import org.opencdmp.commons.enums.PlanAccessType; +import org.opencdmp.commons.enums.PlanStatus; +import org.opencdmp.commons.enums.PlanVersionStatus; import org.opencdmp.commons.enums.IsActive; -import org.opencdmp.elastic.query.DmpElasticQuery; +import org.opencdmp.elastic.query.PlanElasticQuery; import org.opencdmp.elastic.query.InnerObjectDmpElasticQuery; -import org.opencdmp.query.DmpQuery; +import org.opencdmp.query.PlanQuery; import java.util.List; import java.util.UUID; -public class DmpLookup extends Lookup { +public class PlanLookup extends Lookup { private String like; @@ -24,17 +24,17 @@ public class DmpLookup extends Lookup { private List groupIds; private List isActive; - private List versionStatuses; + private List versionStatuses; - private List statuses; - private List accessTypes; + private List statuses; + private List accessTypes; private List versions; - private DmpDescriptionTemplateLookup dmpDescriptionTemplateSubQuery; - private DmpUserLookup dmpUserSubQuery; - private DmpBlueprintLookup dmpBlueprintSubQuery; - private DmpReferenceLookup dmpReferenceSubQuery; + private PlanDescriptionTemplateLookup planDescriptionTemplateSubQuery; + private PlanUserLookup planUserSubQuery; + private PlanBlueprintLookup planBlueprintSubQuery; + private PlanReferenceLookup planReferenceSubQuery; public String getLike() { return this.like; @@ -68,11 +68,11 @@ public class DmpLookup extends Lookup { this.isActive = isActive; } - public List getStatuses() { + public List getStatuses() { return this.statuses; } - public void setStatuses(List statuses) { + public void setStatuses(List statuses) { this.statuses = statuses; } @@ -84,28 +84,28 @@ public class DmpLookup extends Lookup { this.versions = versions; } - public List getAccessTypes() { + public List getAccessTypes() { return this.accessTypes; } - public void setAccessTypes(List accessTypes) { + public void setAccessTypes(List accessTypes) { this.accessTypes = accessTypes; } - public List getVersionStatuses() { + public List getVersionStatuses() { return this.versionStatuses; } - public void setVersionStatuses(List versionStatuses) { + public void setVersionStatuses(List versionStatuses) { this.versionStatuses = versionStatuses; } - public DmpDescriptionTemplateLookup getDmpDescriptionTemplateSubQuery() { - return this.dmpDescriptionTemplateSubQuery; + public PlanDescriptionTemplateLookup getPlanDescriptionTemplateSubQuery() { + return this.planDescriptionTemplateSubQuery; } - public void setDmpDescriptionTemplateSubQuery(DmpDescriptionTemplateLookup dmpDescriptionTemplateSubQuery) { - this.dmpDescriptionTemplateSubQuery = dmpDescriptionTemplateSubQuery; + public void setPlanDescriptionTemplateSubQuery(PlanDescriptionTemplateLookup planDescriptionTemplateSubQuery) { + this.planDescriptionTemplateSubQuery = planDescriptionTemplateSubQuery; } public List getGroupIds() { @@ -116,25 +116,25 @@ public class DmpLookup extends Lookup { this.groupIds = groupIds; } - public DmpUserLookup getDmpUserSubQuery() { - return this.dmpUserSubQuery; + public PlanUserLookup getPlanUserSubQuery() { + return this.planUserSubQuery; } - public void setDmpUserSubQuery(DmpUserLookup dmpUserSubQuery) { - this.dmpUserSubQuery = dmpUserSubQuery; + public void setPlanUserSubQuery(PlanUserLookup planUserSubQuery) { + this.planUserSubQuery = planUserSubQuery; } - public DmpBlueprintLookup getDmpBlueprintSubQuery() { return this.dmpBlueprintSubQuery; } + public PlanBlueprintLookup getPlanBlueprintSubQuery() { return this.planBlueprintSubQuery; } - public void setDmpBlueprintLookup(DmpBlueprintLookup dmpBlueprintSubQuery) { this.dmpBlueprintSubQuery = dmpBlueprintSubQuery; } + public void setPlanBlueprintLookup(PlanBlueprintLookup dmpBlueprintSubQuery) { this.planBlueprintSubQuery = dmpBlueprintSubQuery; } - public DmpReferenceLookup getDmpReferenceSubQuery() { return this.dmpReferenceSubQuery; } + public PlanReferenceLookup getPlanReferenceSubQuery() { return this.planReferenceSubQuery; } - public void setDmpReferenceLookup(DmpReferenceLookup dmpReferenceSubQuery) { this.dmpReferenceSubQuery = dmpReferenceSubQuery; } + public void setPlanReferenceLookup(PlanReferenceLookup dmpReferenceSubQuery) { this.planReferenceSubQuery = dmpReferenceSubQuery; } - public DmpQuery enrich(QueryFactory queryFactory) { - DmpQuery query = queryFactory.query(DmpQuery.class); + public PlanQuery enrich(QueryFactory queryFactory) { + PlanQuery query = queryFactory.query(PlanQuery.class); if (this.like != null) query.like(this.like); if (this.ids != null) query.ids(this.ids); if (this.groupIds != null) query.groupIds(this.groupIds); @@ -144,18 +144,18 @@ public class DmpLookup extends Lookup { if (this.statuses != null) query.statuses(this.statuses); if (this.versions != null) query.versions(this.versions); if (this.versionStatuses != null) query.versionStatuses(this.versionStatuses); - if (this.dmpDescriptionTemplateSubQuery != null) query.dmpDescriptionTemplateSubQuery(this.dmpDescriptionTemplateSubQuery.enrich(queryFactory)); - if (this.dmpUserSubQuery != null) query.dmpUserSubQuery(this.dmpUserSubQuery.enrich(queryFactory)); - if (this.dmpBlueprintSubQuery != null) query.dmpBlueprintSubQuery(this.dmpBlueprintSubQuery.enrich(queryFactory)); - if (this.dmpReferenceSubQuery != null) query.dmpReferenceSubQuery(this.dmpReferenceSubQuery.enrich(queryFactory)); + if (this.planDescriptionTemplateSubQuery != null) query.planDescriptionTemplateSubQuery(this.planDescriptionTemplateSubQuery.enrich(queryFactory)); + if (this.planUserSubQuery != null) query.planUserSubQuery(this.planUserSubQuery.enrich(queryFactory)); + if (this.planBlueprintSubQuery != null) query.planBlueprintSubQuery(this.planBlueprintSubQuery.enrich(queryFactory)); + if (this.planReferenceSubQuery != null) query.planReferenceSubQuery(this.planReferenceSubQuery.enrich(queryFactory)); this.enrichCommon(query); return query; } - public DmpElasticQuery enrichElastic(QueryFactory queryFactory) { - DmpElasticQuery query = queryFactory.query(DmpElasticQuery.class); + public PlanElasticQuery enrichElastic(QueryFactory queryFactory) { + PlanElasticQuery query = queryFactory.query(PlanElasticQuery.class); if (this.like != null) query.like(StringUtils.strip(this.like, "%")); if (this.ids != null) query.ids(this.ids); if (this.groupIds != null) query.groupIds(this.groupIds); @@ -164,8 +164,8 @@ public class DmpLookup extends Lookup { if (this.statuses != null) query.statuses(this.statuses); if (this.versions != null) query.versions(this.versions); if (this.versionStatuses != null) query.versionStatuses(this.versionStatuses); - if (this.dmpDescriptionTemplateSubQuery != null) query.dmpDescriptionTemplateSubQuery(this.dmpDescriptionTemplateSubQuery.enrichElasticInner(queryFactory)); - if (this.dmpUserSubQuery != null) query.dmpSubQuery(this.dmpUserSubQuery.enrichElasticInner(queryFactory)); + if (this.planDescriptionTemplateSubQuery != null) query.planDescriptionTemplateSubQuery(this.planDescriptionTemplateSubQuery.enrichElasticInner(queryFactory)); + if (this.planUserSubQuery != null) query.planSubQuery(this.planUserSubQuery.enrichElasticInner(queryFactory)); // TODO ?? this.enrichCommon(query); @@ -182,8 +182,8 @@ public class DmpLookup extends Lookup { if (this.statuses != null) query.statuses(this.statuses); if (this.versions != null) query.versions(this.versions); if (this.versionStatuses != null) query.versionStatuses(this.versionStatuses); - if (this.dmpDescriptionTemplateSubQuery != null) throw new UnsupportedOperationException(""); - if (this.dmpUserSubQuery != null) query.dmpSubQuery(this.dmpUserSubQuery.enrichElasticInner(queryFactory)); + if (this.planDescriptionTemplateSubQuery != null) throw new UnsupportedOperationException(""); + if (this.planUserSubQuery != null) query.dmpSubQuery(this.planUserSubQuery.enrichElasticInner(queryFactory)); // TODO ?? return query; } diff --git a/backend/core/src/main/java/org/opencdmp/query/lookup/DmpReferenceLookup.java b/backend/core/src/main/java/org/opencdmp/query/lookup/PlanReferenceLookup.java similarity index 60% rename from backend/core/src/main/java/org/opencdmp/query/lookup/DmpReferenceLookup.java rename to backend/core/src/main/java/org/opencdmp/query/lookup/PlanReferenceLookup.java index 3822d378f..60de6bf35 100644 --- a/backend/core/src/main/java/org/opencdmp/query/lookup/DmpReferenceLookup.java +++ b/backend/core/src/main/java/org/opencdmp/query/lookup/PlanReferenceLookup.java @@ -1,18 +1,17 @@ package org.opencdmp.query.lookup; -import org.opencdmp.query.DmpReferenceQuery; +import org.opencdmp.query.PlanReferenceQuery; import gr.cite.tools.data.query.Lookup; import gr.cite.tools.data.query.QueryFactory; -import java.util.Collection; import java.util.List; import java.util.UUID; -public class DmpReferenceLookup extends Lookup { +public class PlanReferenceLookup extends Lookup { private List ids; - private List dmpIds; + private List planIds; private List referenceIds; @@ -24,12 +23,12 @@ public class DmpReferenceLookup extends Lookup { this.ids = ids; } - public List getDmpIds() { - return dmpIds; + public List getPlanIds() { + return planIds; } - public void setDmpIds(List dmpIds) { - this.dmpIds = dmpIds; + public void setPlanIds(List planIds) { + this.planIds = planIds; } public List getReferenceIds() { @@ -40,10 +39,10 @@ public class DmpReferenceLookup extends Lookup { this.referenceIds = referenceIds; } - public DmpReferenceQuery enrich(QueryFactory queryFactory) { - DmpReferenceQuery query = queryFactory.query(DmpReferenceQuery.class); + public PlanReferenceQuery enrich(QueryFactory queryFactory) { + PlanReferenceQuery query = queryFactory.query(PlanReferenceQuery.class); if (this.ids != null) query.ids(this.ids); - if (this.dmpIds != null) query.dmpIds(this.dmpIds); + if (this.planIds != null) query.planIds(this.planIds); if (this.referenceIds != null) query.referenceIds(this.referenceIds); this.enrichCommon(query); diff --git a/backend/core/src/main/java/org/opencdmp/query/lookup/DmpUserLookup.java b/backend/core/src/main/java/org/opencdmp/query/lookup/PlanUserLookup.java similarity index 75% rename from backend/core/src/main/java/org/opencdmp/query/lookup/DmpUserLookup.java rename to backend/core/src/main/java/org/opencdmp/query/lookup/PlanUserLookup.java index fe10576b5..b2dec8dcd 100644 --- a/backend/core/src/main/java/org/opencdmp/query/lookup/DmpUserLookup.java +++ b/backend/core/src/main/java/org/opencdmp/query/lookup/PlanUserLookup.java @@ -2,25 +2,25 @@ package org.opencdmp.query.lookup; import gr.cite.tools.data.query.Lookup; import gr.cite.tools.data.query.QueryFactory; -import org.opencdmp.commons.enums.DmpUserRole; +import org.opencdmp.commons.enums.PlanUserRole; import org.opencdmp.commons.enums.IsActive; import org.opencdmp.elastic.query.NestedCollaboratorElasticQuery; -import org.opencdmp.query.DmpUserQuery; +import org.opencdmp.query.PlanUserQuery; import java.util.List; import java.util.UUID; -public class DmpUserLookup extends Lookup { +public class PlanUserLookup extends Lookup { private List ids; - private List dmpIds; + private List planIds; private List userIds; private List sectionIds; private List isActive; - private List userRoles; + private List userRoles; public List getIds() { return this.ids; @@ -30,12 +30,12 @@ public class DmpUserLookup extends Lookup { this.ids = ids; } - public List getDmpIds() { - return this.dmpIds; + public List getPlanIds() { + return this.planIds; } - public void setDmpIds(List dmpIds) { - this.dmpIds = dmpIds; + public void setPlanIds(List planIds) { + this.planIds = planIds; } public List getUserIds() { @@ -62,18 +62,18 @@ public class DmpUserLookup extends Lookup { this.isActive = isActive; } - public List getUserRoles() { + public List getUserRoles() { return this.userRoles; } - public void setUserRoles(List userRoles) { + public void setUserRoles(List userRoles) { this.userRoles = userRoles; } - public DmpUserQuery enrich(QueryFactory queryFactory) { - DmpUserQuery query = queryFactory.query(DmpUserQuery.class); + public PlanUserQuery enrich(QueryFactory queryFactory) { + PlanUserQuery query = queryFactory.query(PlanUserQuery.class); if (this.ids != null) query.ids(this.ids); - if (this.dmpIds != null) query.dmpIds(this.dmpIds); + if (this.planIds != null) query.planIds(this.planIds); if (this.userIds != null) query.userIds(this.userIds); if (this.userRoles != null) query.userRoles(this.userRoles); if (this.sectionIds != null) query.sectionIds(this.sectionIds); diff --git a/backend/core/src/main/java/org/opencdmp/query/utils/QueryUtilsServiceImpl.java b/backend/core/src/main/java/org/opencdmp/query/utils/QueryUtilsServiceImpl.java index e5b338f2e..980930509 100644 --- a/backend/core/src/main/java/org/opencdmp/query/utils/QueryUtilsServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/query/utils/QueryUtilsServiceImpl.java @@ -3,12 +3,12 @@ package org.opencdmp.query.utils; import jakarta.persistence.criteria.*; import org.hibernate.query.criteria.HibernateCriteriaBuilder; import org.opencdmp.commons.enums.DescriptionStatus; -import org.opencdmp.commons.enums.DmpAccessType; -import org.opencdmp.commons.enums.DmpStatus; +import org.opencdmp.commons.enums.PlanAccessType; +import org.opencdmp.commons.enums.PlanStatus; import org.opencdmp.commons.enums.IsActive; import org.opencdmp.data.DescriptionEntity; -import org.opencdmp.data.DmpEntity; -import org.opencdmp.data.DmpUserEntity; +import org.opencdmp.data.PlanEntity; +import org.opencdmp.data.PlanUserEntity; import org.opencdmp.data.UserDescriptionTemplateEntity; import org.springframework.stereotype.Component; @@ -28,17 +28,17 @@ public class QueryUtilsServiceImpl implements QueryUtilsService { @Override public Subquery buildDmpAuthZSubQuery(AbstractQuery query, CriteriaBuilder criteriaBuilder, UUID userId, Boolean usePublic){ return this.buildSubQuery(new BuildSubQueryInput<>( - new BuildSubQueryInput.Builder<>(DmpEntity.class, UUID.class) + new BuildSubQueryInput.Builder<>(PlanEntity.class, UUID.class) .query(query) .criteriaBuilder(criteriaBuilder) - .keyPathFunc((subQueryRoot) -> subQueryRoot.get(DmpEntity._id)) + .keyPathFunc((subQueryRoot) -> subQueryRoot.get(PlanEntity._id)) .filterFunc((subQueryRoot, cb) -> cb.or( usePublic ? cb.and( - cb.equal(subQueryRoot.get(DmpEntity._accessType), DmpAccessType.Public), - cb.equal(subQueryRoot.get(DmpEntity._status), DmpStatus.Finalized), - cb.equal(subQueryRoot.get(DmpEntity._isActive), IsActive.Active) + cb.equal(subQueryRoot.get(PlanEntity._accessType), PlanAccessType.Public), + cb.equal(subQueryRoot.get(PlanEntity._status), PlanStatus.Finalized), + cb.equal(subQueryRoot.get(PlanEntity._isActive), IsActive.Active) ): cb.or(), //Creates a false query - userId != null ? cb.in(subQueryRoot.get(DmpEntity._id)).value(this.buildDmpUserAuthZSubQuery(query, criteriaBuilder, userId)) : cb.or() //Creates a false query + userId != null ? cb.in(subQueryRoot.get(PlanEntity._id)).value(this.buildDmpUserAuthZSubQuery(query, criteriaBuilder, userId)) : cb.or() //Creates a false query ) ) )); @@ -53,8 +53,8 @@ public class QueryUtilsServiceImpl implements QueryUtilsService { .keyPathFunc((subQueryRoot) -> subQueryRoot.get(UserDescriptionTemplateEntity._descriptionTemplateId)) .filterFunc((subQueryRoot, cb) -> userId != null ? cb.and( - cb.equal(subQueryRoot.get(DmpUserEntity._userId), userId), - cb.equal(subQueryRoot.get(DmpUserEntity._isActive), IsActive.Active) + cb.equal(subQueryRoot.get(PlanUserEntity._userId), userId), + cb.equal(subQueryRoot.get(PlanUserEntity._isActive), IsActive.Active) ) : cb.or() //Creates a false query ) )); @@ -71,12 +71,12 @@ public class QueryUtilsServiceImpl implements QueryUtilsService { usePublic ? cb.and( cb.equal(subQueryRoot.get(DescriptionEntity._status), DescriptionStatus.Finalized), cb.equal(subQueryRoot.get(DescriptionEntity._isActive), IsActive.Active), - cb.in(subQueryRoot.get(DescriptionEntity._dmpId)).value(this.buildPublicDmpAuthZSubQuery(query, criteriaBuilder, usePublic)) + cb.in(subQueryRoot.get(DescriptionEntity._planId)).value(this.buildPublicDmpAuthZSubQuery(query, criteriaBuilder, usePublic)) ): cb.or(), //Creates a false query userId != null ? cb.or( cb.equal(subQueryRoot.get(DescriptionEntity._createdById), userId), - cb.in(subQueryRoot.get(DescriptionEntity._dmpId)).value(this.buildDmpUserAuthZSubQuery(query, criteriaBuilder, userId)) + cb.in(subQueryRoot.get(DescriptionEntity._planId)).value(this.buildDmpUserAuthZSubQuery(query, criteriaBuilder, userId)) ) : cb.or() //Creates a false query ) ) @@ -86,15 +86,15 @@ public class QueryUtilsServiceImpl implements QueryUtilsService { @Override public Subquery buildPublicDmpAuthZSubQuery(AbstractQuery query, CriteriaBuilder criteriaBuilder, Boolean usePublic){ return this.buildSubQuery(new BuildSubQueryInput<>( - new BuildSubQueryInput.Builder<>(DmpEntity.class, UUID.class) + new BuildSubQueryInput.Builder<>(PlanEntity.class, UUID.class) .query(query) .criteriaBuilder(criteriaBuilder) - .keyPathFunc((subQueryRoot) -> subQueryRoot.get(DmpEntity._id)) + .keyPathFunc((subQueryRoot) -> subQueryRoot.get(PlanEntity._id)) .filterFunc((subQueryRoot, cb) -> usePublic ? cb.and( - cb.equal(subQueryRoot.get(DmpEntity._accessType), DmpAccessType.Public), - cb.equal(subQueryRoot.get(DmpEntity._status), DmpStatus.Finalized), - cb.equal(subQueryRoot.get(DmpEntity._isActive), IsActive.Active) + cb.equal(subQueryRoot.get(PlanEntity._accessType), PlanAccessType.Public), + cb.equal(subQueryRoot.get(PlanEntity._status), PlanStatus.Finalized), + cb.equal(subQueryRoot.get(PlanEntity._isActive), IsActive.Active) ): cb.or() //Creates a false query ) )); @@ -102,14 +102,14 @@ public class QueryUtilsServiceImpl implements QueryUtilsService { @Override public Subquery buildDmpUserAuthZSubQuery(AbstractQuery query, CriteriaBuilder criteriaBuilder, UUID userId){ - return this.buildSubQuery(new BuildSubQueryInput<>(new BuildSubQueryInput.Builder<>(DmpUserEntity.class, UUID.class) + return this.buildSubQuery(new BuildSubQueryInput<>(new BuildSubQueryInput.Builder<>(PlanUserEntity.class, UUID.class) .query(query) .criteriaBuilder(criteriaBuilder) - .keyPathFunc((subQueryRoot) -> subQueryRoot.get(DmpUserEntity._dmpId)) + .keyPathFunc((subQueryRoot) -> subQueryRoot.get(PlanUserEntity._planId)) .filterFunc((subQueryRoot, cb) -> userId != null ? cb.and( - cb.equal(subQueryRoot.get(DmpUserEntity._userId), userId), - cb.equal(subQueryRoot.get(DmpUserEntity._isActive), IsActive.Active) + cb.equal(subQueryRoot.get(PlanUserEntity._userId), userId), + cb.equal(subQueryRoot.get(PlanUserEntity._isActive), IsActive.Active) ) : cb.or() //Creates a false query ) )); diff --git a/backend/core/src/main/java/org/opencdmp/service/actionconfirmation/ActionConfirmationServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/actionconfirmation/ActionConfirmationServiceImpl.java index b19c67ed2..d2d2179a2 100644 --- a/backend/core/src/main/java/org/opencdmp/service/actionconfirmation/ActionConfirmationServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/actionconfirmation/ActionConfirmationServiceImpl.java @@ -18,7 +18,7 @@ import org.opencdmp.authorization.Permission; import org.opencdmp.commons.XmlHandlingService; import org.opencdmp.commons.enums.IsActive; import org.opencdmp.commons.scope.user.UserScope; -import org.opencdmp.commons.types.actionconfirmation.DmpInvitationEntity; +import org.opencdmp.commons.types.actionconfirmation.PlanInvitationEntity; import org.opencdmp.commons.types.actionconfirmation.MergeAccountConfirmationEntity; import org.opencdmp.commons.types.actionconfirmation.RemoveCredentialRequestEntity; import org.opencdmp.commons.types.actionconfirmation.UserInviteToTenantRequestEntity; @@ -31,11 +31,11 @@ import org.opencdmp.model.builder.actionconfirmation.ActionConfirmationBuilder; import org.opencdmp.model.deleter.ActionConfirmationDeleter; import org.opencdmp.model.persist.ActionConfirmationPersist; import org.opencdmp.model.persist.UserInviteToTenantRequestPersist; -import org.opencdmp.model.persist.actionconfirmation.DmpInvitationPersist; +import org.opencdmp.model.persist.actionconfirmation.PlanInvitationPersist; import org.opencdmp.model.persist.actionconfirmation.MergeAccountConfirmationPersist; import org.opencdmp.model.persist.actionconfirmation.RemoveCredentialRequestPersist; import org.opencdmp.model.referencetype.ReferenceType; -import org.opencdmp.service.dmpblueprint.DmpBlueprintServiceImpl; +import org.opencdmp.service.planblueprint.PlanBlueprintServiceImpl; import org.slf4j.LoggerFactory; import org.springframework.context.MessageSource; import org.springframework.context.i18n.LocaleContextHolder; @@ -50,7 +50,7 @@ import java.util.UUID; @Service public class ActionConfirmationServiceImpl implements ActionConfirmationService { - private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpBlueprintServiceImpl.class)); + private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PlanBlueprintServiceImpl.class)); private final TenantEntityManager entityManager; private final AuthorizationService authorizationService; private final DeleterFactory deleterFactory; @@ -104,7 +104,7 @@ public class ActionConfirmationServiceImpl implements ActionConfirmationService data.setExpiresAt(model.getExpiresAt()); switch (model.getType()){ case MergeAccount -> data.setData(this.xmlHandlingService.toXmlSafe(this.buildMergeAccountConfirmationEntity(model.getMergeAccountConfirmation()))); - case DmpInvitation -> data.setData(this.xmlHandlingService.toXmlSafe(this.buildDmpInvitationEntity(model.getDmpInvitation()))); + case PlanInvitation -> data.setData(this.xmlHandlingService.toXmlSafe(this.buildDmpInvitationEntity(model.getPlanInvitation()))); case RemoveCredential -> data.setData(this.xmlHandlingService.toXmlSafe(this.buildMergeAccountConfirmationEntity(model.getRemoveCredentialRequest()))); case UserInviteToTenant -> data.setData(this.xmlHandlingService.toXmlSafe(this.buildUserInviteToTenantRequestEntity(model.getUserInviteToTenantRequest()))); default -> throw new InternalError("unknown type: " + model.getType()); @@ -119,13 +119,13 @@ public class ActionConfirmationServiceImpl implements ActionConfirmationService return this.builderFactory.builder(ActionConfirmationBuilder.class).build(BaseFieldSet.build(fields, ActionConfirmation._id), data); } - private @NotNull DmpInvitationEntity buildDmpInvitationEntity(DmpInvitationPersist persist){ - DmpInvitationEntity data = new DmpInvitationEntity(); + private @NotNull PlanInvitationEntity buildDmpInvitationEntity(PlanInvitationPersist persist){ + PlanInvitationEntity data = new PlanInvitationEntity(); if (persist == null) return data; data.setEmail(persist.getEmail()); data.setRole(persist.getRole()); - data.setDmpId(persist.getDmpId()); + data.setPlanId(persist.getPlanId()); return data; } diff --git a/backend/core/src/main/java/org/opencdmp/service/dashborad/DashboardServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/dashborad/DashboardServiceImpl.java index c70c563d9..1480f655e 100644 --- a/backend/core/src/main/java/org/opencdmp/service/dashborad/DashboardServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/dashborad/DashboardServiceImpl.java @@ -18,11 +18,11 @@ import org.opencdmp.model.*; import org.opencdmp.model.builder.PublicReferenceTypeBuilder; import org.opencdmp.model.builder.RecentActivityItemBuilder; import org.opencdmp.model.description.Description; -import org.opencdmp.model.dmp.Dmp; +import org.opencdmp.model.plan.Plan; import org.opencdmp.model.result.QueryResult; import org.opencdmp.query.*; import org.opencdmp.query.lookup.DescriptionLookup; -import org.opencdmp.query.lookup.DmpLookup; +import org.opencdmp.query.lookup.PlanLookup; import org.opencdmp.service.elastic.ElasticQueryHelperService; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -83,14 +83,14 @@ public class DashboardServiceImpl implements DashboardService { } } - DmpLookup dmpLookup = model.asDmpLookup(); - if (dmpLookup != null){ - dmpLookup.getPage().setOffset(0); - dmpLookup.getPage().setSize(model.getPage().getSize()+model.getPage().getOffset()); + PlanLookup planLookup = model.asDmpLookup(); + if (planLookup != null){ + planLookup.getPage().setOffset(0); + planLookup.getPage().setSize(model.getPage().getSize()+model.getPage().getOffset()); - QueryResult dmps = this.elasticQueryHelperService.collect(dmpLookup, AuthorizationFlags.AllExceptPublic, new BaseFieldSet().ensure(Dmp._id).ensure(Dmp._updatedAt).ensure(Dmp._label).ensure(Dmp._status)); + QueryResult dmps = this.elasticQueryHelperService.collect(planLookup, AuthorizationFlags.AllExceptPublic, new BaseFieldSet().ensure(Plan._id).ensure(Plan._updatedAt).ensure(Plan._label).ensure(Plan._status)); if (!this.conventionService.isListNullOrEmpty(dmps.getItems())) { - for (Dmp dmp : dmps.getItems()) recentActivityItemEntities.add(new RecentActivityItemEntity(RecentActivityItemType.Dmp, dmp.getId(), dmp.getUpdatedAt(), dmp.getLabel(), dmp.getStatus().getValue())); + for (Plan plan : dmps.getItems()) recentActivityItemEntities.add(new RecentActivityItemEntity(RecentActivityItemType.Plan, plan.getId(), plan.getUpdatedAt(), plan.getLabel(), plan.getStatus().getValue())); } } @@ -118,18 +118,18 @@ public class DashboardServiceImpl implements DashboardService { DashboardStatisticsCacheService.DashboardStatisticsCacheValue cacheValue = this.dashboardStatisticsCacheService.lookup(this.dashboardStatisticsCacheService.buildKey(DashboardStatisticsCacheService.publicKey)); if (cacheValue == null || cacheValue.getDashboardStatistics() == null) { - DmpQuery dmpQuery = this.queryFactory.query(DmpQuery.class).disableTracking().isActive(IsActive.Active).versionStatuses(DmpVersionStatus.Current).statuses(DmpStatus.Finalized).accessTypes(DmpAccessType.Public); + PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking().isActive(IsActive.Active).versionStatuses(PlanVersionStatus.Current).statuses(PlanStatus.Finalized).accessTypes(PlanAccessType.Public); DashboardStatistics statistics = new DashboardStatistics(); - statistics.setDmpCount(dmpQuery.authorize(EnumSet.of(Public)).count()); - statistics.setDescriptionCount(this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).dmpSubQuery(dmpQuery).statuses(DescriptionStatus.Finalized).authorize(EnumSet.of(Public)).count()); + statistics.setDmpCount(planQuery.authorize(EnumSet.of(Public)).count()); + statistics.setDescriptionCount(this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).dmpSubQuery(planQuery).statuses(DescriptionStatus.Finalized).authorize(EnumSet.of(Public)).count()); statistics.setReferenceTypeStatistics(new ArrayList<>()); if (!this.conventionService.isListNullOrEmpty(this.config.getReferenceTypeCounters())){ for (UUID typeId : this.config.getReferenceTypeCounters()){ DashboardReferenceTypeStatistics referenceTypeStatistics = new DashboardReferenceTypeStatistics(); referenceTypeStatistics.setCount(this.queryFactory.query(ReferenceQuery.class).disableTracking().isActive(IsActive.Active).typeIds(typeId).authorize(EnumSet.of(Public)) - .dmpReferenceSubQuery(this.queryFactory.query(DmpReferenceQuery.class).disableTracking().isActives(IsActive.Active) - .dmpSubQuery(dmpQuery)).count()); + .dmpReferenceSubQuery(this.queryFactory.query(PlanReferenceQuery.class).disableTracking().isActives(IsActive.Active) + .dmpSubQuery(planQuery)).count()); referenceTypeStatistics.setReferenceType(this.builderFactory.builder(PublicReferenceTypeBuilder.class).build(new BaseFieldSet().ensure(PublicReferenceType._id), this.queryFactory.query(ReferenceTypeQuery.class).disableTracking().ids(typeId).first())); statistics.getReferenceTypeStatistics().add(referenceTypeStatistics); } @@ -149,23 +149,23 @@ public class DashboardServiceImpl implements DashboardService { DashboardStatisticsCacheService.DashboardStatisticsCacheValue cacheValue = this.dashboardStatisticsCacheService.lookup(this.dashboardStatisticsCacheService.buildKey(this.dashboardStatisticsCacheService.generateUserTenantCacheKey(this.userScope.getUserId(), this.tenantScope.getTenantCode()))); if (cacheValue == null || cacheValue.getDashboardStatistics() == null) { - DmpUserQuery dmpUserLookup = this.queryFactory.query(DmpUserQuery.class).disableTracking(); + PlanUserQuery dmpUserLookup = this.queryFactory.query(PlanUserQuery.class).disableTracking(); dmpUserLookup.userIds(this.userScope.getUserId()); dmpUserLookup.isActives(IsActive.Active); - DmpQuery dmpQuery = this.queryFactory.query(DmpQuery.class).disableTracking().isActive(IsActive.Active).dmpUserSubQuery(dmpUserLookup).versionStatuses(List.of(DmpVersionStatus.Current, DmpVersionStatus.NotFinalized)); + PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking().isActive(IsActive.Active).planUserSubQuery(dmpUserLookup).versionStatuses(List.of(PlanVersionStatus.Current, PlanVersionStatus.NotFinalized)); DashboardStatistics statistics = new DashboardStatistics(); - statistics.setDmpCount(dmpQuery.authorize(AuthorizationFlags.AllExceptPublic).count()); - statistics.setDescriptionCount(this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).dmpSubQuery(dmpQuery).authorize(AuthorizationFlags.AllExceptPublic).count()); + statistics.setDmpCount(planQuery.authorize(AuthorizationFlags.AllExceptPublic).count()); + statistics.setDescriptionCount(this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).dmpSubQuery(planQuery).authorize(AuthorizationFlags.AllExceptPublic).count()); statistics.setReferenceTypeStatistics(new ArrayList<>()); if (!this.conventionService.isListNullOrEmpty(this.config.getReferenceTypeCounters())){ for (UUID typeId : this.config.getReferenceTypeCounters()){ DashboardReferenceTypeStatistics referenceTypeStatistics = new DashboardReferenceTypeStatistics(); referenceTypeStatistics.setCount(this.queryFactory.query(ReferenceQuery.class).disableTracking().isActive(IsActive.Active).typeIds(typeId).authorize(AuthorizationFlags.AllExceptPublic) - .dmpReferenceSubQuery(this.queryFactory.query(DmpReferenceQuery.class).disableTracking().isActives(IsActive.Active) - .dmpSubQuery(dmpQuery)).count()); + .dmpReferenceSubQuery(this.queryFactory.query(PlanReferenceQuery.class).disableTracking().isActives(IsActive.Active) + .dmpSubQuery(planQuery)).count()); referenceTypeStatistics.setReferenceType(this.builderFactory.builder(PublicReferenceTypeBuilder.class).build(new BaseFieldSet().ensure(PublicReferenceType._id), this.queryFactory.query(ReferenceTypeQuery.class).disableTracking().ids(typeId).first())); statistics.getReferenceTypeStatistics().add(referenceTypeStatistics); } diff --git a/backend/core/src/main/java/org/opencdmp/service/deposit/DepositService.java b/backend/core/src/main/java/org/opencdmp/service/deposit/DepositService.java index 4fc1f6739..da3c14a5d 100644 --- a/backend/core/src/main/java/org/opencdmp/service/deposit/DepositService.java +++ b/backend/core/src/main/java/org/opencdmp/service/deposit/DepositService.java @@ -16,7 +16,7 @@ import java.util.List; public interface DepositService { List getAvailableConfigurations(FieldSet fieldSet) throws InvalidApplicationException, InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException; - EntityDoi deposit(DepositRequest dmpDepositModel) throws Exception; + EntityDoi deposit(DepositRequest planDepositModel) throws Exception; String getLogo(String repositoryId) throws InvalidApplicationException, InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException; } diff --git a/backend/core/src/main/java/org/opencdmp/service/deposit/DepositServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/deposit/DepositServiceImpl.java index 980bc4cc2..cf16944dc 100644 --- a/backend/core/src/main/java/org/opencdmp/service/deposit/DepositServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/deposit/DepositServiceImpl.java @@ -31,8 +31,8 @@ import org.opencdmp.commons.types.notification.FieldInfo; import org.opencdmp.commons.types.notification.NotificationFieldData; import org.opencdmp.commons.types.tenantconfiguration.DepositTenantConfigurationEntity; import org.opencdmp.convention.ConventionService; -import org.opencdmp.data.DmpEntity; -import org.opencdmp.data.DmpUserEntity; +import org.opencdmp.data.PlanEntity; +import org.opencdmp.data.PlanUserEntity; import org.opencdmp.data.TenantConfigurationEntity; import org.opencdmp.data.UserEntity; import org.opencdmp.depositbase.repository.DepositClient; @@ -43,14 +43,14 @@ import org.opencdmp.integrationevent.outbox.notification.NotifyIntegrationEventH import org.opencdmp.model.EntityDoi; import org.opencdmp.model.StorageFile; import org.opencdmp.model.builder.commonmodels.DepositConfigurationBuilder; -import org.opencdmp.model.builder.commonmodels.dmp.DmpCommonModelBuilder; +import org.opencdmp.model.builder.commonmodels.plan.PlanCommonModelBuilder; import org.opencdmp.model.persist.EntityDoiPersist; import org.opencdmp.model.persist.StorageFilePersist; import org.opencdmp.model.persist.deposit.DepositAuthenticateRequest; import org.opencdmp.model.persist.deposit.DepositRequest; import org.opencdmp.model.tenantconfiguration.TenantConfiguration; -import org.opencdmp.query.DmpQuery; -import org.opencdmp.query.DmpUserQuery; +import org.opencdmp.query.PlanQuery; +import org.opencdmp.query.PlanUserQuery; import org.opencdmp.query.TenantConfigurationQuery; import org.opencdmp.query.UserQuery; import org.opencdmp.service.encryption.EncryptionService; @@ -269,31 +269,31 @@ public class DepositServiceImpl implements DepositService { } @Override - public EntityDoi deposit(DepositRequest dmpDepositModel) throws Exception { - this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.dmpAffiliation(dmpDepositModel.getDmpId())), Permission.DepositDmp); + public EntityDoi deposit(DepositRequest planDepositModel) throws Exception { + this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.dmpAffiliation(planDepositModel.getPlanId())), Permission.DepositPlan); //GK: First get the right client - DepositClient depositClient = this.getDepositClient(dmpDepositModel.getRepositoryId()); - if (depositClient == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{dmpDepositModel.getRepositoryId(), DepositClient.class.getSimpleName()}, LocaleContextHolder.getLocale())); + DepositClient depositClient = this.getDepositClient(planDepositModel.getRepositoryId()); + if (depositClient == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{planDepositModel.getRepositoryId(), DepositClient.class.getSimpleName()}, LocaleContextHolder.getLocale())); //GK: Second get the Target Data Management Plan - DmpEntity dmpEntity = this.queryFactory.query(DmpQuery.class).disableTracking().ids(dmpDepositModel.getDmpId()).first(); - if (dmpEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{dmpDepositModel.getDmpId(), DmpEntity.class.getSimpleName()}, LocaleContextHolder.getLocale())); + PlanEntity planEntity = this.queryFactory.query(PlanQuery.class).disableTracking().ids(planDepositModel.getPlanId()).first(); + if (planEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{planDepositModel.getPlanId(), PlanEntity.class.getSimpleName()}, LocaleContextHolder.getLocale())); //GK: Forth make the required files to be uploaded with the deposit //TODO: Properly create required files - DepositSourceEntity source = this.getDepositSources().stream().filter(depositSource -> depositSource.getRepositoryId().equals(dmpDepositModel.getRepositoryId())).findFirst().orElse(null); - if (source == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{dmpDepositModel.getRepositoryId(), DepositSourceEntity.class.getSimpleName()}, LocaleContextHolder.getLocale())); + DepositSourceEntity source = this.getDepositSources().stream().filter(depositSource -> depositSource.getRepositoryId().equals(planDepositModel.getRepositoryId())).findFirst().orElse(null); + if (source == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{planDepositModel.getRepositoryId(), DepositSourceEntity.class.getSimpleName()}, LocaleContextHolder.getLocale())); String accessToken = null; - if (!this.conventionService.isNullOrEmpty(dmpDepositModel.getAuthorizationCode())) { + if (!this.conventionService.isNullOrEmpty(planDepositModel.getAuthorizationCode())) { DepositAuthenticateRequest authenticateRequest = new DepositAuthenticateRequest(); - authenticateRequest.setRepositoryId(dmpDepositModel.getRepositoryId()); - authenticateRequest.setCode(dmpDepositModel.getAuthorizationCode()); + authenticateRequest.setRepositoryId(planDepositModel.getRepositoryId()); + authenticateRequest.setCode(planDepositModel.getAuthorizationCode()); accessToken = this.authenticate(authenticateRequest); } - org.opencdmp.model.file.FileEnvelope pdfFile = this.fileTransformerService.exportDmp(dmpEntity.getId(), source.getPdfTransformerId(),"pdf"); - org.opencdmp.model.file.FileEnvelope rda = this.fileTransformerService.exportDmp(dmpEntity.getId(), source.getRdaTransformerId(),"json"); + org.opencdmp.model.file.FileEnvelope pdfFile = this.fileTransformerService.exportDmp(planEntity.getId(), source.getPdfTransformerId(),"pdf"); + org.opencdmp.model.file.FileEnvelope rda = this.fileTransformerService.exportDmp(planEntity.getId(), source.getRdaTransformerId(),"json"); FileEnvelopeModel pdfEnvelope = new FileEnvelopeModel(); FileEnvelopeModel jsonEnvelope = new FileEnvelopeModel(); @@ -311,8 +311,8 @@ public class DepositServiceImpl implements DepositService { } //GK: Fifth Transform them to the DepositModel - DmpModel depositModel = this.builderFactory.builder(DmpCommonModelBuilder.class).useSharedStorage(depositClient.getConfiguration().isUseSharedStorage()).authorize(AuthorizationFlags.AllExceptPublic) - .setRepositoryId(dmpDepositModel.getRepositoryId()).setPdfFile(pdfEnvelope).setRdaJsonFile(jsonEnvelope).build(dmpEntity); + DmpModel depositModel = this.builderFactory.builder(PlanCommonModelBuilder.class).useSharedStorage(depositClient.getConfiguration().isUseSharedStorage()).authorize(AuthorizationFlags.AllExceptPublic) + .setRepositoryId(planDepositModel.getRepositoryId()).setPdfFile(pdfEnvelope).setRdaJsonFile(jsonEnvelope).build(planEntity); //GK: Sixth Perform the deposit @@ -321,29 +321,29 @@ public class DepositServiceImpl implements DepositService { if (doi.isEmpty()) return null; //GK: doi is fine store it in database EntityDoiPersist doiPersist = new EntityDoiPersist(); - doiPersist.setRepositoryId(dmpDepositModel.getRepositoryId()); + doiPersist.setRepositoryId(planDepositModel.getRepositoryId()); doiPersist.setDoi(doi); - doiPersist.setEntityId(dmpEntity.getId()); - this.sendNotification(dmpEntity); - return this.doiService.persist(doiPersist, true, dmpDepositModel.getProject()); + doiPersist.setEntityId(planEntity.getId()); + this.sendNotification(planEntity); + return this.doiService.persist(doiPersist, true, planDepositModel.getProject()); } - private void sendNotification(DmpEntity dmpEntity) throws InvalidApplicationException { - List dmpUsers = this.queryFactory.query(DmpUserQuery.class).disableTracking().dmpIds(dmpEntity.getId()).isActives(IsActive.Active).collect(); + private void sendNotification(PlanEntity planEntity) throws InvalidApplicationException { + List dmpUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking().planIds(planEntity.getId()).isActives(IsActive.Active).collect(); if (this.conventionService.isListNullOrEmpty(dmpUsers)){ throw new MyNotFoundException("Dmp does not have Users"); } - List users = this.queryFactory.query(UserQuery.class).disableTracking().ids(dmpUsers.stream().map(DmpUserEntity::getUserId).collect(Collectors.toList())).isActive(IsActive.Active).collect(); + List users = this.queryFactory.query(UserQuery.class).disableTracking().ids(dmpUsers.stream().map(PlanUserEntity::getUserId).collect(Collectors.toList())).isActive(IsActive.Active).collect(); for (UserEntity user: users) { if (!user.getId().equals(this.userScope.getUserIdSafe()) && !this.conventionService.isListNullOrEmpty(dmpUsers.stream().filter(x -> x.getUserId().equals(user.getId())).collect(Collectors.toList()))){ - this.createDmpDepositNotificationEvent(dmpEntity, user); + this.createDmpDepositNotificationEvent(planEntity, user); } } } - private void createDmpDepositNotificationEvent(DmpEntity dmp, UserEntity user) throws InvalidApplicationException { + private void createDmpDepositNotificationEvent(PlanEntity dmp, UserEntity user) throws InvalidApplicationException { NotifyIntegrationEvent event = new NotifyIntegrationEvent(); event.setUserId(user.getId()); diff --git a/backend/core/src/main/java/org/opencdmp/service/description/DescriptionService.java b/backend/core/src/main/java/org/opencdmp/service/description/DescriptionService.java index 9d4cf2eab..2708e7033 100644 --- a/backend/core/src/main/java/org/opencdmp/service/description/DescriptionService.java +++ b/backend/core/src/main/java/org/opencdmp/service/description/DescriptionService.java @@ -52,8 +52,8 @@ public interface DescriptionService { ResponseEntity exportXml(UUID id) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException; - Description importXml(DescriptionImportExport descriptionXml, UUID dmpId, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException; + Description importXml(DescriptionImportExport descriptionXml, UUID planId, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException; - Description importCommonModel(DescriptionModel model, UUID dmpId, FieldSet fields) throws MyForbiddenException, MyNotFoundException, InvalidApplicationException, IOException, JAXBException, ParserConfigurationException, TransformerException, InstantiationException, IllegalAccessException, SAXException; + Description importCommonModel(DescriptionModel model, UUID planId, FieldSet fields) throws MyForbiddenException, MyNotFoundException, InvalidApplicationException, IOException, JAXBException, ParserConfigurationException, TransformerException, InstantiationException, IllegalAccessException, SAXException; } diff --git a/backend/core/src/main/java/org/opencdmp/service/description/DescriptionServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/description/DescriptionServiceImpl.java index e86ada34a..09d78b75d 100644 --- a/backend/core/src/main/java/org/opencdmp/service/description/DescriptionServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/description/DescriptionServiceImpl.java @@ -50,7 +50,7 @@ import org.opencdmp.integrationevent.outbox.annotationentitytouch.AnnotationEnti import org.opencdmp.integrationevent.outbox.notification.NotifyIntegrationEvent; import org.opencdmp.integrationevent.outbox.notification.NotifyIntegrationEventHandler; import org.opencdmp.model.DescriptionValidationResult; -import org.opencdmp.model.DmpDescriptionTemplate; +import org.opencdmp.model.PlanDescriptionTemplate; import org.opencdmp.model.StorageFile; import org.opencdmp.model.Tag; import org.opencdmp.model.builder.description.DescriptionBuilder; @@ -59,8 +59,8 @@ import org.opencdmp.model.deleter.DescriptionReferenceDeleter; import org.opencdmp.model.deleter.DescriptionTagDeleter; import org.opencdmp.model.description.Description; import org.opencdmp.model.descriptiontemplate.DescriptionTemplate; -import org.opencdmp.model.dmp.Dmp; -import org.opencdmp.model.dmpblueprint.DmpBlueprint; +import org.opencdmp.model.plan.Plan; +import org.opencdmp.model.planblueprint.PlanBlueprint; import org.opencdmp.model.file.FileEnvelope; import org.opencdmp.model.persist.*; import org.opencdmp.model.persist.descriptionproperties.*; @@ -186,7 +186,7 @@ public class DescriptionServiceImpl implements DescriptionService { Map> response = new HashMap<>(); - Map affiliatedResourceMap = this.authorizationContentResolver.descriptionsAffiliationBySections(model.getDmpId(), model.getSectionIds()); + Map affiliatedResourceMap = this.authorizationContentResolver.descriptionsAffiliationBySections(model.getPlanId(), model.getSectionIds()); for (UUID sectionId : model.getSectionIds().stream().distinct().toList()){ AffiliatedResource affiliatedResource = affiliatedResourceMap.getOrDefault(sectionId, null); response.put(sectionId, new ArrayList<>()); @@ -206,11 +206,11 @@ public class DescriptionServiceImpl implements DescriptionService { Boolean isUpdate = this.conventionService.isValidGuid(model.getId()); - DmpDescriptionTemplateEntity dmpDescriptionTemplate = this.entityManager.find(DmpDescriptionTemplateEntity.class, model.getDmpDescriptionTemplateId()); - if (dmpDescriptionTemplate == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getDmpDescriptionTemplateId(), DmpDescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale())); + PlanDescriptionTemplateEntity planDescriptionTemplate = this.entityManager.find(PlanDescriptionTemplateEntity.class, model.getPlanDescriptionTemplateId()); + if (planDescriptionTemplate == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getPlanDescriptionTemplateId(), PlanDescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale())); if (isUpdate) this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.descriptionAffiliation(model.getId())), Permission.EditDescription); - else this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.descriptionsAffiliationBySection(model.getDmpId(), dmpDescriptionTemplate.getSectionId())), Permission.EditDescription); + else this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.descriptionsAffiliationBySection(model.getPlanId(), planDescriptionTemplate.getSectionId())), Permission.EditDescription); DescriptionEntity data; if (isUpdate) { @@ -218,27 +218,27 @@ public class DescriptionServiceImpl implements DescriptionService { if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), Description.class.getSimpleName()}, LocaleContextHolder.getLocale())); if (!this.conventionService.hashValue(data.getUpdatedAt()).equals(model.getHash())) throw new MyValidationException(this.errors.getHashConflict().getCode(), this.errors.getHashConflict().getMessage()); if (data.getStatus().equals(DescriptionStatus.Finalized)) throw new MyValidationException(this.errors.getDescriptionIsFinalized().getCode(), this.errors.getDescriptionIsFinalized().getMessage()); - if (!data.getDmpId().equals(model.getDmpId())) throw new MyValidationException(this.errors.getDmpCanNotChange().getCode(), this.errors.getDmpCanNotChange().getMessage()); - if (!data.getDmpDescriptionTemplateId().equals(model.getDmpDescriptionTemplateId())) throw new MyValidationException(this.errors.getDmpDescriptionTemplateCanNotChange().getCode(), this.errors.getDmpDescriptionTemplateCanNotChange().getMessage()); + if (!data.getPlanId().equals(model.getPlanId())) throw new MyValidationException(this.errors.getDmpCanNotChange().getCode(), this.errors.getDmpCanNotChange().getMessage()); + if (!data.getPlanDescriptionTemplateId().equals(model.getPlanDescriptionTemplateId())) throw new MyValidationException(this.errors.getDmpDescriptionTemplateCanNotChange().getCode(), this.errors.getDmpDescriptionTemplateCanNotChange().getMessage()); } else { data = new DescriptionEntity(); data.setId(UUID.randomUUID()); data.setIsActive(IsActive.Active); data.setCreatedAt(Instant.now()); data.setCreatedById(this.userScope.getUserId()); - data.setDmpId(model.getDmpId()); - data.setDmpDescriptionTemplateId(model.getDmpDescriptionTemplateId()); + data.setPlanId(model.getPlanId()); + data.setPlanDescriptionTemplateId(model.getPlanDescriptionTemplateId()); } DescriptionTemplateEntity descriptionTemplateEntity = this.entityManager.find(DescriptionTemplateEntity.class, model.getDescriptionTemplateId(), true); if (descriptionTemplateEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getDescriptionTemplateId(), DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale())); - if (!dmpDescriptionTemplate.getDescriptionTemplateGroupId().equals(descriptionTemplateEntity.getGroupId())) throw new MyValidationException(this.errors.getInvalidDescriptionTemplate().getCode(), this.errors.getInvalidDescriptionTemplate().getMessage()); + if (!planDescriptionTemplate.getDescriptionTemplateGroupId().equals(descriptionTemplateEntity.getGroupId())) throw new MyValidationException(this.errors.getInvalidDescriptionTemplate().getCode(), this.errors.getInvalidDescriptionTemplate().getMessage()); - DmpEntity dmp = this.entityManager.find(DmpEntity.class, data.getDmpId(), true); - if (dmp == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{data.getDmpId(), Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale())); + PlanEntity dmp = this.entityManager.find(PlanEntity.class, data.getPlanId(), true); + if (dmp == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{data.getPlanId(), Plan.class.getSimpleName()}, LocaleContextHolder.getLocale())); - if (dmp.getStatus().equals(DmpStatus.Finalized) && isUpdate) throw new MyValidationException(this.errors.getDmpIsFinalized().getCode(), this.errors.getDmpIsFinalized().getMessage()); + if (dmp.getStatus().equals(PlanStatus.Finalized) && isUpdate) throw new MyValidationException(this.errors.getDmpIsFinalized().getCode(), this.errors.getDmpIsFinalized().getMessage()); data.setLabel(model.getLabel()); data.setStatus(model.getStatus()); @@ -288,8 +288,8 @@ public class DescriptionServiceImpl implements DescriptionService { DescriptionTemplateEntity oldDescriptionTemplateEntity = this.entityManager.find(DescriptionTemplateEntity.class, data.getDescriptionTemplateId(), true); if (oldDescriptionTemplateEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{data.getDescriptionTemplateId(), DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale())); - DmpDescriptionTemplateEntity dmpDescriptionTemplateEntity = this.entityManager.find(DmpDescriptionTemplateEntity.class, data.getDmpDescriptionTemplateId(), true); - if (dmpDescriptionTemplateEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{data.getDmpDescriptionTemplateId(), DmpDescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale())); + PlanDescriptionTemplateEntity planDescriptionTemplateEntity = this.entityManager.find(PlanDescriptionTemplateEntity.class, data.getPlanDescriptionTemplateId(), true); + if (planDescriptionTemplateEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{data.getPlanDescriptionTemplateId(), PlanDescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale())); List latestVersionDescriptionTemplates = this.queryFactory.query(DescriptionTemplateQuery.class).disableTracking() @@ -326,15 +326,15 @@ public class DescriptionServiceImpl implements DescriptionService { } private void sendNotification(DescriptionEntity description, Boolean isUpdate) throws InvalidApplicationException { - List existingUsers = this.queryFactory.query(DmpUserQuery.class).disableTracking() - .dmpIds(description.getDmpId()) + List existingUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking() + .planIds(description.getPlanId()) .isActives(IsActive.Active) .collect(); if (existingUsers == null || existingUsers.size() <= 1){ return; } - for (DmpUserEntity dmpUser : existingUsers) { + for (PlanUserEntity dmpUser : existingUsers) { if (!dmpUser.getUserId().equals(this.userScope.getUserIdSafe())){ UserEntity user = this.queryFactory.query(UserQuery.class).disableTracking().ids(dmpUser.getUserId()).first(); if (user == null || user.getIsActive().equals(IsActive.Inactive)) throw new MyValidationException(this.errors.getDmpInactiveUser().getCode(), this.errors.getDmpInactiveUser().getMessage()); @@ -435,9 +435,9 @@ public class DescriptionServiceImpl implements DescriptionService { if (!data.getStatus().equals(model.getStatus())){ if (data.getStatus().equals(DescriptionStatus.Finalized)){ this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.descriptionAffiliation(model.getId())), Permission.FinalizeDescription); - DmpEntity dmpEntity = this.entityManager.find(DmpEntity.class, data.getDmpId(), true); - if (dmpEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{data.getDmpId(), DmpEntity.class.getSimpleName()}, LocaleContextHolder.getLocale())); - if(!dmpEntity.getStatus().equals(DmpStatus.Draft)) throw new MyValidationException(this.errors.getDmpIsFinalized().getCode(), this.errors.getDmpIsFinalized().getMessage()); + PlanEntity planEntity = this.entityManager.find(PlanEntity.class, data.getPlanId(), true); + if (planEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{data.getPlanId(), PlanEntity.class.getSimpleName()}, LocaleContextHolder.getLocale())); + if(!planEntity.getStatus().equals(PlanStatus.Draft)) throw new MyValidationException(this.errors.getDmpIsFinalized().getCode(), this.errors.getDmpIsFinalized().getMessage()); } data.setStatus(model.getStatus()); @@ -553,9 +553,9 @@ public class DescriptionServiceImpl implements DescriptionService { else if (!this.conventionService.isNullOrEmpty(persist.getTextValue())) ids.add(UUID.fromString(persist.getTextValue())); if (!ids.isEmpty()){ - Set existingIds = this.queryFactory.query(DmpQuery.class).disableTracking().ids(ids).collectAs(new BaseFieldSet().ensure(Dmp._id)).stream().map(DmpEntity::getId).collect(Collectors.toSet()); + Set existingIds = this.queryFactory.query(PlanQuery.class).disableTracking().ids(ids).collectAs(new BaseFieldSet().ensure(Plan._id)).stream().map(PlanEntity::getId).collect(Collectors.toSet()); for (UUID id : ids){ - if (!existingIds.contains(id)) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale())); + if (!existingIds.contains(id)) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Plan.class.getSimpleName()}, LocaleContextHolder.getLocale())); } } @@ -922,15 +922,15 @@ public class DescriptionServiceImpl implements DescriptionService { DescriptionEntity descriptionEntity = this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).ids(descriptionId).first(); if (descriptionEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{descriptionId, Description.class.getSimpleName()}, LocaleContextHolder.getLocale())); - DmpDescriptionTemplateEntity dmpDescriptionTemplateEntity = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking().ids(descriptionEntity.getDmpDescriptionTemplateId()).isActive(IsActive.Active).first(); - if (dmpDescriptionTemplateEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{descriptionEntity.getDmpDescriptionTemplateId(), DmpDescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale())); + PlanDescriptionTemplateEntity planDescriptionTemplateEntity = this.queryFactory.query(PlanDescriptionTemplateQuery.class).disableTracking().ids(descriptionEntity.getPlanDescriptionTemplateId()).isActive(IsActive.Active).first(); + if (planDescriptionTemplateEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{descriptionEntity.getPlanDescriptionTemplateId(), PlanDescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale())); - DmpEntity dmpEntity = this.queryFactory.query(DmpQuery.class).ids(dmpDescriptionTemplateEntity.getDmpId()).disableTracking().isActive(IsActive.Active).first(); - if (dmpEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{dmpDescriptionTemplateEntity.getDmpId(), Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale())); + PlanEntity planEntity = this.queryFactory.query(PlanQuery.class).ids(planDescriptionTemplateEntity.getPlanId()).disableTracking().isActive(IsActive.Active).first(); + if (planEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{planDescriptionTemplateEntity.getPlanId(), Plan.class.getSimpleName()}, LocaleContextHolder.getLocale())); - if (!dmpEntity.getAccessType().equals(DmpAccessType.Public)) + if (!planEntity.getAccessType().equals(PlanAccessType.Public)) { - boolean isDmpUser = this.queryFactory.query(DmpUserQuery.class).dmpIds(dmpEntity.getId()).disableTracking().userIds(this.userScope.getUserIdSafe()).isActives(IsActive.Active).count() > 0; + boolean isDmpUser = this.queryFactory.query(PlanUserQuery.class).planIds(planEntity.getId()).disableTracking().userIds(this.userScope.getUserIdSafe()).isActives(IsActive.Active).count() > 0; if (!isDmpUser) throw new MyUnauthorizedException(); } @@ -954,8 +954,8 @@ public class DescriptionServiceImpl implements DescriptionService { persist.setStatus(DescriptionStatus.Finalized); persist.setDescription(data.getDescription()); persist.setDescriptionTemplateId(data.getDescriptionTemplateId()); - persist.setDmpId(data.getDmpId()); - persist.setDmpDescriptionTemplateId(data.getDmpDescriptionTemplateId()); + persist.setPlanId(data.getPlanId()); + persist.setPlanDescriptionTemplateId(data.getPlanDescriptionTemplateId()); org.opencdmp.commons.types.descriptiontemplate.DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(org.opencdmp.commons.types.descriptiontemplate.DefinitionEntity.class, descriptionTemplateEntity.getDefinition()); @@ -1141,8 +1141,8 @@ public class DescriptionServiceImpl implements DescriptionService { xml.setLabel(data.getLabel()); xml.setFinalizedAt(data.getFinalizedAt()); - DmpDescriptionTemplateEntity dmpDescriptionTemplateEntity = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking().ids(data.getDmpDescriptionTemplateId()).authorize(AuthorizationFlags.All).isActive(IsActive.Active).first(); - if (dmpDescriptionTemplateEntity != null) xml.setSectionId(dmpDescriptionTemplateEntity.getSectionId()); + PlanDescriptionTemplateEntity planDescriptionTemplateEntity = this.queryFactory.query(PlanDescriptionTemplateQuery.class).disableTracking().ids(data.getPlanDescriptionTemplateId()).authorize(AuthorizationFlags.All).isActive(IsActive.Active).first(); + if (planDescriptionTemplateEntity != null) xml.setSectionId(planDescriptionTemplateEntity.getSectionId()); DescriptionTagQuery descriptionTagQuery = this.queryFactory.query(DescriptionTagQuery.class); descriptionTagQuery.descriptionIds(data.getId()); @@ -1160,17 +1160,17 @@ public class DescriptionServiceImpl implements DescriptionService { xml.setProperties(this.descriptionPropertyDefinitionToExport(propertiesEntity)); } - List dmpReferences = this.queryFactory.query(DescriptionReferenceQuery.class).disableTracking().descriptionIds(data.getId()).authorize(AuthorizationFlags.All).isActive(IsActive.Active).collect(); - if (!this.conventionService.isListNullOrEmpty(dmpReferences)) { - List references = this.queryFactory.query(ReferenceQuery.class).disableTracking().ids(dmpReferences.stream().map(DescriptionReferenceEntity::getReferenceId).distinct().toList()).authorize(AuthorizationFlags.All).isActive(IsActive.Active).collect(); + List planReferences = this.queryFactory.query(DescriptionReferenceQuery.class).disableTracking().descriptionIds(data.getId()).authorize(AuthorizationFlags.All).isActive(IsActive.Active).collect(); + if (!this.conventionService.isListNullOrEmpty(planReferences)) { + List references = this.queryFactory.query(ReferenceQuery.class).disableTracking().ids(planReferences.stream().map(DescriptionReferenceEntity::getReferenceId).distinct().toList()).authorize(AuthorizationFlags.All).isActive(IsActive.Active).collect(); Map referenceEntityMap = references == null ? new HashMap<>() : references.stream().collect(Collectors.toMap(ReferenceEntity::getId, x-> x)); List referenceTypes = references == null ? new ArrayList<>() : this.queryFactory.query(ReferenceTypeQuery.class).disableTracking().ids(references.stream().map(ReferenceEntity::getTypeId).distinct().toList()).authorize(AuthorizationFlags.All).isActive(IsActive.Active).collect(); Map referenceTypeEntityMap = referenceTypes == null ? new HashMap<>() : referenceTypes.stream().collect(Collectors.toMap(ReferenceTypeEntity::getId, x-> x)); - List dmpReferenceImportExports = new LinkedList<>(); - for (DescriptionReferenceEntity descriptionReferenceEntity : dmpReferences) { - dmpReferenceImportExports.add(this.descriptionReferenceToExport(descriptionReferenceEntity, referenceEntityMap, referenceTypeEntityMap)); + List descriptionReferenceImportExports = new LinkedList<>(); + for (DescriptionReferenceEntity descriptionReferenceEntity : planReferences) { + descriptionReferenceImportExports.add(this.descriptionReferenceToExport(descriptionReferenceEntity, referenceEntityMap, referenceTypeEntityMap)); } - xml.setReferences(dmpReferenceImportExports); + xml.setReferences(descriptionReferenceImportExports); } return xml; } @@ -1287,19 +1287,19 @@ public class DescriptionServiceImpl implements DescriptionService { //region Import xml - public Description importXml(DescriptionImportExport descriptionXml, UUID dmpId, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException{ + public Description importXml(DescriptionImportExport descriptionXml, UUID planId, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException{ if (descriptionXml == null) throw new MyNotFoundException("Description xml not found"); - logger.debug(new MapLogEntry("import description").And("dmpId", dmpId).And("fields", fields)); + logger.debug(new MapLogEntry("import description").And("planId", planId).And("fields", fields)); DescriptionPersist persist = new DescriptionPersist(); persist.setLabel(descriptionXml.getLabel()); persist.setDescription(descriptionXml.getDescription()); persist.setStatus(DescriptionStatus.Draft); - persist.setDmpId(dmpId); + persist.setPlanId(planId); persist.setDescriptionTemplateId(this.xmlToDescriptionTemplatePersist(descriptionXml)); - persist.setDmpDescriptionTemplateId(this.xmlToDmpDescriptionTemplatePersist(descriptionXml, dmpId)); + persist.setPlanDescriptionTemplateId(this.xmlToPlanDescriptionTemplatePersist(descriptionXml, planId)); persist.setTags(descriptionXml.getTags()); persist.setProperties(this.xmlToPropertyDefinitionToPersist(descriptionXml)); @@ -1319,7 +1319,7 @@ public class DescriptionServiceImpl implements DescriptionService { if (descriptionTemplateEntity != null){ descriptionTemplateId = descriptionTemplateEntity.getId(); } else { - DescriptionTemplate persisted = this.descriptionTemplateService.importXml(descriptionXml.getDescriptionTemplate(), null, descriptionXml.getDescriptionTemplate().getDescription(), new BaseFieldSet().ensure(DmpBlueprint._label).ensure(DmpBlueprint._hash)); + DescriptionTemplate persisted = this.descriptionTemplateService.importXml(descriptionXml.getDescriptionTemplate(), null, descriptionXml.getDescriptionTemplate().getDescription(), new BaseFieldSet().ensure(PlanBlueprint._label).ensure(PlanBlueprint._hash)); descriptionTemplateId = persisted.getId(); } @@ -1328,20 +1328,20 @@ public class DescriptionServiceImpl implements DescriptionService { return null; } - private UUID xmlToDmpDescriptionTemplatePersist(DescriptionImportExport descriptionXml, UUID dmpId) { + private UUID xmlToPlanDescriptionTemplatePersist(DescriptionImportExport descriptionXml, UUID planId) { if (descriptionXml.getDescriptionTemplate() != null) { - List dmpDescriptionTemplates = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking() + List planDescriptionTemplates = this.queryFactory.query(PlanDescriptionTemplateQuery.class).disableTracking() .isActive(IsActive.Active) - .dmpIds(dmpId) + .planIds(planId) .collect(); - if (!this.conventionService.isListNullOrEmpty(dmpDescriptionTemplates) && descriptionXml.getSectionId() != null && descriptionXml.getDescriptionTemplate().getGroupId() != null){ - DmpDescriptionTemplateEntity dmpDescriptionTemplate = dmpDescriptionTemplates.stream().filter(x -> + if (!this.conventionService.isListNullOrEmpty(planDescriptionTemplates) && descriptionXml.getSectionId() != null && descriptionXml.getDescriptionTemplate().getGroupId() != null){ + PlanDescriptionTemplateEntity planDescriptionTemplate = planDescriptionTemplates.stream().filter(x -> x.getDescriptionTemplateGroupId().equals(descriptionXml.getDescriptionTemplate().getGroupId()) && x.getSectionId().equals(descriptionXml.getSectionId())).findFirst().orElse(null); - if (dmpDescriptionTemplate == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{descriptionXml.getDescriptionTemplate().getGroupId(), DmpDescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale())); - return dmpDescriptionTemplate.getId(); + if (planDescriptionTemplate == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{descriptionXml.getDescriptionTemplate().getGroupId(), PlanDescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale())); + return planDescriptionTemplate.getId(); } } return null; @@ -1500,18 +1500,18 @@ public class DescriptionServiceImpl implements DescriptionService { //region Import Common Model @Override - public Description importCommonModel(DescriptionModel model, UUID dmpId, FieldSet fields) throws MyForbiddenException, MyNotFoundException, InvalidApplicationException, IOException, JAXBException, ParserConfigurationException, TransformerException, InstantiationException, IllegalAccessException, SAXException { - logger.debug(new MapLogEntry("import description").And("dmpId", dmpId).And("fields", fields)); + public Description importCommonModel(DescriptionModel model, UUID planId, FieldSet fields) throws MyForbiddenException, MyNotFoundException, InvalidApplicationException, IOException, JAXBException, ParserConfigurationException, TransformerException, InstantiationException, IllegalAccessException, SAXException { + logger.debug(new MapLogEntry("import description").And("planId", planId).And("fields", fields)); if (model == null) throw new IllegalArgumentException ("model"); - if (dmpId == null) throw new IllegalArgumentException ("dmpId"); + if (planId == null) throw new IllegalArgumentException ("planId"); DescriptionPersist persist = new DescriptionPersist(); persist.setLabel(model.getLabel()); persist.setDescription(model.getDescription()); persist.setStatus(DescriptionStatus.Draft); - persist.setDmpId(dmpId); + persist.setPlanId(planId); persist.setDescriptionTemplateId(this.commonModelToDescriptionTemplatePersist(model)); - persist.setDmpDescriptionTemplateId(this.commonModelTToDmpDescriptionTemplatePersist(model, dmpId)); + persist.setPlanDescriptionTemplateId(this.commonModelTToPlanDescriptionTemplatePersist(model, planId)); persist.setTags(model.getTags()); persist.setProperties(this.commonModelPropertyDefinitionToPersist(model)); @@ -1529,7 +1529,7 @@ public class DescriptionServiceImpl implements DescriptionService { if (descriptionTemplateEntity != null){ descriptionTemplateId = descriptionTemplateEntity.getId(); } else { - DescriptionTemplate persisted = this.descriptionTemplateService.importCommonModel(commonModel.getDescriptionTemplate(), new BaseFieldSet().ensure(DmpBlueprint._label).ensure(DmpBlueprint._hash)); + DescriptionTemplate persisted = this.descriptionTemplateService.importCommonModel(commonModel.getDescriptionTemplate(), new BaseFieldSet().ensure(PlanBlueprint._label).ensure(PlanBlueprint._hash)); descriptionTemplateId = persisted.getId(); } @@ -1538,20 +1538,20 @@ public class DescriptionServiceImpl implements DescriptionService { return null; } - private UUID commonModelTToDmpDescriptionTemplatePersist(DescriptionModel commonModel, UUID dmpId) { + private UUID commonModelTToPlanDescriptionTemplatePersist(DescriptionModel commonModel, UUID planId) { if (commonModel.getDescriptionTemplate() != null) { - List dmpDescriptionTemplates = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking() + List planDescriptionTemplates = this.queryFactory.query(PlanDescriptionTemplateQuery.class).disableTracking() .isActive(IsActive.Active) - .dmpIds(dmpId) + .planIds(planId) .collect(); - if (!this.conventionService.isListNullOrEmpty(dmpDescriptionTemplates) && commonModel.getSectionId() != null && commonModel.getDescriptionTemplate().getGroupId() != null){ - DmpDescriptionTemplateEntity dmpDescriptionTemplate = dmpDescriptionTemplates.stream().filter(x -> + if (!this.conventionService.isListNullOrEmpty(planDescriptionTemplates) && commonModel.getSectionId() != null && commonModel.getDescriptionTemplate().getGroupId() != null){ + PlanDescriptionTemplateEntity planDescriptionTemplate = planDescriptionTemplates.stream().filter(x -> x.getDescriptionTemplateGroupId().equals(commonModel.getDescriptionTemplate().getGroupId()) && x.getSectionId().equals(commonModel.getSectionId())).findFirst().orElse(null); - if (dmpDescriptionTemplate == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{commonModel.getDescriptionTemplate().getGroupId(), DmpDescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale())); - return dmpDescriptionTemplate.getId(); + if (planDescriptionTemplate == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{commonModel.getDescriptionTemplate().getGroupId(), PlanDescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale())); + return planDescriptionTemplate.getId(); } } return null; diff --git a/backend/core/src/main/java/org/opencdmp/service/dmp/DmpService.java b/backend/core/src/main/java/org/opencdmp/service/dmp/DmpService.java deleted file mode 100644 index 28d9244d4..000000000 --- a/backend/core/src/main/java/org/opencdmp/service/dmp/DmpService.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.opencdmp.service.dmp; - -import gr.cite.tools.exception.MyApplicationException; -import gr.cite.tools.exception.MyForbiddenException; -import gr.cite.tools.exception.MyNotFoundException; -import gr.cite.tools.exception.MyValidationException; -import gr.cite.tools.fieldset.FieldSet; -import jakarta.xml.bind.JAXBException; -import org.opencdmp.commons.types.dmp.importexport.DmpImportExport; -import org.opencdmp.filetransformerbase.models.misc.PreprocessingDmpModel; -import org.opencdmp.model.DmpUser; -import org.opencdmp.model.DmpValidationResult; -import org.opencdmp.model.dmp.Dmp; -import org.opencdmp.model.persist.*; -import org.springframework.http.ResponseEntity; -import org.xml.sax.SAXException; - -import javax.crypto.BadPaddingException; -import javax.crypto.IllegalBlockSizeException; -import javax.crypto.NoSuchPaddingException; -import javax.management.InvalidApplicationException; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.TransformerException; -import java.io.IOException; -import java.security.InvalidAlgorithmParameterException; -import java.security.InvalidKeyException; -import java.security.NoSuchAlgorithmException; -import java.util.List; -import java.util.UUID; - -public interface DmpService { - - Dmp persist(DmpPersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, JAXBException, IOException; - - void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException, IOException; - - void finalize(UUID id, List descriptionIds) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, IOException; - - void undoFinalize(UUID id, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, IOException; - - DmpValidationResult validate(UUID id) throws InvalidApplicationException; - - Dmp createNewVersion(NewVersionDmpPersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, IOException, TransformerException; - - Dmp buildClone(CloneDmpPersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, IOException, InvalidApplicationException; - - List assignUsers(UUID dmp, List model, FieldSet fields, boolean disableDelete) throws InvalidApplicationException, IOException; - Dmp removeUser(DmpUserRemovePersist model, FieldSet fields) throws InvalidApplicationException, IOException; - - ResponseEntity export(UUID id, String transformerId, String exportType) throws InvalidApplicationException, IOException, InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException; - - void inviteUserOrAssignUsers(UUID id, List users) throws InvalidApplicationException, JAXBException, IOException; - - void dmpInvitationAccept(String token) throws InvalidApplicationException, IOException; - - DmpImportExport exportXmlEntity(UUID id, boolean ignoreAuthorize) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException; - - ResponseEntity exportXml(UUID id) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException; - - Dmp importXml(byte[] bytes, String label, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException; - - Dmp importJson(DmpCommonModelConfig dmpCommonModelConfig, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, InvalidApplicationException, IOException, InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, ParserConfigurationException, TransformerException, InstantiationException, IllegalAccessException, SAXException; - - PreprocessingDmpModel preprocessingDmp(UUID fileId, String repositoryId) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, IOException; -} diff --git a/backend/core/src/main/java/org/opencdmp/service/dmpblueprint/DmpBlueprintService.java b/backend/core/src/main/java/org/opencdmp/service/dmpblueprint/DmpBlueprintService.java deleted file mode 100644 index b8d6b04f7..000000000 --- a/backend/core/src/main/java/org/opencdmp/service/dmpblueprint/DmpBlueprintService.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.opencdmp.service.dmpblueprint; - -import com.fasterxml.jackson.core.JsonProcessingException; -import gr.cite.tools.exception.MyApplicationException; -import gr.cite.tools.exception.MyForbiddenException; -import gr.cite.tools.exception.MyNotFoundException; -import gr.cite.tools.exception.MyValidationException; -import gr.cite.tools.fieldset.FieldSet; -import jakarta.xml.bind.JAXBException; -import org.opencdmp.commonmodels.models.dmpblueprint.DmpBlueprintModel; -import org.opencdmp.commons.enums.DmpBlueprintSystemFieldType; -import org.opencdmp.commons.types.dmpblueprint.importexport.BlueprintImportExport; -import org.opencdmp.data.DmpBlueprintEntity; -import org.opencdmp.model.dmpblueprint.DmpBlueprint; -import org.opencdmp.model.persist.DmpBlueprintPersist; -import org.opencdmp.model.persist.NewVersionDmpBlueprintPersist; -import org.springframework.http.ResponseEntity; -import org.xml.sax.SAXException; - -import javax.management.InvalidApplicationException; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.TransformerException; -import java.io.IOException; -import java.util.UUID; - -public interface DmpBlueprintService { - - DmpBlueprint persist(DmpBlueprintPersist model, UUID groupId, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, JAXBException, JsonProcessingException, TransformerException, ParserConfigurationException; - - void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException; - boolean fieldInBlueprint(DmpBlueprintEntity dmpBlueprintEntity, DmpBlueprintSystemFieldType type); - - boolean fieldInBlueprint(UUID id, DmpBlueprintSystemFieldType type) throws InvalidApplicationException; - - DmpBlueprint buildClone(UUID id, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException; - - DmpBlueprint createNewVersion(NewVersionDmpBlueprintPersist model, FieldSet fieldSet) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, JsonProcessingException, TransformerException; - - BlueprintImportExport getExportXmlEntity(UUID id, boolean ignoreAuthorize) throws MyForbiddenException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException; - - ResponseEntity exportXml(UUID id) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, TransformerException, InvalidApplicationException; - - DmpBlueprint importXml(BlueprintImportExport dmpDefinition, UUID groupId, String label, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException; - - DmpBlueprint importXml(byte[] bytes, UUID groupId, String label, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException; - DmpBlueprint importCommonModel(DmpBlueprintModel dmpDefinition, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException; -} diff --git a/backend/core/src/main/java/org/opencdmp/service/elastic/ElasticQueryHelperService.java b/backend/core/src/main/java/org/opencdmp/service/elastic/ElasticQueryHelperService.java index 89e764e67..64a48e26e 100644 --- a/backend/core/src/main/java/org/opencdmp/service/elastic/ElasticQueryHelperService.java +++ b/backend/core/src/main/java/org/opencdmp/service/elastic/ElasticQueryHelperService.java @@ -3,19 +3,19 @@ package org.opencdmp.service.elastic; import org.opencdmp.authorization.AuthorizationFlags; import org.opencdmp.model.*; import org.opencdmp.model.description.Description; -import org.opencdmp.model.dmp.Dmp; +import org.opencdmp.model.plan.Plan; import org.opencdmp.model.result.QueryResult; import org.opencdmp.query.lookup.DescriptionLookup; -import org.opencdmp.query.lookup.DmpLookup; +import org.opencdmp.query.lookup.PlanLookup; import gr.cite.tools.fieldset.FieldSet; import java.util.EnumSet; public interface ElasticQueryHelperService { - QueryResult collect(DmpLookup lookup, EnumSet authorizationFlags, FieldSet fieldSet); - QueryResult collectPublic(DmpLookup lookup, EnumSet authorizationFlags, FieldSet fieldSet); - long count(DmpLookup lookup, EnumSet authorizationFlags); + QueryResult collect(PlanLookup lookup, EnumSet authorizationFlags, FieldSet fieldSet); + QueryResult collectPublic(PlanLookup lookup, EnumSet authorizationFlags, FieldSet fieldSet); + long count(PlanLookup lookup, EnumSet authorizationFlags); QueryResult collect(DescriptionLookup lookup, EnumSet authorizationFlags, FieldSet fieldSet); QueryResult collectPublic(DescriptionLookup lookup, EnumSet authorizationFlags, FieldSet fieldSet); long count(DescriptionLookup lookup, EnumSet authorizationFlags); diff --git a/backend/core/src/main/java/org/opencdmp/service/elastic/ElasticQueryHelperServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/elastic/ElasticQueryHelperServiceImpl.java index 2054c2a7f..e71357b9c 100644 --- a/backend/core/src/main/java/org/opencdmp/service/elastic/ElasticQueryHelperServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/elastic/ElasticQueryHelperServiceImpl.java @@ -7,22 +7,22 @@ import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.logging.LoggerService; import org.opencdmp.authorization.AuthorizationFlags; import org.opencdmp.data.DescriptionEntity; -import org.opencdmp.data.DmpEntity; +import org.opencdmp.data.PlanEntity; import org.opencdmp.elastic.data.DescriptionElasticEntity; -import org.opencdmp.elastic.data.DmpElasticEntity; +import org.opencdmp.elastic.data.PlanElasticEntity; import org.opencdmp.model.PublicDescription; -import org.opencdmp.model.PublicDmp; +import org.opencdmp.model.PublicPlan; import org.opencdmp.model.builder.PublicDescriptionBuilder; -import org.opencdmp.model.builder.PublicDmpBuilder; +import org.opencdmp.model.builder.PublicPlanBuilder; import org.opencdmp.model.builder.description.DescriptionBuilder; -import org.opencdmp.model.builder.dmp.DmpBuilder; +import org.opencdmp.model.builder.plan.PlanBuilder; import org.opencdmp.model.description.Description; -import org.opencdmp.model.dmp.Dmp; +import org.opencdmp.model.plan.Plan; import org.opencdmp.model.result.QueryResult; import org.opencdmp.query.DescriptionQuery; -import org.opencdmp.query.DmpQuery; +import org.opencdmp.query.PlanQuery; import org.opencdmp.query.lookup.DescriptionLookup; -import org.opencdmp.query.lookup.DmpLookup; +import org.opencdmp.query.lookup.PlanLookup; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; @@ -46,25 +46,25 @@ public class ElasticQueryHelperServiceImpl implements ElasticQueryHelperService } @Override - public QueryResult collect(DmpLookup lookup, EnumSet authorizationFlags, FieldSet fieldSet) { + public QueryResult collect(PlanLookup lookup, EnumSet authorizationFlags, FieldSet fieldSet) { EnumSet flags = authorizationFlags == null ? EnumSet.of(AuthorizationFlags.None) : authorizationFlags; - return this.collect(lookup, (d) -> this.builderFactory.builder(DmpBuilder.class).authorize(flags).build(fieldSet != null ? fieldSet : lookup.getProject(), d), flags); + return this.collect(lookup, (d) -> this.builderFactory.builder(PlanBuilder.class).authorize(flags).build(fieldSet != null ? fieldSet : lookup.getProject(), d), flags); } @Override - public QueryResult collectPublic(DmpLookup lookup, EnumSet authorizationFlags, FieldSet fieldSet) { + public QueryResult collectPublic(PlanLookup lookup, EnumSet authorizationFlags, FieldSet fieldSet) { EnumSet flags = authorizationFlags == null ? EnumSet.of(AuthorizationFlags.None) : authorizationFlags; - return this.collect(lookup, (d) -> this.builderFactory.builder(PublicDmpBuilder.class).authorize(flags).build(fieldSet != null ? fieldSet : lookup.getProject(), d), flags); + return this.collect(lookup, (d) -> this.builderFactory.builder(PublicPlanBuilder.class).authorize(flags).build(fieldSet != null ? fieldSet : lookup.getProject(), d), flags); } - private QueryResult collect(DmpLookup lookup, Function, List> buildFunc, EnumSet flags) { - DmpQuery query = null; + private QueryResult collect(PlanLookup lookup, Function, List> buildFunc, EnumSet flags) { + PlanQuery query = null; QueryResult result = new QueryResult<>(); boolean elasticFilterUsed = false; if (lookup.useElastic() && this.elasticService.enabled()){ try { - List elasticResponse = lookup.enrichElastic(this.queryFactory).authorize(flags).collectAs(new BaseFieldSet().ensure(DmpElasticEntity._id)); - query = this.queryFactory.query(DmpQuery.class).authorize(flags).ids(elasticResponse.stream().map(DmpElasticEntity::getId).toList()); + List elasticResponse = lookup.enrichElastic(this.queryFactory).authorize(flags).collectAs(new BaseFieldSet().ensure(PlanElasticEntity._id)); + query = this.queryFactory.query(PlanQuery.class).authorize(flags).ids(elasticResponse.stream().map(PlanElasticEntity::getId).toList()); query.setOrder(lookup.enrich(this.queryFactory).getOrder()); if (lookup.getMetadata() != null && lookup.getMetadata().countAll) result.setCount(lookup.enrichElastic(this.queryFactory).authorize(flags).count()); elasticFilterUsed = true; @@ -89,7 +89,7 @@ public class ElasticQueryHelperServiceImpl implements ElasticQueryHelperService } @Override - public long count(DmpLookup lookup, EnumSet authorizationFlags) { + public long count(PlanLookup lookup, EnumSet authorizationFlags) { EnumSet flags = authorizationFlags == null ? EnumSet.of(AuthorizationFlags.None) : authorizationFlags; if (lookup.useElastic() && this.elasticService.enabled()){ try { diff --git a/backend/core/src/main/java/org/opencdmp/service/elastic/ElasticService.java b/backend/core/src/main/java/org/opencdmp/service/elastic/ElasticService.java index b60126f3c..a3fdfeaf8 100644 --- a/backend/core/src/main/java/org/opencdmp/service/elastic/ElasticService.java +++ b/backend/core/src/main/java/org/opencdmp/service/elastic/ElasticService.java @@ -1,36 +1,36 @@ package org.opencdmp.service.elastic; import org.opencdmp.data.DescriptionEntity; -import org.opencdmp.data.DmpEntity; +import org.opencdmp.data.PlanEntity; import javax.management.InvalidApplicationException; import java.io.IOException; public interface ElasticService { boolean enabled(); - boolean existsDmpIndex() throws IOException; + boolean existsPlanIndex() throws IOException; boolean existsDescriptionIndex() throws IOException; - void ensureDmpIndex() throws IOException; + void ensurePlanIndex() throws IOException; void ensureDescriptionIndex() throws IOException; void ensureIndexes() throws IOException; - void persistDmp(DmpEntity dmp) throws IOException; + void persistPlan(PlanEntity dmp) throws IOException; - void deleteDmp(DmpEntity dmp) throws IOException; + void deletePlan(PlanEntity dmp) throws IOException; void persistDescription(DescriptionEntity description) throws IOException, InvalidApplicationException; void deleteDescription(DescriptionEntity description) throws IOException, InvalidApplicationException; - void deleteDmpIndex() throws IOException; + void deletePlanIndex() throws IOException; void deleteDescriptionIndex() throws IOException; - void resetDmpIndex() throws IOException, InvalidApplicationException; + void resetPlanIndex() throws IOException, InvalidApplicationException; void resetDescriptionIndex() throws IOException, InvalidApplicationException; } diff --git a/backend/core/src/main/java/org/opencdmp/service/elastic/ElasticServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/elastic/ElasticServiceImpl.java index 73684f3ad..243456f13 100644 --- a/backend/core/src/main/java/org/opencdmp/service/elastic/ElasticServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/elastic/ElasticServiceImpl.java @@ -17,18 +17,18 @@ import gr.cite.tools.logging.MapLogEntry; import org.opencdmp.authorization.Permission; import org.opencdmp.commons.enums.IsActive; import org.opencdmp.data.DescriptionEntity; -import org.opencdmp.data.DmpEntity; +import org.opencdmp.data.PlanEntity; import org.opencdmp.data.TenantEntityManager; import org.opencdmp.elastic.data.DescriptionElasticEntity; -import org.opencdmp.elastic.data.DmpElasticEntity; +import org.opencdmp.elastic.data.PlanElasticEntity; import org.opencdmp.elastic.data.nested.*; import org.opencdmp.elastic.elasticbuilder.DescriptionElasticBuilder; -import org.opencdmp.elastic.elasticbuilder.DmpElasticBuilder; +import org.opencdmp.elastic.elasticbuilder.PlanElasticBuilder; import org.opencdmp.model.description.Description; -import org.opencdmp.model.dmp.Dmp; +import org.opencdmp.model.plan.Plan; import org.opencdmp.query.DescriptionQuery; -import org.opencdmp.query.DmpQuery; -import org.opencdmp.service.dmpblueprint.DmpBlueprintServiceImpl; +import org.opencdmp.query.PlanQuery; +import org.opencdmp.service.planblueprint.PlanBlueprintServiceImpl; import org.slf4j.LoggerFactory; import org.springframework.context.MessageSource; import org.springframework.context.i18n.LocaleContextHolder; @@ -45,7 +45,7 @@ import java.util.Map; @Service public class ElasticServiceImpl implements ElasticService { - private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpBlueprintServiceImpl.class)); + private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PlanBlueprintServiceImpl.class)); public final AppElasticConfiguration appElasticConfiguration; private final ElasticsearchClient restHighLevelClient; private final ElasticsearchTemplate elasticsearchTemplate; @@ -72,7 +72,7 @@ public class ElasticServiceImpl implements ElasticService { } @Override - public boolean existsDmpIndex() throws IOException { + public boolean existsPlanIndex() throws IOException { if (!this.enabled()) return false; return this.restHighLevelClient.indices().exists(new ExistsRequest.Builder().index(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName()).includeDefaults(true).build()).value(); } @@ -87,9 +87,9 @@ public class ElasticServiceImpl implements ElasticService { //region ensure index @Override - public void ensureDmpIndex() throws IOException { + public void ensurePlanIndex() throws IOException { if (!this.enabled()) return ; - boolean exists = this.existsDmpIndex(); + boolean exists = this.existsPlanIndex(); if (exists) return ; this.ensureIndex(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName(), this.createDmpTemplatePropertyMap()); @@ -107,7 +107,7 @@ public class ElasticServiceImpl implements ElasticService { public void ensureIndexes() throws IOException { if (!this.enabled()) return ; - this.ensureDmpIndex(); + this.ensurePlanIndex(); this.ensureDescriptionIndex(); } @@ -150,35 +150,35 @@ public class ElasticServiceImpl implements ElasticService { private Map createDmpTemplatePropertyMap(){ Map propertyMap = new HashMap<>(); - propertyMap.put(DmpElasticEntity._id, this.createElastic(FieldType.Keyword, false)); - propertyMap.put(DmpElasticEntity._tenantId, this.createElastic(FieldType.Keyword, false)); - propertyMap.put(DmpElasticEntity._label, this.createElastic(FieldType.Text, true)); - propertyMap.put(DmpElasticEntity._description, this.createElastic(FieldType.Text, false)); - propertyMap.put(DmpElasticEntity._status, this.createElastic(FieldType.Short, false)); - propertyMap.put(DmpElasticEntity._version, this.createElastic(FieldType.Short, false)); - propertyMap.put(DmpElasticEntity._language, this.createElastic(FieldType.Keyword, false)); - propertyMap.put(DmpElasticEntity._blueprintId, this.createElastic(FieldType.Keyword, false)); - propertyMap.put(DmpElasticEntity._accessType, this.createElastic(FieldType.Short, false)); - propertyMap.put(DmpElasticEntity._groupId, this.createElastic(FieldType.Keyword, false)); - propertyMap.put(DmpElasticEntity._finalizedAt, this.createElastic(FieldType.Date, false)); - propertyMap.put(DmpElasticEntity._updatedAt, this.createElastic(FieldType.Date, false)); - propertyMap.put(DmpElasticEntity._createdAt, this.createElastic(FieldType.Date, false)); - propertyMap.put(DmpElasticEntity._versionStatus, this.createElastic(FieldType.Short, false)); + propertyMap.put(PlanElasticEntity._id, this.createElastic(FieldType.Keyword, false)); + propertyMap.put(PlanElasticEntity._tenantId, this.createElastic(FieldType.Keyword, false)); + propertyMap.put(PlanElasticEntity._label, this.createElastic(FieldType.Text, true)); + propertyMap.put(PlanElasticEntity._description, this.createElastic(FieldType.Text, false)); + propertyMap.put(PlanElasticEntity._status, this.createElastic(FieldType.Short, false)); + propertyMap.put(PlanElasticEntity._version, this.createElastic(FieldType.Short, false)); + propertyMap.put(PlanElasticEntity._language, this.createElastic(FieldType.Keyword, false)); + propertyMap.put(PlanElasticEntity._blueprintId, this.createElastic(FieldType.Keyword, false)); + propertyMap.put(PlanElasticEntity._accessType, this.createElastic(FieldType.Short, false)); + propertyMap.put(PlanElasticEntity._groupId, this.createElastic(FieldType.Keyword, false)); + propertyMap.put(PlanElasticEntity._finalizedAt, this.createElastic(FieldType.Date, false)); + propertyMap.put(PlanElasticEntity._updatedAt, this.createElastic(FieldType.Date, false)); + propertyMap.put(PlanElasticEntity._createdAt, this.createElastic(FieldType.Date, false)); + propertyMap.put(PlanElasticEntity._versionStatus, this.createElastic(FieldType.Short, false)); - propertyMap.put(DmpElasticEntity._descriptions, new Property.Builder().nested(x -> x.properties(this.createNestedDescriptionTemplatePropertyMap())).build()); - propertyMap.put(DmpElasticEntity._dmpDescriptionTemplates, new Property.Builder().nested(x -> x.properties(this.createNestedDmpDescriptionTemplateElasticEntityPropertyMap())).build()); - propertyMap.put(DmpElasticEntity._references, new Property.Builder().nested(x -> x.properties(this.createNestedReferencesTemplatePropertyMap())).build()); - propertyMap.put(DmpElasticEntity._collaborators, new Property.Builder().nested(x -> x.properties(this.createNestedCollaboratorTemplatePropertyMap())).build()); - propertyMap.put(DmpElasticEntity._dois, new Property.Builder().nested(x -> x.properties(this.createNestedDoisTemplatePropertyMap())).build()); + propertyMap.put(PlanElasticEntity._descriptions, new Property.Builder().nested(x -> x.properties(this.createNestedDescriptionTemplatePropertyMap())).build()); + propertyMap.put(PlanElasticEntity._dmpDescriptionTemplates, new Property.Builder().nested(x -> x.properties(this.createNestedDmpDescriptionTemplateElasticEntityPropertyMap())).build()); + propertyMap.put(PlanElasticEntity._references, new Property.Builder().nested(x -> x.properties(this.createNestedReferencesTemplatePropertyMap())).build()); + propertyMap.put(PlanElasticEntity._collaborators, new Property.Builder().nested(x -> x.properties(this.createNestedCollaboratorTemplatePropertyMap())).build()); + propertyMap.put(PlanElasticEntity._dois, new Property.Builder().nested(x -> x.properties(this.createNestedDoisTemplatePropertyMap())).build()); return propertyMap; } private Map createNestedDmpDescriptionTemplateElasticEntityPropertyMap(){ Map propertyMap = new HashMap<>(); - propertyMap.put(NestedDmpDescriptionTemplateElasticEntity._id, this.createElastic(FieldType.Keyword, false)); - propertyMap.put(NestedDmpDescriptionTemplateElasticEntity._descriptionTemplateGroupId, this.createElastic(FieldType.Keyword, false)); - propertyMap.put(NestedDmpDescriptionTemplateElasticEntity._sectionId, this.createElastic(FieldType.Keyword, false)); - propertyMap.put(NestedDmpDescriptionTemplateElasticEntity._dmpId, this.createElastic(FieldType.Keyword, false)); + propertyMap.put(NestedPlanDescriptionTemplateElasticEntity._id, this.createElastic(FieldType.Keyword, false)); + propertyMap.put(NestedPlanDescriptionTemplateElasticEntity._descriptionTemplateGroupId, this.createElastic(FieldType.Keyword, false)); + propertyMap.put(NestedPlanDescriptionTemplateElasticEntity._sectionId, this.createElastic(FieldType.Keyword, false)); + propertyMap.put(NestedPlanDescriptionTemplateElasticEntity._dmpId, this.createElastic(FieldType.Keyword, false)); return propertyMap; } @@ -227,21 +227,21 @@ public class ElasticServiceImpl implements ElasticService { private Map createNetsedDmpTemplatePropertyMap(){ Map propertyMap = new HashMap<>(); - propertyMap.put(NestedDmpElasticEntity._id, this.createElastic(FieldType.Keyword, false)); - propertyMap.put(NestedDmpElasticEntity._label, this.createElastic(FieldType.Text, true)); - propertyMap.put(NestedDmpElasticEntity._description, this.createElastic(FieldType.Text, false)); - propertyMap.put(NestedDmpElasticEntity._status, this.createElastic(FieldType.Short, false)); - propertyMap.put(NestedDmpElasticEntity._version, this.createElastic(FieldType.Short, false)); - propertyMap.put(NestedDmpElasticEntity._versionStatus, this.createElastic(FieldType.Short, false)); - propertyMap.put(NestedDmpElasticEntity._language, this.createElastic(FieldType.Keyword, false)); - propertyMap.put(NestedDmpElasticEntity._blueprintId, this.createElastic(FieldType.Keyword, false)); - propertyMap.put(NestedDmpElasticEntity._accessType, this.createElastic(FieldType.Short, false)); - propertyMap.put(NestedDmpElasticEntity._groupId, this.createElastic(FieldType.Keyword, false)); - propertyMap.put(NestedDmpElasticEntity._finalizedAt, this.createElastic(FieldType.Date, false)); + propertyMap.put(NestedPlanElasticEntity._id, this.createElastic(FieldType.Keyword, false)); + propertyMap.put(NestedPlanElasticEntity._label, this.createElastic(FieldType.Text, true)); + propertyMap.put(NestedPlanElasticEntity._description, this.createElastic(FieldType.Text, false)); + propertyMap.put(NestedPlanElasticEntity._status, this.createElastic(FieldType.Short, false)); + propertyMap.put(NestedPlanElasticEntity._version, this.createElastic(FieldType.Short, false)); + propertyMap.put(NestedPlanElasticEntity._versionStatus, this.createElastic(FieldType.Short, false)); + propertyMap.put(NestedPlanElasticEntity._language, this.createElastic(FieldType.Keyword, false)); + propertyMap.put(NestedPlanElasticEntity._blueprintId, this.createElastic(FieldType.Keyword, false)); + propertyMap.put(NestedPlanElasticEntity._accessType, this.createElastic(FieldType.Short, false)); + propertyMap.put(NestedPlanElasticEntity._groupId, this.createElastic(FieldType.Keyword, false)); + propertyMap.put(NestedPlanElasticEntity._finalizedAt, this.createElastic(FieldType.Date, false)); - propertyMap.put(NestedDmpElasticEntity._references, new Property.Builder().nested(x -> x.properties(this.createNestedReferencesTemplatePropertyMap())).build()); - propertyMap.put(NestedDmpElasticEntity._collaborators, new Property.Builder().nested(x -> x.properties(this.createNestedCollaboratorTemplatePropertyMap())).build()); - propertyMap.put(NestedDmpElasticEntity._dois, new Property.Builder().nested(x -> x.properties(this.createNestedDoisTemplatePropertyMap())).build()); + propertyMap.put(NestedPlanElasticEntity._references, new Property.Builder().nested(x -> x.properties(this.createNestedReferencesTemplatePropertyMap())).build()); + propertyMap.put(NestedPlanElasticEntity._collaborators, new Property.Builder().nested(x -> x.properties(this.createNestedCollaboratorTemplatePropertyMap())).build()); + propertyMap.put(NestedPlanElasticEntity._dois, new Property.Builder().nested(x -> x.properties(this.createNestedDoisTemplatePropertyMap())).build()); return propertyMap; } @@ -289,24 +289,24 @@ public class ElasticServiceImpl implements ElasticService { //region persist delete @Override - public void persistDmp(DmpEntity dmp) throws IOException { + public void persistPlan(PlanEntity dmp) throws IOException { if (!this.enabled()) return; this.ensureIndexes(); - DmpElasticEntity dmpElasticEntity = this.builderFactory.builder(DmpElasticBuilder.class).build(dmp); - this.elasticsearchTemplate.save(dmpElasticEntity, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName())); - List descriptions = this.builderFactory.builder(DescriptionElasticBuilder.class).build(this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).dmpSubQuery(this.queryFactory.query(DmpQuery.class).ids(dmp.getId())).collect()); + PlanElasticEntity planElasticEntity = this.builderFactory.builder(PlanElasticBuilder.class).build(dmp); + this.elasticsearchTemplate.save(planElasticEntity, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName())); + List descriptions = this.builderFactory.builder(DescriptionElasticBuilder.class).build(this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).dmpSubQuery(this.queryFactory.query(PlanQuery.class).ids(dmp.getId())).collect()); this.elasticsearchTemplate.save(descriptions, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getDescriptionIndexName())); } @Override - public void deleteDmp(DmpEntity dmp) throws IOException { + public void deletePlan(PlanEntity dmp) throws IOException { if (!this.enabled()) return; this.ensureIndexes(); - DmpElasticEntity dmpElasticEntity = this.elasticsearchTemplate.get(dmp.getId().toString(),DmpElasticEntity.class, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName())); - if (dmpElasticEntity == null) return; - this.elasticsearchTemplate.delete(dmpElasticEntity, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName())); - List descriptions = this.queryFactory.query(DescriptionQuery.class).dmpSubQuery(this.queryFactory.query(DmpQuery.class).disableTracking().ids(dmp.getId())).collectAs(new BaseFieldSet().ensure(Description._id)); + PlanElasticEntity planElasticEntity = this.elasticsearchTemplate.get(dmp.getId().toString(), PlanElasticEntity.class, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName())); + if (planElasticEntity == null) return; + this.elasticsearchTemplate.delete(planElasticEntity, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName())); + List descriptions = this.queryFactory.query(DescriptionQuery.class).dmpSubQuery(this.queryFactory.query(PlanQuery.class).disableTracking().ids(dmp.getId())).collectAs(new BaseFieldSet().ensure(Description._id)); for (DescriptionEntity description: descriptions) { DescriptionElasticEntity descriptionElasticEntity = this.elasticsearchTemplate.get(description.getId().toString(), DescriptionElasticEntity.class, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getDescriptionIndexName())); if (descriptionElasticEntity == null) continue; @@ -321,11 +321,11 @@ public class ElasticServiceImpl implements ElasticService { DescriptionElasticEntity descriptionElasticEntity = this.builderFactory.builder(DescriptionElasticBuilder.class).build(description); this.elasticsearchTemplate.save(descriptionElasticEntity, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getDescriptionIndexName())); - DmpEntity dmpEntity = this.entityManager.find(DmpEntity.class, description.getDmpId(), true); - if (dmpEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{description.getDmpId(), Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale())); - if (dmpEntity.getIsActive().equals(IsActive.Active)) { - DmpElasticEntity dmpElasticEntity = this.builderFactory.builder(DmpElasticBuilder.class).build(dmpEntity); - this.elasticsearchTemplate.save(dmpElasticEntity, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName())); + PlanEntity planEntity = this.entityManager.find(PlanEntity.class, description.getPlanId(), true); + if (planEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{description.getPlanId(), Plan.class.getSimpleName()}, LocaleContextHolder.getLocale())); + if (planEntity.getIsActive().equals(IsActive.Active)) { + PlanElasticEntity planElasticEntity = this.builderFactory.builder(PlanElasticBuilder.class).build(planEntity); + this.elasticsearchTemplate.save(planElasticEntity, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName())); } } @@ -338,11 +338,11 @@ public class ElasticServiceImpl implements ElasticService { if (descriptionElasticEntity == null) return; this.elasticsearchTemplate.delete(descriptionElasticEntity, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getDescriptionIndexName())); - DmpEntity dmpEntity = this.entityManager.find(DmpEntity.class, description.getDmpId(), true); - if (dmpEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{description.getDmpId(), Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale())); - if (dmpEntity.getIsActive().equals(IsActive.Active)) { - DmpElasticEntity dmpElasticEntity = this.builderFactory.builder(DmpElasticBuilder.class).build(dmpEntity); - this.elasticsearchTemplate.save(dmpElasticEntity, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName())); + PlanEntity planEntity = this.entityManager.find(PlanEntity.class, description.getPlanId(), true); + if (planEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{description.getPlanId(), Plan.class.getSimpleName()}, LocaleContextHolder.getLocale())); + if (planEntity.getIsActive().equals(IsActive.Active)) { + PlanElasticEntity planElasticEntity = this.builderFactory.builder(PlanElasticBuilder.class).build(planEntity); + this.elasticsearchTemplate.save(planElasticEntity, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName())); } } @@ -351,12 +351,12 @@ public class ElasticServiceImpl implements ElasticService { //region manage @Override - public void deleteDmpIndex() throws IOException { + public void deletePlanIndex() throws IOException { logger.debug(new MapLogEntry("delete dmp index")); this.authorizationService.authorizeForce(Permission.ManageElastic); if (!this.enabled()) return; - boolean exists = this.existsDmpIndex(); + boolean exists = this.existsPlanIndex(); if (!exists) return ; this.restHighLevelClient.indices().delete(new DeleteIndexRequest.Builder().index(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName()).build()); @@ -374,27 +374,27 @@ public class ElasticServiceImpl implements ElasticService { } @Override - public void resetDmpIndex() throws IOException, InvalidApplicationException { + public void resetPlanIndex() throws IOException, InvalidApplicationException { logger.debug(new MapLogEntry("reset dmp index")); this.authorizationService.authorizeForce(Permission.ManageElastic); if (!this.enabled()) return; - this.deleteDmpIndex(); - this.ensureDmpIndex(); + this.deletePlanIndex(); + this.ensurePlanIndex(); try { this.entityManager.disableTenantFilters(); int page = 0; int pageSize = this.appElasticConfiguration.getAppElasticProperties().getResetBatchSize(); - List items; + List items; do { - DmpQuery query = this.queryFactory.query(DmpQuery.class).disableTracking(); - query.setOrder(new Ordering().addAscending(Dmp._createdAt)); + PlanQuery query = this.queryFactory.query(PlanQuery.class).disableTracking(); + query.setOrder(new Ordering().addAscending(Plan._createdAt)); query.setPage(new Paging(page * pageSize, pageSize)); items = query.collect(); if (items != null && !items.isEmpty()) { - List elasticEntities = this.builderFactory.builder(DmpElasticBuilder.class).build(items); + List elasticEntities = this.builderFactory.builder(PlanElasticBuilder.class).build(items); this.elasticsearchTemplate.save(elasticEntities, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName())); page++; } diff --git a/backend/core/src/main/java/org/opencdmp/service/filetransformer/FileTransformerService.java b/backend/core/src/main/java/org/opencdmp/service/filetransformer/FileTransformerService.java index d86214fb7..d7a66e98c 100644 --- a/backend/core/src/main/java/org/opencdmp/service/filetransformer/FileTransformerService.java +++ b/backend/core/src/main/java/org/opencdmp/service/filetransformer/FileTransformerService.java @@ -4,7 +4,7 @@ import jakarta.xml.bind.JAXBException; import org.opencdmp.commonmodels.models.dmp.DmpModel; import org.opencdmp.filetransformerbase.models.misc.PreprocessingDmpModel; import org.opencdmp.model.file.RepositoryFileFormat; -import org.opencdmp.model.persist.DmpCommonModelConfig; +import org.opencdmp.model.persist.PlanCommonModelConfig; import javax.crypto.BadPaddingException; import javax.crypto.IllegalBlockSizeException; @@ -24,7 +24,7 @@ public interface FileTransformerService { org.opencdmp.model.file.FileEnvelope exportDescription(UUID descriptionId, String repositoryId, String format) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException; - DmpModel importDmp(DmpCommonModelConfig dmpCommonModelConfig) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, IOException, JAXBException; + DmpModel importDmp(PlanCommonModelConfig planCommonModelConfig) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, IOException, JAXBException; PreprocessingDmpModel preprocessingDmp(UUID fileId, String repositoryId) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, IOException; } diff --git a/backend/core/src/main/java/org/opencdmp/service/filetransformer/FileTransformerServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/filetransformer/FileTransformerServiceImpl.java index a3a268a07..bfdff979f 100644 --- a/backend/core/src/main/java/org/opencdmp/service/filetransformer/FileTransformerServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/filetransformer/FileTransformerServiceImpl.java @@ -41,14 +41,14 @@ import org.opencdmp.filetransformerbase.models.misc.PreprocessingDmpModel; import org.opencdmp.model.StorageFile; import org.opencdmp.model.builder.commonmodels.description.DescriptionCommonModelBuilder; import org.opencdmp.model.builder.commonmodels.descriptiontemplate.DescriptionTemplateCommonModelBuilder; -import org.opencdmp.model.builder.commonmodels.dmp.DmpCommonModelBuilder; -import org.opencdmp.model.builder.commonmodels.dmpblueprint.DmpBlueprintCommonModelBuilder; +import org.opencdmp.model.builder.commonmodels.plan.PlanCommonModelBuilder; +import org.opencdmp.model.builder.commonmodels.planblueprint.PlanBlueprintCommonModelBuilder; import org.opencdmp.model.description.Description; -import org.opencdmp.model.dmp.Dmp; -import org.opencdmp.model.dmpblueprint.DmpBlueprint; +import org.opencdmp.model.plan.Plan; +import org.opencdmp.model.planblueprint.PlanBlueprint; import org.opencdmp.model.file.RepositoryFileFormat; import org.opencdmp.model.persist.DescriptionCommonModelConfig; -import org.opencdmp.model.persist.DmpCommonModelConfig; +import org.opencdmp.model.persist.PlanCommonModelConfig; import org.opencdmp.model.persist.StorageFilePersist; import org.opencdmp.model.tenantconfiguration.TenantConfiguration; import org.opencdmp.query.*; @@ -253,14 +253,14 @@ public class FileTransformerServiceImpl implements FileTransformerService { @Override public org.opencdmp.model.file.FileEnvelope exportDmp(UUID dmpId, String repositoryId, String format) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException { - this.authorizationService.authorizeForce(Permission.ExportDmp); + this.authorizationService.authorizeForce(Permission.ExportPlan); //GK: First get the right client FileTransformerRepository repository = this.getRepository(repositoryId); if (repository == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{format, FileTransformerRepository.class.getSimpleName()}, LocaleContextHolder.getLocale())); //GK: Second get the Target Data Management Plan - DmpQuery query = this.queryFactory.query(DmpQuery.class).disableTracking().authorize(AuthorizationFlags.All).ids(dmpId); - DmpModel dmpFileTransformerModel = this.builderFactory.builder(DmpCommonModelBuilder.class).useSharedStorage(repository.getConfiguration().isUseSharedStorage()).setRepositoryId(repository.getConfiguration().getFileTransformerId()).authorize(AuthorizationFlags.AllExceptPublic).build(query.first()); - if (dmpFileTransformerModel == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{dmpId, Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale())); + PlanQuery query = this.queryFactory.query(PlanQuery.class).disableTracking().authorize(AuthorizationFlags.All).ids(dmpId); + DmpModel dmpFileTransformerModel = this.builderFactory.builder(PlanCommonModelBuilder.class).useSharedStorage(repository.getConfiguration().isUseSharedStorage()).setRepositoryId(repository.getConfiguration().getFileTransformerId()).authorize(AuthorizationFlags.AllExceptPublic).build(query.first()); + if (dmpFileTransformerModel == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{dmpId, Plan.class.getSimpleName()}, LocaleContextHolder.getLocale())); FileEnvelopeModel fileEnvelope = repository.exportDmp(dmpFileTransformerModel, format); org.opencdmp.model.file.FileEnvelope result = new org.opencdmp.model.file.FileEnvelope(); @@ -313,31 +313,31 @@ public class FileTransformerServiceImpl implements FileTransformerService { } @Override - public DmpModel importDmp(DmpCommonModelConfig dmpCommonModelConfig) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, IOException, JAXBException { - this.authorizationService.authorizeForce(Permission.NewDmp); + public DmpModel importDmp(PlanCommonModelConfig planCommonModelConfig) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, IOException, JAXBException { + this.authorizationService.authorizeForce(Permission.NewPlan); - StorageFileEntity tempFile = this.queryFactory.query(StorageFileQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).ids(dmpCommonModelConfig.getFileId()).first(); + StorageFileEntity tempFile = this.queryFactory.query(StorageFileQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).ids(planCommonModelConfig.getFileId()).first(); - if (tempFile == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{dmpCommonModelConfig.getFileId(), StorageFile.class.getSimpleName()}, LocaleContextHolder.getLocale())); + if (tempFile == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{planCommonModelConfig.getFileId(), StorageFile.class.getSimpleName()}, LocaleContextHolder.getLocale())); //GK: First get the right client - FileTransformerRepository repository = this.getRepository(dmpCommonModelConfig.getRepositoryId()); - if (repository == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{dmpCommonModelConfig.getRepositoryId(), FileTransformerRepository.class.getSimpleName()}, LocaleContextHolder.getLocale())); + FileTransformerRepository repository = this.getRepository(planCommonModelConfig.getRepositoryId()); + if (repository == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{planCommonModelConfig.getRepositoryId(), FileTransformerRepository.class.getSimpleName()}, LocaleContextHolder.getLocale())); - DmpBlueprintQuery dmpBlueprintQuery = this.queryFactory.query(DmpBlueprintQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).ids(dmpCommonModelConfig.getBlueprintId()); - DmpBlueprintModel dmpBlueprintModel = this.builderFactory.builder(DmpBlueprintCommonModelBuilder.class).authorize(AuthorizationFlags.AllExceptPublic).build(dmpBlueprintQuery.first()); - if (dmpBlueprintModel == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{dmpCommonModelConfig.getBlueprintId(), DmpBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale())); + PlanBlueprintQuery planBlueprintQuery = this.queryFactory.query(PlanBlueprintQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).ids(planCommonModelConfig.getBlueprintId()); + DmpBlueprintModel dmpBlueprintModel = this.builderFactory.builder(PlanBlueprintCommonModelBuilder.class).authorize(AuthorizationFlags.AllExceptPublic).build(planBlueprintQuery.first()); + if (dmpBlueprintModel == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{planCommonModelConfig.getBlueprintId(), PlanBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale())); DmpImportModel dmpImportModel = new DmpImportModel(); dmpImportModel.setBlueprintModel(dmpBlueprintModel); - if (!this.conventionService.isListNullOrEmpty(dmpCommonModelConfig.getDescriptions())){ - List descriptionTemplateEntities = this.queryFactory.query(DescriptionTemplateQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).ids(dmpCommonModelConfig.getDescriptions().stream().map(x -> x.getTemplateId()).distinct().collect(Collectors.toList())).collect(); + if (!this.conventionService.isListNullOrEmpty(planCommonModelConfig.getDescriptions())){ + List descriptionTemplateEntities = this.queryFactory.query(DescriptionTemplateQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).ids(planCommonModelConfig.getDescriptions().stream().map(x -> x.getTemplateId()).distinct().collect(Collectors.toList())).collect(); if (descriptionTemplateEntities == null) throw new MyApplicationException("Description Templates Not Exist!"); List descriptionImportModels = new ArrayList<>(); - for (DescriptionCommonModelConfig descriptionCommonModelConfig : dmpCommonModelConfig.getDescriptions()) { + for (DescriptionCommonModelConfig descriptionCommonModelConfig : planCommonModelConfig.getDescriptions()) { DescriptionTemplateEntity descriptionTemplateEntity = descriptionTemplateEntities.stream().filter(x -> x.getId().equals(descriptionCommonModelConfig.getTemplateId())).findFirst().orElse(null); if (descriptionTemplateEntity != null){ DescriptionTemplateModel descriptionTemplateModel = this.builderFactory.builder(DescriptionTemplateCommonModelBuilder.class).authorize(AuthorizationFlags.AllExceptPublic).build(descriptionTemplateEntity); @@ -358,7 +358,7 @@ public class FileTransformerServiceImpl implements FileTransformerService { String mimeType = URLConnection.guessContentTypeFromName(originalFileName); FileEnvelopeModel fileEnvelope = new FileEnvelopeModel(); - fileEnvelope.setFile(this.storageFileService.readAsBytesSafe(dmpCommonModelConfig.getFileId())); + fileEnvelope.setFile(this.storageFileService.readAsBytesSafe(planCommonModelConfig.getFileId())); fileEnvelope.setMimeType(mimeType); fileEnvelope.setFilename(originalFileName); @@ -381,7 +381,7 @@ public class FileTransformerServiceImpl implements FileTransformerService { @Override public PreprocessingDmpModel preprocessingDmp(UUID fileId, String repositoryId) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, IOException { - this.authorizationService.authorizeForce(Permission.NewDmp); + this.authorizationService.authorizeForce(Permission.NewPlan); StorageFileEntity tempFile = this.queryFactory.query(StorageFileQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).ids(fileId).first(); diff --git a/backend/core/src/main/java/org/opencdmp/service/language/LanguageServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/language/LanguageServiceImpl.java index e4e0931d4..b82fdcd79 100644 --- a/backend/core/src/main/java/org/opencdmp/service/language/LanguageServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/language/LanguageServiceImpl.java @@ -22,7 +22,7 @@ import org.opencdmp.model.Language; import org.opencdmp.model.builder.LanguageBuilder; import org.opencdmp.model.deleter.LanguageDeleter; import org.opencdmp.model.persist.LanguagePersist; -import org.opencdmp.service.dmpblueprint.DmpBlueprintServiceImpl; +import org.opencdmp.service.planblueprint.PlanBlueprintServiceImpl; import org.opencdmp.service.storage.StorageFileService; import org.slf4j.LoggerFactory; import org.springframework.context.MessageSource; @@ -39,7 +39,7 @@ import java.util.UUID; @Service public class LanguageServiceImpl implements LanguageService { - private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpBlueprintServiceImpl.class)); + private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PlanBlueprintServiceImpl.class)); private final TenantEntityManager entityManager; private final AuthorizationService authorizationService; private final DeleterFactory deleterFactory; diff --git a/backend/core/src/main/java/org/opencdmp/service/maintenance/MaintenanceServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/maintenance/MaintenanceServiceImpl.java index 5ddaf7cdb..8d39f5daf 100644 --- a/backend/core/src/main/java/org/opencdmp/service/maintenance/MaintenanceServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/maintenance/MaintenanceServiceImpl.java @@ -17,10 +17,10 @@ import org.opencdmp.integrationevent.outbox.userremoval.UserRemovalIntegrationEv import org.opencdmp.integrationevent.outbox.usertouched.UserTouchedIntegrationEventHandler; import org.opencdmp.model.Tenant; import org.opencdmp.model.description.Description; -import org.opencdmp.model.dmp.Dmp; +import org.opencdmp.model.plan.Plan; import org.opencdmp.model.user.User; import org.opencdmp.query.DescriptionQuery; -import org.opencdmp.query.DmpQuery; +import org.opencdmp.query.PlanQuery; import org.opencdmp.query.TenantQuery; import org.opencdmp.query.UserQuery; import org.slf4j.LoggerFactory; @@ -141,9 +141,9 @@ public class MaintenanceServiceImpl implements MaintenanceService { private void sendTenantDmpTouchEvents(UUID tenantId, String tenantCode) throws InvalidApplicationException { try { this.tenantScope.setTempTenant(this.entityManager, tenantId, tenantCode); - List items = this.queryFactory.query(DmpQuery.class).disableTracking().collectAs(new BaseFieldSet().ensure(Dmp._id).ensure(Dmp._isActive)); - for (DmpEntity item : items) { - if (item.getIsActive().equals(IsActive.Active)) this.annotationEntityTouchedIntegrationEventHandler.handleDmp(item.getId()); + List items = this.queryFactory.query(PlanQuery.class).disableTracking().collectAs(new BaseFieldSet().ensure(Plan._id).ensure(Plan._isActive)); + for (PlanEntity item : items) { + if (item.getIsActive().equals(IsActive.Active)) this.annotationEntityTouchedIntegrationEventHandler.handlePlan(item.getId()); else this.annotationEntityRemovalIntegrationEventHandler.handleDmp(item.getId()); } } finally { diff --git a/backend/core/src/main/java/org/opencdmp/service/metrics/MetricsServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/metrics/MetricsServiceImpl.java index c658c5a2c..d06127c3d 100644 --- a/backend/core/src/main/java/org/opencdmp/service/metrics/MetricsServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/metrics/MetricsServiceImpl.java @@ -8,7 +8,7 @@ import io.prometheus.client.Gauge; import org.opencdmp.commons.enums.*; import org.opencdmp.commons.metrics.MetricLabels; import org.opencdmp.commons.metrics.MetricNames; -import org.opencdmp.data.DmpDescriptionTemplateEntity; +import org.opencdmp.data.PlanDescriptionTemplateEntity; import org.opencdmp.data.TenantEntityManager; import org.opencdmp.query.*; import org.opencdmp.service.keycloak.MyKeycloakAdminRestApi; @@ -325,76 +325,76 @@ public class MetricsServiceImpl implements MetricsService { } private double calculateDraftDmps(boolean forNexus) { - DmpQuery dmpQuery = this.queryFactory.query(DmpQuery.class).disableTracking().statuses(DmpStatus.Draft).isActive(IsActive.Active); + PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking().statuses(PlanStatus.Draft).isActive(IsActive.Active); if (forNexus) - dmpQuery.after(this._config.getNexusDate()); - return dmpQuery.count(); + planQuery.after(this._config.getNexusDate()); + return planQuery.count(); } private double calculateFinalizedDmps(boolean forNexus) { - DmpQuery dmpQuery = this.queryFactory.query(DmpQuery.class).disableTracking().statuses(DmpStatus.Finalized).isActive(IsActive.Active); + PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking().statuses(PlanStatus.Finalized).isActive(IsActive.Active); if (forNexus) - dmpQuery.after(this._config.getNexusDate()); - return dmpQuery.count(); + planQuery.after(this._config.getNexusDate()); + return planQuery.count(); } private double calculatePublishedDmps(boolean forNexus) { - DmpQuery dmpQuery = this.queryFactory.query(DmpQuery.class).disableTracking().statuses(DmpStatus.Finalized).accessTypes(DmpAccessType.Public).isActive(IsActive.Active); + PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking().statuses(PlanStatus.Finalized).accessTypes(PlanAccessType.Public).isActive(IsActive.Active); if (forNexus) - dmpQuery.after(this._config.getNexusDate()); - return dmpQuery.count(); + planQuery.after(this._config.getNexusDate()); + return planQuery.count(); } private double calculateDoiedDmps(boolean forNexus) { - DmpQuery dmpQuery = this.queryFactory.query(DmpQuery.class).disableTracking().isActive(IsActive.Active); + PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking().isActive(IsActive.Active); if (forNexus) - dmpQuery.after(this._config.getNexusDate()); + planQuery.after(this._config.getNexusDate()); EntityDoiQuery entityDoiQuery = this.queryFactory.query(EntityDoiQuery.class).disableTracking().types(EntityType.DMP).isActive(IsActive.Active); - dmpQuery.entityDoiSubQuery(entityDoiQuery); - dmpQuery.setDistinct(true); - return dmpQuery.count(); + planQuery.entityDoiSubQuery(entityDoiQuery); + planQuery.setDistinct(true); + return planQuery.count(); } private double calculateDraftDmpsWithGrant(boolean forNexus) { - DmpQuery dmpQuery = this.queryFactory.query(DmpQuery.class).statuses(DmpStatus.Draft).disableTracking().isActive(IsActive.Active); + PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).statuses(PlanStatus.Draft).disableTracking().isActive(IsActive.Active); if (forNexus) - dmpQuery.after(this._config.getNexusDate()); + planQuery.after(this._config.getNexusDate()); ReferenceQuery referenceQuery = this.queryFactory.query(ReferenceQuery.class).disableTracking().typeIds(this._config.getReferenceTypes().getGrantIds()).isActive(IsActive.Active); - DmpReferenceQuery dmpReferenceQuery = this.queryFactory.query(DmpReferenceQuery.class).disableTracking().referenceSubQuery(referenceQuery).isActives(IsActive.Active); - dmpQuery.dmpReferenceSubQuery(dmpReferenceQuery); - return dmpQuery.count(); + PlanReferenceQuery planReferenceQuery = this.queryFactory.query(PlanReferenceQuery.class).disableTracking().referenceSubQuery(referenceQuery).isActives(IsActive.Active); + planQuery.planReferenceSubQuery(planReferenceQuery); + return planQuery.count(); } private double calculateFinalizedDmpsWithGrant(boolean forNexus) { - DmpQuery dmpQuery = this.queryFactory.query(DmpQuery.class).disableTracking().statuses(DmpStatus.Finalized).isActive(IsActive.Active); + PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking().statuses(PlanStatus.Finalized).isActive(IsActive.Active); if (forNexus) - dmpQuery.after(this._config.getNexusDate()); + planQuery.after(this._config.getNexusDate()); ReferenceQuery referenceQuery = this.queryFactory.query(ReferenceQuery.class).disableTracking().typeIds(this._config.getReferenceTypes().getGrantIds()).isActive(IsActive.Active); - DmpReferenceQuery dmpReferenceQuery = this.queryFactory.query(DmpReferenceQuery.class).disableTracking().referenceSubQuery(referenceQuery).isActives(IsActive.Active); - dmpQuery.dmpReferenceSubQuery(dmpReferenceQuery); - return dmpQuery.count(); + PlanReferenceQuery planReferenceQuery = this.queryFactory.query(PlanReferenceQuery.class).disableTracking().referenceSubQuery(referenceQuery).isActives(IsActive.Active); + planQuery.planReferenceSubQuery(planReferenceQuery); + return planQuery.count(); } private double calculatePublishedDmpsWithGrant(boolean forNexus) { - DmpQuery dmpQuery = this.queryFactory.query(DmpQuery.class).statuses(DmpStatus.Finalized).disableTracking().accessTypes(DmpAccessType.Public).isActive(IsActive.Active); + PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).statuses(PlanStatus.Finalized).disableTracking().accessTypes(PlanAccessType.Public).isActive(IsActive.Active); if (forNexus) - dmpQuery.after(this._config.getNexusDate()); + planQuery.after(this._config.getNexusDate()); ReferenceQuery referenceQuery = this.queryFactory.query(ReferenceQuery.class).disableTracking().typeIds(this._config.getReferenceTypes().getGrantIds()).isActive(IsActive.Active); - DmpReferenceQuery dmpReferenceQuery = this.queryFactory.query(DmpReferenceQuery.class).disableTracking().referenceSubQuery(referenceQuery).isActives(IsActive.Active); - dmpQuery.dmpReferenceSubQuery(dmpReferenceQuery); - return dmpQuery.count(); + PlanReferenceQuery planReferenceQuery = this.queryFactory.query(PlanReferenceQuery.class).disableTracking().referenceSubQuery(referenceQuery).isActives(IsActive.Active); + planQuery.planReferenceSubQuery(planReferenceQuery); + return planQuery.count(); } private double calculateDoiedDmpsWithGrant(boolean forNexus) { - DmpQuery dmpQuery = this.queryFactory.query(DmpQuery.class).disableTracking().isActive(IsActive.Active); + PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking().isActive(IsActive.Active); if (forNexus) - dmpQuery.after(this._config.getNexusDate()); + planQuery.after(this._config.getNexusDate()); ReferenceQuery referenceQuery = this.queryFactory.query(ReferenceQuery.class).disableTracking().typeIds(this._config.getReferenceTypes().getGrantIds()).isActive(IsActive.Active); - DmpReferenceQuery dmpReferenceQuery = this.queryFactory.query(DmpReferenceQuery.class).disableTracking().referenceSubQuery(referenceQuery).isActives(IsActive.Active); - dmpQuery.dmpReferenceSubQuery(dmpReferenceQuery); + PlanReferenceQuery planReferenceQuery = this.queryFactory.query(PlanReferenceQuery.class).disableTracking().referenceSubQuery(referenceQuery).isActives(IsActive.Active); + planQuery.planReferenceSubQuery(planReferenceQuery); EntityDoiQuery entityDoiQuery = this.queryFactory.query(EntityDoiQuery.class).disableTracking().isActive(IsActive.Active); - dmpQuery.entityDoiSubQuery(entityDoiQuery); - return dmpQuery.count(); + planQuery.entityDoiSubQuery(entityDoiQuery); + return planQuery.count(); } private double calculateAllFunders(boolean forNexus) { @@ -443,8 +443,8 @@ public class MetricsServiceImpl implements MetricsService { DescriptionQuery descriptionQuery = this.queryFactory.query(DescriptionQuery.class).disableTracking().statuses(DescriptionStatus.Finalized).isActive(IsActive.Active); if (forNexus) descriptionQuery.createdAfter(this._config.getNexusDate()); - DmpQuery dmpQuery = this.queryFactory.query(DmpQuery.class).isActive(IsActive.Active).disableTracking().statuses(DmpStatus.Finalized).accessTypes(DmpAccessType.Public); - descriptionQuery.dmpSubQuery(dmpQuery); + PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).isActive(IsActive.Active).disableTracking().statuses(PlanStatus.Finalized).accessTypes(PlanAccessType.Public); + descriptionQuery.dmpSubQuery(planQuery); return descriptionQuery.count(); } @@ -452,10 +452,10 @@ public class MetricsServiceImpl implements MetricsService { DescriptionQuery descriptionQuery = this.queryFactory.query(DescriptionQuery.class).disableTracking().statuses(DescriptionStatus.Finalized).isActive(IsActive.Active); if (forNexus) descriptionQuery.createdAfter(this._config.getNexusDate()); - DmpQuery dmpQuery = this.queryFactory.query(DmpQuery.class).isActive(IsActive.Active); + PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).isActive(IsActive.Active); EntityDoiQuery entityDoiQuery = this.queryFactory.query(EntityDoiQuery.class).types(EntityType.DMP).isActive(IsActive.Active); - dmpQuery.entityDoiSubQuery(entityDoiQuery); - descriptionQuery.dmpSubQuery(dmpQuery); + planQuery.entityDoiSubQuery(entityDoiQuery); + descriptionQuery.dmpSubQuery(planQuery); descriptionQuery.setDistinct(true); return descriptionQuery.count(); } @@ -475,13 +475,13 @@ public class MetricsServiceImpl implements MetricsService { } private double calculateUsedTemplates(boolean forNexus) { - DmpDescriptionTemplateQuery dmpDescriptionTemplateQuery = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking().isActive(IsActive.Active); - dmpDescriptionTemplateQuery.setDistinct(true); + PlanDescriptionTemplateQuery planDescriptionTemplateQuery = this.queryFactory.query(PlanDescriptionTemplateQuery.class).disableTracking().isActive(IsActive.Active); + planDescriptionTemplateQuery.setDistinct(true); if (forNexus) { DescriptionTemplateQuery descriptionTemplateQuery = this.queryFactory.query(DescriptionTemplateQuery.class).disableTracking().isActive(IsActive.Active).after(this._config.getNexusDate()); - dmpDescriptionTemplateQuery.descriptionTemplateSubQuery(descriptionTemplateQuery); + planDescriptionTemplateQuery.descriptionTemplateSubQuery(descriptionTemplateQuery); } - return dmpDescriptionTemplateQuery.collectAs(new BaseFieldSet().ensure(DmpDescriptionTemplateEntity._descriptionTemplateGroupId)).size(); + return planDescriptionTemplateQuery.collectAs(new BaseFieldSet().ensure(PlanDescriptionTemplateEntity._descriptionTemplateGroupId)).size(); } private double calculateActiveUsers() { diff --git a/backend/core/src/main/java/org/opencdmp/service/plan/PlanService.java b/backend/core/src/main/java/org/opencdmp/service/plan/PlanService.java new file mode 100644 index 000000000..1c4932542 --- /dev/null +++ b/backend/core/src/main/java/org/opencdmp/service/plan/PlanService.java @@ -0,0 +1,65 @@ +package org.opencdmp.service.plan; + +import gr.cite.tools.exception.MyApplicationException; +import gr.cite.tools.exception.MyForbiddenException; +import gr.cite.tools.exception.MyNotFoundException; +import gr.cite.tools.exception.MyValidationException; +import gr.cite.tools.fieldset.FieldSet; +import jakarta.xml.bind.JAXBException; +import org.opencdmp.commons.types.plan.importexport.PlanImportExport; +import org.opencdmp.filetransformerbase.models.misc.PreprocessingDmpModel; +import org.opencdmp.model.PlanUser; +import org.opencdmp.model.PlanValidationResult; +import org.opencdmp.model.plan.Plan; +import org.opencdmp.model.persist.*; +import org.springframework.http.ResponseEntity; +import org.xml.sax.SAXException; + +import javax.crypto.BadPaddingException; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.NoSuchPaddingException; +import javax.management.InvalidApplicationException; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.TransformerException; +import java.io.IOException; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.util.List; +import java.util.UUID; + +public interface PlanService { + + Plan persist(PlanPersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, JAXBException, IOException; + + void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException, IOException; + + void finalize(UUID id, List descriptionIds) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, IOException; + + void undoFinalize(UUID id, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, IOException; + + PlanValidationResult validate(UUID id) throws InvalidApplicationException; + + Plan createNewVersion(NewVersionPlanPersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, IOException, TransformerException; + + Plan buildClone(ClonePlanPersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, IOException, InvalidApplicationException; + + List assignUsers(UUID dmp, List model, FieldSet fields, boolean disableDelete) throws InvalidApplicationException, IOException; + Plan removeUser(PlanUserRemovePersist model, FieldSet fields) throws InvalidApplicationException, IOException; + + ResponseEntity export(UUID id, String transformerId, String exportType) throws InvalidApplicationException, IOException, InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException; + + void inviteUserOrAssignUsers(UUID id, List users) throws InvalidApplicationException, JAXBException, IOException; + + void planInvitationAccept(String token) throws InvalidApplicationException, IOException; + + PlanImportExport exportXmlEntity(UUID id, boolean ignoreAuthorize) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException; + + ResponseEntity exportXml(UUID id) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException; + + Plan importXml(byte[] bytes, String label, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException; + + Plan importJson(PlanCommonModelConfig planCommonModelConfig, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, InvalidApplicationException, IOException, InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, ParserConfigurationException, TransformerException, InstantiationException, IllegalAccessException, SAXException; + + PreprocessingDmpModel preprocessingPlan(UUID fileId, String repositoryId) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, IOException; +} diff --git a/backend/core/src/main/java/org/opencdmp/service/dmp/DmpServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/plan/PlanServiceImpl.java similarity index 55% rename from backend/core/src/main/java/org/opencdmp/service/dmp/DmpServiceImpl.java rename to backend/core/src/main/java/org/opencdmp/service/plan/PlanServiceImpl.java index ce5c06de0..f09868517 100644 --- a/backend/core/src/main/java/org/opencdmp/service/dmp/DmpServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/plan/PlanServiceImpl.java @@ -1,4 +1,4 @@ -package org.opencdmp.service.dmp; +package org.opencdmp.service.plan; import com.fasterxml.jackson.core.JsonProcessingException; import gr.cite.commons.web.authz.service.AuthorizationService; @@ -42,51 +42,51 @@ import org.opencdmp.commons.enums.notification.NotificationContactType; import org.opencdmp.commons.notification.NotificationProperties; import org.opencdmp.commons.scope.tenant.TenantScope; import org.opencdmp.commons.scope.user.UserScope; -import org.opencdmp.commons.types.actionconfirmation.DmpInvitationEntity; +import org.opencdmp.commons.types.actionconfirmation.PlanInvitationEntity; import org.opencdmp.commons.types.description.importexport.DescriptionImportExport; -import org.opencdmp.commons.types.dmp.DmpBlueprintValueEntity; -import org.opencdmp.commons.types.dmp.DmpContactEntity; -import org.opencdmp.commons.types.dmp.DmpPropertiesEntity; -import org.opencdmp.commons.types.dmp.importexport.*; -import org.opencdmp.commons.types.dmpblueprint.DescriptionTemplateEntity; -import org.opencdmp.commons.types.dmpblueprint.ExtraFieldEntity; -import org.opencdmp.commons.types.dmpblueprint.ReferenceTypeFieldEntity; -import org.opencdmp.commons.types.dmpblueprint.SectionEntity; -import org.opencdmp.commons.types.dmpblueprint.importexport.BlueprintExtraFieldImportExport; -import org.opencdmp.commons.types.dmpblueprint.importexport.BlueprintReferenceTypeFieldImportExport; -import org.opencdmp.commons.types.dmpblueprint.importexport.BlueprintSectionImportExport; -import org.opencdmp.commons.types.dmpreference.DmpReferenceDataEntity; +import org.opencdmp.commons.types.plan.PlanBlueprintValueEntity; +import org.opencdmp.commons.types.plan.PlanContactEntity; +import org.opencdmp.commons.types.plan.PlanPropertiesEntity; +import org.opencdmp.commons.types.plan.importexport.*; +import org.opencdmp.commons.types.planblueprint.DescriptionTemplateEntity; +import org.opencdmp.commons.types.planblueprint.ExtraFieldEntity; +import org.opencdmp.commons.types.planblueprint.ReferenceTypeFieldEntity; +import org.opencdmp.commons.types.planblueprint.SectionEntity; +import org.opencdmp.commons.types.planblueprint.importexport.BlueprintExtraFieldImportExport; +import org.opencdmp.commons.types.planblueprint.importexport.BlueprintReferenceTypeFieldImportExport; +import org.opencdmp.commons.types.planblueprint.importexport.BlueprintSectionImportExport; +import org.opencdmp.commons.types.planreference.PlanReferenceDataEntity; import org.opencdmp.commons.types.notification.*; import org.opencdmp.commons.types.reference.DefinitionEntity; import org.opencdmp.commons.types.reference.FieldEntity; import org.opencdmp.convention.ConventionService; import org.opencdmp.data.*; import org.opencdmp.errorcode.ErrorThesaurusProperties; -import org.opencdmp.event.DmpTouchedEvent; +import org.opencdmp.event.PlanTouchedEvent; import org.opencdmp.event.EventBroker; import org.opencdmp.filetransformerbase.models.misc.PreprocessingDmpModel; import org.opencdmp.integrationevent.outbox.annotationentityremoval.AnnotationEntityRemovalIntegrationEventHandler; import org.opencdmp.integrationevent.outbox.annotationentitytouch.AnnotationEntityTouchedIntegrationEventHandler; import org.opencdmp.integrationevent.outbox.notification.NotifyIntegrationEvent; import org.opencdmp.integrationevent.outbox.notification.NotifyIntegrationEventHandler; -import org.opencdmp.model.DmpUser; -import org.opencdmp.model.DmpValidationResult; -import org.opencdmp.model.builder.DmpUserBuilder; +import org.opencdmp.model.PlanUser; +import org.opencdmp.model.PlanValidationResult; +import org.opencdmp.model.builder.PlanUserBuilder; import org.opencdmp.model.builder.description.DescriptionBuilder; -import org.opencdmp.model.builder.dmp.DmpBuilder; +import org.opencdmp.model.builder.plan.PlanBuilder; import org.opencdmp.model.deleter.*; import org.opencdmp.model.description.Description; import org.opencdmp.model.descriptiontemplate.DescriptionTemplate; -import org.opencdmp.model.dmp.Dmp; -import org.opencdmp.model.dmpblueprint.DmpBlueprint; -import org.opencdmp.model.dmpreference.DmpReferenceData; +import org.opencdmp.model.plan.Plan; +import org.opencdmp.model.planblueprint.PlanBlueprint; +import org.opencdmp.model.planreference.PlanReferenceData; import org.opencdmp.model.file.FileEnvelope; import org.opencdmp.model.persist.*; -import org.opencdmp.model.persist.actionconfirmation.DmpInvitationPersist; -import org.opencdmp.model.persist.dmpproperties.DmpBlueprintValuePersist; -import org.opencdmp.model.persist.dmpproperties.DmpContactPersist; -import org.opencdmp.model.persist.dmpproperties.DmpPropertiesPersist; -import org.opencdmp.model.persist.dmpreference.DmpReferenceDataPersist; +import org.opencdmp.model.persist.actionconfirmation.PlanInvitationPersist; +import org.opencdmp.model.persist.planproperties.PlanBlueprintValuePersist; +import org.opencdmp.model.persist.planproperties.PlanContactPersist; +import org.opencdmp.model.persist.planproperties.PlanPropertiesPersist; +import org.opencdmp.model.persist.planreference.PlanReferenceDataPersist; import org.opencdmp.model.persist.referencedefinition.DefinitionPersist; import org.opencdmp.model.persist.referencedefinition.FieldPersist; import org.opencdmp.model.reference.Reference; @@ -95,7 +95,7 @@ import org.opencdmp.query.*; import org.opencdmp.service.actionconfirmation.ActionConfirmationService; import org.opencdmp.service.description.DescriptionService; import org.opencdmp.service.descriptiontemplate.DescriptionTemplateService; -import org.opencdmp.service.dmpblueprint.DmpBlueprintService; +import org.opencdmp.service.planblueprint.PlanBlueprintService; import org.opencdmp.service.elastic.ElasticService; import org.opencdmp.service.filetransformer.FileTransformerService; import org.opencdmp.service.responseutils.ResponseUtilsService; @@ -126,9 +126,9 @@ import java.util.*; import java.util.stream.Collectors; @Service -public class DmpServiceImpl implements DmpService { +public class PlanServiceImpl implements PlanService { - private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpServiceImpl.class)); + private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PlanServiceImpl.class)); private final TenantEntityManager entityManager; @@ -174,10 +174,10 @@ public class DmpServiceImpl implements DmpService { private final AuthorizationContentResolver authorizationContentResolver; private final TenantScope tenantScope; private final ResponseUtilsService responseUtilsService; - private final DmpBlueprintService dmpBlueprintService; + private final PlanBlueprintService planBlueprintService; @Autowired - public DmpServiceImpl( + public PlanServiceImpl( TenantEntityManager entityManager, AuthorizationService authorizationService, DeleterFactory deleterFactory, @@ -197,7 +197,7 @@ public class DmpServiceImpl implements DmpService { FileTransformerService fileTransformerService, ValidatorFactory validatorFactory, ElasticService elasticService, DescriptionTemplateService descriptionTemplateService, - AnnotationEntityTouchedIntegrationEventHandler annotationEntityTouchedIntegrationEventHandler, AnnotationEntityRemovalIntegrationEventHandler annotationEntityRemovalIntegrationEventHandler, AuthorizationContentResolver authorizationContentResolver, TenantScope tenantScope, ResponseUtilsService responseUtilsService, DmpBlueprintService dmpBlueprintService) { + AnnotationEntityTouchedIntegrationEventHandler annotationEntityTouchedIntegrationEventHandler, AnnotationEntityRemovalIntegrationEventHandler annotationEntityRemovalIntegrationEventHandler, AuthorizationContentResolver authorizationContentResolver, TenantScope tenantScope, ResponseUtilsService responseUtilsService, PlanBlueprintService planBlueprintService) { this.entityManager = entityManager; this.authorizationService = authorizationService; this.deleterFactory = deleterFactory; @@ -223,23 +223,23 @@ public class DmpServiceImpl implements DmpService { this.authorizationContentResolver = authorizationContentResolver; this.tenantScope = tenantScope; this.responseUtilsService = responseUtilsService; - this.dmpBlueprintService = dmpBlueprintService; + this.planBlueprintService = planBlueprintService; } - public Dmp persist(DmpPersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, JAXBException, IOException { + public Plan persist(PlanPersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, JAXBException, IOException { Boolean isUpdate = this.conventionService.isValidGuid(model.getId()); - if (isUpdate) this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.dmpAffiliation(model.getId())), Permission.EditDmp); - else this.authorizationService.authorizeForce(Permission.NewDmp); + if (isUpdate) this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.dmpAffiliation(model.getId())), Permission.EditPlan); + else this.authorizationService.authorizeForce(Permission.NewPlan); - DmpEntity data = this.patchAndSave(model); + PlanEntity data = this.patchAndSave(model); - DmpBlueprintEntity blueprintEntity = this.entityManager.find(DmpBlueprintEntity.class, data.getBlueprintId(), true); - if (blueprintEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{data.getBlueprintId(), DmpBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale())); - org.opencdmp.commons.types.dmpblueprint.DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(org.opencdmp.commons.types.dmpblueprint.DefinitionEntity.class, blueprintEntity.getDefinition()); - if (definition == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{data.getBlueprintId(), org.opencdmp.commons.types.dmpblueprint.DefinitionEntity.class.getSimpleName()}, LocaleContextHolder.getLocale())); + PlanBlueprintEntity blueprintEntity = this.entityManager.find(PlanBlueprintEntity.class, data.getBlueprintId(), true); + if (blueprintEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{data.getBlueprintId(), PlanBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale())); + org.opencdmp.commons.types.planblueprint.DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(org.opencdmp.commons.types.planblueprint.DefinitionEntity.class, blueprintEntity.getDefinition()); + if (definition == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{data.getBlueprintId(), org.opencdmp.commons.types.planblueprint.DefinitionEntity.class.getSimpleName()}, LocaleContextHolder.getLocale())); - this.patchAndSaveReferences(this.buildDmpReferencePersists(model.getProperties()), data.getId(), definition); + this.patchAndSaveReferences(this.buildPlanReferencePersists(model.getProperties()), data.getId(), definition); if (isUpdate) this.checkIfDescriptionTemplateIsUse(model.getDescriptionTemplates(), model.getId()); @@ -248,55 +248,55 @@ public class DmpServiceImpl implements DmpService { if (!isUpdate && this.userScope.isSet()) { this.addOwner(data); if (model.getUsers() == null) model.setUsers(new ArrayList<>()); - if (model.getUsers().stream().noneMatch(x-> x.getUser() != null && x.getUser().equals(this.userScope.getUserIdSafe()) && DmpUserRole.Owner.equals(x.getRole()))) model.getUsers().add(this.createOwnerPersist()); + if (model.getUsers().stream().noneMatch(x-> x.getUser() != null && x.getUser().equals(this.userScope.getUserIdSafe()) && PlanUserRole.Owner.equals(x.getRole()))) model.getUsers().add(this.createOwnerPersist()); } - this.eventBroker.emit(new DmpTouchedEvent(data.getId())); + this.eventBroker.emit(new PlanTouchedEvent(data.getId())); this.sendNotification(data); this.assignUsers(data.getId(), this.inviteUserOrAssignUsers(data.getId(), model.getUsers(), false), null, false); - this.elasticService.persistDmp(data); + this.elasticService.persistPlan(data); - this.annotationEntityTouchedIntegrationEventHandler.handleDmp(data.getId()); + this.annotationEntityTouchedIntegrationEventHandler.handlePlan(data.getId()); - return this.builderFactory.builder(DmpBuilder.class).authorize(AuthorizationFlags.AllExceptPublic).build(BaseFieldSet.build(fields, Dmp._id, Dmp._hash), data); + return this.builderFactory.builder(PlanBuilder.class).authorize(AuthorizationFlags.AllExceptPublic).build(BaseFieldSet.build(fields, Plan._id, Plan._hash), data); } - private void checkIfDescriptionTemplateIsUse (List descriptionTemplates, UUID id){ - List existingDmpDescriptionTemplates = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).dmpIds(id).isActive(IsActive.Active).collect(); + private void checkIfDescriptionTemplateIsUse (List descriptionTemplates, UUID id){ + List existingDmpDescriptionTemplates = this.queryFactory.query(PlanDescriptionTemplateQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).planIds(id).isActive(IsActive.Active).collect(); - List removedDescriptionTemplates = existingDmpDescriptionTemplates.stream().filter(x -> descriptionTemplates.stream().noneMatch(y -> y.getDescriptionTemplateGroupId().equals(x.getDescriptionTemplateGroupId()))).toList(); - DmpDescriptionTemplateQuery dmpDescriptionTemplateQuery = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking().isActive(IsActive.Active).dmpIds(id).descriptionTemplateGroupIds(removedDescriptionTemplates.stream().map(DmpDescriptionTemplateEntity::getDescriptionTemplateGroupId).collect(Collectors.toList())); - DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).dmpDescriptionTemplateSubQuery(dmpDescriptionTemplateQuery).isActive(IsActive.Active); + List removedDescriptionTemplates = existingDmpDescriptionTemplates.stream().filter(x -> descriptionTemplates.stream().noneMatch(y -> y.getDescriptionTemplateGroupId().equals(x.getDescriptionTemplateGroupId()))).toList(); + PlanDescriptionTemplateQuery planDescriptionTemplateQuery = this.queryFactory.query(PlanDescriptionTemplateQuery.class).disableTracking().isActive(IsActive.Active).planIds(id).descriptionTemplateGroupIds(removedDescriptionTemplates.stream().map(PlanDescriptionTemplateEntity::getDescriptionTemplateGroupId).collect(Collectors.toList())); + DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).dmpDescriptionTemplateSubQuery(planDescriptionTemplateQuery).isActive(IsActive.Active); if (query != null && query.count() > 0) throw new MyValidationException(this.errors.getDmpDescriptionTemplateCanNotRemove().getCode(), this.errors.getDmpDescriptionTemplateCanNotRemove().getMessage()); } - private DmpUserPersist createOwnerPersist() { - DmpUserPersist persist = new DmpUserPersist(); - persist.setRole(DmpUserRole.Owner); + private PlanUserPersist createOwnerPersist() { + PlanUserPersist persist = new PlanUserPersist(); + persist.setRole(PlanUserRole.Owner); persist.setUser(this.userScope.getUserIdSafe()); return persist; } - private void addOwner(DmpEntity dmpEntity) throws InvalidApplicationException { - DmpUserEntity data = new DmpUserEntity(); + private void addOwner(PlanEntity planEntity) throws InvalidApplicationException { + PlanUserEntity data = new PlanUserEntity(); data.setId(UUID.randomUUID()); data.setIsActive(IsActive.Active); data.setCreatedAt(Instant.now()); data.setUpdatedAt(Instant.now()); - data.setRole(DmpUserRole.Owner); + data.setRole(PlanUserRole.Owner); data.setUserId(this.userScope.getUserId()); - data.setDmpId(dmpEntity.getId()); + data.setPlanId(planEntity.getId()); this.entityManager.persist(data); } - private void sendNotification(DmpEntity dmp) throws InvalidApplicationException { - List existingUsers = this.queryFactory.query(DmpUserQuery.class).disableTracking() - .dmpIds(dmp.getId()) + private void sendNotification(PlanEntity dmp) throws InvalidApplicationException { + List existingUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking() + .planIds(dmp.getId()) .isActives(IsActive.Active) .collect(); @@ -304,7 +304,7 @@ public class DmpServiceImpl implements DmpService { return; } - for (DmpUserEntity dmpUser : existingUsers) { + for (PlanUserEntity dmpUser : existingUsers) { if (!dmpUser.getUserId().equals(this.userScope.getUserIdSafe())){ UserEntity user = this.queryFactory.query(UserQuery.class).disableTracking().ids(dmpUser.getUserId()).first(); if (user == null || user.getIsActive().equals(IsActive.Inactive)) throw new MyValidationException(this.errors.getDmpInactiveUser().getCode(), this.errors.getDmpInactiveUser().getMessage()); @@ -313,7 +313,7 @@ public class DmpServiceImpl implements DmpService { } } - private void createDmpNotificationEvent(DmpEntity dmp, UserEntity user) throws InvalidApplicationException { + private void createDmpNotificationEvent(PlanEntity dmp, UserEntity user) throws InvalidApplicationException { NotifyIntegrationEvent event = new NotifyIntegrationEvent(); event.setUserId(user.getId()); @@ -333,7 +333,7 @@ public class DmpServiceImpl implements DmpService { this.eventHandler.handle(event); } - private void applyNotificationType(DmpStatus status, NotifyIntegrationEvent event) { + private void applyNotificationType(PlanStatus status, NotifyIntegrationEvent event) { switch (status) { case Draft: event.setNotificationType(this.notificationProperties.getDmpModifiedType()); @@ -349,103 +349,103 @@ public class DmpServiceImpl implements DmpService { public void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException, IOException { logger.debug("deleting dmp: {}", id); - this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.dmpAffiliation(id)), Permission.DeleteDmp); + this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.dmpAffiliation(id)), Permission.DeletePlan); - DmpEntity data = this.entityManager.find(DmpEntity.class, id); - if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale())); + PlanEntity data = this.entityManager.find(PlanEntity.class, id); + if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Plan.class.getSimpleName()}, LocaleContextHolder.getLocale())); EntityDoiQuery entityDoiQuery = this.queryFactory.query(EntityDoiQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).types(EntityType.DMP).entityIds(data.getId()); if (entityDoiQuery.count() > 0) throw new MyApplicationException("DMP is deposited can not deleted"); - DmpEntity previousDmp = null; - if (!data.getVersionStatus().equals(DmpVersionStatus.Previous)){ - DmpQuery dmpQuery = this.queryFactory.query(DmpQuery.class) + PlanEntity previousDmp = null; + if (!data.getVersionStatus().equals(PlanVersionStatus.Previous)){ + PlanQuery planQuery = this.queryFactory.query(PlanQuery.class) .excludedIds(data.getId()) .isActive(IsActive.Active) .groupIds(data.getGroupId()); - dmpQuery.setOrder(new Ordering().addDescending(Dmp._version)); - previousDmp = dmpQuery.count() > 0 ? dmpQuery.collect().getFirst() : null; + planQuery.setOrder(new Ordering().addDescending(Plan._version)); + previousDmp = planQuery.count() > 0 ? planQuery.collect().getFirst() : null; if (previousDmp != null){ - if (previousDmp.getStatus().equals(DmpStatus.Finalized)) previousDmp.setVersionStatus(DmpVersionStatus.Current); - else previousDmp.setVersionStatus(DmpVersionStatus.NotFinalized); + if (previousDmp.getStatus().equals(PlanStatus.Finalized)) previousDmp.setVersionStatus(PlanVersionStatus.Current); + else previousDmp.setVersionStatus(PlanVersionStatus.NotFinalized); this.entityManager.merge(previousDmp); } - data.setVersionStatus(DmpVersionStatus.NotFinalized); + data.setVersionStatus(PlanVersionStatus.NotFinalized); this.entityManager.merge(data); this.entityManager.flush(); } - this.deleterFactory.deleter(DmpDeleter.class).deleteAndSaveByIds(List.of(id), false); - if (previousDmp != null) this.elasticService.persistDmp(previousDmp); + this.deleterFactory.deleter(PlanDeleter.class).deleteAndSaveByIds(List.of(id), false); + if (previousDmp != null) this.elasticService.persistPlan(previousDmp); this.annotationEntityRemovalIntegrationEventHandler.handleDmp(data.getId()); } @Override - public Dmp createNewVersion(NewVersionDmpPersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, IOException { + public Plan createNewVersion(NewVersionPlanPersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, IOException { logger.debug(new MapLogEntry("persisting data bew version").And("model", model).And("fields", fields)); - this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.dmpAffiliation( model.getId())), Permission.CreateNewVersionDmp); + this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.dmpAffiliation( model.getId())), Permission.CreateNewVersionPlan); - DmpEntity oldDmpEntity = this.entityManager.find(DmpEntity.class, model.getId(), true); - if (oldDmpEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale())); - if (!this.conventionService.hashValue(oldDmpEntity.getUpdatedAt()).equals(model.getHash())) throw new MyValidationException(this.errors.getHashConflict().getCode(), this.errors.getHashConflict().getMessage()); + PlanEntity oldPlanEntity = this.entityManager.find(PlanEntity.class, model.getId(), true); + if (oldPlanEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), Plan.class.getSimpleName()}, LocaleContextHolder.getLocale())); + if (!this.conventionService.hashValue(oldPlanEntity.getUpdatedAt()).equals(model.getHash())) throw new MyValidationException(this.errors.getHashConflict().getCode(), this.errors.getHashConflict().getMessage()); - List latestVersionDmps = this.queryFactory.query(DmpQuery.class).disableTracking() - .groupIds(oldDmpEntity.getGroupId()) + List latestVersionPlans = this.queryFactory.query(PlanQuery.class).disableTracking() + .groupIds(oldPlanEntity.getGroupId()) .isActive(IsActive.Active) - .versionStatuses(DmpVersionStatus.Current) + .versionStatuses(PlanVersionStatus.Current) .collect(); - if (latestVersionDmps.isEmpty()) throw new MyValidationException(this.errors.getDmpIsNotFinalized().getCode()); - if (latestVersionDmps.size() > 1) throw new MyValidationException(this.errors.getMultipleDmpVersionsNotSupported().getCode()); - if (!latestVersionDmps.getFirst().getVersion().equals(oldDmpEntity.getVersion())){ + if (latestVersionPlans.isEmpty()) throw new MyValidationException(this.errors.getDmpIsNotFinalized().getCode()); + if (latestVersionPlans.size() > 1) throw new MyValidationException(this.errors.getMultipleDmpVersionsNotSupported().getCode()); + if (!latestVersionPlans.getFirst().getVersion().equals(oldPlanEntity.getVersion())){ throw new MyValidationException(this.errors.getDmpNewVersionConflict().getCode(), this.errors.getDmpNewVersionConflict().getMessage()); } - Long notFinalizedCount = this.queryFactory.query(DmpQuery.class).disableTracking() - .versionStatuses(DmpVersionStatus.NotFinalized) - .groupIds(oldDmpEntity.getGroupId()) + Long notFinalizedCount = this.queryFactory.query(PlanQuery.class).disableTracking() + .versionStatuses(PlanVersionStatus.NotFinalized) + .groupIds(oldPlanEntity.getGroupId()) .isActive(IsActive.Active) .count(); if (notFinalizedCount > 0) throw new MyValidationException(this.errors.getDmpNewVersionAlreadyCreatedDraft().getCode(), this.errors.getDmpNewVersionAlreadyCreatedDraft().getMessage()); - DmpEntity newDmp = new DmpEntity(); - newDmp.setId(UUID.randomUUID()); - newDmp.setIsActive(IsActive.Active); - newDmp.setCreatedAt(Instant.now()); - newDmp.setUpdatedAt(Instant.now()); - newDmp.setGroupId(oldDmpEntity.getGroupId()); - newDmp.setVersionStatus(DmpVersionStatus.NotFinalized); - newDmp.setVersion((short)(oldDmpEntity.getVersion() + 1)); - newDmp.setDescription(model.getDescription()); - newDmp.setLabel(model.getLabel()); - newDmp.setLanguage(oldDmpEntity.getLanguage()); - newDmp.setStatus(DmpStatus.Draft); - newDmp.setProperties(oldDmpEntity.getProperties()); - newDmp.setBlueprintId(model.getBlueprintId()); - newDmp.setAccessType(oldDmpEntity.getAccessType()); - newDmp.setCreatorId(this.userScope.getUserId()); + PlanEntity newPlan = new PlanEntity(); + newPlan.setId(UUID.randomUUID()); + newPlan.setIsActive(IsActive.Active); + newPlan.setCreatedAt(Instant.now()); + newPlan.setUpdatedAt(Instant.now()); + newPlan.setGroupId(oldPlanEntity.getGroupId()); + newPlan.setVersionStatus(PlanVersionStatus.NotFinalized); + newPlan.setVersion((short)(oldPlanEntity.getVersion() + 1)); + newPlan.setDescription(model.getDescription()); + newPlan.setLabel(model.getLabel()); + newPlan.setLanguage(oldPlanEntity.getLanguage()); + newPlan.setStatus(PlanStatus.Draft); + newPlan.setProperties(oldPlanEntity.getProperties()); + newPlan.setBlueprintId(model.getBlueprintId()); + newPlan.setAccessType(oldPlanEntity.getAccessType()); + newPlan.setCreatorId(this.userScope.getUserId()); - this.entityManager.persist(newDmp); + this.entityManager.persist(newPlan); - List dmpUsers = this.queryFactory.query(DmpUserQuery.class).disableTracking() - .dmpIds(model.getId()) + List planUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking() + .planIds(model.getId()) .isActives(IsActive.Active) .collect(); - List dmpReferences = this.queryFactory.query(DmpReferenceQuery.class).disableTracking() - .dmpIds(model.getId()) + List planReferences = this.queryFactory.query(PlanReferenceQuery.class).disableTracking() + .planIds(model.getId()) .isActives(IsActive.Active) .collect(); - List dmpDescriptionTemplates = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking() - .dmpIds(model.getId()) + List planDescriptionTemplates = this.queryFactory.query(PlanDescriptionTemplateQuery.class).disableTracking() + .planIds(model.getId()) .isActive(IsActive.Active) .collect(); - for (DmpUserEntity dmpUser : dmpUsers) { - DmpUserEntity newUser = new DmpUserEntity(); + for (PlanUserEntity planUser : planUsers) { + PlanUserEntity newUser = new PlanUserEntity(); newUser.setId(UUID.randomUUID()); - newUser.setDmpId(newDmp.getId()); - newUser.setUserId(dmpUser.getUserId()); - newUser.setRole(dmpUser.getRole()); + newUser.setPlanId(newPlan.getId()); + newUser.setUserId(planUser.getUserId()); + newUser.setRole(planUser.getRole()); newUser.setCreatedAt(Instant.now()); newUser.setUpdatedAt(Instant.now()); newUser.setIsActive(IsActive.Active); @@ -453,12 +453,12 @@ public class DmpServiceImpl implements DmpService { this.entityManager.persist(newUser); } - for (DmpReferenceEntity dmpReference : dmpReferences) { - DmpReferenceEntity newReference = new DmpReferenceEntity(); + for (PlanReferenceEntity planReference : planReferences) { + PlanReferenceEntity newReference = new PlanReferenceEntity(); newReference.setId(UUID.randomUUID()); - newReference.setDmpId(newDmp.getId()); - newReference.setReferenceId(dmpReference.getReferenceId()); - newReference.setData(dmpReference.getData()); + newReference.setPlanId(newPlan.getId()); + newReference.setReferenceId(planReference.getReferenceId()); + newReference.setData(planReference.getData()); newReference.setCreatedAt(Instant.now()); newReference.setUpdatedAt(Instant.now()); newReference.setIsActive(IsActive.Active); @@ -469,56 +469,56 @@ public class DmpServiceImpl implements DmpService { this.entityManager.flush(); if (model.getDescriptions() != null){ - DmpBlueprintEntity blueprintEntity = this.entityManager.find(DmpBlueprintEntity.class, model.getBlueprintId(), true); - if (blueprintEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getBlueprintId(), DmpBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale())); + PlanBlueprintEntity blueprintEntity = this.entityManager.find(PlanBlueprintEntity.class, model.getBlueprintId(), true); + if (blueprintEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getBlueprintId(), PlanBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale())); - org.opencdmp.commons.types.dmpblueprint.DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(org.opencdmp.commons.types.dmpblueprint.DefinitionEntity.class, blueprintEntity.getDefinition()); + org.opencdmp.commons.types.planblueprint.DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(org.opencdmp.commons.types.planblueprint.DefinitionEntity.class, blueprintEntity.getDefinition()); - List descriptionEntities = this.queryFactory.query(DescriptionQuery.class).disableTracking().ids(model.getDescriptions().stream().map(NewVersionDmpDescriptionPersist::getDescriptionId).distinct().collect(Collectors.toList())).isActive(IsActive.Active).collect(); + List descriptionEntities = this.queryFactory.query(DescriptionQuery.class).disableTracking().ids(model.getDescriptions().stream().map(NewVersionPlanDescriptionPersist::getDescriptionId).distinct().collect(Collectors.toList())).isActive(IsActive.Active).collect(); FieldSet fieldSet = new BaseFieldSet(Description._id, BaseFieldSet.asIndexer(Description._descriptionTemplate, DescriptionTemplate._groupId)); List models = this.builderFactory.builder(DescriptionBuilder.class).authorize(AuthorizationFlags.AllExceptPublic).build(fieldSet, descriptionEntities); if (!this.conventionService.isListNullOrEmpty(models)){ - for (NewVersionDmpDescriptionPersist newVersionDmpDescriptionPersist : model.getDescriptions()) { - Description description = models.stream().filter(x -> x.getId().equals(newVersionDmpDescriptionPersist.getDescriptionId())).findFirst().orElse(null); + for (NewVersionPlanDescriptionPersist newVersionPlanDescriptionPersist : model.getDescriptions()) { + Description description = models.stream().filter(x -> x.getId().equals(newVersionPlanDescriptionPersist.getDescriptionId())).findFirst().orElse(null); if (description != null){ - DmpDescriptionTemplateEntity existingDmpDescriptionTemplateEntity = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking().dmpIds(newDmp.getId()).isActive(IsActive.Active).sectionIds(newVersionDmpDescriptionPersist.getBlueprintSectionId()).descriptionTemplateGroupIds(description.getDescriptionTemplate().getGroupId()).first(); - if (existingDmpDescriptionTemplateEntity == null){ - DmpDescriptionTemplateEntity newTemplate = new DmpDescriptionTemplateEntity(); + PlanDescriptionTemplateEntity existingPlanDescriptionTemplateEntity = this.queryFactory.query(PlanDescriptionTemplateQuery.class).disableTracking().planIds(newPlan.getId()).isActive(IsActive.Active).sectionIds(newVersionPlanDescriptionPersist.getBlueprintSectionId()).descriptionTemplateGroupIds(description.getDescriptionTemplate().getGroupId()).first(); + if (existingPlanDescriptionTemplateEntity == null){ + PlanDescriptionTemplateEntity newTemplate = new PlanDescriptionTemplateEntity(); newTemplate.setId(UUID.randomUUID()); - newTemplate.setDmpId(newDmp.getId()); + newTemplate.setPlanId(newPlan.getId()); newTemplate.setDescriptionTemplateGroupId(description.getDescriptionTemplate().getGroupId()); - newTemplate.setSectionId(newVersionDmpDescriptionPersist.getBlueprintSectionId()); + newTemplate.setSectionId(newVersionPlanDescriptionPersist.getBlueprintSectionId()); newTemplate.setCreatedAt(Instant.now()); newTemplate.setUpdatedAt(Instant.now()); newTemplate.setIsActive(IsActive.Active); this.entityManager.persist(newTemplate); this.entityManager.flush(); - this.cloneDescription(newDmp.getId(), null, newVersionDmpDescriptionPersist.getDescriptionId(), newTemplate.getId()); + this.cloneDescription(newPlan.getId(), null, newVersionPlanDescriptionPersist.getDescriptionId(), newTemplate.getId()); } else{ - this.cloneDescription(newDmp.getId(), null, newVersionDmpDescriptionPersist.getDescriptionId(), existingDmpDescriptionTemplateEntity.getId()); + this.cloneDescription(newPlan.getId(), null, newVersionPlanDescriptionPersist.getDescriptionId(), existingPlanDescriptionTemplateEntity.getId()); } } } } - List newDmpDescriptionTemplateEntities = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking().dmpIds(newDmp.getId()).isActive(IsActive.Active).collect(); + List newPlanDescriptionTemplateEntities = this.queryFactory.query(PlanDescriptionTemplateQuery.class).disableTracking().planIds(newPlan.getId()).isActive(IsActive.Active).collect(); - if (!oldDmpEntity.getBlueprintId().equals(blueprintEntity.getId())){ + if (!oldPlanEntity.getBlueprintId().equals(blueprintEntity.getId())){ // add description templates if exists in new blueprint List sections = definition.getSections().stream().filter(SectionEntity::getHasTemplates).collect(Collectors.toList()); - if (!this.conventionService.isListNullOrEmpty(sections) && !this.conventionService.isListNullOrEmpty(newDmpDescriptionTemplateEntities)){ + if (!this.conventionService.isListNullOrEmpty(sections) && !this.conventionService.isListNullOrEmpty(newPlanDescriptionTemplateEntities)){ for (SectionEntity section: sections) { if (!this.conventionService.isListNullOrEmpty(section.getDescriptionTemplates())){ for (DescriptionTemplateEntity blueprintDescriptionTemplate: section.getDescriptionTemplates()) { - if (model.getDescriptions().stream().map(NewVersionDmpDescriptionPersist::getBlueprintSectionId).toList().contains(section.getId())){ - DmpDescriptionTemplateEntity existingBlueprintDescriptionTemplateEntity = newDmpDescriptionTemplateEntities.stream().filter(x -> x.getSectionId().equals(section.getId()) && x.getDescriptionTemplateGroupId().equals(blueprintDescriptionTemplate.getDescriptionTemplateGroupId())).findFirst().orElse(null); + if (model.getDescriptions().stream().map(NewVersionPlanDescriptionPersist::getBlueprintSectionId).toList().contains(section.getId())){ + PlanDescriptionTemplateEntity existingBlueprintDescriptionTemplateEntity = newPlanDescriptionTemplateEntities.stream().filter(x -> x.getSectionId().equals(section.getId()) && x.getDescriptionTemplateGroupId().equals(blueprintDescriptionTemplate.getDescriptionTemplateGroupId())).findFirst().orElse(null); if (existingBlueprintDescriptionTemplateEntity == null){ - DmpDescriptionTemplateEntity newTemplate = new DmpDescriptionTemplateEntity(); + PlanDescriptionTemplateEntity newTemplate = new PlanDescriptionTemplateEntity(); newTemplate.setId(UUID.randomUUID()); - newTemplate.setDmpId(newDmp.getId()); + newTemplate.setPlanId(newPlan.getId()); newTemplate.setDescriptionTemplateGroupId(blueprintDescriptionTemplate.getDescriptionTemplateGroupId()); newTemplate.setSectionId(section.getId()); newTemplate.setCreatedAt(Instant.now()); @@ -534,13 +534,13 @@ public class DmpServiceImpl implements DmpService { } } else { - for (DmpDescriptionTemplateEntity oldDmpDescriptionTemplate : dmpDescriptionTemplates) { - if (newDmpDescriptionTemplateEntities.stream().filter(x -> x.getSectionId().equals(oldDmpDescriptionTemplate.getSectionId()) && x.getDescriptionTemplateGroupId().equals(oldDmpDescriptionTemplate.getDescriptionTemplateGroupId())).findFirst().orElse(null) == null){ - DmpDescriptionTemplateEntity newTemplate = new DmpDescriptionTemplateEntity(); + for (PlanDescriptionTemplateEntity oldPlanDescriptionTemplate : planDescriptionTemplates) { + if (newPlanDescriptionTemplateEntities.stream().filter(x -> x.getSectionId().equals(oldPlanDescriptionTemplate.getSectionId()) && x.getDescriptionTemplateGroupId().equals(oldPlanDescriptionTemplate.getDescriptionTemplateGroupId())).findFirst().orElse(null) == null){ + PlanDescriptionTemplateEntity newTemplate = new PlanDescriptionTemplateEntity(); newTemplate.setId(UUID.randomUUID()); - newTemplate.setDmpId(newDmp.getId()); - newTemplate.setDescriptionTemplateGroupId(oldDmpDescriptionTemplate.getDescriptionTemplateGroupId()); - newTemplate.setSectionId(oldDmpDescriptionTemplate.getSectionId()); + newTemplate.setPlanId(newPlan.getId()); + newTemplate.setDescriptionTemplateGroupId(oldPlanDescriptionTemplate.getDescriptionTemplateGroupId()); + newTemplate.setSectionId(oldPlanDescriptionTemplate.getSectionId()); newTemplate.setCreatedAt(Instant.now()); newTemplate.setUpdatedAt(Instant.now()); newTemplate.setIsActive(IsActive.Active); @@ -552,21 +552,21 @@ public class DmpServiceImpl implements DmpService { this.entityManager.flush(); - this.updateVersionStatusAndSave(newDmp, DmpStatus.Draft, newDmp.getStatus()); + this.updateVersionStatusAndSave(newPlan, PlanStatus.Draft, newPlan.getStatus()); this.entityManager.flush(); - this.elasticService.persistDmp(oldDmpEntity); - this.elasticService.persistDmp(newDmp); + this.elasticService.persistPlan(oldPlanEntity); + this.elasticService.persistPlan(newPlan); - this.annotationEntityTouchedIntegrationEventHandler.handleDmp(newDmp.getId()); - this.annotationEntityTouchedIntegrationEventHandler.handleDmp(oldDmpEntity.getId()); + this.annotationEntityTouchedIntegrationEventHandler.handlePlan(newPlan.getId()); + this.annotationEntityTouchedIntegrationEventHandler.handlePlan(oldPlanEntity.getId()); - return this.builderFactory.builder(DmpBuilder.class).build(BaseFieldSet.build(fields, Dmp._id), newDmp); + return this.builderFactory.builder(PlanBuilder.class).build(BaseFieldSet.build(fields, Plan._id), newPlan); } - public void cloneDescription(UUID dmpId, Map dmpDescriptionTemplateRemap, UUID descriptionId, UUID newDmpDescriptionTemplateId) throws InvalidApplicationException, IOException { - logger.debug("cloning description: {} with description: {}", descriptionId, dmpId); + public void cloneDescription(UUID planId, Map planDescriptionTemplateRemap, UUID descriptionId, UUID newPlanDescriptionTemplateId) throws InvalidApplicationException, IOException { + logger.debug("cloning description: {} with description: {}", descriptionId, planId); this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.descriptionAffiliation(descriptionId)), Permission.CloneDescription); @@ -578,9 +578,9 @@ public class DmpServiceImpl implements DmpService { newDescription.setDescription(existing.getDescription()); newDescription.setStatus(DescriptionStatus.Draft); newDescription.setProperties(existing.getProperties()); - newDescription.setDmpId(dmpId); - if (newDmpDescriptionTemplateId == null && dmpDescriptionTemplateRemap != null) newDescription.setDmpDescriptionTemplateId(dmpDescriptionTemplateRemap.get(existing.getDmpDescriptionTemplateId())); - else newDescription.setDmpDescriptionTemplateId(newDmpDescriptionTemplateId); + newDescription.setPlanId(planId); + if (newPlanDescriptionTemplateId == null && planDescriptionTemplateRemap != null) newDescription.setPlanDescriptionTemplateId(planDescriptionTemplateRemap.get(existing.getPlanDescriptionTemplateId())); + else newDescription.setPlanDescriptionTemplateId(newPlanDescriptionTemplateId); newDescription.setDescriptionTemplateId(existing.getDescriptionTemplateId()); newDescription.setCreatedById(this.userScope.getUserId()); newDescription.setCreatedAt(Instant.now()); @@ -634,37 +634,37 @@ public class DmpServiceImpl implements DmpService { - private void updateVersionStatusAndSave(DmpEntity data, DmpStatus previousStatus, DmpStatus newStatus) throws InvalidApplicationException { + private void updateVersionStatusAndSave(PlanEntity data, PlanStatus previousStatus, PlanStatus newStatus) throws InvalidApplicationException { if (previousStatus.equals(newStatus)) return; - if (previousStatus.equals(DmpStatus.Finalized) && newStatus.equals(DmpStatus.Draft)){ - boolean alreadyCreatedNewVersion = this.queryFactory.query(DmpQuery.class).disableTracking() - .versionStatuses(DmpVersionStatus.NotFinalized, DmpVersionStatus.Current) + if (previousStatus.equals(PlanStatus.Finalized) && newStatus.equals(PlanStatus.Draft)){ + boolean alreadyCreatedNewVersion = this.queryFactory.query(PlanQuery.class).disableTracking() + .versionStatuses(PlanVersionStatus.NotFinalized, PlanVersionStatus.Current) .excludedIds(data.getId()) .isActive(IsActive.Active) .groupIds(data.getGroupId()) .count() > 0; if (alreadyCreatedNewVersion) throw new MyValidationException("Already new version is created"); - data.setVersionStatus(DmpVersionStatus.NotFinalized); + data.setVersionStatus(PlanVersionStatus.NotFinalized); this.entityManager.merge(data); } - if (newStatus.equals(DmpStatus.Finalized)) { - List latestVersionDmps = this.queryFactory.query(DmpQuery.class) - .versionStatuses(DmpVersionStatus.Current).excludedIds(data.getId()) + if (newStatus.equals(PlanStatus.Finalized)) { + List latestVersionDmps = this.queryFactory.query(PlanQuery.class) + .versionStatuses(PlanVersionStatus.Current).excludedIds(data.getId()) .isActive(IsActive.Active).groupIds(data.getGroupId()).collect(); if (latestVersionDmps.size() > 1) throw new MyValidationException("Multiple previous template found"); - DmpEntity oldDmpEntity = latestVersionDmps.stream().findFirst().orElse(null); + PlanEntity oldPlanEntity = latestVersionDmps.stream().findFirst().orElse(null); - data.setVersionStatus(DmpVersionStatus.Current); + data.setVersionStatus(PlanVersionStatus.Current); - if (oldDmpEntity != null) { - data.setVersion((short) (oldDmpEntity.getVersion() + 1)); + if (oldPlanEntity != null) { + data.setVersion((short) (oldPlanEntity.getVersion() + 1)); - oldDmpEntity.setVersionStatus(DmpVersionStatus.Previous); - this.entityManager.merge(oldDmpEntity); + oldPlanEntity.setVersionStatus(PlanVersionStatus.Previous); + this.entityManager.merge(oldPlanEntity); } else { data.setVersion((short) 1); } @@ -672,51 +672,51 @@ public class DmpServiceImpl implements DmpService { } @Override - public Dmp buildClone(CloneDmpPersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, IOException, InvalidApplicationException { - this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.dmpAffiliation( model.getId())), Permission.CloneDmp); + public Plan buildClone(ClonePlanPersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, IOException, InvalidApplicationException { + this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.dmpAffiliation( model.getId())), Permission.ClonePlan); - DmpEntity existingDmpEntity = this.queryFactory.query(DmpQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).ids(model.getId()).firstAs(fields); - if (!this.conventionService.isValidGuid(model.getId()) || existingDmpEntity == null) - throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale())); + PlanEntity existingPlanEntity = this.queryFactory.query(PlanQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).ids(model.getId()).firstAs(fields); + if (!this.conventionService.isValidGuid(model.getId()) || existingPlanEntity == null) + throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), Plan.class.getSimpleName()}, LocaleContextHolder.getLocale())); - DmpEntity newDmp = new DmpEntity(); - newDmp.setId(UUID.randomUUID()); - newDmp.setIsActive(IsActive.Active); - newDmp.setCreatedAt(Instant.now()); - newDmp.setUpdatedAt(Instant.now()); - newDmp.setGroupId(UUID.randomUUID()); - newDmp.setVersion((short) 1); - newDmp.setVersionStatus(DmpVersionStatus.NotFinalized); - newDmp.setDescription(model.getDescription()); - newDmp.setLabel(model.getLabel()); - newDmp.setLanguage(existingDmpEntity.getLanguage()); - newDmp.setStatus(DmpStatus.Draft); - newDmp.setProperties(existingDmpEntity.getProperties()); - newDmp.setBlueprintId(existingDmpEntity.getBlueprintId()); - newDmp.setAccessType(existingDmpEntity.getAccessType()); - newDmp.setCreatorId(this.userScope.getUserId()); + PlanEntity newPlan = new PlanEntity(); + newPlan.setId(UUID.randomUUID()); + newPlan.setIsActive(IsActive.Active); + newPlan.setCreatedAt(Instant.now()); + newPlan.setUpdatedAt(Instant.now()); + newPlan.setGroupId(UUID.randomUUID()); + newPlan.setVersion((short) 1); + newPlan.setVersionStatus(PlanVersionStatus.NotFinalized); + newPlan.setDescription(model.getDescription()); + newPlan.setLabel(model.getLabel()); + newPlan.setLanguage(existingPlanEntity.getLanguage()); + newPlan.setStatus(PlanStatus.Draft); + newPlan.setProperties(existingPlanEntity.getProperties()); + newPlan.setBlueprintId(existingPlanEntity.getBlueprintId()); + newPlan.setAccessType(existingPlanEntity.getAccessType()); + newPlan.setCreatorId(this.userScope.getUserId()); - this.entityManager.persist(newDmp); + this.entityManager.persist(newPlan); - List dmpUsers = this.queryFactory.query(DmpUserQuery.class).disableTracking() - .dmpIds(model.getId()) + List planUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking() + .planIds(model.getId()) .isActives(IsActive.Active) .collect(); - List dmpReferences = this.queryFactory.query(DmpReferenceQuery.class).disableTracking() - .dmpIds(model.getId()) + List planReferences = this.queryFactory.query(PlanReferenceQuery.class).disableTracking() + .planIds(model.getId()) .isActives(IsActive.Active) .collect(); - List dmpDescriptionTemplates = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking() - .dmpIds(model.getId()) + List planDescriptionTemplates = this.queryFactory.query(PlanDescriptionTemplateQuery.class).disableTracking() + .planIds(model.getId()) .isActive(IsActive.Active) .collect(); - for (DmpUserEntity dmpUser : dmpUsers) { - DmpUserEntity newUser = new DmpUserEntity(); + for (PlanUserEntity planUser : planUsers) { + PlanUserEntity newUser = new PlanUserEntity(); newUser.setId(UUID.randomUUID()); - newUser.setDmpId(newDmp.getId()); - newUser.setUserId(dmpUser.getUserId()); - newUser.setRole(dmpUser.getRole()); + newUser.setPlanId(newPlan.getId()); + newUser.setUserId(planUser.getUserId()); + newUser.setRole(planUser.getRole()); newUser.setCreatedAt(Instant.now()); newUser.setUpdatedAt(Instant.now()); newUser.setIsActive(IsActive.Active); @@ -724,12 +724,12 @@ public class DmpServiceImpl implements DmpService { this.entityManager.persist(newUser); } - for (DmpReferenceEntity dmpReference : dmpReferences) { - DmpReferenceEntity newReference = new DmpReferenceEntity(); + for (PlanReferenceEntity planReference : planReferences) { + PlanReferenceEntity newReference = new PlanReferenceEntity(); newReference.setId(UUID.randomUUID()); - newReference.setDmpId(newDmp.getId()); - newReference.setReferenceId(dmpReference.getReferenceId()); - newReference.setData(dmpReference.getData()); + newReference.setPlanId(newPlan.getId()); + newReference.setReferenceId(planReference.getReferenceId()); + newReference.setData(planReference.getData()); newReference.setCreatedAt(Instant.now()); newReference.setUpdatedAt(Instant.now()); newReference.setIsActive(IsActive.Active); @@ -737,90 +737,90 @@ public class DmpServiceImpl implements DmpService { this.entityManager.persist(newReference); } - Map dmpDescriptionTemplateRemap = new HashMap<>(); - for (DmpDescriptionTemplateEntity dmpDescriptionTemplate : dmpDescriptionTemplates) { - DmpDescriptionTemplateEntity newTemplate = new DmpDescriptionTemplateEntity(); + Map planDescriptionTemplateRemap = new HashMap<>(); + for (PlanDescriptionTemplateEntity planDescriptionTemplate : planDescriptionTemplates) { + PlanDescriptionTemplateEntity newTemplate = new PlanDescriptionTemplateEntity(); newTemplate.setId(UUID.randomUUID()); - newTemplate.setDmpId(newDmp.getId()); - newTemplate.setDescriptionTemplateGroupId(dmpDescriptionTemplate.getDescriptionTemplateGroupId()); - newTemplate.setSectionId(dmpDescriptionTemplate.getSectionId()); + newTemplate.setPlanId(newPlan.getId()); + newTemplate.setDescriptionTemplateGroupId(planDescriptionTemplate.getDescriptionTemplateGroupId()); + newTemplate.setSectionId(planDescriptionTemplate.getSectionId()); newTemplate.setCreatedAt(Instant.now()); newTemplate.setUpdatedAt(Instant.now()); newTemplate.setIsActive(IsActive.Active); - dmpDescriptionTemplateRemap.put(dmpDescriptionTemplate.getId(), newTemplate.getId()); + planDescriptionTemplateRemap.put(planDescriptionTemplate.getId(), newTemplate.getId()); this.entityManager.persist(newTemplate); } this.entityManager.flush(); - this.elasticService.persistDmp(newDmp); + this.elasticService.persistPlan(newPlan); - this.annotationEntityTouchedIntegrationEventHandler.handleDmp(newDmp.getId()); + this.annotationEntityTouchedIntegrationEventHandler.handlePlan(newPlan.getId()); - DmpEntity resultingDmpEntity = this.queryFactory.query(DmpQuery.class).disableTracking().ids(newDmp.getId()).firstAs(fields); + PlanEntity resultingPlanEntity = this.queryFactory.query(PlanQuery.class).disableTracking().ids(newPlan.getId()).firstAs(fields); if (!this.conventionService.isListNullOrEmpty(model.getDescriptions())){ for (UUID description: model.getDescriptions()) { - this.cloneDescription(newDmp.getId(), dmpDescriptionTemplateRemap, description, null); + this.cloneDescription(newPlan.getId(), planDescriptionTemplateRemap, description, null); } } - return this.builderFactory.builder(DmpBuilder.class).build(fields, resultingDmpEntity); + return this.builderFactory.builder(PlanBuilder.class).build(fields, resultingPlanEntity); } @Override - public List assignUsers(UUID dmpId, List model, FieldSet fieldSet, boolean disableDelete) throws InvalidApplicationException, IOException { - this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.dmpAffiliation(dmpId)), Permission.AssignDmpUsers); + public List assignUsers(UUID planId, List model, FieldSet fieldSet, boolean disableDelete) throws InvalidApplicationException, IOException { + this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.dmpAffiliation(planId)), Permission.AssignPlanUsers); - if (!disableDelete && (model == null || model.stream().noneMatch(x-> x.getUser() != null && DmpUserRole.Owner.equals(x.getRole())))) throw new MyApplicationException("At least one owner required"); + if (!disableDelete && (model == null || model.stream().noneMatch(x-> x.getUser() != null && PlanUserRole.Owner.equals(x.getRole())))) throw new MyApplicationException("At least one owner required"); this.checkDuplicateDmpUser(model); - DmpEntity dmpEntity = this.entityManager.find(DmpEntity.class, dmpId, true); - if (dmpEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{dmpId, Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale())); + PlanEntity planEntity = this.entityManager.find(PlanEntity.class, planId, true); + if (planEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{planId, Plan.class.getSimpleName()}, LocaleContextHolder.getLocale())); - List existingUsers = this.queryFactory.query(DmpUserQuery.class) - .dmpIds(dmpId) + List existingUsers = this.queryFactory.query(PlanUserQuery.class) + .planIds(planId) .isActives(IsActive.Active) .collect(); List updatedCreatedIds = new ArrayList<>(); - for (DmpUserPersist dmpUser : model) { - DmpUserEntity dmpUserEntity = existingUsers.stream().filter(x-> x.getDmpId().equals(dmpId) && x.getUserId().equals(dmpUser.getUser()) && x.getRole().equals(dmpUser.getRole()) && Objects.equals(dmpUser.getSectionId(), x.getSectionId())).findFirst().orElse(null); - if (dmpUserEntity == null){ - dmpUserEntity = new DmpUserEntity(); - dmpUserEntity.setId(UUID.randomUUID()); - dmpUserEntity.setDmpId(dmpId); - dmpUserEntity.setUserId(dmpUser.getUser()); - dmpUserEntity.setRole(dmpUser.getRole()); - dmpUserEntity.setSectionId(dmpUser.getSectionId()); - dmpUserEntity.setCreatedAt(Instant.now()); - dmpUserEntity.setUpdatedAt(Instant.now()); - dmpUserEntity.setIsActive(IsActive.Active); - this.entityManager.persist(dmpUserEntity); + for (PlanUserPersist dmpUser : model) { + PlanUserEntity planUserEntity = existingUsers.stream().filter(x-> x.getPlanId().equals(planId) && x.getUserId().equals(dmpUser.getUser()) && x.getRole().equals(dmpUser.getRole()) && Objects.equals(dmpUser.getSectionId(), x.getSectionId())).findFirst().orElse(null); + if (planUserEntity == null){ + planUserEntity = new PlanUserEntity(); + planUserEntity.setId(UUID.randomUUID()); + planUserEntity.setPlanId(planId); + planUserEntity.setUserId(dmpUser.getUser()); + planUserEntity.setRole(dmpUser.getRole()); + planUserEntity.setSectionId(dmpUser.getSectionId()); + planUserEntity.setCreatedAt(Instant.now()); + planUserEntity.setUpdatedAt(Instant.now()); + planUserEntity.setIsActive(IsActive.Active); + this.entityManager.persist(planUserEntity); } - updatedCreatedIds.add(dmpUserEntity.getId()); + updatedCreatedIds.add(planUserEntity.getId()); } - List toDelete = existingUsers.stream().filter(x-> updatedCreatedIds.stream().noneMatch(y-> y.equals(x.getId()))).collect(Collectors.toList()); - if (!toDelete.isEmpty() && !disableDelete) this.deleterFactory.deleter(DmpUserDeleter.class).delete(toDelete); + List toDelete = existingUsers.stream().filter(x-> updatedCreatedIds.stream().noneMatch(y-> y.equals(x.getId()))).collect(Collectors.toList()); + if (!toDelete.isEmpty() && !disableDelete) this.deleterFactory.deleter(PlanUserDeleter.class).delete(toDelete); this.entityManager.flush(); - List persisted = this.queryFactory.query(DmpUserQuery.class) - .dmpIds(dmpId) + List persisted = this.queryFactory.query(PlanUserQuery.class) + .planIds(planId) .isActives(IsActive.Active) .collect(); - this.elasticService.persistDmp(dmpEntity); + this.elasticService.persistPlan(planEntity); - this.annotationEntityTouchedIntegrationEventHandler.handleDmp(dmpEntity.getId()); + this.annotationEntityTouchedIntegrationEventHandler.handlePlan(planEntity.getId()); - return this.builderFactory.builder(DmpUserBuilder.class).authorize(AuthorizationFlags.AllExceptPublic).build(BaseFieldSet.build(fieldSet, DmpUser._id, DmpUser._hash), persisted); + return this.builderFactory.builder(PlanUserBuilder.class).authorize(AuthorizationFlags.AllExceptPublic).build(BaseFieldSet.build(fieldSet, PlanUser._id, PlanUser._hash), persisted); } - private void checkDuplicateDmpUser(List model){ - for (DmpUserPersist user: model) { - List duplicateUser; + private void checkDuplicateDmpUser(List model){ + for (PlanUserPersist user: model) { + List duplicateUser; if (user.getUser() != null){ duplicateUser = model.stream().filter(x -> x.getUser().equals(user.getUser()) && x.getRole().equals(user.getRole()) && Objects.equals(user.getSectionId(), x.getSectionId())).collect(Collectors.toList()); } else { @@ -833,26 +833,26 @@ public class DmpServiceImpl implements DmpService { } @Override - public Dmp removeUser(DmpUserRemovePersist model, FieldSet fields) throws InvalidApplicationException, IOException { - this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.dmpAffiliation(model.getDmpId())), Permission.AssignDmpUsers); - DmpEntity data = this.entityManager.find(DmpEntity.class, model.getDmpId(), true); - if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale())); + public Plan removeUser(PlanUserRemovePersist model, FieldSet fields) throws InvalidApplicationException, IOException { + this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.dmpAffiliation(model.getPlanId())), Permission.AssignPlanUsers); + PlanEntity data = this.entityManager.find(PlanEntity.class, model.getPlanId(), true); + if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), Plan.class.getSimpleName()}, LocaleContextHolder.getLocale())); - List existingUsers = this.queryFactory.query(DmpUserQuery.class) - .dmpIds(model.getDmpId()).ids(model.getId()).userRoles(model.getRole()) + List existingUsers = this.queryFactory.query(PlanUserQuery.class) + .planIds(model.getPlanId()).ids(model.getId()).userRoles(model.getRole()) .collect(); - if (!existingUsers.isEmpty()) this.deleterFactory.deleter(DmpUserDeleter.class).delete(existingUsers); + if (!existingUsers.isEmpty()) this.deleterFactory.deleter(PlanUserDeleter.class).delete(existingUsers); this.entityManager.flush(); - DmpEntity dmpEntity = this.entityManager.find(DmpEntity.class, model.getDmpId()); - if (dmpEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getDmpId(), Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale())); - this.elasticService.persistDmp(dmpEntity); + PlanEntity planEntity = this.entityManager.find(PlanEntity.class, model.getPlanId()); + if (planEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getPlanId(), Plan.class.getSimpleName()}, LocaleContextHolder.getLocale())); + this.elasticService.persistPlan(planEntity); - this.annotationEntityTouchedIntegrationEventHandler.handleDmp(dmpEntity.getId()); + this.annotationEntityTouchedIntegrationEventHandler.handlePlan(planEntity.getId()); - return this.builderFactory.builder(DmpBuilder.class).authorize(AuthorizationFlags.AllExceptPublic).build(BaseFieldSet.build(fields, Dmp._id, Dmp._hash), data); + return this.builderFactory.builder(PlanBuilder.class).authorize(AuthorizationFlags.AllExceptPublic).build(BaseFieldSet.build(fields, Plan._id, Plan._hash), data); } @Override @@ -866,37 +866,37 @@ public class DmpServiceImpl implements DmpService { return new ResponseEntity<>(data, headers, HttpStatus.OK); } - private DmpEntity patchAndSave(DmpPersist model) throws JsonProcessingException, InvalidApplicationException { + private PlanEntity patchAndSave(PlanPersist model) throws JsonProcessingException, InvalidApplicationException { Boolean isUpdate = this.conventionService.isValidGuid(model.getId()); - DmpEntity data; + PlanEntity data; if (isUpdate) { - data = this.entityManager.find(DmpEntity.class, model.getId()); - if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale())); + data = this.entityManager.find(PlanEntity.class, model.getId()); + if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), Plan.class.getSimpleName()}, LocaleContextHolder.getLocale())); if (!this.conventionService.hashValue(data.getUpdatedAt()).equals(model.getHash())) throw new MyValidationException(this.errors.getHashConflict().getCode(), this.errors.getHashConflict().getMessage()); - if (model.getStatus() != null && model.getStatus() == DmpStatus.Finalized && data.getStatus() != DmpStatus.Finalized) { - this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.dmpAffiliation(model.getId())), Permission.FinalizeDmp); + if (model.getStatus() != null && model.getStatus() == PlanStatus.Finalized && data.getStatus() != PlanStatus.Finalized) { + this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.dmpAffiliation(model.getId())), Permission.FinalizePlan); data.setStatus(model.getStatus()); data.setFinalizedAt(Instant.now()); } } else { - data = new DmpEntity(); + data = new PlanEntity(); data.setId(UUID.randomUUID()); data.setGroupId(UUID.randomUUID()); data.setVersion((short) 1); - data.setStatus(DmpStatus.Draft); - data.setVersionStatus(DmpVersionStatus.NotFinalized); + data.setStatus(PlanStatus.Draft); + data.setVersionStatus(PlanVersionStatus.NotFinalized); data.setCreatorId(this.userScope.getUserId()); data.setBlueprintId(model.getBlueprint()); data.setIsActive(IsActive.Active); data.setCreatedAt(Instant.now()); } - DmpStatus previousStatus = data.getStatus(); + PlanStatus previousStatus = data.getStatus(); - DmpBlueprintEntity dmpBlueprintEntity = this.entityManager.find(DmpBlueprintEntity.class, model.getBlueprint(), true); - if (dmpBlueprintEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getBlueprint(), DmpBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale())); + PlanBlueprintEntity planBlueprintEntity = this.entityManager.find(PlanBlueprintEntity.class, model.getBlueprint(), true); + if (planBlueprintEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getBlueprint(), PlanBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale())); - org.opencdmp.commons.types.dmpblueprint.DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(org.opencdmp.commons.types.dmpblueprint.DefinitionEntity.class, dmpBlueprintEntity.getDefinition()); + org.opencdmp.commons.types.planblueprint.DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(org.opencdmp.commons.types.planblueprint.DefinitionEntity.class, planBlueprintEntity.getDefinition()); data.setLabel(model.getLabel()); data.setLanguage(model.getLanguage()); @@ -919,26 +919,26 @@ public class DmpServiceImpl implements DmpService { return data; } - private @NotNull DmpPropertiesEntity buildDmpPropertiesEntity(DmpPropertiesPersist persist, org.opencdmp.commons.types.dmpblueprint.DefinitionEntity definition){ - DmpPropertiesEntity data = new DmpPropertiesEntity(); + private @NotNull PlanPropertiesEntity buildDmpPropertiesEntity(PlanPropertiesPersist persist, org.opencdmp.commons.types.planblueprint.DefinitionEntity definition){ + PlanPropertiesEntity data = new PlanPropertiesEntity(); if (persist == null) return data; if (!this.conventionService.isListNullOrEmpty(persist.getContacts())){ data.setContacts(new ArrayList<>()); - for (DmpContactPersist contactPersist: persist.getContacts()) { + for (PlanContactPersist contactPersist: persist.getContacts()) { data.getContacts().add(this.buildDmpContactEntity(contactPersist)); } } - if (persist.getDmpBlueprintValues() != null && !persist.getDmpBlueprintValues().isEmpty()){ - data.setDmpBlueprintValues(new ArrayList<>()); - for (DmpBlueprintValuePersist fieldValuePersist: persist.getDmpBlueprintValues().values()) { - if (!this.conventionService.isNullOrEmpty(fieldValuePersist.getFieldValue()) || fieldValuePersist.getDateValue() != null || fieldValuePersist.getNumberValue() != null) data.getDmpBlueprintValues().add(this.buildDmpBlueprintValueEntity(fieldValuePersist, definition)); + if (persist.getPlanBlueprintValues() != null && !persist.getPlanBlueprintValues().isEmpty()){ + data.setPlanBlueprintValues(new ArrayList<>()); + for (PlanBlueprintValuePersist fieldValuePersist: persist.getPlanBlueprintValues().values()) { + if (!this.conventionService.isNullOrEmpty(fieldValuePersist.getFieldValue()) || fieldValuePersist.getDateValue() != null || fieldValuePersist.getNumberValue() != null) data.getPlanBlueprintValues().add(this.buildDmpBlueprintValueEntity(fieldValuePersist, definition)); } } return data; } - private @NotNull DmpContactEntity buildDmpContactEntity(DmpContactPersist persist){ - DmpContactEntity data = new DmpContactEntity(); + private @NotNull PlanContactEntity buildDmpContactEntity(PlanContactPersist persist){ + PlanContactEntity data = new PlanContactEntity(); if (persist == null) return data; data.setEmail(persist.getEmail()); @@ -947,18 +947,18 @@ public class DmpServiceImpl implements DmpService { return data; } - private @NotNull DmpBlueprintValueEntity buildDmpBlueprintValueEntity(DmpBlueprintValuePersist persist, org.opencdmp.commons.types.dmpblueprint.DefinitionEntity definition){ - DmpBlueprintValueEntity data = new DmpBlueprintValueEntity(); + private @NotNull PlanBlueprintValueEntity buildDmpBlueprintValueEntity(PlanBlueprintValuePersist persist, org.opencdmp.commons.types.planblueprint.DefinitionEntity definition){ + PlanBlueprintValueEntity data = new PlanBlueprintValueEntity(); if (persist == null || definition == null) return data; - org.opencdmp.commons.types.dmpblueprint.FieldEntity fieldEntity = definition.getFieldById(persist.getFieldId()).stream().findFirst().orElse(null); + org.opencdmp.commons.types.planblueprint.FieldEntity fieldEntity = definition.getFieldById(persist.getFieldId()).stream().findFirst().orElse(null); if (fieldEntity == null) return data; - if (fieldEntity.getCategory().equals(DmpBlueprintFieldCategory.Extra)) { + if (fieldEntity.getCategory().equals(PlanBlueprintFieldCategory.Extra)) { ExtraFieldEntity extraFieldEntity = (ExtraFieldEntity) fieldEntity; - if (DmpBlueprintExtraFieldDataType.isDateType(extraFieldEntity.getType())){ + if (PlanBlueprintExtraFieldDataType.isDateType(extraFieldEntity.getType())){ data.setDateValue(persist.getDateValue()); - } else if (DmpBlueprintExtraFieldDataType.isNumberType(extraFieldEntity.getType())){ + } else if (PlanBlueprintExtraFieldDataType.isNumberType(extraFieldEntity.getType())){ data.setNumberValue(persist.getNumberValue()); } else { data.setValue(persist.getFieldValue()); @@ -969,56 +969,56 @@ public class DmpServiceImpl implements DmpService { return data; } - private @NotNull List buildDmpReferencePersists(DmpPropertiesPersist persist){ - List dmpReferencePersists = new ArrayList<>(); - if (persist.getDmpBlueprintValues() != null && !persist.getDmpBlueprintValues().isEmpty()){ - for (DmpBlueprintValuePersist fieldValuePersist: persist.getDmpBlueprintValues().values()) { + private @NotNull List buildPlanReferencePersists(PlanPropertiesPersist persist){ + List planReferencePersists = new ArrayList<>(); + if (persist.getPlanBlueprintValues() != null && !persist.getPlanBlueprintValues().isEmpty()){ + for (PlanBlueprintValuePersist fieldValuePersist: persist.getPlanBlueprintValues().values()) { if (fieldValuePersist.getReference() != null) { if (fieldValuePersist.getReferences() == null) fieldValuePersist.setReferences(new ArrayList<>()); fieldValuePersist.getReferences().add(fieldValuePersist.getReference()); } if (this.conventionService.isNullOrEmpty(fieldValuePersist.getFieldValue()) && fieldValuePersist.getDateValue() == null && fieldValuePersist.getNumberValue() == null && !this.conventionService.isListNullOrEmpty( fieldValuePersist.getReferences())) { for (ReferencePersist referencePersist : fieldValuePersist.getReferences()) { - DmpReferencePersist dmpReferencePersist = new DmpReferencePersist(); - dmpReferencePersist.setData(new DmpReferenceDataPersist()); - dmpReferencePersist.getData().setBlueprintFieldId(fieldValuePersist.getFieldId()); - dmpReferencePersist.setReference(referencePersist); - dmpReferencePersists.add(dmpReferencePersist); + PlanReferencePersist planReferencePersist = new PlanReferencePersist(); + planReferencePersist.setData(new PlanReferenceDataPersist()); + planReferencePersist.getData().setBlueprintFieldId(fieldValuePersist.getFieldId()); + planReferencePersist.setReference(referencePersist); + planReferencePersists.add(planReferencePersist); } } } } - return dmpReferencePersists; + return planReferencePersists; } - private void patchAndSaveReferences(List models, UUID dmpId, org.opencdmp.commons.types.dmpblueprint.DefinitionEntity blueprintDefinition) throws InvalidApplicationException { + private void patchAndSaveReferences(List models, UUID planId, org.opencdmp.commons.types.planblueprint.DefinitionEntity blueprintDefinition) throws InvalidApplicationException { if (models == null) models = new ArrayList<>(); - List dmpReferences = this.queryFactory.query(DmpReferenceQuery.class).dmpIds(dmpId).isActives(IsActive.Active).collect(); - Map> dmpReferenceEntityByReferenceId = new HashMap<>(); - for (DmpReferenceEntity dmpReferenceEntity : dmpReferences){ - List dmpReferenceEntities = dmpReferenceEntityByReferenceId.getOrDefault(dmpReferenceEntity.getReferenceId(), null); - if (dmpReferenceEntities == null) { - dmpReferenceEntities = new ArrayList<>(); - dmpReferenceEntityByReferenceId.put(dmpReferenceEntity.getReferenceId(), dmpReferenceEntities); + List planReferences = this.queryFactory.query(PlanReferenceQuery.class).planIds(planId).isActives(IsActive.Active).collect(); + Map> planReferenceEntityByReferenceId = new HashMap<>(); + for (PlanReferenceEntity planReferenceEntity : planReferences){ + List planReferenceEntities = planReferenceEntityByReferenceId.getOrDefault(planReferenceEntity.getReferenceId(), null); + if (planReferenceEntities == null) { + planReferenceEntities = new ArrayList<>(); + planReferenceEntityByReferenceId.put(planReferenceEntity.getReferenceId(), planReferenceEntities); } - dmpReferenceEntities.add(dmpReferenceEntity); + planReferenceEntities.add(planReferenceEntity); } - Map dmpReferenceDataEntityMap = new HashMap<>(); - for (DmpReferenceEntity dmpReferenceEntity : dmpReferences){ - dmpReferenceDataEntityMap.put(dmpReferenceEntity.getId(), this.jsonHandlingService.fromJsonSafe(DmpReferenceDataEntity.class, dmpReferenceEntity.getData())); + Map planReferenceDataEntityMap = new HashMap<>(); + for (PlanReferenceEntity planReferenceEntity : planReferences){ + planReferenceDataEntityMap.put(planReferenceEntity.getId(), this.jsonHandlingService.fromJsonSafe(PlanReferenceDataEntity.class, planReferenceEntity.getData())); } List updatedCreatedIds = new ArrayList<>(); - for (DmpReferencePersist model : models) { + for (PlanReferencePersist model : models) { ReferencePersist referencePersist = model.getReference(); ReferenceEntity referenceEntity; if (this.conventionService.isValidGuid(referencePersist.getId())){ referenceEntity = this.entityManager.find(ReferenceEntity.class, referencePersist.getId()); if (referenceEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{referencePersist.getId(), Reference.class.getSimpleName()}, LocaleContextHolder.getLocale())); } else { - ReferenceTypeFieldEntity fieldEntity = blueprintDefinition.getFieldById(model.getData().getBlueprintFieldId()).stream().filter(x-> x.getCategory().equals(DmpBlueprintFieldCategory.ReferenceType)).map(x-> (ReferenceTypeFieldEntity)x).findFirst().orElse(null); + ReferenceTypeFieldEntity fieldEntity = blueprintDefinition.getFieldById(model.getData().getBlueprintFieldId()).stream().filter(x-> x.getCategory().equals(PlanBlueprintFieldCategory.ReferenceType)).map(x-> (ReferenceTypeFieldEntity)x).findFirst().orElse(null); if (fieldEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getData().getBlueprintFieldId(), ReferenceTypeFieldEntity.class.getSimpleName()}, LocaleContextHolder.getLocale())); referenceEntity = this.queryFactory.query(ReferenceQuery.class).sourceTypes(referencePersist.getSourceType()).typeIds(fieldEntity.getReferenceTypeId()).sources(referencePersist.getSource()).isActive(IsActive.Active).references(referencePersist.getReference()).first(); @@ -1050,25 +1050,25 @@ public class DmpServiceImpl implements DmpService { } } - DmpReferenceEntity data = null; - List dmpReferenceEntities = dmpReferenceEntityByReferenceId.getOrDefault(referenceEntity.getId(), new ArrayList<>()); - for (DmpReferenceEntity dmpReferenceEntity : dmpReferenceEntities){ - DmpReferenceDataEntity dmpReferenceDataEntity = dmpReferenceDataEntityMap.getOrDefault(dmpReferenceEntity.getId(), new DmpReferenceDataEntity()); - if (Objects.equals(dmpReferenceDataEntity.getBlueprintFieldId(), model.getData().getBlueprintFieldId())){ - data = dmpReferenceEntity; + PlanReferenceEntity data = null; + List planReferenceEntities = planReferenceEntityByReferenceId.getOrDefault(referenceEntity.getId(), new ArrayList<>()); + for (PlanReferenceEntity planReferenceEntity : planReferenceEntities){ + PlanReferenceDataEntity planReferenceDataEntity = planReferenceDataEntityMap.getOrDefault(planReferenceEntity.getId(), new PlanReferenceDataEntity()); + if (Objects.equals(planReferenceDataEntity.getBlueprintFieldId(), model.getData().getBlueprintFieldId())){ + data = planReferenceEntity; break; } } boolean isUpdate = data != null; if (!isUpdate) { - data = new DmpReferenceEntity(); + data = new PlanReferenceEntity(); data.setId(UUID.randomUUID()); data.setReferenceId(referenceEntity.getId()); - data.setDmpId(dmpId); + data.setPlanId(planId); data.setCreatedAt(Instant.now()); data.setIsActive(IsActive.Active); - data.setData(this.jsonHandlingService.toJsonSafe(this.buildDmpReferenceDataEntity(model.getData()))); + data.setData(this.jsonHandlingService.toJsonSafe(this.buildPlanReferenceDataEntity(model.getData()))); } updatedCreatedIds.add(data.getId()); @@ -1077,33 +1077,33 @@ public class DmpServiceImpl implements DmpService { if (isUpdate) this.entityManager.merge(data); else this.entityManager.persist(data); } - List toDelete = dmpReferences.stream().filter(x-> updatedCreatedIds.stream().noneMatch(y-> y.equals(x.getId()))).collect(Collectors.toList()); - this.deleterFactory.deleter(DmpReferenceDeleter.class).delete(toDelete); + List toDelete = planReferences.stream().filter(x-> updatedCreatedIds.stream().noneMatch(y-> y.equals(x.getId()))).collect(Collectors.toList()); + this.deleterFactory.deleter(PlanReferenceDeleter.class).delete(toDelete); this.entityManager.flush(); } - private void patchAndSaveTemplates(UUID id, List models) throws InvalidApplicationException { + private void patchAndSaveTemplates(UUID id, List models) throws InvalidApplicationException { if (models == null) models = new ArrayList<>(); - List items = this.queryFactory.query(DmpDescriptionTemplateQuery.class).isActive(IsActive.Active).dmpIds(id).collect(); + List items = this.queryFactory.query(PlanDescriptionTemplateQuery.class).isActive(IsActive.Active).planIds(id).collect(); List updatedCreatedIds = new ArrayList<>(); - for (DmpDescriptionTemplatePersist model : models) { - DmpDescriptionTemplateEntity data = items.stream().filter(x -> x.getDescriptionTemplateGroupId().equals(model.getDescriptionTemplateGroupId()) && x.getSectionId().equals(model.getSectionId())).findFirst().orElse(null); + for (PlanDescriptionTemplatePersist model : models) { + PlanDescriptionTemplateEntity data = items.stream().filter(x -> x.getDescriptionTemplateGroupId().equals(model.getDescriptionTemplateGroupId()) && x.getSectionId().equals(model.getSectionId())).findFirst().orElse(null); if (data == null){ - data = new DmpDescriptionTemplateEntity(); + data = new PlanDescriptionTemplateEntity(); data.setId(UUID.randomUUID()); data.setIsActive(IsActive.Active); data.setCreatedAt(Instant.now()); data.setUpdatedAt(Instant.now()); - data.setDmpId(id); + data.setPlanId(id); data.setSectionId(model.getSectionId()); data.setDescriptionTemplateGroupId(model.getDescriptionTemplateGroupId()); this.entityManager.persist(data); } updatedCreatedIds.add(data.getId()); } - List toDelete = items.stream().filter(x-> updatedCreatedIds.stream().noneMatch(y-> y.equals(x.getId()))).collect(Collectors.toList()); + List toDelete = items.stream().filter(x-> updatedCreatedIds.stream().noneMatch(y-> y.equals(x.getId()))).collect(Collectors.toList()); - this.deleterFactory.deleter(DmpDescriptionTemplateDeleter.class).delete(toDelete); + this.deleterFactory.deleter(PlanDescriptionTemplateDeleter.class).delete(toDelete); } private @NotNull DefinitionEntity buildDefinitionEntity(DefinitionPersist persist){ @@ -1119,8 +1119,8 @@ public class DmpServiceImpl implements DmpService { return data; } - private @NotNull DmpReferenceDataEntity buildDmpReferenceDataEntity(DmpReferenceDataPersist persist){ - DmpReferenceDataEntity data = new DmpReferenceDataEntity(); + private @NotNull PlanReferenceDataEntity buildPlanReferenceDataEntity(PlanReferenceDataPersist persist){ + PlanReferenceDataEntity data = new PlanReferenceDataEntity(); if (persist == null) return data; data.setBlueprintFieldId(persist.getBlueprintFieldId()); return data; @@ -1138,23 +1138,23 @@ public class DmpServiceImpl implements DmpService { } public void finalize(UUID id, List descriptionIds) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, IOException { - this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.dmpAffiliation(id)), Permission.FinalizeDmp); - DmpEntity dmp = this.queryFactory.query(DmpQuery.class).authorize(AuthorizationFlags.AllExceptPublic).ids(id).isActive(IsActive.Active).first(); + this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.dmpAffiliation(id)), Permission.FinalizePlan); + PlanEntity dmp = this.queryFactory.query(PlanQuery.class).authorize(AuthorizationFlags.AllExceptPublic).ids(id).isActive(IsActive.Active).first(); if (dmp == null){ - throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale())); + throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Plan.class.getSimpleName()}, LocaleContextHolder.getLocale())); } - if (dmp.getStatus().equals(DmpStatus.Finalized)){ + if (dmp.getStatus().equals(PlanStatus.Finalized)){ throw new MyApplicationException("DMP is already finalized"); } - if (this.validate(id).getResult().equals(DmpValidationOutput.Invalid)){ + if (this.validate(id).getResult().equals(PlanValidationOutput.Invalid)){ throw new MyApplicationException("Dmp is invalid"); } List descriptions = this.queryFactory.query(DescriptionQuery.class) - .authorize(AuthorizationFlags.AllExceptPublic).dmpIds(id).isActive(IsActive.Active).collect(); + .authorize(AuthorizationFlags.AllExceptPublic).planIds(id).isActive(IsActive.Active).collect(); for (DescriptionEntity description: descriptions) { if (descriptionIds.contains(description.getId())){ @@ -1176,187 +1176,187 @@ public class DmpServiceImpl implements DmpService { } } - DmpStatus previousStatus = dmp.getStatus(); - dmp.setStatus(DmpStatus.Finalized); + PlanStatus previousStatus = dmp.getStatus(); + dmp.setStatus(PlanStatus.Finalized); dmp.setUpdatedAt(Instant.now()); dmp.setFinalizedAt(Instant.now()); this.updateVersionStatusAndSave(dmp, previousStatus, dmp.getStatus()); - dmp.setVersionStatus(DmpVersionStatus.Current); + dmp.setVersionStatus(PlanVersionStatus.Current); this.entityManager.merge(dmp); this.entityManager.flush(); - this.elasticService.persistDmp(dmp); + this.elasticService.persistPlan(dmp); - this.annotationEntityTouchedIntegrationEventHandler.handleDmp(dmp.getId()); + this.annotationEntityTouchedIntegrationEventHandler.handlePlan(dmp.getId()); this.sendNotification(dmp); } public void undoFinalize(UUID id, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException { - this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.dmpAffiliation(id)), Permission.UndoFinalizeDmp); - DmpEntity dmp = this.queryFactory.query(DmpQuery.class).authorize(AuthorizationFlags.AllExceptPublic).ids(id).isActive(IsActive.Active).firstAs(fields); + this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.dmpAffiliation(id)), Permission.UndoFinalizePlan); + PlanEntity dmp = this.queryFactory.query(PlanQuery.class).authorize(AuthorizationFlags.AllExceptPublic).ids(id).isActive(IsActive.Active).firstAs(fields); - if (dmp == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale())); + if (dmp == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Plan.class.getSimpleName()}, LocaleContextHolder.getLocale())); - if (!dmp.getStatus().equals(DmpStatus.Finalized)) throw new MyApplicationException("DMP is already drafted"); + if (!dmp.getStatus().equals(PlanStatus.Finalized)) throw new MyApplicationException("DMP is already drafted"); EntityDoiQuery entityDoiQuery = this.queryFactory.query(EntityDoiQuery.class).authorize(AuthorizationFlags.AllExceptPublic).types(EntityType.DMP).entityIds(dmp.getId()).isActive(IsActive.Active); if (entityDoiQuery.count() > 0) throw new MyApplicationException("DMP is deposited"); - dmp.setStatus(DmpStatus.Draft); + dmp.setStatus(PlanStatus.Draft); dmp.setUpdatedAt(Instant.now()); this.entityManager.merge(dmp); this.entityManager.flush(); - this.updateVersionStatusAndSave(dmp, DmpStatus.Finalized, dmp.getStatus()); + this.updateVersionStatusAndSave(dmp, PlanStatus.Finalized, dmp.getStatus()); this.entityManager.flush(); - DmpQuery dmpQuery = this.queryFactory.query(DmpQuery.class).disableTracking() - .versionStatuses(DmpVersionStatus.Previous) + PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking() + .versionStatuses(PlanVersionStatus.Previous) .excludedIds(dmp.getId()) .isActive(IsActive.Active) .groupIds(dmp.getGroupId()); - dmpQuery.setOrder(new Ordering().addDescending(Dmp._version)); - DmpEntity previousDmp = dmpQuery.count() > 0 ? dmpQuery.collect().getFirst() : null; + planQuery.setOrder(new Ordering().addDescending(Plan._version)); + PlanEntity previousDmp = planQuery.count() > 0 ? planQuery.collect().getFirst() : null; if (previousDmp != null){ - if (previousDmp.getStatus().equals(DmpStatus.Finalized)) previousDmp.setVersionStatus(DmpVersionStatus.Current); - else previousDmp.setVersionStatus(DmpVersionStatus.NotFinalized); + if (previousDmp.getStatus().equals(PlanStatus.Finalized)) previousDmp.setVersionStatus(PlanVersionStatus.Current); + else previousDmp.setVersionStatus(PlanVersionStatus.NotFinalized); this.entityManager.merge(previousDmp); } this.entityManager.flush(); - this.annotationEntityTouchedIntegrationEventHandler.handleDmp(dmp.getId()); + this.annotationEntityTouchedIntegrationEventHandler.handlePlan(dmp.getId()); this.sendNotification(dmp); } - public DmpValidationResult validate(UUID id) throws InvalidApplicationException { + public PlanValidationResult validate(UUID id) throws InvalidApplicationException { - DmpEntity dmp = this.queryFactory.query(DmpQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).ids(id).isActive(IsActive.Active).first(); + PlanEntity dmp = this.queryFactory.query(PlanQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).ids(id).isActive(IsActive.Active).first(); - if (dmp == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale())); + if (dmp == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Plan.class.getSimpleName()}, LocaleContextHolder.getLocale())); - DmpValidationResult dmpValidationResult = new DmpValidationResult(dmp.getId(), DmpValidationOutput.Invalid); + PlanValidationResult planValidationResult = new PlanValidationResult(dmp.getId(), PlanValidationOutput.Invalid); - DmpPersist.DmpPersistValidator validator = this.validatorFactory.validator(DmpPersist.DmpPersistValidator.class); + PlanPersist.PlanPersistValidator validator = this.validatorFactory.validator(PlanPersist.PlanPersistValidator.class); validator.validate(this.buildDmpPersist(dmp)); - if (validator.result().isValid()) dmpValidationResult.setResult(DmpValidationOutput.Valid); - else dmpValidationResult.setErrors(validator.result().getErrors().stream().map(ValidationFailure::getErrorMessage).collect(Collectors.toList())); + if (validator.result().isValid()) planValidationResult.setResult(PlanValidationOutput.Valid); + else planValidationResult.setErrors(validator.result().getErrors().stream().map(ValidationFailure::getErrorMessage).collect(Collectors.toList())); - return dmpValidationResult; + return planValidationResult; } // build persist - private @NotNull DmpPersist buildDmpPersist(DmpEntity data) throws InvalidApplicationException { - DmpPersist persist = new DmpPersist(); + private @NotNull PlanPersist buildDmpPersist(PlanEntity data) throws InvalidApplicationException { + PlanPersist persist = new PlanPersist(); if (data == null) return persist; - DmpBlueprintEntity dmpBlueprintEntity = this.entityManager.find(DmpBlueprintEntity.class, data.getBlueprintId(), true); - if (dmpBlueprintEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{data.getBlueprintId(), DmpBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale())); + PlanBlueprintEntity planBlueprintEntity = this.entityManager.find(PlanBlueprintEntity.class, data.getBlueprintId(), true); + if (planBlueprintEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{data.getBlueprintId(), PlanBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale())); persist.setId(data.getId()); persist.setHash(data.getId().toString()); persist.setLabel(data.getLabel()); - persist.setStatus(DmpStatus.Finalized); + persist.setStatus(PlanStatus.Finalized); persist.setDescription(data.getDescription()); persist.setBlueprint(data.getBlueprintId()); persist.setAccessType(data.getAccessType()); persist.setLanguage(data.getLanguage()); - List dmpUserEntities = this.queryFactory.query(DmpUserQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).dmpIds(data.getId()).isActives(IsActive.Active).collect(); + List dmpUserEntities = this.queryFactory.query(PlanUserQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).planIds(data.getId()).isActives(IsActive.Active).collect(); if (!this.conventionService.isListNullOrEmpty(dmpUserEntities)){ persist.setUsers(new ArrayList<>()); - for (DmpUserEntity user: dmpUserEntities) { - persist.getUsers().add(this.buildDmpUserPersist(user)); + for (PlanUserEntity user: dmpUserEntities) { + persist.getUsers().add(this.buildPlanUserPersist(user)); } } - List dmpReferenceEntities = this.queryFactory.query(DmpReferenceQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).dmpIds(data.getId()).isActives(IsActive.Active).collect(); + List planReferenceEntities = this.queryFactory.query(PlanReferenceQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).planIds(data.getId()).isActives(IsActive.Active).collect(); - org.opencdmp.commons.types.dmpblueprint.DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(org.opencdmp.commons.types.dmpblueprint.DefinitionEntity.class, dmpBlueprintEntity.getDefinition()); + org.opencdmp.commons.types.planblueprint.DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(org.opencdmp.commons.types.planblueprint.DefinitionEntity.class, planBlueprintEntity.getDefinition()); - List dmpDescriptionTemplateEntities = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).dmpIds(data.getId()).isActive(IsActive.Active).collect(); + List dmpDescriptionTemplateEntities = this.queryFactory.query(PlanDescriptionTemplateQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).planIds(data.getId()).isActive(IsActive.Active).collect(); if (!this.conventionService.isListNullOrEmpty(dmpDescriptionTemplateEntities)){ persist.setDescriptionTemplates(new ArrayList<>()); - for (DmpDescriptionTemplateEntity descriptionTemplateEntity: dmpDescriptionTemplateEntities) { - persist.getDescriptionTemplates().add(this.buildDmpDescriptionTemplatePersists(descriptionTemplateEntity)); + for (PlanDescriptionTemplateEntity descriptionTemplateEntity: dmpDescriptionTemplateEntities) { + persist.getDescriptionTemplates().add(this.buildPlanDescriptionTemplatePersists(descriptionTemplateEntity)); } } - persist.setProperties(this.buildDmpPropertyDefinitionPersist( this.jsonHandlingService.fromJsonSafe(DmpPropertiesEntity.class, data.getProperties()), dmpReferenceEntities, definition.getSections())); + persist.setProperties(this.buildPlanPropertyDefinitionPersist( this.jsonHandlingService.fromJsonSafe(PlanPropertiesEntity.class, data.getProperties()), planReferenceEntities, definition.getSections())); return persist; } - private @NotNull DmpPropertiesPersist buildDmpPropertyDefinitionPersist(DmpPropertiesEntity data, List dmpReferenceEntities, List sectionEntities){ - DmpPropertiesPersist persist = new DmpPropertiesPersist(); + private @NotNull PlanPropertiesPersist buildPlanPropertyDefinitionPersist(PlanPropertiesEntity data, List planReferenceEntities, List sectionEntities){ + PlanPropertiesPersist persist = new PlanPropertiesPersist(); if (data == null) return persist; if (!this.conventionService.isListNullOrEmpty(data.getContacts())){ persist.setContacts(new ArrayList<>()); - for (DmpContactEntity contact: data.getContacts()) { - persist.getContacts().add(this.buildDmpContactPersist(contact)); + for (PlanContactEntity contact: data.getContacts()) { + persist.getContacts().add(this.buildPlanContactPersist(contact)); } } List referencesFromAllFields = new ArrayList<>(); - if (!this.conventionService.isListNullOrEmpty(dmpReferenceEntities)) { - referencesFromAllFields = this.queryFactory.query(ReferenceQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).ids(dmpReferenceEntities.stream().map(DmpReferenceEntity::getReferenceId).collect(Collectors.toList())).isActive(IsActive.Active).collect(); + if (!this.conventionService.isListNullOrEmpty(planReferenceEntities)) { + referencesFromAllFields = this.queryFactory.query(ReferenceQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).ids(planReferenceEntities.stream().map(PlanReferenceEntity::getReferenceId).collect(Collectors.toList())).isActive(IsActive.Active).collect(); } - Map dmpBlueprintValues = new HashMap<>(); + Map planBlueprintValues = new HashMap<>(); if (!this.conventionService.isListNullOrEmpty(sectionEntities)){ for (SectionEntity sectionEntity: sectionEntities) { if (!this.conventionService.isListNullOrEmpty(sectionEntity.getFields())){ - for (org.opencdmp.commons.types.dmpblueprint.FieldEntity fieldEntity: sectionEntity.getFields()) { + for (org.opencdmp.commons.types.planblueprint.FieldEntity fieldEntity: sectionEntity.getFields()) { - if (!this.conventionService.isListNullOrEmpty(dmpReferenceEntities) && fieldEntity.getCategory().equals(DmpBlueprintFieldCategory.ReferenceType)) { + if (!this.conventionService.isListNullOrEmpty(planReferenceEntities) && fieldEntity.getCategory().equals(PlanBlueprintFieldCategory.ReferenceType)) { List referencePersists = new ArrayList<>(); - for (DmpReferenceEntity dmpReferenceEntity : dmpReferenceEntities) { - DmpReferenceData referenceData = this.jsonHandlingService.fromJsonSafe(DmpReferenceData.class, dmpReferenceEntity.getData()); + for (PlanReferenceEntity planReferenceEntity : planReferenceEntities) { + PlanReferenceData referenceData = this.jsonHandlingService.fromJsonSafe(PlanReferenceData.class, planReferenceEntity.getData()); - ReferenceEntity reference = referencesFromAllFields.stream().filter(x -> x.getId().equals(dmpReferenceEntity.getReferenceId())).toList().getFirst(); + ReferenceEntity reference = referencesFromAllFields.stream().filter(x -> x.getId().equals(planReferenceEntity.getReferenceId())).toList().getFirst(); if (referenceData.getBlueprintFieldId().equals(fieldEntity.getId()) && reference != null) { referencePersists.add(this.buildReferencePersist(reference)); } // put references - dmpBlueprintValues.put(fieldEntity.getId(), this.buildDmpBlueprintValuePersist(fieldEntity.getId(), null, null, null, referencePersists, ((ReferenceTypeFieldEntity)fieldEntity).getMultipleSelect())); + planBlueprintValues.put(fieldEntity.getId(), this.buildPlanBlueprintValuePersist(fieldEntity.getId(), null, null, null, referencePersists, ((ReferenceTypeFieldEntity)fieldEntity).getMultipleSelect())); } - } else if (!this.conventionService.isListNullOrEmpty(data.getDmpBlueprintValues())) { - for (DmpBlueprintValueEntity value : data.getDmpBlueprintValues()) { + } else if (!this.conventionService.isListNullOrEmpty(data.getPlanBlueprintValues())) { + for (PlanBlueprintValueEntity value : data.getPlanBlueprintValues()) { if (value.getFieldId().equals(fieldEntity.getId())) { if (value.getDateValue() != null) { - dmpBlueprintValues.put(fieldEntity.getId(), this.buildDmpBlueprintValuePersist(fieldEntity.getId(), null, value.getDateValue(), null, null,null)); + planBlueprintValues.put(fieldEntity.getId(), this.buildPlanBlueprintValuePersist(fieldEntity.getId(), null, value.getDateValue(), null, null,null)); } else if (value.getNumberValue() != null) { - dmpBlueprintValues.put(fieldEntity.getId(), this.buildDmpBlueprintValuePersist(fieldEntity.getId(), null, null, value.getNumberValue(), null,null)); + planBlueprintValues.put(fieldEntity.getId(), this.buildPlanBlueprintValuePersist(fieldEntity.getId(), null, null, value.getNumberValue(), null,null)); } else if (!this.conventionService.isNullOrEmpty(value.getValue())) { - dmpBlueprintValues.put(fieldEntity.getId(), this.buildDmpBlueprintValuePersist(fieldEntity.getId(), value.getValue(), null,null,null,null)); + planBlueprintValues.put(fieldEntity.getId(), this.buildPlanBlueprintValuePersist(fieldEntity.getId(), value.getValue(), null,null,null,null)); } else { - dmpBlueprintValues.put(fieldEntity.getId(), null); + planBlueprintValues.put(fieldEntity.getId(), null); } } } } // fill fields with no values - if (dmpBlueprintValues.get(fieldEntity.getId()) == null){ - dmpBlueprintValues.put(fieldEntity.getId(), this.buildDmpBlueprintValuePersist(fieldEntity.getId(), null, null, null,null,null)); + if (planBlueprintValues.get(fieldEntity.getId()) == null){ + planBlueprintValues.put(fieldEntity.getId(), this.buildPlanBlueprintValuePersist(fieldEntity.getId(), null, null, null,null,null)); } } } } - persist.setDmpBlueprintValues(dmpBlueprintValues); + persist.setPlanBlueprintValues(planBlueprintValues); } return persist; } - private @NotNull DmpContactPersist buildDmpContactPersist(DmpContactEntity data){ - DmpContactPersist persist = new DmpContactPersist(); + private @NotNull PlanContactPersist buildPlanContactPersist(PlanContactEntity data){ + PlanContactPersist persist = new PlanContactPersist(); if (data == null) return persist; persist.setEmail(data.getEmail()); @@ -1365,8 +1365,8 @@ public class DmpServiceImpl implements DmpService { return persist; } - private @NotNull DmpUserPersist buildDmpUserPersist(DmpUserEntity data){ - DmpUserPersist persist = new DmpUserPersist(); + private @NotNull PlanUserPersist buildPlanUserPersist(PlanUserEntity data){ + PlanUserPersist persist = new PlanUserPersist(); if (data == null) return persist; persist.setUser(data.getUserId()); @@ -1376,8 +1376,8 @@ public class DmpServiceImpl implements DmpService { return persist; } - private @NotNull DmpDescriptionTemplatePersist buildDmpDescriptionTemplatePersists(DmpDescriptionTemplateEntity data){ - DmpDescriptionTemplatePersist persist = new DmpDescriptionTemplatePersist(); + private @NotNull PlanDescriptionTemplatePersist buildPlanDescriptionTemplatePersists(PlanDescriptionTemplateEntity data){ + PlanDescriptionTemplatePersist persist = new PlanDescriptionTemplatePersist(); if (data == null) return persist; persist.setSectionId(data.getSectionId()); @@ -1402,8 +1402,8 @@ public class DmpServiceImpl implements DmpService { return persist; } - private @NotNull DmpBlueprintValuePersist buildDmpBlueprintValuePersist(UUID fieldId, String fieldValue, Instant dateValue, Double numberValue, List referencePersists, Boolean multipleSelect){ - DmpBlueprintValuePersist persist = new DmpBlueprintValuePersist(); + private @NotNull PlanBlueprintValuePersist buildPlanBlueprintValuePersist(UUID fieldId, String fieldValue, Instant dateValue, Double numberValue, List referencePersists, Boolean multipleSelect){ + PlanBlueprintValuePersist persist = new PlanBlueprintValuePersist(); persist.setFieldId(fieldId); @@ -1423,24 +1423,24 @@ public class DmpServiceImpl implements DmpService { } // invites - public void inviteUserOrAssignUsers(UUID id, List users) throws InvalidApplicationException, JAXBException, IOException { + public void inviteUserOrAssignUsers(UUID id, List users) throws InvalidApplicationException, JAXBException, IOException { this.inviteUserOrAssignUsers(id, users, true); - this.annotationEntityTouchedIntegrationEventHandler.handleDmp(id); + this.annotationEntityTouchedIntegrationEventHandler.handlePlan(id); } - private List inviteUserOrAssignUsers(UUID id, List users, boolean persistUsers) throws InvalidApplicationException, JAXBException, IOException { - this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.dmpAffiliation(id)), Permission.InviteDmpUsers); + private List inviteUserOrAssignUsers(UUID id, List users, boolean persistUsers) throws InvalidApplicationException, JAXBException, IOException { + this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.dmpAffiliation(id)), Permission.InvitePlanUsers); - DmpEntity dmp = this.queryFactory.query(DmpQuery.class).disableTracking().ids(id).first(); + PlanEntity dmp = this.queryFactory.query(PlanQuery.class).disableTracking().ids(id).first(); if (dmp == null){ throw new InvalidApplicationException("Dmp does not exist!"); } - List existingUsers = this.queryFactory.query(DmpUserQuery.class).disableTracking() - .dmpIds(dmp.getId()) + List existingUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking() + .planIds(dmp.getId()) .isActives(IsActive.Active) .collect(); @@ -1448,8 +1448,8 @@ public class DmpServiceImpl implements DmpService { throw new InvalidApplicationException("Dmp does not have users!"); } - List usersToAssign = new ArrayList<>(); - for (DmpUserPersist user :users) { + List usersToAssign = new ArrayList<>(); + for (PlanUserPersist user :users) { UUID userId = null; if (user.getUser() != null){ userId = user.getUser(); @@ -1462,11 +1462,11 @@ public class DmpServiceImpl implements DmpService { if (userId != null){ user.setUser(userId); usersToAssign.add(user); - if (this.userScope.getUserId() != userId && !existingUsers.stream().map(DmpUserEntity::getUserId).toList().contains(userId)){ - this.sendDmpInvitationExistingUser(user.getUser(), dmp, user.getRole()); + if (this.userScope.getUserId() != userId && !existingUsers.stream().map(PlanUserEntity::getUserId).toList().contains(userId)){ + this.sendPlanInvitationExistingUser(user.getUser(), dmp, user.getRole()); } }else if (user.getEmail() != null) { - this.sendDmpInvitationExternalUser(user.getEmail(),dmp, user.getRole()); + this.sendPlanInvitationExternalUser(user.getEmail(),dmp, user.getRole()); } } @@ -1474,14 +1474,14 @@ public class DmpServiceImpl implements DmpService { return usersToAssign; } - private void sendDmpInvitationExistingUser(UUID userId, DmpEntity dmp, DmpUserRole role) throws InvalidApplicationException { + private void sendPlanInvitationExistingUser(UUID userId, PlanEntity dmp, PlanUserRole role) throws InvalidApplicationException { UserEntity recipient = this.queryFactory.query(UserQuery.class).disableTracking().ids(userId).isActive(IsActive.Active).first(); if (recipient == null) throw new MyValidationException(this.errors.getDmpInactiveUser().getCode(), this.errors.getDmpInactiveUser().getMessage()); String email = this.queryFactory.query(UserContactInfoQuery.class).disableTracking().userIds(recipient.getId()).first().getValue(); - this.createDmpInvitationExistingUserEvent(recipient, dmp, role, email); + this.createPlanInvitationExistingUserEvent(recipient, dmp, role, email); } - private void createDmpInvitationExistingUserEvent(UserEntity recipient, DmpEntity dmp, DmpUserRole role, String email) throws InvalidApplicationException { + private void createPlanInvitationExistingUserEvent(UserEntity recipient, PlanEntity dmp, PlanUserRole role, String email) throws InvalidApplicationException { if (email == null) throw new MyValidationException(this.errors.getDmpMissingUserContactInfo().getCode(), this.errors.getDmpMissingUserContactInfo().getMessage()); @@ -1504,7 +1504,7 @@ public class DmpServiceImpl implements DmpService { this.eventHandler.handle(event); } - private void sendDmpInvitationExternalUser(String email, DmpEntity dmp, DmpUserRole role) throws JAXBException, InvalidApplicationException { + private void sendPlanInvitationExternalUser(String email, PlanEntity dmp, PlanUserRole role) throws JAXBException, InvalidApplicationException { String token = this.createActionConfirmation(email, dmp, role); NotifyIntegrationEvent event = new NotifyIntegrationEvent(); @@ -1529,12 +1529,12 @@ public class DmpServiceImpl implements DmpService { this.eventHandler.handle(event); } - private String createActionConfirmation(String email, DmpEntity dmp, DmpUserRole role) throws JAXBException, InvalidApplicationException { + private String createActionConfirmation(String email, PlanEntity dmp, PlanUserRole role) throws JAXBException, InvalidApplicationException { ActionConfirmationPersist persist = new ActionConfirmationPersist(); - persist.setType(ActionConfirmationType.DmpInvitation); + persist.setType(ActionConfirmationType.PlanInvitation); persist.setStatus(ActionConfirmationStatus.Requested); persist.setToken(UUID.randomUUID().toString()); - persist.setDmpInvitation(new DmpInvitationPersist(email, dmp.getId(), role)); + persist.setPlanInvitation(new PlanInvitationPersist(email, dmp.getId(), role)); persist.setExpiresAt(Instant.now().plusSeconds(this.notificationProperties.getEmailExpirationTimeSeconds())); this.validatorFactory.validator(ActionConfirmationPersist.ActionConfirmationPersistValidator.class).validateForce(persist); this.actionConfirmationService.persist(persist, null); @@ -1542,8 +1542,8 @@ public class DmpServiceImpl implements DmpService { return persist.getToken(); } - public void dmpInvitationAccept(String token) throws InvalidApplicationException { - ActionConfirmationEntity action = this.queryFactory.query(ActionConfirmationQuery.class).tokens(token).types(ActionConfirmationType.DmpInvitation).isActive(IsActive.Active).first(); + public void planInvitationAccept(String token) throws InvalidApplicationException { + ActionConfirmationEntity action = this.queryFactory.query(ActionConfirmationQuery.class).tokens(token).types(ActionConfirmationType.PlanInvitation).isActive(IsActive.Active).first(); if (action == null){ throw new MyApplicationException("Token does not exist!"); @@ -1555,35 +1555,35 @@ public class DmpServiceImpl implements DmpService { throw new MyApplicationException("Token has expired!"); } - DmpInvitationEntity dmpInvitation = this.xmlHandlingService.fromXmlSafe(DmpInvitationEntity.class, action.getData()); + PlanInvitationEntity planInvitation = this.xmlHandlingService.fromXmlSafe(PlanInvitationEntity.class, action.getData()); - DmpUserEntity data = new DmpUserEntity(); + PlanUserEntity data = new PlanUserEntity(); data.setId(UUID.randomUUID()); data.setIsActive(IsActive.Active); data.setCreatedAt(Instant.now()); data.setUpdatedAt(Instant.now()); - data.setRole(dmpInvitation.getRole()); + data.setRole(planInvitation.getRole()); data.setUserId(this.userScope.getUserIdSafe()); - data.setDmpId(dmpInvitation.getDmpId()); + data.setPlanId(planInvitation.getPlanId()); this.entityManager.persist(data); action.setStatus(ActionConfirmationStatus.Accepted); this.entityManager.merge(action); - this.annotationEntityTouchedIntegrationEventHandler.handleDmp(dmpInvitation.getDmpId()); + this.annotationEntityTouchedIntegrationEventHandler.handlePlan(planInvitation.getPlanId()); } //region Export @Override - public DmpImportExport exportXmlEntity(UUID id, boolean ignoreAuthorize) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException { + public PlanImportExport exportXmlEntity(UUID id, boolean ignoreAuthorize) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException { logger.debug(new MapLogEntry("export xml").And("id", id)); - if (!ignoreAuthorize) this.authorizationService.authorizeForce(Permission.ExportDmp); - DmpEntity data = this.queryFactory.query(DmpQuery.class).disableTracking().ids(id).authorize(AuthorizationFlags.All).isActive(IsActive.Active).first(); - if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale())); + if (!ignoreAuthorize) this.authorizationService.authorizeForce(Permission.ExportPlan); + PlanEntity data = this.queryFactory.query(PlanQuery.class).disableTracking().ids(id).authorize(AuthorizationFlags.All).isActive(IsActive.Active).first(); + if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Plan.class.getSimpleName()}, LocaleContextHolder.getLocale())); - DmpPropertiesEntity definition = this.jsonHandlingService.fromJson(DmpPropertiesEntity.class, data.getProperties()); + PlanPropertiesEntity definition = this.jsonHandlingService.fromJson(PlanPropertiesEntity.class, data.getProperties()); return this.definitionXmlToExport(data, definition); } @@ -1591,19 +1591,19 @@ public class DmpServiceImpl implements DmpService { public ResponseEntity exportXml(UUID id) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException { logger.debug(new MapLogEntry("export xml").And("id", id)); - this.authorizationService.authorizeForce(Permission.ExportDmp); - DmpEntity data = this.queryFactory.query(DmpQuery.class).disableTracking().ids(id).authorize(AuthorizationFlags.All).isActive(IsActive.Active).first(); - if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale())); + this.authorizationService.authorizeForce(Permission.ExportPlan); + PlanEntity data = this.queryFactory.query(PlanQuery.class).disableTracking().ids(id).authorize(AuthorizationFlags.All).isActive(IsActive.Active).first(); + if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Plan.class.getSimpleName()}, LocaleContextHolder.getLocale())); String xml = this.xmlHandlingService.toXml(this.exportXmlEntity(data.getId(), false)); return this.responseUtilsService.buildResponseFileFromText(xml, data.getLabel() + ".xml"); } - private DmpImportExport definitionXmlToExport(DmpEntity data, DmpPropertiesEntity propertiesEntity) throws InvalidApplicationException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException { - DmpBlueprintEntity blueprintEntity = this.queryFactory.query(DmpBlueprintQuery.class).disableTracking().ids(data.getBlueprintId()).authorize(AuthorizationFlags.All).first(); - if (blueprintEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{data.getBlueprintId(), DmpBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale())); + private PlanImportExport definitionXmlToExport(PlanEntity data, PlanPropertiesEntity propertiesEntity) throws InvalidApplicationException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException { + PlanBlueprintEntity blueprintEntity = this.queryFactory.query(PlanBlueprintQuery.class).disableTracking().ids(data.getBlueprintId()).authorize(AuthorizationFlags.All).first(); + if (blueprintEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{data.getBlueprintId(), PlanBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale())); - DmpImportExport xml = new DmpImportExport(); + PlanImportExport xml = new PlanImportExport(); xml.setId(data.getId()); xml.setDescription(data.getDescription()); xml.setTitle(data.getLabel()); @@ -1612,19 +1612,19 @@ public class DmpServiceImpl implements DmpService { xml.setFinalizedAt(data.getFinalizedAt()); xml.setPublicAfter(data.getPublicAfter()); xml.setVersion(data.getVersion()); - xml.setContacts(this.dmpContactsToExport(propertiesEntity)); - xml.setUsers(this.dmpUsersToExport(data)); - xml.setBlueprint(this.dmpBlueprintService.getExportXmlEntity(blueprintEntity.getId(), true)); - xml.setDescriptionTemplates(this.dmpDescriptionTemplatesToExport(data)); - xml.setBlueprintValues(this.dmpBlueprintValuesToExport(propertiesEntity, blueprintEntity)); - xml.setReferences(this.dmpReferencesToExport(data)); + xml.setContacts(this.planContactsToExport(propertiesEntity)); + xml.setUsers(this.planUsersToExport(data)); + xml.setBlueprint(this.planBlueprintService.getExportXmlEntity(blueprintEntity.getId(), true)); + xml.setDescriptionTemplates(this.planDescriptionTemplatesToExport(data)); + xml.setBlueprintValues(this.planBlueprintValuesToExport(propertiesEntity, blueprintEntity)); + xml.setReferences(this.planReferencesToExport(data)); xml.setDescriptions(this.descriptionsToExport(data)); return xml; } - private List descriptionsToExport(DmpEntity data) throws JAXBException, InvalidApplicationException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException { - List descriptions = this.queryFactory.query(DescriptionQuery.class).disableTracking().dmpIds(data.getId()).authorize(AuthorizationFlags.All).dmpIds(data.getId()).isActive(IsActive.Active).collect(); + private List descriptionsToExport(PlanEntity data) throws JAXBException, InvalidApplicationException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException { + List descriptions = this.queryFactory.query(DescriptionQuery.class).disableTracking().planIds(data.getId()).authorize(AuthorizationFlags.All).planIds(data.getId()).isActive(IsActive.Active).collect(); if (!this.conventionService.isListNullOrEmpty(descriptions)) { List descriptionImportExports = new LinkedList<>(); for (DescriptionEntity description : descriptions) { @@ -1635,26 +1635,26 @@ public class DmpServiceImpl implements DmpService { return null; } - private List dmpReferencesToExport(DmpEntity data){ - List dmpReferences = this.queryFactory.query(DmpReferenceQuery.class).disableTracking().dmpIds(data.getId()).authorize(AuthorizationFlags.All).isActives(IsActive.Active).collect(); - if (!this.conventionService.isListNullOrEmpty(dmpReferences)) { - List references = this.queryFactory.query(ReferenceQuery.class).disableTracking().ids(dmpReferences.stream().map(DmpReferenceEntity::getReferenceId).distinct().toList()).authorize(AuthorizationFlags.All).isActive(IsActive.Active).collect(); + private List planReferencesToExport(PlanEntity data){ + List planReferences = this.queryFactory.query(PlanReferenceQuery.class).disableTracking().planIds(data.getId()).authorize(AuthorizationFlags.All).isActives(IsActive.Active).collect(); + if (!this.conventionService.isListNullOrEmpty(planReferences)) { + List references = this.queryFactory.query(ReferenceQuery.class).disableTracking().ids(planReferences.stream().map(PlanReferenceEntity::getReferenceId).distinct().toList()).authorize(AuthorizationFlags.All).isActive(IsActive.Active).collect(); Map referenceEntityMap = references == null ? new HashMap<>() : references.stream().collect(Collectors.toMap(ReferenceEntity::getId, x-> x)); List referenceTypes = references == null ? new ArrayList<>() : this.queryFactory.query(ReferenceTypeQuery.class).disableTracking().ids(references.stream().map(ReferenceEntity::getTypeId).distinct().toList()).authorize(AuthorizationFlags.AllExceptPublic).isActive(IsActive.Active).collect(); Map referenceTypeEntityMap = referenceTypes == null ? new HashMap<>() : referenceTypes.stream().collect(Collectors.toMap(ReferenceTypeEntity::getId, x-> x)); - List dmpReferenceImportExports = new LinkedList<>(); - for (DmpReferenceEntity descriptionTemplateEntity : dmpReferences) { - dmpReferenceImportExports.add(this.dmpReferenceToExport(descriptionTemplateEntity, referenceEntityMap, referenceTypeEntityMap)); + List planReferenceImportExports = new LinkedList<>(); + for (PlanReferenceEntity descriptionTemplateEntity : planReferences) { + planReferenceImportExports.add(this.planReferenceToExport(descriptionTemplateEntity, referenceEntityMap, referenceTypeEntityMap)); } - return dmpReferenceImportExports; + return planReferenceImportExports; } return null; } - private DmpReferenceImportExport dmpReferenceToExport(DmpReferenceEntity entity, Map referenceEntityMap, Map referenceTypeEntityMap) { - DmpReferenceImportExport xml = new DmpReferenceImportExport(); + private PlanReferenceImportExport planReferenceToExport(PlanReferenceEntity entity, Map referenceEntityMap, Map referenceTypeEntityMap) { + PlanReferenceImportExport xml = new PlanReferenceImportExport(); if (entity == null) return xml; - DmpReferenceDataEntity referenceData = this.jsonHandlingService.fromJsonSafe(DmpReferenceDataEntity.class, entity.getData()); + PlanReferenceDataEntity referenceData = this.jsonHandlingService.fromJsonSafe(PlanReferenceDataEntity.class, entity.getData()); if (referenceData != null) xml.setFieldId(referenceData.getBlueprintFieldId()); ReferenceEntity reference = referenceEntityMap.getOrDefault(entity.getReferenceId(), null); @@ -1665,14 +1665,14 @@ public class DmpServiceImpl implements DmpService { xml.setSourceType(reference.getSourceType()); xml.setReference(reference.getReference()); ReferenceTypeEntity referenceType = referenceTypeEntityMap.getOrDefault(reference.getTypeId(), null); - if (referenceType != null) xml.setType(this.dmpReferenceTypeToExport(referenceType)); + if (referenceType != null) xml.setType(this.planReferenceTypeToExport(referenceType)); } return xml; } - private DmpReferenceTypeImportExport dmpReferenceTypeToExport(ReferenceTypeEntity entity) { - DmpReferenceTypeImportExport xml = new DmpReferenceTypeImportExport(); + private PlanReferenceTypeImportExport planReferenceTypeToExport(ReferenceTypeEntity entity) { + PlanReferenceTypeImportExport xml = new PlanReferenceTypeImportExport(); if (entity == null) return xml; xml.setId(entity.getId()); xml.setCode(entity.getCode()); @@ -1681,30 +1681,30 @@ public class DmpServiceImpl implements DmpService { return xml; } - private List dmpBlueprintValuesToExport(DmpPropertiesEntity propertiesEntity, DmpBlueprintEntity blueprintEntity){ - if (propertiesEntity != null && !this.conventionService.isListNullOrEmpty(propertiesEntity.getDmpBlueprintValues())) { - List dmpBlueprintValueImportExports = new LinkedList<>(); - org.opencdmp.commons.types.dmpblueprint.DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(org.opencdmp.commons.types.dmpblueprint.DefinitionEntity.class, blueprintEntity.getDefinition()); - for (DmpBlueprintValueEntity dmpBlueprintValueEntity : propertiesEntity.getDmpBlueprintValues()) { - dmpBlueprintValueImportExports.add(this.dmpBlueprintValueToExport(dmpBlueprintValueEntity, definition)); + private List planBlueprintValuesToExport(PlanPropertiesEntity propertiesEntity, PlanBlueprintEntity blueprintEntity){ + if (propertiesEntity != null && !this.conventionService.isListNullOrEmpty(propertiesEntity.getPlanBlueprintValues())) { + List planBlueprintValueImportExports = new LinkedList<>(); + org.opencdmp.commons.types.planblueprint.DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(org.opencdmp.commons.types.planblueprint.DefinitionEntity.class, blueprintEntity.getDefinition()); + for (PlanBlueprintValueEntity planBlueprintValueEntity : propertiesEntity.getPlanBlueprintValues()) { + planBlueprintValueImportExports.add(this.planBlueprintValueToExport(planBlueprintValueEntity, definition)); } - return dmpBlueprintValueImportExports; + return planBlueprintValueImportExports; } return null; } - private DmpBlueprintValueImportExport dmpBlueprintValueToExport(DmpBlueprintValueEntity entity, org.opencdmp.commons.types.dmpblueprint.DefinitionEntity definition) { - DmpBlueprintValueImportExport xml = new DmpBlueprintValueImportExport(); + private PlanBlueprintValueImportExport planBlueprintValueToExport(PlanBlueprintValueEntity entity, org.opencdmp.commons.types.planblueprint.DefinitionEntity definition) { + PlanBlueprintValueImportExport xml = new PlanBlueprintValueImportExport(); if (entity == null) return xml; - org.opencdmp.commons.types.dmpblueprint.FieldEntity fieldEntity = definition.getFieldById(entity.getFieldId()).stream().findFirst().orElse(null); + org.opencdmp.commons.types.planblueprint.FieldEntity fieldEntity = definition.getFieldById(entity.getFieldId()).stream().findFirst().orElse(null); if (fieldEntity == null) return xml; - if (fieldEntity.getCategory().equals(DmpBlueprintFieldCategory.Extra)) { + if (fieldEntity.getCategory().equals(PlanBlueprintFieldCategory.Extra)) { ExtraFieldEntity extraFieldEntity = (ExtraFieldEntity) fieldEntity; - if (DmpBlueprintExtraFieldDataType.isDateType(extraFieldEntity.getType())){ + if (PlanBlueprintExtraFieldDataType.isDateType(extraFieldEntity.getType())){ xml.setDateValue(entity.getDateValue()); - } else if (DmpBlueprintExtraFieldDataType.isNumberType(extraFieldEntity.getType())){ + } else if (PlanBlueprintExtraFieldDataType.isNumberType(extraFieldEntity.getType())){ xml.setNumberValue(entity.getNumberValue()); } else { xml.setValue(entity.getValue()); @@ -1716,20 +1716,20 @@ public class DmpServiceImpl implements DmpService { } - private List dmpDescriptionTemplatesToExport(DmpEntity data){ - List dmpDescriptionTemplateEntities = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking().authorize(AuthorizationFlags.All).dmpIds(data.getId()).isActive(IsActive.Active).collect(); + private List planDescriptionTemplatesToExport(PlanEntity data){ + List dmpDescriptionTemplateEntities = this.queryFactory.query(PlanDescriptionTemplateQuery.class).disableTracking().authorize(AuthorizationFlags.All).planIds(data.getId()).isActive(IsActive.Active).collect(); if (!this.conventionService.isListNullOrEmpty(dmpDescriptionTemplateEntities)) { - List dmpDescriptionTemplateImportExports = new LinkedList<>(); - for (DmpDescriptionTemplateEntity descriptionTemplateEntity : dmpDescriptionTemplateEntities) { - dmpDescriptionTemplateImportExports.add(this.dmpDescriptionTemplateToExport(descriptionTemplateEntity)); + List planDescriptionTemplateImportExports = new LinkedList<>(); + for (PlanDescriptionTemplateEntity descriptionTemplateEntity : dmpDescriptionTemplateEntities) { + planDescriptionTemplateImportExports.add(this.planDescriptionTemplateToExport(descriptionTemplateEntity)); } - return dmpDescriptionTemplateImportExports; + return planDescriptionTemplateImportExports; } return null; } - private DmpDescriptionTemplateImportExport dmpDescriptionTemplateToExport(DmpDescriptionTemplateEntity entity) { - DmpDescriptionTemplateImportExport xml = new DmpDescriptionTemplateImportExport(); + private PlanDescriptionTemplateImportExport planDescriptionTemplateToExport(PlanDescriptionTemplateEntity entity) { + PlanDescriptionTemplateImportExport xml = new PlanDescriptionTemplateImportExport(); if (entity == null) return xml; xml.setDescriptionTemplateGroupId(entity.getDescriptionTemplateGroupId()); @@ -1738,22 +1738,22 @@ public class DmpServiceImpl implements DmpService { return xml; } - private ListdmpUsersToExport(DmpEntity data){ - List dmpUsers = this.queryFactory.query(DmpUserQuery.class).disableTracking().dmpIds(data.getId()).authorize(AuthorizationFlags.All).isActives(IsActive.Active).collect(); + private List planUsersToExport(PlanEntity data){ + List dmpUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking().planIds(data.getId()).authorize(AuthorizationFlags.All).isActives(IsActive.Active).collect(); if (!this.conventionService.isListNullOrEmpty(dmpUsers)) { - List users = this.queryFactory.query(UserQuery.class).disableTracking().ids(dmpUsers.stream().map(DmpUserEntity::getUserId).distinct().toList()).authorize(AuthorizationFlags.All).isActive(IsActive.Active).collect(); + List users = this.queryFactory.query(UserQuery.class).disableTracking().ids(dmpUsers.stream().map(PlanUserEntity::getUserId).distinct().toList()).authorize(AuthorizationFlags.All).isActive(IsActive.Active).collect(); Map usersMap = users == null ? new HashMap<>() : users.stream().collect(Collectors.toMap(UserEntity::getId, x -> x)); - List dmpUserImportExports = new LinkedList<>(); - for (DmpUserEntity dmpUserEntity : dmpUsers) { - dmpUserImportExports.add(this.dmpUserToExport(dmpUserEntity, usersMap)); + List planUserImportExports = new LinkedList<>(); + for (PlanUserEntity planUserEntity : dmpUsers) { + planUserImportExports.add(this.planUserToExport(planUserEntity, usersMap)); } - return dmpUserImportExports; + return planUserImportExports; } return null; } - private DmpUserImportExport dmpUserToExport(DmpUserEntity entity, Map usersMap) { - DmpUserImportExport xml = new DmpUserImportExport(); + private PlanUserImportExport planUserToExport(PlanUserEntity entity, Map usersMap) { + PlanUserImportExport xml = new PlanUserImportExport(); if (entity == null) return xml; xml.setId(entity.getUserId()); @@ -1767,19 +1767,19 @@ public class DmpServiceImpl implements DmpService { return xml; } - private List dmpContactsToExport(DmpPropertiesEntity propertiesEntity){ + private List planContactsToExport(PlanPropertiesEntity propertiesEntity){ if (propertiesEntity != null && !this.conventionService.isListNullOrEmpty(propertiesEntity.getContacts())) { - List dmpContactImportExports = new LinkedList<>(); - for (DmpContactEntity contactEntity : propertiesEntity.getContacts()) { - dmpContactImportExports.add(this.dmpContactToExport(contactEntity)); + List planContactImportExports = new LinkedList<>(); + for (PlanContactEntity contactEntity : propertiesEntity.getContacts()) { + planContactImportExports.add(this.planContactToExport(contactEntity)); } - return dmpContactImportExports; + return planContactImportExports; } return null; } - private DmpContactImportExport dmpContactToExport(DmpContactEntity entity) { - DmpContactImportExport xml = new DmpContactImportExport(); + private PlanContactImportExport planContactToExport(PlanContactEntity entity) { + PlanContactImportExport xml = new PlanContactImportExport(); if (entity == null) return xml; xml.setEmail(entity.getEmail()); @@ -1794,149 +1794,149 @@ public class DmpServiceImpl implements DmpService { //region Import Xml - public Dmp importXml(byte[] bytes, String label, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException { + public Plan importXml(byte[] bytes, String label, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException { logger.debug(new MapLogEntry("import data").And("bytes", bytes).And("label", label).And("fields", fields)); - this.authorizationService.authorizeForce(Permission.NewDmp); - DmpImportExport dmpXml = this.xmlHandlingService.fromXml(DmpImportExport.class, new String(bytes, StandardCharsets.UTF_8)); + this.authorizationService.authorizeForce(Permission.NewPlan); + PlanImportExport planXml = this.xmlHandlingService.fromXml(PlanImportExport.class, new String(bytes, StandardCharsets.UTF_8)); - this.xmlEnsureDescriptionTemplates(dmpXml); + this.xmlEnsureDescriptionTemplates(planXml); - DmpPersist persist = new DmpPersist(); + PlanPersist persist = new PlanPersist(); persist.setLabel(label); - persist.setStatus(DmpStatus.Draft); - persist.setDescription(dmpXml.getDescription()); - persist.setAccessType(dmpXml.getAccess()); - persist.setLanguage(dmpXml.getLanguage()); - persist.setUsers(this.xmlToDmpUsersPersist(dmpXml)); //TODO ignore users not exists. by id betters solution - persist.setProperties(this.xmlToDmpPropertiesPersist(dmpXml)); - persist.setDescriptionTemplates(this.xmlDmpDescriptionTemplatesToPersist(dmpXml)); //TODO maybe we should create templates if not exists - persist.setBlueprint(this.xmlDmpBlueprintToPersist(dmpXml)); + persist.setStatus(PlanStatus.Draft); + persist.setDescription(planXml.getDescription()); + persist.setAccessType(planXml.getAccess()); + persist.setLanguage(planXml.getLanguage()); + persist.setUsers(this.xmlToPlanUsersPersist(planXml)); //TODO ignore users not exists. by id betters solution + persist.setProperties(this.xmlToPlanPropertiesPersist(planXml)); + persist.setDescriptionTemplates(this.xmlPlanDescriptionTemplatesToPersist(planXml)); //TODO maybe we should create templates if not exists + persist.setBlueprint(this.xmlPlanBlueprintToPersist(planXml)); - this.validatorFactory.validator(DmpPersist.DmpPersistValidator.class).validateForce(persist); + this.validatorFactory.validator(PlanPersist.PlanPersistValidator.class).validateForce(persist); - Dmp dmp = this.persist(persist, BaseFieldSet.build(fields, Dmp._id, Dmp._hash)); - if (dmp == null) throw new MyApplicationException("Error creating dmp"); + Plan plan = this.persist(persist, BaseFieldSet.build(fields, Plan._id, Plan._hash)); + if (plan == null) throw new MyApplicationException("Error creating dmp"); - if (!this.conventionService.isListNullOrEmpty(dmpXml.getDescriptions())){ - for (DescriptionImportExport description: dmpXml.getDescriptions()){ - this.descriptionService.importXml(description, dmp.getId(), fields != null ? fields.extractPrefixed(this.conventionService.asPrefix(Dmp._description)) : null); + if (!this.conventionService.isListNullOrEmpty(planXml.getDescriptions())){ + for (DescriptionImportExport description: planXml.getDescriptions()){ + this.descriptionService.importXml(description, plan.getId(), fields != null ? fields.extractPrefixed(this.conventionService.asPrefix(Plan._description)) : null); } } - return dmp; + return plan; } - private void xmlEnsureDescriptionTemplates(DmpImportExport dmpImportExport) throws JAXBException, InvalidApplicationException, ParserConfigurationException, IOException, TransformerException, InstantiationException, IllegalAccessException, SAXException { - if (!this.conventionService.isListNullOrEmpty(dmpImportExport.getDescriptions())){ - for (DescriptionImportExport descriptionXml: dmpImportExport.getDescriptions()) { + private void xmlEnsureDescriptionTemplates(PlanImportExport planImportExport) throws JAXBException, InvalidApplicationException, ParserConfigurationException, IOException, TransformerException, InstantiationException, IllegalAccessException, SAXException { + if (!this.conventionService.isListNullOrEmpty(planImportExport.getDescriptions())){ + for (DescriptionImportExport descriptionXml: planImportExport.getDescriptions()) { if (descriptionXml.getDescriptionTemplate() != null) { org.opencdmp.data.DescriptionTemplateEntity descriptionTemplateEntity = this.queryFactory.query(DescriptionTemplateQuery.class).disableTracking().ids(descriptionXml.getDescriptionTemplate().getId()).first(); if (descriptionTemplateEntity == null) descriptionTemplateEntity = this.queryFactory.query(DescriptionTemplateQuery.class).disableTracking().groupIds(descriptionXml.getDescriptionTemplate().getGroupId()).versionStatuses(DescriptionTemplateVersionStatus.Current).isActive(IsActive.Active).statuses(DescriptionTemplateStatus.Finalized).first(); if (descriptionTemplateEntity == null) { - this.descriptionTemplateService.importXml(descriptionXml.getDescriptionTemplate(), null, descriptionXml.getDescriptionTemplate().getDescription(), new BaseFieldSet().ensure(DmpBlueprint._label).ensure(DmpBlueprint._hash)); + this.descriptionTemplateService.importXml(descriptionXml.getDescriptionTemplate(), null, descriptionXml.getDescriptionTemplate().getDescription(), new BaseFieldSet().ensure(PlanBlueprint._label).ensure(PlanBlueprint._hash)); } } } } } - private UUID xmlDmpBlueprintToPersist(DmpImportExport dmpXml) throws JAXBException, InvalidApplicationException, ParserConfigurationException, IOException, TransformerException, InstantiationException, IllegalAccessException, SAXException { - if (dmpXml.getBlueprint() != null){ - DmpBlueprintEntity dmpBlueprintEntity = this.queryFactory.query(DmpBlueprintQuery.class).disableTracking().ids(dmpXml.getBlueprint().getId()).first(); - if (dmpBlueprintEntity == null) dmpBlueprintEntity = this.queryFactory.query(DmpBlueprintQuery.class).disableTracking().groupIds(dmpXml.getBlueprint().getGroupId()).versionStatuses(DmpBlueprintVersionStatus.Current).isActive(IsActive.Active).statuses(DmpBlueprintStatus.Finalized).first(); - if (dmpBlueprintEntity != null){ - return dmpBlueprintEntity.getId(); + private UUID xmlPlanBlueprintToPersist(PlanImportExport planXml) throws JAXBException, InvalidApplicationException, ParserConfigurationException, IOException, TransformerException, InstantiationException, IllegalAccessException, SAXException { + if (planXml.getBlueprint() != null){ + PlanBlueprintEntity planBlueprintEntity = this.queryFactory.query(PlanBlueprintQuery.class).disableTracking().ids(planXml.getBlueprint().getId()).first(); + if (planBlueprintEntity == null) planBlueprintEntity = this.queryFactory.query(PlanBlueprintQuery.class).disableTracking().groupIds(planXml.getBlueprint().getGroupId()).versionStatuses(PlanBlueprintVersionStatus.Current).isActive(IsActive.Active).statuses(PlanBlueprintStatus.Finalized).first(); + if (planBlueprintEntity != null){ + return planBlueprintEntity.getId(); } else { - DmpBlueprint persisted = this.dmpBlueprintService.importXml(dmpXml.getBlueprint(), null, dmpXml.getBlueprint().getLabel(), new BaseFieldSet().ensure(DmpBlueprint._label).ensure(DmpBlueprint._hash)); + PlanBlueprint persisted = this.planBlueprintService.importXml(planXml.getBlueprint(), null, planXml.getBlueprint().getLabel(), new BaseFieldSet().ensure(PlanBlueprint._label).ensure(PlanBlueprint._hash)); return persisted.getId(); } } return null; } - private DmpPropertiesPersist xmlToDmpPropertiesPersist(DmpImportExport importXml) { + private PlanPropertiesPersist xmlToPlanPropertiesPersist(PlanImportExport importXml) { if (importXml == null) return null; - DmpPropertiesPersist persist = new DmpPropertiesPersist(); - persist.setContacts(this.xmlToDmpContactPersist(importXml)); - persist.setDmpBlueprintValues(this.xmlToDmpBlueprintValuePersist(importXml)); + PlanPropertiesPersist persist = new PlanPropertiesPersist(); + persist.setContacts(this.xmlToPlanContactPersist(importXml)); + persist.setPlanBlueprintValues(this.xmlToPlanBlueprintValuePersist(importXml)); return persist; } - private Map xmlToDmpBlueprintValuePersist(DmpImportExport importXml){ - if (importXml.getBlueprint() != null && importXml.getBlueprint().getDmpBlueprintDefinition() != null && !this.conventionService.isListNullOrEmpty(importXml.getBlueprint().getDmpBlueprintDefinition().getSections())) { - Map dmpBlueprintValues = new HashMap<>(); - List sections = importXml.getBlueprint().getDmpBlueprintDefinition().getSections(); + private Map xmlToPlanBlueprintValuePersist(PlanImportExport importXml){ + if (importXml.getBlueprint() != null && importXml.getBlueprint().getPlanBlueprintDefinition() != null && !this.conventionService.isListNullOrEmpty(importXml.getBlueprint().getPlanBlueprintDefinition().getSections())) { + Map planBlueprintValues = new HashMap<>(); + List sections = importXml.getBlueprint().getPlanBlueprintDefinition().getSections(); if (!this.conventionService.isListNullOrEmpty(sections)){ - for (BlueprintSectionImportExport section : importXml.getBlueprint().getDmpBlueprintDefinition().getSections()) { - this.xmlToDmpBlueprintExtraFieldValuePersist(importXml, section, dmpBlueprintValues); - this.xmlToDmpBlueprintReferenceFieldValuePersist(importXml, section, dmpBlueprintValues); + for (BlueprintSectionImportExport section : importXml.getBlueprint().getPlanBlueprintDefinition().getSections()) { + this.xmlToPlanBlueprintExtraFieldValuePersist(importXml, section, planBlueprintValues); + this.xmlToPlanBlueprintReferenceFieldValuePersist(importXml, section, planBlueprintValues); } } - return dmpBlueprintValues; + return planBlueprintValues; } return null; } - private void xmlToDmpBlueprintExtraFieldValuePersist(DmpImportExport importXml, BlueprintSectionImportExport section, Map dmpBlueprintValues){ + private void xmlToPlanBlueprintExtraFieldValuePersist(PlanImportExport importXml, BlueprintSectionImportExport section, Map planBlueprintValues){ if (!this.conventionService.isListNullOrEmpty(section.getExtraFields()) && !this.conventionService.isListNullOrEmpty(importXml.getBlueprintValues())){ - for (DmpBlueprintValueImportExport value : importXml.getBlueprintValues()) { + for (PlanBlueprintValueImportExport value : importXml.getBlueprintValues()) { if (value.getFieldId() != null ) { - section.getExtraFields().stream().filter(x -> x.getId().equals(value.getFieldId())).findFirst().ifPresent(extraFieldImportExport -> dmpBlueprintValues.put(value.getFieldId(), this.xmlDmpBlueprintValueToPersist(value, extraFieldImportExport))); + section.getExtraFields().stream().filter(x -> x.getId().equals(value.getFieldId())).findFirst().ifPresent(extraFieldImportExport -> planBlueprintValues.put(value.getFieldId(), this.xmlPlanBlueprintValueToPersist(value, extraFieldImportExport))); } } } } - private void xmlToDmpBlueprintReferenceFieldValuePersist(DmpImportExport importXml, BlueprintSectionImportExport section, Map dmpBlueprintValues){ + private void xmlToPlanBlueprintReferenceFieldValuePersist(PlanImportExport importXml, BlueprintSectionImportExport section, Map planBlueprintValues){ if (!this.conventionService.isListNullOrEmpty(section.getReferenceFields()) && !this.conventionService.isListNullOrEmpty(importXml.getReferences())){ for (BlueprintReferenceTypeFieldImportExport blueprintReferenceTypeField : section.getReferenceFields()) { - List dmpReferencesByField = importXml.getReferences().stream().filter(x -> x.getFieldId().equals(blueprintReferenceTypeField.getId())).collect(Collectors.toList()); - if (!this.conventionService.isListNullOrEmpty(dmpReferencesByField)){ - dmpBlueprintValues.put(blueprintReferenceTypeField.getId(), this.xmlReferenceFieldToDmpBlueprintValuePersist(blueprintReferenceTypeField, dmpReferencesByField)); + List planReferencesByField = importXml.getReferences().stream().filter(x -> x.getFieldId().equals(blueprintReferenceTypeField.getId())).collect(Collectors.toList()); + if (!this.conventionService.isListNullOrEmpty(planReferencesByField)){ + planBlueprintValues.put(blueprintReferenceTypeField.getId(), this.xmlReferenceFieldToPlanBlueprintValuePersist(blueprintReferenceTypeField, planReferencesByField)); } } } } - private List xmlToDmpContactPersist(DmpImportExport importXml){ + private List xmlToPlanContactPersist(PlanImportExport importXml){ if (!this.conventionService.isListNullOrEmpty(importXml.getContacts())) { - List contacts = new ArrayList<>(); - for (DmpContactImportExport contact : importXml.getContacts()) { - contacts.add(this.xmlDmpContactToPersist(contact)); + List contacts = new ArrayList<>(); + for (PlanContactImportExport contact : importXml.getContacts()) { + contacts.add(this.xmlPlanContactToPersist(contact)); } return contacts; } return null; } - private DmpBlueprintValuePersist xmlReferenceFieldToDmpBlueprintValuePersist(BlueprintReferenceTypeFieldImportExport blueprintReferenceTypeFieldImportXml, List dmpReferencesImportXml) { - if (blueprintReferenceTypeFieldImportXml == null || this.conventionService.isListNullOrEmpty(dmpReferencesImportXml)) + private PlanBlueprintValuePersist xmlReferenceFieldToPlanBlueprintValuePersist(BlueprintReferenceTypeFieldImportExport blueprintReferenceTypeFieldImportXml, List planReferencesImportXml) { + if (blueprintReferenceTypeFieldImportXml == null || this.conventionService.isListNullOrEmpty(planReferencesImportXml)) return null; ReferenceTypeEntity referenceTypeEntity = this.queryFactory.query(ReferenceTypeQuery.class).ids(blueprintReferenceTypeFieldImportXml.getReferenceTypeId()).first();//TODO: optimize if (referenceTypeEntity == null) referenceTypeEntity = this.queryFactory.query(ReferenceTypeQuery.class).codes(blueprintReferenceTypeFieldImportXml.getReferenceTypeCode()).first(); if (referenceTypeEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{blueprintReferenceTypeFieldImportXml.getReferenceTypeCode(), ReferenceType.class.getSimpleName()}, LocaleContextHolder.getLocale())); - DmpBlueprintValuePersist persist = new DmpBlueprintValuePersist(); + PlanBlueprintValuePersist persist = new PlanBlueprintValuePersist(); persist.setFieldId(blueprintReferenceTypeFieldImportXml.getId()); if (blueprintReferenceTypeFieldImportXml.getMultipleSelect()){ List references = new ArrayList<>(); - for (DmpReferenceImportExport dmpReference : dmpReferencesImportXml) { - references.add(this.xmlDmpReferenceToReferencePersist(dmpReference, referenceTypeEntity)); + for (PlanReferenceImportExport planReference : planReferencesImportXml) { + references.add(this.xmlPlanReferenceToReferencePersist(planReference, referenceTypeEntity)); } persist.setReferences(references); } else { - persist.setReference(this.xmlDmpReferenceToReferencePersist(dmpReferencesImportXml.stream().findFirst().orElse(null), referenceTypeEntity)); + persist.setReference(this.xmlPlanReferenceToReferencePersist(planReferencesImportXml.stream().findFirst().orElse(null), referenceTypeEntity)); } return persist; } - private ReferencePersist xmlDmpReferenceToReferencePersist(DmpReferenceImportExport importXml, ReferenceTypeEntity referenceTypeEntity) { + private ReferencePersist xmlPlanReferenceToReferencePersist(PlanReferenceImportExport importXml, ReferenceTypeEntity referenceTypeEntity) { if (importXml == null) return null; @@ -1966,11 +1966,11 @@ public class DmpServiceImpl implements DmpService { return persist; } - private DmpBlueprintValuePersist xmlDmpBlueprintValueToPersist(DmpBlueprintValueImportExport importXml, BlueprintExtraFieldImportExport extraFieldImportExport) { + private PlanBlueprintValuePersist xmlPlanBlueprintValueToPersist(PlanBlueprintValueImportExport importXml, BlueprintExtraFieldImportExport extraFieldImportExport) { if (importXml == null || extraFieldImportExport == null) return null; - DmpBlueprintValuePersist persist = new DmpBlueprintValuePersist(); + PlanBlueprintValuePersist persist = new PlanBlueprintValuePersist(); persist.setFieldId(importXml.getFieldId()); switch (extraFieldImportExport.getType()){ @@ -1983,22 +1983,22 @@ public class DmpServiceImpl implements DmpService { return persist; } - private List xmlDmpDescriptionTemplatesToPersist(DmpImportExport dmpXml){ - if (!this.conventionService.isListNullOrEmpty(dmpXml.getDescriptionTemplates())) { - List descriptionTemplates = new ArrayList<>(); - for (DmpDescriptionTemplateImportExport descriptionTemplate : dmpXml.getDescriptionTemplates()) { - descriptionTemplates.add(this.xmlDmpDescriptionTemplateToPersist(descriptionTemplate)); + private List xmlPlanDescriptionTemplatesToPersist(PlanImportExport planXml){ + if (!this.conventionService.isListNullOrEmpty(planXml.getDescriptionTemplates())) { + List descriptionTemplates = new ArrayList<>(); + for (PlanDescriptionTemplateImportExport descriptionTemplate : planXml.getDescriptionTemplates()) { + descriptionTemplates.add(this.xmlPlanDescriptionTemplateToPersist(descriptionTemplate)); } return descriptionTemplates.stream().filter(Objects::nonNull).toList(); } return null; } - private DmpDescriptionTemplatePersist xmlDmpDescriptionTemplateToPersist(DmpDescriptionTemplateImportExport importXml) { + private PlanDescriptionTemplatePersist xmlPlanDescriptionTemplateToPersist(PlanDescriptionTemplateImportExport importXml) { if (importXml == null) return null; - DmpDescriptionTemplatePersist persist = new DmpDescriptionTemplatePersist(); + PlanDescriptionTemplatePersist persist = new PlanDescriptionTemplatePersist(); persist.setDescriptionTemplateGroupId(importXml.getDescriptionTemplateGroupId()); persist.setSectionId(importXml.getSectionId()); @@ -2006,26 +2006,26 @@ public class DmpServiceImpl implements DmpService { return persist; } - private List xmlToDmpUsersPersist(DmpImportExport dmpXml){ - if (!this.conventionService.isListNullOrEmpty(dmpXml.getUsers())) { - List users = this.queryFactory.query(UserQuery.class).disableTracking().ids(dmpXml.getUsers().stream().map(DmpUserImportExport::getId).filter(Objects::nonNull).distinct().toList()).isActive(IsActive.Active).collect(); + private List xmlToPlanUsersPersist(PlanImportExport planXml){ + if (!this.conventionService.isListNullOrEmpty(planXml.getUsers())) { + List users = this.queryFactory.query(UserQuery.class).disableTracking().ids(planXml.getUsers().stream().map(PlanUserImportExport::getId).filter(Objects::nonNull).distinct().toList()).isActive(IsActive.Active).collect(); List userIds = users == null ? new ArrayList<>() : users.stream().map(UserEntity::getId).collect(Collectors.toList()); - List dmpUsers = new ArrayList<>(); - for (DmpUserImportExport user : dmpXml.getUsers()) { - dmpUsers.add(this.xmlDmpUserToPersist(user, userIds)); + List dmpUsers = new ArrayList<>(); + for (PlanUserImportExport user : planXml.getUsers()) { + dmpUsers.add(this.xmlPlanUserToPersist(user, userIds)); } return dmpUsers.stream().filter(Objects::nonNull).collect(Collectors.toList()); } return null; } - private DmpUserPersist xmlDmpUserToPersist(DmpUserImportExport importXml, List userIds) { + private PlanUserPersist xmlPlanUserToPersist(PlanUserImportExport importXml, List userIds) { if (importXml == null) return null; if (importXml.getId() != null && !userIds.isEmpty() && userIds.contains(importXml.getId())) { - DmpUserPersist persist = new DmpUserPersist(); + PlanUserPersist persist = new PlanUserPersist(); persist.setUser(importXml.getId()); persist.setRole(importXml.getRole()); @@ -2036,11 +2036,11 @@ public class DmpServiceImpl implements DmpService { return null; } - private DmpContactPersist xmlDmpContactToPersist(DmpContactImportExport importXml) { + private PlanContactPersist xmlPlanContactToPersist(PlanContactImportExport importXml) { if (importXml == null) return null; - DmpContactPersist persist = new DmpContactPersist(); + PlanContactPersist persist = new PlanContactPersist(); persist.setEmail(importXml.getEmail()); persist.setFirstName(importXml.getEmail()); @@ -2053,62 +2053,62 @@ public class DmpServiceImpl implements DmpService { //region Import RDA JSON - public PreprocessingDmpModel preprocessingDmp(UUID fileId, String repositoryId) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, IOException { + public PreprocessingDmpModel preprocessingPlan(UUID fileId, String repositoryId) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, IOException { return this.fileTransformerService.preprocessingDmp(fileId, repositoryId); } - public Dmp importJson(DmpCommonModelConfig dmpCommonModelConfig, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, InvalidApplicationException, IOException, InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, ParserConfigurationException, TransformerException, InstantiationException, IllegalAccessException, SAXException { - logger.debug(new MapLogEntry("import data").And("file id", dmpCommonModelConfig.getFileId()).And("label", dmpCommonModelConfig.getLabel()).And("fields", fields)); + public Plan importJson(PlanCommonModelConfig planCommonModelConfig, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, InvalidApplicationException, IOException, InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, ParserConfigurationException, TransformerException, InstantiationException, IllegalAccessException, SAXException { + logger.debug(new MapLogEntry("import data").And("file id", planCommonModelConfig.getFileId()).And("label", planCommonModelConfig.getLabel()).And("fields", fields)); - DmpModel model = this.fileTransformerService.importDmp(dmpCommonModelConfig); + DmpModel model = this.fileTransformerService.importDmp(planCommonModelConfig); if (model == null) throw new MyNotFoundException("Plan Import Error"); - DmpPersist persist = new DmpPersist(); + PlanPersist persist = new PlanPersist(); - persist.setLabel(dmpCommonModelConfig.getLabel()); - persist.setStatus(DmpStatus.Draft); + persist.setLabel(planCommonModelConfig.getLabel()); + persist.setStatus(PlanStatus.Draft); persist.setDescription(model.getDescription()); switch (model.getAccessType()) { - case Public -> persist.setAccessType(DmpAccessType.Public); - case Restricted -> persist.setAccessType(DmpAccessType.Restricted); + case Public -> persist.setAccessType(PlanAccessType.Public); + case Restricted -> persist.setAccessType(PlanAccessType.Restricted); default -> throw new MyApplicationException("Unrecognized Type " + model.getAccessType().getValue()); } persist.setLanguage(model.getLanguage()); persist.setUsers(this.commonModelToDmpUsersPersist(model)); persist.setBlueprint(this.commonModelDmpBlueprintToPersist(model)); - persist.setDescriptionTemplates(this.commonModelDmpDescriptionTemplatesToPersist(model)); //TODO maybe we should create templates if not exists + persist.setDescriptionTemplates(this.commonModelPlanDescriptionTemplatesToPersist(model)); //TODO maybe we should create templates if not exists persist.setProperties(this.commonModelDmpPropertiesToPersist(model)); - this.validatorFactory.validator(DmpPersist.DmpPersistValidator.class).validateForce(persist); - Dmp dmp = this.persist(persist, BaseFieldSet.build(fields, Dmp._id, Dmp._hash)); - if (dmp == null) throw new MyApplicationException("Error creating dmp"); + this.validatorFactory.validator(PlanPersist.PlanPersistValidator.class).validateForce(persist); + Plan plan = this.persist(persist, BaseFieldSet.build(fields, Plan._id, Plan._hash)); + if (plan == null) throw new MyApplicationException("Error creating dmp"); if (!this.conventionService.isListNullOrEmpty(model.getDescriptions())){ for (DescriptionModel description: model.getDescriptions()){ - this.descriptionService.importCommonModel(description, dmp.getId(), fields != null ? fields.extractPrefixed(this.conventionService.asPrefix(Dmp._description)) : null); + this.descriptionService.importCommonModel(description, plan.getId(), fields != null ? fields.extractPrefixed(this.conventionService.asPrefix(Plan._description)) : null); } } - return dmp; + return plan; } - private List commonModelDmpDescriptionTemplatesToPersist(DmpModel commonModel){ + private List commonModelPlanDescriptionTemplatesToPersist(DmpModel commonModel){ if (!this.conventionService.isListNullOrEmpty(commonModel.getDescriptionTemplates())) { - List descriptionTemplates = new ArrayList<>(); + List descriptionTemplates = new ArrayList<>(); for (DmpDescriptionTemplateModel descriptionTemplate : commonModel.getDescriptionTemplates()) { - descriptionTemplates.add(this.commonModelDmpDescriptionTemplateToPersist(descriptionTemplate)); + descriptionTemplates.add(this.commonModelPlanDescriptionTemplateToPersist(descriptionTemplate)); } return descriptionTemplates.stream().filter(Objects::nonNull).toList(); } return null; } - private DmpDescriptionTemplatePersist commonModelDmpDescriptionTemplateToPersist(DmpDescriptionTemplateModel commonModel) { + private PlanDescriptionTemplatePersist commonModelPlanDescriptionTemplateToPersist(DmpDescriptionTemplateModel commonModel) { if (commonModel == null) return null; - DmpDescriptionTemplatePersist persist = new DmpDescriptionTemplatePersist(); + PlanDescriptionTemplatePersist persist = new PlanDescriptionTemplatePersist(); persist.setDescriptionTemplateGroupId(commonModel.getDescriptionTemplateGroupId()); persist.setSectionId(commonModel.getSectionId()); @@ -2116,33 +2116,33 @@ public class DmpServiceImpl implements DmpService { return persist; } - private UUID commonModelDmpBlueprintToPersist(DmpModel dmpXml) throws JAXBException, InvalidApplicationException, ParserConfigurationException, IOException, TransformerException, InstantiationException, IllegalAccessException, SAXException { - if (dmpXml.getDmpBlueprint() != null){ - DmpBlueprintEntity dmpBlueprintEntity = this.queryFactory.query(DmpBlueprintQuery.class).disableTracking().ids(dmpXml.getDmpBlueprint().getId()).first(); - if (dmpBlueprintEntity == null) dmpBlueprintEntity = this.queryFactory.query(DmpBlueprintQuery.class).disableTracking().groupIds(dmpXml.getDmpBlueprint().getGroupId()).versionStatuses(DmpBlueprintVersionStatus.Current).isActive(IsActive.Active).statuses(DmpBlueprintStatus.Finalized).first(); - if (dmpBlueprintEntity != null){ - return dmpBlueprintEntity.getId(); + private UUID commonModelDmpBlueprintToPersist(DmpModel planXml) throws JAXBException, InvalidApplicationException, ParserConfigurationException, IOException, TransformerException, InstantiationException, IllegalAccessException, SAXException { + if (planXml.getDmpBlueprint() != null){ + PlanBlueprintEntity planBlueprintEntity = this.queryFactory.query(PlanBlueprintQuery.class).disableTracking().ids(planXml.getDmpBlueprint().getId()).first(); + if (planBlueprintEntity == null) planBlueprintEntity = this.queryFactory.query(PlanBlueprintQuery.class).disableTracking().groupIds(planXml.getDmpBlueprint().getGroupId()).versionStatuses(PlanBlueprintVersionStatus.Current).isActive(IsActive.Active).statuses(PlanBlueprintStatus.Finalized).first(); + if (planBlueprintEntity != null){ + return planBlueprintEntity.getId(); } else { - DmpBlueprint persisted = this.dmpBlueprintService.importCommonModel(dmpXml.getDmpBlueprint(), new BaseFieldSet().ensure(DmpBlueprint._label).ensure(DmpBlueprint._hash)); + PlanBlueprint persisted = this.planBlueprintService.importCommonModel(planXml.getDmpBlueprint(), new BaseFieldSet().ensure(PlanBlueprint._label).ensure(PlanBlueprint._hash)); return persisted.getId(); } } return null; } - private DmpPropertiesPersist commonModelDmpPropertiesToPersist(DmpModel commonModel) { + private PlanPropertiesPersist commonModelDmpPropertiesToPersist(DmpModel commonModel) { if (commonModel == null || commonModel.getProperties() == null) return null; - DmpPropertiesPersist persist = new DmpPropertiesPersist(); + PlanPropertiesPersist persist = new PlanPropertiesPersist(); persist.setContacts(this.commonModelToDmpContactPersist(commonModel.getProperties())); - persist.setDmpBlueprintValues(this.commonModelToDmpBlueprintValuePersist(commonModel)); + persist.setPlanBlueprintValues(this.commonModelToDmpBlueprintValuePersist(commonModel)); return persist; } - private List commonModelToDmpContactPersist(DmpPropertiesModel commonModel){ + private List commonModelToDmpContactPersist(DmpPropertiesModel commonModel){ if (!this.conventionService.isListNullOrEmpty(commonModel.getContacts())) { - List contacts = new ArrayList<>(); + List contacts = new ArrayList<>(); for (DmpContactModel contact : commonModel.getContacts()) { contacts.add(this.commonModelDmpContactToPersist(contact)); } @@ -2151,9 +2151,9 @@ public class DmpServiceImpl implements DmpService { return null; } - private Map commonModelToDmpBlueprintValuePersist(DmpModel commonModel){ + private Map commonModelToDmpBlueprintValuePersist(DmpModel commonModel){ if (commonModel.getDmpBlueprint() != null && commonModel.getDmpBlueprint().getDefinition() != null && !this.conventionService.isListNullOrEmpty(commonModel.getDmpBlueprint().getDefinition().getSections())) { - Map dmpBlueprintValues = new HashMap<>(); + Map dmpBlueprintValues = new HashMap<>(); List sections = commonModel.getDmpBlueprint().getDefinition().getSections(); if (!this.conventionService.isListNullOrEmpty(sections)){ for (SectionModel section : sections) { @@ -2183,7 +2183,7 @@ public class DmpServiceImpl implements DmpService { return null; } - private DmpBlueprintValuePersist commonModelDmpReferenceFieldToDmpBlueprintValuePersist(ReferenceTypeFieldModel model, List dmpReferences) { + private PlanBlueprintValuePersist commonModelDmpReferenceFieldToDmpBlueprintValuePersist(ReferenceTypeFieldModel model, List dmpReferences) { if (model == null || this.conventionService.isListNullOrEmpty(dmpReferences) || model.getReferenceType() == null) return null; @@ -2191,7 +2191,7 @@ public class DmpServiceImpl implements DmpService { if (referenceTypeEntity == null) referenceTypeEntity = this.queryFactory.query(ReferenceTypeQuery.class).codes(model.getReferenceType().getCode()).first(); if (referenceTypeEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getReferenceType().getCode(), ReferenceType.class.getSimpleName()}, LocaleContextHolder.getLocale())); - DmpBlueprintValuePersist persist = new DmpBlueprintValuePersist(); + PlanBlueprintValuePersist persist = new PlanBlueprintValuePersist(); persist.setFieldId(model.getId()); if (model.getMultipleSelect()){ @@ -2239,10 +2239,10 @@ public class DmpServiceImpl implements DmpService { return persist; } - private DmpBlueprintValuePersist commonModelDmpBlueprintValueToPersist(DmpBlueprintValueModel commonModel, ExtraFieldModel extraFieldModel) { + private PlanBlueprintValuePersist commonModelDmpBlueprintValueToPersist(DmpBlueprintValueModel commonModel, ExtraFieldModel extraFieldModel) { if (commonModel == null || extraFieldModel == null) return null; - DmpBlueprintValuePersist persist = new DmpBlueprintValuePersist(); + PlanBlueprintValuePersist persist = new PlanBlueprintValuePersist(); persist.setFieldId(commonModel.getFieldId()); switch (extraFieldModel.getDataType()){ @@ -2255,12 +2255,12 @@ public class DmpServiceImpl implements DmpService { return persist; } - private List commonModelToDmpUsersPersist(DmpModel commonModel){ + private List commonModelToDmpUsersPersist(DmpModel commonModel){ if (!this.conventionService.isListNullOrEmpty(commonModel.getUsers())) { List users = this.queryFactory.query(UserQuery.class).disableTracking().ids(commonModel.getUsers().stream().map(DmpUserModel::getUser).filter(Objects::nonNull).map(UserModel::getId).filter(Objects::nonNull).distinct().toList()).isActive(IsActive.Active).collect(); List userIds = users == null ? new ArrayList<>() : users.stream().map(UserEntity::getId).collect(Collectors.toList()); - List dmpUsers = new ArrayList<>(); + List dmpUsers = new ArrayList<>(); for (DmpUserModel user : commonModel.getUsers()) { dmpUsers.add(this.commonModelDmpUserToPersist(user, userIds)); } @@ -2270,20 +2270,20 @@ public class DmpServiceImpl implements DmpService { } - private DmpUserPersist commonModelDmpUserToPersist(DmpUserModel commonModel, List userIds) { + private PlanUserPersist commonModelDmpUserToPersist(DmpUserModel commonModel, List userIds) { if (commonModel == null) return null; if (commonModel.getUser() != null && commonModel.getUser().getId() != null && !userIds.isEmpty() && userIds.contains(commonModel.getUser().getId())) { - DmpUserPersist persist = new DmpUserPersist(); + PlanUserPersist persist = new PlanUserPersist(); persist.setUser(commonModel.getUser().getId()); switch (commonModel.getRole()){ - case Owner -> persist.setRole(DmpUserRole.Owner); - case Viewer -> persist.setRole(DmpUserRole.Viewer); - case DescriptionContributor -> persist.setRole(DmpUserRole.DescriptionContributor); - case Reviewer -> persist.setRole(DmpUserRole.Reviewer); + case Owner -> persist.setRole(PlanUserRole.Owner); + case Viewer -> persist.setRole(PlanUserRole.Viewer); + case DescriptionContributor -> persist.setRole(PlanUserRole.DescriptionContributor); + case Reviewer -> persist.setRole(PlanUserRole.Reviewer); default -> throw new MyApplicationException("Unrecognized Type " + commonModel.getRole().getValue()); } persist.setSectionId(commonModel.getSectionId()); @@ -2293,11 +2293,11 @@ public class DmpServiceImpl implements DmpService { return null; } - private DmpContactPersist commonModelDmpContactToPersist(DmpContactModel commonModel) { + private PlanContactPersist commonModelDmpContactToPersist(DmpContactModel commonModel) { if (commonModel == null) return null; - DmpContactPersist persist = new DmpContactPersist(); + PlanContactPersist persist = new PlanContactPersist(); persist.setEmail(commonModel.getEmail()); persist.setFirstName(commonModel.getEmail()); diff --git a/backend/core/src/main/java/org/opencdmp/service/planblueprint/PlanBlueprintService.java b/backend/core/src/main/java/org/opencdmp/service/planblueprint/PlanBlueprintService.java new file mode 100644 index 000000000..ceb24ad6c --- /dev/null +++ b/backend/core/src/main/java/org/opencdmp/service/planblueprint/PlanBlueprintService.java @@ -0,0 +1,47 @@ +package org.opencdmp.service.planblueprint; + +import com.fasterxml.jackson.core.JsonProcessingException; +import gr.cite.tools.exception.MyApplicationException; +import gr.cite.tools.exception.MyForbiddenException; +import gr.cite.tools.exception.MyNotFoundException; +import gr.cite.tools.exception.MyValidationException; +import gr.cite.tools.fieldset.FieldSet; +import jakarta.xml.bind.JAXBException; +import org.opencdmp.commonmodels.models.dmpblueprint.DmpBlueprintModel; +import org.opencdmp.commons.enums.PlanBlueprintSystemFieldType; +import org.opencdmp.commons.types.planblueprint.importexport.BlueprintImportExport; +import org.opencdmp.data.PlanBlueprintEntity; +import org.opencdmp.model.planblueprint.PlanBlueprint; +import org.opencdmp.model.persist.PlanBlueprintPersist; +import org.opencdmp.model.persist.NewVersionPlanBlueprintPersist; +import org.springframework.http.ResponseEntity; +import org.xml.sax.SAXException; + +import javax.management.InvalidApplicationException; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.TransformerException; +import java.io.IOException; +import java.util.UUID; + +public interface PlanBlueprintService { + + PlanBlueprint persist(PlanBlueprintPersist model, UUID groupId, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, JAXBException, JsonProcessingException, TransformerException, ParserConfigurationException; + + void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException; + boolean fieldInBlueprint(PlanBlueprintEntity planBlueprintEntity, PlanBlueprintSystemFieldType type); + + boolean fieldInBlueprint(UUID id, PlanBlueprintSystemFieldType type) throws InvalidApplicationException; + + PlanBlueprint buildClone(UUID id, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException; + + PlanBlueprint createNewVersion(NewVersionPlanBlueprintPersist model, FieldSet fieldSet) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, JsonProcessingException, TransformerException; + + BlueprintImportExport getExportXmlEntity(UUID id, boolean ignoreAuthorize) throws MyForbiddenException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException; + + ResponseEntity exportXml(UUID id) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, TransformerException, InvalidApplicationException; + + PlanBlueprint importXml(BlueprintImportExport dmpDefinition, UUID groupId, String label, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException; + + PlanBlueprint importXml(byte[] bytes, UUID groupId, String label, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException; + PlanBlueprint importCommonModel(DmpBlueprintModel planDefinition, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException; +} diff --git a/backend/core/src/main/java/org/opencdmp/service/dmpblueprint/DmpBlueprintServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/planblueprint/PlanBlueprintServiceImpl.java similarity index 75% rename from backend/core/src/main/java/org/opencdmp/service/dmpblueprint/DmpBlueprintServiceImpl.java rename to backend/core/src/main/java/org/opencdmp/service/planblueprint/PlanBlueprintServiceImpl.java index f51ec06d1..fcf2b01de 100644 --- a/backend/core/src/main/java/org/opencdmp/service/dmpblueprint/DmpBlueprintServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/planblueprint/PlanBlueprintServiceImpl.java @@ -1,4 +1,4 @@ -package org.opencdmp.service.dmpblueprint; +package org.opencdmp.service.planblueprint; import com.fasterxml.jackson.core.JsonProcessingException; import gr.cite.commons.web.authz.service.AuthorizationService; @@ -22,28 +22,28 @@ import org.opencdmp.commonmodels.models.dmpblueprint.*; import org.opencdmp.commons.XmlHandlingService; import org.opencdmp.commons.enums.*; import org.opencdmp.commons.scope.tenant.TenantScope; -import org.opencdmp.commons.types.dmpblueprint.*; -import org.opencdmp.commons.types.dmpblueprint.importexport.*; +import org.opencdmp.commons.types.planblueprint.*; +import org.opencdmp.commons.types.planblueprint.importexport.*; import org.opencdmp.convention.ConventionService; -import org.opencdmp.data.DmpBlueprintEntity; +import org.opencdmp.data.PlanBlueprintEntity; import org.opencdmp.data.PrefillingSourceEntity; import org.opencdmp.data.ReferenceTypeEntity; import org.opencdmp.data.TenantEntityManager; import org.opencdmp.errorcode.ErrorThesaurusProperties; -import org.opencdmp.model.builder.dmpblueprint.DmpBlueprintBuilder; -import org.opencdmp.model.deleter.DmpBlueprintDeleter; +import org.opencdmp.model.builder.planblueprint.PlanBlueprintBuilder; +import org.opencdmp.model.deleter.PlanBlueprintDeleter; import org.opencdmp.model.descriptiontemplate.DescriptionTemplate; -import org.opencdmp.model.dmpblueprint.Definition; -import org.opencdmp.model.dmpblueprint.DmpBlueprint; -import org.opencdmp.model.dmpblueprint.Field; -import org.opencdmp.model.dmpblueprint.Section; -import org.opencdmp.model.persist.DmpBlueprintPersist; -import org.opencdmp.model.persist.NewVersionDmpBlueprintPersist; +import org.opencdmp.model.planblueprint.Definition; +import org.opencdmp.model.planblueprint.PlanBlueprint; +import org.opencdmp.model.planblueprint.Field; +import org.opencdmp.model.planblueprint.Section; +import org.opencdmp.model.persist.PlanBlueprintPersist; +import org.opencdmp.model.persist.NewVersionPlanBlueprintPersist; import org.opencdmp.model.persist.dmpblueprintdefinition.*; import org.opencdmp.model.prefillingsource.PrefillingSource; import org.opencdmp.model.referencetype.ReferenceType; import org.opencdmp.query.DescriptionTemplateQuery; -import org.opencdmp.query.DmpBlueprintQuery; +import org.opencdmp.query.PlanBlueprintQuery; import org.opencdmp.query.PrefillingSourceQuery; import org.opencdmp.query.ReferenceTypeQuery; import org.opencdmp.service.responseutils.ResponseUtilsService; @@ -64,9 +64,9 @@ import java.time.Instant; import java.util.*; @Service -public class DmpBlueprintServiceImpl implements DmpBlueprintService { +public class PlanBlueprintServiceImpl implements PlanBlueprintService { - private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpBlueprintServiceImpl.class)); + private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PlanBlueprintServiceImpl.class)); private final TenantEntityManager entityManager; @@ -91,7 +91,7 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService { private final ValidatorFactory validatorFactory; private final TenantScope tenantScope; @Autowired - public DmpBlueprintServiceImpl( + public PlanBlueprintServiceImpl( TenantEntityManager entityManager, AuthorizationService authorizationService, DeleterFactory deleterFactory, @@ -118,29 +118,29 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService { //region Persist - public DmpBlueprint persist(DmpBlueprintPersist model, UUID groupId, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, JAXBException, JsonProcessingException, TransformerException, ParserConfigurationException { + public PlanBlueprint persist(PlanBlueprintPersist model, UUID groupId, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, JAXBException, JsonProcessingException, TransformerException, ParserConfigurationException { logger.debug(new MapLogEntry("persisting data").And("model", model).And("fields", fields)); - this.authorizationService.authorizeForce(Permission.EditDmpBlueprint); + this.authorizationService.authorizeForce(Permission.EditPlanBlueprint); Boolean isUpdate = this.conventionService.isValidGuid(model.getId()); - DmpBlueprintEntity data; + PlanBlueprintEntity data; if (isUpdate) { - data = this.entityManager.find(DmpBlueprintEntity.class, model.getId()); + data = this.entityManager.find(PlanBlueprintEntity.class, model.getId()); if (data == null) - throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), DmpBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale())); + throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), PlanBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale())); if (!this.conventionService.hashValue(data.getUpdatedAt()).equals(model.getHash())) throw new MyValidationException(this.errors.getHashConflict().getCode(), this.errors.getHashConflict().getMessage()); - if (data.getStatus().equals(DmpBlueprintStatus.Finalized)) + if (data.getStatus().equals(PlanBlueprintStatus.Finalized)) throw new MyForbiddenException("Cannot update finalized blueprint"); } else { - data = new DmpBlueprintEntity(); + data = new PlanBlueprintEntity(); data.setId(UUID.randomUUID()); - data.setStatus(DmpBlueprintStatus.Draft); + data.setStatus(PlanBlueprintStatus.Draft); data.setGroupId(groupId != null ? groupId : UUID.randomUUID()); data.setVersion((short) 1); - data.setVersionStatus(DmpBlueprintVersionStatus.NotFinalized); + data.setVersionStatus(PlanBlueprintVersionStatus.NotFinalized); data.setCreatedAt(Instant.now()); data.setIsActive(IsActive.Active); long activeDescriptionTemplatesForTheGroup = this.queryFactory.query(DescriptionTemplateQuery.class).disableTracking() @@ -151,7 +151,7 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService { } if (groupId != null && !data.getGroupId().equals(groupId)) throw new MyApplicationException("Can not change description template group id"); - DmpBlueprintStatus previousStatus = data.getStatus(); + PlanBlueprintStatus previousStatus = data.getStatus(); if (model.getDefinition() != null && model.getDefinition().getSections().stream().noneMatch(SectionPersist::getHasTemplates)) { throw new MyValidationException(this.errors.getDmpBlueprintHasNoDescriptionTemplates().getCode(), this.errors.getDmpBlueprintHasNoDescriptionTemplates().getMessage()); @@ -173,32 +173,32 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService { this.entityManager.flush(); - return this.builderFactory.builder(DmpBlueprintBuilder.class).authorize(AuthorizationFlags.AllExceptPublic).build(BaseFieldSet.build(fields, DmpBlueprint._id), data); + return this.builderFactory.builder(PlanBlueprintBuilder.class).authorize(AuthorizationFlags.AllExceptPublic).build(BaseFieldSet.build(fields, PlanBlueprint._id), data); } - private void updateVersionStatusAndSave(DmpBlueprintEntity data, DmpBlueprintStatus previousStatus, DmpBlueprintStatus newStatus) throws InvalidApplicationException { + private void updateVersionStatusAndSave(PlanBlueprintEntity data, PlanBlueprintStatus previousStatus, PlanBlueprintStatus newStatus) throws InvalidApplicationException { if (previousStatus.equals(newStatus)) return; - if (previousStatus.equals(DmpBlueprintStatus.Finalized)) + if (previousStatus.equals(PlanBlueprintStatus.Finalized)) throw new MyForbiddenException("Can not update finalized blueprint"); - if (newStatus.equals(DmpBlueprintStatus.Finalized)) { - List latestVersionDmpBlueprints = this.queryFactory.query(DmpBlueprintQuery.class) + if (newStatus.equals(PlanBlueprintStatus.Finalized)) { + List latestVersionDmpBlueprints = this.queryFactory.query(PlanBlueprintQuery.class) .disableTracking() - .versionStatuses(DmpBlueprintVersionStatus.Current) + .versionStatuses(PlanBlueprintVersionStatus.Current) .isActive(IsActive.Active) .groupIds(data.getGroupId()) .collect(); if (latestVersionDmpBlueprints.size() > 1) throw new MyValidationException(this.errors.getMultipleDmpVersionsNotSupported().getCode(), this.errors.getMultipleDmpVersionsNotSupported().getMessage()); - DmpBlueprintEntity oldDmpBlueprintEntity = latestVersionDmpBlueprints.stream().findFirst().orElse(null); + PlanBlueprintEntity oldPlanBlueprintEntity = latestVersionDmpBlueprints.stream().findFirst().orElse(null); - data.setVersionStatus(DmpBlueprintVersionStatus.Current); + data.setVersionStatus(PlanBlueprintVersionStatus.Current); - if (oldDmpBlueprintEntity != null) { - data.setVersion((short) (oldDmpBlueprintEntity.getVersion() + 1)); + if (oldPlanBlueprintEntity != null) { + data.setVersion((short) (oldPlanBlueprintEntity.getVersion() + 1)); - oldDmpBlueprintEntity.setVersionStatus(DmpBlueprintVersionStatus.Previous); - this.entityManager.merge(oldDmpBlueprintEntity); + oldPlanBlueprintEntity.setVersionStatus(PlanBlueprintVersionStatus.Previous); + this.entityManager.merge(oldPlanBlueprintEntity); } else { data.setVersion((short) 1); } @@ -305,18 +305,18 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService { public void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException { logger.debug("deleting : {}", id); - this.authorizationService.authorizeForce(Permission.DeleteDmpBlueprint); + this.authorizationService.authorizeForce(Permission.DeletePlanBlueprint); - this.deleterFactory.deleter(DmpBlueprintDeleter.class).deleteAndSaveByIds(List.of(id)); + this.deleterFactory.deleter(PlanBlueprintDeleter.class).deleteAndSaveByIds(List.of(id)); } //endregion //region FieldInBlueprint - public boolean fieldInBlueprint(DmpBlueprintEntity dmpBlueprintEntity, DmpBlueprintSystemFieldType type) { + public boolean fieldInBlueprint(PlanBlueprintEntity planBlueprintEntity, PlanBlueprintSystemFieldType type) { - DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(DefinitionEntity.class, dmpBlueprintEntity.getDefinition()); + DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(DefinitionEntity.class, planBlueprintEntity.getDefinition()); if (definition == null || definition.getSections() == null) return false; @@ -324,7 +324,7 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService { if (section.getFields() == null) continue; for (FieldEntity field : section.getFields()) { - if (field.getCategory().equals(DmpBlueprintFieldCategory.System)) { + if (field.getCategory().equals(PlanBlueprintFieldCategory.System)) { SystemFieldEntity systemField = (SystemFieldEntity) field; if (systemField.getType().equals(type)) { return true; @@ -335,10 +335,10 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService { return false; } - public boolean fieldInBlueprint(UUID id, DmpBlueprintSystemFieldType type) throws InvalidApplicationException { - DmpBlueprintEntity data = this.entityManager.find(DmpBlueprintEntity.class, id, true); + public boolean fieldInBlueprint(UUID id, PlanBlueprintSystemFieldType type) throws InvalidApplicationException { + PlanBlueprintEntity data = this.entityManager.find(PlanBlueprintEntity.class, id, true); if (data == null) - throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, DmpBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale())); + throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, PlanBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale())); return this.fieldInBlueprint(data, type); } @@ -346,20 +346,20 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService { //region Clone - public DmpBlueprint buildClone(UUID id, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException { + public PlanBlueprint buildClone(UUID id, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException { logger.debug(new MapLogEntry("persisting data").And("id", id).And("fields", fields)); - this.authorizationService.authorizeForce(Permission.CloneDmpBlueprint); + this.authorizationService.authorizeForce(Permission.ClonePlanBlueprint); - DmpBlueprintQuery query = this.queryFactory.query(DmpBlueprintQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).ids(id); - DmpBlueprint model = this.builderFactory.builder(DmpBlueprintBuilder.class).authorize(AuthorizationFlags.AllExceptPublic).build(fields, query.firstAs(fields)); + PlanBlueprintQuery query = this.queryFactory.query(PlanBlueprintQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).ids(id); + PlanBlueprint model = this.builderFactory.builder(PlanBlueprintBuilder.class).authorize(AuthorizationFlags.AllExceptPublic).build(fields, query.firstAs(fields)); if (model == null) - throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, DmpBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale())); + throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, PlanBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale())); model.setLabel(model.getLabel() + " new "); model.setId(null); model.setHash(null); - model.setStatus(DmpBlueprintStatus.Draft); + model.setStatus(PlanBlueprintStatus.Draft); this.reassignDefinition(model.getDefinition()); return model; @@ -399,45 +399,45 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService { //region NewVersion @Override - public DmpBlueprint createNewVersion(NewVersionDmpBlueprintPersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, JAXBException { + public PlanBlueprint createNewVersion(NewVersionPlanBlueprintPersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, JAXBException { logger.debug(new MapLogEntry("persisting data dmpBlueprint").And("model", model).And("fields", fields)); - this.authorizationService.authorizeForce(Permission.CreateNewVersionDmpBlueprint); + this.authorizationService.authorizeForce(Permission.CreateNewVersionPlanBlueprint); - DmpBlueprintEntity oldDmpBlueprintEntity = this.entityManager.find(DmpBlueprintEntity.class, model.getId(), true); - if (oldDmpBlueprintEntity == null) - throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), DmpBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale())); - if (!this.conventionService.hashValue(oldDmpBlueprintEntity.getUpdatedAt()).equals(model.getHash())) + PlanBlueprintEntity oldPlanBlueprintEntity = this.entityManager.find(PlanBlueprintEntity.class, model.getId(), true); + if (oldPlanBlueprintEntity == null) + throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), PlanBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale())); + if (!this.conventionService.hashValue(oldPlanBlueprintEntity.getUpdatedAt()).equals(model.getHash())) throw new MyValidationException(this.errors.getHashConflict().getCode(), this.errors.getHashConflict().getMessage()); - if (!this.tenantScope.isSet() || !Objects.equals(oldDmpBlueprintEntity.getTenantId(), this.tenantScope.getTenant())) throw new MyForbiddenException(this.errors.getTenantTampering().getCode(), this.errors.getTenantTampering().getMessage()); + if (!this.tenantScope.isSet() || !Objects.equals(oldPlanBlueprintEntity.getTenantId(), this.tenantScope.getTenant())) throw new MyForbiddenException(this.errors.getTenantTampering().getCode(), this.errors.getTenantTampering().getMessage()); - List latestVersionDmpBlueprints = this.queryFactory.query(DmpBlueprintQuery.class) + List latestVersionDmpBlueprints = this.queryFactory.query(PlanBlueprintQuery.class) .disableTracking() - .versionStatuses(DmpBlueprintVersionStatus.Current) + .versionStatuses(PlanBlueprintVersionStatus.Current) .isActive(IsActive.Active) - .statuses(DmpBlueprintStatus.Finalized) - .groupIds(oldDmpBlueprintEntity.getGroupId()) + .statuses(PlanBlueprintStatus.Finalized) + .groupIds(oldPlanBlueprintEntity.getGroupId()) .collect(); if (latestVersionDmpBlueprints.isEmpty()) throw new MyValidationException(this.errors.getDmpIsNotFinalized().getCode(), this.errors.getDmpIsNotFinalized().getMessage()); if (latestVersionDmpBlueprints.size() > 1) throw new MyValidationException(this.errors.getMultipleDmpVersionsNotSupported().getCode(), this.errors.getMultipleDmpVersionsNotSupported().getMessage()); - if (!latestVersionDmpBlueprints.getFirst().getVersion().equals(oldDmpBlueprintEntity.getVersion())) throw new MyValidationException(this.errors.getDmpBlueprintNewVersionConflict().getCode(), this.errors.getDmpBlueprintNewVersionConflict().getMessage()); - Long notFinalizedCount = this.queryFactory.query(DmpBlueprintQuery.class) + if (!latestVersionDmpBlueprints.getFirst().getVersion().equals(oldPlanBlueprintEntity.getVersion())) throw new MyValidationException(this.errors.getDmpBlueprintNewVersionConflict().getCode(), this.errors.getDmpBlueprintNewVersionConflict().getMessage()); + Long notFinalizedCount = this.queryFactory.query(PlanBlueprintQuery.class) .disableTracking() - .versionStatuses(DmpBlueprintVersionStatus.NotFinalized) - .groupIds(oldDmpBlueprintEntity.getGroupId()) + .versionStatuses(PlanBlueprintVersionStatus.NotFinalized) + .groupIds(oldPlanBlueprintEntity.getGroupId()) .isActive(IsActive.Active) .count(); if (notFinalizedCount > 0) throw new MyValidationException(this.errors.getDmpBlueprintNewVersionAlreadyCreatedDraft().getCode(), this.errors.getDmpBlueprintNewVersionAlreadyCreatedDraft().getMessage()); - DmpBlueprintEntity data = new DmpBlueprintEntity(); + PlanBlueprintEntity data = new PlanBlueprintEntity(); data.setId(UUID.randomUUID()); data.setLabel(model.getLabel()); - data.setStatus(DmpBlueprintStatus.Draft); + data.setStatus(PlanBlueprintStatus.Draft); data.setDefinition(this.xmlHandlingService.toXml(this.buildDefinitionEntity(model.getDefinition()))); - data.setGroupId(oldDmpBlueprintEntity.getGroupId()); - data.setVersion((short) (oldDmpBlueprintEntity.getVersion() + 1)); - data.setVersionStatus(DmpBlueprintVersionStatus.NotFinalized); + data.setGroupId(oldPlanBlueprintEntity.getGroupId()); + data.setVersion((short) (oldPlanBlueprintEntity.getVersion() + 1)); + data.setVersionStatus(PlanBlueprintVersionStatus.NotFinalized); data.setCreatedAt(Instant.now()); data.setUpdatedAt(Instant.now()); data.setIsActive(IsActive.Active); @@ -446,11 +446,11 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService { this.entityManager.flush(); - this.updateVersionStatusAndSave(data, DmpBlueprintStatus.Draft, data.getStatus()); + this.updateVersionStatusAndSave(data, PlanBlueprintStatus.Draft, data.getStatus()); this.entityManager.flush(); - return this.builderFactory.builder(DmpBlueprintBuilder.class).authorize(AuthorizationFlags.AllExceptPublic).build(BaseFieldSet.build(fields, DmpBlueprint._id), data); + return this.builderFactory.builder(PlanBlueprintBuilder.class).authorize(AuthorizationFlags.AllExceptPublic).build(BaseFieldSet.build(fields, PlanBlueprint._id), data); } //endregion @@ -462,9 +462,9 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService { public BlueprintImportExport getExportXmlEntity(UUID id, boolean ignoreAuthorize) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException { logger.debug(new MapLogEntry("export xml").And("id", id)); - if (!ignoreAuthorize) this.authorizationService.authorizeForce(Permission.ExportDmpBlueprint); - DmpBlueprintEntity data = this.queryFactory.query(DmpBlueprintQuery.class).disableTracking().ids(id).authorize(AuthorizationFlags.AllExceptPublic).isActive(IsActive.Active).first(); - if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, DmpBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale())); + if (!ignoreAuthorize) this.authorizationService.authorizeForce(Permission.ExportPlanBlueprint); + PlanBlueprintEntity data = this.queryFactory.query(PlanBlueprintQuery.class).disableTracking().ids(id).authorize(AuthorizationFlags.AllExceptPublic).isActive(IsActive.Active).first(); + if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, PlanBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale())); return this.definitionXmlToExport(data); } @@ -473,22 +473,22 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService { @Override public ResponseEntity exportXml(UUID id) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, TransformerException, InvalidApplicationException { logger.debug(new MapLogEntry("export xml").And("id", id)); - DmpBlueprintEntity data = this.queryFactory.query(DmpBlueprintQuery.class).disableTracking().ids(id).authorize(AuthorizationFlags.AllExceptPublic).isActive(IsActive.Active).first(); - if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, DmpBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale())); + PlanBlueprintEntity data = this.queryFactory.query(PlanBlueprintQuery.class).disableTracking().ids(id).authorize(AuthorizationFlags.AllExceptPublic).isActive(IsActive.Active).first(); + if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, PlanBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale())); String xml = this.xmlHandlingService.toXml(this.getExportXmlEntity(id, false)); return this.responseUtilsService.buildResponseFileFromText(xml, data.getLabel() + ".xml"); } - private BlueprintImportExport definitionXmlToExport(DmpBlueprintEntity entity) throws JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException { + private BlueprintImportExport definitionXmlToExport(PlanBlueprintEntity entity) throws JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException { if (entity == null) return null; BlueprintImportExport xml = new BlueprintImportExport(); xml.setId(entity.getId()); xml.setLabel(entity.getLabel()); xml.setGroupId(entity.getGroupId()); - DefinitionEntity dmpDefinition = this.xmlHandlingService.fromXml(DefinitionEntity.class, entity.getDefinition()); - xml.setDmpBlueprintDefinition(this.definitionXmlToExport(dmpDefinition)); + DefinitionEntity planBlueprintDefinition = this.xmlHandlingService.fromXml(DefinitionEntity.class, entity.getDefinition()); + xml.setPlanBlueprintDefinition(this.definitionXmlToExport(planBlueprintDefinition)); return xml; } @@ -515,7 +515,7 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService { xml.setHasTemplates(entity.getHasTemplates()); List dmpBlueprintSystemFieldModels = new LinkedList<>(); if (!this.conventionService.isListNullOrEmpty(entity.getFields())) { - for (SystemFieldEntity systemField : entity.getFields().stream().filter(x -> x.getCategory() == DmpBlueprintFieldCategory.System).map(x -> (SystemFieldEntity) x).toList()) { + for (SystemFieldEntity systemField : entity.getFields().stream().filter(x -> x.getCategory() == PlanBlueprintFieldCategory.System).map(x -> (SystemFieldEntity) x).toList()) { dmpBlueprintSystemFieldModels.add(this.systemFieldXmlToExport(systemField)); } } @@ -523,7 +523,7 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService { List dmpBlueprintExtraFieldModels = new LinkedList<>(); if (!this.conventionService.isListNullOrEmpty(entity.getFields())) { - for (ExtraFieldEntity systemField : entity.getFields().stream().filter(x -> x.getCategory() == DmpBlueprintFieldCategory.Extra).map(x -> (ExtraFieldEntity) x).toList()) { + for (ExtraFieldEntity systemField : entity.getFields().stream().filter(x -> x.getCategory() == PlanBlueprintFieldCategory.Extra).map(x -> (ExtraFieldEntity) x).toList()) { dmpBlueprintExtraFieldModels.add(this.extraFieldXmlToExport(systemField)); } } @@ -531,7 +531,7 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService { List dmpBlueprintReferenceFieldModels = new LinkedList<>(); if (!this.conventionService.isListNullOrEmpty(entity.getFields())) { - for (ReferenceTypeFieldEntity referenceTypeFieldEntity : entity.getFields().stream().filter(x -> x.getCategory() == DmpBlueprintFieldCategory.ReferenceType).map(x -> (ReferenceTypeFieldEntity) x).toList()) { + for (ReferenceTypeFieldEntity referenceTypeFieldEntity : entity.getFields().stream().filter(x -> x.getCategory() == PlanBlueprintFieldCategory.ReferenceType).map(x -> (ReferenceTypeFieldEntity) x).toList()) { dmpBlueprintReferenceFieldModels.add(this.referenceFieldXmlToExport(referenceTypeFieldEntity)); } } @@ -623,57 +623,57 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService { //region Import @Override - public DmpBlueprint importXml(BlueprintImportExport dmpDefinition, UUID groupId, String label, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException { - logger.debug(new MapLogEntry("import data").And("dmpDefinition", dmpDefinition).And("label", label).And("fields", fields)); + public PlanBlueprint importXml(BlueprintImportExport planBlueprintDefinition, UUID groupId, String label, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException { + logger.debug(new MapLogEntry("import data").And("planBlueprintDefinition", planBlueprintDefinition).And("label", label).And("fields", fields)); - this.authorizationService.authorizeForce(Permission.ImportDmpBlueprint); + this.authorizationService.authorizeForce(Permission.ImportPlanBlueprint); - if (groupId == null) groupId = dmpDefinition.getGroupId(); + if (groupId == null) groupId = planBlueprintDefinition.getGroupId(); - long activeBlueprintForTheGroup = groupId != null ? this.queryFactory.query(DmpBlueprintQuery.class).disableTracking() + long activeBlueprintForTheGroup = groupId != null ? this.queryFactory.query(PlanBlueprintQuery.class).disableTracking() .isActive(IsActive.Active) .groupIds(groupId) .count() : 0; if (activeBlueprintForTheGroup == 0) { - DmpBlueprintPersist persist = new DmpBlueprintPersist(); + PlanBlueprintPersist persist = new PlanBlueprintPersist(); persist.setLabel(label); - persist.setStatus(DmpBlueprintStatus.Draft); - persist.setDefinition(this.xmlDefinitionToPersist(dmpDefinition.getDmpBlueprintDefinition())); + persist.setStatus(PlanBlueprintStatus.Draft); + persist.setDefinition(this.xmlDefinitionToPersist(planBlueprintDefinition.getPlanBlueprintDefinition())); - this.validatorFactory.validator(DmpBlueprintPersist.DmpBlueprintPersistValidator.class).validateForce(persist); + this.validatorFactory.validator(PlanBlueprintPersist.PlanBlueprintPersistValidator.class).validateForce(persist); return this.persist(persist, groupId, fields); } else { - DmpBlueprintEntity latestVersionDmpBlueprint = this.queryFactory.query(DmpBlueprintQuery.class) + PlanBlueprintEntity latestVersionDmpBlueprint = this.queryFactory.query(PlanBlueprintQuery.class) .disableTracking() - .versionStatuses(DmpBlueprintVersionStatus.Current) + .versionStatuses(PlanBlueprintVersionStatus.Current) .isActive(IsActive.Active) - .statuses(DmpBlueprintStatus.Finalized) + .statuses(PlanBlueprintStatus.Finalized) .groupIds(groupId) .first(); if (latestVersionDmpBlueprint == null) throw new MyValidationException(this.errors.getDmpIsNotFinalized().getCode(), this.errors.getDmpIsNotFinalized().getMessage()); - NewVersionDmpBlueprintPersist persist = new NewVersionDmpBlueprintPersist(); + NewVersionPlanBlueprintPersist persist = new NewVersionPlanBlueprintPersist(); persist.setId(latestVersionDmpBlueprint.getId()); persist.setLabel(label); - persist.setStatus(DmpBlueprintStatus.Draft); - persist.setDefinition(this.xmlDefinitionToPersist(dmpDefinition.getDmpBlueprintDefinition())); + persist.setStatus(PlanBlueprintStatus.Draft); + persist.setDefinition(this.xmlDefinitionToPersist(planBlueprintDefinition.getPlanBlueprintDefinition())); persist.setHash(this.conventionService.hashValue(latestVersionDmpBlueprint.getUpdatedAt())); - this.validatorFactory.validator(NewVersionDmpBlueprintPersist.NewVersionDmpBlueprintPersistValidator.class).validateForce(persist); + this.validatorFactory.validator(NewVersionPlanBlueprintPersist.NewVersionPlanBlueprintPersistValidator.class).validateForce(persist); return this.createNewVersion(persist, fields); } } @Override - public DmpBlueprint importXml(byte[] bytes, UUID groupId, String label, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException { + public PlanBlueprint importXml(byte[] bytes, UUID groupId, String label, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException { logger.debug(new MapLogEntry("import data").And("bytes", bytes).And("label", label).And("fields", fields)); - this.authorizationService.authorizeForce(Permission.ImportDmpBlueprint); + this.authorizationService.authorizeForce(Permission.ImportPlanBlueprint); - BlueprintImportExport dmpDefinition = this.xmlHandlingService.fromXml(BlueprintImportExport.class, new String(bytes, StandardCharsets.UTF_8)); + BlueprintImportExport planBlueprintDefinition = this.xmlHandlingService.fromXml(BlueprintImportExport.class, new String(bytes, StandardCharsets.UTF_8)); - return this.importXml(dmpDefinition, groupId, label, fields); + return this.importXml(planBlueprintDefinition, groupId, label, fields); } private DefinitionPersist xmlDefinitionToPersist(BlueprintDefinitionImportExport importXml) { @@ -757,7 +757,7 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService { private FieldPersist xmlExtraFieldToPersist(BlueprintExtraFieldImportExport importXml) { ExtraFieldPersist persist = new ExtraFieldPersist(); persist.setId(importXml.getId()); - persist.setCategory(DmpBlueprintFieldCategory.Extra); + persist.setCategory(PlanBlueprintFieldCategory.Extra); persist.setDataType(importXml.getType()); persist.setLabel(importXml.getLabel()); persist.setPlaceholder(importXml.getPlaceholder()); @@ -771,7 +771,7 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService { private FieldPersist xmlSystemFieldToPersist(BlueprintSystemFieldImportExport importXml) { SystemFieldPersist persist = new SystemFieldPersist(); persist.setId(importXml.getId()); - persist.setCategory(DmpBlueprintFieldCategory.System); + persist.setCategory(PlanBlueprintFieldCategory.System); persist.setSystemFieldType(importXml.getType()); persist.setLabel(importXml.getLabel()); persist.setPlaceholder(importXml.getPlaceholder()); @@ -792,7 +792,7 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService { ReferenceTypeFieldPersist persist = new ReferenceTypeFieldPersist(); persist.setId(importXml.getId()); - persist.setCategory(DmpBlueprintFieldCategory.ReferenceType); + persist.setCategory(PlanBlueprintFieldCategory.ReferenceType); persist.setReferenceTypeId(data.getId()); persist.setLabel(importXml.getLabel()); persist.setPlaceholder(importXml.getPlaceholder()); @@ -809,42 +809,42 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService { //region Import Common Model @Override - public DmpBlueprint importCommonModel(DmpBlueprintModel dmpDefinition, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException { - logger.debug(new MapLogEntry("import data").And("dmpDefinition", dmpDefinition).And("fields", fields)); + public PlanBlueprint importCommonModel(DmpBlueprintModel planDefinition, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException { + logger.debug(new MapLogEntry("import data").And("planDefinition", planDefinition).And("fields", fields)); - this.authorizationService.authorizeForce(Permission.ImportDmpBlueprint); + this.authorizationService.authorizeForce(Permission.ImportPlanBlueprint); - long activeBlueprintForTheGroup = dmpDefinition.getGroupId() != null ? this.queryFactory.query(DmpBlueprintQuery.class).disableTracking() + long activeBlueprintForTheGroup = planDefinition.getGroupId() != null ? this.queryFactory.query(PlanBlueprintQuery.class).disableTracking() .isActive(IsActive.Active) - .groupIds(dmpDefinition.getGroupId()) + .groupIds(planDefinition.getGroupId()) .count() : 0; if (activeBlueprintForTheGroup == 0) { - DmpBlueprintPersist persist = new DmpBlueprintPersist(); + PlanBlueprintPersist persist = new PlanBlueprintPersist(); - persist.setLabel(dmpDefinition.getLabel()); - persist.setStatus(DmpBlueprintStatus.Draft); - persist.setDefinition(this.commonModelDefinitionToPersist(dmpDefinition.getDefinition())); + persist.setLabel(planDefinition.getLabel()); + persist.setStatus(PlanBlueprintStatus.Draft); + persist.setDefinition(this.commonModelDefinitionToPersist(planDefinition.getDefinition())); - this.validatorFactory.validator(DmpBlueprintPersist.DmpBlueprintPersistValidator.class).validateForce(persist); - return this.persist(persist, dmpDefinition.getGroupId(), fields); + this.validatorFactory.validator(PlanBlueprintPersist.PlanBlueprintPersistValidator.class).validateForce(persist); + return this.persist(persist, planDefinition.getGroupId(), fields); } else { - DmpBlueprintEntity latestVersionDmpBlueprint = this.queryFactory.query(DmpBlueprintQuery.class) + PlanBlueprintEntity latestVersionDmpBlueprint = this.queryFactory.query(PlanBlueprintQuery.class) .disableTracking() - .versionStatuses(DmpBlueprintVersionStatus.Current) + .versionStatuses(PlanBlueprintVersionStatus.Current) .isActive(IsActive.Active) - .statuses(DmpBlueprintStatus.Finalized) - .groupIds(dmpDefinition.getGroupId()) + .statuses(PlanBlueprintStatus.Finalized) + .groupIds(planDefinition.getGroupId()) .first(); if (latestVersionDmpBlueprint == null) throw new MyValidationException(this.errors.getDmpIsNotFinalized().getCode(), this.errors.getDmpIsNotFinalized().getMessage()); - NewVersionDmpBlueprintPersist persist = new NewVersionDmpBlueprintPersist(); + NewVersionPlanBlueprintPersist persist = new NewVersionPlanBlueprintPersist(); persist.setId(latestVersionDmpBlueprint.getId()); - persist.setLabel(dmpDefinition.getLabel()); - persist.setStatus(DmpBlueprintStatus.Draft); - persist.setDefinition(this.commonModelDefinitionToPersist(dmpDefinition.getDefinition())); + persist.setLabel(planDefinition.getLabel()); + persist.setStatus(PlanBlueprintStatus.Draft); + persist.setDefinition(this.commonModelDefinitionToPersist(planDefinition.getDefinition())); persist.setHash(this.conventionService.hashValue(latestVersionDmpBlueprint.getUpdatedAt())); - this.validatorFactory.validator(NewVersionDmpBlueprintPersist.NewVersionDmpBlueprintPersistValidator.class).validateForce(persist); + this.validatorFactory.validator(NewVersionPlanBlueprintPersist.NewVersionPlanBlueprintPersistValidator.class).validateForce(persist); return this.createNewVersion(persist, fields); } } @@ -926,12 +926,12 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService { private FieldPersist commonExtraFieldToPersist(ExtraFieldModel commonModel) { ExtraFieldPersist persist = new ExtraFieldPersist(); persist.setId(commonModel.getId()); - persist.setCategory(DmpBlueprintFieldCategory.Extra); + persist.setCategory(PlanBlueprintFieldCategory.Extra); switch (commonModel.getDataType()){ - case Text -> persist.setDataType(DmpBlueprintExtraFieldDataType.Text); - case Date -> persist.setDataType(DmpBlueprintExtraFieldDataType.Date); - case Number -> persist.setDataType(DmpBlueprintExtraFieldDataType.Number); - case RichTex -> persist.setDataType(DmpBlueprintExtraFieldDataType.RichTex); + case Text -> persist.setDataType(PlanBlueprintExtraFieldDataType.Text); + case Date -> persist.setDataType(PlanBlueprintExtraFieldDataType.Date); + case Number -> persist.setDataType(PlanBlueprintExtraFieldDataType.Number); + case RichTex -> persist.setDataType(PlanBlueprintExtraFieldDataType.RichTex); default -> throw new InternalError("unknown type: " + commonModel.getDataType()); } persist.setLabel(commonModel.getLabel()); @@ -946,14 +946,14 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService { private FieldPersist commonModelSystemFieldToPersist(SystemFieldModel commonModel) { SystemFieldPersist persist = new SystemFieldPersist(); persist.setId(commonModel.getId()); - persist.setCategory(DmpBlueprintFieldCategory.System); + persist.setCategory(PlanBlueprintFieldCategory.System); switch (commonModel.getSystemFieldType()){ - case User -> persist.setSystemFieldType(DmpBlueprintSystemFieldType.User); - case AccessRights -> persist.setSystemFieldType(DmpBlueprintSystemFieldType.AccessRights); - case Contact -> persist.setSystemFieldType(DmpBlueprintSystemFieldType.Contact); - case Description -> persist.setSystemFieldType(DmpBlueprintSystemFieldType.Description); - case Language -> persist.setSystemFieldType(DmpBlueprintSystemFieldType.Language); - case Title -> persist.setSystemFieldType(DmpBlueprintSystemFieldType.Title); + case User -> persist.setSystemFieldType(PlanBlueprintSystemFieldType.User); + case AccessRights -> persist.setSystemFieldType(PlanBlueprintSystemFieldType.AccessRights); + case Contact -> persist.setSystemFieldType(PlanBlueprintSystemFieldType.Contact); + case Description -> persist.setSystemFieldType(PlanBlueprintSystemFieldType.Description); + case Language -> persist.setSystemFieldType(PlanBlueprintSystemFieldType.Language); + case Title -> persist.setSystemFieldType(PlanBlueprintSystemFieldType.Title); default -> throw new InternalError("unknown type: " + commonModel.getSystemFieldType()); } persist.setLabel(commonModel.getLabel()); @@ -975,7 +975,7 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService { ReferenceTypeFieldPersist persist = new ReferenceTypeFieldPersist(); persist.setId(commonModel.getId()); - persist.setCategory(DmpBlueprintFieldCategory.ReferenceType); + persist.setCategory(PlanBlueprintFieldCategory.ReferenceType); persist.setReferenceTypeId(data.getId()); persist.setLabel(commonModel.getLabel()); persist.setPlaceholder(commonModel.getPlaceholder()); diff --git a/backend/core/src/main/java/org/opencdmp/service/supportivematerial/SupportiveMaterialServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/supportivematerial/SupportiveMaterialServiceImpl.java index 2fa163b22..e730e75e0 100644 --- a/backend/core/src/main/java/org/opencdmp/service/supportivematerial/SupportiveMaterialServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/supportivematerial/SupportiveMaterialServiceImpl.java @@ -25,7 +25,7 @@ import org.opencdmp.model.builder.SupportiveMaterialBuilder; import org.opencdmp.model.deleter.SupportiveMaterialDeleter; import org.opencdmp.model.persist.SupportiveMaterialPersist; import org.opencdmp.query.SupportiveMaterialQuery; -import org.opencdmp.service.dmpblueprint.DmpBlueprintServiceImpl; +import org.opencdmp.service.planblueprint.PlanBlueprintServiceImpl; import org.opencdmp.service.storage.StorageFileService; import org.slf4j.LoggerFactory; import org.springframework.context.MessageSource; @@ -41,7 +41,7 @@ import java.util.UUID; @Service public class SupportiveMaterialServiceImpl implements SupportiveMaterialService{ - private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpBlueprintServiceImpl.class)); + private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PlanBlueprintServiceImpl.class)); private final TenantEntityManager entityManager; private final AuthorizationService authorizationService; private final DeleterFactory deleterFactory; diff --git a/backend/core/src/main/java/org/opencdmp/service/user/UserServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/user/UserServiceImpl.java index 685f2eab9..56511a810 100644 --- a/backend/core/src/main/java/org/opencdmp/service/user/UserServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/user/UserServiceImpl.java @@ -804,8 +804,8 @@ public class UserServiceImpl implements UserService { this.entityManager.merge(lock); } - List dmpUsers = this.queryFactory.query(DmpUserQuery.class).userIds(oldUser.getId()).collect(); - for (DmpUserEntity dmpUser : dmpUsers) { + List dmpUsers = this.queryFactory.query(PlanUserQuery.class).userIds(oldUser.getId()).collect(); + for (PlanUserEntity dmpUser : dmpUsers) { dmpUser.setUserId(newUser.getId()); this.entityManager.merge(dmpUser); } @@ -816,8 +816,8 @@ public class UserServiceImpl implements UserService { this.entityManager.merge(userDescriptionTemplate); } - List dmps = this.queryFactory.query(DmpQuery.class).creatorIds(oldUser.getId()).collect(); - for (DmpEntity dmp : dmps) { + List dmps = this.queryFactory.query(PlanQuery.class).creatorIds(oldUser.getId()).collect(); + for (PlanEntity dmp : dmps) { dmp.setCreatorId(newUser.getId()); this.entityManager.merge(dmp); } @@ -834,16 +834,16 @@ public class UserServiceImpl implements UserService { this.entityManager.flush(); - for (DmpEntity dmp : dmps) { - this.elasticService.persistDmp(dmp); + for (PlanEntity dmp : dmps) { + this.elasticService.persistPlan(dmp); } for (DescriptionEntity description : descriptions) { this.elasticService.persistDescription(description); } - for (DmpEntity dmp : dmps) { - this.annotationEntityTouchedIntegrationEventHandler.handleDmp(dmp.getId()); + for (PlanEntity dmp : dmps) { + this.annotationEntityTouchedIntegrationEventHandler.handlePlan(dmp.getId()); } for (DescriptionEntity description : descriptions) { diff --git a/backend/web/src/main/java/org/opencdmp/authorization/AffiliatedAuthorizationHandler.java b/backend/web/src/main/java/org/opencdmp/authorization/AffiliatedAuthorizationHandler.java index b12ed64d6..4b9a8cd20 100644 --- a/backend/web/src/main/java/org/opencdmp/authorization/AffiliatedAuthorizationHandler.java +++ b/backend/web/src/main/java/org/opencdmp/authorization/AffiliatedAuthorizationHandler.java @@ -4,7 +4,7 @@ import gr.cite.commons.web.authz.handler.AuthorizationHandler; import gr.cite.commons.web.authz.handler.AuthorizationHandlerContext; import gr.cite.commons.web.authz.policy.AuthorizationRequirement; import gr.cite.commons.web.oidc.principal.MyPrincipal; -import org.opencdmp.commons.enums.DmpUserRole; +import org.opencdmp.commons.enums.PlanUserRole; import org.opencdmp.commons.enums.UserDescriptionTemplateRole; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -37,14 +37,14 @@ public class AffiliatedAuthorizationHandler extends AuthorizationHandler dmpUserRoles = rs != null && rs.getDmpUserRoles() != null ? rs.getDmpUserRoles() : null; + HashSet planUserRoles = rs != null && rs.getPlanUserRoles() != null ? rs.getPlanUserRoles() : null; HashSet userDescriptionTemplateRoles = rs != null && rs.getUserDescriptionTemplateRoles() != null ? rs.getUserDescriptionTemplateRoles() : null; for (String permission : req.getRequiredPermissions()) { CustomPermissionAttributesProperties.MyPermission policy = this.myConfiguration.getMyPolicies().get(permission); - boolean hasDmpPermission = policy != null && this.hasPermission(policy.getDmp(), dmpUserRoles); + boolean hasPlanPermission = policy != null && this.hasPermission(policy.getDmp(), planUserRoles); boolean hasDescriptionTemplatePermission = policy != null && this.hasPermission(policy.getDescriptionTemplate(), userDescriptionTemplateRoles); - if (hasDmpPermission || hasDescriptionTemplatePermission) hits += 1; + if (hasPlanPermission || hasDescriptionTemplatePermission) hits += 1; } if ((req.getMatchAll() && req.getRequiredPermissions().size() == hits) || (!req.getMatchAll() && hits > 0)) return ACCESS_GRANTED; @@ -64,12 +64,12 @@ public class AffiliatedAuthorizationHandler extends AuthorizationHandler roles) { + private Boolean hasPermission(PlanRole planRole, HashSet roles) { if (roles == null) return Boolean.FALSE; - if (dmpRole == null || dmpRole.getRoles() == null) + if (planRole == null || planRole.getRoles() == null) return Boolean.FALSE; - for (DmpUserRole role : dmpRole.getRoles()) { + for (PlanUserRole role : planRole.getRoles()) { if (roles.contains(role)) return Boolean.TRUE; } diff --git a/backend/web/src/main/java/org/opencdmp/authorization/CustomPermissionAttributesProperties.java b/backend/web/src/main/java/org/opencdmp/authorization/CustomPermissionAttributesProperties.java index 5e6474aa3..66772bc55 100644 --- a/backend/web/src/main/java/org/opencdmp/authorization/CustomPermissionAttributesProperties.java +++ b/backend/web/src/main/java/org/opencdmp/authorization/CustomPermissionAttributesProperties.java @@ -23,17 +23,17 @@ public class CustomPermissionAttributesProperties { public static class MyPermission { - private final DmpRole dmp; + private final PlanRole dmp; private final DescriptionTemplateRole descriptionTemplate; @ConstructorBinding - public MyPermission(DmpRole dmp, DescriptionTemplateRole descriptionTemplate) { + public MyPermission(PlanRole dmp, DescriptionTemplateRole descriptionTemplate) { this.dmp = dmp; this.descriptionTemplate = descriptionTemplate; } - public DmpRole getDmp() { + public PlanRole getDmp() { return this.dmp; } diff --git a/backend/web/src/main/java/org/opencdmp/authorization/OwnedAuthorizationHandler.java b/backend/web/src/main/java/org/opencdmp/authorization/OwnedAuthorizationHandler.java index e998719c7..be75c42bb 100644 --- a/backend/web/src/main/java/org/opencdmp/authorization/OwnedAuthorizationHandler.java +++ b/backend/web/src/main/java/org/opencdmp/authorization/OwnedAuthorizationHandler.java @@ -1,6 +1,5 @@ package org.opencdmp.authorization; -import org.opencdmp.commons.enums.DmpUserRole; import org.opencdmp.commons.scope.user.UserScope; import gr.cite.commons.web.authz.handler.AuthorizationHandler; import gr.cite.commons.web.authz.handler.AuthorizationHandlerContext; @@ -9,9 +8,6 @@ import gr.cite.commons.web.oidc.principal.MyPrincipal; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.HashSet; -import java.util.List; - @Component("ownedAuthorizationHandler") public class OwnedAuthorizationHandler extends AuthorizationHandler { diff --git a/backend/web/src/main/java/org/opencdmp/authorization/DmpRole.java b/backend/web/src/main/java/org/opencdmp/authorization/PlanRole.java similarity index 52% rename from backend/web/src/main/java/org/opencdmp/authorization/DmpRole.java rename to backend/web/src/main/java/org/opencdmp/authorization/PlanRole.java index 7e65e09fd..803104e31 100644 --- a/backend/web/src/main/java/org/opencdmp/authorization/DmpRole.java +++ b/backend/web/src/main/java/org/opencdmp/authorization/PlanRole.java @@ -1,20 +1,20 @@ package org.opencdmp.authorization; -import org.opencdmp.commons.enums.DmpUserRole; +import org.opencdmp.commons.enums.PlanUserRole; import org.springframework.boot.context.properties.bind.ConstructorBinding; import java.util.Set; -public class DmpRole { - private final Set roles; +public class PlanRole { + private final Set roles; @ConstructorBinding - public DmpRole(Set roles) { + public PlanRole(Set roles) { this.roles = roles; } - public Set getRoles() { + public Set getRoles() { return this.roles; } diff --git a/backend/web/src/main/java/org/opencdmp/controllers/DescriptionController.java b/backend/web/src/main/java/org/opencdmp/controllers/DescriptionController.java index c6a25ae60..f89d8d0e8 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/DescriptionController.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/DescriptionController.java @@ -22,8 +22,8 @@ import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.xml.bind.JAXBException; import org.opencdmp.audit.AuditableAction; import org.opencdmp.authorization.AuthorizationFlags; -import org.opencdmp.commons.enums.DmpAccessType; -import org.opencdmp.commons.enums.DmpStatus; +import org.opencdmp.commons.enums.PlanAccessType; +import org.opencdmp.commons.enums.PlanStatus; import org.opencdmp.commons.enums.IsActive; import org.opencdmp.controllers.swagger.SwaggerHelpers; import org.opencdmp.controllers.swagger.annotation.OperationWithTenantHeader; @@ -40,11 +40,11 @@ import org.opencdmp.model.builder.description.DescriptionBuilder; import org.opencdmp.model.censorship.PublicDescriptionCensor; import org.opencdmp.model.censorship.description.DescriptionCensor; import org.opencdmp.model.description.Description; -import org.opencdmp.model.dmpblueprint.DmpBlueprint; +import org.opencdmp.model.planblueprint.PlanBlueprint; import org.opencdmp.model.persist.*; import org.opencdmp.model.result.QueryResult; import org.opencdmp.query.DescriptionQuery; -import org.opencdmp.query.DmpQuery; +import org.opencdmp.query.PlanQuery; import org.opencdmp.query.lookup.DescriptionLookup; import org.opencdmp.service.description.DescriptionService; import org.opencdmp.service.elastic.ElasticQueryHelperService; @@ -148,7 +148,7 @@ public class DescriptionController { this.censorFactory.censor(PublicDescriptionCensor.class).censor(fieldSet); - DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(EnumSet.of(Public)).ids(id).dmpSubQuery(this.queryFactory.query(DmpQuery.class).isActive(IsActive.Active).statuses(DmpStatus.Finalized).accessTypes(DmpAccessType.Public)); + DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(EnumSet.of(Public)).ids(id).dmpSubQuery(this.queryFactory.query(PlanQuery.class).isActive(IsActive.Active).statuses(PlanStatus.Finalized).accessTypes(PlanAccessType.Public)); PublicDescription model = this.builderFactory.builder(PublicDescriptionBuilder.class).authorize(EnumSet.of(Public)).build(fieldSet, query.firstAs(fieldSet)); if (model == null) @@ -424,11 +424,11 @@ public class DescriptionController { public @ResponseBody ResponseEntity getXml( @Parameter(name = "id", description = "The id of a description to export", example = "c0c163dc-2965-45a5-9608-f76030578609", required = true) @PathVariable UUID id ) throws JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException { - logger.debug(new MapLogEntry("export" + DmpBlueprint.class.getSimpleName()).And("id", id)); + logger.debug(new MapLogEntry("export" + PlanBlueprint.class.getSimpleName()).And("id", id)); ResponseEntity response = this.descriptionService.exportXml(id); - this.auditService.track(AuditableAction.DmpBlueprint_GetXml, Map.ofEntries( + this.auditService.track(AuditableAction.PlanBlueprint_GetXml, Map.ofEntries( new AbstractMap.SimpleEntry("id", id) )); return response; diff --git a/backend/web/src/main/java/org/opencdmp/controllers/DescriptionTemplateController.java b/backend/web/src/main/java/org/opencdmp/controllers/DescriptionTemplateController.java index 0dcc5e3c6..dc82bdf75 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/DescriptionTemplateController.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/DescriptionTemplateController.java @@ -31,9 +31,9 @@ import org.opencdmp.controllers.swagger.annotation.SwaggerCommonErrorResponses; import org.opencdmp.data.DescriptionTemplateEntity; import org.opencdmp.model.builder.descriptiontemplate.DescriptionTemplateBuilder; import org.opencdmp.model.censorship.descriptiontemplate.DescriptionTemplateCensor; -import org.opencdmp.model.censorship.dmpblueprint.DmpBlueprintCensor; +import org.opencdmp.model.censorship.planblueprint.PlanBlueprintCensor; import org.opencdmp.model.descriptiontemplate.DescriptionTemplate; -import org.opencdmp.model.dmpblueprint.DmpBlueprint; +import org.opencdmp.model.planblueprint.PlanBlueprint; import org.opencdmp.model.persist.DescriptionTemplatePersist; import org.opencdmp.model.persist.NewVersionDescriptionTemplatePersist; import org.opencdmp.model.result.QueryResult; @@ -218,10 +218,10 @@ public class DescriptionTemplateController { @Parameter(name = "id", description = "The id of a description template to clone", example = "c0c163dc-2965-45a5-9608-f76030578609", required = true) @PathVariable("id") UUID id, @Parameter(name = "fieldSet", description = SwaggerHelpers.Commons.fieldset_description, required = true) FieldSet fieldSet ) throws MyApplicationException, MyForbiddenException, MyNotFoundException { - logger.debug(new MapLogEntry("clone" + DmpBlueprint.class.getSimpleName()).And("id", id).And("fields", fieldSet)); + logger.debug(new MapLogEntry("clone" + PlanBlueprint.class.getSimpleName()).And("id", id).And("fields", fieldSet)); fieldSet = this.fieldSetExpanderService.expand(fieldSet); - this.censorFactory.censor(DmpBlueprintCensor.class).censor(fieldSet, null); + this.censorFactory.censor(PlanBlueprintCensor.class).censor(fieldSet, null); DescriptionTemplate model = this.descriptionTemplateTypeService.buildClone(id, fieldSet); diff --git a/backend/web/src/main/java/org/opencdmp/controllers/MaintenanceController.java b/backend/web/src/main/java/org/opencdmp/controllers/MaintenanceController.java index d2e103a8b..1d2e34875 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/MaintenanceController.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/MaintenanceController.java @@ -45,7 +45,7 @@ public class MaintenanceController { logger.debug("generate elastic "); this.authorizationService.authorizeForce(Permission.ManageElastic); - this.elasticService.resetDmpIndex(); + this.elasticService.resetPlanIndex(); this.elasticService.resetDescriptionIndex(); this.auditService.track(AuditableAction.Maintenance_GenerateElastic); @@ -57,7 +57,7 @@ public class MaintenanceController { this.authorizationService.authorizeForce(Permission.ManageElastic); this.elasticService.deleteDescriptionIndex(); - this.elasticService.deleteDmpIndex(); + this.elasticService.deletePlanIndex(); this.auditService.track(AuditableAction.Maintenance_ClearElastic); } @@ -89,7 +89,7 @@ public class MaintenanceController { this.maintenanceService.sendDmpTouchEvents(); - this.auditService.track(AuditableAction.Maintenance_SendDmpTouchEvents); + this.auditService.track(AuditableAction.Maintenance_SendPlanTouchEvents); } @RequestMapping(method = RequestMethod.POST, value = "/events/descriptions/touch") diff --git a/backend/web/src/main/java/org/opencdmp/controllers/PlanBlueprintController.java b/backend/web/src/main/java/org/opencdmp/controllers/PlanBlueprintController.java index 90fa400f0..8ec72dc52 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/PlanBlueprintController.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/PlanBlueprintController.java @@ -28,16 +28,16 @@ import org.opencdmp.controllers.swagger.annotation.OperationWithTenantHeader; import org.opencdmp.controllers.swagger.annotation.Swagger400; import org.opencdmp.controllers.swagger.annotation.Swagger404; import org.opencdmp.controllers.swagger.annotation.SwaggerCommonErrorResponses; -import org.opencdmp.data.DmpBlueprintEntity; -import org.opencdmp.model.builder.dmpblueprint.DmpBlueprintBuilder; -import org.opencdmp.model.censorship.dmpblueprint.DmpBlueprintCensor; -import org.opencdmp.model.dmpblueprint.DmpBlueprint; -import org.opencdmp.model.persist.DmpBlueprintPersist; -import org.opencdmp.model.persist.NewVersionDmpBlueprintPersist; +import org.opencdmp.data.PlanBlueprintEntity; +import org.opencdmp.model.builder.planblueprint.PlanBlueprintBuilder; +import org.opencdmp.model.censorship.planblueprint.PlanBlueprintCensor; +import org.opencdmp.model.persist.NewVersionPlanBlueprintPersist; +import org.opencdmp.model.persist.PlanBlueprintPersist; +import org.opencdmp.model.planblueprint.PlanBlueprint; import org.opencdmp.model.result.QueryResult; -import org.opencdmp.query.DmpBlueprintQuery; -import org.opencdmp.query.lookup.DmpBlueprintLookup; -import org.opencdmp.service.dmpblueprint.DmpBlueprintService; +import org.opencdmp.query.PlanBlueprintQuery; +import org.opencdmp.query.lookup.PlanBlueprintLookup; +import org.opencdmp.service.planblueprint.PlanBlueprintService; import org.slf4j.LoggerFactory; import org.springframework.context.MessageSource; import org.springframework.context.i18n.LocaleContextHolder; @@ -56,7 +56,7 @@ import java.util.Map; import java.util.UUID; @RestController -@RequestMapping(path = "api/dmp-blueprint") +@RequestMapping(path = "api/plan-blueprint") @Tag(name = "Plan Blueprints", description = "Manage plan blueprints") @SwaggerCommonErrorResponses public class PlanBlueprintController { @@ -67,7 +67,7 @@ public class PlanBlueprintController { private final AuditService auditService; - private final DmpBlueprintService dmpBlueprintService; + private final PlanBlueprintService planBlueprintService; private final CensorFactory censorFactory; @@ -78,13 +78,13 @@ public class PlanBlueprintController { public PlanBlueprintController( BuilderFactory builderFactory, AuditService auditService, - DmpBlueprintService dmpBlueprintService, + PlanBlueprintService planBlueprintService, CensorFactory censorFactory, QueryFactory queryFactory, MessageSource messageSource) { this.builderFactory = builderFactory; this.auditService = auditService; - this.dmpBlueprintService = dmpBlueprintService; + this.planBlueprintService = planBlueprintService; this.censorFactory = censorFactory; this.queryFactory = queryFactory; this.messageSource = messageSource; @@ -102,7 +102,7 @@ public class PlanBlueprintController { )), responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content( array = @ArraySchema( schema = @Schema( - implementation = DmpBlueprint.class + implementation = PlanBlueprint.class ) ), examples = @ExampleObject( @@ -110,17 +110,17 @@ public class PlanBlueprintController { description = "Example with the first page of paginated results", value = SwaggerHelpers.PlanBlueprint.endpoint_query_response_example )))) - public QueryResult query(@RequestBody DmpBlueprintLookup lookup) throws MyApplicationException, MyForbiddenException { - logger.debug("querying {}", DmpBlueprint.class.getSimpleName()); + public QueryResult query(@RequestBody PlanBlueprintLookup lookup) throws MyApplicationException, MyForbiddenException { + logger.debug("querying {}", PlanBlueprint.class.getSimpleName()); - this.censorFactory.censor(DmpBlueprintCensor.class).censor(lookup.getProject(), null); - DmpBlueprintQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.AllExceptPublic); + this.censorFactory.censor(PlanBlueprintCensor.class).censor(lookup.getProject(), null); + PlanBlueprintQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.AllExceptPublic); - List data = query.collectAs(lookup.getProject()); - List models = this.builderFactory.builder(DmpBlueprintBuilder.class).authorize(AuthorizationFlags.AllExceptPublic).build(lookup.getProject(), data); + List data = query.collectAs(lookup.getProject()); + List models = this.builderFactory.builder(PlanBlueprintBuilder.class).authorize(AuthorizationFlags.AllExceptPublic).build(lookup.getProject(), data); long count = (lookup.getMetadata() != null && lookup.getMetadata().getCountAll()) ? query.count() : models.size(); - this.auditService.track(AuditableAction.DmpBlueprint_Query, "lookup", lookup); + this.auditService.track(AuditableAction.PlanBlueprint_Query, "lookup", lookup); return new QueryResult<>(models, count); } @@ -129,24 +129,24 @@ public class PlanBlueprintController { @OperationWithTenantHeader(summary = "Fetch a specific plan blueprint by id", description = "", responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content( schema = @Schema( - implementation = DmpBlueprint.class + implementation = PlanBlueprint.class )) )) @Swagger404 - public DmpBlueprint get( + public PlanBlueprint get( @Parameter(name = "id", description = "The id of a plan blueprint to fetch", example = "c0c163dc-2965-45a5-9608-f76030578609", required = true) @PathVariable("id") UUID id, @Parameter(name = "fieldSet", description = SwaggerHelpers.Commons.fieldset_description, required = true) FieldSet fieldSet ) throws MyApplicationException, MyForbiddenException, MyNotFoundException { - logger.debug(new MapLogEntry("retrieving" + DmpBlueprint.class.getSimpleName()).And("id", id).And("fields", fieldSet)); + logger.debug(new MapLogEntry("retrieving" + PlanBlueprint.class.getSimpleName()).And("id", id).And("fields", fieldSet)); - this.censorFactory.censor(DmpBlueprintCensor.class).censor(fieldSet, null); + this.censorFactory.censor(PlanBlueprintCensor.class).censor(fieldSet, null); - DmpBlueprintQuery query = this.queryFactory.query(DmpBlueprintQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).ids(id); - DmpBlueprint model = this.builderFactory.builder(DmpBlueprintBuilder.class).authorize(AuthorizationFlags.AllExceptPublic).build(fieldSet, query.firstAs(fieldSet)); + PlanBlueprintQuery query = this.queryFactory.query(PlanBlueprintQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).ids(id); + PlanBlueprint model = this.builderFactory.builder(PlanBlueprintBuilder.class).authorize(AuthorizationFlags.AllExceptPublic).build(fieldSet, query.firstAs(fieldSet)); if (model == null) - throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, DmpBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale())); + throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, PlanBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale())); - this.auditService.track(AuditableAction.DmpBlueprint_Lookup, Map.ofEntries( + this.auditService.track(AuditableAction.PlanBlueprint_Lookup, Map.ofEntries( new AbstractMap.SimpleEntry("id", id), new AbstractMap.SimpleEntry("fields", fieldSet) )); @@ -158,23 +158,23 @@ public class PlanBlueprintController { @OperationWithTenantHeader(summary = "Create a new or update an existing plan blueprint", description = "", responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content( schema = @Schema( - implementation = DmpBlueprint.class + implementation = PlanBlueprint.class )) )) @Swagger400 @Swagger404 @Transactional - @ValidationFilterAnnotation(validator = DmpBlueprintPersist.DmpBlueprintPersistValidator.ValidatorName, argumentName = "model") - public DmpBlueprint persist( - @RequestBody DmpBlueprintPersist model, + @ValidationFilterAnnotation(validator = PlanBlueprintPersist.PlanBlueprintPersistValidator.ValidatorName, argumentName = "model") + public PlanBlueprint persist( + @RequestBody PlanBlueprintPersist model, @Parameter(name = "fieldSet", description = SwaggerHelpers.Commons.fieldset_description, required = true) FieldSet fieldSet ) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, JsonProcessingException, TransformerException { - logger.debug(new MapLogEntry("persisting" + DmpBlueprint.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet)); - this.censorFactory.censor(DmpBlueprintCensor.class).censor(fieldSet, null); + logger.debug(new MapLogEntry("persisting" + PlanBlueprint.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet)); + this.censorFactory.censor(PlanBlueprintCensor.class).censor(fieldSet, null); - DmpBlueprint persisted = this.dmpBlueprintService.persist(model, null, fieldSet); + PlanBlueprint persisted = this.planBlueprintService.persist(model, null, fieldSet); - this.auditService.track(AuditableAction.DmpBlueprint_Persist, Map.ofEntries( + this.auditService.track(AuditableAction.PlanBlueprint_Persist, Map.ofEntries( new AbstractMap.SimpleEntry("model", model), new AbstractMap.SimpleEntry("fields", fieldSet) )); @@ -190,32 +190,32 @@ public class PlanBlueprintController { public void delete( @Parameter(name = "id", description = "The id of a plan blueprint to delete", example = "c0c163dc-2965-45a5-9608-f76030578609", required = true) @PathVariable("id") UUID id ) throws MyForbiddenException, InvalidApplicationException { - logger.debug(new MapLogEntry("retrieving" + DmpBlueprint.class.getSimpleName()).And("id", id)); + logger.debug(new MapLogEntry("retrieving" + PlanBlueprint.class.getSimpleName()).And("id", id)); - this.dmpBlueprintService.deleteAndSave(id); + this.planBlueprintService.deleteAndSave(id); - this.auditService.track(AuditableAction.DmpBlueprint_Delete, "id", id); + this.auditService.track(AuditableAction.PlanBlueprint_Delete, "id", id); } @GetMapping("clone/{id}") @OperationWithTenantHeader(summary = "Clone a plan blueprint by id", description = "", responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content( schema = @Schema( - implementation = DmpBlueprint.class + implementation = PlanBlueprint.class )) )) @Swagger404 - public DmpBlueprint buildClone( + public PlanBlueprint buildClone( @Parameter(name = "id", description = "The id of a plan blueprint to clone", example = "c0c163dc-2965-45a5-9608-f76030578609", required = true) @PathVariable("id") UUID id, @Parameter(name = "fieldSet", description = SwaggerHelpers.Commons.fieldset_description, required = true) FieldSet fieldSet ) throws MyApplicationException, MyForbiddenException, MyNotFoundException { - logger.debug(new MapLogEntry("clone" + DmpBlueprint.class.getSimpleName()).And("id", id).And("fields", fieldSet)); + logger.debug(new MapLogEntry("clone" + PlanBlueprint.class.getSimpleName()).And("id", id).And("fields", fieldSet)); - this.censorFactory.censor(DmpBlueprintCensor.class).censor(fieldSet, null); + this.censorFactory.censor(PlanBlueprintCensor.class).censor(fieldSet, null); - DmpBlueprint model = this.dmpBlueprintService.buildClone(id, fieldSet); + PlanBlueprint model = this.planBlueprintService.buildClone(id, fieldSet); - this.auditService.track(AuditableAction.DmpBlueprint_Clone, Map.ofEntries( + this.auditService.track(AuditableAction.PlanBlueprint_Clone, Map.ofEntries( new AbstractMap.SimpleEntry("id", id), new AbstractMap.SimpleEntry("fields", fieldSet) )); @@ -227,21 +227,21 @@ public class PlanBlueprintController { @OperationWithTenantHeader(summary = "Create a new version of an existing plan blueprint", description = "", responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content( schema = @Schema( - implementation = DmpBlueprint.class + implementation = PlanBlueprint.class )) )) @Swagger400 @Swagger404 @Transactional - @ValidationFilterAnnotation(validator = NewVersionDmpBlueprintPersist.NewVersionDmpBlueprintPersistValidator.ValidatorName, argumentName = "model") - public DmpBlueprint createNewVersion( - @RequestBody NewVersionDmpBlueprintPersist model, + @ValidationFilterAnnotation(validator = NewVersionPlanBlueprintPersist.NewVersionPlanBlueprintPersistValidator.ValidatorName, argumentName = "model") + public PlanBlueprint createNewVersion( + @RequestBody NewVersionPlanBlueprintPersist model, @Parameter(name = "fieldSet", description = SwaggerHelpers.Commons.fieldset_description, required = true) FieldSet fieldSet ) throws JAXBException, InvalidApplicationException, ParserConfigurationException, JsonProcessingException, TransformerException { - logger.debug(new MapLogEntry("persisting" + NewVersionDmpBlueprintPersist.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet)); - DmpBlueprint persisted = this.dmpBlueprintService.createNewVersion(model, fieldSet); + logger.debug(new MapLogEntry("persisting" + NewVersionPlanBlueprintPersist.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet)); + PlanBlueprint persisted = this.planBlueprintService.createNewVersion(model, fieldSet); - this.auditService.track(AuditableAction.DmpBlueprint_PersistNewVersion, Map.ofEntries( + this.auditService.track(AuditableAction.PlanBlueprint_PersistNewVersion, Map.ofEntries( new AbstractMap.SimpleEntry("model", model), new AbstractMap.SimpleEntry("fields", fieldSet) )); @@ -256,11 +256,11 @@ public class PlanBlueprintController { public @ResponseBody ResponseEntity getXml( @Parameter(name = "id", description = "The id of a plan blueprint to export", example = "c0c163dc-2965-45a5-9608-f76030578609", required = true) @PathVariable UUID id ) throws JAXBException, ParserConfigurationException, IOException, TransformerException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException { - logger.debug(new MapLogEntry("export" + DmpBlueprint.class.getSimpleName()).And("id", id)); + logger.debug(new MapLogEntry("export" + PlanBlueprint.class.getSimpleName()).And("id", id)); - ResponseEntity response = this.dmpBlueprintService.exportXml(id); + ResponseEntity response = this.planBlueprintService.exportXml(id); - this.auditService.track(AuditableAction.DmpBlueprint_GetXml, Map.ofEntries( + this.auditService.track(AuditableAction.PlanBlueprint_GetXml, Map.ofEntries( new AbstractMap.SimpleEntry("id", id) )); return response; @@ -270,22 +270,22 @@ public class PlanBlueprintController { @OperationWithTenantHeader(summary = "Import a plan blueprint from an xml file", description = "", responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content( schema = @Schema( - implementation = DmpBlueprint.class + implementation = PlanBlueprint.class )) )) @Transactional - public DmpBlueprint importXml( + public PlanBlueprint importXml( @RequestParam("file") MultipartFile file, @Parameter(name = "groupId", description = "The group id of a plan blueprint to import. This is optional.", example = "c0c163dc-2965-45a5-9608-f76030578609") @PathVariable(value = "groupId", required = false) UUID groupId, @Parameter(name = "fieldSet", description = SwaggerHelpers.Commons.fieldset_description, required = true) FieldSet fieldSet ) throws IOException, JAXBException, InvalidApplicationException, ParserConfigurationException, TransformerException, InstantiationException, IllegalAccessException, SAXException { - logger.debug(new MapLogEntry("clone" + DmpBlueprint.class.getSimpleName()).And("file", file)); + logger.debug(new MapLogEntry("clone" + PlanBlueprint.class.getSimpleName()).And("file", file)); - this.censorFactory.censor(DmpBlueprintCensor.class).censor(fieldSet, null); + this.censorFactory.censor(PlanBlueprintCensor.class).censor(fieldSet, null); - DmpBlueprint model = this.dmpBlueprintService.importXml(file.getBytes(), groupId, file.getOriginalFilename(), fieldSet); + PlanBlueprint model = this.planBlueprintService.importXml(file.getBytes(), groupId, file.getOriginalFilename(), fieldSet); - this.auditService.track(AuditableAction.DmpBlueprint_Import, Map.ofEntries( + this.auditService.track(AuditableAction.PlanBlueprint_Import, Map.ofEntries( new AbstractMap.SimpleEntry("file", file), new AbstractMap.SimpleEntry("fields", fieldSet) )); diff --git a/backend/web/src/main/java/org/opencdmp/controllers/PlanController.java b/backend/web/src/main/java/org/opencdmp/controllers/PlanController.java index f0111f630..e182809c7 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/PlanController.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/PlanController.java @@ -22,9 +22,9 @@ import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.xml.bind.JAXBException; import org.opencdmp.audit.AuditableAction; import org.opencdmp.authorization.AuthorizationFlags; -import org.opencdmp.commons.enums.DmpAccessType; -import org.opencdmp.commons.enums.DmpStatus; import org.opencdmp.commons.enums.IsActive; +import org.opencdmp.commons.enums.PlanAccessType; +import org.opencdmp.commons.enums.PlanStatus; import org.opencdmp.controllers.swagger.SwaggerHelpers; import org.opencdmp.controllers.swagger.annotation.OperationWithTenantHeader; import org.opencdmp.controllers.swagger.annotation.Swagger400; @@ -32,20 +32,20 @@ import org.opencdmp.controllers.swagger.annotation.Swagger404; import org.opencdmp.controllers.swagger.annotation.SwaggerCommonErrorResponses; import org.opencdmp.filetransformerbase.models.misc.PreprocessingDmpModel; import org.opencdmp.model.DescriptionsToBeFinalized; -import org.opencdmp.model.DmpUser; -import org.opencdmp.model.DmpValidationResult; -import org.opencdmp.model.PublicDmp; -import org.opencdmp.model.builder.PublicDmpBuilder; -import org.opencdmp.model.builder.dmp.DmpBuilder; -import org.opencdmp.model.censorship.PublicDmpCensor; -import org.opencdmp.model.censorship.dmp.DmpCensor; -import org.opencdmp.model.dmp.Dmp; +import org.opencdmp.model.PlanUser; +import org.opencdmp.model.PlanValidationResult; +import org.opencdmp.model.PublicPlan; +import org.opencdmp.model.builder.PublicPlanBuilder; +import org.opencdmp.model.builder.plan.PlanBuilder; +import org.opencdmp.model.censorship.PublicPlanCensor; +import org.opencdmp.model.censorship.plan.PlanCensor; import org.opencdmp.model.persist.*; +import org.opencdmp.model.plan.Plan; import org.opencdmp.model.result.QueryResult; -import org.opencdmp.query.DmpQuery; -import org.opencdmp.query.lookup.DmpLookup; -import org.opencdmp.service.dmp.DmpService; +import org.opencdmp.query.PlanQuery; +import org.opencdmp.query.lookup.PlanLookup; import org.opencdmp.service.elastic.ElasticQueryHelperService; +import org.opencdmp.service.plan.PlanService; import org.slf4j.LoggerFactory; import org.springframework.context.MessageSource; import org.springframework.context.i18n.LocaleContextHolder; @@ -70,7 +70,7 @@ import java.util.*; import static org.opencdmp.authorization.AuthorizationFlags.Public; @RestController -@RequestMapping(path = "api/dmp") +@RequestMapping(path = "api/plan") @Tag(name = "Plans", description = "Manage plans") @SwaggerCommonErrorResponses public class PlanController { @@ -81,7 +81,7 @@ public class PlanController { private final AuditService auditService; - private final DmpService dmpService; + private final PlanService planService; private final CensorFactory censorFactory; @@ -94,14 +94,14 @@ public class PlanController { public PlanController( BuilderFactory builderFactory, AuditService auditService, - DmpService dmpService, + PlanService planService, CensorFactory censorFactory, QueryFactory queryFactory, MessageSource messageSource, ElasticQueryHelperService elasticQueryHelperService) { this.builderFactory = builderFactory; this.auditService = auditService; - this.dmpService = dmpService; + this.planService = planService; this.censorFactory = censorFactory; this.queryFactory = queryFactory; this.messageSource = messageSource; @@ -111,15 +111,15 @@ public class PlanController { @PostMapping("public/query") @OperationWithTenantHeader(summary = "Query public published plans") @Hidden - public QueryResult publicQuery(@RequestBody DmpLookup lookup) throws MyApplicationException, MyForbiddenException { - logger.debug("querying {}", Dmp.class.getSimpleName()); + public QueryResult publicQuery(@RequestBody PlanLookup lookup) throws MyApplicationException, MyForbiddenException { + logger.debug("querying {}", Plan.class.getSimpleName()); - this.censorFactory.censor(PublicDmpCensor.class).censor(lookup.getProject()); + this.censorFactory.censor(PublicPlanCensor.class).censor(lookup.getProject()); //DmpQuery query = lookup.enrich(this.queryFactory).authorize(EnumSet.of(Public)).dmpSubQuery(this.queryFactory.query(DmpQuery.class).isActive(IsActive.Active).statuses(DmpStatus.Finalized).accessTypes(DmpAccessType.Public)); - QueryResult queryResult = this.elasticQueryHelperService.collectPublic(lookup, EnumSet.of(Public), null); + QueryResult queryResult = this.elasticQueryHelperService.collectPublic(lookup, EnumSet.of(Public), null); - this.auditService.track(AuditableAction.Dmp_PublicQuery, "lookup", lookup); + this.auditService.track(AuditableAction.Plan_PublicQuery, "lookup", lookup); return queryResult; } @@ -127,18 +127,18 @@ public class PlanController { @GetMapping("public/{id}") @OperationWithTenantHeader(summary = "Fetch a specific public published plan by id") @Hidden - public PublicDmp publicGet(@PathVariable("id") UUID id, FieldSet fieldSet, Locale locale) throws MyApplicationException, MyForbiddenException, MyNotFoundException { - logger.debug(new MapLogEntry("retrieving" + Dmp.class.getSimpleName()).And("id", id).And("fields", fieldSet)); + public PublicPlan publicGet(@PathVariable("id") UUID id, FieldSet fieldSet, Locale locale) throws MyApplicationException, MyForbiddenException, MyNotFoundException { + logger.debug(new MapLogEntry("retrieving" + Plan.class.getSimpleName()).And("id", id).And("fields", fieldSet)); - this.censorFactory.censor(PublicDmpCensor.class).censor(fieldSet); + this.censorFactory.censor(PublicPlanCensor.class).censor(fieldSet); - DmpQuery query = this.queryFactory.query(DmpQuery.class).disableTracking().authorize(EnumSet.of(Public)).ids(id).isActive(IsActive.Active).statuses(DmpStatus.Finalized).accessTypes(DmpAccessType.Public); + PlanQuery query = this.queryFactory.query(PlanQuery.class).disableTracking().authorize(EnumSet.of(Public)).ids(id).isActive(IsActive.Active).statuses(PlanStatus.Finalized).accessTypes(PlanAccessType.Public); - PublicDmp model = this.builderFactory.builder(PublicDmpBuilder.class).authorize(EnumSet.of(Public)).build(fieldSet, query.firstAs(fieldSet)); + PublicPlan model = this.builderFactory.builder(PublicPlanBuilder.class).authorize(EnumSet.of(Public)).build(fieldSet, query.firstAs(fieldSet)); if (model == null) - throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale())); + throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Plan.class.getSimpleName()}, LocaleContextHolder.getLocale())); - this.auditService.track(AuditableAction.Dmp_PublicLookup, Map.ofEntries( + this.auditService.track(AuditableAction.Plan_PublicLookup, Map.ofEntries( new AbstractMap.SimpleEntry("id", id), new AbstractMap.SimpleEntry("fields", fieldSet) )); @@ -158,7 +158,7 @@ public class PlanController { )), responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content( array = @ArraySchema( schema = @Schema( - implementation = Dmp.class + implementation = Plan.class ) ), examples = @ExampleObject( @@ -166,14 +166,14 @@ public class PlanController { description = "Example with the first page of paginated results", value = SwaggerHelpers.Plan.endpoint_query_response_example )))) - public QueryResult Query(@RequestBody DmpLookup lookup) throws MyApplicationException, MyForbiddenException { - logger.debug("querying {}", Dmp.class.getSimpleName()); + public QueryResult Query(@RequestBody PlanLookup lookup) throws MyApplicationException, MyForbiddenException { + logger.debug("querying {}", Plan.class.getSimpleName()); - this.censorFactory.censor(DmpCensor.class).censor(lookup.getProject(), null); + this.censorFactory.censor(PlanCensor.class).censor(lookup.getProject(), null); - QueryResult queryResult = this.elasticQueryHelperService.collect(lookup, AuthorizationFlags.AllExceptPublic, null); + QueryResult queryResult = this.elasticQueryHelperService.collect(lookup, AuthorizationFlags.AllExceptPublic, null); - this.auditService.track(AuditableAction.Dmp_Query, "lookup", lookup); + this.auditService.track(AuditableAction.Plan_Query, "lookup", lookup); return queryResult; } @@ -182,25 +182,25 @@ public class PlanController { @OperationWithTenantHeader(summary = "Fetch a specific plan by id", description = "", responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content( schema = @Schema( - implementation = Dmp.class + implementation = Plan.class )) )) @Swagger404 - public Dmp Get( + public Plan Get( @Parameter(name = "id", description = "The id of a plan to fetch", example = "c0c163dc-2965-45a5-9608-f76030578609", required = true) @PathVariable("id") UUID id, @Parameter(name = "fieldSet", description = SwaggerHelpers.Commons.fieldset_description, required = true) FieldSet fieldSet, Locale locale ) throws MyApplicationException, MyForbiddenException, MyNotFoundException { - logger.debug(new MapLogEntry("retrieving" + Dmp.class.getSimpleName()).And("id", id).And("fields", fieldSet)); + logger.debug(new MapLogEntry("retrieving" + Plan.class.getSimpleName()).And("id", id).And("fields", fieldSet)); - this.censorFactory.censor(DmpCensor.class).censor(fieldSet, null); + this.censorFactory.censor(PlanCensor.class).censor(fieldSet, null); - DmpQuery query = this.queryFactory.query(DmpQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).ids(id); - Dmp model = this.builderFactory.builder(DmpBuilder.class).authorize(AuthorizationFlags.AllExceptPublic).build(fieldSet, query.firstAs(fieldSet)); + PlanQuery query = this.queryFactory.query(PlanQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).ids(id); + Plan model = this.builderFactory.builder(PlanBuilder.class).authorize(AuthorizationFlags.AllExceptPublic).build(fieldSet, query.firstAs(fieldSet)); if (model == null) - throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale())); + throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Plan.class.getSimpleName()}, LocaleContextHolder.getLocale())); - this.auditService.track(AuditableAction.Dmp_Lookup, Map.ofEntries( + this.auditService.track(AuditableAction.Plan_Lookup, Map.ofEntries( new AbstractMap.SimpleEntry("id", id), new AbstractMap.SimpleEntry("fields", fieldSet) )); @@ -212,22 +212,22 @@ public class PlanController { @OperationWithTenantHeader(summary = "Create a new or update an existing plan", description = "", responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content( schema = @Schema( - implementation = Dmp.class + implementation = Plan.class )) )) @Swagger400 @Swagger404 @Transactional - @ValidationFilterAnnotation(validator = DmpPersist.DmpPersistValidator.ValidatorName, argumentName = "model") - public Dmp Persist( - @RequestBody DmpPersist model, + @ValidationFilterAnnotation(validator = PlanPersist.PlanPersistValidator.ValidatorName, argumentName = "model") + public Plan Persist( + @RequestBody PlanPersist model, @Parameter(name = "fieldSet", description = SwaggerHelpers.Commons.fieldset_description, required = true) FieldSet fieldSet ) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException, IOException, JAXBException { - logger.debug(new MapLogEntry("persisting" + Dmp.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet)); + logger.debug(new MapLogEntry("persisting" + Plan.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet)); - Dmp persisted = this.dmpService.persist(model, fieldSet); + Plan persisted = this.planService.persist(model, fieldSet); - this.auditService.track(AuditableAction.Dmp_Persist, Map.ofEntries( + this.auditService.track(AuditableAction.Plan_Persist, Map.ofEntries( new AbstractMap.SimpleEntry("model", model), new AbstractMap.SimpleEntry("fields", fieldSet) )); @@ -243,11 +243,11 @@ public class PlanController { public void Delete( @Parameter(name = "id", description = "The id of a plan to delete", example = "c0c163dc-2965-45a5-9608-f76030578609", required = true) @PathVariable("id") UUID id ) throws MyForbiddenException, InvalidApplicationException, IOException { - logger.debug(new MapLogEntry("retrieving" + Dmp.class.getSimpleName()).And("id", id)); + logger.debug(new MapLogEntry("retrieving" + Plan.class.getSimpleName()).And("id", id)); - this.dmpService.deleteAndSave(id); + this.planService.deleteAndSave(id); - this.auditService.track(AuditableAction.Dmp_Delete, "id", id); + this.auditService.track(AuditableAction.Plan_Delete, "id", id); } @PostMapping("finalize/{id}") @@ -259,11 +259,11 @@ public class PlanController { @Parameter(name = "id", description = "The id of a plan to finalize", example = "c0c163dc-2965-45a5-9608-f76030578609", required = true) @PathVariable("id") UUID id, @RequestBody DescriptionsToBeFinalized descriptions ) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException, IOException { - logger.debug(new MapLogEntry("finalizing" + Dmp.class.getSimpleName()).And("id", id).And("descriptionIds", descriptions.getDescriptionIds())); + logger.debug(new MapLogEntry("finalizing" + Plan.class.getSimpleName()).And("id", id).And("descriptionIds", descriptions.getDescriptionIds())); - this.dmpService.finalize(id, descriptions.getDescriptionIds()); + this.planService.finalize(id, descriptions.getDescriptionIds()); - this.auditService.track(AuditableAction.Dmp_Finalize, Map.ofEntries( + this.auditService.track(AuditableAction.Plan_Finalize, Map.ofEntries( new AbstractMap.SimpleEntry("id", id), new AbstractMap.SimpleEntry("descriptionIds", descriptions.getDescriptionIds()) )); @@ -280,13 +280,13 @@ public class PlanController { @Parameter(name = "id", description = "The id of a plan to revert the finalization", example = "c0c163dc-2965-45a5-9608-f76030578609", required = true) @PathVariable("id") UUID id, @Parameter(name = "fieldSet", description = SwaggerHelpers.Commons.fieldset_description, required = true) FieldSet fieldSet ) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException, IOException, JAXBException { - logger.debug(new MapLogEntry("undo-finalizing" + Dmp.class.getSimpleName()).And("id", id)); + logger.debug(new MapLogEntry("undo-finalizing" + Plan.class.getSimpleName()).And("id", id)); - this.censorFactory.censor(DmpCensor.class).censor(fieldSet, null); + this.censorFactory.censor(PlanCensor.class).censor(fieldSet, null); - this.dmpService.undoFinalize(id, fieldSet); + this.planService.undoFinalize(id, fieldSet); - this.auditService.track(AuditableAction.Dmp_Undo_Finalize, Map.ofEntries( + this.auditService.track(AuditableAction.Plan_Undo_Finalize, Map.ofEntries( new AbstractMap.SimpleEntry("id", id) )); @@ -296,14 +296,14 @@ public class PlanController { @GetMapping("validate/{id}") @OperationWithTenantHeader(summary = "Validate if a plan is ready for finalization by id") @Hidden - public DmpValidationResult validate(@PathVariable("id") UUID id) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException { - logger.debug(new MapLogEntry("validating" + Dmp.class.getSimpleName()).And("id", id)); + public PlanValidationResult validate(@PathVariable("id") UUID id) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException { + logger.debug(new MapLogEntry("validating" + Plan.class.getSimpleName()).And("id", id)); - this.censorFactory.censor(DmpCensor.class).censor(null, null); + this.censorFactory.censor(PlanCensor.class).censor(null, null); - DmpValidationResult result = this.dmpService.validate(id); + PlanValidationResult result = this.planService.validate(id); - this.auditService.track(AuditableAction.Dmp_Validate, Map.ofEntries( + this.auditService.track(AuditableAction.Plan_Validate, Map.ofEntries( new AbstractMap.SimpleEntry("id", id) )); @@ -314,24 +314,24 @@ public class PlanController { @OperationWithTenantHeader(summary = "Create a clone of an existing plan", description = "", responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content( schema = @Schema( - implementation = Dmp.class + implementation = Plan.class )) )) @Swagger400 @Swagger404 @Transactional - @ValidationFilterAnnotation(validator = CloneDmpPersist.CloneDmpPersistValidator.ValidatorName, argumentName = "model") - public Dmp buildClone( - @RequestBody CloneDmpPersist model, + @ValidationFilterAnnotation(validator = ClonePlanPersist.ClonePlanPersistValidator.ValidatorName, argumentName = "model") + public Plan buildClone( + @RequestBody ClonePlanPersist model, @Parameter(name = "fieldSet", description = SwaggerHelpers.Commons.fieldset_description, required = true) FieldSet fieldSet ) throws MyApplicationException, MyForbiddenException, MyNotFoundException, IOException, InvalidApplicationException { - logger.debug(new MapLogEntry("clone" + Dmp.class.getSimpleName()).And("model", model).And("fields", fieldSet)); + logger.debug(new MapLogEntry("clone" + Plan.class.getSimpleName()).And("model", model).And("fields", fieldSet)); - this.censorFactory.censor(DmpCensor.class).censor(fieldSet, null); + this.censorFactory.censor(PlanCensor.class).censor(fieldSet, null); - Dmp clone = this.dmpService.buildClone(model, fieldSet); + Plan clone = this.planService.buildClone(model, fieldSet); - this.auditService.track(AuditableAction.Dmp_Clone, Map.ofEntries( + this.auditService.track(AuditableAction.Plan_Clone, Map.ofEntries( new AbstractMap.SimpleEntry("model", model), new AbstractMap.SimpleEntry("fields", fieldSet) )); @@ -343,22 +343,22 @@ public class PlanController { @OperationWithTenantHeader(summary = "Create a new version of an existing plan", description = "", responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content( schema = @Schema( - implementation = Dmp.class + implementation = Plan.class )) )) @Swagger400 @Swagger404 @Transactional - @ValidationFilterAnnotation(validator = NewVersionDmpPersist.NewVersionDmpPersistValidator.ValidatorName, argumentName = "model") - public Dmp createNewVersion( - @RequestBody NewVersionDmpPersist model, + @ValidationFilterAnnotation(validator = NewVersionPlanPersist.NewVersionPlanPersistValidator.ValidatorName, argumentName = "model") + public Plan createNewVersion( + @RequestBody NewVersionPlanPersist model, @Parameter(name = "fieldSet", description = SwaggerHelpers.Commons.fieldset_description, required = true) FieldSet fieldSet ) throws MyApplicationException, MyForbiddenException, MyNotFoundException, JAXBException, IOException, TransformerException, InvalidApplicationException, ParserConfigurationException { - logger.debug(new MapLogEntry("persisting" + NewVersionDmpPersist.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet)); + logger.debug(new MapLogEntry("persisting" + NewVersionPlanPersist.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet)); - Dmp persisted = this.dmpService.createNewVersion(model, fieldSet); + Plan persisted = this.planService.createNewVersion(model, fieldSet); - this.auditService.track(AuditableAction.Dmp_PersistNewVersion, Map.ofEntries( + this.auditService.track(AuditableAction.Plan_PersistNewVersion, Map.ofEntries( new AbstractMap.SimpleEntry("model", model), new AbstractMap.SimpleEntry("fields", fieldSet) )); @@ -369,14 +369,14 @@ public class PlanController { @PostMapping("{id}/assign-users") @OperationWithTenantHeader(summary = "Assign users to the plan by id") @Transactional - @ValidationFilterAnnotation(validator = DmpUserPersist.DmpUserPersistValidator.ValidatorName, argumentName = "model") + @ValidationFilterAnnotation(validator = PlanUserPersist.PlanUserPersistValidator.ValidatorName, argumentName = "model") @Hidden - public QueryResult assignUsers(@PathVariable("id") UUID id, @RequestBody List model, FieldSet fieldSet) throws InvalidApplicationException, IOException { - logger.debug(new MapLogEntry("assigning users to dmp").And("model", model).And("fieldSet", fieldSet)); + public QueryResult assignUsers(@PathVariable("id") UUID id, @RequestBody List model, FieldSet fieldSet) throws InvalidApplicationException, IOException { + logger.debug(new MapLogEntry("assigning users to plan").And("model", model).And("fieldSet", fieldSet)); - List persisted = this.dmpService.assignUsers(id, model, fieldSet, false); + List persisted = this.planService.assignUsers(id, model, fieldSet, false); - this.auditService.track(AuditableAction.Dmp_Assign_Users, Map.ofEntries( + this.auditService.track(AuditableAction.Plan_Assign_Users, Map.ofEntries( new AbstractMap.SimpleEntry("model", model), new AbstractMap.SimpleEntry("fields", fieldSet) )); @@ -387,14 +387,14 @@ public class PlanController { @PostMapping("remove-user") @OperationWithTenantHeader(summary = "Remove a user association with the plan") @Transactional - @ValidationFilterAnnotation(validator = DmpUserRemovePersist.DmpUserRemovePersistValidator.ValidatorName, argumentName = "model") + @ValidationFilterAnnotation(validator = PlanUserRemovePersist.PlanUserRemovePersistValidator.ValidatorName, argumentName = "model") @Hidden - public QueryResult removeUser(@RequestBody DmpUserRemovePersist model, FieldSet fieldSet) throws InvalidApplicationException, IOException { - logger.debug(new MapLogEntry("remove user from dmp").And("model", model).And("fieldSet", fieldSet)); + public QueryResult removeUser(@RequestBody PlanUserRemovePersist model, FieldSet fieldSet) throws InvalidApplicationException, IOException { + logger.debug(new MapLogEntry("remove user from plan").And("model", model).And("fieldSet", fieldSet)); - Dmp persisted = this.dmpService.removeUser(model, fieldSet); + Plan persisted = this.planService.removeUser(model, fieldSet); - this.auditService.track(AuditableAction.Dmp_RemoveUser, Map.ofEntries( + this.auditService.track(AuditableAction.Plan_RemoveUser, Map.ofEntries( new AbstractMap.SimpleEntry("model", model), new AbstractMap.SimpleEntry("fields", fieldSet) )); @@ -411,10 +411,10 @@ public class PlanController { @PathVariable("transformerId") String transformerId, @PathVariable("type") String exportType ) throws InvalidApplicationException, IOException, InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException { - logger.debug(new MapLogEntry("exporting dmp").And("id", id).And("transformerId", transformerId).And("exportType", exportType)); + logger.debug(new MapLogEntry("exporting plan").And("id", id).And("transformerId", transformerId).And("exportType", exportType)); - ResponseEntity bytes = this.dmpService.export(id, transformerId, exportType); - this.auditService.track(AuditableAction.Dmp_Export, Map.ofEntries( + ResponseEntity bytes = this.planService.export(id, transformerId, exportType); + this.auditService.track(AuditableAction.Plan_Export, Map.ofEntries( new AbstractMap.SimpleEntry("id", id), new AbstractMap.SimpleEntry("transformerId", transformerId), new AbstractMap.SimpleEntry("exportType", exportType) @@ -425,14 +425,14 @@ public class PlanController { @PostMapping("{id}/invite-users") @OperationWithTenantHeader(summary = "Send user invitations for the plan by id") @Transactional - @ValidationFilterAnnotation(validator = DmpUserInvitePersist.DmpUserInvitePersistValidator.ValidatorName, argumentName = "model") + @ValidationFilterAnnotation(validator = PlanUserInvitePersist.PlanUserInvitePersistValidator.ValidatorName, argumentName = "model") @Hidden - public boolean inviteUsers(@PathVariable("id") UUID id, @RequestBody DmpUserInvitePersist model) throws InvalidApplicationException, JAXBException, IOException { - logger.debug(new MapLogEntry("inviting users to dmp").And("model", model)); + public boolean inviteUsers(@PathVariable("id") UUID id, @RequestBody PlanUserInvitePersist model) throws InvalidApplicationException, JAXBException, IOException { + logger.debug(new MapLogEntry("inviting users to plan").And("model", model)); - this.dmpService.inviteUserOrAssignUsers(id, model.getUsers()); + this.planService.inviteUserOrAssignUsers(id, model.getUsers()); - this.auditService.track(AuditableAction.Dmp_Invite_Users, Map.ofEntries( + this.auditService.track(AuditableAction.Plan_Invite_Users, Map.ofEntries( new AbstractMap.SimpleEntry("model", model) )); @@ -444,11 +444,11 @@ public class PlanController { @Transactional @Hidden public boolean acceptInvitation(@PathVariable("id") UUID id, @PathVariable("token") String token) throws InvalidApplicationException, JAXBException, IOException { - logger.debug(new MapLogEntry("inviting users to dmp").And("id", id)); + logger.debug(new MapLogEntry("inviting users to plan").And("id", id)); - this.dmpService.dmpInvitationAccept(token); + this.planService.planInvitationAccept(token); - this.auditService.track(AuditableAction.Dmp_Invite_Accept, Map.ofEntries( + this.auditService.track(AuditableAction.Plan_Invite_Accept, Map.ofEntries( new AbstractMap.SimpleEntry("token", token) )); @@ -462,11 +462,11 @@ public class PlanController { public @ResponseBody ResponseEntity getXml( @Parameter(name = "id", description = "The id of a plan to export", example = "c0c163dc-2965-45a5-9608-f76030578609", required = true) @PathVariable UUID id ) throws JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException { - logger.debug(new MapLogEntry("export" + Dmp.class.getSimpleName()).And("id", id)); + logger.debug(new MapLogEntry("export" + Plan.class.getSimpleName()).And("id", id)); - ResponseEntity response = this.dmpService.exportXml(id); + ResponseEntity response = this.planService.exportXml(id); - this.auditService.track(AuditableAction.Dmp_GetXml, Map.ofEntries( + this.auditService.track(AuditableAction.Plan_GetXml, Map.ofEntries( new AbstractMap.SimpleEntry("id", id) )); return response; @@ -476,20 +476,20 @@ public class PlanController { @OperationWithTenantHeader(summary = "Import a plan from an xml file", description = "", responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content( schema = @Schema( - implementation = Dmp.class + implementation = Plan.class )) )) @Transactional - public Dmp importXml( + public Plan importXml( @RequestParam("file") MultipartFile file, @RequestParam("label") String label, @Parameter(name = "fields", description = SwaggerHelpers.Commons.fieldset_description, required = true) FieldSet fields ) throws JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException, TransformerException { - logger.debug(new MapLogEntry("import xml" + Dmp.class.getSimpleName()).And("file", file).And("label", label)); + logger.debug(new MapLogEntry("import xml" + Plan.class.getSimpleName()).And("file", file).And("label", label)); - Dmp model = this.dmpService.importXml(file.getBytes(), label, fields); + Plan model = this.planService.importXml(file.getBytes(), label, fields); - this.auditService.track(AuditableAction.Dmp_Import, Map.ofEntries( + this.auditService.track(AuditableAction.Plan_Import, Map.ofEntries( new AbstractMap.SimpleEntry("file", file), new AbstractMap.SimpleEntry("fields", fields) )); @@ -508,11 +508,11 @@ public class PlanController { @RequestParam("fileId") UUID fileId, @RequestParam("repositoryId") String repositoryId ) throws InvalidAlgorithmParameterException, JAXBException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, IOException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException { - logger.debug(new MapLogEntry("preprocessing dmp" + Dmp.class.getSimpleName()).And("transformerId", repositoryId).And("fileId", fileId)); + logger.debug(new MapLogEntry("preprocessing dmp" + Plan.class.getSimpleName()).And("transformerId", repositoryId).And("fileId", fileId)); - PreprocessingDmpModel model = this.dmpService.preprocessingDmp(fileId, repositoryId); + PreprocessingDmpModel model = this.planService.preprocessingPlan(fileId, repositoryId); - this.auditService.track(AuditableAction.Dmp_Import, Map.ofEntries( + this.auditService.track(AuditableAction.Plan_Import, Map.ofEntries( new AbstractMap.SimpleEntry("transformerId", repositoryId), new AbstractMap.SimpleEntry("fileId", fileId) )); @@ -524,22 +524,22 @@ public class PlanController { @OperationWithTenantHeader(summary = "Import a plan from an json file", description = "", responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content( schema = @Schema( - implementation = Dmp.class + implementation = Plan.class )) )) - @ValidationFilterAnnotation(validator = DmpCommonModelConfig.DmpCommonModelConfigValidator.ValidatorName, argumentName = "model") + @ValidationFilterAnnotation(validator = PlanCommonModelConfig.PlanCommonModelConfigValidator.ValidatorName, argumentName = "model") @Transactional - public Dmp importJson( - @RequestBody DmpCommonModelConfig dmpCommonModelConfig, + public Plan importJson( + @RequestBody PlanCommonModelConfig planCommonModelConfig, @Parameter(name = "fields", description = SwaggerHelpers.Commons.fieldset_description, required = true) FieldSet fields ) throws InvalidAlgorithmParameterException, JAXBException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, IOException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, ParserConfigurationException, TransformerException, InstantiationException, IllegalAccessException, SAXException { - logger.debug(new MapLogEntry("import json" + Dmp.class.getSimpleName()).And("transformerId", dmpCommonModelConfig.getRepositoryId()).And("file id", dmpCommonModelConfig.getFileId()).And("label", dmpCommonModelConfig.getLabel())); + logger.debug(new MapLogEntry("import json" + Plan.class.getSimpleName()).And("transformerId", planCommonModelConfig.getRepositoryId()).And("file id", planCommonModelConfig.getFileId()).And("label", planCommonModelConfig.getLabel())); - Dmp model = this.dmpService.importJson(dmpCommonModelConfig, fields); + Plan model = this.planService.importJson(planCommonModelConfig, fields); - this.auditService.track(AuditableAction.Dmp_Import, Map.ofEntries( - new AbstractMap.SimpleEntry("transformerId", dmpCommonModelConfig.getRepositoryId()), - new AbstractMap.SimpleEntry("file id", dmpCommonModelConfig.getFileId()), + this.auditService.track(AuditableAction.Plan_Import, Map.ofEntries( + new AbstractMap.SimpleEntry("transformerId", planCommonModelConfig.getRepositoryId()), + new AbstractMap.SimpleEntry("file id", planCommonModelConfig.getFileId()), new AbstractMap.SimpleEntry("fields", fields) )); diff --git a/backend/web/src/main/java/org/opencdmp/controllers/UserController.java b/backend/web/src/main/java/org/opencdmp/controllers/UserController.java index 6bb91ff1c..720752ad9 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/UserController.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/UserController.java @@ -18,11 +18,11 @@ import org.opencdmp.authorization.AuthorizationFlags; import org.opencdmp.commons.enums.IsActive; import org.opencdmp.commons.scope.user.UserScope; import org.opencdmp.data.UserEntity; -import org.opencdmp.model.DmpAssociatedUser; +import org.opencdmp.model.PlanAssociatedUser; import org.opencdmp.model.UserRole; -import org.opencdmp.model.builder.DmpAssociatedUserBuilder; +import org.opencdmp.model.builder.PlanAssociatedUserBuilder; import org.opencdmp.model.builder.UserBuilder; -import org.opencdmp.model.censorship.DmpAssociatedUserCensor; +import org.opencdmp.model.censorship.PlanAssociatedUserCensor; import org.opencdmp.model.censorship.UserCensor; import org.opencdmp.model.persist.*; import org.opencdmp.model.persist.actionconfirmation.RemoveCredentialRequestPersist; @@ -107,19 +107,19 @@ public class UserController { return new QueryResult<>(models, count); } - @PostMapping("dmp-associated/query") - public QueryResult queryDmpAssociated(@RequestBody UserLookup lookup) throws MyApplicationException, MyForbiddenException { + @PostMapping("plan-associated/query") + public QueryResult queryDmpAssociated(@RequestBody UserLookup lookup) throws MyApplicationException, MyForbiddenException { logger.debug("querying {}", User.class.getSimpleName()); - this.censorFactory.censor(DmpAssociatedUserCensor.class).censor(lookup.getProject(), null); + this.censorFactory.censor(PlanAssociatedUserCensor.class).censor(lookup.getProject(), null); - UserQuery query = lookup.enrich(this.queryFactory).dmpAssociated(true).isActive(IsActive.Active); + UserQuery query = lookup.enrich(this.queryFactory).planAssociated(true).isActive(IsActive.Active); List data = query.collectAs(lookup.getProject()); - List models = this.builderFactory.builder(DmpAssociatedUserBuilder.class).authorize(AuthorizationFlags.AllExceptPublic).build(lookup.getProject(), data); + List models = this.builderFactory.builder(PlanAssociatedUserBuilder.class).authorize(AuthorizationFlags.AllExceptPublic).build(lookup.getProject(), data); long count = (lookup.getMetadata() != null && lookup.getMetadata().getCountAll()) ? query.count() : models.size(); - this.auditService.track(AuditableAction.User_DmpAssociatedQuery, "lookup", lookup); + this.auditService.track(AuditableAction.User_PlanAssociatedQuery, "lookup", lookup); return new QueryResult<>(models, count); } diff --git a/backend/web/src/main/java/org/opencdmp/controllers/publicapi/PublicDatasetsDescriptionDocumentation.java b/backend/web/src/main/java/org/opencdmp/controllers/publicapi/PublicDatasetsDescriptionDocumentation.java index ace5bb0c9..2e5f89c96 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/publicapi/PublicDatasetsDescriptionDocumentation.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/publicapi/PublicDatasetsDescriptionDocumentation.java @@ -19,26 +19,26 @@ import org.opencdmp.controllers.publicapi.response.DataTableData; import org.opencdmp.controllers.publicapi.types.ApiMessageCode; import org.opencdmp.controllers.publicapi.types.ResponseItem; import org.opencdmp.data.DescriptionEntity; -import org.opencdmp.model.DmpUser; +import org.opencdmp.model.PlanUser; import org.opencdmp.model.builder.description.DescriptionBuilder; -import org.opencdmp.model.builder.dmp.DmpBuilder; +import org.opencdmp.model.builder.plan.PlanBuilder; import org.opencdmp.model.description.Description; import org.opencdmp.model.descriptionreference.DescriptionReference; import org.opencdmp.model.descriptiontemplate.*; import org.opencdmp.model.descriptiontemplate.fielddata.BaseFieldData; -import org.opencdmp.model.dmp.Dmp; -import org.opencdmp.model.dmpreference.DmpReference; import org.opencdmp.model.mapper.publicapi.DescriptionToPublicApiDatasetListingMapper; import org.opencdmp.model.mapper.publicapi.DescriptionToPublicApiDatasetMapper; import org.opencdmp.model.mapper.publicapi.PlanToPublicApiPlanListingMapper; +import org.opencdmp.model.plan.Plan; +import org.opencdmp.model.planreference.PlanReference; import org.opencdmp.model.publicapi.listingmodels.DatasetPublicListingModel; import org.opencdmp.model.publicapi.overviewmodels.DatasetPublicModel; import org.opencdmp.model.reference.Reference; import org.opencdmp.model.user.User; import org.opencdmp.query.DescriptionQuery; -import org.opencdmp.query.DmpQuery; +import org.opencdmp.query.PlanQuery; import org.opencdmp.query.lookup.DescriptionLookup; -import org.opencdmp.query.lookup.DmpLookup; +import org.opencdmp.query.lookup.PlanLookup; import org.opencdmp.service.publicapi.PublicApiProperties; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -132,9 +132,9 @@ public class PublicDatasetsDescriptionDocumentation { if (model == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Description.class.getSimpleName()}, LocaleContextHolder.getLocale())); - DmpQuery planQuery = this.queryFactory.query(DmpQuery.class).disableTracking().ids(model.getDmp().getId()).isActive(IsActive.Active); - DmpLookup planLookup = getDmpLookup(); - Dmp plan = this.builderFactory.builder(DmpBuilder.class).build(planLookup.getProject(), planQuery.firstAs(planLookup.getProject())); + PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking().ids(model.getPlan().getId()).isActive(IsActive.Active); + PlanLookup planLookup = getDmpLookup(); + Plan plan = this.builderFactory.builder(PlanBuilder.class).build(planLookup.getProject(), planQuery.firstAs(planLookup.getProject())); DatasetPublicModel dataset = this.descriptionToPublicApiDatasetMapper.toPublicModel(model, this.planToPublicApiPlanListingMapper.toPublicListingModel(plan, this.config.getReferenceTypeMap()), this.config.getReferenceTypeMap()); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().status(ApiMessageCode.NO_MESSAGE).payload(dataset)); @@ -148,8 +148,8 @@ public class PublicDatasetsDescriptionDocumentation { Description._label, Description._description, Description._status, - String.join(".", Description._dmp, Dmp._id), - String.join(".", Description._dmp, Dmp._label), + String.join(".", Description._plan, Plan._id), + String.join(".", Description._plan, Plan._label), String.join(".", Description._createdBy, User._id), String.join(".", Description._createdBy, User._name), String.join(".", Description._descriptionReferences, DescriptionReference._reference, Reference._id), @@ -208,27 +208,27 @@ public class PublicDatasetsDescriptionDocumentation { } @NotNull - private static DmpLookup getDmpLookup() { + private static PlanLookup getDmpLookup() { BaseFieldSet fieldSet = new BaseFieldSet(); Set fields = Set.of( - Dmp._id, - Dmp._label, - Dmp._description, - Dmp._version, - Dmp._groupId, - String.join(".", Dmp._dmpUsers, String.join(".", DmpUser._user, User._id)), - String.join(".", Dmp._dmpUsers, String.join(".", DmpUser._user, User._name)), - String.join(".", Dmp._dmpUsers, DmpUser._role), - String.join(".", Dmp._dmpReferences, String.join(".", DmpReference._reference, Reference._id)), - String.join(".", Dmp._dmpReferences, String.join(".", DmpReference._reference, Reference._reference)), - String.join(".", Dmp._dmpReferences, String.join(".", DmpReference._reference, Reference._label)), - Dmp._dmpReferences, - Dmp._createdAt, - Dmp._updatedAt, - Dmp._finalizedAt + Plan._id, + Plan._label, + Plan._description, + Plan._version, + Plan._groupId, + String.join(".", Plan._planUsers, String.join(".", PlanUser._user, User._id)), + String.join(".", Plan._planUsers, String.join(".", PlanUser._user, User._name)), + String.join(".", Plan._planUsers, PlanUser._role), + String.join(".", Plan._planReferences, String.join(".", PlanReference._reference, Reference._id)), + String.join(".", Plan._planReferences, String.join(".", PlanReference._reference, Reference._reference)), + String.join(".", Plan._planReferences, String.join(".", PlanReference._reference, Reference._label)), + Plan._planReferences, + Plan._createdAt, + Plan._updatedAt, + Plan._finalizedAt ); fieldSet.setFields(fields); - DmpLookup lookup = new DmpLookup(); + PlanLookup lookup = new PlanLookup(); lookup.setProject(fieldSet); return lookup; } diff --git a/backend/web/src/main/java/org/opencdmp/controllers/publicapi/PublicPlansDocumentation.java b/backend/web/src/main/java/org/opencdmp/controllers/publicapi/PublicPlansDocumentation.java index 73c256508..14d2830d6 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/publicapi/PublicPlansDocumentation.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/publicapi/PublicPlansDocumentation.java @@ -18,16 +18,16 @@ import org.opencdmp.controllers.publicapi.request.plan.DataManagmentPlanPublicTa import org.opencdmp.controllers.publicapi.response.DataTableData; import org.opencdmp.controllers.publicapi.types.ApiMessageCode; import org.opencdmp.controllers.publicapi.types.ResponseItem; -import org.opencdmp.data.DmpEntity; -import org.opencdmp.model.DmpDescriptionTemplate; -import org.opencdmp.model.DmpUser; -import org.opencdmp.model.builder.DmpDescriptionTemplateBuilder; -import org.opencdmp.model.builder.dmp.DmpBuilder; -import org.opencdmp.model.dmp.Dmp; -import org.opencdmp.model.dmpblueprint.Section; -import org.opencdmp.model.dmpreference.DmpReference; +import org.opencdmp.data.PlanEntity; +import org.opencdmp.model.PlanDescriptionTemplate; +import org.opencdmp.model.PlanUser; +import org.opencdmp.model.builder.PlanDescriptionTemplateBuilder; +import org.opencdmp.model.builder.plan.PlanBuilder; import org.opencdmp.model.mapper.publicapi.PlanToPublicApiPlanListingMapper; import org.opencdmp.model.mapper.publicapi.PlanToPublicApiPlanMapper; +import org.opencdmp.model.plan.Plan; +import org.opencdmp.model.planblueprint.Section; +import org.opencdmp.model.planreference.PlanReference; import org.opencdmp.model.publicapi.listingmodels.DataManagementPlanPublicListingModel; import org.opencdmp.model.publicapi.overviewmodels.DataManagementPlanPublicModel; import org.opencdmp.model.reference.Definition; @@ -35,10 +35,10 @@ import org.opencdmp.model.reference.Field; import org.opencdmp.model.reference.Reference; import org.opencdmp.model.referencetype.ReferenceType; import org.opencdmp.model.user.User; -import org.opencdmp.query.DmpDescriptionTemplateQuery; -import org.opencdmp.query.DmpQuery; import org.opencdmp.query.EntityDoiQuery; -import org.opencdmp.query.lookup.DmpLookup; +import org.opencdmp.query.PlanDescriptionTemplateQuery; +import org.opencdmp.query.PlanQuery; +import org.opencdmp.query.lookup.PlanLookup; import org.opencdmp.service.publicapi.PublicApiProperties; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -104,12 +104,12 @@ public class PublicPlansDocumentation { @Valid @RequestBody @io.swagger.v3.oas.annotations.parameters.RequestBody(description = PublicApiStaticHelpers.Plan.getPagedRequestBodyDescription) DataManagmentPlanPublicTableRequest planTableRequest, @RequestParam @Parameter(description = PublicApiStaticHelpers.Plan.getPagedRequestParamDescription, example = "listing") String fieldsGroup ) throws Exception { - DmpLookup lookup = getPlanLookup(fieldsGroup, planTableRequest); - DmpQuery query = lookup.enrich(this.queryFactory).authorize(EnumSet.of(AuthorizationFlags.Public)).isActive(IsActive.Active); - long count = this.queryFactory.query(DmpQuery.class).disableTracking().authorize(EnumSet.of(AuthorizationFlags.Public)).isActive(IsActive.Active).count(); + PlanLookup lookup = getPlanLookup(fieldsGroup, planTableRequest); + PlanQuery query = lookup.enrich(this.queryFactory).authorize(EnumSet.of(AuthorizationFlags.Public)).isActive(IsActive.Active); + long count = this.queryFactory.query(PlanQuery.class).disableTracking().authorize(EnumSet.of(AuthorizationFlags.Public)).isActive(IsActive.Active).count(); - List data = query.collectAs(lookup.getProject()); - List models = this.builderFactory.builder(DmpBuilder.class).build(lookup.getProject(), data); + List data = query.collectAs(lookup.getProject()); + List models = this.builderFactory.builder(PlanBuilder.class).build(lookup.getProject(), data); DataTableData dataTableData = new DataTableData<>(); dataTableData.setData(models.stream().map(x-> this.planToPublicApiPlanListingMapper.toPublicListingModel(x, this.config.getReferenceTypeMap())).toList()); dataTableData.setTotalCount(count); @@ -117,42 +117,42 @@ public class PublicPlansDocumentation { } @NotNull - private static DmpLookup getPlanLookup(String fieldsGroup, DataManagmentPlanPublicTableRequest request) { + private static PlanLookup getPlanLookup(String fieldsGroup, DataManagmentPlanPublicTableRequest request) { BaseFieldSet fieldSet = new BaseFieldSet(); Set fields; if ("listing".equals(fieldsGroup)) { fields = Set.of( - Dmp._id, - Dmp._label, - Dmp._description, - Dmp._version, - Dmp._groupId, - String.join(".", Dmp._dmpUsers, DmpUser._user, User._id), - String.join(".", Dmp._dmpUsers, DmpUser._user, User._name), - String.join(".", Dmp._dmpUsers, DmpUser._role), - String.join(".", Dmp._dmpReferences, DmpReference._reference, Reference._id), - String.join(".", Dmp._dmpReferences, DmpReference._reference, Reference._type), - String.join(".", Dmp._dmpReferences, DmpReference._reference, Reference._type), - String.join(".", Dmp._dmpReferences, DmpReference._reference, Reference._type, ReferenceType._id), - String.join(".", Dmp._dmpReferences, DmpReference._reference, Reference._label), - String.join(".", Dmp._dmpReferences, DmpReference._reference, Reference._definition, Definition._fields, Field._code), - String.join(".", Dmp._dmpReferences, DmpReference._reference, Reference._definition, Definition._fields, Field._dataType), - String.join(".", Dmp._dmpReferences, DmpReference._reference, Reference._definition, Definition._fields, Field._value), - Dmp._dmpReferences, - Dmp._createdAt, - Dmp._updatedAt, - Dmp._finalizedAt + Plan._id, + Plan._label, + Plan._description, + Plan._version, + Plan._groupId, + String.join(".", Plan._planUsers, PlanUser._user, User._id), + String.join(".", Plan._planUsers, PlanUser._user, User._name), + String.join(".", Plan._planUsers, PlanUser._role), + String.join(".", Plan._planReferences, PlanReference._reference, Reference._id), + String.join(".", Plan._planReferences, PlanReference._reference, Reference._type), + String.join(".", Plan._planReferences, PlanReference._reference, Reference._type), + String.join(".", Plan._planReferences, PlanReference._reference, Reference._type, ReferenceType._id), + String.join(".", Plan._planReferences, PlanReference._reference, Reference._label), + String.join(".", Plan._planReferences, PlanReference._reference, Reference._definition, Definition._fields, Field._code), + String.join(".", Plan._planReferences, PlanReference._reference, Reference._definition, Definition._fields, Field._dataType), + String.join(".", Plan._planReferences, PlanReference._reference, Reference._definition, Definition._fields, Field._value), + Plan._planReferences, + Plan._createdAt, + Plan._updatedAt, + Plan._finalizedAt ); } else { fields = Set.of( - Dmp._id, - Dmp._label, - Dmp._groupId, - Dmp._createdAt + Plan._id, + Plan._label, + Plan._groupId, + Plan._createdAt ); } fieldSet.setFields(fields); - DmpLookup lookup = new DmpLookup(); + PlanLookup lookup = new PlanLookup(); lookup.setProject(fieldSet); return lookup; } @@ -169,37 +169,37 @@ public class PublicPlansDocumentation { ) { BaseFieldSet planFieldSet = new BaseFieldSet(); Set planFields = Set.of( - Dmp._id, - Dmp._label, - Dmp._description, - Dmp._version, - Dmp._groupId, - String.join(".", Dmp._dmpUsers, DmpUser._user, User._id), - String.join(".", Dmp._dmpUsers, DmpUser._user, User._name), - String.join(".", Dmp._dmpUsers, DmpUser._role), - String.join(".", Dmp._dmpReferences, DmpReference._reference, Reference._id), - String.join(".", Dmp._dmpReferences, DmpReference._reference, Reference._type), - String.join(".", Dmp._dmpReferences, DmpReference._reference, Reference._type, ReferenceType._id), - String.join(".", Dmp._dmpReferences, DmpReference._reference, Reference._reference), - String.join(".", Dmp._dmpReferences, DmpReference._reference, Reference._label), - String.join(".", Dmp._dmpReferences, DmpReference._reference, Reference._abbreviation), - String.join(".", Dmp._dmpReferences, DmpReference._reference, Reference._description), - String.join(".", Dmp._dmpReferences, DmpReference._reference, Reference._definition), - String.join(".", Dmp._blueprint, org.opencdmp.model.dmpblueprint.Definition._sections, Section._id), - String.join(".", Dmp._blueprint, org.opencdmp.model.dmpblueprint.Definition._sections, Section._ordinal), - Dmp._createdAt, - Dmp._updatedAt, - Dmp._finalizedAt + Plan._id, + Plan._label, + Plan._description, + Plan._version, + Plan._groupId, + String.join(".", Plan._planUsers, PlanUser._user, User._id), + String.join(".", Plan._planUsers, PlanUser._user, User._name), + String.join(".", Plan._planUsers, PlanUser._role), + String.join(".", Plan._planReferences, PlanReference._reference, Reference._id), + String.join(".", Plan._planReferences, PlanReference._reference, Reference._type), + String.join(".", Plan._planReferences, PlanReference._reference, Reference._type, ReferenceType._id), + String.join(".", Plan._planReferences, PlanReference._reference, Reference._reference), + String.join(".", Plan._planReferences, PlanReference._reference, Reference._label), + String.join(".", Plan._planReferences, PlanReference._reference, Reference._abbreviation), + String.join(".", Plan._planReferences, PlanReference._reference, Reference._description), + String.join(".", Plan._planReferences, PlanReference._reference, Reference._definition), + String.join(".", Plan._blueprint, org.opencdmp.model.planblueprint.Definition._sections, Section._id), + String.join(".", Plan._blueprint, org.opencdmp.model.planblueprint.Definition._sections, Section._ordinal), + Plan._createdAt, + Plan._updatedAt, + Plan._finalizedAt ); planFieldSet.setFields(planFields); - DmpQuery query = this.queryFactory.query(DmpQuery.class).disableTracking().authorize(EnumSet.of(AuthorizationFlags.Public)).ids(UUID.fromString(id)).isActive(IsActive.Active); - Dmp model = this.builderFactory.builder(DmpBuilder.class).build(planFieldSet, query.firstAs(planFieldSet)); + PlanQuery query = this.queryFactory.query(PlanQuery.class).disableTracking().authorize(EnumSet.of(AuthorizationFlags.Public)).ids(UUID.fromString(id)).isActive(IsActive.Active); + Plan model = this.builderFactory.builder(PlanBuilder.class).build(planFieldSet, query.firstAs(planFieldSet)); if (model == null) - throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale())); + throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Plan.class.getSimpleName()}, LocaleContextHolder.getLocale())); EntityDoiQuery entityDoiQuery = this.queryFactory.query(EntityDoiQuery.class).disableTracking().entityIds(UUID.fromString(id)).isActive(IsActive.Active); BaseFieldSet templateFieldSet = new BaseFieldSet(); - DmpDescriptionTemplateQuery planDescriptionTemplateQuery = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking().dmpIds(UUID.fromString(id)).isActive(IsActive.Active); - List planDescriptionTemplates = this.builderFactory.builder(DmpDescriptionTemplateBuilder.class).build(templateFieldSet, planDescriptionTemplateQuery.collectAs(templateFieldSet)); + PlanDescriptionTemplateQuery planDescriptionTemplateQuery = this.queryFactory.query(PlanDescriptionTemplateQuery.class).disableTracking().planIds(UUID.fromString(id)).isActive(IsActive.Active); + List planDescriptionTemplates = this.builderFactory.builder(PlanDescriptionTemplateBuilder.class).build(templateFieldSet, planDescriptionTemplateQuery.collectAs(templateFieldSet)); DataManagementPlanPublicModel dataManagementPlan = this.planToPublicApiPlanMapper.toPublicModel(model, entityDoiQuery.collect(), planDescriptionTemplates, this.config.getReferenceTypeMap()); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().status(ApiMessageCode.NO_MESSAGE).payload(dataManagementPlan)); } diff --git a/backend/web/src/main/java/org/opencdmp/controllers/publicapi/criteria/plan/DataManagementPlanPublicCriteria.java b/backend/web/src/main/java/org/opencdmp/controllers/publicapi/criteria/plan/DataManagementPlanPublicCriteria.java index 2e3b86942..492170359 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/publicapi/criteria/plan/DataManagementPlanPublicCriteria.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/publicapi/criteria/plan/DataManagementPlanPublicCriteria.java @@ -1,14 +1,14 @@ package org.opencdmp.controllers.publicapi.criteria.plan; import org.opencdmp.controllers.publicapi.criteria.Criteria; -import org.opencdmp.data.DmpEntity; +import org.opencdmp.data.PlanEntity; import io.swagger.annotations.ApiModelProperty; import java.util.Date; import java.util.List; import java.util.UUID; -public class DataManagementPlanPublicCriteria extends Criteria { +public class DataManagementPlanPublicCriteria extends Criteria { @ApiModelProperty(value = "periodStart", name = "periodStart", dataType = "Date", example = "2022-01-01T13:19:42.210Z") private Date periodStart; @ApiModelProperty(value = "periodEnd", name = "periodEnd", dataType = "Date", example = "2022-12-31T13:19:42.210Z") diff --git a/backend/web/src/main/java/org/opencdmp/controllers/publicapi/request/plan/DataManagmentPlanPublicTableRequest.java b/backend/web/src/main/java/org/opencdmp/controllers/publicapi/request/plan/DataManagmentPlanPublicTableRequest.java index 75f1d4c9e..62f0c2ad9 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/publicapi/request/plan/DataManagmentPlanPublicTableRequest.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/publicapi/request/plan/DataManagmentPlanPublicTableRequest.java @@ -7,15 +7,15 @@ import org.opencdmp.controllers.publicapi.query.PaginationService; import org.opencdmp.controllers.publicapi.query.definition.TableQuery; import org.opencdmp.controllers.publicapi.types.FieldSelectionType; import org.opencdmp.controllers.publicapi.types.SelectionField; -import org.opencdmp.data.DmpEntity; +import org.opencdmp.data.PlanEntity; import jakarta.persistence.criteria.Predicate; import java.util.*; -public class DataManagmentPlanPublicTableRequest extends TableQuery { +public class DataManagmentPlanPublicTableRequest extends TableQuery { - public QueryableList applyCriteria() { - QueryableList query = this.getQuery(); + public QueryableList applyCriteria() { + QueryableList query = this.getQuery(); query.where((builder, root) -> builder.equal(root.get("isPublic"), true)); if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty()) query.where((builder, root) -> builder.or( @@ -95,7 +95,7 @@ public class DataManagmentPlanPublicTableRequest extends TableQuery applyPaging(QueryableList items) { + public QueryableList applyPaging(QueryableList items) { return PaginationService.applyPaging(items, this); } } diff --git a/backend/web/src/main/resources/config/permissions.yml b/backend/web/src/main/resources/config/permissions.yml index a872ce4b7..f5926df64 100644 --- a/backend/web/src/main/resources/config/permissions.yml +++ b/backend/web/src/main/resources/config/permissions.yml @@ -333,7 +333,7 @@ permissions: clients: [ ] allowAnonymous: false allowAuthenticated: false - BrowseDmpAssociatedUser: + BrowsePlanAssociatedUser: roles: - Admin - TenantAdmin @@ -475,8 +475,8 @@ permissions: clients: [ ] allowAnonymous: false allowAuthenticated: false - # Dmp - BrowseDmp: + # Plan + BrowsePlan: roles: - Admin - TenantAdmin @@ -489,7 +489,7 @@ permissions: clients: [ ] allowAnonymous: false allowAuthenticated: false - EditDmp: + EditPlan: roles: - Admin - TenantAdmin @@ -499,7 +499,7 @@ permissions: clients: [ ] allowAnonymous: false allowAuthenticated: false - NewDmp: + NewPlan: roles: - Admin - InstallationAdmin @@ -510,7 +510,7 @@ permissions: clients: [ ] allowAnonymous: false allowAuthenticated: false - DeleteDmp: + DeletePlan: roles: - Admin - TenantAdmin @@ -521,7 +521,7 @@ permissions: clients: [ ] allowAnonymous: false allowAuthenticated: false - DepositDmp: + DepositPlan: roles: - Admin - TenantAdmin @@ -532,7 +532,7 @@ permissions: clients: [ ] allowAnonymous: false allowAuthenticated: false - CloneDmp: + ClonePlan: roles: - Admin - TenantAdmin @@ -543,13 +543,13 @@ permissions: clients: [ ] allowAnonymous: false allowAuthenticated: false - ExportDmp: + ExportPlan: roles: [ ] claims: [ ] clients: [ ] allowAnonymous: false allowAuthenticated: true - CreateNewVersionDmp: + CreateNewVersionPlan: roles: - Admin - TenantAdmin @@ -560,7 +560,7 @@ permissions: clients: [ ] allowAnonymous: false allowAuthenticated: false - FinalizeDmp: + FinalizePlan: roles: - Admin - TenantAdmin @@ -571,7 +571,7 @@ permissions: clients: [ ] allowAnonymous: false allowAuthenticated: false - UndoFinalizeDmp: + UndoFinalizePlan: roles: - Admin - TenantAdmin @@ -582,7 +582,7 @@ permissions: clients: [ ] allowAnonymous: false allowAuthenticated: false - AssignDmpUsers: + AssignPlanUsers: roles: - Admin - TenantAdmin @@ -593,7 +593,7 @@ permissions: clients: [ ] allowAnonymous: false allowAuthenticated: false - InviteDmpUsers: + InvitePlanUsers: roles: - Admin - TenantAdmin @@ -604,8 +604,8 @@ permissions: clients: [ ] allowAnonymous: false allowAuthenticated: false - # DmpBlueprint - BrowseDmpBlueprint: + # PlanBlueprint + BrowsePlanBlueprint: roles: - Admin - InstallationAdmin @@ -616,7 +616,7 @@ permissions: clients: [ ] allowAnonymous: false allowAuthenticated: false - EditDmpBlueprint: + EditPlanBlueprint: roles: - Admin - TenantAdmin @@ -624,7 +624,7 @@ permissions: clients: [ ] allowAnonymous: false allowAuthenticated: false - CloneDmpBlueprint: + ClonePlanBlueprint: roles: - Admin - TenantAdmin @@ -632,7 +632,7 @@ permissions: clients: [ ] allowAnonymous: false allowAuthenticated: false - CreateNewVersionDmpBlueprint: + CreateNewVersionPlanBlueprint: roles: - Admin - TenantAdmin @@ -640,7 +640,7 @@ permissions: clients: [ ] allowAnonymous: false allowAuthenticated: false - ExportDmpBlueprint: + ExportPlanBlueprint: roles: - TenantAdmin - TenantPlanManager @@ -648,7 +648,7 @@ permissions: clients: [ ] allowAnonymous: false allowAuthenticated: false - ImportDmpBlueprint: + ImportPlanBlueprint: roles: - Admin - TenantAdmin @@ -657,7 +657,7 @@ permissions: clients: [ ] allowAnonymous: false allowAuthenticated: false - DeleteDmpBlueprint: + DeletePlanBlueprint: roles: - Admin - TenantAdmin @@ -718,22 +718,22 @@ permissions: allowAnonymous: false allowAuthenticated: false - # DmpReference Permissions - BrowseDmpReference: + # PlanReference Permissions + BrowsePlanReference: roles: - Admin - TenantAdmin clients: [ ] allowAnonymous: false allowAuthenticated: false - EditDmpReference: + EditPlanReference: roles: - Admin - TenantAdmin clients: [ ] allowAnonymous: false allowAuthenticated: false - DeleteDmpReference: + DeletePlanReference: roles: - Admin - TenantAdmin @@ -742,22 +742,22 @@ permissions: allowAnonymous: false allowAuthenticated: false - # DmpUser Permissions - BrowseDmpUser: + # PlanUser Permissions + BrowsePlanUser: roles: - Admin - TenantAdmin clients: [ ] allowAnonymous: false allowAuthenticated: false - EditDmpUser: + EditPlanUser: roles: - Admin - TenantAdmin clients: [ ] allowAnonymous: false allowAuthenticated: false - DeleteDmpUser: + DeletePlanUser: roles: - Admin - TenantAdmin @@ -873,22 +873,22 @@ permissions: allowAnonymous: false allowAuthenticated: false - # DmpDescriptionTemplate Permissions - BrowseDmpDescriptionTemplate: + # PlanDescriptionTemplate Permissions + BrowsePlanDescriptionTemplate: roles: - Admin - TenantAdmin clients: [ ] allowAnonymous: false allowAuthenticated: false - EditDmpDescriptionTemplate: + EditPlanDescriptionTemplate: roles: - Admin - TenantAdmin clients: [ ] allowAnonymous: false allowAuthenticated: false - DeleteDmpDescriptionTemplate: + DeletePlanDescriptionTemplate: roles: - Admin - TenantAdmin @@ -1187,7 +1187,7 @@ permissions: clients: [ ] allowAnonymous: false allowAuthenticated: false - ViewDmpBlueprintPage: + ViewPlanBlueprintPage: roles: - Admin - TenantAdmin @@ -1213,7 +1213,7 @@ permissions: clients: [ ] allowAnonymous: false allowAuthenticated: false - ViewMyDmpPage: + ViewMyPlanPage: roles: - Admin - TenantAdmin From a5b9aaccd8c2ca7994bfdaf6e9aff9bec272871a Mon Sep 17 00:00:00 2001 From: amentis Date: Thu, 4 Jul 2024 16:54:09 +0300 Subject: [PATCH 3/6] rename frontend dmp to plan (in progress) --- dmp-frontend/src/app/app-routing.module.ts | 10 +- .../app/core/common/enum/lock-target-type.ts | 2 +- .../app/core/common/enum/permission.enum.ts | 78 ++--- .../app/core/common/enum/plan-access-type.ts | 2 +- .../plan-blueprint-extra-field-data-type.ts | 2 +- .../enum/plan-blueprint-field-category.ts | 2 +- .../common/enum/plan-blueprint-field-type.ts | 2 +- .../core/common/enum/plan-blueprint-status.ts | 2 +- .../enum/plan-blueprint-system-field-type.ts | 2 +- .../core/common/enum/plan-blueprint-type.ts | 2 +- .../enum/plan-blueprint-version-status.ts | 2 +- .../src/app/core/common/enum/plan-status.ts | 2 +- .../app/core/common/enum/plan-user-role.ts | 2 +- .../app/core/common/enum/plan-user-type.ts | 2 +- .../core/common/enum/plan-version-status.ts | 2 +- .../core/common/enum/respone-error-code.ts | 58 ++-- .../src/app/core/core-service.module.ts | 8 +- .../model/dashboard/recent-activity-item.ts | 4 +- .../app/core/model/deposit/deposit-request.ts | 2 +- .../app/core/model/description/description.ts | 20 +- .../model/plan-blueprint/plan-blueprint.ts | 54 ++-- .../src/app/core/model/plan/plan-import.ts | 4 +- .../src/app/core/model/plan/plan-reference.ts | 10 +- dmp-frontend/src/app/core/model/plan/plan.ts | 130 ++++----- .../src/app/core/pipes/field-value.pipe.ts | 8 +- .../src/app/core/query/description.lookup.ts | 6 +- .../app/core/query/plan-blueprint.lookup.ts | 16 +- .../query/plan-description-template.lookup.ts | 8 +- .../src/app/core/query/plan-user.lookup.ts | 8 +- .../src/app/core/query/plan.lookup.ts | 45 +-- .../src/app/core/query/reference.lookup.ts | 3 +- .../file-transformer.http.service.ts | 4 +- .../file-transformer.service.ts | 6 +- .../core/services/matomo/analytics-service.ts | 8 +- .../services/plan/plan-blueprint.service.ts | 102 +++---- .../app/core/services/plan/plan.service.ts | 112 ++++---- .../services/reference/reference.service.ts | 14 +- .../app/core/services/user/user.service.ts | 2 +- .../services/utilities/enum-utils.service.ts | 93 +++--- ...description-template-editor.component.html | 6 +- .../maintenance-tasks.component.html | 2 +- .../plan-blueprint-editor.component.html | 92 +++--- .../editor/plan-blueprint-editor.component.ts | 120 ++++---- .../editor/plan-blueprint-editor.model.ts | 78 ++--- .../editor/plan-blueprint-editor.resolver.ts | 80 +++--- .../editor/plan-blueprint-editor.service.ts | 2 +- ...n-blueprint-listing-filters.component.html | 12 +- ...lan-blueprint-listing-filters.component.ts | 26 +- ...mport-plan-blueprint.dialog.component.html | 6 +- .../import-plan-blueprint.dialog.component.ts | 4 +- .../plan-blueprint-listing.component.html | 42 +-- .../plan-blueprint-listing.component.ts | 98 +++---- .../plan-blueprint/plan-blueprint.module.ts | 22 +- .../plan-blueprint/plan-blueprint.routing.ts | 38 +-- .../annotation-dialog.component.ts | 2 +- .../app/ui/dashboard/dashboard.component.html | 20 +- .../app/ui/dashboard/dashboard.component.ts | 20 +- .../src/app/ui/dashboard/dashboard.module.ts | 4 +- .../recent-edited-activity.component.html | 6 +- .../recent-edited-activity.component.ts | 154 +++++----- .../description-copy-dialog.component.html | 4 +- .../description-copy-dialog.component.ts | 68 ++--- ...cription-base-fields-editor.component.html | 2 +- ...escription-base-fields-editor.component.ts | 6 +- .../editor/description-editor.component.html | 10 +- .../editor/description-editor.component.ts | 74 ++--- .../editor/description-editor.model.ts | 16 +- .../editor/description-editor.routing.ts | 4 +- .../form-field-set.component.ts | 4 +- .../form-field/form-field.component.html | 4 +- .../form-field/form-field.component.ts | 4 +- .../form-section/form-section.component.ts | 4 +- .../description-form.component.ts | 4 +- .../prefill-description.component.ts | 14 +- .../description-editor-entity.resolver.ts | 122 ++++---- ...description-editor-permissions.resolver.ts | 54 ++-- .../description-listing.component.html | 4 +- .../listing/description-listing.component.ts | 118 ++++---- .../listing/description-listing.routing.ts | 2 +- .../description-filter.component.html | 4 +- .../filtering/description-filter.component.ts | 10 +- .../filtering/description-filter.service.ts | 18 +- .../description-listing-item.component.html | 16 +- .../description-listing-item.component.ts | 28 +- .../description-overview.component.html | 50 ++-- .../description-overview.component.ts | 122 ++++---- ...tart-new-description-dialog.component.html | 6 +- .../start-new-description-dialog.component.ts | 52 ++-- .../src/app/ui/navbar/navbar.component.html | 4 +- .../src/app/ui/navbar/navbar.component.ts | 6 +- .../user-dialog/user-dialog.component.html | 2 +- .../plan-clone-dialog.component.html | 24 +- .../plan-clone-dialog.component.ts | 26 +- .../plan-clone-dialog.editor.model.ts | 6 +- .../clone-dialog/plan-clone-dialog.module.ts | 8 +- .../plan-deposit-dropdown.component.html | 2 +- .../plan-deposit-dropdown.component.ts | 20 +- .../plan-invitation-dialog.component.html | 4 +- .../plan-invitation-dialog.component.ts | 32 +-- .../dialog/plan-invitation-dialog.module.ts | 4 +- .../filtering/plan-filter.component.html | 32 +-- .../filtering/plan-filter.component.ts | 14 +- .../filtering/services/plan-filter.service.ts | 38 +-- .../plan-listing-item.component.html | 42 +-- .../plan-listing-item.component.ts | 94 +++---- .../plan/listing/plan-listing.component.html | 10 +- .../ui/plan/listing/plan-listing.component.ts | 210 +++++++------- .../ui/plan/listing/plan-listing.module.ts | 8 +- .../plan-new-version-dialog.component.html | 28 +- .../plan-new-version-dialog.component.ts | 80 +++--- .../plan-new-version-dialog.editor.model.ts | 14 +- .../plan-new-version-dialog.module.ts | 8 +- .../start-new-plan-dialog.component.html | 2 +- .../start-new-plan-dialog.component.ts | 20 +- .../start-new-plan-dialog.module.ts | 8 +- .../plan-common-model-config.editor.model.ts | 6 +- .../plan-upload-dialog.component.html | 26 +- .../plan-upload-dialog.component.ts | 36 +-- .../overview/plan-overview.component.html | 114 ++++---- .../plan/overview/plan-overview.component.ts | 266 +++++++++--------- .../ui/plan/overview/plan-overview.module.ts | 4 +- ...plan-contact-prefill-dialog.component.html | 12 +- .../plan-contact-prefill-dialog.component.ts | 10 +- ...lan-contact-prefill-dialog.editor.model.ts | 2 +- .../plan-contact-prefill-dialog.module.ts | 8 +- .../plan-delete-dialog.component.html | 8 +- .../plan-editor.component.html | 146 +++++----- .../plan-editor.component.ts | 192 ++++++------- .../plan-editor.model.ts | 196 ++++++------- .../plan-editor.module.ts | 18 +- .../plan-editor.routing.ts | 20 +- .../plan-editor.service.ts | 2 +- .../resolvers/plan-editor-enitity.resolver.ts | 164 +++++------ .../plan-editor-permissions.resolver.ts | 14 +- .../plan-finalize-dialog.component.html | 30 +- .../plan-finalize-dialog.component.ts | 36 +-- .../plan-finalize-dialog.module.ts | 8 +- .../plan-user-field.component.html | 30 +- .../plan-user-field.component.ts | 30 +- .../plan-user-field/plan-user-field.module.ts | 8 +- dmp-frontend/src/app/ui/plan/plan.routing.ts | 10 +- .../src/app/ui/sidebar/sidebar.component.ts | 6 +- .../user-profile/user-profile.component.html | 2 +- dmp-frontend/src/assets/i18n/baq.json | 156 +++++----- dmp-frontend/src/assets/i18n/de.json | 158 +++++------ dmp-frontend/src/assets/i18n/en.json | 156 +++++----- dmp-frontend/src/assets/i18n/es.json | 156 +++++----- dmp-frontend/src/assets/i18n/gr.json | 156 +++++----- dmp-frontend/src/assets/i18n/hr.json | 156 +++++----- dmp-frontend/src/assets/i18n/pl.json | 156 +++++----- dmp-frontend/src/assets/i18n/pt.json | 156 +++++----- dmp-frontend/src/assets/i18n/sk.json | 156 +++++----- dmp-frontend/src/assets/i18n/sr.json | 156 +++++----- dmp-frontend/src/assets/i18n/tr.json | 156 +++++----- dmp-frontend/src/common/base/base-editor.ts | 2 +- .../forms/validation/custom-validator.ts | 12 +- .../core/formatting/enum-utils.service.ts | 10 +- 157 files changed, 3196 insertions(+), 3193 deletions(-) diff --git a/dmp-frontend/src/app/app-routing.module.ts b/dmp-frontend/src/app/app-routing.module.ts index c32324ed5..f3a7c4a16 100644 --- a/dmp-frontend/src/app/app-routing.module.ts +++ b/dmp-frontend/src/app/app-routing.module.ts @@ -48,7 +48,7 @@ const appRoutes: Routes = [ loadChildren: () => import('./ui/plan/plan.module').then(m => m.DmpModule), data: { authContext: { - permissions: [AppPermission.ViewMyDmpPage] + permissions: [AppPermission.ViewMyPlanPage] }, breadcrumb: true, ...BreadcrumbService.generateRouteDataConfiguration({ @@ -69,14 +69,14 @@ const appRoutes: Routes = [ } }, { - path: 'dmp-blueprints', - loadChildren: () => import('./ui/admin/plan-blueprint/plan-blueprint.module').then(m => m.DmpBlueprintModule), + path: 'plan-blueprints', + loadChildren: () => import('./ui/admin/plan-blueprint/plan-blueprint.module').then(m => m.PlanBlueprintModule), data: { authContext: { - permissions: [AppPermission.ViewDmpBlueprintPage] + permissions: [AppPermission.ViewPlanBlueprintPage] }, ...BreadcrumbService.generateRouteDataConfiguration({ - title: 'BREADCRUMBS.DMP-BLUEPRINTS' + title: 'BREADCRUMBS.PLAN-BLUEPRINTS' }), title: 'GENERAL.TITLES.BLUEPRINTS' } diff --git a/dmp-frontend/src/app/core/common/enum/lock-target-type.ts b/dmp-frontend/src/app/core/common/enum/lock-target-type.ts index c0e66f3ba..957dccc33 100644 --- a/dmp-frontend/src/app/core/common/enum/lock-target-type.ts +++ b/dmp-frontend/src/app/core/common/enum/lock-target-type.ts @@ -1,6 +1,6 @@ export enum LockTargetType { Dmp = 0, Description = 1, - DmpBlueprint = 2, + PlanBlueprint = 2, DescriptionTemplate= 3 } \ No newline at end of file diff --git a/dmp-frontend/src/app/core/common/enum/permission.enum.ts b/dmp-frontend/src/app/core/common/enum/permission.enum.ts index 820fa5fc4..d252dc06e 100644 --- a/dmp-frontend/src/app/core/common/enum/permission.enum.ts +++ b/dmp-frontend/src/app/core/common/enum/permission.enum.ts @@ -5,9 +5,9 @@ export enum AppPermission { //Public PublicBrowseDescription = "PublicBrowseDescription", PublicBrowseDescriptionTemplate = "PublicBrowseDescriptionTemplate", - PublicBrowseDmp = "PublicBrowseDmp", - PublicBrowseDmpReference = "PublicBrowseDmpReference", - PublicBrowseDmpUser = "PublicBrowseDmpUser", + PublicBrowsePlan = "PublicBrowsePlan", + PublicBrowsePlanReference = "PublicBrowsePlanReference", + PublicBrowsePlanUser = "PublicBrowsePlanUser", PublicBrowseReference = "PublicBrowseReference", PublicBrowseUser = "PublicBrowseUser", PublicBrowseDashboardStatistics = "PublicBrowseDashboardStatistics", @@ -55,7 +55,7 @@ export enum AppPermission { EditUser = "EditUser", DeleteUser = "DeleteUser", ExportUsers = "ExportUsers", - BrowseDmpAssociatedUser = "BrowseDmpAssociatedUser", + BrowsePlanAssociatedUser = "BrowsePlanAssociatedUser", //StorageFile @@ -68,38 +68,38 @@ export enum AppPermission { EditDescriptionTemplateType = "EditDescriptionTemplateType", DeleteDescriptionTemplateType = "DeleteDescriptionTemplateType", - //Dmp - BrowseDmp = "BrowseDmp", - EditDmp = "EditDmp", - NewDmp = "NewDmp", - DepositDmp = "DepositDmp", - DeleteDmp = "DeleteDmp", - CloneDmp = "CloneDmp", - ExportDmp = "ExportDmp", - CreateNewVersionDmp = "CreateNewVersionDmp", - FinalizeDmp = "FinalizeDmp", - UndoFinalizeDmp = "UndoFinalizeDmp", - AssignDmpUsers = "AssignDmpUsers", - InviteDmpUsers = "InviteDmpUsers", + //Plan + BrowsePlan = "BrowsePlan", + EditPlan = "EditPlan", + NewPlan = "NewPlan", + DepositPlan = "DepositPlan", + DeletePlan = "DeletePlan", + ClonePlan = "ClonePlan", + ExportPlan = "ExportPlan", + CreateNewVersionPlan = "CreateNewVersionPlan", + FinalizePlan = "FinalizePlan", + UndoFinalizePlan = "UndoFinalizePlan", + AssignPlanUsers = "AssignPlanUsers", + InvitePlanUsers = "InvitePlanUsers", - //DmpBlueprint - BrowseDmpBlueprint = "BrowseDmpBlueprint", - EditDmpBlueprint = "EditDmpBlueprint", - DeleteDmpBlueprint = "DeleteDmpBlueprint", - CloneDmpBlueprint = "CloneDmpBlueprint", - CreateNewVersionDmpBlueprint = "CreateNewVersionDmpBlueprint", - ExportDmpBlueprint = "ExportDmpBlueprint", - ImportDmpBlueprint = "ImportDmpBlueprint", + //PlanBlueprint + BrowsePlanBlueprint = "BrowsePlanBlueprint", + EditPlanBlueprint = "EditPlanBlueprint", + DeletePlanBlueprint = "DeletePlanBlueprint", + ClonePlanBlueprint = "ClonePlanBlueprint", + CreateNewVersionPlanBlueprint = "CreateNewVersionPlanBlueprint", + ExportPlanBlueprint = "ExportPlanBlueprint", + ImportPlanBlueprint = "ImportPlanBlueprint", - //DmpDescriptionTemplate - BrowseDmpDescriptionTemplate = "BrowseDmpDescriptionTemplate", - EditDmpDescriptionTemplate = "EditDmpDescriptionTemplate", - DeleteDmpDescriptionTemplate = "DeleteDmpDescriptionTemplate", + //PlanDescriptionTemplate + BrowsePlanDescriptionTemplate = "BrowsePlanDescriptionTemplate", + EditPlanDescriptionTemplate = "EditPlanDescriptionTemplate", + DeletePlanDescriptionTemplate = "DeletePlanDescriptionTemplate", - //DmpUser - BrowseDmpUser = "BrowseDmpUser", - EditDmpUser = "EditDmpUser", - DeleteDmpUser = "DeleteDmpUser", + //PlanUser + BrowsePlanUser = "BrowsePlanUser", + EditPlanUser = "EditPlanUser", + DeletePlanUser = "DeletePlanUser", //Description BrowseDescription = "BrowseDescription", @@ -137,10 +137,10 @@ export enum AppPermission { EditTag = "EditTag", DeleteTag = "DeleteTag", - //DmpReference - BrowseDmpReference = "BrowseDmpReference", - EditDmpReference = "EditDmpReference", - DeleteDmpReference = "DeleteDmpReference", + //PlanReference + BrowsePlanReference = "BrowsePlanReference", + EditPlanReference = "EditPlanReference", + DeletePlanReference = "DeletePlanReference", //DescriptionReference BrowseDescriptionReference = "BrowseDescriptionReference", @@ -216,11 +216,11 @@ export enum AppPermission { ViewReferencePage = "ViewReferencePage", ViewEntityLockPage = "ViewEntityLockPage", ViewDescriptionTemplatePage = "ViewDescriptionTemplatePage", - ViewDmpBlueprintPage = "ViewDmpBlueprintPage", + ViewPlanBlueprintPage = "ViewPlanBlueprintPage", ViewPublicDescriptionPage = "ViewPublicDescriptionPage", ViewPublicDmpPage = "ViewPublicDmpPage", ViewMyDescriptionPage = "ViewMyDescriptionPage", - ViewMyDmpPage = "ViewMyDmpPage", + ViewMyPlanPage = "ViewMyPlanPage", ViewHomePage = "ViewHomePage", ViewMineInAppNotificationPage = "ViewMineInAppNotificationPage", ViewTenantConfigurationPage = "ViewTenantConfigurationPage", diff --git a/dmp-frontend/src/app/core/common/enum/plan-access-type.ts b/dmp-frontend/src/app/core/common/enum/plan-access-type.ts index c49005b1c..a44ca9aae 100644 --- a/dmp-frontend/src/app/core/common/enum/plan-access-type.ts +++ b/dmp-frontend/src/app/core/common/enum/plan-access-type.ts @@ -1,4 +1,4 @@ -export enum DmpAccessType { +export enum PlanAccessType { Public = 0, Restricted = 1 } \ No newline at end of file diff --git a/dmp-frontend/src/app/core/common/enum/plan-blueprint-extra-field-data-type.ts b/dmp-frontend/src/app/core/common/enum/plan-blueprint-extra-field-data-type.ts index 2077313f6..775672ba2 100644 --- a/dmp-frontend/src/app/core/common/enum/plan-blueprint-extra-field-data-type.ts +++ b/dmp-frontend/src/app/core/common/enum/plan-blueprint-extra-field-data-type.ts @@ -1,4 +1,4 @@ -export enum DmpBlueprintExtraFieldDataType { +export enum PlanBlueprintExtraFieldDataType { TEXT = 0, RICH_TEXT = 1, DATE = 2, diff --git a/dmp-frontend/src/app/core/common/enum/plan-blueprint-field-category.ts b/dmp-frontend/src/app/core/common/enum/plan-blueprint-field-category.ts index de6927973..c66a1c96a 100644 --- a/dmp-frontend/src/app/core/common/enum/plan-blueprint-field-category.ts +++ b/dmp-frontend/src/app/core/common/enum/plan-blueprint-field-category.ts @@ -1,4 +1,4 @@ -export enum DmpBlueprintFieldCategory { +export enum PlanBlueprintFieldCategory { System = 0, Extra = 1, ReferenceType = 2 diff --git a/dmp-frontend/src/app/core/common/enum/plan-blueprint-field-type.ts b/dmp-frontend/src/app/core/common/enum/plan-blueprint-field-type.ts index 47c979fb3..e7c91c081 100644 --- a/dmp-frontend/src/app/core/common/enum/plan-blueprint-field-type.ts +++ b/dmp-frontend/src/app/core/common/enum/plan-blueprint-field-type.ts @@ -1,4 +1,4 @@ -export enum DmpBlueprintExtraFieldDataType { +export enum PlanBlueprintExtraFieldDataType { Text = 0, RichText = 1, Date = 2, diff --git a/dmp-frontend/src/app/core/common/enum/plan-blueprint-status.ts b/dmp-frontend/src/app/core/common/enum/plan-blueprint-status.ts index a78b43359..ffa2ecf97 100644 --- a/dmp-frontend/src/app/core/common/enum/plan-blueprint-status.ts +++ b/dmp-frontend/src/app/core/common/enum/plan-blueprint-status.ts @@ -1,4 +1,4 @@ -export enum DmpBlueprintStatus { +export enum PlanBlueprintStatus { Draft = 0, Finalized = 1 } diff --git a/dmp-frontend/src/app/core/common/enum/plan-blueprint-system-field-type.ts b/dmp-frontend/src/app/core/common/enum/plan-blueprint-system-field-type.ts index 2e20bf40f..d0a0d0f96 100644 --- a/dmp-frontend/src/app/core/common/enum/plan-blueprint-system-field-type.ts +++ b/dmp-frontend/src/app/core/common/enum/plan-blueprint-system-field-type.ts @@ -1,4 +1,4 @@ -export enum DmpBlueprintSystemFieldType { +export enum PlanBlueprintSystemFieldType { Title = 0, Description = 1, // RESEARCHERS = 2, diff --git a/dmp-frontend/src/app/core/common/enum/plan-blueprint-type.ts b/dmp-frontend/src/app/core/common/enum/plan-blueprint-type.ts index 669badd81..8300d25d8 100644 --- a/dmp-frontend/src/app/core/common/enum/plan-blueprint-type.ts +++ b/dmp-frontend/src/app/core/common/enum/plan-blueprint-type.ts @@ -1,3 +1,3 @@ -export enum DmpBlueprintType { +export enum PlanBlueprintType { Input = 0 } \ No newline at end of file diff --git a/dmp-frontend/src/app/core/common/enum/plan-blueprint-version-status.ts b/dmp-frontend/src/app/core/common/enum/plan-blueprint-version-status.ts index 16f1c0cbd..b4ff8ec31 100644 --- a/dmp-frontend/src/app/core/common/enum/plan-blueprint-version-status.ts +++ b/dmp-frontend/src/app/core/common/enum/plan-blueprint-version-status.ts @@ -1,4 +1,4 @@ -export enum DmpBlueprintVersionStatus { +export enum PlanBlueprintVersionStatus { Current = 0, Previous = 1, NotFinalized = 2 diff --git a/dmp-frontend/src/app/core/common/enum/plan-status.ts b/dmp-frontend/src/app/core/common/enum/plan-status.ts index 3a836657e..0e2550529 100644 --- a/dmp-frontend/src/app/core/common/enum/plan-status.ts +++ b/dmp-frontend/src/app/core/common/enum/plan-status.ts @@ -1,4 +1,4 @@ -export enum DmpStatus { +export enum PlanStatus { Draft = 0, Finalized = 1 } \ No newline at end of file diff --git a/dmp-frontend/src/app/core/common/enum/plan-user-role.ts b/dmp-frontend/src/app/core/common/enum/plan-user-role.ts index b9d0d6eef..40d8c9587 100644 --- a/dmp-frontend/src/app/core/common/enum/plan-user-role.ts +++ b/dmp-frontend/src/app/core/common/enum/plan-user-role.ts @@ -1,4 +1,4 @@ -export enum DmpUserRole { +export enum PlanUserRole { Owner = 0, Viewer = 1, DescriptionContributor = 2, diff --git a/dmp-frontend/src/app/core/common/enum/plan-user-type.ts b/dmp-frontend/src/app/core/common/enum/plan-user-type.ts index 56e656c0c..b8f958f9b 100644 --- a/dmp-frontend/src/app/core/common/enum/plan-user-type.ts +++ b/dmp-frontend/src/app/core/common/enum/plan-user-type.ts @@ -1,4 +1,4 @@ -export enum DmpUserType { +export enum PlanUserType { Internal = 0, External = 1 } \ No newline at end of file diff --git a/dmp-frontend/src/app/core/common/enum/plan-version-status.ts b/dmp-frontend/src/app/core/common/enum/plan-version-status.ts index df9a4dd5d..1a2a03715 100644 --- a/dmp-frontend/src/app/core/common/enum/plan-version-status.ts +++ b/dmp-frontend/src/app/core/common/enum/plan-version-status.ts @@ -1,4 +1,4 @@ -export enum DmpVersionStatus { +export enum PlanVersionStatus { Current = 0, Previous = 1, NotFinalized = 2 diff --git a/dmp-frontend/src/app/core/common/enum/respone-error-code.ts b/dmp-frontend/src/app/core/common/enum/respone-error-code.ts index d09a578c8..5d2364b6f 100644 --- a/dmp-frontend/src/app/core/common/enum/respone-error-code.ts +++ b/dmp-frontend/src/app/core/common/enum/respone-error-code.ts @@ -18,12 +18,12 @@ export enum ResponseErrorCode { MultipleDmpVersionsNotSupported = 118, DmpIsFinalized = 119, DmpCanNotChange = 120, - DmpDescriptionTemplateCanNotChange = 121, + PlanDescriptionTemplateCanNotChange = 121, InvalidDescriptionTemplate = 122, DescriptionIsFinalized = 123, - DmpBlueprintHasNoDescriptionTemplates = 124, - DmpBlueprintNewVersionConflict = 125, - DmpDescriptionTemplateCanNotRemove = 126, + PlanBlueprintHasNoDescriptionTemplates = 124, + PlanBlueprintNewVersionConflict = 125, + PlanDescriptionTemplateCanNotRemove = 126, TenantTampering = 127, TenantConfigurationTypeCanNotChange = 128, MultipleTenantConfigurationTypeNotAllowed = 129, @@ -33,10 +33,10 @@ export enum ResponseErrorCode { DescriptionTemplateMissingUserContactInfo = 133, DmpInactiveUser = 134, DmpMissingUserContactInfo = 135, - ImportDescriptionWithoutDmpDescriptionTemplate = 136, - DuplicateDmpUser = 137, + ImportDescriptionWithoutPlanDescriptionTemplate = 136, + DuplicatePlanUser = 137, DescriptionTemplateNewVersionAlreadyCreatedDraft = 138, - DmpBlueprintNewVersionAlreadyCreatedDraft = 139, + PlanBlueprintNewVersionAlreadyCreatedDraft = 139, ReferenceTypeCodeExists = 140, PrefillingSourceCodeExists = 141, InviteUserAlreadyConfirmed = 142, @@ -80,27 +80,27 @@ export class ResponseErrorCodeHelper { case ResponseErrorCode.MultipleDescriptionTemplateVersionsNotSupported: return language.instant("GENERAL.BACKEND-ERRORS.MULTIPLE-DESCRIPTION-TEMPLATE-VERSIONS-NOT-SUPPORTED"); case ResponseErrorCode.DmpNewVersionConflict: - return language.instant("GENERAL.BACKEND-ERRORS.DMP-NEW-VERSION-CONFLICT"); + return language.instant("GENERAL.BACKEND-ERRORS.PLAN-NEW-VERSION-CONFLICT"); case ResponseErrorCode.DmpIsNotFinalized: - return language.instant("GENERAL.BACKEND-ERRORS.DMP-IS-NOT-FINALIZED"); + return language.instant("GENERAL.BACKEND-ERRORS.PLAN-IS-NOT-FINALIZED"); case ResponseErrorCode.MultipleDmpVersionsNotSupported: - return language.instant("GENERAL.BACKEND-ERRORS.MULTIPLE-DMP-VERSIONS-NOT-SUPPORTED"); + return language.instant("GENERAL.BACKEND-ERRORS.MULTIPLE-PLAN-VERSIONS-NOT-SUPPORTED"); case ResponseErrorCode.DmpIsFinalized: - return language.instant("GENERAL.BACKEND-ERRORS.DMP-IS-FINALIZED"); + return language.instant("GENERAL.BACKEND-ERRORS.PLAN-IS-FINALIZED"); case ResponseErrorCode.DmpCanNotChange: - return language.instant("GENERAL.BACKEND-ERRORS.DMP-CAN-NOT-CHANGE"); - case ResponseErrorCode.DmpDescriptionTemplateCanNotChange: - return language.instant("GENERAL.BACKEND-ERRORS.DMP-DESCRIPTION-TEMPLATE-CAN-NOT-CHANGE"); + return language.instant("GENERAL.BACKEND-ERRORS.PLAN-CAN-NOT-CHANGE"); + case ResponseErrorCode.PlanDescriptionTemplateCanNotChange: + return language.instant("GENERAL.BACKEND-ERRORS.PLAN-DESCRIPTION-TEMPLATE-CAN-NOT-CHANGE"); case ResponseErrorCode.InvalidDescriptionTemplate: return language.instant("GENERAL.BACKEND-ERRORS.INVALID-DESCRIPTION-TEMPLATE"); case ResponseErrorCode.DescriptionIsFinalized: return language.instant("GENERAL.BACKEND-ERRORS.DESCRIPTION-IS-FINALIZED"); - case ResponseErrorCode.DmpBlueprintHasNoDescriptionTemplates: - return language.instant("GENERAL.BACKEND-ERRORS.DMP-BLUEPRINT-HAS-NO-DESCRIPTION-TEMPLATES"); - case ResponseErrorCode.DmpBlueprintNewVersionConflict: - return language.instant("GENERAL.BACKEND-ERRORS.DMP-BLUEPRINT-NEW-VERSION-CONFLICT"); - case ResponseErrorCode.DmpDescriptionTemplateCanNotRemove: - return language.instant("GENERAL.BACKEND-ERRORS.DMP-DESCRIPTION-TEMPLATE-CAN-NOT-REMOVE"); + case ResponseErrorCode.PlanBlueprintHasNoDescriptionTemplates: + return language.instant("GENERAL.BACKEND-ERRORS.PLAN-BLUEPRINT-HAS-NO-DESCRIPTION-TEMPLATES"); + case ResponseErrorCode.PlanBlueprintNewVersionConflict: + return language.instant("GENERAL.BACKEND-ERRORS.PLAN-BLUEPRINT-NEW-VERSION-CONFLICT"); + case ResponseErrorCode.PlanDescriptionTemplateCanNotRemove: + return language.instant("GENERAL.BACKEND-ERRORS.PLAN-DESCRIPTION-TEMPLATE-CAN-NOT-REMOVE"); case ResponseErrorCode.TenantTampering: return language.instant("GENERAL.BACKEND-ERRORS.TENANT-TAMPERING"); case ResponseErrorCode.TenantConfigurationTypeCanNotChange: @@ -110,21 +110,21 @@ export class ResponseErrorCodeHelper { case ResponseErrorCode.TenantCodeExists: return language.instant("GENERAL.BACKEND-ERRORS.TENANT-CODE-EXISTS"); case ResponseErrorCode.DmpNewVersionAlreadyCreatedDraft: - return language.instant("GENERAL.BACKEND-ERRORS.DMP-NEW-VERSION-ALREADY-CREATED-DRAFT"); + return language.instant("GENERAL.BACKEND-ERRORS.PLAN-NEW-VERSION-ALREADY-CREATED-DRAFT"); case ResponseErrorCode.DescriptionTemplateInactiveUser: return language.instant("GENERAL.BACKEND-ERRORS.DESCRIPTION-TEMPLATE-INACTIVE-USER"); case ResponseErrorCode.DescriptionTemplateMissingUserContactInfo: return language.instant("GENERAL.BACKEND-ERRORS.DESCRIPTION-TEMPLATE-MISSING-USER-CONTACT-INFO"); case ResponseErrorCode.DmpInactiveUser: - return language.instant("GENERAL.BACKEND-ERRORS.DMP-INACTIVE-USER"); + return language.instant("GENERAL.BACKEND-ERRORS.PLAN-INACTIVE-USER"); case ResponseErrorCode.DmpMissingUserContactInfo: - return language.instant("GENERAL.BACKEND-ERRORS.DMP-MISSING-USER-CONTACT-INFO"); - case ResponseErrorCode.ImportDescriptionWithoutDmpDescriptionTemplate: - return language.instant("GENERAL.BACKEND-ERRORS.IMPORT-DESCRIPTION-WITHOUT-DMP-DESCRIPTION-TEMPLATE"); + return language.instant("GENERAL.BACKEND-ERRORS.PLAN-MISSING-USER-CONTACT-INFO"); + case ResponseErrorCode.ImportDescriptionWithoutPlanDescriptionTemplate: + return language.instant("GENERAL.BACKEND-ERRORS.IMPORT-DESCRIPTION-WITHOUT-PLAN-DESCRIPTION-TEMPLATE"); case ResponseErrorCode.InvalidApiKey: return language.instant("GENERAL.BACKEND-ERRORS.INVALID-API-KEY"); - case ResponseErrorCode.DuplicateDmpUser: - return language.instant("GENERAL.BACKEND-ERRORS.DUPLICATE-DMP-USER"); + case ResponseErrorCode.DuplicatePlanUser: + return language.instant("GENERAL.BACKEND-ERRORS.DUPLICATE-PLAN-USER"); case ResponseErrorCode.StaleApiKey: return language.instant("GENERAL.BACKEND-ERRORS.STALE-API-KEY"); case ResponseErrorCode.SensitiveInfo: @@ -143,8 +143,8 @@ export class ResponseErrorCodeHelper { return language.instant("GENERAL.BACKEND-ERRORS.OVERLAPPING-TENANT-CONFIGURATION-NOTIFIER-LIST"); case ResponseErrorCode.DescriptionTemplateNewVersionAlreadyCreatedDraft: return language.instant("GENERAL.BACKEND-ERRORS.DESCRIPTION-TEMPLATE-NEW-VERSION-ALREADY-CREATED-DRAFT"); - case ResponseErrorCode.DmpBlueprintNewVersionAlreadyCreatedDraft: - return language.instant("GENERAL.BACKEND-ERRORS.DMP-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT"); + case ResponseErrorCode.PlanBlueprintNewVersionAlreadyCreatedDraft: + return language.instant("GENERAL.BACKEND-ERRORS.PLAN-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT"); case ResponseErrorCode.ReferenceTypeCodeExists: return language.instant("GENERAL.BACKEND-ERRORS.REFERENCE-TYPE-CODE-EXISTS"); case ResponseErrorCode.PrefillingSourceCodeExists: diff --git a/dmp-frontend/src/app/core/core-service.module.ts b/dmp-frontend/src/app/core/core-service.module.ts index ead631c5c..a5dcccfe8 100644 --- a/dmp-frontend/src/app/core/core-service.module.ts +++ b/dmp-frontend/src/app/core/core-service.module.ts @@ -8,8 +8,8 @@ import { LanguageInfoService } from './services/culture/language-info-service'; import { DashboardService } from './services/dashboard/dashboard.service'; import { DepositService } from './services/deposit/deposit.service'; import { DescriptionTemplateTypeService } from './services/description-template-type/description-template-type.service'; -import { DmpBlueprintService } from './services/plan/plan-blueprint.service'; -import { DmpService } from './services/plan/plan.service'; +import { PlanBlueprintService } from './services/plan/plan-blueprint.service'; +import { PlanService } from './services/plan/plan.service'; import { BaseHttpV2Service } from './services/http/base-http-v2.service'; import { LanguageService } from './services/language/language.service'; import { LockService } from './services/lock/lock.service'; @@ -79,7 +79,7 @@ export class CoreServiceModule { LoggingService, DashboardService, DepositService, - DmpBlueprintService, + PlanBlueprintService, ContactSupportService, LanguageService, LockService, @@ -100,7 +100,7 @@ export class CoreServiceModule { TenantService, UserService, LanguageHttpService, - DmpService, + PlanService, DescriptionService, MaintenanceService, TagService, diff --git a/dmp-frontend/src/app/core/model/dashboard/recent-activity-item.ts b/dmp-frontend/src/app/core/model/dashboard/recent-activity-item.ts index 57ed24450..34b14d7dd 100644 --- a/dmp-frontend/src/app/core/model/dashboard/recent-activity-item.ts +++ b/dmp-frontend/src/app/core/model/dashboard/recent-activity-item.ts @@ -1,9 +1,9 @@ import { RecentActivityItemType } from "@app/core/common/enum/recent-activity-item-type"; import { Description } from "../description/description"; -import { Dmp } from "../plan/plan"; +import { Plan } from "../plan/plan"; export interface RecentActivityItem { type: RecentActivityItemType; - dmp: Dmp; + plan: Plan; description: Description; } diff --git a/dmp-frontend/src/app/core/model/deposit/deposit-request.ts b/dmp-frontend/src/app/core/model/deposit/deposit-request.ts index f60d68a0a..90e9650ec 100644 --- a/dmp-frontend/src/app/core/model/deposit/deposit-request.ts +++ b/dmp-frontend/src/app/core/model/deposit/deposit-request.ts @@ -2,7 +2,7 @@ import { Guid } from "@common/types/guid"; export class DepositRequest { repositoryId: string; - dmpId: Guid; + planId: Guid; authorizationCode: String; project: DepositRequestFields; } diff --git a/dmp-frontend/src/app/core/model/description/description.ts b/dmp-frontend/src/app/core/model/description/description.ts index bb96acb05..2468d8717 100644 --- a/dmp-frontend/src/app/core/model/description/description.ts +++ b/dmp-frontend/src/app/core/model/description/description.ts @@ -2,7 +2,7 @@ import { DescriptionStatus } from "@app/core/common/enum/description-status"; import { BaseEntity, BaseEntityPersist } from "@common/base/base-entity.model"; import { Guid } from "@common/types/guid"; import { DescriptionTemplate } from "../description-template/description-template"; -import { Dmp, DmpDescriptionTemplate, PublicDmp } from "../plan/plan"; +import { Plan, PlanDescriptionTemplate, PublicPlan } from "../plan/plan"; import { Reference, ReferencePersist } from "../reference/reference"; import { Tag, TagPersist } from "../tag/tag"; import { User } from "../user/user"; @@ -17,8 +17,8 @@ export interface Description extends BaseDescription { descriptionReferences?: DescriptionReference[]; descriptionTags?: DescriptionTag[]; descriptionTemplate?: DescriptionTemplate; - dmpDescriptionTemplate?: DmpDescriptionTemplate; - dmp?: Dmp; + planDescriptionTemplate?: PlanDescriptionTemplate; + plan?: Plan; authorizationFlags?: AppPermission[]; } @@ -73,8 +73,8 @@ export interface DescriptionTag extends BaseEntity { // export interface DescriptionPersist extends BaseEntityPersist { label: string; - dmpId: Guid; - dmpDescriptionTemplateId: Guid; + planId: Guid; + planDescriptionTemplateId: Guid; descriptionTemplateId: Guid; status: DescriptionStatus; description: string; @@ -134,13 +134,13 @@ export interface PublicDescription extends BaseDescription { description?: string; finalizedAt?: Date; descriptionTemplate?: PublicDescriptionTemplate; - dmpDescriptionTemplate?: PublicDmpDescriptionTemplate; - dmp?: PublicDmp; + planDescriptionTemplate?: PublicPlanDescriptionTemplate; + plan?: PublicPlan; } -export interface PublicDmpDescriptionTemplate { +export interface PublicPlanDescriptionTemplate { id: Guid; - dmp: PublicDmp; + plan: PublicPlan; } export interface PublicDescriptionTemplate { @@ -149,7 +149,7 @@ export interface PublicDescriptionTemplate { description: string; } export interface DescriptionSectionPermissionResolver { - dmpId: Guid; + planId: Guid; sectionIds: Guid[]; permissions: string[]; } diff --git a/dmp-frontend/src/app/core/model/plan-blueprint/plan-blueprint.ts b/dmp-frontend/src/app/core/model/plan-blueprint/plan-blueprint.ts index f67a7bf17..562c4ffe6 100644 --- a/dmp-frontend/src/app/core/model/plan-blueprint/plan-blueprint.ts +++ b/dmp-frontend/src/app/core/model/plan-blueprint/plan-blueprint.ts @@ -1,29 +1,29 @@ -import { DmpBlueprintFieldCategory } from "@app/core/common/enum/plan-blueprint-field-category"; -import { DmpBlueprintExtraFieldDataType } from "@app/core/common/enum/plan-blueprint-field-type"; -import { DmpBlueprintStatus } from "@app/core/common/enum/plan-blueprint-status"; -import { DmpBlueprintSystemFieldType } from "@app/core/common/enum/plan-blueprint-system-field-type"; +import { PlanBlueprintFieldCategory } from "@app/core/common/enum/plan-blueprint-field-category"; +import { PlanBlueprintExtraFieldDataType } from "@app/core/common/enum/plan-blueprint-field-type"; +import { PlanBlueprintStatus } from "@app/core/common/enum/plan-blueprint-status"; +import { PlanBlueprintSystemFieldType } from "@app/core/common/enum/plan-blueprint-system-field-type"; import { BaseEntity, BaseEntityPersist } from "@common/base/base-entity.model"; import { Guid } from "@common/types/guid"; import { ReferenceType } from "../reference-type/reference-type"; import { PrefillingSource } from "../prefilling-source/prefilling-source"; -import { DmpBlueprintVersionStatus } from "@app/core/common/enum/plan-blueprint-version-status"; +import { PlanBlueprintVersionStatus } from "@app/core/common/enum/plan-blueprint-version-status"; -export interface DmpBlueprint extends BaseEntity { +export interface PlanBlueprint extends BaseEntity { label: string; - definition: DmpBlueprintDefinition; - status: DmpBlueprintStatus; + definition: PlanBlueprintDefinition; + status: PlanBlueprintStatus; version: number; - versionStatus: DmpBlueprintVersionStatus; + versionStatus: PlanBlueprintVersionStatus; groupId: Guid; } -export interface DmpBlueprintDefinition { - sections?: DmpBlueprintDefinitionSection[]; +export interface PlanBlueprintDefinition { + sections?: PlanBlueprintDefinitionSection[]; } -export interface DmpBlueprintDefinitionSection { +export interface PlanBlueprintDefinitionSection { id: Guid; label: string; description: string; @@ -43,7 +43,7 @@ export interface DescriptionTemplatesInSection { export interface FieldInSection { id: Guid; - category: DmpBlueprintFieldCategory; + category: PlanBlueprintFieldCategory; label: string; placeholder: string; description: string; @@ -53,11 +53,11 @@ export interface FieldInSection { } export interface SystemFieldInSection extends FieldInSection { - systemFieldType: DmpBlueprintSystemFieldType; + systemFieldType: PlanBlueprintSystemFieldType; } export interface ExtraFieldInSection extends FieldInSection { - dataType: DmpBlueprintExtraFieldDataType; + dataType: PlanBlueprintExtraFieldDataType; } export interface ReferenceTypeFieldInSection extends FieldInSection { @@ -68,23 +68,23 @@ export interface ReferenceTypeFieldInSection extends FieldInSection { // // Persist // -export interface DmpBlueprintPersist extends BaseEntityPersist { +export interface PlanBlueprintPersist extends BaseEntityPersist { label: string; - definition: DmpBlueprintDefinitionPersist; - status: DmpBlueprintStatus; + definition: PlanBlueprintDefinitionPersist; + status: PlanBlueprintStatus; } -export interface NewVersionDmpBlueprintPersist { +export interface NewVersionPlanBlueprintPersist { label: string; - definition: DmpBlueprintDefinitionPersist; - status: DmpBlueprintStatus; + definition: PlanBlueprintDefinitionPersist; + status: PlanBlueprintStatus; } -export interface DmpBlueprintDefinitionPersist { - sections?: DmpBlueprintDefinitionSectionPersist[]; +export interface PlanBlueprintDefinitionPersist { + sections?: PlanBlueprintDefinitionSectionPersist[]; } -export interface DmpBlueprintDefinitionSectionPersist { +export interface PlanBlueprintDefinitionSectionPersist { id: Guid; label: string; description: string; @@ -104,7 +104,7 @@ export interface DescriptionTemplatesInSectionPersist { export interface FieldInSectionPersist { id: Guid; - category: DmpBlueprintFieldCategory; + category: PlanBlueprintFieldCategory; label: string; placeholder: string; description: string; @@ -114,11 +114,11 @@ export interface FieldInSectionPersist { } export interface SystemFieldInSectionPersist extends FieldInSectionPersist { - systemFieldType: DmpBlueprintSystemFieldType; + systemFieldType: PlanBlueprintSystemFieldType; } export interface ExtraFieldInSectionPersist extends FieldInSectionPersist { - dataType: DmpBlueprintExtraFieldDataType; + dataType: PlanBlueprintExtraFieldDataType; } export interface ReferenceTypeFieldInSectionPersist extends FieldInSectionPersist { diff --git a/dmp-frontend/src/app/core/model/plan/plan-import.ts b/dmp-frontend/src/app/core/model/plan/plan-import.ts index 3c7349cc3..25feda261 100644 --- a/dmp-frontend/src/app/core/model/plan/plan-import.ts +++ b/dmp-frontend/src/app/core/model/plan/plan-import.ts @@ -2,14 +2,14 @@ import { Guid } from "@common/types/guid"; import { DescriptionCommonModelConfig, PreprocessingDescriptionModel } from "../description/description-import"; // preprocessing -export interface PreprocessingDmpModel { +export interface PreprocessingPlanModel { label: string; blueprintId: Guid; preprocessingDescriptionModels: PreprocessingDescriptionModel[]; } // rda config -export interface DmpCommonModelConfig { +export interface PlanCommonModelConfig { fileId: Guid; label: string; blueprintId: Guid; diff --git a/dmp-frontend/src/app/core/model/plan/plan-reference.ts b/dmp-frontend/src/app/core/model/plan/plan-reference.ts index cb984bd31..d5d5d41dc 100644 --- a/dmp-frontend/src/app/core/model/plan/plan-reference.ts +++ b/dmp-frontend/src/app/core/model/plan/plan-reference.ts @@ -1,14 +1,14 @@ import { BaseEntity } from "@common/base/base-entity.model"; import { Reference } from "../reference/reference"; -import { Dmp } from "./plan"; +import { Plan } from "./plan"; import { Guid } from "@common/types/guid"; -export interface DmpReference extends BaseEntity { - dmp?: Dmp; +export interface PlanReference extends BaseEntity { + plan?: Plan; reference?: Reference; - data: DmpReferenceData; + data: PlanReferenceData; } -export interface DmpReferenceData { +export interface PlanReferenceData { blueprintFieldId: Guid; } \ No newline at end of file diff --git a/dmp-frontend/src/app/core/model/plan/plan.ts b/dmp-frontend/src/app/core/model/plan/plan.ts index d1f960da4..e17d1ae3f 100644 --- a/dmp-frontend/src/app/core/model/plan/plan.ts +++ b/dmp-frontend/src/app/core/model/plan/plan.ts @@ -1,71 +1,71 @@ -import { DmpAccessType } from '@app/core/common/enum/plan-access-type'; -import { DmpStatus } from '@app/core/common/enum/plan-status'; -import { DmpUserRole } from '@app/core/common/enum/plan-user-role'; -import { DmpVersionStatus } from '@app/core/common/enum/plan-version-status'; +import { PlanAccessType } from '@app/core/common/enum/plan-access-type'; +import { PlanStatus } from '@app/core/common/enum/plan-status'; +import { PlanUserRole } from '@app/core/common/enum/plan-user-role'; +import { PlanVersionStatus } from '@app/core/common/enum/plan-version-status'; import { BaseEntity, BaseEntityPersist } from '@common/base/base-entity.model'; import { Guid } from '@common/types/guid'; import { DescriptionTemplate } from '../description-template/description-template'; import { BaseDescription, Description, PublicDescription } from '../description/description'; -import { DmpBlueprint } from '../plan-blueprint/plan-blueprint'; +import { PlanBlueprint } from '../plan-blueprint/plan-blueprint'; import { EntityDoi } from '../entity-doi/entity-doi'; import { ReferencePersist } from '../reference/reference'; import { User } from "../user/user"; -import { DmpReference } from './plan-reference'; +import { PlanReference } from './plan-reference'; import { IsActive } from '@app/core/common/enum/is-active.enum'; import { AppPermission } from '@app/core/common/enum/permission.enum'; import { EntityType } from '@app/core/common/enum/entity-type'; -export interface Dmp extends BaseDmp { +export interface Plan extends BasePlan { label?: string; version?: number; - versionStatus?: DmpVersionStatus; - properties?: DmpProperties; + versionStatus?: PlanVersionStatus; + properties?: PlanProperties; groupId?: String; description?: String; finalizedAt?: Date; publishedAt?: Date; creator?: User; - accessType?: DmpAccessType; - blueprint?: DmpBlueprint; + accessType?: PlanAccessType; + blueprint?: PlanBlueprint; language?: String; publicAfter?: Date; - dmpReferences?: DmpReference[]; - dmpUsers?: DmpUser[]; + planReferences?: PlanReference[]; + planUsers?: PlanUser[]; descriptions?: Description[]; - dmpDescriptionTemplates?: DmpDescriptionTemplate[]; + planDescriptionTemplates?: PlanDescriptionTemplate[]; entityDois?: EntityDoi[]; - otherDmpVersions?: Dmp[]; + otherPlanVersions?: Plan[]; authorizationFlags?: AppPermission[]; } -export interface DmpProperties { - dmpBlueprintValues: DmpBlueprintValue[]; - contacts: DmpContact[]; +export interface PlanProperties { + planBlueprintValues: PlanBlueprintValue[]; + contacts: PlanContact[]; } -export interface DmpBlueprintValue { +export interface PlanBlueprintValue { fieldId: Guid; fieldValue: string; dateValue: Date; numberValue: number; } -export interface DmpContact { +export interface PlanContact { firstName: string; lastName: string; email: string; } -export interface DmpUser extends BaseEntity { - dmp: Dmp; +export interface PlanUser extends BaseEntity { + plan: Plan; user: User; - role: DmpUserRole; + role: PlanUserRole; sectionId: Guid; } -export interface DmpDescriptionTemplate extends BaseEntity { - dmp?: Dmp; +export interface PlanDescriptionTemplate extends BaseEntity { + plan?: Plan; currentDescriptionTemplate?: DescriptionTemplate; //TODO: what is this? descriptionTemplates?: DescriptionTemplate[]; //TODO: why it is array? descriptionTemplateGroupId?: Guid; @@ -75,112 +75,112 @@ export interface DmpDescriptionTemplate extends BaseEntity { // // Persist // -export interface DmpPersist extends BaseEntityPersist { +export interface PlanPersist extends BaseEntityPersist { label: string; - status: DmpStatus; - properties: DmpPropertiesPersist; + status: PlanStatus; + properties: PlanPropertiesPersist; description: String; language: String; blueprint: Guid; - accessType: DmpAccessType; - descriptionTemplates: DmpDescriptionTemplatePersist[]; - users: DmpUserPersist[]; + accessType: PlanAccessType; + descriptionTemplates: PlanDescriptionTemplatePersist[]; + users: PlanUserPersist[]; } -export interface DmpPropertiesPersist { - dmpBlueprintValues: Map; - contacts: DmpContactPersist[]; +export interface PlanPropertiesPersist { + planBlueprintValues: Map; + contacts: PlanContactPersist[]; } -export interface DmpBlueprintValuePersist { +export interface PlanBlueprintValuePersist { fieldId: Guid; fieldValue: string; dateValue: Date; numberValue: number; - references: DmpReferencePersist[]; - reference: DmpReferencePersist; + references: PlanReferencePersist[]; + reference: PlanReferencePersist; } -export interface DmpContactPersist { +export interface PlanContactPersist { firstName: string; lastName: string; email: string; } -export interface DmpReferencePersist { +export interface PlanReferencePersist { reference?: ReferencePersist; - data?: DmpReferenceDataPersist; + data?: PlanReferenceDataPersist; } -export interface DmpReferenceDataPersist { +export interface PlanReferenceDataPersist { blueprintFieldId: Guid; } -export interface DmpDescriptionTemplatePersist { +export interface PlanDescriptionTemplatePersist { descriptionTemplateGroupId: Guid; sectionId: Guid; } -export interface CloneDmpPersist { +export interface ClonePlanPersist { id: Guid; label: string; description: String; descriptions: Guid[]; } -export interface NewVersionDmpPersist { +export interface NewVersionPlanPersist { id: Guid; label: string; description: String; blueprintId: Guid; - descriptions: NewVersionDmpDescriptionPersist[]; + descriptions: NewVersionPlanDescriptionPersist[]; hash?: string; } -export interface NewVersionDmpDescriptionPersist { +export interface NewVersionPlanDescriptionPersist { descriptionId: Guid; blueprintSectionId: Guid; } -export interface DmpUserPersist { +export interface PlanUserPersist { user: Guid; - role: DmpUserRole; + role: PlanUserRole; email: string; sectionId: string; } -export interface DmpUserRemovePersist { +export interface PlanUserRemovePersist { id: Guid; - dmpId: Guid; - role: DmpUserRole; + planId: Guid; + role: PlanUserRole; } -export interface DmpUserInvitePersist { - users: DmpUserPersist[]; +export interface PlanUserInvitePersist { + users: PlanUserPersist[]; } // // Public // -export interface PublicDmp extends BaseDmp { +export interface PublicPlan extends BasePlan { label?: string; version?: number; description?: string; finalizedAt?: Date; publishedAt?: Date; groupId?: String; - accessType: DmpAccessType; - dmpReferences: PublicDmpReference[]; - dmpUsers: PublicDmpUser[]; + accessType: PlanAccessType; + planReferences: PublicPlanReference[]; + planUsers: PublicPlanUser[]; descriptions: PublicDescription[]; entityDois: PublicEntityDoi[]; - otherDmpVersions?: PublicDmp[]; + otherPlanVersions?: PublicPlan[]; } -export interface PublicDmpReference { +export interface PublicPlanReference { id: Guid; - dmp: PublicDmp; + plan: PublicPlan; reference: PublicReference; isActive?: IsActive; } @@ -199,11 +199,11 @@ export interface PublicReferenceType { code: string; } -export interface PublicDmpUser { +export interface PublicPlanUser { id: Guid; - dmp: PublicDmp; + plan: PublicPlan; user: PublicUser; - role: DmpUserRole; + role: PlanUserRole; } export interface PublicUser { @@ -219,7 +219,7 @@ export interface PublicEntityDoi { doi: string; } -export interface BaseDmp extends BaseEntity { - status?: DmpStatus; +export interface BasePlan extends BaseEntity { + status?: PlanStatus; descriptions?: BaseDescription[]; } diff --git a/dmp-frontend/src/app/core/pipes/field-value.pipe.ts b/dmp-frontend/src/app/core/pipes/field-value.pipe.ts index 072e553cc..8df9e7f7b 100644 --- a/dmp-frontend/src/app/core/pipes/field-value.pipe.ts +++ b/dmp-frontend/src/app/core/pipes/field-value.pipe.ts @@ -8,7 +8,7 @@ import { DescriptionTemplateField, DescriptionTemplateLabelAndMultiplicityData, import { DescriptionFieldPersist } from "../model/description/description"; import { StorageFile } from "../model/storage-file/storage-file"; import { DescriptionService } from "../services/description/description.service"; -import { DmpService } from "../services/plan/plan.service"; +import { PlanService } from "../services/plan/plan.service"; import { StorageFileService } from "../services/storage-file/storage-file.service"; import { DateTimeFormatPipe } from "./date-time-format.pipe"; @@ -19,7 +19,7 @@ export class FieldValuePipe implements PipeTransform { constructor( private dateTimeFormatPipe: DateTimeFormatPipe, - private dmpService: DmpService, + private planService: PlanService, private storageFileService: StorageFileService, private descriptionService: DescriptionService, private language: TranslateService) { @@ -77,9 +77,9 @@ export class FieldValuePipe implements PipeTransform { case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DMPS: { const data = field.data; if (!data?.multipleSelect && controlValue.textValue && controlValue.textValue.length > 0) { - return this.dmpService.query(this.dmpService.buildAutocompleteLookup(null, null, [Guid.parse(controlValue.textValue)])).pipe(map(x => x.items?.map(y => y.label).join(','))); + return this.planService.query(this.planService.buildAutocompleteLookup(null, null, [Guid.parse(controlValue.textValue)])).pipe(map(x => x.items?.map(y => y.label).join(','))); } else if (data?.multipleSelect && controlValue.references && controlValue.textListValue && controlValue.textListValue.length > 0) { - return this.dmpService.query(this.dmpService.buildAutocompleteLookup(null, null, controlValue.textListValue.map(x => Guid.parse(x)))).pipe(map(x => x.items?.map(y => y.label).join(','))); + return this.planService.query(this.planService.buildAutocompleteLookup(null, null, controlValue.textListValue.map(x => Guid.parse(x)))).pipe(map(x => x.items?.map(y => y.label).join(','))); } break; } diff --git a/dmp-frontend/src/app/core/query/description.lookup.ts b/dmp-frontend/src/app/core/query/description.lookup.ts index 141eeeebb..6899bfd0e 100644 --- a/dmp-frontend/src/app/core/query/description.lookup.ts +++ b/dmp-frontend/src/app/core/query/description.lookup.ts @@ -2,7 +2,7 @@ import { Lookup } from '@common/model/lookup'; import { Guid } from '@common/types/guid'; import { IsActive } from '../common/enum/is-active.enum'; import { DescriptionStatus } from '../common/enum/description-status'; -import { DmpLookup } from './plan.lookup'; +import { PlanLookup } from './plan.lookup'; import { ReferenceType } from '../model/reference-type/reference-type'; import { DescriptionReferenceLookup } from './reference.lookup'; import { DescriptionTagLookup } from './tag.lookup'; @@ -19,7 +19,7 @@ export class DescriptionLookup extends Lookup implements DescriptionFilter { isActive: IsActive[]; statuses: DescriptionStatus[]; - dmpSubQuery: DmpLookup; + planSubQuery: PlanLookup; descriptionTemplateSubQuery: DescriptionTemplateLookup; descriptionTagSubQuery: DescriptionTagLookup; descriptionReferenceSubQuery: DescriptionReferenceLookup; @@ -40,7 +40,7 @@ export interface DescriptionFilter { isActive: IsActive[]; statuses: DescriptionStatus[]; - dmpSubQuery: DmpLookup; + planSubQuery: PlanLookup; descriptionTemplateSubQuery: DescriptionTemplateLookup; descriptionTagSubQuery: DescriptionTagLookup; descriptionReferenceSubQuery: DescriptionReferenceLookup; diff --git a/dmp-frontend/src/app/core/query/plan-blueprint.lookup.ts b/dmp-frontend/src/app/core/query/plan-blueprint.lookup.ts index 7e10cd631..5a5f33061 100644 --- a/dmp-frontend/src/app/core/query/plan-blueprint.lookup.ts +++ b/dmp-frontend/src/app/core/query/plan-blueprint.lookup.ts @@ -1,28 +1,28 @@ import { Lookup } from '@common/model/lookup'; import { Guid } from '@common/types/guid'; import { IsActive } from '../common/enum/is-active.enum'; -import { DmpBlueprintStatus } from '../common/enum/plan-blueprint-status'; -import { DmpBlueprintVersionStatus } from '../common/enum/plan-blueprint-version-status'; +import { PlanBlueprintStatus } from '../common/enum/plan-blueprint-status'; +import { PlanBlueprintVersionStatus } from '../common/enum/plan-blueprint-version-status'; -export class DmpBlueprintLookup extends Lookup implements DmpBlueprintFilter { +export class PlanBlueprintLookup extends Lookup implements PlanBlueprintFilter { ids: Guid[]; excludedIds: Guid[]; like: string; isActive: IsActive[]; - statuses: DmpBlueprintStatus[]; + statuses: PlanBlueprintStatus[]; groupIds: Guid[]; - versionStatuses: DmpBlueprintVersionStatus[]; + versionStatuses: PlanBlueprintVersionStatus[]; constructor() { super(); } } -export interface DmpBlueprintFilter { +export interface PlanBlueprintFilter { ids: Guid[]; excludedIds: Guid[]; like: string; isActive: IsActive[]; - statuses: DmpBlueprintStatus[]; - versionStatuses: DmpBlueprintVersionStatus[]; + statuses: PlanBlueprintStatus[]; + versionStatuses: PlanBlueprintVersionStatus[]; } diff --git a/dmp-frontend/src/app/core/query/plan-description-template.lookup.ts b/dmp-frontend/src/app/core/query/plan-description-template.lookup.ts index 8703bc871..54821408b 100644 --- a/dmp-frontend/src/app/core/query/plan-description-template.lookup.ts +++ b/dmp-frontend/src/app/core/query/plan-description-template.lookup.ts @@ -2,10 +2,10 @@ import { Lookup } from '@common/model/lookup'; import { Guid } from '@common/types/guid'; import { IsActive } from '../common/enum/is-active.enum'; -export class DmpDescriptionTemplateLookup extends Lookup implements DmpDescriptionTemplateFilter { +export class PlanDescriptionTemplateLookup extends Lookup implements PlanDescriptionTemplateFilter { ids: Guid[]; excludedIds: Guid[]; - dmpIds: Guid[]; + planIds: Guid[]; descriptionTemplateGroupIds: Guid[]; sectionIds: Guid[]; isActive: IsActive[]; @@ -16,10 +16,10 @@ export class DmpDescriptionTemplateLookup extends Lookup implements DmpDescripti } } -export interface DmpDescriptionTemplateFilter { +export interface PlanDescriptionTemplateFilter { ids: Guid[]; excludedIds: Guid[]; - dmpIds: Guid[]; + planIds: Guid[]; descriptionTemplateGroupIds: Guid[]; sectionIds: Guid[]; isActive: IsActive[]; diff --git a/dmp-frontend/src/app/core/query/plan-user.lookup.ts b/dmp-frontend/src/app/core/query/plan-user.lookup.ts index 9cd94dd3b..581d85b45 100644 --- a/dmp-frontend/src/app/core/query/plan-user.lookup.ts +++ b/dmp-frontend/src/app/core/query/plan-user.lookup.ts @@ -2,10 +2,10 @@ import { Guid } from "@common/types/guid"; import { IsActive } from "../common/enum/is-active.enum"; import { Lookup } from "@common/model/lookup"; -export class DmpUserLookup extends Lookup implements DmpUserFilter { +export class PlanUserLookup extends Lookup implements PlanUserFilter { ids: Guid[]; isActive: IsActive[]; - dmpIds: Guid[]; + planIds: Guid[]; userIds: Guid[]; sectionIds: Guid[]; userRoles: Guid[]; @@ -15,11 +15,11 @@ export class DmpUserLookup extends Lookup implements DmpUserFilter { } } -export interface DmpUserFilter { +export interface PlanUserFilter { ids: Guid[]; isActive: IsActive[]; - dmpIds: Guid[]; + planIds: Guid[]; userIds: Guid[]; sectionIds: Guid[]; userRoles: Guid[]; diff --git a/dmp-frontend/src/app/core/query/plan.lookup.ts b/dmp-frontend/src/app/core/query/plan.lookup.ts index b15af345f..c734a4300 100644 --- a/dmp-frontend/src/app/core/query/plan.lookup.ts +++ b/dmp-frontend/src/app/core/query/plan.lookup.ts @@ -1,47 +1,48 @@ import { Lookup } from '@common/model/lookup'; import { Guid } from '@common/types/guid'; -import { DmpAccessType } from '../common/enum/plan-access-type'; -import { DmpStatus } from '../common/enum/plan-status'; -import { DmpVersionStatus } from '../common/enum/plan-version-status'; +import { PlanAccessType } from '../common/enum/plan-access-type'; +import { PlanStatus } from '../common/enum/plan-status'; +import { PlanVersionStatus } from '../common/enum/plan-version-status'; import { IsActive } from '../common/enum/is-active.enum'; -import { DmpDescriptionTemplateLookup } from './plan-description-template.lookup'; -import { DmpUserLookup } from './plan-user.lookup'; -import { DmpBlueprintLookup } from './plan-blueprint.lookup'; -import { DmpReferenceLookup } from './reference.lookup'; +import { PlanDescriptionTemplateLookup } from './plan-description-template.lookup'; +import { PlanUserLookup } from './plan-user.lookup'; +import { PlanBlueprintLookup } from './plan-blueprint.lookup'; +import { PlanReferenceLookup } from './reference.lookup'; -export class DmpLookup extends Lookup implements DmpFilter { +export class PlanLookup extends Lookup implements PlanFilter { ids: Guid[]; excludedIds: Guid[]; like: string; isActive: IsActive[]; - versionStatuses: DmpVersionStatus[]; - statuses: DmpStatus[]; - accessTypes: DmpAccessType[]; + versionStatuses: PlanVersionStatus[]; + statuses: PlanStatus[]; + accessTypes: PlanAccessType[]; versions: Number[]; groupIds: Guid[]; - dmpUserSubQuery: DmpUserLookup; - dmpBlueprintSubQuery: DmpBlueprintLookup; - dmpDescriptionTemplateSubQuery: DmpDescriptionTemplateLookup; - dmpReferenceSubQuery: DmpReferenceLookup + planUserSubQuery: PlanUserLookup; + planBlueprintSubQuery: PlanBlueprintLookup; + planDescriptionTemplateSubQuery: PlanDescriptionTemplateLookup; + planReferenceSubQuery: PlanReferenceLookup; constructor() { super(); } } -export interface DmpFilter { +export interface PlanFilter { ids: Guid[]; excludedIds: Guid[]; like: string; isActive: IsActive[]; - versionStatuses: DmpVersionStatus[]; - statuses: DmpStatus[]; - accessTypes: DmpAccessType[]; + versionStatuses: PlanVersionStatus[]; + statuses: PlanStatus[]; + accessTypes: PlanAccessType[]; versions: Number[]; groupIds: Guid[]; - dmpUserSubQuery: DmpUserLookup; - dmpBlueprintSubQuery: DmpBlueprintLookup; - dmpDescriptionTemplateSubQuery: DmpDescriptionTemplateLookup; + planUserSubQuery: PlanUserLookup; + planBlueprintSubQuery: PlanBlueprintLookup; + planDescriptionTemplateSubQuery: PlanDescriptionTemplateLookup; + planReferenceSubQuery: PlanReferenceLookup; } diff --git a/dmp-frontend/src/app/core/query/reference.lookup.ts b/dmp-frontend/src/app/core/query/reference.lookup.ts index ab78cf9e9..5619b41dc 100644 --- a/dmp-frontend/src/app/core/query/reference.lookup.ts +++ b/dmp-frontend/src/app/core/query/reference.lookup.ts @@ -26,7 +26,8 @@ export class DescriptionReferenceLookup extends Lookup { } } -export class DmpReferenceLookup extends Lookup { +export class PlanReferenceLookup extends Lookup { + planIds: Guid[]; referenceIds: Guid[]; excludedIds: Guid[]; like: string; diff --git a/dmp-frontend/src/app/core/services/file-transformer/file-transformer.http.service.ts b/dmp-frontend/src/app/core/services/file-transformer/file-transformer.http.service.ts index 4c14ea2ec..13e35e3da 100644 --- a/dmp-frontend/src/app/core/services/file-transformer/file-transformer.http.service.ts +++ b/dmp-frontend/src/app/core/services/file-transformer/file-transformer.http.service.ts @@ -25,10 +25,10 @@ export class FileTransformerHttpService extends BaseService { return this.http.get(url).pipe(catchError((error: any) => throwError(error))); } - exportDmp(dmpId: Guid, repositoryId: string, format: string): Observable { + exportDmp(planId: Guid, repositoryId: string, format: string): Observable { //TODO: implement const url = `${this.apiBase}/export-dmp`; - return this.http.post(url, {id: dmpId, repositoryId: repositoryId, format: format}, {responseType: 'blob', observe: 'response'}).pipe(catchError((error: any) => throwError(error))); + return this.http.post(url, {id: planId, repositoryId: repositoryId, format: format}, {responseType: 'blob', observe: 'response'}).pipe(catchError((error: any) => throwError(error))); } exportDescription(id: Guid, repositoryId: string, format: string): Observable { diff --git a/dmp-frontend/src/app/core/services/file-transformer/file-transformer.service.ts b/dmp-frontend/src/app/core/services/file-transformer/file-transformer.service.ts index 398334a90..d37590943 100644 --- a/dmp-frontend/src/app/core/services/file-transformer/file-transformer.service.ts +++ b/dmp-frontend/src/app/core/services/file-transformer/file-transformer.service.ts @@ -8,7 +8,7 @@ import { FileUtils } from '../utilities/file-utils.service'; import { AuthService } from '../auth/auth.service'; import { RepositoryFileFormat } from '@app/core/model/file/file-format.model'; import { FileTransformerEntityType } from '@app/core/common/enum/file-transformer-entity-type'; -import { DmpService } from '../plan/plan.service'; +import { PlanService } from '../plan/plan.service'; import { DescriptionService } from '../description/description.service'; import { AnalyticsService } from '../matomo/analytics-service'; import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service'; @@ -20,7 +20,7 @@ export class FileTransformerService extends BaseService { private fileTransformerHttpService: FileTransformerHttpService, private analyticsService: AnalyticsService, private fileUtils: FileUtils, - private dmpService: DmpService, + private planService: PlanService, private descriptionService: DescriptionService, private authentication: AuthService, private httpErrorHandlingService: HttpErrorHandlingService @@ -70,7 +70,7 @@ export class FileTransformerService extends BaseService { exportDmp(id: Guid, repositoryId: string, format: string) { this._loading = true; if (repositoryId == this.xmlExportRepo.repositoryId) { - this.dmpService.downloadXML(id) + this.planService.downloadXML(id) .pipe(takeUntil(this._destroyed)) .subscribe(response => { const blob = new Blob([response.body], { type: 'application/xml' }); diff --git a/dmp-frontend/src/app/core/services/matomo/analytics-service.ts b/dmp-frontend/src/app/core/services/matomo/analytics-service.ts index 148c367dd..c2e40ef55 100644 --- a/dmp-frontend/src/app/core/services/matomo/analytics-service.ts +++ b/dmp-frontend/src/app/core/services/matomo/analytics-service.ts @@ -11,8 +11,8 @@ export class AnalyticsService { public static About: string = 'About'; public static DescriptionTemplateEditor: string = 'Admin: DMP Blueprints'; public static DescriptionTemplateListing: string = 'Admin: DMP Templates'; - public static DmpBlueprintEditor: string = 'Admin: DMP Blueprints'; - public static DmpBlueprintListing: string = 'Admin: DMP Templates'; + public static PlanBlueprintEditor: string = 'Admin: DMP Blueprints'; + public static PlanBlueprintListing: string = 'Admin: DMP Templates'; public static LanguagesEditor: string = 'Admin: Languages'; public static PrefillingSourcesEditor: string = 'Admin: PrefillingSources'; public static ReferencesEditor: string = 'Admin: References'; @@ -29,11 +29,11 @@ export class AnalyticsService { public static DescriptionFilterDialog: string = 'Dataset Criteria'; public static DescriptionListingItem: string = 'Description Listing Item'; public static DescriptionOverview: string = 'Description Overview'; - public static DmpEditor: string = 'DMP Editor'; + public static PlanEditor: string = 'DMP Editor'; public static DmpListing: string = 'DMPs'; public static DmpFilterDialog: string = 'DMP Criteria'; public static DmpListingItem: string = 'DMP Listing Item'; - public static StartNewDmpDialog: string = 'Start New DMP Dialog'; + public static StartNewPlanDialog: string = 'Start New DMP Dialog'; public static DmpUploadDialog: string = 'DMP Upload Dialog'; public static DmpOverview: string = 'DMP Overview'; public static FAQ: string = 'FAQ'; diff --git a/dmp-frontend/src/app/core/services/plan/plan-blueprint.service.ts b/dmp-frontend/src/app/core/services/plan/plan-blueprint.service.ts index e265d9be3..ef60165d0 100644 --- a/dmp-frontend/src/app/core/services/plan/plan-blueprint.service.ts +++ b/dmp-frontend/src/app/core/services/plan/plan-blueprint.service.ts @@ -1,8 +1,8 @@ import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { IsActive } from '@app/core/common/enum/is-active.enum'; -import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection, DmpBlueprintPersist, NewVersionDmpBlueprintPersist } from '@app/core/model/plan-blueprint/plan-blueprint'; -import { DmpBlueprintLookup } from '@app/core/query/plan-blueprint.lookup'; +import { DescriptionTemplatesInSection, PlanBlueprint, PlanBlueprintDefinition, PlanBlueprintDefinitionSection, PlanBlueprintPersist, NewVersionPlanBlueprintPersist } from '@app/core/model/plan-blueprint/plan-blueprint'; +import { PlanBlueprintLookup } from '@app/core/query/plan-blueprint.lookup'; import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration'; import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration'; import { BaseHttpParams } from '@common/http/base-http-params'; @@ -15,13 +15,13 @@ import { catchError, map } from 'rxjs/operators'; import { nameof } from 'ts-simple-nameof'; import { ConfigurationService } from '../configuration/configuration.service'; import { BaseHttpV2Service } from '../http/base-http-v2.service'; -import { DmpBlueprintStatus } from '@app/core/common/enum/plan-blueprint-status'; +import { PlanBlueprintStatus } from '@app/core/common/enum/plan-blueprint-status'; import { error } from 'console'; -import { DmpBlueprintVersionStatus } from '@app/core/common/enum/plan-blueprint-version-status'; +import { PlanBlueprintVersionStatus } from '@app/core/common/enum/plan-blueprint-version-status'; import { TranslateService } from '@ngx-translate/core'; @Injectable() -export class DmpBlueprintService { +export class PlanBlueprintService { private headers = new HttpHeaders(); @@ -29,53 +29,53 @@ export class DmpBlueprintService { ) { } - private get apiBase(): string { return `${this.configurationService.server}dmp-blueprint`; } + private get apiBase(): string { return `${this.configurationService.server}plan-blueprint`; } - query(q: DmpBlueprintLookup): Observable> { + query(q: PlanBlueprintLookup): Observable> { const url = `${this.apiBase}/query`; - return this.http.post>(url, q).pipe(catchError((error: any) => throwError(error))); + return this.http.post>(url, q).pipe(catchError((error: any) => throwError(error))); } - getSingle(id: Guid, reqFields: string[] = []): Observable { + getSingle(id: Guid, reqFields: string[] = []): Observable { const url = `${this.apiBase}/${id}`; const options = { params: { f: reqFields } }; return this.http - .get(url, options).pipe( + .get(url, options).pipe( catchError((error: any) => throwError(error))); } - persist(item: DmpBlueprintPersist): Observable { + persist(item: PlanBlueprintPersist): Observable { const url = `${this.apiBase}/persist`; return this.http - .post(url, item).pipe( + .post(url, item).pipe( catchError((error: any) => throwError(error))); } - delete(id: Guid): Observable { + delete(id: Guid): Observable { const url = `${this.apiBase}/${id}`; return this.http - .delete(url).pipe( + .delete(url).pipe( catchError((error: any) => throwError(error))); } - clone(id: Guid, reqFields: string[] = []): Observable { + clone(id: Guid, reqFields: string[] = []): Observable { const url = `${this.apiBase}/clone/${id}`; const options = { params: { f: reqFields } }; return this.http - .get(url, options).pipe( + .get(url, options).pipe( catchError((error: any) => throwError(error))); } - newVersion(item: NewVersionDmpBlueprintPersist, reqFields: string[] = []): Observable { + newVersion(item: NewVersionPlanBlueprintPersist, reqFields: string[] = []): Observable { const url = `${this.apiBase}/new-version`; const options = { params: { f: reqFields } }; return this.http - .post(url, item).pipe( + .post(url, item).pipe( catchError((error: any) => throwError(error))); } @@ -89,7 +89,7 @@ export class DmpBlueprintService { return this.httpClient.get(url, { params: params, responseType: 'blob', observe: 'response', headers: headerXml }); } - uploadFile(file: FileList, labelSent: string, reqFields: string[] = []): Observable { + uploadFile(file: FileList, labelSent: string, reqFields: string[] = []): Observable { const url = `${this.apiBase}/xml/import`; const params = new BaseHttpParams(); params.interceptorContext = { @@ -108,9 +108,9 @@ export class DmpBlueprintService { initialItems: (data?: any) => this.query(this.buildAutocompleteLookup()).pipe(map(x => x.items)), filterFn: (searchQuery: string, data?: any) => this.query(this.buildAutocompleteLookup(searchQuery)).pipe(map(x => x.items)), getSelectedItem: (selectedItem: any) => this.query(this.buildAutocompleteLookup(null, null, [selectedItem])).pipe(map(x => x.items[0])), - displayFn: (item: DmpBlueprint) => item.label, - titleFn: (item: DmpBlueprint) => item.label, - valueAssign: (item: DmpBlueprint) => item.id, + displayFn: (item: PlanBlueprint) => item.label, + titleFn: (item: PlanBlueprint) => item.label, + valueAssign: (item: PlanBlueprint) => item.id, }; // tslint:disable-next-line: member-ordering @@ -118,13 +118,13 @@ export class DmpBlueprintService { initialItems: (excludedItems: any[], data?: any) => this.query(this.buildAutocompleteLookup(null, excludedItems ? excludedItems : null)).pipe(map(x => x.items)), filterFn: (searchQuery: string, excludedItems: any[]) => this.query(this.buildAutocompleteLookup(searchQuery, excludedItems)).pipe(map(x => x.items)), getSelectedItems: (selectedItems: any[]) => this.query(this.buildAutocompleteLookup(null, null, selectedItems)).pipe(map(x => x.items)), - displayFn: (item: DmpBlueprint) => item.label, - titleFn: (item: DmpBlueprint) => item.label, - valueAssign: (item: DmpBlueprint) => item.id, + displayFn: (item: PlanBlueprint) => item.label, + titleFn: (item: PlanBlueprint) => item.label, + valueAssign: (item: PlanBlueprint) => item.id, }; - public buildAutocompleteLookup(like?: string, excludedIds?: Guid[], ids?: Guid[], statuses?: DmpBlueprintStatus[]): DmpBlueprintLookup { - const lookup: DmpBlueprintLookup = new DmpBlueprintLookup(); + public buildAutocompleteLookup(like?: string, excludedIds?: Guid[], ids?: Guid[], statuses?: PlanBlueprintStatus[]): PlanBlueprintLookup { + const lookup: PlanBlueprintLookup = new PlanBlueprintLookup(); lookup.page = { size: 100, offset: 0 }; if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; } if (ids && ids.length > 0) { lookup.ids = ids; } @@ -132,30 +132,30 @@ export class DmpBlueprintService { lookup.statuses = statuses; lookup.project = { fields: [ - nameof(x => x.id), - nameof(x => x.label), - nameof(x => x.version) + nameof(x => x.id), + nameof(x => x.label), + nameof(x => x.version) ] }; - lookup.order = { items: [nameof(x => x.label)] }; - lookup.versionStatuses = [DmpBlueprintVersionStatus.Current]; + lookup.order = { items: [nameof(x => x.label)] }; + lookup.versionStatuses = [PlanBlueprintVersionStatus.Current]; if (like) { lookup.like = this.filterService.transformLike(like); } return lookup; } // Finalized Blueprint with definitions Single AutoComplete singleAutocompleteBlueprintConfiguration: SingleAutoCompleteConfiguration = { - initialItems: (data?: any) => this.query(this.buildAutocompleteWithDefinitonLookup(null, null, null, [DmpBlueprintStatus.Finalized])).pipe(map(x => x.items)), - filterFn: (searchQuery: string, data?: any) => this.query(this.buildAutocompleteWithDefinitonLookup(searchQuery, null, null, [DmpBlueprintStatus.Finalized])).pipe(map(x => x.items)), + initialItems: (data?: any) => this.query(this.buildAutocompleteWithDefinitonLookup(null, null, null, [PlanBlueprintStatus.Finalized])).pipe(map(x => x.items)), + filterFn: (searchQuery: string, data?: any) => this.query(this.buildAutocompleteWithDefinitonLookup(searchQuery, null, null, [PlanBlueprintStatus.Finalized])).pipe(map(x => x.items)), getSelectedItem: (selectedItem: any) => this.query(this.buildAutocompleteWithDefinitonLookup(null, null, [selectedItem])).pipe(map(x => x.items[0])), - displayFn: (item: DmpBlueprint) => item.label, - subtitleFn: (item: DmpBlueprint) => this.language.instant('DMP-EDITOR.FIELDS.DMP-BLUEPRINT-VERSION') + ' '+ item.version, - titleFn: (item: DmpBlueprint) => item.label, - valueAssign: (item: DmpBlueprint) => item.id, + displayFn: (item: PlanBlueprint) => item.label, + subtitleFn: (item: PlanBlueprint) => this.language.instant('Plan-EDITOR.FIELDS.Plan-BLUEPRINT-VERSION') + ' '+ item.version, + titleFn: (item: PlanBlueprint) => item.label, + valueAssign: (item: PlanBlueprint) => item.id, }; - public buildAutocompleteWithDefinitonLookup(like?: string, excludedIds?: Guid[], ids?: Guid[], statuses?: DmpBlueprintStatus[]): DmpBlueprintLookup { - const lookup: DmpBlueprintLookup = new DmpBlueprintLookup(); + public buildAutocompleteWithDefinitonLookup(like?: string, excludedIds?: Guid[], ids?: Guid[], statuses?: PlanBlueprintStatus[]): PlanBlueprintLookup { + const lookup: PlanBlueprintLookup = new PlanBlueprintLookup(); lookup.page = { size: 100, offset: 0 }; if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; } if (ids && ids.length > 0) { lookup.ids = ids; } @@ -163,17 +163,17 @@ export class DmpBlueprintService { lookup.statuses = statuses; lookup.project = { fields: [ - nameof(x => x.id), - nameof(x => x.label), - nameof(x => x.version), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.label)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.hasTemplates)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), + nameof(x => x.id), + nameof(x => x.label), + nameof(x => x.version), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.label)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.hasTemplates)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), ] }; - lookup.order = { items: [nameof(x => x.label)] }; - lookup.versionStatuses = [DmpBlueprintVersionStatus.Previous, DmpBlueprintVersionStatus.Current]; + lookup.order = { items: [nameof(x => x.label)] }; + lookup.versionStatuses = [PlanBlueprintVersionStatus.Previous, PlanBlueprintVersionStatus.Current]; if (like) { lookup.like = this.filterService.transformLike(like); } return lookup; } @@ -184,7 +184,7 @@ export class DmpBlueprintService { // // - getSection(dmpBlueprint: DmpBlueprint, sectionId: Guid): DmpBlueprintDefinitionSection { - return dmpBlueprint?.definition?.sections?.find(x => x.id === sectionId); + getSection(PlanBlueprint: PlanBlueprint, sectionId: Guid): PlanBlueprintDefinitionSection { + return PlanBlueprint?.definition?.sections?.find(x => x.id === sectionId); } } diff --git a/dmp-frontend/src/app/core/services/plan/plan.service.ts b/dmp-frontend/src/app/core/services/plan/plan.service.ts index d60231a7d..14830d640 100644 --- a/dmp-frontend/src/app/core/services/plan/plan.service.ts +++ b/dmp-frontend/src/app/core/services/plan/plan.service.ts @@ -1,10 +1,10 @@ import { HttpClient, HttpHeaders, HttpParamsOptions, HttpResponse } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import { DmpStatus } from '@app/core/common/enum/plan-status'; -import { DmpUserRole } from '@app/core/common/enum/plan-user-role'; +import { PlanStatus } from '@app/core/common/enum/plan-status'; +import { PlanUserRole } from '@app/core/common/enum/plan-user-role'; import { IsActive } from '@app/core/common/enum/is-active.enum'; -import { DmpDescriptionTemplateLookup } from '@app/core/query/plan-description-template.lookup'; -import { DmpLookup } from '@app/core/query/plan.lookup'; +import { PlanDescriptionTemplateLookup } from '@app/core/query/plan-description-template.lookup'; +import { PlanLookup } from '@app/core/query/plan.lookup'; import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration'; import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration'; import { QueryResult } from '@common/model/query-result'; @@ -15,15 +15,15 @@ import { catchError, map } from 'rxjs/operators'; import { nameof } from 'ts-simple-nameof'; import { BaseHttpParams } from '../../../../common/http/base-http-params'; import { InterceptorType } from '../../../../common/http/interceptors/interceptor-type'; -import { CloneDmpPersist, Dmp, DmpPersist, DmpUser, DmpUserInvitePersist, DmpUserPersist, DmpUserRemovePersist, NewVersionDmpPersist, PublicDmp } from '../../model/plan/plan'; +import { ClonePlanPersist, Plan, PlanPersist, PlanUser, PlanUserInvitePersist, PlanUserPersist, PlanUserRemovePersist, NewVersionPlanPersist, PublicPlan } from '../../model/plan/plan'; import { AuthService } from '../auth/auth.service'; import { ConfigurationService } from '../configuration/configuration.service'; import { BaseHttpV2Service } from '../http/base-http-v2.service'; -import { DmpValidationResult } from '@app/ui/plan/plan-finalize-dialog/plan-finalize-dialog.component'; -import { DmpCommonModelConfig, PreprocessingDmpModel } from '@app/core/model/plan/plan-import'; +import { PlanValidationResult } from '@app/ui/plan/plan-finalize-dialog/plan-finalize-dialog.component'; +import { PlanCommonModelConfig, PreprocessingPlanModel } from '@app/core/model/plan/plan-import'; @Injectable() -export class DmpService { +export class PlanService { private headers = new HttpHeaders(); @@ -36,33 +36,33 @@ export class DmpService { ) { } - private get apiBase(): string { return `${this.configurationService.server}dmp`; } + private get apiBase(): string { return `${this.configurationService.server}plan`; } - query(q: DmpLookup): Observable> { + query(q: PlanLookup): Observable> { const url = `${this.apiBase}/query`; - return this.http.post>(url, q).pipe(catchError((error: any) => throwError(error))); + return this.http.post>(url, q).pipe(catchError((error: any) => throwError(error))); } - publicQuery(q: DmpLookup): Observable> { + publicQuery(q: PlanLookup): Observable> { const url = `${this.apiBase}/public/query`; const params = new BaseHttpParams(); params.interceptorContext = { excludedInterceptors: [InterceptorType.AuthToken, InterceptorType.TenantHeaderInterceptor] }; - return this.http.post>(url, q, {params: params}).pipe(catchError((error: any) => throwError(error))); + return this.http.post>(url, q, {params: params}).pipe(catchError((error: any) => throwError(error))); } - getSingle(id: Guid, reqFields: string[] = []): Observable { + getSingle(id: Guid, reqFields: string[] = []): Observable { const url = `${this.apiBase}/${id}`; const options = { params: { f: reqFields } }; return this.http - .get(url, options).pipe( + .get(url, options).pipe( catchError((error: any) => throwError(error))); } - getPublicSingle(id: Guid, reqFields: string[] = []): Observable { + getPublicSingle(id: Guid, reqFields: string[] = []): Observable { const url = `${this.apiBase}/public/${id}`; const options: HttpParamsOptions = { fromObject: { f: reqFields } }; @@ -74,23 +74,23 @@ export class DmpService { }; return this.http - .get(url, { params: params }).pipe( + .get(url, { params: params }).pipe( catchError((error: any) => throwError(error))); } - persist(item: DmpPersist): Observable { + persist(item: PlanPersist): Observable { const url = `${this.apiBase}/persist`; return this.http - .post(url, item).pipe( + .post(url, item).pipe( catchError((error: any) => throwError(error))); } - delete(id: Guid): Observable { + delete(id: Guid): Observable { const url = `${this.apiBase}/${id}`; return this.http - .delete(url).pipe( + .delete(url).pipe( catchError((error: any) => throwError(error))); } @@ -112,59 +112,59 @@ export class DmpService { catchError((error: any) => throwError(error))); } - validate(id: Guid): Observable { + validate(id: Guid): Observable { const url = `${this.apiBase}/validate/${id}`; return this.http - .get(url).pipe( + .get(url).pipe( catchError((error: any) => throwError(error))); } - clone(item: CloneDmpPersist, reqFields: string[] = []): Observable { + clone(item: ClonePlanPersist, reqFields: string[] = []): Observable { const url = `${this.apiBase}/clone`; const options = { params: { f: reqFields } }; return this.http - .post(url, item, options).pipe( + .post(url, item, options).pipe( catchError((error: any) => throwError(error))); } - newVersion(item: NewVersionDmpPersist, reqFields: string[] = []): Observable { + newVersion(item: NewVersionPlanPersist, reqFields: string[] = []): Observable { const url = `${this.apiBase}/new-version`; const options = { params: { f: reqFields } }; return this.http - .post(url, item, options ).pipe( + .post(url, item, options ).pipe( catchError((error: any) => throwError(error))); } - assignUsers(id: Guid, items: DmpUserPersist[], reqFields: string[] = []): Observable { + assignUsers(id: Guid, items: PlanUserPersist[], reqFields: string[] = []): Observable { const url = `${this.apiBase}/${id}/assign-users`; const options = { params: { f: reqFields } }; return this.http - .post(url, items).pipe( + .post(url, items).pipe( catchError((error: any) => throwError(error))); } - removeUser(item: DmpUserRemovePersist, reqFields: string[] = []): Observable { + removeUser(item: PlanUserRemovePersist, reqFields: string[] = []): Observable { const url = `${this.apiBase}/remove-user`; return this.http - .post(url, item).pipe( + .post(url, item).pipe( catchError((error: any) => throwError(error))); } - inviteUsers(dmpId: Guid, item: DmpUserInvitePersist): Observable { - const url = `${this.apiBase}/${dmpId}/invite-users`; + inviteUsers(PlanId: Guid, item: PlanUserInvitePersist): Observable { + const url = `${this.apiBase}/${PlanId}/invite-users`; return this.http .post(url, item).pipe( catchError((error: any) => throwError(error))); } - acceptInvitation(dmpId: Guid, token: string): Observable { - const url = `${this.apiBase}/${dmpId}/token/${token}/invite-accept`; + acceptInvitation(PlanId: Guid, token: string): Observable { + const url = `${this.apiBase}/${PlanId}/token/${token}/invite-accept`; return this.http.get(url).pipe(catchError((error: any) => throwError(error))); } @@ -179,7 +179,7 @@ export class DmpService { return this.httpClient.get(url, { params: params, responseType: 'blob', observe: 'response', headers: headerXml }); } - uploadXml(file: File, label: string, reqFields: string[] = []): Observable { + uploadXml(file: File, label: string, reqFields: string[] = []): Observable { const url = `${this.apiBase}/xml/import`; const params = new BaseHttpParams(); params.interceptorContext = { @@ -198,7 +198,7 @@ export class DmpService { catchError((error: any) => throwError(error)));; } - preprocessingDmp(fileId: Guid, repositoryId: string): Observable { + preprocessingPlan(fileId: Guid, repositoryId: string): Observable { const url = `${this.apiBase}/json/preprocessing`; const params = new BaseHttpParams(); @@ -209,13 +209,13 @@ export class DmpService { formData.append('fileId', fileId.toString()); formData.append('repositoryId', repositoryId); - return this.http.post(url, formData, { params: params }).pipe(catchError((error: any) => throwError(error))); + return this.http.post(url, formData, { params: params }).pipe(catchError((error: any) => throwError(error))); } - uploadJson(item: DmpCommonModelConfig, reqFields: string[] = []): Observable { + uploadJson(item: PlanCommonModelConfig, reqFields: string[] = []): Observable { const url = `${this.apiBase}/json/import`; - return this.http.post(url, item).pipe(catchError((error: any) => throwError(error))); + return this.http.post(url, item).pipe(catchError((error: any) => throwError(error))); } @@ -227,9 +227,9 @@ export class DmpService { initialItems: (data?: any) => this.query(this.buildAutocompleteLookup([IsActive.Active])).pipe(map(x => x.items)), filterFn: (searchQuery: string, data?: any) => this.query(this.buildAutocompleteLookup([IsActive.Active], searchQuery)).pipe(map(x => x.items)), getSelectedItem: (selectedItem: any) => this.query(this.buildAutocompleteLookup([IsActive.Active, IsActive.Inactive], null, null, [selectedItem])).pipe(map(x => x.items[0])), - displayFn: (item: Dmp) => item.label, - titleFn: (item: Dmp) => item.label, - valueAssign: (item: Dmp) => item.id, + displayFn: (item: Plan) => item.label, + titleFn: (item: Plan) => item.label, + valueAssign: (item: Plan) => item.id, }; // tslint:disable-next-line: member-ordering @@ -237,13 +237,13 @@ export class DmpService { initialItems: (excludedItems: any[], data?: any) => this.query(this.buildAutocompleteLookup([IsActive.Active], null, excludedItems ? excludedItems : null)).pipe(map(x => x.items)), filterFn: (searchQuery: string, excludedItems: any[]) => this.query(this.buildAutocompleteLookup([IsActive.Active],searchQuery, excludedItems)).pipe(map(x => x.items)), getSelectedItems: (selectedItems: any[]) => this.query(this.buildAutocompleteLookup([IsActive.Active, IsActive.Inactive], null, null, selectedItems)).pipe(map(x => x.items)), - displayFn: (item: Dmp) => item.label, - titleFn: (item: Dmp) => item.label, - valueAssign: (item: Dmp) => item.id, + displayFn: (item: Plan) => item.label, + titleFn: (item: Plan) => item.label, + valueAssign: (item: Plan) => item.id, }; - public buildAutocompleteLookup(isActive: IsActive[], like?: string, excludedIds?: Guid[], ids?: Guid[], statuses?: DmpStatus[], dmpDescriptionTemplateSubQuery?: DmpDescriptionTemplateLookup): DmpLookup { - const lookup: DmpLookup = new DmpLookup(); + public buildAutocompleteLookup(isActive: IsActive[], like?: string, excludedIds?: Guid[], ids?: Guid[], statuses?: PlanStatus[], planDescriptionTemplateSubQuery?: PlanDescriptionTemplateLookup): PlanLookup { + const lookup: PlanLookup = new PlanLookup(); lookup.page = { size: 100, offset: 0 }; if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; } if (ids && ids.length > 0) { lookup.ids = ids; } @@ -251,12 +251,12 @@ export class DmpService { lookup.statuses = statuses; lookup.project = { fields: [ - nameof(x => x.id), - nameof(x => x.label) + nameof(x => x.id), + nameof(x => x.label) ] }; - if (dmpDescriptionTemplateSubQuery != null) lookup.dmpDescriptionTemplateSubQuery = dmpDescriptionTemplateSubQuery; - lookup.order = { items: [nameof(x => x.label)] }; + if (planDescriptionTemplateSubQuery != null) lookup.planDescriptionTemplateSubQuery = planDescriptionTemplateSubQuery; + lookup.order = { items: [nameof(x => x.label)] }; if (like) { lookup.like = this.filterService.transformLike(like); } return lookup; } @@ -267,12 +267,12 @@ export class DmpService { // // - getCurrentUserRolesInDmp(dmpUsers: DmpUser[]): DmpUserRole[] { + getCurrentUserRolesInPlan(planUsers: PlanUser[]): PlanUserRole[] { const principalId: Guid = this.authService.userId(); - let dmpUserRoles: DmpUserRole[] = null; + let planUserRoles: PlanUserRole[] = null; if (principalId) { - dmpUserRoles = dmpUsers.filter(element => element.isActive == IsActive.Active && element?.user?.id === principalId).map(x => x.role); + planUserRoles = planUsers.filter(element => element.isActive == IsActive.Active && element?.user?.id === principalId).map(x => x.role); } - return dmpUserRoles; + return planUserRoles; } } diff --git a/dmp-frontend/src/app/core/services/reference/reference.service.ts b/dmp-frontend/src/app/core/services/reference/reference.service.ts index 7066a7e2f..abe336f89 100644 --- a/dmp-frontend/src/app/core/services/reference/reference.service.ts +++ b/dmp-frontend/src/app/core/services/reference/reference.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { IsActive } from '@app/core/common/enum/is-active.enum'; import { ReferenceSourceType } from '@app/core/common/enum/reference-source-type'; -import { DmpReference } from '@app/core/model/plan/plan-reference'; +import { PlanReference } from '@app/core/model/plan/plan-reference'; import { Definition, Field, Reference, ReferencePersist } from '@app/core/model/reference/reference'; import { ReferenceSearchDefinitionLookup, ReferenceSearchLookup } from '@app/core/query/reference-search.lookup'; import { ReferenceLookup } from '@app/core/query/reference.lookup'; @@ -184,15 +184,15 @@ export class ReferenceService { // // - hasRerefenceOfTypes(dmpReferences: DmpReference[], referenceTypeIds?: Guid[]): boolean { - return this.getReferencesForTypes(dmpReferences, referenceTypeIds)?.length > 0; + hasRerefenceOfTypes(planReferences: PlanReference[], referenceTypeIds?: Guid[]): boolean { + return this.getReferencesForTypes(planReferences, referenceTypeIds)?.length > 0; } - getReferencesForTypes(dmpReferences: DmpReference[], referenceTypeIds?: Guid[]): DmpReference[] { - return dmpReferences?.filter(x => referenceTypeIds?.includes(x?.reference?.type?.id)).filter(x=> x.isActive === IsActive.Active);; + getReferencesForTypes(planReferences: PlanReference[], referenceTypeIds?: Guid[]): PlanReference[] { + return planReferences?.filter(x => referenceTypeIds?.includes(x?.reference?.type?.id)).filter(x=> x.isActive === IsActive.Active);; } - getReferencesForTypesFirstSafe(dmpReferences: DmpReference[], referenceTypeIds?: Guid[]): DmpReference { - return this.getReferencesForTypes(dmpReferences, referenceTypeIds)?.find(Boolean); + getReferencesForTypesFirstSafe(planReferences: PlanReference[], referenceTypeIds?: Guid[]): PlanReference { + return this.getReferencesForTypes(planReferences, referenceTypeIds)?.find(Boolean); } } diff --git a/dmp-frontend/src/app/core/services/user/user.service.ts b/dmp-frontend/src/app/core/services/user/user.service.ts index 1a272e427..818d40ac0 100644 --- a/dmp-frontend/src/app/core/services/user/user.service.ts +++ b/dmp-frontend/src/app/core/services/user/user.service.ts @@ -32,7 +32,7 @@ export class UserService { } queryDmpAssociated(q: UserLookup): Observable> { - const url = `${this.apiBase}/dmp-associated/query`; + const url = `${this.apiBase}/plan-associated/query`; return this.http.post>(url, q).pipe(catchError((error: any) => throwError(error))); } diff --git a/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts b/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts index 5e806bd7d..dacdc5963 100644 --- a/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts +++ b/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts @@ -7,12 +7,12 @@ import { DescriptionTemplateFieldDataExternalDatasetType } from '@app/core/commo import { DescriptionTemplateFieldType } from '@app/core/common/enum/description-template-field-type'; import { DescriptionTemplateStatus } from '@app/core/common/enum/description-template-status'; import { DescriptionTemplateTypeStatus } from '@app/core/common/enum/description-template-type-status'; -import { DmpAccessType } from '@app/core/common/enum/plan-access-type'; -import { DmpBlueprintFieldCategory } from '@app/core/common/enum/plan-blueprint-field-category'; -import { DmpBlueprintStatus } from '@app/core/common/enum/plan-blueprint-status'; -import { DmpBlueprintSystemFieldType } from '@app/core/common/enum/plan-blueprint-system-field-type'; -import { DmpUserRole } from '@app/core/common/enum/plan-user-role'; -import { DmpUserType } from '@app/core/common/enum/plan-user-type'; +import { PlanAccessType } from '@app/core/common/enum/plan-access-type'; +import { PlanBlueprintFieldCategory } from '@app/core/common/enum/plan-blueprint-field-category'; +import { PlanBlueprintStatus } from '@app/core/common/enum/plan-blueprint-status'; +import { PlanBlueprintSystemFieldType } from '@app/core/common/enum/plan-blueprint-system-field-type'; +import { PlanUserRole } from '@app/core/common/enum/plan-user-role'; +import { PlanUserType } from '@app/core/common/enum/plan-user-type'; import { ExternalFetcherApiHTTPMethodType } from '@app/core/common/enum/external-fetcher-api-http-method-type'; import { ExternalFetcherSourceType } from '@app/core/common/enum/external-fetcher-source-type'; import { IsActive } from '@app/core/common/enum/is-active.enum'; @@ -26,8 +26,8 @@ import { SupportiveMaterialFieldType } from '@app/core/common/enum/supportive-ma import { UserDescriptionTemplateRole } from '@app/core/common/enum/user-description-template-role'; import { TranslateService } from '@ngx-translate/core'; import { AppRole } from '../../common/enum/app-role'; -import { DmpBlueprintExtraFieldDataType } from '../../common/enum/plan-blueprint-field-type'; -import { DmpStatus } from '../../common/enum/plan-status'; +import { PlanBlueprintExtraFieldDataType } from '../../common/enum/plan-blueprint-field-type'; +import { PlanStatus } from '../../common/enum/plan-status'; import { ValidationType } from '../../common/enum/validation-type'; @Injectable() @@ -46,6 +46,7 @@ export class EnumUtils { return []; } + toIsActiveString(status: IsActive): string { switch (status) { @@ -66,10 +67,10 @@ export class EnumUtils { } } - toDmpStatusString(status: DmpStatus): string { + toPlanStatusString(status: PlanStatus): string { switch (status) { - case DmpStatus.Draft: return this.language.instant('TYPES.DMP.DRAFT'); - case DmpStatus.Finalized: return this.language.instant('TYPES.DMP.FINALISED'); + case PlanStatus.Draft: return this.language.instant('TYPES.PLAN.DRAFT'); + case PlanStatus.Finalized: return this.language.instant('TYPES.PLAN.FINALISED'); } } @@ -113,30 +114,30 @@ export class EnumUtils { } } - toDmpBlueprintStatusString(status: DmpBlueprintStatus): string { + toPlanBlueprintStatusString(status: PlanBlueprintStatus): string { switch (status) { - case DmpBlueprintStatus.Draft: return this.language.instant('TYPES.DMP-BLUEPRINT-STATUS.DRAFT'); - case DmpBlueprintStatus.Finalized: return this.language.instant('TYPES.DMP-BLUEPRINT-STATUS.FINALIZED'); + case PlanBlueprintStatus.Draft: return this.language.instant('TYPES.PLAN-BLUEPRINT-STATUS.DRAFT'); + case PlanBlueprintStatus.Finalized: return this.language.instant('TYPES.PLAN-BLUEPRINT-STATUS.FINALIZED'); } } - toDmpBlueprintSystemFieldTypeString(status: DmpBlueprintSystemFieldType): string { + toPlanBlueprintSystemFieldTypeString(status: PlanBlueprintSystemFieldType): string { switch (status) { - case DmpBlueprintSystemFieldType.Title: return this.language.instant('TYPES.DMP-BLUEPRINT-SYSTEM-FIELD-TYPE.TITLE'); - case DmpBlueprintSystemFieldType.Description: return this.language.instant('TYPES.DMP-BLUEPRINT-SYSTEM-FIELD-TYPE.DESCRIPTION'); - case DmpBlueprintSystemFieldType.Language: return this.language.instant('TYPES.DMP-BLUEPRINT-SYSTEM-FIELD-TYPE.LANGUAGE'); - case DmpBlueprintSystemFieldType.Contact: return this.language.instant('TYPES.DMP-BLUEPRINT-SYSTEM-FIELD-TYPE.CONTACT'); - case DmpBlueprintSystemFieldType.AccessRights: return this.language.instant('TYPES.DMP-BLUEPRINT-SYSTEM-FIELD-TYPE.ACCESS_RIGHTS'); - case DmpBlueprintSystemFieldType.User: return this.language.instant('TYPES.DMP-BLUEPRINT-SYSTEM-FIELD-TYPE.USER'); + case PlanBlueprintSystemFieldType.Title: return this.language.instant('TYPES.PLAN-BLUEPRINT-SYSTEM-FIELD-TYPE.TITLE'); + case PlanBlueprintSystemFieldType.Description: return this.language.instant('TYPES.PLAN-BLUEPRINT-SYSTEM-FIELD-TYPE.DESCRIPTION'); + case PlanBlueprintSystemFieldType.Language: return this.language.instant('TYPES.PLAN-BLUEPRINT-SYSTEM-FIELD-TYPE.LANGUAGE'); + case PlanBlueprintSystemFieldType.Contact: return this.language.instant('TYPES.PLAN-BLUEPRINT-SYSTEM-FIELD-TYPE.CONTACT'); + case PlanBlueprintSystemFieldType.AccessRights: return this.language.instant('TYPES.PLAN-BLUEPRINT-SYSTEM-FIELD-TYPE.ACCESS_RIGHTS'); + case PlanBlueprintSystemFieldType.User: return this.language.instant('TYPES.PLAN-BLUEPRINT-SYSTEM-FIELD-TYPE.USER'); } } - toDmpBlueprintExtraFieldDataTypeString(status: DmpBlueprintExtraFieldDataType): string { + toPlanBlueprintExtraFieldDataTypeString(status: PlanBlueprintExtraFieldDataType): string { switch (status) { - case DmpBlueprintExtraFieldDataType.Text: return this.language.instant('TYPES.DMP-BLUEPRINT-EXTRA-FIELD-DATA-TYPE.TEXT'); - case DmpBlueprintExtraFieldDataType.RichText: return this.language.instant('TYPES.DMP-BLUEPRINT-EXTRA-FIELD-DATA-TYPE.RICH-TEXT'); - case DmpBlueprintExtraFieldDataType.Date: return this.language.instant('TYPES.DMP-BLUEPRINT-EXTRA-FIELD-DATA-TYPE.DATE'); - case DmpBlueprintExtraFieldDataType.Number: return this.language.instant('TYPES.DMP-BLUEPRINT-EXTRA-FIELD-DATA-TYPE.NUMBER'); + case PlanBlueprintExtraFieldDataType.Text: return this.language.instant('TYPES.PLAN-BLUEPRINT-EXTRA-FIELD-DATA-TYPE.TEXT'); + case PlanBlueprintExtraFieldDataType.RichText: return this.language.instant('TYPES.PLAN-BLUEPRINT-EXTRA-FIELD-DATA-TYPE.RICH-TEXT'); + case PlanBlueprintExtraFieldDataType.Date: return this.language.instant('TYPES.PLAN-BLUEPRINT-EXTRA-FIELD-DATA-TYPE.DATE'); + case PlanBlueprintExtraFieldDataType.Number: return this.language.instant('TYPES.PLAN-BLUEPRINT-EXTRA-FIELD-DATA-TYPE.NUMBER'); } } @@ -145,8 +146,8 @@ export class EnumUtils { case DescriptionTemplateFieldType.SELECT: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.SELECT'); case DescriptionTemplateFieldType.BOOLEAN_DECISION: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.BOOLEAN-DECISION'); case DescriptionTemplateFieldType.RADIO_BOX: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.RADIO-BOX'); - case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DMPS: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.INTERNAL-DMP-ENTITIES-DMPS'); - case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.INTERNAL-DMP-ENTITIES-DESCRIPTIONS'); + case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DMPS: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.INTERNAL-PLAN-ENTITIES-DMPS'); + case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.INTERNAL-PLAN-ENTITIES-DESCRIPTIONS'); case DescriptionTemplateFieldType.CHECK_BOX: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.CHECKBOX'); case DescriptionTemplateFieldType.FREE_TEXT: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.FREE-TEXT'); case DescriptionTemplateFieldType.TEXT_AREA: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.TEXT-AREA'); @@ -215,13 +216,13 @@ export class EnumUtils { } } - toDmpUserRolesString(roles: DmpUserRole[]): string { return roles.map(x => this.toDmpUserRoleString(x)).join(', ') } - toDmpUserRoleString(role: DmpUserRole): string { + toPlanUserRolesString(roles: PlanUserRole[]): string { return roles.map(x => this.toPlanUserRoleString(x)).join(', ') } + toPlanUserRoleString(role: PlanUserRole): string { switch (role) { - case DmpUserRole.Owner: return this.language.instant('TYPES.DMP-USER-ROLE.OWNER'); - case DmpUserRole.Viewer: return this.language.instant('TYPES.DMP-USER-ROLE.VIEWER'); - case DmpUserRole.DescriptionContributor: return this.language.instant('TYPES.DMP-USER-ROLE.DESCRIPTION-CONTRIBUTOR'); - case DmpUserRole.Reviewer: return this.language.instant('TYPES.DMP-USER-ROLE.REVIEWER'); + case PlanUserRole.Owner: return this.language.instant('TYPES.PLAN-USER-ROLE.OWNER'); + case PlanUserRole.Viewer: return this.language.instant('TYPES.PLAN-USER-ROLE.VIEWER'); + case PlanUserRole.DescriptionContributor: return this.language.instant('TYPES.PLAN-USER-ROLE.DESCRIPTION-CONTRIBUTOR'); + case PlanUserRole.Reviewer: return this.language.instant('TYPES.PLAN-USER-ROLE.REVIEWER'); } } @@ -234,10 +235,10 @@ export class EnumUtils { } } - public toDmpAccessTypeString(value: DmpAccessType): string { + public toPlanAccessTypeString(value: PlanAccessType): string { switch (value) { - case DmpAccessType.Public: return this.language.instant('TYPES.DMP-ACCESS-TYPE.PUBLIC'); - case DmpAccessType.Restricted: return this.language.instant('TYPES.DMP-ACCESS-TYPE.RESTRICTED'); + case PlanAccessType.Public: return this.language.instant('TYPES.PLAN-ACCESS-TYPE.PUBLIC'); + case PlanAccessType.Restricted: return this.language.instant('TYPES.PLAN-ACCESS-TYPE.RESTRICTED'); } } @@ -249,10 +250,10 @@ export class EnumUtils { } } - public toDmpUserTypeString(value: DmpUserType): string { + public toPlanUserTypeString(value: PlanUserType): string { switch (value) { - case DmpUserType.Internal: return this.language.instant('TYPES.DMP-USER-TYPE.INTERNAL'); - case DmpUserType.External: return this.language.instant('TYPES.DMP-USER-TYPE.EXTERNAL'); + case PlanUserType.Internal: return this.language.instant('TYPES.PLAN-USER-TYPE.INTERNAL'); + case PlanUserType.External: return this.language.instant('TYPES.PLAN-USER-TYPE.EXTERNAL'); } } @@ -269,11 +270,11 @@ export class EnumUtils { } } - public toDmpBlueprintFieldCategoryString(value: DmpBlueprintFieldCategory): string { + public toPlanBlueprintFieldCategoryString(value: PlanBlueprintFieldCategory): string { switch (value) { - case DmpBlueprintFieldCategory.System: return this.language.instant('TYPES.DMP-BLUEPRINT-FIELD-CATEGORY.SYSTEM'); - case DmpBlueprintFieldCategory.Extra: return this.language.instant('TYPES.DMP-BLUEPRINT-FIELD-CATEGORY.EXTRA'); - case DmpBlueprintFieldCategory.ReferenceType: return this.language.instant('TYPES.DMP-BLUEPRINT-FIELD-CATEGORY.REFERENCE-TYPE'); + case PlanBlueprintFieldCategory.System: return this.language.instant('TYPES.PLAN-BLUEPRINT-FIELD-CATEGORY.SYSTEM'); + case PlanBlueprintFieldCategory.Extra: return this.language.instant('TYPES.PLAN-BLUEPRINT-FIELD-CATEGORY.EXTRA'); + case PlanBlueprintFieldCategory.ReferenceType: return this.language.instant('TYPES.PLAN-BLUEPRINT-FIELD-CATEGORY.REFERENCE-TYPE'); } } @@ -295,9 +296,9 @@ export class EnumUtils { public toLockTargetTypeString(status: LockTargetType): string { switch (status) { - case LockTargetType.Dmp: return this.language.instant('TYPES.LOCK-TARGET-TYPE.DMP'); + case LockTargetType.Dmp: return this.language.instant('TYPES.LOCK-TARGET-TYPE.PLAN'); case LockTargetType.Description: return this.language.instant('TYPES.LOCK-TARGET-TYPE.DESCRIPTION'); - case LockTargetType.DmpBlueprint: return this.language.instant('TYPES.LOCK-TARGET-TYPE.DMP-BLUEPRINT'); + case LockTargetType.PlanBlueprint: return this.language.instant('TYPES.LOCK-TARGET-TYPE.PLAN-BLUEPRINT'); case LockTargetType.DescriptionTemplate: return this.language.instant('TYPES.LOCK-TARGET-TYPE.DESCRIPTION-TEMPLATE'); } } diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.html b/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.html index c39fde135..6c4ca89ee 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.html +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.html @@ -49,7 +49,7 @@
1.2 {{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.DESCRIPTION-TEMPLATE-DESCRIPTION'| translate}} *
- +
{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.DESCRIPTION-TEMPLATE-DESCRIPTION-HINT'| translate}}
@@ -73,7 +73,7 @@
- +
1.4 {{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.DESCRIPTION-TEMPLATE-LANGUAGE'| translate}} *
{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.DESCRIPTION-TEMPLATE-LANGUAGE-HINT'| translate}}
@@ -229,7 +229,7 @@
{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.PAGE-INFO.ACTIONS.NOTHING-HERE-HINT'| translate}} -

{{'DMP-BLUEPRINT-EDITOR.FIELDS-REQUIRED' | translate}}

+

{{'PLAN-BLUEPRINT-EDITOR.FIELDS-REQUIRED' | translate}}

{{formGroup.get('definition').get('pages').getError('backendError').message}}

diff --git a/dmp-frontend/src/app/ui/admin/maintenance-tasks/maintenance-tasks.component.html b/dmp-frontend/src/app/ui/admin/maintenance-tasks/maintenance-tasks.component.html index b67aa1665..d3722af4f 100644 --- a/dmp-frontend/src/app/ui/admin/maintenance-tasks/maintenance-tasks.component.html +++ b/dmp-frontend/src/app/ui/admin/maintenance-tasks/maintenance-tasks.component.html @@ -33,7 +33,7 @@
- +
diff --git a/dmp-frontend/src/app/ui/admin/plan-blueprint/editor/plan-blueprint-editor.component.html b/dmp-frontend/src/app/ui/admin/plan-blueprint/editor/plan-blueprint-editor.component.html index e7f13c195..7306495d2 100644 --- a/dmp-frontend/src/app/ui/admin/plan-blueprint/editor/plan-blueprint-editor.component.html +++ b/dmp-frontend/src/app/ui/admin/plan-blueprint/editor/plan-blueprint-editor.component.html @@ -3,14 +3,14 @@
- @@ -18,14 +18,14 @@
- +
- +
@@ -34,14 +34,14 @@
- {{'DMP-BLUEPRINT-EDITOR.FIELDS.NAME' | translate}} + {{'PLAN-BLUEPRINT-EDITOR.FIELDS.NAME' | translate}} {{formGroup.get('label').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}}
-

{{'DMP-BLUEPRINT-EDITOR.FIELDS.SECTIONS' | translate}} - {{'DMP-BLUEPRINT-EDITOR.SYSTEM-FIELDS-REQUIRED' | translate}} +

{{'PLAN-BLUEPRINT-EDITOR.FIELDS.SECTIONS' | translate}} + {{'PLAN-BLUEPRINT-EDITOR.SYSTEM-FIELDS-REQUIRED' | translate}}

@@ -50,12 +50,12 @@
- {{'DMP-BLUEPRINT-EDITOR.FIELDS.SECTION-PREFIX' | translate}} {{sectionIndex + 1}} + {{'PLAN-BLUEPRINT-EDITOR.FIELDS.SECTION-PREFIX' | translate}} {{sectionIndex + 1}}
drag_indicator
-
@@ -65,7 +65,7 @@
- {{'DMP-BLUEPRINT-EDITOR.FIELDS.SECTION-NAME' | translate}} + {{'PLAN-BLUEPRINT-EDITOR.FIELDS.SECTION-NAME' | translate}} {{section.get('label').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}} @@ -73,14 +73,14 @@
- {{'DMP-BLUEPRINT-EDITOR.FIELDS.SECTION-DESCRIPTION' | translate}} + {{'PLAN-BLUEPRINT-EDITOR.FIELDS.SECTION-DESCRIPTION' | translate}} {{section.get('description').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}}
- +
@@ -93,7 +93,7 @@ drag_indicator
-
@@ -107,9 +107,9 @@
- {{'DMP-BLUEPRINT-EDITOR.FIELDS.CATEGORY' | translate}} + {{'PLAN-BLUEPRINT-EDITOR.FIELDS.CATEGORY' | translate}} - {{enumUtils.toDmpBlueprintFieldCategoryString(fieldCategory)}} + {{enumUtils.toPlanBlueprintFieldCategoryString(fieldCategory)}} {{field.get('category').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}} @@ -117,9 +117,9 @@
- {{'DMP-BLUEPRINT-EDITOR.FIELDS.SYSTEM-FIELD-TYPE' | translate}} + {{'PLAN-BLUEPRINT-EDITOR.FIELDS.SYSTEM-FIELD-TYPE' | translate}} - {{enumUtils.toDmpBlueprintSystemFieldTypeString(systemFieldType)}} + {{enumUtils.toPlanBlueprintSystemFieldTypeString(systemFieldType)}} {{field.get('systemFieldType').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}} @@ -127,10 +127,10 @@
- {{'DMP-BLUEPRINT-EDITOR.FIELDS.DATA-TYPE' | translate}} + {{'PLAN-BLUEPRINT-EDITOR.FIELDS.DATA-TYPE' | translate}} - - {{enumUtils.toDmpBlueprintExtraFieldDataTypeString(extraFieldDataType)}} + + {{enumUtils.toPlanBlueprintExtraFieldDataTypeString(extraFieldDataType)}} {{field.get('dataType').getError('backendError').message}} @@ -139,15 +139,15 @@
- {{'DMP-BLUEPRINT-EDITOR.FIELDS.REFERENCE-TYPE' | translate}} - + {{'PLAN-BLUEPRINT-EDITOR.FIELDS.REFERENCE-TYPE' | translate}} + {{field.get('referenceTypeId').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}}
- {{'DMP-BLUEPRINT-EDITOR.FIELDS.FIELD-LABEL' | translate}} + {{'PLAN-BLUEPRINT-EDITOR.FIELDS.FIELD-LABEL' | translate}} {{field.get('label').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}} @@ -155,7 +155,7 @@
- {{'DMP-BLUEPRINT-EDITOR.FIELDS.FIELD-PLACEHOLDER' | translate}} + {{'PLAN-BLUEPRINT-EDITOR.FIELDS.FIELD-PLACEHOLDER' | translate}} {{field.get('placeholder').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}} @@ -163,7 +163,7 @@
- {{'DMP-BLUEPRINT-EDITOR.FIELDS.FIELD-DESCRIPTION' | translate}} + {{'PLAN-BLUEPRINT-EDITOR.FIELDS.FIELD-DESCRIPTION' | translate}} {{field.get('description').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}} @@ -171,21 +171,21 @@
- {{'DMP-BLUEPRINT-EDITOR.FIELDS.SEMANTICS' | translate}} - + {{'PLAN-BLUEPRINT-EDITOR.FIELDS.SEMANTICS' | translate}} + {{field.get('semantics').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}}
- {{'DMP-BLUEPRINT-EDITOR.FIELDS.FIELD-REQUIRED' | translate}} + {{'PLAN-BLUEPRINT-EDITOR.FIELDS.FIELD-REQUIRED' | translate}} {{field.get('required').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}}
- {{'DMP-BLUEPRINT-EDITOR.FIELDS.FIELD-MULTIPLE-SELECT' | translate}} + {{'PLAN-BLUEPRINT-EDITOR.FIELDS.FIELD-MULTIPLE-SELECT' | translate}} {{field.get('multipleSelect')?.getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}}
@@ -193,7 +193,7 @@
-
@@ -203,7 +203,7 @@
- {{'DMP-BLUEPRINT-EDITOR.FIELDS-REQUIRED' | translate}} + {{'PLAN-BLUEPRINT-EDITOR.FIELDS-REQUIRED' | translate}} {{section.get('fields').getError('backendError').message}}
@@ -213,13 +213,13 @@
- {{'DMP-BLUEPRINT-EDITOR.FIELDS.DESCRIPTION-TEMPLATES' | translate}} + {{'PLAN-BLUEPRINT-EDITOR.FIELDS.DESCRIPTION-TEMPLATES' | translate}} {{section.get('hasTemplates').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}}
- +
@@ -236,7 +236,7 @@ drag_indicator
-
@@ -251,7 +251,7 @@
- {{'DMP-BLUEPRINT-EDITOR.FIELDS.DESCRIPTION-TEMPLATE' | translate}} + {{'PLAN-BLUEPRINT-EDITOR.FIELDS.DESCRIPTION-TEMPLATE' | translate}} {{descriptionTemplate.get('descriptionTemplateGroupId').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}} @@ -259,7 +259,7 @@
- {{'DMP-BLUEPRINT-EDITOR.FIELDS.DESCRIPTION-TEMPLATE-MIN-MULTIPLICITY' | translate}} + {{'PLAN-BLUEPRINT-EDITOR.FIELDS.DESCRIPTION-TEMPLATE-MIN-MULTIPLICITY' | translate}} {{descriptionTemplate.get('minMultiplicity').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}} @@ -275,7 +275,7 @@
- {{'DMP-BLUEPRINT-EDITOR.FIELDS.DESCRIPTION-TEMPLATE-MAX-MULTIPLICITY' | translate}} + {{'PLAN-BLUEPRINT-EDITOR.FIELDS.DESCRIPTION-TEMPLATE-MAX-MULTIPLICITY' | translate}} {{descriptionTemplate.get('maxMultiplicity').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}} @@ -286,7 +286,7 @@
-
@@ -299,7 +299,7 @@
- {{'DMP-BLUEPRINT-EDITOR.FIELDS.PREFILLING-SOURCES' | translate}} + {{'PLAN-BLUEPRINT-EDITOR.FIELDS.PREFILLING-SOURCES' | translate}} {{section.get('prefillingSourcesIds').getError('backendError').message}} @@ -320,8 +320,8 @@
- - {{'DMP-BLUEPRINT-EDITOR.SECTIONS-REQUIRED' | translate}} + + {{'PLAN-BLUEPRINT-EDITOR.SECTIONS-REQUIRED' | translate}} {{formGroup.get('definition').get('sections').getError('backendError').message}}
@@ -329,12 +329,12 @@
- +
diff --git a/dmp-frontend/src/app/ui/admin/plan-blueprint/editor/plan-blueprint-editor.component.ts b/dmp-frontend/src/app/ui/admin/plan-blueprint/editor/plan-blueprint-editor.component.ts index 5e408332a..f5d919578 100644 --- a/dmp-frontend/src/app/ui/admin/plan-blueprint/editor/plan-blueprint-editor.component.ts +++ b/dmp-frontend/src/app/ui/admin/plan-blueprint/editor/plan-blueprint-editor.component.ts @@ -6,19 +6,19 @@ import { MatCheckboxChange } from '@angular/material/checkbox'; import { MatDialog } from '@angular/material/dialog'; import { Title } from '@angular/platform-browser'; import { ActivatedRoute, Router } from '@angular/router'; -import { DmpBlueprintFieldCategory } from '@app/core/common/enum/plan-blueprint-field-category'; -import { DmpBlueprintExtraFieldDataType } from '@app/core/common/enum/plan-blueprint-field-type'; -import { DmpBlueprintStatus } from '@app/core/common/enum/plan-blueprint-status'; -import { DmpBlueprintSystemFieldType } from '@app/core/common/enum/plan-blueprint-system-field-type'; +import { PlanBlueprintFieldCategory } from '@app/core/common/enum/plan-blueprint-field-category'; +import { PlanBlueprintExtraFieldDataType } from '@app/core/common/enum/plan-blueprint-field-type'; +import { PlanBlueprintStatus } from '@app/core/common/enum/plan-blueprint-status'; +import { PlanBlueprintSystemFieldType } from '@app/core/common/enum/plan-blueprint-system-field-type'; import { IsActive } from '@app/core/common/enum/is-active.enum'; import { LockTargetType } from '@app/core/common/enum/lock-target-type'; import { AppPermission } from '@app/core/common/enum/permission.enum'; import { DescriptionTemplate } from '@app/core/model/description-template/description-template'; -import { DmpBlueprint, DmpBlueprintPersist, NewVersionDmpBlueprintPersist, SystemFieldInSection } from '@app/core/model/plan-blueprint/plan-blueprint'; +import { PlanBlueprint, PlanBlueprintPersist, NewVersionPlanBlueprintPersist, SystemFieldInSection } from '@app/core/model/plan-blueprint/plan-blueprint'; import { AuthService } from '@app/core/services/auth/auth.service'; import { ConfigurationService } from '@app/core/services/configuration/configuration.service'; import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service'; -import { DmpBlueprintService } from '@app/core/services/plan/plan-blueprint.service'; +import { PlanBlueprintService } from '@app/core/services/plan/plan-blueprint.service'; import { LockService } from '@app/core/services/lock/lock.service'; import { LoggingService } from '@app/core/services/logging/logging-service'; import { AnalyticsService } from '@app/core/services/matomo/analytics-service'; @@ -41,9 +41,9 @@ import { TranslateService } from '@ngx-translate/core'; import * as FileSaver from 'file-saver'; import { map, takeUntil } from 'rxjs/operators'; import { DescriptionTemplatePreviewDialogComponent } from '../../description-template/description-template-preview/description-template-preview-dialog.component'; -import { DmpBlueprintEditorModel, FieldInSectionEditorModel } from './plan-blueprint-editor.model'; -import { DmpBlueprintEditorResolver } from './plan-blueprint-editor.resolver'; -import { DmpBlueprintEditorService } from './plan-blueprint-editor.service'; +import { PlanBlueprintEditorModel, FieldInSectionEditorModel } from './plan-blueprint-editor.model'; +import { PlanBlueprintEditorResolver } from './plan-blueprint-editor.resolver'; +import { PlanBlueprintEditorService } from './plan-blueprint-editor.service'; import { RouterUtilsService } from '@app/core/services/router/router-utils.service'; @@ -51,9 +51,9 @@ import { RouterUtilsService } from '@app/core/services/router/router-utils.servi selector: 'app-plan-blueprint-editor-component', templateUrl: 'plan-blueprint-editor.component.html', styleUrls: ['./plan-blueprint-editor.component.scss'], - providers: [DmpBlueprintEditorService] + providers: [PlanBlueprintEditorService] }) -export class DmpBlueprintEditorComponent extends BaseEditor implements OnInit { +export class PlanBlueprintEditorComponent extends BaseEditor implements OnInit { isNew = true; isClone = false; @@ -65,12 +65,12 @@ export class DmpBlueprintEditorComponent extends BaseEditor(DmpBlueprintSystemFieldType); - dmpBlueprintExtraFieldDataType = DmpBlueprintExtraFieldDataType; - public dmpBlueprintExtraFieldDataTypeEnum = this.enumUtils.getEnumValues(DmpBlueprintExtraFieldDataType); - public dmpBlueprintFieldCategoryEnum = this.enumUtils.getEnumValues(DmpBlueprintFieldCategory); + dmpBlueprintSectionFieldCategory = PlanBlueprintFieldCategory; + dmpBlueprintSystemFieldType = PlanBlueprintSystemFieldType; + public planBlueprintSystemFieldTypeEnum = this.enumUtils.getEnumValues(PlanBlueprintSystemFieldType); + dmpBlueprintExtraFieldDataType = PlanBlueprintExtraFieldDataType; + public planBlueprintExtraFieldDataTypeEnum = this.enumUtils.getEnumValues(PlanBlueprintExtraFieldDataType); + public dmpBlueprintFieldCategoryEnum = this.enumUtils.getEnumValues(PlanBlueprintFieldCategory); descriptionTempalteGroupSingleAutocompleteConfiguration: SingleAutoCompleteConfiguration = { initialItems: (data?: any) => this.descriptionTemplateService.query(this.descriptionTemplateService.buildDescriptionTempalteGroupAutocompleteLookup([IsActive.Active], null, null, null, this.getUsedDescriptionTemplateGroupIds())).pipe(map(x => x.items)), filterFn: (searchQuery: string, data?: any) => this.descriptionTemplateService.query(this.descriptionTemplateService.buildDescriptionTempalteGroupAutocompleteLookup([IsActive.Active], searchQuery, null, null, this.getUsedDescriptionTemplateGroupIds() ? this.getUsedDescriptionTemplateGroupIds() : null)).pipe(map(x => x.items)), @@ -83,17 +83,17 @@ export class DmpBlueprintEditorComponent extends BaseEditor { @@ -172,22 +172,22 @@ export class DmpBlueprintEditorComponent extends BaseEditor void) { - this.dmpBlueprintService.getSingle(itemId, DmpBlueprintEditorResolver.lookupFields()) - .pipe(map(data => data as DmpBlueprint), takeUntil(this._destroyed)) + getItem(itemId: Guid, successFunction: (item: PlanBlueprint) => void) { + this.planBlueprintService.getSingle(itemId, PlanBlueprintEditorResolver.lookupFields()) + .pipe(map(data => data as PlanBlueprint), takeUntil(this._destroyed)) .subscribe( data => successFunction(data), error => this.onCallbackError(error) ); } - prepareForm(data: DmpBlueprint) { + prepareForm(data: PlanBlueprint) { try { - this.editorModel = data ? new DmpBlueprintEditorModel().fromModel(data) : new DmpBlueprintEditorModel(); + this.editorModel = data ? new PlanBlueprintEditorModel().fromModel(data) : new PlanBlueprintEditorModel(); this.isDeleted = data ? data.isActive === IsActive.Inactive : false; this.buildForm(); - if (data && data.id) this.checkLock(data.id, LockTargetType.DmpBlueprint, 'DMP-BLUEPRINT-EDITOR.LOCKED-DIALOG.TITLE', 'DMP-BLUEPRINT-EDITOR.LOCKED-DIALOG.MESSAGE'); + if (data && data.id) this.checkLock(data.id, LockTargetType.PlanBlueprint, 'PLAN-BLUEPRINT-EDITOR.LOCKED-DIALOG.TITLE', 'PLAN-BLUEPRINT-EDITOR.LOCKED-DIALOG.MESSAGE'); } catch (error) { this.logger.error('Could not parse dmpBlueprint item: ' + data + error); @@ -196,7 +196,7 @@ export class DmpBlueprintEditorComponent extends BaseEditor this.prepareForm(data)); + this.getItem(id ?? this.editorModel.id, (data: PlanBlueprint) => this.prepareForm(data)); } refreshOnNavigateToData(id?: Guid): void { this.formGroup.markAsPristine(); if (this.isNew || this.isNewVersion) { let route = []; - route.push(this.routerUtils.generateUrl('/dmp-blueprints/' + id)); + route.push(this.routerUtils.generateUrl('/plan-blueprints/' + id)); this.router.navigate(route, { queryParams: { 'lookup': this.queryParamsService.serializeLookup(this.lookupParams), 'lv': ++this.lv }, replaceUrl: true, relativeTo: this.route }); } else { this.refreshData(id); @@ -223,17 +223,17 @@ export class DmpBlueprintEditorComponent extends BaseEditor void): void { if (this.isNewVersion == false) { - const formData = this.formService.getValue(this.formGroup.value) as DmpBlueprintPersist; + const formData = this.formService.getValue(this.formGroup.value) as PlanBlueprintPersist; - this.dmpBlueprintService.persist(formData) + this.planBlueprintService.persist(formData) .pipe(takeUntil(this._destroyed)).subscribe( complete => onSuccess ? onSuccess(complete) : this.onCallbackSuccess(complete), error => this.onCallbackError(error) ); } else if (this.isNewVersion == true && this.isNew == false && this.isClone == false) { - const formData = this.formService.getValue(this.formGroup.value) as NewVersionDmpBlueprintPersist; + const formData = this.formService.getValue(this.formGroup.value) as NewVersionPlanBlueprintPersist; - this.dmpBlueprintService.newVersion(formData) + this.planBlueprintService.newVersion(formData) .pipe(takeUntil(this._destroyed)).subscribe( complete => onSuccess ? onSuccess(complete) : this.onCallbackSuccess(complete), error => this.onCallbackError(error) @@ -265,7 +265,7 @@ export class DmpBlueprintEditorComponent extends BaseEditor { if (result) { - this.dmpBlueprintService.delete(value.id).pipe(takeUntil(this._destroyed)) + this.planBlueprintService.delete(value.id).pipe(takeUntil(this._destroyed)) .subscribe( complete => this.onCallbackDeleteSuccess(), error => this.onCallbackError(error) @@ -310,7 +310,7 @@ export class DmpBlueprintEditorComponent extends BaseEditor { section.get('ordinal').setValue(index + 1); }); - DmpBlueprintEditorModel.reApplySectionValidators( + PlanBlueprintEditorModel.reApplySectionValidators( { formGroup: this.formGroup, validationErrorModel: this.editorModel.validationErrorModel @@ -357,7 +357,7 @@ export class DmpBlueprintEditorComponent extends BaseEditor (x.get('fields') as FormArray).controls.some(y => (y as UntypedFormGroup).get('systemFieldType')?.value === systemField)); } fieldCategoryChanged(sectionIndex: number, fieldIndex: number) { //Reapply validators - DmpBlueprintEditorModel.reApplySectionValidators( + PlanBlueprintEditorModel.reApplySectionValidators( { formGroup: this.formGroup, validationErrorModel: this.editorModel.validationErrorModel @@ -381,7 +381,7 @@ export class DmpBlueprintEditorComponent extends BaseEditor section.fields.some(field => (field.category == DmpBlueprintFieldCategory.System) && (field as SystemFieldInSection).systemFieldType === DmpBlueprintSystemFieldType.Title)); + const dmpBlueprint: PlanBlueprintPersist = this.formGroup.value; + return dmpBlueprint.definition.sections.some(section => section.fields.some(field => (field.category == PlanBlueprintFieldCategory.System) && (field as SystemFieldInSection).systemFieldType === PlanBlueprintSystemFieldType.Title)); } hasDescription(): boolean { - const dmpBlueprint: DmpBlueprintPersist = this.formGroup.value; - return dmpBlueprint.definition.sections.some(section => section.fields.some(field => (field.category == DmpBlueprintFieldCategory.System) && (field as SystemFieldInSection).systemFieldType === DmpBlueprintSystemFieldType.Description)); + const dmpBlueprint: PlanBlueprintPersist = this.formGroup.value; + return dmpBlueprint.definition.sections.some(section => section.fields.some(field => (field.category == PlanBlueprintFieldCategory.System) && (field as SystemFieldInSection).systemFieldType === PlanBlueprintSystemFieldType.Description)); } hasLanguage(): boolean { - const dmpBlueprint: DmpBlueprintPersist = this.formGroup.value; - return dmpBlueprint.definition.sections.some(section => section.fields.some(field => (field.category == DmpBlueprintFieldCategory.System) && (field as SystemFieldInSection).systemFieldType === DmpBlueprintSystemFieldType.Language)); + const dmpBlueprint: PlanBlueprintPersist = this.formGroup.value; + return dmpBlueprint.definition.sections.some(section => section.fields.some(field => (field.category == PlanBlueprintFieldCategory.System) && (field as SystemFieldInSection).systemFieldType === PlanBlueprintSystemFieldType.Language)); } hasAccess(): boolean { - const dmpBlueprint: DmpBlueprintPersist = this.formGroup.value; - return dmpBlueprint.definition.sections.some(section => section.fields.some(field => (field.category == DmpBlueprintFieldCategory.System) && (field as SystemFieldInSection).systemFieldType === DmpBlueprintSystemFieldType.AccessRights)); + const dmpBlueprint: PlanBlueprintPersist = this.formGroup.value; + return dmpBlueprint.definition.sections.some(section => section.fields.some(field => (field.category == PlanBlueprintFieldCategory.System) && (field as SystemFieldInSection).systemFieldType === PlanBlueprintSystemFieldType.AccessRights)); } hasDescriptionTemplates(): boolean { - const dmpBlueprint: DmpBlueprintPersist = this.formGroup.value; + const dmpBlueprint: PlanBlueprintPersist = this.formGroup.value; return dmpBlueprint.definition.sections.some(section => section.hasTemplates == true); } @@ -556,12 +556,12 @@ export class DmpBlueprintEditorComponent extends BaseEditor { const blob = new Blob([response.body], { type: 'application/xml' }); diff --git a/dmp-frontend/src/app/ui/admin/plan-blueprint/editor/plan-blueprint-editor.model.ts b/dmp-frontend/src/app/ui/admin/plan-blueprint/editor/plan-blueprint-editor.model.ts index 95818fdf0..2c790c233 100644 --- a/dmp-frontend/src/app/ui/admin/plan-blueprint/editor/plan-blueprint-editor.model.ts +++ b/dmp-frontend/src/app/ui/admin/plan-blueprint/editor/plan-blueprint-editor.model.ts @@ -1,21 +1,21 @@ import { FormArray, UntypedFormArray, UntypedFormBuilder, UntypedFormGroup, Validators } from "@angular/forms"; -import { DmpBlueprintFieldCategory } from "@app/core/common/enum/plan-blueprint-field-category"; -import { DmpBlueprintExtraFieldDataType } from "@app/core/common/enum/plan-blueprint-field-type"; -import { DmpBlueprintStatus } from "@app/core/common/enum/plan-blueprint-status"; -import { DmpBlueprintSystemFieldType } from "@app/core/common/enum/plan-blueprint-system-field-type"; -import { DmpBlueprintVersionStatus } from "@app/core/common/enum/plan-blueprint-version-status"; -import { DescriptionTemplatesInSection, DescriptionTemplatesInSectionPersist, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionPersist, DmpBlueprintDefinitionSection, DmpBlueprintDefinitionSectionPersist, DmpBlueprintPersist, ExtraFieldInSection, FieldInSection, FieldInSectionPersist, ReferenceTypeFieldInSection, SystemFieldInSection } from "@app/core/model/plan-blueprint/plan-blueprint"; +import { PlanBlueprintFieldCategory } from "@app/core/common/enum/plan-blueprint-field-category"; +import { PlanBlueprintExtraFieldDataType } from "@app/core/common/enum/plan-blueprint-field-type"; +import { PlanBlueprintStatus } from "@app/core/common/enum/plan-blueprint-status"; +import { PlanBlueprintSystemFieldType } from "@app/core/common/enum/plan-blueprint-system-field-type"; +import { PlanBlueprintVersionStatus } from "@app/core/common/enum/plan-blueprint-version-status"; +import { DescriptionTemplatesInSection, DescriptionTemplatesInSectionPersist, PlanBlueprint, PlanBlueprintDefinition, PlanBlueprintDefinitionPersist, PlanBlueprintDefinitionSection, PlanBlueprintDefinitionSectionPersist, PlanBlueprintPersist, ExtraFieldInSection, FieldInSection, FieldInSectionPersist, ReferenceTypeFieldInSection, SystemFieldInSection } from "@app/core/model/plan-blueprint/plan-blueprint"; import { BaseEditorModel } from "@common/base/base-form-editor-model"; -import { BackendErrorValidator, DmpBlueprintSystemFieldRequiredValidator } from "@common/forms/validation/custom-validator"; +import { BackendErrorValidator, PlanBlueprintSystemFieldRequiredValidator } from "@common/forms/validation/custom-validator"; import { ValidationErrorModel } from "@common/forms/validation/error-model/validation-error-model"; import { Validation, ValidationContext } from "@common/forms/validation/validation-context"; import { Guid } from "@common/types/guid"; -export class DmpBlueprintEditorModel extends BaseEditorModel implements DmpBlueprintPersist { +export class PlanBlueprintEditorModel extends BaseEditorModel implements PlanBlueprintPersist { label: string; - definition: DmpBlueprintDefinitionEditorModel = new DmpBlueprintDefinitionEditorModel(); - status: DmpBlueprintStatus = DmpBlueprintStatus.Draft; - versionStatus: DmpBlueprintVersionStatus = DmpBlueprintVersionStatus.Current; + definition: PlanBlueprintDefinitionEditorModel = new PlanBlueprintDefinitionEditorModel(); + status: PlanBlueprintStatus = PlanBlueprintStatus.Draft; + versionStatus: PlanBlueprintVersionStatus = PlanBlueprintVersionStatus.Current; description: string; permissions: string[]; @@ -24,13 +24,13 @@ export class DmpBlueprintEditorModel extends BaseEditorModel implements DmpBluep constructor() { super(); } - public fromModel(item: DmpBlueprint): DmpBlueprintEditorModel { + public fromModel(item: PlanBlueprint): PlanBlueprintEditorModel { if (item) { super.fromModel(item); this.label = item.label; this.status = item.status; this.versionStatus = item.versionStatus; - this.definition = new DmpBlueprintDefinitionEditorModel(this.validationErrorModel).fromModel(item.definition); + this.definition = new PlanBlueprintDefinitionEditorModel(this.validationErrorModel).fromModel(item.definition); } return this; } @@ -63,7 +63,7 @@ export class DmpBlueprintEditorModel extends BaseEditorModel implements DmpBluep } createChildSection(index: number): UntypedFormGroup { - const section: DmpBlueprintDefinitionSectionEditorModel = new DmpBlueprintDefinitionSectionEditorModel(this.validationErrorModel); + const section: PlanBlueprintDefinitionSectionEditorModel = new PlanBlueprintDefinitionSectionEditorModel(this.validationErrorModel); section.id = Guid.create(); section.ordinal = index + 1; section.hasTemplates = false; @@ -90,7 +90,7 @@ export class DmpBlueprintEditorModel extends BaseEditorModel implements DmpBluep const { formGroup, validationErrorModel } = params; const control = formGroup?.get('definition'); - DmpBlueprintDefinitionEditorModel.reapplySectionsValidators({ + PlanBlueprintDefinitionEditorModel.reapplySectionsValidators({ formArray: control.get('sections') as UntypedFormArray, rootPath: `definition.`, validationErrorModel: validationErrorModel @@ -99,17 +99,17 @@ export class DmpBlueprintEditorModel extends BaseEditorModel implements DmpBluep } } -export class DmpBlueprintDefinitionEditorModel implements DmpBlueprintDefinitionPersist { - sections: DmpBlueprintDefinitionSectionEditorModel[] = []; +export class PlanBlueprintDefinitionEditorModel implements PlanBlueprintDefinitionPersist { + sections: PlanBlueprintDefinitionSectionEditorModel[] = []; protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder(); constructor( public validationErrorModel: ValidationErrorModel = new ValidationErrorModel() ) { } - public fromModel(item: DmpBlueprintDefinition): DmpBlueprintDefinitionEditorModel { + public fromModel(item: PlanBlueprintDefinition): PlanBlueprintDefinitionEditorModel { if (item) { - if (item.sections) { item.sections.sort((a,b) => a.ordinal - b.ordinal).map(x => this.sections.push(new DmpBlueprintDefinitionSectionEditorModel(this.validationErrorModel).fromModel(x))); } + if (item.sections) { item.sections.sort((a,b) => a.ordinal - b.ordinal).map(x => this.sections.push(new PlanBlueprintDefinitionSectionEditorModel(this.validationErrorModel).fromModel(x))); } } return this; } @@ -121,7 +121,7 @@ export class DmpBlueprintDefinitionEditorModel implements DmpBlueprintDefinition }): UntypedFormGroup { let { context = null, disabled = false, rootPath } = params ?? {} if (context == null) { - context = DmpBlueprintDefinitionEditorModel.createValidationContext({ + context = PlanBlueprintDefinitionEditorModel.createValidationContext({ validationErrorModel: this.validationErrorModel, rootPath }); @@ -147,7 +147,7 @@ export class DmpBlueprintDefinitionEditorModel implements DmpBlueprintDefinition const baseContext: ValidationContext = new ValidationContext(); const baseValidationArray: Validation[] = new Array(); - baseValidationArray.push({ key: 'sections', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}sections`), DmpBlueprintSystemFieldRequiredValidator()] }); + baseValidationArray.push({ key: 'sections', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}sections`), PlanBlueprintSystemFieldRequiredValidator()] }); baseContext.validation = baseValidationArray; return baseContext; @@ -160,7 +160,7 @@ export class DmpBlueprintDefinitionEditorModel implements DmpBlueprintDefinition }): void { const { validationErrorModel, rootPath, formArray } = params; formArray?.controls?.forEach( - (control, index) => DmpBlueprintDefinitionSectionEditorModel.reapplySectionValidators({ + (control, index) => PlanBlueprintDefinitionSectionEditorModel.reapplySectionValidators({ formGroup: control as UntypedFormGroup, rootPath: `${rootPath}sections[${index}].`, validationErrorModel: validationErrorModel @@ -170,7 +170,7 @@ export class DmpBlueprintDefinitionEditorModel implements DmpBlueprintDefinition } -export class DmpBlueprintDefinitionSectionEditorModel implements DmpBlueprintDefinitionSectionPersist { +export class PlanBlueprintDefinitionSectionEditorModel implements PlanBlueprintDefinitionSectionPersist { id: Guid; label: string; description: string; @@ -186,7 +186,7 @@ export class DmpBlueprintDefinitionSectionEditorModel implements DmpBlueprintDef public validationErrorModel: ValidationErrorModel = new ValidationErrorModel() ) { } - public fromModel(item: DmpBlueprintDefinitionSection): DmpBlueprintDefinitionSectionEditorModel { + public fromModel(item: PlanBlueprintDefinitionSection): PlanBlueprintDefinitionSectionEditorModel { if (item) { this.id = item.id; this.label = item.label; @@ -207,7 +207,7 @@ export class DmpBlueprintDefinitionSectionEditorModel implements DmpBlueprintDef }): UntypedFormGroup { let { context = null, disabled = false, rootPath } = params ?? {} if (context == null) { - context = DmpBlueprintDefinitionSectionEditorModel.createValidationContext({ + context = PlanBlueprintDefinitionSectionEditorModel.createValidationContext({ validationErrorModel: this.validationErrorModel, rootPath }); @@ -267,7 +267,7 @@ export class DmpBlueprintDefinitionSectionEditorModel implements DmpBlueprintDef rootPath: string }): void { const { formGroup, rootPath, validationErrorModel } = params; - const context = DmpBlueprintDefinitionSectionEditorModel.createValidationContext({ + const context = PlanBlueprintDefinitionSectionEditorModel.createValidationContext({ rootPath, validationErrorModel }); @@ -302,20 +302,20 @@ export class DmpBlueprintDefinitionSectionEditorModel implements DmpBlueprintDef export class FieldInSectionEditorModel implements FieldInSectionPersist { public id: Guid; - public category: DmpBlueprintFieldCategory; + public category: PlanBlueprintFieldCategory; public label: string; public placeholder: string; public description: string; public semantics: string[]; public required: boolean = false; public ordinal: number; - public dataType: DmpBlueprintExtraFieldDataType; - public systemFieldType: DmpBlueprintSystemFieldType; + public dataType: PlanBlueprintExtraFieldDataType; + public systemFieldType: PlanBlueprintSystemFieldType; public referenceTypeId: Guid; public multipleSelect: boolean; - static get alwaysRequiredSystemFieldTypes(): DmpBlueprintSystemFieldType[] { - return [DmpBlueprintSystemFieldType.Title, DmpBlueprintSystemFieldType.Description, DmpBlueprintSystemFieldType.Language, DmpBlueprintSystemFieldType.AccessRights]; + static get alwaysRequiredSystemFieldTypes(): PlanBlueprintSystemFieldType[] { + return [PlanBlueprintSystemFieldType.Title, PlanBlueprintSystemFieldType.Description, PlanBlueprintSystemFieldType.Language, PlanBlueprintSystemFieldType.AccessRights]; } protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder(); @@ -334,14 +334,14 @@ export class FieldInSectionEditorModel implements FieldInSectionPersist { this.required = item.required; this.ordinal = item.ordinal; - if (this.category == DmpBlueprintFieldCategory.System) { + if (this.category == PlanBlueprintFieldCategory.System) { this.systemFieldType = (item as SystemFieldInSection).systemFieldType; if (FieldInSectionEditorModel.alwaysRequiredSystemFieldTypes.includes(this.systemFieldType)) { this.required = true; } - } else if (this.category == DmpBlueprintFieldCategory.Extra) { + } else if (this.category == PlanBlueprintFieldCategory.Extra) { this.dataType = (item as ExtraFieldInSection).dataType; - } else if (this.category == DmpBlueprintFieldCategory.ReferenceType) { + } else if (this.category == PlanBlueprintFieldCategory.ReferenceType) { this.referenceTypeId = (item as ReferenceTypeFieldInSection).referenceType?.id; this.multipleSelect= (item as ReferenceTypeFieldInSection).multipleSelect; } @@ -366,7 +366,7 @@ export class FieldInSectionEditorModel implements FieldInSectionPersist { id: [{ value: this.id, disabled: disabled }, context.getValidation('id').validators], category: [{ value: this.category, disabled: disabled }, context.getValidation('category').validators], - label: [{ value: this.label, disabled: disabled }, this.category === DmpBlueprintFieldCategory.System ? context.getValidation('label-system').validators : ( this.category === DmpBlueprintFieldCategory.Extra ? context.getValidation('label-extra').validators : context.getValidation('label-external-reference').validators)], + label: [{ value: this.label, disabled: disabled }, this.category === PlanBlueprintFieldCategory.System ? context.getValidation('label-system').validators : ( this.category === PlanBlueprintFieldCategory.Extra ? context.getValidation('label-extra').validators : context.getValidation('label-external-reference').validators)], placeholder: [{ value: this.placeholder, disabled: disabled }, context.getValidation('placeholder').validators], description: [{ value: this.description, disabled: disabled }, context.getValidation('description').validators], required: [{ value: this.required, disabled: disabled }, context.getValidation('required').validators], @@ -425,16 +425,16 @@ export class FieldInSectionEditorModel implements FieldInSectionPersist { if (keyField == 'label') { control?.addValidators(context.has('label-system') ? context.getValidation('label-system').validators : (context.has('label-extra') ? context.getValidation('label-extra').validators : context.getValidation('label-external-reference').validators)); } else if (keyField == 'referenceTypeId') { - if (formGroup.get('category').value === DmpBlueprintFieldCategory.ReferenceType) control?.addValidators([Validators.required, ...context.getValidation('referenceTypeId').validators]); + if (formGroup.get('category').value === PlanBlueprintFieldCategory.ReferenceType) control?.addValidators([Validators.required, ...context.getValidation('referenceTypeId').validators]); else control?.addValidators([...context.getValidation('referenceTypeId').validators]); } else if (keyField == 'multipleSelect') { - if (formGroup.get('category').value === DmpBlueprintFieldCategory.ReferenceType) control?.addValidators([Validators.required, ...context.getValidation('multipleSelect').validators]); + if (formGroup.get('category').value === PlanBlueprintFieldCategory.ReferenceType) control?.addValidators([Validators.required, ...context.getValidation('multipleSelect').validators]); else control?.addValidators([...context.getValidation('multipleSelect').validators]); }else if (keyField == 'systemFieldType') { - if (formGroup.get('category').value === DmpBlueprintFieldCategory.System) control?.addValidators([Validators.required, ...context.getValidation('systemFieldType').validators]); + if (formGroup.get('category').value === PlanBlueprintFieldCategory.System) control?.addValidators([Validators.required, ...context.getValidation('systemFieldType').validators]); else control?.addValidators([...context.getValidation('systemFieldType').validators]); } else if (keyField == 'dataType') { - if (formGroup.get('category').value === DmpBlueprintFieldCategory.Extra) control?.addValidators([Validators.required, ...context.getValidation('dataType').validators]); + if (formGroup.get('category').value === PlanBlueprintFieldCategory.Extra) control?.addValidators([Validators.required, ...context.getValidation('dataType').validators]); else control?.addValidators([...context.getValidation('dataType').validators]); } else { control?.addValidators(context.getValidation(keyField).validators); diff --git a/dmp-frontend/src/app/ui/admin/plan-blueprint/editor/plan-blueprint-editor.resolver.ts b/dmp-frontend/src/app/ui/admin/plan-blueprint/editor/plan-blueprint-editor.resolver.ts index cba3cd3cb..b8a5055f3 100644 --- a/dmp-frontend/src/app/ui/admin/plan-blueprint/editor/plan-blueprint-editor.resolver.ts +++ b/dmp-frontend/src/app/ui/admin/plan-blueprint/editor/plan-blueprint-editor.resolver.ts @@ -1,9 +1,9 @@ import { Injectable } from '@angular/core'; import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'; -import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection, ExtraFieldInSection, FieldInSection, ReferenceTypeFieldInSection, SystemFieldInSection } from '@app/core/model/plan-blueprint/plan-blueprint'; +import { DescriptionTemplatesInSection, PlanBlueprint, PlanBlueprintDefinition, PlanBlueprintDefinitionSection, ExtraFieldInSection, FieldInSection, ReferenceTypeFieldInSection, SystemFieldInSection } from '@app/core/model/plan-blueprint/plan-blueprint'; import { PrefillingSource } from '@app/core/model/prefilling-source/prefilling-source'; import { ReferenceType } from '@app/core/model/reference-type/reference-type'; -import { DmpBlueprintService } from '@app/core/services/plan/plan-blueprint.service'; +import { PlanBlueprintService } from '@app/core/services/plan/plan-blueprint.service'; import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service'; import { BaseEditorResolver } from '@common/base/base-editor.resolver'; import { Guid } from '@common/types/guid'; @@ -11,68 +11,68 @@ import { takeUntil, tap } from 'rxjs/operators'; import { nameof } from 'ts-simple-nameof'; @Injectable() -export class DmpBlueprintEditorResolver extends BaseEditorResolver { +export class PlanBlueprintEditorResolver extends BaseEditorResolver { - constructor(private dmpBlueprintService: DmpBlueprintService, private breadcrumbService: BreadcrumbService) { + constructor(private planBlueprintService: PlanBlueprintService, private breadcrumbService: BreadcrumbService) { super(); } public static lookupFields(): string[] { return [ ...BaseEditorResolver.lookupFields(), - nameof(x => x.id), - nameof(x => x.label), - nameof(x => x.status), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.label)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.description)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.ordinal)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.hasTemplates)].join('.'), + nameof(x => x.id), + nameof(x => x.label), + nameof(x => x.status), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.label)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.description)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.ordinal)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.hasTemplates)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.id)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.category)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.label)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.placeholder)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.description)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.required)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.semantics)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.ordinal)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.systemFieldType)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.dataType)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.referenceType), nameof(x => x.id)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.referenceType), nameof(x => x.name)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.referenceType), nameof(x => x.code)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.multipleSelect)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.id)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.category)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.label)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.placeholder)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.description)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.required)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.semantics)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.ordinal)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.systemFieldType)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.dataType)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.referenceType), nameof(x => x.id)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.referenceType), nameof(x => x.name)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.referenceType), nameof(x => x.code)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.multipleSelect)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.label)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.minMultiplicity)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.maxMultiplicity)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.label)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.minMultiplicity)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.maxMultiplicity)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.prefillingSources), nameof(x => x.id)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.prefillingSources), nameof(x => x.label)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.prefillingSources), nameof(x => x.code)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.prefillingSources), nameof(x => x.id)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.prefillingSources), nameof(x => x.label)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.prefillingSources), nameof(x => x.code)].join('.'), - nameof(x => x.createdAt), - nameof(x => x.hash), - nameof(x => x.isActive) + nameof(x => x.createdAt), + nameof(x => x.hash), + nameof(x => x.isActive) ] } resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { const fields = [ - ...DmpBlueprintEditorResolver.lookupFields() + ...PlanBlueprintEditorResolver.lookupFields() ]; const id = route.paramMap.get('id'); const cloneid = route.paramMap.get('cloneid'); const newversion = route.paramMap.get("newversionid"); if (id != null) { - return this.dmpBlueprintService.getSingle(Guid.parse(id), fields).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(x.id?.toString(), x.label)), takeUntil(this._destroyed)); + return this.planBlueprintService.getSingle(Guid.parse(id), fields).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(x.id?.toString(), x.label)), takeUntil(this._destroyed)); } else if (cloneid != null) { - return this.dmpBlueprintService.clone(Guid.parse(cloneid), fields).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(cloneid, x.label)), takeUntil(this._destroyed)); + return this.planBlueprintService.clone(Guid.parse(cloneid), fields).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(cloneid, x.label)), takeUntil(this._destroyed)); } else if (newversion != null) { - return this.dmpBlueprintService.getSingle(Guid.parse(newversion), fields).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(newversion, x.label)), takeUntil(this._destroyed)); + return this.planBlueprintService.getSingle(Guid.parse(newversion), fields).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(newversion, x.label)), takeUntil(this._destroyed)); } } } diff --git a/dmp-frontend/src/app/ui/admin/plan-blueprint/editor/plan-blueprint-editor.service.ts b/dmp-frontend/src/app/ui/admin/plan-blueprint/editor/plan-blueprint-editor.service.ts index 6070d257b..7d85b55cd 100644 --- a/dmp-frontend/src/app/ui/admin/plan-blueprint/editor/plan-blueprint-editor.service.ts +++ b/dmp-frontend/src/app/ui/admin/plan-blueprint/editor/plan-blueprint-editor.service.ts @@ -2,7 +2,7 @@ import { Injectable } from "@angular/core"; import { ValidationErrorModel } from "@common/forms/validation/error-model/validation-error-model"; @Injectable() -export class DmpBlueprintEditorService { +export class PlanBlueprintEditorService { private validationErrorModel: ValidationErrorModel; public setValidationErrorModel(validationErrorModel: ValidationErrorModel): void { diff --git a/dmp-frontend/src/app/ui/admin/plan-blueprint/listing/filters/plan-blueprint-listing-filters.component.html b/dmp-frontend/src/app/ui/admin/plan-blueprint/listing/filters/plan-blueprint-listing-filters.component.html index fc34c9d97..bbf4b0bc1 100644 --- a/dmp-frontend/src/app/ui/admin/plan-blueprint/listing/filters/plan-blueprint-listing-filters.component.html +++ b/dmp-frontend/src/app/ui/admin/plan-blueprint/listing/filters/plan-blueprint-listing-filters.component.html @@ -10,7 +10,7 @@
-

{{'DMP-BLUEPRINT-LISTING.FILTER.TITLE' | translate}}

+

{{'PLAN-BLUEPRINT-LISTING.FILTER.TITLE' | translate}}

@@ -31,9 +31,9 @@
- {{'DMP-BLUEPRINT-LISTING.FILTER.STATUS' | translate}} + {{'PLAN-BLUEPRINT-LISTING.FILTER.STATUS' | translate}} - {{enumUtils.toDmpBlueprintStatusString(blueprintStatus)}} + {{enumUtils.toPlanBlueprintStatusString(blueprintStatus)}}
@@ -42,12 +42,12 @@
diff --git a/dmp-frontend/src/app/ui/admin/plan-blueprint/listing/filters/plan-blueprint-listing-filters.component.ts b/dmp-frontend/src/app/ui/admin/plan-blueprint/listing/filters/plan-blueprint-listing-filters.component.ts index 3dce8c9ef..8c3f1567d 100644 --- a/dmp-frontend/src/app/ui/admin/plan-blueprint/listing/filters/plan-blueprint-listing-filters.component.ts +++ b/dmp-frontend/src/app/ui/admin/plan-blueprint/listing/filters/plan-blueprint-listing-filters.component.ts @@ -1,7 +1,7 @@ import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core'; -import { DmpBlueprintStatus } from '@app/core/common/enum/plan-blueprint-status'; +import { PlanBlueprintStatus } from '@app/core/common/enum/plan-blueprint-status'; import { IsActive } from '@app/core/common/enum/is-active.enum'; -import { DmpBlueprintFilter } from '@app/core/query/plan-blueprint.lookup'; +import { PlanBlueprintFilter } from '@app/core/query/plan-blueprint.lookup'; import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; import { BaseComponent } from '@common/base/base.component'; import { Guid } from '@common/types/guid'; @@ -12,15 +12,15 @@ import { nameof } from 'ts-simple-nameof'; templateUrl: './plan-blueprint-listing-filters.component.html', styleUrls: ['./plan-blueprint-listing-filters.component.scss'] }) -export class DmpBlueprintListingFiltersComponent extends BaseComponent implements OnInit, OnChanges { +export class PlanBlueprintListingFiltersComponent extends BaseComponent implements OnInit, OnChanges { - @Input() readonly filter: DmpBlueprintFilter; - @Output() filterChange = new EventEmitter(); + @Input() readonly filter: PlanBlueprintFilter; + @Output() filterChange = new EventEmitter(); - dmpBlueprintStatusEnumValues = this.enumUtils.getEnumValues(DmpBlueprintStatus); + planBlueprintStatusEnumValues = this.enumUtils.getEnumValues(PlanBlueprintStatus); // * State - internalFilters: DmpBlueprintListingFilters = this._getEmptyFilters(); + internalFilters: PlanBlueprintListingFilters = this._getEmptyFilters(); protected appliedFilterCount: number = 0; constructor( @@ -31,7 +31,7 @@ export class DmpBlueprintListingFiltersComponent extends BaseComponent implement } ngOnChanges(changes: SimpleChanges): void { - const filterChange = changes[nameof(x => x.filter)]?.currentValue as DmpBlueprintFilter; + const filterChange = changes[nameof(x => x.filter)]?.currentValue as PlanBlueprintFilter; if (filterChange) { this.updateFilters() } @@ -59,7 +59,7 @@ export class DmpBlueprintListingFiltersComponent extends BaseComponent implement } - private _parseToInternalFilters(inputFilter: DmpBlueprintFilter): DmpBlueprintListingFilters { + private _parseToInternalFilters(inputFilter: PlanBlueprintFilter): PlanBlueprintListingFilters { if (!inputFilter) { return this._getEmptyFilters(); } @@ -74,7 +74,7 @@ export class DmpBlueprintListingFiltersComponent extends BaseComponent implement } - private _getEmptyFilters(): DmpBlueprintListingFilters { + private _getEmptyFilters(): PlanBlueprintListingFilters { return { isActive: true, like: null, @@ -82,7 +82,7 @@ export class DmpBlueprintListingFiltersComponent extends BaseComponent implement } } - private _computeAppliedFilters(filters: DmpBlueprintListingFilters): number { + private _computeAppliedFilters(filters: PlanBlueprintListingFilters): number { let count = 0; if (filters?.isActive) { count++ @@ -95,8 +95,8 @@ export class DmpBlueprintListingFiltersComponent extends BaseComponent implement } } -interface DmpBlueprintListingFilters { +interface PlanBlueprintListingFilters { isActive: boolean; like: string; - statuses: DmpBlueprintStatus[]; + statuses: PlanBlueprintStatus[]; } diff --git a/dmp-frontend/src/app/ui/admin/plan-blueprint/listing/import-plan-blueprint/import-plan-blueprint.dialog.component.html b/dmp-frontend/src/app/ui/admin/plan-blueprint/listing/import-plan-blueprint/import-plan-blueprint.dialog.component.html index b73860ce5..e60bba2c6 100644 --- a/dmp-frontend/src/app/ui/admin/plan-blueprint/listing/import-plan-blueprint/import-plan-blueprint.dialog.component.html +++ b/dmp-frontend/src/app/ui/admin/plan-blueprint/listing/import-plan-blueprint/import-plan-blueprint.dialog.component.html @@ -21,15 +21,15 @@
- +
diff --git a/dmp-frontend/src/app/ui/admin/plan-blueprint/listing/import-plan-blueprint/import-plan-blueprint.dialog.component.ts b/dmp-frontend/src/app/ui/admin/plan-blueprint/listing/import-plan-blueprint/import-plan-blueprint.dialog.component.ts index 65ea6d91d..fac537464 100644 --- a/dmp-frontend/src/app/ui/admin/plan-blueprint/listing/import-plan-blueprint/import-plan-blueprint.dialog.component.ts +++ b/dmp-frontend/src/app/ui/admin/plan-blueprint/listing/import-plan-blueprint/import-plan-blueprint.dialog.component.ts @@ -6,7 +6,7 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; templateUrl: './import-plan-blueprint.dialog.component.html', styleUrls: ['./import-plan-blueprint.dialog.component.scss'] }) -export class ImportDmpBlueprintDialogComponent { +export class ImportPlanBlueprintDialogComponent { sizeError = false; selectFile = false; @@ -14,7 +14,7 @@ export class ImportDmpBlueprintDialogComponent { selectedFileName: string; constructor( - public dialogRef: MatDialogRef, + public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public data: any ) { } diff --git a/dmp-frontend/src/app/ui/admin/plan-blueprint/listing/plan-blueprint-listing.component.html b/dmp-frontend/src/app/ui/admin/plan-blueprint/listing/plan-blueprint-listing.component.html index ec09a2077..20ade4205 100644 --- a/dmp-frontend/src/app/ui/admin/plan-blueprint/listing/plan-blueprint-listing.component.html +++ b/dmp-frontend/src/app/ui/admin/plan-blueprint/listing/plan-blueprint-listing.component.html @@ -8,20 +8,20 @@
-
- + @@ -46,15 +46,15 @@
-
- {{enumUtils.toDmpBlueprintStatusString(item.status) | nullifyValue}} +
+ {{enumUtils.toPlanBlueprintStatusString(item.status) | nullifyValue}}
- {{'DMP-BLUEPRINT-LISTING.FIELDS.CREATED-AT' | translate}}: + {{'PLAN-BLUEPRINT-LISTING.FIELDS.CREATED-AT' | translate}}: {{item?.createdAt | dateTimeFormatter : 'short' | nullifyValue}} @@ -63,7 +63,7 @@ - {{'DMP-BLUEPRINT-LISTING.FIELDS.UPDATED-AT' | translate}}: + {{'PLAN-BLUEPRINT-LISTING.FIELDS.UPDATED-AT' | translate}}: {{item?.updatedAt | dateTimeFormatter : 'short' | nullifyValue}} @@ -73,10 +73,10 @@
- +
-
- {{enumUtils.toDmpBlueprintStatusString(row.status) | nullifyValue}} +
+ {{enumUtils.toPlanBlueprintStatusString(row.status) | nullifyValue}}
@@ -88,25 +88,25 @@ more_horiz - - - -
diff --git a/dmp-frontend/src/app/ui/admin/plan-blueprint/listing/plan-blueprint-listing.component.ts b/dmp-frontend/src/app/ui/admin/plan-blueprint/listing/plan-blueprint-listing.component.ts index 95dd90b0b..2c080432c 100644 --- a/dmp-frontend/src/app/ui/admin/plan-blueprint/listing/plan-blueprint-listing.component.ts +++ b/dmp-frontend/src/app/ui/admin/plan-blueprint/listing/plan-blueprint-listing.component.ts @@ -2,13 +2,13 @@ import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { ActivatedRoute, Router } from '@angular/router'; -import { DmpBlueprintStatus } from '@app/core/common/enum/plan-blueprint-status'; -import { DmpBlueprintVersionStatus } from '@app/core/common/enum/plan-blueprint-version-status'; +import { PlanBlueprintStatus } from '@app/core/common/enum/plan-blueprint-status'; +import { PlanBlueprintVersionStatus } from '@app/core/common/enum/plan-blueprint-version-status'; import { IsActive } from '@app/core/common/enum/is-active.enum'; -import { DmpBlueprint } from '@app/core/model/plan-blueprint/plan-blueprint'; -import { DmpBlueprintLookup } from '@app/core/query/plan-blueprint.lookup'; +import { PlanBlueprint } from '@app/core/model/plan-blueprint/plan-blueprint'; +import { PlanBlueprintLookup } from '@app/core/query/plan-blueprint.lookup'; import { AuthService } from '@app/core/services/auth/auth.service'; -import { DmpBlueprintService } from '@app/core/services/plan/plan-blueprint.service'; +import { PlanBlueprintService } from '@app/core/services/plan/plan-blueprint.service'; import { AnalyticsService } from '@app/core/services/matomo/analytics-service'; import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service'; import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; @@ -28,7 +28,7 @@ import * as FileSaver from 'file-saver'; import { Observable } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { nameof } from 'ts-simple-nameof'; -import { ImportDmpBlueprintDialogComponent } from './import-plan-blueprint/import-plan-blueprint.dialog.component'; +import { ImportPlanBlueprintDialogComponent } from './import-plan-blueprint/import-plan-blueprint.dialog.component'; import { RouterUtilsService } from '@app/core/services/router/router-utils.service'; @@ -37,28 +37,28 @@ import { RouterUtilsService } from '@app/core/services/router/router-utils.servi templateUrl: './plan-blueprint-listing.component.html', styleUrls: ['./plan-blueprint-listing.component.scss'] }) -export class DmpBlueprintListingComponent extends BaseListingComponent implements OnInit { +export class PlanBlueprintListingComponent extends BaseListingComponent implements OnInit { publish = false; - userSettingsKey = { key: 'DmpBlueprintListingUserSettings' }; + userSettingsKey = { key: 'PlanBlueprintListingUserSettings' }; propertiesAvailableForOrder: ColumnDefinition[]; - dmpBlueprintStatuses = DmpBlueprintStatus; + planBlueprintStatuses = PlanBlueprintStatus; mode; - @ViewChild('dmpBlueprintStatus', { static: true }) dmpBlueprintStatus?: TemplateRef; + @ViewChild('planBlueprintStatus', { static: true }) planBlueprintStatus?: TemplateRef; @ViewChild('actions', { static: true }) actions?: TemplateRef; @ViewChild(HybridListingComponent, { static: true }) hybridListingComponent: HybridListingComponent; private readonly lookupFields: string[] = [ - nameof(x => x.id), - nameof(x => x.label), - nameof(x => x.status), - nameof(x => x.version), - nameof(x => x.groupId), - nameof(x => x.updatedAt), - nameof(x => x.createdAt), - nameof(x => x.hash), - nameof(x => x.isActive), - nameof(x => x.belongsToCurrentTenant) + nameof(x => x.id), + nameof(x => x.label), + nameof(x => x.status), + nameof(x => x.version), + nameof(x => x.groupId), + nameof(x => x.updatedAt), + nameof(x => x.createdAt), + nameof(x => x.hash), + nameof(x => x.isActive), + nameof(x => x.belongsToCurrentTenant) ]; rowIdentity = x => x.id; @@ -70,7 +70,7 @@ export class DmpBlueprintListingComponent extends BaseListingComponent(x => x.createdAt))] }; + lookup.order = { items: [this.toDescSortField(nameof(x => x.createdAt))] }; if (this.mode && this.mode == 'versions-listing') { lookup.groupIds = [Guid.parse(this.route.snapshot.paramMap.get('groupid'))]; lookup.versionStatuses = null; } else { - lookup.versionStatuses = [DmpBlueprintVersionStatus.Current, DmpBlueprintVersionStatus.NotFinalized]; + lookup.versionStatuses = [PlanBlueprintVersionStatus.Current, PlanBlueprintVersionStatus.NotFinalized]; } this.updateOrderUiFields(lookup.order); @@ -114,37 +114,37 @@ export class DmpBlueprintListingComponent extends BaseListingComponent(x => x.label), + prop: nameof(x => x.label), sortable: true, - languageName: 'DMP-BLUEPRINT-LISTING.FIELDS.NAME' + languageName: 'PLAN-BLUEPRINT-LISTING.FIELDS.NAME' }, { - prop: nameof(x => x.status), + prop: nameof(x => x.status), sortable: true, - languageName: 'DMP-BLUEPRINT-LISTING.FIELDS.STATUS', - cellTemplate: this.dmpBlueprintStatus + languageName: 'PLAN-BLUEPRINT-LISTING.FIELDS.STATUS', + cellTemplate: this.planBlueprintStatus }, { - prop: nameof(x => x.version), + prop: nameof(x => x.version), sortable: true, - languageName: 'DMP-BLUEPRINT-LISTING.FIELDS.VERSION' + languageName: 'PLAN-BLUEPRINT-LISTING.FIELDS.VERSION' }, { - prop: nameof(x => x.createdAt), + prop: nameof(x => x.createdAt), sortable: true, - languageName: 'DMP-BLUEPRINT-LISTING.FIELDS.CREATED-AT', + languageName: 'PLAN-BLUEPRINT-LISTING.FIELDS.CREATED-AT', pipe: this.pipeService.getPipe(DataTableDateTimeFormatPipe).withFormat('short') }, { - prop: nameof(x => x.updatedAt), + prop: nameof(x => x.updatedAt), sortable: true, - languageName: 'DMP-BLUEPRINT-LISTING.FIELDS.UPDATED-AT', + languageName: 'PLAN-BLUEPRINT-LISTING.FIELDS.UPDATED-AT', pipe: this.pipeService.getPipe(DataTableDateTimeFormatPipe).withFormat('short') }, { - prop: nameof(x => x.isActive), + prop: nameof(x => x.isActive), sortable: true, - languageName: 'DMP-BLUEPRINT-LISTING.FIELDS.IS-ACTIVE', + languageName: 'PLAN-BLUEPRINT-LISTING.FIELDS.IS-ACTIVE', pipe: this.pipeService.getPipe(IsActiveTypePipe) }, { @@ -176,8 +176,8 @@ export class DmpBlueprintListingComponent extends BaseListingComponent> { - return this.dmpBlueprintService.query(this.lookup); + protected loadListing(): Observable> { + return this.planBlueprintService.query(this.lookup); } public delete(id: Guid) { @@ -192,7 +192,7 @@ export class DmpBlueprintListingComponent extends BaseListingComponent { if (result) { - this.dmpBlueprintService.delete(id).pipe(takeUntil(this._destroyed)) + this.planBlueprintService.delete(id).pipe(takeUntil(this._destroyed)) .subscribe( complete => this.onCallbackSuccess(), error => this.onCallbackError(error) @@ -209,7 +209,7 @@ export class DmpBlueprintListingComponent extends BaseListingComponent { const blob = new Blob([response.body], { type: 'application/xml' }); @@ -220,12 +220,12 @@ export class DmpBlueprintListingComponent extends BaseListingComponent { if (data && data.sucsess && data.name != null && data.file != null) { - this.dmpBlueprintService.uploadFile(data.file, data.name) + this.planBlueprintService.uploadFile(data.file, data.name) .pipe(takeUntil(this._destroyed)) .subscribe(_ => { - this.uiNotificationService.snackBarNotification(this.language.instant('DMP-BLUEPRINT-LISTING.MESSAGES.BLUEPRINT-UPLOAD-SUCCESS'), SnackBarNotificationLevel.Success); + this.uiNotificationService.snackBarNotification(this.language.instant('PLAN-BLUEPRINT-LISTING.MESSAGES.BLUEPRINT-UPLOAD-SUCCESS'), SnackBarNotificationLevel.Success); this.refresh(); }, error => { diff --git a/dmp-frontend/src/app/ui/admin/plan-blueprint/plan-blueprint.module.ts b/dmp-frontend/src/app/ui/admin/plan-blueprint/plan-blueprint.module.ts index 90ef3d8e8..f600a174c 100644 --- a/dmp-frontend/src/app/ui/admin/plan-blueprint/plan-blueprint.module.ts +++ b/dmp-frontend/src/app/ui/admin/plan-blueprint/plan-blueprint.module.ts @@ -9,11 +9,11 @@ import { TextFilterModule } from "@common/modules/text-filter/text-filter.module import { UserSettingsModule } from "@common/modules/user-settings/user-settings.module"; import { CommonUiModule } from '@common/ui/common-ui.module'; import { NgxDropzoneModule } from "ngx-dropzone"; -import { DmpBlueprintRoutingModule } from './plan-blueprint.routing'; -import { DmpBlueprintEditorComponent } from './editor/plan-blueprint-editor.component'; -import { DmpBlueprintListingComponent } from './listing/plan-blueprint-listing.component'; -import { DmpBlueprintListingFiltersComponent } from "./listing/filters/plan-blueprint-listing-filters.component"; -import { ImportDmpBlueprintDialogComponent } from './listing/import-plan-blueprint/import-plan-blueprint.dialog.component'; +import { PlanBlueprintRoutingModule } from './plan-blueprint.routing'; +import { PlanBlueprintEditorComponent } from './editor/plan-blueprint-editor.component'; +import { PlanBlueprintListingComponent } from './listing/plan-blueprint-listing.component'; +import { PlanBlueprintListingFiltersComponent } from "./listing/filters/plan-blueprint-listing-filters.component"; +import { ImportPlanBlueprintDialogComponent } from './listing/import-plan-blueprint/import-plan-blueprint.dialog.component'; import { DescriptionTemplatePreviewDialogModule } from '../description-template/description-template-preview/description-template-preview-dialog.module'; @NgModule({ @@ -21,7 +21,7 @@ import { DescriptionTemplatePreviewDialogModule } from '../description-template/ CommonUiModule, CommonFormsModule, ConfirmationDialogModule, - DmpBlueprintRoutingModule, + PlanBlueprintRoutingModule, NgxDropzoneModule, DragDropModule, AutoCompleteModule, @@ -32,10 +32,10 @@ import { DescriptionTemplatePreviewDialogModule } from '../description-template/ DescriptionTemplatePreviewDialogModule ], declarations: [ - DmpBlueprintEditorComponent, - DmpBlueprintListingComponent, - DmpBlueprintListingFiltersComponent, - ImportDmpBlueprintDialogComponent + PlanBlueprintEditorComponent, + PlanBlueprintListingComponent, + PlanBlueprintListingFiltersComponent, + ImportPlanBlueprintDialogComponent ] }) -export class DmpBlueprintModule { } +export class PlanBlueprintModule { } diff --git a/dmp-frontend/src/app/ui/admin/plan-blueprint/plan-blueprint.routing.ts b/dmp-frontend/src/app/ui/admin/plan-blueprint/plan-blueprint.routing.ts index 3bc530625..2b7b1022e 100644 --- a/dmp-frontend/src/app/ui/admin/plan-blueprint/plan-blueprint.routing.ts +++ b/dmp-frontend/src/app/ui/admin/plan-blueprint/plan-blueprint.routing.ts @@ -1,22 +1,22 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; -import { DmpBlueprintEditorComponent } from './editor/plan-blueprint-editor.component'; -import { DmpBlueprintListingComponent } from './listing/plan-blueprint-listing.component'; +import { PlanBlueprintEditorComponent } from './editor/plan-blueprint-editor.component'; +import { PlanBlueprintListingComponent } from './listing/plan-blueprint-listing.component'; import { AppPermission } from '@app/core/common/enum/permission.enum'; import { AuthGuard } from '@app/core/auth-guard.service'; import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service'; import { PendingChangesGuard } from '@common/forms/pending-form-changes/pending-form-changes-guard.service'; -import { DmpBlueprintEditorResolver } from './editor/plan-blueprint-editor.resolver'; +import { PlanBlueprintEditorResolver } from './editor/plan-blueprint-editor.resolver'; const routes: Routes = [ { path: '', - component: DmpBlueprintListingComponent, + component: PlanBlueprintListingComponent, canActivate: [AuthGuard] }, { path: 'versions/:groupid', - component: DmpBlueprintListingComponent, + component: PlanBlueprintListingComponent, canActivate: [AuthGuard], data: { mode: 'versions-listing' @@ -25,14 +25,14 @@ const routes: Routes = [ { path: 'new', canActivate: [AuthGuard], - component: DmpBlueprintEditorComponent, + component: PlanBlueprintEditorComponent, canDeactivate: [PendingChangesGuard], data: { authContext: { - permissions: [AppPermission.EditDmpBlueprint] + permissions: [AppPermission.EditPlanBlueprint] }, ...BreadcrumbService.generateRouteDataConfiguration({ - title: 'BREADCRUMBS.NEW-DMP-BLUEPRINT' + title: 'BREADCRUMBS.NEW-PLAN-BLUEPRINT' }), getFromTitleService: true, usePrefix: false @@ -41,17 +41,17 @@ const routes: Routes = [ { path: 'clone/:cloneid', canActivate: [AuthGuard], - component: DmpBlueprintEditorComponent, + component: PlanBlueprintEditorComponent, canDeactivate: [PendingChangesGuard], resolve: { - 'entity': DmpBlueprintEditorResolver + 'entity': PlanBlueprintEditorResolver }, data: { ...BreadcrumbService.generateRouteDataConfiguration({ skipNavigation: true }), authContext: { - permissions: [AppPermission.EditDmpBlueprint] + permissions: [AppPermission.EditPlanBlueprint] }, getFromTitleService: true, usePrefix: false, @@ -61,17 +61,17 @@ const routes: Routes = [ { path: 'new-version/:newversionid', canActivate: [AuthGuard], - component: DmpBlueprintEditorComponent, + component: PlanBlueprintEditorComponent, canDeactivate: [PendingChangesGuard], resolve: { - 'entity': DmpBlueprintEditorResolver + 'entity': PlanBlueprintEditorResolver }, data: { ...BreadcrumbService.generateRouteDataConfiguration({ skipNavigation: true }), authContext: { - permissions: [AppPermission.EditDmpBlueprint] + permissions: [AppPermission.EditPlanBlueprint] }, getFromTitleService: true, usePrefix: false, @@ -81,14 +81,14 @@ const routes: Routes = [ { path: ':id', canActivate: [AuthGuard], - component: DmpBlueprintEditorComponent, + component: PlanBlueprintEditorComponent, canDeactivate: [PendingChangesGuard], resolve: { - 'entity': DmpBlueprintEditorResolver + 'entity': PlanBlueprintEditorResolver }, data: { authContext: { - permissions: [AppPermission.EditDmpBlueprint] + permissions: [AppPermission.EditPlanBlueprint] }, getFromTitleService: true, usePrefix: false @@ -101,6 +101,6 @@ const routes: Routes = [ @NgModule({ imports: [RouterModule.forChild(routes)], exports: [RouterModule], - providers: [DmpBlueprintEditorResolver] + providers: [PlanBlueprintEditorResolver] }) -export class DmpBlueprintRoutingModule { } +export class PlanBlueprintRoutingModule { } diff --git a/dmp-frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.component.ts b/dmp-frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.component.ts index 7d7c3253a..176e0e0ea 100644 --- a/dmp-frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.component.ts +++ b/dmp-frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.component.ts @@ -76,7 +76,7 @@ export class AnnotationDialogComponent extends BaseComponent { this.entityId = data.entityId; this.anchor = data.anchor; this.entityType = data.entityType; - this.dmpUsersMentionNames = data.dmpUsers.map(x => x.user.name); + this.dmpUsersMentionNames = data.planUsers.map(x => x.user.name); dialogRef.backdropClick().pipe(takeUntil(this._destroyed)).subscribe(() => dialogRef.close(this.changesMade)); } diff --git a/dmp-frontend/src/app/ui/dashboard/dashboard.component.html b/dmp-frontend/src/app/ui/dashboard/dashboard.component.html index 6001587d3..fb337cd29 100644 --- a/dmp-frontend/src/app/ui/dashboard/dashboard.component.html +++ b/dmp-frontend/src/app/ui/dashboard/dashboard.component.html @@ -27,21 +27,21 @@
clear -

{{'DASHBOARD.DMP-QUESTION' | translate}}

-

{{'DASHBOARD.INFO-DMP-TEXT' | translate}}

+

{{'DASHBOARD.PLAN-QUESTION' | translate}}

+

{{'DASHBOARD.INFO-PLAN-TEXT' | translate}}

{{'DASHBOARD.NEW-QUESTION' | translate}} {{'DASHBOARD.OPEN-AIR-GUIDE' | translate}} {{'DASHBOARD.LEARN-MORE' | translate}}

-

{{'DASHBOARD.DMP-ABOUT-BEG' | translate}} +

{{'DASHBOARD.PLAN-ABOUT-BEG' | translate}} {{'DASHBOARD.DESCRIPTIONS-DASHBOARD-TEXT' | translate}} - {{'DASHBOARD.DMP-ABOUT-END' | translate}} + {{'DASHBOARD.PLAN-ABOUT-END' | translate}}

- +
@@ -64,7 +64,7 @@ > - + @@ -85,7 +85,7 @@
0
@@ -110,7 +110,7 @@
{{dashboardStatistics?.dmpCount}}
- {{'DASHBOARD.DMPS' | translate}} + {{'DASHBOARD.PLANS' | translate}}
@@ -168,7 +168,7 @@
0
@@ -190,7 +190,7 @@
diff --git a/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts b/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts index 4445baf3f..6c3ada45c 100644 --- a/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts @@ -16,7 +16,7 @@ import moment from 'moment'; import { CookieService } from 'ngx-cookie-service'; import { takeUntil } from 'rxjs/operators'; import { StartNewDescriptionDialogComponent } from '../description/start-new-description-dialog/start-new-description-dialog.component'; -import { StartNewDmpDialogComponent } from '../plan/new/start-new-plan-dialogue/start-new-plan-dialog.component'; +import { StartNewPlanDialogComponent } from '../plan/new/start-new-plan-dialogue/start-new-plan-dialog.component'; import { AnalyticsService } from '@app/core/services/matomo/analytics-service'; import { RouterUtilsService } from '@app/core/services/router/router-utils.service'; @@ -112,12 +112,12 @@ export class DashboardComponent extends BaseComponent implements OnInit { return this.authentication.currentAccountIsAuthenticated(); } - openNewDmpDialog() { + openNewPlanDialog() { if (this.dialog.openDialogs.length > 0) { this.dialog.closeAll(); } else { - const dialogRef = this.dialog.open(StartNewDmpDialogComponent, { + const dialogRef = this.dialog.open(StartNewPlanDialogComponent, { disableClose: false, data: { isDialog: true @@ -140,23 +140,23 @@ export class DashboardComponent extends BaseComponent implements OnInit { if (addDescription == false) return; const formGroup = this.fb.group({ - dmpId: this.fb.control(null, Validators.required), + planId: this.fb.control(null, Validators.required), }) const dialogRef = this.dialog.open(StartNewDescriptionDialogComponent, { disableClose: false, restoreFocus: false, data: { - startNewDmp: false, + startNewPlan: false, formGroup: formGroup } }); dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { if (result) { - if (result.startNewDmp) { - this.openNewDmpDialog(); + if (result.startNewPlan) { + this.openNewPlanDialog(); } else { - this.router.navigate([this.routerUtils.generateUrl(['/plans/', 'edit/', result.formGroup.get('dmpId').value])]); + this.router.navigate([this.routerUtils.generateUrl(['/plans/', 'edit/', result.formGroup.get('planId').value])]); } } }); @@ -172,7 +172,7 @@ export class DashboardComponent extends BaseComponent implements OnInit { orientation: Orientation.BottomRight, isStepUnique: false, highlightPadding: 10, - closeAction: () => this.openNewDmpDialog() + closeAction: () => this.openNewPlanDialog() }, { selector: '.import-file', @@ -200,7 +200,7 @@ export class DashboardComponent extends BaseComponent implements OnInit { }; public setDashboardTourDmpText(): void { - const dmpText = this.language.instant('DASHBOARD.TOUR-GUIDE.DMP') + '\n\n' + + const dmpText = this.language.instant('DASHBOARD.TOUR-GUIDE.PLAN') + '\n\n' + this.language.instant('DASHBOARD.TOUR-GUIDE.START-NEW'); this.dashboardTour.steps[0].title = dmpText; } diff --git a/dmp-frontend/src/app/ui/dashboard/dashboard.module.ts b/dmp-frontend/src/app/ui/dashboard/dashboard.module.ts index 62a8930e3..4abf59d3c 100644 --- a/dmp-frontend/src/app/ui/dashboard/dashboard.module.ts +++ b/dmp-frontend/src/app/ui/dashboard/dashboard.module.ts @@ -7,7 +7,7 @@ import { ConfirmationDialogModule } from '@common/modules/confirmation-dialog/co import { CommonUiModule } from '@common/ui/common-ui.module'; import { DescriptionListingModule } from '../description/listing/description-listing.module'; import { DmpListingModule } from '../plan/listing/plan-listing.module'; -import { StartNewDmpDialogModule } from '../plan/new/start-new-plan-dialogue/start-new-plan-dialog.module'; +import { StartNewPlanDialogModule } from '../plan/new/start-new-plan-dialogue/start-new-plan-dialog.module'; import { RecentEditedActivityComponent } from './recent-edited-activity/recent-edited-activity.component'; @NgModule({ @@ -21,7 +21,7 @@ import { RecentEditedActivityComponent } from './recent-edited-activity/recent-e DmpListingModule, DescriptionListingModule, - StartNewDmpDialogModule + StartNewPlanDialogModule ], declarations: [ DashboardComponent, diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.html b/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.html index 09afd4dca..3258dff80 100644 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.html +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.html @@ -1,13 +1,13 @@
- {{'DMP-LISTING.EMPTY-LIST' | translate}} + {{'PLAN-LISTING.EMPTY-LIST' | translate}}
- {{'DMP-LISTING.SORT-BY' | translate}}: + {{'PLAN-LISTING.SORT-BY' | translate}}:
@@ -31,7 +31,7 @@
- +
diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts b/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts index 5c5bc87ec..d48778f1f 100644 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts @@ -3,22 +3,22 @@ import { Component, Input, OnInit, Output } from '@angular/core'; import { UntypedFormBuilder, UntypedFormControl } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; import { DescriptionStatus } from '@app/core/common/enum/description-status'; -import { DmpStatus } from '@app/core/common/enum/plan-status'; +import { PlanStatus } from '@app/core/common/enum/plan-status'; import { IsActive } from '@app/core/common/enum/is-active.enum'; import { AppPermission } from '@app/core/common/enum/permission.enum'; import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order'; import { RecentActivityItem } from '@app/core/model/dashboard/recent-activity-item'; import { DescriptionTemplate } from '@app/core/model/description-template/description-template'; import { Description } from '@app/core/model/description/description'; -import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/plan-blueprint/plan-blueprint'; -import { Dmp, DmpDescriptionTemplate, DmpUser } from '@app/core/model/plan/plan'; -import { DmpReference } from '@app/core/model/plan/plan-reference'; +import { DescriptionTemplatesInSection, PlanBlueprint, PlanBlueprintDefinition, PlanBlueprintDefinitionSection } from '@app/core/model/plan-blueprint/plan-blueprint'; +import { Plan, PlanDescriptionTemplate, PlanUser } from '@app/core/model/plan/plan'; +import { PlanReference } from '@app/core/model/plan/plan-reference'; import { ReferenceType } from '@app/core/model/reference-type/reference-type'; import { Reference } from '@app/core/model/reference/reference'; import { RecentActivityItemLookup } from '@app/core/query/recent-activity-item-lookup.lookup'; import { AuthService } from '@app/core/services/auth/auth.service'; import { DashboardService } from '@app/core/services/dashboard/dashboard.service'; -import { DmpService } from '@app/core/services/plan/plan.service'; +import { PlanService } from '@app/core/services/plan/plan.service'; import { AnalyticsService } from '@app/core/services/matomo/analytics-service'; import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; import { BaseComponent } from '@common/base/base.component'; @@ -79,7 +79,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn private authentication: AuthService, private dashboardService: DashboardService, private location: Location, - private dmpService: DmpService, + private planService: PlanService, private analyticsService: AnalyticsService, private httpErrorHandlingService: HttpErrorHandlingService ) { @@ -166,7 +166,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn this.lookup.like = this.formGroup.get('like').value; this.lookup.project = { fields : [ - ...(this.includeDmps ? this._getDmpLookup() : []), + ...(this.includeDmps ? this._getPlanLookup() : []), ...(this.includeDescriptions ? this._getDescriptionLookup() : []) ] }; @@ -207,15 +207,15 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn if (this.lookup.page.offset == 0) this.listingItems = []; response.forEach(item => { - if (item.dmp){ - if (item.dmp.descriptions) { - if (item.dmp.status == DmpStatus.Finalized) { - item.dmp.descriptions = item.dmp.descriptions.filter(x => x.isActive === IsActive.Active && x.status === DescriptionStatus.Finalized); + if (item.plan){ + if (item.plan.descriptions) { + if (item.plan.status == PlanStatus.Finalized) { + item.plan.descriptions = item.plan.descriptions.filter(x => x.isActive === IsActive.Active && x.status === DescriptionStatus.Finalized); } else { - item.dmp.descriptions = item.dmp.descriptions.filter(x => x.isActive === IsActive.Active && x.status != DescriptionStatus.Canceled); + item.plan.descriptions = item.plan.descriptions.filter(x => x.isActive === IsActive.Active && x.status != DescriptionStatus.Canceled); } } - item.dmp.dmpUsers = item.dmp.dmpUsers.filter(x=> x.isActive === IsActive.Active); + item.plan.planUsers = item.plan.planUsers.filter(x=> x.isActive === IsActive.Active); this.listingItems.push(item); } if (item.description){ @@ -240,52 +240,52 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn this.updateUrl(); } - private _getDmpLookup(): string[] { + private _getPlanLookup(): string[] { return [ - [nameof(x => x.dmp), nameof(x => x.id)].join('.'), - [nameof(x => x.dmp), nameof(x => x.label)].join('.'), - [nameof(x => x.dmp), nameof(x => x.description)].join('.'), - [nameof(x => x.dmp), nameof(x => x.status)].join('.'), - [nameof(x => x.dmp), nameof(x => x.accessType)].join('.'), - [nameof(x => x.dmp), nameof(x => x.version)].join('.'), - [nameof(x => x.dmp), nameof(x => x.versionStatus)].join('.'), - [nameof(x => x.dmp), nameof(x => x.groupId)].join('.'), - [nameof(x => x.dmp), nameof(x => x.updatedAt)].join('.'), - [nameof(x => x.dmp), nameof(x => x.isActive)].join('.'), - [nameof(x => x.dmp), nameof(x => x.hash)].join('.'), - [nameof(x => x.dmp), nameof(x => x.authorizationFlags), AppPermission.CreateNewVersionDmp].join('.'), - [nameof(x => x.dmp), nameof(x => x.authorizationFlags), AppPermission.DeleteDmp].join('.'), - [nameof(x => x.dmp), nameof(x => x.authorizationFlags), AppPermission.CloneDmp].join('.'), - [nameof(x => x.dmp), nameof(x => x.authorizationFlags), AppPermission.FinalizeDmp].join('.'), - [nameof(x => x.dmp), nameof(x => x.authorizationFlags), AppPermission.ExportDmp].join('.'), - [nameof(x => x.dmp), nameof(x => x.authorizationFlags), AppPermission.InviteDmpUsers].join('.'), - [nameof(x => x.dmp), nameof(x => x.authorizationFlags), AppPermission.AssignDmpUsers].join('.'), - [nameof(x => x.dmp), nameof(x => x.authorizationFlags), AppPermission.EditDmp].join('.'), - [nameof(x => x.dmp), nameof(x => x.descriptions), nameof(x => x.id)].join('.'), - [nameof(x => x.dmp), nameof(x => x.descriptions), nameof(x => x.label)].join('.'), - [nameof(x => x.dmp), nameof(x => x.descriptions), nameof(x => x.status)].join('.'), - [nameof(x => x.dmp), nameof(x => x.descriptions), nameof(x => x.isActive)].join('.'), - [nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.id)].join('.'), - [nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.label)].join('.'), - [nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.hasTemplates)].join('.'), - [nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), - [nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.label)].join('.'), - [nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.id)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.user.id)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.role)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.isActive)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.id)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.id)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.label)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.type), nameof(x => x.id)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.isActive)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpDescriptionTemplates), nameof(x => x.sectionId)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpDescriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpDescriptionTemplates), nameof(x => x.isActive)].join('.'), - [nameof(x => x.dmp), nameof(x => x.descriptions), nameof(x => x.descriptionTemplate), nameof(x => x.groupId)].join('.'), - [nameof(x => x.dmp), nameof(x => x.descriptions), nameof(x => x.id)].join('.'), - [nameof(x => x.dmp), nameof(x => x.descriptions), nameof(x => x.dmpDescriptionTemplate), nameof(x => x.sectionId)].join('.'), + [nameof(x => x.plan), nameof(x => x.id)].join('.'), + [nameof(x => x.plan), nameof(x => x.label)].join('.'), + [nameof(x => x.plan), nameof(x => x.description)].join('.'), + [nameof(x => x.plan), nameof(x => x.status)].join('.'), + [nameof(x => x.plan), nameof(x => x.accessType)].join('.'), + [nameof(x => x.plan), nameof(x => x.version)].join('.'), + [nameof(x => x.plan), nameof(x => x.versionStatus)].join('.'), + [nameof(x => x.plan), nameof(x => x.groupId)].join('.'), + [nameof(x => x.plan), nameof(x => x.updatedAt)].join('.'), + [nameof(x => x.plan), nameof(x => x.isActive)].join('.'), + [nameof(x => x.plan), nameof(x => x.hash)].join('.'), + [nameof(x => x.plan), nameof(x => x.authorizationFlags), AppPermission.CreateNewVersionPlan].join('.'), + [nameof(x => x.plan), nameof(x => x.authorizationFlags), AppPermission.DeletePlan].join('.'), + [nameof(x => x.plan), nameof(x => x.authorizationFlags), AppPermission.ClonePlan].join('.'), + [nameof(x => x.plan), nameof(x => x.authorizationFlags), AppPermission.FinalizePlan].join('.'), + [nameof(x => x.plan), nameof(x => x.authorizationFlags), AppPermission.ExportPlan].join('.'), + [nameof(x => x.plan), nameof(x => x.authorizationFlags), AppPermission.InvitePlanUsers].join('.'), + [nameof(x => x.plan), nameof(x => x.authorizationFlags), AppPermission.AssignPlanUsers].join('.'), + [nameof(x => x.plan), nameof(x => x.authorizationFlags), AppPermission.EditPlan].join('.'), + [nameof(x => x.plan), nameof(x => x.descriptions), nameof(x => x.id)].join('.'), + [nameof(x => x.plan), nameof(x => x.descriptions), nameof(x => x.label)].join('.'), + [nameof(x => x.plan), nameof(x => x.descriptions), nameof(x => x.status)].join('.'), + [nameof(x => x.plan), nameof(x => x.descriptions), nameof(x => x.isActive)].join('.'), + [nameof(x => x.plan), nameof(x => x.blueprint), nameof(x => x.id)].join('.'), + [nameof(x => x.plan), nameof(x => x.blueprint), nameof(x => x.label)].join('.'), + [nameof(x => x.plan), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.hasTemplates)].join('.'), + [nameof(x => x.plan), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), + [nameof(x => x.plan), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.label)].join('.'), + [nameof(x => x.plan), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), + [nameof(x => x.plan), nameof(x => x.planUsers), nameof(x => x.id)].join('.'), + [nameof(x => x.plan), nameof(x => x.planUsers), nameof(x => x.user.id)].join('.'), + [nameof(x => x.plan), nameof(x => x.planUsers), nameof(x => x.role)].join('.'), + [nameof(x => x.plan), nameof(x => x.planUsers), nameof(x => x.isActive)].join('.'), + [nameof(x => x.plan), nameof(x => x.planReferences), nameof(x => x.id)].join('.'), + [nameof(x => x.plan), nameof(x => x.planReferences), nameof(x => x.reference), nameof(x => x.id)].join('.'), + [nameof(x => x.plan), nameof(x => x.planReferences), nameof(x => x.reference), nameof(x => x.label)].join('.'), + [nameof(x => x.plan), nameof(x => x.planReferences), nameof(x => x.reference), nameof(x => x.type), nameof(x => x.id)].join('.'), + [nameof(x => x.plan), nameof(x => x.planReferences), nameof(x => x.isActive)].join('.'), + [nameof(x => x.plan), nameof(x => x.planDescriptionTemplates), nameof(x => x.sectionId)].join('.'), + [nameof(x => x.plan), nameof(x => x.planDescriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), + [nameof(x => x.plan), nameof(x => x.planDescriptionTemplates), nameof(x => x.isActive)].join('.'), + [nameof(x => x.plan), nameof(x => x.descriptions), nameof(x => x.descriptionTemplate), nameof(x => x.groupId)].join('.'), + [nameof(x => x.plan), nameof(x => x.descriptions), nameof(x => x.id)].join('.'), + [nameof(x => x.plan), nameof(x => x.descriptions), nameof(x => x.planDescriptionTemplate), nameof(x => x.sectionId)].join('.'), ]; } @@ -298,28 +298,28 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn [nameof(x => x.description), nameof(x => x.isActive)].join('.'), [nameof(x => x.description), nameof(x => x.authorizationFlags), AppPermission.EditDescription].join('.'), [nameof(x => x.description), nameof(x => x.authorizationFlags), AppPermission.DeleteDescription].join('.'), - [nameof(x => x.description), nameof(x => x.authorizationFlags), AppPermission.InviteDmpUsers].join('.'), + [nameof(x => x.description), nameof(x => x.authorizationFlags), AppPermission.InvitePlanUsers].join('.'), [nameof(x => x.description), nameof(x => x.descriptionTemplate), nameof(x => x.id)].join('.'), [nameof(x => x.description), nameof(x => x.descriptionTemplate), nameof(x => x.label)].join('.'), [nameof(x => x.description), nameof(x => x.descriptionTemplate), nameof(x => x.groupId)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.id)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.label)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.accessType)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.id)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.label)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.label)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.hasTemplates)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.id)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.user.id)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.role)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.isActive)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.id)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.id)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.label)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.type), nameof(x => x.id)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.reference)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.isActive)].join('.'), + [nameof(x => x.description), nameof(x => x.plan), nameof(x => x.id)].join('.'), + [nameof(x => x.description), nameof(x => x.plan), nameof(x => x.label)].join('.'), + [nameof(x => x.description), nameof(x => x.plan), nameof(x => x.accessType)].join('.'), + [nameof(x => x.description), nameof(x => x.plan), nameof(x => x.blueprint), nameof(x => x.id)].join('.'), + [nameof(x => x.description), nameof(x => x.plan), nameof(x => x.blueprint), nameof(x => x.label)].join('.'), + [nameof(x => x.description), nameof(x => x.plan), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), + [nameof(x => x.description), nameof(x => x.plan), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.label)].join('.'), + [nameof(x => x.description), nameof(x => x.plan), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.hasTemplates)].join('.'), + [nameof(x => x.description), nameof(x => x.plan), nameof(x => x.planUsers), nameof(x => x.id)].join('.'), + [nameof(x => x.description), nameof(x => x.plan), nameof(x => x.planUsers), nameof(x => x.user.id)].join('.'), + [nameof(x => x.description), nameof(x => x.plan), nameof(x => x.planUsers), nameof(x => x.role)].join('.'), + [nameof(x => x.description), nameof(x => x.plan), nameof(x => x.planUsers), nameof(x => x.isActive)].join('.'), + [nameof(x => x.description), nameof(x => x.plan), nameof(x => x.planReferences), nameof(x => x.id)].join('.'), + [nameof(x => x.description), nameof(x => x.plan), nameof(x => x.planReferences), nameof(x => x.reference), nameof(x => x.id)].join('.'), + [nameof(x => x.description), nameof(x => x.plan), nameof(x => x.planReferences), nameof(x => x.reference), nameof(x => x.label)].join('.'), + [nameof(x => x.description), nameof(x => x.plan), nameof(x => x.planReferences), nameof(x => x.reference), nameof(x => x.type), nameof(x => x.id)].join('.'), + [nameof(x => x.description), nameof(x => x.plan), nameof(x => x.planReferences), nameof(x => x.reference), nameof(x => x.reference)].join('.'), + [nameof(x => x.description), nameof(x => x.plan), nameof(x => x.planReferences), nameof(x => x.isActive)].join('.'), ] } } diff --git a/dmp-frontend/src/app/ui/description/description-copy-dialog/description-copy-dialog.component.html b/dmp-frontend/src/app/ui/description/description-copy-dialog/description-copy-dialog.component.html index 20533e95b..2547e3f44 100644 --- a/dmp-frontend/src/app/ui/description/description-copy-dialog/description-copy-dialog.component.html +++ b/dmp-frontend/src/app/ui/description/description-copy-dialog/description-copy-dialog.component.html @@ -7,7 +7,7 @@
- +
@@ -15,7 +15,7 @@
- {{'DESCRIPTION-COPY-DIALOG.DMP-SECTION' | translate}} + {{'DESCRIPTION-COPY-DIALOG.PLAN-SECTION' | translate}} {{section.label}} diff --git a/dmp-frontend/src/app/ui/description/description-copy-dialog/description-copy-dialog.component.ts b/dmp-frontend/src/app/ui/description/description-copy-dialog/description-copy-dialog.component.ts index 957761754..68d19441f 100644 --- a/dmp-frontend/src/app/ui/description/description-copy-dialog/description-copy-dialog.component.ts +++ b/dmp-frontend/src/app/ui/description/description-copy-dialog/description-copy-dialog.component.ts @@ -6,18 +6,18 @@ import { Observable } from "rxjs"; import { Inject } from "@angular/core"; import { TranslateService } from "@ngx-translate/core"; import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration'; -import { Dmp, DmpDescriptionTemplate } from '@app/core/model/plan/plan'; -import { DmpService } from '@app/core/services/plan/plan.service'; +import { Plan, PlanDescriptionTemplate } from '@app/core/model/plan/plan'; +import { PlanService } from '@app/core/services/plan/plan.service'; import { DescriptionService } from '@app/core/services/description/description.service'; -import { DmpDescriptionTemplateLookup } from '@app/core/query/plan-description-template.lookup'; +import { PlanDescriptionTemplateLookup } from '@app/core/query/plan-description-template.lookup'; import { IsActive } from '@app/core/common/enum/is-active.enum'; -import { DmpLookup } from '@app/core/query/plan.lookup'; +import { PlanLookup } from '@app/core/query/plan.lookup'; import { Guid } from '@common/types/guid'; -import { DmpStatus } from '@app/core/common/enum/plan-status'; +import { PlanStatus } from '@app/core/common/enum/plan-status'; import { nameof } from 'ts-simple-nameof'; import { FilterService } from '@common/modules/text-filter/filter-service'; import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms'; -import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/plan-blueprint/plan-blueprint'; +import { DescriptionTemplatesInSection, PlanBlueprint, PlanBlueprintDefinition, PlanBlueprintDefinitionSection } from '@app/core/model/plan-blueprint/plan-blueprint'; @Component({ selector: 'description-copy-dialog-component', @@ -26,54 +26,54 @@ import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, Dm }) export class DescriptionCopyDialogComponent { - dmpModel: Dmp; - sections: DmpBlueprintDefinitionSection[] = []; + dmpModel: Plan; + sections: PlanBlueprintDefinitionSection[] = []; descriptionDescriptionTemplateLabel: String; dmpAutoCompleteConfiguration: SingleAutoCompleteConfiguration = { //TODO: add filter to only get DMPs that have connection with the same Description Template group. - initialItems: (data?: any) => this.dmpService.query(this.buildDmpLookup(null,null,null, this.dmpDescriptionTemplateLookup)).pipe(map(x => x.items)), - filterFn: (searchQuery: string, data?: any) => this.dmpService.query(this.buildDmpLookup(searchQuery, null, null, this.dmpDescriptionTemplateLookup)).pipe(map(x => x.items)), - getSelectedItem: (selectedItem: any) => this.dmpService.query(this.buildDmpLookup(null, null, [selectedItem])).pipe(map(x => x.items[0])), - displayFn: (item: Dmp) => item.label, - titleFn: (item: Dmp) => item.label, - valueAssign: (item: Dmp) => this.findSection(item), + initialItems: (data?: any) => this.planService.query(this.buildPlanLookup(null,null,null, this.planDescriptionTemplateLookup)).pipe(map(x => x.items)), + filterFn: (searchQuery: string, data?: any) => this.planService.query(this.buildPlanLookup(searchQuery, null, null, this.planDescriptionTemplateLookup)).pipe(map(x => x.items)), + getSelectedItem: (selectedItem: any) => this.planService.query(this.buildPlanLookup(null, null, [selectedItem])).pipe(map(x => x.items[0])), + displayFn: (item: Plan) => item.label, + titleFn: (item: Plan) => item.label, + valueAssign: (item: Plan) => this.findSection(item), }; - dmpDescriptionTemplateLookup: DmpDescriptionTemplateLookup = { + planDescriptionTemplateLookup: PlanDescriptionTemplateLookup = { descriptionTemplateGroupIds: [this.data.descriptionTemplate.groupId], isActive: [IsActive.Active] - } as DmpDescriptionTemplateLookup; + } as PlanDescriptionTemplateLookup; - private buildDmpLookup(like?: string, excludedIds?: Guid[], ids?: Guid[], dmpDescriptionTemplateSubQuery?: DmpDescriptionTemplateLookup): DmpLookup { - const lookup: DmpLookup = new DmpLookup(); + private buildPlanLookup(like?: string, excludedIds?: Guid[], ids?: Guid[], planDescriptionTemplateSubQuery?: PlanDescriptionTemplateLookup): PlanLookup { + const lookup: PlanLookup = new PlanLookup(); lookup.page = { size: 100, offset: 0 }; if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; } if (ids && ids.length > 0) { lookup.ids = ids; } lookup.isActive = [IsActive.Active]; - lookup.statuses = [DmpStatus.Draft]; + lookup.statuses = [PlanStatus.Draft]; lookup.project = { fields: [ - nameof(x => x.id), - nameof(x => x.label), - [nameof(x => x.dmpDescriptionTemplates), nameof(x => x.sectionId)].join('.'), - [nameof(x => x.dmpDescriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), - [nameof(x => x.dmpDescriptionTemplates), nameof(x => x.isActive)].join('.'), - [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), - [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.label)].join('.'), - [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.ordinal)].join('.'), - [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.hasTemplates)].join('.'), - [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), + nameof(x => x.id), + nameof(x => x.label), + [nameof(x => x.planDescriptionTemplates), nameof(x => x.sectionId)].join('.'), + [nameof(x => x.planDescriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), + [nameof(x => x.planDescriptionTemplates), nameof(x => x.isActive)].join('.'), + [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), + [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.label)].join('.'), + [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.ordinal)].join('.'), + [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.hasTemplates)].join('.'), + [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), ] }; - if (dmpDescriptionTemplateSubQuery != null) lookup.dmpDescriptionTemplateSubQuery = dmpDescriptionTemplateSubQuery; - lookup.order = { items: [nameof(x => x.label)] }; + if (planDescriptionTemplateSubQuery != null) lookup.planDescriptionTemplateSubQuery = planDescriptionTemplateSubQuery; + lookup.order = { items: [nameof(x => x.label)] }; if (like) { lookup.like = this.filterService.transformLike(like); } return lookup; } constructor( public dialogRef: MatDialogRef, - public dmpService: DmpService, + public planService: PlanService, public descriptionService: DescriptionService, public language: TranslateService, private filterService: FilterService, @@ -83,8 +83,8 @@ export class DescriptionCopyDialogComponent { ngOnInit() { } - findSection(dmp: Dmp){ - const availableSectionIds = dmp.dmpDescriptionTemplates?.filter(x => x.descriptionTemplateGroupId === this.data.descriptionTemplate.groupId && x.isActive == IsActive.Active).map(y => y.sectionId); + findSection(dmp: Plan){ + const availableSectionIds = dmp.planDescriptionTemplates?.filter(x => x.descriptionTemplateGroupId === this.data.descriptionTemplate.groupId && x.isActive == IsActive.Active).map(y => y.sectionId); this.sections = dmp.blueprint.definition.sections.filter(x => x.hasTemplates == true && availableSectionIds?.includes(x.id)) || []; if(this.sections.length == 1){ this.data.formGroup.get('sectionId').setValue(this.sections[0].id); diff --git a/dmp-frontend/src/app/ui/description/editor/description-base-fields-editor/description-base-fields-editor.component.html b/dmp-frontend/src/app/ui/description/editor/description-base-fields-editor/description-base-fields-editor.component.html index 634784683..9cc7995f8 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-base-fields-editor/description-base-fields-editor.component.html +++ b/dmp-frontend/src/app/ui/description/editor/description-base-fields-editor/description-base-fields-editor.component.html @@ -23,7 +23,7 @@
{{'DESCRIPTION-EDITOR.BASE-INFO.FIELDS.DESCRIPTION' | translate}}
{{'DESCRIPTION-EDITOR.BASE-INFO.FIELDS.DESCRIPTION-HINT' | translate}}
-
diff --git a/dmp-frontend/src/app/ui/description/editor/description-base-fields-editor/description-base-fields-editor.component.ts b/dmp-frontend/src/app/ui/description/editor/description-base-fields-editor/description-base-fields-editor.component.ts index 1596e4028..f720526c1 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-base-fields-editor/description-base-fields-editor.component.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-base-fields-editor/description-base-fields-editor.component.ts @@ -6,7 +6,7 @@ import { DescriptionTemplateVersionStatus } from '@app/core/common/enum/descript import { IsActive } from '@app/core/common/enum/is-active.enum'; import { DescriptionTemplate } from '@app/core/model/description-template/description-template'; import { Description } from '@app/core/model/description/description'; -import { DmpDescriptionTemplate } from '@app/core/model/plan/plan'; +import { PlanDescriptionTemplate } from '@app/core/model/plan/plan'; import { DescriptionService } from '@app/core/services/description/description.service'; import { BaseComponent } from '@common/base/base.component'; import { takeUntil } from 'rxjs/operators'; @@ -40,8 +40,8 @@ export class DescriptionBaseFieldsEditorComponent extends BaseComponent { } private loadDescriptionTemplates(): void { - const dmpDescriptionTemplates: DmpDescriptionTemplate[] = this.description.dmp.dmpDescriptionTemplates.filter(x => x.sectionId == this.description.dmpDescriptionTemplate.sectionId && x.isActive == IsActive.Active); - const currentVersionsOfDescriptionTemplates = dmpDescriptionTemplates.map(x => x.currentDescriptionTemplate); + const planDescriptionTemplates: PlanDescriptionTemplate[] = this.description.plan.planDescriptionTemplates.filter(x => x.sectionId == this.description.planDescriptionTemplate.sectionId && x.isActive == IsActive.Active); + const currentVersionsOfDescriptionTemplates = planDescriptionTemplates.map(x => x.currentDescriptionTemplate); this.availableDescriptionTemplates.push(...currentVersionsOfDescriptionTemplates); if (this.description?.descriptionTemplate != null) { diff --git a/dmp-frontend/src/app/ui/description/editor/description-editor.component.html b/dmp-frontend/src/app/ui/description/editor/description-editor.component.html index 4f05f9a68..925c41dce 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-editor.component.html +++ b/dmp-frontend/src/app/ui/description/editor/description-editor.component.html @@ -16,10 +16,10 @@
{{'DESCRIPTION-EDITOR.TITLE-PREVIEW-DESCRIPTION' | translate}}
-
{{'DESCRIPTION-EDITOR.TO-DMP' | translate}}
+
{{'DESCRIPTION-EDITOR.TO-PLAN' | translate}}
: {{ item?.dmp?.label }}
@@ -67,7 +67,7 @@ - +
@@ -86,11 +86,11 @@
-
+
chevron_left {{'DESCRIPTION-EDITOR.ACTIONS.BACK-TO' | translate}}
-
{{'DESCRIPTION-EDITOR.DMP' | translate}}
+
{{'DESCRIPTION-EDITOR.PLAN' | translate}}
{{'DESCRIPTION-EDITOR.TOC.TITLE' | translate}}
diff --git a/dmp-frontend/src/app/ui/description/editor/description-editor.component.ts b/dmp-frontend/src/app/ui/description/editor/description-editor.component.ts index 17185ab0b..cb2ddb7ae 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-editor.component.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-editor.component.ts @@ -4,15 +4,15 @@ import { MatDialog } from '@angular/material/dialog'; import { Title } from '@angular/platform-browser'; import { ActivatedRoute, Params, Router } from '@angular/router'; import { DescriptionStatus } from '@app/core/common/enum/description-status'; -import { DmpStatus } from '@app/core/common/enum/plan-status'; +import { PlanStatus } from '@app/core/common/enum/plan-status'; import { FileTransformerEntityType } from '@app/core/common/enum/file-transformer-entity-type'; import { IsActive } from '@app/core/common/enum/is-active.enum'; import { LockTargetType } from '@app/core/common/enum/lock-target-type'; import { AppPermission } from '@app/core/common/enum/permission.enum'; import { DescriptionTemplate, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplatePage, DescriptionTemplateSection } from '@app/core/model/description-template/description-template'; import { Description, DescriptionPersist, DescriptionStatusPersist } from '@app/core/model/description/description'; -import { DmpBlueprintDefinitionSection } from '@app/core/model/plan-blueprint/plan-blueprint'; -import { DmpDescriptionTemplate } from '@app/core/model/plan/plan'; +import { PlanBlueprintDefinitionSection } from '@app/core/model/plan-blueprint/plan-blueprint'; +import { PlanDescriptionTemplate } from '@app/core/model/plan/plan'; import { AuthService } from '@app/core/services/auth/auth.service'; import { ConfigurationService } from '@app/core/services/configuration/configuration.service'; import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service'; @@ -135,9 +135,9 @@ export class DescriptionEditorComponent extends BaseEditor { const itemId = params['id']; - const dmpId = params['dmpId']; - const copyDmpId = params['copyDmpId']; - const dmpSectionId = params['dmpSectionId']; + const planId = params['planId']; + const copyPlanId = params['copyPlanId']; + const planSectionId = params['planSectionId']; const isPublicDescription = params['public']; const newDmpId = params['newDmpId']; @@ -146,7 +146,7 @@ export class DescriptionEditorComponent extends BaseEditor x.sectionId == sectionId && x.descriptionTemplateGroupId == result.descriptionTemplate.groupId); + const sectionId = this.item.planDescriptionTemplate.sectionId; + result.planDescriptionTemplate = this.item.plan.planDescriptionTemplates.find(x => x.sectionId == sectionId && x.descriptionTemplateGroupId == result.descriptionTemplate.groupId); this.prepareForm(result); this.changeDetectorRef.markForCheck(); // when prefilling a description the "prepareForm" has already being executed from the base-editor and we need to trigger the angular's change-detector manually @@ -210,14 +210,14 @@ export class DescriptionEditorComponent extends BaseEditor x.isActive === IsActive.Active); + if (data && data?.plan?.planUsers) data.plan.planUsers = data.plan.planUsers.filter(x => x.isActive === IsActive.Active); this.item = data; this.initialTemplateId = data?.descriptionTemplate?.id?.toString(); - if (data && data.dmpDescriptionTemplate?.sectionId && data.dmp?.blueprint?.definition?.sections?.length > 0 && data.dmp?.descriptions?.length > 0) { - const section = data.dmp?.blueprint?.definition?.sections.find(x => x.id == data.dmpDescriptionTemplate?.sectionId); + if (data && data.planDescriptionTemplate?.sectionId && data.plan?.blueprint?.definition?.sections?.length > 0 && data.plan?.descriptions?.length > 0) { + const section = data.plan?.blueprint?.definition?.sections.find(x => x.id == data.planDescriptionTemplate?.sectionId); if (section.hasTemplates) { - const notAvailableDescriptionTemplates = this.calculateMultiplicityRejectedDmpDescriptionTemplates(section, data.dmp.descriptions.filter(x => x.isActive == IsActive.Active)); - this.item.dmp.dmpDescriptionTemplates = data.dmp.dmpDescriptionTemplates.filter(x => !notAvailableDescriptionTemplates.map(y => y.id).includes(x.id)) + const notAvailableDescriptionTemplates = this.calculateMultiplicityRejectedPlanDescriptionTemplates(section, data.plan.descriptions.filter(x => x.isActive == IsActive.Active)); + this.item.plan.planDescriptionTemplates = data.plan.planDescriptionTemplates.filter(x => !notAvailableDescriptionTemplates.map(y => y.id).includes(x.id)) } } this.isDeleted = data ? data.isActive === IsActive.Inactive : false; @@ -233,8 +233,8 @@ export class DescriptionEditorComponent extends BaseEditor x === AppPermission.EditDescription); - this.canReview = this.permissionPerSection && this.permissionPerSection[this.item.dmpDescriptionTemplate.sectionId.toString()] && this.permissionPerSection[this.item.dmpDescriptionTemplate.sectionId.toString()].some(x => x === AppPermission.ReviewDescription); + this.canEdit = this.permissionPerSection && this.permissionPerSection[this.item.planDescriptionTemplate.sectionId.toString()] && this.permissionPerSection[this.item.planDescriptionTemplate.sectionId.toString()].some(x => x === AppPermission.EditDescription); + this.canReview = this.permissionPerSection && this.permissionPerSection[this.item.planDescriptionTemplate.sectionId.toString()] && this.permissionPerSection[this.item.planDescriptionTemplate.sectionId.toString()].some(x => x === AppPermission.ReviewDescription); this.formGroup = this.editorModel.buildForm(null, this.isDeleted || !this.canEdit, this.visibilityRulesService); if (this.item.descriptionTemplate?.definition) this.visibilityRulesService.setContext(this.item.descriptionTemplate.definition, this.formGroup.get('properties')); if (this.item.descriptionTemplate?.definition) this.pageToFieldSetMap = this.mapPageToFieldSet(this.item.descriptionTemplate);; @@ -252,21 +252,21 @@ export class DescriptionEditorComponent extends BaseEditor 0) { - descriptions = descriptions?.filter(x => x?.dmpDescriptionTemplate?.sectionId === section.id) || []; + descriptions = descriptions?.filter(x => x?.planDescriptionTemplate?.sectionId === section.id) || []; - let rejectedDmpDescriptionTemplates: DmpDescriptionTemplate[] = []; + let rejectedPlanDescriptionTemplates: PlanDescriptionTemplate[] = []; section.descriptionTemplates.forEach(sectionDescriptionTemplate => { if (sectionDescriptionTemplate.maxMultiplicity != null) { - const commonDescriptions = descriptions.filter(x => x.dmpDescriptionTemplate.descriptionTemplateGroupId == sectionDescriptionTemplate.descriptionTemplateGroupId); + const commonDescriptions = descriptions.filter(x => x.planDescriptionTemplate.descriptionTemplateGroupId == sectionDescriptionTemplate.descriptionTemplateGroupId); if (commonDescriptions && commonDescriptions.length >= sectionDescriptionTemplate.maxMultiplicity) { - rejectedDmpDescriptionTemplates.push.apply(rejectedDmpDescriptionTemplates, commonDescriptions.map(x => x.dmpDescriptionTemplate)); + rejectedPlanDescriptionTemplates.push.apply(rejectedPlanDescriptionTemplates, commonDescriptions.map(x => x.planDescriptionTemplate)); } } }) - return rejectedDmpDescriptionTemplates; + return rejectedPlanDescriptionTemplates; } else { return []; } @@ -319,7 +319,7 @@ export class DescriptionEditorComponent extends BaseEditor void): void { this.formService.removeAllBackEndErrors(this.formGroup); - if (this.formGroup.get('label').valid && this.formGroup.get('dmpId').valid && this.formGroup.get('dmpDescriptionTemplateId').valid + if (this.formGroup.get('label').valid && this.formGroup.get('planId').valid && this.formGroup.get('planDescriptionTemplateId').valid && this.formGroup.get('descriptionTemplateId').valid && this.formGroup.get('status').valid) { this.persistEntity(onSuccess); } else { @@ -331,9 +331,9 @@ export class DescriptionEditorComponent extends BaseEditor { this.uiNotificationService.snackBarNotification(this.isNew ? this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-CREATION') : this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success); - const dmpId = this.formGroup.get('dmpId').value; + const planId = this.formGroup.get('planId').value; this.formGroup = null; - this.backToDmp(dmpId); + this.backToDmp(planId); }); } @@ -414,8 +414,8 @@ export class DescriptionEditorComponent extends BaseEditor x.sectionId == sectionId && x.descriptionTemplateGroupId == descriptionTemplate.groupId); - this.formGroup.get('dmpDescriptionTemplateId').setValue(this.item.dmpDescriptionTemplate.id); + const sectionId = this.item.planDescriptionTemplate.sectionId; + this.item.planDescriptionTemplate = this.item.plan.planDescriptionTemplates.find(x => x.sectionId == sectionId && x.descriptionTemplateGroupId == descriptionTemplate.groupId); + this.formGroup.get('planDescriptionTemplateId').setValue(this.item.planDescriptionTemplate.id); if (descriptionTemplate.definition) this.visibilityRulesService.setContext(this.item.descriptionTemplate.definition, this.formGroup.get('properties')); if (descriptionTemplate.definition) this.pageToFieldSetMap = this.mapPageToFieldSet(this.item.descriptionTemplate); diff --git a/dmp-frontend/src/app/ui/description/editor/description-editor.model.ts b/dmp-frontend/src/app/ui/description/editor/description-editor.model.ts index 0b9202dea..c4a27cf05 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-editor.model.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-editor.model.ts @@ -15,8 +15,8 @@ import { VisibilityRulesService } from "./description-form/visibility-rules/visi export class DescriptionEditorModel extends BaseEditorModel implements DescriptionPersist { label: string; - dmpId: Guid; - dmpDescriptionTemplateId: Guid; + planId: Guid; + planDescriptionTemplateId: Guid; descriptionTemplateId: Guid; status: DescriptionStatus; description: string; @@ -33,8 +33,8 @@ export class DescriptionEditorModel extends BaseEditorModel implements Descripti if (item) { super.fromModel(item); this.label = item.label; - this.dmpId = item.dmp?.id; - this.dmpDescriptionTemplateId = item.dmpDescriptionTemplate?.id; + this.planId = item.plan?.id; + this.planDescriptionTemplateId = item.planDescriptionTemplate?.id; this.descriptionTemplateId = item.descriptionTemplate?.id; this.status = item.status ?? DescriptionStatus.Draft; this.description = item.description; @@ -50,8 +50,8 @@ export class DescriptionEditorModel extends BaseEditorModel implements Descripti return this.formBuilder.group({ id: [{ value: this.id, disabled: disabled }, context.getValidation('id').validators], label: [{ value: this.label, disabled: disabled }, context.getValidation('label').validators], - dmpId: [{ value: this.dmpId, disabled: disabled }, context.getValidation('dmpId').validators], - dmpDescriptionTemplateId: [{ value: this.dmpDescriptionTemplateId, disabled: disabled }, context.getValidation('dmpDescriptionTemplateId').validators], + planId: [{ value: this.planId, disabled: disabled }, context.getValidation('planId').validators], + planDescriptionTemplateId: [{ value: this.planDescriptionTemplateId, disabled: disabled }, context.getValidation('planDescriptionTemplateId').validators], descriptionTemplateId: [{ value: this.descriptionTemplateId, disabled: disabled }, context.getValidation('descriptionTemplateId').validators], status: [{ value: this.status, disabled: disabled }, context.getValidation('status').validators], description: [{ value: this.description, disabled: disabled }, context.getValidation('description').validators], @@ -73,8 +73,8 @@ export class DescriptionEditorModel extends BaseEditorModel implements Descripti const baseValidationArray: Validation[] = new Array(); baseValidationArray.push({ key: 'id', validators: [BackendErrorValidator(this.validationErrorModel, 'id')] }); baseValidationArray.push({ key: 'label', validators: [CustomValidators.required(), BackendErrorValidator(this.validationErrorModel, 'label')] }); - baseValidationArray.push({ key: 'dmpId', validators: [CustomValidators.required(), BackendErrorValidator(this.validationErrorModel, 'dmpId')] }); - baseValidationArray.push({ key: 'dmpDescriptionTemplateId', validators: [CustomValidators.required(), BackendErrorValidator(this.validationErrorModel, 'dmpDescriptionTemplateId')] }); + baseValidationArray.push({ key: 'planId', validators: [CustomValidators.required(), BackendErrorValidator(this.validationErrorModel, 'planId')] }); + baseValidationArray.push({ key: 'planDescriptionTemplateId', validators: [CustomValidators.required(), BackendErrorValidator(this.validationErrorModel, 'planDescriptionTemplateId')] }); baseValidationArray.push({ key: 'descriptionTemplateId', validators: [CustomValidators.required(), BackendErrorValidator(this.validationErrorModel, 'descriptionTemplateId')] }); baseValidationArray.push({ key: 'status', validators: [CustomValidators.required(), BackendErrorValidator(this.validationErrorModel, 'status')] }); baseValidationArray.push({ key: 'description', validators: [BackendErrorValidator(this.validationErrorModel, 'description')] }); diff --git a/dmp-frontend/src/app/ui/description/editor/description-editor.routing.ts b/dmp-frontend/src/app/ui/description/editor/description-editor.routing.ts index 6a0e30f00..b4c242e4d 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-editor.routing.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-editor.routing.ts @@ -83,7 +83,7 @@ const routes: Routes = [ } }, { - path: ':dmpId/:dmpSectionId', + path: ':planId/:planSectionId', canActivate: [AuthGuard], component: DescriptionEditorComponent, canDeactivate: [PendingChangesGuard], @@ -99,7 +99,7 @@ const routes: Routes = [ } }, { - path: 'copy/:id/:copyDmpId/:dmpSectionId', + path: 'copy/:id/:copyPlanId/:planSectionId', canActivate: [AuthGuard], component: DescriptionEditorComponent, canDeactivate: [PendingChangesGuard], diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/form-field-set.component.ts b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/form-field-set.component.ts index d2b20db21..eeb360561 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/form-field-set.component.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/form-field-set.component.ts @@ -20,7 +20,7 @@ import { DescriptionTemplateFieldType } from '@app/core/common/enum/description- import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service'; import { RouterUtilsService } from '@app/core/services/router/router-utils.service'; import { TranslateService } from '@ngx-translate/core'; -import { DmpUser } from '@app/core/model/plan/plan'; +import { PlanUser } from '@app/core/model/plan/plan'; @Component({ selector: 'app-description-form-field-set', @@ -35,7 +35,7 @@ export class DescriptionFormFieldSetComponent extends BaseComponent { @Input() hideAnnotations: boolean = false; @Input() canReview: boolean = false; @Input() numbering: string; - @Input() dmpUsers: DmpUser[] = []; + @Input() dmpUsers: PlanUser[] = []; get isMultiplicityEnabled() { return this.fieldSet.hasMultiplicity && this.fieldSet.multiplicity != null; diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.html b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.html index 7bcce43b0..a04a4ada8 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.html +++ b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.html @@ -81,7 +81,7 @@ {{ field.data.label }} - + {{propertiesFormGroup?.get(field.id).get('textListValue').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}} @@ -91,7 +91,7 @@ {{ field.data.label }} - + {{propertiesFormGroup?.get(field.id).get('textValue').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}} diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.ts b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.ts index 18f41b9c0..29f0dcd41 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.ts @@ -8,7 +8,7 @@ import { DescriptionTemplateFieldValidationType } from '@app/core/common/enum/de import { DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateLabelAndMultiplicityData, DescriptionTemplateUploadData } from '@app/core/model/description-template/description-template'; import { StorageFile } from '@app/core/model/storage-file/storage-file'; import { DescriptionService } from '@app/core/services/description/description.service'; -import { DmpService } from '@app/core/services/plan/plan.service'; +import { PlanService } from '@app/core/services/plan/plan.service'; import { SnackBarNotificationLevel, UiNotificationService } from "@app/core/services/notification/ui-notification-service"; import { ReferenceService } from '@app/core/services/reference/reference.service'; import { StorageFileService } from '@app/core/services/storage-file/storage-file.service'; @@ -80,7 +80,7 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn constructor( private language: TranslateService, - public dmpService: DmpService, + public planService: PlanService, public descriptionService: DescriptionService, public tagService: TagService, private cdr: ChangeDetectorRef, diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.ts b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.ts index dcdd89f1c..2e397ca2f 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.ts @@ -8,7 +8,7 @@ import { ToCEntryType } from '../../../table-of-contents/models/toc-entry-type.e import { LinkToScroll } from '../../../table-of-contents/table-of-contents.component'; import { VisibilityRulesService } from '../../visibility-rules/visibility-rules.service'; import { Guid } from '@common/types/guid'; -import { DmpUser } from '@app/core/model/plan/plan'; +import { PlanUser } from '@app/core/model/plan/plan'; @Component({ @@ -26,7 +26,7 @@ export class DescriptionFormSectionComponent extends BaseComponent implements On @Input() visibilityRulesService: VisibilityRulesService; @Input() path: string; @Input() descriptionId: Guid; - @Input() dmpUsers: DmpUser[] = []; + @Input() dmpUsers: PlanUser[] = []; // @Input() descriptionTemplateId: String; diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/description-form.component.ts b/dmp-frontend/src/app/ui/description/editor/description-form/description-form.component.ts index df2e3a09c..7dcce55ff 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/description-form.component.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-form/description-form.component.ts @@ -8,7 +8,7 @@ import { Guid } from '@common/types/guid'; import { LinkToScroll } from '../table-of-contents/table-of-contents.component'; import { DescriptionFormAnnotationService } from './description-form-annotation.service'; import { VisibilityRulesService } from './visibility-rules/visibility-rules.service'; -import { DmpUser } from '@app/core/model/plan/plan'; +import { PlanUser } from '@app/core/model/plan/plan'; @Component({ selector: 'app-description-form', @@ -27,7 +27,7 @@ export class DescriptionFormComponent extends BaseComponent implements OnInit, O @Input() datasetDescription: String; @Input() linkToScroll: LinkToScroll; @Input() validationErrorModel: ValidationErrorModel; - @Input() dmpUsers: DmpUser[] = []; + @Input() dmpUsers: PlanUser[] = []; @Output() formChanged: EventEmitter = new EventEmitter(); diff --git a/dmp-frontend/src/app/ui/description/editor/prefill-description/prefill-description.component.ts b/dmp-frontend/src/app/ui/description/editor/prefill-description/prefill-description.component.ts index dd978c481..4564a4acf 100644 --- a/dmp-frontend/src/app/ui/description/editor/prefill-description/prefill-description.component.ts +++ b/dmp-frontend/src/app/ui/description/editor/prefill-description/prefill-description.component.ts @@ -3,7 +3,7 @@ import { UntypedFormGroup } from "@angular/forms"; import { MAT_DIALOG_DATA, MatDialogRef } from "@angular/material/dialog"; import { DescriptionPrefillingRequest, PrefillingSearchRequest } from "@app/core/model/description-prefilling-request/description-prefilling-request"; import { DescriptionTemplate } from "@app/core/model/description-template/description-template"; -import { Dmp } from "@app/core/model/plan/plan"; +import { Plan } from "@app/core/model/plan/plan"; import { Prefilling } from "@app/core/model/prefilling-source/prefilling-source"; import { PrefillingSourceService } from "@app/core/services/prefilling-source/prefilling-source.service"; import { ProgressIndicationService } from "@app/core/services/progress-indication/progress-indication-service"; @@ -31,8 +31,8 @@ export class PrefillDescriptionDialogComponent extends BaseComponent implements prefillSelected: boolean = false; prefillForm: UntypedFormGroup; - dmp: Dmp; - dmpSectionId: Guid; + dmp: Plan; + planSectionId: Guid; availableDescriptionTemplates: DescriptionTemplate[] = []; constructor(public dialogRef: MatDialogRef, @@ -43,13 +43,13 @@ export class PrefillDescriptionDialogComponent extends BaseComponent implements @Inject(MAT_DIALOG_DATA) public data: any) { super(); - this.dmp = data.dmp; - this.dmpSectionId = data.dmpSectionId; - this.availableDescriptionTemplates = this.dmp.dmpDescriptionTemplates.filter(x => x.sectionId == this.dmpSectionId && x.isActive == IsActive.Active).map(x => x.currentDescriptionTemplate); + this.dmp = data.plan; + this.planSectionId = data.planSectionId; + this.availableDescriptionTemplates = this.dmp.planDescriptionTemplates.filter(x => x.sectionId == this.planSectionId && x.isActive == IsActive.Active).map(x => x.currentDescriptionTemplate); } ngOnInit() { - const availablePrefillingSourcesIds = this.dmp.blueprint.definition.sections.filter(x => x.id === this.dmpSectionId)[0].prefillingSources?.map(x => x.id) || null; + const availablePrefillingSourcesIds = this.dmp.blueprint.definition.sections.filter(x => x.id === this.planSectionId)[0].prefillingSources?.map(x => x.id) || null; this.singlePrefillingSourceAutoCompleteConfiguration = this.prefillingSourceService.getSingleAutocompleteConfiguration(availablePrefillingSourcesIds); this.progressIndicationService.getProgressIndicationObservable().pipe(takeUntil(this._destroyed)).subscribe(x => { diff --git a/dmp-frontend/src/app/ui/description/editor/resolvers/description-editor-entity.resolver.ts b/dmp-frontend/src/app/ui/description/editor/resolvers/description-editor-entity.resolver.ts index 9a3bd758e..ee9f5478e 100644 --- a/dmp-frontend/src/app/ui/description/editor/resolvers/description-editor-entity.resolver.ts +++ b/dmp-frontend/src/app/ui/description/editor/resolvers/description-editor-entity.resolver.ts @@ -4,14 +4,14 @@ import { DescriptionStatus } from '@app/core/common/enum/description-status'; import { AppPermission } from '@app/core/common/enum/permission.enum'; import { DescriptionTemplate } from '@app/core/model/description-template/description-template'; import { Description, DescriptionExternalIdentifier, DescriptionField, DescriptionPropertyDefinition, DescriptionPropertyDefinitionFieldSet, DescriptionPropertyDefinitionFieldSetItem, DescriptionReference, DescriptionReferenceData, DescriptionTag } from '@app/core/model/description/description'; -import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/plan-blueprint/plan-blueprint'; -import { Dmp, DmpDescriptionTemplate, DmpUser } from '@app/core/model/plan/plan'; +import { DescriptionTemplatesInSection, PlanBlueprint, PlanBlueprintDefinition, PlanBlueprintDefinitionSection } from '@app/core/model/plan-blueprint/plan-blueprint'; +import { Plan, PlanDescriptionTemplate, PlanUser } from '@app/core/model/plan/plan'; import { PrefillingSource } from '@app/core/model/prefilling-source/prefilling-source'; import { ReferenceType } from '@app/core/model/reference-type/reference-type'; import { Reference } from '@app/core/model/reference/reference'; import { Tag } from '@app/core/model/tag/tag'; import { DescriptionService } from '@app/core/services/description/description.service'; -import { DmpService } from '@app/core/services/plan/plan.service'; +import { PlanService } from '@app/core/services/plan/plan.service'; import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service'; import { BaseEditorResolver } from '@common/base/base-editor.resolver'; import { Guid } from '@common/types/guid'; @@ -26,7 +26,7 @@ export class DescriptionEditorEntityResolver extends BaseEditorResolver { private descriptionService: DescriptionService, private breadcrumbService: BreadcrumbService, private language: TranslateService, - private dmpService: DmpService + private planService: PlanService ) { super(); } @@ -34,7 +34,7 @@ export class DescriptionEditorEntityResolver extends BaseEditorResolver { public static lookupFields(): string[] { return [ ...DescriptionEditorEntityResolver.descriptionLookupFields(), - ...DescriptionEditorEntityResolver.dmpLookupFields(nameof(x => x.dmp)), + ...DescriptionEditorEntityResolver.dmpLookupFields(nameof(x => x.plan)), ...DescriptionEditorEntityResolver.descriptionTemplateLookupFieldsForDescrption(), ] } @@ -60,9 +60,9 @@ export class DescriptionEditorEntityResolver extends BaseEditorResolver { [nameof(x => x.authorizationFlags), AppPermission.FinalizeDescription].join('.'), [nameof(x => x.authorizationFlags), AppPermission.ReviewDescription].join('.'), - [nameof(x => x.dmpDescriptionTemplate), nameof(x => x.id)].join('.'), - [nameof(x => x.dmpDescriptionTemplate), nameof(x => x.sectionId)].join('.'), - [nameof(x => x.dmpDescriptionTemplate), nameof(x => x.isActive)].join('.'), + [nameof(x => x.planDescriptionTemplate), nameof(x => x.id)].join('.'), + [nameof(x => x.planDescriptionTemplate), nameof(x => x.sectionId)].join('.'), + [nameof(x => x.planDescriptionTemplate), nameof(x => x.isActive)].join('.'), [nameof(x => x.properties), nameof(x => x.fieldSets), nameof(x => x.items), nameof(x => x.comment)].join('.'), [nameof(x => x.properties), nameof(x => x.fieldSets), nameof(x => x.items), nameof(x => x.ordinal)].join('.'), @@ -117,44 +117,44 @@ export class DescriptionEditorEntityResolver extends BaseEditorResolver { public static dmpLookupFields(prefix?: string): string[] { return [ - (prefix ? prefix + '.' : '') + [nameof(x => x.id)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.label)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.status)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.isActive)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.id)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.label)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.status)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.isActive)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.authorizationFlags), AppPermission.EditDmp].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.authorizationFlags), AppPermission.EditPlan].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.blueprint), nameof(x => x.id)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.blueprint), nameof(x => x.isActive)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.blueprint), nameof(x => x.definition)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.label)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.ordinal)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.hasTemplates)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.maxMultiplicity)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.prefillingSources), nameof(x => x.id)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.blueprint), nameof(x => x.id)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.blueprint), nameof(x => x.isActive)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.blueprint), nameof(x => x.definition)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.label)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.ordinal)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.hasTemplates)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.maxMultiplicity)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.prefillingSources), nameof(x => x.id)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.dmpDescriptionTemplates), nameof(x => x.id)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.dmpDescriptionTemplates), nameof(x => x.sectionId)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.dmpDescriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.dmpDescriptionTemplates), nameof(x => x.isActive)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.dmpDescriptionTemplates), nameof(x => x.currentDescriptionTemplate), nameof(x => x.id)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.dmpDescriptionTemplates), nameof(x => x.currentDescriptionTemplate), nameof(x => x.label)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.dmpDescriptionTemplates), nameof(x => x.currentDescriptionTemplate), nameof(x => x.version)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.planDescriptionTemplates), nameof(x => x.id)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.planDescriptionTemplates), nameof(x => x.sectionId)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.planDescriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.planDescriptionTemplates), nameof(x => x.isActive)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.planDescriptionTemplates), nameof(x => x.currentDescriptionTemplate), nameof(x => x.id)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.planDescriptionTemplates), nameof(x => x.currentDescriptionTemplate), nameof(x => x.label)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.planDescriptionTemplates), nameof(x => x.currentDescriptionTemplate), nameof(x => x.version)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.descriptions), nameof(x => x.id)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.descriptions), nameof(x => x.isActive)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.descriptions), nameof(x => x.dmpDescriptionTemplate), nameof(x => x.id)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.descriptions), nameof(x => x.dmpDescriptionTemplate), nameof(x => x.descriptionTemplateGroupId)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.descriptions), nameof(x => x.dmpDescriptionTemplate), nameof(x => x.sectionId)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.descriptions), nameof(x => x.dmpDescriptionTemplate), nameof(x => x.isActive)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.dmpUsers), nameof(x => x.id)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.dmpUsers), nameof(x => x.sectionId)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.dmpUsers), nameof(x => x.user.id)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.dmpUsers), nameof(x => x.user.name)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.dmpUsers), nameof(x => x.role)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.dmpUsers), nameof(x => x.isActive)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.descriptions), nameof(x => x.id)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.descriptions), nameof(x => x.isActive)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.descriptions), nameof(x => x.planDescriptionTemplate), nameof(x => x.id)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.descriptions), nameof(x => x.planDescriptionTemplate), nameof(x => x.descriptionTemplateGroupId)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.descriptions), nameof(x => x.planDescriptionTemplate), nameof(x => x.sectionId)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.descriptions), nameof(x => x.planDescriptionTemplate), nameof(x => x.isActive)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.planUsers), nameof(x => x.id)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.planUsers), nameof(x => x.sectionId)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.planUsers), nameof(x => x.user.id)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.planUsers), nameof(x => x.user.name)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.planUsers), nameof(x => x.role)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.planUsers), nameof(x => x.isActive)].join('.'), ] } @@ -164,46 +164,46 @@ export class DescriptionEditorEntityResolver extends BaseEditorResolver { ...DescriptionEditorEntityResolver.lookupFields() ]; const id = route.paramMap.get('id'); - const dmpId = route.paramMap.get('dmpId'); - const dmpSectionId = route.paramMap.get('dmpSectionId'); - const copyDmpId = route.paramMap.get('copyDmpId'); + const planId = route.paramMap.get('planId'); + const planSectionId = route.paramMap.get('planSectionId'); + const copyPlanId = route.paramMap.get('copyPlanId'); const fieldsetId = route.paramMap.get('fieldsetId'); - if (id != null && copyDmpId == null && dmpSectionId == null) { + if (id != null && copyPlanId == null && planSectionId == null) { if (fieldsetId != null) { this.breadcrumbService.addExcludedParam(fieldsetId, true); this.breadcrumbService.addExcludedParam('f', true); this.breadcrumbService.addExcludedParam('annotation', true); } return this.descriptionService.getSingle(Guid.parse(id), fields).pipe(tap(d => this.breadcrumbService.addIdResolvedValue(d.id.toString(), d.label))); - } else if (dmpId != null && dmpSectionId != null && copyDmpId == null) { - return this.dmpService.getSingle(Guid.parse(dmpId), DescriptionEditorEntityResolver.dmpLookupFields()) + } else if (planId != null && planSectionId != null && copyPlanId == null) { + return this.planService.getSingle(Guid.parse(planId), DescriptionEditorEntityResolver.dmpLookupFields()) .pipe(tap(x => { - this.breadcrumbService.addExcludedParam(dmpId, true); - this.breadcrumbService.addIdResolvedValue(dmpSectionId, this.language.instant("DESCRIPTION-EDITOR.TITLE-NEW")); + this.breadcrumbService.addExcludedParam(planId, true); + this.breadcrumbService.addIdResolvedValue(planSectionId, this.language.instant("DESCRIPTION-EDITOR.TITLE-NEW")); }), takeUntil(this._destroyed), map(dmp => { const description: Description = {}; - description.dmp = dmp; - description.dmpDescriptionTemplate = { - sectionId: Guid.parse(dmpSectionId) + description.plan = dmp; + description.planDescriptionTemplate = { + sectionId: Guid.parse(planSectionId) } return description; })); - } else if (copyDmpId != null && id != null && dmpSectionId != null) { - return this.dmpService.getSingle(Guid.parse(copyDmpId), DescriptionEditorEntityResolver.dmpLookupFields()).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(x.id?.toString(), x.label)), takeUntil(this._destroyed), concatMap(dmp => { + } else if (copyPlanId != null && id != null && planSectionId != null) { + return this.planService.getSingle(Guid.parse(copyPlanId), DescriptionEditorEntityResolver.dmpLookupFields()).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(x.id?.toString(), x.label)), takeUntil(this._destroyed), concatMap(dmp => { return this.descriptionService.getSingle(Guid.parse(id), DescriptionEditorEntityResolver.cloneLookupFields()) .pipe(tap(x => { - this.breadcrumbService.addExcludedParam(copyDmpId, true) - this.breadcrumbService.addExcludedParam(dmpSectionId, true) + this.breadcrumbService.addExcludedParam(copyPlanId, true) + this.breadcrumbService.addExcludedParam(planSectionId, true) this.breadcrumbService.addIdResolvedValue(id, x.label) }), takeUntil(this._destroyed), map(description => { description.id = null; description.hash = null; description.status = DescriptionStatus.Draft; - description.dmp = dmp; - description.dmpDescriptionTemplate = { - id: dmp.dmpDescriptionTemplates.filter(x => x.sectionId == Guid.parse(dmpSectionId) && x.descriptionTemplateGroupId == description.descriptionTemplate.groupId)[0].id, - sectionId: Guid.parse(dmpSectionId) + description.plan = dmp; + description.planDescriptionTemplate = { + id: dmp.planDescriptionTemplates.filter(x => x.sectionId == Guid.parse(planSectionId) && x.descriptionTemplateGroupId == description.descriptionTemplate.groupId)[0].id, + sectionId: Guid.parse(planSectionId) } return description; })); diff --git a/dmp-frontend/src/app/ui/description/editor/resolvers/description-editor-permissions.resolver.ts b/dmp-frontend/src/app/ui/description/editor/resolvers/description-editor-permissions.resolver.ts index b05204b33..9ee56ca30 100644 --- a/dmp-frontend/src/app/ui/description/editor/resolvers/description-editor-permissions.resolver.ts +++ b/dmp-frontend/src/app/ui/description/editor/resolvers/description-editor-permissions.resolver.ts @@ -3,7 +3,7 @@ import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'; import { DescriptionStatus } from '@app/core/common/enum/description-status'; import { Description, DescriptionSectionPermissionResolver } from '@app/core/model/description/description'; import { DescriptionService } from '@app/core/services/description/description.service'; -import { DmpService } from '@app/core/services/plan/plan.service'; +import { PlanService } from '@app/core/services/plan/plan.service'; import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service'; import { BaseEditorResolver } from '@common/base/base-editor.resolver'; import { Guid } from '@common/types/guid'; @@ -19,7 +19,7 @@ export class DescriptionEditorPermissionsResolver extends BaseEditorResolver { private descriptionService: DescriptionService, private breadcrumbService: BreadcrumbService, private language: TranslateService, - private dmpService: DmpService + private planService: PlanService ) { super(); } @@ -30,66 +30,66 @@ export class DescriptionEditorPermissionsResolver extends BaseEditorResolver { ...DescriptionEditorEntityResolver.lookupFields() ]; const id = route.paramMap.get('id'); - const dmpId = route.paramMap.get('dmpId'); - const dmpSectionId = route.paramMap.get('dmpSectionId'); - const copyDmpId = route.paramMap.get('copyDmpId'); + const planId = route.paramMap.get('planId'); + const planSectionId = route.paramMap.get('planSectionId'); + const copyPlanId = route.paramMap.get('copyPlanId'); // const cloneid = route.paramMap.get('cloneid'); - if (id != null && copyDmpId == null && dmpSectionId == null) { + if (id != null && copyPlanId == null && planSectionId == null) { return this.descriptionService.getSingle(Guid.parse(id), fields).pipe(tap(d => this.breadcrumbService.addIdResolvedValue(d.id.toString(), d.label))) .pipe(mergeMap( description => { const descriptionSectionPermissionResolverModel: DescriptionSectionPermissionResolver = { - dmpId: description.dmp.id, - sectionIds: [description.dmpDescriptionTemplate.sectionId], + planId: description.plan.id, + sectionIds: [description.planDescriptionTemplate.sectionId], permissions: [AppPermission.EditDescription, AppPermission.DeleteDescription, AppPermission.FinalizeDescription, AppPermission.ReviewDescription] } return this.descriptionService.getDescriptionSectionPermissions(descriptionSectionPermissionResolverModel).pipe(takeUntil(this._destroyed)); })); - } else if (dmpId != null && dmpSectionId != null && copyDmpId == null) { - return this.dmpService.getSingle(Guid.parse(dmpId), DescriptionEditorEntityResolver.dmpLookupFields()) + } else if (planId != null && planSectionId != null && copyPlanId == null) { + return this.planService.getSingle(Guid.parse(planId), DescriptionEditorEntityResolver.dmpLookupFields()) .pipe(tap(x => { - this.breadcrumbService.addExcludedParam(dmpId, true); - this.breadcrumbService.addIdResolvedValue(dmpSectionId, this.language.instant("DESCRIPTION-EDITOR.TITLE-NEW")); + this.breadcrumbService.addExcludedParam(planId, true); + this.breadcrumbService.addIdResolvedValue(planSectionId, this.language.instant("DESCRIPTION-EDITOR.TITLE-NEW")); }), takeUntil(this._destroyed), map(dmp => { const description: Description = {}; - description.dmp = dmp; - description.dmpDescriptionTemplate = { - sectionId: Guid.parse(dmpSectionId) + description.plan = dmp; + description.planDescriptionTemplate = { + sectionId: Guid.parse(planSectionId) } return description; })) .pipe(mergeMap( description => { const descriptionSectionPermissionResolverModel: DescriptionSectionPermissionResolver = { - dmpId: description.dmp.id, - sectionIds: [description.dmpDescriptionTemplate.sectionId], + planId: description.plan.id, + sectionIds: [description.planDescriptionTemplate.sectionId], permissions: [AppPermission.EditDescription, AppPermission.DeleteDescription, AppPermission.FinalizeDescription, AppPermission.ReviewDescription] } return this.descriptionService.getDescriptionSectionPermissions(descriptionSectionPermissionResolverModel).pipe(takeUntil(this._destroyed)); })); - } else if (copyDmpId != null && id != null && dmpSectionId != null) { - return this.dmpService.getSingle(Guid.parse(copyDmpId), DescriptionEditorEntityResolver.dmpLookupFields()).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(x.id?.toString(), x.label)), takeUntil(this._destroyed), concatMap(dmp => { + } else if (copyPlanId != null && id != null && planSectionId != null) { + return this.planService.getSingle(Guid.parse(copyPlanId), DescriptionEditorEntityResolver.dmpLookupFields()).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(x.id?.toString(), x.label)), takeUntil(this._destroyed), concatMap(dmp => { //TODO return this.descriptionService.getSingle(Guid.parse(id), DescriptionEditorEntityResolver.cloneLookupFields()) .pipe(tap(x => { - this.breadcrumbService.addExcludedParam(copyDmpId, true) - this.breadcrumbService.addExcludedParam(dmpSectionId, true) + this.breadcrumbService.addExcludedParam(copyPlanId, true) + this.breadcrumbService.addExcludedParam(planSectionId, true) this.breadcrumbService.addIdResolvedValue(id, x.label) }), takeUntil(this._destroyed), map(description => { description.id = null; description.hash = null; description.status = DescriptionStatus.Draft; - description.dmp = dmp; - description.dmpDescriptionTemplate = { - id: dmp.dmpDescriptionTemplates.filter(x => x.sectionId == Guid.parse(dmpSectionId) && x.descriptionTemplateGroupId == description.descriptionTemplate.groupId)[0].id, - sectionId: Guid.parse(dmpSectionId) + description.plan = dmp; + description.planDescriptionTemplate = { + id: dmp.planDescriptionTemplates.filter(x => x.sectionId == Guid.parse(planSectionId) && x.descriptionTemplateGroupId == description.descriptionTemplate.groupId)[0].id, + sectionId: Guid.parse(planSectionId) } return description; })); })).pipe(mergeMap( description => { const descriptionSectionPermissionResolverModel: DescriptionSectionPermissionResolver = { - dmpId: description.dmp.id, - sectionIds: [description.dmpDescriptionTemplate.sectionId], + planId: description.plan.id, + sectionIds: [description.planDescriptionTemplate.sectionId], permissions: [AppPermission.EditDescription, AppPermission.DeleteDescription, AppPermission.FinalizeDescription, AppPermission.ReviewDescription] } return this.descriptionService.getDescriptionSectionPermissions(descriptionSectionPermissionResolverModel).pipe(takeUntil(this._destroyed)); diff --git a/dmp-frontend/src/app/ui/description/listing/description-listing.component.html b/dmp-frontend/src/app/ui/description/listing/description-listing.component.html index e7ef630e9..fc8a9a01c 100644 --- a/dmp-frontend/src/app/ui/description/listing/description-listing.component.html +++ b/dmp-frontend/src/app/ui/description/listing/description-listing.component.html @@ -27,7 +27,7 @@
-
- +
{{'DESCRIPTION-OVERVIEW.GRANT' | translate}}
-
{{referenceService.getReferencesForTypesFirstSafe(description?.dmp?.dmpReferences, [this.referenceTypeService.getGrantReferenceType()])?.reference?.label}}
+
{{referenceService.getReferencesForTypesFirstSafe(description?.plan?.planReferences, [this.referenceTypeService.getGrantReferenceType()])?.reference?.label}}
{{'DESCRIPTION-OVERVIEW.RESEARCHERS' | translate}}
-
- - +
+ +
 
-
{{ dmpReference.reference?.label }},
-
{{ dmpReference.reference?.label }}
+
{{ planReference.reference?.label }},
+
{{ planReference.reference?.label }}
- -
{{ dmpReference.reference?.label }},
-
{{ dmpReference.reference?.label }}
+ +
{{ planReference.reference?.label }},
+
{{ planReference.reference?.label }}
@@ -190,15 +190,15 @@

{{ 'DESCRIPTION-OVERVIEW.DESCRIPTION-AUTHORS' | translate }}

-
+
- -

{{ dmpUser.user?.name }}

+ +

{{ planUser.user?.name }}

{{ userName }} @@ -207,19 +207,19 @@

- {{ enumUtils.toDmpUserRoleString(dmpUser.role) }} - - {{ 'DESCRIPTION-OVERVIEW.ROLES.ALL-SECTIONS' | translate}} - {{ getSectionNameById(dmpUser.sectionId) }} + {{ enumUtils.toPlanUserRoleString(planUser.role) }} - + {{ 'DESCRIPTION-OVERVIEW.ROLES.ALL-SECTIONS' | translate}} + {{ getSectionNameById(planUser.sectionId) }}

-
-
-
+
+
{{ 'FAQ.TITLE' | translate }} @@ -101,7 +101,7 @@
  • - +
  • diff --git a/dmp-frontend/src/app/ui/navbar/navbar.component.ts b/dmp-frontend/src/app/ui/navbar/navbar.component.ts index 9cafae5f3..c9c9121cf 100644 --- a/dmp-frontend/src/app/ui/navbar/navbar.component.ts +++ b/dmp-frontend/src/app/ui/navbar/navbar.component.ts @@ -24,7 +24,7 @@ import { MineInAppNotificationListingDialogComponent } from '@notification-servi import { timer } from 'rxjs'; import { map, takeUntil } from 'rxjs/operators'; import { nameof } from 'ts-simple-nameof'; -import { StartNewDmpDialogComponent } from '../plan/new/start-new-plan-dialogue/start-new-plan-dialog.component'; +import { StartNewPlanDialogComponent } from '../plan/new/start-new-plan-dialogue/start-new-plan-dialog.component'; import { FaqDialogComponent } from '../faq/dialog/faq-dialog.component'; import { UserDialogComponent } from './user-dialog/user-dialog.component'; @@ -294,13 +294,13 @@ export class NavbarComponent extends BaseComponent implements OnInit { this.sidenavService.toggle(); } - openNewDmpDialog() { + openNewPlanDialog() { if (this.dialog.openDialogs.length > 0) { this.dialog.closeAll(); } else if (!this.isAuthenticated()) { this.router.navigate(['/login']); } else { - const dialogRef = this.dialog.open(StartNewDmpDialogComponent, { + const dialogRef = this.dialog.open(StartNewPlanDialogComponent, { disableClose: false, data: { isDialog: true diff --git a/dmp-frontend/src/app/ui/navbar/user-dialog/user-dialog.component.html b/dmp-frontend/src/app/ui/navbar/user-dialog/user-dialog.component.html index 9179c429a..1fcc4f6ef 100644 --- a/dmp-frontend/src/app/ui/navbar/user-dialog/user-dialog.component.html +++ b/dmp-frontend/src/app/ui/navbar/user-dialog/user-dialog.component.html @@ -5,7 +5,7 @@
    diff --git a/dmp-frontend/src/app/ui/plan/clone-dialog/plan-clone-dialog.component.html b/dmp-frontend/src/app/ui/plan/clone-dialog/plan-clone-dialog.component.html index f91db100f..47183831a 100644 --- a/dmp-frontend/src/app/ui/plan/clone-dialog/plan-clone-dialog.component.html +++ b/dmp-frontend/src/app/ui/plan/clone-dialog/plan-clone-dialog.component.html @@ -1,16 +1,16 @@
    -
    {{'DMP-CLONE-DIALOG.TITLE' | translate}}
    +
    {{'PLAN-CLONE-DIALOG.TITLE' | translate}}
    close
    -
    {{'DMP-CLONE-DIALOG.FIELDS.LABEL' | translate}}*
    +
    {{'PLAN-CLONE-DIALOG.FIELDS.LABEL' | translate}}*
    - + {{formGroup.get('label').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}} @@ -19,25 +19,25 @@
    -
    {{'DMP-CLONE-DIALOG.FIELDS.DESCRIPTION' | translate}}
    +
    {{'PLAN-CLONE-DIALOG.FIELDS.DESCRIPTION' | translate}}
    -
    {{'DMP-CLONE-DIALOG.FIELDS.DESCRIPTION-HINT' | translate}}
    +
    {{'PLAN-CLONE-DIALOG.FIELDS.DESCRIPTION-HINT' | translate}}
    - +
    -
    {{'DMP-CLONE-DIALOG.FIELDS.DESCRIPTIONS' | translate}}
    +
    {{'PLAN-CLONE-DIALOG.FIELDS.DESCRIPTIONS' | translate}}
    -
    {{'DMP-CLONE-DIALOG.FIELDS.DESCRIPTIONS-HINT' | translate}}
    +
    {{'PLAN-CLONE-DIALOG.FIELDS.DESCRIPTIONS-HINT' | translate}}
    - {{ 'DMP-CLONE-DIALOG.ACTIONS.TOGGLE-DESCRIPTIONS' | translate }} + {{ 'PLAN-CLONE-DIALOG.ACTIONS.TOGGLE-DESCRIPTIONS' | translate }} @@ -47,12 +47,12 @@
    -
    {{'DMP-CLONE-DIALOG.NO-DESCRIPTIONS' | translate}}
    +
    {{'PLAN-CLONE-DIALOG.NO-DESCRIPTIONS' | translate}}
    -
    -
    +
    +
    \ No newline at end of file diff --git a/dmp-frontend/src/app/ui/plan/clone-dialog/plan-clone-dialog.component.ts b/dmp-frontend/src/app/ui/plan/clone-dialog/plan-clone-dialog.component.ts index 573d60a13..a1afac437 100644 --- a/dmp-frontend/src/app/ui/plan/clone-dialog/plan-clone-dialog.component.ts +++ b/dmp-frontend/src/app/ui/plan/clone-dialog/plan-clone-dialog.component.ts @@ -1,14 +1,14 @@ import { Component, Inject } from '@angular/core'; import { UntypedFormGroup } from '@angular/forms'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; -import { CloneDmpPersist, Dmp } from '@app/core/model/plan/plan'; -import { DmpService } from '@app/core/services/plan/plan.service'; +import { ClonePlanPersist, Plan } from '@app/core/model/plan/plan'; +import { PlanService } from '@app/core/services/plan/plan.service'; import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service'; import { BaseComponent } from '@common/base/base.component'; import { TranslateService } from '@ngx-translate/core'; import { takeUntil } from 'rxjs/operators'; -import { DmpCloneDialogEditorModel } from './plan-clone-dialog.editor.model'; -import { DmpEditorEntityResolver } from '../plan-editor-blueprint/resolvers/plan-editor-enitity.resolver'; +import { PlanCloneDialogEditorModel } from './plan-clone-dialog.editor.model'; +import { PlanEditorEntityResolver } from '../plan-editor-blueprint/resolvers/plan-editor-enitity.resolver'; import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service'; import { HttpErrorResponse } from '@angular/common/http'; @@ -17,22 +17,22 @@ import { HttpErrorResponse } from '@angular/common/http'; templateUrl: './plan-clone-dialog.component.html', styleUrls: ['./plan-clone-dialog.component.scss'] }) -export class CloneDmpDialogComponent extends BaseComponent { +export class ClonePlanDialogComponent extends BaseComponent { - dmp: Dmp; - editorModel: DmpCloneDialogEditorModel; + dmp: Plan; + editorModel: PlanCloneDialogEditorModel; formGroup: UntypedFormGroup; constructor( - public dialogRef: MatDialogRef, - private dmpService: DmpService, + public dialogRef: MatDialogRef, + private planService: PlanService, private uiNotificationService: UiNotificationService, private httpErrorHandlingService: HttpErrorHandlingService, private language: TranslateService, @Inject(MAT_DIALOG_DATA) public data: any ) { super(); - this.dmp = data.dmp; + this.dmp = data.plan; } @@ -53,7 +53,7 @@ export class CloneDmpDialogComponent extends BaseComponent { } ngOnInit() { - this.editorModel = new DmpCloneDialogEditorModel().fromModel(this.data.dmp); + this.editorModel = new PlanCloneDialogEditorModel().fromModel(this.data.plan); this.formGroup = this.editorModel.buildForm(); } @@ -71,8 +71,8 @@ export class CloneDmpDialogComponent extends BaseComponent { confirm() { if (!this.formGroup.valid) { return; } - const value: CloneDmpPersist = this.formGroup.value; - this.dmpService.clone(value, DmpEditorEntityResolver.lookupFields()).pipe(takeUntil(this._destroyed)).subscribe( + const value: ClonePlanPersist = this.formGroup.value; + this.planService.clone(value, PlanEditorEntityResolver.lookupFields()).pipe(takeUntil(this._destroyed)).subscribe( dmp => this.dialogRef.close(dmp), error => this.onCallbackError(error) ); diff --git a/dmp-frontend/src/app/ui/plan/clone-dialog/plan-clone-dialog.editor.model.ts b/dmp-frontend/src/app/ui/plan/clone-dialog/plan-clone-dialog.editor.model.ts index c3a22e48c..546596f5e 100644 --- a/dmp-frontend/src/app/ui/plan/clone-dialog/plan-clone-dialog.editor.model.ts +++ b/dmp-frontend/src/app/ui/plan/clone-dialog/plan-clone-dialog.editor.model.ts @@ -1,11 +1,11 @@ import { UntypedFormBuilder, UntypedFormGroup, Validators } from "@angular/forms"; -import { CloneDmpPersist, Dmp } from "@app/core/model/plan/plan"; +import { ClonePlanPersist, Plan } from "@app/core/model/plan/plan"; import { BackendErrorValidator } from '@common/forms/validation/custom-validator'; import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model'; import { Validation, ValidationContext } from '@common/forms/validation/validation-context'; import { Guid } from "@common/types/guid"; -export class DmpCloneDialogEditorModel implements CloneDmpPersist { +export class PlanCloneDialogEditorModel implements ClonePlanPersist { id: Guid; label: string; description: String; @@ -16,7 +16,7 @@ export class DmpCloneDialogEditorModel implements CloneDmpPersist { constructor() { } - public fromModel(item: Dmp): DmpCloneDialogEditorModel { + public fromModel(item: Plan): PlanCloneDialogEditorModel { if (item) { this.id = item.id; this.label = item.label + " New"; diff --git a/dmp-frontend/src/app/ui/plan/clone-dialog/plan-clone-dialog.module.ts b/dmp-frontend/src/app/ui/plan/clone-dialog/plan-clone-dialog.module.ts index 142ab8d5c..ac0b2e78f 100644 --- a/dmp-frontend/src/app/ui/plan/clone-dialog/plan-clone-dialog.module.ts +++ b/dmp-frontend/src/app/ui/plan/clone-dialog/plan-clone-dialog.module.ts @@ -1,15 +1,15 @@ import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { CommonUiModule } from '@common/ui/common-ui.module'; -import { CloneDmpDialogComponent } from './plan-clone-dialog.component'; +import { ClonePlanDialogComponent } from './plan-clone-dialog.component'; import { AutoCompleteModule } from '@app/library/auto-complete/auto-complete.module'; import {RichTextEditorModule} from "@app/library/rich-text-editor/rich-text-editor.module"; @NgModule({ imports: [CommonUiModule, FormsModule, ReactiveFormsModule, AutoCompleteModule, RichTextEditorModule], - declarations: [CloneDmpDialogComponent], - exports: [CloneDmpDialogComponent] + declarations: [ClonePlanDialogComponent], + exports: [ClonePlanDialogComponent] }) -export class CloneDmpDialogModule { +export class ClonePlanDialogModule { constructor() { } } diff --git a/dmp-frontend/src/app/ui/plan/editor/plan-deposit-dropdown/plan-deposit-dropdown.component.html b/dmp-frontend/src/app/ui/plan/editor/plan-deposit-dropdown/plan-deposit-dropdown.component.html index 40209200a..6aa51cfe0 100644 --- a/dmp-frontend/src/app/ui/plan/editor/plan-deposit-dropdown/plan-deposit-dropdown.component.html +++ b/dmp-frontend/src/app/ui/plan/editor/plan-deposit-dropdown/plan-deposit-dropdown.component.html @@ -5,7 +5,7 @@
    -

    {{ 'DMP-LISTING.ACTIONS.DEPOSIT' | translate }}

    +

    {{ 'PLAN-LISTING.ACTIONS.DEPOSIT' | translate }}

    diff --git a/dmp-frontend/src/app/ui/plan/editor/plan-deposit-dropdown/plan-deposit-dropdown.component.ts b/dmp-frontend/src/app/ui/plan/editor/plan-deposit-dropdown/plan-deposit-dropdown.component.ts index e80ed060d..ec7c98e35 100644 --- a/dmp-frontend/src/app/ui/plan/editor/plan-deposit-dropdown/plan-deposit-dropdown.component.ts +++ b/dmp-frontend/src/app/ui/plan/editor/plan-deposit-dropdown/plan-deposit-dropdown.component.ts @@ -4,7 +4,7 @@ import { DomSanitizer, SafeResourceUrl } from "@angular/platform-browser"; import { DepositConfigurationStatus } from '@app/core/common/enum/deposit-configuration-status'; import { DepositConfiguration } from '@app/core/model/deposit/deposit-configuration'; import { DepositAuthenticateRequest, DepositRequest, DepositRequestFields} from '@app/core/model/deposit/deposit-request'; -import { Dmp } from '@app/core/model/plan/plan'; +import { Plan } from '@app/core/model/plan/plan'; import { EntityDoi } from '@app/core/model/entity-doi/entity-doi'; import { DepositService } from '@app/core/services/deposit/deposit.service'; import { @@ -26,7 +26,7 @@ import { nameof } from 'ts-simple-nameof'; }) export class DmpDepositDropdown extends BaseComponent implements OnInit { @Input() inputRepos: DepositConfiguration[]; - @Input() dmp: Dmp; + @Input() dmp: Plan; outputRepos = []; logos: Map = new Map(); @Output() outputReposEmitter: EventEmitter = new EventEmitter(); @@ -69,8 +69,8 @@ export class DmpDepositDropdown extends BaseComponent implements OnInit { maxWidth: '600px', restoreFocus: false, data: { - message: this.language.instant('DMP-OVERVIEW.DEPOSIT.ACCOUNT-LOGIN'), - titles: [this.language.instant('DMP-OVERVIEW.DEPOSIT.LOGIN', { 'repository': repo.repositoryId }), this.language.instant('DMP-OVERVIEW.MULTIPLE-DIALOG.USE-DEFAULT')] + message: this.language.instant('PLAN-OVERVIEW.DEPOSIT.ACCOUNT-LOGIN'), + titles: [this.language.instant('PLAN-OVERVIEW.DEPOSIT.LOGIN', { 'repository': repo.repositoryId }), this.language.instant('PLAN-OVERVIEW.MULTIPLE-DIALOG.USE-DEFAULT')] } }); dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { @@ -81,7 +81,7 @@ export class DmpDepositDropdown extends BaseComponent implements OnInit { case 1: const depositRequest: DepositRequest = { repositoryId: repo.repositoryId, - dmpId: this.dmp.id, + planId: this.dmp.id, authorizationCode: null, project: this.EntityDoiFields() }; @@ -99,7 +99,7 @@ export class DmpDepositDropdown extends BaseComponent implements OnInit { } else if (repo.depositType == DepositConfigurationStatus.System) { const depositRequest: DepositRequest = { repositoryId: repo.repositoryId, - dmpId: this.dmp.id, + planId: this.dmp.id, authorizationCode: null, project: this.EntityDoiFields() }; @@ -114,21 +114,21 @@ export class DmpDepositDropdown extends BaseComponent implements OnInit { } onDOICallbackSuccess(): void { - this.uiNotificationService.snackBarNotification(this.language.instant('DMP-EDITOR.SNACK-BAR.SUCCESSFUL-DOI'), SnackBarNotificationLevel.Success); + this.uiNotificationService.snackBarNotification(this.language.instant('PLAN-EDITOR.SNACK-BAR.SUCCESSFUL-DOI'), SnackBarNotificationLevel.Success); } onDOICallbackError(error) { - this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('DMP-EDITOR.SNACK-BAR.UNSUCCESSFUL-DOI'), SnackBarNotificationLevel.Error); + this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('PLAN-EDITOR.SNACK-BAR.UNSUCCESSFUL-DOI'), SnackBarNotificationLevel.Error); } - showOauth2Dialog(url: string, repo: DepositConfiguration, dmp: Dmp) { + showOauth2Dialog(url: string, repo: DepositConfiguration, dmp: Plan) { this.depositOauth2DialogService.login(url) .pipe(takeUntil(this._destroyed)) .subscribe(code => { if (code !== undefined) { const depositRequest: DepositRequest = { repositoryId: repo.repositoryId, - dmpId: dmp.id, + planId: dmp.id, authorizationCode: code, project: this.EntityDoiFields() }; diff --git a/dmp-frontend/src/app/ui/plan/invitation/dialog/plan-invitation-dialog.component.html b/dmp-frontend/src/app/ui/plan/invitation/dialog/plan-invitation-dialog.component.html index 7173158e4..2c2dc6d6e 100644 --- a/dmp-frontend/src/app/ui/plan/invitation/dialog/plan-invitation-dialog.component.html +++ b/dmp-frontend/src/app/ui/plan/invitation/dialog/plan-invitation-dialog.component.html @@ -1,7 +1,7 @@
    -

    {{'DMP-USER-INVITATION-DIALOG.TITLE' | translate}}

    +

    {{'PLAN-USER-INVITATION-DIALOG.TITLE' | translate}}

    close @@ -12,7 +12,7 @@
    - + {{formGroup.get('users').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}}
    diff --git a/dmp-frontend/src/app/ui/plan/invitation/dialog/plan-invitation-dialog.component.ts b/dmp-frontend/src/app/ui/plan/invitation/dialog/plan-invitation-dialog.component.ts index ffdf38791..3bc4f594b 100644 --- a/dmp-frontend/src/app/ui/plan/invitation/dialog/plan-invitation-dialog.component.ts +++ b/dmp-frontend/src/app/ui/plan/invitation/dialog/plan-invitation-dialog.component.ts @@ -5,10 +5,10 @@ import { Component, Inject, OnInit } from '@angular/core'; import { UntypedFormGroup } from '@angular/forms'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { ActivatedRoute, Router } from '@angular/router'; -import { DmpUserRole } from '@app/core/common/enum/plan-user-role'; -import { DmpBlueprint } from '@app/core/model/plan-blueprint/plan-blueprint'; -import { DmpUserPersist } from '@app/core/model/plan/plan'; -import { DmpService } from '@app/core/services/plan/plan.service'; +import { PlanUserRole } from '@app/core/common/enum/plan-user-role'; +import { PlanBlueprint } from '@app/core/model/plan-blueprint/plan-blueprint'; +import { PlanUserPersist } from '@app/core/model/plan/plan'; +import { PlanService } from '@app/core/services/plan/plan.service'; import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service'; import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; import { BaseComponent } from '@common/base/base.component'; @@ -17,7 +17,7 @@ import { HttpError, HttpErrorHandlingService } from '@common/modules/errors/erro import { Guid } from '@common/types/guid'; import { TranslateService } from '@ngx-translate/core'; import { takeUntil } from 'rxjs/operators'; -import { DmpEditorModel } from '../../plan-editor-blueprint/plan-editor.model'; +import { PlanEditorModel } from '../../plan-editor-blueprint/plan-editor.model'; @Component({ selector: 'app-invitation-dialog-component', @@ -26,11 +26,11 @@ import { DmpEditorModel } from '../../plan-editor-blueprint/plan-editor.model'; }) export class DmpInvitationDialogComponent extends BaseComponent implements OnInit { - dmpId: Guid; - editorModel: DmpEditorModel; + planId: Guid; + editorModel: PlanEditorModel; formGroup: UntypedFormGroup; - dmpUserRoleEnum = DmpUserRole; - selectedBlueprint: DmpBlueprint; + planUserRoleEnum = PlanUserRole; + selectedBlueprint: PlanBlueprint; inProgressSendButton = false; readonly separatorKeysCodes: number[] = [ENTER, COMMA]; @@ -42,13 +42,13 @@ export class DmpInvitationDialogComponent extends BaseComponent implements OnIni public dialogRef: MatDialogRef, private uiNotificationService: UiNotificationService, private httpErrorHandlingService: HttpErrorHandlingService, - private dmpService: DmpService, + private planService: PlanService, private formService: FormService, @Inject(MAT_DIALOG_DATA) public data: any ) { super(); - this.dmpId = data.dmpId; - this.editorModel = data ? new DmpEditorModel().fromModel(data) : new DmpEditorModel(); + this.planId = data.planId; + this.editorModel = data ? new PlanEditorModel().fromModel(data) : new PlanEditorModel(); this.selectedBlueprint = data?.blueprint; } @@ -62,9 +62,9 @@ export class DmpInvitationDialogComponent extends BaseComponent implements OnIni if (!this.formGroup.get("users").valid) { return; } this.inProgressSendButton = true; - const userFormData = this.formGroup.get("users").value as DmpUserPersist[]; + const userFormData = this.formGroup.get("users").value as PlanUserPersist[]; - this.dmpService.inviteUsers(this.dmpId, { users: userFormData }) + this.planService.inviteUsers(this.planId, { users: userFormData }) .pipe(takeUntil(this._destroyed)) .subscribe( complete => { @@ -84,13 +84,13 @@ export class DmpInvitationDialogComponent extends BaseComponent implements OnIni } onCallbackSuccess(): void { - this.uiNotificationService.snackBarNotification(this.language.instant('DMP-USER-INVITATION-DIALOG.SUCCESS'), SnackBarNotificationLevel.Success); + this.uiNotificationService.snackBarNotification(this.language.instant('PLAN-USER-INVITATION-DIALOG.SUCCESS'), SnackBarNotificationLevel.Success); } onCallbackError(errorResponse: HttpErrorResponse) { this.inProgressSendButton = false; let errorOverrides = new Map(); - errorOverrides.set(-1, this.language.instant('DMP-USER-INVITATION-DIALOG.ERROR')); + errorOverrides.set(-1, this.language.instant('PLAN-USER-INVITATION-DIALOG.ERROR')); this.httpErrorHandlingService.handleBackedRequestError(errorResponse, errorOverrides, SnackBarNotificationLevel.Error); const error: HttpError = this.httpErrorHandlingService.getError(errorResponse); diff --git a/dmp-frontend/src/app/ui/plan/invitation/dialog/plan-invitation-dialog.module.ts b/dmp-frontend/src/app/ui/plan/invitation/dialog/plan-invitation-dialog.module.ts index 1917312bf..7af3e772f 100644 --- a/dmp-frontend/src/app/ui/plan/invitation/dialog/plan-invitation-dialog.module.ts +++ b/dmp-frontend/src/app/ui/plan/invitation/dialog/plan-invitation-dialog.module.ts @@ -4,10 +4,10 @@ import { AutoCompleteModule } from '@app/library/auto-complete/auto-complete.mod import { RichTextEditorModule } from "@app/library/rich-text-editor/rich-text-editor.module"; import { CommonUiModule } from '@common/ui/common-ui.module'; import { DmpInvitationDialogComponent } from './plan-invitation-dialog.component'; -import { DmpUserFieldModule } from '../../plan-user-field/plan-user-field.module'; +import { PlanUserFieldModule } from '../../plan-user-field/plan-user-field.module'; @NgModule({ - imports: [CommonUiModule, FormsModule, ReactiveFormsModule, AutoCompleteModule, RichTextEditorModule, DmpUserFieldModule], + imports: [CommonUiModule, FormsModule, ReactiveFormsModule, AutoCompleteModule, RichTextEditorModule, PlanUserFieldModule], declarations: [DmpInvitationDialogComponent], exports: [DmpInvitationDialogComponent] }) diff --git a/dmp-frontend/src/app/ui/plan/listing/filtering/plan-filter.component.html b/dmp-frontend/src/app/ui/plan/listing/filtering/plan-filter.component.html index bc4d68417..1a0ff11ca 100644 --- a/dmp-frontend/src/app/ui/plan/listing/filtering/plan-filter.component.html +++ b/dmp-frontend/src/app/ui/plan/listing/filtering/plan-filter.component.html @@ -2,17 +2,17 @@
    -
    {{'DMP-LISTING.FILTERS.NAME'| translate}}
    +
    {{'PLAN-LISTING.FILTERS.NAME'| translate}}
    -
    {{ 'DMP-LISTING.FILTERS.STATUS.NAME' | translate }}
    +
    {{ 'PLAN-LISTING.FILTERS.STATUS.NAME' | translate }}
    - {{ 'DMP-LISTING.FILTERS.STATUS.TYPE.ANY' | translate }} - {{ 'DMP-LISTING.FILTERS.STATUS.TYPE.DRAFT' | translate }} - {{ 'DMP-LISTING.FILTERS.STATUS.TYPE.FINALIZED' | translate }} + {{ 'PLAN-LISTING.FILTERS.STATUS.TYPE.ANY' | translate }} + {{ 'PLAN-LISTING.FILTERS.STATUS.TYPE.DRAFT' | translate }} + {{ 'PLAN-LISTING.FILTERS.STATUS.TYPE.FINALIZED' | translate }}
    @@ -20,9 +20,9 @@
    -
    {{ 'DMP-LISTING.FILTERS.RELATED-DESCRIPTION-TEMPLATES.NAME' | translate}}
    +
    {{ 'PLAN-LISTING.FILTERS.RELATED-DESCRIPTION-TEMPLATES.NAME' | translate}}
    - {{ 'DMP-LISTING.FILTERS.RELATED-DESCRIPTION-TEMPLATES.PLACEHOLDER' | translate }} + {{ 'PLAN-LISTING.FILTERS.RELATED-DESCRIPTION-TEMPLATES.PLACEHOLDER' | translate }}
    @@ -31,9 +31,9 @@
    -
    {{ 'DMP-LISTING.FILTERS.ASSOCIATED-DMP-BLUEPRINTS.NAME' | translate}}
    +
    {{ 'PLAN-LISTING.FILTERS.ASSOCIATED-PLAN-BLUEPRINTS.NAME' | translate}}
    - {{ 'DMP-LISTING.FILTERS.ASSOCIATED-DMP-BLUEPRINTS.PLACEHOLDER' | translate }} + {{ 'PLAN-LISTING.FILTERS.ASSOCIATED-PLAN-BLUEPRINTS.PLACEHOLDER' | translate }}
    @@ -42,13 +42,13 @@
    -
    {{ 'DMP-LISTING.FILTERS.ROLE.NAME' | translate }}
    +
    {{ 'PLAN-LISTING.FILTERS.ROLE.NAME' | translate }}
    - {{ 'DMP-LISTING.FILTERS.ROLE.TYPE.ANY' | translate }} - {{ 'DMP-LISTING.FILTERS.ROLE.TYPE.OWNER' | translate }} - {{ 'DMP-LISTING.FILTERS.ROLE.TYPE.VIEWER' | translate }} - {{ 'DMP-LISTING.FILTERS.ROLE.TYPE.DESCRIPTION-CONTRIBUTOR' | translate }} - {{ 'DMP-LISTING.FILTERS.ROLE.TYPE.REVIEWER' | translate }} + {{ 'PLAN-LISTING.FILTERS.ROLE.TYPE.ANY' | translate }} + {{ 'PLAN-LISTING.FILTERS.ROLE.TYPE.OWNER' | translate }} + {{ 'PLAN-LISTING.FILTERS.ROLE.TYPE.VIEWER' | translate }} + {{ 'PLAN-LISTING.FILTERS.ROLE.TYPE.DESCRIPTION-CONTRIBUTOR' | translate }} + {{ 'PLAN-LISTING.FILTERS.ROLE.TYPE.REVIEWER' | translate }}
    @@ -97,7 +97,7 @@
    diff --git a/dmp-frontend/src/app/ui/plan/listing/filtering/plan-filter.component.ts b/dmp-frontend/src/app/ui/plan/listing/filtering/plan-filter.component.ts index 2aa45ffda..b01100ff1 100644 --- a/dmp-frontend/src/app/ui/plan/listing/filtering/plan-filter.component.ts +++ b/dmp-frontend/src/app/ui/plan/listing/filtering/plan-filter.component.ts @@ -5,10 +5,10 @@ import { ValidationErrorModel } from '@common/forms/validation/error-model/valid import { TranslateService } from '@ngx-translate/core'; import { AuthService } from '@app/core/services/auth/auth.service'; import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration'; -import { DmpBlueprintService } from '@app/core/services/plan/plan-blueprint.service'; -import { DmpStatus } from '@app/core/common/enum/plan-status'; +import { PlanBlueprintService } from '@app/core/services/plan/plan-blueprint.service'; +import { PlanStatus } from '@app/core/common/enum/plan-status'; import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service'; -import { DmpUserRole } from '@app/core/common/enum/plan-user-role'; +import { PlanUserRole } from '@app/core/common/enum/plan-user-role'; import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration'; import { Guid } from '@common/types/guid'; import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service'; @@ -34,8 +34,8 @@ export class DmpFilterComponent extends BaseCriteriaComponent implements OnInit, @Input() filterFormGroup: UntypedFormGroup; @Output() filterChanged: EventEmitter = new EventEmitter(); - status = DmpStatus; - role = DmpUserRole; + status = PlanStatus; + role = PlanUserRole; filteringGrantsAsync = false; sizeError = false; maxFileSize: number = 1048576; @@ -50,7 +50,7 @@ export class DmpFilterComponent extends BaseCriteriaComponent implements OnInit, public formBuilder: UntypedFormBuilder, private authentication: AuthService, private descriptionTemplateService: DescriptionTemplateService, - private dmpBlueprintService: DmpBlueprintService, + private planBlueprintService: PlanBlueprintService, private referenceTypeService: ReferenceTypeService, private referenceService: ReferenceService, ) { @@ -65,7 +65,7 @@ export class DmpFilterComponent extends BaseCriteriaComponent implements OnInit, if (changes['filterFormGroup']) { this.descriptionTemplateAutoCompleteConfiguration = this.descriptionTemplateService.buildDescriptionTempalteGroupMultipleAutocompleteConfiguration(); - this.dmpBlueprintAutoCompleteConfiguration = this.dmpBlueprintService.multipleAutocompleteConfiguration; + this.dmpBlueprintAutoCompleteConfiguration = this.planBlueprintService.multipleAutocompleteConfiguration; this.referenceTypeAutocompleteConfiguration = this.getReferenceTypeAutocompleteConfiguration(); this.referenceAutocompleteConfiguration = new Map(); diff --git a/dmp-frontend/src/app/ui/plan/listing/filtering/services/plan-filter.service.ts b/dmp-frontend/src/app/ui/plan/listing/filtering/services/plan-filter.service.ts index c08f0466f..1de025d89 100644 --- a/dmp-frontend/src/app/ui/plan/listing/filtering/services/plan-filter.service.ts +++ b/dmp-frontend/src/app/ui/plan/listing/filtering/services/plan-filter.service.ts @@ -1,11 +1,11 @@ import { Injectable } from "@angular/core"; -import { DmpBlueprint } from "@app/core/model/plan-blueprint/plan-blueprint"; -import { Dmp, DmpDescriptionTemplate, DmpUser } from "@app/core/model/plan/plan"; +import { PlanBlueprint } from "@app/core/model/plan-blueprint/plan-blueprint"; +import { Plan, PlanDescriptionTemplate, PlanUser } from "@app/core/model/plan/plan"; import { Reference } from "@app/core/model/reference/reference"; -import { DmpBlueprintLookup } from "@app/core/query/plan-blueprint.lookup"; -import { DmpDescriptionTemplateLookup } from "@app/core/query/plan-description-template.lookup"; -import { DmpUserLookup } from "@app/core/query/plan-user.lookup"; -import { DmpReferenceLookup } from "@app/core/query/reference.lookup"; +import { PlanBlueprintLookup } from "@app/core/query/plan-blueprint.lookup"; +import { PlanDescriptionTemplateLookup } from "@app/core/query/plan-description-template.lookup"; +import { PlanUserLookup } from "@app/core/query/plan-user.lookup"; +import { PlanReferenceLookup } from "@app/core/query/reference.lookup"; import { IsActive } from "@notification-service/core/enum/is-active.enum"; import { nameof } from "ts-simple-nameof"; @@ -13,53 +13,53 @@ import { nameof } from "ts-simple-nameof"; export class DmpFilterService { - public static initializeDmpDescriptionTemplateLookup(): DmpDescriptionTemplateLookup { - const lookup = new DmpDescriptionTemplateLookup(); + public static initializePlanDescriptionTemplateLookup(): PlanDescriptionTemplateLookup { + const lookup = new PlanDescriptionTemplateLookup(); lookup.metadata = { countAll: true }; lookup.isActive = [IsActive.Active]; lookup.project = { fields: [ - [nameof(x => x.dmpDescriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), - [nameof(x => x.dmpDescriptionTemplates), nameof(x => x.dmp), nameof(x => x.id)].join('.'), + [nameof(x => x.planDescriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), + [nameof(x => x.planDescriptionTemplates), nameof(x => x.plan), nameof(x => x.id)].join('.'), ] }; return lookup; } - public static initializeDmpBlueprintLookup(): DmpBlueprintLookup { - const lookup = new DmpBlueprintLookup(); + public static initializePlanBlueprintLookup(): PlanBlueprintLookup { + const lookup = new PlanBlueprintLookup(); lookup.metadata = { countAll: true }; lookup.isActive = [IsActive.Active]; lookup.project = { fields: [ - [nameof(x => x.blueprint), nameof(x => x.id)].join('.'), + [nameof(x => x.blueprint), nameof(x => x.id)].join('.'), ] }; return lookup; } - public static initializeDmpUserLookup(): DmpUserLookup { - const lookup = new DmpUserLookup(); + public static initializePlanUserLookup(): PlanUserLookup { + const lookup = new PlanUserLookup(); lookup.metadata = { countAll: true }; lookup.isActive = [IsActive.Active]; lookup.project = { fields: [ - [nameof(x => x.dmpUsers), nameof(x => x.role)].join('.'), + [nameof(x => x.planUsers), nameof(x => x.role)].join('.'), ] }; return lookup; } - public static initializeDmpReferenceLookup(): DmpReferenceLookup { - const lookup = new DmpReferenceLookup(); + public static initializePlanReferenceLookup(): PlanReferenceLookup { + const lookup = new PlanReferenceLookup(); lookup.metadata = { countAll: true }; lookup.isActive = [IsActive.Active]; lookup.project = { fields: [ - [nameof(x => x.dmpReferences), nameof(x => x.id)].join('.'), + [nameof(x => x.planReferences), nameof(x => x.id)].join('.'), ] }; diff --git a/dmp-frontend/src/app/ui/plan/listing/listing-item/plan-listing-item.component.html b/dmp-frontend/src/app/ui/plan/listing/listing-item/plan-listing-item.component.html index 74498a04c..aec1d93f0 100644 --- a/dmp-frontend/src/app/ui/plan/listing/listing-item/plan-listing-item.component.html +++ b/dmp-frontend/src/app/ui/plan/listing/listing-item/plan-listing-item.component.html @@ -1,23 +1,23 @@
    -
    {{ 'DMP-LISTING.DMP' | translate }}
    -
    {{ 'DMP-LISTING.EDITED' | translate }}: {{ dmp.updatedAt | dateTimeFormatter: "d MMMM y" }}
    -
    {{ 'DMP-LISTING.PUBLISHED' | translate }}: {{ dmp.finalizedAt | dateTimeFormatter: "d MMMM y" }}
    +
    {{ 'PLAN-LISTING.PLAN' | translate }}
    +
    {{ 'PLAN-LISTING.EDITED' | translate }}: {{ dmp.updatedAt | dateTimeFormatter: "d MMMM y" }}
    +
    {{ 'PLAN-LISTING.PUBLISHED' | translate }}: {{ dmp.finalizedAt | dateTimeFormatter: "d MMMM y" }}
    {{dmp.label}}
    - {{ enumUtils.toDmpUserRolesString(dmpService.getCurrentUserRolesInDmp(dmp?.dmpUsers)) }} - . - public{{'TYPES.DMP-VISIBILITY.PUBLIC' | translate}} - done{{ enumUtils.toDmpStatusString(dmp.status) }} - create{{ enumUtils.toDmpStatusString(dmp.status) }} + {{ enumUtils.toPlanUserRolesString(planService.getCurrentUserRolesInPlan(dmp?.planUsers)) }} + . + public{{'TYPES.PLAN-VISIBILITY.PUBLIC' | translate}} + done{{ enumUtils.toPlanStatusString(dmp.status) }} + create{{ enumUtils.toPlanStatusString(dmp.status) }} . - {{'DMP-LISTING.VERSION' | translate}} {{dmp.version}} + {{'PLAN-LISTING.VERSION' | translate}} {{dmp.version}} . - {{ 'DMP-LISTING.GRANT' | translate }}: {{referenceService.getReferencesForTypesFirstSafe(dmp?.dmpReferences, [this.referenceTypeService.getGrantReferenceType()])?.reference?.label}} + {{ 'PLAN-LISTING.GRANT' | translate }}: {{referenceService.getReferencesForTypesFirstSafe(dmp?.planReferences, [this.referenceTypeService.getGrantReferenceType()])?.reference?.label}}
    -
    {{'DMP-LISTING.CONTAINED-DESCRIPTIONS' | translate}}: ({{ dmp.descriptions?.length }}) +
    {{'PLAN-LISTING.CONTAINED-DESCRIPTIONS' | translate}}: ({{ dmp.descriptions?.length }})
    @@ -28,13 +28,13 @@ {{'GENERAL.ACTIONS.SHOW-MORE' | translate}} @@ -45,13 +45,13 @@ -
    diff --git a/dmp-frontend/src/app/ui/plan/listing/listing-item/plan-listing-item.component.ts b/dmp-frontend/src/app/ui/plan/listing/listing-item/plan-listing-item.component.ts index bf2cf4bdc..506bda4ee 100644 --- a/dmp-frontend/src/app/ui/plan/listing/listing-item/plan-listing-item.component.ts +++ b/dmp-frontend/src/app/ui/plan/listing/listing-item/plan-listing-item.component.ts @@ -3,10 +3,10 @@ import { HttpClient } from '@angular/common/http'; import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { Router } from '@angular/router'; -import { DmpAccessType } from '@app/core/common/enum/plan-access-type'; -import { Dmp } from '@app/core/model/plan/plan'; -import { DmpBlueprintService } from '@app/core/services/plan/plan-blueprint.service'; -import { DmpService } from '@app/core/services/plan/plan.service'; +import { PlanAccessType } from '@app/core/common/enum/plan-access-type'; +import { Plan } from '@app/core/model/plan/plan'; +import { PlanBlueprintService } from '@app/core/services/plan/plan-blueprint.service'; +import { PlanService } from '@app/core/services/plan/plan.service'; import { FileTransformerService } from '@app/core/services/file-transformer/file-transformer.service'; import { LockService } from '@app/core/services/lock/lock.service'; import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service'; @@ -19,14 +19,14 @@ import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog import { Guid } from '@common/types/guid'; import { TranslateService } from '@ngx-translate/core'; import { takeUntil } from 'rxjs/operators'; -import { DmpStatus } from '../../../../core/common/enum/plan-status'; +import { PlanStatus } from '../../../../core/common/enum/plan-status'; import { AuthService } from '../../../../core/services/auth/auth.service'; -import { CloneDmpDialogComponent } from '../../clone-dialog/plan-clone-dialog.component'; +import { ClonePlanDialogComponent } from '../../clone-dialog/plan-clone-dialog.component'; import { DmpInvitationDialogComponent } from '../../invitation/dialog/plan-invitation-dialog.component'; -import { NewVersionDmpDialogComponent } from '../../new-version-dialog/plan-new-version-dialog.component'; +import { NewVersionPlanDialogComponent } from '../../new-version-dialog/plan-new-version-dialog.component'; import { AppPermission } from '@app/core/common/enum/permission.enum'; import { FileTransformerEntityType } from '@app/core/common/enum/file-transformer-entity-type'; -import { DmpVersionStatus } from '@app/core/common/enum/plan-version-status'; +import { PlanVersionStatus } from '@app/core/common/enum/plan-version-status'; import { DmpDeleteDialogComponent } from '../../plan-delete-dialog/plan-delete-dialog.component'; import { AnalyticsService } from '@app/core/services/matomo/analytics-service'; import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service'; @@ -39,15 +39,15 @@ import { RouterUtilsService } from '@app/core/services/router/router-utils.servi }) export class DmpListingItemComponent extends BaseComponent implements OnInit { - @Input() dmp: Dmp; + @Input() dmp: Plan; @Input() showDivider: boolean = true; @Input() isPublic: boolean; - @Output() onClick: EventEmitter = new EventEmitter(); + @Output() onClick: EventEmitter = new EventEmitter(); isDraft: boolean; isFinalized: boolean; isPublished: boolean; - dmpStatusEnum = DmpStatus; + planStatusEnum = PlanStatus; fileTransformerEntityTypeEnum = FileTransformerEntityType; constructor( @@ -56,8 +56,8 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit { private dialog: MatDialog, private authentication: AuthService, public enumUtils: EnumUtils, - private dmpService: DmpService, - private dmpBlueprintService: DmpBlueprintService, + private planService: PlanService, + private planBlueprintService: PlanBlueprintService, private language: TranslateService, private uiNotificationService: UiNotificationService, private lockService: LockService, @@ -75,16 +75,16 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit { ngOnInit() { this.analyticsService.trackPageView(AnalyticsService.DmpListingItem); - if (this.dmp.status == DmpStatus.Draft) { + if (this.dmp.status == PlanStatus.Draft) { this.isDraft = true; this.isFinalized = false; this.isPublished = false; } - else if (this.dmp.status == DmpStatus.Finalized) { + else if (this.dmp.status == PlanStatus.Finalized) { this.isDraft = false; this.isFinalized = true; this.isPublished = false; - if (this.dmp.status === DmpStatus.Finalized && this.dmp.accessType === DmpAccessType.Public) { this.isPublished = true } + if (this.dmp.status === PlanStatus.Finalized && this.dmp.accessType === PlanAccessType.Public) { this.isPublished = true } } } @@ -99,15 +99,15 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit { autoFocus: false, restoreFocus: false, data: { - dmpId: this.dmp.id, + planId: this.dmp.id, dmpName: this.dmp.label, blueprint: this.dmp.blueprint } }); } - viewVersions(dmp: Dmp) { - if (dmp.accessType == DmpAccessType.Public && dmp.status == DmpStatus.Finalized && !this.dmp.authorizationFlags?.some(x => x === AppPermission.EditDmp)) { + viewVersions(dmp: Plan) { + if (dmp.accessType == PlanAccessType.Public && dmp.status == PlanStatus.Finalized && !this.dmp.authorizationFlags?.some(x => x === AppPermission.EditPlan)) { let url = this.router.createUrlTree(['/explore-plans/versions/', dmp.groupId]); window.open(url.toString(), '_blank'); } else { @@ -116,20 +116,20 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit { } } - isUserDMPRelated() { + isUserPlanRelated() { const principalId: Guid = this.authentication.userId(); - return this.dmp.dmpUsers?.some(x => (x.user.id === principalId)); + return this.dmp.planUsers?.some(x => (x.user.id === principalId)); } cloneClicked() { - const dialogRef = this.dialog.open(CloneDmpDialogComponent, { + const dialogRef = this.dialog.open(ClonePlanDialogComponent, { maxWidth: '700px', maxHeight: '80vh', data: { - dmp: this.dmp + plan: this.dmp } }); - dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe((result: Dmp) => { + dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe((result: Plan) => { if (result) { this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success); this.router.navigate([this.routerUtils.generateUrl(['/plans/edit', result.id.toString()], '/')]); @@ -138,14 +138,14 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit { } newVersionClicked() { - const dialogRef = this.dialog.open(NewVersionDmpDialogComponent, { + const dialogRef = this.dialog.open(NewVersionPlanDialogComponent, { maxWidth: '700px', maxHeight: '80vh', data: { - dmp: this.dmp + plan: this.dmp } }); - dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe((result: Dmp) => { + dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe((result: Plan) => { if (result) { this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success); this.router.navigate([this.routerUtils.generateUrl(['/plans/edit', result.id.toString()], '/')]); @@ -190,7 +190,7 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit { dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { if (result) { - this.dmpService.delete(id) + this.planService.delete(id) .pipe(takeUntil(this._destroyed)) .subscribe( complete => this.onDeleteCallbackSuccess(), @@ -205,13 +205,13 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit { maxWidth: '400px', restoreFocus: false, data: { - message: this.language.instant('DMP-EDITOR.ACTIONS.LOCK') + message: this.language.instant('PLAN-EDITOR.ACTIONS.LOCK') } }); } - isDraftDmp(activity: Dmp) { - return activity.status == DmpStatus.Draft; + isDraftDmp(activity: Plan) { + return activity.status == PlanStatus.Draft; } reloadPage(): void { @@ -230,35 +230,35 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit { this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DELETE'), SnackBarNotificationLevel.Error); } - canEditDmp(dmp: Dmp): boolean { - return (this.dmp.authorizationFlags?.some(x => x === AppPermission.EditDmp) || this.authentication.hasPermission(AppPermission.EditDmp)) && this.isPublic == false && this.dmp.belongsToCurrentTenant != false; + canEditPlan(dmp: Plan): boolean { + return (this.dmp.authorizationFlags?.some(x => x === AppPermission.EditPlan) || this.authentication.hasPermission(AppPermission.EditPlan)) && this.isPublic == false && this.dmp.belongsToCurrentTenant != false; } - canCreateNewVersion(dmp: Dmp): boolean { - return (this.dmp.authorizationFlags?.some(x => x === AppPermission.CreateNewVersionDmp) || this.authentication.hasPermission(AppPermission.CreateNewVersionDmp)) && this.dmp.versionStatus === DmpVersionStatus.Current && this.isPublic == false && this.dmp.belongsToCurrentTenant != false; + canCreateNewVersion(dmp: Plan): boolean { + return (this.dmp.authorizationFlags?.some(x => x === AppPermission.CreateNewVersionPlan) || this.authentication.hasPermission(AppPermission.CreateNewVersionPlan)) && this.dmp.versionStatus === PlanVersionStatus.Current && this.isPublic == false && this.dmp.belongsToCurrentTenant != false; } - canDeleteDmp(dmp: Dmp): boolean { - return (this.dmp.authorizationFlags?.some(x => x === AppPermission.DeleteDmp) || this.authentication.hasPermission(AppPermission.DeleteDmp)) && this.isPublic == false && this.dmp.belongsToCurrentTenant != false; + canDeletePlan(dmp: Plan): boolean { + return (this.dmp.authorizationFlags?.some(x => x === AppPermission.DeletePlan) || this.authentication.hasPermission(AppPermission.DeletePlan)) && this.isPublic == false && this.dmp.belongsToCurrentTenant != false; } - canCloneDmp(dmp: Dmp): boolean { - return this.dmp.authorizationFlags?.some(x => x === AppPermission.CloneDmp) || this.authentication.hasPermission(AppPermission.CloneDmp); + canClonePlan(dmp: Plan): boolean { + return this.dmp.authorizationFlags?.some(x => x === AppPermission.ClonePlan) || this.authentication.hasPermission(AppPermission.ClonePlan); } - canFinalizeDmp(dmp: Dmp): boolean { - return (this.dmp.authorizationFlags?.some(x => x === AppPermission.FinalizeDmp) || this.authentication.hasPermission(AppPermission.FinalizeDmp)) && this.isPublic == false && this.dmp.belongsToCurrentTenant != false; + canFinalizePlan(dmp: Plan): boolean { + return (this.dmp.authorizationFlags?.some(x => x === AppPermission.FinalizePlan) || this.authentication.hasPermission(AppPermission.FinalizePlan)) && this.isPublic == false && this.dmp.belongsToCurrentTenant != false; } - canExportDmp(dmp: Dmp): boolean { - return this.dmp.authorizationFlags?.some(x => x === AppPermission.ExportDmp) || this.authentication.hasPermission(AppPermission.ExportDmp); + canExportPlan(dmp: Plan): boolean { + return this.dmp.authorizationFlags?.some(x => x === AppPermission.ExportPlan) || this.authentication.hasPermission(AppPermission.ExportPlan); } - canInviteDmpUsers(dmp: Dmp): boolean { - return (this.dmp.authorizationFlags?.some(x => x === AppPermission.InviteDmpUsers) || this.authentication.hasPermission(AppPermission.InviteDmpUsers)) && this.isPublic == false && this.dmp.belongsToCurrentTenant != false; + canInvitePlanUsers(dmp: Plan): boolean { + return (this.dmp.authorizationFlags?.some(x => x === AppPermission.InvitePlanUsers) || this.authentication.hasPermission(AppPermission.InvitePlanUsers)) && this.isPublic == false && this.dmp.belongsToCurrentTenant != false; } - canAssignDmpUsers(dmp: Dmp): boolean { - return (this.dmp.authorizationFlags?.some(x => x === AppPermission.AssignDmpUsers) || this.authentication.hasPermission(AppPermission.AssignDmpUsers)) && this.isPublic == false && this.dmp.belongsToCurrentTenant != false; + canAssignPlanUsers(dmp: Plan): boolean { + return (this.dmp.authorizationFlags?.some(x => x === AppPermission.AssignPlanUsers) || this.authentication.hasPermission(AppPermission.AssignPlanUsers)) && this.isPublic == false && this.dmp.belongsToCurrentTenant != false; } } diff --git a/dmp-frontend/src/app/ui/plan/listing/plan-listing.component.html b/dmp-frontend/src/app/ui/plan/listing/plan-listing.component.html index 1aa8d38b8..4f366d3ad 100644 --- a/dmp-frontend/src/app/ui/plan/listing/plan-listing.component.html +++ b/dmp-frontend/src/app/ui/plan/listing/plan-listing.component.html @@ -3,8 +3,8 @@
    -

    {{'DMP-LISTING.TEXT-INFO' | translate}}

    -

    {{'DMP-LISTING.TEXT-INFO-QUESTION' | translate}} {{'DMP-LISTING.LINK-ZENODO' | translate}} {{'DMP-LISTING.GET-IDEA' | translate}}

    +

    {{'PLAN-LISTING.TEXT-INFO' | translate}}

    +

    {{'PLAN-LISTING.TEXT-INFO-QUESTION' | translate}} {{'PLAN-LISTING.LINK-ZENODO' | translate}} {{'PLAN-LISTING.GET-IDEA' | translate}}

    {{ 'GENERAL.ACTIONS.TAKE-A-TOUR'| translate }}
    @@ -26,7 +26,7 @@
    - {{'DMP-LISTING.SORT-BY' | translate}}: + {{'PLAN-LISTING.SORT-BY' | translate}}:
    @@ -69,10 +69,10 @@
    - {{'DMP-LISTING.EMPTY-LIST' | translate}} + {{'PLAN-LISTING.EMPTY-LIST' | translate}}
    - {{'DMP-LISTING.FILTERS.NO-ITEMS-FOUND' | translate}} + {{'PLAN-LISTING.FILTERS.NO-ITEMS-FOUND' | translate}}
    diff --git a/dmp-frontend/src/app/ui/plan/listing/plan-listing.component.ts b/dmp-frontend/src/app/ui/plan/listing/plan-listing.component.ts index 9d023498b..fad8eb621 100644 --- a/dmp-frontend/src/app/ui/plan/listing/plan-listing.component.ts +++ b/dmp-frontend/src/app/ui/plan/listing/plan-listing.component.ts @@ -9,14 +9,14 @@ import { AppPermission } from '@app/core/common/enum/permission.enum'; import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order'; import { DescriptionTemplate } from '@app/core/model/description-template/description-template'; import { Description } from '@app/core/model/description/description'; -import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/plan-blueprint/plan-blueprint'; -import { BaseDmp, Dmp, DmpDescriptionTemplate, DmpUser } from '@app/core/model/plan/plan'; -import { DmpReference } from '@app/core/model/plan/plan-reference'; +import { DescriptionTemplatesInSection, PlanBlueprint, PlanBlueprintDefinition, PlanBlueprintDefinitionSection } from '@app/core/model/plan-blueprint/plan-blueprint'; +import { BasePlan, Plan, PlanDescriptionTemplate, PlanUser } from '@app/core/model/plan/plan'; +import { PlanReference } from '@app/core/model/plan/plan-reference'; import { ReferenceType } from '@app/core/model/reference-type/reference-type'; import { Reference } from '@app/core/model/reference/reference'; -import { DmpLookup } from '@app/core/query/plan.lookup'; +import { PlanLookup } from '@app/core/query/plan.lookup'; import { AuthService } from '@app/core/services/auth/auth.service'; -import { DmpService } from '@app/core/services/plan/plan.service'; +import { PlanService } from '@app/core/services/plan/plan.service'; import { AnalyticsService } from '@app/core/services/matomo/analytics-service'; import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; import { GuidedTour, Orientation } from '@app/library/guided-tour/guided-tour.constants'; @@ -42,13 +42,13 @@ import { DmpFilterService } from './filtering/services/plan-filter.service'; templateUrl: 'plan-listing.component.html', styleUrls: ['./plan-listing.component.scss'], }) -export class DmpListingComponent extends BaseListingComponent implements OnInit { +export class DmpListingComponent extends BaseListingComponent implements OnInit { userSettingsKey = { key: 'DmpListingUserSettings' }; @ViewChild(MatPaginator, { static: true }) _paginator: MatPaginator; @ViewChild(MatSort) sort: MatSort; - lookup: DmpLookup; + lookup: PlanLookup; groupId: string; totalCount: number; listingItems: any[] = []; @@ -80,15 +80,15 @@ export class DmpListingComponent extends BaseListingComponent 0; } get hasFilters(): boolean { return (this.lookup.like != null && this.lookup.like != '') || this.lookup.statuses != null || - this.lookup.dmpReferenceSubQuery != null || this.lookup.dmpDescriptionTemplateSubQuery != null || - this.lookup.dmpBlueprintSubQuery != null || this.lookup.dmpUserSubQuery != null; + this.lookup.planReferenceSubQuery != null || this.lookup.planDescriptionTemplateSubQuery != null || + this.lookup.planBlueprintSubQuery != null || this.lookup.planUserSubQuery != null; } constructor( @@ -97,7 +97,7 @@ export class DmpListingComponent extends BaseListingComponent> { + protected loadListing(): Observable> { if (this.isPublic) { - return this.dmpService.publicQuery(this.lookup).pipe(takeUntil(this._destroyed)) + return this.planService.publicQuery(this.lookup).pipe(takeUntil(this._destroyed)) .pipe(tap(result => { if (!result) { return []; } this.totalCount = result.count; @@ -188,7 +188,7 @@ export class DmpListingComponent extends BaseListingComponent { this.hasLoadedListingItems = true; if (!result) { return []; } @@ -201,8 +201,8 @@ export class DmpListingComponent extends BaseListingComponent { + this.language.get('PLAN-LISTING.TEXT-INFO').pipe(takeUntil(this._destroyed)).subscribe((x: string) => { this.dashboardTour.steps[0].title = x + '\n\n' + - this.language.instant('DMP-LISTING.TEXT-INFO-QUESTION') + ' ' + - this.language.instant('DMP-LISTING.LINK-ZENODO') + ' ' + - this.language.instant('DMP-LISTING.GET-IDEA'); + this.language.instant('PLAN-LISTING.TEXT-INFO-QUESTION') + ' ' + + this.language.instant('PLAN-LISTING.LINK-ZENODO') + ' ' + + this.language.instant('PLAN-LISTING.GET-IDEA'); this.dashboardTour.steps[1].title = this.language.instant('DESCRIPTION-LISTING.TEXT-INFO') + '\n\n' + this.language.instant('DESCRIPTION-LISTING.TEXT-INFO-QUESTION') + ' ' + @@ -244,13 +244,13 @@ export class DmpListingComponent extends BaseListingComponent(x => x.status)] }; + this.lookup.order = { items: [this.sortingDirectionPrefix + nameof(x => x.status)] }; } else if (this.formGroup.get('order').value == RecentActivityOrder.Label) { - this.lookup.order = { items: [this.sortingDirectionPrefix + nameof(x => x.label)] }; + this.lookup.order = { items: [this.sortingDirectionPrefix + nameof(x => x.label)] }; } else if (this.formGroup.get('order').value == RecentActivityOrder.PublishedAt){ - this.lookup.order = { items: [this.sortingDirectionPrefix + nameof(x => x.finalizedAt)] }; + this.lookup.order = { items: [this.sortingDirectionPrefix + nameof(x => x.finalizedAt)] }; }else { - this.lookup.order = { items: [this.sortingDirectionPrefix + nameof(x => x.updatedAt)] }; + this.lookup.order = { items: [this.sortingDirectionPrefix + nameof(x => x.updatedAt)] }; } this.filterChanged(this.lookup); } @@ -300,10 +300,10 @@ export class DmpListingComponent extends BaseListingComponent(x => x.updatedAt): return RecentActivityOrder.UpdatedAt; - case nameof(x => x.label): return RecentActivityOrder.Label; - case nameof(x => x.finalizedAt): return RecentActivityOrder.PublishedAt; - case nameof(x => x.status): return RecentActivityOrder.Status; + case nameof(x => x.updatedAt): return RecentActivityOrder.UpdatedAt; + case nameof(x => x.label): return RecentActivityOrder.Label; + case nameof(x => x.finalizedAt): return RecentActivityOrder.PublishedAt; + case nameof(x => x.status): return RecentActivityOrder.Status; } } - private _patchLookupFromForm(lookup: DmpLookup, formGroup: UntypedFormGroup): DmpLookup { + private _patchLookupFromForm(lookup: PlanLookup, formGroup: UntypedFormGroup): PlanLookup { if (!formGroup) return; lookup.statuses = formGroup.get("status")?.value !== null ? [formGroup.get("status")?.value] : null; @@ -359,33 +359,33 @@ export class DmpListingComponent extends BaseListingComponent 0) { - lookup.dmpDescriptionTemplateSubQuery = DmpFilterService.initializeDmpDescriptionTemplateLookup(); - lookup.dmpDescriptionTemplateSubQuery.descriptionTemplateGroupIds = descriptionTemplates; - } else lookup.dmpDescriptionTemplateSubQuery = null; + lookup.planDescriptionTemplateSubQuery = DmpFilterService.initializePlanDescriptionTemplateLookup(); + lookup.planDescriptionTemplateSubQuery.descriptionTemplateGroupIds = descriptionTemplates; + } else lookup.planDescriptionTemplateSubQuery = null; // Blueprints let dmpBlueprints = formGroup.get("dmpBlueprints")?.value ?? null; if (dmpBlueprints && dmpBlueprints?.length > 0) { - lookup.dmpBlueprintSubQuery = DmpFilterService.initializeDmpBlueprintLookup(); - lookup.dmpBlueprintSubQuery.ids = dmpBlueprints; - } else lookup.dmpBlueprintSubQuery = null; + lookup.planBlueprintSubQuery = DmpFilterService.initializePlanBlueprintLookup(); + lookup.planBlueprintSubQuery.ids = dmpBlueprints; + } else lookup.planBlueprintSubQuery = null; // Dmps let roles = formGroup.get("role")?.value !== null ? [formGroup.get("role")?.value] : null; if (roles && roles?.length > 0) { - lookup.dmpUserSubQuery = DmpFilterService.initializeDmpUserLookup(); - lookup.dmpUserSubQuery.userRoles = roles; - } else lookup.dmpUserSubQuery = null; + lookup.planUserSubQuery = DmpFilterService.initializePlanUserLookup(); + lookup.planUserSubQuery.userRoles = roles; + } else lookup.planUserSubQuery = null; let references: Guid[] = formGroup.get("references")?.value ?.filter((reference: ReferencesWithType) => reference.referenceTypeId != null && reference.referenceIds?.length > 0) ?.flatMap((referencesWithType: ReferencesWithType) => referencesWithType.referenceIds) as Guid[]; if (references && references?.length > 0) { - lookup.dmpReferenceSubQuery = DmpFilterService.initializeDmpReferenceLookup(); - lookup.dmpReferenceSubQuery.referenceIds = references; - } else lookup.dmpReferenceSubQuery = null; + lookup.planReferenceSubQuery = DmpFilterService.initializePlanReferenceLookup(); + lookup.planReferenceSubQuery.referenceIds = references; + } else lookup.planReferenceSubQuery = null; return lookup; @@ -395,29 +395,29 @@ export class DmpListingComponent extends BaseListingComponent referencesWithType != null && referencesWithType.referenceIds?.length > 0) ?? null; } - private _buildFormFromLookup(lookup: DmpLookup): UntypedFormGroup { + private _buildFormFromLookup(lookup: PlanLookup): UntypedFormGroup { return (new UntypedFormBuilder()).group({ status: [lookup.statuses?.length > 0 ? lookup.statuses[0] : null], - descriptionTemplates: lookup.dmpDescriptionTemplateSubQuery?.descriptionTemplateGroupIds ? [lookup.dmpDescriptionTemplateSubQuery?.descriptionTemplateGroupIds] : [], - dmpBlueprints: lookup.dmpBlueprintSubQuery?.ids ? [lookup.dmpBlueprintSubQuery?.ids]: [], - role: lookup.dmpUserSubQuery?.userRoles ? lookup.dmpUserSubQuery?.userRoles[0] : null, + descriptionTemplates: lookup.planDescriptionTemplateSubQuery?.descriptionTemplateGroupIds ? [lookup.planDescriptionTemplateSubQuery?.descriptionTemplateGroupIds] : [], + dmpBlueprints: lookup.planBlueprintSubQuery?.ids ? [lookup.planBlueprintSubQuery?.ids]: [], + role: lookup.planUserSubQuery?.userRoles ? lookup.planUserSubQuery?.userRoles[0] : null, }); } - private _countFilters(lookup: DmpLookup): number { + private _countFilters(lookup: PlanLookup): number { let count = 0; if (lookup.statuses) count += lookup.statuses.length; - if (lookup.dmpDescriptionTemplateSubQuery) count += lookup.dmpDescriptionTemplateSubQuery.descriptionTemplateGroupIds?.length; - if (lookup.dmpBlueprintSubQuery) count += lookup.dmpBlueprintSubQuery.ids?.length; - if (lookup.dmpUserSubQuery) count += lookup.dmpUserSubQuery.userRoles?.length; - if (lookup.dmpReferenceSubQuery) count += lookup.dmpReferenceSubQuery.referenceIds?.length; + if (lookup.planDescriptionTemplateSubQuery) count += lookup.planDescriptionTemplateSubQuery.descriptionTemplateGroupIds?.length; + if (lookup.planBlueprintSubQuery) count += lookup.planBlueprintSubQuery.ids?.length; + if (lookup.planUserSubQuery) count += lookup.planUserSubQuery.userRoles?.length; + if (lookup.planReferenceSubQuery) count += lookup.planReferenceSubQuery.referenceIds?.length; return count; } - private _filterDmp(dmps: BaseDmp[]): BaseDmp[] { - dmps.forEach((dmp: BaseDmp) => { + private _filterDmp(dmps: BasePlan[]): BasePlan[] { + dmps.forEach((dmp: BasePlan) => { dmp.descriptions = dmp.descriptions?.filter(d => d.isActive == IsActive.Active) ?? []; }) return dmps; @@ -425,57 +425,57 @@ export class DmpListingComponent extends BaseListingComponent(x => x.id), - nameof(x => x.label), - nameof(x => x.description), - nameof(x => x.status), - nameof(x => x.accessType), - nameof(x => x.version), - nameof(x => x.versionStatus), - nameof(x => x.groupId), - nameof(x => x.updatedAt), - nameof(x => x.belongsToCurrentTenant), - nameof(x => x.finalizedAt), - nameof(x => x.hash), - [nameof(x => x.authorizationFlags), AppPermission.CreateNewVersionDmp].join('.'), - [nameof(x => x.authorizationFlags), AppPermission.DeleteDmp].join('.'), - [nameof(x => x.authorizationFlags), AppPermission.CloneDmp].join('.'), - [nameof(x => x.authorizationFlags), AppPermission.FinalizeDmp].join('.'), - [nameof(x => x.authorizationFlags), AppPermission.ExportDmp].join('.'), - [nameof(x => x.authorizationFlags), AppPermission.InviteDmpUsers].join('.'), - [nameof(x => x.authorizationFlags), AppPermission.AssignDmpUsers].join('.'), - [nameof(x => x.authorizationFlags), AppPermission.EditDmp].join('.'), + nameof(x => x.id), + nameof(x => x.label), + nameof(x => x.description), + nameof(x => x.status), + nameof(x => x.accessType), + nameof(x => x.version), + nameof(x => x.versionStatus), + nameof(x => x.groupId), + nameof(x => x.updatedAt), + nameof(x => x.belongsToCurrentTenant), + nameof(x => x.finalizedAt), + nameof(x => x.hash), + [nameof(x => x.authorizationFlags), AppPermission.CreateNewVersionPlan].join('.'), + [nameof(x => x.authorizationFlags), AppPermission.DeletePlan].join('.'), + [nameof(x => x.authorizationFlags), AppPermission.ClonePlan].join('.'), + [nameof(x => x.authorizationFlags), AppPermission.FinalizePlan].join('.'), + [nameof(x => x.authorizationFlags), AppPermission.ExportPlan].join('.'), + [nameof(x => x.authorizationFlags), AppPermission.InvitePlanUsers].join('.'), + [nameof(x => x.authorizationFlags), AppPermission.AssignPlanUsers].join('.'), + [nameof(x => x.authorizationFlags), AppPermission.EditPlan].join('.'), - [nameof(x => x.descriptions), nameof(x => x.id)].join('.'), - [nameof(x => x.descriptions), nameof(x => x.label)].join('.'), - [nameof(x => x.descriptions), nameof(x => x.status)].join('.'), - [nameof(x => x.descriptions), nameof(x => x.descriptionTemplate), nameof(x => x.groupId)].join('.'), - [nameof(x => x.descriptions), nameof(x => x.dmpDescriptionTemplate), nameof(x => x.sectionId)].join('.'), - [nameof(x => x.descriptions), nameof(x => x.isActive)].join('.'), + [nameof(x => x.descriptions), nameof(x => x.id)].join('.'), + [nameof(x => x.descriptions), nameof(x => x.label)].join('.'), + [nameof(x => x.descriptions), nameof(x => x.status)].join('.'), + [nameof(x => x.descriptions), nameof(x => x.descriptionTemplate), nameof(x => x.groupId)].join('.'), + [nameof(x => x.descriptions), nameof(x => x.planDescriptionTemplate), nameof(x => x.sectionId)].join('.'), + [nameof(x => x.descriptions), nameof(x => x.isActive)].join('.'), - [nameof(x => x.blueprint), nameof(x => x.id)].join('.'), - [nameof(x => x.blueprint), nameof(x => x.label)].join('.'), - [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), - [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.label)].join('.'), - [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.hasTemplates)].join('.'), - [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), + [nameof(x => x.blueprint), nameof(x => x.id)].join('.'), + [nameof(x => x.blueprint), nameof(x => x.label)].join('.'), + [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), + [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.label)].join('.'), + [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.hasTemplates)].join('.'), + [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), - [nameof(x => x.dmpUsers), nameof(x => x.id)].join('.'), - [nameof(x => x.dmpUsers), nameof(x => x.user.id)].join('.'), - [nameof(x => x.dmpUsers), nameof(x => x.role)].join('.'), - [nameof(x => x.dmpUsers), nameof(x => x.dmp.id)].join('.'), - [nameof(x => x.dmpUsers), nameof(x => x.isActive)].join('.'), + [nameof(x => x.planUsers), nameof(x => x.id)].join('.'), + [nameof(x => x.planUsers), nameof(x => x.user.id)].join('.'), + [nameof(x => x.planUsers), nameof(x => x.role)].join('.'), + [nameof(x => x.planUsers), nameof(x => x.plan.id)].join('.'), + [nameof(x => x.planUsers), nameof(x => x.isActive)].join('.'), - [nameof(x => x.dmpReferences), nameof(x => x.id)].join('.'), - [nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.id)].join('.'), - [nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.label)].join('.'), - [nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.type), nameof(x => x.id)].join('.'), - [nameof(x => x.dmpReferences), nameof(x => x.isActive)].join('.'), + [nameof(x => x.planReferences), nameof(x => x.id)].join('.'), + [nameof(x => x.planReferences), nameof(x => x.reference), nameof(x => x.id)].join('.'), + [nameof(x => x.planReferences), nameof(x => x.reference), nameof(x => x.label)].join('.'), + [nameof(x => x.planReferences), nameof(x => x.reference), nameof(x => x.type), nameof(x => x.id)].join('.'), + [nameof(x => x.planReferences), nameof(x => x.isActive)].join('.'), - [nameof(x => x.dmpDescriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), - [nameof(x => x.dmpDescriptionTemplates), nameof(x => x.sectionId)].join('.'), - [nameof(x => x.dmpDescriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), - [nameof(x => x.dmpDescriptionTemplates), nameof(x => x.isActive)].join('.'), + [nameof(x => x.planDescriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), + [nameof(x => x.planDescriptionTemplates), nameof(x => x.sectionId)].join('.'), + [nameof(x => x.planDescriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), + [nameof(x => x.planDescriptionTemplates), nameof(x => x.isActive)].join('.'), ]; } } diff --git a/dmp-frontend/src/app/ui/plan/listing/plan-listing.module.ts b/dmp-frontend/src/app/ui/plan/listing/plan-listing.module.ts index 60bae269a..7efe447d6 100644 --- a/dmp-frontend/src/app/ui/plan/listing/plan-listing.module.ts +++ b/dmp-frontend/src/app/ui/plan/listing/plan-listing.module.ts @@ -2,13 +2,13 @@ import { NgModule } from '@angular/core'; import { FormattingModule } from '@app/core/formatting.module'; import { CommonFormsModule } from '@common/forms/common-forms.module'; import { CommonUiModule } from '@common/ui/common-ui.module'; -import { NewVersionDmpDialogModule } from '../new-version-dialog/plan-new-version-dialog.module'; +import { NewVersionPlanDialogModule } from '../new-version-dialog/plan-new-version-dialog.module'; import { DmpInvitationDialogModule } from '../invitation/dialog/plan-invitation-dialog.module'; import { DmpFilterDialogComponent } from './filtering/plan-filter-dialog/plan-filter-dialog.component'; import { DmpFilterComponent } from './filtering/plan-filter.component'; import { AutoCompleteModule } from '@app/library/auto-complete/auto-complete.module'; import { DmpFilterService } from './filtering/services/plan-filter.service'; -import { CloneDmpDialogModule } from '../clone-dialog/plan-clone-dialog.module'; +import { ClonePlanDialogModule } from '../clone-dialog/plan-clone-dialog.module'; import { DmpListingComponent } from './plan-listing.component'; import { DmpListingItemComponent } from './listing-item/plan-listing-item.component'; import { DmpListingRoutingModule } from './plan-listing.routing'; @@ -19,8 +19,8 @@ import { DmpListingRoutingModule } from './plan-listing.routing'; CommonFormsModule, FormattingModule, AutoCompleteModule, - CloneDmpDialogModule, - NewVersionDmpDialogModule, + ClonePlanDialogModule, + NewVersionPlanDialogModule, DmpInvitationDialogModule, DmpListingRoutingModule ], diff --git a/dmp-frontend/src/app/ui/plan/new-version-dialog/plan-new-version-dialog.component.html b/dmp-frontend/src/app/ui/plan/new-version-dialog/plan-new-version-dialog.component.html index 983c2248f..42800b902 100644 --- a/dmp-frontend/src/app/ui/plan/new-version-dialog/plan-new-version-dialog.component.html +++ b/dmp-frontend/src/app/ui/plan/new-version-dialog/plan-new-version-dialog.component.html @@ -1,16 +1,16 @@
    -
    {{'DMP-NEW-VERSION-DIALOG.TITLE' | translate}}
    +
    {{'PLAN-NEW-VERSION-DIALOG.TITLE' | translate}}
    close
    -
    {{'DMP-NEW-VERSION-DIALOG.FIELDS.LABEL' | translate}}*
    +
    {{'PLAN-NEW-VERSION-DIALOG.FIELDS.LABEL' | translate}}*
    - + {{formGroup.get('label').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}} @@ -19,37 +19,37 @@
    -
    {{'DMP-NEW-VERSION-DIALOG.FIELDS.DESCRIPTION' | translate}}
    +
    {{'PLAN-NEW-VERSION-DIALOG.FIELDS.DESCRIPTION' | translate}}
    -
    {{'DMP-NEW-VERSION-DIALOG.FIELDS.DESCRIPTION-HINT' | translate}}
    +
    {{'PLAN-NEW-VERSION-DIALOG.FIELDS.DESCRIPTION-HINT' | translate}}
    - +
    -
    {{'DMP-NEW-VERSION-DIALOG.FIELDS.BLUEPRINT' | translate}}*
    +
    {{'PLAN-NEW-VERSION-DIALOG.FIELDS.BLUEPRINT' | translate}}*
    - +
    -
    {{'DMP-NEW-VERSION-DIALOG.FIELDS.DESCRIPTIONS' | translate}}
    +
    {{'PLAN-NEW-VERSION-DIALOG.FIELDS.DESCRIPTIONS' | translate}}
    -
    {{'DMP-NEW-VERSION-DIALOG.FIELDS.DESCRIPTIONS-HINT' | translate}}
    +
    {{'PLAN-NEW-VERSION-DIALOG.FIELDS.DESCRIPTIONS-HINT' | translate}}
    - {{ 'DMP-NEW-VERSION-DIALOG.ACTIONS.TOGGLE-DESCRIPTIONS' | translate }} + {{ 'PLAN-NEW-VERSION-DIALOG.ACTIONS.TOGGLE-DESCRIPTIONS' | translate }} @@ -80,12 +80,12 @@
    -
    {{'DMP-NEW-VERSION-DIALOG.NO-DESCRIPTIONS' | translate}}
    +
    {{'PLAN-NEW-VERSION-DIALOG.NO-DESCRIPTIONS' | translate}}
    -
    -
    +
    +
    \ No newline at end of file diff --git a/dmp-frontend/src/app/ui/plan/new-version-dialog/plan-new-version-dialog.component.ts b/dmp-frontend/src/app/ui/plan/new-version-dialog/plan-new-version-dialog.component.ts index b91efa93f..10957ebef 100644 --- a/dmp-frontend/src/app/ui/plan/new-version-dialog/plan-new-version-dialog.component.ts +++ b/dmp-frontend/src/app/ui/plan/new-version-dialog/plan-new-version-dialog.component.ts @@ -1,22 +1,22 @@ import { Component, Inject } from '@angular/core'; import { AbstractControl, FormArray, UntypedFormGroup } from '@angular/forms'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; -import { Dmp, DmpDescriptionTemplate, NewVersionDmpDescriptionPersist, NewVersionDmpPersist } from '@app/core/model/plan/plan'; -import { DmpService } from '@app/core/services/plan/plan.service'; +import { Plan, PlanDescriptionTemplate, NewVersionPlanDescriptionPersist, NewVersionPlanPersist } from '@app/core/model/plan/plan'; +import { PlanService } from '@app/core/services/plan/plan.service'; import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service'; import { BaseComponent } from '@common/base/base.component'; import { TranslateService } from '@ngx-translate/core'; import { map, takeUntil } from 'rxjs/operators'; import { DmpNewVersionDialogEditorModel } from './plan-new-version-dialog.editor.model'; -import { DmpBlueprintService } from '@app/core/services/plan/plan-blueprint.service'; -import { DmpEditorEntityResolver } from '../plan-editor-blueprint/resolvers/plan-editor-enitity.resolver'; +import { PlanBlueprintService } from '@app/core/services/plan/plan-blueprint.service'; +import { PlanEditorEntityResolver } from '../plan-editor-blueprint/resolvers/plan-editor-enitity.resolver'; import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration'; -import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/plan-blueprint/plan-blueprint'; -import { DmpBlueprintStatus } from '@app/core/common/enum/plan-blueprint-status'; -import { DmpBlueprintLookup } from '@app/core/query/plan-blueprint.lookup'; +import { DescriptionTemplatesInSection, PlanBlueprint, PlanBlueprintDefinition, PlanBlueprintDefinitionSection } from '@app/core/model/plan-blueprint/plan-blueprint'; +import { PlanBlueprintStatus } from '@app/core/common/enum/plan-blueprint-status'; +import { PlanBlueprintLookup } from '@app/core/query/plan-blueprint.lookup'; import { IsActive } from '@notification-service/core/enum/is-active.enum'; import { nameof } from 'ts-simple-nameof'; -import { DmpBlueprintVersionStatus } from '@app/core/common/enum/plan-blueprint-version-status'; +import { PlanBlueprintVersionStatus } from '@app/core/common/enum/plan-blueprint-version-status'; import { FilterService } from '@common/modules/text-filter/filter-service'; import { Guid } from '@common/types/guid'; import { FormService } from '@common/forms/form-service'; @@ -30,25 +30,25 @@ import { Description } from '@app/core/model/description/description'; templateUrl: './plan-new-version-dialog.component.html', styleUrls: ['./plan-new-version-dialog.component.scss'] }) -export class NewVersionDmpDialogComponent extends BaseComponent { +export class NewVersionPlanDialogComponent extends BaseComponent { - dmp: Dmp; + dmp: Plan; editorModel: DmpNewVersionDialogEditorModel; formGroup: UntypedFormGroup; - selectedBlueprintSections: DmpBlueprintDefinitionSection[]; + selectedBlueprintSections: PlanBlueprintDefinitionSection[]; singleAutocompleteBlueprintConfiguration: SingleAutoCompleteConfiguration = { - initialItems: (data?: any) => this.dmpBlueprintService.query(this.buildAutocompleteLookup(null, null, null, [DmpBlueprintStatus.Finalized])).pipe(map(x => x.items)), - filterFn: (searchQuery: string, data?: any) => this.dmpBlueprintService.query(this.buildAutocompleteLookup(searchQuery, null, null, [DmpBlueprintStatus.Finalized])).pipe(map(x => x.items)), - getSelectedItem: (selectedItem: any) => this.dmpBlueprintService.query(this.buildAutocompleteLookup(null, null, [selectedItem])).pipe(map(x => x.items[0])), - displayFn: (item: DmpBlueprint) => item.label, - subtitleFn: (item: DmpBlueprint) => this.language.instant('DMP-EDITOR.FIELDS.DMP-BLUEPRINT-VERSION') + ' '+ item.version, - titleFn: (item: DmpBlueprint) => item.label, - valueAssign: (item: DmpBlueprint) => item.id, + initialItems: (data?: any) => this.planBlueprintService.query(this.buildAutocompleteLookup(null, null, null, [PlanBlueprintStatus.Finalized])).pipe(map(x => x.items)), + filterFn: (searchQuery: string, data?: any) => this.planBlueprintService.query(this.buildAutocompleteLookup(searchQuery, null, null, [PlanBlueprintStatus.Finalized])).pipe(map(x => x.items)), + getSelectedItem: (selectedItem: any) => this.planBlueprintService.query(this.buildAutocompleteLookup(null, null, [selectedItem])).pipe(map(x => x.items[0])), + displayFn: (item: PlanBlueprint) => item.label, + subtitleFn: (item: PlanBlueprint) => this.language.instant('PLAN-EDITOR.FIELDS.PLAN-BLUEPRINT-VERSION') + ' '+ item.version, + titleFn: (item: PlanBlueprint) => item.label, + valueAssign: (item: PlanBlueprint) => item.id, }; - public buildAutocompleteLookup(like?: string, excludedIds?: Guid[], ids?: Guid[], statuses?: DmpBlueprintStatus[]): DmpBlueprintLookup { - const lookup: DmpBlueprintLookup = new DmpBlueprintLookup(); + public buildAutocompleteLookup(like?: string, excludedIds?: Guid[], ids?: Guid[], statuses?: PlanBlueprintStatus[]): PlanBlueprintLookup { + const lookup: PlanBlueprintLookup = new PlanBlueprintLookup(); lookup.page = { size: 100, offset: 0 }; if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; } if (ids && ids.length > 0) { lookup.ids = ids; } @@ -56,25 +56,25 @@ export class NewVersionDmpDialogComponent extends BaseComponent { lookup.statuses = statuses; lookup.project = { fields: [ - nameof(x => x.id), - nameof(x => x.label), - nameof(x => x.version), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.label)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.hasTemplates)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), + nameof(x => x.id), + nameof(x => x.label), + nameof(x => x.version), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.label)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.hasTemplates)].join('.'), + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), ] }; - lookup.order = { items: [nameof(x => x.label)] }; - lookup.versionStatuses = [DmpBlueprintVersionStatus.Previous, DmpBlueprintVersionStatus.Current]; + lookup.order = { items: [nameof(x => x.label)] }; + lookup.versionStatuses = [PlanBlueprintVersionStatus.Previous, PlanBlueprintVersionStatus.Current]; if (like) { lookup.like = this.filterService.transformLike(like); } return lookup; } constructor( - public dialogRef: MatDialogRef, - private dmpService: DmpService, - public dmpBlueprintService: DmpBlueprintService, + public dialogRef: MatDialogRef, + private planService: PlanService, + public planBlueprintService: PlanBlueprintService, private uiNotificationService: UiNotificationService, private httpErrorHandlingService: HttpErrorHandlingService, private language: TranslateService, @@ -83,18 +83,18 @@ export class NewVersionDmpDialogComponent extends BaseComponent { @Inject(MAT_DIALOG_DATA) public data: any ) { super(); - this.dmp = data.dmp; - this.dmp.dmpDescriptionTemplates = this.dmp.dmpDescriptionTemplates?.filter(x => x.isActive === IsActive.Active); + this.dmp = data.plan; + this.dmp.planDescriptionTemplates = this.dmp.planDescriptionTemplates?.filter(x => x.isActive === IsActive.Active); } get allDescriptionsNo(): number{ - const allDescriptionIds = (this.formGroup.get('descriptions').value as NewVersionDmpDescriptionPersist[]).map( x => x.descriptionId); + const allDescriptionIds = (this.formGroup.get('descriptions').value as NewVersionPlanDescriptionPersist[]).map( x => x.descriptionId); return allDescriptionIds?.length ?? 0; } get checkedDescrionsNo(): number { - const selectedDescriptionIds = (this.formGroup.get('descriptions').value as NewVersionDmpDescriptionPersist[]).filter(y => y.blueprintSectionId != undefined).map( x => x.descriptionId); + const selectedDescriptionIds = (this.formGroup.get('descriptions').value as NewVersionPlanDescriptionPersist[]).filter(y => y.blueprintSectionId != undefined).map( x => x.descriptionId); return selectedDescriptionIds?.length ?? 0; } @@ -114,7 +114,7 @@ export class NewVersionDmpDialogComponent extends BaseComponent { this.formGroup = this.editorModel.buildForm(); } - selectedBlueprintChanged(item: DmpBlueprint): void{ + selectedBlueprintChanged(item: PlanBlueprint): void{ this.selectedBlueprintSections = item.definition?.sections?.filter(x => x.hasTemplates) || null; if(this.selectedBlueprintSections && this.hasDescriptions()) { this.formGroup = this.editorModel.fromModel(this.dmp, item, this.formGroup.get('label').value, this.formGroup.get('description').value).buildForm(); @@ -127,7 +127,7 @@ export class NewVersionDmpDialogComponent extends BaseComponent { } patchSelectedDescriptions(descriptionsFormArray: FormArray, selectedDescriptionIds: string[]): void { - const descriptionIds = (this.formGroup.get('descriptions').value as NewVersionDmpDescriptionPersist[]).filter(y => y.blueprintSectionId != undefined).map( x => x.descriptionId); + const descriptionIds = (this.formGroup.get('descriptions').value as NewVersionPlanDescriptionPersist[]).filter(y => y.blueprintSectionId != undefined).map( x => x.descriptionId); if (selectedDescriptionIds.length > 0 && descriptionIds.length > 0){ if (selectedDescriptionIds.length < descriptionIds.length){ @@ -183,11 +183,11 @@ export class NewVersionDmpDialogComponent extends BaseComponent { confirm() { if (!this.formGroup.valid) { return; } - const formData = this.formService.getValue(this.formGroup.value) as NewVersionDmpPersist; + const formData = this.formService.getValue(this.formGroup.value) as NewVersionPlanPersist; if (formData.descriptions.length > 0){ formData.descriptions = formData.descriptions.filter(x => x.blueprintSectionId != null) } - this.dmpService.newVersion(formData, DmpEditorEntityResolver.lookupFields()).pipe(takeUntil(this._destroyed)).subscribe( + this.planService.newVersion(formData, PlanEditorEntityResolver.lookupFields()).pipe(takeUntil(this._destroyed)).subscribe( dmp => this.dialogRef.close(dmp), error => this.onCallbackError(error) ); diff --git a/dmp-frontend/src/app/ui/plan/new-version-dialog/plan-new-version-dialog.editor.model.ts b/dmp-frontend/src/app/ui/plan/new-version-dialog/plan-new-version-dialog.editor.model.ts index 01bf4ec6f..c3ea907f9 100644 --- a/dmp-frontend/src/app/ui/plan/new-version-dialog/plan-new-version-dialog.editor.model.ts +++ b/dmp-frontend/src/app/ui/plan/new-version-dialog/plan-new-version-dialog.editor.model.ts @@ -1,12 +1,12 @@ import { UntypedFormBuilder, UntypedFormGroup, Validators } from "@angular/forms"; -import { DmpBlueprint } from "@app/core/model/plan-blueprint/plan-blueprint"; -import { Dmp, NewVersionDmpDescriptionPersist, NewVersionDmpPersist } from "@app/core/model/plan/plan"; +import { PlanBlueprint } from "@app/core/model/plan-blueprint/plan-blueprint"; +import { Plan, NewVersionPlanDescriptionPersist, NewVersionPlanPersist } from "@app/core/model/plan/plan"; import { BackendErrorValidator } from '@common/forms/validation/custom-validator'; import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model'; import { Validation, ValidationContext } from '@common/forms/validation/validation-context'; import { Guid } from "@common/types/guid"; -export class DmpNewVersionDialogEditorModel implements NewVersionDmpPersist { +export class DmpNewVersionDialogEditorModel implements NewVersionPlanPersist { id: Guid; label: string; description: String; @@ -19,7 +19,7 @@ export class DmpNewVersionDialogEditorModel implements NewVersionDmpPersist { constructor() { } - public fromModel(item: Dmp, blueprint: DmpBlueprint, label?: string, description?: string): DmpNewVersionDialogEditorModel { + public fromModel(item: Plan, blueprint: PlanBlueprint, label?: string, description?: string): DmpNewVersionDialogEditorModel { if (item) { this.id = item.id; this.label = label != undefined ? label : item.label; @@ -32,9 +32,9 @@ export class DmpNewVersionDialogEditorModel implements NewVersionDmpPersist { // initialize because blueprint changed this.descriptions = []; - if (item.dmpDescriptionTemplates?.length > 0 && blueprint.id === item.blueprint.id) { // dmp's first blueprint + if (item.planDescriptionTemplates?.length > 0 && blueprint.id === item.blueprint.id) { // dmp's first blueprint item.descriptions.forEach(description => { - this.descriptions.push(new NewVersionDmpDescriptionEditorModel(this.validationErrorModel).fromModel(description.id, description.dmpDescriptionTemplate.sectionId)); + this.descriptions.push(new NewVersionDmpDescriptionEditorModel(this.validationErrorModel).fromModel(description.id, description.planDescriptionTemplate.sectionId)); }) } else { // in case the user changes the blueprint from the dropdown and the new blueprint has prefilled templates const selectedBlueprintSections = blueprint.definition?.sections?.filter(x => x.hasTemplates) || null; @@ -86,7 +86,7 @@ export class DmpNewVersionDialogEditorModel implements NewVersionDmpPersist { } } -export class NewVersionDmpDescriptionEditorModel implements NewVersionDmpDescriptionPersist { +export class NewVersionDmpDescriptionEditorModel implements NewVersionPlanDescriptionPersist { descriptionId: Guid; blueprintSectionId: Guid; diff --git a/dmp-frontend/src/app/ui/plan/new-version-dialog/plan-new-version-dialog.module.ts b/dmp-frontend/src/app/ui/plan/new-version-dialog/plan-new-version-dialog.module.ts index b61640eb1..6e40aacda 100644 --- a/dmp-frontend/src/app/ui/plan/new-version-dialog/plan-new-version-dialog.module.ts +++ b/dmp-frontend/src/app/ui/plan/new-version-dialog/plan-new-version-dialog.module.ts @@ -3,13 +3,13 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { AutoCompleteModule } from '@app/library/auto-complete/auto-complete.module'; import { RichTextEditorModule } from "@app/library/rich-text-editor/rich-text-editor.module"; import { CommonUiModule } from '@common/ui/common-ui.module'; -import { NewVersionDmpDialogComponent } from './plan-new-version-dialog.component'; +import { NewVersionPlanDialogComponent } from './plan-new-version-dialog.component'; @NgModule({ imports: [CommonUiModule, FormsModule, ReactiveFormsModule, AutoCompleteModule, RichTextEditorModule], - declarations: [NewVersionDmpDialogComponent], - exports: [NewVersionDmpDialogComponent] + declarations: [NewVersionPlanDialogComponent], + exports: [NewVersionPlanDialogComponent] }) -export class NewVersionDmpDialogModule { +export class NewVersionPlanDialogModule { constructor() { } } diff --git a/dmp-frontend/src/app/ui/plan/new/start-new-plan-dialogue/start-new-plan-dialog.component.html b/dmp-frontend/src/app/ui/plan/new/start-new-plan-dialogue/start-new-plan-dialog.component.html index b849f4509..dfc7c5794 100644 --- a/dmp-frontend/src/app/ui/plan/new/start-new-plan-dialogue/start-new-plan-dialog.component.html +++ b/dmp-frontend/src/app/ui/plan/new/start-new-plan-dialogue/start-new-plan-dialog.component.html @@ -45,7 +45,7 @@ {{'START-NEW-PLAN-DIALOG.IMPORT' | translate }} {{'START-NEW-PLAN-DIALOG.FUNCTION-SUPPORTS' | translate }} {{'START-NEW-PLAN-DIALOG.JSON-FILES' | translate }} {{'START-NEW-PLAN-DIALOG.PRODUCED' | translate }} - {{'START-NEW-PLAN-DIALOG.RDA-SPECIFICATIONS' | translate }} + {{'START-NEW-PLAN-DIALOG.RDA-SPECIFICATIONS' | translate }} {{'START-NEW-PLAN-DIALOG.MACHINE-ACTIONABLE' | translate }}
    diff --git a/dmp-frontend/src/app/ui/plan/new/start-new-plan-dialogue/start-new-plan-dialog.component.ts b/dmp-frontend/src/app/ui/plan/new/start-new-plan-dialogue/start-new-plan-dialog.component.ts index 9dfbafb74..cde901968 100644 --- a/dmp-frontend/src/app/ui/plan/new/start-new-plan-dialogue/start-new-plan-dialog.component.ts +++ b/dmp-frontend/src/app/ui/plan/new/start-new-plan-dialogue/start-new-plan-dialog.component.ts @@ -2,7 +2,7 @@ import { HttpClient } from '@angular/common/http'; import { Component, Inject } from '@angular/core'; import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog'; import { Router } from '@angular/router'; -import { DmpService } from '@app/core/services/plan/plan.service'; +import { PlanService } from '@app/core/services/plan/plan.service'; import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service'; import { BaseComponent } from '@common/base/base.component'; import { TranslateService } from '@ngx-translate/core'; @@ -16,18 +16,18 @@ import { RouterUtilsService } from '@app/core/services/router/router-utils.servi templateUrl: './start-new-plan-dialog.component.html', styleUrls: ['./start-new-plan-dialog.component.scss'] }) -export class StartNewDmpDialogComponent extends BaseComponent { +export class StartNewPlanDialogComponent extends BaseComponent { public isDialog: boolean = false; constructor( - public dialogRef: MatDialogRef, + public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public data: any, private router: Router, public dialog: MatDialog, private uiNotificationService: UiNotificationService, private language: TranslateService, - private dmpService: DmpService, + private planService: PlanService, private httpClient: HttpClient, private analyticsService: AnalyticsService, private routerUtils: RouterUtilsService @@ -37,7 +37,7 @@ export class StartNewDmpDialogComponent extends BaseComponent { } ngOnInit() { - this.analyticsService.trackPageView(AnalyticsService.StartNewDmpDialog); + this.analyticsService.trackPageView(AnalyticsService.StartNewPlanDialog); } cancel() { @@ -63,14 +63,14 @@ export class StartNewDmpDialogComponent extends BaseComponent { data: { fileList: FileList, success: Boolean, - dmpTitle: String + planTitle: String } }); dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { if (result && result.success) { const file = result.fileList[0] as File; if (file?.type.includes('/xml')){ - this.dmpService.uploadXml(result.fileList[0], result.dmpTitle) + this.planService.uploadXml(result.fileList[0], result.planTitle) .pipe(takeUntil(this._destroyed)) .subscribe( (complete) => { @@ -79,8 +79,8 @@ export class StartNewDmpDialogComponent extends BaseComponent { }, (error) => this.onCallbackImportFail(error.error) ); - } else if (file?.type.includes('/json') && result.dmpCommonModelConfig){ - this.dmpService.uploadJson(result.dmpCommonModelConfig) + } else if (file?.type.includes('/json') && result.planCommonModelConfig){ + this.planService.uploadJson(result.planCommonModelConfig) .pipe(takeUntil(this._destroyed)) .subscribe( (complete) => { @@ -95,7 +95,7 @@ export class StartNewDmpDialogComponent extends BaseComponent { } private onCallbackImportComplete() { - this.uiNotificationService.snackBarNotification(this.language.instant('DMP-UPLOAD.UPLOAD-SUCCESS'), SnackBarNotificationLevel.Success); + this.uiNotificationService.snackBarNotification(this.language.instant('PLAN-UPLOAD.UPLOAD-SUCCESS'), SnackBarNotificationLevel.Success); this.router.navigate(['/reload']).then(() => this.router.navigate([this.routerUtils.generateUrl('/plans')])); } diff --git a/dmp-frontend/src/app/ui/plan/new/start-new-plan-dialogue/start-new-plan-dialog.module.ts b/dmp-frontend/src/app/ui/plan/new/start-new-plan-dialogue/start-new-plan-dialog.module.ts index d9614feac..c7078aec9 100644 --- a/dmp-frontend/src/app/ui/plan/new/start-new-plan-dialogue/start-new-plan-dialog.module.ts +++ b/dmp-frontend/src/app/ui/plan/new/start-new-plan-dialogue/start-new-plan-dialog.module.ts @@ -3,7 +3,7 @@ import { FormattingModule } from '@app/core/formatting.module'; import { CommonFormsModule } from '@common/forms/common-forms.module'; import { CommonUiModule } from '@common/ui/common-ui.module'; import { DmpUploadDialogModule } from '../upload-dialogue/plan-upload-dialog.module'; -import { StartNewDmpDialogComponent } from './start-new-plan-dialog.component'; +import { StartNewPlanDialogComponent } from './start-new-plan-dialog.component'; @NgModule({ imports: [ @@ -13,10 +13,10 @@ import { StartNewDmpDialogComponent } from './start-new-plan-dialog.component'; DmpUploadDialogModule ], declarations: [ - StartNewDmpDialogComponent, + StartNewPlanDialogComponent, ], exports: [ - StartNewDmpDialogComponent, + StartNewPlanDialogComponent, ] }) -export class StartNewDmpDialogModule { } +export class StartNewPlanDialogModule { } diff --git a/dmp-frontend/src/app/ui/plan/new/upload-dialogue/plan-common-model-config.editor.model.ts b/dmp-frontend/src/app/ui/plan/new/upload-dialogue/plan-common-model-config.editor.model.ts index d5f9937b1..e903b2c1a 100644 --- a/dmp-frontend/src/app/ui/plan/new/upload-dialogue/plan-common-model-config.editor.model.ts +++ b/dmp-frontend/src/app/ui/plan/new/upload-dialogue/plan-common-model-config.editor.model.ts @@ -3,10 +3,10 @@ import { BackendErrorValidator } from "@common/forms/validation/custom-validator import { ValidationErrorModel } from "@common/forms/validation/error-model/validation-error-model"; import { Validation, ValidationContext } from "@common/forms/validation/validation-context"; import { Guid } from "@common/types/guid"; -import { DmpCommonModelConfig, PreprocessingDmpModel } from "@app/core/model/plan/plan-import"; +import { PlanCommonModelConfig, PreprocessingPlanModel } from "@app/core/model/plan/plan-import"; import { DescriptionCommonModelConfig, PreprocessingDescriptionModel } from "@app/core/model/description/description-import"; -export class DmpImportRdaConfigEditorModel implements DmpCommonModelConfig{ +export class DmpImportRdaConfigEditorModel implements PlanCommonModelConfig{ fileId: Guid; label: string; blueprintId: Guid; @@ -18,7 +18,7 @@ export class DmpImportRdaConfigEditorModel implements DmpCommonModelConfig{ constructor() { } - fromModel(item: PreprocessingDmpModel, fileId: Guid): DmpImportRdaConfigEditorModel { + fromModel(item: PreprocessingPlanModel, fileId: Guid): DmpImportRdaConfigEditorModel { this.fileId = fileId; if (item){ this.label = item.label + '.json'; diff --git a/dmp-frontend/src/app/ui/plan/new/upload-dialogue/plan-upload-dialog.component.html b/dmp-frontend/src/app/ui/plan/new/upload-dialogue/plan-upload-dialog.component.html index 886ebf8b7..885238c93 100644 --- a/dmp-frontend/src/app/ui/plan/new/upload-dialogue/plan-upload-dialog.component.html +++ b/dmp-frontend/src/app/ui/plan/new/upload-dialogue/plan-upload-dialog.component.html @@ -1,7 +1,7 @@
    -

    {{'DMP-UPLOAD.TITLE' | translate}}

    +

    {{'PLAN-UPLOAD.TITLE' | translate}}

    close @@ -12,7 +12,7 @@
    - +
    @@ -25,23 +25,23 @@
    - {{ 'DMP-UPLOAD.ANALYZING-FILE' | translate }} + {{ 'PLAN-UPLOAD.ANALYZING-FILE' | translate }}
    - + - + @@ -53,16 +53,16 @@
    - {{'DMP-UPLOAD.FIELDS.DESCRIPTION-TEMPLATE' | translate}} - + {{'PLAN-UPLOAD.FIELDS.DESCRIPTION-TEMPLATE' | translate}} + {{description.get('templateId').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}}
    - {{'DMP-UPLOAD.FIELDS.SECTION' | translate}} - + {{'PLAN-UPLOAD.FIELDS.SECTION' | translate}} + {{ section.label }} @@ -79,10 +79,10 @@
    - +
    - +
    diff --git a/dmp-frontend/src/app/ui/plan/new/upload-dialogue/plan-upload-dialog.component.ts b/dmp-frontend/src/app/ui/plan/new/upload-dialogue/plan-upload-dialog.component.ts index c07e97e97..600bde1b4 100644 --- a/dmp-frontend/src/app/ui/plan/new/upload-dialogue/plan-upload-dialog.component.ts +++ b/dmp-frontend/src/app/ui/plan/new/upload-dialogue/plan-upload-dialog.component.ts @@ -2,9 +2,9 @@ import { HttpClient } from '@angular/common/http'; import { Component, Inject } from '@angular/core'; import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog'; import { DescriptionTemplate } from '@app/core/model/description-template/description-template'; -import { DmpBlueprint, DmpBlueprintDefinitionSection } from '@app/core/model/plan-blueprint/plan-blueprint'; -import { DmpBlueprintService } from '@app/core/services/plan/plan-blueprint.service'; -import { DmpService } from '@app/core/services/plan/plan.service'; +import { PlanBlueprint, PlanBlueprintDefinitionSection } from '@app/core/model/plan-blueprint/plan-blueprint'; +import { PlanBlueprintService } from '@app/core/services/plan/plan-blueprint.service'; +import { PlanService } from '@app/core/services/plan/plan.service'; import { AnalyticsService } from '@app/core/services/matomo/analytics-service'; import { BaseComponent } from '@common/base/base.component'; import { map, takeUntil } from 'rxjs/operators'; @@ -12,7 +12,7 @@ import { DmpImportRdaConfigEditorModel } from './plan-common-model-config.editor import { UntypedFormArray, UntypedFormGroup } from '@angular/forms'; import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service'; import { FormService } from '@common/forms/form-service'; -import { DmpCommonModelConfig } from '@app/core/model/plan/plan-import'; +import { PlanCommonModelConfig } from '@app/core/model/plan/plan-import'; import { StorageFileService } from '@app/core/services/storage-file/storage-file.service'; import { IsActive } from '@notification-service/core/enum/is-active.enum'; import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration'; @@ -25,10 +25,10 @@ import { TranslateService } from '@ngx-translate/core'; styleUrls: ['./plan-upload-dialog.component.scss'] }) export class DmpUploadDialogComponent extends BaseComponent { - dmpTitle: string; + planTitle: string; dmpBlueprints: any[] = []; files: File[] = []; - selectedBlueprintSections: DmpBlueprintDefinitionSection[]; + selectedBlueprintSections: PlanBlueprintDefinitionSection[]; formGroup: UntypedFormGroup; descriptionTemplateSingleAutocompleteConfiguration: SingleAutoCompleteConfiguration = { @@ -45,14 +45,14 @@ export class DmpUploadDialogComponent extends BaseComponent { constructor( public dialogRef: MatDialogRef, - private _service: DmpService, + private _service: PlanService, private dialog: MatDialog, private httpClient: HttpClient, private analyticsService: AnalyticsService, private formService: FormService, public descriptionTemplateService: DescriptionTemplateService, - public dmpBlueprintService: DmpBlueprintService, - private dmpService: DmpService, + public planBlueprintService: PlanBlueprintService, + private planService: PlanService, private storageFileStorage: StorageFileService, private uiNotificationService: UiNotificationService, private language: TranslateService, @@ -77,15 +77,15 @@ export class DmpUploadDialogComponent extends BaseComponent { confirm() { this.data.success = true; - this.data.dmpTitle = this.dmpTitle; - this.data.dmpBlueprints = this.dmpBlueprints; + this.data.planTitle = this.planTitle; + this.data.planBlueprints = this.dmpBlueprints; if (this.files.length > 0 && this.files[0].type.includes('/json') && this.formGroup){ this.formService.removeAllBackEndErrors(this.formGroup); this.formService.touchAllFormFields(this.formGroup); if (this.formGroup.valid){ - this.data.dmpCommonModelConfig = this.formService.getValue(this.formGroup.value) as DmpCommonModelConfig; - this.data.dmpCommonModelConfig.file = this.files[0]; + this.data.planCommonModelConfig = this.formService.getValue(this.formGroup.value) as PlanCommonModelConfig; + this.data.planCommonModelConfig.file = this.files[0]; } else { return; } @@ -104,7 +104,7 @@ export class DmpUploadDialogComponent extends BaseComponent { const fileList: FileList = event.target.files this.data.fileList = fileList; if (this.data.fileList.length > 0) { - this.dmpTitle = fileList.item(0).name; + this.planTitle = fileList.item(0).name; } if (this.files.length === 1) { this.files.splice(0, 1); @@ -117,7 +117,7 @@ export class DmpUploadDialogComponent extends BaseComponent { .subscribe( (storageFile) => { if (storageFile.length >0 ){ - this.dmpService.preprocessingDmp(storageFile[0].id, 'rda-file-transformer') + this.planService.preprocessingPlan(storageFile[0].id, 'rda-file-transformer') .pipe(takeUntil(this._destroyed)) .subscribe( (preprocessingData) => { @@ -138,7 +138,7 @@ export class DmpUploadDialogComponent extends BaseComponent { const fileList: FileList = event.addedFiles this.data.fileList = fileList; if (this.data.fileList.length > 0) { - this.dmpTitle = fileList[0].name; + this.planTitle = fileList[0].name; } if (this.files.length === 1) { this.files.splice(0, 1); @@ -148,11 +148,11 @@ export class DmpUploadDialogComponent extends BaseComponent { onRemove(event) { this.files.splice(0, 1); - this.dmpTitle = null; + this.planTitle = null; this.formGroup = null; } - selectedBlueprintChanged(item: DmpBlueprint): void{ + selectedBlueprintChanged(item: PlanBlueprint): void{ this.selectedBlueprintSections = item.definition?.sections?.filter(x => x.hasTemplates) || null; if (this.formGroup){ const descriptionsFormArray = this.formGroup.get('descriptions') as UntypedFormArray; diff --git a/dmp-frontend/src/app/ui/plan/overview/plan-overview.component.html b/dmp-frontend/src/app/ui/plan/overview/plan-overview.component.html index 0e38886e0..4b041ce2b 100644 --- a/dmp-frontend/src/app/ui/plan/overview/plan-overview.component.html +++ b/dmp-frontend/src/app/ui/plan/overview/plan-overview.component.html @@ -8,101 +8,101 @@
    -
    +
    {{ dmp.label }}
    -

    {{ enumUtils.toDmpUserRolesString(dmpService.getCurrentUserRolesInDmp(dmp?.dmpUsers)) }} +

    {{ enumUtils.toPlanUserRolesString(planService.getCurrentUserRolesInPlan(dmp?.planUsers)) }}

    .
    public - {{'DMP-OVERVIEW.PUBLIC' | translate}} + {{'PLAN-OVERVIEW.PUBLIC' | translate}}
    .
    lock_outline - {{'DMP-OVERVIEW.LOCKED' | translate}} + {{'PLAN-OVERVIEW.LOCKED' | translate}}
    - - - {{'DMP-OVERVIEW.VERSION' | translate}} {{version.version}} + + + {{'PLAN-OVERVIEW.VERSION' | translate}} {{version.version}}
    -
    {{'DMP-OVERVIEW.EDITED' | translate}} : +
    {{'PLAN-OVERVIEW.EDITED' | translate}} : {{dmp.updatedAt | dateTimeFormatter: "d MMMM y"}}
    -
    +
    check - {{'DMP-OVERVIEW.FINALISED' | translate}} + {{'PLAN-OVERVIEW.FINALISED' | translate}}
    -
    - -
    -
    -
    -
    -
    -
    -
    - -
    {{'DMP-OVERVIEW.GRANT' | translate}}
    -
    {{referenceService.getReferencesForTypesFirstSafe(dmp?.dmpReferences, [this.referenceTypeService.getGrantReferenceType()])?.reference?.label}}
    + +
    {{'PLAN-OVERVIEW.GRANT' | translate}}
    +
    {{referenceService.getReferencesForTypesFirstSafe(dmp?.planReferences, [this.referenceTypeService.getGrantReferenceType()])?.reference?.label}}
    {{'DESCRIPTION-OVERVIEW.RESEARCHERS' | translate}}
    - - + + - +
    - {{ dmpReference.reference?.label }},  - {{ dmpReference.reference?.label }} + {{ planReference.reference?.label }},  + {{ planReference.reference?.label }}
    horizontal_rule
    -
    {{'DMP-OVERVIEW.DESCRIPTION' | translate}}
    +
    {{'PLAN-OVERVIEW.DESCRIPTION' | translate}}

    @@ -113,7 +113,7 @@ horizontal_rule
    -
    {{'DMP-OVERVIEW.DESCRIPTIONS' | translate}}
    +
    {{'PLAN-OVERVIEW.DESCRIPTIONS' | translate}}
    @@ -135,7 +135,7 @@
    -
    {{'DMP-OVERVIEW.DOI-PROVIDED' | translate}}:
    +
    {{'PLAN-OVERVIEW.DOI-PROVIDED' | translate}}:
    @@ -155,10 +155,10 @@ {{selectedModel.doi}}
    - -
    -

    {{ 'DMP-OVERVIEW.ACTIONS.FINALIZE' | translate }}

    +

    {{ 'PLAN-OVERVIEW.ACTIONS.FINALIZE' | translate }}

    @@ -191,8 +191,8 @@
    - - + +
    -

    {{ 'DMP-OVERVIEW.ACTIONS.REVERSE' | translate }}

    +

    {{ 'PLAN-OVERVIEW.ACTIONS.REVERSE' | translate }}

    - +
    -

    {{ 'DMP-OVERVIEW.ACTIONS.EXPORT' | translate }}

    +

    {{ 'PLAN-OVERVIEW.ACTIONS.EXPORT' | translate }}

    @@ -224,7 +224,7 @@
    -

    {{ 'DMP-OVERVIEW.ACTIONS.NEW-VERSION' | translate }}

    +

    {{ 'PLAN-OVERVIEW.ACTIONS.NEW-VERSION' | translate }}

    @@ -242,42 +242,42 @@
    -

    {{ 'DMP-OVERVIEW.DMP-AUTHORS' | translate }}

    +

    {{ 'PLAN-OVERVIEW.PLAN-AUTHORS' | translate }}

    -
    +
    - -

    {{ dmpUser.user?.name }}

    + +

    {{ planUser.user?.name }}

    {{ userName }} - ({{ 'DMP-OVERVIEW.YOU' | translate }}) + ({{ 'PLAN-OVERVIEW.YOU' | translate }})

    - {{ enumUtils.toDmpUserRoleString(dmpUser.role) }} - - {{ 'DMP-OVERVIEW.ROLES.ALL-SECTIONS' | translate}} - {{ getSectionNameById(dmpUser.sectionId) }} + {{ enumUtils.toPlanUserRoleString(planUser.role) }} - + {{ 'PLAN-OVERVIEW.ROLES.ALL-SECTIONS' | translate}} + {{ getSectionNameById(planUser.sectionId) }}

    -
    -
    -
    +
    diff --git a/dmp-frontend/src/app/ui/plan/overview/plan-overview.component.ts b/dmp-frontend/src/app/ui/plan/overview/plan-overview.component.ts index 825266ad0..e47758847 100644 --- a/dmp-frontend/src/app/ui/plan/overview/plan-overview.component.ts +++ b/dmp-frontend/src/app/ui/plan/overview/plan-overview.component.ts @@ -3,19 +3,19 @@ import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { ActivatedRoute, Params, Router } from '@angular/router'; import { DescriptionStatus } from '@app/core/common/enum/description-status'; -import { DmpAccessType } from '@app/core/common/enum/plan-access-type'; -import { DmpStatus } from '@app/core/common/enum/plan-status'; -import { DmpUserRole } from '@app/core/common/enum/plan-user-role'; -import { DmpVersionStatus } from '@app/core/common/enum/plan-version-status'; +import { PlanAccessType } from '@app/core/common/enum/plan-access-type'; +import { PlanStatus } from '@app/core/common/enum/plan-status'; +import { PlanUserRole } from '@app/core/common/enum/plan-user-role'; +import { PlanVersionStatus } from '@app/core/common/enum/plan-version-status'; import { FileTransformerEntityType } from '@app/core/common/enum/file-transformer-entity-type'; import { IsActive } from '@app/core/common/enum/is-active.enum'; import { AppPermission } from '@app/core/common/enum/permission.enum'; import { DepositConfiguration } from '@app/core/model/deposit/deposit-configuration'; import { DescriptionTemplate } from '@app/core/model/description-template/description-template'; import { Description } from '@app/core/model/description/description'; -import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/plan-blueprint/plan-blueprint'; -import { Dmp, DmpDescriptionTemplate, DmpUser, DmpUserRemovePersist } from '@app/core/model/plan/plan'; -import { DmpReference } from '@app/core/model/plan/plan-reference'; +import { DescriptionTemplatesInSection, PlanBlueprint, PlanBlueprintDefinition, PlanBlueprintDefinitionSection } from '@app/core/model/plan-blueprint/plan-blueprint'; +import { Plan, PlanDescriptionTemplate, PlanUser, PlanUserRemovePersist } from '@app/core/model/plan/plan'; +import { PlanReference } from '@app/core/model/plan/plan-reference'; import { EntityDoi } from '@app/core/model/entity-doi/entity-doi'; import { ReferenceType } from '@app/core/model/reference-type/reference-type'; import { Reference } from '@app/core/model/reference/reference'; @@ -23,8 +23,8 @@ import { User } from '@app/core/model/user/user'; import { AuthService } from '@app/core/services/auth/auth.service'; import { ConfigurationService } from '@app/core/services/configuration/configuration.service'; import { DepositService } from '@app/core/services/deposit/deposit.service'; -import { DmpBlueprintService } from '@app/core/services/plan/plan-blueprint.service'; -import { DmpService } from '@app/core/services/plan/plan.service'; +import { PlanBlueprintService } from '@app/core/services/plan/plan-blueprint.service'; +import { PlanService } from '@app/core/services/plan/plan.service'; import { FileTransformerService } from '@app/core/services/file-transformer/file-transformer.service'; import { LockService } from '@app/core/services/lock/lock.service'; import { AnalyticsService } from '@app/core/services/matomo/analytics-service'; @@ -43,12 +43,12 @@ import { Guid } from '@common/types/guid'; import { TranslateService } from '@ngx-translate/core'; import { map, takeUntil } from 'rxjs/operators'; import { nameof } from 'ts-simple-nameof'; -import { CloneDmpDialogComponent } from '../clone-dialog/plan-clone-dialog.component'; +import { ClonePlanDialogComponent } from '../clone-dialog/plan-clone-dialog.component'; import { DmpDeleteDialogComponent } from '../plan-delete-dialog/plan-delete-dialog.component'; -import { DmpEditorEntityResolver } from '../plan-editor-blueprint/resolvers/plan-editor-enitity.resolver'; -import { DmpFinalizeDialogComponent, DmpFinalizeDialogOutput } from '../plan-finalize-dialog/plan-finalize-dialog.component'; +import { PlanEditorEntityResolver } from '../plan-editor-blueprint/resolvers/plan-editor-enitity.resolver'; +import { PlanFinalizeDialogComponent, PlanFinalizeDialogOutput } from '../plan-finalize-dialog/plan-finalize-dialog.component'; import { DmpInvitationDialogComponent } from '../invitation/dialog/plan-invitation-dialog.component'; -import { NewVersionDmpDialogComponent } from '../new-version-dialog/plan-new-version-dialog.component'; +import { NewVersionPlanDialogComponent } from '../new-version-dialog/plan-new-version-dialog.component'; import { RouterUtilsService } from '@app/core/services/router/router-utils.service'; @Component({ @@ -59,9 +59,9 @@ import { RouterUtilsService } from '@app/core/services/router/router-utils.servi export class DmpOverviewComponent extends BaseComponent implements OnInit { dmp: any; - selectedBlueprint: DmpBlueprint; + selectedBlueprint: PlanBlueprint; selectedDmpVersion: any; - researchers: DmpReference[] = []; + researchers: PlanReference[] = []; isNew = true; isFinalized = false; isPublicView = true; @@ -77,9 +77,9 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { depositRepos: DepositConfiguration[] = []; descriptionStatusEnum = DescriptionStatus; - dmpAccessTypeEnum = DmpAccessType; - dmpStatusEnum = DmpStatus; - dmpUserRoleEnum = DmpUserRole; + planAccessTypeEnum = PlanAccessType; + planStatusEnum = PlanStatus; + planUserRoleEnum = PlanUserRole; authorFocus: string; userName: string; @@ -88,8 +88,8 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { public routerUtils: RouterUtilsService, private route: ActivatedRoute, private router: Router, - private dmpService: DmpService, - private dmpBlueprintService: DmpBlueprintService, + private planService: PlanService, + private planBlueprintService: PlanBlueprintService, private depositRepositoriesService: DepositService, private translate: TranslateService, private authentication: AuthService, @@ -123,16 +123,16 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { if (itemId != null) { this.isNew = false; this.isPublicView = false; - this.dmpService.getSingle(itemId, this.lookupFields()) + this.planService.getSingle(itemId, this.lookupFields()) .pipe(takeUntil(this._destroyed)) .subscribe(data => { this.breadcrumbService.addIdResolvedValue(data.id?.toString(), data.label); this.dmp = data; - this.dmp.dmpUsers = data.dmpUsers.filter(x => x.isActive === IsActive.Active); - this.dmp.otherDmpVersions = data.otherDmpVersions?.filter(x => x.isActive === IsActive.Active) || null; + this.dmp.planUsers = data.planUsers.filter(x => x.isActive === IsActive.Active); + this.dmp.otherPlanVersions = data.otherPlanVersions?.filter(x => x.isActive === IsActive.Active) || null; if (this.dmp.descriptions) { - if (this.dmp.status == DmpStatus.Finalized) { + if (this.dmp.status == PlanStatus.Finalized) { this.dmp.descriptions = data.descriptions.filter(x => x.isActive === IsActive.Active && x.status === DescriptionStatus.Finalized); } else { this.dmp.descriptions = data.descriptions.filter(x => x.isActive === IsActive.Active && x.status !== DescriptionStatus.Canceled); @@ -140,7 +140,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { } if (data.entityDois && data.entityDois.length > 0) this.dmp.entityDois = data.entityDois.filter(x => x.isActive === IsActive.Active); this.selectedBlueprint = data.blueprint; - this.researchers = this.referenceService.getReferencesForTypes(this.dmp?.dmpReferences, [this.referenceTypeService.getResearcherReferenceType()]); + this.researchers = this.referenceService.getReferencesForTypes(this.dmp?.planReferences, [this.referenceTypeService.getResearcherReferenceType()]); if (!this.hasDoi()) { this.selectedModel = this.dmp.entityDois[0]; } @@ -166,14 +166,14 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { this.isNew = false; this.isFinalized = true; this.isPublicView = true; - this.dmpService.getPublicSingle(publicId, this.lookupFields()) + this.planService.getPublicSingle(publicId, this.lookupFields()) .pipe(takeUntil(this._destroyed)) .subscribe(data => { this.breadcrumbService.addExcludedParam('public', true); this.breadcrumbService.addIdResolvedValue(data.id?.toString(), data.label); this.dmp = data; - this.researchers = this.referenceService.getReferencesForTypes(this.dmp?.dmpReferences, [this.referenceTypeService.getResearcherReferenceType()]); + this.researchers = this.referenceService.getReferencesForTypes(this.dmp?.planReferences, [this.referenceTypeService.getResearcherReferenceType()]); if (!this.hasDoi()) { this.selectedModel = this.dmp.entityDois[0]; } @@ -217,7 +217,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { } get unauthorizedTootipText(): string { - return this.language.instant('DMP-OVERVIEW.INFOS.UNAUTHORIZED-ORCID'); + return this.language.instant('PLAN-OVERVIEW.INFOS.UNAUTHORIZED-ORCID'); } onFetchingDeletedCallbackError(redirectRoot: string) { @@ -247,40 +247,40 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { return `${dmpUserId}-${order}` == this.authorFocus; } - canEditDmp(): boolean { - return (this.isDraftDmp()) && (this.dmp.authorizationFlags?.some(x => x === AppPermission.EditDmp) || this.authentication.hasPermission(AppPermission.EditDmp)) && this.isPublicView == false && this.dmp.belongsToCurrentTenant != false; + canEditPlan(): boolean { + return (this.isDraftDmp()) && (this.dmp.authorizationFlags?.some(x => x === AppPermission.EditPlan) || this.authentication.hasPermission(AppPermission.EditPlan)) && this.isPublicView == false && this.dmp.belongsToCurrentTenant != false; } canCreateNewVersion(): boolean { - return (this.dmp.authorizationFlags?.some(x => x === AppPermission.CreateNewVersionDmp) || this.authentication.hasPermission(AppPermission.CreateNewVersionDmp)) && this.dmp.versionStatus === DmpVersionStatus.Current && this.isPublicView == false && this.dmp.belongsToCurrentTenant != false; + return (this.dmp.authorizationFlags?.some(x => x === AppPermission.CreateNewVersionPlan) || this.authentication.hasPermission(AppPermission.CreateNewVersionPlan)) && this.dmp.versionStatus === PlanVersionStatus.Current && this.isPublicView == false && this.dmp.belongsToCurrentTenant != false; } - canDeleteDmp(): boolean { - return (this.dmp.authorizationFlags?.some(x => x === AppPermission.DeleteDmp) || this.authentication.hasPermission(AppPermission.DeleteDmp)) && this.isPublicView == false && this.dmp.belongsToCurrentTenant != false; + canDeletePlan(): boolean { + return (this.dmp.authorizationFlags?.some(x => x === AppPermission.DeletePlan) || this.authentication.hasPermission(AppPermission.DeletePlan)) && this.isPublicView == false && this.dmp.belongsToCurrentTenant != false; } - canCloneDmp(): boolean { - return (this.dmp.authorizationFlags?.some(x => x === AppPermission.CloneDmp) || this.authentication.hasPermission(AppPermission.CloneDmp)); + canClonePlan(): boolean { + return (this.dmp.authorizationFlags?.some(x => x === AppPermission.ClonePlan) || this.authentication.hasPermission(AppPermission.ClonePlan)); } - canFinalizeDmp(): boolean { - return (this.dmp.authorizationFlags?.some(x => x === AppPermission.FinalizeDmp) || this.authentication.hasPermission(AppPermission.FinalizeDmp)) && this.isPublicView == false && this.dmp.belongsToCurrentTenant != false; + canFinalizePlan(): boolean { + return (this.dmp.authorizationFlags?.some(x => x === AppPermission.FinalizePlan) || this.authentication.hasPermission(AppPermission.FinalizePlan)) && this.isPublicView == false && this.dmp.belongsToCurrentTenant != false; } - canExportDmp(): boolean { - return (this.dmp.authorizationFlags?.some(x => x === AppPermission.ExportDmp) || this.authentication.hasPermission(AppPermission.ExportDmp)); + canExportPlan(): boolean { + return (this.dmp.authorizationFlags?.some(x => x === AppPermission.ExportPlan) || this.authentication.hasPermission(AppPermission.ExportPlan)); } - canInviteDmpUsers(): boolean { - return (this.dmp.authorizationFlags?.some(x => x === AppPermission.InviteDmpUsers) || this.authentication.hasPermission(AppPermission.InviteDmpUsers)) && this.isPublicView == false && this.dmp.belongsToCurrentTenant != false; + canInvitePlanUsers(): boolean { + return (this.dmp.authorizationFlags?.some(x => x === AppPermission.InvitePlanUsers) || this.authentication.hasPermission(AppPermission.InvitePlanUsers)) && this.isPublicView == false && this.dmp.belongsToCurrentTenant != false; } - canAssignDmpUsers(): boolean { - return (this.dmp.authorizationFlags?.some(x => x === AppPermission.AssignDmpUsers) || this.authentication.hasPermission(AppPermission.AssignDmpUsers)) && this.isPublicView == false && this.dmp.belongsToCurrentTenant != false; + canAssignPlanUsers(): boolean { + return (this.dmp.authorizationFlags?.some(x => x === AppPermission.AssignPlanUsers) || this.authentication.hasPermission(AppPermission.AssignPlanUsers)) && this.isPublicView == false && this.dmp.belongsToCurrentTenant != false; } - canDepositDmp(): boolean { - return (this.dmp.authorizationFlags?.some(x => x === AppPermission.DepositDmp) || this.authentication.hasPermission(AppPermission.DepositDmp)) && this.isPublicView == false && this.dmp.belongsToCurrentTenant != false; + canDepositPlan(): boolean { + return (this.dmp.authorizationFlags?.some(x => x === AppPermission.DepositPlan) || this.authentication.hasPermission(AppPermission.DepositPlan)) && this.isPublicView == false && this.dmp.belongsToCurrentTenant != false; } @@ -289,14 +289,14 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { } cloneClicked() { - const dialogRef = this.dialog.open(CloneDmpDialogComponent, { + const dialogRef = this.dialog.open(ClonePlanDialogComponent, { maxWidth: '700px', maxHeight: '80vh', data: { - dmp: this.dmp + plan: this.dmp } }); - dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe((result: Dmp) => { + dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe((result: Plan) => { if (result) { this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success); this.router.navigate([this.routerUtils.generateUrl(['/plans/edit', result.id.toString()], '/')]); @@ -305,14 +305,14 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { } newVersionClicked() { - const dialogRef = this.dialog.open(NewVersionDmpDialogComponent, { + const dialogRef = this.dialog.open(NewVersionPlanDialogComponent, { maxWidth: '700px', maxHeight: '80vh', data: { - dmp: this.dmp + plan: this.dmp } }); - dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe((result: Dmp) => { + dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe((result: Plan) => { if (result) { this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success); this.router.navigate([this.routerUtils.generateUrl(['/plans/edit', result.id.toString()], '/')]); @@ -343,7 +343,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { if (result) { - this.dmpService.delete(this.dmp.id) + this.planService.delete(this.dmp.id) .pipe(takeUntil(this._destroyed)) .subscribe( complete => { this.onDeleteCallbackSuccess() }, @@ -373,19 +373,19 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { isUserDmpRelated(): boolean { const principalId: Guid = this.authentication.userId(); - return this.dmp.dmpUsers?.some(x => (x.user.id === principalId)); + return this.dmp.planUsers?.some(x => (x.user.id === principalId)); } isDraftDmp() { - return this.dmp.status == DmpStatus.Draft; + return this.dmp.status == PlanStatus.Draft; } - isFinalizedDmp(dmp: Dmp) { - return dmp.status == DmpStatus.Finalized; + isFinalizedDmp(dmp: Plan) { + return dmp.status == PlanStatus.Finalized; } isPublishedDmp() { - return (this.dmp.status == DmpStatus.Finalized && this.dmp.accessType === DmpAccessType.Public); + return (this.dmp.status == PlanStatus.Finalized && this.dmp.accessType === PlanAccessType.Public); } hasDoi() { @@ -408,18 +408,18 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { } finalize() { - const dialogRef = this.dialog.open(DmpFinalizeDialogComponent, { + const dialogRef = this.dialog.open(PlanFinalizeDialogComponent, { maxWidth: '500px', restoreFocus: false, autoFocus: false, data: { - dmp: this.dmp + plan: this.dmp } }); - dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe((result: DmpFinalizeDialogOutput) => { + dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe((result: PlanFinalizeDialogOutput) => { if (result && !result.cancelled) { - this.dmpService.finalize(this.dmp.id, result.descriptionsToBeFinalized) + this.planService.finalize(this.dmp.id, result.descriptionsToBeFinalized) .pipe(takeUntil(this._destroyed)) .subscribe(data => { this.reloadPage(); @@ -451,7 +451,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { autoFocus: false, restoreFocus: false, data: { - dmpId: rowId, + planId: rowId, dmpName: rowName, blueprint: this.selectedBlueprint } @@ -480,15 +480,15 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { const dialogRef = this.dialog.open(ConfirmationDialogComponent, { restoreFocus: false, data: { - message: this.language.instant('DMP-OVERVIEW.UNDO-FINALIZATION-DIALOG.TITLE'), - confirmButton: this.language.instant('DMP-OVERVIEW.UNDO-FINALIZATION-DIALOG.CONFIRM'), - cancelButton: this.language.instant('DMP-OVERVIEW.UNDO-FINALIZATION-DIALOG.NEGATIVE'), + message: this.language.instant('PLAN-OVERVIEW.UNDO-FINALIZATION-DIALOG.TITLE'), + confirmButton: this.language.instant('PLAN-OVERVIEW.UNDO-FINALIZATION-DIALOG.CONFIRM'), + cancelButton: this.language.instant('PLAN-OVERVIEW.UNDO-FINALIZATION-DIALOG.NEGATIVE'), isDeleteConfirmation: false } }); dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { if (result) { - this.dmpService.undoFinalize(this.dmp.id, DmpEditorEntityResolver.lookupFields()).pipe(takeUntil(this._destroyed)) + this.planService.undoFinalize(this.dmp.id, PlanEditorEntityResolver.lookupFields()).pipe(takeUntil(this._destroyed)) .subscribe(data => { this.reloadPage(); this.onUpdateCallbackSuccess() @@ -510,7 +510,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { }); } - removeUserFromDmp(dmpUser: DmpUser) { + removeUserFromDmp(dmpUser: PlanUser) { const dialogRef = this.dialog.open(ConfirmationDialogComponent, { data: { message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.DELETE-USER'), @@ -521,12 +521,12 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { }); dialogRef.afterClosed().subscribe(result => { if (result) { - const dmpUserRemovePersist: DmpUserRemovePersist = { + const dmpUserRemovePersist: PlanUserRemovePersist = { id: dmpUser.id, - dmpId: this.dmp.id, + planId: this.dmp.id, role: dmpUser.role }; - this.dmpService.removeUser(dmpUserRemovePersist).pipe(takeUntil(this._destroyed)) + this.planService.removeUser(dmpUserRemovePersist).pipe(takeUntil(this._destroyed)) .subscribe(data => { this.reloadPage(); this.onUpdateCallbackSuccess() @@ -566,7 +566,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { getSectionNameById(sectionId: Guid): string { if (sectionId == null) return ''; - let sections: DmpBlueprintDefinitionSection[] = this.dmp?.blueprint?.definition?.sections?.filter((section: DmpBlueprintDefinitionSection) => sectionId === section.id); + let sections: PlanBlueprintDefinitionSection[] = this.dmp?.blueprint?.definition?.sections?.filter((section: PlanBlueprintDefinitionSection) => sectionId === section.id); return sections == null ? '' : sections[0].label; } @@ -578,8 +578,8 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { if (this.isLocked) { this.dialog.open(PopupNotificationDialogComponent, { data: { - title: this.language.instant('DMP-OVERVIEW.LOCKED-DIALOG.TITLE'), - message: this.language.instant('DMP-OVERVIEW.LOCKED-DIALOG.MESSAGE') + title: this.language.instant('PLAN-OVERVIEW.LOCKED-DIALOG.TITLE'), + message: this.language.instant('PLAN-OVERVIEW.LOCKED-DIALOG.MESSAGE') }, maxWidth: '30em' }); } @@ -592,69 +592,69 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { private lookupFields(): string[] { return [ - nameof(x => x.id), - nameof(x => x.label), - nameof(x => x.description), - nameof(x => x.status), - nameof(x => x.accessType), - nameof(x => x.version), - nameof(x => x.versionStatus), - nameof(x => x.groupId), - nameof(x => x.version), - nameof(x => x.updatedAt), - nameof(x => x.entityDois), - nameof(x => x.belongsToCurrentTenant), - [nameof(x => x.authorizationFlags), AppPermission.CreateNewVersionDmp].join('.'), - [nameof(x => x.authorizationFlags), AppPermission.DeleteDmp].join('.'), - [nameof(x => x.authorizationFlags), AppPermission.CloneDmp].join('.'), - [nameof(x => x.authorizationFlags), AppPermission.FinalizeDmp].join('.'), - [nameof(x => x.authorizationFlags), AppPermission.ExportDmp].join('.'), - [nameof(x => x.authorizationFlags), AppPermission.InviteDmpUsers].join('.'), - [nameof(x => x.authorizationFlags), AppPermission.AssignDmpUsers].join('.'), - [nameof(x => x.authorizationFlags), AppPermission.EditDmp].join('.'), - [nameof(x => x.authorizationFlags), AppPermission.DepositDmp].join('.'), - [nameof(x => x.entityDois), nameof(x => x.id)].join('.'), - [nameof(x => x.entityDois), nameof(x => x.repositoryId)].join('.'), - [nameof(x => x.entityDois), nameof(x => x.doi)].join('.'), - [nameof(x => x.entityDois), nameof(x => x.isActive)].join('.'), - [nameof(x => x.descriptions), nameof(x => x.id)].join('.'), - [nameof(x => x.descriptions), nameof(x => x.label)].join('.'), - [nameof(x => x.descriptions), nameof(x => x.status)].join('.'), - [nameof(x => x.descriptions), nameof(x => x.isActive)].join('.'), - [nameof(x => x.dmpUsers), nameof(x => x.id)].join('.'), - [nameof(x => x.dmpUsers), nameof(x => x.sectionId)].join('.'), - [nameof(x => x.dmpUsers), nameof(x => x.user.id)].join('.'), - [nameof(x => x.dmpUsers), nameof(x => x.user.name)].join('.'), - [nameof(x => x.dmpUsers), nameof(x => x.role)].join('.'), - [nameof(x => x.dmpUsers), nameof(x => x.dmp.id)].join('.'), - [nameof(x => x.dmpUsers), nameof(x => x.isActive)].join('.'), - [nameof(x => x.dmpReferences), nameof(x => x.id)].join('.'), - [nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.id)].join('.'), - [nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.label)].join('.'), - [nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.type), nameof(x => x.id)].join('.'), - [nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.source)].join('.'), - [nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.reference)].join('.'), - [nameof(x => x.dmpReferences), nameof(x => x.isActive)].join('.'), - [nameof(x => x.dmpDescriptionTemplates), nameof(x => x.sectionId)].join('.'), - [nameof(x => x.dmpDescriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), - [nameof(x => x.dmpDescriptionTemplates), nameof(x => x.isActive)].join('.'), + nameof(x => x.id), + nameof(x => x.label), + nameof(x => x.description), + nameof(x => x.status), + nameof(x => x.accessType), + nameof(x => x.version), + nameof(x => x.versionStatus), + nameof(x => x.groupId), + nameof(x => x.version), + nameof(x => x.updatedAt), + nameof(x => x.entityDois), + nameof(x => x.belongsToCurrentTenant), + [nameof(x => x.authorizationFlags), AppPermission.CreateNewVersionPlan].join('.'), + [nameof(x => x.authorizationFlags), AppPermission.DeletePlan].join('.'), + [nameof(x => x.authorizationFlags), AppPermission.ClonePlan].join('.'), + [nameof(x => x.authorizationFlags), AppPermission.FinalizePlan].join('.'), + [nameof(x => x.authorizationFlags), AppPermission.ExportPlan].join('.'), + [nameof(x => x.authorizationFlags), AppPermission.InvitePlanUsers].join('.'), + [nameof(x => x.authorizationFlags), AppPermission.AssignPlanUsers].join('.'), + [nameof(x => x.authorizationFlags), AppPermission.EditPlan].join('.'), + [nameof(x => x.authorizationFlags), AppPermission.DepositPlan].join('.'), + [nameof(x => x.entityDois), nameof(x => x.id)].join('.'), + [nameof(x => x.entityDois), nameof(x => x.repositoryId)].join('.'), + [nameof(x => x.entityDois), nameof(x => x.doi)].join('.'), + [nameof(x => x.entityDois), nameof(x => x.isActive)].join('.'), + [nameof(x => x.descriptions), nameof(x => x.id)].join('.'), + [nameof(x => x.descriptions), nameof(x => x.label)].join('.'), + [nameof(x => x.descriptions), nameof(x => x.status)].join('.'), + [nameof(x => x.descriptions), nameof(x => x.isActive)].join('.'), + [nameof(x => x.planUsers), nameof(x => x.id)].join('.'), + [nameof(x => x.planUsers), nameof(x => x.sectionId)].join('.'), + [nameof(x => x.planUsers), nameof(x => x.user.id)].join('.'), + [nameof(x => x.planUsers), nameof(x => x.user.name)].join('.'), + [nameof(x => x.planUsers), nameof(x => x.role)].join('.'), + [nameof(x => x.planUsers), nameof(x => x.plan.id)].join('.'), + [nameof(x => x.planUsers), nameof(x => x.isActive)].join('.'), + [nameof(x => x.planReferences), nameof(x => x.id)].join('.'), + [nameof(x => x.planReferences), nameof(x => x.reference), nameof(x => x.id)].join('.'), + [nameof(x => x.planReferences), nameof(x => x.reference), nameof(x => x.label)].join('.'), + [nameof(x => x.planReferences), nameof(x => x.reference), nameof(x => x.type), nameof(x => x.id)].join('.'), + [nameof(x => x.planReferences), nameof(x => x.reference), nameof(x => x.source)].join('.'), + [nameof(x => x.planReferences), nameof(x => x.reference), nameof(x => x.reference)].join('.'), + [nameof(x => x.planReferences), nameof(x => x.isActive)].join('.'), + [nameof(x => x.planDescriptionTemplates), nameof(x => x.sectionId)].join('.'), + [nameof(x => x.planDescriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), + [nameof(x => x.planDescriptionTemplates), nameof(x => x.isActive)].join('.'), - [nameof(x => x.blueprint), nameof(x => x.id)].join('.'), - [nameof(x => x.blueprint), nameof(x => x.definition)].join('.'), - [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), - [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.label)].join('.'), - [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.hasTemplates)].join('.'), - [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), - [nameof(x => x.descriptions), nameof(x => x.id)].join('.'), - [nameof(x => x.descriptions), nameof(x => x.dmpDescriptionTemplate), nameof(x => x.sectionId)].join('.'), - [nameof(x => x.descriptions), nameof(x => x.descriptionTemplate), nameof(x => x.groupId)].join('.'), + [nameof(x => x.blueprint), nameof(x => x.id)].join('.'), + [nameof(x => x.blueprint), nameof(x => x.definition)].join('.'), + [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), + [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.label)].join('.'), + [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.hasTemplates)].join('.'), + [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), + [nameof(x => x.descriptions), nameof(x => x.id)].join('.'), + [nameof(x => x.descriptions), nameof(x => x.planDescriptionTemplate), nameof(x => x.sectionId)].join('.'), + [nameof(x => x.descriptions), nameof(x => x.descriptionTemplate), nameof(x => x.groupId)].join('.'), - [nameof(x => x.otherDmpVersions), nameof(x => x.id)].join('.'), - [nameof(x => x.otherDmpVersions), nameof(x => x.groupId)].join('.'), - [nameof(x => x.otherDmpVersions), nameof(x => x.version)].join('.'), - [nameof(x => x.otherDmpVersions), nameof(x => x.isActive)].join('.'), + [nameof(x => x.otherPlanVersions), nameof(x => x.id)].join('.'), + [nameof(x => x.otherPlanVersions), nameof(x => x.groupId)].join('.'), + [nameof(x => x.otherPlanVersions), nameof(x => x.version)].join('.'), + [nameof(x => x.otherPlanVersions), nameof(x => x.isActive)].join('.'), - nameof(x => x.hash), + nameof(x => x.hash), ] } } diff --git a/dmp-frontend/src/app/ui/plan/overview/plan-overview.module.ts b/dmp-frontend/src/app/ui/plan/overview/plan-overview.module.ts index a196ddd14..9040b65d1 100644 --- a/dmp-frontend/src/app/ui/plan/overview/plan-overview.module.ts +++ b/dmp-frontend/src/app/ui/plan/overview/plan-overview.module.ts @@ -6,7 +6,7 @@ import { CommonFormsModule } from '@common/forms/common-forms.module'; import { ConfirmationDialogModule } from '@common/modules/confirmation-dialog/confirmation-dialog.module'; import { CommonUiModule } from '@common/ui/common-ui.module'; import { NgDialogAnimationService } from 'ng-dialog-animation'; -import { DmpFinalizeDialogModule } from '../plan-finalize-dialog/plan-finalize-dialog.module'; +import { PlanFinalizeDialogModule } from '../plan-finalize-dialog/plan-finalize-dialog.module'; import { DmpOverviewRoutingModule } from './plan-overview.routing'; import { MultipleChoiceDialogModule } from '@common/modules/multiple-choice-dialog/multiple-choice-dialog.module'; import { DmpDeleteDialogModule } from '../plan-delete-dialog/plan-delete-dialog.module'; @@ -22,7 +22,7 @@ import { DmpOverviewComponent } from './plan-overview.component'; FormattingModule, AutoCompleteModule, DmpOverviewRoutingModule, - DmpFinalizeDialogModule + PlanFinalizeDialogModule ], declarations: [ DmpOverviewComponent, diff --git a/dmp-frontend/src/app/ui/plan/plan-contact-prefill-dialog/plan-contact-prefill-dialog.component.html b/dmp-frontend/src/app/ui/plan/plan-contact-prefill-dialog/plan-contact-prefill-dialog.component.html index 8f44faa24..64a100b61 100644 --- a/dmp-frontend/src/app/ui/plan/plan-contact-prefill-dialog/plan-contact-prefill-dialog.component.html +++ b/dmp-frontend/src/app/ui/plan/plan-contact-prefill-dialog/plan-contact-prefill-dialog.component.html @@ -1,23 +1,23 @@
    - {{'DMP-CONTACT-PREFILL-DIALOG.TITLE' | translate}}{{label}} + {{'PLAN-CONTACT-PREFILL-DIALOG.TITLE' | translate}}{{label}}
    - {{'DMP-CONTACT-PREFILL-DIALOG.TITLE' | translate}}{{enumUtils.toDmpBlueprintSystemFieldTypeString(3)}} + {{'PLAN-CONTACT-PREFILL-DIALOG.TITLE' | translate}}{{enumUtils.toPlanBlueprintSystemFieldTypeString(3)}}
    -
    {{'DMP-CONTACT-PREFILL-DIALOG.TEXT' | translate}}
    +
    {{'PLAN-CONTACT-PREFILL-DIALOG.TEXT' | translate}}
    - {{'DMP-CONTACT-PREFILL-DIALOG.FIELDS.USER' | translate}} + {{'PLAN-CONTACT-PREFILL-DIALOG.FIELDS.USER' | translate}}
    -
    -
    +
    +
    \ No newline at end of file diff --git a/dmp-frontend/src/app/ui/plan/plan-contact-prefill-dialog/plan-contact-prefill-dialog.component.ts b/dmp-frontend/src/app/ui/plan/plan-contact-prefill-dialog/plan-contact-prefill-dialog.component.ts index 549b5f0b6..5c264d7fa 100644 --- a/dmp-frontend/src/app/ui/plan/plan-contact-prefill-dialog/plan-contact-prefill-dialog.component.ts +++ b/dmp-frontend/src/app/ui/plan/plan-contact-prefill-dialog/plan-contact-prefill-dialog.component.ts @@ -6,17 +6,17 @@ import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/sing import { map } from 'rxjs'; import { DmpAssociatedUser } from '@app/core/model/user/user'; import { UntypedFormGroup } from '@angular/forms'; -import { DmpContactPrefillDialogEditorModel } from './plan-contact-prefill-dialog.editor.model'; +import { PlanContactPrefillDialogEditorModel } from './plan-contact-prefill-dialog.editor.model'; import { FormService } from '@common/forms/form-service'; import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; -import { DmpBlueprintSystemFieldType } from '@app/core/common/enum/plan-blueprint-system-field-type'; +import { PlanBlueprintSystemFieldType } from '@app/core/common/enum/plan-blueprint-system-field-type'; @Component({ selector: 'app-plan-contact-prefill-dialog', templateUrl: './plan-contact-prefill-dialog.component.html', styleUrls: ['./plan-contact-prefill-dialog.component.scss'] }) -export class DmpContactPrefillDialogComponent extends BaseComponent { +export class PlanContactPrefillDialogComponent extends BaseComponent { formGroup: UntypedFormGroup; contactFormGroup: UntypedFormGroup; @@ -36,7 +36,7 @@ export class DmpContactPrefillDialogComponent extends BaseComponent { private userService: UserService, private formService: FormService, public enumUtils: EnumUtils, - public dialogRef: MatDialogRef, + public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public data: any ) { super(); @@ -45,7 +45,7 @@ export class DmpContactPrefillDialogComponent extends BaseComponent { } ngOnInit(): void { - this.formGroup = new DmpContactPrefillDialogEditorModel().buildForm(); + this.formGroup = new PlanContactPrefillDialogEditorModel().buildForm(); } cancel() { diff --git a/dmp-frontend/src/app/ui/plan/plan-contact-prefill-dialog/plan-contact-prefill-dialog.editor.model.ts b/dmp-frontend/src/app/ui/plan/plan-contact-prefill-dialog/plan-contact-prefill-dialog.editor.model.ts index 3eedad13c..266c2ff0f 100644 --- a/dmp-frontend/src/app/ui/plan/plan-contact-prefill-dialog/plan-contact-prefill-dialog.editor.model.ts +++ b/dmp-frontend/src/app/ui/plan/plan-contact-prefill-dialog/plan-contact-prefill-dialog.editor.model.ts @@ -5,7 +5,7 @@ import { ValidationErrorModel } from '@common/forms/validation/error-model/valid import { Validation, ValidationContext } from '@common/forms/validation/validation-context'; import { Guid } from "@common/types/guid"; -export class DmpContactPrefillDialogEditorModel implements DmpAssociatedUser { +export class PlanContactPrefillDialogEditorModel implements DmpAssociatedUser { id: Guid; name: string; email: string; diff --git a/dmp-frontend/src/app/ui/plan/plan-contact-prefill-dialog/plan-contact-prefill-dialog.module.ts b/dmp-frontend/src/app/ui/plan/plan-contact-prefill-dialog/plan-contact-prefill-dialog.module.ts index 879467585..3233d6b45 100644 --- a/dmp-frontend/src/app/ui/plan/plan-contact-prefill-dialog/plan-contact-prefill-dialog.module.ts +++ b/dmp-frontend/src/app/ui/plan/plan-contact-prefill-dialog/plan-contact-prefill-dialog.module.ts @@ -2,13 +2,13 @@ import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { CommonUiModule } from '@common/ui/common-ui.module'; import { AutoCompleteModule } from '@app/library/auto-complete/auto-complete.module'; -import { DmpContactPrefillDialogComponent } from './plan-contact-prefill-dialog.component'; +import { PlanContactPrefillDialogComponent } from './plan-contact-prefill-dialog.component'; @NgModule({ imports: [CommonUiModule, FormsModule, ReactiveFormsModule, AutoCompleteModule], - declarations: [DmpContactPrefillDialogComponent], - exports: [DmpContactPrefillDialogComponent] + declarations: [PlanContactPrefillDialogComponent], + exports: [PlanContactPrefillDialogComponent] }) -export class DmpContactPrefillDialogModule { +export class PlanContactPrefillDialogModule { constructor() { } } diff --git a/dmp-frontend/src/app/ui/plan/plan-delete-dialog/plan-delete-dialog.component.html b/dmp-frontend/src/app/ui/plan/plan-delete-dialog/plan-delete-dialog.component.html index 7dc6a02f9..ad267849f 100644 --- a/dmp-frontend/src/app/ui/plan/plan-delete-dialog/plan-delete-dialog.component.html +++ b/dmp-frontend/src/app/ui/plan/plan-delete-dialog/plan-delete-dialog.component.html @@ -1,12 +1,12 @@
    - {{'DMP-DELETE-DIALOG.WARNING' | translate}} + {{'PLAN-DELETE-DIALOG.WARNING' | translate}} close
    -
    {{'DMP-DELETE-DIALOG.DELETE-ITEM' | translate}}
    +
    {{'PLAN-DELETE-DIALOG.DELETE-ITEM' | translate}}
    @@ -16,7 +16,7 @@
    -
    -
    +
    +
    diff --git a/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.component.html b/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.component.html index 6d5b532d1..1071b36f1 100644 --- a/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.component.html +++ b/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.component.html @@ -6,14 +6,14 @@
    -
    {{'DMP-EDITOR.TITLE-EDIT' | translate}}
    -
    {{ formGroup.get('label').value }} ({{'DMP-EDITOR.UNSAVED-CHANGES' | translate}})
    +
    {{'PLAN-EDITOR.TITLE-EDIT' | translate}}
    +
    {{ formGroup.get('label').value }} ({{'PLAN-EDITOR.UNSAVED-CHANGES' | translate}})
    - @@ -27,22 +27,22 @@
    - - + +
    -
    - +
    +
    - - + +
    @@ -83,10 +83,10 @@
    -
    {{'DMP-EDITOR.FIELDS.TITLE' | translate}} *
    +
    {{'PLAN-EDITOR.FIELDS.TITLE' | translate}} *
    - {{'DMP-EDITOR.FIELDS.TITLE' | translate}} + {{'PLAN-EDITOR.FIELDS.TITLE' | translate}} {{formGroup.get('label').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}} @@ -94,31 +94,31 @@
    -
    {{'DMP-EDITOR.FIELDS.DESCRIPTION' | translate}} *
    +
    {{'PLAN-EDITOR.FIELDS.DESCRIPTION' | translate}} *
    - +
    -
    {{'DMP-EDITOR.FIELDS.BLUEPRINT' | translate}} *
    +
    {{'PLAN-EDITOR.FIELDS.BLUEPRINT' | translate}} *
    - {{'DMP-EDITOR.FIELDS.BLUEPRINT' | translate}} - + {{'PLAN-EDITOR.FIELDS.BLUEPRINT' | translate}} +
    - +
    -

    {{'DMP-EDITOR.ACTIONS.OR-CONTINUE-WITH' | translate}}

    +

    {{'PLAN-EDITOR.ACTIONS.OR-CONTINUE-WITH' | translate}}

    - +
    @@ -132,7 +132,7 @@
    - {{'DMP-EDITOR.TITLE' | translate}} + {{'PLAN-EDITOR.TITLE' | translate}}
    @@ -146,8 +146,8 @@
    1. -
      {{'DMP-EDITOR.DESCRIPTION' | translate}}: {{ description.label }}
      -
      close
      +
      {{'PLAN-EDITOR.DESCRIPTION' | translate}}: {{ description.label }}
      +
      close
      check
    2. @@ -156,10 +156,10 @@
    3. - add{{'DMP-EDITOR.ACTIONS.ADD-DESCRIPTION-IN-SECTION' | translate}} + add{{'PLAN-EDITOR.ACTIONS.ADD-DESCRIPTION-IN-SECTION' | translate}} - add{{'DMP-EDITOR.ACTIONS.ADD-DESCRIPTION-IN-SECTION' | translate}} + add{{'PLAN-EDITOR.ACTIONS.ADD-DESCRIPTION-IN-SECTION' | translate}}
    4. @@ -176,12 +176,12 @@
      -
      {{'DMP-EDITOR.ACTIONS.NEXT-STEP' | translate}}
      +
      {{'PLAN-EDITOR.ACTIONS.NEXT-STEP' | translate}}
      chevron_right
      @@ -206,28 +206,28 @@
      -
      {{i + 1}}.{{j + 1}} {{enumUtils.toDmpBlueprintSystemFieldTypeString(field.systemFieldType)}}*
      -
      {{i + 1}}.{{j + 1}} {{field.referenceType.name}}*
      +
      {{i + 1}}.{{j + 1}} {{enumUtils.toPlanBlueprintSystemFieldTypeString(field.systemFieldType)}}*
      +
      {{i + 1}}.{{j + 1}} {{field.referenceType.name}}*
      {{i + 1}}.{{j + 1}} {{field.label}}*
      {{field.description}}
      -
      -
      +
      +
      - + {{formGroup.get('label').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}}
      -
      - +
      +
      -
      +
      - + {{ lang.name }} @@ -236,7 +236,7 @@ {{'GENERAL.VALIDATION.REQUIRED' | translate}}
      -
      +
      @@ -247,7 +247,7 @@
      - {{'DMP-EDITOR.FIELDS.FIRST-NAME' | translate}} + {{'PLAN-EDITOR.FIELDS.FIRST-NAME' | translate}} {{contact.get('firstName').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}} @@ -255,7 +255,7 @@
      - {{'DMP-EDITOR.FIELDS.LAST-NAME' | translate}} + {{'PLAN-EDITOR.FIELDS.LAST-NAME' | translate}} {{contact.get('lastName').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}} @@ -263,7 +263,7 @@
      - {{'DMP-EDITOR.FIELDS.EMAIL' | translate}} + {{'PLAN-EDITOR.FIELDS.EMAIL' | translate}} {{contact.get('email').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}} @@ -272,12 +272,12 @@
      -
      -
      @@ -293,58 +293,58 @@
      -
      +
      - - - {{enumUtils.toDmpAccessTypeString(dmpAccessType)}} + + + {{enumUtils.toPlanAccessTypeString(planAccessType)}} {{formGroup.get('accessType').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}}
      -
      +
      -
      +
      - + - +
      -
      -
      +
      +
      {{field.label}} - - {{formGroup.get('properties').get('dmpBlueprintValues').get(field.id).get('fieldValue').getError('backendError').message}} - {{'GENERAL.VALIDATION.REQUIRED' | translate}} + + {{formGroup.get('properties').get('planBlueprintValues').get(field.id).get('fieldValue').getError('backendError').message}} + {{'GENERAL.VALIDATION.REQUIRED' | translate}}
      -
      - +
      +
      -
      +
      {{field.label}} - + - {{formGroup.get('properties').get('dmpBlueprintValues').get(field.id).get('dateValue').getError('backendError').message}} - {{'GENERAL.VALIDATION.REQUIRED' | translate}} + {{formGroup.get('properties').get('planBlueprintValues').get(field.id).get('dateValue').getError('backendError').message}} + {{'GENERAL.VALIDATION.REQUIRED' | translate}}
      -
      +
      {{field.label}} - - {{formGroup.get('properties').get('dmpBlueprintValues').get(field.id).get('numberValue').getError('backendError').message}} - {{'GENERAL.VALIDATION.REQUIRED' | translate}} + + {{formGroup.get('properties').get('planBlueprintValues').get(field.id).get('numberValue').getError('backendError').message}} + {{'GENERAL.VALIDATION.REQUIRED' | translate}}
      @@ -357,16 +357,16 @@
      -
      {{'DMP-EDITOR.FIELDS.DESCRIPTION-TEMPLATES' | translate}}
      +
      {{'PLAN-EDITOR.FIELDS.DESCRIPTION-TEMPLATES' | translate}}
      - {{'DMP-EDITOR.FIELDS.DESCRIPTION-TEMPLATES-HINT' | translate}} - + {{'PLAN-EDITOR.FIELDS.DESCRIPTION-TEMPLATES-HINT' | translate}} + {{formGroup.get('descriptionTemplates').get(section.id).getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}}
      - {{'DMP-EDITOR.NO-TEMPLATE-MESSAGE' | translate}} + {{'PLAN-EDITOR.NO-TEMPLATE-MESSAGE' | translate}}
      diff --git a/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.component.ts b/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.component.ts index a6ddbc0d6..3ef13d42c 100644 --- a/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.component.ts +++ b/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.component.ts @@ -5,29 +5,29 @@ import { MatDialog } from '@angular/material/dialog'; import { Title } from '@angular/platform-browser'; import { ActivatedRoute, Router } from '@angular/router'; import { DescriptionStatus } from '@app/core/common/enum/description-status'; -import { DmpAccessType } from '@app/core/common/enum/plan-access-type'; -import { DmpBlueprintFieldCategory } from '@app/core/common/enum/plan-blueprint-field-category'; -import { DmpBlueprintExtraFieldDataType } from '@app/core/common/enum/plan-blueprint-field-type'; -import { DmpBlueprintStatus } from '@app/core/common/enum/plan-blueprint-status'; -import { DmpBlueprintSystemFieldType } from '@app/core/common/enum/plan-blueprint-system-field-type'; -import { DmpStatus } from '@app/core/common/enum/plan-status'; -import { DmpUserRole } from '@app/core/common/enum/plan-user-role'; -import { DmpUserType } from '@app/core/common/enum/plan-user-type'; +import { PlanAccessType } from '@app/core/common/enum/plan-access-type'; +import { PlanBlueprintFieldCategory } from '@app/core/common/enum/plan-blueprint-field-category'; +import { PlanBlueprintExtraFieldDataType } from '@app/core/common/enum/plan-blueprint-field-type'; +import { PlanBlueprintStatus } from '@app/core/common/enum/plan-blueprint-status'; +import { PlanBlueprintSystemFieldType } from '@app/core/common/enum/plan-blueprint-system-field-type'; +import { PlanStatus } from '@app/core/common/enum/plan-status'; +import { PlanUserRole } from '@app/core/common/enum/plan-user-role'; +import { PlanUserType } from '@app/core/common/enum/plan-user-type'; import { IsActive } from '@app/core/common/enum/is-active.enum'; import { LockTargetType } from '@app/core/common/enum/lock-target-type'; import { AppPermission } from '@app/core/common/enum/permission.enum'; import { DescriptionTemplate } from '@app/core/model/description-template/description-template'; import { DescriptionSectionPermissionResolver } from '@app/core/model/description/description'; -import { DmpBlueprint, DmpBlueprintDefinitionSection, FieldInSection } from '@app/core/model/plan-blueprint/plan-blueprint'; -import { Dmp, DmpPersist } from '@app/core/model/plan/plan'; +import { PlanBlueprint, PlanBlueprintDefinitionSection, FieldInSection } from '@app/core/model/plan-blueprint/plan-blueprint'; +import { Plan, PlanPersist } from '@app/core/model/plan/plan'; import { LanguageInfo } from '@app/core/model/language-info'; import { AuthService } from '@app/core/services/auth/auth.service'; import { ConfigurationService } from '@app/core/services/configuration/configuration.service'; import { LanguageInfoService } from '@app/core/services/culture/language-info-service'; import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service'; import { DescriptionService } from '@app/core/services/description/description.service'; -import { DmpBlueprintService } from '@app/core/services/plan/plan-blueprint.service'; -import { DmpService } from '@app/core/services/plan/plan.service'; +import { PlanBlueprintService } from '@app/core/services/plan/plan-blueprint.service'; +import { PlanService } from '@app/core/services/plan/plan.service'; import { LockService } from '@app/core/services/lock/lock.service'; import { LoggingService } from '@app/core/services/logging/logging-service'; import { AnalyticsService } from '@app/core/services/matomo/analytics-service'; @@ -48,41 +48,41 @@ import { FilterService } from '@common/modules/text-filter/filter-service'; import { Guid } from '@common/types/guid'; import { TranslateService } from '@ngx-translate/core'; import { map, takeUntil } from 'rxjs/operators'; -import { DmpContactPrefillDialogComponent } from '../plan-contact-prefill-dialog/plan-contact-prefill-dialog.component'; -import { DmpEditorModel, DmpFieldIndicator } from './plan-editor.model'; -import { DmpEditorEntityResolver } from './resolvers/plan-editor-enitity.resolver'; -import { DmpEditorService } from './plan-editor.service'; +import { PlanContactPrefillDialogComponent } from '../plan-contact-prefill-dialog/plan-contact-prefill-dialog.component'; +import { PlanEditorModel, DmpFieldIndicator } from './plan-editor.model'; +import { PlanEditorEntityResolver } from './resolvers/plan-editor-enitity.resolver'; +import { PlanEditorService } from './plan-editor.service'; import { RouterUtilsService } from '@app/core/services/router/router-utils.service'; import { FileTransformerService } from '@app/core/services/file-transformer/file-transformer.service'; import { FileTransformerEntityType } from '@app/core/common/enum/file-transformer-entity-type'; -import { DmpFinalizeDialogComponent, DmpFinalizeDialogOutput } from '../plan-finalize-dialog/plan-finalize-dialog.component'; +import { PlanFinalizeDialogComponent, PlanFinalizeDialogOutput } from '../plan-finalize-dialog/plan-finalize-dialog.component'; @Component({ selector: 'app-plan-editor', templateUrl: './plan-editor.component.html', styleUrls: ['./plan-editor.component.scss'], - providers: [DmpEditorService] + providers: [PlanEditorService] }) -export class DmpEditorComponent extends BaseEditor implements OnInit { +export class PlanEditorComponent extends BaseEditor implements OnInit { isNew = true; isDeleted = false; isFinalized = false; viewOnly = false; - item: Dmp; - selectedBlueprint: DmpBlueprint; + item: Plan; + selectedBlueprint: PlanBlueprint; step: number = 0; //Enums descriptionStatusEnum = DescriptionStatus; - dmpBlueprintSectionFieldCategoryEnum = DmpBlueprintFieldCategory; - dmpBlueprintSystemFieldTypeEnum = DmpBlueprintSystemFieldType; - dmpBlueprintExtraFieldDataTypeEnum = DmpBlueprintExtraFieldDataType; - dmpAccessTypeEnum = DmpAccessType; - dmpAccessTypeEnumValues = this.enumUtils.getEnumValues(DmpAccessType); - dmpUserTypeEnum = DmpUserType; - dmpUserTypeEnumValues = this.enumUtils.getEnumValues(DmpUserType); - dmpUserRoleEnumValues = this.enumUtils.getEnumValues(DmpUserRole); + planBlueprintSectionFieldCategoryEnum = PlanBlueprintFieldCategory; + planBlueprintSystemFieldTypeEnum = PlanBlueprintSystemFieldType; + planBlueprintExtraFieldDataTypeEnum = PlanBlueprintExtraFieldDataType; + planAccessTypeEnum = PlanAccessType; + planAccessTypeEnumValues = this.enumUtils.getEnumValues(PlanAccessType); + planUserTypeEnum = PlanUserType; + planUserTypeEnumValues = this.enumUtils.getEnumValues(PlanUserType); + planUserRoleEnumValues = this.enumUtils.getEnumValues(PlanUserRole); fileTransformerEntityTypeEnum = FileTransformerEntityType; permissionPerSection: Map; @@ -90,13 +90,13 @@ export class DmpEditorComponent extends BaseEditor implemen hoveredContact: number = -1; singleAutocompleteBlueprintConfiguration: SingleAutoCompleteConfiguration = { - initialItems: (data?: any) => this.dmpBlueprintService.query(this.dmpBlueprintService.buildAutocompleteLookup(null, null, null, [DmpBlueprintStatus.Finalized])).pipe(map(x => x.items)), - filterFn: (searchQuery: string, data?: any) => this.dmpBlueprintService.query(this.dmpBlueprintService.buildAutocompleteLookup(searchQuery, null, null, [DmpBlueprintStatus.Finalized])).pipe(map(x => x.items)), - getSelectedItem: (selectedItem: any) => this.dmpBlueprintService.query(this.dmpBlueprintService.buildAutocompleteLookup(null, null, [selectedItem])).pipe(map(x => x.items[0])), - displayFn: (item: DmpBlueprint) => item.label, - subtitleFn: (item: DmpBlueprint) => this.language.instant('DMP-EDITOR.FIELDS.DMP-BLUEPRINT-VERSION') + ' ' + item.version, - titleFn: (item: DmpBlueprint) => item.label, - valueAssign: (item: DmpBlueprint) => item.id, + initialItems: (data?: any) => this.planBlueprintService.query(this.planBlueprintService.buildAutocompleteLookup(null, null, null, [PlanBlueprintStatus.Finalized])).pipe(map(x => x.items)), + filterFn: (searchQuery: string, data?: any) => this.planBlueprintService.query(this.planBlueprintService.buildAutocompleteLookup(searchQuery, null, null, [PlanBlueprintStatus.Finalized])).pipe(map(x => x.items)), + getSelectedItem: (selectedItem: any) => this.planBlueprintService.query(this.planBlueprintService.buildAutocompleteLookup(null, null, [selectedItem])).pipe(map(x => x.items[0])), + displayFn: (item: PlanBlueprint) => item.label, + subtitleFn: (item: PlanBlueprint) => this.language.instant('PLAN-EDITOR.FIELDS.PLAN-BLUEPRINT-VERSION') + ' ' + item.version, + titleFn: (item: PlanBlueprint) => item.label, + valueAssign: (item: PlanBlueprint) => item.id, }; getDescriptionTemplateMultipleAutoCompleteConfiguration(sectionId: Guid): MultipleAutoCompleteConfiguration { @@ -116,19 +116,19 @@ export class DmpEditorComponent extends BaseEditor implemen sectionToFieldsMap: Map = new Map(); protected get canDelete(): boolean { - return !this.isDeleted && !this.isNew && (this.hasPermission(this.authService.permissionEnum.DeleteDmp) || this.item?.authorizationFlags?.some(x => x === AppPermission.DeleteDmp)); + return !this.isDeleted && !this.isNew && (this.hasPermission(this.authService.permissionEnum.DeletePlan) || this.item?.authorizationFlags?.some(x => x === AppPermission.DeletePlan)); } protected get canSave(): boolean { - return !this.isDeleted && !this.isFinalized && (this.hasPermission(this.authService.permissionEnum.EditDmp) || this.item?.authorizationFlags?.some(x => x === AppPermission.EditDmp)); + return !this.isDeleted && !this.isFinalized && (this.hasPermission(this.authService.permissionEnum.EditPlan) || this.item?.authorizationFlags?.some(x => x === AppPermission.EditPlan)); } protected get canFinalize(): boolean { - return !this.isDeleted && !this.isNew && this.canEdit && this.isLockedByUser && !this.isFinalized && (this.hasPermission(this.authService.permissionEnum.EditDmp) || this.item?.authorizationFlags?.some(x => x === AppPermission.EditDmp)); + return !this.isDeleted && !this.isNew && this.canEdit && this.isLockedByUser && !this.isFinalized && (this.hasPermission(this.authService.permissionEnum.EditPlan) || this.item?.authorizationFlags?.some(x => x === AppPermission.EditPlan)); } protected get canReverseFinalize(): boolean { - return !this.isDeleted && !this.isNew && this.canEdit && this.isLockedByUser && this.item.status == DmpStatus.Finalized && (this.hasPermission(this.authService.permissionEnum.EditDmp) || this.item?.authorizationFlags?.some(x => x === AppPermission.EditDmp)); + return !this.isDeleted && !this.isNew && this.canEdit && this.isLockedByUser && this.item.status == PlanStatus.Finalized && (this.hasPermission(this.authService.permissionEnum.EditPlan) || this.item?.authorizationFlags?.some(x => x === AppPermission.EditPlan)); } protected canEditSection(id: Guid): boolean { @@ -144,7 +144,7 @@ export class DmpEditorComponent extends BaseEditor implemen } get canEdit(): boolean { - return this.isNew ? this.authService.hasPermission(AppPermission.NewDmp) : this.item.authorizationFlags?.some(x => x === AppPermission.EditDmp) || this.authService.hasPermission(AppPermission.EditDmp); + return this.isNew ? this.authService.hasPermission(AppPermission.NewPlan) : this.item.authorizationFlags?.some(x => x === AppPermission.EditPlan) || this.authService.hasPermission(AppPermission.EditPlan); } private hasPermission(permission: AppPermission): boolean { @@ -166,9 +166,9 @@ export class DmpEditorComponent extends BaseEditor implemen protected authService: AuthService, protected configurationService: ConfigurationService, // Rest dependencies. Inject any other needed deps here: - private dmpService: DmpService, + private planService: PlanService, private logger: LoggingService, - public dmpBlueprintService: DmpBlueprintService, + public planBlueprintService: PlanBlueprintService, // public visibilityRulesService: VisibilityRulesService, private languageInfoService: LanguageInfoService, public routerUtils: RouterUtilsService, @@ -185,29 +185,29 @@ export class DmpEditorComponent extends BaseEditor implemen if (descriptionLabel) { titleService.setTitle(descriptionLabel); } else { - titleService.setTitle('DMP-EDITOR.TITLE-EDIT'); + titleService.setTitle('PLAN-EDITOR.TITLE-EDIT'); } super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, route, queryParamsService, lockService, authService, configurationService); } ngOnInit(): void { - this.analyticsService.trackPageView(AnalyticsService.DmpEditor); + this.analyticsService.trackPageView(AnalyticsService.PlanEditor); this.permissionPerSection = this.route.snapshot.data['permissions'] as Map ?? new Map(); super.ngOnInit(); if (this.isNew === false && this.step === 0) this.nextStep(); } - getItem(itemId: Guid, successFunction: (item: Dmp) => void) { - this.dmpService.getSingle(itemId, DmpEditorEntityResolver.lookupFields()) - .pipe(map(data => data as Dmp), takeUntil(this._destroyed)) + getItem(itemId: Guid, successFunction: (item: Plan) => void) { + this.planService.getSingle(itemId, PlanEditorEntityResolver.lookupFields()) + .pipe(map(data => data as Plan), takeUntil(this._destroyed)) .subscribe( data => successFunction(data), error => this.onCallbackError(error) ); } - prepareForm(data: Dmp) { + prepareForm(data: Plan) { try { if (data?.blueprint?.definition?.sections != null) { data.blueprint.definition.sections = data.blueprint.definition.sections.sort((s1, s2) => s1.ordinal - s2.ordinal); @@ -215,17 +215,17 @@ export class DmpEditorComponent extends BaseEditor implemen data.blueprint.definition.sections[i].fields = data.blueprint.definition.sections[i]?.fields?.sort((f1, f2) => f1.ordinal - f2.ordinal); } } - this.editorModel = data ? new DmpEditorModel().fromModel(data) : new DmpEditorModel(); + this.editorModel = data ? new PlanEditorModel().fromModel(data) : new PlanEditorModel(); if (data) { if (data.descriptions) { - if (data.status == DmpStatus.Finalized) { + if (data.status == PlanStatus.Finalized) { data.descriptions = data.descriptions.filter(x => x.isActive === IsActive.Active && x.status === DescriptionStatus.Finalized); } else { data.descriptions = data.descriptions.filter(x => x.isActive === IsActive.Active && x.status !== DescriptionStatus.Canceled); } } - if (data.dmpDescriptionTemplates) { - data.dmpDescriptionTemplates = data.dmpDescriptionTemplates.filter(x => x.isActive === IsActive.Active); + if (data.planDescriptionTemplates) { + data.planDescriptionTemplates = data.planDescriptionTemplates.filter(x => x.isActive === IsActive.Active); } } @@ -233,11 +233,11 @@ export class DmpEditorComponent extends BaseEditor implemen this.selectedBlueprint = data?.blueprint; this.isDeleted = data ? data.isActive === IsActive.Inactive : false; - this.isFinalized = data ? data.status === DmpStatus.Finalized : false; + this.isFinalized = data ? data.status === PlanStatus.Finalized : false; if (data && data.id) { const descriptionSectionPermissionResolverModel: DescriptionSectionPermissionResolver = { - dmpId: data.id, + planId: data.id, sectionIds: data?.blueprint?.definition?.sections?.map(x => x.id), permissions: [AppPermission.EditDescription, AppPermission.DeleteDescription] } @@ -247,7 +247,7 @@ export class DmpEditorComponent extends BaseEditor implemen } if (this.item && this.item.id != null) { - this.checkLock(this.item.id, LockTargetType.Dmp, 'DMP-EDITOR.LOCKED-DIALOG.TITLE', 'DMP-EDITOR.LOCKED-DIALOG.MESSAGE'); + this.checkLock(this.item.id, LockTargetType.Dmp, 'PLAN-EDITOR.LOCKED-DIALOG.TITLE', 'PLAN-EDITOR.LOCKED-DIALOG.MESSAGE'); } } catch (error) { this.logger.error('Could not parse Dmp item: ' + data + error); @@ -260,9 +260,9 @@ export class DmpEditorComponent extends BaseEditor implemen this.sectionToFieldsMap = this.prepareErrorIndication(); - if (this.editorModel.status == DmpStatus.Finalized || this.isDeleted) { + if (this.editorModel.status == PlanStatus.Finalized || this.isDeleted) { this.viewOnly = true; - this.isFinalized = this.editorModel.status == DmpStatus.Finalized; + this.isFinalized = this.editorModel.status == PlanStatus.Finalized; this.formGroup.disable(); } else { this.viewOnly = false; @@ -273,7 +273,7 @@ export class DmpEditorComponent extends BaseEditor implemen if (this.selectedBlueprint?.definition == null) return; const sectionToFieldsMap: Map = new Map(); - this.selectedBlueprint.definition.sections.forEach((section: DmpBlueprintDefinitionSection) => { + this.selectedBlueprint.definition.sections.forEach((section: PlanBlueprintDefinitionSection) => { let value: DmpFieldIndicator = new DmpFieldIndicator(section); sectionToFieldsMap.set(section.id.toString(), value); }); @@ -282,7 +282,7 @@ export class DmpEditorComponent extends BaseEditor implemen } refreshData(): void { - this.getItem(this.editorModel.id, (data: Dmp) => { + this.getItem(this.editorModel.id, (data: Plan) => { this.breadcrumbService.addIdResolvedValue(data.id.toString(), data.label); this.prepareForm(data) if (this.isNew === false && this.step === 0) this.nextStep(); @@ -302,7 +302,7 @@ export class DmpEditorComponent extends BaseEditor implemen } persistEntity(onSuccess?: (response) => void): void { - const formData = this.formService.getValue(this.formGroup.value) as DmpPersist; + const formData = this.formService.getValue(this.formGroup.value) as PlanPersist; //Transform to persist //Transform descriptionTemplates @@ -315,7 +315,7 @@ export class DmpEditorComponent extends BaseEditor implemen } } - this.dmpService.persist(formData) + this.planService.persist(formData) .pipe(takeUntil(this._destroyed)).subscribe( complete => onSuccess ? onSuccess(complete) : this.onCallbackSuccess(complete), error => this.onCallbackError(error) @@ -335,14 +335,14 @@ export class DmpEditorComponent extends BaseEditor implemen if (this.isNew) { - messageText = this.language.instant('DMP-EDITOR.ACTIONS.DISCARD.DISCARD-NEW-MESSAGE'); - confirmButtonText = this.language.instant('DMP-EDITOR.ACTIONS.DISCARD.DISCARD-NEW-CONFIRM'); - cancelButtonText = this.language.instant('DMP-EDITOR.ACTIONS.DISCARD.DISCARD-NEW-DENY'); + messageText = this.language.instant('PLAN-EDITOR.ACTIONS.DISCARD.DISCARD-NEW-MESSAGE'); + confirmButtonText = this.language.instant('PLAN-EDITOR.ACTIONS.DISCARD.DISCARD-NEW-CONFIRM'); + cancelButtonText = this.language.instant('PLAN-EDITOR.ACTIONS.DISCARD.DISCARD-NEW-DENY'); isDeleteConfirmation = true; } else { - messageText = this.language.instant('DMP-EDITOR.ACTIONS.DISCARD.DISCARD-EDITED-MESSAGE'); - confirmButtonText = this.language.instant('DMP-EDITOR.ACTIONS.DISCARD.DISCARD-EDITED-CONFIRM'); - cancelButtonText = this.language.instant('DMP-EDITOR.ACTIONS.DISCARD.DISCARD-EDITED-DENY'); + messageText = this.language.instant('PLAN-EDITOR.ACTIONS.DISCARD.DISCARD-EDITED-MESSAGE'); + confirmButtonText = this.language.instant('PLAN-EDITOR.ACTIONS.DISCARD.DISCARD-EDITED-CONFIRM'); + cancelButtonText = this.language.instant('PLAN-EDITOR.ACTIONS.DISCARD.DISCARD-EDITED-DENY'); isDeleteConfirmation = false; } @@ -382,7 +382,7 @@ export class DmpEditorComponent extends BaseEditor implemen }); dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { if (result) { - this.dmpService.delete(value.id).pipe(takeUntil(this._destroyed)) + this.planService.delete(value.id).pipe(takeUntil(this._destroyed)) .subscribe( complete => this.onCallbackDeleteSuccess(), error => this.onCallbackError(error) @@ -401,18 +401,18 @@ export class DmpEditorComponent extends BaseEditor implemen } finalize() { - const dialogRef = this.dialog.open(DmpFinalizeDialogComponent, { + const dialogRef = this.dialog.open(PlanFinalizeDialogComponent, { maxWidth: '500px', restoreFocus: false, autoFocus: false, data: { - dmp: this.item + plan: this.item } }); - dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe((result: DmpFinalizeDialogOutput) => { + dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe((result: PlanFinalizeDialogOutput) => { if (result && !result.cancelled) { - this.dmpService.finalize(this.item.id, result.descriptionsToBeFinalized) + this.planService.finalize(this.item.id, result.descriptionsToBeFinalized) .pipe(takeUntil(this._destroyed)) .subscribe(data => { this.onCallbackSuccess() @@ -429,15 +429,15 @@ export class DmpEditorComponent extends BaseEditor implemen const dialogRef = this.dialog.open(ConfirmationDialogComponent, { restoreFocus: false, data: { - message: this.language.instant('DMP-OVERVIEW.UNDO-FINALIZATION-DIALOG.TITLE'), - confirmButton: this.language.instant('DMP-OVERVIEW.UNDO-FINALIZATION-DIALOG.CONFIRM'), - cancelButton: this.language.instant('DMP-OVERVIEW.UNDO-FINALIZATION-DIALOG.NEGATIVE'), + message: this.language.instant('PLAN-OVERVIEW.UNDO-FINALIZATION-DIALOG.TITLE'), + confirmButton: this.language.instant('PLAN-OVERVIEW.UNDO-FINALIZATION-DIALOG.CONFIRM'), + cancelButton: this.language.instant('PLAN-OVERVIEW.UNDO-FINALIZATION-DIALOG.NEGATIVE'), isDeleteConfirmation: false } }); dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { if (result) { - this.dmpService.undoFinalize(this.item.id, DmpEditorEntityResolver.lookupFields()).pipe(takeUntil(this._destroyed)) + this.planService.undoFinalize(this.item.id, PlanEditorEntityResolver.lookupFields()).pipe(takeUntil(this._destroyed)) .subscribe(data => { this.onCallbackSuccess() }, (error: any) => { @@ -507,7 +507,7 @@ export class DmpEditorComponent extends BaseEditor implemen // // selectBlueprint() { - this.dmpBlueprintService.getSingle(this.formGroup.get('blueprint').value, DmpEditorEntityResolver.blueprintLookupFields()).pipe(takeUntil(this._destroyed)) + this.planBlueprintService.getSingle(this.formGroup.get('blueprint').value, PlanEditorEntityResolver.blueprintLookupFields()).pipe(takeUntil(this._destroyed)) .subscribe(data => { this.selectedBlueprint = data; this.buildFormAfterBlueprintSelection(); @@ -517,7 +517,7 @@ export class DmpEditorComponent extends BaseEditor implemen } selectDefaultBlueprint(): void { - this.dmpBlueprintService.getSingle(this.configurationService.defaultBlueprintId, DmpEditorEntityResolver.blueprintLookupFields()).pipe(takeUntil(this._destroyed)) + this.planBlueprintService.getSingle(this.configurationService.defaultBlueprintId, PlanEditorEntityResolver.blueprintLookupFields()).pipe(takeUntil(this._destroyed)) .subscribe(data => { this.selectedBlueprint = data; this.formGroup.get('blueprint').setValue(this.selectedBlueprint.id); @@ -532,11 +532,11 @@ export class DmpEditorComponent extends BaseEditor implemen } private buildFormAfterBlueprintSelection() { - const dmp: Dmp = { + const dmp: Plan = { label: this.formGroup.get('label').value, description: this.formGroup.get('description').value, blueprint: this.selectedBlueprint, - status: DmpStatus.Draft + status: PlanStatus.Draft } this.prepareForm(dmp); @@ -568,7 +568,7 @@ export class DmpEditorComponent extends BaseEditor implemen removeContact(contactIndex: number): void { (this.formGroup.get('properties').get('contacts') as FormArray).removeAt(contactIndex); - DmpEditorModel.reApplyPropertiesValidators( + PlanEditorModel.reApplyPropertiesValidators( { formGroup: this.formGroup, validationErrorModel: this.editorModel.validationErrorModel, @@ -584,7 +584,7 @@ export class DmpEditorComponent extends BaseEditor implemen moveItemInArray(contactsFormArray.controls, event.previousIndex, event.currentIndex); contactsFormArray.updateValueAndValidity(); - DmpEditorModel.reApplyPropertiesValidators( + PlanEditorModel.reApplyPropertiesValidators( { formGroup: this.formGroup, validationErrorModel: this.editorModel.validationErrorModel, @@ -595,7 +595,7 @@ export class DmpEditorComponent extends BaseEditor implemen } searchContact(contactIndex: number, field: FieldInSection): void { - const dialogRef = this.dialog.open(DmpContactPrefillDialogComponent, { + const dialogRef = this.dialog.open(PlanContactPrefillDialogComponent, { maxWidth: '700px', maxHeight: '80vh', data: { @@ -603,9 +603,9 @@ export class DmpEditorComponent extends BaseEditor implemen label: field.label } }); - dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe((result: Dmp) => { + dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe((result: Plan) => { if (result) { - this.uiNotificationService.snackBarNotification(this.language.instant('DMP-EDITOR.SNACK-BAR.SUCCESSFUL-DMP-CONTACT'), SnackBarNotificationLevel.Success); + this.uiNotificationService.snackBarNotification(this.language.instant('PLAN-EDITOR.SNACK-BAR.SUCCESSFUL-PLAN-CONTACT'), SnackBarNotificationLevel.Success); } }); } @@ -617,7 +617,7 @@ export class DmpEditorComponent extends BaseEditor implemen // // public descriptionsInSection(sectionId: Guid) { - return this.item?.descriptions?.filter(x => x.isActive == IsActive.Active && x?.dmpDescriptionTemplate?.sectionId === sectionId && x.dmpDescriptionTemplate.isActive == IsActive.Active) || []; + return this.item?.descriptions?.filter(x => x.isActive == IsActive.Active && x?.planDescriptionTemplate?.sectionId === sectionId && x.planDescriptionTemplate.isActive == IsActive.Active) || []; } editDescription(id: string, isNew: boolean) { @@ -654,24 +654,24 @@ export class DmpEditorComponent extends BaseEditor implemen }); } - hasDescriptionTemplates(section: DmpBlueprintDefinitionSection): boolean { - if (this.item.dmpDescriptionTemplates?.filter(x => x.sectionId == section.id).length > 0) return true; + hasDescriptionTemplates(section: PlanBlueprintDefinitionSection): boolean { + if (this.item.planDescriptionTemplates?.filter(x => x.sectionId == section.id).length > 0) return true; return false; } - hasValidMultiplicity(section: DmpBlueprintDefinitionSection): boolean { + hasValidMultiplicity(section: PlanBlueprintDefinitionSection): boolean { if (section.hasTemplates) { if (section.descriptionTemplates?.length > 0) { const descriptions = this.descriptionsInSection(section.id) - if (this.item.dmpDescriptionTemplates.filter(x => x.sectionId == section.id).length > descriptions.map(x => x.dmpDescriptionTemplate).length) { + if (this.item.planDescriptionTemplates.filter(x => x.sectionId == section.id).length > descriptions.map(x => x.planDescriptionTemplate).length) { return true; } let multiplicityValidResults: boolean[] = []; section.descriptionTemplates.forEach(sectionDescriptionTemplate => { if (sectionDescriptionTemplate.maxMultiplicity != null) { - const count = descriptions.filter(x => x.dmpDescriptionTemplate.descriptionTemplateGroupId == sectionDescriptionTemplate.descriptionTemplateGroupId).length || 0; + const count = descriptions.filter(x => x.planDescriptionTemplate.descriptionTemplateGroupId == sectionDescriptionTemplate.descriptionTemplateGroupId).length || 0; if (count >= sectionDescriptionTemplate.maxMultiplicity) multiplicityValidResults.push(false); else multiplicityValidResults.push(true); } else { @@ -726,9 +726,9 @@ export class DmpEditorComponent extends BaseEditor implemen if (descriptionsInSection && descriptionsInSection.length > 0) { for (let index = 0; index < descriptionsInSection.length; index++) { const description = descriptionsInSection[index]; - if (description.dmpDescriptionTemplate?.descriptionTemplateGroupId === event.groupId) { + if (description.planDescriptionTemplate?.descriptionTemplateGroupId === event.groupId) { foundDescription = true; - this.uiNotificationService.snackBarNotification(this.language.instant('DMP-EDITOR.UNSUCCESSFUL-REMOVE-TEMPLATE'), SnackBarNotificationLevel.Error); + this.uiNotificationService.snackBarNotification(this.language.instant('PLAN-EDITOR.UNSUCCESSFUL-REMOVE-TEMPLATE'), SnackBarNotificationLevel.Error); break; } } @@ -747,10 +747,10 @@ export class DmpEditorComponent extends BaseEditor implemen if (descriptionsInSection && descriptionsInSection.length > 0) { for (let index = 0; index < descriptionsInSection.length; index++) { const description = descriptionsInSection[index]; - if (description.dmpDescriptionTemplate?.descriptionTemplateGroupId === item.groupId) { + if (description.planDescriptionTemplate?.descriptionTemplateGroupId === item.groupId) { return { canRemove: false, - message: 'DMP-EDITOR.UNSUCCESSFUL-REMOVE-TEMPLATE' + message: 'PLAN-EDITOR.UNSUCCESSFUL-REMOVE-TEMPLATE' } as MultipleAutoCompleteCanRemoveItem } } diff --git a/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.model.ts b/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.model.ts index 54ef53c1f..93a967781 100644 --- a/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.model.ts +++ b/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.model.ts @@ -1,14 +1,14 @@ import { FormArray, FormControl, UntypedFormBuilder, UntypedFormGroup, Validators } from "@angular/forms"; -import { DmpAccessType } from "@app/core/common/enum/plan-access-type"; -import { DmpBlueprintFieldCategory } from "@app/core/common/enum/plan-blueprint-field-category"; -import { DmpBlueprintSystemFieldType } from "@app/core/common/enum/plan-blueprint-system-field-type"; -import { DmpStatus } from "@app/core/common/enum/plan-status"; -import { DmpUserRole } from "@app/core/common/enum/plan-user-role"; -import { DmpUserType } from "@app/core/common/enum/plan-user-type"; +import { PlanAccessType } from "@app/core/common/enum/plan-access-type"; +import { PlanBlueprintFieldCategory } from "@app/core/common/enum/plan-blueprint-field-category"; +import { PlanBlueprintSystemFieldType } from "@app/core/common/enum/plan-blueprint-system-field-type"; +import { PlanStatus } from "@app/core/common/enum/plan-status"; +import { PlanUserRole } from "@app/core/common/enum/plan-user-role"; +import { PlanUserType } from "@app/core/common/enum/plan-user-type"; import { IsActive } from "@app/core/common/enum/is-active.enum"; -import { DmpBlueprint, DmpBlueprintDefinitionSection, ExtraFieldInSection, FieldInSection, ReferenceTypeFieldInSection, SystemFieldInSection } from "@app/core/model/plan-blueprint/plan-blueprint"; -import { Dmp, DmpBlueprintValue, DmpBlueprintValuePersist, DmpContact, DmpContactPersist, DmpDescriptionTemplate, DmpDescriptionTemplatePersist, DmpPersist, DmpProperties, DmpPropertiesPersist, DmpReferenceDataPersist, DmpReferencePersist, DmpUser, DmpUserPersist } from "@app/core/model/plan/plan"; -import { DmpReference } from "@app/core/model/plan/plan-reference"; +import { PlanBlueprint, PlanBlueprintDefinitionSection, ExtraFieldInSection, FieldInSection, ReferenceTypeFieldInSection, SystemFieldInSection } from "@app/core/model/plan-blueprint/plan-blueprint"; +import { Plan, PlanBlueprintValue, PlanBlueprintValuePersist, PlanContact, PlanContactPersist, PlanDescriptionTemplate, PlanDescriptionTemplatePersist, PlanPersist, PlanProperties, PlanPropertiesPersist, PlanReferenceDataPersist, PlanReferencePersist, PlanUser, PlanUserPersist } from "@app/core/model/plan/plan"; +import { PlanReference } from "@app/core/model/plan/plan-reference"; import { ReferencePersist } from "@app/core/model/reference/reference"; import { BaseEditorModel } from "@common/base/base-form-editor-model"; import { BackendErrorValidator } from '@common/forms/validation/custom-validator'; @@ -16,16 +16,16 @@ import { ValidationErrorModel } from '@common/forms/validation/error-model/valid import { Validation, ValidationContext } from '@common/forms/validation/validation-context'; import { Guid } from "@common/types/guid"; -export class DmpEditorModel extends BaseEditorModel implements DmpPersist { +export class PlanEditorModel extends BaseEditorModel implements PlanPersist { label: string; - status: DmpStatus; - properties: DmpPropertiesEditorModel = new DmpPropertiesEditorModel(this.validationErrorModel); + status: PlanStatus; + properties: PlanPropertiesEditorModel = new PlanPropertiesEditorModel(this.validationErrorModel); description: String; language: String; blueprint: Guid; - accessType: DmpAccessType; - descriptionTemplates: DmpDescriptionTemplateEditorModel[] = []; - users: DmpUserEditorModel[] = []; + accessType: PlanAccessType; + descriptionTemplates: PlanDescriptionTemplateEditorModel[] = []; + users: PlanUserEditorModel[] = []; permissions: string[]; public validationErrorModel: ValidationErrorModel = new ValidationErrorModel(); @@ -33,40 +33,40 @@ export class DmpEditorModel extends BaseEditorModel implements DmpPersist { constructor() { super(); } - public fromModel(item: Dmp): DmpEditorModel { + public fromModel(item: Plan): PlanEditorModel { if (item) { super.fromModel(item); this.label = item.label; this.status = item.status; - this.properties = new DmpPropertiesEditorModel(this.validationErrorModel).fromModel(item.properties, item.dmpReferences?.filter(x => x.isActive === IsActive.Active), item.blueprint); + this.properties = new PlanPropertiesEditorModel(this.validationErrorModel).fromModel(item.properties, item.planReferences?.filter(x => x.isActive === IsActive.Active), item.blueprint); this.description = item.description; this.language = item.language; this.blueprint = item.blueprint?.id; this.accessType = item.accessType; - if (item?.dmpUsers) { item.dmpUsers.filter(x => x.isActive === IsActive.Active).map(x => this.users.push(new DmpUserEditorModel(this.validationErrorModel).fromModel(x))); } + if (item?.planUsers) { item.planUsers.filter(x => x.isActive === IsActive.Active).map(x => this.users.push(new PlanUserEditorModel(this.validationErrorModel).fromModel(x))); } item.blueprint.definition.sections.forEach(section => { if (section.hasTemplates) { - const sectionTempaltesFromDmp = item.dmpDescriptionTemplates?.filter(x => x.sectionId == section.id && x.isActive == IsActive.Active) || []; + const sectionTempaltesFromDmp = item.planDescriptionTemplates?.filter(x => x.sectionId == section.id && x.isActive == IsActive.Active) || []; if (sectionTempaltesFromDmp.length > 0) { - sectionTempaltesFromDmp?.filter(x => x.sectionId == section.id).forEach(dmpDescriptionTemplate => { - this.descriptionTemplates.push(new DmpDescriptionTemplateEditorModel(this.validationErrorModel).fromModel( + sectionTempaltesFromDmp?.filter(x => x.sectionId == section.id).forEach(planDescriptionTemplate => { + this.descriptionTemplates.push(new PlanDescriptionTemplateEditorModel(this.validationErrorModel).fromModel( { sectionId: section.id, - descriptionTemplateGroupId: dmpDescriptionTemplate?.descriptionTemplateGroupId, + descriptionTemplateGroupId: planDescriptionTemplate?.descriptionTemplateGroupId, })); }); } else if (section.descriptionTemplates?.length > 0) { section.descriptionTemplates.forEach(blueprintDefinedDescriptionTemplate => { - this.descriptionTemplates.push(new DmpDescriptionTemplateEditorModel(this.validationErrorModel).fromModel( + this.descriptionTemplates.push(new PlanDescriptionTemplateEditorModel(this.validationErrorModel).fromModel( { sectionId: section.id, descriptionTemplateGroupId: blueprintDefinedDescriptionTemplate?.descriptionTemplateGroupId, })); }); } else { - this.descriptionTemplates.push(new DmpDescriptionTemplateEditorModel(this.validationErrorModel).fromModel( + this.descriptionTemplates.push(new PlanDescriptionTemplateEditorModel(this.validationErrorModel).fromModel( { sectionId: section.id, })); @@ -142,7 +142,7 @@ export class DmpEditorModel extends BaseEditorModel implements DmpPersist { } createChildContact(index: number): UntypedFormGroup { - const contact: DmpContactEditorModel = new DmpContactEditorModel(this.validationErrorModel); + const contact: PlanContactEditorModel = new PlanContactEditorModel(this.validationErrorModel); return contact.buildForm({ rootPath: 'properties.contacts[' + index + '].' }); } @@ -150,12 +150,12 @@ export class DmpEditorModel extends BaseEditorModel implements DmpPersist { static reApplyPropertiesValidators(params: { formGroup: UntypedFormGroup, validationErrorModel: ValidationErrorModel, - blueprint: DmpBlueprint + blueprint: PlanBlueprint }): void { const { formGroup, validationErrorModel } = params; const control = formGroup?.get('properties'); - DmpPropertiesEditorModel.reapplyValidators({ + PlanPropertiesEditorModel.reapplyValidators({ formGroup: control as UntypedFormGroup, rootPath: `properties.`, validationErrorModel: validationErrorModel, @@ -174,7 +174,7 @@ export class DmpEditorModel extends BaseEditorModel implements DmpPersist { const keys = Object.keys(descriptionTemplates.value as Object); keys.forEach((key) => { const control = descriptionTemplates?.get(key); - DmpDescriptionTemplateEditorModel.reapplyValidators({ + PlanDescriptionTemplateEditorModel.reapplyValidators({ formGroup: control as UntypedFormGroup, rootPath: `descriptionTemplates[${key}].`, validationErrorModel: validationErrorModel @@ -189,7 +189,7 @@ export class DmpEditorModel extends BaseEditorModel implements DmpPersist { const { formGroup, validationErrorModel } = params; (formGroup.get('users') as FormArray).controls?.forEach( - (control, index) => DmpUserEditorModel.reapplyValidators({ + (control, index) => PlanUserEditorModel.reapplyValidators({ formGroup: control as UntypedFormGroup, rootPath: `users[${index}].`, validationErrorModel: validationErrorModel @@ -198,9 +198,9 @@ export class DmpEditorModel extends BaseEditorModel implements DmpPersist { } } -export class DmpPropertiesEditorModel implements DmpPropertiesPersist { - dmpBlueprintValues: Map = new Map; - contacts: DmpContactEditorModel[] = []; +export class PlanPropertiesEditorModel implements PlanPropertiesPersist { + planBlueprintValues: Map = new Map; + contacts: PlanContactEditorModel[] = []; protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder(); @@ -208,23 +208,23 @@ export class DmpPropertiesEditorModel implements DmpPropertiesPersist { public validationErrorModel: ValidationErrorModel = new ValidationErrorModel() ) { } - fromModel(item: DmpProperties, dmpReferences: DmpReference[], dmpBlueprint: DmpBlueprint): DmpPropertiesEditorModel { + fromModel(item: PlanProperties, planReferences: PlanReference[], dmpBlueprint: PlanBlueprint): PlanPropertiesEditorModel { dmpBlueprint.definition.sections.forEach(section => { section.fields?.forEach(field => { - if (field.category !== DmpBlueprintFieldCategory.System) { - this.dmpBlueprintValues.set(field.id, new DmpBlueprintValueEditorModel(this.validationErrorModel).fromModel( + if (field.category !== PlanBlueprintFieldCategory.System) { + this.planBlueprintValues.set(field.id, new PlanBlueprintValueEditorModel(this.validationErrorModel).fromModel( { fieldId: field.id, - fieldValue: item?.dmpBlueprintValues?.find(x => x.fieldId == field.id)?.fieldValue || undefined, - dateValue: item?.dmpBlueprintValues?.find(x => x.fieldId == field.id)?.dateValue || undefined, - numberValue: item?.dmpBlueprintValues?.find(x => x.fieldId == field.id)?.numberValue || undefined, - }, dmpReferences, field)); + fieldValue: item?.planBlueprintValues?.find(x => x.fieldId == field.id)?.fieldValue || undefined, + dateValue: item?.planBlueprintValues?.find(x => x.fieldId == field.id)?.dateValue || undefined, + numberValue: item?.planBlueprintValues?.find(x => x.fieldId == field.id)?.numberValue || undefined, + }, planReferences, field)); } }); }); - if (item?.contacts) { item.contacts.map(x => this.contacts.push(new DmpContactEditorModel(this.validationErrorModel).fromModel(x))); } + if (item?.contacts) { item.contacts.map(x => this.contacts.push(new PlanContactEditorModel(this.validationErrorModel).fromModel(x))); } return this; } @@ -233,10 +233,10 @@ export class DmpPropertiesEditorModel implements DmpPropertiesPersist { context?: ValidationContext, disabled?: boolean, rootPath?: string - }, dmpReferences?: DmpReference[], dmpBlueprint?: DmpBlueprint): UntypedFormGroup { + }, planReferences?: PlanReference[], dmpBlueprint?: PlanBlueprint): UntypedFormGroup { let { context = null, disabled = false, rootPath } = params ?? {} if (context == null) { - context = DmpPropertiesEditorModel.createValidationContext({ + context = PlanPropertiesEditorModel.createValidationContext({ validationErrorModel: this.validationErrorModel, rootPath }); @@ -255,13 +255,13 @@ export class DmpPropertiesEditorModel implements DmpPropertiesPersist { }); - const dmpBlueprintValuesFormGroup = this.formBuilder.group({}); - this.dmpBlueprintValues.forEach((value, key) => dmpBlueprintValuesFormGroup.addControl(key.toString(), value.buildForm({ - rootPath: `${rootPath}dmpBlueprintValues[${key}].`, + const planBlueprintValuesFormGroup = this.formBuilder.group({}); + this.planBlueprintValues.forEach((value, key) => planBlueprintValuesFormGroup.addControl(key.toString(), value.buildForm({ + rootPath: `${rootPath}planBlueprintValues[${key}].`, disabled: disabled - })), context.getValidation('dmpBlueprintValues') + })), context.getValidation('planBlueprintValues') ) - formGroup.addControl('dmpBlueprintValues', dmpBlueprintValuesFormGroup); + formGroup.addControl('planBlueprintValues', planBlueprintValuesFormGroup); return formGroup; } @@ -274,7 +274,7 @@ export class DmpPropertiesEditorModel implements DmpPropertiesPersist { const baseContext: ValidationContext = new ValidationContext(); const baseValidationArray: Validation[] = new Array(); - baseValidationArray.push({ key: 'dmpBlueprintValues', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}dmpBlueprintValues`)] }); + baseValidationArray.push({ key: 'planBlueprintValues', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}planBlueprintValues`)] }); baseValidationArray.push({ key: 'contacts', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}contacts`)] }); baseContext.validation = baseValidationArray; @@ -285,18 +285,18 @@ export class DmpPropertiesEditorModel implements DmpPropertiesPersist { formGroup: UntypedFormGroup, validationErrorModel: ValidationErrorModel, rootPath: string, - blueprint: DmpBlueprint + blueprint: PlanBlueprint }): void { const { formGroup, rootPath, validationErrorModel } = params; - const dmpBlueprintValues = formGroup?.get('dmpBlueprintValues') as UntypedFormGroup; - const keys = Object.keys(dmpBlueprintValues.value as Object); + const planBlueprintValues = formGroup?.get('planBlueprintValues') as UntypedFormGroup; + const keys = Object.keys(planBlueprintValues.value as Object); keys.forEach((key) => { - const control = dmpBlueprintValues?.get(key); - DmpBlueprintValueEditorModel.reapplyValidators({ + const control = planBlueprintValues?.get(key); + PlanBlueprintValueEditorModel.reapplyValidators({ formGroup: control as UntypedFormGroup, - rootPath: `${rootPath}dmpBlueprintValues[${key}].`, + rootPath: `${rootPath}planBlueprintValues[${key}].`, validationErrorModel: validationErrorModel, isRequired: params.blueprint.definition.sections.flatMap(x => x.fields).find(x => x.id.toString() == key).required, multipleSelect: (params.blueprint.definition.sections.flatMap(x => x.fields).find(x => x.id.toString() == key) as ReferenceTypeFieldInSection).multipleSelect @@ -304,7 +304,7 @@ export class DmpPropertiesEditorModel implements DmpPropertiesPersist { }); (formGroup.get('contacts') as FormArray).controls?.forEach( - (control, index) => DmpContactEditorModel.reapplyValidators({ + (control, index) => PlanContactEditorModel.reapplyValidators({ formGroup: control as UntypedFormGroup, rootPath: `${rootPath}contacts[${index}].`, validationErrorModel: validationErrorModel @@ -313,16 +313,16 @@ export class DmpPropertiesEditorModel implements DmpPropertiesPersist { } } -export class DmpBlueprintValueEditorModel implements DmpBlueprintValuePersist { +export class PlanBlueprintValueEditorModel implements PlanBlueprintValuePersist { fieldId: Guid; fieldValue: string; dateValue: Date; numberValue: number; - references: DmpReferencePersist[] = []; - reference: DmpReferencePersist; + references: PlanReferencePersist[] = []; + reference: PlanReferencePersist; isRequired: boolean = false; multipleSelect: boolean = false; - category: DmpBlueprintFieldCategory; + category: PlanBlueprintFieldCategory; protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder(); @@ -330,12 +330,12 @@ export class DmpBlueprintValueEditorModel implements DmpBlueprintValuePersist { public validationErrorModel: ValidationErrorModel = new ValidationErrorModel() ) { } - fromModel(item: DmpBlueprintValue, dmpReferences: DmpReference[], field: FieldInSection): DmpBlueprintValueEditorModel { + fromModel(item: PlanBlueprintValue, planReferences: PlanReference[], field: FieldInSection): PlanBlueprintValueEditorModel { this.fieldId = item.fieldId; this.fieldValue = item.fieldValue; this.dateValue = item.dateValue; this.numberValue = item.numberValue; - const references = dmpReferences?.filter(x => x.data.blueprintFieldId == this.fieldId && x.isActive == IsActive.Active).map(x => { + const references = planReferences?.filter(x => x.data.blueprintFieldId == this.fieldId && x.isActive == IsActive.Active).map(x => { return { data: x.data, reference: { @@ -376,7 +376,7 @@ export class DmpBlueprintValueEditorModel implements DmpBlueprintValuePersist { }): UntypedFormGroup { let { context = null, disabled = false, rootPath } = params ?? {} if (context == null) { - context = DmpBlueprintValueEditorModel.createValidationContext({ + context = PlanBlueprintValueEditorModel.createValidationContext({ validationErrorModel: this.validationErrorModel, rootPath, isRequired: this.isRequired, @@ -388,12 +388,12 @@ export class DmpBlueprintValueEditorModel implements DmpBlueprintValuePersist { fieldId: [{ value: this.fieldId, disabled: disabled }, context.getValidation('fieldId').validators], }); switch (this.category) { - case DmpBlueprintFieldCategory.ReferenceType: + case PlanBlueprintFieldCategory.ReferenceType: formGroup.addControl('references', new FormControl({ value: this.references?.map(x => x.reference), disabled: disabled }, context.getValidation('references').validators)); formGroup.addControl('reference', new FormControl({ value: this.reference?.reference, disabled: disabled }, context.getValidation('reference').validators)); break; - case DmpBlueprintFieldCategory.System: - case DmpBlueprintFieldCategory.Extra: + case PlanBlueprintFieldCategory.System: + case PlanBlueprintFieldCategory.Extra: formGroup.addControl('fieldValue', new FormControl({ value: this.fieldValue, disabled: disabled }, context.getValidation('fieldValue').validators)); formGroup.addControl('dateValue', new FormControl({ value: this.dateValue, disabled: disabled }, context.getValidation('dateValue').validators)); formGroup.addControl('numberValue', new FormControl({ value: this.numberValue, disabled: disabled }, context.getValidation('numberValue').validators)); @@ -433,7 +433,7 @@ export class DmpBlueprintValueEditorModel implements DmpBlueprintValuePersist { }): void { const { formGroup, rootPath, validationErrorModel } = params; - const context = DmpBlueprintValueEditorModel.createValidationContext({ + const context = PlanBlueprintValueEditorModel.createValidationContext({ rootPath, validationErrorModel, isRequired: params.isRequired, @@ -448,7 +448,7 @@ export class DmpBlueprintValueEditorModel implements DmpBlueprintValuePersist { } } -export class DmpContactEditorModel implements DmpContactPersist { +export class PlanContactEditorModel implements PlanContactPersist { firstName: string; lastName: string; email: string; @@ -459,7 +459,7 @@ export class DmpContactEditorModel implements DmpContactPersist { public validationErrorModel: ValidationErrorModel = new ValidationErrorModel() ) { } - fromModel(item: DmpContact): DmpContactEditorModel { + fromModel(item: PlanContact): PlanContactEditorModel { this.firstName = item.firstName; this.lastName = item.lastName; this.email = item.email; @@ -474,7 +474,7 @@ export class DmpContactEditorModel implements DmpContactPersist { }): UntypedFormGroup { let { context = null, disabled = false, rootPath } = params ?? {} if (context == null) { - context = DmpContactEditorModel.createValidationContext({ + context = PlanContactEditorModel.createValidationContext({ validationErrorModel: this.validationErrorModel, rootPath }); @@ -510,7 +510,7 @@ export class DmpContactEditorModel implements DmpContactPersist { }): void { const { formGroup, rootPath, validationErrorModel } = params; - const context = DmpContactEditorModel.createValidationContext({ + const context = PlanContactEditorModel.createValidationContext({ rootPath, validationErrorModel }); @@ -523,11 +523,11 @@ export class DmpContactEditorModel implements DmpContactPersist { } } -export class DmpUserEditorModel implements DmpUserPersist { +export class PlanUserEditorModel implements PlanUserPersist { user: Guid; - role: DmpUserRole; + role: PlanUserRole; email: string; - userType: DmpUserType = DmpUserType.Internal; + userType: PlanUserType = PlanUserType.Internal; sectionId: string = ''; protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder(); @@ -536,11 +536,11 @@ export class DmpUserEditorModel implements DmpUserPersist { public validationErrorModel: ValidationErrorModel = new ValidationErrorModel() ) { } - fromModel(item: DmpUser): DmpUserEditorModel { + fromModel(item: PlanUser): PlanUserEditorModel { if (item?.user?.id) this.user = item.user.id; this.role = item.role; // TODO this.email = item.email; - this.userType = (item == null || this.user != null) ? DmpUserType.Internal : DmpUserType.External; + this.userType = (item == null || this.user != null) ? PlanUserType.Internal : PlanUserType.External; this.sectionId = item.sectionId?.toString() || ''; //Trick to allow a null option for all items. return this; @@ -553,7 +553,7 @@ export class DmpUserEditorModel implements DmpUserPersist { }): UntypedFormGroup { let { context = null, disabled = false, rootPath } = params ?? {} if (context == null) { - context = DmpUserEditorModel.createValidationContext({ + context = PlanUserEditorModel.createValidationContext({ validationErrorModel: this.validationErrorModel, rootPath }); @@ -593,7 +593,7 @@ export class DmpUserEditorModel implements DmpUserPersist { }): void { const { formGroup, rootPath, validationErrorModel } = params; - const context = DmpUserEditorModel.createValidationContext({ + const context = PlanUserEditorModel.createValidationContext({ rootPath, validationErrorModel }); @@ -606,11 +606,11 @@ export class DmpUserEditorModel implements DmpUserPersist { } } -export class DmpReferenceEditorModel implements DmpReferencePersist { +export class PlanReferenceEditorModel implements PlanReferencePersist { id: Guid; reference: ReferencePersist; referenceId: Guid; - data: DmpReferenceDataPersist; + data: PlanReferenceDataPersist; hash: string; protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder(); @@ -619,7 +619,7 @@ export class DmpReferenceEditorModel implements DmpReferencePersist { public validationErrorModel: ValidationErrorModel = new ValidationErrorModel() ) { } - fromModel(item: DmpReference): DmpReferenceEditorModel { + fromModel(item: PlanReference): PlanReferenceEditorModel { this.id = item.id; // this.reference = item.reference; //TODO: refactor reference type this.data = item.data; @@ -635,7 +635,7 @@ export class DmpReferenceEditorModel implements DmpReferencePersist { }): UntypedFormGroup { let { context = null, disabled = false, rootPath } = params ?? {} if (context == null) { - context = DmpReferenceEditorModel.createValidationContext({ + context = PlanReferenceEditorModel.createValidationContext({ validationErrorModel: this.validationErrorModel, rootPath }); @@ -667,7 +667,7 @@ export class DmpReferenceEditorModel implements DmpReferencePersist { } } -export class DmpDescriptionTemplateEditorModel implements DmpDescriptionTemplatePersist { +export class PlanDescriptionTemplateEditorModel implements PlanDescriptionTemplatePersist { descriptionTemplateGroupId: Guid; sectionId: Guid; @@ -677,7 +677,7 @@ export class DmpDescriptionTemplateEditorModel implements DmpDescriptionTemplate public validationErrorModel: ValidationErrorModel = new ValidationErrorModel() ) { } - fromModel(item: DmpDescriptionTemplate): DmpDescriptionTemplateEditorModel { + fromModel(item: PlanDescriptionTemplate): PlanDescriptionTemplateEditorModel { this.descriptionTemplateGroupId = item.descriptionTemplateGroupId; this.sectionId = item.sectionId; @@ -691,7 +691,7 @@ export class DmpDescriptionTemplateEditorModel implements DmpDescriptionTemplate }): UntypedFormGroup { let { context = null, disabled = false, rootPath } = params ?? {} if (context == null) { - context = DmpDescriptionTemplateEditorModel.createValidationContext({ + context = PlanDescriptionTemplateEditorModel.createValidationContext({ validationErrorModel: this.validationErrorModel, rootPath: rootPath, }); @@ -725,7 +725,7 @@ export class DmpDescriptionTemplateEditorModel implements DmpDescriptionTemplate }): void { const { formGroup, rootPath, validationErrorModel } = params; - const context = DmpDescriptionTemplateEditorModel.createValidationContext({ + const context = PlanDescriptionTemplateEditorModel.createValidationContext({ rootPath, validationErrorModel }); @@ -746,7 +746,7 @@ export class DmpFieldIndicator { return this._fieldControlNames; } - constructor(section: DmpBlueprintDefinitionSection) { + constructor(section: PlanBlueprintDefinitionSection) { this._fieldControlNames = []; if (section.hasTemplates) { @@ -754,13 +754,13 @@ export class DmpFieldIndicator { } else { section.fields.forEach((field: FieldInSection) => { switch (field.category) { - case DmpBlueprintFieldCategory.System: + case PlanBlueprintFieldCategory.System: this.buildSystemField(field as SystemFieldInSection); break; - case DmpBlueprintFieldCategory.ReferenceType: + case PlanBlueprintFieldCategory.ReferenceType: this.buildReferenceTypeField(field as ReferenceTypeFieldInSection); break; - case DmpBlueprintFieldCategory.Extra: + case PlanBlueprintFieldCategory.Extra: this.buildExtraField(field as ExtraFieldInSection); break; } @@ -770,22 +770,22 @@ export class DmpFieldIndicator { buildSystemField(field: SystemFieldInSection): void { switch (field.systemFieldType) { - case DmpBlueprintSystemFieldType.Title: + case PlanBlueprintSystemFieldType.Title: this._fieldControlNames.push("label"); break; - case DmpBlueprintSystemFieldType.Description: + case PlanBlueprintSystemFieldType.Description: this._fieldControlNames.push("description"); break; - case DmpBlueprintSystemFieldType.Language: + case PlanBlueprintSystemFieldType.Language: this._fieldControlNames.push("language"); break; - case DmpBlueprintSystemFieldType.Contact: + case PlanBlueprintSystemFieldType.Contact: this._fieldControlNames.push("properties.contacts"); break; - case DmpBlueprintSystemFieldType.AccessRights: + case PlanBlueprintSystemFieldType.AccessRights: this._fieldControlNames.push("accessType"); break; - case DmpBlueprintSystemFieldType.User: + case PlanBlueprintSystemFieldType.User: this._fieldControlNames.push("users"); break; } @@ -793,13 +793,13 @@ export class DmpFieldIndicator { buildReferenceTypeField(field: ReferenceTypeFieldInSection): void { if (field.multipleSelect) { - this._fieldControlNames.push(`properties.dmpBlueprintValues.${field.id}.references`); + this._fieldControlNames.push(`properties.planBlueprintValues.${field.id}.references`); } else { - this._fieldControlNames.push(`properties.dmpBlueprintValues.${field.id}.reference`); + this._fieldControlNames.push(`properties.planBlueprintValues.${field.id}.reference`); } } buildExtraField(field: ExtraFieldInSection): void { - this._fieldControlNames.push(`properties.dmpBlueprintValues.${field.id}.fieldValue`); + this._fieldControlNames.push(`properties.planBlueprintValues.${field.id}.fieldValue`); } } diff --git a/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.module.ts b/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.module.ts index ae5579dd1..b454e8659 100644 --- a/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.module.ts +++ b/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.module.ts @@ -7,12 +7,12 @@ import { ReferenceFieldModule } from '@app/ui/reference/reference-field/referenc import { CommonFormsModule } from '@common/forms/common-forms.module'; import { ConfirmationDialogModule } from '@common/modules/confirmation-dialog/confirmation-dialog.module'; import { CommonUiModule } from '@common/ui/common-ui.module'; -import { DmpUserFieldModule } from '../plan-user-field/plan-user-field.module'; -import { DmpEditorComponent } from './plan-editor.component'; -import { DmpEditorRoutingModule } from './plan-editor.routing'; +import { PlanUserFieldModule } from '../plan-user-field/plan-user-field.module'; +import { PlanEditorComponent } from './plan-editor.component'; +import { PlanEditorRoutingModule } from './plan-editor.routing'; import { DmpFormProgressIndicationModule } from './form-progress-indication/plan-form-progress-indication.module'; import { DmpDeleteDialogModule } from '../plan-delete-dialog/plan-delete-dialog.module'; -import { DmpContactPrefillDialogModule } from '../plan-contact-prefill-dialog/plan-contact-prefill-dialog.module'; +import { PlanContactPrefillDialogModule } from '../plan-contact-prefill-dialog/plan-contact-prefill-dialog.module'; @NgModule({ imports: [ @@ -21,21 +21,21 @@ import { DmpContactPrefillDialogModule } from '../plan-contact-prefill-dialog/pl FormattingModule, ConfirmationDialogModule, DmpDeleteDialogModule, - DmpEditorRoutingModule, + PlanEditorRoutingModule, RichTextEditorModule, AutoCompleteModule, ReferenceFieldModule, DragDropModule, - DmpUserFieldModule, + PlanUserFieldModule, DmpFormProgressIndicationModule, - DmpContactPrefillDialogModule + PlanContactPrefillDialogModule ], declarations: [ - DmpEditorComponent, + PlanEditorComponent, ], exports: [ ], providers: [ ] }) -export class DmpEditorModule { } +export class PlanEditorModule { } diff --git a/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.routing.ts b/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.routing.ts index 772b79d6f..33d6ccb13 100644 --- a/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.routing.ts +++ b/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.routing.ts @@ -5,31 +5,31 @@ import { AppPermission } from '@app/core/common/enum/permission.enum'; import { PendingChangesGuard } from '@common/forms/pending-form-changes/pending-form-changes-guard.service'; // import { DmpOverviewComponent } from './overview/description-overview.component'; import { AuthGuard } from '@app/core/auth-guard.service'; -import { DmpEditorComponent } from './plan-editor.component'; -import { DmpEditorEntityResolver } from './resolvers/plan-editor-enitity.resolver'; -import { DmpEditorPermissionsResolver } from './resolvers/plan-editor-permissions.resolver'; +import { PlanEditorComponent } from './plan-editor.component'; +import { PlanEditorEntityResolver } from './resolvers/plan-editor-enitity.resolver'; +import { PlanEditorPermissionsResolver } from './resolvers/plan-editor-permissions.resolver'; const routes: Routes = [ { path: '', - component: DmpEditorComponent, + component: PlanEditorComponent, canActivate: [AuthGuard], canDeactivate: [PendingChangesGuard], data: { breadcrumb: true, authContext: { - permissions: [AppPermission.NewDmp] + permissions: [AppPermission.NewPlan] } } }, { path: ':id', canActivate: [AuthGuard], - component: DmpEditorComponent, + component: PlanEditorComponent, canDeactivate: [PendingChangesGuard], resolve: { - 'entity': DmpEditorEntityResolver, - 'permissions': DmpEditorPermissionsResolver + 'entity': PlanEditorEntityResolver, + 'permissions': PlanEditorPermissionsResolver }, data: { breadcrumb: true, @@ -43,6 +43,6 @@ const routes: Routes = [ @NgModule({ imports: [RouterModule.forChild(routes)], exports: [RouterModule], - providers: [DmpEditorEntityResolver, DmpEditorPermissionsResolver] + providers: [PlanEditorEntityResolver, PlanEditorPermissionsResolver] }) -export class DmpEditorRoutingModule { } +export class PlanEditorRoutingModule { } diff --git a/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.service.ts b/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.service.ts index d62da18d2..c00e858ff 100644 --- a/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.service.ts +++ b/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.service.ts @@ -2,7 +2,7 @@ import { Injectable } from "@angular/core"; import { ValidationErrorModel } from "@common/forms/validation/error-model/validation-error-model"; @Injectable() -export class DmpEditorService { +export class PlanEditorService { private validationErrorModel: ValidationErrorModel; public setValidationErrorModel(validationErrorModel: ValidationErrorModel): void { diff --git a/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/resolvers/plan-editor-enitity.resolver.ts b/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/resolvers/plan-editor-enitity.resolver.ts index 18596e59b..cec94bd7c 100644 --- a/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/resolvers/plan-editor-enitity.resolver.ts +++ b/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/resolvers/plan-editor-enitity.resolver.ts @@ -2,13 +2,13 @@ import { Injectable } from '@angular/core'; import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'; import { AppPermission } from '@app/core/common/enum/permission.enum'; import { Description } from '@app/core/model/description/description'; -import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection, ExtraFieldInSection, FieldInSection, ReferenceTypeFieldInSection, SystemFieldInSection } from '@app/core/model/plan-blueprint/plan-blueprint'; -import { Dmp, DmpBlueprintValue, DmpContact, DmpDescriptionTemplate, DmpProperties, DmpUser } from '@app/core/model/plan/plan'; -import { DmpReference, DmpReferenceData } from '@app/core/model/plan/plan-reference'; +import { DescriptionTemplatesInSection, PlanBlueprint, PlanBlueprintDefinition, PlanBlueprintDefinitionSection, ExtraFieldInSection, FieldInSection, ReferenceTypeFieldInSection, SystemFieldInSection } from '@app/core/model/plan-blueprint/plan-blueprint'; +import { Plan, PlanBlueprintValue, PlanContact, PlanDescriptionTemplate, PlanProperties, PlanUser } from '@app/core/model/plan/plan'; +import { PlanReference, PlanReferenceData } from '@app/core/model/plan/plan-reference'; import { ExternalFetcherBaseSourceConfiguration } from '@app/core/model/external-fetcher/external-fetcher'; import { ReferenceType, ReferenceTypeDefinition } from '@app/core/model/reference-type/reference-type'; import { Reference } from '@app/core/model/reference/reference'; -import { DmpService } from '@app/core/services/plan/plan.service'; +import { PlanService } from '@app/core/services/plan/plan.service'; import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service'; import { BaseEditorResolver } from '@common/base/base-editor.resolver'; import { Guid } from '@common/types/guid'; @@ -16,113 +16,113 @@ import { takeUntil, tap } from 'rxjs/operators'; import { nameof } from 'ts-simple-nameof'; @Injectable() -export class DmpEditorEntityResolver extends BaseEditorResolver { +export class PlanEditorEntityResolver extends BaseEditorResolver { - constructor(private descriptionService: DmpService, private breadcrumbService: BreadcrumbService) { + constructor(private descriptionService: PlanService, private breadcrumbService: BreadcrumbService) { super(); } public static lookupFields(): string[] { return [ ...BaseEditorResolver.lookupFields(), - nameof(x => x.id), - nameof(x => x.label), - nameof(x => x.status), - nameof(x => x.versionStatus), - nameof(x => x.groupId), - nameof(x => x.description), - nameof(x => x.language), - nameof(x => x.accessType), - nameof(x => x.isActive), - nameof(x => x.version), - nameof(x => x.updatedAt), - nameof(x => x.publicAfter), - nameof(x => x.creator), - nameof(x => x.hash), + nameof(x => x.id), + nameof(x => x.label), + nameof(x => x.status), + nameof(x => x.versionStatus), + nameof(x => x.groupId), + nameof(x => x.description), + nameof(x => x.language), + nameof(x => x.accessType), + nameof(x => x.isActive), + nameof(x => x.version), + nameof(x => x.updatedAt), + nameof(x => x.publicAfter), + nameof(x => x.creator), + nameof(x => x.hash), - [nameof(x => x.authorizationFlags), AppPermission.EditDmp].join('.'), - [nameof(x => x.authorizationFlags), AppPermission.DeleteDmp].join('.'), - [nameof(x => x.authorizationFlags), AppPermission.EditDescription].join('.'), + [nameof(x => x.authorizationFlags), AppPermission.EditPlan].join('.'), + [nameof(x => x.authorizationFlags), AppPermission.DeletePlan].join('.'), + [nameof(x => x.authorizationFlags), AppPermission.EditDescription].join('.'), - [nameof(x => x.properties), nameof(x => x.dmpBlueprintValues), nameof(x => x.fieldId)].join('.'), - [nameof(x => x.properties), nameof(x => x.dmpBlueprintValues), nameof(x => x.fieldValue)].join('.'), - [nameof(x => x.properties), nameof(x => x.dmpBlueprintValues), nameof(x => x.dateValue)].join('.'), - [nameof(x => x.properties), nameof(x => x.dmpBlueprintValues), nameof(x => x.numberValue)].join('.'), - [nameof(x => x.properties), nameof(x => x.contacts), nameof(x => x.firstName)].join('.'), - [nameof(x => x.properties), nameof(x => x.contacts), nameof(x => x.lastName)].join('.'), - [nameof(x => x.properties), nameof(x => x.contacts), nameof(x => x.email)].join('.'), + [nameof(x => x.properties), nameof(x => x.planBlueprintValues), nameof(x => x.fieldId)].join('.'), + [nameof(x => x.properties), nameof(x => x.planBlueprintValues), nameof(x => x.fieldValue)].join('.'), + [nameof(x => x.properties), nameof(x => x.planBlueprintValues), nameof(x => x.dateValue)].join('.'), + [nameof(x => x.properties), nameof(x => x.planBlueprintValues), nameof(x => x.numberValue)].join('.'), + [nameof(x => x.properties), nameof(x => x.contacts), nameof(x => x.firstName)].join('.'), + [nameof(x => x.properties), nameof(x => x.contacts), nameof(x => x.lastName)].join('.'), + [nameof(x => x.properties), nameof(x => x.contacts), nameof(x => x.email)].join('.'), - [nameof(x => x.descriptions), nameof(x => x.id)].join('.'), - [nameof(x => x.descriptions), nameof(x => x.label)].join('.'), - [nameof(x => x.descriptions), nameof(x => x.status)].join('.'), - [nameof(x => x.descriptions), nameof(x => x.isActive)].join('.'), - [nameof(x => x.descriptions), nameof(x => x.dmpDescriptionTemplate), nameof(x => x.id)].join('.'), - [nameof(x => x.descriptions), nameof(x => x.dmpDescriptionTemplate), nameof(x => x.sectionId)].join('.'), - [nameof(x => x.descriptions), nameof(x => x.dmpDescriptionTemplate), nameof(x => x.descriptionTemplateGroupId)].join('.'), - [nameof(x => x.descriptions), nameof(x => x.dmpDescriptionTemplate), nameof(x => x.isActive)].join('.'), + [nameof(x => x.descriptions), nameof(x => x.id)].join('.'), + [nameof(x => x.descriptions), nameof(x => x.label)].join('.'), + [nameof(x => x.descriptions), nameof(x => x.status)].join('.'), + [nameof(x => x.descriptions), nameof(x => x.isActive)].join('.'), + [nameof(x => x.descriptions), nameof(x => x.planDescriptionTemplate), nameof(x => x.id)].join('.'), + [nameof(x => x.descriptions), nameof(x => x.planDescriptionTemplate), nameof(x => x.sectionId)].join('.'), + [nameof(x => x.descriptions), nameof(x => x.planDescriptionTemplate), nameof(x => x.descriptionTemplateGroupId)].join('.'), + [nameof(x => x.descriptions), nameof(x => x.planDescriptionTemplate), nameof(x => x.isActive)].join('.'), - [nameof(x => x.dmpUsers), nameof(x => x.id)].join('.'), - [nameof(x => x.dmpUsers), nameof(x => x.user.id)].join('.'), - [nameof(x => x.dmpUsers), nameof(x => x.user.name)].join('.'), - [nameof(x => x.dmpUsers), nameof(x => x.role)].join('.'), - [nameof(x => x.dmpUsers), nameof(x => x.sectionId)].join('.'), - [nameof(x => x.dmpUsers), nameof(x => x.isActive)].join('.'), + [nameof(x => x.planUsers), nameof(x => x.id)].join('.'), + [nameof(x => x.planUsers), nameof(x => x.user.id)].join('.'), + [nameof(x => x.planUsers), nameof(x => x.user.name)].join('.'), + [nameof(x => x.planUsers), nameof(x => x.role)].join('.'), + [nameof(x => x.planUsers), nameof(x => x.sectionId)].join('.'), + [nameof(x => x.planUsers), nameof(x => x.isActive)].join('.'), - [nameof(x => x.dmpReferences), nameof(x => x.id)].join('.'), - [nameof(x => x.dmpReferences), nameof(x => x.isActive)].join('.'), - [nameof(x => x.dmpReferences), nameof(x => x.data), nameof(x => x.blueprintFieldId)].join('.'), - [nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.id)].join('.'), - [nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.label)].join('.'), - [nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.type), nameof(x => x.id)].join('.'), - [nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.source)].join('.'), - [nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.reference)].join('.'), - [nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.sourceType)].join('.'), + [nameof(x => x.planReferences), nameof(x => x.id)].join('.'), + [nameof(x => x.planReferences), nameof(x => x.isActive)].join('.'), + [nameof(x => x.planReferences), nameof(x => x.data), nameof(x => x.blueprintFieldId)].join('.'), + [nameof(x => x.planReferences), nameof(x => x.reference), nameof(x => x.id)].join('.'), + [nameof(x => x.planReferences), nameof(x => x.reference), nameof(x => x.label)].join('.'), + [nameof(x => x.planReferences), nameof(x => x.reference), nameof(x => x.type), nameof(x => x.id)].join('.'), + [nameof(x => x.planReferences), nameof(x => x.reference), nameof(x => x.source)].join('.'), + [nameof(x => x.planReferences), nameof(x => x.reference), nameof(x => x.reference)].join('.'), + [nameof(x => x.planReferences), nameof(x => x.reference), nameof(x => x.sourceType)].join('.'), - [nameof(x => x.dmpDescriptionTemplates), nameof(x => x.sectionId)].join('.'), - [nameof(x => x.dmpDescriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), - [nameof(x => x.dmpDescriptionTemplates), nameof(x => x.isActive)].join('.'), + [nameof(x => x.planDescriptionTemplates), nameof(x => x.sectionId)].join('.'), + [nameof(x => x.planDescriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), + [nameof(x => x.planDescriptionTemplates), nameof(x => x.isActive)].join('.'), - ...DmpEditorEntityResolver.blueprintLookupFields(nameof(x => x.blueprint)), + ...PlanEditorEntityResolver.blueprintLookupFields(nameof(x => x.blueprint)), ] } public static blueprintLookupFields(prefix?: string): string[] { return [ - (prefix ? prefix + '.' : '') + [nameof(x => x.id)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.definition)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.label)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.ordinal)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.description)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.hasTemplates)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.minMultiplicity)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.maxMultiplicity)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.id)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.category)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.label)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.placeholder)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.description)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.required)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.ordinal)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.dataType)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.systemFieldType)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.referenceType), nameof(x => x.id)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.referenceType), nameof(x => x.name)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.referenceType), nameof(x => x.code)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.multipleSelect)].join('.'), - (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.referenceType), nameof(x => x.definition), nameof(x=> x.sources), nameof(x=> x.referenceTypeDependencies) , nameof(x => x.id)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.id)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.label)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.ordinal)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.description)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.hasTemplates)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.minMultiplicity)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.maxMultiplicity)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.id)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.category)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.label)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.placeholder)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.description)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.required)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.ordinal)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.dataType)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.systemFieldType)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.referenceType), nameof(x => x.id)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.referenceType), nameof(x => x.name)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.referenceType), nameof(x => x.code)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.multipleSelect)].join('.'), + (prefix ? prefix + '.' : '') + [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.referenceType), nameof(x => x.definition), nameof(x=> x.sources), nameof(x=> x.referenceTypeDependencies) , nameof(x => x.id)].join('.'), ] } resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { const fields = [ - ...DmpEditorEntityResolver.lookupFields() + ...PlanEditorEntityResolver.lookupFields() ]; const id = route.paramMap.get('id'); if (id != null) { diff --git a/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/resolvers/plan-editor-permissions.resolver.ts b/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/resolvers/plan-editor-permissions.resolver.ts index c0472d719..9aff17970 100644 --- a/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/resolvers/plan-editor-permissions.resolver.ts +++ b/dmp-frontend/src/app/ui/plan/plan-editor-blueprint/resolvers/plan-editor-permissions.resolver.ts @@ -3,17 +3,17 @@ import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'; import { AppPermission } from '@app/core/common/enum/permission.enum'; import { DescriptionSectionPermissionResolver } from '@app/core/model/description/description'; import { DescriptionService } from '@app/core/services/description/description.service'; -import { DmpService } from '@app/core/services/plan/plan.service'; +import { PlanService } from '@app/core/services/plan/plan.service'; import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service'; import { BaseEditorResolver } from '@common/base/base-editor.resolver'; import { Guid } from '@common/types/guid'; import { mergeMap, takeUntil, tap } from 'rxjs/operators'; -import { DmpEditorEntityResolver } from './plan-editor-enitity.resolver'; +import { PlanEditorEntityResolver } from './plan-editor-enitity.resolver'; @Injectable() -export class DmpEditorPermissionsResolver extends BaseEditorResolver { +export class PlanEditorPermissionsResolver extends BaseEditorResolver { - constructor(private dmpService: DmpService, + constructor(private planService: PlanService, private breadcrumbService: BreadcrumbService, private descriptionService: DescriptionService, ) { @@ -23,16 +23,16 @@ export class DmpEditorPermissionsResolver extends BaseEditorResolver { resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { const fields = [ - ...DmpEditorEntityResolver.lookupFields() + ...PlanEditorEntityResolver.lookupFields() ]; const id = route.paramMap.get('id'); if (id != null) { - return this.dmpService + return this.planService .getSingle(Guid.parse(id), fields) .pipe(tap(x => this.breadcrumbService.addIdResolvedValue(id, x.label)), takeUntil(this._destroyed)) .pipe(mergeMap( data => { let descriptionSectionPermissionResolverModel: DescriptionSectionPermissionResolver = { - dmpId: data.id, + planId: data.id, sectionIds: data?.blueprint?.definition?.sections?.map(x => x.id), permissions: [AppPermission.EditDescription, AppPermission.DeleteDescription] }; diff --git a/dmp-frontend/src/app/ui/plan/plan-finalize-dialog/plan-finalize-dialog.component.html b/dmp-frontend/src/app/ui/plan/plan-finalize-dialog/plan-finalize-dialog.component.html index 73351668e..753699b23 100644 --- a/dmp-frontend/src/app/ui/plan/plan-finalize-dialog/plan-finalize-dialog.component.html +++ b/dmp-frontend/src/app/ui/plan/plan-finalize-dialog/plan-finalize-dialog.component.html @@ -1,6 +1,6 @@
      -
      {{ 'DMP-FINALISE-DIALOG.TITLE' | translate }}
      +
      {{ 'PLAN-FINALISE-DIALOG.TITLE' | translate }}
      close
      @@ -11,7 +11,7 @@ - {{ 'DMP-FINALISE-DIALOG.DMP' | translate }} + {{ 'PLAN-FINALISE-DIALOG.PLAN' | translate }} {{ dmp.label }} @@ -22,7 +22,7 @@ - {{ 'DMP-FINALISE-DIALOG.DESCRPIPTIONS' | translate }} + {{ 'PLAN-FINALISE-DIALOG.DESCRPIPTIONS' | translate }} @@ -33,7 +33,7 @@

      {{ 'TYPES.DESCRIPTION-STATUS.DRAFT' | translate }} - ({{'DMP-FINALISE-DIALOG.INVALID' | translate}}) + ({{'PLAN-FINALISE-DIALOG.INVALID' | translate}}) : {{ description.label }} @@ -42,12 +42,12 @@

      {{ description.label }}

      -
      {{ 'DMP-FINALISE-DIALOG.EMPTY' | translate }}
      +
      {{ 'PLAN-FINALISE-DIALOG.EMPTY' | translate }}
      -

      {{'DMP-FINALISE-DIALOG.FINALISE-TITLE' | translate}}

      +

      {{'PLAN-FINALISE-DIALOG.FINALISE-TITLE' | translate}}

      @@ -58,7 +58,7 @@
      - {{ 'DMP-FINALISE-DIALOG.VALIDATION.INVALID-DMP' | translate }} + {{ 'PLAN-FINALISE-DIALOG.VALIDATION.INVALID-PLAN' | translate }}
      @@ -69,28 +69,28 @@ - {{'DMP-FINALISE-DIALOG.VALIDATION.AT-LEAST-ONE-DESCRPIPTION-FINALISED' | translate}} + {{'PLAN-FINALISE-DIALOG.VALIDATION.AT-LEAST-ONE-DESCRPIPTION-FINALISED' | translate}}
      - {{ 'DMP-FINALISE-DIALOG.IMPACT' | translate }} + {{ 'PLAN-FINALISE-DIALOG.IMPACT' | translate }}
      -
      - {{ 'DMP-FINALISE-DIALOG.PUBLIC-DMP-MESSAGE' | translate }} +
      + {{ 'PLAN-FINALISE-DIALOG.PUBLIC-PLAN-MESSAGE' | translate }}
      -
      - {{ 'DMP-FINALISE-DIALOG.RESTRICTED-DMP-MESSAGE' | translate }} +
      + {{ 'PLAN-FINALISE-DIALOG.RESTRICTED-PLAN-MESSAGE' | translate }}
      - +
      - +
      diff --git a/dmp-frontend/src/app/ui/plan/plan-finalize-dialog/plan-finalize-dialog.component.ts b/dmp-frontend/src/app/ui/plan/plan-finalize-dialog/plan-finalize-dialog.component.ts index 1512843dc..74de3b32f 100644 --- a/dmp-frontend/src/app/ui/plan/plan-finalize-dialog/plan-finalize-dialog.component.ts +++ b/dmp-frontend/src/app/ui/plan/plan-finalize-dialog/plan-finalize-dialog.component.ts @@ -2,10 +2,10 @@ import { Component, Inject, OnInit } from '@angular/core'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { Router } from '@angular/router'; import { DescriptionStatus } from '@app/core/common/enum/description-status'; -import { DmpAccessType } from '@app/core/common/enum/plan-access-type'; -import { Dmp } from '@app/core/model/plan/plan'; +import { PlanAccessType } from '@app/core/common/enum/plan-access-type'; +import { Plan } from '@app/core/model/plan/plan'; import { DescriptionService } from '@app/core/services/description/description.service'; -import { DmpService } from '@app/core/services/plan/plan.service'; +import { PlanService } from '@app/core/services/plan/plan.service'; import { BaseComponent } from '@common/base/base.component'; import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service'; import { Guid } from '@common/types/guid'; @@ -17,12 +17,12 @@ import { takeUntil } from 'rxjs/operators'; templateUrl: 'plan-finalize-dialog.component.html', styleUrls: ['./plan-finalize-dialog.component.scss'] }) -export class DmpFinalizeDialogComponent extends BaseComponent implements OnInit { +export class PlanFinalizeDialogComponent extends BaseComponent implements OnInit { - dmp: Dmp; + dmp: Plan; isDmpValid: boolean; dmpErrors: string[]; - dmpAccessTypeEnum = DmpAccessType; + planAccessTypeEnum = PlanAccessType; descriptionStatusEnum = DescriptionStatus; descriptionValidationOutputEnum = DescriptionValidationOutput; validationResults: DescriptionValidationResult[] = []; @@ -31,20 +31,20 @@ export class DmpFinalizeDialogComponent extends BaseComponent implements OnInit constructor( public router: Router, - public dialogRef: MatDialogRef, + public dialogRef: MatDialogRef, public descriptionService: DescriptionService, - private dmpService: DmpService, + private planService: PlanService, private httpErrorHandlingService: HttpErrorHandlingService, @Inject(MAT_DIALOG_DATA) public data: any ) { super(); - this.dmp = data.dmp; + this.dmp = data.plan; } ngOnInit(): void { - this.dmpService.validate(this.dmp.id).pipe(takeUntil(this._destroyed),) + this.planService.validate(this.dmp.id).pipe(takeUntil(this._destroyed),) .subscribe(result => { - if (result.result === DmpValidationOutput.Valid){ + if (result.result === PlanValidationOutput.Valid){ this.validateDescriptions(this.dmp); this.isDmpValid = true; }else{ @@ -69,7 +69,7 @@ export class DmpFinalizeDialogComponent extends BaseComponent implements OnInit } onSubmit() { - this.dialogRef.close({ descriptionsToBeFinalized: this.descriptionsToBeFinalized } as DmpFinalizeDialogOutput); + this.dialogRef.close({ descriptionsToBeFinalized: this.descriptionsToBeFinalized } as PlanFinalizeDialogOutput); } getFinalizedDescriptions() { @@ -84,10 +84,10 @@ export class DmpFinalizeDialogComponent extends BaseComponent implements OnInit } close() { - this.dialogRef.close({ cancelled: true } as DmpFinalizeDialogOutput); + this.dialogRef.close({ cancelled: true } as PlanFinalizeDialogOutput); } - validateDescriptions(dmp: Dmp) { + validateDescriptions(dmp: Plan) { if (!dmp.descriptions?.some(x => x.status == DescriptionStatus.Draft)) return; const draftDescriptions = this.dmp.descriptions.filter(x => x.status == DescriptionStatus.Draft) || []; @@ -124,19 +124,19 @@ export enum DescriptionValidationOutput { Pending = 3 } -export interface DmpValidationResult { +export interface PlanValidationResult { id: Guid; - result: DmpValidationOutput; + result: PlanValidationOutput; errors: string[]; } -export enum DmpValidationOutput { +export enum PlanValidationOutput { Valid = 1, Invalid = 2 } -export interface DmpFinalizeDialogOutput { +export interface PlanFinalizeDialogOutput { cancelled?: boolean; descriptionsToBeFinalized?: Guid[]; } diff --git a/dmp-frontend/src/app/ui/plan/plan-finalize-dialog/plan-finalize-dialog.module.ts b/dmp-frontend/src/app/ui/plan/plan-finalize-dialog/plan-finalize-dialog.module.ts index 8a67814d5..7b3408005 100644 --- a/dmp-frontend/src/app/ui/plan/plan-finalize-dialog/plan-finalize-dialog.module.ts +++ b/dmp-frontend/src/app/ui/plan/plan-finalize-dialog/plan-finalize-dialog.module.ts @@ -3,13 +3,13 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { AutoCompleteModule } from '@app/library/auto-complete/auto-complete.module'; import { RichTextEditorModule } from "@app/library/rich-text-editor/rich-text-editor.module"; import { CommonUiModule } from '@common/ui/common-ui.module'; -import { DmpFinalizeDialogComponent } from './plan-finalize-dialog.component'; +import { PlanFinalizeDialogComponent } from './plan-finalize-dialog.component'; @NgModule({ imports: [CommonUiModule, FormsModule, ReactiveFormsModule, AutoCompleteModule, RichTextEditorModule], - declarations: [DmpFinalizeDialogComponent], - exports: [DmpFinalizeDialogComponent] + declarations: [PlanFinalizeDialogComponent], + exports: [PlanFinalizeDialogComponent] }) -export class DmpFinalizeDialogModule { +export class PlanFinalizeDialogModule { constructor() { } } diff --git a/dmp-frontend/src/app/ui/plan/plan-user-field/plan-user-field.component.html b/dmp-frontend/src/app/ui/plan/plan-user-field/plan-user-field.component.html index 94c90d240..9b7a441a9 100644 --- a/dmp-frontend/src/app/ui/plan/plan-user-field/plan-user-field.component.html +++ b/dmp-frontend/src/app/ui/plan/plan-user-field/plan-user-field.component.html @@ -36,22 +36,22 @@
      -
      - {{enumUtils.toDmpUserTypeString(userType)}} +
      + {{enumUtils.toPlanUserTypeString(userType)}}
      -
      +
      - {{'DMP-EDITOR.FIELDS.USER' | translate}} + {{'PLAN-EDITOR.FIELDS.USER' | translate}} {{user.get('user').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}}
      -
      +
      - {{'DMP-EDITOR.FIELDS.EMAIL' | translate}} + {{'PLAN-EDITOR.FIELDS.EMAIL' | translate}} {{user.get('email').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}} @@ -59,9 +59,9 @@
      - {{'DMP-EDITOR.FIELDS.USER-ROLE' | translate}} + {{'PLAN-EDITOR.FIELDS.USER-ROLE' | translate}} - {{enumUtils.toDmpUserRoleString(userRole)}} + {{enumUtils.toPlanUserRoleString(userRole)}} {{user.get('role').getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}} @@ -69,15 +69,15 @@
      - {{'DMP-EDITOR.FIELDS.SECTIONS' | translate}} - - {{'DMP-EDITOR.FIELDS.ALL-SECTIONS' | translate}} + {{'PLAN-EDITOR.FIELDS.SECTIONS' | translate}} + + {{'PLAN-EDITOR.FIELDS.ALL-SECTIONS' | translate}} {{ section.label }} - - {{'DMP-EDITOR.FIELDS.ALL-SECTIONS' | translate}} + + {{'PLAN-EDITOR.FIELDS.ALL-SECTIONS' | translate}} {{ section.label }} @@ -87,11 +87,11 @@
      -
      - {{'DMP-EDITOR.USERS-REQUIRED' | translate}} + {{'PLAN-EDITOR.USERS-REQUIRED' | translate}} {{form.get('users').getError('backendError').message}} \ No newline at end of file diff --git a/dmp-frontend/src/app/ui/plan/plan-user-field/plan-user-field.component.ts b/dmp-frontend/src/app/ui/plan/plan-user-field/plan-user-field.component.ts index 298c20e8d..e9240b8af 100644 --- a/dmp-frontend/src/app/ui/plan/plan-user-field/plan-user-field.component.ts +++ b/dmp-frontend/src/app/ui/plan/plan-user-field/plan-user-field.component.ts @@ -1,15 +1,15 @@ import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop'; import { Component, Input, OnInit } from '@angular/core'; import { FormArray } from '@angular/forms'; -import { DmpUserRole } from '@app/core/common/enum/plan-user-role'; -import { DmpUserType } from '@app/core/common/enum/plan-user-type'; -import { DmpBlueprintDefinitionSection } from '@app/core/model/plan-blueprint/plan-blueprint'; +import { PlanUserRole } from '@app/core/common/enum/plan-user-role'; +import { PlanUserType } from '@app/core/common/enum/plan-user-type'; +import { PlanBlueprintDefinitionSection } from '@app/core/model/plan-blueprint/plan-blueprint'; import { UserService } from '@app/core/services/user/user.service'; import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration'; import { BaseComponent } from '@common/base/base.component'; import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model'; -import { DmpEditorModel, DmpUserEditorModel } from '../plan-editor-blueprint/plan-editor.model'; +import { PlanEditorModel, PlanUserEditorModel } from '../plan-editor-blueprint/plan-editor.model'; import { MatButtonToggleChange } from '@angular/material/button-toggle'; @Component({ @@ -17,24 +17,24 @@ import { MatButtonToggleChange } from '@angular/material/button-toggle'; templateUrl: 'plan-user-field.component.html', styleUrls: ['./plan-user-field.component.scss'] }) -export class DmpUserFieldComponent extends BaseComponent implements OnInit { +export class PlanUserFieldComponent extends BaseComponent implements OnInit { @Input() form; @Input() validationErrorModel: ValidationErrorModel; @Input() label: string = null; @Input() required: boolean = false; @Input() placeholder: string; - @Input() sections: DmpBlueprintDefinitionSection[] = null; + @Input() sections: PlanBlueprintDefinitionSection[] = null; @Input() initializeUsers: boolean = false; @Input() viewOnly: boolean = false; @Input() enableSorting: boolean = true; hoveredUser:number = -1; - hasTemplatesSections: DmpBlueprintDefinitionSection[] = null; + hasTemplatesSections: PlanBlueprintDefinitionSection[] = null; - dmpUserTypeEnum = DmpUserType; - dmpUserTypeEnumValues = this.enumUtils.getEnumValues(DmpUserType); - dmpUserRoleEnumValues = this.enumUtils.getEnumValues(DmpUserRole); - dmpUserRoleEnum = DmpUserRole; + planUserTypeEnum = PlanUserType; + planUserTypeEnumValues = this.enumUtils.getEnumValues(PlanUserType); + planUserRoleEnumValues = this.enumUtils.getEnumValues(PlanUserRole); + planUserRoleEnum = PlanUserRole; multipleAutoCompleteSearchConfiguration: MultipleAutoCompleteConfiguration; @@ -53,14 +53,14 @@ export class DmpUserFieldComponent extends BaseComponent implements OnInit { addUser(): void { const userArray = this.form.get('users') as FormArray; - const dmpUser: DmpUserEditorModel = new DmpUserEditorModel(this.validationErrorModel); + const dmpUser: PlanUserEditorModel = new PlanUserEditorModel(this.validationErrorModel); userArray.push(dmpUser.buildForm({ rootPath: "users[" + userArray.length + "]." })); } removeUser(userIndex: number): void { (this.form.get('users') as FormArray).removeAt(userIndex); - DmpEditorModel.reApplyUsersValidators( + PlanEditorModel.reApplyUsersValidators( { formGroup: this.form, validationErrorModel: this.validationErrorModel, @@ -81,7 +81,7 @@ export class DmpUserFieldComponent extends BaseComponent implements OnInit { moveItemInArray(usersFormArray.controls, event.previousIndex, event.currentIndex); usersFormArray.updateValueAndValidity(); - DmpEditorModel.reApplyUsersValidators( + PlanEditorModel.reApplyUsersValidators( { formGroup: this.form, validationErrorModel: this.validationErrorModel @@ -105,7 +105,7 @@ export class DmpUserFieldComponent extends BaseComponent implements OnInit { } userTypeChange(type: MatButtonToggleChange, userIndex: number){ - if (type.value === DmpUserType.Internal){ + if (type.value === PlanUserType.Internal){ (this.form.get('users') as FormArray).at(userIndex).get('email').patchValue(null); } else { (this.form.get('users') as FormArray).at(userIndex).get('user').patchValue(null); diff --git a/dmp-frontend/src/app/ui/plan/plan-user-field/plan-user-field.module.ts b/dmp-frontend/src/app/ui/plan/plan-user-field/plan-user-field.module.ts index da3f62dea..68d9570e4 100644 --- a/dmp-frontend/src/app/ui/plan/plan-user-field/plan-user-field.module.ts +++ b/dmp-frontend/src/app/ui/plan/plan-user-field/plan-user-field.module.ts @@ -5,7 +5,7 @@ import { CommonFormsModule } from '@common/forms/common-forms.module'; import { CommonUiModule } from '@common/ui/common-ui.module'; import { DragDropModule } from '@angular/cdk/drag-drop'; import { NgxDropzoneModule } from "ngx-dropzone"; -import { DmpUserFieldComponent } from './plan-user-field.component'; +import { PlanUserFieldComponent } from './plan-user-field.component'; @NgModule({ imports: [ @@ -17,10 +17,10 @@ import { DmpUserFieldComponent } from './plan-user-field.component'; AutoCompleteModule ], declarations: [ - DmpUserFieldComponent + PlanUserFieldComponent ], exports: [ - DmpUserFieldComponent + PlanUserFieldComponent ] }) -export class DmpUserFieldModule { } +export class PlanUserFieldModule { } diff --git a/dmp-frontend/src/app/ui/plan/plan.routing.ts b/dmp-frontend/src/app/ui/plan/plan.routing.ts index 303610587..182a25e57 100644 --- a/dmp-frontend/src/app/ui/plan/plan.routing.ts +++ b/dmp-frontend/src/app/ui/plan/plan.routing.ts @@ -17,26 +17,26 @@ const routes: Routes = [ }, { path: 'new', - loadChildren: () => import('./plan-editor-blueprint/plan-editor.module').then(m => m.DmpEditorModule), + loadChildren: () => import('./plan-editor-blueprint/plan-editor.module').then(m => m.PlanEditorModule), canActivate:[AuthGuard], data: { breadcrumb: true, ...BreadcrumbService.generateRouteDataConfiguration({ - title: 'DMP-EDITOR.TITLE-NEW' + title: 'PLAN-EDITOR.TITLE-NEW' }), - title: 'DMP-EDITOR.TITLE-NEW' + title: 'PLAN-EDITOR.TITLE-NEW' } }, { path: 'edit', - loadChildren: () => import('./plan-editor-blueprint/plan-editor.module').then(m => m.DmpEditorModule), + loadChildren: () => import('./plan-editor-blueprint/plan-editor.module').then(m => m.PlanEditorModule), canActivate:[AuthGuard], data: { breadcrumb: true, ...BreadcrumbService.generateRouteDataConfiguration({ hideNavigationItem: true }), - title: 'DMP-EDITOR.TITLE-EDIT' + title: 'PLAN-EDITOR.TITLE-EDIT' } }, { diff --git a/dmp-frontend/src/app/ui/sidebar/sidebar.component.ts b/dmp-frontend/src/app/ui/sidebar/sidebar.component.ts index 7e5521fcf..7c65e5651 100644 --- a/dmp-frontend/src/app/ui/sidebar/sidebar.component.ts +++ b/dmp-frontend/src/app/ui/sidebar/sidebar.component.ts @@ -82,11 +82,11 @@ export class SidebarComponent implements OnInit { this.groupMenuItems.push(this.generalItems); this.dmpItems = { - title: 'SIDE-BAR.DMP', + title: 'SIDE-BAR.PLAN', routes: [], } - if (this.authentication.hasPermission(AppPermission.ViewMyDmpPage)) this.dmpItems.routes.push({ path: '/plans', title: 'SIDE-BAR.MY-DMPS', icon: 'library_books', routeType: RouteType.System }); + if (this.authentication.hasPermission(AppPermission.ViewMyPlanPage)) this.dmpItems.routes.push({ path: '/plans', title: 'SIDE-BAR.MY-DMPS', icon: 'library_books', routeType: RouteType.System }); if (this.authentication.hasPermission(AppPermission.ViewMyDescriptionPage)) this.dmpItems.routes.push({ path: '/descriptions', title: 'SIDE-BAR.MY-DESCRIPTIONS', icon: 'dns', routeType: RouteType.System }); this.groupMenuItems.push(this.dmpItems); @@ -113,7 +113,7 @@ export class SidebarComponent implements OnInit { title: 'SIDE-BAR.ADMIN', routes: [], } - if (this.authentication.hasPermission(AppPermission.ViewDmpBlueprintPage)) this.adminItems.routes.push({ path: '/dmp-blueprints', title: 'SIDE-BAR.DMP-BLUEPRINTS', icon: 'library_books', routeType: RouteType.System }); + if (this.authentication.hasPermission(AppPermission.ViewPlanBlueprintPage)) this.adminItems.routes.push({ path: '/plan-blueprints', title: 'SIDE-BAR.PLAN-BLUEPRINTS', icon: 'library_books', routeType: RouteType.System }); if (this.authentication.hasPermission(AppPermission.ViewDescriptionTemplatePage)) this.adminItems.routes.push({ path: '/description-templates', title: 'SIDE-BAR.DESCRIPTION-TEMPLATES', icon: 'description', routeType: RouteType.System }); if (this.authentication.hasPermission(AppPermission.ViewDescriptionTemplateTypePage)) this.adminItems.routes.push({ path: '/description-template-type', title: 'SIDE-BAR.DESCRIPTION-TEMPLATE-TYPES', icon: 'stack', routeType: RouteType.System }); if (this.authentication.hasPermission(AppPermission.ViewEntityLockPage)) this.adminItems.routes.push({ path: '/entity-locks', title: 'SIDE-BAR.ENTITY-LOCKS', icon: 'lock_person', routeType: RouteType.System }); diff --git a/dmp-frontend/src/app/ui/user-profile/user-profile.component.html b/dmp-frontend/src/app/ui/user-profile/user-profile.component.html index bbb46f2ad..9f2610d9e 100644 --- a/dmp-frontend/src/app/ui/user-profile/user-profile.component.html +++ b/dmp-frontend/src/app/ui/user-profile/user-profile.component.html @@ -96,7 +96,7 @@
      - +
      diff --git a/dmp-frontend/src/assets/i18n/baq.json b/dmp-frontend/src/assets/i18n/baq.json index 5c9117134..e791b83d2 100644 --- a/dmp-frontend/src/assets/i18n/baq.json +++ b/dmp-frontend/src/assets/i18n/baq.json @@ -42,23 +42,23 @@ "DESCRIPTION-TEMPLATE-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", "DESCRIPTION-TEMPLATE-IS-NOT-FINALIZED": "The selected Description Template is not finalized.", "MULTIPLE-DESCRIPTION-TEMPLATE-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected Description Template where found. Please contact your administrator.", - "DMP-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", - "DMP-IS-NOT-FINALIZED": "The selected DMP is not finalized.", - "MULTIPLE-DMP-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected DMP where found. Please contact your administrator.", - "DMP-IS-FINALIZED": "The requested action cannot be completed as the DMP has been finalized. To proceed, please revert the finalization.", - "DMP-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP.", - "DMP-DESCRIPTION-TEMPLATE-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP's Description Template.", + "PLAN-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", + "PLAN-IS-NOT-FINALIZED": "The selected DMP is not finalized.", + "MULTIPLE-PLAN-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected DMP where found. Please contact your administrator.", + "PLAN-IS-FINALIZED": "The requested action cannot be completed as the DMP has been finalized. To proceed, please revert the finalization.", + "PLAN-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP.", + "PLAN-DESCRIPTION-TEMPLATE-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP's Description Template.", "INVALID-DESCRIPTION-TEMPLATE": "While tying to update your Description, a validation error occurred. The Description's associated DMP's Description Template is invalid.", "DESCRIPTION-IS-FINALIZED": "The requested action cannot be completed as the Description has been finalized. To proceed, please revert the finalization.", - "DMP-BLUEPRINT-HAS-NO-DESCRIPTION-TEMPLATES": "You need to select at least one Description Template. Click the 'Has Description Templates' button to proceed.", - "DMP-BLUEPRINT-NEW-VERSION-CONFLICT": "While trying to update your Blueprint, a version conflict occurred. Your Blueprint is not in the latest version.", - "DMP-DESCRIPTION-TEMPLATE-CAN-NOT-REMOVE": "The Description template cannot be removed as it is currently in use.", + "PLAN-BLUEPRINT-HAS-NO-DESCRIPTION-TEMPLATES": "You need to select at least one Description Template. Click the 'Has Description Templates' button to proceed.", + "PLAN-BLUEPRINT-NEW-VERSION-CONFLICT": "While trying to update your Blueprint, a version conflict occurred. Your Blueprint is not in the latest version.", + "PLAN-DESCRIPTION-TEMPLATE-CAN-NOT-REMOVE": "The Description template cannot be removed as it is currently in use.", "TENANT-TAMPERING": "This operation affects data from a Tenant different than your selected. Please reselect your Tenant.", "TENANT-CONFIGURATION-TYPE-CAN-NOT-CHANGE": "The configuration type for this Tenant cannot be changed.", "MULTIPLE-TENANT-CONFIGURATION-TYPE-NOT-ALLOWED": "Tenant Configuration already exists for this Tenant.", "TENANT-CODE-EXISTS": "The Tenant code you provided already exists. Please choose a different code.", - "DMP-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this plan.", - "IMPORT-DESCRIPTION-WITHOUT-DMP-DESCRIPTION-TEMPLATE": "Your plan contains descriptions that are not defined in which section they will exist", + "PLAN-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this plan.", + "IMPORT-DESCRIPTION-WITHOUT-PLAN-DESCRIPTION-TEMPLATE": "Your plan contains descriptions that are not defined in which section they will exist", "INVALID-API-KEY": "Invalid configurations detected. Please contact your administrator.", "STALE-API-KEY": "A problem occurred while trying to authorize you. Please try refreshing the page or logging in again. Contact the system administrator if the problem persists.", "SENSITIVE-INFO": "You've reached a section that contains sensitive information. To protect your privacy, please head back to the public area of the site or log in with your authorized account to access this information.", @@ -70,13 +70,13 @@ "OVERLAPPING-TENANT-CONFIGURATION-NOTIFIER-LIST": "An error occurred due to overlapping configurations. Please try again or contact your administrator.", "DESCRIPTION-TEMPLATE-INACTIVE-USER": "This description template contains users that are not exist", "DESCRIPTION-TEMPLATE-MISSING-USER-CONTACT-INFO": "This description template contains users that don't have contact info", - "DMP-INACTIVE-USER": "This plan contains users that are not exist", - "DMP-MISSING-USER-CONTACT-INFO": "This plan contains users that don't have contact info", + "PLAN-INACTIVE-USER": "This plan contains users that are not exist", + "PLAN-MISSING-USER-CONTACT-INFO": "This plan contains users that don't have contact info", "DESCRIPTION-TEMPLATE-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this description template.", - "DMP-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.", + "PLAN-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.", "REFERENCE-TYPE-CODE-EXISTS": "The reference type code you provided already exists. Please choose a different code.", "PREFILLING-SOURCE-CODE-EXISTS": "The prefilling source code you provided already exists. Please choose a different code.", - "DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once", + "DUPLICATE-PLAN-USER": "You can't invite authors with same role and plan section more than once", "INVITE-USER-ALREADY-CONFIRMED": "Ιnvitation has already confirmed", "REQUEST-HAS-EXPIRED": "Request has expired" }, @@ -112,9 +112,9 @@ "CLOSE": "Itxi" } }, - "DMP-TO-DESCRIPTION-DIALOG": { + "PLAN-TO-DESCRIPTION-DIALOG": { "FROM-DMP": "Modu egokian sortu da zure", - "DMP": "DKPa", + "PLAN": "DKPa", "TO-DESCRIPTION": "Hona transferituko zaizu", "DATASET": "Datu-multzoa", "EDITOR": "editorea", @@ -186,7 +186,7 @@ "CRITERIA": { "LIKE": "Search..." }, - "START-NEW-DMP-DIALOG": { + "START-NEW-PLAN-DIALOG": { "UPLOAD-FILE": "Fitxategia kargatu", "REPLACE-FILE": "Fitxategia ordezkatu" } @@ -231,8 +231,8 @@ "DESCRIPTION-TEMPLATE-TYPES": "Description Types", "DESCRIPTION-TEMPLATES": "Description Templates", "NEW-DESCRIPTION-TEMPLATE-TYPE": "New", - "DMP-BLUEPRINTS": "Plan Blueprints", - "NEW-DMP-BLUEPRINT": "New", + "PLAN-BLUEPRINTS": "Plan Blueprints", + "NEW-PLAN-BLUEPRINT": "New", "NEW-DESCRIPTION-TEMPLATES": "New", "REFERENCE-TYPES": "Reference Types", "NEW-REFERENCE-TYPE": "New", @@ -278,14 +278,14 @@ "MACHINE-ACTIONABLE": "for machine-actionable DMPs" }, "NAV-BAR": { - "START-NEW-DMP": "Hasi DKP berria", + "START-NEW-PLAN": "Hasi DKP berria", "INAPP-NOTIFICATIONS": "All Notifications", "READ-ALL-INAPP-NOTIFICATIONS": "Read All" }, "SIDE-BAR": { "GENERAL": "OROKORRA", "DASHBOARD": "Aginte-panela", - "DMP": "DATUAK KUDEATZEKO PLANAK", + "PLAN": "DATUAK KUDEATZEKO PLANAK", "MY-DMPS": "Nire DPKak", "DESCRIPTIONS": "DATU-MULTZOAK", "MY-DESCRIPTIONS": "My Descriptions", @@ -295,7 +295,7 @@ "ADMIN": "ADMIN", "DESCRIPTION-TEMPLATES": "Description Templates", "DESCRIPTION-TEMPLATE-TYPES": "Description Types", - "DMP-BLUEPRINTS": "Plan Blueprints", + "PLAN-BLUEPRINTS": "Plan Blueprints", "USERS": "Erabiltzaileak", "TENANT-USERS":"Tenant Users", "CO-BRANDING": "Marka partekatua", @@ -355,7 +355,7 @@ "ACTIONS": { "SEND-USER-TOUCH": "Send user touch events", "SEND-TENANT-TOUCH": "Send tenant touch events", - "SEND-DMP-TOUCH": "Send dmp touch events", + "SEND-PLAN-TOUCH": "Send dmp touch events", "SEND-DESCRIPTION-TOUCH": "Send description touch events" } } @@ -650,8 +650,8 @@ "MESSAGE": "Somebody else is modifying the description template at this moment. You may view the description template but you cannot make any changes. If you would like to modify it please come back later." } }, - "DMP-LISTING": { - "DMP": "DKP", + "PLAN-LISTING": { + "PLAN": "DKP", "GRANT": "Diru-laguntza", "EDITED": "Editatuta", "PUBLISHED": "Argitaratuta", @@ -696,7 +696,7 @@ "NAME": "Related Description Templates", "PLACEHOLDER": "Select Description Templates" }, - "ASSOCIATED-DMP-BLUEPRINTS": { + "ASSOCIATED-PLAN-BLUEPRINTS": { "NAME": "Related DMP Blueprints", "PLACEHOLDER": "Select DMP Blueprints" }, @@ -713,7 +713,7 @@ }, "EMPTY-LIST": "Hutsik dago oraindik." }, - "DMP-UPLOAD": { + "PLAN-UPLOAD": { "TITLE": "Inportatu Datuak Kudeatzeko Plana", "UPLOAD-SUCCESS": "Inpotazioa ondo burutu da", "ANALYZING-FILE": "Analyzing file", @@ -730,7 +730,7 @@ }, "PLACEHOLDER": "DKPren izenburua" }, - "DMP-DELETE-DIALOG": { + "PLAN-DELETE-DIALOG": { "WARNING": "Warning!", "DELETE-ITEM": "Are you sure to delete this plan? The following descriptions will also be removed:", "ACTIONS": { @@ -738,7 +738,7 @@ "CANCEL": "Cancel" } }, - "DMP-OVERVIEW": { + "PLAN-OVERVIEW": { "TITLE": "Plan", "PUBLIC": "Publikoa", "LOCKED": "Blokeatuta", @@ -749,7 +749,7 @@ "DESCRIPTION": "Description", "DESCRIPTIONS": "Descriptions included", "DOI-PROVIDED": "DOI provided by", - "DMP-AUTHORS": "DKParen Egileak", + "PLAN-AUTHORS": "DKParen Egileak", "YOU": "zu", "ACTIONS": { "BACK": "Back", @@ -850,7 +850,7 @@ "GRANT": "Grant", "LOCKED": "Description is Locked by another user", "PART-OF": "Part of", - "DMP": "Plan", + "PLAN": "Plan", "EMPTY-LIST": "Hutsik dago oraindik.", "ACTIONS": { "ADD-REFERENCE-TYPE": "Add a Reference Type", @@ -889,7 +889,7 @@ "NAME": "Related Description Templates", "PLACEHOLDER": "Select Description Templates" }, - "ASSOCIATED-DMPS": { + "ASSOCIATED-PLANS": { "NAME": "Related DMPs", "PLACEHOLDER": "Select DMPs" }, @@ -922,7 +922,7 @@ "TITLE-PREVIEW-DESCRIPTION": "Previewing Description", "TO-DMP": "Previewing Description", "UNSAVED-CHANGES": "(unsaved changes)", - "DMP": "Plan", + "PLAN": "Plan", "TOC": { "TITLE": "Guide steps", "MAIN-INFO": "Main info", @@ -1000,8 +1000,8 @@ }, "DESCRIPTION-COPY-DIALOG": { "TITLE": "Copy Description to Plan", - "SELECT-DMP": "Select Plan", - "DMP-SECTION": "Select Section" + "SELECT-PLAN": "Select Plan", + "PLAN-SECTION": "Select Section" }, "PREFILL-DESCRIPTION-DIALOG": { "TITLE": "Initialize your Description", @@ -1566,7 +1566,7 @@ "REMOVE-FIELD": "Remove Field" } }, - "DMP-BLUEPRINT-EDITOR": { + "PLAN-BLUEPRINT-EDITOR": { "TITLE": { "NEW": "DKP Txantiloi Berria", "CLONE": "Clone Plan Blueprint", @@ -1617,7 +1617,7 @@ "MESSAGE": "Somebody else is modifying the Plan Blueprint at this moment. You may view the Plan Blueprint but you cannot make any changes. If you would like to modify it please come back later." } }, - "DMP-EDITOR": { + "PLAN-EDITOR": { "TITLE-NEW": "New Plan", "TITLE-EDIT": "Editing Plan", "TITLE": "Plan Template", @@ -1645,7 +1645,7 @@ "USER-ROLE": "Role", "SECTIONS": "Plan Sections", "ALL-SECTIONS": "All", - "DMP-BLUEPRINT-VERSION": "Version" + "PLAN-BLUEPRINT-VERSION": "Version" }, "ACTIONS": { "DISCARD": { @@ -1688,7 +1688,7 @@ "SNACK-BAR": { "UNSUCCESSFUL-DOI": "DOIa ez da behar bezala sortu", "SUCCESSFUL-DOI": "DOIa ondo sortu da", - "SUCCESSFUL-DMP-CONTACT": "User added" + "SUCCESSFUL-PLAN-CONTACT": "User added" }, "DESCRIPTION-TEMPLATE-LIST": { "TITLE": "Available Description Templates", @@ -1721,7 +1721,7 @@ "TYPE-INFORMATION": " Information" } }, - "DMP-CLONE-DIALOG": { + "PLAN-CLONE-DIALOG": { "TITLE": "Clone", "FIELDS": { "LABEL": "Title of Plan", @@ -1738,7 +1738,7 @@ "TOGGLE-DESCRIPTIONS": "Check/Uncheck" } }, - "DMP-NEW-VERSION-DIALOG": { + "PLAN-NEW-VERSION-DIALOG": { "TITLE": "New Version", "FIELDS": { "LABEL": "Title of Plan", @@ -1757,7 +1757,7 @@ "TOGGLE-DESCRIPTIONS": "Check/Uncheck" } }, - "DMP-CONTACT-PREFILL-DIALOG": { + "PLAN-CONTACT-PREFILL-DIALOG": { "TITLE": "Add ", "TEXT": "Search an existing user where associated with your plans", "FIELDS": { @@ -1768,7 +1768,7 @@ "CONFIRM": "Confirm" } }, - "DMP-USER-INVITATION-DIALOG": { + "PLAN-USER-INVITATION-DIALOG": { "TITLE": "Invite authors", "ACTIONS": { "INVITE": "Invite" @@ -1776,8 +1776,8 @@ "SUCCESS": "Invitation Success", "ERROR": "Invitation Error" }, - "DMP-BLUEPRINT-LISTING": { - "CREATE-DMP-BLUEPRINT": "Create Plan Blueprint", + "PLAN-BLUEPRINT-LISTING": { + "CREATE-PLAN-BLUEPRINT": "Create Plan Blueprint", "FIELDS": { "NAME": "Name", "STATUS": "Status", @@ -1861,7 +1861,7 @@ "FINALIZED": "Finalized", "CANCELED": "Canceled" }, - "DMP-USER-ROLE": { + "PLAN-USER-ROLE": { "OWNER": "Owner", "VIEWER": "Viewer", "DESCRIPTION-CONTRIBUTOR": "Description Contributor", @@ -1870,11 +1870,11 @@ "EXTERNAL-DATASET-TYPE": { "SELECT": "Aukeratu" }, - "DMP": { + "PLAN": { "FINALISED": "Amaituta", "DRAFT": "Zirriborroa" }, - "DMP-VISIBILITY": { + "PLAN-VISIBILITY": { "PUBLIC": "Argitaratuta" }, "DESCRIPTION-TEMPLATE-FIELD-VALIDATION-TYPE": { @@ -1885,8 +1885,8 @@ "SELECT": "Select", "BOOLEAN-DECISION": "Boolean Decision", "RADIO-BOX": "Radio Box", - "INTERNAL-DMP-ENTITIES-DMPS": "Internal Plans", - "INTERNAL-DMP-ENTITIES-DESCRIPTIONS": "Internal Descriptions", + "INTERNAL-PLAN-ENTITIES-DMPS": "Internal Plans", + "INTERNAL-PLAN-ENTITIES-DESCRIPTIONS": "Internal Descriptions", "CHECKBOX": "Checkbox", "FREE-TEXT": "Free Text", "TEXT-AREA": "Text Area", @@ -1930,11 +1930,11 @@ "FINALIZED": "Finalized", "DRAFT": "Draft" }, - "DMP-BLUEPRINT-STATUS": { + "PLAN-BLUEPRINT-STATUS": { "FINALIZED": "Finalized", "DRAFT": "Draft" }, - "DMP-BLUEPRINT-SYSTEM-FIELD-TYPE": { + "PLAN-BLUEPRINT-SYSTEM-FIELD-TYPE": { "TITLE": "Title", "DESCRIPTION": "Description", "LANGUAGE": "Language", @@ -1942,7 +1942,7 @@ "ACCESS_RIGHTS": "Access", "USER": "User" }, - "DMP-BLUEPRINT-EXTRA-FIELD-DATA-TYPE": { + "PLAN-BLUEPRINT-EXTRA-FIELD-DATA-TYPE": { "DATE": "Date", "NUMBER": "Number", "TEXT": "Text", @@ -1994,17 +1994,17 @@ "REPLACE": "Replace" }, "NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE": { - "DMP-INVITATION-EXTERNAL-USER": "Plan Invitation External User", - "DMP-INVITATION-EXISTING-USER": "Plan Invitation Existing User", - "DMP-MODIFIED": "Plan Modified", - "DMP-FINALISED": "Plan Finalised", + "PLAN-INVITATION-EXTERNAL-USER": "Plan Invitation External User", + "PLAN-INVITATION-EXISTING-USER": "Plan Invitation Existing User", + "PLAN-MODIFIED": "Plan Modified", + "PLAN-FINALISED": "Plan Finalised", "DESCRIPTION-CREATED": "Description Created", "DESCRIPTION-MODIFIED": "Description Modified", "DESCRIPTION-FINALISED": "Description Finalised", "DESCRIPTION-ANNOTATION-CREATED": "Description Annotation Created", "MERGE-ACCOUNT-CONFIRMATION": "Merge Account Confirmation", "REMOVE-CREDENTIAL-CONFIRMATION": "Remove Credential Confirmation", - "DMP-DEPOSIT": "Plan Deposit", + "PLAN-DEPOSIT": "Plan Deposit", "DESCRIPTION-TEMPLATE-INVITATION": "Description Template Invitation", "CONTACT-SUPPORT": "Contact Support", "PUBLIC-CONTACT-SUPPORT": "Public Contact Support", @@ -2036,7 +2036,7 @@ "ERROR": "Error", "OMITTED": "Omitted" }, - "DMP-ACCESS-TYPE": { + "PLAN-ACCESS-TYPE": { "PUBLIC": "Public", "RESTRICTED": "Restricted Access" }, @@ -2045,11 +2045,11 @@ "REUSED": "Reused dataset", "OTHER": "Other" }, - "DMP-USER-TYPE": { + "PLAN-USER-TYPE": { "INTERNAL": "Internal", "EXTERNAL": "External" }, - "DMP-BLUEPRINT-FIELD-CATEGORY": { + "PLAN-BLUEPRINT-FIELD-CATEGORY": { "SYSTEM": "System", "EXTRA": "Custom", "REFERENCE-TYPE": "External Reference" @@ -2060,9 +2060,9 @@ "TAGS": "Tags" }, "LOCK-TARGET-TYPE": { - "DMP": "Plan", + "PLAN": "Plan", "DESCRIPTION": "Description", - "DMP-BLUEPRINT": "Plan Blueprint", + "PLAN-BLUEPRINT": "Plan Blueprint", "DESCRIPTION-TEMPLATE": "Description Template" } }, @@ -2115,14 +2115,14 @@ "DASHBOARD": { "GRANTS": "Diru-laguntzak", "TITLE": "Zer da {{ APP_NAME_CAPS }}?", - "DMP-QUESTION": "Zer da DKP bat hemen {{ APP_NAME_CAPS }}?", + "PLAN-QUESTION": "Zer da DKP bat hemen {{ APP_NAME_CAPS }}?", "INFO-TEXT": "{{ APP_NAME_CAPS }} zerbitzu irekia eta hedagarria da, Datuak Kudeatzeko Planen kudeaketa, baliozkotzea, monitorizazioa eta mantenketa sinplifikatzen dituena. Eragileei (ikertzaileak, kudeatzaileak, ikuskatzaileak, etab.) prozesagarriak diren DKPak sortzeko aukera ematen die, azpiegitura desberdinen artean libreki truka daitezkeenak, datuen kudeaketa prozesuko alderdi espezifikoak gauzatzeko, datuen jabeen asmoen eta konpromisoaren arabera.", - "INFO-DMP-TEXT": "Datuak Kudeatzeko Plana (DKP) dokumentu bizia da eta ikerketa baten bizialdian zehar eta ondoren sortzen edota berrerabiltzen diren datu-multzoak deskribatzen ditu. DKPen xedea da, ikertzaileei funtsezko informazioa ematea beraien ikerketa emaitzak berrekoiztu, birbanatu eta berrerabiltzeko, horrela, haien baliozkotasuna eta ustiapena bermatuz.", + "INFO-PLAN-TEXT": "Datuak Kudeatzeko Plana (DKP) dokumentu bizia da eta ikerketa baten bizialdian zehar eta ondoren sortzen edota berrerabiltzen diren datu-multzoak deskribatzen ditu. DKPen xedea da, ikertzaileei funtsezko informazioa ematea beraien ikerketa emaitzak berrekoiztu, birbanatu eta berrerabiltzeko, horrela, haien baliozkotasuna eta ustiapena bermatuz.", "NEW-QUESTION": "Berria zara DKPekin? Bisitatu", "START-YOUR-FIRST-DMP": "Hasi zure lehen DKP", "OPEN-AIR-GUIDE": "OpenAIRE’ren Ikertzaileentzako Gida", "LEARN-MORE": "bat sortzeko moduari buruz gehiago jakiteko!", - "DMPS": "DKPak", + "PLANS": "DKPak", "PERSONAL-USAGE": "Erabilera pertsonala", "PUBLIC-USAGE": "Erabilera publikoa", "DESCRIPTIONS": "Descriptions", @@ -2134,14 +2134,14 @@ "ALL": "Guztiak", "EMPTY-LIST": "Hutsik dago oraindik.", "LATEST-ACTIVITY": "Azkenengo jarduera", - "DMP-ABOUT-BEG": "DKP batek {{ APP_NAME }} ikerketaren inguruko funtsezko informazioan datza, hala nola xedea, helburuak eta parte hartzen duten ikertzaileak, baina baita ikerketaren datu-multzoen dokumentazioari buruzkoa ere, hain zuzen ere", - "DMP-ABOUT-END": ", datuak kudeatzeko jarduera guztietan jarraitutako pausoak eta erabilitako bitartekoak nabarmentzen dituena.", - "SELECT-DMP": "Aukeratu DKP bat zure Datu-multzorako", + "PLAN-ABOUT-BEG": "DKP batek {{ APP_NAME }} ikerketaren inguruko funtsezko informazioan datza, hala nola xedea, helburuak eta parte hartzen duten ikertzaileak, baina baita ikerketaren datu-multzoen dokumentazioari buruzkoa ere, hain zuzen ere", + "PLAN-ABOUT-END": ", datuak kudeatzeko jarduera guztietan jarraitutako pausoak eta erabilitako bitartekoak nabarmentzen dituena.", + "SELECT-PLAN": "Aukeratu DKP bat zure Datu-multzorako", "ACTIONS": { "ADD-DESCRIPTION": "Add Description" }, "TOUR-GUIDE": { - "DMP": "Hau da zure aginte-panela. Parte hartu duzun edo zuk zeuk sortutako DKP guztiak ikusi eta editatu ditzakezu.", + "PLAN": "Hau da zure aginte-panela. Parte hartu duzun edo zuk zeuk sortutako DKP guztiak ikusi eta editatu ditzakezu.", "START-NEW": "Sortu zure DKPa Hasi DKP berria aukerarekin.", "IMPORT-DMP": "DKP bat inportatu dezakezu", "START-WIZARD": "edo berri bat sortu hemen {{ APP_NAME }}.", @@ -2152,7 +2152,7 @@ }, "ADD-NEW-DESCRIPTION": { "OPTIONS-NOT-ENOUGH": "Aukera hauek ez dira nahikoa?", - "START-NEW-DMP": "Hasi DKP berria", + "START-NEW-PLAN": "Hasi DKP berria", "OPTIONS": { "CREATED-AT": "Created At:" } @@ -2207,7 +2207,7 @@ "EMAILS": "E-mailak", "YOUR-EMAIL": "Zure E-maila" }, - "ASSOCIATED-DMPS": "Lotutako DKPak", + "ASSOCIATED-PLANS": "Lotutako DKPak", "ROLE-ORGANIZATION": { "FACULTY": "Fakultatea", "LIBRARIAN": "Liburuzaina", @@ -2234,9 +2234,9 @@ "CANCEL": "Ezeztatu" } }, - "DMP-FINALISE-DIALOG": { + "PLAN-FINALISE-DIALOG": { "TITLE": "Finalize this item?", - "DMP": "DKPa", + "PLAN": "DKPa", "DESCRPIPTIONS": "Descriptions", "EMPTY": "Orain arte ez dago DKP honetarako datu-multzorik", "FINALISE-TITLE": "Datu-multzoen zirriborro hauetakoren bat amaitu bahi duzu?", @@ -2245,8 +2245,8 @@ "INVALID-DMP": "This Plan can not be finalized " }, "IMPACT": "Ekintza honek zure DKPa amaitutzat emango du eta ezingo duzu berriro editatu.", - "PUBLIC-DMP-MESSAGE": "After finalizing your Plan, it'll be published and be publicly available to the {{ APP_NAME_CAPS }} tool.", - "RESTRICTED-DMP-MESSAGE": "Your Plan can be published and be publicly available to the {{ APP_NAME_CAPS }} tool after finalization when its access rights are opened. Current access rights: restricted", + "PUBLIC-PLAN-MESSAGE": "After finalizing your Plan, it'll be published and be publicly available to the {{ APP_NAME_CAPS }} tool.", + "RESTRICTED-PLAN-MESSAGE": "Your Plan can be published and be publicly available to the {{ APP_NAME_CAPS }} tool after finalization when its access rights are opened. Current access rights: restricted", "INVALID": "Baliogabea", "ACTIONS": { "SUBMIT": "Submit", @@ -2254,7 +2254,7 @@ } }, "START-NEW-DESCRIPTION-DIALOG": { - "SELECT-DMP": "Select Plan", + "SELECT-PLAN": "Select Plan", "ACTIONS": { "NEXT": "Next", "CANCEL": "Cancel" diff --git a/dmp-frontend/src/assets/i18n/de.json b/dmp-frontend/src/assets/i18n/de.json index 28040ff1c..dd3bd0b54 100644 --- a/dmp-frontend/src/assets/i18n/de.json +++ b/dmp-frontend/src/assets/i18n/de.json @@ -42,23 +42,23 @@ "DESCRIPTION-TEMPLATE-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", "DESCRIPTION-TEMPLATE-IS-NOT-FINALIZED": "The selected Description Template is not finalized.", "MULTIPLE-DESCRIPTION-TEMPLATE-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected Description Template where found. Please contact your administrator.", - "DMP-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", - "DMP-IS-NOT-FINALIZED": "The selected DMP is not finalized.", - "MULTIPLE-DMP-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected DMP where found. Please contact your administrator.", - "DMP-IS-FINALIZED": "The requested action cannot be completed as the DMP has been finalized. To proceed, please revert the finalization.", - "DMP-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP.", - "DMP-DESCRIPTION-TEMPLATE-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP's Description Template.", + "PLAN-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", + "PLAN-IS-NOT-FINALIZED": "The selected DMP is not finalized.", + "MULTIPLE-PLAN-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected DMP where found. Please contact your administrator.", + "PLAN-IS-FINALIZED": "The requested action cannot be completed as the DMP has been finalized. To proceed, please revert the finalization.", + "PLAN-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP.", + "PLAN-DESCRIPTION-TEMPLATE-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP's Description Template.", "INVALID-DESCRIPTION-TEMPLATE": "While tying to update your Description, a validation error occurred. The Description's associated DMP's Description Template is invalid.", "DESCRIPTION-IS-FINALIZED": "The requested action cannot be completed as the Description has been finalized. To proceed, please revert the finalization.", - "DMP-BLUEPRINT-HAS-NO-DESCRIPTION-TEMPLATES": "You need to select at least one Description Template. Click the 'Has Description Templates' button to proceed.", - "DMP-BLUEPRINT-NEW-VERSION-CONFLICT": "While trying to update your Blueprint, a version conflict occurred. Your Blueprint is not in the latest version.", - "DMP-DESCRIPTION-TEMPLATE-CAN-NOT-REMOVE": "The Description template cannot be removed as it is currently in use.", + "PLAN-BLUEPRINT-HAS-NO-DESCRIPTION-TEMPLATES": "You need to select at least one Description Template. Click the 'Has Description Templates' button to proceed.", + "PLAN-BLUEPRINT-NEW-VERSION-CONFLICT": "While trying to update your Blueprint, a version conflict occurred. Your Blueprint is not in the latest version.", + "PLAN-DESCRIPTION-TEMPLATE-CAN-NOT-REMOVE": "The Description template cannot be removed as it is currently in use.", "TENANT-TAMPERING": "This operation affects data from a Tenant different than your selected. Please reselect your Tenant.", "TENANT-CONFIGURATION-TYPE-CAN-NOT-CHANGE": "The configuration type for this Tenant cannot be changed.", "MULTIPLE-TENANT-CONFIGURATION-TYPE-NOT-ALLOWED": "Tenant Configuration already exists for this Tenant.", "TENANT-CODE-EXISTS": "The Tenant code you provided already exists. Please choose a different code.", - "DMP-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this plan.", - "IMPORT-DESCRIPTION-WITHOUT-DMP-DESCRIPTION-TEMPLATE": "Your plan contains descriptions that are not defined in which section they will exist", + "PLAN-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this plan.", + "IMPORT-DESCRIPTION-WITHOUT-PLAN-DESCRIPTION-TEMPLATE": "Your plan contains descriptions that are not defined in which section they will exist", "INVALID-API-KEY": "Invalid configurations detected. Please contact your administrator.", "STALE-API-KEY": "A problem occurred while trying to authorize you. Please try refreshing the page or logging in again. Contact the system administrator if the problem persists.", "SENSITIVE-INFO": "You've reached a section that contains sensitive information. To protect your privacy, please head back to the public area of the site or log in with your authorized account to access this information.", @@ -70,13 +70,13 @@ "OVERLAPPING-TENANT-CONFIGURATION-NOTIFIER-LIST": "An error occurred due to overlapping configurations. Please try again or contact your administrator.", "DESCRIPTION-TEMPLATE-INACTIVE-USER": "This description template contains users that are not exist", "DESCRIPTION-TEMPLATE-MISSING-USER-CONTACT-INFO": "This description template contains users that don't have contact info", - "DMP-INACTIVE-USER": "This plan contains users that are not exist", - "DMP-MISSING-USER-CONTACT-INFO": "This plan contains users that don't have contact info", + "PLAN-INACTIVE-USER": "This plan contains users that are not exist", + "PLAN-MISSING-USER-CONTACT-INFO": "This plan contains users that don't have contact info", "DESCRIPTION-TEMPLATE-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this description template.", - "DMP-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.", + "PLAN-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.", "REFERENCE-TYPE-CODE-EXISTS": "The reference type code you provided already exists. Please choose a different code.", "PREFILLING-SOURCE-CODE-EXISTS": "The prefilling source code you provided already exists. Please choose a different code.", - "DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once", + "DUPLICATE-PLAN-USER": "You can't invite authors with same role and plan section more than once", "INVITE-USER-ALREADY-CONFIRMED": "Ιnvitation has already confirmed", "REQUEST-HAS-EXPIRED": "Request has expired" }, @@ -112,9 +112,9 @@ "CLOSE": "Schließen" } }, - "DMP-TO-DESCRIPTION-DIALOG": { + "PLAN-TO-DESCRIPTION-DIALOG": { "FROM-DMP": "You have successfully created your", - "DMP": "DMP", + "PLAN": "PLAN", "TO-DESCRIPTION": "You will be transferred to the", "DATASET": "Dataset", "EDITOR": "editor", @@ -186,7 +186,7 @@ "CRITERIA": { "LIKE": "Search..." }, - "START-NEW-DMP-DIALOG": { + "START-NEW-PLAN-DIALOG": { "UPLOAD-FILE": "Upload File", "REPLACE-FILE": "Replace File" } @@ -231,8 +231,8 @@ "DESCRIPTION-TEMPLATE-TYPES": "Description Types", "DESCRIPTION-TEMPLATES": "Description Templates", "NEW-DESCRIPTION-TEMPLATE-TYPE": "New", - "DMP-BLUEPRINTS": "Plan Blueprints", - "NEW-DMP-BLUEPRINT": "New", + "PLAN-BLUEPRINTS": "Plan Blueprints", + "NEW-PLAN-BLUEPRINT": "New", "NEW-DESCRIPTION-TEMPLATES": "New", "REFERENCE-TYPES": "Reference Types", "NEW-REFERENCE-TYPE": "New", @@ -278,14 +278,14 @@ "MACHINE-ACTIONABLE": "for machine-actionable DMPs" }, "NAV-BAR": { - "START-NEW-DMP": "Start new DMP", + "START-NEW-PLAN": "Start new DMP", "INAPP-NOTIFICATIONS": "All Notifications", "READ-ALL-INAPP-NOTIFICATIONS": "Read All" }, "SIDE-BAR": { "GENERAL": "ALLGEMEINES", "DASHBOARD": "Startseite", - "DMP": "DATENMANAGEMENTPLÄNE", + "PLAN": "DATENMANAGEMENTPLÄNE", "MY-DMPS": "Meine DMPs", "DESCRIPTIONS": "DATENSATZBESCHREIBUNG", "MY-DESCRIPTIONS": "My Descriptions", @@ -295,7 +295,7 @@ "ADMIN": "ADMINISTRATOR", "DESCRIPTION-TEMPLATES": "Description Templates", "DESCRIPTION-TEMPLATE-TYPES": "Description Types", - "DMP-BLUEPRINTS": "DMP Blueprints", + "PLAN-BLUEPRINTS": "DMP Blueprints", "USERS": "Benutzer", "TENANT-USERS":"Tenant Users", "CO-BRANDING": "Co-Branding", @@ -355,7 +355,7 @@ "ACTIONS": { "SEND-USER-TOUCH": "Send user touch events", "SEND-TENANT-TOUCH": "Send tenant touch events", - "SEND-DMP-TOUCH": "Send dmp touch events", + "SEND-PLAN-TOUCH": "Send dmp touch events", "SEND-DESCRIPTION-TOUCH": "Send description touch events" } } @@ -650,8 +650,8 @@ "MESSAGE": "Somebody else is modifying the description template at this moment. You may view the description template but you cannot make any changes. If you would like to modify it please come back later." } }, - "DMP-LISTING": { - "DMP": "DMP", + "PLAN-LISTING": { + "PLAN": "PLAN", "GRANT": "Grant", "EDITED": "Edited", "PUBLISHED": "Published", @@ -671,7 +671,7 @@ "INVITE-SHORT": "Invite", "ADD-DESCRIPTION-SHORT": "Add Description", "NEW-VERSION": "Neue Version", - "VIEW-VERSION": "Alle DMP-Versionen", + "VIEW-VERSION": "Alle PLAN-Versionen", "CLONE": "Klonen", "DELETE": "Löschen", "DEPOSIT": "Deposit", @@ -696,7 +696,7 @@ "NAME": "Related Description Templates", "PLACEHOLDER": "Select Description Templates" }, - "ASSOCIATED-DMP-BLUEPRINTS": { + "ASSOCIATED-PLAN-BLUEPRINTS": { "NAME": "Related DMP Blueprints", "PLACEHOLDER": "Select DMP Blueprints" }, @@ -713,7 +713,7 @@ }, "EMPTY-LIST": "Nothing here yet." }, - "DMP-UPLOAD": { + "PLAN-UPLOAD": { "TITLE": "Datenmanagementplan importieren", "UPLOAD-SUCCESS": "Import war erfolgreich", "ANALYZING-FILE": "Analyzing file", @@ -730,7 +730,7 @@ }, "PLACEHOLDER": "DMP Titel" }, - "DMP-DELETE-DIALOG": { + "PLAN-DELETE-DIALOG": { "WARNING": "Warning!", "DELETE-ITEM": "Are you sure to delete this plan? The following descriptions will also be removed:", "ACTIONS": { @@ -738,7 +738,7 @@ "CANCEL": "Cancel" } }, - "DMP-OVERVIEW": { + "PLAN-OVERVIEW": { "TITLE": "Plan", "PUBLIC": "Public", "LOCKED": "Locked", @@ -749,7 +749,7 @@ "DESCRIPTION": "Description", "DESCRIPTIONS": "Descriptions included", "DOI-PROVIDED": "DOI provided by", - "DMP-AUTHORS": "DΜP Authors", + "PLAN-AUTHORS": "DΜP Authors", "YOU": "you", "ACTIONS": { "BACK": "Back", @@ -850,7 +850,7 @@ "GRANT": "Grant", "LOCKED": "Description is Locked by another user", "PART-OF": "Part of", - "DMP": "Plan", + "PLAN": "Plan", "EMPTY-LIST": "Nothing here yet.", "ACTIONS": { "ADD-REFERENCE-TYPE": "Add a Reference Type", @@ -889,7 +889,7 @@ "NAME": "Related Description Templates", "PLACEHOLDER": "Select Description Templates" }, - "ASSOCIATED-DMPS": { + "ASSOCIATED-PLANS": { "NAME": "Related DMPs", "PLACEHOLDER": "Select DMPs" }, @@ -922,7 +922,7 @@ "TITLE-PREVIEW-DESCRIPTION": "Previewing Description", "TO-DMP": "Previewing Description", "UNSAVED-CHANGES": "(unsaved changes)", - "DMP": "Plan", + "PLAN": "Plan", "TOC": { "TITLE": "Guide steps", "MAIN-INFO": "Main info", @@ -1000,8 +1000,8 @@ }, "DESCRIPTION-COPY-DIALOG": { "TITLE": "Copy Description to Plan", - "SELECT-DMP": "Select Plan", - "DMP-SECTION": "Select Section" + "SELECT-PLAN": "Select Plan", + "PLAN-SECTION": "Select Section" }, "PREFILL-DESCRIPTION-DIALOG": { "TITLE": "Initialize your Description", @@ -1566,7 +1566,7 @@ "REMOVE-FIELD": "Remove Field" } }, - "DMP-BLUEPRINT-EDITOR": { + "PLAN-BLUEPRINT-EDITOR": { "TITLE": { "NEW": "New DMP Blueprint", "CLONE": "Clone Plan Blueprint", @@ -1617,7 +1617,7 @@ "MESSAGE": "Somebody else is modifying the Plan Blueprint at this moment. You may view the Plan Blueprint but you cannot make any changes. If you would like to modify it please come back later." } }, - "DMP-EDITOR": { + "PLAN-EDITOR": { "TITLE-NEW": "New Plan", "TITLE-EDIT": "Editing Plan", "TITLE": "Plan Template", @@ -1645,7 +1645,7 @@ "USER-ROLE": "Role", "SECTIONS": "Plan Sections", "ALL-SECTIONS": "All", - "DMP-BLUEPRINT-VERSION": "Version" + "PLAN-BLUEPRINT-VERSION": "Version" }, "ACTIONS": { "DISCARD": { @@ -1688,7 +1688,7 @@ "SNACK-BAR": { "UNSUCCESSFUL-DOI": "DOI Erstellung fehlgeschlagen", "SUCCESSFUL-DOI": "DOI Erstellung erfolgreich", - "SUCCESSFUL-DMP-CONTACT": "User added" + "SUCCESSFUL-PLAN-CONTACT": "User added" }, "DESCRIPTION-TEMPLATE-LIST": { "TITLE": "Available Description Templates", @@ -1721,7 +1721,7 @@ "TYPE-INFORMATION": " Information" } }, - "DMP-CLONE-DIALOG": { + "PLAN-CLONE-DIALOG": { "TITLE": "Clone", "FIELDS": { "LABEL": "Title of Plan", @@ -1738,7 +1738,7 @@ "TOGGLE-DESCRIPTIONS": "Check/Uncheck" } }, - "DMP-NEW-VERSION-DIALOG": { + "PLAN-NEW-VERSION-DIALOG": { "TITLE": "New Version", "FIELDS": { "LABEL": "Title of Plan", @@ -1757,7 +1757,7 @@ "TOGGLE-DESCRIPTIONS": "Check/Uncheck" } }, - "DMP-CONTACT-PREFILL-DIALOG": { + "PLAN-CONTACT-PREFILL-DIALOG": { "TITLE": "Add ", "TEXT": "Search an existing user where associated with your plans", "FIELDS": { @@ -1768,7 +1768,7 @@ "CONFIRM": "Confirm" } }, - "DMP-USER-INVITATION-DIALOG": { + "PLAN-USER-INVITATION-DIALOG": { "TITLE": "Invite authors", "ACTIONS": { "INVITE": "Invite" @@ -1776,8 +1776,8 @@ "SUCCESS": "Invitation Success", "ERROR": "Invitation Error" }, - "DMP-BLUEPRINT-LISTING": { - "CREATE-DMP-BLUEPRINT": "Create DMP Blueprint", + "PLAN-BLUEPRINT-LISTING": { + "CREATE-PLAN-BLUEPRINT": "Create DMP Blueprint", "FIELDS": { "NAME": "Name", "STATUS": "Status", @@ -1861,7 +1861,7 @@ "FINALIZED": "Finalized", "CANCELED": "Canceled" }, - "DMP-USER-ROLE": { + "PLAN-USER-ROLE": { "OWNER": "Owner", "VIEWER": "Viewer", "DESCRIPTION-CONTRIBUTOR": "Description Contributor", @@ -1870,11 +1870,11 @@ "EXTERNAL-DATASET-TYPE": { "SELECT": "Select" }, - "DMP": { + "PLAN": { "FINALISED": "Fertiggestellt", "DRAFT": "Entwurf" }, - "DMP-VISIBILITY": { + "PLAN-VISIBILITY": { "PUBLIC": "Veröffentlicht" }, "DESCRIPTION-TEMPLATE-FIELD-VALIDATION-TYPE": { @@ -1885,8 +1885,8 @@ "SELECT": "Select", "BOOLEAN-DECISION": "Boolean Decision", "RADIO-BOX": "Radio Box", - "INTERNAL-DMP-ENTITIES-DMPS": "Internal Plans", - "INTERNAL-DMP-ENTITIES-DESCRIPTIONS": "Internal Descriptions", + "INTERNAL-PLAN-ENTITIES-DMPS": "Internal Plans", + "INTERNAL-PLAN-ENTITIES-DESCRIPTIONS": "Internal Descriptions", "CHECKBOX": "Checkbox", "FREE-TEXT": "Free Text", "TEXT-AREA": "Text Area", @@ -1930,11 +1930,11 @@ "FINALIZED": "Finalized", "DRAFT": "Draft" }, - "DMP-BLUEPRINT-STATUS": { + "PLAN-BLUEPRINT-STATUS": { "FINALIZED": "Finalized", "DRAFT": "Draft" }, - "DMP-BLUEPRINT-SYSTEM-FIELD-TYPE": { + "PLAN-BLUEPRINT-SYSTEM-FIELD-TYPE": { "TITLE": "Title", "DESCRIPTION": "Description", "LANGUAGE": "Language", @@ -1942,7 +1942,7 @@ "ACCESS_RIGHTS": "Access", "USER": "User" }, - "DMP-BLUEPRINT-EXTRA-FIELD-DATA-TYPE": { + "PLAN-BLUEPRINT-EXTRA-FIELD-DATA-TYPE": { "DATE": "Date", "NUMBER": "Number", "TEXT": "Text", @@ -1994,17 +1994,17 @@ "REPLACE": "Replace" }, "NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE": { - "DMP-INVITATION-EXTERNAL-USER": "Plan Invitation External User", - "DMP-INVITATION-EXISTING-USER": "Plan Invitation Existing User", - "DMP-MODIFIED": "Plan Modified", - "DMP-FINALISED": "Plan Finalised", + "PLAN-INVITATION-EXTERNAL-USER": "Plan Invitation External User", + "PLAN-INVITATION-EXISTING-USER": "Plan Invitation Existing User", + "PLAN-MODIFIED": "Plan Modified", + "PLAN-FINALISED": "Plan Finalised", "DESCRIPTION-CREATED": "Description Created", "DESCRIPTION-MODIFIED": "Description Modified", "DESCRIPTION-FINALISED": "Description Finalised", "DESCRIPTION-ANNOTATION-CREATED": "Description Annotation Created", "MERGE-ACCOUNT-CONFIRMATION": "Merge Account Confirmation", "REMOVE-CREDENTIAL-CONFIRMATION": "Remove Credential Confirmation", - "DMP-DEPOSIT": "Plan Deposit", + "PLAN-DEPOSIT": "Plan Deposit", "DESCRIPTION-TEMPLATE-INVITATION": "Description Template Invitation", "CONTACT-SUPPORT": "Contact Support", "PUBLIC-CONTACT-SUPPORT": "Public Contact Support", @@ -2036,7 +2036,7 @@ "ERROR": "Error", "OMITTED": "Omitted" }, - "DMP-ACCESS-TYPE": { + "PLAN-ACCESS-TYPE": { "PUBLIC": "Public", "RESTRICTED": "Restricted Access" }, @@ -2045,11 +2045,11 @@ "REUSED": "Reused dataset", "OTHER": "Other" }, - "DMP-USER-TYPE": { + "PLAN-USER-TYPE": { "INTERNAL": "Internal", "EXTERNAL": "External" }, - "DMP-BLUEPRINT-FIELD-CATEGORY": { + "PLAN-BLUEPRINT-FIELD-CATEGORY": { "SYSTEM": "System", "EXTRA": "Custom", "REFERENCE-TYPE": "External Reference" @@ -2060,9 +2060,9 @@ "TAGS": "Tags" }, "LOCK-TARGET-TYPE": { - "DMP": "Plan", + "PLAN": "Plan", "DESCRIPTION": "Description", - "DMP-BLUEPRINT": "Plan Blueprint", + "PLAN-BLUEPRINT": "Plan Blueprint", "DESCRIPTION-TEMPLATE": "Description Template" } }, @@ -2115,14 +2115,14 @@ "DASHBOARD": { "GRANTS": "Förderungen", "TITLE": "Was ist {{ APP_NAME_CAPS }}?", - "DMP-QUESTION": "What is a DMP in {{ APP_NAME_CAPS }}?", + "PLAN-QUESTION": "What is a DMP in {{ APP_NAME_CAPS }}?", "INFO-TEXT": "{{ APP_NAME_CAPS }} ist ein offener, erweiterbarer Dienst, der die Verwaltung, Validierung, Überwachung und Aktualisierung von Datenmanagementplänen vereinfacht. Er ermöglicht es Akteuren (Forschern, Managern, Betreuern usw.), praktisch umsetzbare DMPs zu erstellen, die uneingeschränkt zwischen Infrastruktursystemen ausgetauscht werden können, um bestimmte Aspekte des Datenmanagementprozesses in Übereinstimmung mit den Absichten und dem Engagement der Dateneigentümer durchzuführen.", - "INFO-DMP-TEXT": "A Data Management Plan (DMP) is a living document describing the datasets that are generated and/ or re-used during and after a research lifetime. DMPs aim to provide researchers with essential information to re-produce, re-distribute and re-purpose research results thus assuring for their validity and exploitation.", + "INFO-PLAN-TEXT": "A Data Management Plan (DMP) is a living document describing the datasets that are generated and/ or re-used during and after a research lifetime. DMPs aim to provide researchers with essential information to re-produce, re-distribute and re-purpose research results thus assuring for their validity and exploitation.", "NEW-QUESTION": "New with DMPs? Visit", "START-YOUR-FIRST-DMP": "Start your first DMP", "OPEN-AIR-GUIDE": "OpenAIRE’s Guide for Researchers", "LEARN-MORE": "to learn more about how to create one!", - "DMPS": "DMPs", + "PLANS": "DMPs", "PERSONAL-USAGE": "Personal Usage", "PUBLIC-USAGE": "Public Usage", "DESCRIPTIONS": "Descriptions", @@ -2134,14 +2134,14 @@ "ALL": "All", "EMPTY-LIST": "Nothing here yet.", "LATEST-ACTIVITY": "Latest Activity", - "DMP-ABOUT-BEG": "A DMP in {{ APP_NAME }} consists of key information about research, such as purpose, objectives and researchers involved, but also about documentation of research datasets, namely", - "DMP-ABOUT-END": ", that highlight the steps followed and the means used across data management activities.", - "SELECT-DMP": "Select a DMP for your Dataset", + "PLAN-ABOUT-BEG": "A DMP in {{ APP_NAME }} consists of key information about research, such as purpose, objectives and researchers involved, but also about documentation of research datasets, namely", + "PLAN-ABOUT-END": ", that highlight the steps followed and the means used across data management activities.", + "SELECT-PLAN": "Select a DMP for your Dataset", "ACTIONS": { "ADD-DESCRIPTION": "Add Description" }, "TOUR-GUIDE": { - "DMP": "This is your dashboard. You can view and edit all DMPs that you have either contributed to or created yourself.", + "PLAN": "This is your dashboard. You can view and edit all DMPs that you have either contributed to or created yourself.", "START-NEW": "Create your DMP with Start new DMP.", "IMPORT-DMP": "You can import a DMP", "START-WIZARD": "or create new in {{ APP_NAME }}.", @@ -2152,7 +2152,7 @@ }, "ADD-NEW-DESCRIPTION": { "OPTIONS-NOT-ENOUGH": "Are those options not enough?", - "START-NEW-DMP": "Start new DMP", + "START-NEW-PLAN": "Start new DMP", "OPTIONS": { "CREATED-AT": "Created At:" } @@ -2207,7 +2207,7 @@ "EMAILS": "Emails", "YOUR-EMAIL": "Your Email" }, - "ASSOCIATED-DMPS": "Zugehörige DMPs", + "ASSOCIATED-PLANS": "Zugehörige DMPs", "ROLE-ORGANIZATION": { "FACULTY": "Faculty", "LIBRARIAN": "Librarian", @@ -2234,9 +2234,9 @@ "CANCEL": "Cancel" } }, - "DMP-FINALISE-DIALOG": { + "PLAN-FINALISE-DIALOG": { "TITLE": "Finalize this item?", - "DMP": "DMP", + "PLAN": "PLAN", "DESCRPIPTIONS": "Descriptions", "EMPTY": "Bisher noch keine Datensatzbeschreibungen für diesen DMP", "FINALISE-TITLE": "Möchten Sie einen der folgenden Entwürfe für Datensatzbeschreibungen fertigstellen?", @@ -2245,8 +2245,8 @@ "INVALID-DMP": "This Plan can not be finalized " }, "IMPACT": "Mit dieser Aktion wird Ihr DMP fertiggestellt und Sie werden ihn nicht erneut bearbeiten können.", - "PUBLIC-DMP-MESSAGE": "After finalizing your Plan, it'll be published and be publicly available to the {{ APP_NAME_CAPS }} tool.", - "RESTRICTED-DMP-MESSAGE": "Your Plan can be published and be publicly available to the {{ APP_NAME_CAPS }} tool after finalization when its access rights are opened. Current access rights: restricted", + "PUBLIC-PLAN-MESSAGE": "After finalizing your Plan, it'll be published and be publicly available to the {{ APP_NAME_CAPS }} tool.", + "RESTRICTED-PLAN-MESSAGE": "Your Plan can be published and be publicly available to the {{ APP_NAME_CAPS }} tool after finalization when its access rights are opened. Current access rights: restricted", "INVALID": "Invalid", "ACTIONS": { "SUBMIT": "Submit", @@ -2254,7 +2254,7 @@ } }, "START-NEW-DESCRIPTION-DIALOG": { - "SELECT-DMP": "Select Plan", + "SELECT-PLAN": "Select Plan", "ACTIONS": { "NEXT": "Next", "CANCEL": "Cancel" diff --git a/dmp-frontend/src/assets/i18n/en.json b/dmp-frontend/src/assets/i18n/en.json index a08715a8d..99add0eba 100644 --- a/dmp-frontend/src/assets/i18n/en.json +++ b/dmp-frontend/src/assets/i18n/en.json @@ -42,23 +42,23 @@ "DESCRIPTION-TEMPLATE-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", "DESCRIPTION-TEMPLATE-IS-NOT-FINALIZED": "The selected Description Template is not finalized.", "MULTIPLE-DESCRIPTION-TEMPLATE-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected Description Template where found. Please contact your administrator.", - "DMP-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", - "DMP-IS-NOT-FINALIZED": "The selected DMP is not finalized.", - "MULTIPLE-DMP-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected DMP where found. Please contact your administrator.", - "DMP-IS-FINALIZED": "The requested action cannot be completed as the DMP has been finalized. To proceed, please revert the finalization.", - "DMP-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP.", - "DMP-DESCRIPTION-TEMPLATE-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP's Description Template.", + "PLAN-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", + "PLAN-IS-NOT-FINALIZED": "The selected DMP is not finalized.", + "MULTIPLE-PLAN-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected DMP where found. Please contact your administrator.", + "PLAN-IS-FINALIZED": "The requested action cannot be completed as the DMP has been finalized. To proceed, please revert the finalization.", + "PLAN-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP.", + "PLAN-DESCRIPTION-TEMPLATE-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP's Description Template.", "INVALID-DESCRIPTION-TEMPLATE": "While tying to update your Description, a validation error occurred. The Description's associated DMP's Description Template is invalid.", "DESCRIPTION-IS-FINALIZED": "The requested action cannot be completed as the Description has been finalized. To proceed, please revert the finalization.", - "DMP-BLUEPRINT-HAS-NO-DESCRIPTION-TEMPLATES": "You need to select at least one Description Template. Click the 'Has Description Templates' button to proceed.", - "DMP-BLUEPRINT-NEW-VERSION-CONFLICT": "While trying to update your Blueprint, a version conflict occurred. Your Blueprint is not in the latest version.", - "DMP-DESCRIPTION-TEMPLATE-CAN-NOT-REMOVE": "The Description template cannot be removed as it is currently in use.", + "PLAN-BLUEPRINT-HAS-NO-DESCRIPTION-TEMPLATES": "You need to select at least one Description Template. Click the 'Has Description Templates' button to proceed.", + "PLAN-BLUEPRINT-NEW-VERSION-CONFLICT": "While trying to update your Blueprint, a version conflict occurred. Your Blueprint is not in the latest version.", + "PLAN-DESCRIPTION-TEMPLATE-CAN-NOT-REMOVE": "The Description template cannot be removed as it is currently in use.", "TENANT-TAMPERING": "This operation affects data from a Tenant different than your selected. Please reselect your Tenant.", "TENANT-CONFIGURATION-TYPE-CAN-NOT-CHANGE": "The configuration type for this Tenant cannot be changed.", "MULTIPLE-TENANT-CONFIGURATION-TYPE-NOT-ALLOWED": "Tenant Configuration already exists for this Tenant.", "TENANT-CODE-EXISTS": "The Tenant code you provided already exists. Please choose a different code.", - "DMP-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this plan.", - "IMPORT-DESCRIPTION-WITHOUT-DMP-DESCRIPTION-TEMPLATE": "Your plan contains descriptions that are not defined in which section they will exist", + "PLAN-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this plan.", + "IMPORT-DESCRIPTION-WITHOUT-PLAN-DESCRIPTION-TEMPLATE": "Your plan contains descriptions that are not defined in which section they will exist", "INVALID-API-KEY": "Invalid configurations detected. Please contact your administrator.", "STALE-API-KEY": "A problem occurred while trying to authorize you. Please try refreshing the page or logging in again. Contact the system administrator if the problem persists.", "SENSITIVE-INFO": "You've reached a section that contains sensitive information. To protect your privacy, please head back to the public area of the site or log in with your authorized account to access this information.", @@ -70,13 +70,13 @@ "OVERLAPPING-TENANT-CONFIGURATION-NOTIFIER-LIST": "An error occurred due to overlapping configurations. Please try again or contact your administrator.", "DESCRIPTION-TEMPLATE-INACTIVE-USER": "This description template contains users that are not exist", "DESCRIPTION-TEMPLATE-MISSING-USER-CONTACT-INFO": "This description template contains users that don't have contact info", - "DMP-INACTIVE-USER": "This plan contains users that are not exist", - "DMP-MISSING-USER-CONTACT-INFO": "This plan contains users that don't have contact info", + "PLAN-INACTIVE-USER": "This plan contains users that are not exist", + "PLAN-MISSING-USER-CONTACT-INFO": "This plan contains users that don't have contact info", "DESCRIPTION-TEMPLATE-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this description template.", - "DMP-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.", + "PLAN-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.", "REFERENCE-TYPE-CODE-EXISTS": "The reference type code you provided already exists. Please choose a different code.", "PREFILLING-SOURCE-CODE-EXISTS": "The prefilling source code you provided already exists. Please choose a different code.", - "DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once", + "DUPLICATE-PLAN-USER": "You can't invite authors with same role and plan section more than once", "INVITE-USER-ALREADY-CONFIRMED": "Ιnvitation has already confirmed", "REQUEST-HAS-EXPIRED": "Request has expired" }, @@ -112,9 +112,9 @@ "CLOSE": "Close" } }, - "DMP-TO-DESCRIPTION-DIALOG": { + "PLAN-TO-DESCRIPTION-DIALOG": { "FROM-DMP": "You have successfully created your", - "DMP": "Plan", + "PLAN": "Plan", "TO-DESCRIPTION": "You will be transferred to the", "DESCRIPTION": "Description", "EDITOR": "editor", @@ -186,7 +186,7 @@ "CRITERIA": { "LIKE": "Search..." }, - "START-NEW-DMP-DIALOG": { + "START-NEW-PLAN-DIALOG": { "UPLOAD-FILE": "Upoad File", "REPLACE-FILE": "Replace File" } @@ -231,8 +231,8 @@ "DESCRIPTION-TEMPLATE-TYPES": "Description Types", "DESCRIPTION-TEMPLATES": "Description Templates", "NEW-DESCRIPTION-TEMPLATE-TYPE": "New", - "DMP-BLUEPRINTS": "Plan Blueprints", - "NEW-DMP-BLUEPRINT": "New", + "PLAN-BLUEPRINTS": "Plan Blueprints", + "NEW-PLAN-BLUEPRINT": "New", "NEW-DESCRIPTION-TEMPLATES": "New", "REFERENCE-TYPES": "Reference Types", "NEW-REFERENCE-TYPE": "New", @@ -278,14 +278,14 @@ "MACHINE-ACTIONABLE": "for machine-actionable DMPs" }, "NAV-BAR": { - "START-NEW-DMP": "Start new Plan", + "START-NEW-PLAN": "Start new Plan", "INAPP-NOTIFICATIONS": "All Notifications", "READ-ALL-INAPP-NOTIFICATIONS": "Read All" }, "SIDE-BAR": { "GENERAL": "GENERAL", "DASHBOARD": "Home", - "DMP": "PLANS", + "PLAN": "PLANS", "MY-DMPS": "My Plans", "DESCRIPTIONS": "DESCRIPTIONS", "MY-DESCRIPTIONS": "My Descriptions", @@ -295,7 +295,7 @@ "ADMIN": "ADMIN", "DESCRIPTION-TEMPLATES": "Description Templates", "DESCRIPTION-TEMPLATE-TYPES": "Description Types", - "DMP-BLUEPRINTS": "Plan Blueprints", + "PLAN-BLUEPRINTS": "Plan Blueprints", "USERS": "Users", "TENANT-USERS": "Tenant Users", "CO-BRANDING": "Co-Branding", @@ -355,7 +355,7 @@ "ACTIONS": { "SEND-USER-TOUCH": "Send user touch events", "SEND-TENANT-TOUCH": "Send tenant touch events", - "SEND-DMP-TOUCH": "Send dmp touch events", + "SEND-PLAN-TOUCH": "Send dmp touch events", "SEND-DESCRIPTION-TOUCH": "Send description touch events" } } @@ -650,8 +650,8 @@ "MESSAGE": "Somebody else is modifying the description template at this moment. You may view the description template but you cannot make any changes. If you would like to modify it please come back later." } }, - "DMP-LISTING": { - "DMP": "Plan", + "PLAN-LISTING": { + "PLAN": "Plan", "GRANT": "Grant", "EDITED": "Edited", "PUBLISHED": "Published", @@ -696,7 +696,7 @@ "NAME": "Related Description Templates", "PLACEHOLDER": "Select Description Templates" }, - "ASSOCIATED-DMP-BLUEPRINTS": { + "ASSOCIATED-PLAN-BLUEPRINTS": { "NAME": "Related DMP Blueprints", "PLACEHOLDER": "Select DMP Blueprints" }, @@ -713,7 +713,7 @@ }, "EMPTY-LIST": "Nothing here yet." }, - "DMP-UPLOAD": { + "PLAN-UPLOAD": { "TITLE": "Import Plan", "UPLOAD-SUCCESS": "Import was Successful", "ANALYZING-FILE": "Analyzing file", @@ -730,7 +730,7 @@ }, "PLACEHOLDER": "Plan title" }, - "DMP-DELETE-DIALOG": { + "PLAN-DELETE-DIALOG": { "WARNING": "Warning!", "DELETE-ITEM": "Are you sure to delete this plan? The following descriptions will also be removed:", "ACTIONS": { @@ -738,7 +738,7 @@ "CANCEL": "Cancel" } }, - "DMP-OVERVIEW": { + "PLAN-OVERVIEW": { "TITLE": "Plan", "PUBLIC": "Public", "LOCKED": "Locked", @@ -749,7 +749,7 @@ "DESCRIPTION": "Description", "DESCRIPTIONS": "Descriptions included", "DOI-PROVIDED": "DOI provided by", - "DMP-AUTHORS": "Plan Authors", + "PLAN-AUTHORS": "Plan Authors", "YOU": "you", "ACTIONS": { "BACK": "Back", @@ -850,7 +850,7 @@ "GRANT": "Grant", "LOCKED": "Description is Locked by another user", "PART-OF": "Part of", - "DMP": "Plan", + "PLAN": "Plan", "EMPTY-LIST": "Nothing here yet.", "ACTIONS": { "ADD-REFERENCE-TYPE": "Add a Reference Type", @@ -889,7 +889,7 @@ "NAME": "Related Description Templates", "PLACEHOLDER": "Select Description Templates" }, - "ASSOCIATED-DMPS": { + "ASSOCIATED-PLANS": { "NAME": "Related DMPs", "PLACEHOLDER": "Select DMPs" }, @@ -922,7 +922,7 @@ "TITLE-PREVIEW-DESCRIPTION": "Previewing Description", "TO-DMP": "Previewing Description", "UNSAVED-CHANGES": "(unsaved changes)", - "DMP": "Plan", + "PLAN": "Plan", "TOC": { "TITLE": "Guide steps", "MAIN-INFO": "Main info", @@ -1000,8 +1000,8 @@ }, "DESCRIPTION-COPY-DIALOG": { "TITLE": "Copy Description to Plan", - "SELECT-DMP": "Select Plan", - "DMP-SECTION": "Select Section" + "SELECT-PLAN": "Select Plan", + "PLAN-SECTION": "Select Section" }, "PREFILL-DESCRIPTION-DIALOG": { "TITLE": "Initialize your Description", @@ -1566,7 +1566,7 @@ "REMOVE-FIELD": "Remove Field" } }, - "DMP-BLUEPRINT-EDITOR": { + "PLAN-BLUEPRINT-EDITOR": { "TITLE": { "NEW": "New Plan Blueprint", "CLONE": "Clone Plan Blueprint", @@ -1617,7 +1617,7 @@ "MESSAGE": "Somebody else is modifying the Plan Blueprint at this moment. You may view the Plan Blueprint but you cannot make any changes. If you would like to modify it please come back later." } }, - "DMP-EDITOR": { + "PLAN-EDITOR": { "TITLE-NEW": "New Plan", "TITLE-EDIT": "Editing Plan", "TITLE": "Plan Template", @@ -1645,7 +1645,7 @@ "USER-ROLE": "Role", "SECTIONS": "Plan Sections", "ALL-SECTIONS": "All", - "DMP-BLUEPRINT-VERSION": "Version" + "PLAN-BLUEPRINT-VERSION": "Version" }, "ACTIONS": { "DISCARD": { @@ -1688,7 +1688,7 @@ "SNACK-BAR": { "UNSUCCESSFUL-DOI": "Unsuccessful DOI creation", "SUCCESSFUL-DOI": "Successful DOI creation", - "SUCCESSFUL-DMP-CONTACT": "User added" + "SUCCESSFUL-PLAN-CONTACT": "User added" }, "DESCRIPTION-TEMPLATE-LIST": { "TITLE": "Available Description Templates", @@ -1721,7 +1721,7 @@ "TYPE-INFORMATION": " Information" } }, - "DMP-CLONE-DIALOG": { + "PLAN-CLONE-DIALOG": { "TITLE": "Clone", "FIELDS": { "LABEL": "Title of Plan", @@ -1738,7 +1738,7 @@ "TOGGLE-DESCRIPTIONS": "Check/Uncheck" } }, - "DMP-NEW-VERSION-DIALOG": { + "PLAN-NEW-VERSION-DIALOG": { "TITLE": "New Version", "FIELDS": { "LABEL": "Title of Plan", @@ -1757,7 +1757,7 @@ "TOGGLE-DESCRIPTIONS": "Check/Uncheck" } }, - "DMP-CONTACT-PREFILL-DIALOG": { + "PLAN-CONTACT-PREFILL-DIALOG": { "TITLE": "Add ", "TEXT": "Search an existing user where associated with your plans", "FIELDS": { @@ -1768,7 +1768,7 @@ "CONFIRM": "Confirm" } }, - "DMP-USER-INVITATION-DIALOG": { + "PLAN-USER-INVITATION-DIALOG": { "TITLE": "Invite authors", "ACTIONS": { "INVITE": "Invite" @@ -1776,8 +1776,8 @@ "SUCCESS": "Invitation Success", "ERROR": "Invitation Error" }, - "DMP-BLUEPRINT-LISTING": { - "CREATE-DMP-BLUEPRINT": "Create Plan Blueprint", + "PLAN-BLUEPRINT-LISTING": { + "CREATE-PLAN-BLUEPRINT": "Create Plan Blueprint", "FIELDS": { "NAME": "Name", "STATUS": "Status", @@ -1861,7 +1861,7 @@ "FINALIZED": "Finalized", "CANCELED": "Canceled" }, - "DMP-USER-ROLE": { + "PLAN-USER-ROLE": { "OWNER": "Owner", "VIEWER": "Viewer", "DESCRIPTION-CONTRIBUTOR": "Description Contributor", @@ -1870,11 +1870,11 @@ "EXTERNAL-DATASET-TYPE": { "SELECT": "Select" }, - "DMP": { + "PLAN": { "FINALISED": "Finalized", "DRAFT": "Draft" }, - "DMP-VISIBILITY": { + "PLAN-VISIBILITY": { "PUBLIC": "Published" }, "DESCRIPTION-TEMPLATE-FIELD-VALIDATION-TYPE": { @@ -1885,8 +1885,8 @@ "SELECT": "Select", "BOOLEAN-DECISION": "Boolean Decision", "RADIO-BOX": "Radio Box", - "INTERNAL-DMP-ENTITIES-DMPS": "Internal Plans", - "INTERNAL-DMP-ENTITIES-DESCRIPTIONS": "Internal Descriptions", + "INTERNAL-PLAN-ENTITIES-DMPS": "Internal Plans", + "INTERNAL-PLAN-ENTITIES-DESCRIPTIONS": "Internal Descriptions", "CHECKBOX": "Checkbox", "FREE-TEXT": "Free Text", "TEXT-AREA": "Text Area", @@ -1930,11 +1930,11 @@ "FINALIZED": "Finalized", "DRAFT": "Draft" }, - "DMP-BLUEPRINT-STATUS": { + "PLAN-BLUEPRINT-STATUS": { "FINALIZED": "Finalized", "DRAFT": "Draft" }, - "DMP-BLUEPRINT-SYSTEM-FIELD-TYPE": { + "PLAN-BLUEPRINT-SYSTEM-FIELD-TYPE": { "TITLE": "Title", "DESCRIPTION": "Description", "LANGUAGE": "Language", @@ -1942,7 +1942,7 @@ "ACCESS_RIGHTS": "Access", "USER": "User" }, - "DMP-BLUEPRINT-EXTRA-FIELD-DATA-TYPE": { + "PLAN-BLUEPRINT-EXTRA-FIELD-DATA-TYPE": { "DATE": "Date", "NUMBER": "Number", "TEXT": "Text", @@ -1994,17 +1994,17 @@ "REPLACE": "Replace" }, "NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE": { - "DMP-INVITATION-EXTERNAL-USER": "Plan Invitation External User", - "DMP-INVITATION-EXISTING-USER": "Plan Invitation Existing User", - "DMP-MODIFIED": "Plan Modified", - "DMP-FINALISED": "Plan Finalised", + "PLAN-INVITATION-EXTERNAL-USER": "Plan Invitation External User", + "PLAN-INVITATION-EXISTING-USER": "Plan Invitation Existing User", + "PLAN-MODIFIED": "Plan Modified", + "PLAN-FINALISED": "Plan Finalised", "DESCRIPTION-CREATED": "Description Created", "DESCRIPTION-MODIFIED": "Description Modified", "DESCRIPTION-FINALISED": "Description Finalised", "DESCRIPTION-ANNOTATION-CREATED": "Description Annotation Created", "MERGE-ACCOUNT-CONFIRMATION": "Merge Account Confirmation", "REMOVE-CREDENTIAL-CONFIRMATION": "Remove Credential Confirmation", - "DMP-DEPOSIT": "Plan Deposit", + "PLAN-DEPOSIT": "Plan Deposit", "DESCRIPTION-TEMPLATE-INVITATION": "Description Template Invitation", "CONTACT-SUPPORT": "Contact Support", "PUBLIC-CONTACT-SUPPORT": "Public Contact Support", @@ -2036,7 +2036,7 @@ "ERROR": "Error", "OMITTED": "Omitted" }, - "DMP-ACCESS-TYPE": { + "PLAN-ACCESS-TYPE": { "PUBLIC": "Public", "RESTRICTED": "Restricted Access" }, @@ -2045,11 +2045,11 @@ "REUSED": "Reused dataset", "OTHER": "Other" }, - "DMP-USER-TYPE": { + "PLAN-USER-TYPE": { "INTERNAL": "Internal", "EXTERNAL": "External" }, - "DMP-BLUEPRINT-FIELD-CATEGORY": { + "PLAN-BLUEPRINT-FIELD-CATEGORY": { "SYSTEM": "System", "EXTRA": "Custom", "REFERENCE-TYPE": "External Reference" @@ -2060,9 +2060,9 @@ "TAGS": "Tags" }, "LOCK-TARGET-TYPE": { - "DMP": "Plan", + "PLAN": "Plan", "DESCRIPTION": "Description", - "DMP-BLUEPRINT": "Plan Blueprint", + "PLAN-BLUEPRINT": "Plan Blueprint", "DESCRIPTION-TEMPLATE": "Description Template" } }, @@ -2115,14 +2115,14 @@ "DASHBOARD": { "GRANTS": "Grants", "TITLE": "What is {{ APP_NAME_CAPS }}?", - "DMP-QUESTION": "What is a Plan in {{ APP_NAME_CAPS }}?", + "PLAN-QUESTION": "What is a Plan in {{ APP_NAME_CAPS }}?", "INFO-TEXT": "{{ APP_NAME_CAPS }} is an open extensible service that simplifies the management, validation, monitoring and maintenance and of Plans. It allows actors (researchers, managers, supervisors etc) to create actionable Plans that may be freely exchanged among infrastructures for carrying out specific aspects of the Data management process in accordance with the intentions and commitment of Data owners.", - "INFO-DMP-TEXT": "A Plan (DMP) is a living document describing the items that are generated and/ or re-used during and after a research lifetime. Plans aim to provide researchers with essential information to re-produce, re-distribute and re-purpose research results thus assuring for their validity and exploitation.", + "INFO-PLAN-TEXT": "A Plan (DMP) is a living document describing the items that are generated and/ or re-used during and after a research lifetime. Plans aim to provide researchers with essential information to re-produce, re-distribute and re-purpose research results thus assuring for their validity and exploitation.", "NEW-QUESTION": "New with Plans? Visit", "START-YOUR-FIRST-DMP": "Start your first Plan", "OPEN-AIR-GUIDE": "OpenAIRE’s Guide for Researchers", "LEARN-MORE": "to learn more about how to create one!", - "DMPS": "Plans", + "PLANS": "Plans", "PERSONAL-USAGE": "Personal Usage", "PUBLIC-USAGE": "Public Usage", "DESCRIPTIONS": "Descriptions", @@ -2134,14 +2134,14 @@ "ALL": "All", "EMPTY-LIST": "Nothing here yet.", "LATEST-ACTIVITY": "Latest Activity", - "DMP-ABOUT-BEG": "A Plan in {{ APP_NAME }} consists of key information about research, such as purpose, objectives and researchers involved, but also about documentation of research datasets, namely", - "DMP-ABOUT-END": ", that highlight the steps followed and the means used across data management activities.", - "SELECT-DMP": "Select a Plan for your Description", + "PLAN-ABOUT-BEG": "A Plan in {{ APP_NAME }} consists of key information about research, such as purpose, objectives and researchers involved, but also about documentation of research datasets, namely", + "PLAN-ABOUT-END": ", that highlight the steps followed and the means used across data management activities.", + "SELECT-PLAN": "Select a Plan for your Description", "ACTIONS": { "ADD-DESCRIPTION": "Add Description" }, "TOUR-GUIDE": { - "DMP": "This is your dashboard. You can view and edit all Plans that you have either contributed to or created yourself.", + "PLAN": "This is your dashboard. You can view and edit all Plans that you have either contributed to or created yourself.", "START-NEW": "Create your Plan with Start new Plan.", "IMPORT-DMP": "You can import a Plan", "START-WIZARD": "or create new in {{ APP_NAME }}.", @@ -2152,7 +2152,7 @@ }, "ADD-NEW-DESCRIPTION": { "OPTIONS-NOT-ENOUGH": "Are those options not enough?", - "START-NEW-DMP": "Start new Plan", + "START-NEW-PLAN": "Start new Plan", "OPTIONS": { "CREATED-AT": "Created At:" } @@ -2207,7 +2207,7 @@ "EMAILS": "Emails", "YOUR-EMAIL": "Your Email" }, - "ASSOCIATED-DMPS": "Associated Plans", + "ASSOCIATED-PLANS": "Associated Plans", "ROLE-ORGANIZATION": { "FACULTY": "Faculty", "LIBRARIAN": "Librarian", @@ -2234,9 +2234,9 @@ "CANCEL": "Cancel" } }, - "DMP-FINALISE-DIALOG": { + "PLAN-FINALISE-DIALOG": { "TITLE": "Finalize this item?", - "DMP": "Plan", + "PLAN": "Plan", "DESCRPIPTIONS": "Descriptions", "EMPTY": "No Descriptions for this Plan so far", "FINALISE-TITLE": "Do you want to finalize any of the following Draft Descriptions?", @@ -2245,8 +2245,8 @@ "INVALID-DMP": "This Plan can not be finalized " }, "IMPACT": "This action will finalize your Plan, and you won't be able to edit it again.", - "PUBLIC-DMP-MESSAGE": "After finalizing your Plan, it'll be published and be publicly available to the {{ APP_NAME_CAPS }} tool.", - "RESTRICTED-DMP-MESSAGE": "Your Plan can be published and be publicly available to the {{ APP_NAME_CAPS }} tool after finalization when its access rights are opened. Current access rights: restricted", + "PUBLIC-PLAN-MESSAGE": "After finalizing your Plan, it'll be published and be publicly available to the {{ APP_NAME_CAPS }} tool.", + "RESTRICTED-PLAN-MESSAGE": "Your Plan can be published and be publicly available to the {{ APP_NAME_CAPS }} tool after finalization when its access rights are opened. Current access rights: restricted", "INVALID": "Invalid", "ACTIONS": { "SUBMIT": "Submit", @@ -2254,7 +2254,7 @@ } }, "START-NEW-DESCRIPTION-DIALOG": { - "SELECT-DMP": "Select Plan", + "SELECT-PLAN": "Select Plan", "ACTIONS": { "NEXT": "Next", "CANCEL": "Cancel" diff --git a/dmp-frontend/src/assets/i18n/es.json b/dmp-frontend/src/assets/i18n/es.json index 4bb94acfa..f80f8773c 100644 --- a/dmp-frontend/src/assets/i18n/es.json +++ b/dmp-frontend/src/assets/i18n/es.json @@ -42,23 +42,23 @@ "DESCRIPTION-TEMPLATE-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", "DESCRIPTION-TEMPLATE-IS-NOT-FINALIZED": "The selected Description Template is not finalized.", "MULTIPLE-DESCRIPTION-TEMPLATE-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected Description Template where found. Please contact your administrator.", - "DMP-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", - "DMP-IS-NOT-FINALIZED": "The selected DMP is not finalized.", - "MULTIPLE-DMP-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected DMP where found. Please contact your administrator.", - "DMP-IS-FINALIZED": "The requested action cannot be completed as the DMP has been finalized. To proceed, please revert the finalization.", - "DMP-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP.", - "DMP-DESCRIPTION-TEMPLATE-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP's Description Template.", + "PLAN-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", + "PLAN-IS-NOT-FINALIZED": "The selected DMP is not finalized.", + "MULTIPLE-PLAN-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected DMP where found. Please contact your administrator.", + "PLAN-IS-FINALIZED": "The requested action cannot be completed as the DMP has been finalized. To proceed, please revert the finalization.", + "PLAN-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP.", + "PLAN-DESCRIPTION-TEMPLATE-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP's Description Template.", "INVALID-DESCRIPTION-TEMPLATE": "While tying to update your Description, a validation error occurred. The Description's associated DMP's Description Template is invalid.", "DESCRIPTION-IS-FINALIZED": "The requested action cannot be completed as the Description has been finalized. To proceed, please revert the finalization.", - "DMP-BLUEPRINT-HAS-NO-DESCRIPTION-TEMPLATES": "You need to select at least one Description Template. Click the 'Has Description Templates' button to proceed.", - "DMP-BLUEPRINT-NEW-VERSION-CONFLICT": "While trying to update your Blueprint, a version conflict occurred. Your Blueprint is not in the latest version.", - "DMP-DESCRIPTION-TEMPLATE-CAN-NOT-REMOVE": "The Description template cannot be removed as it is currently in use.", + "PLAN-BLUEPRINT-HAS-NO-DESCRIPTION-TEMPLATES": "You need to select at least one Description Template. Click the 'Has Description Templates' button to proceed.", + "PLAN-BLUEPRINT-NEW-VERSION-CONFLICT": "While trying to update your Blueprint, a version conflict occurred. Your Blueprint is not in the latest version.", + "PLAN-DESCRIPTION-TEMPLATE-CAN-NOT-REMOVE": "The Description template cannot be removed as it is currently in use.", "TENANT-TAMPERING": "This operation affects data from a Tenant different than your selected. Please reselect your Tenant.", "TENANT-CONFIGURATION-TYPE-CAN-NOT-CHANGE": "The configuration type for this Tenant cannot be changed.", "MULTIPLE-TENANT-CONFIGURATION-TYPE-NOT-ALLOWED": "Tenant Configuration already exists for this Tenant.", "TENANT-CODE-EXISTS": "The Tenant code you provided already exists. Please choose a different code.", - "DMP-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this plan.", - "IMPORT-DESCRIPTION-WITHOUT-DMP-DESCRIPTION-TEMPLATE": "Your plan contains descriptions that are not defined in which section they will exist", + "PLAN-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this plan.", + "IMPORT-DESCRIPTION-WITHOUT-PLAN-DESCRIPTION-TEMPLATE": "Your plan contains descriptions that are not defined in which section they will exist", "INVALID-API-KEY": "Invalid configurations detected. Please contact your administrator.", "STALE-API-KEY": "A problem occurred while trying to authorize you. Please try refreshing the page or logging in again. Contact the system administrator if the problem persists.", "SENSITIVE-INFO": "You've reached a section that contains sensitive information. To protect your privacy, please head back to the public area of the site or log in with your authorized account to access this information.", @@ -70,13 +70,13 @@ "OVERLAPPING-TENANT-CONFIGURATION-NOTIFIER-LIST": "An error occurred due to overlapping configurations. Please try again or contact your administrator.", "DESCRIPTION-TEMPLATE-INACTIVE-USER": "This description template contains users that are not exist", "DESCRIPTION-TEMPLATE-MISSING-USER-CONTACT-INFO": "This description template contains users that don't have contact info", - "DMP-INACTIVE-USER": "This plan contains users that are not exist", - "DMP-MISSING-USER-CONTACT-INFO": "This plan contains users that don't have contact info", + "PLAN-INACTIVE-USER": "This plan contains users that are not exist", + "PLAN-MISSING-USER-CONTACT-INFO": "This plan contains users that don't have contact info", "DESCRIPTION-TEMPLATE-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this description template.", - "DMP-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.", + "PLAN-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.", "REFERENCE-TYPE-CODE-EXISTS": "The reference type code you provided already exists. Please choose a different code.", "PREFILLING-SOURCE-CODE-EXISTS": "The prefilling source code you provided already exists. Please choose a different code.", - "DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once", + "DUPLICATE-PLAN-USER": "You can't invite authors with same role and plan section more than once", "INVITE-USER-ALREADY-CONFIRMED": "Ιnvitation has already confirmed", "REQUEST-HAS-EXPIRED": "Request has expired" }, @@ -112,9 +112,9 @@ "CLOSE": "Cerrar" } }, - "DMP-TO-DESCRIPTION-DIALOG": { + "PLAN-TO-DESCRIPTION-DIALOG": { "FROM-DMP": "Ha creado correctamente su", - "DMP": "PGD", + "PLAN": "PGD", "TO-DESCRIPTION": "Será transferido al", "DATASET": "Dataset", "EDITOR": "editor", @@ -186,7 +186,7 @@ "CRITERIA": { "LIKE": "Search..." }, - "START-NEW-DMP-DIALOG": { + "START-NEW-PLAN-DIALOG": { "UPLOAD-FILE": "Subir fichero", "REPLACE-FILE": "Reemplar ichero" } @@ -231,8 +231,8 @@ "DESCRIPTION-TEMPLATE-TYPES": "Description Types", "DESCRIPTION-TEMPLATES": "Description Templates", "NEW-DESCRIPTION-TEMPLATE-TYPE": "New", - "DMP-BLUEPRINTS": "Plan Blueprints", - "NEW-DMP-BLUEPRINT": "New", + "PLAN-BLUEPRINTS": "Plan Blueprints", + "NEW-PLAN-BLUEPRINT": "New", "NEW-DESCRIPTION-TEMPLATES": "New", "REFERENCE-TYPES": "Reference Types", "NEW-REFERENCE-TYPE": "New", @@ -278,14 +278,14 @@ "MACHINE-ACTIONABLE": "for machine-actionable DMPs" }, "NAV-BAR": { - "START-NEW-DMP": "Iniciar un nuevo PGD", + "START-NEW-PLAN": "Iniciar un nuevo PGD", "INAPP-NOTIFICATIONS": "All Notifications", "READ-ALL-INAPP-NOTIFICATIONS": "Read All" }, "SIDE-BAR": { "GENERAL": "GENERAL", "DASHBOARD": "Inicio", - "DMP": "PLAN DE GESTIÓN DE DATOS", + "PLAN": "PLAN DE GESTIÓN DE DATOS", "MY-DMPS": "Mis PGDs", "DESCRIPTIONS": "DESCRIPCIONES DEL DATASET", "MY-DESCRIPTIONS": "My Descriptions", @@ -295,7 +295,7 @@ "ADMIN": "ADMINISTRADOR", "DESCRIPTION-TEMPLATES": "Description Templates", "DESCRIPTION-TEMPLATE-TYPES": "Description Types", - "DMP-BLUEPRINTS": "DMP Blueprints", + "PLAN-BLUEPRINTS": "DMP Blueprints", "USERS": "Usuarios", "TENANT-USERS":"Tenant Users", "CO-BRANDING": "Marca compartida", @@ -355,7 +355,7 @@ "ACTIONS": { "SEND-USER-TOUCH": "Send user touch events", "SEND-TENANT-TOUCH": "Send tenant touch events", - "SEND-DMP-TOUCH": "Send dmp touch events", + "SEND-PLAN-TOUCH": "Send dmp touch events", "SEND-DESCRIPTION-TOUCH": "Send description touch events" } } @@ -650,8 +650,8 @@ "MESSAGE": "Somebody else is modifying the description template at this moment. You may view the description template but you cannot make any changes. If you would like to modify it please come back later." } }, - "DMP-LISTING": { - "DMP": "PGD", + "PLAN-LISTING": { + "PLAN": "PGD", "GRANT": "Subvención", "EDITED": "Editado", "PUBLISHED": "Published", @@ -696,7 +696,7 @@ "NAME": "Related Description Templates", "PLACEHOLDER": "Select Description Templates" }, - "ASSOCIATED-DMP-BLUEPRINTS": { + "ASSOCIATED-PLAN-BLUEPRINTS": { "NAME": "Related DMP Blueprints", "PLACEHOLDER": "Select DMP Blueprints" }, @@ -713,7 +713,7 @@ }, "EMPTY-LIST": "No hay nada aquí aún." }, - "DMP-UPLOAD": { + "PLAN-UPLOAD": { "TITLE": "Importar Plan de Gestión de Datos", "UPLOAD-SUCCESS": "Importado con éxito", "ANALYZING-FILE": "Analyzing file", @@ -730,7 +730,7 @@ }, "PLACEHOLDER": "Título PGD" }, - "DMP-DELETE-DIALOG": { + "PLAN-DELETE-DIALOG": { "WARNING": "Warning!", "DELETE-ITEM": "Are you sure to delete this plan? The following descriptions will also be removed:", "ACTIONS": { @@ -738,7 +738,7 @@ "CANCEL": "Cancel" } }, - "DMP-OVERVIEW": { + "PLAN-OVERVIEW": { "TITLE": "Plan", "PUBLIC": "Publicado", "LOCKED": "Bloqueado", @@ -749,7 +749,7 @@ "DESCRIPTION": "Description", "DESCRIPTIONS": "Descriptions included", "DOI-PROVIDED": "DOI provided by", - "DMP-AUTHORS": "Autores del PGD", + "PLAN-AUTHORS": "Autores del PGD", "YOU": "tú", "ACTIONS": { "BACK": "Back", @@ -850,7 +850,7 @@ "GRANT": "Grant", "LOCKED": "Description is Locked by another user", "PART-OF": "Part of", - "DMP": "Plan", + "PLAN": "Plan", "EMPTY-LIST": "Nada todavía por aquí.", "ACTIONS": { "ADD-REFERENCE-TYPE": "Add a Reference Type", @@ -889,7 +889,7 @@ "NAME": "Related Description Templates", "PLACEHOLDER": "Select Description Templates" }, - "ASSOCIATED-DMPS": { + "ASSOCIATED-PLANS": { "NAME": "Related DMPs", "PLACEHOLDER": "Select DMPs" }, @@ -922,7 +922,7 @@ "TITLE-PREVIEW-DESCRIPTION": "Previewing Description", "TO-DMP": "Previewing Description", "UNSAVED-CHANGES": "(unsaved changes)", - "DMP": "Plan", + "PLAN": "Plan", "TOC": { "TITLE": "Guide steps", "MAIN-INFO": "Main info", @@ -1000,8 +1000,8 @@ }, "DESCRIPTION-COPY-DIALOG": { "TITLE": "Copy Description to Plan", - "SELECT-DMP": "Select Plan", - "DMP-SECTION": "Select Section" + "SELECT-PLAN": "Select Plan", + "PLAN-SECTION": "Select Section" }, "PREFILL-DESCRIPTION-DIALOG": { "TITLE": "Initialize your Description", @@ -1566,7 +1566,7 @@ "REMOVE-FIELD": "Remove Field" } }, - "DMP-BLUEPRINT-EDITOR": { + "PLAN-BLUEPRINT-EDITOR": { "TITLE": { "NEW": "New DMP Blueprint", "CLONE": "Clone Plan Blueprint", @@ -1617,7 +1617,7 @@ "MESSAGE": "Somebody else is modifying the Plan Blueprint at this moment. You may view the Plan Blueprint but you cannot make any changes. If you would like to modify it please come back later." } }, - "DMP-EDITOR": { + "PLAN-EDITOR": { "TITLE-NEW": "New Plan", "TITLE-EDIT": "Editing Plan", "TITLE": "Plan Template", @@ -1645,7 +1645,7 @@ "USER-ROLE": "Role", "SECTIONS": "Plan Sections", "ALL-SECTIONS": "All", - "DMP-BLUEPRINT-VERSION": "Version" + "PLAN-BLUEPRINT-VERSION": "Version" }, "ACTIONS": { "DISCARD": { @@ -1688,7 +1688,7 @@ "SNACK-BAR": { "UNSUCCESSFUL-DOI": "Fallo en la creación del DOI", "SUCCESSFUL-DOI": "Creación del DOI correcta", - "SUCCESSFUL-DMP-CONTACT": "User added" + "SUCCESSFUL-PLAN-CONTACT": "User added" }, "DESCRIPTION-TEMPLATE-LIST": { "TITLE": "Available Description Templates", @@ -1721,7 +1721,7 @@ "TYPE-INFORMATION": " Information" } }, - "DMP-CLONE-DIALOG": { + "PLAN-CLONE-DIALOG": { "TITLE": "Clone", "FIELDS": { "LABEL": "Title of Plan", @@ -1738,7 +1738,7 @@ "TOGGLE-DESCRIPTIONS": "Check/Uncheck" } }, - "DMP-NEW-VERSION-DIALOG": { + "PLAN-NEW-VERSION-DIALOG": { "TITLE": "New Version", "FIELDS": { "LABEL": "Title of Plan", @@ -1757,7 +1757,7 @@ "TOGGLE-DESCRIPTIONS": "Check/Uncheck" } }, - "DMP-CONTACT-PREFILL-DIALOG": { + "PLAN-CONTACT-PREFILL-DIALOG": { "TITLE": "Add ", "TEXT": "Search an existing user where associated with your plans", "FIELDS": { @@ -1768,7 +1768,7 @@ "CONFIRM": "Confirm" } }, - "DMP-USER-INVITATION-DIALOG": { + "PLAN-USER-INVITATION-DIALOG": { "TITLE": "Invite authors", "ACTIONS": { "INVITE": "Invite" @@ -1776,8 +1776,8 @@ "SUCCESS": "Invitation Success", "ERROR": "Invitation Error" }, - "DMP-BLUEPRINT-LISTING": { - "CREATE-DMP-BLUEPRINT": "Create DMP Blueprint", + "PLAN-BLUEPRINT-LISTING": { + "CREATE-PLAN-BLUEPRINT": "Create DMP Blueprint", "FIELDS": { "NAME": "Name", "STATUS": "Status", @@ -1861,7 +1861,7 @@ "FINALIZED": "Finalized", "CANCELED": "Canceled" }, - "DMP-USER-ROLE": { + "PLAN-USER-ROLE": { "OWNER": "Owner", "VIEWER": "Viewer", "DESCRIPTION-CONTRIBUTOR": "Description Contributor", @@ -1870,11 +1870,11 @@ "EXTERNAL-DATASET-TYPE": { "SELECT": "Seleccionar" }, - "DMP": { + "PLAN": { "FINALISED": "Finalizado", "DRAFT": "Borrador" }, - "DMP-VISIBILITY": { + "PLAN-VISIBILITY": { "PUBLIC": "Publicado" }, "DESCRIPTION-TEMPLATE-FIELD-VALIDATION-TYPE": { @@ -1885,8 +1885,8 @@ "SELECT": "Select", "BOOLEAN-DECISION": "Boolean Decision", "RADIO-BOX": "Radio Box", - "INTERNAL-DMP-ENTITIES-DMPS": "Internal Plans", - "INTERNAL-DMP-ENTITIES-DESCRIPTIONS": "Internal Descriptions", + "INTERNAL-PLAN-ENTITIES-DMPS": "Internal Plans", + "INTERNAL-PLAN-ENTITIES-DESCRIPTIONS": "Internal Descriptions", "CHECKBOX": "Checkbox", "FREE-TEXT": "Free Text", "TEXT-AREA": "Text Area", @@ -1930,11 +1930,11 @@ "FINALIZED": "Finalized", "DRAFT": "Draft" }, - "DMP-BLUEPRINT-STATUS": { + "PLAN-BLUEPRINT-STATUS": { "FINALIZED": "Finalized", "DRAFT": "Draft" }, - "DMP-BLUEPRINT-SYSTEM-FIELD-TYPE": { + "PLAN-BLUEPRINT-SYSTEM-FIELD-TYPE": { "TITLE": "Title", "DESCRIPTION": "Description", "LANGUAGE": "Language", @@ -1942,7 +1942,7 @@ "ACCESS_RIGHTS": "Access", "USER": "User" }, - "DMP-BLUEPRINT-EXTRA-FIELD-DATA-TYPE": { + "PLAN-BLUEPRINT-EXTRA-FIELD-DATA-TYPE": { "DATE": "Date", "NUMBER": "Number", "TEXT": "Text", @@ -1994,17 +1994,17 @@ "REPLACE": "Replace" }, "NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE": { - "DMP-INVITATION-EXTERNAL-USER": "Plan Invitation External User", - "DMP-INVITATION-EXISTING-USER": "Plan Invitation Existing User", - "DMP-MODIFIED": "Plan Modified", - "DMP-FINALISED": "Plan Finalised", + "PLAN-INVITATION-EXTERNAL-USER": "Plan Invitation External User", + "PLAN-INVITATION-EXISTING-USER": "Plan Invitation Existing User", + "PLAN-MODIFIED": "Plan Modified", + "PLAN-FINALISED": "Plan Finalised", "DESCRIPTION-CREATED": "Description Created", "DESCRIPTION-MODIFIED": "Description Modified", "DESCRIPTION-FINALISED": "Description Finalised", "DESCRIPTION-ANNOTATION-CREATED": "Description Annotation Created", "MERGE-ACCOUNT-CONFIRMATION": "Merge Account Confirmation", "REMOVE-CREDENTIAL-CONFIRMATION": "Remove Credential Confirmation", - "DMP-DEPOSIT": "Plan Deposit", + "PLAN-DEPOSIT": "Plan Deposit", "DESCRIPTION-TEMPLATE-INVITATION": "Description Template Invitation", "CONTACT-SUPPORT": "Contact Support", "PUBLIC-CONTACT-SUPPORT": "Public Contact Support", @@ -2036,7 +2036,7 @@ "ERROR": "Error", "OMITTED": "Omitted" }, - "DMP-ACCESS-TYPE": { + "PLAN-ACCESS-TYPE": { "PUBLIC": "Public", "RESTRICTED": "Restricted Access" }, @@ -2045,11 +2045,11 @@ "REUSED": "Reused dataset", "OTHER": "Other" }, - "DMP-USER-TYPE": { + "PLAN-USER-TYPE": { "INTERNAL": "Internal", "EXTERNAL": "External" }, - "DMP-BLUEPRINT-FIELD-CATEGORY": { + "PLAN-BLUEPRINT-FIELD-CATEGORY": { "SYSTEM": "System", "EXTRA": "Custom", "REFERENCE-TYPE": "External Reference" @@ -2060,9 +2060,9 @@ "TAGS": "Tags" }, "LOCK-TARGET-TYPE": { - "DMP": "Plan", + "PLAN": "Plan", "DESCRIPTION": "Description", - "DMP-BLUEPRINT": "Plan Blueprint", + "PLAN-BLUEPRINT": "Plan Blueprint", "DESCRIPTION-TEMPLATE": "Description Template" } }, @@ -2115,14 +2115,14 @@ "DASHBOARD": { "GRANTS": "Subvenciones", "TITLE": "¿Qué es {{ APP_NAME_CAPS }}?", - "DMP-QUESTION": "¿Qué es un PGD en {{ APP_NAME_CAPS }}?", + "PLAN-QUESTION": "¿Qué es un PGD en {{ APP_NAME_CAPS }}?", "INFO-TEXT": "{{ APP_NAME_CAPS }} es un servicio extensible y abierto que simplifica la gestión, validación, monitorización y mantenimiento de los Plan de Gestión de Datos. Permite a los participantes (investigadores, gestores, supervisores, etc) crear un PGDs visible que puede ser compartido libremente entre distintas infraestructuras para llevar a cabo aspectos específicos del proceso de Gestión de Datos de acuerdo con los propósitos y el compromiso de los propietarios de los datos.", - "INFO-DMP-TEXT": "Un plan de gestión de datos (PGD) es un documento vivo que describe los datasets generados y/o reutilizados durante y tras la finalización de la investigación. Los PGDs se crean para proveer a los investigadores de la información escencial para reproducir, redistribuir y reutilizar con nuevos propósitos los resultados de la investigación, de forma que se asegure su validez y explotación", + "INFO-PLAN-TEXT": "Un plan de gestión de datos (PGD) es un documento vivo que describe los datasets generados y/o reutilizados durante y tras la finalización de la investigación. Los PGDs se crean para proveer a los investigadores de la información escencial para reproducir, redistribuir y reutilizar con nuevos propósitos los resultados de la investigación, de forma que se asegure su validez y explotación", "NEW-QUESTION": "¿Nuevo con los PGDs? Visite", "START-YOUR-FIRST-DMP": "Iniciar su primer PGD", "OPEN-AIR-GUIDE": "Guida de OpenAIRE para investigadores", "LEARN-MORE": "¡para saber más sobre como crear uno!", - "DMPS": "PGDs", + "PLANS": "PGDs", "PERSONAL-USAGE": "Uso personal", "PUBLIC-USAGE": "Public Usage", "DESCRIPTIONS": "Descriptions", @@ -2134,14 +2134,14 @@ "ALL": "Todo", "EMPTY-LIST": "Nada aquí todavía.", "LATEST-ACTIVITY": "Última actividad", - "DMP-ABOUT-BEG": "Un PGD en {{ APP_NAME }} consiste en la información clave sobre una investigación. Para este propósito se incluyen además de objetivos e investigaciones la documentación sobre los datasets de la investigación.", - "DMP-ABOUT-END": ", esto resalta los pasos seguidos y los medios usados en las actividades de administración de datos.", - "SELECT-DMP": "Select a DMP for your Dataset", + "PLAN-ABOUT-BEG": "Un PGD en {{ APP_NAME }} consiste en la información clave sobre una investigación. Para este propósito se incluyen además de objetivos e investigaciones la documentación sobre los datasets de la investigación.", + "PLAN-ABOUT-END": ", esto resalta los pasos seguidos y los medios usados en las actividades de administración de datos.", + "SELECT-PLAN": "Select a DMP for your Dataset", "ACTIONS": { "ADD-DESCRIPTION": "Add Description" }, "TOUR-GUIDE": { - "DMP": "Esta es su consola, puede ver y editar todos los PGD en los que ha participado o creado.", + "PLAN": "Esta es su consola, puede ver y editar todos los PGD en los que ha participado o creado.", "START-NEW": "Cree su PGD con la opción Iniciar nuevo PGD.", "IMPORT-DMP": "Puede importar un PGD", "START-WIZARD": "o crear uno nuevo en {{ APP_NAME }}.", @@ -2152,7 +2152,7 @@ }, "ADD-NEW-DESCRIPTION": { "OPTIONS-NOT-ENOUGH": "¿No son estas opciones suficientes?", - "START-NEW-DMP": "Iniciar un nuevo PGD", + "START-NEW-PLAN": "Iniciar un nuevo PGD", "OPTIONS": { "CREATED-AT": "Created At:" } @@ -2207,7 +2207,7 @@ "EMAILS": "Emails", "YOUR-EMAIL": "Su Email" }, - "ASSOCIATED-DMPS": "PGDs asociados", + "ASSOCIATED-PLANS": "PGDs asociados", "ROLE-ORGANIZATION": { "FACULTY": "Facultad", "LIBRARIAN": "Bibliotecario", @@ -2234,9 +2234,9 @@ "CANCEL": "Cancelar" } }, - "DMP-FINALISE-DIALOG": { + "PLAN-FINALISE-DIALOG": { "TITLE": "Finalize this item?", - "DMP": "PGD", + "PLAN": "PGD", "DESCRPIPTIONS": "Descriptions", "EMPTY": "Hasta ahora no hay descripciones del dataset para este PGD", "FINALISE-TITLE": "¿Quiere finalizar alguno de los siguiente borradores de descripción de dataset?", @@ -2245,8 +2245,8 @@ "INVALID-DMP": "This Plan can not be finalized " }, "IMPACT": "Esta acción finaliza su PGD, y no podrá editarla otra vez. ", - "PUBLIC-DMP-MESSAGE": "After finalizing your Plan, it'll be published and be publicly available to the {{ APP_NAME_CAPS }} tool.", - "RESTRICTED-DMP-MESSAGE": "Your Plan can be published and be publicly available to the {{ APP_NAME_CAPS }} tool after finalization when its access rights are opened. Current access rights: restricted", + "PUBLIC-PLAN-MESSAGE": "After finalizing your Plan, it'll be published and be publicly available to the {{ APP_NAME_CAPS }} tool.", + "RESTRICTED-PLAN-MESSAGE": "Your Plan can be published and be publicly available to the {{ APP_NAME_CAPS }} tool after finalization when its access rights are opened. Current access rights: restricted", "INVALID": "Inválido", "ACTIONS": { "SUBMIT": "Submit", @@ -2254,7 +2254,7 @@ } }, "START-NEW-DESCRIPTION-DIALOG": { - "SELECT-DMP": "Select Plan", + "SELECT-PLAN": "Select Plan", "ACTIONS": { "NEXT": "Next", "CANCEL": "Cancel" diff --git a/dmp-frontend/src/assets/i18n/gr.json b/dmp-frontend/src/assets/i18n/gr.json index e0f877506..c20f3894e 100644 --- a/dmp-frontend/src/assets/i18n/gr.json +++ b/dmp-frontend/src/assets/i18n/gr.json @@ -42,23 +42,23 @@ "DESCRIPTION-TEMPLATE-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", "DESCRIPTION-TEMPLATE-IS-NOT-FINALIZED": "The selected Description Template is not finalized.", "MULTIPLE-DESCRIPTION-TEMPLATE-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected Description Template where found. Please contact your administrator.", - "DMP-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", - "DMP-IS-NOT-FINALIZED": "The selected DMP is not finalized.", - "MULTIPLE-DMP-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected DMP where found. Please contact your administrator.", - "DMP-IS-FINALIZED": "The requested action cannot be completed as the DMP has been finalized. To proceed, please revert the finalization.", - "DMP-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP.", - "DMP-DESCRIPTION-TEMPLATE-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP's Description Template.", + "PLAN-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", + "PLAN-IS-NOT-FINALIZED": "The selected DMP is not finalized.", + "MULTIPLE-PLAN-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected DMP where found. Please contact your administrator.", + "PLAN-IS-FINALIZED": "The requested action cannot be completed as the DMP has been finalized. To proceed, please revert the finalization.", + "PLAN-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP.", + "PLAN-DESCRIPTION-TEMPLATE-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP's Description Template.", "INVALID-DESCRIPTION-TEMPLATE": "While tying to update your Description, a validation error occurred. The Description's associated DMP's Description Template is invalid.", "DESCRIPTION-IS-FINALIZED": "The requested action cannot be completed as the Description has been finalized. To proceed, please revert the finalization.", - "DMP-BLUEPRINT-HAS-NO-DESCRIPTION-TEMPLATES": "You need to select at least one Description Template. Click the 'Has Description Templates' button to proceed.", - "DMP-BLUEPRINT-NEW-VERSION-CONFLICT": "While trying to update your Blueprint, a version conflict occurred. Your Blueprint is not in the latest version.", - "DMP-DESCRIPTION-TEMPLATE-CAN-NOT-REMOVE": "The Description template cannot be removed as it is currently in use.", + "PLAN-BLUEPRINT-HAS-NO-DESCRIPTION-TEMPLATES": "You need to select at least one Description Template. Click the 'Has Description Templates' button to proceed.", + "PLAN-BLUEPRINT-NEW-VERSION-CONFLICT": "While trying to update your Blueprint, a version conflict occurred. Your Blueprint is not in the latest version.", + "PLAN-DESCRIPTION-TEMPLATE-CAN-NOT-REMOVE": "The Description template cannot be removed as it is currently in use.", "TENANT-TAMPERING": "This operation affects data from a Tenant different than your selected. Please reselect your Tenant.", "TENANT-CONFIGURATION-TYPE-CAN-NOT-CHANGE": "The configuration type for this Tenant cannot be changed.", "MULTIPLE-TENANT-CONFIGURATION-TYPE-NOT-ALLOWED": "Tenant Configuration already exists for this Tenant.", "TENANT-CODE-EXISTS": "The Tenant code you provided already exists. Please choose a different code.", - "DMP-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this plan.", - "IMPORT-DESCRIPTION-WITHOUT-DMP-DESCRIPTION-TEMPLATE": "Your plan contains descriptions that are not defined in which section they will exist", + "PLAN-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this plan.", + "IMPORT-DESCRIPTION-WITHOUT-PLAN-DESCRIPTION-TEMPLATE": "Your plan contains descriptions that are not defined in which section they will exist", "INVALID-API-KEY": "Invalid configurations detected. Please contact your administrator.", "STALE-API-KEY": "A problem occurred while trying to authorize you. Please try refreshing the page or logging in again. Contact the system administrator if the problem persists.", "SENSITIVE-INFO": "You've reached a section that contains sensitive information. To protect your privacy, please head back to the public area of the site or log in with your authorized account to access this information.", @@ -70,13 +70,13 @@ "OVERLAPPING-TENANT-CONFIGURATION-NOTIFIER-LIST": "An error occurred due to overlapping configurations. Please try again or contact your administrator.", "DESCRIPTION-TEMPLATE-INACTIVE-USER": "This description template contains users that are not exist", "DESCRIPTION-TEMPLATE-MISSING-USER-CONTACT-INFO": "This description template contains users that don't have contact info", - "DMP-INACTIVE-USER": "This plan contains users that are not exist", - "DMP-MISSING-USER-CONTACT-INFO": "This plan contains users that don't have contact info", + "PLAN-INACTIVE-USER": "This plan contains users that are not exist", + "PLAN-MISSING-USER-CONTACT-INFO": "This plan contains users that don't have contact info", "DESCRIPTION-TEMPLATE-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this description template.", - "DMP-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.", + "PLAN-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.", "REFERENCE-TYPE-CODE-EXISTS": "The reference type code you provided already exists. Please choose a different code.", "PREFILLING-SOURCE-CODE-EXISTS": "The prefilling source code you provided already exists. Please choose a different code.", - "DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once", + "DUPLICATE-PLAN-USER": "You can't invite authors with same role and plan section more than once", "INVITE-USER-ALREADY-CONFIRMED": "Ιnvitation has already confirmed", "REQUEST-HAS-EXPIRED": "Request has expired" }, @@ -112,9 +112,9 @@ "CLOSE": "Κλείσιμο" } }, - "DMP-TO-DESCRIPTION-DIALOG": { + "PLAN-TO-DESCRIPTION-DIALOG": { "FROM-DMP": "Δημιουργήσατε με επιτυχία το Σχέδιο Διαχείρισης Δεδομένων σας", - "DMP": "Σχέδιο Διαχείρισης Δεδομένων", + "PLAN": "Σχέδιο Διαχείρισης Δεδομένων", "TO-DESCRIPTION": "Θα μεταφερθείτε στο", "DATASET": "Σύνολο Δεδομένων", "EDITOR": "Συντάκτης", @@ -186,7 +186,7 @@ "CRITERIA": { "LIKE": "Search..." }, - "START-NEW-DMP-DIALOG": { + "START-NEW-PLAN-DIALOG": { "UPLOAD-FILE": "Μεταφόρτωση Αρχείου", "REPLACE-FILE": "Replace File" } @@ -231,8 +231,8 @@ "DESCRIPTION-TEMPLATE-TYPES": "Description Types", "DESCRIPTION-TEMPLATES": "Description Templates", "NEW-DESCRIPTION-TEMPLATE-TYPE": "New", - "DMP-BLUEPRINTS": "Plan Blueprints", - "NEW-DMP-BLUEPRINT": "New", + "PLAN-BLUEPRINTS": "Plan Blueprints", + "NEW-PLAN-BLUEPRINT": "New", "NEW-DESCRIPTION-TEMPLATES": "New", "REFERENCE-TYPES": "Reference Types", "NEW-REFERENCE-TYPE": "New", @@ -278,14 +278,14 @@ "MACHINE-ACTIONABLE": "for machine-actionable DMPs" }, "NAV-BAR": { - "START-NEW-DMP": "Ξεκινήστε νέο DMP", + "START-NEW-PLAN": "Ξεκινήστε νέο DMP", "INAPP-NOTIFICATIONS": "All Notifications", "READ-ALL-INAPP-NOTIFICATIONS": "Read All" }, "SIDE-BAR": { "GENERAL": "ΓΕΝΙΚΑ", "DASHBOARD": "Αρχική", - "DMP": "ΣΧΕΔΙΑ ΔΙΑΧΕΙΡΙΣΗΣ ΔΕΔΟΜΕΝΩΝ", + "PLAN": "ΣΧΕΔΙΑ ΔΙΑΧΕΙΡΙΣΗΣ ΔΕΔΟΜΕΝΩΝ", "MY-DMPS": "Τα δικά μου Σχέδια Διαχείρισης Δεδομένων", "DESCRIPTIONS": "ΠΕΡΙΓΡΑΦΕΣ ΣΥΝΟΛΟΥ ΔΕΔΟΜΕΝΩΝ", "MY-DESCRIPTIONS": "My Descriptions", @@ -295,7 +295,7 @@ "ADMIN": "ΔΙΑΧΕΙΡΙΣΤΗΣ", "DESCRIPTION-TEMPLATES": "Description Templates", "DESCRIPTION-TEMPLATE-TYPES": "Description Types", - "DMP-BLUEPRINTS": "DMP Blueprints", + "PLAN-BLUEPRINTS": "DMP Blueprints", "USERS": "Users", "TENANT-USERS":"Tenant Users", "CO-BRANDING": "Co-Branding", @@ -355,7 +355,7 @@ "ACTIONS": { "SEND-USER-TOUCH": "Send user touch events", "SEND-TENANT-TOUCH": "Send tenant touch events", - "SEND-DMP-TOUCH": "Send dmp touch events", + "SEND-PLAN-TOUCH": "Send dmp touch events", "SEND-DESCRIPTION-TOUCH": "Send description touch events" } } @@ -650,8 +650,8 @@ "MESSAGE": "Somebody else is modifying the description template at this moment. You may view the description template but you cannot make any changes. If you would like to modify it please come back later." } }, - "DMP-LISTING": { - "DMP": "Σχέδιο Διαχείρισης Δεδομένων", + "PLAN-LISTING": { + "PLAN": "Σχέδιο Διαχείρισης Δεδομένων", "GRANT": "Επιχορήγηση", "EDITED": "Επεξεργάστηκε", "PUBLISHED": "Δημοσιευμένο", @@ -696,7 +696,7 @@ "NAME": "Related Description Templates", "PLACEHOLDER": "Select Description Templates" }, - "ASSOCIATED-DMP-BLUEPRINTS": { + "ASSOCIATED-PLAN-BLUEPRINTS": { "NAME": "Related DMP Blueprints", "PLACEHOLDER": "Select DMP Blueprints" }, @@ -713,7 +713,7 @@ }, "EMPTY-LIST": "Δεν υπάρχει τίποτα ακόμα εδώ." }, - "DMP-UPLOAD": { + "PLAN-UPLOAD": { "TITLE": "Εισαγωγή Σχεδίου Διαχείρισης Δεδομένων", "UPLOAD-SUCCESS": "Επιτυχής Εισαγωγή", "ANALYZING-FILE": "Analyzing file", @@ -730,7 +730,7 @@ }, "PLACEHOLDER": "Τίτλος Σχεδίου Διαχείρισης Δεδομένων" }, - "DMP-DELETE-DIALOG": { + "PLAN-DELETE-DIALOG": { "WARNING": "Warning!", "DELETE-ITEM": "Are you sure to delete this plan? The following descriptions will also be removed:", "ACTIONS": { @@ -738,7 +738,7 @@ "CANCEL": "Cancel" } }, - "DMP-OVERVIEW": { + "PLAN-OVERVIEW": { "TITLE": "Plan", "PUBLIC": "Δημόσιο", "LOCKED": "Κλειδωμένο", @@ -749,7 +749,7 @@ "DESCRIPTION": "Description", "DESCRIPTIONS": "Descriptions included", "DOI-PROVIDED": "DOI provided by", - "DMP-AUTHORS": "Συγγραφείς DΜP", + "PLAN-AUTHORS": "Συγγραφείς DΜP", "YOU": "εσύ", "ACTIONS": { "BACK": "Back", @@ -850,7 +850,7 @@ "GRANT": "Grant", "LOCKED": "Description is Locked by another user", "PART-OF": "Part of", - "DMP": "Plan", + "PLAN": "Plan", "EMPTY-LIST": "Τίποτα ακόμα εδώ.", "ACTIONS": { "ADD-REFERENCE-TYPE": "Add a Reference Type", @@ -889,7 +889,7 @@ "NAME": "Related Description Templates", "PLACEHOLDER": "Select Description Templates" }, - "ASSOCIATED-DMPS": { + "ASSOCIATED-PLANS": { "NAME": "Related DMPs", "PLACEHOLDER": "Select DMPs" }, @@ -922,7 +922,7 @@ "TITLE-PREVIEW-DESCRIPTION": "Previewing Description", "TO-DMP": "Previewing Description", "UNSAVED-CHANGES": "(unsaved changes)", - "DMP": "Plan", + "PLAN": "Plan", "TOC": { "TITLE": "Guide steps", "MAIN-INFO": "Main info", @@ -1000,8 +1000,8 @@ }, "DESCRIPTION-COPY-DIALOG": { "TITLE": "Copy Description to Plan", - "SELECT-DMP": "Select Plan", - "DMP-SECTION": "Select Section" + "SELECT-PLAN": "Select Plan", + "PLAN-SECTION": "Select Section" }, "PREFILL-DESCRIPTION-DIALOG": { "TITLE": "Initialize your Description", @@ -1566,7 +1566,7 @@ "REMOVE-FIELD": "Remove Field" } }, - "DMP-BLUEPRINT-EDITOR": { + "PLAN-BLUEPRINT-EDITOR": { "TITLE": { "NEW": "New DMP Blueprint", "CLONE": "Clone Plan Blueprint", @@ -1617,7 +1617,7 @@ "MESSAGE": "Somebody else is modifying the Plan Blueprint at this moment. You may view the Plan Blueprint but you cannot make any changes. If you would like to modify it please come back later." } }, - "DMP-EDITOR": { + "PLAN-EDITOR": { "TITLE-NEW": "New Plan", "TITLE-EDIT": "Editing Plan", "TITLE": "Plan Template", @@ -1645,7 +1645,7 @@ "USER-ROLE": "Role", "SECTIONS": "Plan Sections", "ALL-SECTIONS": "All", - "DMP-BLUEPRINT-VERSION": "Version" + "PLAN-BLUEPRINT-VERSION": "Version" }, "ACTIONS": { "DISCARD": { @@ -1688,7 +1688,7 @@ "SNACK-BAR": { "UNSUCCESSFUL-DOI": "Αποτυχία δημιουργίας Μονοσήμαντων Αναγνωριστικών Ψηφιακών Αντικειμένων (DOI)", "SUCCESSFUL-DOI": "Επιτυχία δημιουργίας Μονοσήμαντων Αναγνωριστικών Ψηφιακών Αντικειμένων (DOI)", - "SUCCESSFUL-DMP-CONTACT": "User added" + "SUCCESSFUL-PLAN-CONTACT": "User added" }, "DESCRIPTION-TEMPLATE-LIST": { "TITLE": "Available Description Templates", @@ -1721,7 +1721,7 @@ "TYPE-INFORMATION": " Information" } }, - "DMP-CLONE-DIALOG": { + "PLAN-CLONE-DIALOG": { "TITLE": "Clone", "FIELDS": { "LABEL": "Title of Plan", @@ -1738,7 +1738,7 @@ "TOGGLE-DESCRIPTIONS": "Check/Uncheck" } }, - "DMP-NEW-VERSION-DIALOG": { + "PLAN-NEW-VERSION-DIALOG": { "TITLE": "New Version", "FIELDS": { "LABEL": "Title of Plan", @@ -1757,7 +1757,7 @@ "TOGGLE-DESCRIPTIONS": "Check/Uncheck" } }, - "DMP-CONTACT-PREFILL-DIALOG": { + "PLAN-CONTACT-PREFILL-DIALOG": { "TITLE": "Add ", "TEXT": "Search an existing user where associated with your plans", "FIELDS": { @@ -1768,7 +1768,7 @@ "CONFIRM": "Confirm" } }, - "DMP-USER-INVITATION-DIALOG": { + "PLAN-USER-INVITATION-DIALOG": { "TITLE": "Invite authors", "ACTIONS": { "INVITE": "Invite" @@ -1776,8 +1776,8 @@ "SUCCESS": "Invitation Success", "ERROR": "Invitation Error" }, - "DMP-BLUEPRINT-LISTING": { - "CREATE-DMP-BLUEPRINT": "Create DMP Blueprint", + "PLAN-BLUEPRINT-LISTING": { + "CREATE-PLAN-BLUEPRINT": "Create DMP Blueprint", "FIELDS": { "NAME": "Name", "STATUS": "Status", @@ -1861,7 +1861,7 @@ "FINALIZED": "Finalized", "CANCELED": "Canceled" }, - "DMP-USER-ROLE": { + "PLAN-USER-ROLE": { "OWNER": "Owner", "VIEWER": "Viewer", "DESCRIPTION-CONTRIBUTOR": "Description Contributor", @@ -1870,11 +1870,11 @@ "EXTERNAL-DATASET-TYPE": { "SELECT": "Επιλέξτε" }, - "DMP": { + "PLAN": { "FINALISED": "Οριστικοποιημένο", "DRAFT": "Προσχέδιο" }, - "DMP-VISIBILITY": { + "PLAN-VISIBILITY": { "PUBLIC": "Δημοσιευμένο" }, "DESCRIPTION-TEMPLATE-FIELD-VALIDATION-TYPE": { @@ -1885,8 +1885,8 @@ "SELECT": "Select", "BOOLEAN-DECISION": "Boolean Decision", "RADIO-BOX": "Radio Box", - "INTERNAL-DMP-ENTITIES-DMPS": "Internal Plans", - "INTERNAL-DMP-ENTITIES-DESCRIPTIONS": "Internal Descriptions", + "INTERNAL-PLAN-ENTITIES-DMPS": "Internal Plans", + "INTERNAL-PLAN-ENTITIES-DESCRIPTIONS": "Internal Descriptions", "CHECKBOX": "Checkbox", "FREE-TEXT": "Free Text", "TEXT-AREA": "Text Area", @@ -1930,11 +1930,11 @@ "FINALIZED": "Finalized", "DRAFT": "Draft" }, - "DMP-BLUEPRINT-STATUS": { + "PLAN-BLUEPRINT-STATUS": { "FINALIZED": "Finalized", "DRAFT": "Draft" }, - "DMP-BLUEPRINT-SYSTEM-FIELD-TYPE": { + "PLAN-BLUEPRINT-SYSTEM-FIELD-TYPE": { "TITLE": "Title", "DESCRIPTION": "Description", "LANGUAGE": "Language", @@ -1942,7 +1942,7 @@ "ACCESS_RIGHTS": "Access", "USER": "User" }, - "DMP-BLUEPRINT-EXTRA-FIELD-DATA-TYPE": { + "PLAN-BLUEPRINT-EXTRA-FIELD-DATA-TYPE": { "DATE": "Date", "NUMBER": "Number", "TEXT": "Text", @@ -1994,17 +1994,17 @@ "REPLACE": "Replace" }, "NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE": { - "DMP-INVITATION-EXTERNAL-USER": "Plan Invitation External User", - "DMP-INVITATION-EXISTING-USER": "Plan Invitation Existing User", - "DMP-MODIFIED": "Plan Modified", - "DMP-FINALISED": "Plan Finalised", + "PLAN-INVITATION-EXTERNAL-USER": "Plan Invitation External User", + "PLAN-INVITATION-EXISTING-USER": "Plan Invitation Existing User", + "PLAN-MODIFIED": "Plan Modified", + "PLAN-FINALISED": "Plan Finalised", "DESCRIPTION-CREATED": "Description Created", "DESCRIPTION-MODIFIED": "Description Modified", "DESCRIPTION-FINALISED": "Description Finalised", "DESCRIPTION-ANNOTATION-CREATED": "Description Annotation Created", "MERGE-ACCOUNT-CONFIRMATION": "Merge Account Confirmation", "REMOVE-CREDENTIAL-CONFIRMATION": "Remove Credential Confirmation", - "DMP-DEPOSIT": "Plan Deposit", + "PLAN-DEPOSIT": "Plan Deposit", "DESCRIPTION-TEMPLATE-INVITATION": "Description Template Invitation", "CONTACT-SUPPORT": "Contact Support", "PUBLIC-CONTACT-SUPPORT": "Public Contact Support", @@ -2036,7 +2036,7 @@ "ERROR": "Error", "OMITTED": "Omitted" }, - "DMP-ACCESS-TYPE": { + "PLAN-ACCESS-TYPE": { "PUBLIC": "Public", "RESTRICTED": "Restricted Access" }, @@ -2045,11 +2045,11 @@ "REUSED": "Reused dataset", "OTHER": "Other" }, - "DMP-USER-TYPE": { + "PLAN-USER-TYPE": { "INTERNAL": "Internal", "EXTERNAL": "External" }, - "DMP-BLUEPRINT-FIELD-CATEGORY": { + "PLAN-BLUEPRINT-FIELD-CATEGORY": { "SYSTEM": "System", "EXTRA": "Custom", "REFERENCE-TYPE": "External Reference" @@ -2060,9 +2060,9 @@ "TAGS": "Tags" }, "LOCK-TARGET-TYPE": { - "DMP": "Plan", + "PLAN": "Plan", "DESCRIPTION": "Description", - "DMP-BLUEPRINT": "Plan Blueprint", + "PLAN-BLUEPRINT": "Plan Blueprint", "DESCRIPTION-TEMPLATE": "Description Template" } }, @@ -2115,14 +2115,14 @@ "DASHBOARD": { "GRANTS": "Επιχορηγήσεις", "TITLE": "Τι είναι το {{ APP_NAME_CAPS }}?", - "DMP-QUESTION": "Τι είναι το DMP στο {{ APP_NAME_CAPS }}?", + "PLAN-QUESTION": "Τι είναι το DMP στο {{ APP_NAME_CAPS }}?", "INFO-TEXT": "Το {{ APP_NAME_CAPS }} είναι μια ανοικτή επεκτάσιμη υπηρεσία που απλοποιεί τη διαχείριση, την επικύρωση, την παρακολούθηση και τη συντήρηση των Σχεδίων Διαχείρισης Δεδομένων. Επιτρέπει στους φορείς (ερευνητές, υπεύθυνους έρευνας, διευθυντές κλπ.) να δημιουργούν ζωντανά Σχέδια Διαχείρισης Δεδομένων που μπορούν να ανταλλάσσονται ελεύθερα μεταξύ των υποδομών για τη διεξαγωγή συγκεκριμένων πτυχών της διαδικασίας διαχείρισης Δεδομένων, σύμφωνα με τις προθέσεις και τη δέσμευση των κατόχων Δεδομένων.", - "INFO-DMP-TEXT": "Ένα Σχέδιο Διαχείρισης Δεδομένων είναι ένα ζωντανό αρχείο που περιγραφεί τα σύνολα δεδομένων που έχουν παραχθεί ή και επαναχρησιμοποιηθεί κατά τη διάρκεια και μετά του κύκλου ζωής της έρευνας. Τα Σχέδια Διαχείρισης Δεδομένων έχουν ως στόχο να παρέχουν στους ερευνητές τις αναγκαίες πληροφορίες για την αναπαραγωγή, επαναδιανομή και ανακατεύθυνση του σκοπού των ερευνητικών αποτελεσμάτων ώστε να εξασφαλίζεται η εγκυρότητα και η εκμετάλλευσή τους.", + "INFO-PLAN-TEXT": "Ένα Σχέδιο Διαχείρισης Δεδομένων είναι ένα ζωντανό αρχείο που περιγραφεί τα σύνολα δεδομένων που έχουν παραχθεί ή και επαναχρησιμοποιηθεί κατά τη διάρκεια και μετά του κύκλου ζωής της έρευνας. Τα Σχέδια Διαχείρισης Δεδομένων έχουν ως στόχο να παρέχουν στους ερευνητές τις αναγκαίες πληροφορίες για την αναπαραγωγή, επαναδιανομή και ανακατεύθυνση του σκοπού των ερευνητικών αποτελεσμάτων ώστε να εξασφαλίζεται η εγκυρότητα και η εκμετάλλευσή τους.", "NEW-QUESTION": "Νέος με τα DMP; Επισκέψου", "START-YOUR-FIRST-DMP": "Ξεκινήστε το πρώτο σας DMP", "OPEN-AIR-GUIDE": "Οδηγός για ερευνητές του OpenAIRE", "LEARN-MORE": "για να μάθετε περισσότερα για το πώς να δημιουργήσετε ένα!", - "DMPS": "Σχέδια Διαχείρισης Δεδομένων", + "PLANS": "Σχέδια Διαχείρισης Δεδομένων", "PERSONAL-USAGE": "Προσωπική Χρήση", "PUBLIC-USAGE": "Δημόσια Χρήση", "DESCRIPTIONS": "Descriptions", @@ -2134,14 +2134,14 @@ "ALL": "Όλα", "EMPTY-LIST": "Τίποτα ακόμα εδώ.", "LATEST-ACTIVITY": "Τελευταία Δραστηριότητα", - "DMP-ABOUT-BEG": "Ένα Σχέδιο Διαχείρισης Δεδομένων αποτελείται από τις βασικές πληροφορίες σχετικά με την έρευνα, όπως ο σκοπός, οι στόχοι και οι εμπλεκόμενοι ερευνητές, αλλά και σχετικά με την τεκμηρίωση των ερευνητικών συνόλων δεδομένων, δηλαδή", - "DMP-ABOUT-END": ", που υπογραμμίζουν τα βήματα που ακολουθήθηκαν και τα μέσα που χρησιμοποιήθηκαν κατά τις δραστηριότητες διαχείρισης δεδομένων.", - "SELECT-DMP": "Επιλέξτε ένα Σχέδιο Διαχείρισης Δεδομένων για το Σύνολο Δεδομένων σας", + "PLAN-ABOUT-BEG": "Ένα Σχέδιο Διαχείρισης Δεδομένων αποτελείται από τις βασικές πληροφορίες σχετικά με την έρευνα, όπως ο σκοπός, οι στόχοι και οι εμπλεκόμενοι ερευνητές, αλλά και σχετικά με την τεκμηρίωση των ερευνητικών συνόλων δεδομένων, δηλαδή", + "PLAN-ABOUT-END": ", που υπογραμμίζουν τα βήματα που ακολουθήθηκαν και τα μέσα που χρησιμοποιήθηκαν κατά τις δραστηριότητες διαχείρισης δεδομένων.", + "SELECT-PLAN": "Επιλέξτε ένα Σχέδιο Διαχείρισης Δεδομένων για το Σύνολο Δεδομένων σας", "ACTIONS": { "ADD-DESCRIPTION": "Add Description" }, "TOUR-GUIDE": { - "DMP": "This is your dashboard. You can view and edit all DMPs that you have either contributed to or created yourself.", + "PLAN": "This is your dashboard. You can view and edit all DMPs that you have either contributed to or created yourself.", "START-NEW": "Create your DMP with Start new DMP.", "IMPORT-DMP": "You can import a DMP", "START-WIZARD": "or create new in {{ APP_NAME }}.", @@ -2152,7 +2152,7 @@ }, "ADD-NEW-DESCRIPTION": { "OPTIONS-NOT-ENOUGH": "Are those options not enough?", - "START-NEW-DMP": "Start new DMP", + "START-NEW-PLAN": "Start new DMP", "OPTIONS": { "CREATED-AT": "Created At:" } @@ -2207,7 +2207,7 @@ "EMAILS": "Emails", "YOUR-EMAIL": "Your Email" }, - "ASSOCIATED-DMPS": "Συσχετιζόμενα Σχέδια Διαχείρισης Δεδομένων", + "ASSOCIATED-PLANS": "Συσχετιζόμενα Σχέδια Διαχείρισης Δεδομένων", "ROLE-ORGANIZATION": { "FACULTY": "Faculty", "LIBRARIAN": "Librarian", @@ -2234,9 +2234,9 @@ "CANCEL": "Cancel" } }, - "DMP-FINALISE-DIALOG": { + "PLAN-FINALISE-DIALOG": { "TITLE": "Finalize this item?", - "DMP": "Σχέδια Διαχείρισης Δεδομένων", + "PLAN": "Σχέδια Διαχείρισης Δεδομένων", "DESCRPIPTIONS": "Descriptions", "EMPTY": "Δεν υπάρχει καμία Διαθέσιμη Περιγραφή Συνόλου Δεδομένων μέχρι τώρα για αυτό το Σχέδιο Διαχείρισης Δεδομένων", "FINALISE-TITLE": "Θέλετε να οριστικοποιήσετε κάποια από τις ακόλουθες Περιγραφές Συνόλων Δεδομένων;", @@ -2245,8 +2245,8 @@ "INVALID-DMP": "This Plan can not be finalized " }, "IMPACT": "Αυτή η επιλογή θα οριστικοποιήσει το Σχέδιο Διαχείρισης Δεδομένων σας και δε θα μπορείτε να το επεξεργαστείτε ξανά σε αυτήν την έκδοση.", - "PUBLIC-DMP-MESSAGE": "After finalizing your Plan, it'll be published and be publicly available to the {{ APP_NAME_CAPS }} tool.", - "RESTRICTED-DMP-MESSAGE": "Your Plan can be published and be publicly available to the {{ APP_NAME_CAPS }} tool after finalization when its access rights are opened. Current access rights: restricted", + "PUBLIC-PLAN-MESSAGE": "After finalizing your Plan, it'll be published and be publicly available to the {{ APP_NAME_CAPS }} tool.", + "RESTRICTED-PLAN-MESSAGE": "Your Plan can be published and be publicly available to the {{ APP_NAME_CAPS }} tool after finalization when its access rights are opened. Current access rights: restricted", "INVALID": "Invalid", "ACTIONS": { "SUBMIT": "Submit", @@ -2254,7 +2254,7 @@ } }, "START-NEW-DESCRIPTION-DIALOG": { - "SELECT-DMP": "Select Plan", + "SELECT-PLAN": "Select Plan", "ACTIONS": { "NEXT": "Next", "CANCEL": "Cancel" diff --git a/dmp-frontend/src/assets/i18n/hr.json b/dmp-frontend/src/assets/i18n/hr.json index 04a3e7fc7..133797713 100644 --- a/dmp-frontend/src/assets/i18n/hr.json +++ b/dmp-frontend/src/assets/i18n/hr.json @@ -42,23 +42,23 @@ "DESCRIPTION-TEMPLATE-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", "DESCRIPTION-TEMPLATE-IS-NOT-FINALIZED": "The selected Description Template is not finalized.", "MULTIPLE-DESCRIPTION-TEMPLATE-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected Description Template where found. Please contact your administrator.", - "DMP-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", - "DMP-IS-NOT-FINALIZED": "The selected DMP is not finalized.", - "MULTIPLE-DMP-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected DMP where found. Please contact your administrator.", - "DMP-IS-FINALIZED": "The requested action cannot be completed as the DMP has been finalized. To proceed, please revert the finalization.", - "DMP-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP.", - "DMP-DESCRIPTION-TEMPLATE-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP's Description Template.", + "PLAN-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", + "PLAN-IS-NOT-FINALIZED": "The selected DMP is not finalized.", + "MULTIPLE-PLAN-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected DMP where found. Please contact your administrator.", + "PLAN-IS-FINALIZED": "The requested action cannot be completed as the DMP has been finalized. To proceed, please revert the finalization.", + "PLAN-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP.", + "PLAN-DESCRIPTION-TEMPLATE-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP's Description Template.", "INVALID-DESCRIPTION-TEMPLATE": "While tying to update your Description, a validation error occurred. The Description's associated DMP's Description Template is invalid.", "DESCRIPTION-IS-FINALIZED": "The requested action cannot be completed as the Description has been finalized. To proceed, please revert the finalization.", - "DMP-BLUEPRINT-HAS-NO-DESCRIPTION-TEMPLATES": "You need to select at least one Description Template. Click the 'Has Description Templates' button to proceed.", - "DMP-BLUEPRINT-NEW-VERSION-CONFLICT": "While trying to update your Blueprint, a version conflict occurred. Your Blueprint is not in the latest version.", - "DMP-DESCRIPTION-TEMPLATE-CAN-NOT-REMOVE": "The Description template cannot be removed as it is currently in use.", + "PLAN-BLUEPRINT-HAS-NO-DESCRIPTION-TEMPLATES": "You need to select at least one Description Template. Click the 'Has Description Templates' button to proceed.", + "PLAN-BLUEPRINT-NEW-VERSION-CONFLICT": "While trying to update your Blueprint, a version conflict occurred. Your Blueprint is not in the latest version.", + "PLAN-DESCRIPTION-TEMPLATE-CAN-NOT-REMOVE": "The Description template cannot be removed as it is currently in use.", "TENANT-TAMPERING": "This operation affects data from a Tenant different than your selected. Please reselect your Tenant.", "TENANT-CONFIGURATION-TYPE-CAN-NOT-CHANGE": "The configuration type for this Tenant cannot be changed.", "MULTIPLE-TENANT-CONFIGURATION-TYPE-NOT-ALLOWED": "Tenant Configuration already exists for this Tenant.", "TENANT-CODE-EXISTS": "The Tenant code you provided already exists. Please choose a different code.", - "DMP-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this plan.", - "IMPORT-DESCRIPTION-WITHOUT-DMP-DESCRIPTION-TEMPLATE": "Your plan contains descriptions that are not defined in which section they will exist", + "PLAN-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this plan.", + "IMPORT-DESCRIPTION-WITHOUT-PLAN-DESCRIPTION-TEMPLATE": "Your plan contains descriptions that are not defined in which section they will exist", "INVALID-API-KEY": "Invalid configurations detected. Please contact your administrator.", "STALE-API-KEY": "A problem occurred while trying to authorize you. Please try refreshing the page or logging in again. Contact the system administrator if the problem persists.", "SENSITIVE-INFO": "You've reached a section that contains sensitive information. To protect your privacy, please head back to the public area of the site or log in with your authorized account to access this information.", @@ -70,13 +70,13 @@ "OVERLAPPING-TENANT-CONFIGURATION-NOTIFIER-LIST": "An error occurred due to overlapping configurations. Please try again or contact your administrator.", "DESCRIPTION-TEMPLATE-INACTIVE-USER": "This description template contains users that are not exist", "DESCRIPTION-TEMPLATE-MISSING-USER-CONTACT-INFO": "This description template contains users that don't have contact info", - "DMP-INACTIVE-USER": "This plan contains users that are not exist", - "DMP-MISSING-USER-CONTACT-INFO": "This plan contains users that don't have contact info", + "PLAN-INACTIVE-USER": "This plan contains users that are not exist", + "PLAN-MISSING-USER-CONTACT-INFO": "This plan contains users that don't have contact info", "DESCRIPTION-TEMPLATE-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this description template.", - "DMP-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.", + "PLAN-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.", "REFERENCE-TYPE-CODE-EXISTS": "The reference type code you provided already exists. Please choose a different code.", "PREFILLING-SOURCE-CODE-EXISTS": "The prefilling source code you provided already exists. Please choose a different code.", - "DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once", + "DUPLICATE-PLAN-USER": "You can't invite authors with same role and plan section more than once", "INVITE-USER-ALREADY-CONFIRMED": "Ιnvitation has already confirmed", "REQUEST-HAS-EXPIRED": "Request has expired" }, @@ -112,9 +112,9 @@ "CLOSE": "Zatvori" } }, - "DMP-TO-DESCRIPTION-DIALOG": { + "PLAN-TO-DESCRIPTION-DIALOG": { "FROM-DMP": "Uspješno ste kreirali", - "DMP": "DMP", + "PLAN": "PLAN", "TO-DESCRIPTION": "Preusmjeravanje na", "DATASET": "uređivanje", "EDITOR": "skupa podataka", @@ -186,7 +186,7 @@ "CRITERIA": { "LIKE": "Search..." }, - "START-NEW-DMP-DIALOG": { + "START-NEW-PLAN-DIALOG": { "UPLOAD-FILE": "Prenesi datoteku", "REPLACE-FILE": "Zamijeni datoteku" } @@ -231,8 +231,8 @@ "DESCRIPTION-TEMPLATE-TYPES": "Description Types", "DESCRIPTION-TEMPLATES": "Description Templates", "NEW-DESCRIPTION-TEMPLATE-TYPE": "New", - "DMP-BLUEPRINTS": "Plan Blueprints", - "NEW-DMP-BLUEPRINT": "New", + "PLAN-BLUEPRINTS": "Plan Blueprints", + "NEW-PLAN-BLUEPRINT": "New", "NEW-DESCRIPTION-TEMPLATES": "New", "REFERENCE-TYPES": "Reference Types", "NEW-REFERENCE-TYPE": "New", @@ -278,14 +278,14 @@ "MACHINE-ACTIONABLE": "for machine-actionable DMPs" }, "NAV-BAR": { - "START-NEW-DMP": "Kreirajte novi Plan", + "START-NEW-PLAN": "Kreirajte novi Plan", "INAPP-NOTIFICATIONS": "All Notifications", "READ-ALL-INAPP-NOTIFICATIONS": "Read All" }, "SIDE-BAR": { "GENERAL": "OPĆENITO", "DASHBOARD": "Početak", - "DMP": "PLANOVI UPRAVLJANJA PODACIMA", + "PLAN": "PLANOVI UPRAVLJANJA PODACIMA", "MY-DMPS": "Moji Planovi", "DESCRIPTIONS": "OPISI SKUPOVA PODATAKA", "MY-DESCRIPTIONS": "My Descriptions", @@ -295,7 +295,7 @@ "ADMIN": "ADMINISTRATOR", "DESCRIPTION-TEMPLATES": "Description Templates", "DESCRIPTION-TEMPLATE-TYPES": "Description Types", - "DMP-BLUEPRINTS": "DMP Blueprints", + "PLAN-BLUEPRINTS": "DMP Blueprints", "USERS": "Korisnici", "TENANT-USERS":"Tenant Users", "CO-BRANDING": "Razvoj i suradnja", @@ -355,7 +355,7 @@ "ACTIONS": { "SEND-USER-TOUCH": "Send user touch events", "SEND-TENANT-TOUCH": "Send tenant touch events", - "SEND-DMP-TOUCH": "Send dmp touch events", + "SEND-PLAN-TOUCH": "Send dmp touch events", "SEND-DESCRIPTION-TOUCH": "Send description touch events" } } @@ -650,8 +650,8 @@ "MESSAGE": "Somebody else is modifying the description template at this moment. You may view the description template but you cannot make any changes. If you would like to modify it please come back later." } }, - "DMP-LISTING": { - "DMP": "Plan upravljanja podacima", + "PLAN-LISTING": { + "PLAN": "Plan upravljanja podacima", "GRANT": "Potpora", "EDITED": "Izmijenjeno", "PUBLISHED": "Objavljeno", @@ -696,7 +696,7 @@ "NAME": "Related Description Templates", "PLACEHOLDER": "Select Description Templates" }, - "ASSOCIATED-DMP-BLUEPRINTS": { + "ASSOCIATED-PLAN-BLUEPRINTS": { "NAME": "Related DMP Blueprints", "PLACEHOLDER": "Select DMP Blueprints" }, @@ -713,7 +713,7 @@ }, "EMPTY-LIST": "Ništa još nije dostupno." }, - "DMP-UPLOAD": { + "PLAN-UPLOAD": { "TITLE": "Uvezi plan upravljanja podacima", "UPLOAD-SUCCESS": "Uspješan prijenos", "ANALYZING-FILE": "Analyzing file", @@ -730,7 +730,7 @@ }, "PLACEHOLDER": "Naslov Plana" }, - "DMP-DELETE-DIALOG": { + "PLAN-DELETE-DIALOG": { "WARNING": "Warning!", "DELETE-ITEM": "Are you sure to delete this plan? The following descriptions will also be removed:", "ACTIONS": { @@ -738,7 +738,7 @@ "CANCEL": "Cancel" } }, - "DMP-OVERVIEW": { + "PLAN-OVERVIEW": { "TITLE": "Plan", "PUBLIC": "Javno", "LOCKED": "Zaključano", @@ -749,7 +749,7 @@ "DESCRIPTION": "Description", "DESCRIPTIONS": "Descriptions included", "DOI-PROVIDED": "DOI provided by", - "DMP-AUTHORS": "Autor/i Plana", + "PLAN-AUTHORS": "Autor/i Plana", "YOU": "Vi", "ACTIONS": { "BACK": "Back", @@ -850,7 +850,7 @@ "GRANT": "Grant", "LOCKED": "Description is Locked by another user", "PART-OF": "Part of", - "DMP": "Plan", + "PLAN": "Plan", "EMPTY-LIST": "Ništa još nije dostupno.", "ACTIONS": { "ADD-REFERENCE-TYPE": "Add a Reference Type", @@ -889,7 +889,7 @@ "NAME": "Related Description Templates", "PLACEHOLDER": "Select Description Templates" }, - "ASSOCIATED-DMPS": { + "ASSOCIATED-PLANS": { "NAME": "Related DMPs", "PLACEHOLDER": "Select DMPs" }, @@ -922,7 +922,7 @@ "TITLE-PREVIEW-DESCRIPTION": "Previewing Description", "TO-DMP": "Previewing Description", "UNSAVED-CHANGES": "(unsaved changes)", - "DMP": "Plan", + "PLAN": "Plan", "TOC": { "TITLE": "Guide steps", "MAIN-INFO": "Main info", @@ -1000,8 +1000,8 @@ }, "DESCRIPTION-COPY-DIALOG": { "TITLE": "Copy Description to Plan", - "SELECT-DMP": "Select Plan", - "DMP-SECTION": "Select Section" + "SELECT-PLAN": "Select Plan", + "PLAN-SECTION": "Select Section" }, "PREFILL-DESCRIPTION-DIALOG": { "TITLE": "Initialize your Description", @@ -1566,7 +1566,7 @@ "REMOVE-FIELD": "Remove Field" } }, - "DMP-BLUEPRINT-EDITOR": { + "PLAN-BLUEPRINT-EDITOR": { "TITLE": { "NEW": "New DMP Blueprint", "CLONE": "Clone Plan Blueprint", @@ -1617,7 +1617,7 @@ "MESSAGE": "Somebody else is modifying the Plan Blueprint at this moment. You may view the Plan Blueprint but you cannot make any changes. If you would like to modify it please come back later." } }, - "DMP-EDITOR": { + "PLAN-EDITOR": { "TITLE-NEW": "New Plan", "TITLE-EDIT": "Editing Plan", "TITLE": "Plan Template", @@ -1645,7 +1645,7 @@ "USER-ROLE": "Role", "SECTIONS": "Plan Sections", "ALL-SECTIONS": "All", - "DMP-BLUEPRINT-VERSION": "Version" + "PLAN-BLUEPRINT-VERSION": "Version" }, "ACTIONS": { "DISCARD": { @@ -1688,7 +1688,7 @@ "SNACK-BAR": { "UNSUCCESSFUL-DOI": "Neuspješno generiran DOI", "SUCCESSFUL-DOI": "Uspješno generiran DOI", - "SUCCESSFUL-DMP-CONTACT": "User added" + "SUCCESSFUL-PLAN-CONTACT": "User added" }, "DESCRIPTION-TEMPLATE-LIST": { "TITLE": "Available Description Templates", @@ -1721,7 +1721,7 @@ "TYPE-INFORMATION": " Information" } }, - "DMP-CLONE-DIALOG": { + "PLAN-CLONE-DIALOG": { "TITLE": "Clone", "FIELDS": { "LABEL": "Title of Plan", @@ -1738,7 +1738,7 @@ "TOGGLE-DESCRIPTIONS": "Check/Uncheck" } }, - "DMP-NEW-VERSION-DIALOG": { + "PLAN-NEW-VERSION-DIALOG": { "TITLE": "New Version", "FIELDS": { "LABEL": "Title of Plan", @@ -1757,7 +1757,7 @@ "TOGGLE-DESCRIPTIONS": "Check/Uncheck" } }, - "DMP-CONTACT-PREFILL-DIALOG": { + "PLAN-CONTACT-PREFILL-DIALOG": { "TITLE": "Add ", "TEXT": "Search an existing user where associated with your plans", "FIELDS": { @@ -1768,7 +1768,7 @@ "CONFIRM": "Confirm" } }, - "DMP-USER-INVITATION-DIALOG": { + "PLAN-USER-INVITATION-DIALOG": { "TITLE": "Invite authors", "ACTIONS": { "INVITE": "Invite" @@ -1776,8 +1776,8 @@ "SUCCESS": "Invitation Success", "ERROR": "Invitation Error" }, - "DMP-BLUEPRINT-LISTING": { - "CREATE-DMP-BLUEPRINT": "Create DMP Blueprint", + "PLAN-BLUEPRINT-LISTING": { + "CREATE-PLAN-BLUEPRINT": "Create DMP Blueprint", "FIELDS": { "NAME": "Name", "STATUS": "Status", @@ -1861,7 +1861,7 @@ "FINALIZED": "Finalized", "CANCELED": "Canceled" }, - "DMP-USER-ROLE": { + "PLAN-USER-ROLE": { "OWNER": "Owner", "VIEWER": "Viewer", "DESCRIPTION-CONTRIBUTOR": "Description Contributor", @@ -1870,11 +1870,11 @@ "EXTERNAL-DATASET-TYPE": { "SELECT": "Odaberite" }, - "DMP": { + "PLAN": { "FINALISED": "Završeno", "DRAFT": "Nacrt" }, - "DMP-VISIBILITY": { + "PLAN-VISIBILITY": { "PUBLIC": "Objavljeno" }, "DESCRIPTION-TEMPLATE-FIELD-VALIDATION-TYPE": { @@ -1885,8 +1885,8 @@ "SELECT": "Select", "BOOLEAN-DECISION": "Boolean Decision", "RADIO-BOX": "Radio Box", - "INTERNAL-DMP-ENTITIES-DMPS": "Internal Plans", - "INTERNAL-DMP-ENTITIES-DESCRIPTIONS": "Internal Descriptions", + "INTERNAL-PLAN-ENTITIES-DMPS": "Internal Plans", + "INTERNAL-PLAN-ENTITIES-DESCRIPTIONS": "Internal Descriptions", "CHECKBOX": "Checkbox", "FREE-TEXT": "Free Text", "TEXT-AREA": "Text Area", @@ -1930,11 +1930,11 @@ "FINALIZED": "Finalized", "DRAFT": "Draft" }, - "DMP-BLUEPRINT-STATUS": { + "PLAN-BLUEPRINT-STATUS": { "FINALIZED": "Finalized", "DRAFT": "Draft" }, - "DMP-BLUEPRINT-SYSTEM-FIELD-TYPE": { + "PLAN-BLUEPRINT-SYSTEM-FIELD-TYPE": { "TITLE": "Title", "DESCRIPTION": "Description", "LANGUAGE": "Language", @@ -1942,7 +1942,7 @@ "ACCESS_RIGHTS": "Access", "USER": "User" }, - "DMP-BLUEPRINT-EXTRA-FIELD-DATA-TYPE": { + "PLAN-BLUEPRINT-EXTRA-FIELD-DATA-TYPE": { "DATE": "Date", "NUMBER": "Number", "TEXT": "Text", @@ -1994,17 +1994,17 @@ "REPLACE": "Replace" }, "NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE": { - "DMP-INVITATION-EXTERNAL-USER": "Plan Invitation External User", - "DMP-INVITATION-EXISTING-USER": "Plan Invitation Existing User", - "DMP-MODIFIED": "Plan Modified", - "DMP-FINALISED": "Plan Finalised", + "PLAN-INVITATION-EXTERNAL-USER": "Plan Invitation External User", + "PLAN-INVITATION-EXISTING-USER": "Plan Invitation Existing User", + "PLAN-MODIFIED": "Plan Modified", + "PLAN-FINALISED": "Plan Finalised", "DESCRIPTION-CREATED": "Description Created", "DESCRIPTION-MODIFIED": "Description Modified", "DESCRIPTION-FINALISED": "Description Finalised", "DESCRIPTION-ANNOTATION-CREATED": "Description Annotation Created", "MERGE-ACCOUNT-CONFIRMATION": "Merge Account Confirmation", "REMOVE-CREDENTIAL-CONFIRMATION": "Remove Credential Confirmation", - "DMP-DEPOSIT": "Plan Deposit", + "PLAN-DEPOSIT": "Plan Deposit", "DESCRIPTION-TEMPLATE-INVITATION": "Description Template Invitation", "CONTACT-SUPPORT": "Contact Support", "PUBLIC-CONTACT-SUPPORT": "Public Contact Support", @@ -2036,7 +2036,7 @@ "ERROR": "Error", "OMITTED": "Omitted" }, - "DMP-ACCESS-TYPE": { + "PLAN-ACCESS-TYPE": { "PUBLIC": "Public", "RESTRICTED": "Restricted Access" }, @@ -2045,11 +2045,11 @@ "REUSED": "Reused dataset", "OTHER": "Other" }, - "DMP-USER-TYPE": { + "PLAN-USER-TYPE": { "INTERNAL": "Internal", "EXTERNAL": "External" }, - "DMP-BLUEPRINT-FIELD-CATEGORY": { + "PLAN-BLUEPRINT-FIELD-CATEGORY": { "SYSTEM": "System", "EXTRA": "Custom", "REFERENCE-TYPE": "External Reference" @@ -2060,9 +2060,9 @@ "TAGS": "Tags" }, "LOCK-TARGET-TYPE": { - "DMP": "Plan", + "PLAN": "Plan", "DESCRIPTION": "Description", - "DMP-BLUEPRINT": "Plan Blueprint", + "PLAN-BLUEPRINT": "Plan Blueprint", "DESCRIPTION-TEMPLATE": "Description Template" } }, @@ -2115,14 +2115,14 @@ "DASHBOARD": { "GRANTS": "Potpore", "TITLE": "Što je {{ APP_NAME_CAPS }}?", - "DMP-QUESTION": "Što je Plan upravljanja podacima u {{ APP_NAME_CAPS }}U?", + "PLAN-QUESTION": "Što je Plan upravljanja podacima u {{ APP_NAME_CAPS }}U?", "INFO-TEXT": "{{ APP_NAME_CAPS }} je otvorena modularna aplikacija koja pojednostavljuje izradu Planova upravljanja podacima (eng. Data Management Plan), kao i njihovu provjeru, praćenje i održavanje. Uz pomoć {{ APP_NAME_CAPS }}a, svi sudionici u istraživanju (istraživači, administratori, nadzorna tijela i drugi) mogu izraditi primjenjive Planove koji se mogu slobodno razmjenjivati kroz različite infrastrukture radi provođenja određenih dijelova procesa upravljanja podacima u skladu s namjerama i obvezama vlasnika podataka.", - "INFO-DMP-TEXT": "Plan upravljanja podacima (eng. Data Management Plan, skraćeno DMP) je živi dokument koji opisuje skupove podataka prikupljene ili korištene tijekom i nakon istraživanja. Planovi sadrže osnovne informacije o mogućnostima za ponovnu upotrebu i naknadnu distribuciju rezultata istraživanja, kao i za njihovo korištenje u novim kontekstima, čime se potvrđuje njihova valjanost i osigurava njihovo ponovno korištenje.", + "INFO-PLAN-TEXT": "Plan upravljanja podacima (eng. Data Management Plan, skraćeno DMP) je živi dokument koji opisuje skupove podataka prikupljene ili korištene tijekom i nakon istraživanja. Planovi sadrže osnovne informacije o mogućnostima za ponovnu upotrebu i naknadnu distribuciju rezultata istraživanja, kao i za njihovo korištenje u novim kontekstima, čime se potvrđuje njihova valjanost i osigurava njihovo ponovno korištenje.", "NEW-QUESTION": "Potrebna Vam je pomoć pri izradi Plana upravljanja podacima? Posjetite", "START-YOUR-FIRST-DMP": "Započnite Vaš prvi Plan upravljanja podacima", "OPEN-AIR-GUIDE": "OpenAIRE Upute za istraživače", "LEARN-MORE": "kako biste naučili kako izraditi vlastiti Plan!", - "DMPS": "Planovi upravljanja podacima", + "PLANS": "Planovi upravljanja podacima", "PERSONAL-USAGE": "Osobna upotreba", "PUBLIC-USAGE": "Javna upotreba", "DESCRIPTIONS": "Descriptions", @@ -2134,14 +2134,14 @@ "ALL": "Sve", "EMPTY-LIST": "Ništa još nije dostupno.", "LATEST-ACTIVITY": "Posljednja aktivnost", - "DMP-ABOUT-BEG": "Plan upravljanja podacima u {{ APP_NAME }}u sadrži osnovne informacije o istraživanju (kao što su svrha i ciljevi istraživanja), uključenim istraživačima te dokumentaciju o skupovima istraživačkih podataka", - "DMP-ABOUT-END": " (informacije koje ukazuju na procedure i sredstva korištena prilikom upravljanja podacima).", - "SELECT-DMP": "Odaberite odgovarajući Plan za Vaš skup podataka", + "PLAN-ABOUT-BEG": "Plan upravljanja podacima u {{ APP_NAME }}u sadrži osnovne informacije o istraživanju (kao što su svrha i ciljevi istraživanja), uključenim istraživačima te dokumentaciju o skupovima istraživačkih podataka", + "PLAN-ABOUT-END": " (informacije koje ukazuju na procedure i sredstva korištena prilikom upravljanja podacima).", + "SELECT-PLAN": "Odaberite odgovarajući Plan za Vaš skup podataka", "ACTIONS": { "ADD-DESCRIPTION": "Add Description" }, "TOUR-GUIDE": { - "DMP": "Ovo je Vaša kontrolna ploča. Ovdje možete pregledavati i uređivati sve Planove upravljanja podacima kojima ste doprinijeli ili koje ste sami izradili.", + "PLAN": "Ovo je Vaša kontrolna ploča. Ovdje možete pregledavati i uređivati sve Planove upravljanja podacima kojima ste doprinijeli ili koje ste sami izradili.", "START-NEW": "Izradite svoj Plan upravljanja podacima pritiskom na Započni novi Plan upravljanja podacima.", "IMPORT-DMP": "Plan možete uvesti", "START-WIZARD": "ili stvoriti novi u {{ APP_NAME }}u.", @@ -2152,7 +2152,7 @@ }, "ADD-NEW-DESCRIPTION": { "OPTIONS-NOT-ENOUGH": "Ako niste pronašli odgovarajući Plan,", - "START-NEW-DMP": "započnite novi.", + "START-NEW-PLAN": "započnite novi.", "OPTIONS": { "CREATED-AT": "Created At:" } @@ -2207,7 +2207,7 @@ "EMAILS": "E-mail adrese", "YOUR-EMAIL": "Vaš e-mail" }, - "ASSOCIATED-DMPS": "Povezani Planovi", + "ASSOCIATED-PLANS": "Povezani Planovi", "ROLE-ORGANIZATION": { "FACULTY": "Fakultet", "LIBRARIAN": "Knjižničar/ka", @@ -2234,9 +2234,9 @@ "CANCEL": "Poništi" } }, - "DMP-FINALISE-DIALOG": { + "PLAN-FINALISE-DIALOG": { "TITLE": "Finalize this item?", - "DMP": "Plan upravljanja podacima", + "PLAN": "Plan upravljanja podacima", "DESCRPIPTIONS": "Descriptions", "EMPTY": "U Planu nije opisan nijedan skup podataka?", "FINALISE-TITLE": "Želite li završiti kreiranje radnih verzija skupova podataka?", @@ -2245,8 +2245,8 @@ "INVALID-DMP": "This Plan can not be finalized " }, "IMPACT": "Ovim korakom se završava proces kreiranja Plana upravljanja podacima, više ga nećete moći uređivati.", - "PUBLIC-DMP-MESSAGE": "After finalizing your Plan, it'll be published and be publicly available to the {{ APP_NAME_CAPS }} tool.", - "RESTRICTED-DMP-MESSAGE": "Your Plan can be published and be publicly available to the {{ APP_NAME_CAPS }} tool after finalization when its access rights are opened. Current access rights: restricted", + "PUBLIC-PLAN-MESSAGE": "After finalizing your Plan, it'll be published and be publicly available to the {{ APP_NAME_CAPS }} tool.", + "RESTRICTED-PLAN-MESSAGE": "Your Plan can be published and be publicly available to the {{ APP_NAME_CAPS }} tool after finalization when its access rights are opened. Current access rights: restricted", "INVALID": "Greška", "ACTIONS": { "SUBMIT": "Submit", @@ -2254,7 +2254,7 @@ } }, "START-NEW-DESCRIPTION-DIALOG": { - "SELECT-DMP": "Select Plan", + "SELECT-PLAN": "Select Plan", "ACTIONS": { "NEXT": "Next", "CANCEL": "Cancel" diff --git a/dmp-frontend/src/assets/i18n/pl.json b/dmp-frontend/src/assets/i18n/pl.json index c2f962d28..e44cfb131 100644 --- a/dmp-frontend/src/assets/i18n/pl.json +++ b/dmp-frontend/src/assets/i18n/pl.json @@ -42,23 +42,23 @@ "DESCRIPTION-TEMPLATE-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", "DESCRIPTION-TEMPLATE-IS-NOT-FINALIZED": "The selected Description Template is not finalized.", "MULTIPLE-DESCRIPTION-TEMPLATE-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected Description Template where found. Please contact your administrator.", - "DMP-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", - "DMP-IS-NOT-FINALIZED": "The selected DMP is not finalized.", - "MULTIPLE-DMP-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected DMP where found. Please contact your administrator.", - "DMP-IS-FINALIZED": "The requested action cannot be completed as the DMP has been finalized. To proceed, please revert the finalization.", - "DMP-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP.", - "DMP-DESCRIPTION-TEMPLATE-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP's Description Template.", + "PLAN-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", + "PLAN-IS-NOT-FINALIZED": "The selected DMP is not finalized.", + "MULTIPLE-PLAN-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected DMP where found. Please contact your administrator.", + "PLAN-IS-FINALIZED": "The requested action cannot be completed as the DMP has been finalized. To proceed, please revert the finalization.", + "PLAN-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP.", + "PLAN-DESCRIPTION-TEMPLATE-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP's Description Template.", "INVALID-DESCRIPTION-TEMPLATE": "While tying to update your Description, a validation error occurred. The Description's associated DMP's Description Template is invalid.", "DESCRIPTION-IS-FINALIZED": "The requested action cannot be completed as the Description has been finalized. To proceed, please revert the finalization.", - "DMP-BLUEPRINT-HAS-NO-DESCRIPTION-TEMPLATES": "You need to select at least one Description Template. Click the 'Has Description Templates' button to proceed.", - "DMP-BLUEPRINT-NEW-VERSION-CONFLICT": "While trying to update your Blueprint, a version conflict occurred. Your Blueprint is not in the latest version.", - "DMP-DESCRIPTION-TEMPLATE-CAN-NOT-REMOVE": "The Description template cannot be removed as it is currently in use.", + "PLAN-BLUEPRINT-HAS-NO-DESCRIPTION-TEMPLATES": "You need to select at least one Description Template. Click the 'Has Description Templates' button to proceed.", + "PLAN-BLUEPRINT-NEW-VERSION-CONFLICT": "While trying to update your Blueprint, a version conflict occurred. Your Blueprint is not in the latest version.", + "PLAN-DESCRIPTION-TEMPLATE-CAN-NOT-REMOVE": "The Description template cannot be removed as it is currently in use.", "TENANT-TAMPERING": "This operation affects data from a Tenant different than your selected. Please reselect your Tenant.", "TENANT-CONFIGURATION-TYPE-CAN-NOT-CHANGE": "The configuration type for this Tenant cannot be changed.", "MULTIPLE-TENANT-CONFIGURATION-TYPE-NOT-ALLOWED": "Tenant Configuration already exists for this Tenant.", "TENANT-CODE-EXISTS": "The Tenant code you provided already exists. Please choose a different code.", - "DMP-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this plan.", - "IMPORT-DESCRIPTION-WITHOUT-DMP-DESCRIPTION-TEMPLATE": "Your plan contains descriptions that are not defined in which section they will exist", + "PLAN-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this plan.", + "IMPORT-DESCRIPTION-WITHOUT-PLAN-DESCRIPTION-TEMPLATE": "Your plan contains descriptions that are not defined in which section they will exist", "INVALID-API-KEY": "Invalid configurations detected. Please contact your administrator.", "STALE-API-KEY": "A problem occurred while trying to authorize you. Please try refreshing the page or logging in again. Contact the system administrator if the problem persists.", "SENSITIVE-INFO": "You've reached a section that contains sensitive information. To protect your privacy, please head back to the public area of the site or log in with your authorized account to access this information.", @@ -70,13 +70,13 @@ "OVERLAPPING-TENANT-CONFIGURATION-NOTIFIER-LIST": "An error occurred due to overlapping configurations. Please try again or contact your administrator.", "DESCRIPTION-TEMPLATE-INACTIVE-USER": "This description template contains users that are not exist", "DESCRIPTION-TEMPLATE-MISSING-USER-CONTACT-INFO": "This description template contains users that don't have contact info", - "DMP-INACTIVE-USER": "This plan contains users that are not exist", - "DMP-MISSING-USER-CONTACT-INFO": "This plan contains users that don't have contact info", + "PLAN-INACTIVE-USER": "This plan contains users that are not exist", + "PLAN-MISSING-USER-CONTACT-INFO": "This plan contains users that don't have contact info", "DESCRIPTION-TEMPLATE-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this description template.", - "DMP-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.", + "PLAN-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.", "REFERENCE-TYPE-CODE-EXISTS": "The reference type code you provided already exists. Please choose a different code.", "PREFILLING-SOURCE-CODE-EXISTS": "The prefilling source code you provided already exists. Please choose a different code.", - "DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once", + "DUPLICATE-PLAN-USER": "You can't invite authors with same role and plan section more than once", "INVITE-USER-ALREADY-CONFIRMED": "Ιnvitation has already confirmed", "REQUEST-HAS-EXPIRED": "Request has expired" }, @@ -112,9 +112,9 @@ "CLOSE": "Zamknij" } }, - "DMP-TO-DESCRIPTION-DIALOG": { + "PLAN-TO-DESCRIPTION-DIALOG": { "FROM-DMP": "Utworzyłeś swój", - "DMP": "DMP", + "PLAN": "PLAN", "TO-DESCRIPTION": "Zostaniesz przeniesiony do", "DATASET": "Zbioru danych", "EDITOR": "edytora", @@ -186,7 +186,7 @@ "CRITERIA": { "LIKE": "Search..." }, - "START-NEW-DMP-DIALOG": { + "START-NEW-PLAN-DIALOG": { "UPLOAD-FILE": "Prześlij plik", "REPLACE-FILE": "Przenieś plik" } @@ -231,8 +231,8 @@ "DESCRIPTION-TEMPLATE-TYPES": "Description Types", "DESCRIPTION-TEMPLATES": "Description Templates", "NEW-DESCRIPTION-TEMPLATE-TYPE": "New", - "DMP-BLUEPRINTS": "Plan Blueprints", - "NEW-DMP-BLUEPRINT": "New", + "PLAN-BLUEPRINTS": "Plan Blueprints", + "NEW-PLAN-BLUEPRINT": "New", "NEW-DESCRIPTION-TEMPLATES": "New", "REFERENCE-TYPES": "Reference Types", "NEW-REFERENCE-TYPE": "New", @@ -278,14 +278,14 @@ "MACHINE-ACTIONABLE": "for machine-actionable DMPs" }, "NAV-BAR": { - "START-NEW-DMP": "Uruchom nowy DMP", + "START-NEW-PLAN": "Uruchom nowy DMP", "INAPP-NOTIFICATIONS": "All Notifications", "READ-ALL-INAPP-NOTIFICATIONS": "Read All" }, "SIDE-BAR": { "GENERAL": "OGÓLNY", "DASHBOARD": "Strona główna", - "DMP": "PLANY ZARZĄDZANIA DANYMI", + "PLAN": "PLANY ZARZĄDZANIA DANYMI", "MY-DMPS": "Moje DMPs", "DESCRIPTIONS": "ZBIÓR DANYCH", "MY-DESCRIPTIONS": "My Descriptions", @@ -295,7 +295,7 @@ "ADMIN": "ADMINISTRATOR", "DESCRIPTION-TEMPLATES": "Description Templates", "DESCRIPTION-TEMPLATE-TYPES": "Description Types", - "DMP-BLUEPRINTS": "DMP Blueprints", + "PLAN-BLUEPRINTS": "DMP Blueprints", "USERS": "Użytkownicy", "TENANT-USERS":"Tenant Users", "CO-BRANDING": "Wspólne oznaczenie", @@ -355,7 +355,7 @@ "ACTIONS": { "SEND-USER-TOUCH": "Send user touch events", "SEND-TENANT-TOUCH": "Send tenant touch events", - "SEND-DMP-TOUCH": "Send dmp touch events", + "SEND-PLAN-TOUCH": "Send dmp touch events", "SEND-DESCRIPTION-TOUCH": "Send description touch events" } } @@ -650,8 +650,8 @@ "MESSAGE": "Somebody else is modifying the description template at this moment. You may view the description template but you cannot make any changes. If you would like to modify it please come back later." } }, - "DMP-LISTING": { - "DMP": "DMP", + "PLAN-LISTING": { + "PLAN": "PLAN", "GRANT": "Dotacja", "EDITED": "Edytowano", "PUBLISHED": "Opublikowane", @@ -696,7 +696,7 @@ "NAME": "Related Description Templates", "PLACEHOLDER": "Select Description Templates" }, - "ASSOCIATED-DMP-BLUEPRINTS": { + "ASSOCIATED-PLAN-BLUEPRINTS": { "NAME": "Related DMP Blueprints", "PLACEHOLDER": "Select DMP Blueprints" }, @@ -713,7 +713,7 @@ }, "EMPTY-LIST": "Nic tu jeszcze nie ma" }, - "DMP-UPLOAD": { + "PLAN-UPLOAD": { "TITLE": "Importuj plan zarządzania danymi", "UPLOAD-SUCCESS": "Import zakończył się pomyślnie", "ANALYZING-FILE": "Analyzing file", @@ -730,7 +730,7 @@ }, "PLACEHOLDER": "Tytuł DMP" }, - "DMP-DELETE-DIALOG": { + "PLAN-DELETE-DIALOG": { "WARNING": "Warning!", "DELETE-ITEM": "Are you sure to delete this plan? The following descriptions will also be removed:", "ACTIONS": { @@ -738,7 +738,7 @@ "CANCEL": "Cancel" } }, - "DMP-OVERVIEW": { + "PLAN-OVERVIEW": { "TITLE": "Plan", "PUBLIC": "Publiczny", "LOCKED": "Zablokowany", @@ -749,7 +749,7 @@ "DESCRIPTION": "Description", "DESCRIPTIONS": "Descriptions included", "DOI-PROVIDED": "DOI provided by", - "DMP-AUTHORS": "Autorzy DMP", + "PLAN-AUTHORS": "Autorzy DMP", "YOU": "ty", "ACTIONS": { "BACK": "Back", @@ -850,7 +850,7 @@ "GRANT": "Grant", "LOCKED": "Description is Locked by another user", "PART-OF": "Part of", - "DMP": "Plan", + "PLAN": "Plan", "EMPTY-LIST": "Jeszcze nic tu nie ma", "ACTIONS": { "ADD-REFERENCE-TYPE": "Add a Reference Type", @@ -889,7 +889,7 @@ "NAME": "Related Description Templates", "PLACEHOLDER": "Select Description Templates" }, - "ASSOCIATED-DMPS": { + "ASSOCIATED-PLANS": { "NAME": "Related DMPs", "PLACEHOLDER": "Select DMPs" }, @@ -922,7 +922,7 @@ "TITLE-PREVIEW-DESCRIPTION": "Previewing Description", "TO-DMP": "Previewing Description", "UNSAVED-CHANGES": "(unsaved changes)", - "DMP": "Plan", + "PLAN": "Plan", "TOC": { "TITLE": "Guide steps", "MAIN-INFO": "Main info", @@ -1000,8 +1000,8 @@ }, "DESCRIPTION-COPY-DIALOG": { "TITLE": "Copy Description to Plan", - "SELECT-DMP": "Select Plan", - "DMP-SECTION": "Select Section" + "SELECT-PLAN": "Select Plan", + "PLAN-SECTION": "Select Section" }, "PREFILL-DESCRIPTION-DIALOG": { "TITLE": "Initialize your Description", @@ -1566,7 +1566,7 @@ "REMOVE-FIELD": "Remove Field" } }, - "DMP-BLUEPRINT-EDITOR": { + "PLAN-BLUEPRINT-EDITOR": { "TITLE": { "NEW": "New DMP Blueprint", "CLONE": "Clone Plan Blueprint", @@ -1617,7 +1617,7 @@ "MESSAGE": "Somebody else is modifying the Plan Blueprint at this moment. You may view the Plan Blueprint but you cannot make any changes. If you would like to modify it please come back later." } }, - "DMP-EDITOR": { + "PLAN-EDITOR": { "TITLE-NEW": "New Plan", "TITLE-EDIT": "Editing Plan", "TITLE": "Plan Template", @@ -1645,7 +1645,7 @@ "USER-ROLE": "Role", "SECTIONS": "Plan Sections", "ALL-SECTIONS": "All", - "DMP-BLUEPRINT-VERSION": "Version" + "PLAN-BLUEPRINT-VERSION": "Version" }, "ACTIONS": { "DISCARD": { @@ -1688,7 +1688,7 @@ "SNACK-BAR": { "UNSUCCESSFUL-DOI": "Nie udało się utworzyć DOI", "SUCCESSFUL-DOI": "Utworzono DOI", - "SUCCESSFUL-DMP-CONTACT": "User added" + "SUCCESSFUL-PLAN-CONTACT": "User added" }, "DESCRIPTION-TEMPLATE-LIST": { "TITLE": "Available Description Templates", @@ -1721,7 +1721,7 @@ "TYPE-INFORMATION": " Information" } }, - "DMP-CLONE-DIALOG": { + "PLAN-CLONE-DIALOG": { "TITLE": "Clone", "FIELDS": { "LABEL": "Title of Plan", @@ -1738,7 +1738,7 @@ "TOGGLE-DESCRIPTIONS": "Check/Uncheck" } }, - "DMP-NEW-VERSION-DIALOG": { + "PLAN-NEW-VERSION-DIALOG": { "TITLE": "New Version", "FIELDS": { "LABEL": "Title of Plan", @@ -1757,7 +1757,7 @@ "TOGGLE-DESCRIPTIONS": "Check/Uncheck" } }, - "DMP-CONTACT-PREFILL-DIALOG": { + "PLAN-CONTACT-PREFILL-DIALOG": { "TITLE": "Add ", "TEXT": "Search an existing user where associated with your plans", "FIELDS": { @@ -1768,7 +1768,7 @@ "CONFIRM": "Confirm" } }, - "DMP-USER-INVITATION-DIALOG": { + "PLAN-USER-INVITATION-DIALOG": { "TITLE": "Invite authors", "ACTIONS": { "INVITE": "Invite" @@ -1776,8 +1776,8 @@ "SUCCESS": "Invitation Success", "ERROR": "Invitation Error" }, - "DMP-BLUEPRINT-LISTING": { - "CREATE-DMP-BLUEPRINT": "Create DMP Blueprint", + "PLAN-BLUEPRINT-LISTING": { + "CREATE-PLAN-BLUEPRINT": "Create DMP Blueprint", "FIELDS": { "NAME": "Name", "STATUS": "Status", @@ -1861,7 +1861,7 @@ "FINALIZED": "Finalized", "CANCELED": "Canceled" }, - "DMP-USER-ROLE": { + "PLAN-USER-ROLE": { "OWNER": "Owner", "VIEWER": "Viewer", "DESCRIPTION-CONTRIBUTOR": "Description Contributor", @@ -1870,11 +1870,11 @@ "EXTERNAL-DATASET-TYPE": { "SELECT": "Wybierz" }, - "DMP": { + "PLAN": { "FINALISED": "Sfinalizowane", "DRAFT": "Wersja robocza" }, - "DMP-VISIBILITY": { + "PLAN-VISIBILITY": { "PUBLIC": "Opublikowane" }, "DESCRIPTION-TEMPLATE-FIELD-VALIDATION-TYPE": { @@ -1885,8 +1885,8 @@ "SELECT": "Select", "BOOLEAN-DECISION": "Boolean Decision", "RADIO-BOX": "Radio Box", - "INTERNAL-DMP-ENTITIES-DMPS": "Internal Plans", - "INTERNAL-DMP-ENTITIES-DESCRIPTIONS": "Internal Descriptions", + "INTERNAL-PLAN-ENTITIES-DMPS": "Internal Plans", + "INTERNAL-PLAN-ENTITIES-DESCRIPTIONS": "Internal Descriptions", "CHECKBOX": "Checkbox", "FREE-TEXT": "Free Text", "TEXT-AREA": "Text Area", @@ -1930,11 +1930,11 @@ "FINALIZED": "Finalized", "DRAFT": "Draft" }, - "DMP-BLUEPRINT-STATUS": { + "PLAN-BLUEPRINT-STATUS": { "FINALIZED": "Finalized", "DRAFT": "Draft" }, - "DMP-BLUEPRINT-SYSTEM-FIELD-TYPE": { + "PLAN-BLUEPRINT-SYSTEM-FIELD-TYPE": { "TITLE": "Title", "DESCRIPTION": "Description", "LANGUAGE": "Language", @@ -1942,7 +1942,7 @@ "ACCESS_RIGHTS": "Access", "USER": "User" }, - "DMP-BLUEPRINT-EXTRA-FIELD-DATA-TYPE": { + "PLAN-BLUEPRINT-EXTRA-FIELD-DATA-TYPE": { "DATE": "Date", "NUMBER": "Number", "TEXT": "Text", @@ -1994,17 +1994,17 @@ "REPLACE": "Replace" }, "NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE": { - "DMP-INVITATION-EXTERNAL-USER": "Plan Invitation External User", - "DMP-INVITATION-EXISTING-USER": "Plan Invitation Existing User", - "DMP-MODIFIED": "Plan Modified", - "DMP-FINALISED": "Plan Finalised", + "PLAN-INVITATION-EXTERNAL-USER": "Plan Invitation External User", + "PLAN-INVITATION-EXISTING-USER": "Plan Invitation Existing User", + "PLAN-MODIFIED": "Plan Modified", + "PLAN-FINALISED": "Plan Finalised", "DESCRIPTION-CREATED": "Description Created", "DESCRIPTION-MODIFIED": "Description Modified", "DESCRIPTION-FINALISED": "Description Finalised", "DESCRIPTION-ANNOTATION-CREATED": "Description Annotation Created", "MERGE-ACCOUNT-CONFIRMATION": "Merge Account Confirmation", "REMOVE-CREDENTIAL-CONFIRMATION": "Remove Credential Confirmation", - "DMP-DEPOSIT": "Plan Deposit", + "PLAN-DEPOSIT": "Plan Deposit", "DESCRIPTION-TEMPLATE-INVITATION": "Description Template Invitation", "CONTACT-SUPPORT": "Contact Support", "PUBLIC-CONTACT-SUPPORT": "Public Contact Support", @@ -2036,7 +2036,7 @@ "ERROR": "Error", "OMITTED": "Omitted" }, - "DMP-ACCESS-TYPE": { + "PLAN-ACCESS-TYPE": { "PUBLIC": "Public", "RESTRICTED": "Restricted Access" }, @@ -2045,11 +2045,11 @@ "REUSED": "Reused dataset", "OTHER": "Other" }, - "DMP-USER-TYPE": { + "PLAN-USER-TYPE": { "INTERNAL": "Internal", "EXTERNAL": "External" }, - "DMP-BLUEPRINT-FIELD-CATEGORY": { + "PLAN-BLUEPRINT-FIELD-CATEGORY": { "SYSTEM": "System", "EXTRA": "Custom", "REFERENCE-TYPE": "External Reference" @@ -2060,9 +2060,9 @@ "TAGS": "Tags" }, "LOCK-TARGET-TYPE": { - "DMP": "Plan", + "PLAN": "Plan", "DESCRIPTION": "Description", - "DMP-BLUEPRINT": "Plan Blueprint", + "PLAN-BLUEPRINT": "Plan Blueprint", "DESCRIPTION-TEMPLATE": "Description Template" } }, @@ -2115,14 +2115,14 @@ "DASHBOARD": { "GRANTS": "Dotacje", "TITLE": "Co to jest {{ APP_NAME_CAPS }}?", - "DMP-QUESTION": "Co to jest DMP w {{ APP_NAME_CAPS }}?", + "PLAN-QUESTION": "Co to jest DMP w {{ APP_NAME_CAPS }}?", "INFO-TEXT": "{{ APP_NAME_CAPS }} to otwarta, rozszerzalna usługa, która ułatwia zarządzanie, walidację, monitorowanie i konserwację oraz plany zarządzania danymi. Umożliwia podmiotom (naukowcom, menedżerom, nadzorcom itp.) tworzenie praktycznych DMP, które mogą być swobodnie wymieniane między infrastrukturami do realizacji określonych aspektów procesu zarządzania danymi zgodnie z intencjami i zaangażowaniem właścicieli danych.", - "INFO-DMP-TEXT": "Plan zarządzania danymi (DMP) to żywy dokument opisujący zbiory danych, które są generowane i/lub ponownie wykorzystywane w trakcie badań i po ich zakończeniu. DMP mają na celu dostarczenie naukowcom niezbędnych informacji do ponownego tworzenia, redystrybucji i zmiany przeznaczenia wyników badań, zapewniając w ten sposób ich ważność i wykorzystanie.", + "INFO-PLAN-TEXT": "Plan zarządzania danymi (DMP) to żywy dokument opisujący zbiory danych, które są generowane i/lub ponownie wykorzystywane w trakcie badań i po ich zakończeniu. DMP mają na celu dostarczenie naukowcom niezbędnych informacji do ponownego tworzenia, redystrybucji i zmiany przeznaczenia wyników badań, zapewniając w ten sposób ich ważność i wykorzystanie.", "NEW-QUESTION": "Nowy w DMP? Odwiedź", "START-YOUR-FIRST-DMP": "Uruchom swój pierwszy DMP", "OPEN-AIR-GUIDE": "Przewodnik dla badaczy OpenAIRE", "LEARN-MORE": "aby dowiedzieć się więcej o tym, jak je stworzyć!", - "DMPS": "DMP", + "PLANS": "PLAN", "PERSONAL-USAGE": "Użytek osobisty", "PUBLIC-USAGE": "Użytek publiczny", "DESCRIPTIONS": "Descriptions", @@ -2134,14 +2134,14 @@ "ALL": "Wszystko", "EMPTY-LIST": "Puste pole", "LATEST-ACTIVITY": "Ostatnia aktywność", - "DMP-ABOUT-BEG": "DMP w {{ APP_NAME }} składa się z kluczowych informacji dotyczących badań, takich jak cel, zamierzenia i zaangażowani naukowcy, ale także z dokumentacji zbiorów danych badawczych, a mianowicie", - "DMP-ABOUT-END": ", które podkreślają podjęte kroki i środki stosowane w ramach działań związanych z zarządzaniem danymi.", - "SELECT-DMP": "Wybierz DMP dla swojego zbioru danych", + "PLAN-ABOUT-BEG": "DMP w {{ APP_NAME }} składa się z kluczowych informacji dotyczących badań, takich jak cel, zamierzenia i zaangażowani naukowcy, ale także z dokumentacji zbiorów danych badawczych, a mianowicie", + "PLAN-ABOUT-END": ", które podkreślają podjęte kroki i środki stosowane w ramach działań związanych z zarządzaniem danymi.", + "SELECT-PLAN": "Wybierz DMP dla swojego zbioru danych", "ACTIONS": { "ADD-DESCRIPTION": "Add Description" }, "TOUR-GUIDE": { - "DMP": "To jest twój pulpit nawigacyjny. Możesz przeglądać i edytować wszystkie utworzone lub współtworzone przez ciebie DMP.", + "PLAN": "To jest twój pulpit nawigacyjny. Możesz przeglądać i edytować wszystkie utworzone lub współtworzone przez ciebie DMP.", "START-NEW": "Utwórz swój DMP za pomocą funkcji Uruchom nowy DMP.", "IMPORT-DMP": "Możesz zaimportować DMP", "START-WIZARD": "lub utwórz nowy w {{ APP_NAME }}.", @@ -2152,7 +2152,7 @@ }, "ADD-NEW-DESCRIPTION": { "OPTIONS-NOT-ENOUGH": "Czy te opcje nie wystarczą?", - "START-NEW-DMP": "Rozpocznij nowy DMP", + "START-NEW-PLAN": "Rozpocznij nowy DMP", "OPTIONS": { "CREATED-AT": "Created At:" } @@ -2207,7 +2207,7 @@ "EMAILS": "E-maile", "YOUR-EMAIL": "Twój e-mail" }, - "ASSOCIATED-DMPS": "Powiązane DMP", + "ASSOCIATED-PLANS": "Powiązane DMP", "ROLE-ORGANIZATION": { "FACULTY": "Wydział", "LIBRARIAN": "Bibliotekarz", @@ -2234,9 +2234,9 @@ "CANCEL": "Anuluj" } }, - "DMP-FINALISE-DIALOG": { + "PLAN-FINALISE-DIALOG": { "TITLE": "Finalize this item?", - "DMP": "DMP", + "PLAN": "PLAN", "DESCRPIPTIONS": "Descriptions", "EMPTY": "Brak zbiorów danych dla tego DMP", "FINALISE-TITLE": "Czy chcesz sfinalizować którykolwiek z następujących roboczych zestawów danych?", @@ -2245,8 +2245,8 @@ "INVALID-DMP": "This Plan can not be finalized " }, "IMPACT": "Ta akcja/to działanie/ta funkcja? sfinalizuje twój DMP i nie będziesz mógł go ponownie edytować.", - "PUBLIC-DMP-MESSAGE": "After finalizing your Plan, it'll be published and be publicly available to the {{ APP_NAME_CAPS }} tool.", - "RESTRICTED-DMP-MESSAGE": "Your Plan can be published and be publicly available to the {{ APP_NAME_CAPS }} tool after finalization when its access rights are opened. Current access rights: restricted", + "PUBLIC-PLAN-MESSAGE": "After finalizing your Plan, it'll be published and be publicly available to the {{ APP_NAME_CAPS }} tool.", + "RESTRICTED-PLAN-MESSAGE": "Your Plan can be published and be publicly available to the {{ APP_NAME_CAPS }} tool after finalization when its access rights are opened. Current access rights: restricted", "INVALID": "Nieprawidłowy", "ACTIONS": { "SUBMIT": "Submit", @@ -2254,7 +2254,7 @@ } }, "START-NEW-DESCRIPTION-DIALOG": { - "SELECT-DMP": "Select Plan", + "SELECT-PLAN": "Select Plan", "ACTIONS": { "NEXT": "Next", "CANCEL": "Cancel" diff --git a/dmp-frontend/src/assets/i18n/pt.json b/dmp-frontend/src/assets/i18n/pt.json index ada0c5935..794deca24 100644 --- a/dmp-frontend/src/assets/i18n/pt.json +++ b/dmp-frontend/src/assets/i18n/pt.json @@ -42,23 +42,23 @@ "DESCRIPTION-TEMPLATE-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", "DESCRIPTION-TEMPLATE-IS-NOT-FINALIZED": "The selected Description Template is not finalized.", "MULTIPLE-DESCRIPTION-TEMPLATE-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected Description Template where found. Please contact your administrator.", - "DMP-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", - "DMP-IS-NOT-FINALIZED": "The selected DMP is not finalized.", - "MULTIPLE-DMP-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected DMP where found. Please contact your administrator.", - "DMP-IS-FINALIZED": "The requested action cannot be completed as the DMP has been finalized. To proceed, please revert the finalization.", - "DMP-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP.", - "DMP-DESCRIPTION-TEMPLATE-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP's Description Template.", + "PLAN-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", + "PLAN-IS-NOT-FINALIZED": "The selected DMP is not finalized.", + "MULTIPLE-PLAN-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected DMP where found. Please contact your administrator.", + "PLAN-IS-FINALIZED": "The requested action cannot be completed as the DMP has been finalized. To proceed, please revert the finalization.", + "PLAN-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP.", + "PLAN-DESCRIPTION-TEMPLATE-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP's Description Template.", "INVALID-DESCRIPTION-TEMPLATE": "While tying to update your Description, a validation error occurred. The Description's associated DMP's Description Template is invalid.", "DESCRIPTION-IS-FINALIZED": "The requested action cannot be completed as the Description has been finalized. To proceed, please revert the finalization.", - "DMP-BLUEPRINT-HAS-NO-DESCRIPTION-TEMPLATES": "You need to select at least one Description Template. Click the 'Has Description Templates' button to proceed.", - "DMP-BLUEPRINT-NEW-VERSION-CONFLICT": "While trying to update your Blueprint, a version conflict occurred. Your Blueprint is not in the latest version.", - "DMP-DESCRIPTION-TEMPLATE-CAN-NOT-REMOVE": "The Description template cannot be removed as it is currently in use.", + "PLAN-BLUEPRINT-HAS-NO-DESCRIPTION-TEMPLATES": "You need to select at least one Description Template. Click the 'Has Description Templates' button to proceed.", + "PLAN-BLUEPRINT-NEW-VERSION-CONFLICT": "While trying to update your Blueprint, a version conflict occurred. Your Blueprint is not in the latest version.", + "PLAN-DESCRIPTION-TEMPLATE-CAN-NOT-REMOVE": "The Description template cannot be removed as it is currently in use.", "TENANT-TAMPERING": "This operation affects data from a Tenant different than your selected. Please reselect your Tenant.", "TENANT-CONFIGURATION-TYPE-CAN-NOT-CHANGE": "The configuration type for this Tenant cannot be changed.", "MULTIPLE-TENANT-CONFIGURATION-TYPE-NOT-ALLOWED": "Tenant Configuration already exists for this Tenant.", "TENANT-CODE-EXISTS": "The Tenant code you provided already exists. Please choose a different code.", - "DMP-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this plan.", - "IMPORT-DESCRIPTION-WITHOUT-DMP-DESCRIPTION-TEMPLATE": "Your plan contains descriptions that are not defined in which section they will exist", + "PLAN-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this plan.", + "IMPORT-DESCRIPTION-WITHOUT-PLAN-DESCRIPTION-TEMPLATE": "Your plan contains descriptions that are not defined in which section they will exist", "INVALID-API-KEY": "Invalid configurations detected. Please contact your administrator.", "STALE-API-KEY": "A problem occurred while trying to authorize you. Please try refreshing the page or logging in again. Contact the system administrator if the problem persists.", "SENSITIVE-INFO": "You've reached a section that contains sensitive information. To protect your privacy, please head back to the public area of the site or log in with your authorized account to access this information.", @@ -70,13 +70,13 @@ "OVERLAPPING-TENANT-CONFIGURATION-NOTIFIER-LIST": "An error occurred due to overlapping configurations. Please try again or contact your administrator.", "DESCRIPTION-TEMPLATE-INACTIVE-USER": "This description template contains users that are not exist", "DESCRIPTION-TEMPLATE-MISSING-USER-CONTACT-INFO": "This description template contains users that don't have contact info", - "DMP-INACTIVE-USER": "This plan contains users that are not exist", - "DMP-MISSING-USER-CONTACT-INFO": "This plan contains users that don't have contact info", + "PLAN-INACTIVE-USER": "This plan contains users that are not exist", + "PLAN-MISSING-USER-CONTACT-INFO": "This plan contains users that don't have contact info", "DESCRIPTION-TEMPLATE-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this description template.", - "DMP-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.", + "PLAN-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.", "REFERENCE-TYPE-CODE-EXISTS": "The reference type code you provided already exists. Please choose a different code.", "PREFILLING-SOURCE-CODE-EXISTS": "The prefilling source code you provided already exists. Please choose a different code.", - "DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once", + "DUPLICATE-PLAN-USER": "You can't invite authors with same role and plan section more than once", "INVITE-USER-ALREADY-CONFIRMED": "Ιnvitation has already confirmed", "REQUEST-HAS-EXPIRED": "Request has expired" }, @@ -112,9 +112,9 @@ "CLOSE": "Fechar" } }, - "DMP-TO-DESCRIPTION-DIALOG": { + "PLAN-TO-DESCRIPTION-DIALOG": { "FROM-DMP": "Criou com sucesso o seu", - "DMP": "PGD", + "PLAN": "PGD", "TO-DESCRIPTION": "Será transferido para o editor de", "DATASET": "Datasets", "EDITOR": "onde poderá criar ou rever o seu modelo", @@ -186,7 +186,7 @@ "CRITERIA": { "LIKE": "Search..." }, - "START-NEW-DMP-DIALOG": { + "START-NEW-PLAN-DIALOG": { "UPLOAD-FILE": "Carregar ficheiro", "REPLACE-FILE": "Substituir ficheiro" } @@ -231,8 +231,8 @@ "DESCRIPTION-TEMPLATE-TYPES": "Description Types", "DESCRIPTION-TEMPLATES": "Description Templates", "NEW-DESCRIPTION-TEMPLATE-TYPE": "New", - "DMP-BLUEPRINTS": "Plan Blueprints", - "NEW-DMP-BLUEPRINT": "New", + "PLAN-BLUEPRINTS": "Plan Blueprints", + "NEW-PLAN-BLUEPRINT": "New", "NEW-DESCRIPTION-TEMPLATES": "New", "REFERENCE-TYPES": "Reference Types", "NEW-REFERENCE-TYPE": "New", @@ -278,14 +278,14 @@ "MACHINE-ACTIONABLE": "for machine-actionable DMPs" }, "NAV-BAR": { - "START-NEW-DMP": "Criar novo PGD", + "START-NEW-PLAN": "Criar novo PGD", "INAPP-NOTIFICATIONS": "All Notifications", "READ-ALL-INAPP-NOTIFICATIONS": "Read All" }, "SIDE-BAR": { "GENERAL": "GERAL", "DASHBOARD": "Início", - "DMP": "PLANOS DE GESTÃO DE DADOS", + "PLAN": "PLANOS DE GESTÃO DE DADOS", "MY-DMPS": "Os meus PGDs", "DESCRIPTIONS": "Datasets", "MY-DESCRIPTIONS": "My Descriptions", @@ -295,7 +295,7 @@ "ADMIN": "Administrador", "DESCRIPTION-TEMPLATES": "Description Templates", "DESCRIPTION-TEMPLATE-TYPES": "Description Types", - "DMP-BLUEPRINTS": "DMP Blueprints", + "PLAN-BLUEPRINTS": "DMP Blueprints", "USERS": "Utilizadores", "TENANT-USERS":"Tenant Users", "CO-BRANDING": "Co-Branding", @@ -355,7 +355,7 @@ "ACTIONS": { "SEND-USER-TOUCH": "Send user touch events", "SEND-TENANT-TOUCH": "Send tenant touch events", - "SEND-DMP-TOUCH": "Send dmp touch events", + "SEND-PLAN-TOUCH": "Send dmp touch events", "SEND-DESCRIPTION-TOUCH": "Send description touch events" } } @@ -650,8 +650,8 @@ "MESSAGE": "Somebody else is modifying the description template at this moment. You may view the description template but you cannot make any changes. If you would like to modify it please come back later." } }, - "DMP-LISTING": { - "DMP": "PGD", + "PLAN-LISTING": { + "PLAN": "PGD", "GRANT": "Grant", "EDITED": "Editado", "PUBLISHED": "Publicado", @@ -696,7 +696,7 @@ "NAME": "Related Description Templates", "PLACEHOLDER": "Select Description Templates" }, - "ASSOCIATED-DMP-BLUEPRINTS": { + "ASSOCIATED-PLAN-BLUEPRINTS": { "NAME": "Related DMP Blueprints", "PLACEHOLDER": "Select DMP Blueprints" }, @@ -713,7 +713,7 @@ }, "EMPTY-LIST": "Sem informação" }, - "DMP-UPLOAD": { + "PLAN-UPLOAD": { "TITLE": "Importar o Plano de Gestão de Dados", "UPLOAD-SUCCESS": "Importado com Sucesso", "ANALYZING-FILE": "Analyzing file", @@ -730,7 +730,7 @@ }, "PLACEHOLDER": "Título do PGD" }, - "DMP-DELETE-DIALOG": { + "PLAN-DELETE-DIALOG": { "WARNING": "Warning!", "DELETE-ITEM": "Are you sure to delete this plan? The following descriptions will also be removed:", "ACTIONS": { @@ -738,7 +738,7 @@ "CANCEL": "Cancel" } }, - "DMP-OVERVIEW": { + "PLAN-OVERVIEW": { "TITLE": "Plan", "PUBLIC": "Público", "LOCKED": "Bloqueado", @@ -749,7 +749,7 @@ "DESCRIPTION": "Description", "DESCRIPTIONS": "Descriptions included", "DOI-PROVIDED": "DOI provided by", - "DMP-AUTHORS": "Autores do PGD", + "PLAN-AUTHORS": "Autores do PGD", "YOU": "Você", "ACTIONS": { "BACK": "Back", @@ -850,7 +850,7 @@ "GRANT": "Grant", "LOCKED": "Description is Locked by another user", "PART-OF": "Part of", - "DMP": "Plan", + "PLAN": "Plan", "EMPTY-LIST": "Sem informação", "ACTIONS": { "ADD-REFERENCE-TYPE": "Add a Reference Type", @@ -889,7 +889,7 @@ "NAME": "Related Description Templates", "PLACEHOLDER": "Select Description Templates" }, - "ASSOCIATED-DMPS": { + "ASSOCIATED-PLANS": { "NAME": "Related DMPs", "PLACEHOLDER": "Select DMPs" }, @@ -922,7 +922,7 @@ "TITLE-PREVIEW-DESCRIPTION": "Previewing Description", "TO-DMP": "Previewing Description", "UNSAVED-CHANGES": "(unsaved changes)", - "DMP": "Plan", + "PLAN": "Plan", "TOC": { "TITLE": "Guide steps", "MAIN-INFO": "Main info", @@ -1000,8 +1000,8 @@ }, "DESCRIPTION-COPY-DIALOG": { "TITLE": "Copy Description to Plan", - "SELECT-DMP": "Select Plan", - "DMP-SECTION": "Select Section" + "SELECT-PLAN": "Select Plan", + "PLAN-SECTION": "Select Section" }, "PREFILL-DESCRIPTION-DIALOG": { "TITLE": "Initialize your Description", @@ -1566,7 +1566,7 @@ "REMOVE-FIELD": "Remove Field" } }, - "DMP-BLUEPRINT-EDITOR": { + "PLAN-BLUEPRINT-EDITOR": { "TITLE": { "NEW": "New DMP Blueprint", "CLONE": "Clone Plan Blueprint", @@ -1617,7 +1617,7 @@ "MESSAGE": "Somebody else is modifying the Plan Blueprint at this moment. You may view the Plan Blueprint but you cannot make any changes. If you would like to modify it please come back later." } }, - "DMP-EDITOR": { + "PLAN-EDITOR": { "TITLE-NEW": "New Plan", "TITLE-EDIT": "Editing Plan", "TITLE": "Plan Template", @@ -1645,7 +1645,7 @@ "USER-ROLE": "Role", "SECTIONS": "Plan Sections", "ALL-SECTIONS": "All", - "DMP-BLUEPRINT-VERSION": "Version" + "PLAN-BLUEPRINT-VERSION": "Version" }, "ACTIONS": { "DISCARD": { @@ -1688,7 +1688,7 @@ "SNACK-BAR": { "UNSUCCESSFUL-DOI": "Criação de DOI sem sucesso", "SUCCESSFUL-DOI": "Criação de DOI com sucesso", - "SUCCESSFUL-DMP-CONTACT": "User added" + "SUCCESSFUL-PLAN-CONTACT": "User added" }, "DESCRIPTION-TEMPLATE-LIST": { "TITLE": "Available Description Templates", @@ -1721,7 +1721,7 @@ "TYPE-INFORMATION": " Information" } }, - "DMP-CLONE-DIALOG": { + "PLAN-CLONE-DIALOG": { "TITLE": "Clone", "FIELDS": { "LABEL": "Title of Plan", @@ -1738,7 +1738,7 @@ "TOGGLE-DESCRIPTIONS": "Check/Uncheck" } }, - "DMP-NEW-VERSION-DIALOG": { + "PLAN-NEW-VERSION-DIALOG": { "TITLE": "New Version", "FIELDS": { "LABEL": "Title of Plan", @@ -1757,7 +1757,7 @@ "TOGGLE-DESCRIPTIONS": "Check/Uncheck" } }, - "DMP-CONTACT-PREFILL-DIALOG": { + "PLAN-CONTACT-PREFILL-DIALOG": { "TITLE": "Add ", "TEXT": "Search an existing user where associated with your plans", "FIELDS": { @@ -1768,7 +1768,7 @@ "CONFIRM": "Confirm" } }, - "DMP-USER-INVITATION-DIALOG": { + "PLAN-USER-INVITATION-DIALOG": { "TITLE": "Invite authors", "ACTIONS": { "INVITE": "Invite" @@ -1776,8 +1776,8 @@ "SUCCESS": "Invitation Success", "ERROR": "Invitation Error" }, - "DMP-BLUEPRINT-LISTING": { - "CREATE-DMP-BLUEPRINT": "Create DMP Blueprint", + "PLAN-BLUEPRINT-LISTING": { + "CREATE-PLAN-BLUEPRINT": "Create DMP Blueprint", "FIELDS": { "NAME": "Name", "STATUS": "Status", @@ -1861,7 +1861,7 @@ "FINALIZED": "Finalized", "CANCELED": "Canceled" }, - "DMP-USER-ROLE": { + "PLAN-USER-ROLE": { "OWNER": "Owner", "VIEWER": "Viewer", "DESCRIPTION-CONTRIBUTOR": "Description Contributor", @@ -1870,11 +1870,11 @@ "EXTERNAL-DATASET-TYPE": { "SELECT": "Selecionar" }, - "DMP": { + "PLAN": { "FINALISED": "Concluído", "DRAFT": "Rascunho" }, - "DMP-VISIBILITY": { + "PLAN-VISIBILITY": { "PUBLIC": "Publicado" }, "DESCRIPTION-TEMPLATE-FIELD-VALIDATION-TYPE": { @@ -1885,8 +1885,8 @@ "SELECT": "Select", "BOOLEAN-DECISION": "Boolean Decision", "RADIO-BOX": "Radio Box", - "INTERNAL-DMP-ENTITIES-DMPS": "Internal Plans", - "INTERNAL-DMP-ENTITIES-DESCRIPTIONS": "Internal Descriptions", + "INTERNAL-PLAN-ENTITIES-DMPS": "Internal Plans", + "INTERNAL-PLAN-ENTITIES-DESCRIPTIONS": "Internal Descriptions", "CHECKBOX": "Checkbox", "FREE-TEXT": "Free Text", "TEXT-AREA": "Text Area", @@ -1930,11 +1930,11 @@ "FINALIZED": "Finalized", "DRAFT": "Draft" }, - "DMP-BLUEPRINT-STATUS": { + "PLAN-BLUEPRINT-STATUS": { "FINALIZED": "Finalized", "DRAFT": "Draft" }, - "DMP-BLUEPRINT-SYSTEM-FIELD-TYPE": { + "PLAN-BLUEPRINT-SYSTEM-FIELD-TYPE": { "TITLE": "Title", "DESCRIPTION": "Description", "LANGUAGE": "Language", @@ -1942,7 +1942,7 @@ "ACCESS_RIGHTS": "Access", "USER": "User" }, - "DMP-BLUEPRINT-EXTRA-FIELD-DATA-TYPE": { + "PLAN-BLUEPRINT-EXTRA-FIELD-DATA-TYPE": { "DATE": "Date", "NUMBER": "Number", "TEXT": "Text", @@ -1994,17 +1994,17 @@ "REPLACE": "Replace" }, "NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE": { - "DMP-INVITATION-EXTERNAL-USER": "Plan Invitation External User", - "DMP-INVITATION-EXISTING-USER": "Plan Invitation Existing User", - "DMP-MODIFIED": "Plan Modified", - "DMP-FINALISED": "Plan Finalised", + "PLAN-INVITATION-EXTERNAL-USER": "Plan Invitation External User", + "PLAN-INVITATION-EXISTING-USER": "Plan Invitation Existing User", + "PLAN-MODIFIED": "Plan Modified", + "PLAN-FINALISED": "Plan Finalised", "DESCRIPTION-CREATED": "Description Created", "DESCRIPTION-MODIFIED": "Description Modified", "DESCRIPTION-FINALISED": "Description Finalised", "DESCRIPTION-ANNOTATION-CREATED": "Description Annotation Created", "MERGE-ACCOUNT-CONFIRMATION": "Merge Account Confirmation", "REMOVE-CREDENTIAL-CONFIRMATION": "Remove Credential Confirmation", - "DMP-DEPOSIT": "Plan Deposit", + "PLAN-DEPOSIT": "Plan Deposit", "DESCRIPTION-TEMPLATE-INVITATION": "Description Template Invitation", "CONTACT-SUPPORT": "Contact Support", "PUBLIC-CONTACT-SUPPORT": "Public Contact Support", @@ -2036,7 +2036,7 @@ "ERROR": "Error", "OMITTED": "Omitted" }, - "DMP-ACCESS-TYPE": { + "PLAN-ACCESS-TYPE": { "PUBLIC": "Public", "RESTRICTED": "Restricted Access" }, @@ -2045,11 +2045,11 @@ "REUSED": "Reused dataset", "OTHER": "Other" }, - "DMP-USER-TYPE": { + "PLAN-USER-TYPE": { "INTERNAL": "Internal", "EXTERNAL": "External" }, - "DMP-BLUEPRINT-FIELD-CATEGORY": { + "PLAN-BLUEPRINT-FIELD-CATEGORY": { "SYSTEM": "System", "EXTRA": "Custom", "REFERENCE-TYPE": "External Reference" @@ -2060,9 +2060,9 @@ "TAGS": "Tags" }, "LOCK-TARGET-TYPE": { - "DMP": "Plan", + "PLAN": "Plan", "DESCRIPTION": "Description", - "DMP-BLUEPRINT": "Plan Blueprint", + "PLAN-BLUEPRINT": "Plan Blueprint", "DESCRIPTION-TEMPLATE": "Description Template" } }, @@ -2115,14 +2115,14 @@ "DASHBOARD": { "GRANTS": "Grants", "TITLE": "O que é o {{ APP_NAME_CAPS }}?", - "DMP-QUESTION": "O que é um Plano de Gestão de Dados no {{ APP_NAME_CAPS }}?", + "PLAN-QUESTION": "O que é um Plano de Gestão de Dados no {{ APP_NAME_CAPS }}?", "INFO-TEXT": "O {{ APP_NAME_CAPS }} é um serviço aberto e extensível que simplifica a gestão, validação, monitorização e manutenção de Planos de Gestão de Dados (PGDs). Permite aos intervenientes (investigadores, gestores, coordenadores, investigadores principais, entre outros) criar PGDs acionáveis por máquina, que podem ser livremente trocados entre infraestruturas para a execução de aspetos específicos no processo de gestão de dados, de acordo com as intenções e o compromisso dos proprietários dos dados.", - "INFO-DMP-TEXT": "Um Plano de Gestão de Dados (PGD) é um documento dinâmico que descreve os conjuntos de dados que são gerados e/ou reutilizados durante e após a vida útil de uma investigação. Os PGD visam fornecer aos investigadores informações essenciais para a reprodução, redistribuição e redefinição dos resultados da investigação, assegurando assim a sua validade e qualidade.", + "INFO-PLAN-TEXT": "Um Plano de Gestão de Dados (PGD) é um documento dinâmico que descreve os conjuntos de dados que são gerados e/ou reutilizados durante e após a vida útil de uma investigação. Os PGD visam fornecer aos investigadores informações essenciais para a reprodução, redistribuição e redefinição dos resultados da investigação, assegurando assim a sua validade e qualidade.", "NEW-QUESTION": "Novo nos Planos de Gestão de Dados? Visite", "START-YOUR-FIRST-DMP": "Começar o seu primeiro PGD", "OPEN-AIR-GUIDE": "Guia OpenAIRE para Investigadores", "LEARN-MORE": "para saber mais sobre como criar um Plano de Gestão de Dados!", - "DMPS": "PGDs", + "PLANS": "PGDs", "PERSONAL-USAGE": "Uso Pessoal", "PUBLIC-USAGE": "Uso Público", "DESCRIPTIONS": "Descriptions", @@ -2134,14 +2134,14 @@ "ALL": "TODOS", "EMPTY-LIST": "Sem Informação", "LATEST-ACTIVITY": "Última Atividade", - "DMP-ABOUT-BEG": "A criação de um Plano de Gestão de Dados (PGD) no {{ APP_NAME }} consiste em fornecer informação-chave sobre a investigação, tal como, a sua finalidade, os seus objetivos e quais os investigadores envolvidos, como também sobre a documentação relativa aos dados de investigação que permite evidenciar os passos dados e os meios utilizados para uma gestão mais eficaz dos dados a produzir ou que já tenham sido produzidos.", - "DMP-ABOUT-END": "", - "SELECT-DMP": "Selecione um PGD para o seu Dataset", + "PLAN-ABOUT-BEG": "A criação de um Plano de Gestão de Dados (PGD) no {{ APP_NAME }} consiste em fornecer informação-chave sobre a investigação, tal como, a sua finalidade, os seus objetivos e quais os investigadores envolvidos, como também sobre a documentação relativa aos dados de investigação que permite evidenciar os passos dados e os meios utilizados para uma gestão mais eficaz dos dados a produzir ou que já tenham sido produzidos.", + "PLAN-ABOUT-END": "", + "SELECT-PLAN": "Selecione um PGD para o seu Dataset", "ACTIONS": { "ADD-DESCRIPTION": "Add Description" }, "TOUR-GUIDE": { - "DMP": "Aqui pode visualizar e editar todos os PGDs para os quais tenha contribuído ou criado.", + "PLAN": "Aqui pode visualizar e editar todos os PGDs para os quais tenha contribuído ou criado.", "START-NEW": "Crie o seu PGD através do botão “Criar novo PGD”.", "IMPORT-DMP": "Aqui pode importar um PGD pré-existente...", "START-WIZARD": "... ou criar um novo no {{ APP_NAME }}!", @@ -2152,7 +2152,7 @@ }, "ADD-NEW-DESCRIPTION": { "OPTIONS-NOT-ENOUGH": "Não pretende selecionar nenhuma destas opções?", - "START-NEW-DMP": "Criar novo PGD", + "START-NEW-PLAN": "Criar novo PGD", "OPTIONS": { "CREATED-AT": "Created At:" } @@ -2207,7 +2207,7 @@ "EMAILS": "Emails", "YOUR-EMAIL": "O seu email" }, - "ASSOCIATED-DMPS": "PGDs associados", + "ASSOCIATED-PLANS": "PGDs associados", "ROLE-ORGANIZATION": { "FACULTY": "Docente", "LIBRARIAN": "Bibliotecário(a)", @@ -2234,9 +2234,9 @@ "CANCEL": "Cancelar" } }, - "DMP-FINALISE-DIALOG": { + "PLAN-FINALISE-DIALOG": { "TITLE": "Finalize this item?", - "DMP": "PGD", + "PLAN": "PGD", "DESCRPIPTIONS": "Descriptions", "EMPTY": "Até ao momento não existem Datasets neste PGD", "FINALISE-TITLE": "Pretende finalizar algum destes Datasets em rascunho?", @@ -2245,8 +2245,8 @@ "INVALID-DMP": "This Plan can not be finalized " }, "IMPACT": "Esta ação finalizará o seu PGD, não sendo possível a sua edição.", - "PUBLIC-DMP-MESSAGE": "After finalizing your Plan, it'll be published and be publicly available to the {{ APP_NAME_CAPS }} tool.", - "RESTRICTED-DMP-MESSAGE": "Your Plan can be published and be publicly available to the {{ APP_NAME_CAPS }} tool after finalization when its access rights are opened. Current access rights: restricted", + "PUBLIC-PLAN-MESSAGE": "After finalizing your Plan, it'll be published and be publicly available to the {{ APP_NAME_CAPS }} tool.", + "RESTRICTED-PLAN-MESSAGE": "Your Plan can be published and be publicly available to the {{ APP_NAME_CAPS }} tool after finalization when its access rights are opened. Current access rights: restricted", "INVALID": "Inválido", "ACTIONS": { "SUBMIT": "Submit", @@ -2254,7 +2254,7 @@ } }, "START-NEW-DESCRIPTION-DIALOG": { - "SELECT-DMP": "Select Plan", + "SELECT-PLAN": "Select Plan", "ACTIONS": { "NEXT": "Next", "CANCEL": "Cancel" diff --git a/dmp-frontend/src/assets/i18n/sk.json b/dmp-frontend/src/assets/i18n/sk.json index 894082d3a..f68a45608 100644 --- a/dmp-frontend/src/assets/i18n/sk.json +++ b/dmp-frontend/src/assets/i18n/sk.json @@ -42,23 +42,23 @@ "DESCRIPTION-TEMPLATE-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", "DESCRIPTION-TEMPLATE-IS-NOT-FINALIZED": "The selected Description Template is not finalized.", "MULTIPLE-DESCRIPTION-TEMPLATE-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected Description Template where found. Please contact your administrator.", - "DMP-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", - "DMP-IS-NOT-FINALIZED": "The selected DMP is not finalized.", - "MULTIPLE-DMP-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected DMP where found. Please contact your administrator.", - "DMP-IS-FINALIZED": "The requested action cannot be completed as the DMP has been finalized. To proceed, please revert the finalization.", - "DMP-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP.", - "DMP-DESCRIPTION-TEMPLATE-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP's Description Template.", + "PLAN-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", + "PLAN-IS-NOT-FINALIZED": "The selected DMP is not finalized.", + "MULTIPLE-PLAN-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected DMP where found. Please contact your administrator.", + "PLAN-IS-FINALIZED": "The requested action cannot be completed as the DMP has been finalized. To proceed, please revert the finalization.", + "PLAN-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP.", + "PLAN-DESCRIPTION-TEMPLATE-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP's Description Template.", "INVALID-DESCRIPTION-TEMPLATE": "While tying to update your Description, a validation error occurred. The Description's associated DMP's Description Template is invalid.", "DESCRIPTION-IS-FINALIZED": "The requested action cannot be completed as the Description has been finalized. To proceed, please revert the finalization.", - "DMP-BLUEPRINT-HAS-NO-DESCRIPTION-TEMPLATES": "You need to select at least one Description Template. Click the 'Has Description Templates' button to proceed.", - "DMP-BLUEPRINT-NEW-VERSION-CONFLICT": "While trying to update your Blueprint, a version conflict occurred. Your Blueprint is not in the latest version.", - "DMP-DESCRIPTION-TEMPLATE-CAN-NOT-REMOVE": "The Description template cannot be removed as it is currently in use.", + "PLAN-BLUEPRINT-HAS-NO-DESCRIPTION-TEMPLATES": "You need to select at least one Description Template. Click the 'Has Description Templates' button to proceed.", + "PLAN-BLUEPRINT-NEW-VERSION-CONFLICT": "While trying to update your Blueprint, a version conflict occurred. Your Blueprint is not in the latest version.", + "PLAN-DESCRIPTION-TEMPLATE-CAN-NOT-REMOVE": "The Description template cannot be removed as it is currently in use.", "TENANT-TAMPERING": "This operation affects data from a Tenant different than your selected. Please reselect your Tenant.", "TENANT-CONFIGURATION-TYPE-CAN-NOT-CHANGE": "The configuration type for this Tenant cannot be changed.", "MULTIPLE-TENANT-CONFIGURATION-TYPE-NOT-ALLOWED": "Tenant Configuration already exists for this Tenant.", "TENANT-CODE-EXISTS": "The Tenant code you provided already exists. Please choose a different code.", - "DMP-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this plan.", - "IMPORT-DESCRIPTION-WITHOUT-DMP-DESCRIPTION-TEMPLATE": "Your plan contains descriptions that are not defined in which section they will exist", + "PLAN-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this plan.", + "IMPORT-DESCRIPTION-WITHOUT-PLAN-DESCRIPTION-TEMPLATE": "Your plan contains descriptions that are not defined in which section they will exist", "INVALID-API-KEY": "Invalid configurations detected. Please contact your administrator.", "STALE-API-KEY": "A problem occurred while trying to authorize you. Please try refreshing the page or logging in again. Contact the system administrator if the problem persists.", "SENSITIVE-INFO": "You've reached a section that contains sensitive information. To protect your privacy, please head back to the public area of the site or log in with your authorized account to access this information.", @@ -70,13 +70,13 @@ "OVERLAPPING-TENANT-CONFIGURATION-NOTIFIER-LIST": "An error occurred due to overlapping configurations. Please try again or contact your administrator.", "DESCRIPTION-TEMPLATE-INACTIVE-USER": "This description template contains users that are not exist", "DESCRIPTION-TEMPLATE-MISSING-USER-CONTACT-INFO": "This description template contains users that don't have contact info", - "DMP-INACTIVE-USER": "This plan contains users that are not exist", - "DMP-MISSING-USER-CONTACT-INFO": "This plan contains users that don't have contact info", + "PLAN-INACTIVE-USER": "This plan contains users that are not exist", + "PLAN-MISSING-USER-CONTACT-INFO": "This plan contains users that don't have contact info", "DESCRIPTION-TEMPLATE-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this description template.", - "DMP-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.", + "PLAN-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.", "REFERENCE-TYPE-CODE-EXISTS": "The reference type code you provided already exists. Please choose a different code.", "PREFILLING-SOURCE-CODE-EXISTS": "The prefilling source code you provided already exists. Please choose a different code.", - "DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once", + "DUPLICATE-PLAN-USER": "You can't invite authors with same role and plan section more than once", "INVITE-USER-ALREADY-CONFIRMED": "Ιnvitation has already confirmed", "REQUEST-HAS-EXPIRED": "Request has expired" }, @@ -112,9 +112,9 @@ "CLOSE": "Zatvoriť" } }, - "DMP-TO-DESCRIPTION-DIALOG": { + "PLAN-TO-DESCRIPTION-DIALOG": { "FROM-DMP": "You have successfully created your", - "DMP": "DMP", + "PLAN": "PLAN", "TO-DESCRIPTION": "You will be transferred to the", "DATASET": "Dataset", "EDITOR": "editor", @@ -186,7 +186,7 @@ "CRITERIA": { "LIKE": "Search..." }, - "START-NEW-DMP-DIALOG": { + "START-NEW-PLAN-DIALOG": { "UPLOAD-FILE": "Nahrať súbor", "REPLACE-FILE": "Replace File" } @@ -231,8 +231,8 @@ "DESCRIPTION-TEMPLATE-TYPES": "Description Types", "DESCRIPTION-TEMPLATES": "Description Templates", "NEW-DESCRIPTION-TEMPLATE-TYPE": "New", - "DMP-BLUEPRINTS": "Plan Blueprints", - "NEW-DMP-BLUEPRINT": "New", + "PLAN-BLUEPRINTS": "Plan Blueprints", + "NEW-PLAN-BLUEPRINT": "New", "NEW-DESCRIPTION-TEMPLATES": "New", "REFERENCE-TYPES": "Reference Types", "NEW-REFERENCE-TYPE": "New", @@ -278,14 +278,14 @@ "MACHINE-ACTIONABLE": "for machine-actionable DMPs" }, "NAV-BAR": { - "START-NEW-DMP": "Začať nový DMP", + "START-NEW-PLAN": "Začať nový DMP", "INAPP-NOTIFICATIONS": "All Notifications", "READ-ALL-INAPP-NOTIFICATIONS": "Read All" }, "SIDE-BAR": { "GENERAL": "VŠEOBECNÉ INFORMÁCIE", "DASHBOARD": "Domov", - "DMP": "PLÁNY MANAŽMENTU DÁT", + "PLAN": "PLÁNY MANAŽMENTU DÁT", "MY-DMPS": "Moje DMP", "DESCRIPTIONS": "SÚBORY DÁT", "MY-DESCRIPTIONS": "My Descriptions", @@ -295,7 +295,7 @@ "ADMIN": "ADMIN", "DESCRIPTION-TEMPLATES": "Description Templates", "DESCRIPTION-TEMPLATE-TYPES": "Description Types", - "DMP-BLUEPRINTS": "DMP Blueprints", + "PLAN-BLUEPRINTS": "DMP Blueprints", "USERS": "Používatelia", "TENANT-USERS":"Tenant Users", "CO-BRANDING": "Co-Branding", @@ -355,7 +355,7 @@ "ACTIONS": { "SEND-USER-TOUCH": "Send user touch events", "SEND-TENANT-TOUCH": "Send tenant touch events", - "SEND-DMP-TOUCH": "Send dmp touch events", + "SEND-PLAN-TOUCH": "Send dmp touch events", "SEND-DESCRIPTION-TOUCH": "Send description touch events" } } @@ -650,8 +650,8 @@ "MESSAGE": "Somebody else is modifying the description template at this moment. You may view the description template but you cannot make any changes. If you would like to modify it please come back later." } }, - "DMP-LISTING": { - "DMP": "DMP", + "PLAN-LISTING": { + "PLAN": "PLAN", "GRANT": "Grant", "EDITED": "Upravené", "PUBLISHED": "Publikované", @@ -696,7 +696,7 @@ "NAME": "Related Description Templates", "PLACEHOLDER": "Select Description Templates" }, - "ASSOCIATED-DMP-BLUEPRINTS": { + "ASSOCIATED-PLAN-BLUEPRINTS": { "NAME": "Related DMP Blueprints", "PLACEHOLDER": "Select DMP Blueprints" }, @@ -713,7 +713,7 @@ }, "EMPTY-LIST": "Zatiaľ prázdne." }, - "DMP-UPLOAD": { + "PLAN-UPLOAD": { "TITLE": "Importovať Plán manažmentu dát", "UPLOAD-SUCCESS": "Importovanie bolo úspešné", "ANALYZING-FILE": "Analyzing file", @@ -730,7 +730,7 @@ }, "PLACEHOLDER": "Názov DMP" }, - "DMP-DELETE-DIALOG": { + "PLAN-DELETE-DIALOG": { "WARNING": "Warning!", "DELETE-ITEM": "Are you sure to delete this plan? The following descriptions will also be removed:", "ACTIONS": { @@ -738,7 +738,7 @@ "CANCEL": "Cancel" } }, - "DMP-OVERVIEW": { + "PLAN-OVERVIEW": { "TITLE": "Plan", "PUBLIC": "Verejné", "LOCKED": "Zamknuté", @@ -749,7 +749,7 @@ "DESCRIPTION": "Description", "DESCRIPTIONS": "Descriptions included", "DOI-PROVIDED": "DOI provided by", - "DMP-AUTHORS": "Autori DΜP", + "PLAN-AUTHORS": "Autori DΜP", "YOU": "vy", "ACTIONS": { "BACK": "Back", @@ -850,7 +850,7 @@ "GRANT": "Grant", "LOCKED": "Description is Locked by another user", "PART-OF": "Part of", - "DMP": "Plan", + "PLAN": "Plan", "EMPTY-LIST": "Zatiaľ prázdne.", "ACTIONS": { "ADD-REFERENCE-TYPE": "Add a Reference Type", @@ -891,7 +891,7 @@ "NAME": "Related Description Templates", "PLACEHOLDER": "Select Description Templates" }, - "ASSOCIATED-DMPS": { + "ASSOCIATED-PLANS": { "NAME": "Related DMPs", "PLACEHOLDER": "Select DMPs" }, @@ -922,7 +922,7 @@ "TITLE-PREVIEW-DESCRIPTION": "Previewing Description", "TO-DMP": "Previewing Description", "UNSAVED-CHANGES": "(unsaved changes)", - "DMP": "Plan", + "PLAN": "Plan", "TOC": { "TITLE": "Guide steps", "MAIN-INFO": "Main info", @@ -1000,8 +1000,8 @@ }, "DESCRIPTION-COPY-DIALOG": { "TITLE": "Copy Description to Plan", - "SELECT-DMP": "Select Plan", - "DMP-SECTION": "Select Section" + "SELECT-PLAN": "Select Plan", + "PLAN-SECTION": "Select Section" }, "PREFILL-DESCRIPTION-DIALOG": { "TITLE": "Initialize your Description", @@ -1566,7 +1566,7 @@ "REMOVE-FIELD": "Remove Field" } }, - "DMP-BLUEPRINT-EDITOR": { + "PLAN-BLUEPRINT-EDITOR": { "TITLE": { "NEW": "New DMP Blueprint", "CLONE": "Clone Plan Blueprint", @@ -1617,7 +1617,7 @@ "MESSAGE": "Somebody else is modifying the Plan Blueprint at this moment. You may view the Plan Blueprint but you cannot make any changes. If you would like to modify it please come back later." } }, - "DMP-EDITOR": { + "PLAN-EDITOR": { "TITLE-NEW": "New Plan", "TITLE-EDIT": "Editing Plan", "TITLE": "Plan Template", @@ -1645,7 +1645,7 @@ "USER-ROLE": "Role", "SECTIONS": "Plan Sections", "ALL-SECTIONS": "All", - "DMP-BLUEPRINT-VERSION": "Version" + "PLAN-BLUEPRINT-VERSION": "Version" }, "ACTIONS": { "DISCARD": { @@ -1688,7 +1688,7 @@ "SNACK-BAR": { "UNSUCCESSFUL-DOI": "Neúspešné vytvorenie DOI", "SUCCESSFUL-DOI": "Úspešné vytvorenie DOI", - "SUCCESSFUL-DMP-CONTACT": "User added" + "SUCCESSFUL-PLAN-CONTACT": "User added" }, "DESCRIPTION-TEMPLATE-LIST": { "TITLE": "Available Description Templates", @@ -1721,7 +1721,7 @@ "TYPE-INFORMATION": " Information" } }, - "DMP-CLONE-DIALOG": { + "PLAN-CLONE-DIALOG": { "TITLE": "Clone", "FIELDS": { "LABEL": "Title of Plan", @@ -1738,7 +1738,7 @@ "TOGGLE-DESCRIPTIONS": "Check/Uncheck" } }, - "DMP-NEW-VERSION-DIALOG": { + "PLAN-NEW-VERSION-DIALOG": { "TITLE": "New Version", "FIELDS": { "LABEL": "Title of Plan", @@ -1757,7 +1757,7 @@ "TOGGLE-DESCRIPTIONS": "Check/Uncheck" } }, - "DMP-CONTACT-PREFILL-DIALOG": { + "PLAN-CONTACT-PREFILL-DIALOG": { "TITLE": "Add ", "TEXT": "Search an existing user where associated with your plans", "FIELDS": { @@ -1768,7 +1768,7 @@ "CONFIRM": "Confirm" } }, - "DMP-USER-INVITATION-DIALOG": { + "PLAN-USER-INVITATION-DIALOG": { "TITLE": "Invite authors", "ACTIONS": { "INVITE": "Invite" @@ -1776,8 +1776,8 @@ "SUCCESS": "Invitation Success", "ERROR": "Invitation Error" }, - "DMP-BLUEPRINT-LISTING": { - "CREATE-DMP-BLUEPRINT": "Create DMP Blueprint", + "PLAN-BLUEPRINT-LISTING": { + "CREATE-PLAN-BLUEPRINT": "Create DMP Blueprint", "FIELDS": { "NAME": "Name", "STATUS": "Status", @@ -1861,7 +1861,7 @@ "FINALIZED": "Finalized", "CANCELED": "Canceled" }, - "DMP-USER-ROLE": { + "PLAN-USER-ROLE": { "OWNER": "Owner", "VIEWER": "Viewer", "DESCRIPTION-CONTRIBUTOR": "Description Contributor", @@ -1870,11 +1870,11 @@ "EXTERNAL-DATASET-TYPE": { "SELECT": "Vybrať" }, - "DMP": { + "PLAN": { "FINALISED": "Dokončené", "DRAFT": "Návrh" }, - "DMP-VISIBILITY": { + "PLAN-VISIBILITY": { "PUBLIC": "Publikované" }, "DESCRIPTION-TEMPLATE-FIELD-VALIDATION-TYPE": { @@ -1885,8 +1885,8 @@ "SELECT": "Select", "BOOLEAN-DECISION": "Boolean Decision", "RADIO-BOX": "Radio Box", - "INTERNAL-DMP-ENTITIES-DMPS": "Internal Plans", - "INTERNAL-DMP-ENTITIES-DESCRIPTIONS": "Internal Descriptions", + "INTERNAL-PLAN-ENTITIES-DMPS": "Internal Plans", + "INTERNAL-PLAN-ENTITIES-DESCRIPTIONS": "Internal Descriptions", "CHECKBOX": "Checkbox", "FREE-TEXT": "Free Text", "TEXT-AREA": "Text Area", @@ -1930,11 +1930,11 @@ "FINALIZED": "Finalized", "DRAFT": "Draft" }, - "DMP-BLUEPRINT-STATUS": { + "PLAN-BLUEPRINT-STATUS": { "FINALIZED": "Finalized", "DRAFT": "Draft" }, - "DMP-BLUEPRINT-SYSTEM-FIELD-TYPE": { + "PLAN-BLUEPRINT-SYSTEM-FIELD-TYPE": { "TITLE": "Title", "DESCRIPTION": "Description", "LANGUAGE": "Language", @@ -1942,7 +1942,7 @@ "ACCESS_RIGHTS": "Access", "USER": "User" }, - "DMP-BLUEPRINT-EXTRA-FIELD-DATA-TYPE": { + "PLAN-BLUEPRINT-EXTRA-FIELD-DATA-TYPE": { "DATE": "Date", "NUMBER": "Number", "TEXT": "Text", @@ -1994,17 +1994,17 @@ "REPLACE": "Replace" }, "NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE": { - "DMP-INVITATION-EXTERNAL-USER": "Plan Invitation External User", - "DMP-INVITATION-EXISTING-USER": "Plan Invitation Existing User", - "DMP-MODIFIED": "Plan Modified", - "DMP-FINALISED": "Plan Finalised", + "PLAN-INVITATION-EXTERNAL-USER": "Plan Invitation External User", + "PLAN-INVITATION-EXISTING-USER": "Plan Invitation Existing User", + "PLAN-MODIFIED": "Plan Modified", + "PLAN-FINALISED": "Plan Finalised", "DESCRIPTION-CREATED": "Description Created", "DESCRIPTION-MODIFIED": "Description Modified", "DESCRIPTION-FINALISED": "Description Finalised", "DESCRIPTION-ANNOTATION-CREATED": "Description Annotation Created", "MERGE-ACCOUNT-CONFIRMATION": "Merge Account Confirmation", "REMOVE-CREDENTIAL-CONFIRMATION": "Remove Credential Confirmation", - "DMP-DEPOSIT": "Plan Deposit", + "PLAN-DEPOSIT": "Plan Deposit", "DESCRIPTION-TEMPLATE-INVITATION": "Description Template Invitation", "CONTACT-SUPPORT": "Contact Support", "PUBLIC-CONTACT-SUPPORT": "Public Contact Support", @@ -2036,7 +2036,7 @@ "ERROR": "Error", "OMITTED": "Omitted" }, - "DMP-ACCESS-TYPE": { + "PLAN-ACCESS-TYPE": { "PUBLIC": "Public", "RESTRICTED": "Restricted Access" }, @@ -2045,11 +2045,11 @@ "REUSED": "Reused dataset", "OTHER": "Other" }, - "DMP-USER-TYPE": { + "PLAN-USER-TYPE": { "INTERNAL": "Internal", "EXTERNAL": "External" }, - "DMP-BLUEPRINT-FIELD-CATEGORY": { + "PLAN-BLUEPRINT-FIELD-CATEGORY": { "SYSTEM": "System", "EXTRA": "Custom", "REFERENCE-TYPE": "External Reference" @@ -2060,9 +2060,9 @@ "TAGS": "Tags" }, "LOCK-TARGET-TYPE": { - "DMP": "Plan", + "PLAN": "Plan", "DESCRIPTION": "Description", - "DMP-BLUEPRINT": "Plan Blueprint", + "PLAN-BLUEPRINT": "Plan Blueprint", "DESCRIPTION-TEMPLATE": "Description Template" } }, @@ -2115,14 +2115,14 @@ "DASHBOARD": { "GRANTS": "Granty", "TITLE": "Čo je {{ APP_NAME_CAPS }}?", - "DMP-QUESTION": "Čo je DMP v {{ APP_NAME_CAPS }}E?", + "PLAN-QUESTION": "Čo je DMP v {{ APP_NAME_CAPS }}E?", "INFO-TEXT": "{{ APP_NAME_CAPS }} je otvorený, rozširovateľný nástroj, ktorý zjednodušuje manažment, validovanie, monitorovanie a údržbu plánov manažmentu dát (DMP, z angl. Data Management Plan). Umožňuje aktérom (výskumníkom, manažérom, supervízorom apod.) vytvárať strojovo spracovateľné DMP, ktoré sa môžu voľne vymieňať medzi infraštuktúrami na realizáciu konkrétnych aspektov procesu manažmentu dát v súlade so zámermi a záväzkami vlastníkov dát.", - "INFO-DMP-TEXT": "Plán manažmentu dát (DMP, z angl. Data Managment Plan) je živý dokument definujúci súbory dát, ktoré sú vygenerované a/alebo znovu používané počas výskumného projektu a po jeho ukončení. Cieľom DMP je poskytnúť výskumným pracovníkom dôležité informácie tak, aby mohli opätovne vytvoriť, opätovne distribuovať a opätovne použiť výskumné výsledky, čím sa zaistí validácia a lepšie využite dát.", + "INFO-PLAN-TEXT": "Plán manažmentu dát (DMP, z angl. Data Managment Plan) je živý dokument definujúci súbory dát, ktoré sú vygenerované a/alebo znovu používané počas výskumného projektu a po jeho ukončení. Cieľom DMP je poskytnúť výskumným pracovníkom dôležité informácie tak, aby mohli opätovne vytvoriť, opätovne distribuovať a opätovne použiť výskumné výsledky, čím sa zaistí validácia a lepšie využite dát.", "NEW-QUESTION": "Nový používateľ DMP? Navštívte", "START-YOUR-FIRST-DMP": "Začať prvý DMP", "OPEN-AIR-GUIDE": "Príručka OpenAIRE pre výskumných pracovníkov,", "LEARN-MORE": "poskytne viac informácií o vytvorení DMP.", - "DMPS": "DMP", + "PLANS": "PLAN", "PERSONAL-USAGE": "Osobné použitie", "PUBLIC-USAGE": "Verejné použitie", "DESCRIPTIONS": "Descriptions", @@ -2134,14 +2134,14 @@ "ALL": "Všetko", "EMPTY-LIST": "Zatiaľ prázdne.", "LATEST-ACTIVITY": "Posledná aktivita", - "DMP-ABOUT-BEG": "DMP v {{ APP_NAME }}e tvoria kľúčové informácie o výskume, ako sú napríklad účel, ciele a zapojení výskumníci, ale aj informácie o dokumentácii výskumných súborov dát, hlavne", - "DMP-ABOUT-END": "o typoch súborov dát, ktoré ukazujú postupnosť krokov a prostriedkov používaných v rámci manažmentu dát.", - "SELECT-DMP": "Vybrať DMP pre svoj súbor dát", + "PLAN-ABOUT-BEG": "DMP v {{ APP_NAME }}e tvoria kľúčové informácie o výskume, ako sú napríklad účel, ciele a zapojení výskumníci, ale aj informácie o dokumentácii výskumných súborov dát, hlavne", + "PLAN-ABOUT-END": "o typoch súborov dát, ktoré ukazujú postupnosť krokov a prostriedkov používaných v rámci manažmentu dát.", + "SELECT-PLAN": "Vybrať DMP pre svoj súbor dát", "ACTIONS": { "ADD-DESCRIPTION": "Add Description" }, "TOUR-GUIDE": { - "DMP": "This is your dashboard. You can view and edit all DMPs that you have either contributed to or created yourself.", + "PLAN": "This is your dashboard. You can view and edit all DMPs that you have either contributed to or created yourself.", "START-NEW": "Create your DMP with Start new DMP.", "IMPORT-DMP": "You can import a DMP", "START-WIZARD": "or create new in {{ APP_NAME }}.", @@ -2152,7 +2152,7 @@ }, "ADD-NEW-DESCRIPTION": { "OPTIONS-NOT-ENOUGH": "Are those options not enough?", - "START-NEW-DMP": "Start new DMP", + "START-NEW-PLAN": "Start new DMP", "OPTIONS": { "CREATED-AT": "Created At:" } @@ -2207,7 +2207,7 @@ "EMAILS": "Emails", "YOUR-EMAIL": "Your Email" }, - "ASSOCIATED-DMPS": "Súvisiace DMP", + "ASSOCIATED-PLANS": "Súvisiace DMP", "ROLE-ORGANIZATION": { "FACULTY": "Faculty", "LIBRARIAN": "Librarian", @@ -2234,9 +2234,9 @@ "CANCEL": "Cancel" } }, - "DMP-FINALISE-DIALOG": { + "PLAN-FINALISE-DIALOG": { "TITLE": "Finalize this item?", - "DMP": "DMP", + "PLAN": "PLAN", "DESCRPIPTIONS": "Descriptions", "EMPTY": "Žiadne súbory dát pre tento DMP", "FINALISE-TITLE": "Chcete dokončiť niektorý z nasledujúcich návrhov súborov dát?", @@ -2245,8 +2245,8 @@ "INVALID-DMP": "This Plan can not be finalized " }, "IMPACT": "Týmto krokom dokončíte svoj DMP a nebudete ho môcť znovu editovať.", - "PUBLIC-DMP-MESSAGE": "After finalizing your Plan, it'll be published and be publicly available to the {{ APP_NAME_CAPS }} tool.", - "RESTRICTED-DMP-MESSAGE": "Your Plan can be published and be publicly available to the {{ APP_NAME_CAPS }} tool after finalization when its access rights are opened. Current access rights: restricted", + "PUBLIC-PLAN-MESSAGE": "After finalizing your Plan, it'll be published and be publicly available to the {{ APP_NAME_CAPS }} tool.", + "RESTRICTED-PLAN-MESSAGE": "Your Plan can be published and be publicly available to the {{ APP_NAME_CAPS }} tool after finalization when its access rights are opened. Current access rights: restricted", "INVALID": "Invalid", "ACTIONS": { "SUBMIT": "Submit", @@ -2254,7 +2254,7 @@ } }, "START-NEW-DESCRIPTION-DIALOG": { - "SELECT-DMP": "Select Plan", + "SELECT-PLAN": "Select Plan", "ACTIONS": { "NEXT": "Next", "CANCEL": "Cancel" diff --git a/dmp-frontend/src/assets/i18n/sr.json b/dmp-frontend/src/assets/i18n/sr.json index 4118a72d4..d0f50b210 100644 --- a/dmp-frontend/src/assets/i18n/sr.json +++ b/dmp-frontend/src/assets/i18n/sr.json @@ -42,23 +42,23 @@ "DESCRIPTION-TEMPLATE-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", "DESCRIPTION-TEMPLATE-IS-NOT-FINALIZED": "The selected Description Template is not finalized.", "MULTIPLE-DESCRIPTION-TEMPLATE-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected Description Template where found. Please contact your administrator.", - "DMP-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", - "DMP-IS-NOT-FINALIZED": "The selected DMP is not finalized.", - "MULTIPLE-DMP-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected DMP where found. Please contact your administrator.", - "DMP-IS-FINALIZED": "The requested action cannot be completed as the DMP has been finalized. To proceed, please revert the finalization.", - "DMP-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP.", - "DMP-DESCRIPTION-TEMPLATE-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP's Description Template.", + "PLAN-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", + "PLAN-IS-NOT-FINALIZED": "The selected DMP is not finalized.", + "MULTIPLE-PLAN-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected DMP where found. Please contact your administrator.", + "PLAN-IS-FINALIZED": "The requested action cannot be completed as the DMP has been finalized. To proceed, please revert the finalization.", + "PLAN-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP.", + "PLAN-DESCRIPTION-TEMPLATE-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP's Description Template.", "INVALID-DESCRIPTION-TEMPLATE": "While tying to update your Description, a validation error occurred. The Description's associated DMP's Description Template is invalid.", "DESCRIPTION-IS-FINALIZED": "The requested action cannot be completed as the Description has been finalized. To proceed, please revert the finalization.", - "DMP-BLUEPRINT-HAS-NO-DESCRIPTION-TEMPLATES": "You need to select at least one Description Template. Click the 'Has Description Templates' button to proceed.", - "DMP-BLUEPRINT-NEW-VERSION-CONFLICT": "While trying to update your Blueprint, a version conflict occurred. Your Blueprint is not in the latest version.", - "DMP-DESCRIPTION-TEMPLATE-CAN-NOT-REMOVE": "The Description template cannot be removed as it is currently in use.", + "PLAN-BLUEPRINT-HAS-NO-DESCRIPTION-TEMPLATES": "You need to select at least one Description Template. Click the 'Has Description Templates' button to proceed.", + "PLAN-BLUEPRINT-NEW-VERSION-CONFLICT": "While trying to update your Blueprint, a version conflict occurred. Your Blueprint is not in the latest version.", + "PLAN-DESCRIPTION-TEMPLATE-CAN-NOT-REMOVE": "The Description template cannot be removed as it is currently in use.", "TENANT-TAMPERING": "This operation affects data from a Tenant different than your selected. Please reselect your Tenant.", "TENANT-CONFIGURATION-TYPE-CAN-NOT-CHANGE": "The configuration type for this Tenant cannot be changed.", "MULTIPLE-TENANT-CONFIGURATION-TYPE-NOT-ALLOWED": "Tenant Configuration already exists for this Tenant.", "TENANT-CODE-EXISTS": "The Tenant code you provided already exists. Please choose a different code.", - "DMP-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this plan.", - "IMPORT-DESCRIPTION-WITHOUT-DMP-DESCRIPTION-TEMPLATE": "Your plan contains descriptions that are not defined in which section they will exist", + "PLAN-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this plan.", + "IMPORT-DESCRIPTION-WITHOUT-PLAN-DESCRIPTION-TEMPLATE": "Your plan contains descriptions that are not defined in which section they will exist", "INVALID-API-KEY": "Invalid configurations detected. Please contact your administrator.", "STALE-API-KEY": "A problem occurred while trying to authorize you. Please try refreshing the page or logging in again. Contact the system administrator if the problem persists.", "SENSITIVE-INFO": "You've reached a section that contains sensitive information. To protect your privacy, please head back to the public area of the site or log in with your authorized account to access this information.", @@ -70,13 +70,13 @@ "OVERLAPPING-TENANT-CONFIGURATION-NOTIFIER-LIST": "An error occurred due to overlapping configurations. Please try again or contact your administrator.", "DESCRIPTION-TEMPLATE-INACTIVE-USER": "This description template contains users that are not exist", "DESCRIPTION-TEMPLATE-MISSING-USER-CONTACT-INFO": "This description template contains users that don't have contact info", - "DMP-INACTIVE-USER": "This plan contains users that are not exist", - "DMP-MISSING-USER-CONTACT-INFO": "This plan contains users that don't have contact info", + "PLAN-INACTIVE-USER": "This plan contains users that are not exist", + "PLAN-MISSING-USER-CONTACT-INFO": "This plan contains users that don't have contact info", "DESCRIPTION-TEMPLATE-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this description template.", - "DMP-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.", + "PLAN-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.", "REFERENCE-TYPE-CODE-EXISTS": "The reference type code you provided already exists. Please choose a different code.", "PREFILLING-SOURCE-CODE-EXISTS": "The prefilling source code you provided already exists. Please choose a different code.", - "DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once", + "DUPLICATE-PLAN-USER": "You can't invite authors with same role and plan section more than once", "INVITE-USER-ALREADY-CONFIRMED": "Ιnvitation has already confirmed", "REQUEST-HAS-EXPIRED": "Request has expired" }, @@ -112,9 +112,9 @@ "CLOSE": "Zatvorite" } }, - "DMP-TO-DESCRIPTION-DIALOG": { + "PLAN-TO-DESCRIPTION-DIALOG": { "FROM-DMP": "Uspešno ste kreirali", - "DMP": "DMP", + "PLAN": "PLAN", "TO-DESCRIPTION": "Preusmeravanje na", "DATASET": "uređivanje", "EDITOR": "skupa podataka", @@ -186,7 +186,7 @@ "CRITERIA": { "LIKE": "Search..." }, - "START-NEW-DMP-DIALOG": { + "START-NEW-PLAN-DIALOG": { "UPLOAD-FILE": "Uvezite datoteku", "REPLACE-FILE": "Replace File" } @@ -231,8 +231,8 @@ "DESCRIPTION-TEMPLATE-TYPES": "Description Types", "DESCRIPTION-TEMPLATES": "Description Templates", "NEW-DESCRIPTION-TEMPLATE-TYPE": "New", - "DMP-BLUEPRINTS": "Plan Blueprints", - "NEW-DMP-BLUEPRINT": "New", + "PLAN-BLUEPRINTS": "Plan Blueprints", + "NEW-PLAN-BLUEPRINT": "New", "NEW-DESCRIPTION-TEMPLATES": "New", "REFERENCE-TYPES": "Reference Types", "NEW-REFERENCE-TYPE": "New", @@ -278,14 +278,14 @@ "MACHINE-ACTIONABLE": "for machine-actionable DMPs" }, "NAV-BAR": { - "START-NEW-DMP": "Započnite kreiranje novog Plana", + "START-NEW-PLAN": "Započnite kreiranje novog Plana", "INAPP-NOTIFICATIONS": "All Notifications", "READ-ALL-INAPP-NOTIFICATIONS": "Read All" }, "SIDE-BAR": { "GENERAL": "OPŠTE", "DASHBOARD": "Početak", - "DMP": "PLANOVI UPRAVLJANJA PODACIMA", + "PLAN": "PLANOVI UPRAVLJANJA PODACIMA", "MY-DMPS": "Moji Planovi", "DESCRIPTIONS": "SKUPOVI PODATAKA", "MY-DESCRIPTIONS": "My Descriptions", @@ -295,7 +295,7 @@ "ADMIN": "ADMINISTRATOR", "DESCRIPTION-TEMPLATES": "Description Templates", "DESCRIPTION-TEMPLATE-TYPES": "Description Types", - "DMP-BLUEPRINTS": "DMP Blueprints", + "PLAN-BLUEPRINTS": "DMP Blueprints", "USERS": "Korisnici", "TENANT-USERS":"Tenant Users", "CO-BRANDING": "Partnerstvo", @@ -355,7 +355,7 @@ "ACTIONS": { "SEND-USER-TOUCH": "Send user touch events", "SEND-TENANT-TOUCH": "Send tenant touch events", - "SEND-DMP-TOUCH": "Send dmp touch events", + "SEND-PLAN-TOUCH": "Send dmp touch events", "SEND-DESCRIPTION-TOUCH": "Send description touch events" } } @@ -650,8 +650,8 @@ "MESSAGE": "Somebody else is modifying the description template at this moment. You may view the description template but you cannot make any changes. If you would like to modify it please come back later." } }, - "DMP-LISTING": { - "DMP": "Plan upravljanja podacima", + "PLAN-LISTING": { + "PLAN": "Plan upravljanja podacima", "GRANT": "Grant", "EDITED": "Izmenjeno", "PUBLISHED": "Objavljeno", @@ -696,7 +696,7 @@ "NAME": "Related Description Templates", "PLACEHOLDER": "Select Description Templates" }, - "ASSOCIATED-DMP-BLUEPRINTS": { + "ASSOCIATED-PLAN-BLUEPRINTS": { "NAME": "Related DMP Blueprints", "PLACEHOLDER": "Select DMP Blueprints" }, @@ -713,7 +713,7 @@ }, "EMPTY-LIST": "Još uvek ništa nije dostupno." }, - "DMP-UPLOAD": { + "PLAN-UPLOAD": { "TITLE": "Uvezite plan upravljanja podacima", "UPLOAD-SUCCESS": "Uspešan uvoz", "ANALYZING-FILE": "Analyzing file", @@ -730,7 +730,7 @@ }, "PLACEHOLDER": "Naslov Plana" }, - "DMP-DELETE-DIALOG": { + "PLAN-DELETE-DIALOG": { "WARNING": "Warning!", "DELETE-ITEM": "Are you sure to delete this plan? The following descriptions will also be removed:", "ACTIONS": { @@ -738,7 +738,7 @@ "CANCEL": "Cancel" } }, - "DMP-OVERVIEW": { + "PLAN-OVERVIEW": { "TITLE": "Plan", "PUBLIC": "Javno", "LOCKED": "Zaključano", @@ -749,7 +749,7 @@ "DESCRIPTION": "Description", "DESCRIPTIONS": "Descriptions included", "DOI-PROVIDED": "DOI provided by", - "DMP-AUTHORS": "Autori Plana", + "PLAN-AUTHORS": "Autori Plana", "YOU": "Vi", "ACTIONS": { "BACK": "Back", @@ -850,7 +850,7 @@ "GRANT": "Grant", "LOCKED": "Description is Locked by another user", "PART-OF": "Part of", - "DMP": "Plan", + "PLAN": "Plan", "EMPTY-LIST": "Još uvek ništa nije dostupno.", "ACTIONS": { "ADD-REFERENCE-TYPE": "Add a Reference Type", @@ -889,7 +889,7 @@ "NAME": "Related Description Templates", "PLACEHOLDER": "Select Description Templates" }, - "ASSOCIATED-DMPS": { + "ASSOCIATED-PLANS": { "NAME": "Related DMPs", "PLACEHOLDER": "Select DMPs" }, @@ -922,7 +922,7 @@ "TITLE-PREVIEW-DESCRIPTION": "Previewing Description", "TO-DMP": "Previewing Description", "UNSAVED-CHANGES": "(unsaved changes)", - "DMP": "Plan", + "PLAN": "Plan", "TOC": { "TITLE": "Guide steps", "MAIN-INFO": "Main info", @@ -1000,8 +1000,8 @@ }, "DESCRIPTION-COPY-DIALOG": { "TITLE": "Copy Description to Plan", - "SELECT-DMP": "Select Plan", - "DMP-SECTION": "Select Section" + "SELECT-PLAN": "Select Plan", + "PLAN-SECTION": "Select Section" }, "PREFILL-DESCRIPTION-DIALOG": { "TITLE": "Initialize your Description", @@ -1566,7 +1566,7 @@ "REMOVE-FIELD": "Remove Field" } }, - "DMP-BLUEPRINT-EDITOR": { + "PLAN-BLUEPRINT-EDITOR": { "TITLE": { "NEW": "New DMP Blueprint", "CLONE": "Clone Plan Blueprint", @@ -1617,7 +1617,7 @@ "MESSAGE": "Somebody else is modifying the Plan Blueprint at this moment. You may view the Plan Blueprint but you cannot make any changes. If you would like to modify it please come back later." } }, - "DMP-EDITOR": { + "PLAN-EDITOR": { "TITLE-NEW": "New Plan", "TITLE-EDIT": "Editing Plan", "TITLE": "Plan Template", @@ -1645,7 +1645,7 @@ "USER-ROLE": "Role", "SECTIONS": "Plan Sections", "ALL-SECTIONS": "All", - "DMP-BLUEPRINT-VERSION": "Version" + "PLAN-BLUEPRINT-VERSION": "Version" }, "ACTIONS": { "DISCARD": { @@ -1688,7 +1688,7 @@ "SNACK-BAR": { "UNSUCCESSFUL-DOI": "Neuspešno registrovan DOI", "SUCCESSFUL-DOI": "Uspešno registrovan DOI", - "SUCCESSFUL-DMP-CONTACT": "User added" + "SUCCESSFUL-PLAN-CONTACT": "User added" }, "DESCRIPTION-TEMPLATE-LIST": { "TITLE": "Available Description Templates", @@ -1721,7 +1721,7 @@ "TYPE-INFORMATION": " Information" } }, - "DMP-CLONE-DIALOG": { + "PLAN-CLONE-DIALOG": { "TITLE": "Clone", "FIELDS": { "LABEL": "Title of Plan", @@ -1738,7 +1738,7 @@ "TOGGLE-DESCRIPTIONS": "Check/Uncheck" } }, - "DMP-NEW-VERSION-DIALOG": { + "PLAN-NEW-VERSION-DIALOG": { "TITLE": "New Version", "FIELDS": { "LABEL": "Title of Plan", @@ -1757,7 +1757,7 @@ "TOGGLE-DESCRIPTIONS": "Check/Uncheck" } }, - "DMP-CONTACT-PREFILL-DIALOG": { + "PLAN-CONTACT-PREFILL-DIALOG": { "TITLE": "Add ", "TEXT": "Search an existing user where associated with your plans", "FIELDS": { @@ -1768,7 +1768,7 @@ "CONFIRM": "Confirm" } }, - "DMP-USER-INVITATION-DIALOG": { + "PLAN-USER-INVITATION-DIALOG": { "TITLE": "Invite authors", "ACTIONS": { "INVITE": "Invite" @@ -1776,8 +1776,8 @@ "SUCCESS": "Invitation Success", "ERROR": "Invitation Error" }, - "DMP-BLUEPRINT-LISTING": { - "CREATE-DMP-BLUEPRINT": "Create DMP Blueprint", + "PLAN-BLUEPRINT-LISTING": { + "CREATE-PLAN-BLUEPRINT": "Create DMP Blueprint", "FIELDS": { "NAME": "Name", "STATUS": "Status", @@ -1861,7 +1861,7 @@ "FINALIZED": "Finalized", "CANCELED": "Canceled" }, - "DMP-USER-ROLE": { + "PLAN-USER-ROLE": { "OWNER": "Owner", "VIEWER": "Viewer", "DESCRIPTION-CONTRIBUTOR": "Description Contributor", @@ -1870,11 +1870,11 @@ "EXTERNAL-DATASET-TYPE": { "SELECT": "Odaberite" }, - "DMP": { + "PLAN": { "FINALISED": "Završeno", "DRAFT": "Radna verzija" }, - "DMP-VISIBILITY": { + "PLAN-VISIBILITY": { "PUBLIC": "Objavljeno" }, "DESCRIPTION-TEMPLATE-FIELD-VALIDATION-TYPE": { @@ -1885,8 +1885,8 @@ "SELECT": "Select", "BOOLEAN-DECISION": "Boolean Decision", "RADIO-BOX": "Radio Box", - "INTERNAL-DMP-ENTITIES-DMPS": "Internal Plans", - "INTERNAL-DMP-ENTITIES-DESCRIPTIONS": "Internal Descriptions", + "INTERNAL-PLAN-ENTITIES-DMPS": "Internal Plans", + "INTERNAL-PLAN-ENTITIES-DESCRIPTIONS": "Internal Descriptions", "CHECKBOX": "Checkbox", "FREE-TEXT": "Free Text", "TEXT-AREA": "Text Area", @@ -1930,11 +1930,11 @@ "FINALIZED": "Finalized", "DRAFT": "Draft" }, - "DMP-BLUEPRINT-STATUS": { + "PLAN-BLUEPRINT-STATUS": { "FINALIZED": "Finalized", "DRAFT": "Draft" }, - "DMP-BLUEPRINT-SYSTEM-FIELD-TYPE": { + "PLAN-BLUEPRINT-SYSTEM-FIELD-TYPE": { "TITLE": "Title", "DESCRIPTION": "Description", "LANGUAGE": "Language", @@ -1942,7 +1942,7 @@ "ACCESS_RIGHTS": "Access", "USER": "User" }, - "DMP-BLUEPRINT-EXTRA-FIELD-DATA-TYPE": { + "PLAN-BLUEPRINT-EXTRA-FIELD-DATA-TYPE": { "DATE": "Date", "NUMBER": "Number", "TEXT": "Text", @@ -1994,17 +1994,17 @@ "REPLACE": "Replace" }, "NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE": { - "DMP-INVITATION-EXTERNAL-USER": "Plan Invitation External User", - "DMP-INVITATION-EXISTING-USER": "Plan Invitation Existing User", - "DMP-MODIFIED": "Plan Modified", - "DMP-FINALISED": "Plan Finalised", + "PLAN-INVITATION-EXTERNAL-USER": "Plan Invitation External User", + "PLAN-INVITATION-EXISTING-USER": "Plan Invitation Existing User", + "PLAN-MODIFIED": "Plan Modified", + "PLAN-FINALISED": "Plan Finalised", "DESCRIPTION-CREATED": "Description Created", "DESCRIPTION-MODIFIED": "Description Modified", "DESCRIPTION-FINALISED": "Description Finalised", "DESCRIPTION-ANNOTATION-CREATED": "Description Annotation Created", "MERGE-ACCOUNT-CONFIRMATION": "Merge Account Confirmation", "REMOVE-CREDENTIAL-CONFIRMATION": "Remove Credential Confirmation", - "DMP-DEPOSIT": "Plan Deposit", + "PLAN-DEPOSIT": "Plan Deposit", "DESCRIPTION-TEMPLATE-INVITATION": "Description Template Invitation", "CONTACT-SUPPORT": "Contact Support", "PUBLIC-CONTACT-SUPPORT": "Public Contact Support", @@ -2036,7 +2036,7 @@ "ERROR": "Error", "OMITTED": "Omitted" }, - "DMP-ACCESS-TYPE": { + "PLAN-ACCESS-TYPE": { "PUBLIC": "Public", "RESTRICTED": "Restricted Access" }, @@ -2045,11 +2045,11 @@ "REUSED": "Reused dataset", "OTHER": "Other" }, - "DMP-USER-TYPE": { + "PLAN-USER-TYPE": { "INTERNAL": "Internal", "EXTERNAL": "External" }, - "DMP-BLUEPRINT-FIELD-CATEGORY": { + "PLAN-BLUEPRINT-FIELD-CATEGORY": { "SYSTEM": "System", "EXTRA": "Custom", "REFERENCE-TYPE": "External Reference" @@ -2060,9 +2060,9 @@ "TAGS": "Tags" }, "LOCK-TARGET-TYPE": { - "DMP": "Plan", + "PLAN": "Plan", "DESCRIPTION": "Description", - "DMP-BLUEPRINT": "Plan Blueprint", + "PLAN-BLUEPRINT": "Plan Blueprint", "DESCRIPTION-TEMPLATE": "Description Template" } }, @@ -2115,14 +2115,14 @@ "DASHBOARD": { "GRANTS": "Grantovi", "TITLE": "Šta je {{ APP_NAME_CAPS }}?", - "DMP-QUESTION": "Šta je Plan u {{ APP_NAME_CAPS }}U?", + "PLAN-QUESTION": "Šta je Plan u {{ APP_NAME_CAPS }}U?", "INFO-TEXT": "{{ APP_NAME_CAPS }} je otvorena modularna aplikacija koja omogućava jednostavno upravljanje planovima upravljanja podacima (eng. Data Management Plan), kao i njihovu proveru, praćenje i održavanje. Uz pomoć {{ APP_NAME }}a, svi akteri u istraživanju (istraživači, rukovodioci, nadzorni organi i drugi) mogu da napišu primenljive planove koji se mogu slobodno razmenjivati kroz različite infrastrukture radi realizacije određenih elemenata procesa upravljanja podacima u skladu sa namerama i obavezama vlasnika podataka.", - "INFO-DMP-TEXT": "Plan upravljanja podacima (eng. Data Management Plan, skraćeno DMP) je živi dokument koji opisuje skupove podataka proizvedene ili korišćene tokom i posle istraživačkog ciklusa. Planovi daju osnovne informacije o mogućnostima za replikaciju i naknadnu distribuciju rezultata istraživanja, kao i za njihovo korišćenje u novim kontekstima, čime se potvrđuje njihova validnost i obezbeđuje njihovo ponovno korišćenje u istu ili druge svrhe.", + "INFO-PLAN-TEXT": "Plan upravljanja podacima (eng. Data Management Plan, skraćeno DMP) je živi dokument koji opisuje skupove podataka proizvedene ili korišćene tokom i posle istraživačkog ciklusa. Planovi daju osnovne informacije o mogućnostima za replikaciju i naknadnu distribuciju rezultata istraživanja, kao i za njihovo korišćenje u novim kontekstima, čime se potvrđuje njihova validnost i obezbeđuje njihovo ponovno korišćenje u istu ili druge svrhe.", "NEW-QUESTION": "Nemate iskustvo u kreiranju plana upravljanja podacima? Posetite", "START-YOUR-FIRST-DMP": "Započnite Vaš prvi plan upravljanja podacima", "OPEN-AIR-GUIDE": "OpenAIRE vodič za istraživače", "LEARN-MORE": "kako biste naučili kako da kreirate plan upravljanja podacima (eng. Data Management Plan)!", - "DMPS": "Planovi upravljanja podacima", + "PLANS": "Planovi upravljanja podacima", "PERSONAL-USAGE": "Lična upotreba", "PUBLIC-USAGE": "Javna upotreba", "DESCRIPTIONS": "Descriptions", @@ -2134,14 +2134,14 @@ "ALL": "Sve", "EMPTY-LIST": "Još uvek ništa nije dostupno.", "LATEST-ACTIVITY": "Poslednja izmena", - "DMP-ABOUT-BEG": "Plan upravljanja podacima u {{ APP_NAME }}u sadrži osnovne informacije o istraživanju, kao što su svrha i ciljevi istraživanja, angažovani istraživači, kao i dokumentaciju o skupovima istraživačkih podataka, tačnije", - "DMP-ABOUT-END": ", koje ukazuju na procedure primenjene u upravljanju podacima.", - "SELECT-DMP": "Odaberite odgovarajući Plan za Vaš skup podataka", + "PLAN-ABOUT-BEG": "Plan upravljanja podacima u {{ APP_NAME }}u sadrži osnovne informacije o istraživanju, kao što su svrha i ciljevi istraživanja, angažovani istraživači, kao i dokumentaciju o skupovima istraživačkih podataka, tačnije", + "PLAN-ABOUT-END": ", koje ukazuju na procedure primenjene u upravljanju podacima.", + "SELECT-PLAN": "Odaberite odgovarajući Plan za Vaš skup podataka", "ACTIONS": { "ADD-DESCRIPTION": "Add Description" }, "TOUR-GUIDE": { - "DMP": "This is your dashboard. You can view and edit all DMPs that you have either contributed to or created yourself.", + "PLAN": "This is your dashboard. You can view and edit all DMPs that you have either contributed to or created yourself.", "START-NEW": "Create your DMP with Start new DMP.", "IMPORT-DMP": "You can import a DMP", "START-WIZARD": "or create new in {{ APP_NAME }}.", @@ -2152,7 +2152,7 @@ }, "ADD-NEW-DESCRIPTION": { "OPTIONS-NOT-ENOUGH": "Are those options not enough?", - "START-NEW-DMP": "Start new DMP", + "START-NEW-PLAN": "Start new DMP", "OPTIONS": { "CREATED-AT": "Created At:" } @@ -2207,7 +2207,7 @@ "EMAILS": "Emails", "YOUR-EMAIL": "Your Email" }, - "ASSOCIATED-DMPS": "Povezani Planovi", + "ASSOCIATED-PLANS": "Povezani Planovi", "ROLE-ORGANIZATION": { "FACULTY": "Faculty", "LIBRARIAN": "Librarian", @@ -2234,9 +2234,9 @@ "CANCEL": "Cancel" } }, - "DMP-FINALISE-DIALOG": { + "PLAN-FINALISE-DIALOG": { "TITLE": "Finalize this item?", - "DMP": "Plan upravljanja podacima", + "PLAN": "Plan upravljanja podacima", "DESCRPIPTIONS": "Descriptions", "EMPTY": "Plan još uvek nema nijedan skup podataka", "FINALISE-TITLE": "Da li želite da završite kreiranje sledećih radnih verzija skupova podataka?", @@ -2245,8 +2245,8 @@ "INVALID-DMP": "This Plan can not be finalized " }, "IMPACT": "Ovim korakom se završava proces kreiranja plana upravljanja podacima i posle toga nećete biti u mogućnosti da ga menjate.", - "PUBLIC-DMP-MESSAGE": "After finalizing your Plan, it'll be published and be publicly available to the {{ APP_NAME_CAPS }} tool.", - "RESTRICTED-DMP-MESSAGE": "Your Plan can be published and be publicly available to the {{ APP_NAME_CAPS }} tool after finalization when its access rights are opened. Current access rights: restricted", + "PUBLIC-PLAN-MESSAGE": "After finalizing your Plan, it'll be published and be publicly available to the {{ APP_NAME_CAPS }} tool.", + "RESTRICTED-PLAN-MESSAGE": "Your Plan can be published and be publicly available to the {{ APP_NAME_CAPS }} tool after finalization when its access rights are opened. Current access rights: restricted", "INVALID": "Invalid", "ACTIONS": { "SUBMIT": "Submit", @@ -2254,7 +2254,7 @@ } }, "START-NEW-DESCRIPTION-DIALOG": { - "SELECT-DMP": "Select Plan", + "SELECT-PLAN": "Select Plan", "ACTIONS": { "NEXT": "Next", "CANCEL": "Cancel" diff --git a/dmp-frontend/src/assets/i18n/tr.json b/dmp-frontend/src/assets/i18n/tr.json index 91aaff329..76cad3241 100644 --- a/dmp-frontend/src/assets/i18n/tr.json +++ b/dmp-frontend/src/assets/i18n/tr.json @@ -42,23 +42,23 @@ "DESCRIPTION-TEMPLATE-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", "DESCRIPTION-TEMPLATE-IS-NOT-FINALIZED": "The selected Description Template is not finalized.", "MULTIPLE-DESCRIPTION-TEMPLATE-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected Description Template where found. Please contact your administrator.", - "DMP-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", - "DMP-IS-NOT-FINALIZED": "The selected DMP is not finalized.", - "MULTIPLE-DMP-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected DMP where found. Please contact your administrator.", - "DMP-IS-FINALIZED": "The requested action cannot be completed as the DMP has been finalized. To proceed, please revert the finalization.", - "DMP-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP.", - "DMP-DESCRIPTION-TEMPLATE-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP's Description Template.", + "PLAN-NEW-VERSION-CONFLICT": "You can create a new version only by selected the latest version.", + "PLAN-IS-NOT-FINALIZED": "The selected DMP is not finalized.", + "MULTIPLE-PLAN-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected DMP where found. Please contact your administrator.", + "PLAN-IS-FINALIZED": "The requested action cannot be completed as the DMP has been finalized. To proceed, please revert the finalization.", + "PLAN-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP.", + "PLAN-DESCRIPTION-TEMPLATE-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP's Description Template.", "INVALID-DESCRIPTION-TEMPLATE": "While tying to update your Description, a validation error occurred. The Description's associated DMP's Description Template is invalid.", "DESCRIPTION-IS-FINALIZED": "The requested action cannot be completed as the Description has been finalized. To proceed, please revert the finalization.", - "DMP-BLUEPRINT-HAS-NO-DESCRIPTION-TEMPLATES": "You need to select at least one Description Template. Click the 'Has Description Templates' button to proceed.", - "DMP-BLUEPRINT-NEW-VERSION-CONFLICT": "While trying to update your Blueprint, a version conflict occurred. Your Blueprint is not in the latest version.", - "DMP-DESCRIPTION-TEMPLATE-CAN-NOT-REMOVE": "The Description template cannot be removed as it is currently in use.", + "PLAN-BLUEPRINT-HAS-NO-DESCRIPTION-TEMPLATES": "You need to select at least one Description Template. Click the 'Has Description Templates' button to proceed.", + "PLAN-BLUEPRINT-NEW-VERSION-CONFLICT": "While trying to update your Blueprint, a version conflict occurred. Your Blueprint is not in the latest version.", + "PLAN-DESCRIPTION-TEMPLATE-CAN-NOT-REMOVE": "The Description template cannot be removed as it is currently in use.", "TENANT-TAMPERING": "This operation affects data from a Tenant different than your selected. Please reselect your Tenant.", "TENANT-CONFIGURATION-TYPE-CAN-NOT-CHANGE": "The configuration type for this Tenant cannot be changed.", "MULTIPLE-TENANT-CONFIGURATION-TYPE-NOT-ALLOWED": "Tenant Configuration already exists for this Tenant.", "TENANT-CODE-EXISTS": "The Tenant code you provided already exists. Please choose a different code.", - "DMP-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this plan.", - "IMPORT-DESCRIPTION-WITHOUT-DMP-DESCRIPTION-TEMPLATE": "Your plan contains descriptions that are not defined in which section they will exist", + "PLAN-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this plan.", + "IMPORT-DESCRIPTION-WITHOUT-PLAN-DESCRIPTION-TEMPLATE": "Your plan contains descriptions that are not defined in which section they will exist", "INVALID-API-KEY": "Invalid configurations detected. Please contact your administrator.", "STALE-API-KEY": "A problem occurred while trying to authorize you. Please try refreshing the page or logging in again. Contact the system administrator if the problem persists.", "SENSITIVE-INFO": "You've reached a section that contains sensitive information. To protect your privacy, please head back to the public area of the site or log in with your authorized account to access this information.", @@ -70,13 +70,13 @@ "OVERLAPPING-TENANT-CONFIGURATION-NOTIFIER-LIST": "An error occurred due to overlapping configurations. Please try again or contact your administrator.", "DESCRIPTION-TEMPLATE-INACTIVE-USER": "This description template contains users that are not exist", "DESCRIPTION-TEMPLATE-MISSING-USER-CONTACT-INFO": "This description template contains users that don't have contact info", - "DMP-INACTIVE-USER": "This plan contains users that are not exist", - "DMP-MISSING-USER-CONTACT-INFO": "This plan contains users that don't have contact info", + "PLAN-INACTIVE-USER": "This plan contains users that are not exist", + "PLAN-MISSING-USER-CONTACT-INFO": "This plan contains users that don't have contact info", "DESCRIPTION-TEMPLATE-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this description template.", - "DMP-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.", + "PLAN-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.", "REFERENCE-TYPE-CODE-EXISTS": "The reference type code you provided already exists. Please choose a different code.", "PREFILLING-SOURCE-CODE-EXISTS": "The prefilling source code you provided already exists. Please choose a different code.", - "DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once", + "DUPLICATE-PLAN-USER": "You can't invite authors with same role and plan section more than once", "INVITE-USER-ALREADY-CONFIRMED": "Ιnvitation has already confirmed", "REQUEST-HAS-EXPIRED": "Request has expired" }, @@ -112,9 +112,9 @@ "CLOSE": "Kapat" } }, - "DMP-TO-DESCRIPTION-DIALOG": { + "PLAN-TO-DESCRIPTION-DIALOG": { "FROM-DMP": "Başarıyla oluşturdunuz", - "DMP": "VYP", + "PLAN": "VYP", "TO-DESCRIPTION": "Yönlendireleceksiniz", "DATASET": "Veri Seti", "EDITOR": "editor", @@ -186,7 +186,7 @@ "CRITERIA": { "LIKE": "Search..." }, - "START-NEW-DMP-DIALOG": { + "START-NEW-PLAN-DIALOG": { "UPLOAD-FILE": "Dosya Yükle", "REPLACE-FILE": "Replace File" } @@ -231,8 +231,8 @@ "DESCRIPTION-TEMPLATE-TYPES": "Description Types", "DESCRIPTION-TEMPLATES": "Description Templates", "NEW-DESCRIPTION-TEMPLATE-TYPE": "New", - "DMP-BLUEPRINTS": "Plan Blueprints", - "NEW-DMP-BLUEPRINT": "New", + "PLAN-BLUEPRINTS": "Plan Blueprints", + "NEW-PLAN-BLUEPRINT": "New", "NEW-DESCRIPTION-TEMPLATES": "New", "REFERENCE-TYPES": "Reference Types", "NEW-REFERENCE-TYPE": "New", @@ -278,14 +278,14 @@ "MACHINE-ACTIONABLE": "for machine-actionable DMPs" }, "NAV-BAR": { - "START-NEW-DMP": "Yeni bir VYP yaz", + "START-NEW-PLAN": "Yeni bir VYP yaz", "INAPP-NOTIFICATIONS": "All Notifications", "READ-ALL-INAPP-NOTIFICATIONS": "Read All" }, "SIDE-BAR": { "GENERAL": "GENEL", "DASHBOARD": "Ev", - "DMP": "VERİ YÖNETİM PLANLARI", + "PLAN": "VERİ YÖNETİM PLANLARI", "MY-DMPS": "VYP'larım", "DESCRIPTIONS": "Veri Setleri", "MY-DESCRIPTIONS": "My Descriptions", @@ -295,7 +295,7 @@ "ADMIN": "ADMIN", "DESCRIPTION-TEMPLATES": "Description Templates", "DESCRIPTION-TEMPLATE-TYPES": "Description Types", - "DMP-BLUEPRINTS": "DMP Blueprints", + "PLAN-BLUEPRINTS": "DMP Blueprints", "USERS": "Kullanıcılar", "TENANT-USERS":"Tenant Users", "CO-BRANDING": "Birlikte Markalama", @@ -355,7 +355,7 @@ "ACTIONS": { "SEND-USER-TOUCH": "Send user touch events", "SEND-TENANT-TOUCH": "Send tenant touch events", - "SEND-DMP-TOUCH": "Send dmp touch events", + "SEND-PLAN-TOUCH": "Send dmp touch events", "SEND-DESCRIPTION-TOUCH": "Send description touch events" } } @@ -650,8 +650,8 @@ "MESSAGE": "Somebody else is modifying the description template at this moment. You may view the description template but you cannot make any changes. If you would like to modify it please come back later." } }, - "DMP-LISTING": { - "DMP": "VYP", + "PLAN-LISTING": { + "PLAN": "VYP", "GRANT": "Hibe", "EDITED": "Düzeltildi", "PUBLISHED": "Yayınlanmış", @@ -696,7 +696,7 @@ "NAME": "Related Description Templates", "PLACEHOLDER": "Select Description Templates" }, - "ASSOCIATED-DMP-BLUEPRINTS": { + "ASSOCIATED-PLAN-BLUEPRINTS": { "NAME": "Related DMP Blueprints", "PLACEHOLDER": "Select DMP Blueprints" }, @@ -713,7 +713,7 @@ }, "EMPTY-LIST": "Burada Henüz Bir Şey Yok." }, - "DMP-UPLOAD": { + "PLAN-UPLOAD": { "TITLE": "Veri Yönetim Planı Şablonu İçeri Aktar", "UPLOAD-SUCCESS": "Başarıyla İçeri Aktarıldı", "ANALYZING-FILE": "Analyzing file", @@ -730,7 +730,7 @@ }, "PLACEHOLDER": "VYP başlığı" }, - "DMP-DELETE-DIALOG": { + "PLAN-DELETE-DIALOG": { "WARNING": "Warning!", "DELETE-ITEM": "Are you sure to delete this plan? The following descriptions will also be removed:", "ACTIONS": { @@ -738,7 +738,7 @@ "CANCEL": "Cancel" } }, - "DMP-OVERVIEW": { + "PLAN-OVERVIEW": { "TITLE": "Plan", "PUBLIC": "Açık Erişimli", "LOCKED": "Kilitli", @@ -749,7 +749,7 @@ "DESCRIPTION": "Description", "DESCRIPTIONS": "Descriptions included", "DOI-PROVIDED": "DOI provided by", - "DMP-AUTHORS": "VYP Yazarı", + "PLAN-AUTHORS": "VYP Yazarı", "YOU": "siz", "ACTIONS": { "BACK": "Back", @@ -850,7 +850,7 @@ "GRANT": "Grant", "LOCKED": "Description is Locked by another user", "PART-OF": "Part of", - "DMP": "Plan", + "PLAN": "Plan", "EMPTY-LIST": "Burada Henüz Bir Şey Yok.", "ACTIONS": { "ADD-REFERENCE-TYPE": "Add a Reference Type", @@ -889,7 +889,7 @@ "NAME": "Related Description Templates", "PLACEHOLDER": "Select Description Templates" }, - "ASSOCIATED-DMPS": { + "ASSOCIATED-PLANS": { "NAME": "Related DMPs", "PLACEHOLDER": "Select DMPs" }, @@ -922,7 +922,7 @@ "TITLE-PREVIEW-DESCRIPTION": "Previewing Description", "TO-DMP": "Previewing Description", "UNSAVED-CHANGES": "(unsaved changes)", - "DMP": "Plan", + "PLAN": "Plan", "TOC": { "TITLE": "Guide steps", "MAIN-INFO": "Main info", @@ -1000,8 +1000,8 @@ }, "DESCRIPTION-COPY-DIALOG": { "TITLE": "Copy Description to Plan", - "SELECT-DMP": "Select Plan", - "DMP-SECTION": "Select Section" + "SELECT-PLAN": "Select Plan", + "PLAN-SECTION": "Select Section" }, "PREFILL-DESCRIPTION-DIALOG": { "TITLE": "Initialize your Description", @@ -1566,7 +1566,7 @@ "REMOVE-FIELD": "Remove Field" } }, - "DMP-BLUEPRINT-EDITOR": { + "PLAN-BLUEPRINT-EDITOR": { "TITLE": { "NEW": "New DMP Blueprint", "CLONE": "Clone Plan Blueprint", @@ -1617,7 +1617,7 @@ "MESSAGE": "Somebody else is modifying the Plan Blueprint at this moment. You may view the Plan Blueprint but you cannot make any changes. If you would like to modify it please come back later." } }, - "DMP-EDITOR": { + "PLAN-EDITOR": { "TITLE-NEW": "New Plan", "TITLE-EDIT": "Editing Plan", "TITLE": "Plan Template", @@ -1645,7 +1645,7 @@ "USER-ROLE": "Role", "SECTIONS": "Plan Sections", "ALL-SECTIONS": "All", - "DMP-BLUEPRINT-VERSION": "Version" + "PLAN-BLUEPRINT-VERSION": "Version" }, "ACTIONS": { "DISCARD": { @@ -1688,7 +1688,7 @@ "SNACK-BAR": { "UNSUCCESSFUL-DOI": "Başarısız DOI oluşturma", "SUCCESSFUL-DOI": "Başarılı DOI oluşumu", - "SUCCESSFUL-DMP-CONTACT": "User added" + "SUCCESSFUL-PLAN-CONTACT": "User added" }, "DESCRIPTION-TEMPLATE-LIST": { "TITLE": "Available Description Templates", @@ -1721,7 +1721,7 @@ "TYPE-INFORMATION": " Information" } }, - "DMP-CLONE-DIALOG": { + "PLAN-CLONE-DIALOG": { "TITLE": "Clone", "FIELDS": { "LABEL": "Title of Plan", @@ -1738,7 +1738,7 @@ "TOGGLE-DESCRIPTIONS": "Check/Uncheck" } }, - "DMP-NEW-VERSION-DIALOG": { + "PLAN-NEW-VERSION-DIALOG": { "TITLE": "New Version", "FIELDS": { "LABEL": "Title of Plan", @@ -1757,7 +1757,7 @@ "TOGGLE-DESCRIPTIONS": "Check/Uncheck" } }, - "DMP-CONTACT-PREFILL-DIALOG": { + "PLAN-CONTACT-PREFILL-DIALOG": { "TITLE": "Add ", "TEXT": "Search an existing user where associated with your plans", "FIELDS": { @@ -1768,7 +1768,7 @@ "CONFIRM": "Confirm" } }, - "DMP-USER-INVITATION-DIALOG": { + "PLAN-USER-INVITATION-DIALOG": { "TITLE": "Invite authors", "ACTIONS": { "INVITE": "Invite" @@ -1776,8 +1776,8 @@ "SUCCESS": "Invitation Success", "ERROR": "Invitation Error" }, - "DMP-BLUEPRINT-LISTING": { - "CREATE-DMP-BLUEPRINT": "Create DMP Blueprint", + "PLAN-BLUEPRINT-LISTING": { + "CREATE-PLAN-BLUEPRINT": "Create DMP Blueprint", "FIELDS": { "NAME": "Name", "STATUS": "Status", @@ -1861,7 +1861,7 @@ "FINALIZED": "Finalized", "CANCELED": "Canceled" }, - "DMP-USER-ROLE": { + "PLAN-USER-ROLE": { "OWNER": "Owner", "VIEWER": "Viewer", "DESCRIPTION-CONTRIBUTOR": "Description Contributor", @@ -1870,11 +1870,11 @@ "EXTERNAL-DATASET-TYPE": { "SELECT": "Seçiniz" }, - "DMP": { + "PLAN": { "FINALISED": "Tamamlandı", "DRAFT": "Taslak" }, - "DMP-VISIBILITY": { + "PLAN-VISIBILITY": { "PUBLIC": "Yayınlandı" }, "DESCRIPTION-TEMPLATE-FIELD-VALIDATION-TYPE": { @@ -1885,8 +1885,8 @@ "SELECT": "Select", "BOOLEAN-DECISION": "Boolean Decision", "RADIO-BOX": "Radio Box", - "INTERNAL-DMP-ENTITIES-DMPS": "Internal Plans", - "INTERNAL-DMP-ENTITIES-DESCRIPTIONS": "Internal Descriptions", + "INTERNAL-PLAN-ENTITIES-DMPS": "Internal Plans", + "INTERNAL-PLAN-ENTITIES-DESCRIPTIONS": "Internal Descriptions", "CHECKBOX": "Checkbox", "FREE-TEXT": "Free Text", "TEXT-AREA": "Text Area", @@ -1930,11 +1930,11 @@ "FINALIZED": "Finalized", "DRAFT": "Draft" }, - "DMP-BLUEPRINT-STATUS": { + "PLAN-BLUEPRINT-STATUS": { "FINALIZED": "Finalized", "DRAFT": "Draft" }, - "DMP-BLUEPRINT-SYSTEM-FIELD-TYPE": { + "PLAN-BLUEPRINT-SYSTEM-FIELD-TYPE": { "TITLE": "Title", "DESCRIPTION": "Description", "LANGUAGE": "Language", @@ -1942,7 +1942,7 @@ "ACCESS_RIGHTS": "Access", "USER": "User" }, - "DMP-BLUEPRINT-EXTRA-FIELD-DATA-TYPE": { + "PLAN-BLUEPRINT-EXTRA-FIELD-DATA-TYPE": { "DATE": "Date", "NUMBER": "Number", "TEXT": "Text", @@ -1994,17 +1994,17 @@ "REPLACE": "Replace" }, "NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE": { - "DMP-INVITATION-EXTERNAL-USER": "Plan Invitation External User", - "DMP-INVITATION-EXISTING-USER": "Plan Invitation Existing User", - "DMP-MODIFIED": "Plan Modified", - "DMP-FINALISED": "Plan Finalised", + "PLAN-INVITATION-EXTERNAL-USER": "Plan Invitation External User", + "PLAN-INVITATION-EXISTING-USER": "Plan Invitation Existing User", + "PLAN-MODIFIED": "Plan Modified", + "PLAN-FINALISED": "Plan Finalised", "DESCRIPTION-CREATED": "Description Created", "DESCRIPTION-MODIFIED": "Description Modified", "DESCRIPTION-FINALISED": "Description Finalised", "DESCRIPTION-ANNOTATION-CREATED": "Description Annotation Created", "MERGE-ACCOUNT-CONFIRMATION": "Merge Account Confirmation", "REMOVE-CREDENTIAL-CONFIRMATION": "Remove Credential Confirmation", - "DMP-DEPOSIT": "Plan Deposit", + "PLAN-DEPOSIT": "Plan Deposit", "DESCRIPTION-TEMPLATE-INVITATION": "Description Template Invitation", "CONTACT-SUPPORT": "Contact Support", "PUBLIC-CONTACT-SUPPORT": "Public Contact Support", @@ -2036,7 +2036,7 @@ "ERROR": "Error", "OMITTED": "Omitted" }, - "DMP-ACCESS-TYPE": { + "PLAN-ACCESS-TYPE": { "PUBLIC": "Public", "RESTRICTED": "Restricted Access" }, @@ -2045,11 +2045,11 @@ "REUSED": "Reused dataset", "OTHER": "Other" }, - "DMP-USER-TYPE": { + "PLAN-USER-TYPE": { "INTERNAL": "Internal", "EXTERNAL": "External" }, - "DMP-BLUEPRINT-FIELD-CATEGORY": { + "PLAN-BLUEPRINT-FIELD-CATEGORY": { "SYSTEM": "System", "EXTRA": "Custom", "REFERENCE-TYPE": "External Reference" @@ -2060,9 +2060,9 @@ "TAGS": "Tags" }, "LOCK-TARGET-TYPE": { - "DMP": "Plan", + "PLAN": "Plan", "DESCRIPTION": "Description", - "DMP-BLUEPRINT": "Plan Blueprint", + "PLAN-BLUEPRINT": "Plan Blueprint", "DESCRIPTION-TEMPLATE": "Description Template" } }, @@ -2115,14 +2115,14 @@ "DASHBOARD": { "GRANTS": "Hibeler", "TITLE": "{{ APP_NAME_CAPS }} Nedir?", - "DMP-QUESTION": "{{ APP_NAME }}'taki VYP nedir?", + "PLAN-QUESTION": "{{ APP_NAME }}'taki VYP nedir?", "INFO-TEXT": "{{ APP_NAME_CAPS }} is an open extensible service that simplifies the management, validation, monitoring and maintenance and of Data Management Plans. It allows actors (researchers, managers, supervisors etc) to create actionable DMPs that may be freely exchanged among infrastructures for carrying out specific aspects of the Data management process in accordance with the intentions and commitment of Data owners.", - "INFO-DMP-TEXT": "Bir Veri Yönetim Planı (VYP), bir araştırma ömrü boyunca ve öğrenim ve / veya yeniden kullanılan veri setlerini açıklayan canlı bir belgedir. VYP'ler, araştırmacılara araştırma sonuçları yeniden yeniden dağıtmak ve yeniden kullanım için gerekli bilgileri sağlamayı ve böylece tekrar geçerliliğini ve kullanılmasını sağlamayı amaçlamaktadır.", + "INFO-PLAN-TEXT": "Bir Veri Yönetim Planı (VYP), bir araştırma ömrü boyunca ve öğrenim ve / veya yeniden kullanılan veri setlerini açıklayan canlı bir belgedir. VYP'ler, araştırmacılara araştırma sonuçları yeniden yeniden dağıtmak ve yeniden kullanım için gerekli bilgileri sağlamayı ve böylece tekrar geçerliliğini ve kullanılmasını sağlamayı amaçlamaktadır.", "NEW-QUESTION": "İlk VYP'niz mi? Daha fazla bilgi için gözat", "START-YOUR-FIRST-DMP": "İlk VYP'ni Başlat", "OPEN-AIR-GUIDE": "Araştırmacılar için OpenAIRE Rehberi", "LEARN-MORE": "Nasıl yapılacağı hakkında daha fazla bilgi için gözat!", - "DMPS": "VYP'ları", + "PLANS": "VYP'ları", "PERSONAL-USAGE": "Kişisel Kullanım", "PUBLIC-USAGE": "Genel Kullanım", "DESCRIPTIONS": "Descriptions", @@ -2134,14 +2134,14 @@ "ALL": "Hepsi", "EMPTY-LIST": "Henüz bir şey yok", "LATEST-ACTIVITY": "Son İşlemler", - "DMP-ABOUT-BEG": "{{ APP_NAME }}'taki bir DMP, araştırma veri setlerinin dokümantasyonu, yani, takip edilen adımları ve araştırmayla ilgili amaç, hedefler ve araştırmacılar gibi önemli bilgilerden oluşur. Şöyle ki,", - "DMP-ABOUT-END": ", Veri yönetimi faaliyetlerinde izlenen adımları ve kullanılan araçları vurgulayan", - "SELECT-DMP": "Veri Setiniz için bir VYP seçin", + "PLAN-ABOUT-BEG": "{{ APP_NAME }}'taki bir DMP, araştırma veri setlerinin dokümantasyonu, yani, takip edilen adımları ve araştırmayla ilgili amaç, hedefler ve araştırmacılar gibi önemli bilgilerden oluşur. Şöyle ki,", + "PLAN-ABOUT-END": ", Veri yönetimi faaliyetlerinde izlenen adımları ve kullanılan araçları vurgulayan", + "SELECT-PLAN": "Veri Setiniz için bir VYP seçin", "ACTIONS": { "ADD-DESCRIPTION": "Add Description" }, "TOUR-GUIDE": { - "DMP": "This is your dashboard. You can view and edit all DMPs that you have either contributed to or created yourself.", + "PLAN": "This is your dashboard. You can view and edit all DMPs that you have either contributed to or created yourself.", "START-NEW": "Create your DMP with Start new DMP.", "IMPORT-DMP": "You can import a DMP", "START-WIZARD": "or create new in {{ APP_NAME }}.", @@ -2152,7 +2152,7 @@ }, "ADD-NEW-DESCRIPTION": { "OPTIONS-NOT-ENOUGH": "Are those options not enough?", - "START-NEW-DMP": "Start new DMP", + "START-NEW-PLAN": "Start new DMP", "OPTIONS": { "CREATED-AT": "Created At:" } @@ -2207,7 +2207,7 @@ "EMAILS": "E-Postalar", "YOUR-EMAIL": "E-Postanız" }, - "ASSOCIATED-DMPS": "İlişkili VYP'ları", + "ASSOCIATED-PLANS": "İlişkili VYP'ları", "ROLE-ORGANIZATION": { "FACULTY": "Faculty", "LIBRARIAN": "Librarian", @@ -2234,9 +2234,9 @@ "CANCEL": "İptal" } }, - "DMP-FINALISE-DIALOG": { + "PLAN-FINALISE-DIALOG": { "TITLE": "Finalize this item?", - "DMP": "VYP", + "PLAN": "VYP", "DESCRPIPTIONS": "Descriptions", "EMPTY": "Bu VYP için şu ana kadar Veri Seti yoktur", "FINALISE-TITLE": "Aşağıdaki Taslak Veri Setlerinden herhangi birini sonlandırmak istiyor musunuz?", @@ -2245,8 +2245,8 @@ "INVALID-DMP": "This Plan can not be finalized " }, "IMPACT": "Bu işlem VYP'nızı sonlandıracak ve onu tekrar düzenleyemeyeceksiniz.", - "PUBLIC-DMP-MESSAGE": "After finalizing your Plan, it'll be published and be publicly available to the {{ APP_NAME_CAPS }} tool.", - "RESTRICTED-DMP-MESSAGE": "Your Plan can be published and be publicly available to the {{ APP_NAME_CAPS }} tool after finalization when its access rights are opened. Current access rights: restricted", + "PUBLIC-PLAN-MESSAGE": "After finalizing your Plan, it'll be published and be publicly available to the {{ APP_NAME_CAPS }} tool.", + "RESTRICTED-PLAN-MESSAGE": "Your Plan can be published and be publicly available to the {{ APP_NAME_CAPS }} tool after finalization when its access rights are opened. Current access rights: restricted", "INVALID": "Invalid", "ACTIONS": { "SUBMIT": "Submit", @@ -2254,7 +2254,7 @@ } }, "START-NEW-DESCRIPTION-DIALOG": { - "SELECT-DMP": "Select Plan", + "SELECT-PLAN": "Select Plan", "ACTIONS": { "NEXT": "Next", "CANCEL": "Cancel" diff --git a/dmp-frontend/src/common/base/base-editor.ts b/dmp-frontend/src/common/base/base-editor.ts index 172f5e8e9..6de27e870 100644 --- a/dmp-frontend/src/common/base/base-editor.ts +++ b/dmp-frontend/src/common/base/base-editor.ts @@ -123,7 +123,7 @@ export abstract class BaseEditor { let foundTitle = false; let foundDescription = false; @@ -172,16 +172,16 @@ export function DmpBlueprintSystemFieldRequiredValidator(): ValidatorFn { sectionsFormArray.controls.forEach((section, index) => { const fieldsFormArray = section.get('fields') as UntypedFormArray; if (fieldsFormArray && fieldsFormArray.length > 0) { - if (fieldsFormArray.controls.some(y => (y as UntypedFormGroup).get('systemFieldType')?.value === DmpBlueprintSystemFieldType.Title)) { + if (fieldsFormArray.controls.some(y => (y as UntypedFormGroup).get('systemFieldType')?.value === PlanBlueprintSystemFieldType.Title)) { foundTitle = true; } - if (fieldsFormArray.controls.some(y => (y as UntypedFormGroup).get('systemFieldType')?.value === DmpBlueprintSystemFieldType.Description)) { + if (fieldsFormArray.controls.some(y => (y as UntypedFormGroup).get('systemFieldType')?.value === PlanBlueprintSystemFieldType.Description)) { foundDescription = true; } - if (fieldsFormArray.controls.some(y => (y as UntypedFormGroup).get('systemFieldType')?.value === DmpBlueprintSystemFieldType.Language)) { + if (fieldsFormArray.controls.some(y => (y as UntypedFormGroup).get('systemFieldType')?.value === PlanBlueprintSystemFieldType.Language)) { foundLanguage = true; } - if (fieldsFormArray.controls.some(y => (y as UntypedFormGroup).get('systemFieldType')?.value === DmpBlueprintSystemFieldType.AccessRights)) { + if (fieldsFormArray.controls.some(y => (y as UntypedFormGroup).get('systemFieldType')?.value === PlanBlueprintSystemFieldType.AccessRights)) { foundAccess = true; } } diff --git a/dmp-frontend/src/notification-service/core/formatting/enum-utils.service.ts b/dmp-frontend/src/notification-service/core/formatting/enum-utils.service.ts index d160bd8cf..2b104228e 100644 --- a/dmp-frontend/src/notification-service/core/formatting/enum-utils.service.ts +++ b/dmp-frontend/src/notification-service/core/formatting/enum-utils.service.ts @@ -28,17 +28,17 @@ export class NotificationServiceEnumUtils extends BaseEnumUtilsService { public toNotificationTypeString(value: NotificationType): string { switch (value) { - case NotificationType.dmpInvitationExternalUserType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.DMP-INVITATION-EXTERNAL-USER'); - case NotificationType.dmpInvitationExistingUserType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.DMP-INVITATION-EXISTING-USER'); - case NotificationType.dmpModifiedType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.DMP-MODIFIED'); - case NotificationType.dmpFinalisedType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.DMP-FINALISED'); + case NotificationType.dmpInvitationExternalUserType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.PLAN-INVITATION-EXTERNAL-USER'); + case NotificationType.dmpInvitationExistingUserType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.PLAN-INVITATION-EXISTING-USER'); + case NotificationType.dmpModifiedType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.PLAN-MODIFIED'); + case NotificationType.dmpFinalisedType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.PLAN-FINALISED'); case NotificationType.descriptionCreatedType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.DESCRIPTION-CREATED'); case NotificationType.descriptionModifiedType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.DESCRIPTION-MODIFIED'); case NotificationType.descriptionFinalisedType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.DESCRIPTION-FINALISED'); case NotificationType.descriptionAnnotationCreated: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.DESCRIPTION-ANNOTATION-CREATED'); case NotificationType.mergeAccountConfirmationType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.MERGE-ACCOUNT-CONFIRMATION'); case NotificationType.removeCredentialConfirmationType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.REMOVE-CREDENTIAL-CONFIRMATION'); - case NotificationType.dmpDepositType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.DMP-DEPOSIT'); + case NotificationType.dmpDepositType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.PLAN-DEPOSIT'); case NotificationType.descriptionTemplateInvitationType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.DESCRIPTION-TEMPLATE-INVITATION'); case NotificationType.contactSupportType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.CONTACT-SUPPORT'); case NotificationType.publicContactSupportType: return this.language.instant('TYPES.NOTIFICATION-TEMPLATE-NOTIFICATION-TYPE.PUBLIC-CONTACT-SUPPORT'); From 85b80f6c29a59ac553079440b050df09e2587f15 Mon Sep 17 00:00:00 2001 From: amentis Date: Thu, 4 Jul 2024 17:14:08 +0300 Subject: [PATCH 4/6] small fix --- .../ui/description/editor/description-editor.component.html | 6 +++--- .../components/form-field-set/form-field-set.component.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dmp-frontend/src/app/ui/description/editor/description-editor.component.html b/dmp-frontend/src/app/ui/description/editor/description-editor.component.html index 925c41dce..6d9d1b337 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-editor.component.html +++ b/dmp-frontend/src/app/ui/description/editor/description-editor.component.html @@ -15,9 +15,9 @@
      {{'DESCRIPTION-EDITOR.TITLE-PREVIEW-DESCRIPTION' | translate}}
      -
      + diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/form-field-set.component.ts b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/form-field-set.component.ts index eeb360561..4489e66e3 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/form-field-set.component.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/form-field-set.component.ts @@ -186,7 +186,7 @@ export class DescriptionFormFieldSetComponent extends BaseComponent { entityId: this.descriptionId, anchor: fieldSetId, entityType: AnnotationEntityType.Description, - dmpUsers: this.dmpUsers + planUsers: this.dmpUsers } }); dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(changesMade => { From 4c530140253315bc74ac2e7080f37c88cee1b348 Mon Sep 17 00:00:00 2001 From: Thomas Georgios Giannos Date: Thu, 4 Jul 2024 17:28:21 +0300 Subject: [PATCH 5/6] Added swagger docs for references and their types --- .../controllers/ReferenceController.java | 81 ++- .../controllers/ReferenceTypeController.java | 79 ++- .../controllers/swagger/SwaggerHelpers.java | 493 ++++++++++++++++++ .../web/src/main/resources/config/swagger.yml | 2 +- 4 files changed, 646 insertions(+), 9 deletions(-) diff --git a/backend/web/src/main/java/org/opencdmp/controllers/ReferenceController.java b/backend/web/src/main/java/org/opencdmp/controllers/ReferenceController.java index 403515e62..94707022a 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/ReferenceController.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/ReferenceController.java @@ -12,14 +12,28 @@ 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 io.swagger.v3.oas.annotations.Hidden; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.transaction.Transactional; import jakarta.xml.bind.JAXBException; import org.opencdmp.audit.AuditableAction; import org.opencdmp.authorization.AuthorizationFlags; +import org.opencdmp.controllers.swagger.SwaggerHelpers; +import org.opencdmp.controllers.swagger.annotation.OperationWithTenantHeader; +import org.opencdmp.controllers.swagger.annotation.Swagger400; +import org.opencdmp.controllers.swagger.annotation.Swagger404; +import org.opencdmp.controllers.swagger.annotation.SwaggerCommonErrorResponses; import org.opencdmp.data.ReferenceEntity; import org.opencdmp.model.builder.reference.ReferenceBuilder; import org.opencdmp.model.censorship.reference.ReferenceCensor; import org.opencdmp.model.persist.ReferencePersist; +import org.opencdmp.model.planblueprint.PlanBlueprint; import org.opencdmp.model.reference.Reference; import org.opencdmp.model.result.QueryResult; import org.opencdmp.query.ReferenceQuery; @@ -42,6 +56,8 @@ import java.util.UUID; @RestController @RequestMapping(path = "api/reference") +@Tag(name = "References", description = "Manage references") +@SwaggerCommonErrorResponses public class ReferenceController { private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(ReferenceController.class)); @@ -76,6 +92,25 @@ public class ReferenceController { } @PostMapping("query") + @OperationWithTenantHeader(summary = "Query all references", description = SwaggerHelpers.Reference.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.Reference.endpoint_query_request_body, content = @Content( + examples = { + @ExampleObject( + name = "Pagination and projection", + description = "Simple paginated request using a property projection list and pagination info", + value = SwaggerHelpers.Reference.endpoint_query_request_body_example + ) + } + )), responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content( + array = @ArraySchema( + schema = @Schema( + implementation = Reference.class + ) + ), + examples = @ExampleObject( + name = "First page", + description = "Example with the first page of paginated results", + value = SwaggerHelpers.Reference.endpoint_query_response_example + )))) public QueryResult query(@RequestBody ReferenceLookup lookup) throws MyApplicationException, MyForbiddenException { logger.debug("querying {}", Reference.class.getSimpleName()); @@ -93,6 +128,8 @@ public class ReferenceController { @PostMapping("search") + @Hidden + //TODO thgiannos add swagger docs public List searchReferenceWithDefinition(@RequestBody ReferenceSearchLookup lookup) throws MyNotFoundException, InvalidApplicationException { logger.debug("search with db definition {}", Reference.class.getSimpleName()); @@ -106,7 +143,17 @@ public class ReferenceController { } @GetMapping("find/{referenceTypeId}") - public Boolean findReference(@PathVariable("referenceTypeId") UUID referenceTypeId, @RequestParam("reference") String reference) throws MyNotFoundException { + @OperationWithTenantHeader(summary = "Fetch a specific reference by type id and reference value", description = "", + responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content( + schema = @Schema( + implementation = Boolean.class + )) + )) + @Swagger404 + public Boolean findReference( + @Parameter(name = "referenceTypeId", description = "The type id of a reference to check if it exists", example = "c0c163dc-2965-45a5-9608-f76030578609", required = true) @PathVariable("referenceTypeId") UUID referenceTypeId, + @Parameter(name = "reference", description = "The reference value of a reference to check if it exists", example = "MIT Licence", required = true) @RequestParam("reference") String reference + ) throws MyNotFoundException { logger.debug("search with db definition {}", Reference.class.getSimpleName()); this.censorFactory.censor(ReferenceCensor.class).censor(null, null); @@ -119,7 +166,17 @@ public class ReferenceController { } @GetMapping("{id}") - public Reference get(@PathVariable("id") UUID id, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException { + @OperationWithTenantHeader(summary = "Fetch a specific reference by id", description = "", + responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content( + schema = @Schema( + implementation = Reference.class + )) + )) + @Swagger404 + public Reference get( + @Parameter(name = "id", description = "The id of a reference to fetch", example = "c0c163dc-2965-45a5-9608-f76030578609", required = true) @PathVariable("id") UUID id, + @Parameter(name = "fieldSet", description = SwaggerHelpers.Commons.fieldset_description, required = true) FieldSet fieldSet + ) throws MyApplicationException, MyForbiddenException, MyNotFoundException { logger.debug(new MapLogEntry("retrieving" + Reference.class.getSimpleName()).And("id", id).And("fields", fieldSet)); this.censorFactory.censor(ReferenceCensor.class).censor(fieldSet, null); @@ -138,9 +195,20 @@ public class ReferenceController { } @PostMapping("persist") + @OperationWithTenantHeader(summary = "Create a new or update an existing reference", description = "", + responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content( + schema = @Schema( + implementation = Reference.class + )) + )) + @Swagger400 + @Swagger404 @Transactional @ValidationFilterAnnotation(validator = ReferencePersist.ReferencePersistValidator.ValidatorName, argumentName = "model") - public Reference persist(@RequestBody ReferencePersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, JsonProcessingException, TransformerException { + public Reference persist( + @RequestBody ReferencePersist model, + @Parameter(name = "fieldSet", description = SwaggerHelpers.Commons.fieldset_description, required = true) FieldSet fieldSet + ) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, JsonProcessingException, TransformerException { logger.debug(new MapLogEntry("persisting" + Reference.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet)); this.censorFactory.censor(ReferenceCensor.class).censor(fieldSet, null); @@ -155,8 +223,13 @@ public class ReferenceController { } @DeleteMapping("{id}") + @OperationWithTenantHeader(summary = "Delete a reference by id", description = "", + responses = @ApiResponse(description = "OK", responseCode = "200")) + @Swagger404 @Transactional - public void delete(@PathVariable("id") UUID id) throws MyForbiddenException, InvalidApplicationException { + public void delete( + @Parameter(name = "id", description = "The id of a reference to delete", example = "c0c163dc-2965-45a5-9608-f76030578609", required = true) @PathVariable("id") UUID id + ) throws MyForbiddenException, InvalidApplicationException { logger.debug(new MapLogEntry("retrieving" + Reference.class.getSimpleName()).And("id", id)); this.referenceService.deleteAndSave(id); diff --git a/backend/web/src/main/java/org/opencdmp/controllers/ReferenceTypeController.java b/backend/web/src/main/java/org/opencdmp/controllers/ReferenceTypeController.java index 78c430869..6c500aac8 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/ReferenceTypeController.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/ReferenceTypeController.java @@ -13,14 +13,28 @@ 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 io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.transaction.Transactional; import jakarta.xml.bind.JAXBException; import org.opencdmp.audit.AuditableAction; import org.opencdmp.authorization.AuthorizationFlags; +import org.opencdmp.controllers.swagger.SwaggerHelpers; +import org.opencdmp.controllers.swagger.annotation.OperationWithTenantHeader; +import org.opencdmp.controllers.swagger.annotation.Swagger400; +import org.opencdmp.controllers.swagger.annotation.Swagger404; +import org.opencdmp.controllers.swagger.annotation.SwaggerCommonErrorResponses; import org.opencdmp.data.ReferenceTypeEntity; import org.opencdmp.model.builder.referencetype.ReferenceTypeBuilder; import org.opencdmp.model.censorship.referencetype.ReferenceTypeCensor; import org.opencdmp.model.persist.ReferenceTypePersist; +import org.opencdmp.model.planblueprint.PlanBlueprint; +import org.opencdmp.model.reference.Reference; import org.opencdmp.model.referencetype.ReferenceType; import org.opencdmp.model.result.QueryResult; import org.opencdmp.query.ReferenceTypeQuery; @@ -40,6 +54,8 @@ import java.util.UUID; @RestController @RequestMapping(path = "api/reference-type") +@Tag(name = "Reference types", description = "Manage reference types") +@SwaggerCommonErrorResponses public class ReferenceTypeController{ private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(ReferenceTypeController.class)); @@ -75,6 +91,25 @@ public class ReferenceTypeController{ } @PostMapping("query") + @OperationWithTenantHeader(summary = "Query all reference types", description = SwaggerHelpers.ReferenceType.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.ReferenceType.endpoint_query_request_body, content = @Content( + examples = { + @ExampleObject( + name = "Pagination and projection", + description = "Simple paginated request using a property projection list and pagination info", + value = SwaggerHelpers.ReferenceType.endpoint_query_request_body_example + ) + } + )), responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content( + array = @ArraySchema( + schema = @Schema( + implementation = ReferenceType.class + ) + ), + examples = @ExampleObject( + name = "First page", + description = "Example with the first page of paginated results", + value = SwaggerHelpers.ReferenceType.endpoint_query_response_example + )))) public QueryResult query(@RequestBody ReferenceTypeLookup lookup) throws MyApplicationException, MyForbiddenException { logger.debug("querying {}", ReferenceType.class.getSimpleName()); @@ -91,7 +126,17 @@ public class ReferenceTypeController{ } @GetMapping("{id}") - public ReferenceType get(@PathVariable("id") UUID id, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException { + @OperationWithTenantHeader(summary = "Fetch a specific reference type by id", description = "", + responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content( + schema = @Schema( + implementation = ReferenceType.class + )) + )) + @Swagger404 + public ReferenceType get( + @Parameter(name = "id", description = "The id of a reference type to fetch", example = "c0c163dc-2965-45a5-9608-f76030578609", required = true) @PathVariable("id") UUID id, + @Parameter(name = "fieldSet", description = SwaggerHelpers.Commons.fieldset_description, required = true) FieldSet fieldSet + ) throws MyApplicationException, MyForbiddenException, MyNotFoundException { logger.debug(new MapLogEntry("retrieving" + ReferenceType.class.getSimpleName()).And("id", id).And("fields", fieldSet)); this.censorFactory.censor(ReferenceTypeCensor.class).censor(fieldSet, null); @@ -110,7 +155,17 @@ public class ReferenceTypeController{ } @GetMapping("code/{code}") - public ReferenceType get(@PathVariable("code") String code, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException { + @OperationWithTenantHeader(summary = "Fetch a specific reference type by code", description = "", + responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content( + schema = @Schema( + implementation = ReferenceType.class + )) + )) + @Swagger404 + public ReferenceType get( + @Parameter(name = "code", description = "The code of a reference type to fetch", example = "licences", required = true) @PathVariable("code") String code, + @Parameter(name = "fieldSet", description = SwaggerHelpers.Commons.fieldset_description, required = true) FieldSet fieldSet + ) throws MyApplicationException, MyForbiddenException, MyNotFoundException { logger.debug(new MapLogEntry("retrieving" + ReferenceType.class.getSimpleName()).And("code", code).And("fields", fieldSet)); this.censorFactory.censor(ReferenceTypeCensor.class).censor(fieldSet, null); @@ -129,9 +184,20 @@ public class ReferenceTypeController{ } @PostMapping("persist") + @OperationWithTenantHeader(summary = "Create a new or update an existing reference type", description = "", + responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content( + schema = @Schema( + implementation = ReferenceType.class + )) + )) + @Swagger400 + @Swagger404 @Transactional @ValidationFilterAnnotation(validator = ReferenceTypePersist.ReferenceTypePersistValidator.ValidatorName, argumentName = "model") - public ReferenceType persist(@RequestBody ReferenceTypePersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException, JAXBException, JsonProcessingException, InvalidApplicationException { + public ReferenceType persist( + @RequestBody ReferenceTypePersist model, + @Parameter(name = "fieldSet", description = SwaggerHelpers.Commons.fieldset_description, required = true) FieldSet fieldSet + ) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException, JAXBException, JsonProcessingException, InvalidApplicationException { logger.debug(new MapLogEntry("persisting" + ReferenceType.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet)); this.censorFactory.censor(ReferenceTypeCensor.class).censor(fieldSet, null); @@ -146,8 +212,13 @@ public class ReferenceTypeController{ } @DeleteMapping("{id}") + @OperationWithTenantHeader(summary = "Delete a plan blueprint by id", description = "", + responses = @ApiResponse(description = "OK", responseCode = "200")) + @Swagger404 @Transactional - public void delete(@PathVariable("id") UUID id) throws MyForbiddenException, InvalidApplicationException { + public void delete( + @Parameter(name = "id", description = "The id of a reference type to delete", example = "c0c163dc-2965-45a5-9608-f76030578609", required = true) @PathVariable("id") UUID id + ) throws MyForbiddenException, InvalidApplicationException { logger.debug(new MapLogEntry("retrieving" + ReferenceType.class.getSimpleName()).And("id", id)); this.referenceTypeService.deleteAndSave(id); diff --git a/backend/web/src/main/java/org/opencdmp/controllers/swagger/SwaggerHelpers.java b/backend/web/src/main/java/org/opencdmp/controllers/swagger/SwaggerHelpers.java index 20cea798b..f67d7bbcc 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/swagger/SwaggerHelpers.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/swagger/SwaggerHelpers.java @@ -3086,4 +3086,497 @@ public class SwaggerHelpers { } + public static class Reference { + + public static final String endpoint_query = + """ + This endpoint is used to fetch all the available references.
      + It also allows to restrict the results using a query object passed in the request body.
      + """; + + public static final String endpoint_query_request_body = + """ + Let's explore the options this object gives us. + + ### General query parameters: + +
        +
      • page: + This is an object controlling the pagination of the results. It contains two properties. +
      • +
          +
        • offset: + How many records to omit. +
        • +
        • size: + How many records to include in each page. +
        • +
        +
      + + For example, if we want the third page, and our pages to contain 15 elements, we would pass the following object: + + ```JSON + { + "offset": 30, + "size": 15 + } + ``` + +
        +
      • order: + This is an object controlling the ordering of the results. + It contains a list of strings called items with the names of the properties to use. +
        If the name of the property is prefixed with a '-', the ordering direction is DESC. Otherwise, it is ASC. +
      • +
      + + For example, if we wanted to order based on the field 'createdAt' in descending order, we would pass the following object: + + ```JSON + { + "items": [ + "-createdAt" + ], + } + ``` + +
        +
      • metadata: + This is an object containing metadata for the request. There is only one available option. +
          +
        • countAll: + If this is set to true, the count property included in the response will account for all the records regardless the pagination, + with all the rest of filtering options applied of course. + Otherwise, if it is set to false or not present, only the returned results will be counted. +
          The first option is useful for the UI clients to calculate how many result pages are available. +
        • +
        +
      • +
      • project: + This is an object controlling the data projection of the results. + It contains a list of strings called fields with the names of the properties to project. +
        You can also include properties that are deeper in the object tree by prefixing them with dots. +
      • +
      + + ### Reference specific query parameters: + +
        +
      • like: + If there is a like parameter present in the query, only the reference entities that include the contents of the parameter either in their labels, descriptions or the references will be in the response. +
      • +
      • ids: + This is a list and contains the ids we want to include in the response.
        If empty, every record is included. +
      • +
      • excludedIds: + This is a list and contains the ids we want to exclude from the response.
        If empty, no record gets excluded. +
      • +
      • typeIds: + This is a list and contains the ids of the types of the references we want to include in the response.
        If empty, every record is included. +
      • +
      • isActive: + This is a list and determines which records we want to include in the response, based on if they are deleted or not. + This filter works like this. If we want to view only the active records we pass [1] and for only the deleted records we pass [0]. +
        If not present or if we pass [0,1], every record is included. +
      • +
      • sourceTypes: + This is a list and determines which records we want to include in the response, based on their resource type. + The resource type can only be Internal or External. We add 0 or 1 to the list respectively. +
        If not present, every record is included. +
      • +
      + """; + + public static final String endpoint_query_request_body_example = + """ + { + "project":{ + "fields":[ + "id", + "label", + "createdAt", + "updatedAt", + "isActive", + "reference", + "abbreviation", + "description", + "source", + "sourceType", + "belongsToCurrentTenant" + ] + }, + "metadata":{ + "countAll":true + }, + "page":{ + "offset":0, + "size":10 + }, + "isActive":[ + 1 + ], + "order":{ + "items":[ + "-createdAt" + ] + } + } + """; + + public static final String endpoint_query_response_example = + """ + { + "items":[ + { + "id":"016eba8f-1029-49cc-87eb-bfe17901d940", + "label":"researcher", + "reference":"12344", + "abbreviation":"", + "source":"Internal", + "sourceType":0, + "isActive":1, + "createdAt":"2024-07-04T12:55:40.330369Z", + "updatedAt":"2024-07-04T12:55:40.332366Z", + "belongsToCurrentTenant":true + }, + { + "id":"6d36fefe-94b4-4fce-9e4c-8f7421fdfd83", + "label":"Grant", + "reference":"grantId", + "abbreviation":"", + "source":"Internal", + "sourceType":0, + "isActive":1, + "createdAt":"2024-07-04T12:54:29.108764Z", + "updatedAt":"2024-07-04T12:54:29.110765Z", + "belongsToCurrentTenant":true + }, + { + "id":"1ad6d13b-1dd6-4189-a915-ba082984d185", + "label":"Funder", + "reference":"funderid", + "abbreviation":"", + "source":"Internal", + "sourceType":0, + "isActive":1, + "createdAt":"2024-07-04T12:54:28.936293Z", + "updatedAt":"2024-07-04T12:54:28.939293Z", + "belongsToCurrentTenant":true + }, + { + "id":"9c4c469c-3a86-405c-b09a-8d830957be75", + "label":"Argentine Peso", + "reference":"ARS", + "source":"currencies", + "sourceType":1, + "isActive":1, + "createdAt":"2024-07-04T12:46:52.939455Z", + "updatedAt":"2024-07-04T12:46:52.941187Z", + "belongsToCurrentTenant":true + }, + { + "id":"7128614f-3f34-4844-9cbf-39bce1e12d7a", + "label":"ADHDgene", + "reference":"fairsharing_::1549", + "source":"openaire", + "sourceType":1, + "isActive":1, + "createdAt":"2024-07-04T12:46:52.723995Z", + "updatedAt":"2024-07-04T12:46:52.726995Z", + "belongsToCurrentTenant":true + }, + { + "id":"3ba9da7d-5745-4686-a3fb-bc3cce4044b2", + "label":"Cite Project", + "reference":"cite_project", + "source":"project", + "sourceType":1, + "isActive":1, + "createdAt":"2024-07-04T12:39:12.784789Z", + "updatedAt":"2024-07-04T12:39:12.786810Z", + "belongsToCurrentTenant":true + }, + { + "id":"84796db1-633d-4de7-af4d-b7fe5fad16c0", + "label":"A Randomized, Double-Blind, Placebo-Controlled, Multi-Center Study to Evaluate the Efficacy of ManNAc in Subjects with GNE Myopathy (nih_________::5U01AR070498-04)", + "reference":"nih_________::5U01AR070498-04", + "source":"openaire", + "sourceType":1, + "isActive":1, + "createdAt":"2024-07-04T12:39:12.564228Z", + "updatedAt":"2024-07-04T12:39:12.567428Z", + "belongsToCurrentTenant":true + }, + { + "id":"067d98cb-c4af-4958-a197-0c248afc9fe9", + "label":"FCT - Fundação para a Ciência e a Teconlogia", + "reference":"//ror.org/00snfqn58", + "source":"openaire", + "sourceType":1, + "isActive":1, + "createdAt":"2024-06-27T13:50:15.644509Z", + "updatedAt":"2024-06-27T13:50:15.644509Z", + "belongsToCurrentTenant":true + }, + { + "id":"8ea35687-229a-4c3b-95ec-b3c92b0963b0", + "label":"BuG@Sbase", + "reference":"fairsharing_::1556", + "source":"openaire", + "sourceType":1, + "isActive":1, + "createdAt":"2024-06-27T13:50:14.273886Z", + "updatedAt":"2024-06-27T13:50:14.273886Z", + "belongsToCurrentTenant":true + }, + { + "id":"503037eb-a2d1-4bb7-aa23-afecebb3fee0", + "label":"Amilya Agustina (orcid:0000-0002-9102-1506)", + "reference":"0000-0002-9102-1506", + "source":"orcid", + "sourceType":1, + "isActive":1, + "createdAt":"2024-06-27T13:50:14.230997Z", + "updatedAt":"2024-06-27T13:50:14.230997Z", + "belongsToCurrentTenant":true + } + ], + "count":14270 + } + """; + + } + + public static class ReferenceType { + + public static final String endpoint_query = + """ + This endpoint is used to fetch all the available reference types.
      + It also allows to restrict the results using a query object passed in the request body.
      + """; + + public static final String endpoint_query_request_body = + """ + Let's explore the options this object gives us. + + ### General query parameters: + +
        +
      • page: + This is an object controlling the pagination of the results. It contains two properties. +
      • +
          +
        • offset: + How many records to omit. +
        • +
        • size: + How many records to include in each page. +
        • +
        +
      + + For example, if we want the third page, and our pages to contain 15 elements, we would pass the following object: + + ```JSON + { + "offset": 30, + "size": 15 + } + ``` + +
        +
      • order: + This is an object controlling the ordering of the results. + It contains a list of strings called items with the names of the properties to use. +
        If the name of the property is prefixed with a '-', the ordering direction is DESC. Otherwise, it is ASC. +
      • +
      + + For example, if we wanted to order based on the field 'createdAt' in descending order, we would pass the following object: + + ```JSON + { + "items": [ + "-createdAt" + ], + } + ``` + +
        +
      • metadata: + This is an object containing metadata for the request. There is only one available option. +
          +
        • countAll: + If this is set to true, the count property included in the response will account for all the records regardless the pagination, + with all the rest of filtering options applied of course. + Otherwise, if it is set to false or not present, only the returned results will be counted. +
          The first option is useful for the UI clients to calculate how many result pages are available. +
        • +
        +
      • +
      • project: + This is an object controlling the data projection of the results. + It contains a list of strings called fields with the names of the properties to project. +
        You can also include properties that are deeper in the object tree by prefixing them with dots. +
      • +
      + + ### Reference type specific query parameters: + +
        +
      • like: + If there is a like parameter present in the query, only the reference entities that include the contents of the parameter either in their names or their codes will be in the response. +
      • +
      • ids: + This is a list and contains the ids we want to include in the response.
        If empty, every record is included. +
      • +
      • excludedIds: + This is a list and contains the ids we want to exclude from the response.
        If empty, no record gets excluded. +
      • +
      • isActive: + This is a list and determines which records we want to include in the response, based on if they are deleted or not. + This filter works like this. If we want to view only the active records we pass [1] and for only the deleted records we pass [0]. +
        If not present or if we pass [0,1], every record is included. +
      • +
      • codes: + This is a list and determines which records we want to include in the response, based on their code. +
        If not present, every record is included. +
      • +
      + """; + + public static final String endpoint_query_request_body_example = + """ + { + "project":{ + "fields":[ + "id", + "name", + "code", + "createdAt", + "updatedAt", + "isActive", + "belongsToCurrentTenant" + ] + }, + "metadata":{ + "countAll":true + }, + "page":{ + "offset":0, + "size":10 + }, + "isActive":[ + 1 + ], + "order":{ + "items":[ + "-createdAt" + ] + } + } + """; + + public static final String endpoint_query_response_example = + """ + { + "items":[ + { + "id":"7f4ea357-27ae-45bb-9588-551f1d926760", + "name":"Select format(s)", + "code":"Select format(s)", + "isActive":1, + "createdAt":"2024-06-27T13:06:56.928007Z", + "updatedAt":"2024-06-27T13:06:56.931006Z", + "belongsToCurrentTenant":true + }, + { + "id":"92186655-166c-463c-9898-82e25f2f010a", + "name":"Metadata Services", + "code":"Metadata Services", + "isActive":1, + "createdAt":"2024-06-27T13:06:56.845006Z", + "updatedAt":"2024-06-27T13:06:56.854006Z", + "belongsToCurrentTenant":true + }, + { + "id":"a3ce0fb2-d72c-48bb-b322-7401940cb802", + "name":"Datasets", + "code":"datasets", + "isActive":1, + "createdAt":"2023-11-17T10:26:55.332111Z", + "updatedAt":"2024-05-01T10:34:07.029327Z", + "belongsToCurrentTenant":true + }, + { + "id":"7eeffb98-58fb-4921-82ec-e27f32f8e738", + "name":"Organisations", + "code":"organisations", + "isActive":1, + "createdAt":"2023-11-17T10:13:15.873808Z", + "updatedAt":"2024-02-16T15:35:47.874131Z", + "belongsToCurrentTenant":true + }, + { + "id":"3d372db5-a456-45e6-a845-e41e1a8311f8", + "name":"Projects", + "code":"projects", + "isActive":1, + "createdAt":"2023-11-17T08:55:05.190807Z", + "updatedAt":"2023-11-17T08:56:23.012619Z", + "belongsToCurrentTenant":true + }, + { + "id":"5a2112e7-ea99-4cfe-98a1-68665e26726e", + "name":"Researchers", + "code":"researchers", + "isActive":1, + "createdAt":"2023-11-16T18:21:43.272982Z", + "updatedAt":"2024-04-17T09:44:53.656849Z", + "belongsToCurrentTenant":true + }, + { + "id":"9ec2000d-95c7-452e-b356-755fc8e2574c", + "name":"Services", + "code":"services", + "isActive":1, + "createdAt":"2023-11-16T17:57:22.081053Z", + "updatedAt":"2024-02-16T09:07:13.944104Z", + "belongsToCurrentTenant":true + }, + { + "id":"ab7cdd93-bea2-440d-880d-3846dad80b21", + "name":"Taxonomies", + "code":"taxonomies", + "isActive":1, + "createdAt":"2023-11-16T17:48:09.769599Z", + "updatedAt":"2024-04-25T12:36:57.923984Z", + "belongsToCurrentTenant":true + }, + { + "id":"8ec7556b-749d-4c4a-a4b9-43d064693795", + "name":"Journals", + "code":"journals", + "isActive":1, + "createdAt":"2023-11-16T17:40:12.811667Z", + "updatedAt":"2024-02-16T09:09:22.816978Z", + "belongsToCurrentTenant":true + }, + { + "id":"1e927daa-b856-443f-96da-22f325f7322f", + "name":"Publication Repositories", + "code":"pubRepositories", + "isActive":1, + "createdAt":"2023-11-16T17:17:40.882679Z", + "updatedAt":"2024-05-01T11:52:50.297337Z", + "belongsToCurrentTenant":true + } + ], + "count":17 + } + """; + + } + } diff --git a/backend/web/src/main/resources/config/swagger.yml b/backend/web/src/main/resources/config/swagger.yml index 73ffb5983..2d97790b1 100644 --- a/backend/web/src/main/resources/config/swagger.yml +++ b/backend/web/src/main/resources/config/swagger.yml @@ -11,7 +11,7 @@ springdoc: displayName: Current packagesToScan: org.opencdmp.controllers packagesToExclude: org.opencdmp.controllers.publicapi - pathsToMatch: "/api/dmp/**, /api/description/**, /api/description-template/**, /api/description-template-type/**, /api/dmp-blueprint/**, /api/entity-doi/**, /api/deposit/**, /api/file-transformer/**, /api/tag/**" + pathsToMatch: "/api/plan/**, /api/description/**, /api/description-template/**, /api/description-template-type/**, /api/plan-blueprint/**, /api/entity-doi/**, /api/deposit/**, /api/file-transformer/**, /api/tag/**, /api/reference/**, /api/reference-type/**" swaggerUi: enabled: true useRootPath: true From 4c6ac16f890bd5441bb278ec9f5c88ccc48f2d3b Mon Sep 17 00:00:00 2001 From: Thomas Georgios Giannos Date: Thu, 4 Jul 2024 17:32:00 +0300 Subject: [PATCH 6/6] Small docs update --- docs/docs/documentation/for-devs/apis/swagger.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/docs/documentation/for-devs/apis/swagger.md b/docs/docs/documentation/for-devs/apis/swagger.md index aa0d809b3..35107c654 100644 --- a/docs/docs/documentation/for-devs/apis/swagger.md +++ b/docs/docs/documentation/for-devs/apis/swagger.md @@ -32,6 +32,9 @@ The swagger UI is available at the `/swagger-ui/index.html` url. It contains doc - **/api/entity-doi/\*\*** - **/api/deposit/\*\*** - **/api/file-transformer/\*\*** + - **/api/tag/\*\*** + - **/api/reference/\*\*** + - **/api/reference-type/\*\***

      These endpoints require authentication.