From 9f3a029b19d6a79a948848bdc091ef0673630f76 Mon Sep 17 00:00:00 2001 From: amentis Date: Fri, 5 Jul 2024 13:20:01 +0300 Subject: [PATCH] rename dmp --- .../authorization/AuthorizationFlags.java | 6 +- .../opencdmp/authorization/Permission.java | 8 +- .../AuthorizationContentResolverImpl.java | 36 +-- .../opencdmp/commons/enums/EntityType.java | 2 +- .../org/opencdmp/commons/enums/FieldType.java | 6 +- .../commons/enums/LockTargetType.java | 4 +- .../notification/NotificationProperties.java | 50 ++-- .../PlanInvitationEntity.java | 6 +- .../plan/importexport/PlanImportExport.java | 2 +- .../data/DescriptionElasticEntity.java | 14 +- .../elastic/data/PlanElasticEntity.java | 6 +- .../NestedDescriptionElasticEntity.java | 4 +- ...dPlanDescriptionTemplateElasticEntity.java | 4 +- .../DescriptionElasticBuilder.java | 2 +- .../elasticbuilder/PlanElasticBuilder.java | 2 +- .../query/DescriptionElasticQuery.java | 24 +- ....java => InnerObjectPlanElasticQuery.java} | 60 ++--- .../query/NestedDescriptionElasticQuery.java | 4 +- ...edPlanDescriptionTemplateElasticQuery.java | 6 +- .../elastic/query/PlanElasticQuery.java | 12 +- .../errorcode/ErrorThesaurusProperties.java | 150 +++++------ ...ityCreatedIntegrationEventHandlerImpl.java | 8 +- ...ityChangedIntegrationEventHandlerImpl.java | 8 +- .../outbox/OutboxIntegrationEvent.java | 2 +- .../outbox/OutboxProperties.java | 10 +- .../outbox/OutboxRepositoryImpl.java | 4 +- ...nEntityRemovalIntegrationEventHandler.java | 2 +- ...ityRemovalIntegrationEventHandlerImpl.java | 8 +- ...ityTouchedIntegrationEventHandlerImpl.java | 16 +- .../opencdmp/model/DashboardStatistics.java | 13 +- .../model/PlanDescriptionTemplate.java | 4 +- .../model/RecentActivityItemLookup.java | 14 +- .../PlanDescriptionTemplateBuilder.java | 2 +- .../model/builder/PublicPlanBuilder.java | 2 +- .../ActionConfirmationBuilder.java | 4 +- .../BaseFieldDataCommonModelBuilder.java | 2 +- .../plan/PlanCommonModelBuilder.java | 8 +- .../DefinitionCommonModelBuilder.java | 2 +- .../FieldCommonModelBuilder.java | 2 +- .../SectionCommonModelBuilder.java | 2 +- .../builder/description/FieldBuilder.java | 2 +- .../plan/PlanBlueprintValueBuilder.java | 16 +- .../model/builder/plan/PlanBuilder.java | 8 +- .../builder/plan/PlanPropertiesBuilder.java | 4 +- .../planblueprint/DefinitionBuilder.java | 2 +- .../DescriptionTemplateBuilder.java | 2 +- .../builder/planblueprint/FieldBuilder.java | 2 +- .../builder/planblueprint/SectionBuilder.java | 2 +- .../model/censorship/PublicPlanCensor.java | 2 +- .../censorship/PublicPlanReferenceCensor.java | 2 +- .../censorship/PublicPlanUserCensor.java | 2 +- .../censorship/plan/PlanContactCensor.java | 2 +- .../censorship/plan/PlanPropertiesCensor.java | 6 +- .../planblueprint/DefinitionCensor.java | 2 +- .../DescriptionTemplatesCensor.java | 2 +- .../censorship/planblueprint/FieldCensor.java | 2 +- .../planblueprint/SectionCensor.java | 2 +- .../opencdmp/model/deleter/PlanDeleter.java | 6 +- .../publicapi/PlanToPublicApiPlanMapper.java | 4 +- .../opencdmp/model/persist/PlanPersist.java | 2 +- .../descriptionproperties/FieldPersist.java | 3 +- .../RulePersist.java | 2 +- .../fielddata/BaseFieldDataPersist.java | 2 +- .../DefinitionPersist.java | 2 +- .../DescriptionTemplatePersist.java | 2 +- .../ExtraFieldPersist.java | 2 +- .../ReferenceTypeFieldPersist.java | 2 +- .../SectionPersist.java | 2 +- .../SystemFieldPersist.java | 2 +- .../AssociatedProfilePublicModel.java | 4 +- .../grant/GrantPublicOverviewModel.java | 2 +- .../organisation/OrganizationPublicModel.java | 2 +- .../org/opencdmp/query/DescriptionQuery.java | 10 +- .../query/DescriptionReferenceQuery.java | 2 +- .../query/DescriptionTemplateQuery.java | 8 +- .../org/opencdmp/query/EntityDoiQuery.java | 2 +- .../query/PlanDescriptionTemplateQuery.java | 4 +- .../java/org/opencdmp/query/PlanQuery.java | 6 +- .../opencdmp/query/PlanReferenceQuery.java | 8 +- .../org/opencdmp/query/PlanUserQuery.java | 6 +- .../org/opencdmp/query/ReferenceQuery.java | 6 +- .../java/org/opencdmp/query/TagQuery.java | 2 +- .../opencdmp/query/UserContactInfoQuery.java | 2 +- .../java/org/opencdmp/query/UserQuery.java | 10 +- .../org/opencdmp/query/UserSettingsQuery.java | 2 +- .../query/lookup/DescriptionLookup.java | 4 +- .../org/opencdmp/query/lookup/PlanLookup.java | 12 +- .../query/utils/QueryUtilsService.java | 14 +- .../query/utils/QueryUtilsServiceImpl.java | 12 +- .../ActionConfirmationServiceImpl.java | 4 +- .../dashborad/DashboardServiceImpl.java | 32 +-- .../service/deposit/DepositServiceImpl.java | 24 +- .../description/DescriptionServiceImpl.java | 18 +- .../DescriptionTemplateServiceImpl.java | 8 +- .../service/elastic/AppElasticProperties.java | 10 +- .../service/elastic/ElasticService.java | 4 +- .../service/elastic/ElasticServiceImpl.java | 46 ++-- .../entitydoi/EntityDoiServiceImpl.java | 2 +- .../FieldDataHelperServiceProvider.java | 2 +- .../FileTransformerService.java | 6 +- .../FileTransformerServiceImpl.java | 10 +- .../service/lock/LockServiceImpl.java | 8 +- .../maintenance/MaintenanceService.java | 2 +- .../maintenance/MaintenanceServiceImpl.java | 10 +- .../service/metrics/MetricsServiceImpl.java | 8 +- .../opencdmp/service/plan/PlanService.java | 2 +- .../service/plan/PlanServiceImpl.java | 244 +++++++++--------- .../planblueprint/PlanBlueprintService.java | 4 +- .../PlanBlueprintServiceImpl.java | 124 ++++----- .../PrefillingSourceServiceImpl.java | 2 +- .../service/user/UserServiceImpl.java | 24 +- .../visibility/VisibilityServiceImpl.java | 2 +- .../AffiliatedAuthorizationHandler.java | 2 +- .../CustomPermissionAttributesProperties.java | 10 +- .../controllers/DescriptionController.java | 3 +- .../FileTransformerController.java | 5 +- .../opencdmp/controllers/LockController.java | 12 +- .../controllers/MaintenanceController.java | 10 +- .../opencdmp/controllers/PlanController.java | 3 +- .../opencdmp/controllers/UserController.java | 2 +- ...ublicDatasetsDescriptionDocumentation.java | 4 +- .../main/resources/config/elasticsearch.yml | 2 +- .../web/src/main/resources/config/errors.yml | 46 ++-- .../resources/config/notification-devel.yml | 10 +- .../src/main/resources/config/permissions.yml | 42 +-- .../web/src/main/resources/config/queue.yml | 2 +- .../src/main/resources/messages.properties | 2 +- .../enum/description-template-field-type.ts | 2 +- .../src/app/core/common/enum/entity-type.ts | 2 +- .../app/core/common/enum/lock-target-type.ts | 2 +- .../app/core/common/enum/permission.enum.ts | 2 +- .../common/enum/recent-activity-item-type.ts | 2 +- .../model/dashboard/dashboard-statistics.ts | 2 +- .../src/app/core/pipes/field-value.pipe.ts | 2 +- .../recent-activity-item-lookup.lookup.ts | 4 +- .../file-transformer.http.service.ts | 4 +- .../file-transformer.service.ts | 4 +- .../maintenance/maintenance.service.ts | 4 +- .../services/utilities/enum-utils.service.ts | 4 +- ...n-template-editor-field-set.component.html | 4 +- ...ion-template-editor-field-set.component.ts | 2 +- ...ption-template-editor-field.component.html | 6 +- ...ription-template-editor-field.component.ts | 4 +- ...mplate-editor-visibility-rule.component.ts | 2 +- .../description-template-editor.model.ts | 2 +- .../maintenance-tasks.component.html | 2 +- .../maintenance-tasks.component.ts | 4 +- .../app/ui/dashboard/dashboard.component.html | 6 +- .../app/ui/dashboard/dashboard.component.ts | 4 +- .../recent-edited-activity.component.ts | 4 +- .../editor/description-editor.model.ts | 4 +- .../form-field/form-field.component.html | 2 +- .../visibility-rules.service.ts | 2 +- .../plan-listing-item.component.html | 2 +- .../overview/plan-overview.component.html | 2 +- .../plan-editor.component.html | 2 +- .../plan-editor.component.ts | 2 +- .../src/app/ui/sidebar/sidebar.component.ts | 2 +- 158 files changed, 784 insertions(+), 789 deletions(-) rename backend/core/src/main/java/org/opencdmp/elastic/query/{InnerObjectDmpElasticQuery.java => InnerObjectPlanElasticQuery.java} (81%) diff --git a/backend/core/src/main/java/org/opencdmp/authorization/AuthorizationFlags.java b/backend/core/src/main/java/org/opencdmp/authorization/AuthorizationFlags.java index bf8554aac..e6db6727d 100644 --- a/backend/core/src/main/java/org/opencdmp/authorization/AuthorizationFlags.java +++ b/backend/core/src/main/java/org/opencdmp/authorization/AuthorizationFlags.java @@ -3,7 +3,7 @@ package org.opencdmp.authorization; import java.util.EnumSet; public enum AuthorizationFlags { - None, Permission, DmpAssociated, Public, Owner, DescriptionTemplateAssociated; - public static final EnumSet AllExceptPublic = EnumSet.of(DmpAssociated, Permission, Owner, DescriptionTemplateAssociated); - public static final EnumSet All = EnumSet.of(DmpAssociated, Permission, Owner, Public); + None, Permission, PlanAssociated, Public, Owner, DescriptionTemplateAssociated; + public static final EnumSet AllExceptPublic = EnumSet.of(PlanAssociated, Permission, Owner, DescriptionTemplateAssociated); + public static final EnumSet All = EnumSet.of(PlanAssociated, Permission, Owner, Public); } 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 df9ac7e43..0d1fa6add 100644 --- a/backend/core/src/main/java/org/opencdmp/authorization/Permission.java +++ b/backend/core/src/main/java/org/opencdmp/authorization/Permission.java @@ -7,9 +7,9 @@ public final class Permission { //Public public static String PublicBrowseDescription = "PublicBrowseDescription"; public static String PublicBrowseDescriptionTemplate = "PublicBrowseDescriptionTemplate"; - public static String PublicBrowseDmp = "PublicBrowseDmp"; - public static String PublicBrowseDmpReference = "PublicBrowseDmpReference"; - public static String PublicBrowseDmpUser = "PublicBrowseDmpUser"; + public static String PublicBrowsePlan = "PublicBrowsePlan"; + public static String PublicBrowsePlanReference = "PublicBrowsePlanReference"; + public static String PublicBrowsePlanUser = "PublicBrowsePlanUser"; public static String PublicBrowseReference = "PublicBrowseReference"; public static String PublicBrowseUser = "PublicBrowseUser"; public static String PublicBrowseDashboardStatistics = "PublicBrowseDashboardStatistics"; @@ -223,7 +223,7 @@ public final class Permission { public static String ViewDescriptionTemplatePage = "ViewDescriptionTemplatePage"; public static String ViewPlanBlueprintPage = "ViewPlanBlueprintPage"; public static String ViewPublicDescriptionPage = "ViewPublicDescriptionPage"; - public static String ViewPublicDmpPage = "ViewPublicDmpPage"; + public static String ViewPublicPlanPage = "ViewPublicPlanPage"; public static String ViewMyDescriptionPage = "ViewMyDescriptionPage"; public static String ViewMyPlanPage = "ViewMyPlanPage"; public static String ViewHomePage = "ViewHomePage"; 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 7a0aa4eb0..e2ff60441 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 @@ -67,10 +67,10 @@ public class AuthorizationContentResolverImpl implements AuthorizationContentRes List idsToResolve = this.getAffiliatedFromCache(ids, userId, affiliatedResources, PlanEntity.class.getSimpleName()); if (idsToResolve.isEmpty()) return affiliatedResources; - List dmpUsers; + List planUsers; try { this.tenantEntityManager.loadExplictTenantFilters(); - 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)); + planUsers = 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,8 +82,8 @@ public class AuthorizationContentResolverImpl implements AuthorizationContentRes throw new MyApplicationException(e.getMessage()); } } - for (PlanUserEntity dmpUser : dmpUsers){ - affiliatedResources.get(dmpUser.getPlanId()).getPlanUserRoles().add(dmpUser.getRole()); + for (PlanUserEntity planUser : planUsers){ + affiliatedResources.get(planUser.getPlanId()).getPlanUserRoles().add(planUser.getRole()); } this.ensureAffiliatedInCache(idsToResolve, userId, affiliatedResources, PlanEntity.class.getSimpleName()); @@ -123,8 +123,8 @@ public class AuthorizationContentResolverImpl implements AuthorizationContentRes } } - for (UserDescriptionTemplateEntity dmpUser : userDescriptionTemplates){ - affiliatedResources.get(dmpUser.getDescriptionTemplateId()).getUserDescriptionTemplateRoles().add(dmpUser.getRole()); + for (UserDescriptionTemplateEntity planUser : userDescriptionTemplates){ + affiliatedResources.get(planUser.getDescriptionTemplateId()).getUserDescriptionTemplateRoles().add(planUser.getRole()); } this.ensureAffiliatedInCache(idsToResolve, userId, affiliatedResources, DescriptionTemplateEntity.class.getSimpleName()); @@ -199,13 +199,13 @@ public class AuthorizationContentResolverImpl implements AuthorizationContentRes Map> planUsersMap = planUsers.stream().collect(Collectors.groupingBy(PlanUserEntity::getPlanId)); for (DescriptionEntity description : descriptionEntities){ - List dmpDescriptionUsers = planUsersMap.getOrDefault(description.getPlanId(), new ArrayList<>()); - for (PlanUserEntity dmpUser : dmpDescriptionUsers) { - if (dmpUser.getSectionId() == null) affiliatedResources.get(description.getId()).getPlanUserRoles().add(dmpUser.getRole()); + List planDescriptionUsers = planUsersMap.getOrDefault(description.getPlanId(), new ArrayList<>()); + for (PlanUserEntity planUser : planDescriptionUsers) { + if (planUser.getSectionId() == null) affiliatedResources.get(description.getId()).getPlanUserRoles().add(planUser.getRole()); else { PlanDescriptionTemplateEntity planDescriptionTemplateEntity = planDescriptionTemplateEntityMap.getOrDefault(description.getPlanDescriptionTemplateId(), null); - if (planDescriptionTemplateEntity != null && dmpUser.getSectionId().equals(planDescriptionTemplateEntity.getSectionId())){ - affiliatedResources.get(description.getId()).getPlanUserRoles().add(dmpUser.getRole()); + if (planDescriptionTemplateEntity != null && planUser.getSectionId().equals(planDescriptionTemplateEntity.getSectionId())){ + affiliatedResources.get(description.getId()).getPlanUserRoles().add(planUser.getRole()); } } } @@ -230,10 +230,10 @@ public class AuthorizationContentResolverImpl implements AuthorizationContentRes if (userId == null || !this.userScope.isSet()) return affiliatedResources; - List dmpUsers; + List planUsers; try { this.tenantEntityManager.loadExplictTenantFilters(); - 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)); + planUsers = 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 (PlanUserEntity dmpUser : dmpSectionUsers) { - if (dmpUser.getSectionId() == null) affiliatedResources.get(sectionId).getPlanUserRoles().add(dmpUser.getRole()); + List planSectionUsers = planUsers.stream().filter(x-> x.getSectionId() == null || x.getSectionId().equals(sectionId)).toList(); + for (PlanUserEntity planUser : planSectionUsers) { + if (planUser.getSectionId() == null) affiliatedResources.get(sectionId).getPlanUserRoles().add(planUser.getRole()); else { - if (dmpUser.getSectionId().equals(sectionId)){ - affiliatedResources.get(sectionId).getPlanUserRoles().add(dmpUser.getRole()); + if (planUser.getSectionId().equals(sectionId)){ + affiliatedResources.get(sectionId).getPlanUserRoles().add(planUser.getRole()); } } } diff --git a/backend/core/src/main/java/org/opencdmp/commons/enums/EntityType.java b/backend/core/src/main/java/org/opencdmp/commons/enums/EntityType.java index 15ae70af4..03b1d343a 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/enums/EntityType.java +++ b/backend/core/src/main/java/org/opencdmp/commons/enums/EntityType.java @@ -7,7 +7,7 @@ import java.util.Map; public enum EntityType implements DatabaseEnum { - DMP((short) 0); + Plan((short) 0); private final Short value; diff --git a/backend/core/src/main/java/org/opencdmp/commons/enums/FieldType.java b/backend/core/src/main/java/org/opencdmp/commons/enums/FieldType.java index 9ccc51839..f75551a0a 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/enums/FieldType.java +++ b/backend/core/src/main/java/org/opencdmp/commons/enums/FieldType.java @@ -9,7 +9,7 @@ public enum FieldType implements DatabaseEnum { SELECT(Names.Select), BOOLEAN_DECISION(Names.BooleanDecision), RADIO_BOX(Names.RadioBox), - INTERNAL_ENTRIES_DMPS(Names.InternalEntitiesDmps), + INTERNAL_ENTRIES_PLANS(Names.InternalEntitiesPlans), INTERNAL_ENTRIES_DESCRIPTIONS(Names.InternalEntitiesDescriptions), CHECK_BOX(Names.CheckBox), FREE_TEXT(Names.FreeText), @@ -27,7 +27,7 @@ public enum FieldType implements DatabaseEnum { public static final String Select = "select"; public static final String BooleanDecision = "booleanDecision"; public static final String RadioBox = "radiobox"; - public static final String InternalEntitiesDmps = "internalEntitiesDmps"; + public static final String InternalEntitiesPlans = "internalEntitiesPlans"; public static final String InternalEntitiesDescriptions = "internalEntitiesDescriptions"; public static final String CheckBox = "checkBox"; public static final String FreeText = "freetext"; @@ -68,7 +68,7 @@ public enum FieldType implements DatabaseEnum { } public static boolean isTextListType(FieldType fieldType){ - return fieldType.equals(FieldType.SELECT) || fieldType.equals(FieldType.INTERNAL_ENTRIES_DMPS) || + return fieldType.equals(FieldType.SELECT) || fieldType.equals(FieldType.INTERNAL_ENTRIES_PLANS) || fieldType.equals(FieldType.INTERNAL_ENTRIES_DESCRIPTIONS); } diff --git a/backend/core/src/main/java/org/opencdmp/commons/enums/LockTargetType.java b/backend/core/src/main/java/org/opencdmp/commons/enums/LockTargetType.java index 56b27b270..630fb9174 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/enums/LockTargetType.java +++ b/backend/core/src/main/java/org/opencdmp/commons/enums/LockTargetType.java @@ -6,9 +6,9 @@ import org.opencdmp.data.converters.enums.DatabaseEnum; import java.util.Map; public enum LockTargetType implements DatabaseEnum { - Dmp((short) 0), + Plan((short) 0), Description((short) 1), - DmpBlueprint((short) 2), + PlanBlueprint((short) 2), DescriptionTemplate((short) 3); private final Short value; diff --git a/backend/core/src/main/java/org/opencdmp/commons/notification/NotificationProperties.java b/backend/core/src/main/java/org/opencdmp/commons/notification/NotificationProperties.java index ba05e75af..b4a088daa 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/notification/NotificationProperties.java +++ b/backend/core/src/main/java/org/opencdmp/commons/notification/NotificationProperties.java @@ -7,10 +7,10 @@ import java.util.UUID; @ConfigurationProperties(prefix = "notification") public class NotificationProperties { - private UUID dmpInvitationExternalUserType; - private UUID dmpInvitationExistingUserType; - private UUID dmpModifiedType; - private UUID dmpFinalisedType; + private UUID planInvitationExternalUserType; + private UUID planInvitationExistingUserType; + private UUID planModifiedType; + private UUID planFinalisedType; private UUID descriptionCreatedType; private UUID descriptionModifiedType; private UUID descriptionFinalisedType; @@ -18,7 +18,7 @@ public class NotificationProperties { private UUID descriptionAnnotationStatusChanged; private UUID mergeAccountConfirmationType; private UUID removeCredentialConfirmationType; - private UUID dmpDepositType; + private UUID planDepositType; private UUID descriptionTemplateInvitationType; private UUID contactSupportType; private UUID publicContactSupportType; @@ -27,36 +27,36 @@ public class NotificationProperties { private int emailExpirationTimeSeconds; private String contactSupportEmail; - public UUID getDmpInvitationExternalUserType() { - return this.dmpInvitationExternalUserType; + public UUID getPlanInvitationExternalUserType() { + return this.planInvitationExternalUserType; } - public void setDmpInvitationExternalUserType(UUID dmpInvitationExternalUserType) { - this.dmpInvitationExternalUserType = dmpInvitationExternalUserType; + public void setPlanInvitationExternalUserType(UUID planInvitationExternalUserType) { + this.planInvitationExternalUserType = planInvitationExternalUserType; } - public UUID getDmpInvitationExistingUserType() { - return this.dmpInvitationExistingUserType; + public UUID getPlanInvitationExistingUserType() { + return this.planInvitationExistingUserType; } - public void setDmpInvitationExistingUserType(UUID dmpInvitationExistingUserType) { - this.dmpInvitationExistingUserType = dmpInvitationExistingUserType; + public void setPlanInvitationExistingUserType(UUID planInvitationExistingUserType) { + this.planInvitationExistingUserType = planInvitationExistingUserType; } - public UUID getDmpModifiedType() { - return this.dmpModifiedType; + public UUID getPlanModifiedType() { + return this.planModifiedType; } - public void setDmpModifiedType(UUID dmpModifiedType) { - this.dmpModifiedType = dmpModifiedType; + public void setPlanModifiedType(UUID planModifiedType) { + this.planModifiedType = planModifiedType; } - public UUID getDmpFinalisedType() { - return this.dmpFinalisedType; + public UUID getPlanFinalisedType() { + return this.planFinalisedType; } - public void setDmpFinalisedType(UUID dmpFinalisedType) { - this.dmpFinalisedType = dmpFinalisedType; + public void setPlanFinalisedType(UUID planFinalisedType) { + this.planFinalisedType = planFinalisedType; } public UUID getDescriptionCreatedType() { @@ -99,12 +99,12 @@ public class NotificationProperties { this.removeCredentialConfirmationType = removeCredentialConfirmationType; } - public UUID getDmpDepositType() { - return this.dmpDepositType; + public UUID getPlanDepositType() { + return this.planDepositType; } - public void setDmpDepositType(UUID dmpDepositType) { - this.dmpDepositType = dmpDepositType; + public void setPlanDepositType(UUID planDepositType) { + this.planDepositType = planDepositType; } public UUID getDescriptionTemplateInvitationType() { diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/actionconfirmation/PlanInvitationEntity.java b/backend/core/src/main/java/org/opencdmp/commons/types/actionconfirmation/PlanInvitationEntity.java index 95c65b086..d957dc264 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/types/actionconfirmation/PlanInvitationEntity.java +++ b/backend/core/src/main/java/org/opencdmp/commons/types/actionconfirmation/PlanInvitationEntity.java @@ -5,17 +5,17 @@ import jakarta.xml.bind.annotation.*; import java.util.UUID; -@XmlRootElement(name = "dmp-invitation") +@XmlRootElement(name = "plan-invitation") @XmlAccessorType(XmlAccessType.FIELD) public class PlanInvitationEntity { @XmlAttribute(name = "email") private String email; - @XmlAttribute(name = "dmp") + @XmlAttribute(name = "plan") private UUID planId; - @XmlAttribute(name = "dmp-role") + @XmlAttribute(name = "plan-role") private PlanUserRole role; public String getEmail() { diff --git a/backend/core/src/main/java/org/opencdmp/commons/types/plan/importexport/PlanImportExport.java b/backend/core/src/main/java/org/opencdmp/commons/types/plan/importexport/PlanImportExport.java index 1b8800ca5..13eccf64b 100644 --- a/backend/core/src/main/java/org/opencdmp/commons/types/plan/importexport/PlanImportExport.java +++ b/backend/core/src/main/java/org/opencdmp/commons/types/plan/importexport/PlanImportExport.java @@ -11,7 +11,7 @@ import java.time.Instant; import java.util.List; import java.util.UUID; -@XmlRootElement(name = "dmp") +@XmlRootElement(name = "plan") @XmlAccessorType(XmlAccessType.FIELD) public class PlanImportExport { 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 2b21324cc..5b0d8cc8f 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 @@ -49,9 +49,9 @@ public class DescriptionElasticEntity { private NestedDescriptionTemplateElasticEntity descriptionTemplate; public final static String _descriptionTemplate = "descriptionTemplate"; - @Field(value = DescriptionElasticEntity._dmp, type = FieldType.Object) - private NestedPlanElasticEntity dmp; - public final static String _dmp = "dmp"; + @Field(value = DescriptionElasticEntity._plan, type = FieldType.Object) + private NestedPlanElasticEntity plan; + public final static String _plan = "plan"; @Field(value = DescriptionElasticEntity._references, type = FieldType.Nested) private List references; @@ -129,12 +129,12 @@ public class DescriptionElasticEntity { this.descriptionTemplate = descriptionTemplate; } - public NestedPlanElasticEntity getDmp() { - return this.dmp; + public NestedPlanElasticEntity getPlan() { + return this.plan; } - public void setDmp(NestedPlanElasticEntity dmp) { - this.dmp = dmp; + public void setPlan(NestedPlanElasticEntity plan) { + this.plan = plan; } public List getReferences() { diff --git a/backend/core/src/main/java/org/opencdmp/elastic/data/PlanElasticEntity.java b/backend/core/src/main/java/org/opencdmp/elastic/data/PlanElasticEntity.java index e5419ae3f..3d8e3e8b5 100644 --- a/backend/core/src/main/java/org/opencdmp/elastic/data/PlanElasticEntity.java +++ b/backend/core/src/main/java/org/opencdmp/elastic/data/PlanElasticEntity.java @@ -12,7 +12,7 @@ import java.util.Date; import java.util.List; import java.util.UUID; -@Document(indexName = "dmp") +@Document(indexName = "plan") public class PlanElasticEntity { @Id @Field(value = PlanElasticEntity._id, type = FieldType.Keyword) @@ -74,9 +74,9 @@ public class PlanElasticEntity { private List descriptions; public final static String _descriptions = "descriptions"; - @Field(value = PlanElasticEntity._dmpDescriptionTemplates, type = FieldType.Nested) + @Field(value = PlanElasticEntity._planDescriptionTemplates, type = FieldType.Nested) private List planDescriptionTemplates; - public final static String _dmpDescriptionTemplates = "dmpDescriptionTemplates"; + public final static String _planDescriptionTemplates = "planDescriptionTemplates"; @Field(value = PlanElasticEntity._dois, type = FieldType.Nested) private List dois; 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 29ff2675f..9d4bb4154 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 @@ -20,9 +20,9 @@ public class NestedDescriptionElasticEntity { private UUID id; public final static String _id = "id"; - @Field(value = NestedDescriptionElasticEntity._dmpId, type = FieldType.Keyword) + @Field(value = NestedDescriptionElasticEntity._planId, type = FieldType.Keyword) private UUID planId; - public final static String _dmpId = "dmpId"; + public final static String _planId = "planId"; @MultiField(mainField = @Field(value = NestedDescriptionElasticEntity._label, type = FieldType.Text), otherFields = @InnerField(suffix = ElasticConstants.SubFields.keyword, type = FieldType.Keyword)) private String label; diff --git a/backend/core/src/main/java/org/opencdmp/elastic/data/nested/NestedPlanDescriptionTemplateElasticEntity.java b/backend/core/src/main/java/org/opencdmp/elastic/data/nested/NestedPlanDescriptionTemplateElasticEntity.java index e1beffe1d..2419a7ace 100644 --- a/backend/core/src/main/java/org/opencdmp/elastic/data/nested/NestedPlanDescriptionTemplateElasticEntity.java +++ b/backend/core/src/main/java/org/opencdmp/elastic/data/nested/NestedPlanDescriptionTemplateElasticEntity.java @@ -13,9 +13,9 @@ public class NestedPlanDescriptionTemplateElasticEntity { private UUID id; public final static String _id = "id"; - @Field(value = NestedDescriptionElasticEntity._dmpId, type = FieldType.Keyword) + @Field(value = NestedDescriptionElasticEntity._planId, type = FieldType.Keyword) private UUID planId; - public final static String _dmpId = "dmpId"; + public final static String _planId = "planId"; @Field(value = NestedPlanDescriptionTemplateElasticEntity._descriptionTemplateGroupId, type = FieldType.Keyword) private UUID descriptionTemplateGroupId; 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 9fde3a84b..6cc4f11a8 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 @@ -74,7 +74,7 @@ public class DescriptionElasticBuilder extends BaseElasticBuilder> itemMap; - 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()))); + DescriptionQuery q = this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).planSubQuery(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; 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 2111fc08a..788106496 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 @@ -43,7 +43,7 @@ public class DescriptionElasticQuery extends ElasticQuery ids; private String like; - private InnerObjectDmpElasticQuery planSubQuery; + private InnerObjectPlanElasticQuery planSubQuery; private Instant createdAfter; private Instant createdBefore; private Instant finalizedAfter; @@ -72,7 +72,7 @@ public class DescriptionElasticQuery extends ElasticQuery predicates = new ArrayList<>(); if (usePublic ) { predicates.add(this.and( - 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()) + this.equals(new ElasticField(DescriptionElasticEntity._plan + "." + PlanElasticEntity._status, this.entityClass()).disableInfer(true), PlanStatus.Finalized.getValue()), + this.equals(new ElasticField(DescriptionElasticEntity._plan + "." + PlanElasticEntity._accessType, this.entityClass()).disableInfer(true), PlanAccessType.Public.getValue()) )); } if (userId != null) { - NestedCollaboratorElasticQuery query = this.queryFactory.query(NestedCollaboratorElasticQuery.class).nestedPath(DescriptionElasticEntity._dmp + "." + NestedPlanElasticEntity._collaborators); + NestedCollaboratorElasticQuery query = this.queryFactory.query(NestedCollaboratorElasticQuery.class).nestedPath(DescriptionElasticEntity._plan + "." + NestedPlanElasticEntity._collaborators); query.userIds(userId); predicates.add(this.nestedQuery(query).build()._toQuery()); } @@ -230,13 +230,13 @@ public class DescriptionElasticQuery extends ElasticQuery { +public class InnerObjectPlanElasticQuery extends ElasticInnerObjectQuery { private String like; private Collection ids; private Collection excludedIds; @@ -35,120 +35,120 @@ public class InnerObjectDmpElasticQuery extends ElasticInnerObjectQuery accessTypes; private Collection versions; private Collection groupIds; - private NestedCollaboratorElasticQuery dmpUserSubQuery; + private NestedCollaboratorElasticQuery planUserSubQuery; - public InnerObjectDmpElasticQuery dmpSubQuery(NestedCollaboratorElasticQuery subQuery) { - this.dmpUserSubQuery = subQuery; + public InnerObjectPlanElasticQuery planSubQuery(NestedCollaboratorElasticQuery subQuery) { + this.planUserSubQuery = subQuery; return this; } - public InnerObjectDmpElasticQuery like(String value) { + public InnerObjectPlanElasticQuery like(String value) { this.like = value; return this; } - public InnerObjectDmpElasticQuery ids(UUID value) { + public InnerObjectPlanElasticQuery ids(UUID value) { this.ids = List.of(value); return this; } - public InnerObjectDmpElasticQuery ids(UUID... value) { + public InnerObjectPlanElasticQuery ids(UUID... value) { this.ids = Arrays.asList(value); return this; } - public InnerObjectDmpElasticQuery ids(Collection values) { + public InnerObjectPlanElasticQuery ids(Collection values) { this.ids = values; return this; } - public InnerObjectDmpElasticQuery excludedIds(Collection values) { + public InnerObjectPlanElasticQuery excludedIds(Collection values) { this.excludedIds = values; return this; } - public InnerObjectDmpElasticQuery excludedIds(UUID value) { + public InnerObjectPlanElasticQuery excludedIds(UUID value) { this.excludedIds = List.of(value); return this; } - public InnerObjectDmpElasticQuery excludedIds(UUID... value) { + public InnerObjectPlanElasticQuery excludedIds(UUID... value) { this.excludedIds = Arrays.asList(value); return this; } - public InnerObjectDmpElasticQuery versionStatuses(PlanVersionStatus value) { + public InnerObjectPlanElasticQuery versionStatuses(PlanVersionStatus value) { this.versionStatuses = List.of(value); return this; } - public InnerObjectDmpElasticQuery versionStatuses(PlanVersionStatus... value) { + public InnerObjectPlanElasticQuery versionStatuses(PlanVersionStatus... value) { this.versionStatuses = Arrays.asList(value); return this; } - public InnerObjectDmpElasticQuery versionStatuses(Collection values) { + public InnerObjectPlanElasticQuery versionStatuses(Collection values) { this.versionStatuses = values; return this; } - public InnerObjectDmpElasticQuery accessTypes(PlanAccessType value) { + public InnerObjectPlanElasticQuery accessTypes(PlanAccessType value) { this.accessTypes = List.of(value); return this; } - public InnerObjectDmpElasticQuery accessTypes(PlanAccessType... value) { + public InnerObjectPlanElasticQuery accessTypes(PlanAccessType... value) { this.accessTypes = Arrays.asList(value); return this; } - public InnerObjectDmpElasticQuery accessTypes(Collection values) { + public InnerObjectPlanElasticQuery accessTypes(Collection values) { this.accessTypes = values; return this; } - public InnerObjectDmpElasticQuery statuses(PlanStatus value) { + public InnerObjectPlanElasticQuery statuses(PlanStatus value) { this.statuses = List.of(value); return this; } - public InnerObjectDmpElasticQuery statuses(PlanStatus... value) { + public InnerObjectPlanElasticQuery statuses(PlanStatus... value) { this.statuses = Arrays.asList(value); return this; } - public InnerObjectDmpElasticQuery statuses(Collection values) { + public InnerObjectPlanElasticQuery statuses(Collection values) { this.statuses = values; return this; } - public InnerObjectDmpElasticQuery versions(Integer value) { + public InnerObjectPlanElasticQuery versions(Integer value) { this.versions = List.of(value); return this; } - public InnerObjectDmpElasticQuery versions(Integer... value) { + public InnerObjectPlanElasticQuery versions(Integer... value) { this.versions = Arrays.asList(value); return this; } - public InnerObjectDmpElasticQuery versions(Collection values) { + public InnerObjectPlanElasticQuery versions(Collection values) { this.versions = values; return this; } - public InnerObjectDmpElasticQuery groupIds(UUID value) { + public InnerObjectPlanElasticQuery groupIds(UUID value) { this.groupIds = List.of(value); return this; } - public InnerObjectDmpElasticQuery groupIds(UUID... value) { + public InnerObjectPlanElasticQuery groupIds(UUID... value) { this.groupIds = Arrays.asList(value); return this; } - public InnerObjectDmpElasticQuery groupIds(Collection values) { + public InnerObjectPlanElasticQuery groupIds(Collection values) { this.groupIds = values; return this; } @@ -156,7 +156,7 @@ public class InnerObjectDmpElasticQuery extends ElasticInnerObjectQuery 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 + "." + NestedPlanElasticEntity._collaborators)).build()._toQuery()); + if (this.planUserSubQuery != null) { + predicates.add(this.nestedQuery( this.planUserSubQuery.nestedPath(DescriptionElasticEntity._plan + "." + NestedPlanElasticEntity._collaborators)).build()._toQuery()); } if (!predicates.isEmpty()) { diff --git a/backend/core/src/main/java/org/opencdmp/elastic/query/NestedDescriptionElasticQuery.java b/backend/core/src/main/java/org/opencdmp/elastic/query/NestedDescriptionElasticQuery.java index fe3f6fd0a..9be9b1401 100644 --- a/backend/core/src/main/java/org/opencdmp/elastic/query/NestedDescriptionElasticQuery.java +++ b/backend/core/src/main/java/org/opencdmp/elastic/query/NestedDescriptionElasticQuery.java @@ -83,7 +83,7 @@ public class NestedDescriptionElasticQuery extends ElasticNestedQuery { 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(); + if (this.authorize.contains(AuthorizationFlags.PlanAssociated)) userId = this.userScope.getUserIdSafe(); List predicates = new ArrayList<>(); if (usePublic) { @@ -319,7 +319,7 @@ public class PlanElasticQuery extends ElasticQuery { 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()); + predicates.add(this.nestedQuery( this.planDescriptionTemplateSubQuery.nestedPath(PlanElasticEntity._planDescriptionTemplates)).build()._toQuery()); } if (!predicates.isEmpty()) { @@ -346,7 +346,7 @@ public class PlanElasticQuery extends ElasticQuery { 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)); + mocDoc.setPlanDescriptionTemplates(this.convertNested(rawData, columns, this.queryFactory.query(NestedPlanDescriptionTemplateElasticQuery.class), PlanElasticEntity._planDescriptionTemplates, null)); return mocDoc; } @@ -366,14 +366,14 @@ public class PlanElasticQuery extends ElasticQuery { 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 if (item.prefix(PlanElasticEntity._planDescriptionTemplates)) return this.queryFactory.query(NestedPlanDescriptionTemplateElasticQuery.class).nestedPath(PlanElasticEntity._planDescriptionTemplates).fieldNameOf(this.extractPrefixed(item, PlanElasticEntity._planDescriptionTemplates)); else return null; } @Override protected String[] getIndex() { List indexNames = new ArrayList<>(); - indexNames.add(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName()); + indexNames.add(this.appElasticConfiguration.getAppElasticProperties().getPlanIndexName()); try { this.elasticService.ensureDescriptionIndex(); } catch (IOException e) { @@ -397,7 +397,7 @@ public class PlanElasticQuery extends ElasticQuery { 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 if (item.prefix(PlanElasticEntity._planDescriptionTemplates)) return this.queryFactory.query(NestedPlanDescriptionTemplateElasticQuery.class).nestedPath(PlanElasticEntity._planDescriptionTemplates); else return null; } } diff --git a/backend/core/src/main/java/org/opencdmp/errorcode/ErrorThesaurusProperties.java b/backend/core/src/main/java/org/opencdmp/errorcode/ErrorThesaurusProperties.java index cc60f35b1..280bad596 100644 --- a/backend/core/src/main/java/org/opencdmp/errorcode/ErrorThesaurusProperties.java +++ b/backend/core/src/main/java/org/opencdmp/errorcode/ErrorThesaurusProperties.java @@ -85,84 +85,84 @@ public class ErrorThesaurusProperties { this.multipleDescriptionTemplateVersionsNotSupported = multipleDescriptionTemplateVersionsNotSupported; } - private ErrorDescription dmpNewVersionConflict; + private ErrorDescription planNewVersionConflict; - public ErrorDescription getDmpNewVersionConflict() { - return this.dmpNewVersionConflict; + public ErrorDescription getPlanNewVersionConflict() { + return this.planNewVersionConflict; } - public void setDmpNewVersionConflict(ErrorDescription dmpNewVersionConflict) { - this.dmpNewVersionConflict = dmpNewVersionConflict; + public void setPlanNewVersionConflict(ErrorDescription planNewVersionConflict) { + this.planNewVersionConflict = planNewVersionConflict; } - private ErrorDescription dmpIsNotFinalized; + private ErrorDescription planIsNotFinalized; - public ErrorDescription getDmpIsNotFinalized() { - return this.dmpIsNotFinalized; + public ErrorDescription getPlanIsNotFinalized() { + return this.planIsNotFinalized; } - public void setDmpIsNotFinalized(ErrorDescription dmpIsNotFinalized) { - this.dmpIsNotFinalized = dmpIsNotFinalized; + public void setPlanIsNotFinalized(ErrorDescription planIsNotFinalized) { + this.planIsNotFinalized = planIsNotFinalized; } - private ErrorDescription multipleDmpVersionsNotSupported; + private ErrorDescription multiplePlanVersionsNotSupported; - public ErrorDescription getMultipleDmpVersionsNotSupported() { - return this.multipleDmpVersionsNotSupported; + public ErrorDescription getMultiplePlanVersionsNotSupported() { + return this.multiplePlanVersionsNotSupported; } - public void setMultipleDmpVersionsNotSupported(ErrorDescription multipleDmpVersionsNotSupported) { - this.multipleDmpVersionsNotSupported = multipleDmpVersionsNotSupported; + public void setMultiplePlanVersionsNotSupported(ErrorDescription multiplePlanVersionsNotSupported) { + this.multiplePlanVersionsNotSupported = multiplePlanVersionsNotSupported; } - public ErrorDescription dmpBlueprintNewVersionConflict; + public ErrorDescription planBlueprintNewVersionConflict; - public ErrorDescription getDmpBlueprintNewVersionConflict() { - return this.dmpBlueprintNewVersionConflict; + public ErrorDescription getPlanBlueprintNewVersionConflict() { + return this.planBlueprintNewVersionConflict; } - public void setDmpBlueprintNewVersionConflict(ErrorDescription dmpBlueprintNewVersionConflict) { - this.dmpBlueprintNewVersionConflict = dmpBlueprintNewVersionConflict; + public void setPlanBlueprintNewVersionConflict(ErrorDescription planBlueprintNewVersionConflict) { + this.planBlueprintNewVersionConflict = planBlueprintNewVersionConflict; } - private ErrorDescription dmpBlueprintNewVersionAlreadyCreatedDraft; + private ErrorDescription planBlueprintNewVersionAlreadyCreatedDraft; - public ErrorDescription getDmpBlueprintNewVersionAlreadyCreatedDraft() { - return this.dmpBlueprintNewVersionAlreadyCreatedDraft; + public ErrorDescription getPlanBlueprintNewVersionAlreadyCreatedDraft() { + return this.planBlueprintNewVersionAlreadyCreatedDraft; } - public void setDmpBlueprintNewVersionAlreadyCreatedDraft(ErrorDescription dmpBlueprintNewVersionAlreadyCreatedDraft) { - this.dmpBlueprintNewVersionAlreadyCreatedDraft = dmpBlueprintNewVersionAlreadyCreatedDraft; + public void setPlanBlueprintNewVersionAlreadyCreatedDraft(ErrorDescription planBlueprintNewVersionAlreadyCreatedDraft) { + this.planBlueprintNewVersionAlreadyCreatedDraft = planBlueprintNewVersionAlreadyCreatedDraft; } - private ErrorDescription dmpIsFinalized; + private ErrorDescription planIsFinalized; - public ErrorDescription getDmpIsFinalized() { - return this.dmpIsFinalized; + public ErrorDescription getPlanIsFinalized() { + return this.planIsFinalized; } - public void setDmpIsFinalized(ErrorDescription dmpIsFinalized) { - this.dmpIsFinalized = dmpIsFinalized; + public void setPlanIsFinalized(ErrorDescription planIsFinalized) { + this.planIsFinalized = planIsFinalized; } - private ErrorDescription dmpCanNotChange; + private ErrorDescription planCanNotChange; - public ErrorDescription getDmpCanNotChange() { - return this.dmpCanNotChange; + public ErrorDescription getPlanCanNotChange() { + return this.planCanNotChange; } - public void setDmpCanNotChange(ErrorDescription dmpCanNotChange) { - this.dmpCanNotChange = dmpCanNotChange; + public void setPlanCanNotChange(ErrorDescription planCanNotChange) { + this.planCanNotChange = planCanNotChange; } - private ErrorDescription dmpDescriptionTemplateCanNotChange; + private ErrorDescription planDescriptionTemplateCanNotChange; - public ErrorDescription getDmpDescriptionTemplateCanNotChange() { - return this.dmpDescriptionTemplateCanNotChange; + public ErrorDescription getPlanDescriptionTemplateCanNotChange() { + return this.planDescriptionTemplateCanNotChange; } - public void setDmpDescriptionTemplateCanNotChange(ErrorDescription dmpDescriptionTemplateCanNotChange) { - this.dmpDescriptionTemplateCanNotChange = dmpDescriptionTemplateCanNotChange; + public void setPlanDescriptionTemplateCanNotChange(ErrorDescription planDescriptionTemplateCanNotChange) { + this.planDescriptionTemplateCanNotChange = planDescriptionTemplateCanNotChange; } private ErrorDescription invalidDescriptionTemplate; @@ -185,24 +185,24 @@ public class ErrorThesaurusProperties { this.descriptionIsFinalized = descriptionIsFinalized; } - private ErrorDescription dmpBlueprintHasNoDescriptionTemplates; + private ErrorDescription planBlueprintHasNoDescriptionTemplates; - public ErrorDescription getDmpBlueprintHasNoDescriptionTemplates() { - return this.dmpBlueprintHasNoDescriptionTemplates; + public ErrorDescription getPlanBlueprintHasNoDescriptionTemplates() { + return this.planBlueprintHasNoDescriptionTemplates; } - public void setDmpBlueprintHasNoDescriptionTemplates(ErrorDescription dmpBlueprintHasNoDescriptionTemplates) { - this.dmpBlueprintHasNoDescriptionTemplates = dmpBlueprintHasNoDescriptionTemplates; + public void setPlanBlueprintHasNoDescriptionTemplates(ErrorDescription planBlueprintHasNoDescriptionTemplates) { + this.planBlueprintHasNoDescriptionTemplates = planBlueprintHasNoDescriptionTemplates; } - private ErrorDescription dmpDescriptionTemplateCanNotRemove; + private ErrorDescription planDescriptionTemplateCanNotRemove; - public ErrorDescription getDmpDescriptionTemplateCanNotRemove() { - return this.dmpDescriptionTemplateCanNotRemove; + public ErrorDescription getPlanDescriptionTemplateCanNotRemove() { + return this.planDescriptionTemplateCanNotRemove; } - public void setDmpDescriptionTemplateCanNotRemove(ErrorDescription dmpDescriptionTemplateCanNotRemove) { - this.dmpDescriptionTemplateCanNotRemove = dmpDescriptionTemplateCanNotRemove; + public void setPlanDescriptionTemplateCanNotRemove(ErrorDescription planDescriptionTemplateCanNotRemove) { + this.planDescriptionTemplateCanNotRemove = planDescriptionTemplateCanNotRemove; } private ErrorDescription missingTenant; @@ -266,14 +266,14 @@ public class ErrorThesaurusProperties { } - private ErrorDescription dmpNewVersionAlreadyCreatedDraft; + private ErrorDescription planNewVersionAlreadyCreatedDraft; - public ErrorDescription getDmpNewVersionAlreadyCreatedDraft() { - return this.dmpNewVersionAlreadyCreatedDraft; + public ErrorDescription getPlanNewVersionAlreadyCreatedDraft() { + return this.planNewVersionAlreadyCreatedDraft; } - public void setDmpNewVersionAlreadyCreatedDraft(ErrorDescription dmpNewVersionAlreadyCreatedDraft) { - this.dmpNewVersionAlreadyCreatedDraft = dmpNewVersionAlreadyCreatedDraft; + public void setPlanNewVersionAlreadyCreatedDraft(ErrorDescription planNewVersionAlreadyCreatedDraft) { + this.planNewVersionAlreadyCreatedDraft = planNewVersionAlreadyCreatedDraft; } private ErrorDescription descriptionTemplateInactiveUser; @@ -297,46 +297,46 @@ public class ErrorThesaurusProperties { } - private ErrorDescription dmpInactiveUser; + private ErrorDescription planInactiveUser; - public ErrorDescription getDmpInactiveUser() { - return this.dmpInactiveUser; + public ErrorDescription getPlanInactiveUser() { + return this.planInactiveUser; } - public void setDmpInactiveUser(ErrorDescription dmpInactiveUser) { - this.dmpInactiveUser = dmpInactiveUser; + public void setPlanInactiveUser(ErrorDescription planInactiveUser) { + this.planInactiveUser = planInactiveUser; } - private ErrorDescription dmpMissingUserContactInfo; + private ErrorDescription planMissingUserContactInfo; - public ErrorDescription getDmpMissingUserContactInfo() { - return this.dmpMissingUserContactInfo; + public ErrorDescription getPlanMissingUserContactInfo() { + return this.planMissingUserContactInfo; } - public void setDmpMissingUserContactInfo(ErrorDescription dmpMissingUserContactInfo) { - this.dmpMissingUserContactInfo = dmpMissingUserContactInfo; + public void setPlanMissingUserContactInfo(ErrorDescription planMissingUserContactInfo) { + this.planMissingUserContactInfo = planMissingUserContactInfo; } - private ErrorDescription importDescriptionWithoutDmpDescriptionTemplate; + private ErrorDescription importDescriptionWithoutPlanDescriptionTemplate; - public ErrorDescription getImportDescriptionWithoutDmpDescriptionTemplate() { - return this.importDescriptionWithoutDmpDescriptionTemplate; + public ErrorDescription getImportDescriptionWithoutPlanDescriptionTemplate() { + return this.importDescriptionWithoutPlanDescriptionTemplate; } - public void setImportDescriptionWithoutDmpDescriptionTemplate(ErrorDescription importDescriptionWithoutDmpDescriptionTemplate) { - this.importDescriptionWithoutDmpDescriptionTemplate = importDescriptionWithoutDmpDescriptionTemplate; + public void setImportDescriptionWithoutPlanDescriptionTemplate(ErrorDescription importDescriptionWithoutPlanDescriptionTemplate) { + this.importDescriptionWithoutPlanDescriptionTemplate = importDescriptionWithoutPlanDescriptionTemplate; } - private ErrorDescription duplicateDmpUser; + private ErrorDescription duplicatePlanUser; - public ErrorDescription getDuplicateDmpUser() { - return this.duplicateDmpUser; + public ErrorDescription getDuplicatePlanUser() { + return this.duplicatePlanUser; } - public void setDuplicateDmpUser(ErrorDescription duplicateDmpUser) { - this.duplicateDmpUser = duplicateDmpUser; + public void setDuplicatePlanUser(ErrorDescription duplicatePlanUser) { + this.duplicatePlanUser = duplicatePlanUser; } private ErrorDescription referenceTypeCodeExists; 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 b67395dbc..13efa7788 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 @@ -144,12 +144,12 @@ public class AnnotationEntityCreatedIntegrationEventHandlerImpl implements Annot List existingUSerIDs = existingUsers.stream() .map(PlanUserEntity::getUserId) - .filter(dmpUserId -> !dmpUserId.equals(event.getSubjectId())) + .filter(planUserId -> !planUserId.equals(event.getSubjectId())) .distinct().toList(); - for (UUID dmpUserId : existingUSerIDs) { - UserEntity user = this.queryFactory.query(UserQuery.class).disableTracking().ids(dmpUserId).first(); + for (UUID planUserId : existingUSerIDs) { + UserEntity user = this.queryFactory.query(UserQuery.class).disableTracking().ids(planUserId).first(); if (user == null || user.getIsActive().equals(IsActive.Inactive)) - throw new MyValidationException(this.errors.getDmpInactiveUser().getCode(), this.errors.getDmpInactiveUser().getMessage()); + throw new MyValidationException(this.errors.getPlanInactiveUser().getCode(), this.errors.getPlanInactiveUser().getMessage()); this.createAnnotationNotificationEvent(user, descriptionEntity, sender.getName(), event.getAnchor()); } 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 9a534a548..4eedf1c82 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 @@ -144,12 +144,12 @@ public class AnnotationStatusEntityChangedIntegrationEventHandlerImpl implements List existingUSerIDs = existingUsers.stream() .map(PlanUserEntity::getUserId) - .filter(dmpUserId -> !dmpUserId.equals(event.getSubjectId())) + .filter(planUserId -> !planUserId.equals(event.getSubjectId())) .distinct().toList(); - for (UUID dmpUserId : existingUSerIDs) { - UserEntity user = this.queryFactory.query(UserQuery.class).disableTracking().ids(dmpUserId).first(); + for (UUID planUserId : existingUSerIDs) { + UserEntity user = this.queryFactory.query(UserQuery.class).disableTracking().ids(planUserId).first(); if (user == null || user.getIsActive().equals(IsActive.Inactive)) - throw new MyValidationException(this.errors.getDmpInactiveUser().getCode(), this.errors.getDmpInactiveUser().getMessage()); + throw new MyValidationException(this.errors.getPlanInactiveUser().getCode(), this.errors.getPlanInactiveUser().getMessage()); this.createAnnotationStatusChangedNotificationEvent(user, descriptionEntity, sender.getName(), event.getAnchor(), event.getStatusLabel()); } diff --git a/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/OutboxIntegrationEvent.java b/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/OutboxIntegrationEvent.java index 24326fc4f..0372a90e0 100644 --- a/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/OutboxIntegrationEvent.java +++ b/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/OutboxIntegrationEvent.java @@ -25,7 +25,7 @@ public class OutboxIntegrationEvent extends IntegrationEvent { public static final String USER_REMOVE = "USER_REMOVE"; - public static final String DMP_TOUCH = "DMP_TOUCH"; + public static final String PLAN_TOUCH = "PLAN_TOUCH"; public static final String DESCRIPTION_TOUCH = "DESCRIPTION_TOUCH"; diff --git a/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/OutboxProperties.java b/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/OutboxProperties.java index 414bc1fea..225832f42 100644 --- a/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/OutboxProperties.java +++ b/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/OutboxProperties.java @@ -25,7 +25,7 @@ public class OutboxProperties { private final String userTouchTopic; - private final String dmpTouchTopic; + private final String planTouchTopic; private final String descriptionTouchTopic; @@ -49,7 +49,7 @@ public class OutboxProperties { String tenantUserInviteTopic, String userRemovalTopic, String userTouchTopic, - String dmpTouchTopic, + String planTouchTopic, String descriptionTouchTopic, String annotationEntitiesTouchTopic, String annotationEntitiesRemovalTopic, @@ -71,7 +71,7 @@ public class OutboxProperties { this.tenantUserInviteTopic = tenantUserInviteTopic; this.userRemovalTopic = userRemovalTopic; this.userTouchTopic = userTouchTopic; - this.dmpTouchTopic = dmpTouchTopic; + this.planTouchTopic = planTouchTopic; this.descriptionTouchTopic = descriptionTouchTopic; this.annotationEntitiesTouchTopic = annotationEntitiesTouchTopic; this.annotationEntitiesRemovalTopic = annotationEntitiesRemovalTopic; @@ -133,8 +133,8 @@ public class OutboxProperties { return this.userTouchTopic; } - public String getDmpTouchTopic() { - return this.dmpTouchTopic; + public String getPlanTouchTopic() { + return this.planTouchTopic; } public String getDescriptionTouchTopic() { diff --git a/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/OutboxRepositoryImpl.java b/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/OutboxRepositoryImpl.java index 1b2923c8e..1766a7102 100644 --- a/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/OutboxRepositoryImpl.java +++ b/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/OutboxRepositoryImpl.java @@ -458,8 +458,8 @@ public class OutboxRepositoryImpl implements OutboxRepository { routingKey = this.outboxProperties.getUserTouchTopic(); break; } - case OutboxIntegrationEvent.DMP_TOUCH: { - routingKey = this.outboxProperties.getDmpTouchTopic(); + case OutboxIntegrationEvent.PLAN_TOUCH: { + routingKey = this.outboxProperties.getPlanTouchTopic(); break; } case OutboxIntegrationEvent.DESCRIPTION_TOUCH: { 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 c87538353..9e6a41957 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 planId) throws InvalidApplicationException; + void handlePlan(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 2a3306116..acf48ac0f 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 @@ -56,9 +56,9 @@ public class AnnotationEntityRemovalIntegrationEventHandlerImpl implements Annot } @Override - 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; + public void handlePlan(UUID planId) { + PlanEntity plan = this.queryFactory.query(PlanQuery.class).disableTracking().ids(planId).firstAs(new BaseFieldSet().ensure(Plan._id).ensure(PlanEntity._tenantId)); + if(plan == null) return; List descriptionEntities = this.queryFactory.query(DescriptionQuery.class).disableTracking().planIds(planId).collectAs(new BaseFieldSet().ensure(Description._id)); @@ -68,6 +68,6 @@ public class AnnotationEntityRemovalIntegrationEventHandlerImpl implements Annot for (DescriptionEntity description : descriptionEntities) event.getEntityIds().add(description.getId()); - this.handle(event, dmp.getTenantId()); + this.handle(event, plan.getTenantId()); } } 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 986e0834f..bc0291a09 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 @@ -49,10 +49,10 @@ public class AnnotationEntityTouchedIntegrationEventHandlerImpl implements Annot public void handleDescription(UUID descriptionId) { 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(PlanUserQuery.class).disableTracking().planIds(entity.getPlanId()).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(PlanUser._user)); + List planUsers = 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))); + event.setEvents(List.of(this.buildEventItem(descriptionId, planUsers))); this.handle(event, entity.getTenantId()); } @@ -61,23 +61,23 @@ public class AnnotationEntityTouchedIntegrationEventHandlerImpl implements Annot 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(PlanUserQuery.class).disableTracking().planIds(planId).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(PlanUser._user)); + List planUsers = 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(planId, dmpUsers)); + event.getEvents().add(this.buildEventItem(planId, planUsers)); - for (DescriptionEntity description : descriptionEntities) event.getEvents().add(this.buildEventItem(description.getId(), dmpUsers)); + for (DescriptionEntity description : descriptionEntities) event.getEvents().add(this.buildEventItem(description.getId(), planUsers)); this.handle(event, descriptionEntities.getFirst().getTenantId()); } - private AnnotationEntitiesTouchedIntegrationEvent.AnnotationEntityTouchedIntegrationEvent buildEventItem(UUID entityId, List dmpUsers){ + private AnnotationEntitiesTouchedIntegrationEvent.AnnotationEntityTouchedIntegrationEvent buildEventItem(UUID entityId, List planUsers){ AnnotationEntitiesTouchedIntegrationEvent.AnnotationEntityTouchedIntegrationEvent eventItem = new AnnotationEntitiesTouchedIntegrationEvent.AnnotationEntityTouchedIntegrationEvent(); eventItem.setEntityId(entityId); List users = new ArrayList<>(); - for (PlanUserEntity dmpUser : dmpUsers){ - users.add(dmpUser.getUserId()); + for (PlanUserEntity planUser : planUsers){ + users.add(planUser.getUserId()); } eventItem.setUserIds(users); return eventItem; diff --git a/backend/core/src/main/java/org/opencdmp/model/DashboardStatistics.java b/backend/core/src/main/java/org/opencdmp/model/DashboardStatistics.java index 94dab28d6..0f79ffd41 100644 --- a/backend/core/src/main/java/org/opencdmp/model/DashboardStatistics.java +++ b/backend/core/src/main/java/org/opencdmp/model/DashboardStatistics.java @@ -1,24 +1,23 @@ package org.opencdmp.model; import java.util.List; -import java.util.UUID; public class DashboardStatistics { - private long dmpCount; + private long planCount; - public static final String _dmpCount = "dmpCount"; + public static final String _planCount = "planCount"; private long descriptionCount; private List referenceTypeStatistics; - public long getDmpCount() { - return dmpCount; + public long getPlanCount() { + return planCount; } - public void setDmpCount(long dmpCount) { - this.dmpCount = dmpCount; + public void setPlanCount(long planCount) { + this.planCount = planCount; } public long getDescriptionCount() { diff --git a/backend/core/src/main/java/org/opencdmp/model/PlanDescriptionTemplate.java b/backend/core/src/main/java/org/opencdmp/model/PlanDescriptionTemplate.java index 085c96cf3..a2ee89396 100644 --- a/backend/core/src/main/java/org/opencdmp/model/PlanDescriptionTemplate.java +++ b/backend/core/src/main/java/org/opencdmp/model/PlanDescriptionTemplate.java @@ -61,11 +61,11 @@ public class PlanDescriptionTemplate { this.id = id; } - public Plan getDmp() { + public Plan getPlan() { return plan; } - public void setDmp(Plan plan) { + public void setPlan(Plan plan) { this.plan = plan; } 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 5840b3b3b..028a96153 100644 --- a/backend/core/src/main/java/org/opencdmp/model/RecentActivityItemLookup.java +++ b/backend/core/src/main/java/org/opencdmp/model/RecentActivityItemLookup.java @@ -20,7 +20,7 @@ public class RecentActivityItemLookup{ private String like; private Boolean onlyDraft; - private Boolean onlyDmp; + private Boolean onlyPlan; private Boolean onlyDescription; private List userIds; private Paging page; @@ -75,12 +75,12 @@ public class RecentActivityItemLookup{ this.orderField = orderField; } - public Boolean getOnlyDmp() { - return onlyDmp; + public Boolean getOnlyPlan() { + return onlyPlan; } - public void setOnlyDmp(Boolean onlyDmp) { - this.onlyDmp = onlyDmp; + public void setOnlyPlan(Boolean onlyPlan) { + this.onlyPlan = onlyPlan; } public Boolean getOnlyDescription() { @@ -92,7 +92,7 @@ public class RecentActivityItemLookup{ } public DescriptionLookup asDescriptionLookup() { - if (this.onlyDmp != null) return null; + if (this.onlyPlan != null) return null; DescriptionLookup lookup = new DescriptionLookup(); lookup.setIsActive(List.of(IsActive.Active)); @@ -125,7 +125,7 @@ public class RecentActivityItemLookup{ return lookup; } - public PlanLookup asDmpLookup() { + public PlanLookup asPlanLookup() { if (this.onlyDescription != null) return null; PlanLookup lookup = new PlanLookup(); diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/PlanDescriptionTemplateBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/PlanDescriptionTemplateBuilder.java index 574228ef2..635099a4c 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/PlanDescriptionTemplateBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/PlanDescriptionTemplateBuilder.java @@ -84,7 +84,7 @@ public class PlanDescriptionTemplateBuilder extends BaseBuilder { 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())); + EntityDoiQuery query = this.queryFactory.query(EntityDoiQuery.class).disableTracking().authorize(this.authorize).types(EntityType.Plan).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))) { 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 ab4b7f9a0..a5249c40c 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 @@ -84,8 +84,8 @@ public class ActionConfirmationBuilder extends BaseBuilder { - PlanInvitationEntity dmpInvitation = this.xmlHandlingService.fromXmlSafe(PlanInvitationEntity.class, d.getData()); - m.setPlanInvitation(this.builderFactory.builder(PlanInvitationBuilder.class).authorize(this.authorize).build(planInvitationFields, dmpInvitation)); + PlanInvitationEntity planInvitation = this.xmlHandlingService.fromXmlSafe(PlanInvitationEntity.class, d.getData()); + m.setPlanInvitation(this.builderFactory.builder(PlanInvitationBuilder.class).authorize(this.authorize).build(planInvitationFields, planInvitation)); } case RemoveCredential -> { RemoveCredentialRequestEntity emailConfirmation = this.xmlHandlingService.fromXmlSafe(RemoveCredentialRequestEntity.class, d.getData()); diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/descriptiontemplate/fielddata/BaseFieldDataCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/descriptiontemplate/fielddata/BaseFieldDataCommonModelBuilder.java index b7bbe1011..e35b93f53 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/descriptiontemplate/fielddata/BaseFieldDataCommonModelBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/descriptiontemplate/fielddata/BaseFieldDataCommonModelBuilder.java @@ -53,7 +53,7 @@ public abstract class BaseFieldDataCommonModelBuilder m.setFieldType(FieldType.SELECT); case BOOLEAN_DECISION -> m.setFieldType(FieldType.BOOLEAN_DECISION); case RADIO_BOX -> m.setFieldType(FieldType.RADIO_BOX); - case INTERNAL_ENTRIES_DMPS -> m.setFieldType(FieldType.INTERNAL_ENTRIES_DMPS); + case INTERNAL_ENTRIES_PLANS -> m.setFieldType(FieldType.INTERNAL_ENTRIES_DMPS); case INTERNAL_ENTRIES_DESCRIPTIONS -> m.setFieldType(FieldType.INTERNAL_ENTRIES_DESCRIPTIONS); case CHECK_BOX -> m.setFieldType(FieldType.CHECK_BOX); case FREE_TEXT -> m.setFieldType(FieldType.FREE_TEXT); diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanCommonModelBuilder.java index 0ef4a14d9..6d90cbe54 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanCommonModelBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanCommonModelBuilder.java @@ -114,7 +114,7 @@ public class PlanCommonModelBuilder extends BaseCommonModelBuilder> descriptionsMap = this.disableDescriptions ? null : this.collectPlanDescriptions(data); Map> entityDois = this.collectPlanEntityDois(data); Map creators = this.collectCreators(data); - Map dmpBlueprints = this.collectPlanBlueprints(data); + Map planBlueprints = this.collectPlanBlueprints(data); Map definitionEntityMap = this.collectPlanBlueprintDefinitions(data); for (PlanEntity d : data) { @@ -133,7 +133,7 @@ public class PlanCommonModelBuilder extends BaseCommonModelBuilder planIds = planQuery.groupIds(dmpGroup).excludedIds(currentPlanId).isActive(IsActive.Active).collectAs(new BaseFieldSet().ensure(Plan._id)).stream().map(PlanEntity::getId).toList(); + List planIds = planQuery.groupIds(planGroup).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(planIds).isActive(IsActive.Active).collectAs(new BaseFieldSet().ensure(EntityDoi._entityId, EntityDoi._doi)); diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/DefinitionCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/DefinitionCommonModelBuilder.java index d1aff143f..66f93e5d9 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/DefinitionCommonModelBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/DefinitionCommonModelBuilder.java @@ -20,7 +20,7 @@ import java.util.EnumSet; import java.util.List; import java.util.Optional; -@Component("dmpblueprint.DefinitionCommonModelBuilder") +@Component("planblueprint.DefinitionCommonModelBuilder") @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class DefinitionCommonModelBuilder extends BaseCommonModelBuilder { private final BuilderFactory builderFactory; diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/FieldCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/FieldCommonModelBuilder.java index b5d0b336b..9bcbcfcb4 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/FieldCommonModelBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/FieldCommonModelBuilder.java @@ -20,7 +20,7 @@ import java.util.EnumSet; import java.util.List; import java.util.Optional; -@Component("dmpblueprint.FieldCommonModelBuilder") +@Component("planblueprint.FieldCommonModelBuilder") @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public abstract class FieldCommonModelBuilder extends BaseCommonModelBuilder { private EnumSet authorize = EnumSet.of(AuthorizationFlags.None); diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/SectionCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/SectionCommonModelBuilder.java index e50c4d7dc..5dba895b3 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/SectionCommonModelBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/SectionCommonModelBuilder.java @@ -24,7 +24,7 @@ import java.util.EnumSet; import java.util.List; import java.util.Optional; -@Component("dmpblueprint.SectionCommonModelBuilder") +@Component("planblueprint.SectionCommonModelBuilder") @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class SectionCommonModelBuilder extends BaseCommonModelBuilder { private final BuilderFactory builderFactory; diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/description/FieldBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/description/FieldBuilder.java index ccbe5d2f8..22b745fef 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/description/FieldBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/description/FieldBuilder.java @@ -82,7 +82,7 @@ public class FieldBuilder extends BaseBuilder { if (fields.hasField(this.asIndexer(Field._textListValue)) && FieldType.isTextListType(fieldType)) { boolean isMultiSelect = true; if(this.fieldEntity != null && this.fieldEntity.getData() != null && (this.fieldEntity.getData().getFieldType().equals(FieldType.SELECT) - || this.fieldEntity.getData().getFieldType().equals(FieldType.INTERNAL_ENTRIES_DMPS) + || this.fieldEntity.getData().getFieldType().equals(FieldType.INTERNAL_ENTRIES_PLANS) || this.fieldEntity.getData().getFieldType().equals(FieldType.INTERNAL_ENTRIES_DESCRIPTIONS))){ if (this.fieldEntity.getData() instanceof SelectDataEntity) isMultiSelect = ((SelectDataEntity) this.fieldEntity.getData()).getMultipleSelect(); else if (this.fieldEntity.getData() instanceof LabelAndMultiplicityDataEntity) isMultiSelect = ((LabelAndMultiplicityDataEntity) this.fieldEntity.getData()).getMultipleSelect(); diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/plan/PlanBlueprintValueBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/plan/PlanBlueprintValueBuilder.java index a9ae2917f..f68557dd6 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/plan/PlanBlueprintValueBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/plan/PlanBlueprintValueBuilder.java @@ -47,10 +47,10 @@ public class PlanBlueprintValueBuilder extends BaseBuilder 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()) + public List build(FieldSet planBlueprintValues, List data) throws MyApplicationException { + this.logger.debug("building for {} items requesting {} PlanBlueprintValues", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(planBlueprintValues).map(FieldSet::getFields).map(Set::size).orElse(0)); + this.logger.trace(new DataLogEntry("requested PlanBlueprintValues", planBlueprintValues)); + if (planBlueprintValues == null || data == null || planBlueprintValues.isEmpty()) return new ArrayList<>(); @@ -61,13 +61,13 @@ public class PlanBlueprintValueBuilder extends BaseBuilder { 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())); + EntityDoiQuery query = this.queryFactory.query(EntityDoiQuery.class).disableTracking().authorize(this.authorize).types(EntityType.Plan).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))) { @@ -312,11 +312,11 @@ public class PlanBuilder extends BaseBuilder { 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()); + itemMap = this.builderFactory.builder(PlanDescriptionTemplateBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getPlan().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); + itemMap.values().stream().flatMap(List::stream).filter(x -> x != null && x.getPlan() != null).forEach(x -> { + x.getPlan().setId(null); }); } diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/plan/PlanPropertiesBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/plan/PlanPropertiesBuilder.java index 1d5347405..48d29f2d6 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/plan/PlanPropertiesBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/plan/PlanPropertiesBuilder.java @@ -52,13 +52,13 @@ public class PlanPropertiesBuilder extends BaseBuilder(); //Not Bulk Build because is XML no interaction with db - FieldSet dmpBlueprintValuesFields = fields.extractPrefixed(this.asPrefix(PlanProperties._planBlueprintValues)); + FieldSet planBlueprintValuesFields = fields.extractPrefixed(this.asPrefix(PlanProperties._planBlueprintValues)); FieldSet contactsFields = fields.extractPrefixed(this.asPrefix(PlanProperties._contacts)); 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 (!planBlueprintValuesFields.isEmpty() && d.getPlanBlueprintValues() != null) m.setPlanBlueprintValues(this.builderFactory.builder(PlanBlueprintValueBuilder.class).withDefinition(definition).authorize(this.authorize).build(planBlueprintValuesFields, 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); } diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/DefinitionBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/DefinitionBuilder.java index 2d263ac45..275057f34 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/DefinitionBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/DefinitionBuilder.java @@ -18,7 +18,7 @@ import org.springframework.stereotype.Component; import java.util.*; -@Component("dmpblueprintdefinitionbuilder") +@Component("planblueprintdefinitionbuilder") @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class DefinitionBuilder extends BaseBuilder { diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/DescriptionTemplateBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/DescriptionTemplateBuilder.java index 9440ccba0..c8cb04568 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/DescriptionTemplateBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/DescriptionTemplateBuilder.java @@ -17,7 +17,7 @@ import org.springframework.stereotype.Component; import java.util.*; -@Component("dmpblueprintdefinitiondescriptiontemplatebuilder") +@Component("planblueprintdefinitiondescriptiontemplatebuilder") @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class DescriptionTemplateBuilder extends BaseBuilder { diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/FieldBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/FieldBuilder.java index a1ee27494..2169e0c38 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/FieldBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/FieldBuilder.java @@ -16,7 +16,7 @@ import org.springframework.stereotype.Component; import java.util.*; -@Component("dmpblueprintdefinitionfieldbuilder") +@Component("planblueprintdefinitionfieldbuilder") @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public abstract class FieldBuilder extends BaseBuilder { diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/SectionBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/SectionBuilder.java index c40c2568a..9a54ac3e3 100644 --- a/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/SectionBuilder.java +++ b/backend/core/src/main/java/org/opencdmp/model/builder/planblueprint/SectionBuilder.java @@ -26,7 +26,7 @@ import org.springframework.stereotype.Component; import java.util.*; -@Component("dmpblueprintdefinitionsectionbuilder") +@Component("planblueprintdefinitionsectionbuilder") @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class SectionBuilder extends BaseBuilder { diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/PublicPlanCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/PublicPlanCensor.java index 28a9d2766..fe4d6ebbe 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/PublicPlanCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/PublicPlanCensor.java @@ -36,7 +36,7 @@ public class PublicPlanCensor extends BaseCensor { if (fields.isEmpty()) return; - this.authService.authorizeForce(Permission.PublicBrowseDmp); + this.authService.authorizeForce(Permission.PublicBrowsePlan); FieldSet planDescriptionsFields = fields.extractPrefixed(this.asIndexerPrefix(PublicPlan._planUsers)); this.censorFactory.censor(PublicPlanUserCensor.class).censor(planDescriptionsFields); diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/PublicPlanReferenceCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/PublicPlanReferenceCensor.java index a9ce7f885..30b373456 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/PublicPlanReferenceCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/PublicPlanReferenceCensor.java @@ -35,7 +35,7 @@ public class PublicPlanReferenceCensor extends BaseCensor { if (fields == null || fields.isEmpty()) return; - this.authService.authorizeForce(Permission.PublicBrowseDmpReference); + this.authService.authorizeForce(Permission.PublicBrowsePlanReference); FieldSet planFields = fields.extractPrefixed(this.asIndexerPrefix(PublicPlanReference._plan)); this.censorFactory.censor(PublicPlanCensor.class).censor(planFields); FieldSet templateFields = fields.extractPrefixed(this.asIndexerPrefix(PublicPlanReference._reference)); diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/PublicPlanUserCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/PublicPlanUserCensor.java index 728a14cec..25c87f81c 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/PublicPlanUserCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/PublicPlanUserCensor.java @@ -33,7 +33,7 @@ public class PublicPlanUserCensor extends BaseCensor { if (fields == null || fields.isEmpty()) return; - this.authService.authorizeForce(Permission.PublicBrowseDmpUser); + this.authService.authorizeForce(Permission.PublicBrowsePlanUser); FieldSet planFields = fields.extractPrefixed(this.asIndexerPrefix(PublicPlanUser._plan)); this.censorFactory.censor(PublicPlanCensor.class).censor(planFields); FieldSet userFields = fields.extractPrefixed(this.asIndexerPrefix(PublicPlanUser._user)); diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/plan/PlanContactCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/plan/PlanContactCensor.java index 96bcd6427..e89a171cf 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/plan/PlanContactCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/plan/PlanContactCensor.java @@ -15,7 +15,7 @@ import org.springframework.stereotype.Component; import java.util.UUID; -@Component("dmpcontactcensor") +@Component("plancontactcensor") @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class PlanContactCensor extends BaseCensor { diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/plan/PlanPropertiesCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/plan/PlanPropertiesCensor.java index 14b43ca95..d649e2cec 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/plan/PlanPropertiesCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/plan/PlanPropertiesCensor.java @@ -16,7 +16,7 @@ import org.springframework.stereotype.Component; import java.util.UUID; -@Component("dmppropertiescensor") +@Component("planpropertiescensor") @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class PlanPropertiesCensor extends BaseCensor { @@ -39,8 +39,8 @@ public class PlanPropertiesCensor extends BaseCensor { return; this.authService.authorizeForce(Permission.BrowsePlan, Permission.DeferredAffiliation); - FieldSet dmpBlueprintValuesFields = fields.extractPrefixed(this.asIndexerPrefix(PlanProperties._planBlueprintValues)); - this.censorFactory.censor(PlanBlueprintValueCensor.class).censor(dmpBlueprintValuesFields, userId); + FieldSet planBlueprintValuesFields = fields.extractPrefixed(this.asIndexerPrefix(PlanProperties._planBlueprintValues)); + this.censorFactory.censor(PlanBlueprintValueCensor.class).censor(planBlueprintValuesFields, 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/planblueprint/DefinitionCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/planblueprint/DefinitionCensor.java index dfcc6a972..d232ac0b9 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/planblueprint/DefinitionCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/planblueprint/DefinitionCensor.java @@ -16,7 +16,7 @@ import org.springframework.stereotype.Component; import java.util.UUID; -@Component("dmpblueprintdefinitioncensor") +@Component("planblueprintdefinitioncensor") @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class DefinitionCensor extends BaseCensor { diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/planblueprint/DescriptionTemplatesCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/planblueprint/DescriptionTemplatesCensor.java index c45d56710..b0465c5ce 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/planblueprint/DescriptionTemplatesCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/planblueprint/DescriptionTemplatesCensor.java @@ -14,7 +14,7 @@ import org.springframework.stereotype.Component; import java.util.UUID; -@Component("dmpblueprintdefinitiondescriptiontemplatecensor") +@Component("planblueprintdefinitiondescriptiontemplatecensor") @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class DescriptionTemplatesCensor extends BaseCensor { diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/planblueprint/FieldCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/planblueprint/FieldCensor.java index ec5f824f5..3f8555291 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/planblueprint/FieldCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/planblueprint/FieldCensor.java @@ -14,7 +14,7 @@ import org.springframework.stereotype.Component; import java.util.UUID; -@Component("dmpblueprintdefinitionfieldcensor") +@Component("planblueprintdefinitionfieldcensor") @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class FieldCensor extends BaseCensor { diff --git a/backend/core/src/main/java/org/opencdmp/model/censorship/planblueprint/SectionCensor.java b/backend/core/src/main/java/org/opencdmp/model/censorship/planblueprint/SectionCensor.java index 44ec3cde1..74f073ebf 100644 --- a/backend/core/src/main/java/org/opencdmp/model/censorship/planblueprint/SectionCensor.java +++ b/backend/core/src/main/java/org/opencdmp/model/censorship/planblueprint/SectionCensor.java @@ -16,7 +16,7 @@ import org.springframework.stereotype.Component; import java.util.UUID; -@Component("dmpblueprintdefinitionsectioncensor") +@Component("planblueprintdefinitionsectioncensor") @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class SectionCensor extends BaseCensor { diff --git a/backend/core/src/main/java/org/opencdmp/model/deleter/PlanDeleter.java b/backend/core/src/main/java/org/opencdmp/model/deleter/PlanDeleter.java index 4935b24a5..c49475948 100644 --- a/backend/core/src/main/java/org/opencdmp/model/deleter/PlanDeleter.java +++ b/backend/core/src/main/java/org/opencdmp/model/deleter/PlanDeleter.java @@ -104,9 +104,9 @@ public class PlanDeleter implements Deleter { 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(PlanVersionStatus.Current)) throw new MyApplicationException("DMP is current can not deleted"); + EntityDoiQuery entityDoiQuery = this.queryFactory.query(EntityDoiQuery.class).authorize(AuthorizationFlags.AllExceptPublic).types(EntityType.Plan).entityIds(item.getId()); + if (entityDoiQuery.count() > 0) throw new MyApplicationException("Plan is deposited can not deleted"); + if(item.getVersionStatus().equals(PlanVersionStatus.Current)) throw new MyApplicationException("Plan is current can not deleted"); item.setIsActive(IsActive.Inactive); item.setUpdatedAt(now); logger.trace("updating item"); 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 034e430ca..b3255800b 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 @@ -44,8 +44,8 @@ public class PlanToPublicApiPlanMapper { 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.setGrant(GrantPublicOverviewModel.fromPlanReferences(plan.getPlanReferences(), config)); + model.setOrganisations(plan.getPlanReferences().stream().map(x-> OrganizationPublicModel.fromPlanReference(x, config)).filter(Objects::nonNull).toList()); model.setDois(doiEntities.stream().map(DoiPublicModel::fromDataModel).toList()); model.setAssociatedProfiles(descriptionTemplates.stream().map(x -> AssociatedProfilePublicModel.fromPlanDescriptionTemplate(x, plan.getBlueprint())).toList()); diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/PlanPersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/PlanPersist.java index 96d556118..0df095587 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/PlanPersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/PlanPersist.java @@ -243,7 +243,7 @@ public class PlanPersist { this.spec() .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())), + .failOn(PlanPersist._descriptionTemplates).failWith(this.messageSource.getMessage("Validation.InvalidDescriptionTemplateMultiplicityOnPlan", new Object[]{PlanPersist._descriptionTemplates}, LocaleContextHolder.getLocale())), this.refSpec() .iff(() -> !this.isNull(item.getProperties())) .on(PlanPersist._properties) diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/descriptionproperties/FieldPersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/descriptionproperties/FieldPersist.java index 556598841..05ad117c0 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/descriptionproperties/FieldPersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/descriptionproperties/FieldPersist.java @@ -10,7 +10,6 @@ import org.opencdmp.commons.validation.BaseValidator; import org.opencdmp.convention.ConventionService; import org.opencdmp.errorcode.ErrorThesaurusProperties; import org.opencdmp.model.persist.ReferencePersist; -import org.opencdmp.model.persist.TagPersist; import org.opencdmp.service.visibility.VisibilityService; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.MessageSource; @@ -179,7 +178,7 @@ public class FieldPersist { .must(() -> !this.isListNullOrEmpty(item.getReferences()) || !this.isNull(item.getReference())) .failOn(FieldPersist._textListValue).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._textListValue}, LocaleContextHolder.getLocale())), this.spec() - .iff(()-> !this.isNull(item.getTextListValue()) && (fieldType.equals(FieldType.INTERNAL_ENTRIES_DMPS) || fieldType.equals(FieldType.INTERNAL_ENTRIES_DESCRIPTIONS))) + .iff(()-> !this.isNull(item.getTextListValue()) && (fieldType.equals(FieldType.INTERNAL_ENTRIES_PLANS) || fieldType.equals(FieldType.INTERNAL_ENTRIES_DESCRIPTIONS))) .must(() -> item.getTextListValue().stream().allMatch(this::isUUID)) .failOn(FieldPersist._textListValue).failWith(this.messageSource.getMessage("Validation_UnexpectedValue", new Object[]{FieldPersist._textListValue}, LocaleContextHolder.getLocale())), this.navSpec() diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/descriptiontemplatedefinition/RulePersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/descriptiontemplatedefinition/RulePersist.java index 47043c8ea..68f301f00 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/descriptiontemplatedefinition/RulePersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/descriptiontemplatedefinition/RulePersist.java @@ -110,7 +110,7 @@ public class RulePersist { .failOn(RulePersist._target).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{RulePersist._target}, LocaleContextHolder.getLocale())), this.spec() .iff(() -> this.isNull(fieldType)) - .must(() -> !FieldType.TAGS.equals(fieldType) && !FieldType.INTERNAL_ENTRIES_DESCRIPTIONS.equals(fieldType) && !FieldType.INTERNAL_ENTRIES_DMPS.equals(fieldType) && + .must(() -> !FieldType.TAGS.equals(fieldType) && !FieldType.INTERNAL_ENTRIES_DESCRIPTIONS.equals(fieldType) && !FieldType.INTERNAL_ENTRIES_PLANS.equals(fieldType) && !FieldType.UPLOAD.equals(fieldType) && !FieldType.REFERENCE_TYPES.equals(fieldType) && !FieldType.DATASET_IDENTIFIER.equals(fieldType) && !FieldType.VALIDATION.equals(fieldType)) .failOn(RulePersist._target).failWith(this.messageSource.getMessage("Validation_UnexpectedValue", new Object[]{RulePersist._target}, LocaleContextHolder.getLocale())), diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/descriptiontemplatedefinition/fielddata/BaseFieldDataPersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/descriptiontemplatedefinition/fielddata/BaseFieldDataPersist.java index 7264e1f41..9c6344791 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/descriptiontemplatedefinition/fielddata/BaseFieldDataPersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/descriptiontemplatedefinition/fielddata/BaseFieldDataPersist.java @@ -23,7 +23,7 @@ import java.util.List; @JsonSubTypes({ @JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.BooleanDecision), @JsonSubTypes.Type(value = LabelAndMultiplicityDataPersist.class, name = FieldType.Names.InternalEntitiesDescriptions), - @JsonSubTypes.Type(value = LabelAndMultiplicityDataPersist.class, name = FieldType.Names.InternalEntitiesDmps), + @JsonSubTypes.Type(value = LabelAndMultiplicityDataPersist.class, name = FieldType.Names.InternalEntitiesPlans), @JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.CheckBox), @JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.DatePicker), @JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.FreeText), diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/dmpblueprintdefinition/DefinitionPersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/dmpblueprintdefinition/DefinitionPersist.java index eea9764e5..205efa2bc 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/dmpblueprintdefinition/DefinitionPersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/dmpblueprintdefinition/DefinitionPersist.java @@ -35,7 +35,7 @@ public class DefinitionPersist { @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public static class DefinitionPersistValidator extends BaseValidator { - public static final String ValidatorName = "DmpBlueprint.DefinitionPersistValidator"; + public static final String ValidatorName = "PlanBlueprint.DefinitionPersistValidator"; private final MessageSource messageSource; diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/dmpblueprintdefinition/DescriptionTemplatePersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/dmpblueprintdefinition/DescriptionTemplatePersist.java index 9414472ce..a81e17910 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/dmpblueprintdefinition/DescriptionTemplatePersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/dmpblueprintdefinition/DescriptionTemplatePersist.java @@ -68,7 +68,7 @@ public class DescriptionTemplatePersist { @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public static class DescriptionTemplatePersistValidator extends BaseValidator { - public static final String ValidatorName = "DmpBlueprint.DescriptionTemplatePersistValidator"; + public static final String ValidatorName = "PlanBlueprint.DescriptionTemplatePersistValidator"; private final MessageSource messageSource; 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 4255192c7..6d4bf9373 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 @@ -31,7 +31,7 @@ public class ExtraFieldPersist extends FieldPersist { @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public static class ExtraFieldPersistValidator extends BaseFieldPersistValidator { - public static final String ValidatorName = "DmpBlueprint.ExtraFieldPersistValidator"; + public static final String ValidatorName = "PlanBlueprint.ExtraFieldPersistValidator"; protected ExtraFieldPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) { super(conventionService, errors, messageSource); diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/dmpblueprintdefinition/ReferenceTypeFieldPersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/dmpblueprintdefinition/ReferenceTypeFieldPersist.java index 4768699ec..e3c0eb963 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/dmpblueprintdefinition/ReferenceTypeFieldPersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/dmpblueprintdefinition/ReferenceTypeFieldPersist.java @@ -44,7 +44,7 @@ public class ReferenceTypeFieldPersist extends FieldPersist { @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public static class ReferenceFieldPersistPersistValidator extends BaseFieldPersistValidator { - public static final String ValidatorName = "DmpBlueprint.ReferenceFieldPersistPersistValidator"; + public static final String ValidatorName = "PlanBlueprint.ReferenceFieldPersistPersistValidator"; protected ReferenceFieldPersistPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) { super(conventionService, errors, messageSource); diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/dmpblueprintdefinition/SectionPersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/dmpblueprintdefinition/SectionPersist.java index 2f28f5112..eabcf2844 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/dmpblueprintdefinition/SectionPersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/dmpblueprintdefinition/SectionPersist.java @@ -117,7 +117,7 @@ public class SectionPersist { @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public static class SectionPersistValidator extends BaseValidator { - public static final String ValidatorName = "DmpBlueprint.SectionPersistValidator"; + public static final String ValidatorName = "PlanBlueprint.SectionPersistValidator"; private final MessageSource messageSource; 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 a76e165bd..ee15c62e5 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 @@ -30,7 +30,7 @@ public class SystemFieldPersist extends FieldPersist { @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public static class SystemFieldPersistValidator extends BaseFieldPersistValidator { - public static final String ValidatorName = "DmpBlueprint.SystemFieldPersistValidator"; + public static final String ValidatorName = "PlanBlueprint.SystemFieldPersistValidator"; protected SystemFieldPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) { super(conventionService, errors, messageSource); 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 f73184694..747ea643b 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 @@ -60,13 +60,13 @@ public class AssociatedProfilePublicModel { model.setDescriptionTemplateId(currentDescriptionTemplate.getId()); model.setLabel(currentDescriptionTemplate.getLabel()); HashMap data = new HashMap<>(); - data.put("dmpSectionIndex", getDmpSectionIndexes(planBlueprint, sectionId)); + data.put("planSectionIndex", getPlanSectionIndexes(planBlueprint, sectionId)); model.setData(data); return model; } - private static List getDmpSectionIndexes(PlanBlueprint planBlueprint, UUID sectionId) { + private static List getPlanSectionIndexes(PlanBlueprint planBlueprint, UUID sectionId) { ArrayList indexes = new ArrayList<>(); planBlueprint.getDefinition().getSections().forEach(x -> { if (Objects.equals(sectionId, x.getId())) 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 0452c61fd..61e8f23e3 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 @@ -79,7 +79,7 @@ public class GrantPublicOverviewModel { this.funder = funder; } - public static GrantPublicOverviewModel fromDmpReferences(List references, PublicApiProperties.ReferenceTypeMapConfig config) { + public static GrantPublicOverviewModel fromPlanReferences(List references, PublicApiProperties.ReferenceTypeMapConfig config) { FunderPublicOverviewModel funder = null; for (PlanReference planReference : references) { if (!Objects.equals(planReference.getReference().getType().getId(), config.getFunderTypeId())) { 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 b043794af..f3ad58d63 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 @@ -48,7 +48,7 @@ public class OrganizationPublicModel { this.key = key; } - public static OrganizationPublicModel fromDmpReference(PlanReference planReference, PublicApiProperties.ReferenceTypeMapConfig config) { + public static OrganizationPublicModel fromPlanReference(PlanReference planReference, PublicApiProperties.ReferenceTypeMapConfig config) { if (!Objects.equals(planReference.getReference().getType().getId(), config.getOrganizationTypeId())) return null; OrganizationPublicModel model = new OrganizationPublicModel(); 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 bff0de648..2d4559413 100644 --- a/backend/core/src/main/java/org/opencdmp/query/DescriptionQuery.java +++ b/backend/core/src/main/java/org/opencdmp/query/DescriptionQuery.java @@ -113,7 +113,7 @@ public class DescriptionQuery extends QueryBase { return this; } - public DescriptionQuery dmpDescriptionTemplateSubQuery(PlanDescriptionTemplateQuery subQuery) { + public DescriptionQuery planDescriptionTemplateSubQuery(PlanDescriptionTemplateQuery subQuery) { this.planDescriptionTemplateQuery = subQuery; return this; } @@ -153,7 +153,7 @@ public class DescriptionQuery extends QueryBase { return this; } - public DescriptionQuery dmpSubQuery(PlanQuery subQuery) { + public DescriptionQuery planSubQuery(PlanQuery subQuery) { this.planQuery = subQuery; return this; } @@ -270,7 +270,7 @@ public class DescriptionQuery extends QueryBase { return null; UUID userId; boolean usePublic = this.authorize.contains(AuthorizationFlags.Public); - if (this.authorize.contains(AuthorizationFlags.DmpAssociated)) + if (this.authorize.contains(AuthorizationFlags.PlanAssociated)) userId = this.userScope.getUserIdSafe(); else userId = null; @@ -345,11 +345,11 @@ public class DescriptionQuery extends QueryBase { predicates.add(inClause); } if (this.planDescriptionTemplateQuery != null) { - QueryContext subQuery = this.applySubQuery(this.planDescriptionTemplateQuery, queryContext, UUID.class, dmpDescriptionTemplateEntityRoot -> dmpDescriptionTemplateEntityRoot.get(PlanDescriptionTemplateEntity._id)); + QueryContext subQuery = this.applySubQuery(this.planDescriptionTemplateQuery, queryContext, UUID.class, planDescriptionTemplateEntityRoot -> planDescriptionTemplateEntityRoot.get(PlanDescriptionTemplateEntity._id)); predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionEntity._planDescriptionTemplateId)).value(subQuery.Query)); } if (this.planQuery != null) { - QueryContext subQuery = this.applySubQuery(this.planQuery, queryContext, UUID.class, dmpEntityRoot -> dmpEntityRoot.get(PlanEntity._id)); + QueryContext subQuery = this.applySubQuery(this.planQuery, queryContext, UUID.class, planEntityRoot -> planEntityRoot.get(PlanEntity._id)); predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionEntity._planId)).value(subQuery.Query)); } if (this.descriptionTemplateQuery != null) { diff --git a/backend/core/src/main/java/org/opencdmp/query/DescriptionReferenceQuery.java b/backend/core/src/main/java/org/opencdmp/query/DescriptionReferenceQuery.java index 9c435a3c7..9e1844345 100644 --- a/backend/core/src/main/java/org/opencdmp/query/DescriptionReferenceQuery.java +++ b/backend/core/src/main/java/org/opencdmp/query/DescriptionReferenceQuery.java @@ -166,7 +166,7 @@ public class DescriptionReferenceQuery extends QueryBase predicates = new ArrayList<>(); if (userId != null || usePublic) { - Subquery dmpDescriptionTemplateSubquery = this.queryUtilsService.buildSubQuery(new BuildSubQueryInput<>( + Subquery planDescriptionTemplateSubquery = this.queryUtilsService.buildSubQuery(new BuildSubQueryInput<>( new BuildSubQueryInput.Builder<>(PlanDescriptionTemplateEntity.class, UUID.class, queryContext) .keyPathFunc((subQueryRoot) -> subQueryRoot.get(PlanDescriptionTemplateEntity._descriptionTemplateGroupId)) .filterFunc((subQueryRoot, cb) -> - cb.in(subQueryRoot.get(PlanDescriptionTemplateEntity._planId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic)) + cb.in(subQueryRoot.get(PlanDescriptionTemplateEntity._planId)).value(this.queryUtilsService.buildPlanAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic)) ) )); - predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionTemplateEntity._groupId)).value(dmpDescriptionTemplateSubquery)); + predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionTemplateEntity._groupId)).value(planDescriptionTemplateSubquery)); } if (!predicates.isEmpty()) { Predicate[] predicatesArray = predicates.toArray(new Predicate[0]); 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 1da0d8c25..59bd50298 100644 --- a/backend/core/src/main/java/org/opencdmp/query/EntityDoiQuery.java +++ b/backend/core/src/main/java/org/opencdmp/query/EntityDoiQuery.java @@ -217,7 +217,7 @@ public class EntityDoiQuery extends QueryBase { List predicates = new ArrayList<>(); boolean usePublic = this.authorize.contains(AuthorizationFlags.Public); if (userId != null || usePublic) { - predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(EntityDoiEntity._entityId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic))); + predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(EntityDoiEntity._entityId)).value(this.queryUtilsService.buildPlanAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic))); } if (!predicates.isEmpty()) { Predicate[] predicatesArray = predicates.toArray(new Predicate[0]); diff --git a/backend/core/src/main/java/org/opencdmp/query/PlanDescriptionTemplateQuery.java b/backend/core/src/main/java/org/opencdmp/query/PlanDescriptionTemplateQuery.java index 45318bf5f..9f66c1a51 100644 --- a/backend/core/src/main/java/org/opencdmp/query/PlanDescriptionTemplateQuery.java +++ b/backend/core/src/main/java/org/opencdmp/query/PlanDescriptionTemplateQuery.java @@ -200,12 +200,12 @@ public class PlanDescriptionTemplateQuery extends QueryBase predicates = new ArrayList<>(); if (userId != null || usePublic) { - predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanDescriptionTemplateEntity._planId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic))); + predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanDescriptionTemplateEntity._planId)).value(this.queryUtilsService.buildPlanAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic))); } if (!predicates.isEmpty()) { Predicate[] predicatesArray = predicates.toArray(new Predicate[0]); diff --git a/backend/core/src/main/java/org/opencdmp/query/PlanQuery.java b/backend/core/src/main/java/org/opencdmp/query/PlanQuery.java index dfdcd1ae3..9d0e1ca30 100644 --- a/backend/core/src/main/java/org/opencdmp/query/PlanQuery.java +++ b/backend/core/src/main/java/org/opencdmp/query/PlanQuery.java @@ -242,7 +242,7 @@ public class PlanQuery extends QueryBase { public PlanQuery entityDoiSubQuery(EntityDoiQuery subQuery) { this.entityDoiQuery = subQuery; - this.entityDoiQuery.types(EntityType.DMP); + this.entityDoiQuery.types(EntityType.Plan); return this; } @@ -284,7 +284,7 @@ public class PlanQuery extends QueryBase { return null; UUID userId = null; boolean usePublic = this.authorize.contains(AuthorizationFlags.Public); - if (this.authorize.contains(AuthorizationFlags.DmpAssociated)) + if (this.authorize.contains(AuthorizationFlags.PlanAssociated)) userId = this.userScope.getUserIdSafe(); List predicates = new ArrayList<>(); @@ -295,7 +295,7 @@ public class PlanQuery extends QueryBase { 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(PlanEntity._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.buildPlanUserAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId)) : queryContext.CriteriaBuilder.or() //Creates a false query )); } if (!predicates.isEmpty()) { diff --git a/backend/core/src/main/java/org/opencdmp/query/PlanReferenceQuery.java b/backend/core/src/main/java/org/opencdmp/query/PlanReferenceQuery.java index 0dbcd75bc..d212282e4 100644 --- a/backend/core/src/main/java/org/opencdmp/query/PlanReferenceQuery.java +++ b/backend/core/src/main/java/org/opencdmp/query/PlanReferenceQuery.java @@ -103,7 +103,7 @@ public class PlanReferenceQuery extends QueryBase { return this; } - public PlanReferenceQuery dmpSubQuery(PlanQuery value) { + public PlanReferenceQuery planSubQuery(PlanQuery value) { this.planQuery = value; return this; } @@ -165,12 +165,12 @@ public class PlanReferenceQuery extends QueryBase { 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(); + if (this.authorize.contains(AuthorizationFlags.PlanAssociated)) userId = this.userScope.getUserIdSafe(); else userId = null; List predicates = new ArrayList<>(); if (userId != null || usePublic ) { - predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanReferenceEntity._planId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic))); + predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanReferenceEntity._planId)).value(this.queryUtilsService.buildPlanAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic))); } if (!predicates.isEmpty()) { Predicate[] predicatesArray = predicates.toArray(new Predicate[0]); @@ -208,7 +208,7 @@ public class PlanReferenceQuery extends QueryBase { predicates.add(inClause); } if (this.planQuery != null) { - QueryContext subQuery = this.applySubQuery(this.planQuery, queryContext, UUID.class, dmpEntityRoot -> dmpEntityRoot.get(PlanEntity._id)); + QueryContext subQuery = this.applySubQuery(this.planQuery, queryContext, UUID.class, planEntityRoot -> planEntityRoot.get(PlanEntity._id)); predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanReferenceEntity._planId)).value(subQuery.Query)); } if (this.referenceQuery != null) { diff --git a/backend/core/src/main/java/org/opencdmp/query/PlanUserQuery.java b/backend/core/src/main/java/org/opencdmp/query/PlanUserQuery.java index 13776eff4..c60f27277 100644 --- a/backend/core/src/main/java/org/opencdmp/query/PlanUserQuery.java +++ b/backend/core/src/main/java/org/opencdmp/query/PlanUserQuery.java @@ -212,13 +212,13 @@ public class PlanUserQuery extends QueryBase { 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(); + if (this.authorize.contains(AuthorizationFlags.PlanAssociated)) userId = this.userScope.getUserIdSafe(); List predicates = new ArrayList<>(); if (userId != null || usePublic ) { predicates.add(queryContext.CriteriaBuilder.or( - 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 + usePublic ? queryContext.CriteriaBuilder.in(queryContext.Root.get(PlanUserEntity._planId)).value(this.queryUtilsService.buildPublicPlanAuthZSubQuery(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.buildPlanUserAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId)) : queryContext.CriteriaBuilder.or() //Creates a false query )); } if (!predicates.isEmpty()) { 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 7888e0e98..bd2fa37b2 100644 --- a/backend/core/src/main/java/org/opencdmp/query/ReferenceQuery.java +++ b/backend/core/src/main/java/org/opencdmp/query/ReferenceQuery.java @@ -166,7 +166,7 @@ public class ReferenceQuery extends QueryBase { return this; } - public ReferenceQuery dmpReferenceSubQuery(PlanReferenceQuery value) { + public ReferenceQuery planReferenceSubQuery(PlanReferenceQuery value) { this.planReferenceQuery = value; return this; } @@ -224,7 +224,7 @@ public class ReferenceQuery extends QueryBase { return null; UUID userId; boolean usePublic = this.authorize.contains(AuthorizationFlags.Public); - if (this.authorize.contains(AuthorizationFlags.DmpAssociated)) + if (this.authorize.contains(AuthorizationFlags.PlanAssociated)) userId = this.userScope.getUserIdSafe(); else userId = null; @@ -239,7 +239,7 @@ public class ReferenceQuery extends QueryBase { .criteriaBuilder(queryContext.CriteriaBuilder) .keyPathFunc((subQueryRoot) -> subQueryRoot.get(PlanReferenceEntity._referenceId)) .filterFunc((subQueryRoot, cb) -> - cb.in(subQueryRoot.get(PlanReferenceEntity._planId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic)) + cb.in(subQueryRoot.get(PlanReferenceEntity._planId)).value(this.queryUtilsService.buildPlanAuthZSubQuery(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) diff --git a/backend/core/src/main/java/org/opencdmp/query/TagQuery.java b/backend/core/src/main/java/org/opencdmp/query/TagQuery.java index f0b591cd2..baa6e75ea 100644 --- a/backend/core/src/main/java/org/opencdmp/query/TagQuery.java +++ b/backend/core/src/main/java/org/opencdmp/query/TagQuery.java @@ -199,7 +199,7 @@ public class TagQuery extends QueryBase { if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowseTag)) return null; UUID userId; boolean usePublic = this.authorize.contains(AuthorizationFlags.Public); - if (this.authorize.contains(AuthorizationFlags.DmpAssociated)) userId = this.userScope.getUserIdSafe(); + if (this.authorize.contains(AuthorizationFlags.PlanAssociated)) userId = this.userScope.getUserIdSafe(); else userId = null; List predicates = new ArrayList<>(); 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 3ee6c1dd4..dd0ebd888 100644 --- a/backend/core/src/main/java/org/opencdmp/query/UserContactInfoQuery.java +++ b/backend/core/src/main/java/org/opencdmp/query/UserContactInfoQuery.java @@ -188,7 +188,7 @@ public class UserContactInfoQuery extends QueryBase { .criteriaBuilder(queryContext.CriteriaBuilder) .keyPathFunc((subQueryRoot) -> subQueryRoot.get(PlanUserEntity._userId)) .filterFunc((subQueryRoot, cb) -> - cb.in(subQueryRoot.get(PlanUserEntity._planId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, false)) + cb.in(subQueryRoot.get(PlanUserEntity._planId)).value(this.queryUtilsService.buildPlanAuthZSubQuery(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 06c6cb0dc..56ac8c7e1 100644 --- a/backend/core/src/main/java/org/opencdmp/query/UserQuery.java +++ b/backend/core/src/main/java/org/opencdmp/query/UserQuery.java @@ -173,7 +173,7 @@ public class UserQuery extends QueryBase { if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowseUser)) return null; UUID userId; if (this.authorize.contains(AuthorizationFlags.Owner)) userId = this.userScope.getUserIdSafe(); - if (this.authorize.contains(AuthorizationFlags.DmpAssociated)) userId = this.userScope.getUserIdSafe(); + if (this.authorize.contains(AuthorizationFlags.PlanAssociated)) userId = this.userScope.getUserIdSafe(); if (this.authorize.contains(AuthorizationFlags.DescriptionTemplateAssociated)) userId = this.userScope.getUserIdSafe(); else userId = null; @@ -188,7 +188,7 @@ public class UserQuery extends QueryBase { .criteriaBuilder(queryContext.CriteriaBuilder) .keyPathFunc((subQueryRoot) -> subQueryRoot.get(PlanUserEntity._userId)) .filterFunc((subQueryRoot, cb) -> - cb.in(subQueryRoot.get(PlanUserEntity._planId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, finalUserId, usePublic)) + cb.in(subQueryRoot.get(PlanUserEntity._planId)).value(this.queryUtilsService.buildPlanAuthZSubQuery(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) @@ -260,15 +260,15 @@ public class UserQuery extends QueryBase { if (this.userScope.isSet()) userId = this.userScope.getUserIdSafe(); else throw new MyNotFoundException("Only user scoped allowed"); - Subquery dmpUserUserQuery = this.queryUtilsService.buildSubQuery(new BuildSubQueryInput<>( + Subquery planUserUserQuery = this.queryUtilsService.buildSubQuery(new BuildSubQueryInput<>( new BuildSubQueryInput.Builder<>(PlanUserEntity.class, UUID.class, queryContext) .keyPathFunc((subQueryRoot) -> subQueryRoot.get(PlanUserEntity._userId)) .filterFunc((subQueryRoot, cb) -> cb.and( - cb.in(subQueryRoot.get(PlanUserEntity._planId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, false)) , + cb.in(subQueryRoot.get(PlanUserEntity._planId)).value(this.queryUtilsService.buildPlanAuthZSubQuery(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)); + predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(UserEntity._id)).value(planUserUserQuery)); } diff --git a/backend/core/src/main/java/org/opencdmp/query/UserSettingsQuery.java b/backend/core/src/main/java/org/opencdmp/query/UserSettingsQuery.java index 48fb51427..66c06ddd2 100644 --- a/backend/core/src/main/java/org/opencdmp/query/UserSettingsQuery.java +++ b/backend/core/src/main/java/org/opencdmp/query/UserSettingsQuery.java @@ -166,7 +166,7 @@ public class UserSettingsQuery extends QueryBase { if (this.authorize.contains(AuthorizationFlags.None)) return null; if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowseUserSettings)) return null; UUID ownerId = null; - if (this.authorize.contains(AuthorizationFlags.DmpAssociated)) ownerId = this.userScope.getUserIdSafe(); + if (this.authorize.contains(AuthorizationFlags.PlanAssociated)) ownerId = this.userScope.getUserIdSafe(); List predicates = new ArrayList<>(); if (ownerId != null) { 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 f79f9d5f2..d36cf7f92 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 @@ -81,7 +81,7 @@ public class DescriptionLookup extends Lookup { public DescriptionTemplateLookup getDescriptionTemplateSubQuery() { return this.descriptionTemplateSubQuery; } - public void setDescriptionTemplateSubQuery(DescriptionTemplateLookup dmpSubQuery) { this.descriptionTemplateSubQuery = dmpSubQuery; } + public void setDescriptionTemplateSubQuery(DescriptionTemplateLookup descriptionTemplateSubQuery) { this.descriptionTemplateSubQuery = descriptionTemplateSubQuery; } public DescriptionReferenceLookup getDescriptionReferenceSubQuery() { return this.descriptionReferenceSubQuery; } @@ -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.planSubQuery != null) query.dmpSubQuery(this.planSubQuery.enrich(queryFactory)); + if (this.planSubQuery != null) query.planSubQuery(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)); diff --git a/backend/core/src/main/java/org/opencdmp/query/lookup/PlanLookup.java b/backend/core/src/main/java/org/opencdmp/query/lookup/PlanLookup.java index 5417e4d14..f9ee09398 100644 --- a/backend/core/src/main/java/org/opencdmp/query/lookup/PlanLookup.java +++ b/backend/core/src/main/java/org/opencdmp/query/lookup/PlanLookup.java @@ -8,7 +8,7 @@ import org.opencdmp.commons.enums.PlanStatus; import org.opencdmp.commons.enums.PlanVersionStatus; import org.opencdmp.commons.enums.IsActive; import org.opencdmp.elastic.query.PlanElasticQuery; -import org.opencdmp.elastic.query.InnerObjectDmpElasticQuery; +import org.opencdmp.elastic.query.InnerObjectPlanElasticQuery; import org.opencdmp.query.PlanQuery; import java.util.List; @@ -126,12 +126,12 @@ public class PlanLookup extends Lookup { public PlanBlueprintLookup getPlanBlueprintSubQuery() { return this.planBlueprintSubQuery; } - public void setPlanBlueprintLookup(PlanBlueprintLookup dmpBlueprintSubQuery) { this.planBlueprintSubQuery = dmpBlueprintSubQuery; } + public void setPlanBlueprintLookup(PlanBlueprintLookup planBlueprintSubQuery) { this.planBlueprintSubQuery = planBlueprintSubQuery; } public PlanReferenceLookup getPlanReferenceSubQuery() { return this.planReferenceSubQuery; } - public void setPlanReferenceLookup(PlanReferenceLookup dmpReferenceSubQuery) { this.planReferenceSubQuery = dmpReferenceSubQuery; } + public void setPlanReferenceLookup(PlanReferenceLookup planReferenceSubQuery) { this.planReferenceSubQuery = planReferenceSubQuery; } public PlanQuery enrich(QueryFactory queryFactory) { PlanQuery query = queryFactory.query(PlanQuery.class); @@ -172,8 +172,8 @@ public class PlanLookup extends Lookup { return query; } - public InnerObjectDmpElasticQuery enrichElasticInner(QueryFactory queryFactory) { - InnerObjectDmpElasticQuery query = queryFactory.query(InnerObjectDmpElasticQuery.class); + public InnerObjectPlanElasticQuery enrichElasticInner(QueryFactory queryFactory) { + InnerObjectPlanElasticQuery query = queryFactory.query(InnerObjectPlanElasticQuery.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); @@ -183,7 +183,7 @@ public class PlanLookup extends Lookup { if (this.versions != null) query.versions(this.versions); if (this.versionStatuses != null) query.versionStatuses(this.versionStatuses); if (this.planDescriptionTemplateSubQuery != null) throw new UnsupportedOperationException(""); - if (this.planUserSubQuery != null) query.dmpSubQuery(this.planUserSubQuery.enrichElasticInner(queryFactory)); + if (this.planUserSubQuery != null) query.planSubQuery(this.planUserSubQuery.enrichElasticInner(queryFactory)); // TODO ?? return query; } diff --git a/backend/core/src/main/java/org/opencdmp/query/utils/QueryUtilsService.java b/backend/core/src/main/java/org/opencdmp/query/utils/QueryUtilsService.java index 69191d64e..e8eb966e6 100644 --- a/backend/core/src/main/java/org/opencdmp/query/utils/QueryUtilsService.java +++ b/backend/core/src/main/java/org/opencdmp/query/utils/QueryUtilsService.java @@ -7,19 +7,19 @@ import java.util.UUID; public interface QueryUtilsService { Subquery buildSubQuery(BuildSubQueryInput parameters); - Subquery buildDmpAuthZSubQuery(AbstractQuery query, CriteriaBuilder criteriaBuilder, UUID userId, Boolean usePublic); + Subquery buildPlanAuthZSubQuery(AbstractQuery query, CriteriaBuilder criteriaBuilder, UUID userId, Boolean usePublic); Subquery buildUserDescriptionTemplateEntityAuthZSubQuery(AbstractQuery query, CriteriaBuilder criteriaBuilder, UUID userId); Subquery buildDescriptionAuthZSubQuery(AbstractQuery query, CriteriaBuilder criteriaBuilder, UUID userId, Boolean usePublic); - Subquery buildPublicDmpAuthZSubQuery(AbstractQuery query, - CriteriaBuilder criteriaBuilder, - Boolean usePublic); + Subquery buildPublicPlanAuthZSubQuery(AbstractQuery query, + CriteriaBuilder criteriaBuilder, + Boolean usePublic); - Subquery buildDmpUserAuthZSubQuery(AbstractQuery query, - CriteriaBuilder criteriaBuilder, - UUID userId); + Subquery buildPlanUserAuthZSubQuery(AbstractQuery query, + CriteriaBuilder criteriaBuilder, + UUID userId); Predicate ilike(CriteriaBuilder criteriaBuilder, Expression path, String value); } 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 980930509..443f8b447 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 @@ -26,7 +26,7 @@ public class QueryUtilsServiceImpl implements QueryUtilsService { } @Override - public Subquery buildDmpAuthZSubQuery(AbstractQuery query, CriteriaBuilder criteriaBuilder, UUID userId, Boolean usePublic){ + public Subquery buildPlanAuthZSubQuery(AbstractQuery query, CriteriaBuilder criteriaBuilder, UUID userId, Boolean usePublic){ return this.buildSubQuery(new BuildSubQueryInput<>( new BuildSubQueryInput.Builder<>(PlanEntity.class, UUID.class) .query(query) @@ -38,7 +38,7 @@ public class QueryUtilsServiceImpl implements QueryUtilsService { 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(PlanEntity._id)).value(this.buildDmpUserAuthZSubQuery(query, criteriaBuilder, userId)) : cb.or() //Creates a false query + userId != null ? cb.in(subQueryRoot.get(PlanEntity._id)).value(this.buildPlanUserAuthZSubQuery(query, criteriaBuilder, userId)) : 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._planId)).value(this.buildPublicDmpAuthZSubQuery(query, criteriaBuilder, usePublic)) + cb.in(subQueryRoot.get(DescriptionEntity._planId)).value(this.buildPublicPlanAuthZSubQuery(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._planId)).value(this.buildDmpUserAuthZSubQuery(query, criteriaBuilder, userId)) + cb.in(subQueryRoot.get(DescriptionEntity._planId)).value(this.buildPlanUserAuthZSubQuery(query, criteriaBuilder, userId)) ) : cb.or() //Creates a false query ) ) @@ -84,7 +84,7 @@ public class QueryUtilsServiceImpl implements QueryUtilsService { } @Override - public Subquery buildPublicDmpAuthZSubQuery(AbstractQuery query, CriteriaBuilder criteriaBuilder, Boolean usePublic){ + public Subquery buildPublicPlanAuthZSubQuery(AbstractQuery query, CriteriaBuilder criteriaBuilder, Boolean usePublic){ return this.buildSubQuery(new BuildSubQueryInput<>( new BuildSubQueryInput.Builder<>(PlanEntity.class, UUID.class) .query(query) @@ -101,7 +101,7 @@ public class QueryUtilsServiceImpl implements QueryUtilsService { } @Override - public Subquery buildDmpUserAuthZSubQuery(AbstractQuery query, CriteriaBuilder criteriaBuilder, UUID userId){ + public Subquery buildPlanUserAuthZSubQuery(AbstractQuery query, CriteriaBuilder criteriaBuilder, UUID userId){ return this.buildSubQuery(new BuildSubQueryInput<>(new BuildSubQueryInput.Builder<>(PlanUserEntity.class, UUID.class) .query(query) .criteriaBuilder(criteriaBuilder) 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 d2d2179a2..12e7028d2 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 @@ -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 PlanInvitation -> data.setData(this.xmlHandlingService.toXmlSafe(this.buildDmpInvitationEntity(model.getPlanInvitation()))); + case PlanInvitation -> data.setData(this.xmlHandlingService.toXmlSafe(this.buildPlanInvitationEntity(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,7 +119,7 @@ public class ActionConfirmationServiceImpl implements ActionConfirmationService return this.builderFactory.builder(ActionConfirmationBuilder.class).build(BaseFieldSet.build(fields, ActionConfirmation._id), data); } - private @NotNull PlanInvitationEntity buildDmpInvitationEntity(PlanInvitationPersist persist){ + private @NotNull PlanInvitationEntity buildPlanInvitationEntity(PlanInvitationPersist persist){ PlanInvitationEntity data = new PlanInvitationEntity(); if (persist == null) 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 1480f655e..48d6e11b7 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 @@ -83,14 +83,14 @@ public class DashboardServiceImpl implements DashboardService { } } - PlanLookup planLookup = model.asDmpLookup(); + PlanLookup planLookup = model.asPlanLookup(); if (planLookup != null){ planLookup.getPage().setOffset(0); planLookup.getPage().setSize(model.getPage().getSize()+model.getPage().getOffset()); - 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 (Plan plan : dmps.getItems()) recentActivityItemEntities.add(new RecentActivityItemEntity(RecentActivityItemType.Plan, plan.getId(), plan.getUpdatedAt(), plan.getLabel(), plan.getStatus().getValue())); + QueryResult plans = this.elasticQueryHelperService.collect(planLookup, AuthorizationFlags.AllExceptPublic, new BaseFieldSet().ensure(Plan._id).ensure(Plan._updatedAt).ensure(Plan._label).ensure(Plan._status)); + if (!this.conventionService.isListNullOrEmpty(plans.getItems())) { + for (Plan plan : plans.getItems()) recentActivityItemEntities.add(new RecentActivityItemEntity(RecentActivityItemType.Plan, plan.getId(), plan.getUpdatedAt(), plan.getLabel(), plan.getStatus().getValue())); } } @@ -120,16 +120,16 @@ public class DashboardServiceImpl implements DashboardService { if (cacheValue == null || cacheValue.getDashboardStatistics() == null) { 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(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.setPlanCount(planQuery.authorize(EnumSet.of(Public)).count()); + statistics.setDescriptionCount(this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).planSubQuery(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(PlanReferenceQuery.class).disableTracking().isActives(IsActive.Active) - .dmpSubQuery(planQuery)).count()); + .planReferenceSubQuery(this.queryFactory.query(PlanReferenceQuery.class).disableTracking().isActives(IsActive.Active) + .planSubQuery(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) { - PlanUserQuery dmpUserLookup = this.queryFactory.query(PlanUserQuery.class).disableTracking(); - dmpUserLookup.userIds(this.userScope.getUserId()); - dmpUserLookup.isActives(IsActive.Active); + PlanUserQuery planUserLookup = this.queryFactory.query(PlanUserQuery.class).disableTracking(); + planUserLookup.userIds(this.userScope.getUserId()); + planUserLookup.isActives(IsActive.Active); - PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking().isActive(IsActive.Active).planUserSubQuery(dmpUserLookup).versionStatuses(List.of(PlanVersionStatus.Current, PlanVersionStatus.NotFinalized)); + PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking().isActive(IsActive.Active).planUserSubQuery(planUserLookup).versionStatuses(List.of(PlanVersionStatus.Current, PlanVersionStatus.NotFinalized)); DashboardStatistics statistics = new DashboardStatistics(); - 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.setPlanCount(planQuery.authorize(AuthorizationFlags.AllExceptPublic).count()); + statistics.setDescriptionCount(this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).planSubQuery(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(PlanReferenceQuery.class).disableTracking().isActives(IsActive.Active) - .dmpSubQuery(planQuery)).count()); + .planReferenceSubQuery(this.queryFactory.query(PlanReferenceQuery.class).disableTracking().isActives(IsActive.Active) + .planSubQuery(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/DepositServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/deposit/DepositServiceImpl.java index 46fa4e005..fcbd448dd 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 @@ -292,8 +292,8 @@ public class DepositServiceImpl implements DepositService { accessToken = this.authenticate(authenticateRequest); } - 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"); + org.opencdmp.model.file.FileEnvelope pdfFile = this.fileTransformerService.exportPlan(planEntity.getId(), source.getPdfTransformerId(),"pdf"); + org.opencdmp.model.file.FileEnvelope rda = this.fileTransformerService.exportPlan(planEntity.getId(), source.getRdaTransformerId(),"json"); FileEnvelopeModel pdfEnvelope = new FileEnvelopeModel(); FileEnvelopeModel jsonEnvelope = new FileEnvelopeModel(); @@ -329,31 +329,31 @@ public class DepositServiceImpl implements DepositService { } 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 planUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking().planIds(planEntity.getId()).isActives(IsActive.Active).collect(); + if (this.conventionService.isListNullOrEmpty(planUsers)){ + throw new MyNotFoundException("Plan does not have Users"); } - List users = this.queryFactory.query(UserQuery.class).disableTracking().ids(dmpUsers.stream().map(PlanUserEntity::getUserId).collect(Collectors.toList())).isActive(IsActive.Active).collect(); + List users = this.queryFactory.query(UserQuery.class).disableTracking().ids(planUsers.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(planEntity, user); + if (!user.getId().equals(this.userScope.getUserIdSafe()) && !this.conventionService.isListNullOrEmpty(planUsers.stream().filter(x -> x.getUserId().equals(user.getId())).collect(Collectors.toList()))){ + this.createPlanDepositNotificationEvent(planEntity, user); } } } - private void createDmpDepositNotificationEvent(PlanEntity dmp, UserEntity user) throws InvalidApplicationException { + private void createPlanDepositNotificationEvent(PlanEntity plan, UserEntity user) throws InvalidApplicationException { NotifyIntegrationEvent event = new NotifyIntegrationEvent(); event.setUserId(user.getId()); - event.setNotificationType(this.notificationProperties.getDmpDepositType()); + event.setNotificationType(this.notificationProperties.getPlanDepositType()); NotificationFieldData data = new NotificationFieldData(); List fieldInfoList = new ArrayList<>(); fieldInfoList.add(new FieldInfo("{recipient}", DataType.String, user.getName())); fieldInfoList.add(new FieldInfo("{reasonName}", DataType.String, this.queryFactory.query(UserQuery.class).disableTracking().ids(this.userScope.getUserId()).first().getName())); - fieldInfoList.add(new FieldInfo("{name}", DataType.String, dmp.getLabel())); - fieldInfoList.add(new FieldInfo("{id}", DataType.String, dmp.getId().toString())); + fieldInfoList.add(new FieldInfo("{name}", DataType.String, plan.getLabel())); + fieldInfoList.add(new FieldInfo("{id}", DataType.String, plan.getId().toString())); if(this.tenantScope.getTenantCode() != null && !this.tenantScope.getTenantCode().equals(this.tenantScope.getDefaultTenantCode())){ fieldInfoList.add(new FieldInfo("{tenant-url-path}", DataType.String, String.format("/t/%s", this.tenantScope.getTenantCode()))); 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 86674bdeb..20bf21530 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 @@ -218,8 +218,8 @@ 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.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()); + if (!data.getPlanId().equals(model.getPlanId())) throw new MyValidationException(this.errors.getPlanCanNotChange().getCode(), this.errors.getPlanCanNotChange().getMessage()); + if (!data.getPlanDescriptionTemplateId().equals(model.getPlanDescriptionTemplateId())) throw new MyValidationException(this.errors.getPlanDescriptionTemplateCanNotChange().getCode(), this.errors.getPlanDescriptionTemplateCanNotChange().getMessage()); } else { data = new DescriptionEntity(); data.setId(UUID.randomUUID()); @@ -238,7 +238,7 @@ public class DescriptionServiceImpl implements DescriptionService { PlanEntity plan = this.entityManager.find(PlanEntity.class, data.getPlanId(), true); if (plan == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{data.getPlanId(), Plan.class.getSimpleName()}, LocaleContextHolder.getLocale())); - if (plan.getStatus().equals(PlanStatus.Finalized) && isUpdate) throw new MyValidationException(this.errors.getDmpIsFinalized().getCode(), this.errors.getDmpIsFinalized().getMessage()); + if (plan.getStatus().equals(PlanStatus.Finalized) && isUpdate) throw new MyValidationException(this.errors.getPlanIsFinalized().getCode(), this.errors.getPlanIsFinalized().getMessage()); data.setLabel(model.getLabel()); data.setStatus(model.getStatus()); @@ -337,7 +337,7 @@ public class DescriptionServiceImpl implements DescriptionService { for (PlanUserEntity planUser : existingUsers) { if (!planUser.getUserId().equals(this.userScope.getUserIdSafe())){ UserEntity user = this.queryFactory.query(UserQuery.class).disableTracking().ids(planUser.getUserId()).first(); - if (user == null || user.getIsActive().equals(IsActive.Inactive)) throw new MyValidationException(this.errors.getDmpInactiveUser().getCode(), this.errors.getDmpInactiveUser().getMessage()); + if (user == null || user.getIsActive().equals(IsActive.Inactive)) throw new MyValidationException(this.errors.getPlanInactiveUser().getCode(), this.errors.getPlanInactiveUser().getMessage()); this.createDescriptionNotificationEvent(description, user, isUpdate); } } @@ -437,7 +437,7 @@ public class DescriptionServiceImpl implements DescriptionService { this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.descriptionAffiliation(model.getId())), Permission.FinalizeDescription); 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()); + if(!planEntity.getStatus().equals(PlanStatus.Draft)) throw new MyValidationException(this.errors.getPlanIsFinalized().getCode(), this.errors.getPlanIsFinalized().getMessage()); } data.setStatus(model.getStatus()); @@ -548,7 +548,7 @@ public class DescriptionServiceImpl implements DescriptionService { } else if (FieldType.isTextListType(fieldType)) { List ids = new ArrayList<>(); - if (FieldType.INTERNAL_ENTRIES_DMPS.equals(fieldType)) { + if (FieldType.INTERNAL_ENTRIES_PLANS.equals(fieldType)) { if (!this.conventionService.isListNullOrEmpty(persist.getTextListValue())) ids = persist.getTextListValue().stream().map(UUID::fromString).toList(); else if (!this.conventionService.isNullOrEmpty(persist.getTextValue())) ids.add(UUID.fromString(persist.getTextValue())); @@ -877,7 +877,7 @@ public class DescriptionServiceImpl implements DescriptionService { @Override public StorageFile uploadFieldFile(DescriptionFieldFilePersist model, MultipartFile file, FieldSet fields) throws IOException { //this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.descriptionAffiliation(descriptionId)), Permission.CloneDescription); - this.authorizationService.authorizeForce(Permission.EditDescription);//TODO: Missing Description or dmp for authz + this.authorizationService.authorizeForce(Permission.EditDescription);//TODO: Missing Description or plan for authz DescriptionTemplateEntity descriptionTemplate = this.queryFactory.query(DescriptionTemplateQuery.class).disableTracking().ids(model.getDescriptionTemplateId()).authorize(AuthorizationFlags.AllExceptPublic).first(); if (descriptionTemplate == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getDescriptionTemplateId(), DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale())); @@ -930,8 +930,8 @@ public class DescriptionServiceImpl implements DescriptionService { if (!planEntity.getAccessType().equals(PlanAccessType.Public)) { - 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(); + boolean isPlanUser = this.queryFactory.query(PlanUserQuery.class).planIds(planEntity.getId()).disableTracking().userIds(this.userScope.getUserIdSafe()).isActives(IsActive.Active).count() > 0; + if (!isPlanUser) throw new MyUnauthorizedException(); } StorageFileEntity storageFile = this.queryFactory.query(StorageFileQuery.class).disableTracking().ids(storageFileId).first(); diff --git a/backend/core/src/main/java/org/opencdmp/service/descriptiontemplate/DescriptionTemplateServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/descriptiontemplate/DescriptionTemplateServiceImpl.java index 7f7b83f85..4b1ac610a 100644 --- a/backend/core/src/main/java/org/opencdmp/service/descriptiontemplate/DescriptionTemplateServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/descriptiontemplate/DescriptionTemplateServiceImpl.java @@ -409,7 +409,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic if (FieldType.isTextType(fieldType) || FieldType.isTextListType(fieldType)) { if (FieldType.UPLOAD.equals(fieldType) && !this.conventionService.isNullOrEmpty(persist.getTextValue())) throw new NotImplementedException("Upload not supported"); - if (FieldType.INTERNAL_ENTRIES_DMPS.equals(fieldType) && !this.conventionService.isNullOrEmpty(persist.getTextValue())) throw new NotImplementedException("dmps not supported"); + if (FieldType.INTERNAL_ENTRIES_PLANS.equals(fieldType) && !this.conventionService.isNullOrEmpty(persist.getTextValue())) throw new NotImplementedException("plans not supported"); if (FieldType.INTERNAL_ENTRIES_DESCRIPTIONS.equals(fieldType) && !this.conventionService.isNullOrEmpty(persist.getTextValue())) throw new NotImplementedException("descriptions not supported"); data.setTextValue(persist.getTextValue()); @@ -434,7 +434,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic if (FieldType.isTextType(fieldType) || FieldType.isTextListType(fieldType)) { if (FieldType.UPLOAD.equals(fieldType) && !this.conventionService.isNullOrEmpty(persist.getTextValue())) throw new NotImplementedException("Upload not supported"); - if (FieldType.INTERNAL_ENTRIES_DMPS.equals(fieldType) && !this.conventionService.isNullOrEmpty(persist.getTextValue())) throw new NotImplementedException("dmps not supported"); + if (FieldType.INTERNAL_ENTRIES_PLANS.equals(fieldType) && !this.conventionService.isNullOrEmpty(persist.getTextValue())) throw new NotImplementedException("plans not supported"); if (FieldType.INTERNAL_ENTRIES_DESCRIPTIONS.equals(fieldType) && !this.conventionService.isNullOrEmpty(persist.getTextValue())) throw new NotImplementedException("descriptions not supported"); data.setTextValue(persist.getTextValue()); @@ -628,7 +628,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic if (latestVersionDescriptionTemplates.isEmpty()) throw new MyValidationException(this.errors.getDescriptionTemplateIsNotFinalized().getCode(), this.errors.getDescriptionTemplateIsNotFinalized().getMessage()); if (latestVersionDescriptionTemplates.size() > 1) - throw new MyValidationException(this.errors.getMultipleDmpVersionsNotSupported().getCode(), this.errors.getMultipleDmpVersionsNotSupported().getMessage()); + throw new MyValidationException(this.errors.getMultiplePlanVersionsNotSupported().getCode(), this.errors.getMultiplePlanVersionsNotSupported().getMessage()); if (!latestVersionDescriptionTemplates.getFirst().getVersion().equals(oldDescriptionTemplateEntity.getVersion())) throw new MyValidationException(this.errors.getDescriptionTemplateNewVersionConflict().getCode(), this.errors.getDescriptionTemplateNewVersionConflict().getMessage()); Long notFinalizedCount = this.queryFactory.query(DescriptionTemplateQuery.class).disableTracking() @@ -1187,7 +1187,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic case SELECT -> fieldType = FieldType.SELECT; case BOOLEAN_DECISION -> fieldType = FieldType.BOOLEAN_DECISION; case RADIO_BOX -> fieldType = FieldType.RADIO_BOX; - case INTERNAL_ENTRIES_DMPS -> fieldType = FieldType.INTERNAL_ENTRIES_DMPS; + case INTERNAL_ENTRIES_DMPS -> fieldType = FieldType.INTERNAL_ENTRIES_PLANS; case INTERNAL_ENTRIES_DESCRIPTIONS -> fieldType = FieldType.INTERNAL_ENTRIES_DESCRIPTIONS; case CHECK_BOX -> fieldType = FieldType.CHECK_BOX; case FREE_TEXT -> fieldType = FieldType.FREE_TEXT; diff --git a/backend/core/src/main/java/org/opencdmp/service/elastic/AppElasticProperties.java b/backend/core/src/main/java/org/opencdmp/service/elastic/AppElasticProperties.java index 11c0a4615..64d99a5c0 100644 --- a/backend/core/src/main/java/org/opencdmp/service/elastic/AppElasticProperties.java +++ b/backend/core/src/main/java/org/opencdmp/service/elastic/AppElasticProperties.java @@ -5,17 +5,17 @@ import org.springframework.boot.context.properties.ConfigurationProperties; @ConfigurationProperties(prefix = "app-elastic") public class AppElasticProperties { private boolean enabled; - private String dmpIndexName; + private String planIndexName; private String descriptionIndexName; private int resetBatchSize; private boolean enableIcuAnalysisPlugin; - public String getDmpIndexName() { - return this.dmpIndexName; + public String getPlanIndexName() { + return this.planIndexName; } - public void setDmpIndexName(String dmpIndexName) { - this.dmpIndexName = dmpIndexName; + public void setPlanIndexName(String planIndexName) { + this.planIndexName = planIndexName; } public boolean isEnableIcuAnalysisPlugin() { 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 a3fdfeaf8..d87f630f9 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 @@ -18,9 +18,9 @@ public interface ElasticService { void ensureIndexes() throws IOException; - void persistPlan(PlanEntity dmp) throws IOException; + void persistPlan(PlanEntity plan) throws IOException; - void deletePlan(PlanEntity dmp) throws IOException; + void deletePlan(PlanEntity plan) throws IOException; void persistDescription(DescriptionEntity description) 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 243456f13..3101f10e8 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 @@ -74,7 +74,7 @@ public class ElasticServiceImpl implements ElasticService { @Override 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(); + return this.restHighLevelClient.indices().exists(new ExistsRequest.Builder().index(this.appElasticConfiguration.getAppElasticProperties().getPlanIndexName()).includeDefaults(true).build()).value(); } @@ -92,7 +92,7 @@ public class ElasticServiceImpl implements ElasticService { boolean exists = this.existsPlanIndex(); if (exists) return ; - this.ensureIndex(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName(), this.createDmpTemplatePropertyMap()); + this.ensureIndex(this.appElasticConfiguration.getAppElasticProperties().getPlanIndexName(), this.createPlanTemplatePropertyMap()); } @Override @@ -144,11 +144,11 @@ public class ElasticServiceImpl implements ElasticService { propertyMap.put(DescriptionElasticEntity._tags, new Property.Builder().nested(x -> x.properties(this.createNestedTagsTemplatePropertyMap())).build()); propertyMap.put(DescriptionElasticEntity._references, new Property.Builder().nested(x -> x.properties(this.createNestedReferencesTemplatePropertyMap())).build()); propertyMap.put(DescriptionElasticEntity._descriptionTemplate, new Property.Builder().object(x -> x.properties(this.createNestedDescriptionTemplateTemplatePropertyMap())).build()); - propertyMap.put(DescriptionElasticEntity._dmp, new Property.Builder().object(x -> x.properties(this.createNetsedDmpTemplatePropertyMap())).build()); + propertyMap.put(DescriptionElasticEntity._plan, new Property.Builder().object(x -> x.properties(this.createNetsedPlanTemplatePropertyMap())).build()); return propertyMap; } - private Map createDmpTemplatePropertyMap(){ + private Map createPlanTemplatePropertyMap(){ Map propertyMap = new HashMap<>(); propertyMap.put(PlanElasticEntity._id, this.createElastic(FieldType.Keyword, false)); propertyMap.put(PlanElasticEntity._tenantId, this.createElastic(FieldType.Keyword, false)); @@ -166,19 +166,19 @@ public class ElasticServiceImpl implements ElasticService { propertyMap.put(PlanElasticEntity._versionStatus, this.createElastic(FieldType.Short, false)); 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._planDescriptionTemplates, new Property.Builder().nested(x -> x.properties(this.createNestedPlanDescriptionTemplateElasticEntityPropertyMap())).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(){ + private Map createNestedPlanDescriptionTemplateElasticEntityPropertyMap(){ Map propertyMap = new HashMap<>(); 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)); + propertyMap.put(NestedPlanDescriptionTemplateElasticEntity._planId, this.createElastic(FieldType.Keyword, false)); return propertyMap; } @@ -187,7 +187,7 @@ public class ElasticServiceImpl implements ElasticService { Map propertyMap = new HashMap<>(); propertyMap.put(NestedDescriptionElasticEntity._id, this.createElastic(FieldType.Keyword, false)); propertyMap.put(NestedDescriptionElasticEntity._label, this.createElastic(FieldType.Text, true)); - propertyMap.put(NestedDescriptionElasticEntity._dmpId, this.createElastic(FieldType.Keyword, false)); + propertyMap.put(NestedDescriptionElasticEntity._planId, this.createElastic(FieldType.Keyword, false)); propertyMap.put(NestedDescriptionElasticEntity._description, this.createElastic(FieldType.Text, true)); propertyMap.put(NestedDescriptionElasticEntity._status, this.createElastic(FieldType.Short, false)); propertyMap.put(NestedDescriptionElasticEntity._finalizedAt, this.createElastic(FieldType.Date, false)); @@ -225,7 +225,7 @@ public class ElasticServiceImpl implements ElasticService { return propertyMap; } - private Map createNetsedDmpTemplatePropertyMap(){ + private Map createNetsedPlanTemplatePropertyMap(){ Map propertyMap = new HashMap<>(); propertyMap.put(NestedPlanElasticEntity._id, this.createElastic(FieldType.Keyword, false)); propertyMap.put(NestedPlanElasticEntity._label, this.createElastic(FieldType.Text, true)); @@ -289,24 +289,24 @@ public class ElasticServiceImpl implements ElasticService { //region persist delete @Override - public void persistPlan(PlanEntity dmp) throws IOException { + public void persistPlan(PlanEntity plan) throws IOException { if (!this.enabled()) return; this.ensureIndexes(); - 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()); + PlanElasticEntity planElasticEntity = this.builderFactory.builder(PlanElasticBuilder.class).build(plan); + this.elasticsearchTemplate.save(planElasticEntity, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getPlanIndexName())); + List descriptions = this.builderFactory.builder(DescriptionElasticBuilder.class).build(this.queryFactory.query(DescriptionQuery.class).disableTracking().isActive(IsActive.Active).planSubQuery(this.queryFactory.query(PlanQuery.class).ids(plan.getId())).collect()); this.elasticsearchTemplate.save(descriptions, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getDescriptionIndexName())); } @Override - public void deletePlan(PlanEntity dmp) throws IOException { + public void deletePlan(PlanEntity plan) throws IOException { if (!this.enabled()) return; this.ensureIndexes(); - PlanElasticEntity planElasticEntity = this.elasticsearchTemplate.get(dmp.getId().toString(), PlanElasticEntity.class, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName())); + PlanElasticEntity planElasticEntity = this.elasticsearchTemplate.get(plan.getId().toString(), PlanElasticEntity.class, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getPlanIndexName())); 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)); + this.elasticsearchTemplate.delete(planElasticEntity, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getPlanIndexName())); + List descriptions = this.queryFactory.query(DescriptionQuery.class).planSubQuery(this.queryFactory.query(PlanQuery.class).disableTracking().ids(plan.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; @@ -325,7 +325,7 @@ public class ElasticServiceImpl implements ElasticService { 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())); + this.elasticsearchTemplate.save(planElasticEntity, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getPlanIndexName())); } } @@ -342,7 +342,7 @@ public class ElasticServiceImpl implements ElasticService { 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())); + this.elasticsearchTemplate.save(planElasticEntity, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getPlanIndexName())); } } @@ -352,14 +352,14 @@ public class ElasticServiceImpl implements ElasticService { @Override public void deletePlanIndex() throws IOException { - logger.debug(new MapLogEntry("delete dmp index")); + logger.debug(new MapLogEntry("delete plan index")); this.authorizationService.authorizeForce(Permission.ManageElastic); if (!this.enabled()) return; boolean exists = this.existsPlanIndex(); if (!exists) return ; - this.restHighLevelClient.indices().delete(new DeleteIndexRequest.Builder().index(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName()).build()); + this.restHighLevelClient.indices().delete(new DeleteIndexRequest.Builder().index(this.appElasticConfiguration.getAppElasticProperties().getPlanIndexName()).build()); } @Override @@ -375,7 +375,7 @@ public class ElasticServiceImpl implements ElasticService { @Override public void resetPlanIndex() throws IOException, InvalidApplicationException { - logger.debug(new MapLogEntry("reset dmp index")); + logger.debug(new MapLogEntry("reset plan index")); this.authorizationService.authorizeForce(Permission.ManageElastic); if (!this.enabled()) return; @@ -395,7 +395,7 @@ public class ElasticServiceImpl implements ElasticService { items = query.collect(); if (items != null && !items.isEmpty()) { List elasticEntities = this.builderFactory.builder(PlanElasticBuilder.class).build(items); - this.elasticsearchTemplate.save(elasticEntities, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getDmpIndexName())); + this.elasticsearchTemplate.save(elasticEntities, IndexCoordinates.of(this.appElasticConfiguration.getAppElasticProperties().getPlanIndexName())); page++; } } while (items != null && !items.isEmpty()); diff --git a/backend/core/src/main/java/org/opencdmp/service/entitydoi/EntityDoiServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/entitydoi/EntityDoiServiceImpl.java index a23fc4add..022c6b0d3 100644 --- a/backend/core/src/main/java/org/opencdmp/service/entitydoi/EntityDoiServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/entitydoi/EntityDoiServiceImpl.java @@ -96,7 +96,7 @@ public class EntityDoiServiceImpl implements EntityDoiService { data.setCreatedAt(Instant.now()); } - data.setEntityType(EntityType.DMP); + data.setEntityType(EntityType.Plan); data.setEntityId(model.getEntityId()); data.setRepositoryId(model.getRepositoryId()); data.setDoi(model.getDoi()); diff --git a/backend/core/src/main/java/org/opencdmp/service/fielddatahelper/FieldDataHelperServiceProvider.java b/backend/core/src/main/java/org/opencdmp/service/fielddatahelper/FieldDataHelperServiceProvider.java index 2a4ee62d5..5ae15b061 100644 --- a/backend/core/src/main/java/org/opencdmp/service/fielddatahelper/FieldDataHelperServiceProvider.java +++ b/backend/core/src/main/java/org/opencdmp/service/fielddatahelper/FieldDataHelperServiceProvider.java @@ -16,7 +16,7 @@ public class FieldDataHelperServiceProvider { switch (type) { case INTERNAL_ENTRIES_DESCRIPTIONS: - case INTERNAL_ENTRIES_DMPS: { + case INTERNAL_ENTRIES_PLANS: { item = this.applicationContext.getBean(LabelAndMultiplicityFieldDataHelperService.class); break; } 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 d7a66e98c..766acf1db 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 @@ -20,11 +20,11 @@ import java.util.UUID; public interface FileTransformerService { List getAvailableExportFileFormats() throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException; - org.opencdmp.model.file.FileEnvelope exportDmp(UUID dmpId, String repositoryId, String format) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException; + org.opencdmp.model.file.FileEnvelope exportPlan(UUID planId, String repositoryId, String format) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException; org.opencdmp.model.file.FileEnvelope exportDescription(UUID descriptionId, String repositoryId, String format) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException; - DmpModel importDmp(PlanCommonModelConfig planCommonModelConfig) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, IOException, JAXBException; + DmpModel importPlan(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; + 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/filetransformer/FileTransformerServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/filetransformer/FileTransformerServiceImpl.java index bfdff979f..03e1cbeec 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 @@ -252,15 +252,15 @@ 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 { + public org.opencdmp.model.file.FileEnvelope exportPlan(UUID planId, String repositoryId, String format) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException { 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 - PlanQuery query = this.queryFactory.query(PlanQuery.class).disableTracking().authorize(AuthorizationFlags.All).ids(dmpId); + PlanQuery query = this.queryFactory.query(PlanQuery.class).disableTracking().authorize(AuthorizationFlags.All).ids(planId); 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())); + if (dmpFileTransformerModel == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{planId, Plan.class.getSimpleName()}, LocaleContextHolder.getLocale())); FileEnvelopeModel fileEnvelope = repository.exportDmp(dmpFileTransformerModel, format); org.opencdmp.model.file.FileEnvelope result = new org.opencdmp.model.file.FileEnvelope(); @@ -313,7 +313,7 @@ public class FileTransformerServiceImpl implements FileTransformerService { } @Override - public DmpModel importDmp(PlanCommonModelConfig planCommonModelConfig) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, IOException, JAXBException { + public DmpModel importPlan(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(planCommonModelConfig.getFileId()).first(); @@ -380,7 +380,7 @@ public class FileTransformerServiceImpl implements FileTransformerService { } @Override - 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 { 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/lock/LockServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/lock/LockServiceImpl.java index 82822866a..f265504ed 100644 --- a/backend/core/src/main/java/org/opencdmp/service/lock/LockServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/lock/LockServiceImpl.java @@ -85,10 +85,10 @@ public class LockServiceImpl implements LockService { public Lock persist(LockPersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException { logger.debug(new MapLogEntry("persisting data").And("model", model).And("fields", fields)); - AffiliatedResource affiliatedResourceDmp = this.authorizationContentResolver.planAffiliation(model.getTarget()); + AffiliatedResource affiliatedResourcePlan = this.authorizationContentResolver.planAffiliation(model.getTarget()); AffiliatedResource affiliatedResourceDescription = this.authorizationContentResolver.descriptionAffiliation(model.getTarget()); AffiliatedResource affiliatedResourceDescriptionTemplate = this.authorizationContentResolver.descriptionTemplateAffiliation(model.getTarget()); - this.authorizationService.authorizeAtLeastOneForce(List.of(affiliatedResourceDmp, affiliatedResourceDescription, affiliatedResourceDescriptionTemplate), Permission.EditLock); + this.authorizationService.authorizeAtLeastOneForce(List.of(affiliatedResourcePlan, affiliatedResourceDescription, affiliatedResourceDescriptionTemplate), Permission.EditLock); Boolean isUpdate = this.conventionService.isValidGuid(model.getId()); @@ -174,10 +174,10 @@ public class LockServiceImpl implements LockService { public void deleteAndSave(UUID id, UUID target) throws MyForbiddenException, InvalidApplicationException { logger.debug("deleting : {}", id); - AffiliatedResource affiliatedResourceDmp = this.authorizationContentResolver.planAffiliation(target); + AffiliatedResource affiliatedResourcePlan = this.authorizationContentResolver.planAffiliation(target); AffiliatedResource affiliatedResourceDescription = this.authorizationContentResolver.descriptionAffiliation(target); AffiliatedResource affiliatedResourceDescriptionTemplate = this.authorizationContentResolver.descriptionTemplateAffiliation(target); - this.authorizationService.authorizeAtLeastOneForce(List.of(affiliatedResourceDmp, affiliatedResourceDescription, affiliatedResourceDescriptionTemplate), Permission.DeleteLock); + this.authorizationService.authorizeAtLeastOneForce(List.of(affiliatedResourcePlan, affiliatedResourceDescription, affiliatedResourceDescriptionTemplate), Permission.DeleteLock); this.deleterFactory.deleter(LockDeleter.class).deleteAndSaveByIds(List.of(id)); } diff --git a/backend/core/src/main/java/org/opencdmp/service/maintenance/MaintenanceService.java b/backend/core/src/main/java/org/opencdmp/service/maintenance/MaintenanceService.java index 495b73353..626c0808c 100644 --- a/backend/core/src/main/java/org/opencdmp/service/maintenance/MaintenanceService.java +++ b/backend/core/src/main/java/org/opencdmp/service/maintenance/MaintenanceService.java @@ -9,7 +9,7 @@ public interface MaintenanceService { void sendTenantTouchEvents() throws InvalidApplicationException; - void sendDmpTouchEvents() throws InvalidApplicationException; + void sendPlanTouchEvents() throws InvalidApplicationException; void sendDescriptionTouchEvents() throws InvalidApplicationException; } 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 8d39f5daf..3d3f68353 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 @@ -123,28 +123,28 @@ public class MaintenanceServiceImpl implements MaintenanceService { } @Override - public void sendDmpTouchEvents() throws InvalidApplicationException { + public void sendPlanTouchEvents() throws InvalidApplicationException { logger.debug("send user touch queue events"); this.authorizationService.authorizeForce(Permission.ManageQueueEvents); List tenants = this.getTenants(); - this.sendTenantDmpTouchEvents(null, this.tenantScope.getDefaultTenantCode()); + this.sendTenantPlanTouchEvents(null, this.tenantScope.getDefaultTenantCode()); if (tenants != null){ for (TenantEntity tenant : tenants){ - this.sendTenantDmpTouchEvents(tenant.getId(), tenant.getCode()); + this.sendTenantPlanTouchEvents(tenant.getId(), tenant.getCode()); } } } - private void sendTenantDmpTouchEvents(UUID tenantId, String tenantCode) throws InvalidApplicationException { + private void sendTenantPlanTouchEvents(UUID tenantId, String tenantCode) throws InvalidApplicationException { try { this.tenantScope.setTempTenant(this.entityManager, tenantId, tenantCode); 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()); + else this.annotationEntityRemovalIntegrationEventHandler.handlePlan(item.getId()); } } finally { this.tenantScope.removeTempTenant(this.entityManager); 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 d06127c3d..617e8b6a5 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 @@ -349,7 +349,7 @@ public class MetricsServiceImpl implements MetricsService { PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking().isActive(IsActive.Active); if (forNexus) planQuery.after(this._config.getNexusDate()); - EntityDoiQuery entityDoiQuery = this.queryFactory.query(EntityDoiQuery.class).disableTracking().types(EntityType.DMP).isActive(IsActive.Active); + EntityDoiQuery entityDoiQuery = this.queryFactory.query(EntityDoiQuery.class).disableTracking().types(EntityType.Plan).isActive(IsActive.Active); planQuery.entityDoiSubQuery(entityDoiQuery); planQuery.setDistinct(true); return planQuery.count(); @@ -444,7 +444,7 @@ public class MetricsServiceImpl implements MetricsService { if (forNexus) descriptionQuery.createdAfter(this._config.getNexusDate()); PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).isActive(IsActive.Active).disableTracking().statuses(PlanStatus.Finalized).accessTypes(PlanAccessType.Public); - descriptionQuery.dmpSubQuery(planQuery); + descriptionQuery.planSubQuery(planQuery); return descriptionQuery.count(); } @@ -453,9 +453,9 @@ public class MetricsServiceImpl implements MetricsService { if (forNexus) descriptionQuery.createdAfter(this._config.getNexusDate()); PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).isActive(IsActive.Active); - EntityDoiQuery entityDoiQuery = this.queryFactory.query(EntityDoiQuery.class).types(EntityType.DMP).isActive(IsActive.Active); + EntityDoiQuery entityDoiQuery = this.queryFactory.query(EntityDoiQuery.class).types(EntityType.Plan).isActive(IsActive.Active); planQuery.entityDoiSubQuery(entityDoiQuery); - descriptionQuery.dmpSubQuery(planQuery); + descriptionQuery.planSubQuery(planQuery); descriptionQuery.setDistinct(true); return descriptionQuery.count(); } 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 index 1c4932542..df39a64b4 100644 --- a/backend/core/src/main/java/org/opencdmp/service/plan/PlanService.java +++ b/backend/core/src/main/java/org/opencdmp/service/plan/PlanService.java @@ -44,7 +44,7 @@ public interface PlanService { 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; + List assignUsers(UUID planId, 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; diff --git a/backend/core/src/main/java/org/opencdmp/service/plan/PlanServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/plan/PlanServiceImpl.java index eaf6a91c3..e40b3f5e8 100644 --- a/backend/core/src/main/java/org/opencdmp/service/plan/PlanServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/plan/PlanServiceImpl.java @@ -264,13 +264,13 @@ public class PlanServiceImpl implements PlanService { } 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 existingPlanDescriptionTemplates = 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(); + List removedDescriptionTemplates = existingPlanDescriptionTemplates.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); + DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).planDescriptionTemplateSubQuery(planDescriptionTemplateQuery).isActive(IsActive.Active); - if (query != null && query.count() > 0) throw new MyValidationException(this.errors.getDmpDescriptionTemplateCanNotRemove().getCode(), this.errors.getDmpDescriptionTemplateCanNotRemove().getMessage()); + if (query != null && query.count() > 0) throw new MyValidationException(this.errors.getPlanDescriptionTemplateCanNotRemove().getCode(), this.errors.getPlanDescriptionTemplateCanNotRemove().getMessage()); } @@ -294,9 +294,9 @@ public class PlanServiceImpl implements PlanService { this.entityManager.persist(data); } - private void sendNotification(PlanEntity dmp) throws InvalidApplicationException { + private void sendNotification(PlanEntity plan) throws InvalidApplicationException { List existingUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking() - .planIds(dmp.getId()) + .planIds(plan.getId()) .isActives(IsActive.Active) .collect(); @@ -304,26 +304,26 @@ public class PlanServiceImpl implements PlanService { return; } - 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()); - this.createDmpNotificationEvent(dmp, user); + for (PlanUserEntity planUser : existingUsers) { + if (!planUser.getUserId().equals(this.userScope.getUserIdSafe())){ + UserEntity user = this.queryFactory.query(UserQuery.class).disableTracking().ids(planUser.getUserId()).first(); + if (user == null || user.getIsActive().equals(IsActive.Inactive)) throw new MyValidationException(this.errors.getPlanInactiveUser().getCode(), this.errors.getPlanInactiveUser().getMessage()); + this.createPlanNotificationEvent(plan, user); } } } - private void createDmpNotificationEvent(PlanEntity dmp, UserEntity user) throws InvalidApplicationException { + private void createPlanNotificationEvent(PlanEntity plan, UserEntity user) throws InvalidApplicationException { NotifyIntegrationEvent event = new NotifyIntegrationEvent(); event.setUserId(user.getId()); - this.applyNotificationType(dmp.getStatus(), event); + this.applyNotificationType(plan.getStatus(), event); NotificationFieldData data = new NotificationFieldData(); List fieldInfoList = new ArrayList<>(); fieldInfoList.add(new FieldInfo("{recipient}", DataType.String, user.getName())); fieldInfoList.add(new FieldInfo("{reasonName}", DataType.String, this.queryFactory.query(UserQuery.class).disableTracking().ids(this.userScope.getUserId()).first().getName())); - fieldInfoList.add(new FieldInfo("{name}", DataType.String, dmp.getLabel())); - fieldInfoList.add(new FieldInfo("{id}", DataType.String, dmp.getId().toString())); + fieldInfoList.add(new FieldInfo("{name}", DataType.String, plan.getLabel())); + fieldInfoList.add(new FieldInfo("{id}", DataType.String, plan.getId().toString())); if(this.tenantScope.getTenantCode() != null && !this.tenantScope.getTenantCode().equals(this.tenantScope.getDefaultTenantCode())){ fieldInfoList.add(new FieldInfo("{tenant-url-path}", DataType.String, String.format("/t/%s", this.tenantScope.getTenantCode()))); } @@ -336,28 +336,28 @@ public class PlanServiceImpl implements PlanService { private void applyNotificationType(PlanStatus status, NotifyIntegrationEvent event) { switch (status) { case Draft: - event.setNotificationType(this.notificationProperties.getDmpModifiedType()); + event.setNotificationType(this.notificationProperties.getPlanModifiedType()); break; case Finalized: - event.setNotificationType(this.notificationProperties.getDmpFinalisedType()); + event.setNotificationType(this.notificationProperties.getPlanFinalisedType()); break; default: - throw new MyApplicationException("Unsupported Dmp Status."); + throw new MyApplicationException("Unsupported Plan Status."); } } public void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException, IOException { - logger.debug("deleting dmp: {}", id); + logger.debug("deleting plan: {}", id); this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.planAffiliation(id)), Permission.DeletePlan); 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"); + EntityDoiQuery entityDoiQuery = this.queryFactory.query(EntityDoiQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).types(EntityType.Plan).entityIds(data.getId()); + if (entityDoiQuery.count() > 0) throw new MyApplicationException("Plan is deposited can not deleted"); - PlanEntity previousDmp = null; + PlanEntity previousPlan = null; if (!data.getVersionStatus().equals(PlanVersionStatus.Previous)){ PlanQuery planQuery = this.queryFactory.query(PlanQuery.class) .excludedIds(data.getId()) @@ -365,11 +365,11 @@ public class PlanServiceImpl implements PlanService { .groupIds(data.getGroupId()); planQuery.setOrder(new Ordering().addDescending(Plan._version)); - previousDmp = planQuery.count() > 0 ? planQuery.collect().getFirst() : null; - if (previousDmp != null){ - if (previousDmp.getStatus().equals(PlanStatus.Finalized)) previousDmp.setVersionStatus(PlanVersionStatus.Current); - else previousDmp.setVersionStatus(PlanVersionStatus.NotFinalized); - this.entityManager.merge(previousDmp); + previousPlan = planQuery.count() > 0 ? planQuery.collect().getFirst() : null; + if (previousPlan != null){ + if (previousPlan.getStatus().equals(PlanStatus.Finalized)) previousPlan.setVersionStatus(PlanVersionStatus.Current); + else previousPlan.setVersionStatus(PlanVersionStatus.NotFinalized); + this.entityManager.merge(previousPlan); } data.setVersionStatus(PlanVersionStatus.NotFinalized); this.entityManager.merge(data); @@ -377,9 +377,9 @@ public class PlanServiceImpl implements PlanService { } this.deleterFactory.deleter(PlanDeleter.class).deleteAndSaveByIds(List.of(id), false); - if (previousDmp != null) this.elasticService.persistPlan(previousDmp); + if (previousPlan != null) this.elasticService.persistPlan(previousPlan); - this.annotationEntityRemovalIntegrationEventHandler.handleDmp(data.getId()); + this.annotationEntityRemovalIntegrationEventHandler.handlePlan(data.getId()); } @Override @@ -396,17 +396,17 @@ public class PlanServiceImpl implements PlanService { .isActive(IsActive.Active) .versionStatuses(PlanVersionStatus.Current) .collect(); - if (latestVersionPlans.isEmpty()) throw new MyValidationException(this.errors.getDmpIsNotFinalized().getCode()); - if (latestVersionPlans.size() > 1) throw new MyValidationException(this.errors.getMultipleDmpVersionsNotSupported().getCode()); + if (latestVersionPlans.isEmpty()) throw new MyValidationException(this.errors.getPlanIsNotFinalized().getCode()); + if (latestVersionPlans.size() > 1) throw new MyValidationException(this.errors.getMultiplePlanVersionsNotSupported().getCode()); if (!latestVersionPlans.getFirst().getVersion().equals(oldPlanEntity.getVersion())){ - throw new MyValidationException(this.errors.getDmpNewVersionConflict().getCode(), this.errors.getDmpNewVersionConflict().getMessage()); + throw new MyValidationException(this.errors.getPlanNewVersionConflict().getCode(), this.errors.getPlanNewVersionConflict().getMessage()); } 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()); + if (notFinalizedCount > 0) throw new MyValidationException(this.errors.getPlanNewVersionAlreadyCreatedDraft().getCode(), this.errors.getPlanNewVersionAlreadyCreatedDraft().getMessage()); PlanEntity newPlan = new PlanEntity(); newPlan.setId(UUID.randomUUID()); @@ -651,12 +651,12 @@ public class PlanServiceImpl implements PlanService { } if (newStatus.equals(PlanStatus.Finalized)) { - List latestVersionDmps = this.queryFactory.query(PlanQuery.class) + List latestVersionPlans = this.queryFactory.query(PlanQuery.class) .versionStatuses(PlanVersionStatus.Current).excludedIds(data.getId()) .isActive(IsActive.Active).groupIds(data.getGroupId()).collect(); - if (latestVersionDmps.size() > 1) + if (latestVersionPlans.size() > 1) throw new MyValidationException("Multiple previous template found"); - PlanEntity oldPlanEntity = latestVersionDmps.stream().findFirst().orElse(null); + PlanEntity oldPlanEntity = latestVersionPlans.stream().findFirst().orElse(null); data.setVersionStatus(PlanVersionStatus.Current); @@ -773,7 +773,7 @@ public class PlanServiceImpl implements PlanService { 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); + this.checkDuplicatePlanUser(model); 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())); @@ -784,15 +784,15 @@ public class PlanServiceImpl implements PlanService { .collect(); List updatedCreatedIds = new ArrayList<>(); - 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); + for (PlanUserPersist planUser : model) { + PlanUserEntity planUserEntity = existingUsers.stream().filter(x-> x.getPlanId().equals(planId) && x.getUserId().equals(planUser.getUser()) && x.getRole().equals(planUser.getRole()) && Objects.equals(planUser.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.setUserId(planUser.getUser()); + planUserEntity.setRole(planUser.getRole()); + planUserEntity.setSectionId(planUser.getSectionId()); planUserEntity.setCreatedAt(Instant.now()); planUserEntity.setUpdatedAt(Instant.now()); planUserEntity.setIsActive(IsActive.Active); @@ -818,7 +818,7 @@ public class PlanServiceImpl implements PlanService { return this.builderFactory.builder(PlanUserBuilder.class).authorize(AuthorizationFlags.AllExceptPublic).build(BaseFieldSet.build(fieldSet, PlanUser._id, PlanUser._hash), persisted); } - private void checkDuplicateDmpUser(List model){ + private void checkDuplicatePlanUser(List model){ for (PlanUserPersist user: model) { List duplicateUser; if (user.getUser() != null){ @@ -827,7 +827,7 @@ public class PlanServiceImpl implements PlanService { duplicateUser = model.stream().filter(x -> x.getEmail().equals(user.getEmail()) && x.getRole().equals(user.getRole()) && Objects.equals(user.getSectionId(), x.getSectionId())).collect(Collectors.toList()); } if (duplicateUser.size() > 1) { - throw new MyValidationException(this.errors.getDuplicateDmpUser().getCode(), this.errors.getDuplicateDmpUser().getMessage()); + throw new MyValidationException(this.errors.getDuplicatePlanUser().getCode(), this.errors.getDuplicatePlanUser().getMessage()); } } } @@ -859,7 +859,7 @@ public class PlanServiceImpl implements PlanService { public ResponseEntity export(UUID id, String transformerId, String exportType) throws InvalidApplicationException, IOException, InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException { HttpHeaders headers = new HttpHeaders(); - FileEnvelope fileEnvelope = this.fileTransformerService.exportDmp(id, transformerId, exportType); + FileEnvelope fileEnvelope = this.fileTransformerService.exportPlan(id, transformerId, exportType); headers.add("Content-Disposition", "attachment;filename=" + fileEnvelope.getFilename()); byte[] data = fileEnvelope.getFile(); headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); @@ -900,7 +900,7 @@ public class PlanServiceImpl implements PlanService { data.setLabel(model.getLabel()); data.setLanguage(model.getLanguage()); - data.setProperties(this.jsonHandlingService.toJson(this.buildDmpPropertiesEntity(model.getProperties(), definition))); + data.setProperties(this.jsonHandlingService.toJson(this.buildPlanPropertiesEntity(model.getProperties(), definition))); data.setDescription(model.getDescription()); data.setAccessType(model.getAccessType()); data.setUpdatedAt(Instant.now()); @@ -919,13 +919,13 @@ public class PlanServiceImpl implements PlanService { return data; } - private @NotNull PlanPropertiesEntity buildDmpPropertiesEntity(PlanPropertiesPersist persist, org.opencdmp.commons.types.planblueprint.DefinitionEntity definition){ + private @NotNull PlanPropertiesEntity buildPlanPropertiesEntity(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 (PlanContactPersist contactPersist: persist.getContacts()) { - data.getContacts().add(this.buildDmpContactEntity(contactPersist)); + data.getContacts().add(this.buildPlanContactEntity(contactPersist)); } } if (persist.getPlanBlueprintValues() != null && !persist.getPlanBlueprintValues().isEmpty()){ @@ -937,7 +937,7 @@ public class PlanServiceImpl implements PlanService { return data; } - private @NotNull PlanContactEntity buildDmpContactEntity(PlanContactPersist persist){ + private @NotNull PlanContactEntity buildPlanContactEntity(PlanContactPersist persist){ PlanContactEntity data = new PlanContactEntity(); if (persist == null) return data; @@ -1112,7 +1112,7 @@ public class PlanServiceImpl implements PlanService { if (!this.conventionService.isListNullOrEmpty(persist.getFields())){ data.setFields(new ArrayList<>()); for (FieldPersist fieldPersist: persist.getFields()) { - data.getFields().add(this.buildDmpContactEntity(fieldPersist)); + data.getFields().add(this.buildPlanContactEntity(fieldPersist)); } } @@ -1126,7 +1126,7 @@ public class PlanServiceImpl implements PlanService { return data; } - private @NotNull FieldEntity buildDmpContactEntity(FieldPersist persist){ + private @NotNull FieldEntity buildPlanContactEntity(FieldPersist persist){ FieldEntity data = new FieldEntity(); if (persist == null) return data; @@ -1139,18 +1139,18 @@ public class PlanServiceImpl implements PlanService { public void finalize(UUID id, List descriptionIds) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, IOException { this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.planAffiliation(id)), Permission.FinalizePlan); - PlanEntity dmp = this.queryFactory.query(PlanQuery.class).authorize(AuthorizationFlags.AllExceptPublic).ids(id).isActive(IsActive.Active).first(); + PlanEntity plan = this.queryFactory.query(PlanQuery.class).authorize(AuthorizationFlags.AllExceptPublic).ids(id).isActive(IsActive.Active).first(); - if (dmp == null){ + if (plan == null){ throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Plan.class.getSimpleName()}, LocaleContextHolder.getLocale())); } - if (dmp.getStatus().equals(PlanStatus.Finalized)){ - throw new MyApplicationException("DMP is already finalized"); + if (plan.getStatus().equals(PlanStatus.Finalized)){ + throw new MyApplicationException("Plan is already finalized"); } if (this.validate(id).getResult().equals(PlanValidationOutput.Invalid)){ - throw new MyApplicationException("Dmp is invalid"); + throw new MyApplicationException("Plan is invalid"); } List descriptions = this.queryFactory.query(DescriptionQuery.class) @@ -1176,72 +1176,72 @@ public class PlanServiceImpl implements PlanService { } } - PlanStatus previousStatus = dmp.getStatus(); - dmp.setStatus(PlanStatus.Finalized); - dmp.setUpdatedAt(Instant.now()); - dmp.setFinalizedAt(Instant.now()); + PlanStatus previousStatus = plan.getStatus(); + plan.setStatus(PlanStatus.Finalized); + plan.setUpdatedAt(Instant.now()); + plan.setFinalizedAt(Instant.now()); - this.updateVersionStatusAndSave(dmp, previousStatus, dmp.getStatus()); - dmp.setVersionStatus(PlanVersionStatus.Current); + this.updateVersionStatusAndSave(plan, previousStatus, plan.getStatus()); + plan.setVersionStatus(PlanVersionStatus.Current); - this.entityManager.merge(dmp); + this.entityManager.merge(plan); this.entityManager.flush(); - this.elasticService.persistPlan(dmp); + this.elasticService.persistPlan(plan); - this.annotationEntityTouchedIntegrationEventHandler.handlePlan(dmp.getId()); - this.sendNotification(dmp); + this.annotationEntityTouchedIntegrationEventHandler.handlePlan(plan.getId()); + this.sendNotification(plan); } public void undoFinalize(UUID id, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException { this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.planAffiliation(id)), Permission.UndoFinalizePlan); - PlanEntity dmp = this.queryFactory.query(PlanQuery.class).authorize(AuthorizationFlags.AllExceptPublic).ids(id).isActive(IsActive.Active).firstAs(fields); + PlanEntity plan = 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, Plan.class.getSimpleName()}, LocaleContextHolder.getLocale())); + if (plan == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Plan.class.getSimpleName()}, LocaleContextHolder.getLocale())); - if (!dmp.getStatus().equals(PlanStatus.Finalized)) throw new MyApplicationException("DMP is already drafted"); + if (!plan.getStatus().equals(PlanStatus.Finalized)) throw new MyApplicationException("Plan 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"); + EntityDoiQuery entityDoiQuery = this.queryFactory.query(EntityDoiQuery.class).authorize(AuthorizationFlags.AllExceptPublic).types(EntityType.Plan).entityIds(plan.getId()).isActive(IsActive.Active); + if (entityDoiQuery.count() > 0) throw new MyApplicationException("Plan is deposited"); - dmp.setStatus(PlanStatus.Draft); - dmp.setUpdatedAt(Instant.now()); + plan.setStatus(PlanStatus.Draft); + plan.setUpdatedAt(Instant.now()); - this.entityManager.merge(dmp); + this.entityManager.merge(plan); this.entityManager.flush(); - this.updateVersionStatusAndSave(dmp, PlanStatus.Finalized, dmp.getStatus()); + this.updateVersionStatusAndSave(plan, PlanStatus.Finalized, plan.getStatus()); this.entityManager.flush(); PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking() .versionStatuses(PlanVersionStatus.Previous) - .excludedIds(dmp.getId()) + .excludedIds(plan.getId()) .isActive(IsActive.Active) - .groupIds(dmp.getGroupId()); + .groupIds(plan.getGroupId()); planQuery.setOrder(new Ordering().addDescending(Plan._version)); - PlanEntity previousDmp = planQuery.count() > 0 ? planQuery.collect().getFirst() : null; - if (previousDmp != null){ - if (previousDmp.getStatus().equals(PlanStatus.Finalized)) previousDmp.setVersionStatus(PlanVersionStatus.Current); - else previousDmp.setVersionStatus(PlanVersionStatus.NotFinalized); - this.entityManager.merge(previousDmp); + PlanEntity previousPlan = planQuery.count() > 0 ? planQuery.collect().getFirst() : null; + if (previousPlan != null){ + if (previousPlan.getStatus().equals(PlanStatus.Finalized)) previousPlan.setVersionStatus(PlanVersionStatus.Current); + else previousPlan.setVersionStatus(PlanVersionStatus.NotFinalized); + this.entityManager.merge(previousPlan); } this.entityManager.flush(); - this.annotationEntityTouchedIntegrationEventHandler.handlePlan(dmp.getId()); - this.sendNotification(dmp); + this.annotationEntityTouchedIntegrationEventHandler.handlePlan(plan.getId()); + this.sendNotification(plan); } public PlanValidationResult validate(UUID id) throws InvalidApplicationException { - PlanEntity dmp = this.queryFactory.query(PlanQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).ids(id).isActive(IsActive.Active).first(); + PlanEntity plan = 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, Plan.class.getSimpleName()}, LocaleContextHolder.getLocale())); + if (plan == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Plan.class.getSimpleName()}, LocaleContextHolder.getLocale())); - PlanValidationResult planValidationResult = new PlanValidationResult(dmp.getId(), PlanValidationOutput.Invalid); + PlanValidationResult planValidationResult = new PlanValidationResult(plan.getId(), PlanValidationOutput.Invalid); PlanPersist.PlanPersistValidator validator = this.validatorFactory.validator(PlanPersist.PlanPersistValidator.class); - validator.validate(this.buildDmpPersist(dmp)); + validator.validate(this.buildPlanPersist(plan)); if (validator.result().isValid()) planValidationResult.setResult(PlanValidationOutput.Valid); else planValidationResult.setErrors(validator.result().getErrors().stream().map(ValidationFailure::getErrorMessage).collect(Collectors.toList())); @@ -1250,7 +1250,7 @@ public class PlanServiceImpl implements PlanService { // build persist - private @NotNull PlanPersist buildDmpPersist(PlanEntity data) throws InvalidApplicationException { + private @NotNull PlanPersist buildPlanPersist(PlanEntity data) throws InvalidApplicationException { PlanPersist persist = new PlanPersist(); if (data == null) return persist; @@ -1434,18 +1434,18 @@ public class PlanServiceImpl implements PlanService { private List inviteUserOrAssignUsers(UUID id, List users, boolean persistUsers) throws InvalidApplicationException, JAXBException, IOException { this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.planAffiliation(id)), Permission.InvitePlanUsers); - PlanEntity dmp = this.queryFactory.query(PlanQuery.class).disableTracking().ids(id).first(); - if (dmp == null){ - throw new InvalidApplicationException("Dmp does not exist!"); + PlanEntity plan = this.queryFactory.query(PlanQuery.class).disableTracking().ids(id).first(); + if (plan == null){ + throw new InvalidApplicationException("Plan does not exist!"); } List existingUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking() - .planIds(dmp.getId()) + .planIds(plan.getId()) .isActives(IsActive.Active) .collect(); if (this.conventionService.isListNullOrEmpty(existingUsers)){ - throw new InvalidApplicationException("Dmp does not have users!"); + throw new InvalidApplicationException("Plan does not have users!"); } List usersToAssign = new ArrayList<>(); @@ -1463,10 +1463,10 @@ public class PlanServiceImpl implements PlanService { user.setUser(userId); usersToAssign.add(user); if (this.userScope.getUserId() != userId && !existingUsers.stream().map(PlanUserEntity::getUserId).toList().contains(userId)){ - this.sendPlanInvitationExistingUser(user.getUser(), dmp, user.getRole()); + this.sendPlanInvitationExistingUser(user.getUser(), plan, user.getRole()); } }else if (user.getEmail() != null) { - this.sendPlanInvitationExternalUser(user.getEmail(),dmp, user.getRole()); + this.sendPlanInvitationExternalUser(user.getEmail(),plan, user.getRole()); } } @@ -1474,28 +1474,28 @@ public class PlanServiceImpl implements PlanService { return usersToAssign; } - private void sendPlanInvitationExistingUser(UUID userId, PlanEntity dmp, PlanUserRole role) throws InvalidApplicationException { + private void sendPlanInvitationExistingUser(UUID userId, PlanEntity plan, 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()); + if (recipient == null) throw new MyValidationException(this.errors.getPlanInactiveUser().getCode(), this.errors.getPlanInactiveUser().getMessage()); String email = this.queryFactory.query(UserContactInfoQuery.class).disableTracking().userIds(recipient.getId()).first().getValue(); - this.createPlanInvitationExistingUserEvent(recipient, dmp, role, email); + this.createPlanInvitationExistingUserEvent(recipient, plan, role, email); } - private void createPlanInvitationExistingUserEvent(UserEntity recipient, PlanEntity dmp, PlanUserRole role, String email) throws InvalidApplicationException { + private void createPlanInvitationExistingUserEvent(UserEntity recipient, PlanEntity plan, PlanUserRole role, String email) throws InvalidApplicationException { - if (email == null) throw new MyValidationException(this.errors.getDmpMissingUserContactInfo().getCode(), this.errors.getDmpMissingUserContactInfo().getMessage()); + if (email == null) throw new MyValidationException(this.errors.getPlanMissingUserContactInfo().getCode(), this.errors.getPlanMissingUserContactInfo().getMessage()); NotifyIntegrationEvent event = new NotifyIntegrationEvent(); event.setUserId(recipient.getId()); - event.setNotificationType(this.notificationProperties.getDmpInvitationExistingUserType()); + event.setNotificationType(this.notificationProperties.getPlanInvitationExistingUserType()); NotificationFieldData data = new NotificationFieldData(); List fieldInfoList = new ArrayList<>(); fieldInfoList.add(new FieldInfo("{recipient}", DataType.String, recipient.getName())); fieldInfoList.add(new FieldInfo("{reasonName}", DataType.String, this.queryFactory.query(UserQuery.class).disableTracking().ids(this.userScope.getUserIdSafe()).first().getName())); - fieldInfoList.add(new FieldInfo("{planname}", DataType.String, dmp.getLabel())); + fieldInfoList.add(new FieldInfo("{planname}", DataType.String, plan.getLabel())); fieldInfoList.add(new FieldInfo("{planrole}", DataType.String, role.toString())); - fieldInfoList.add(new FieldInfo("{id}", DataType.String, dmp.getId().toString())); + fieldInfoList.add(new FieldInfo("{id}", DataType.String, plan.getId().toString())); if(this.tenantScope.getTenantCode() != null && !this.tenantScope.getTenantCode().equals(this.tenantScope.getDefaultTenantCode())){ fieldInfoList.add(new FieldInfo("{tenant-url-path}", DataType.String, String.format("/t/%s", this.tenantScope.getTenantCode()))); } @@ -1504,8 +1504,8 @@ public class PlanServiceImpl implements PlanService { this.eventHandler.handle(event); } - private void sendPlanInvitationExternalUser(String email, PlanEntity dmp, PlanUserRole role) throws JAXBException, InvalidApplicationException { - String token = this.createActionConfirmation(email, dmp, role); + private void sendPlanInvitationExternalUser(String email, PlanEntity plan, PlanUserRole role) throws JAXBException, InvalidApplicationException { + String token = this.createActionConfirmation(email, plan, role); NotifyIntegrationEvent event = new NotifyIntegrationEvent(); @@ -1514,12 +1514,12 @@ public class PlanServiceImpl implements PlanService { NotificationContactData contactData = new NotificationContactData(contactPairs, null, null); event.setContactHint(this.jsonHandlingService.toJsonSafe(contactData)); event.setContactTypeHint(NotificationContactType.EMAIL); - event.setNotificationType(this.notificationProperties.getDmpInvitationExternalUserType()); + event.setNotificationType(this.notificationProperties.getPlanInvitationExternalUserType()); NotificationFieldData data = new NotificationFieldData(); List fieldInfoList = new ArrayList<>(); fieldInfoList.add(new FieldInfo("{recipient}", DataType.String, email)); fieldInfoList.add(new FieldInfo("{confirmationToken}", DataType.String, token)); - fieldInfoList.add(new FieldInfo("{planname}", DataType.String, dmp.getLabel())); + fieldInfoList.add(new FieldInfo("{planname}", DataType.String, plan.getLabel())); fieldInfoList.add(new FieldInfo("{planrole}", DataType.String, role.toString())); if(this.tenantScope.getTenantCode() != null && !this.tenantScope.getTenantCode().equals(this.tenantScope.getDefaultTenantCode())){ fieldInfoList.add(new FieldInfo("{tenant-url-path}", DataType.String, String.format("/t/%s", this.tenantScope.getTenantCode()))); @@ -1529,12 +1529,12 @@ public class PlanServiceImpl implements PlanService { this.eventHandler.handle(event); } - private String createActionConfirmation(String email, PlanEntity dmp, PlanUserRole role) throws JAXBException, InvalidApplicationException { + private String createActionConfirmation(String email, PlanEntity plan, PlanUserRole role) throws JAXBException, InvalidApplicationException { ActionConfirmationPersist persist = new ActionConfirmationPersist(); persist.setType(ActionConfirmationType.PlanInvitation); persist.setStatus(ActionConfirmationStatus.Requested); persist.setToken(UUID.randomUUID().toString()); - persist.setPlanInvitation(new PlanInvitationPersist(email, dmp.getId(), role)); + persist.setPlanInvitation(new PlanInvitationPersist(email, plan.getId(), role)); persist.setExpiresAt(Instant.now().plusSeconds(this.notificationProperties.getEmailExpirationTimeSeconds())); this.validatorFactory.validator(ActionConfirmationPersist.ActionConfirmationPersistValidator.class).validateForce(persist); this.actionConfirmationService.persist(persist, null); @@ -1739,12 +1739,12 @@ public class PlanServiceImpl implements PlanService { } 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(PlanUserEntity::getUserId).distinct().toList()).authorize(AuthorizationFlags.All).isActive(IsActive.Active).collect(); + List planUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking().planIds(data.getId()).authorize(AuthorizationFlags.All).isActives(IsActive.Active).collect(); + if (!this.conventionService.isListNullOrEmpty(planUsers)) { + List users = this.queryFactory.query(UserQuery.class).disableTracking().ids(planUsers.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 planUserImportExports = new LinkedList<>(); - for (PlanUserEntity planUserEntity : dmpUsers) { + for (PlanUserEntity planUserEntity : planUsers) { planUserImportExports.add(this.planUserToExport(planUserEntity, usersMap)); } return planUserImportExports; @@ -1816,7 +1816,7 @@ public class PlanServiceImpl implements PlanService { 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 (plan == null) throw new MyApplicationException("Error creating plan"); if (!this.conventionService.isListNullOrEmpty(planXml.getDescriptions())){ for (DescriptionImportExport description: planXml.getDescriptions()){ @@ -2054,13 +2054,13 @@ public class PlanServiceImpl implements PlanService { //region Import RDA JSON public PreprocessingDmpModel preprocessingPlan(UUID fileId, String repositoryId) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, IOException { - return this.fileTransformerService.preprocessingDmp(fileId, repositoryId); + return this.fileTransformerService.preprocessingPlan(fileId, repositoryId); } 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(planCommonModelConfig); + DmpModel model = this.fileTransformerService.importPlan(planCommonModelConfig); if (model == null) throw new MyNotFoundException("Plan Import Error"); PlanPersist persist = new PlanPersist(); @@ -2153,7 +2153,7 @@ public class PlanServiceImpl implements PlanService { private Map commonModelToPlanBlueprintValuePersist(DmpModel commonModel){ if (commonModel.getDmpBlueprint() != null && commonModel.getDmpBlueprint().getDefinition() != null && !this.conventionService.isListNullOrEmpty(commonModel.getDmpBlueprint().getDefinition().getSections())) { - Map dmpBlueprintValues = new HashMap<>(); + Map planBlueprintValues = new HashMap<>(); List sections = commonModel.getDmpBlueprint().getDefinition().getSections(); if (!this.conventionService.isListNullOrEmpty(sections)){ for (SectionModel section : sections) { @@ -2164,21 +2164,21 @@ public class PlanServiceImpl implements PlanService { ReferenceTypeFieldModel referenceField = (ReferenceTypeFieldModel) field; List dmpReferencesByField = commonModel.getReferences().stream().filter(x -> x.getData() != null && x.getData().getBlueprintFieldId().equals(referenceField.getId())).collect(Collectors.toList()); if (!this.conventionService.isListNullOrEmpty(dmpReferencesByField)){ - dmpBlueprintValues.put(referenceField.getId(), this.commonModelPlanReferenceFieldToPlanBlueprintValuePersist(referenceField, dmpReferencesByField)); + planBlueprintValues.put(referenceField.getId(), this.commonModelPlanReferenceFieldToPlanBlueprintValuePersist(referenceField, dmpReferencesByField)); } } else { // custom fields if (field.getCategory().equals(org.opencdmp.commonmodels.enums.DmpBlueprintFieldCategory.Extra) && commonModel.getProperties() != null && !this.conventionService.isListNullOrEmpty(commonModel.getProperties().getDmpBlueprintValues())){ DmpBlueprintValueModel dmpBlueprintValueModel = commonModel.getProperties().getDmpBlueprintValues().stream().filter(x -> x.getFieldId().equals(field.getId())).findFirst().orElse(null); ExtraFieldModel extraFieldModel = (ExtraFieldModel) field; - if (dmpBlueprintValueModel != null) dmpBlueprintValues.put(dmpBlueprintValueModel.getFieldId(), this.commonModelPlanBlueprintValueToPersist(dmpBlueprintValueModel, extraFieldModel)); + if (dmpBlueprintValueModel != null) planBlueprintValues.put(dmpBlueprintValueModel.getFieldId(), this.commonModelPlanBlueprintValueToPersist(dmpBlueprintValueModel, extraFieldModel)); } } } } } } - return dmpBlueprintValues; + return planBlueprintValues; } return null; } @@ -2210,7 +2210,7 @@ public class PlanServiceImpl implements PlanService { private ReferencePersist commonPlanReferenceToReferencePersist(ReferenceModel model, ReferenceTypeEntity referenceTypeEntity) { if (!referenceTypeEntity.getCode().equals(model.getType().getCode())) throw new MyApplicationException("Invalid reference for field " + model.getId()); - if (this.conventionService.isNullOrEmpty(model.getLabel()) && this.conventionService.isNullOrEmpty(model.getReference())) throw new MyApplicationException("Dmp Reference without label and reference id "); + if (this.conventionService.isNullOrEmpty(model.getLabel()) && this.conventionService.isNullOrEmpty(model.getReference())) throw new MyApplicationException("Plan Reference without label and reference id "); ReferenceEntity referenceEntity = model.getId() != null ? this.queryFactory.query(ReferenceQuery.class).ids(model.getId()).first(): null; //TODO: optimize if (referenceEntity == null && !this.conventionService.isNullOrEmpty(model.getReference())) { 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 index ceb24ad6c..d0c96d1e1 100644 --- a/backend/core/src/main/java/org/opencdmp/service/planblueprint/PlanBlueprintService.java +++ b/backend/core/src/main/java/org/opencdmp/service/planblueprint/PlanBlueprintService.java @@ -40,8 +40,8 @@ public interface PlanBlueprintService { 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(BlueprintImportExport planBlueprintDefinition, 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; + PlanBlueprint importCommonModel(DmpBlueprintModel planBlueprintModel, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException; } diff --git a/backend/core/src/main/java/org/opencdmp/service/planblueprint/PlanBlueprintServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/planblueprint/PlanBlueprintServiceImpl.java index fcf2b01de..722357d2c 100644 --- a/backend/core/src/main/java/org/opencdmp/service/planblueprint/PlanBlueprintServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/planblueprint/PlanBlueprintServiceImpl.java @@ -154,7 +154,7 @@ public class PlanBlueprintServiceImpl implements PlanBlueprintService { 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()); + throw new MyValidationException(this.errors.getPlanBlueprintHasNoDescriptionTemplates().getCode(), this.errors.getPlanBlueprintHasNoDescriptionTemplates().getMessage()); } data.setLabel(model.getLabel()); @@ -183,14 +183,14 @@ public class PlanBlueprintServiceImpl implements PlanBlueprintService { throw new MyForbiddenException("Can not update finalized blueprint"); if (newStatus.equals(PlanBlueprintStatus.Finalized)) { - List latestVersionDmpBlueprints = this.queryFactory.query(PlanBlueprintQuery.class) + List latestVersionPlanBlueprints = this.queryFactory.query(PlanBlueprintQuery.class) .disableTracking() .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()); - PlanBlueprintEntity oldPlanBlueprintEntity = latestVersionDmpBlueprints.stream().findFirst().orElse(null); + if (latestVersionPlanBlueprints.size() > 1) throw new MyValidationException(this.errors.getMultiplePlanVersionsNotSupported().getCode(), this.errors.getMultiplePlanVersionsNotSupported().getMessage()); + PlanBlueprintEntity oldPlanBlueprintEntity = latestVersionPlanBlueprints.stream().findFirst().orElse(null); data.setVersionStatus(PlanBlueprintVersionStatus.Current); @@ -400,7 +400,7 @@ public class PlanBlueprintServiceImpl implements PlanBlueprintService { @Override 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)); + logger.debug(new MapLogEntry("persisting data planBlueprint").And("model", model).And("fields", fields)); this.authorizationService.authorizeForce(Permission.CreateNewVersionPlanBlueprint); @@ -411,16 +411,16 @@ public class PlanBlueprintServiceImpl implements PlanBlueprintService { throw new MyValidationException(this.errors.getHashConflict().getCode(), this.errors.getHashConflict().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(PlanBlueprintQuery.class) + List latestVersionPlanBlueprints = this.queryFactory.query(PlanBlueprintQuery.class) .disableTracking() .versionStatuses(PlanBlueprintVersionStatus.Current) .isActive(IsActive.Active) .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(oldPlanBlueprintEntity.getVersion())) throw new MyValidationException(this.errors.getDmpBlueprintNewVersionConflict().getCode(), this.errors.getDmpBlueprintNewVersionConflict().getMessage()); + if (latestVersionPlanBlueprints.isEmpty()) throw new MyValidationException(this.errors.getPlanIsNotFinalized().getCode(), this.errors.getPlanIsNotFinalized().getMessage()); + if (latestVersionPlanBlueprints.size() > 1) throw new MyValidationException(this.errors.getMultiplePlanVersionsNotSupported().getCode(), this.errors.getMultiplePlanVersionsNotSupported().getMessage()); + if (!latestVersionPlanBlueprints.getFirst().getVersion().equals(oldPlanBlueprintEntity.getVersion())) throw new MyValidationException(this.errors.getPlanBlueprintNewVersionConflict().getCode(), this.errors.getPlanBlueprintNewVersionConflict().getMessage()); Long notFinalizedCount = this.queryFactory.query(PlanBlueprintQuery.class) .disableTracking() .versionStatuses(PlanBlueprintVersionStatus.NotFinalized) @@ -428,7 +428,7 @@ public class PlanBlueprintServiceImpl implements PlanBlueprintService { .isActive(IsActive.Active) .count(); if (notFinalizedCount > 0) - throw new MyValidationException(this.errors.getDmpBlueprintNewVersionAlreadyCreatedDraft().getCode(), this.errors.getDmpBlueprintNewVersionAlreadyCreatedDraft().getMessage()); + throw new MyValidationException(this.errors.getPlanBlueprintNewVersionAlreadyCreatedDraft().getCode(), this.errors.getPlanBlueprintNewVersionAlreadyCreatedDraft().getMessage()); PlanBlueprintEntity data = new PlanBlueprintEntity(); data.setId(UUID.randomUUID()); @@ -496,13 +496,13 @@ public class PlanBlueprintServiceImpl implements PlanBlueprintService { if (entity == null) return null; BlueprintDefinitionImportExport xml = new BlueprintDefinitionImportExport(); - List dmpBlueprintSections = new ArrayList<>(); + List planBlueprintSections = new ArrayList<>(); if (!this.conventionService.isListNullOrEmpty(entity.getSections())) { for (SectionEntity section : entity.getSections()) { - dmpBlueprintSections.add(this.sectionXmlToExport(section)); + planBlueprintSections.add(this.sectionXmlToExport(section)); } } - xml.setSections(dmpBlueprintSections); + xml.setSections(planBlueprintSections); return xml; } @@ -513,37 +513,37 @@ public class PlanBlueprintServiceImpl implements PlanBlueprintService { xml.setDescription(entity.getDescription()); xml.setOrdinal(entity.getOrdinal()); xml.setHasTemplates(entity.getHasTemplates()); - List dmpBlueprintSystemFieldModels = new LinkedList<>(); + List planBlueprintSystemFieldModels = new LinkedList<>(); if (!this.conventionService.isListNullOrEmpty(entity.getFields())) { for (SystemFieldEntity systemField : entity.getFields().stream().filter(x -> x.getCategory() == PlanBlueprintFieldCategory.System).map(x -> (SystemFieldEntity) x).toList()) { - dmpBlueprintSystemFieldModels.add(this.systemFieldXmlToExport(systemField)); + planBlueprintSystemFieldModels.add(this.systemFieldXmlToExport(systemField)); } } - xml.setSystemFields(dmpBlueprintSystemFieldModels); + xml.setSystemFields(planBlueprintSystemFieldModels); - List dmpBlueprintExtraFieldModels = new LinkedList<>(); + List planBlueprintExtraFieldModels = new LinkedList<>(); if (!this.conventionService.isListNullOrEmpty(entity.getFields())) { for (ExtraFieldEntity systemField : entity.getFields().stream().filter(x -> x.getCategory() == PlanBlueprintFieldCategory.Extra).map(x -> (ExtraFieldEntity) x).toList()) { - dmpBlueprintExtraFieldModels.add(this.extraFieldXmlToExport(systemField)); + planBlueprintExtraFieldModels.add(this.extraFieldXmlToExport(systemField)); } } - xml.setExtraFields(dmpBlueprintExtraFieldModels); + xml.setExtraFields(planBlueprintExtraFieldModels); - List dmpBlueprintReferenceFieldModels = new LinkedList<>(); + List planBlueprintReferenceFieldModels = new LinkedList<>(); if (!this.conventionService.isListNullOrEmpty(entity.getFields())) { for (ReferenceTypeFieldEntity referenceTypeFieldEntity : entity.getFields().stream().filter(x -> x.getCategory() == PlanBlueprintFieldCategory.ReferenceType).map(x -> (ReferenceTypeFieldEntity) x).toList()) { - dmpBlueprintReferenceFieldModels.add(this.referenceFieldXmlToExport(referenceTypeFieldEntity)); + planBlueprintReferenceFieldModels.add(this.referenceFieldXmlToExport(referenceTypeFieldEntity)); } } - xml.setReferenceFields(dmpBlueprintReferenceFieldModels); + xml.setReferenceFields(planBlueprintReferenceFieldModels); - List dmpBlueprintDescriptionTemplates = new LinkedList<>(); + List planBlueprintDescriptionTemplates = new LinkedList<>(); if (!this.conventionService.isListNullOrEmpty(entity.getDescriptionTemplates())) { for (DescriptionTemplateEntity descriptionTemplate : entity.getDescriptionTemplates()) { - dmpBlueprintDescriptionTemplates.add(this.prefillingSourceXmlToExport(descriptionTemplate)); + planBlueprintDescriptionTemplates.add(this.prefillingSourceXmlToExport(descriptionTemplate)); } } - xml.setDescriptionTemplates(dmpBlueprintDescriptionTemplates); + xml.setDescriptionTemplates(planBlueprintDescriptionTemplates); List blueprintPrefillingSourceImportExports = new LinkedList<>(); if (!this.conventionService.isListNullOrEmpty(entity.getPrefillingSourcesIds())) { @@ -645,20 +645,20 @@ public class PlanBlueprintServiceImpl implements PlanBlueprintService { this.validatorFactory.validator(PlanBlueprintPersist.PlanBlueprintPersistValidator.class).validateForce(persist); return this.persist(persist, groupId, fields); } else { - PlanBlueprintEntity latestVersionDmpBlueprint = this.queryFactory.query(PlanBlueprintQuery.class) + PlanBlueprintEntity latestVersionPlanBlueprint = this.queryFactory.query(PlanBlueprintQuery.class) .disableTracking() .versionStatuses(PlanBlueprintVersionStatus.Current) .isActive(IsActive.Active) .statuses(PlanBlueprintStatus.Finalized) .groupIds(groupId) .first(); - if (latestVersionDmpBlueprint == null) throw new MyValidationException(this.errors.getDmpIsNotFinalized().getCode(), this.errors.getDmpIsNotFinalized().getMessage()); + if (latestVersionPlanBlueprint == null) throw new MyValidationException(this.errors.getPlanIsNotFinalized().getCode(), this.errors.getPlanIsNotFinalized().getMessage()); NewVersionPlanBlueprintPersist persist = new NewVersionPlanBlueprintPersist(); - persist.setId(latestVersionDmpBlueprint.getId()); + persist.setId(latestVersionPlanBlueprint.getId()); persist.setLabel(label); persist.setStatus(PlanBlueprintStatus.Draft); persist.setDefinition(this.xmlDefinitionToPersist(planBlueprintDefinition.getPlanBlueprintDefinition())); - persist.setHash(this.conventionService.hashValue(latestVersionDmpBlueprint.getUpdatedAt())); + persist.setHash(this.conventionService.hashValue(latestVersionPlanBlueprint.getUpdatedAt())); this.validatorFactory.validator(NewVersionPlanBlueprintPersist.NewVersionPlanBlueprintPersistValidator.class).validateForce(persist); return this.createNewVersion(persist, fields); @@ -680,13 +680,13 @@ public class PlanBlueprintServiceImpl implements PlanBlueprintService { if (importXml == null) return null; DefinitionPersist persist = new DefinitionPersist(); - List dmpBlueprintSections = new ArrayList<>(); + List planBlueprintSections = new ArrayList<>(); if (!this.conventionService.isListNullOrEmpty(importXml.getSections())) { for (BlueprintSectionImportExport section : importXml.getSections()) { - dmpBlueprintSections.add(this.xmlSectionToPersist(section)); + planBlueprintSections.add(this.xmlSectionToPersist(section)); } } - persist.setSections(dmpBlueprintSections); + persist.setSections(planBlueprintSections); return persist; } @@ -697,30 +697,30 @@ public class PlanBlueprintServiceImpl implements PlanBlueprintService { persist.setDescription(importXml.getDescription()); persist.setOrdinal(importXml.getOrdinal()); persist.setHasTemplates(importXml.isHasTemplates()); - List dmpBlueprintFieldModels = new LinkedList<>(); + List planBlueprintFieldModels = new LinkedList<>(); if (!this.conventionService.isListNullOrEmpty(importXml.getSystemFields())) { for (BlueprintSystemFieldImportExport systemField : importXml.getSystemFields()) { - dmpBlueprintFieldModels.add(this.xmlSystemFieldToPersist(systemField)); + planBlueprintFieldModels.add(this.xmlSystemFieldToPersist(systemField)); } } if (!this.conventionService.isListNullOrEmpty(importXml.getReferenceFields())) { for (BlueprintReferenceTypeFieldImportExport referenceField : importXml.getReferenceFields()) { - dmpBlueprintFieldModels.add(this.xmlReferenceFieldToPersist(referenceField)); + planBlueprintFieldModels.add(this.xmlReferenceFieldToPersist(referenceField)); } } if (!this.conventionService.isListNullOrEmpty(importXml.getExtraFields())) { for (BlueprintExtraFieldImportExport extraField : importXml.getExtraFields()) { - dmpBlueprintFieldModels.add(this.xmlExtraFieldToPersist(extraField)); + planBlueprintFieldModels.add(this.xmlExtraFieldToPersist(extraField)); } } - persist.setFields(dmpBlueprintFieldModels); - List dmpBlueprintDescriptionTemplates = new LinkedList<>(); + persist.setFields(planBlueprintFieldModels); + List planBlueprintDescriptionTemplates = new LinkedList<>(); if (!this.conventionService.isListNullOrEmpty(importXml.getDescriptionTemplates())) { for (BlueprintDescriptionTemplateImportExport descriptionTemplate : importXml.getDescriptionTemplates()) { - dmpBlueprintDescriptionTemplates.add(this.xmlDescriptionTemplateToPersist(descriptionTemplate)); + planBlueprintDescriptionTemplates.add(this.xmlDescriptionTemplateToPersist(descriptionTemplate)); } } - persist.setDescriptionTemplates(dmpBlueprintDescriptionTemplates); + persist.setDescriptionTemplates(planBlueprintDescriptionTemplates); List prefillingSources = new LinkedList<>(); if (!this.conventionService.isListNullOrEmpty(importXml.getPrefillingSources())) { @@ -809,40 +809,40 @@ public class PlanBlueprintServiceImpl implements PlanBlueprintService { //region Import Common Model @Override - 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)); + public PlanBlueprint importCommonModel(DmpBlueprintModel planBlueprintModel, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException { + logger.debug(new MapLogEntry("import data").And("planBlueprintModel", planBlueprintModel).And("fields", fields)); this.authorizationService.authorizeForce(Permission.ImportPlanBlueprint); - long activeBlueprintForTheGroup = planDefinition.getGroupId() != null ? this.queryFactory.query(PlanBlueprintQuery.class).disableTracking() + long activeBlueprintForTheGroup = planBlueprintModel.getGroupId() != null ? this.queryFactory.query(PlanBlueprintQuery.class).disableTracking() .isActive(IsActive.Active) - .groupIds(planDefinition.getGroupId()) + .groupIds(planBlueprintModel.getGroupId()) .count() : 0; if (activeBlueprintForTheGroup == 0) { PlanBlueprintPersist persist = new PlanBlueprintPersist(); - persist.setLabel(planDefinition.getLabel()); + persist.setLabel(planBlueprintModel.getLabel()); persist.setStatus(PlanBlueprintStatus.Draft); - persist.setDefinition(this.commonModelDefinitionToPersist(planDefinition.getDefinition())); + persist.setDefinition(this.commonModelDefinitionToPersist(planBlueprintModel.getDefinition())); this.validatorFactory.validator(PlanBlueprintPersist.PlanBlueprintPersistValidator.class).validateForce(persist); - return this.persist(persist, planDefinition.getGroupId(), fields); + return this.persist(persist, planBlueprintModel.getGroupId(), fields); } else { - PlanBlueprintEntity latestVersionDmpBlueprint = this.queryFactory.query(PlanBlueprintQuery.class) + PlanBlueprintEntity latestVersionPlanBlueprint = this.queryFactory.query(PlanBlueprintQuery.class) .disableTracking() .versionStatuses(PlanBlueprintVersionStatus.Current) .isActive(IsActive.Active) .statuses(PlanBlueprintStatus.Finalized) - .groupIds(planDefinition.getGroupId()) + .groupIds(planBlueprintModel.getGroupId()) .first(); - if (latestVersionDmpBlueprint == null) throw new MyValidationException(this.errors.getDmpIsNotFinalized().getCode(), this.errors.getDmpIsNotFinalized().getMessage()); + if (latestVersionPlanBlueprint == null) throw new MyValidationException(this.errors.getPlanIsNotFinalized().getCode(), this.errors.getPlanIsNotFinalized().getMessage()); NewVersionPlanBlueprintPersist persist = new NewVersionPlanBlueprintPersist(); - persist.setId(latestVersionDmpBlueprint.getId()); - persist.setLabel(planDefinition.getLabel()); + persist.setId(latestVersionPlanBlueprint.getId()); + persist.setLabel(planBlueprintModel.getLabel()); persist.setStatus(PlanBlueprintStatus.Draft); - persist.setDefinition(this.commonModelDefinitionToPersist(planDefinition.getDefinition())); - persist.setHash(this.conventionService.hashValue(latestVersionDmpBlueprint.getUpdatedAt())); + persist.setDefinition(this.commonModelDefinitionToPersist(planBlueprintModel.getDefinition())); + persist.setHash(this.conventionService.hashValue(latestVersionPlanBlueprint.getUpdatedAt())); this.validatorFactory.validator(NewVersionPlanBlueprintPersist.NewVersionPlanBlueprintPersistValidator.class).validateForce(persist); return this.createNewVersion(persist, fields); @@ -853,13 +853,13 @@ public class PlanBlueprintServiceImpl implements PlanBlueprintService { if (commonModel == null) return null; DefinitionPersist persist = new DefinitionPersist(); - List dmpBlueprintSections = new ArrayList<>(); + List planBlueprintSections = new ArrayList<>(); if (!this.conventionService.isListNullOrEmpty(commonModel.getSections())) { for (SectionModel section : commonModel.getSections()) { - dmpBlueprintSections.add(this.commonModelSectionToPersist(section)); + planBlueprintSections.add(this.commonModelSectionToPersist(section)); } } - persist.setSections(dmpBlueprintSections); + persist.setSections(planBlueprintSections); return persist; } @@ -870,19 +870,19 @@ public class PlanBlueprintServiceImpl implements PlanBlueprintService { persist.setDescription(commonModel.getDescription()); persist.setOrdinal(commonModel.getOrdinal()); persist.setHasTemplates(commonModel.getHasTemplates()); - List dmpBlueprintFieldModels = new LinkedList<>(); + List planBlueprintFieldModels = new LinkedList<>(); if (!this.conventionService.isListNullOrEmpty(commonModel.getFields())) { for (SystemFieldModel systemField : commonModel.getFields().stream().filter(x-> org.opencdmp.commonmodels.enums.DmpBlueprintFieldCategory.System.equals(x.getCategory())).map(x-> (SystemFieldModel)x).toList()) { - dmpBlueprintFieldModels.add(this.commonModelSystemFieldToPersist(systemField)); + planBlueprintFieldModels.add(this.commonModelSystemFieldToPersist(systemField)); } for (ReferenceTypeFieldModel referenceField : commonModel.getFields().stream().filter(x-> org.opencdmp.commonmodels.enums.DmpBlueprintFieldCategory.ReferenceType.equals(x.getCategory())).map(x-> (ReferenceTypeFieldModel)x).toList()) { - dmpBlueprintFieldModels.add(this.commonModelReferenceFieldToPersist(referenceField)); + planBlueprintFieldModels.add(this.commonModelReferenceFieldToPersist(referenceField)); } for (ExtraFieldModel extraField : commonModel.getFields().stream().filter(x-> org.opencdmp.commonmodels.enums.DmpBlueprintFieldCategory.Extra.equals(x.getCategory())).map(x-> (ExtraFieldModel)x).toList()) { - dmpBlueprintFieldModels.add(this.commonExtraFieldToPersist(extraField)); + planBlueprintFieldModels.add(this.commonExtraFieldToPersist(extraField)); } } - persist.setFields(dmpBlueprintFieldModels); + persist.setFields(planBlueprintFieldModels); // List dmpBlueprintDescriptionTemplates = new LinkedList<>(); // if (!this.conventionService.isListNullOrEmpty(importXml.getDescriptionTemplates())) { // for (BlueprintDescriptionTemplateImportExport descriptionTemplate : importXml.getDescriptionTemplates()) { diff --git a/backend/core/src/main/java/org/opencdmp/service/prefillingsource/PrefillingSourceServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/prefillingsource/PrefillingSourceServiceImpl.java index cef1626e7..4d63d2833 100644 --- a/backend/core/src/main/java/org/opencdmp/service/prefillingsource/PrefillingSourceServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/prefillingsource/PrefillingSourceServiceImpl.java @@ -613,7 +613,7 @@ public class PrefillingSourceServiceImpl implements PrefillingSourceService { } } } - case VALIDATION, UPLOAD, INTERNAL_ENTRIES_DMPS, INTERNAL_ENTRIES_DESCRIPTIONS -> throw new MyApplicationException("invalid type " + fieldEntity.getData().getFieldType()); + case VALIDATION, UPLOAD, INTERNAL_ENTRIES_PLANS, INTERNAL_ENTRIES_DESCRIPTIONS -> throw new MyApplicationException("invalid type " + fieldEntity.getData().getFieldType()); default -> throw new MyApplicationException("invalid type " + fieldEntity.getData().getFieldType()); } } catch (Exception e){ 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 56511a810..7f1d4f648 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,10 +804,10 @@ public class UserServiceImpl implements UserService { this.entityManager.merge(lock); } - List dmpUsers = this.queryFactory.query(PlanUserQuery.class).userIds(oldUser.getId()).collect(); - for (PlanUserEntity dmpUser : dmpUsers) { - dmpUser.setUserId(newUser.getId()); - this.entityManager.merge(dmpUser); + List planUsers = this.queryFactory.query(PlanUserQuery.class).userIds(oldUser.getId()).collect(); + for (PlanUserEntity planUser : planUsers) { + planUser.setUserId(newUser.getId()); + this.entityManager.merge(planUser); } List userDescriptionTemplates = this.queryFactory.query(UserDescriptionTemplateQuery.class).userIds(oldUser.getId()).collect(); @@ -816,10 +816,10 @@ public class UserServiceImpl implements UserService { this.entityManager.merge(userDescriptionTemplate); } - List dmps = this.queryFactory.query(PlanQuery.class).creatorIds(oldUser.getId()).collect(); - for (PlanEntity dmp : dmps) { - dmp.setCreatorId(newUser.getId()); - this.entityManager.merge(dmp); + List plans = this.queryFactory.query(PlanQuery.class).creatorIds(oldUser.getId()).collect(); + for (PlanEntity plan : plans) { + plan.setCreatorId(newUser.getId()); + this.entityManager.merge(plan); } List descriptions = this.queryFactory.query(DescriptionQuery.class).createdByIds(oldUser.getId()).collect(); @@ -834,16 +834,16 @@ public class UserServiceImpl implements UserService { this.entityManager.flush(); - for (PlanEntity dmp : dmps) { - this.elasticService.persistPlan(dmp); + for (PlanEntity plan : plans) { + this.elasticService.persistPlan(plan); } for (DescriptionEntity description : descriptions) { this.elasticService.persistDescription(description); } - for (PlanEntity dmp : dmps) { - this.annotationEntityTouchedIntegrationEventHandler.handlePlan(dmp.getId()); + for (PlanEntity plan : plans) { + this.annotationEntityTouchedIntegrationEventHandler.handlePlan(plan.getId()); } for (DescriptionEntity description : descriptions) { diff --git a/backend/core/src/main/java/org/opencdmp/service/visibility/VisibilityServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/visibility/VisibilityServiceImpl.java index 34cedbff0..1808e21e1 100644 --- a/backend/core/src/main/java/org/opencdmp/service/visibility/VisibilityServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/visibility/VisibilityServiceImpl.java @@ -420,7 +420,7 @@ public class VisibilityServiceImpl implements VisibilityService { return field.getTextValue().equals(rule.getTextValue()); } else if (rule.getTextValue() != null &&org.opencdmp.commons.enums.FieldType.isTextListType(fieldType) && field.getTextListValue() != null && !field.getTextListValue().isEmpty()) { - if (FieldType.INTERNAL_ENTRIES_DMPS.equals(fieldType)) throw new NotImplementedException("dmps not supported"); + if (FieldType.INTERNAL_ENTRIES_PLANS.equals(fieldType)) throw new NotImplementedException("plans not supported"); if (FieldType.INTERNAL_ENTRIES_DESCRIPTIONS.equals(fieldType)) throw new NotImplementedException("descriptions not supported"); return new HashSet<>(field.getTextListValue()).contains(rule.getTextValue()); 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 4b9a8cd20..920ad5510 100644 --- a/backend/web/src/main/java/org/opencdmp/authorization/AffiliatedAuthorizationHandler.java +++ b/backend/web/src/main/java/org/opencdmp/authorization/AffiliatedAuthorizationHandler.java @@ -42,7 +42,7 @@ public class AffiliatedAuthorizationHandler extends AuthorizationHandler queryResult = this.elasticQueryHelperService.collectPublic(lookup, EnumSet.of(Public), null); this.auditService.track(AuditableAction.Description_PublicQuery, "lookup", lookup); @@ -148,7 +147,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(PlanQuery.class).isActive(IsActive.Active).statuses(PlanStatus.Finalized).accessTypes(PlanAccessType.Public)); + DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).disableTracking().authorize(EnumSet.of(Public)).ids(id).planSubQuery(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) diff --git a/backend/web/src/main/java/org/opencdmp/controllers/FileTransformerController.java b/backend/web/src/main/java/org/opencdmp/controllers/FileTransformerController.java index 14fd21e11..cd3d1af0e 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/FileTransformerController.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/FileTransformerController.java @@ -9,7 +9,6 @@ import org.opencdmp.audit.AuditableAction; import org.opencdmp.controllers.swagger.SwaggerHelpers; import org.opencdmp.controllers.swagger.annotation.OperationWithTenantHeader; import org.opencdmp.controllers.swagger.annotation.SwaggerCommonErrorResponses; -import org.opencdmp.model.deposit.DepositConfiguration; import org.opencdmp.model.file.ExportRequestModel; import org.opencdmp.model.file.FileEnvelope; import org.opencdmp.model.file.RepositoryFileFormat; @@ -71,14 +70,14 @@ public class FileTransformerController { return model; } - @PostMapping("/export-dmp") + @PostMapping("/export-plan") @OperationWithTenantHeader(summary = "Export a plan", description = SwaggerHelpers.FileTransformer.endpoint_export_plans, responses = @ApiResponse(description = "OK", responseCode = "200")) public ResponseEntity exportPlan(@RequestBody ExportRequestModel requestModel) throws InvalidApplicationException, IOException, InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException { logger.debug(new MapLogEntry("exporting plan")); HttpHeaders headers = new HttpHeaders(); - FileEnvelope fileEnvelope = this.fileTransformerService.exportDmp(requestModel.getId(), requestModel.getRepositoryId(), requestModel.getFormat()); + FileEnvelope fileEnvelope = this.fileTransformerService.exportPlan(requestModel.getId(), requestModel.getRepositoryId(), requestModel.getFormat()); headers.add("Content-Disposition", "attachment;filename=" + fileEnvelope.getFilename()); byte[] data = fileEnvelope.getFile(); headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); diff --git a/backend/web/src/main/java/org/opencdmp/controllers/LockController.java b/backend/web/src/main/java/org/opencdmp/controllers/LockController.java index f2865863f..94935b276 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/LockController.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/LockController.java @@ -172,10 +172,10 @@ public class LockController { @Transactional @GetMapping("target/lock/{id}/{targetType}") public boolean lock(@PathVariable("id") UUID targetId, @PathVariable("targetType") int targetType) throws Exception { - AffiliatedResource affiliatedResourceDmp = this.authorizationContentResolver.planAffiliation(targetId); + AffiliatedResource affiliatedResourcePlan = this.authorizationContentResolver.planAffiliation(targetId); AffiliatedResource affiliatedResourceDescription = this.authorizationContentResolver.descriptionAffiliation(targetId); AffiliatedResource affiliatedResourceDescriptionTemplate = this.authorizationContentResolver.descriptionTemplateAffiliation(targetId); - this.authService.authorizeAtLeastOneForce(List.of(affiliatedResourceDmp, affiliatedResourceDescription, affiliatedResourceDescriptionTemplate), Permission.EditLock); + this.authService.authorizeAtLeastOneForce(List.of(affiliatedResourcePlan, affiliatedResourceDescription, affiliatedResourceDescriptionTemplate), Permission.EditLock); this.lockService.lock(targetId, LockTargetType.of((short) targetType)); this.auditService.track(AuditableAction.Lock_Locked, Map.ofEntries( @@ -188,10 +188,10 @@ public class LockController { @Transactional @GetMapping("target/touch/{id}") public boolean touch(@PathVariable("id") UUID targetId) throws Exception { - AffiliatedResource affiliatedResourceDmp = this.authorizationContentResolver.planAffiliation(targetId); + AffiliatedResource affiliatedResourcePlan = this.authorizationContentResolver.planAffiliation(targetId); AffiliatedResource affiliatedResourceDescription = this.authorizationContentResolver.descriptionAffiliation(targetId); AffiliatedResource affiliatedResourceDescriptionTemplate = this.authorizationContentResolver.descriptionTemplateAffiliation(targetId); - this.authService.authorizeAtLeastOneForce(List.of(affiliatedResourceDmp, affiliatedResourceDescription, affiliatedResourceDescriptionTemplate), Permission.EditLock); + this.authService.authorizeAtLeastOneForce(List.of(affiliatedResourcePlan, affiliatedResourceDescription, affiliatedResourceDescriptionTemplate), Permission.EditLock); this.lockService.touch(targetId); this.auditService.track(AuditableAction.Lock_Touched, Map.ofEntries( @@ -203,10 +203,10 @@ public class LockController { @Transactional @DeleteMapping("target/unlock/{id}") public boolean unlock(@PathVariable("id") UUID targetId) throws Exception { - AffiliatedResource affiliatedResourceDmp = this.authorizationContentResolver.planAffiliation(targetId); + AffiliatedResource affiliatedResourcePlan = this.authorizationContentResolver.planAffiliation(targetId); AffiliatedResource affiliatedResourceDescription = this.authorizationContentResolver.descriptionAffiliation(targetId); AffiliatedResource affiliatedResourceDescriptionTemplate = this.authorizationContentResolver.descriptionTemplateAffiliation(targetId); - this.authService.authorizeAtLeastOneForce(List.of(affiliatedResourceDmp, affiliatedResourceDescription, affiliatedResourceDescriptionTemplate), Permission.EditLock); + this.authService.authorizeAtLeastOneForce(List.of(affiliatedResourcePlan, affiliatedResourceDescription, affiliatedResourceDescriptionTemplate), Permission.EditLock); this.lockService.unlock(targetId); this.auditService.track(AuditableAction.Lock_UnLocked, Map.ofEntries( 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 1d2e34875..7b9911ff1 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/MaintenanceController.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/MaintenanceController.java @@ -82,19 +82,19 @@ public class MaintenanceController { this.auditService.track(AuditableAction.Maintenance_SendTenantTouchEvents); } - @RequestMapping(method = RequestMethod.POST, value = "/events/dmps/touch") - public void sendDmpTouchEvents() throws InvalidApplicationException { - logger.debug("send dmp touch queue events"); + @RequestMapping(method = RequestMethod.POST, value = "/events/plans/touch") + public void sendPlanTouchEvents() throws InvalidApplicationException { + logger.debug("send plan touch queue events"); this.authorizationService.authorizeForce(Permission.ManageQueueEvents); - this.maintenanceService.sendDmpTouchEvents(); + this.maintenanceService.sendPlanTouchEvents(); this.auditService.track(AuditableAction.Maintenance_SendPlanTouchEvents); } @RequestMapping(method = RequestMethod.POST, value = "/events/descriptions/touch") public void sendDescriptionTouchEvents() throws InvalidApplicationException { - logger.debug("send dmp touch queue events"); + logger.debug("send description touch queue events"); this.authorizationService.authorizeForce(Permission.ManageQueueEvents); this.maintenanceService.sendDescriptionTouchEvents(); 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 e182809c7..bd83e4e7d 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/PlanController.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/PlanController.java @@ -116,7 +116,6 @@ public class PlanController { 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); this.auditService.track(AuditableAction.Plan_PublicQuery, "lookup", lookup); @@ -508,7 +507,7 @@ 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" + Plan.class.getSimpleName()).And("transformerId", repositoryId).And("fileId", fileId)); + logger.debug(new MapLogEntry("preprocessing plan" + Plan.class.getSimpleName()).And("transformerId", repositoryId).And("fileId", fileId)); PreprocessingDmpModel model = this.planService.preprocessingPlan(fileId, repositoryId); 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 720752ad9..51e8fc52f 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/UserController.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/UserController.java @@ -108,7 +108,7 @@ public class UserController { } @PostMapping("plan-associated/query") - public QueryResult queryDmpAssociated(@RequestBody UserLookup lookup) throws MyApplicationException, MyForbiddenException { + public QueryResult queryPlanAssociated(@RequestBody UserLookup lookup) throws MyApplicationException, MyForbiddenException { logger.debug("querying {}", User.class.getSimpleName()); this.censorFactory.censor(PlanAssociatedUserCensor.class).censor(lookup.getProject(), null); 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 2e5f89c96..bc9d733bb 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 @@ -133,7 +133,7 @@ public class PublicDatasetsDescriptionDocumentation { throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Description.class.getSimpleName()}, LocaleContextHolder.getLocale())); PlanQuery planQuery = this.queryFactory.query(PlanQuery.class).disableTracking().ids(model.getPlan().getId()).isActive(IsActive.Active); - PlanLookup planLookup = getDmpLookup(); + PlanLookup planLookup = getPlanLookup(); 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()); @@ -208,7 +208,7 @@ public class PublicDatasetsDescriptionDocumentation { } @NotNull - private static PlanLookup getDmpLookup() { + private static PlanLookup getPlanLookup() { BaseFieldSet fieldSet = new BaseFieldSet(); Set fields = Set.of( Plan._id, diff --git a/backend/web/src/main/resources/config/elasticsearch.yml b/backend/web/src/main/resources/config/elasticsearch.yml index 381bb6629..3b40af350 100644 --- a/backend/web/src/main/resources/config/elasticsearch.yml +++ b/backend/web/src/main/resources/config/elasticsearch.yml @@ -15,7 +15,7 @@ elastic: disableHostnameVerifier: false app-elastic: enabled: ${ELASTIC_ENABLED} - dmpIndexName: ${ELASTIC_DMP_INDEX} + planIndexName: ${ELASTIC_DMP_INDEX} descriptionIndexName: ${ELASTIC_DESCRIPTION_INDEX} enableIcuAnalysisPlugin: false resetBatchSize: 1000 diff --git a/backend/web/src/main/resources/config/errors.yml b/backend/web/src/main/resources/config/errors.yml index c26f12d4c..8b2171f00 100644 --- a/backend/web/src/main/resources/config/errors.yml +++ b/backend/web/src/main/resources/config/errors.yml @@ -35,37 +35,37 @@ error-thesaurus: multiple-description-template-versions-not-supported: code: 115 message: multiple versions of the selected description where found - dmp-new-version-conflict: + plan-new-version-conflict: code: 116 message: version to update not the latest - dmp-is-not-finalized: + plan-is-not-finalized: code: 117 - message: the selected dmp is not finalized - multiple-dmp-versions-not-supported: + message: the selected plan is not finalized + multiple-plan-versions-not-supported: code: 118 - message: multiple versions of the dmp where found - dmp-is-finalized: + message: multiple versions of the plan where found + plan-is-finalized: code: 119 - message: To perform this action you will need to revert DMP's finalisation - dmp-can-not-change: + message: To perform this action you will need to revert Plan's finalisation + plan-can-not-change: code: 120 - message: dmp can not change - dmp-description-template-can-not-change: + message: plan can not change + plan-description-template-can-not-change: code: 121 - message: dmp description template can not change + message: plan description template can not change invalid-description-template: code: 122 message: invalid description template id description-is-finalized: code: 123 message: To perform this action you will need to revert description finalisation - dmp-blueprint-has-no-description-templates: + plan-blueprint-has-no-description-templates: code: 124 message: You need to select Has Description Templates field to at least one Section. - dmp-blueprint-new-version-conflict: + plan-blueprint-new-version-conflict: code: 125 message: version to update not the latest - dmp-description-template-can-not-remove: + plan-description-template-can-not-remove: code: 126 message: Can not remove description template that is already in use. tenant-tampering: @@ -80,31 +80,31 @@ error-thesaurus: tenant-code-exists: code: 130 message: Tenant code exists - dmp-new-version-already-created-draft: + plan-new-version-already-created-draft: code: 131 - message: Already created draft for this dmp + message: Already created draft for this plan description-template-inactive-user: code: 132 message: user dont exist description-template-missing-user-contact-info: code: 133 message: missing contact info for this user - dmp-inactive-user: + plan-inactive-user: code: 134 message: user dont exist - dmp-missing-user-contact-info: + plan-missing-user-contact-info: code: 135 message: missing contact info for this user - import-description-without-dmp-description-template: + import-description-without-plan-description-template: code: 136 - message: Error creating description without dmp description template - duplicate-dmp-user: + message: Error creating description without plan description template + duplicate-plan-user: code: 137 - message: Duplicate Dmp User not allowed + message: Duplicate Plan User not allowed descriptionTemplateNewVersionAlreadyCreatedDraft: code: 138 message: Already created draft for this description template - dmpBlueprintNewVersionAlreadyCreatedDraft: + planBlueprintNewVersionAlreadyCreatedDraft: code: 139 message: Already created draft for this blueprint referenceTypeCodeExists: diff --git a/backend/web/src/main/resources/config/notification-devel.yml b/backend/web/src/main/resources/config/notification-devel.yml index 1c8bab032..1a699b3f1 100644 --- a/backend/web/src/main/resources/config/notification-devel.yml +++ b/backend/web/src/main/resources/config/notification-devel.yml @@ -1,8 +1,8 @@ notification: - dmpInvitationExternalUserType: 065DEECD-21BB-44AF-9983-E660FDF24BC4 - dmpInvitationExistingUserType: 4904dea2-5079-46d3-83be-3a19c9ab45dc - dmpModifiedType: 4542262A-22F8-4BAA-9DB6-1C8E70AC1DBB - dmpFinalisedType: 90DB0B46-42DE-BD89-AEBF-6F27EFEB256E + planInvitationExternalUserType: 065DEECD-21BB-44AF-9983-E660FDF24BC4 + planInvitationExistingUserType: 4904dea2-5079-46d3-83be-3a19c9ab45dc + planModifiedType: 4542262A-22F8-4BAA-9DB6-1C8E70AC1DBB + planFinalisedType: 90DB0B46-42DE-BD89-AEBF-6F27EFEB256E descriptionCreatedType: 8965b1d5-99a6-4acf-9016-c0d0ce341364 descriptionModifiedType: 4FDBFA80-7A71-4A69-B854-67CBB70648F1 descriptionFinalisedType: 33790bad-94d4-488a-8ee2-7f6295ca18ea @@ -10,7 +10,7 @@ notification: descriptionAnnotationStatusChanged: 3189e3a6-91e6-40c6-8ff8-275a68445aec mergeAccountConfirmationType: BFE68845-CB05-4C5A-A03D-29161A7C9660 removeCredentialConfirmationType: C9BC3F16-057E-4BBA-8A5F-36BD835E5604 - dmpDepositType: 55736F7A-83AB-4190-AF43-9D031A6F9612 + planDepositType: 55736F7A-83AB-4190-AF43-9D031A6F9612 descriptionTemplateInvitationType: 223BB607-EFA1-4CE7-99EC-4BEABFEF9A8B contactSupportType: 5B1D6C52-88F9-418B-9B8A-6F1F963D9EAD publicContactSupportType: B542B606-ACC6-4629-ADEF-4D8EE2F01222 diff --git a/backend/web/src/main/resources/config/permissions.yml b/backend/web/src/main/resources/config/permissions.yml index f5926df64..7e8f20694 100644 --- a/backend/web/src/main/resources/config/permissions.yml +++ b/backend/web/src/main/resources/config/permissions.yml @@ -29,17 +29,17 @@ permissions: clients: [ ] allowAnonymous: true allowAuthenticated: true - PublicBrowseDmp: + PublicBrowsePlan: roles: [ ] clients: [ ] allowAnonymous: true allowAuthenticated: true - PublicBrowseDmpReference: + PublicBrowsePlanReference: roles: [ ] clients: [ ] allowAnonymous: true allowAuthenticated: true - PublicBrowseDmpUser: + PublicBrowsePlanUser: roles: [ ] clients: [ ] allowAnonymous: true @@ -215,7 +215,7 @@ permissions: roles: - Admin - TenantAdmin - dmp: + plan: roles: - Owner - DescriptionContributor @@ -226,7 +226,7 @@ permissions: roles: - Admin - TenantAdmin - dmp: + plan: roles: - Owner - DescriptionContributor @@ -237,7 +237,7 @@ permissions: roles: - Admin - TenantAdmin - dmp: + plan: roles: - Owner - DescriptionContributor @@ -249,7 +249,7 @@ permissions: roles: - Admin - TenantAdmin - dmp: + plan: roles: - Owner - DescriptionContributor @@ -337,7 +337,7 @@ permissions: roles: - Admin - TenantAdmin - dmp: + plan: roles: - Owner - Viewer @@ -480,7 +480,7 @@ permissions: roles: - Admin - TenantAdmin - dmp: + plan: roles: - Owner - Viewer @@ -493,7 +493,7 @@ permissions: roles: - Admin - TenantAdmin - dmp: + plan: roles: - Owner clients: [ ] @@ -514,7 +514,7 @@ permissions: roles: - Admin - TenantAdmin - dmp: + plan: roles: - Owner claims: [ ] @@ -525,7 +525,7 @@ permissions: roles: - Admin - TenantAdmin - dmp: + plan: roles: - Owner claims: [ ] @@ -536,7 +536,7 @@ permissions: roles: - Admin - TenantAdmin - dmp: + plan: roles: - Owner claims: [ ] @@ -553,7 +553,7 @@ permissions: roles: - Admin - TenantAdmin - dmp: + plan: roles: - Owner claims: [ ] @@ -564,7 +564,7 @@ permissions: roles: - Admin - TenantAdmin - dmp: + plan: roles: - Owner claims: [ ] @@ -575,7 +575,7 @@ permissions: roles: - Admin - TenantAdmin - dmp: + plan: roles: - Owner claims: [ ] @@ -586,7 +586,7 @@ permissions: roles: - Admin - TenantAdmin - dmp: + plan: roles: - Owner claims: [ ] @@ -597,7 +597,7 @@ permissions: roles: - Admin - TenantAdmin - dmp: + plan: roles: - Owner claims: [ ] @@ -974,7 +974,7 @@ permissions: roles: - Admin - TenantAdmin - dmp: + plan: roles: - Owner - Viewer @@ -991,7 +991,7 @@ permissions: roles: - Admin - TenantAdmin - dmp: + plan: roles: - Owner - Viewer @@ -1200,7 +1200,7 @@ permissions: clients: [ ] allowAnonymous: true allowAuthenticated: true - ViewPublicDmpPage: + ViewPublicPlanPage: roles: [ ] clients: [ ] allowAnonymous: true diff --git a/backend/web/src/main/resources/config/queue.yml b/backend/web/src/main/resources/config/queue.yml index bc1135fab..89061bb60 100644 --- a/backend/web/src/main/resources/config/queue.yml +++ b/backend/web/src/main/resources/config/queue.yml @@ -39,7 +39,7 @@ queue: tenant-user-invite-topic: tenant.invite user-touch-topic: user.touch user-removal-topic: user.remove - dmp-touch-topic: dmp.touch + plan-touch-topic: plan.touch description-touch-topic: description.touch annotation-entities-touch-topic: annotation.entities.touch annotation-entities-removal-topic: annotation.entities.remove diff --git a/backend/web/src/main/resources/messages.properties b/backend/web/src/main/resources/messages.properties index 9c04fd2b4..616e424e7 100644 --- a/backend/web/src/main/resources/messages.properties +++ b/backend/web/src/main/resources/messages.properties @@ -26,7 +26,7 @@ Validation.LessThenEqual= value {0} must be equal or less than {1} Validation.LargerThenEqual= value {0} must be equal or larger than {1} Validation.MissingFields= missing fields: {0} Validation.InvalidDescriptionTemplateMultiplicity= {0} can not be used -Validation.InvalidDescriptionTemplateMultiplicityOnDMP= Description Templates has multiplicity errors +Validation.InvalidDescriptionTemplateMultiplicityOnPlan= Description Templates has multiplicity errors Validation_UrlRequired={0} is not valid url DefaultTenant_Name=Default \ No newline at end of file diff --git a/dmp-frontend/src/app/core/common/enum/description-template-field-type.ts b/dmp-frontend/src/app/core/common/enum/description-template-field-type.ts index 425765a64..75fff4cb7 100644 --- a/dmp-frontend/src/app/core/common/enum/description-template-field-type.ts +++ b/dmp-frontend/src/app/core/common/enum/description-template-field-type.ts @@ -2,7 +2,7 @@ export enum DescriptionTemplateFieldType { SELECT = "select", BOOLEAN_DECISION = "booleanDecision", RADIO_BOX = "radiobox", - INTERNAL_ENTRIES_DMPS = "internalEntitiesDmps", + INTERNAL_ENTRIES_PLANS = "internalEntitiesPlans", INTERNAL_ENTRIES_DESCRIPTIONS = "internalEntitiesDescriptions", CHECK_BOX = "checkBox", FREE_TEXT = "freetext", diff --git a/dmp-frontend/src/app/core/common/enum/entity-type.ts b/dmp-frontend/src/app/core/common/enum/entity-type.ts index 536bb62c5..ac01bc65f 100644 --- a/dmp-frontend/src/app/core/common/enum/entity-type.ts +++ b/dmp-frontend/src/app/core/common/enum/entity-type.ts @@ -1,3 +1,3 @@ export enum EntityType { - DMP = 0, + Plan = 0, } \ No newline at end of file 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 957dccc33..6470a7517 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,5 +1,5 @@ export enum LockTargetType { - Dmp = 0, + Plan = 0, Description = 1, PlanBlueprint = 2, DescriptionTemplate= 3 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 d252dc06e..db0040c1b 100644 --- a/dmp-frontend/src/app/core/common/enum/permission.enum.ts +++ b/dmp-frontend/src/app/core/common/enum/permission.enum.ts @@ -218,7 +218,7 @@ export enum AppPermission { ViewDescriptionTemplatePage = "ViewDescriptionTemplatePage", ViewPlanBlueprintPage = "ViewPlanBlueprintPage", ViewPublicDescriptionPage = "ViewPublicDescriptionPage", - ViewPublicDmpPage = "ViewPublicDmpPage", + ViewPublicPlanPage = "ViewPublicPlanPage", ViewMyDescriptionPage = "ViewMyDescriptionPage", ViewMyPlanPage = "ViewMyPlanPage", ViewHomePage = "ViewHomePage", diff --git a/dmp-frontend/src/app/core/common/enum/recent-activity-item-type.ts b/dmp-frontend/src/app/core/common/enum/recent-activity-item-type.ts index c999a8e12..d857685cd 100644 --- a/dmp-frontend/src/app/core/common/enum/recent-activity-item-type.ts +++ b/dmp-frontend/src/app/core/common/enum/recent-activity-item-type.ts @@ -1,4 +1,4 @@ export enum RecentActivityItemType { - Dmp = 0, + Plan = 0, Description = 1 } \ No newline at end of file diff --git a/dmp-frontend/src/app/core/model/dashboard/dashboard-statistics.ts b/dmp-frontend/src/app/core/model/dashboard/dashboard-statistics.ts index b5d3bad4d..7f935bf0a 100644 --- a/dmp-frontend/src/app/core/model/dashboard/dashboard-statistics.ts +++ b/dmp-frontend/src/app/core/model/dashboard/dashboard-statistics.ts @@ -1,7 +1,7 @@ import { PublicReferenceType } from "../plan/plan"; export interface DashboardStatistics { - dmpCount: number; + planCount: number; descriptionCount: number; referenceTypeStatistics: DashboardReferenceTypeStatistics[]; } 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 8df9e7f7b..bfd0ae12a 100644 --- a/dmp-frontend/src/app/core/pipes/field-value.pipe.ts +++ b/dmp-frontend/src/app/core/pipes/field-value.pipe.ts @@ -74,7 +74,7 @@ export class FieldValuePipe implements PipeTransform { } break; } - case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DMPS: { + case DescriptionTemplateFieldType.INTERNAL_ENTRIES_PLANS: { const data = field.data; if (!data?.multipleSelect && controlValue.textValue && controlValue.textValue.length > 0) { return this.planService.query(this.planService.buildAutocompleteLookup(null, null, [Guid.parse(controlValue.textValue)])).pipe(map(x => x.items?.map(y => y.label).join(','))); diff --git a/dmp-frontend/src/app/core/query/recent-activity-item-lookup.lookup.ts b/dmp-frontend/src/app/core/query/recent-activity-item-lookup.lookup.ts index c232fc147..8769a7375 100644 --- a/dmp-frontend/src/app/core/query/recent-activity-item-lookup.lookup.ts +++ b/dmp-frontend/src/app/core/query/recent-activity-item-lookup.lookup.ts @@ -4,7 +4,7 @@ import { RecentActivityOrder } from "../common/enum/recent-activity-order"; export class RecentActivityItemLookup implements RecentActivityItemFilter { like: string; onlyDraft: boolean; - onlyDmp: boolean; + onlyPlan: boolean; onlyDescription: boolean; userIds: string; page: Lookup.Paging; @@ -19,7 +19,7 @@ export class RecentActivityItemLookup implements RecentActivityItemFilter { export interface RecentActivityItemFilter { like: string; onlyDraft: boolean; - onlyDmp: boolean; + onlyPlan: boolean; onlyDescription: boolean; userIds: string; page: Lookup.Paging; 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 13e35e3da..0c6f1a3c6 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,9 +25,9 @@ export class FileTransformerHttpService extends BaseService { return this.http.get(url).pipe(catchError((error: any) => throwError(error))); } - exportDmp(planId: Guid, repositoryId: string, format: string): Observable { + exportPlan(planId: Guid, repositoryId: string, format: string): Observable { //TODO: implement - const url = `${this.apiBase}/export-dmp`; + const url = `${this.apiBase}/export-plan`; return this.http.post(url, {id: planId, repositoryId: repositoryId, format: format}, {responseType: 'blob', observe: 'response'}).pipe(catchError((error: any) => throwError(error))); } 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 d37590943..7748bc475 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 @@ -67,7 +67,7 @@ export class FileTransformerService extends BaseService { }); } - exportDmp(id: Guid, repositoryId: string, format: string) { + exportPlan(id: Guid, repositoryId: string, format: string) { this._loading = true; if (repositoryId == this.xmlExportRepo.repositoryId) { this.planService.downloadXML(id) @@ -79,7 +79,7 @@ export class FileTransformerService extends BaseService { }, error => this.httpErrorHandlingService.handleBackedRequestError(error)); } else { - this.fileTransformerHttpService.exportDmp(id, repositoryId, format).pipe(takeUntil(this._destroyed), catchError((error) => { + this.fileTransformerHttpService.exportPlan(id, repositoryId, format).pipe(takeUntil(this._destroyed), catchError((error) => { this._loading = false; return null; })) diff --git a/dmp-frontend/src/app/core/services/maintenance/maintenance.service.ts b/dmp-frontend/src/app/core/services/maintenance/maintenance.service.ts index d6d98c3f0..92a2c28eb 100644 --- a/dmp-frontend/src/app/core/services/maintenance/maintenance.service.ts +++ b/dmp-frontend/src/app/core/services/maintenance/maintenance.service.ts @@ -43,8 +43,8 @@ export class MaintenanceService extends BaseService { catchError((error: any) => throwError(error))); } - sendDmpTouchEvents(): Observable { - const url = `${this.apiBase}/events/dmps/touch`; + sendPlanTouchEvents(): Observable { + const url = `${this.apiBase}/events/plans/touch`; return this.http .post(url, null).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 97e5ece4d..91ef4ada0 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 @@ -146,7 +146,7 @@ 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-PLAN-ENTITIES-PLANS'); + case DescriptionTemplateFieldType.INTERNAL_ENTRIES_PLANS: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.INTERNAL-PLAN-ENTITIES-PLANS'); 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'); @@ -296,7 +296,7 @@ export class EnumUtils { public toLockTargetTypeString(status: LockTargetType): string { switch (status) { - case LockTargetType.Dmp: return this.language.instant('TYPES.LOCK-TARGET-TYPE.PLAN'); + case LockTargetType.Plan: return this.language.instant('TYPES.LOCK-TARGET-TYPE.PLAN'); case LockTargetType.Description: return this.language.instant('TYPES.LOCK-TARGET-TYPE.DESCRIPTION'); 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/components/field-set/description-template-editor-field-set.component.html b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-set/description-template-editor-field-set.component.html index abec71bb4..056258b70 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-set/description-template-editor-field-set.component.html +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-set/description-template-editor-field-set.component.html @@ -224,9 +224,9 @@ {{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.INTERNAL-ENTITIES' | translate}} - - + diff --git a/dmp-frontend/src/app/ui/admin/maintenance-tasks/maintenance-tasks.component.ts b/dmp-frontend/src/app/ui/admin/maintenance-tasks/maintenance-tasks.component.ts index 807a90646..48bc49c94 100644 --- a/dmp-frontend/src/app/ui/admin/maintenance-tasks/maintenance-tasks.component.ts +++ b/dmp-frontend/src/app/ui/admin/maintenance-tasks/maintenance-tasks.component.ts @@ -155,7 +155,7 @@ export class MaintenanceTasksComponent extends BaseComponent implements OnInit { ); } - sendDmpTouchEvents(ev: Event) { + sendPlanTouchEvents(ev: Event) { this.dialog.open(ConfirmationDialogComponent, { data: { message: this.language.instant('MAINTENANCE-TASKS.CONFIRMATION.MESSAGE'), @@ -174,7 +174,7 @@ export class MaintenanceTasksComponent extends BaseComponent implements OnInit { private doSendDmpTouchEvents(ev: Event) { (ev.target as HTMLButtonElement).disabled = true; - this.maintenanceService.sendDmpTouchEvents().pipe(takeUntil(this._destroyed)).subscribe( + this.maintenanceService.sendPlanTouchEvents().pipe(takeUntil(this._destroyed)).subscribe( _ => { (ev.target as HTMLButtonElement).disabled = false; this.onCallbackSuccess(); diff --git a/dmp-frontend/src/app/ui/dashboard/dashboard.component.html b/dmp-frontend/src/app/ui/dashboard/dashboard.component.html index fb337cd29..af18077c4 100644 --- a/dmp-frontend/src/app/ui/dashboard/dashboard.component.html +++ b/dmp-frontend/src/app/ui/dashboard/dashboard.component.html @@ -107,8 +107,8 @@
{{'DASHBOARD.PERSONAL-USAGE' | translate}}
-
- {{dashboardStatistics?.dmpCount}} +
+ {{dashboardStatistics?.planCount}}
{{'DASHBOARD.PLANS' | translate}}
@@ -189,7 +189,7 @@
{{'DASHBOARD.PUBLIC-USAGE' | translate}}
-
{{dashboardStatistics?.dmpCount}}
+
{{dashboardStatistics?.planCount}}
{{'DASHBOARD.PUBLIC-PLANS' | translate}}
diff --git a/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts b/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts index e6def2279..bd49dd73e 100644 --- a/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts @@ -82,7 +82,7 @@ export class DashboardComponent extends BaseComponent implements OnInit { this.grantCount = this.dashboardStatistics.referenceTypeStatistics.filter(x => x.referenceType.id == this.referenceTypeService.getGrantReferenceType())?.find(Boolean).count; this.organizationCount = this.dashboardStatistics.referenceTypeStatistics.filter(x => x.referenceType.id == this.referenceTypeService.getOrganizationReferenceType())?.find(Boolean).count; - if (this.dashboardStatistics && this.dashboardStatistics.dmpCount === 0) { + if (this.dashboardStatistics && this.dashboardStatistics.planCount === 0) { this.openDashboardTour(); } }); @@ -128,7 +128,7 @@ export class DashboardComponent extends BaseComponent implements OnInit { public hasDmps(): boolean { if (this.dashboardStatistics) { - return this.dashboardStatistics.dmpCount !== 0 + return this.dashboardStatistics.planCount !== 0 || this.dashboardStatistics.descriptionCount !== 0 || this.dashboardStatistics.referenceTypeStatistics.length !== 0 } else { 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 d48778f1f..143c5cc9c 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 @@ -50,7 +50,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn @Output() addNewDescription: BehaviorSubject = new BehaviorSubject(false); - get onlyDmps(): boolean { + get onlyPlans(): boolean { return this.includeDmps && !this.includeDescriptions; } @@ -160,7 +160,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn refresh(): void { this.lookup.onlyDraft = this.onlyDrafts ? this.onlyDrafts : null; - this.lookup.onlyDmp = this.onlyDmps ? this.onlyDmps : null; + this.lookup.onlyPlan = this.onlyPlans ? this.onlyPlans : null; this.lookup.onlyDescription = this.onlyDescriptions ? this.onlyDescriptions : null; this.lookup.orderField = this.formGroup.get('order').value ?? this.order.UpdatedAt; this.lookup.like = this.formGroup.get('like').value; 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 c4a27cf05..802e3118a 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 @@ -104,7 +104,7 @@ export class DescriptionEditorModel extends BaseEditorModel implements Descripti case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS: if (multipleSelect) return 'textListValue'; else return 'textValue'; - case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DMPS: + case DescriptionTemplateFieldType.INTERNAL_ENTRIES_PLANS: if (multipleSelect) return 'textListValue'; else return 'textValue'; case DescriptionTemplateFieldType.REFERENCE_TYPES: @@ -570,7 +570,7 @@ export class DescriptionFieldEditorModel implements DescriptionFieldPersist { case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS: if (multipleSelect) formGroup.addControl(fieldValueControlName, new FormControl({ value: this.textListValue, disabled: disabled }, context.getValidation(fieldValueControlName).validators)); else formGroup.addControl(fieldValueControlName, new FormControl({ value: this.textValue, disabled: disabled }, context.getValidation(fieldValueControlName).validators)); - case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DMPS: + case DescriptionTemplateFieldType.INTERNAL_ENTRIES_PLANS: if (multipleSelect) formGroup.addControl(fieldValueControlName, new FormControl({ value: this.textListValue, disabled: disabled }, context.getValidation(fieldValueControlName).validators)); else formGroup.addControl(fieldValueControlName, new FormControl({ value: this.textValue, disabled: disabled }, context.getValidation(fieldValueControlName).validators)); case DescriptionTemplateFieldType.REFERENCE_TYPES: 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 a04a4ada8..1a5de3cf4 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 @@ -76,7 +76,7 @@ -
+
diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/visibility-rules/visibility-rules.service.ts b/dmp-frontend/src/app/ui/description/editor/description-form/visibility-rules/visibility-rules.service.ts index 7ff90880c..a7283456d 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/visibility-rules/visibility-rules.service.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-form/visibility-rules/visibility-rules.service.ts @@ -357,7 +357,7 @@ export class VisibilityRulesService { else if ([DescriptionTemplateFieldType.SELECT].includes(fieldType) && field.textListValue != null && field.textListValue.length > 0) { return field.textListValue.includes(rule.textValue); } - else if ([DescriptionTemplateFieldType.REFERENCE_TYPES, DescriptionTemplateFieldType.UPLOAD, DescriptionTemplateFieldType.TAGS, DescriptionTemplateFieldType.INTERNAL_ENTRIES_DMPS, + else if ([DescriptionTemplateFieldType.REFERENCE_TYPES, DescriptionTemplateFieldType.UPLOAD, DescriptionTemplateFieldType.TAGS, DescriptionTemplateFieldType.INTERNAL_ENTRIES_PLANS, DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS, DescriptionTemplateFieldType.VALIDATION, DescriptionTemplateFieldType.DATASET_IDENTIFIER].includes(fieldType)) { return false; //not implemented visibility logic } 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 aec1d93f0..ad2f578d3 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 @@ -38,7 +38,7 @@ more_horiz
- 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 4b041ce2b..a6539f044 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 @@ -229,7 +229,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 6b858e357..4f64bacd7 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 @@ -17,7 +17,7 @@ expand_more - 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 3ef13d42c..1394ca79c 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 @@ -247,7 +247,7 @@ export class PlanEditorComponent extends BaseEditor imple } if (this.item && this.item.id != null) { - this.checkLock(this.item.id, LockTargetType.Dmp, 'PLAN-EDITOR.LOCKED-DIALOG.TITLE', 'PLAN-EDITOR.LOCKED-DIALOG.MESSAGE'); + this.checkLock(this.item.id, LockTargetType.Plan, 'PLAN-EDITOR.LOCKED-DIALOG.TITLE', 'PLAN-EDITOR.LOCKED-DIALOG.MESSAGE'); } } catch (error) { this.logger.error('Could not parse Dmp item: ' + data + error); diff --git a/dmp-frontend/src/app/ui/sidebar/sidebar.component.ts b/dmp-frontend/src/app/ui/sidebar/sidebar.component.ts index e5d4cd859..97a15cdb6 100644 --- a/dmp-frontend/src/app/ui/sidebar/sidebar.component.ts +++ b/dmp-frontend/src/app/ui/sidebar/sidebar.component.ts @@ -95,7 +95,7 @@ export class SidebarComponent implements OnInit { routes: [], } - if (this.authentication.hasPermission(AppPermission.ViewPublicDmpPage)) this.descriptionItems.routes.push({ path: '/explore-plans', title: 'SIDE-BAR.PUBLIC-PLANS', icon: 'library_books', routeType: RouteType.System }); + if (this.authentication.hasPermission(AppPermission.ViewPublicPlanPage)) this.descriptionItems.routes.push({ path: '/explore-plans', title: 'SIDE-BAR.PUBLIC-PLANS', icon: 'library_books', routeType: RouteType.System }); if (this.authentication.hasPermission(AppPermission.ViewPublicDescriptionPage)) this.descriptionItems.routes.push({ path: '/explore-descriptions', title: 'SIDE-BAR.PUBLIC-DESC', icon: 'dns', routeType: RouteType.System }); this.groupMenuItems.push(this.descriptionItems);