本文整理汇总了Java中net.wedjaa.elasticparser.ESSearch类的典型用法代码示例。如果您正苦于以下问题:Java ESSearch类的具体用法?Java ESSearch怎么用?Java ESSearch使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ESSearch类属于net.wedjaa.elasticparser包,在下文中一共展示了ESSearch类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFields
import net.wedjaa.elasticparser.ESSearch; //导入依赖的package包/类
@Override
public JRField[] getFields(JasperReport jr) throws JRException {
ESSearch esSearch = getESSearch(jr);
if ( esSearch == null) {
throw new JRException("No ElasticSearch connection for this report!!");
}
Map<String, Class<?>> fields = esSearch.getFields();
JRField[] result = new JRField[fields.size()];
int idx=0;
for (String field: fields.keySet()) {
result[idx] = new ESField(field, field, fields.get(field));
idx++;
}
return result;
}
示例2: createDatasource
import net.wedjaa.elasticparser.ESSearch; //导入依赖的package包/类
@Override
public JRDataSource createDatasource() throws JRException {
ESSearch connection = (ESSearch) ((Map<?, ?>) getParameterValue(JRParameter.REPORT_PARAMETERS_MAP))
.get(JRParameter.REPORT_CONNECTION);
if (connection == null) {
connection = processConnection(reportParameters
.get(JRParameter.REPORT_CONNECTION));
if (connection == null) {
throw new JRException("No ES connection");
}
}
// We create a new connection
// for the datasource based on
// the one that was handed over
// to us.
ESSearch newSearch = connection.clone();
newSearch.setSearch(getQueryString());
esSearch = connection;
logger.debug("Create new DataSource witha clone of the current connection.");
logger.debug("Setting the search to query: " + getQueryString());
return new ESDataSource(newSearch);
}
示例3: createESSearch
import net.wedjaa.elasticparser.ESSearch; //导入依赖的package包/类
private void createESSearch() throws JRException {
esSearch = new ESSearch(
dataAdapter.getElasticSearchIndexes(),
dataAdapter.getElasticSearchTypes(),
Integer.parseInt(dataAdapter.getElasticSearchMode()),
dataAdapter.getElasticSearchHost(),
Integer.parseInt(dataAdapter.getElasticSearchPort()),
dataAdapter.getElasticSearchUsername(),
dataAdapter.getElasticSearchPassword(),
dataAdapter.getElasticSearchCluster()
);
// Creating a base search - it will be a correct query
// once it hits the QueryExecuter.
esSearch.setSearch("{ \"query\": { \"match_all\": {} } }");
}
示例4: getFields
import net.wedjaa.elasticparser.ESSearch; //导入依赖的package包/类
public List<JRDesignField> getFields(
JasperReportsContext context, JRDataset dataset,
Map<String, Object> parameters, ESSearch connection)
throws JRException {
logger.debug("Providing fields a query.");
String query = "{ query: { match_all: {} } }";
if ( dataset.getQuery() != null ) {
query = dataset.getQuery().getText();
}
logger.debug("Passing query to connection: " + query);
connection.setSearch(query);
Map<String, Class<?>> queryFields = connection.getFields(query);
List<JRDesignField> fields = new ArrayList<JRDesignField>();
for (String fieldName: queryFields.keySet() ) {
JRDesignField field = new JRDesignField();
field.setName(fieldName);
field.setValueClass(queryFields.get(fieldName));
field.setDescription(fieldName);
fields.add(field);
}
return fields;
}
示例5: processConnection
import net.wedjaa.elasticparser.ESSearch; //导入依赖的package包/类
private ESSearch processConnection(JRValueParameter valueParameter)
throws JRException {
if (valueParameter == null) {
throw new JRException("No ElasticSearch connection");
}
return (ESSearch) valueParameter.getValue();
}
示例6: setReportParameterValues
import net.wedjaa.elasticparser.ESSearch; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void setReportParameterValues(@SuppressWarnings("rawtypes") Map parameters) {
esSearch = new ESSearch(elasticSearchIndexes,
elasticSearchTypes, Integer.parseInt(elasticSearchMode),
elasticSearchHost, Integer.parseInt(elasticSearchPort),
elasticSearchUsername, elasticSearchPassword, elasticSearchCluster);
parameters.put(JRParameter.REPORT_CONNECTION, esSearch);
}
示例7: getFields
import net.wedjaa.elasticparser.ESSearch; //导入依赖的package包/类
public List<JRDesignField> getFields(DataAdapterService dataAdapterService,
JasperReportsConfiguration jasperReportsConfiguration, JRDataset dataset) throws JRException,
UnsupportedOperationException {
logger.debug("Was asked to provide a list of fields.");
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put(JRParameter.REPORT_MAX_COUNT, 0);
dataAdapterService.contributeParameters(parameters);
ParameterUtil.setParameters(jasperReportsConfiguration, dataset, parameters);
logger.debug("Getting fields for query: " + dataset.getQuery().getText());
return net.wedjaa.jasper.elasticsearch.datasource.ESFieldsProvider.getInstance().getFields(jasperReportsConfiguration, dataset, parameters,
(ESSearch) parameters.get(JRParameter.REPORT_CONNECTION));
}
示例8: createComboField
import net.wedjaa.elasticparser.ESSearch; //导入依赖的package包/类
private Combo createComboField() {
Combo comboField = new Combo(this, SWT.BORDER);
comboField.add("Hits Mode - Returns Hits Data", ESSearch.ES_MODE_HITS);
comboField.add("Aggregation Mode - Returns Aggregations Data", ESSearch.ES_MODE_AGGS);
comboField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
return comboField;
}
示例9: createComboField
import net.wedjaa.elasticparser.ESSearch; //导入依赖的package包/类
private Combo createComboField(Composite composite) {
Combo comboField = new Combo(composite, SWT.BORDER);
comboField.add("Hits Mode - Returns Hits Data", ESSearch.ES_MODE_HITS);
comboField.add("Aggregation Mode - Returns Aggregations Data", ESSearch.ES_MODE_AGGS);
comboField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
return comboField;
}
示例10: ESDataSource
import net.wedjaa.elasticparser.ESSearch; //导入依赖的package包/类
public ESDataSource(ESSearch esSearch) {
this.esSearch = esSearch;
logger.debug("Created a new elasticsearch datasource connected to " + esSearch.getHostname());
this.esSearch.search();
logger.debug("Search for " + this.esSearch.getSearch() + " has started....");
}
示例11: create
import net.wedjaa.elasticparser.ESSearch; //导入依赖的package包/类
@Override
public JRDataSource create(JasperReport jr) throws JRException {
ESSearch esSearch = getESSearch(jr);
if ( esSearch == null) {
throw new JRException("No ElasticSearcg connection for this report!!");
}
return new ESDataSource(esSearch);
}