use of org.codelibs.fess.mylasta.direction.FessConfig 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 WebConfigToLabelBhv webConfigToLabelBhv = ComponentUtil.getComponent(WebConfigToLabelBhv.class);
final ListResultBean<WebConfigToLabel> mappingList = webConfigToLabelBhv.selectList(cb -> {
cb.query().setWebConfigId_Equal(getId());
cb.specify().columnLabelTypeId();
cb.paging(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger().intValue(), 1);
});
final List<String> labelIdList = new ArrayList<>();
for (final WebConfigToLabel 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;
}
use of org.codelibs.fess.mylasta.direction.FessConfig 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;
}
use of org.codelibs.fess.mylasta.direction.FessConfig in project fess by codelibs.
the class DataConfig method getLabelTypeList.
public List<LabelType> getLabelTypeList() {
if (labelTypeList == null) {
synchronized (this) {
if (labelTypeList == null) {
final FessConfig fessConfig = ComponentUtil.getFessConfig();
final DataConfigToLabelBhv dataConfigToLabelBhv = ComponentUtil.getComponent(DataConfigToLabelBhv.class);
final ListResultBean<DataConfigToLabel> mappingList = dataConfigToLabelBhv.selectList(cb -> {
cb.query().setDataConfigId_Equal(getId());
cb.specify().columnLabelTypeId();
cb.paging(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger().intValue(), 1);
});
final List<String> labelIdList = new ArrayList<>();
for (final DataConfigToLabel 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;
}
use of org.codelibs.fess.mylasta.direction.FessConfig in project fess by codelibs.
the class User method getPermissions.
@Override
public String[] getPermissions() {
final FessConfig fessConfig = ComponentUtil.getFessConfig();
final List<String> list = new ArrayList<>();
list.add(fessConfig.getRoleSearchUserPrefix() + getName());
stream(getRoles()).of(stream -> stream.forEach(s -> list.add(fessConfig.getRoleSearchRolePrefix() + decode(s))));
stream(getGroups()).of(stream -> stream.forEach(s -> list.add(fessConfig.getRoleSearchGroupPrefix() + decode(s))));
return list.toArray(new String[list.size()]);
}
use of org.codelibs.fess.mylasta.direction.FessConfig in project fess by codelibs.
the class KeyMatchHelper method getBoostedDocumentList.
public List<Map<String, Object>> getBoostedDocumentList(final String term, final int size) {
final FessEsClient fessEsClient = ComponentUtil.getFessEsClient();
final Pair<QueryBuilder, ScoreFunctionBuilder> pair = keyMatchQueryMap.get(toLowerCase(term));
if (pair == null) {
return Collections.emptyList();
}
final FessConfig fessConfig = ComponentUtil.getFessConfig();
return fessEsClient.getDocumentList(fessConfig.getIndexDocumentSearchIndex(), fessConfig.getIndexDocumentType(), searchRequestBuilder -> {
searchRequestBuilder.setPreference(Constants.SEARCH_PREFERENCE_PRIMARY).setQuery(pair.getFirst()).setSize(size);
return true;
});
}
Aggregations