Search in sources :

Example 1 with ElevateWordToLabelBhv

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

the class ElevateWord method getLabelTypeList.

public List<LabelType> getLabelTypeList() {
    if (labelTypeList == null) {
        synchronized (this) {
            if (labelTypeList == null) {
                final FessConfig fessConfig = ComponentUtil.getFessConfig();
                final ElevateWordToLabelBhv elevateWordToLabelBhv = ComponentUtil.getComponent(ElevateWordToLabelBhv.class);
                final ListResultBean<ElevateWordToLabel> mappingList = elevateWordToLabelBhv.selectList(cb -> {
                    cb.query().setElevateWordId_Equal(getId());
                    cb.specify().columnLabelTypeId();
                    cb.paging(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger(), 1);
                });
                final List<String> labelIdList = new ArrayList<>();
                for (final ElevateWordToLabel mapping : mappingList) {
                    labelIdList.add(mapping.getLabelTypeId());
                }
                final LabelTypeBhv labelTypeBhv = ComponentUtil.getComponent(LabelTypeBhv.class);
                labelTypeList = labelIdList.isEmpty() ? Collections.emptyList() : labelTypeBhv.selectList(cb -> {
                    cb.query().setId_InScope(labelIdList);
                    cb.query().addOrderBy_SortOrder_Asc();
                    cb.fetchFirst(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger());
                });
            }
        }
    }
    return labelTypeList;
}
Also used : ArrayList(java.util.ArrayList) FessConfig(org.codelibs.fess.mylasta.direction.FessConfig) ElevateWordToLabelBhv(org.codelibs.fess.es.config.exbhv.ElevateWordToLabelBhv) LabelTypeBhv(org.codelibs.fess.es.config.exbhv.LabelTypeBhv)

Aggregations

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