Search in sources :

Example 1 with LabelToRoleBhv

use of org.codelibs.fess.es.config.exbhv.LabelToRoleBhv in project fess by codelibs.

the class LabelType method getRoleTypeList.

public List<RoleType> getRoleTypeList() {
    if (roleTypeList == null) {
        synchronized (this) {
            if (roleTypeList == null) {
                final FessConfig fessConfig = ComponentUtil.getFessConfig();
                final LabelToRoleBhv labelToRoleBhv = ComponentUtil.getComponent(LabelToRoleBhv.class);
                final ListResultBean<LabelToRole> mappingList = labelToRoleBhv.selectList(cb -> {
                    cb.query().setLabelTypeId_Equal(getId());
                    cb.specify().columnRoleTypeId();
                    cb.paging(fessConfig.getPageRoletypeMaxFetchSizeAsInteger().intValue(), 1);
                });
                final List<String> roleIdList = new ArrayList<>();
                for (final LabelToRole mapping : mappingList) {
                    roleIdList.add(mapping.getRoleTypeId());
                }
                final RoleTypeBhv roleTypeBhv = ComponentUtil.getComponent(RoleTypeBhv.class);
                roleTypeList = roleIdList.isEmpty() ? Collections.emptyList() : roleTypeBhv.selectList(cb -> {
                    cb.query().setId_InScope(roleIdList);
                    cb.query().addOrderBy_SortOrder_Asc();
                    cb.fetchFirst(fessConfig.getPageRoletypeMaxFetchSizeAsInteger());
                });
            }
        }
    }
    return roleTypeList;
}
Also used : ArrayList(java.util.ArrayList) FessConfig(org.codelibs.fess.mylasta.direction.FessConfig) RoleTypeBhv(org.codelibs.fess.es.config.exbhv.RoleTypeBhv) LabelToRoleBhv(org.codelibs.fess.es.config.exbhv.LabelToRoleBhv)

Aggregations

ArrayList (java.util.ArrayList)1 LabelToRoleBhv (org.codelibs.fess.es.config.exbhv.LabelToRoleBhv)1 RoleTypeBhv (org.codelibs.fess.es.config.exbhv.RoleTypeBhv)1 FessConfig (org.codelibs.fess.mylasta.direction.FessConfig)1