Skip to content
Snippets Groups Projects
Commit 113b794f authored by Kaoru FUZITA's avatar Kaoru FUZITA
Browse files

fix setting id to entity

parent 3b5ac338
Branches
Tags
No related merge requests found
...@@ -216,7 +216,10 @@ public class AdminGroupAction extends FessAdminAction { ...@@ -216,7 +216,10 @@ public class AdminGroupAction extends FessAdminAction {
switch (form.crudMode) { switch (form.crudMode) {
case CrudMode.CREATE: case CrudMode.CREATE:
if (form instanceof CreateForm) { 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; break;
case CrudMode.EDIT: case CrudMode.EDIT:
...@@ -233,7 +236,6 @@ public class AdminGroupAction extends FessAdminAction { ...@@ -233,7 +236,6 @@ public class AdminGroupAction extends FessAdminAction {
protected OptionalEntity<Group> createGroup(final CreateForm form) { protected OptionalEntity<Group> createGroup(final CreateForm form) {
return getEntity(form).map(entity -> { return getEntity(form).map(entity -> {
copyBeanToBean(form, entity, op -> op.exclude(Constants.COMMON_CONVERSION_RULE)); copyBeanToBean(form, entity, op -> op.exclude(Constants.COMMON_CONVERSION_RULE));
entity.setId(Base64.getEncoder().encodeToString(entity.getName().getBytes(Constants.CHARSET_UTF_8)));
return entity; return entity;
}); });
} }
......
...@@ -216,7 +216,10 @@ public class AdminRoleAction extends FessAdminAction { ...@@ -216,7 +216,10 @@ public class AdminRoleAction extends FessAdminAction {
switch (form.crudMode) { switch (form.crudMode) {
case CrudMode.CREATE: case CrudMode.CREATE:
if (form instanceof CreateForm) { 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; break;
case CrudMode.EDIT: case CrudMode.EDIT:
...@@ -233,7 +236,6 @@ public class AdminRoleAction extends FessAdminAction { ...@@ -233,7 +236,6 @@ public class AdminRoleAction extends FessAdminAction {
protected OptionalEntity<Role> createRole(final CreateForm form) { protected OptionalEntity<Role> createRole(final CreateForm form) {
return getEntity(form).map(entity -> { return getEntity(form).map(entity -> {
copyBeanToBean(form, entity, op -> op.exclude(Constants.COMMON_CONVERSION_RULE)); copyBeanToBean(form, entity, op -> op.exclude(Constants.COMMON_CONVERSION_RULE));
entity.setId(Base64.getEncoder().encodeToString(entity.getName().getBytes(Constants.CHARSET_UTF_8)));
return entity; return entity;
}); });
} }
......
...@@ -252,7 +252,10 @@ public class AdminUserAction extends FessAdminAction { ...@@ -252,7 +252,10 @@ public class AdminUserAction extends FessAdminAction {
switch (form.crudMode) { switch (form.crudMode) {
case CrudMode.CREATE: case CrudMode.CREATE:
if (form instanceof CreateForm) { 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; break;
case CrudMode.EDIT: case CrudMode.EDIT:
...@@ -272,7 +275,6 @@ public class AdminUserAction extends FessAdminAction { ...@@ -272,7 +275,6 @@ public class AdminUserAction extends FessAdminAction {
sessionManager.getAttribute(TEMPORARY_PASSWORD, String.class).ifPresent(password -> { sessionManager.getAttribute(TEMPORARY_PASSWORD, String.class).ifPresent(password -> {
entity.setPassword(password); entity.setPassword(password);
}); });
entity.setId(Base64.getEncoder().encodeToString(entity.getName().getBytes(Constants.CHARSET_UTF_8)));
return entity; return entity;
}); });
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment