我在Scout工作,需要SmartField。为此,我需要设置查找建议。
我看到创建Lookup Call的示例,而不是在Lookup Service getConfiguredSqlSelect
但我使用Hibernate来处理类,所以我的问题是如何将智能字段与Hibernate对象填充服务连接起来?
答案 0 :(得分:1)
根据[1]创建一个新的查找调用,但有以下不同之处:
说明以下代码段应该有所帮助:
public class TeamLookupService extends AbstractLookupService<String> implements ITeamLookupService {
private List<ILookupRow<String>> m_values = new ArrayList<>();
public TeamLookupService() {
m_values.add(new LookupRow<String>("CRC", "Costa Rica"));
m_values.add(new LookupRow<String>("HON", "Honduras"));
m_values.add(new LookupRow<String>("MEX", "Mexico"));
m_values.add(new LookupRow<String>("USA", "USA"));
}
@Override
public List<? extends ILookupRow<String>> getDataByAll(ILookupCall<String> call) throws ProcessingException {
return m_values;
}
@Override
public List<? extends ILookupRow<String>> getDataByKey(ILookupCall<String> call) throws ProcessingException {
List<ILookupRow<String>> result = new ArrayList<>();
for (ILookupRow<String> row : m_values) {
if (row.getKey().equals(call.getKey())) {
result.add(row);
}
}
return result;
}
...