From 3c72b741c57227d29bf50907951138d2eac8fb25 Mon Sep 17 00:00:00 2001 From: amentis Date: Wed, 1 May 2024 13:53:22 +0300 Subject: [PATCH] remove descriptionTemplateNewVersion users required validator and default user logic --- .../NewVersionDescriptionTemplatePersist.java | 3 --- .../DescriptionTemplateServiceImpl.java | 14 -------------- 2 files changed, 17 deletions(-) diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/NewVersionDescriptionTemplatePersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/NewVersionDescriptionTemplatePersist.java index 6a57738bc..2b492c132 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/NewVersionDescriptionTemplatePersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/NewVersionDescriptionTemplatePersist.java @@ -182,9 +182,6 @@ public class NewVersionDescriptionTemplatePersist { .on(NewVersionDescriptionTemplatePersist._definition) .over(item.getDefinition()) .using(() -> this.validatorFactory.validator(DefinitionPersist.DefinitionPersistValidator.class)), - this.spec() - .must(() -> !this.isListNullOrEmpty(item.getUsers())) - .failOn(NewVersionDescriptionTemplatePersist._users).failWith(messageSource.getMessage("Validation_Required", new Object[]{NewVersionDescriptionTemplatePersist._users}, LocaleContextHolder.getLocale())), this.navSpec() .iff(() -> !this.isListNullOrEmpty(item.getUsers())) .on(NewVersionDescriptionTemplatePersist._users) 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 214a80dd8..b09fbeb73 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 @@ -188,8 +188,6 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic this.entityManager.persist(data); this.persistUsers(data.getId(), model.getUsers()); - if (this.conventionService.isListNullOrEmpty(model.getUsers())) - this.addOwner(data); this.entityManager.flush(); @@ -284,18 +282,6 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic this.eventHandler.handle(event); } - private void addOwner(DescriptionTemplateEntity descriptionTemplateEntity) throws InvalidApplicationException { - UserDescriptionTemplateEntity data = new UserDescriptionTemplateEntity(); - data.setId(UUID.randomUUID()); - data.setIsActive(IsActive.Active); - data.setCreatedAt(Instant.now()); - data.setUpdatedAt(Instant.now()); - data.setRole(UserDescriptionTemplateRole.Owner); - data.setUserId(this.userScope.getUserId()); - data.setDescriptionTemplateId(descriptionTemplateEntity.getId()); - this.entityManager.persist(data); - } - private @NotNull DefinitionEntity buildDefinitionEntity(DefinitionPersist persist) throws InvalidApplicationException { DefinitionEntity data = new DefinitionEntity(); if (persist == null)