diff --git a/src/main/java/org/codelibs/fess/app/service/GroupService.java b/src/main/java/org/codelibs/fess/app/service/GroupService.java index fa1e54573..aa34f23e6 100644 --- a/src/main/java/org/codelibs/fess/app/service/GroupService.java +++ b/src/main/java/org/codelibs/fess/app/service/GroupService.java @@ -106,9 +106,10 @@ public class GroupService implements Serializable { } - public List getAvailableGroupList() { + public List getAvailableGroupList(Integer size) { return groupBhv.selectList(cb -> { cb.query().matchAll(); + cb.paging(size, 1); }); } diff --git a/src/main/java/org/codelibs/fess/app/service/RoleService.java b/src/main/java/org/codelibs/fess/app/service/RoleService.java index 3483749cf..e44c39830 100644 --- a/src/main/java/org/codelibs/fess/app/service/RoleService.java +++ b/src/main/java/org/codelibs/fess/app/service/RoleService.java @@ -27,6 +27,7 @@ import org.codelibs.fess.app.pager.RolePager; import org.codelibs.fess.es.user.cbean.RoleCB; import org.codelibs.fess.es.user.exbhv.RoleBhv; import org.codelibs.fess.es.user.exentity.Role; +import org.codelibs.fess.mylasta.direction.FessConfig; import org.dbflute.cbean.result.PagingResultBean; import org.dbflute.optional.OptionalEntity; @@ -37,6 +38,9 @@ public class RoleService implements Serializable { @Resource protected RoleBhv roleBhv; + @Resource + protected FessConfig fessConfig; + public List getRoleList(final RolePager rolePager) { final PagingResultBean roleList = roleBhv.selectPage(cb -> { @@ -106,9 +110,10 @@ public class RoleService implements Serializable { } - public List getAvailableRoleList() { + public List getAvailableRoleList(Integer size) { return roleBhv.selectList(cb -> { cb.query().matchAll(); + cb.paging(size, 1); }); } diff --git a/src/main/java/org/codelibs/fess/app/web/admin/user/AdminUserAction.java b/src/main/java/org/codelibs/fess/app/web/admin/user/AdminUserAction.java index 45a93d883..114993334 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/user/AdminUserAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/user/AdminUserAction.java @@ -121,8 +121,8 @@ public class AdminUserAction extends FessAdminAction { } private void registerForms(final RenderData data) { - data.register("roleItems", roleService.getAvailableRoleList()); - data.register("groupItems", groupService.getAvailableGroupList()); + data.register("roleItems", roleService.getAvailableRoleList(fessConfig.getFormRoleListSizeAsInteger())); + data.register("groupItems", groupService.getAvailableGroupList(fessConfig.getFormGroupListSizeAsInteger())); } // =================================================================================== diff --git a/src/main/java/org/codelibs/fess/app/web/base/FessBaseAction.java b/src/main/java/org/codelibs/fess/app/web/base/FessBaseAction.java index 0180d92e2..b5a8fa638 100644 --- a/src/main/java/org/codelibs/fess/app/web/base/FessBaseAction.java +++ b/src/main/java/org/codelibs/fess/app/web/base/FessBaseAction.java @@ -37,6 +37,7 @@ import org.codelibs.fess.app.web.base.login.FessLoginAssist; import org.codelibs.fess.mylasta.action.FessHtmlPath; import org.codelibs.fess.mylasta.action.FessMessages; import org.codelibs.fess.mylasta.action.FessUserBean; +import org.codelibs.fess.mylasta.direction.FessConfig; import org.dbflute.hook.AccessContext; import org.dbflute.optional.OptionalThing; import org.lastaflute.db.dbflute.accesscontext.AccessContextArranger; @@ -71,6 +72,9 @@ public abstract class FessBaseAction extends TypicalAction // has several interf @Resource protected SessionManager sessionManager; + @Resource + protected FessConfig fessConfig; + // =================================================================================== // Hook // ====== diff --git a/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java b/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java index 7764c8cc7..1b53393a9 100644 --- a/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java +++ b/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java @@ -25,6 +25,12 @@ public interface FessConfig extends FessEnv { /** The key of the configuration. e.g. Fess */ String DOMAIN_TITLE = "domain.title"; + /** The key of the configuration. e.g. 100 */ + String FORM_ROLE_LIST_SIZE = "form.role.list.size"; + + /** The key of the configuration. e.g. 100 */ + String FORM_GROUP_LIST_SIZE = "form.group.list.size"; + /** The key of the configuration. e.g. admin */ String AUTHENTICATION_ADMIN_ROLES = "authentication.admin.roles"; @@ -79,6 +85,36 @@ public interface FessConfig extends FessEnv { */ String getDomainTitle(); + /** + * Get the value for the key 'form.role.list.size'.
+ * The value is, e.g. 100
+ * @return The value of found property. (NotNull: if not found, exception but basically no way) + */ + String getFormRoleListSize(); + + /** + * Get the value for the key 'form.role.list.size' as {@link Integer}.
+ * The value is, e.g. 100
+ * @return The value of found property. (NotNull: if not found, exception but basically no way) + * @throws NumberFormatException When the property is not integer. + */ + Integer getFormRoleListSizeAsInteger(); + + /** + * Get the value for the key 'form.group.list.size'.
+ * The value is, e.g. 100
+ * @return The value of found property. (NotNull: if not found, exception but basically no way) + */ + String getFormGroupListSize(); + + /** + * Get the value for the key 'form.group.list.size' as {@link Integer}.
+ * The value is, e.g. 100
+ * @return The value of found property. (NotNull: if not found, exception but basically no way) + * @throws NumberFormatException When the property is not integer. + */ + Integer getFormGroupListSizeAsInteger(); + /** * Get the value for the key 'authentication.admin.roles'.
* The value is, e.g. admin
@@ -215,6 +251,22 @@ public interface FessConfig extends FessEnv { return get(FessConfig.DOMAIN_TITLE); } + public String getFormRoleListSize() { + return get(FessConfig.FORM_ROLE_LIST_SIZE); + } + + public Integer getFormRoleListSizeAsInteger() { + return getAsInteger(FessConfig.FORM_ROLE_LIST_SIZE); + } + + public String getFormGroupListSize() { + return get(FessConfig.FORM_GROUP_LIST_SIZE); + } + + public Integer getFormGroupListSizeAsInteger() { + return getAsInteger(FessConfig.FORM_GROUP_LIST_SIZE); + } + public String getAuthenticationAdminRoles() { return get(FessConfig.AUTHENTICATION_ADMIN_ROLES); } diff --git a/src/main/resources/fess_config.properties b/src/main/resources/fess_config.properties index feec28f2a..e0e3a254d 100644 --- a/src/main/resources/fess_config.properties +++ b/src/main/resources/fess_config.properties @@ -10,8 +10,10 @@ domain.title = Fess # ======================================================================================== -# DB +# ES # ==== +form.role.list.size = 100 +form.group.list.size = 100 # ========================================================================================