remove descriptionTemplateNewVersion users required validator and default user logic
This commit is contained in:
parent
a591c66875
commit
3c72b741c5
|
@ -182,9 +182,6 @@ public class NewVersionDescriptionTemplatePersist {
|
||||||
.on(NewVersionDescriptionTemplatePersist._definition)
|
.on(NewVersionDescriptionTemplatePersist._definition)
|
||||||
.over(item.getDefinition())
|
.over(item.getDefinition())
|
||||||
.using(() -> this.validatorFactory.validator(DefinitionPersist.DefinitionPersistValidator.class)),
|
.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()
|
this.navSpec()
|
||||||
.iff(() -> !this.isListNullOrEmpty(item.getUsers()))
|
.iff(() -> !this.isListNullOrEmpty(item.getUsers()))
|
||||||
.on(NewVersionDescriptionTemplatePersist._users)
|
.on(NewVersionDescriptionTemplatePersist._users)
|
||||||
|
|
|
@ -188,8 +188,6 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
||||||
this.entityManager.persist(data);
|
this.entityManager.persist(data);
|
||||||
|
|
||||||
this.persistUsers(data.getId(), model.getUsers());
|
this.persistUsers(data.getId(), model.getUsers());
|
||||||
if (this.conventionService.isListNullOrEmpty(model.getUsers()))
|
|
||||||
this.addOwner(data);
|
|
||||||
|
|
||||||
this.entityManager.flush();
|
this.entityManager.flush();
|
||||||
|
|
||||||
|
@ -284,18 +282,6 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
||||||
this.eventHandler.handle(event);
|
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 {
|
private @NotNull DefinitionEntity buildDefinitionEntity(DefinitionPersist persist) throws InvalidApplicationException {
|
||||||
DefinitionEntity data = new DefinitionEntity();
|
DefinitionEntity data = new DefinitionEntity();
|
||||||
if (persist == null)
|
if (persist == null)
|
||||||
|
|
Loading…
Reference in New Issue