fix setting id to entity
This commit is contained in:
parent
3b5ac3385c
commit
113b794f16
3 changed files with 12 additions and 6 deletions
|
@ -216,7 +216,10 @@ public class AdminGroupAction extends FessAdminAction {
|
|||
switch (form.crudMode) {
|
||||
case CrudMode.CREATE:
|
||||
if (form instanceof CreateForm) {
|
||||
return OptionalEntity.of(new Group());
|
||||
return OptionalEntity.of(new Group()).map(entity -> {
|
||||
entity.setId(Base64.getEncoder().encodeToString(form.name.getBytes(Constants.CHARSET_UTF_8)));
|
||||
return entity;
|
||||
});
|
||||
}
|
||||
break;
|
||||
case CrudMode.EDIT:
|
||||
|
@ -233,7 +236,6 @@ public class AdminGroupAction extends FessAdminAction {
|
|||
protected OptionalEntity<Group> createGroup(final CreateForm form) {
|
||||
return getEntity(form).map(entity -> {
|
||||
copyBeanToBean(form, entity, op -> op.exclude(Constants.COMMON_CONVERSION_RULE));
|
||||
entity.setId(Base64.getEncoder().encodeToString(entity.getName().getBytes(Constants.CHARSET_UTF_8)));
|
||||
return entity;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -216,7 +216,10 @@ public class AdminRoleAction extends FessAdminAction {
|
|||
switch (form.crudMode) {
|
||||
case CrudMode.CREATE:
|
||||
if (form instanceof CreateForm) {
|
||||
return OptionalEntity.of(new Role());
|
||||
return OptionalEntity.of(new Role()).map(entity -> {
|
||||
entity.setId(Base64.getEncoder().encodeToString(form.name.getBytes(Constants.CHARSET_UTF_8)));
|
||||
return entity;
|
||||
});
|
||||
}
|
||||
break;
|
||||
case CrudMode.EDIT:
|
||||
|
@ -233,7 +236,6 @@ public class AdminRoleAction extends FessAdminAction {
|
|||
protected OptionalEntity<Role> createRole(final CreateForm form) {
|
||||
return getEntity(form).map(entity -> {
|
||||
copyBeanToBean(form, entity, op -> op.exclude(Constants.COMMON_CONVERSION_RULE));
|
||||
entity.setId(Base64.getEncoder().encodeToString(entity.getName().getBytes(Constants.CHARSET_UTF_8)));
|
||||
return entity;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -252,7 +252,10 @@ public class AdminUserAction extends FessAdminAction {
|
|||
switch (form.crudMode) {
|
||||
case CrudMode.CREATE:
|
||||
if (form instanceof CreateForm) {
|
||||
return OptionalEntity.of(new User());
|
||||
return OptionalEntity.of(new User()).map(entity -> {
|
||||
entity.setId(Base64.getEncoder().encodeToString(form.name.getBytes(Constants.CHARSET_UTF_8)));
|
||||
return entity;
|
||||
});
|
||||
}
|
||||
break;
|
||||
case CrudMode.EDIT:
|
||||
|
@ -272,7 +275,6 @@ public class AdminUserAction extends FessAdminAction {
|
|||
sessionManager.getAttribute(TEMPORARY_PASSWORD, String.class).ifPresent(password -> {
|
||||
entity.setPassword(password);
|
||||
});
|
||||
entity.setId(Base64.getEncoder().encodeToString(entity.getName().getBytes(Constants.CHARSET_UTF_8)));
|
||||
return entity;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue