add default list size

This commit is contained in:
Shinsuke Sugaya 2015-11-12 10:36:45 +09:00
parent 2916d6fb93
commit 9745d7dcd8
6 changed files with 69 additions and 5 deletions

View file

@ -106,9 +106,10 @@ public class GroupService implements Serializable {
}
public List<Group> getAvailableGroupList() {
public List<Group> getAvailableGroupList(Integer size) {
return groupBhv.selectList(cb -> {
cb.query().matchAll();
cb.paging(size, 1);
});
}

View file

@ -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<Role> getRoleList(final RolePager rolePager) {
final PagingResultBean<Role> roleList = roleBhv.selectPage(cb -> {
@ -106,9 +110,10 @@ public class RoleService implements Serializable {
}
public List<Role> getAvailableRoleList() {
public List<Role> getAvailableRoleList(Integer size) {
return roleBhv.selectList(cb -> {
cb.query().matchAll();
cb.paging(size, 1);
});
}

View file

@ -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()));
}
// ===================================================================================

View file

@ -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
// ======

View file

@ -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'. <br>
* The value is, e.g. 100 <br>
* @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}. <br>
* The value is, e.g. 100 <br>
* @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'. <br>
* The value is, e.g. 100 <br>
* @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}. <br>
* The value is, e.g. 100 <br>
* @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'. <br>
* The value is, e.g. admin <br>
@ -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);
}

View file

@ -10,8 +10,10 @@ domain.title = Fess
# ========================================================================================
# DB
# ES
# ====
form.role.list.size = 100
form.group.list.size = 100
# ========================================================================================