本文整理了Java中org.apache.oodt.cas.filemgr.structs.Query
类的一些代码示例,展示了Query
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query
类的具体详情如下:
包路径:org.apache.oodt.cas.filemgr.structs.Query
类名称:Query
暂无
代码示例来源:origin: org.apache.oodt/pcs-core
public Query buildQuery() {
Query query = new Query();
TermQueryCriteria crit = new TermQueryCriteria(PRODUCT_NAME, this.prodName);
query.addCriterion(crit);
return query;
}
代码示例来源:origin: org.apache.oodt/oodt-webapp-components
private void refreshProductPage() {
Query query = new Query();
System.out.println("CALLING REFRESH PRODUCT PAGE, CRITERIA:");
for (TermQueryCriteria crit : this.criteria) {
System.out.println(crit);
}
query.getCriteria().addAll(this.criteria);
try {
this.productPage = fm.getFm().pagedQuery(query, type, this.pageNum);
} catch (CatalogException e) {
LOG.log(Level.SEVERE, "Unable to obtain page products: type: ["
+ type.getName() + "]: Reason: " + e.getMessage());
}
}
代码示例来源:origin: org.apache.oodt/cas-filemgr
public static Query getQueryFromXmlRpc(Map<String, Object> queryHash) {
Query query = new Query();
@SuppressWarnings("unchecked")
List<QueryCriteria> criteria = getQueryCriteriaListFromXmlRpc((Vector<Map<String, Object>>) queryHash
.get("criteria"));
query.setCriteria(criteria);
return query;
}
代码示例来源:origin: apache/oodt
/**
* Converts this TypeHandler's element in the given Query into a Query
* with the necessary elements and values so the Catalog can be queried.
*
* NOTE: Original Query is modified . . . the argument query becomes
* equal to the returned query (return of query is a convenience).
*
* @param query Query for which the Catalog Query will be returned
* @return A Query with Catalog element values
* @throws QueryFormulationException
* @throws IllegalAccessException
* @throws InstantiationException
*/
public Query preQueryHandle(Query query) throws QueryFormulationException {
LinkedList<QueryCriteria> qcList = new LinkedList<QueryCriteria>();
for (QueryCriteria qc : query.getCriteria()) {
qcList.add(this.handleQueryCriteria(qc));
}
query.setCriteria(qcList);
return query;
}
代码示例来源:origin: org.apache.oodt/cas-filemgr
public int getNumProducts(ProductType type) throws CatalogException {
Query query = new Query();
return getNumHits(query, type);
}
代码示例来源:origin: org.apache.oodt/cas-filemgr
public static Map<String, Object> getXmlRpcQuery(Query query) {
Map<String, Object> queryHash = new Hashtable<String, Object>();
Vector<Map<String, Object>> criteriaVector = getXmlRpcQueryCriteriaList(query.getCriteria());
queryHash.put("criteria", criteriaVector);
return queryHash;
}
代码示例来源:origin: org.apache.oodt/cas-filemgr
Term t = ((TermQuery) luceneQuery).getTerm();
if (!t.field().equals(freeTextBlock)) {
casQuery.addCriterion(new TermQueryCriteria(t.field(),
t.text()));
if (!t[0].field().equals(freeTextBlock)) {
for (Term aT : t) {
casQuery.addCriterion(new TermQueryCriteria(
aT.field(), aT.text()));
BytesRef startT = ((TermRangeQuery) luceneQuery).getLowerTerm();
BytesRef endT = ((TermRangeQuery) luceneQuery).getUpperTerm();
casQuery.addCriterion(new RangeQueryCriteria(((TermRangeQuery) luceneQuery).getField(), startT.utf8ToString(), endT.utf8ToString()));
} else if (luceneQuery instanceof BooleanQuery) {
List<BooleanClause> clauses = ((BooleanQuery) luceneQuery).clauses();
代码示例来源:origin: apache/oodt
public int getNumProducts(ProductType type) throws CatalogException {
Query query = new Query();
return getNumHits(query, type);
}
代码示例来源:origin: apache/oodt
public static Map<String, Object> getXmlRpcQuery(Query query) {
Map<String, Object> queryHash = new Hashtable<String, Object>();
Vector<Map<String, Object>> criteriaVector = getXmlRpcQueryCriteriaList(query.getCriteria());
queryHash.put("criteria", criteriaVector);
return queryHash;
}
代码示例来源:origin: apache/oodt
Term t = ((TermQuery) luceneQuery).getTerm();
if (!t.field().equals(freeTextBlock)) {
casQuery.addCriterion(new TermQueryCriteria(t.field(),
t.text()));
if (!t[0].field().equals(freeTextBlock)) {
for (Term aT : t) {
casQuery.addCriterion(new TermQueryCriteria(
aT.field(), aT.text()));
BytesRef startT = ((TermRangeQuery) luceneQuery).getLowerTerm();
BytesRef endT = ((TermRangeQuery) luceneQuery).getUpperTerm();
casQuery.addCriterion(new RangeQueryCriteria(((TermRangeQuery) luceneQuery).getField(), startT.utf8ToString(), endT.utf8ToString()));
} else if (luceneQuery instanceof BooleanQuery) {
List<BooleanClause> clauses = ((BooleanQuery) luceneQuery).clauses();
代码示例来源:origin: org.apache.oodt/cas-filemgr
/**
* Converts this TypeHandler's element in the given Query into a Query
* with the necessary elements and values so the Catalog can be queried.
*
* NOTE: Original Query is modified . . . the argument query becomes
* equal to the returned query (return of query is a convenience).
*
* @param query Query for which the Catalog Query will be returned
* @return A Query with Catalog element values
* @throws QueryFormulationException
* @throws IllegalAccessException
* @throws InstantiationException
*/
public Query preQueryHandle(Query query) throws QueryFormulationException {
LinkedList<QueryCriteria> qcList = new LinkedList<QueryCriteria>();
for (QueryCriteria qc : query.getCriteria()) {
qcList.add(this.handleQueryCriteria(qc));
}
query.setCriteria(qcList);
return query;
}
代码示例来源:origin: org.apache.oodt/pcs-core
public Query buildQuery() {
Query query = new Query();
TermQueryCriteria crit = new TermQueryCriteria(INPUT_FILES,
this.origInputFile);
query.addCriterion(crit);
return query;
}
代码示例来源:origin: apache/oodt
public synchronized List<Product> getTopNProducts(int n, ProductType type)
throws CatalogException {
int numPages = 1;
if (n > this.pageSize) {
numPages = n / this.pageSize + (n % this.pageSize == 0 ? 0 : 1);
}
List<Product> products = new Vector<Product>(n);
Query query = new Query();
for (int pageNum = 1; pageNum < numPages + 1; pageNum++) {
List<Product> pageProducts = paginateQuery(query, type, pageNum, null);
if(pageProducts!=null) {
products.addAll(pageProducts);
}
}
if(n<=products.size()) {
return products.subList(0, n);
}
return products;
}
代码示例来源:origin: apache/oodt
private void refreshProductPage() {
Query query = new Query();
System.out.println("CALLING REFRESH PRODUCT PAGE, CRITERIA:");
for (TermQueryCriteria crit : this.criteria) {
System.out.println(crit);
}
query.getCriteria().addAll(this.criteria);
try {
this.productPage = fm.getFm().pagedQuery(query, type, this.pageNum);
} catch (CatalogException e) {
LOG.log(Level.SEVERE, "Unable to obtain page products: type: ["
+ type.getName() + "]: Reason: " + e.getMessage());
}
}
代码示例来源:origin: apache/oodt
public static AvroQuery getAvroQuery(Query query){
List<AvroQueryCriteria> avroQueryCriterias = new ArrayList<AvroQueryCriteria>();
for (QueryCriteria qc : query.getCriteria()){
avroQueryCriterias.add(getAvroQueryCriteria(qc));
}
return new AvroQuery(avroQueryCriterias);
}
代码示例来源:origin: apache/oodt
public static Query getQueryFromXmlRpc(Map<String, Object> queryHash) {
Query query = new Query();
@SuppressWarnings("unchecked")
List<QueryCriteria> criteria = getQueryCriteriaListFromXmlRpc((Vector<Map<String, Object>>) queryHash
.get("criteria"));
query.setCriteria(criteria);
return query;
}
代码示例来源:origin: org.apache.oodt/cas-filemgr
if (!t.field().equals(freeTextBlock)) {
casQuery
.addCriterion(new TermQueryCriteria(t.field(), t.text()));
if (!t[0].field().equals(freeTextBlock)) {
for (Term aT : t) {
casQuery.addCriterion(new TermQueryCriteria(aT.field(),
aT.text()));
casQuery.addCriterion(new RangeQueryCriteria(((TermRangeQuery) luceneQuery).getField(), startT.utf8ToString(), endT.utf8ToString()));
} else if (luceneQuery instanceof BooleanQuery) {
List<BooleanClause> clauses = ((BooleanQuery) luceneQuery).clauses();
代码示例来源:origin: org.apache.oodt/pcs-core
public Query buildQuery() {
Query query = new Query();
TermQueryCriteria crit = new TermQueryCriteria(FILENAME, this.fileName);
query.addCriterion(crit);
return query;
}
代码示例来源:origin: org.apache.oodt/cas-filemgr
public synchronized List<Product> getTopNProducts(int n, ProductType type)
throws CatalogException {
int numPages = 1;
if (n > this.pageSize) {
numPages = n / this.pageSize + (n % this.pageSize == 0 ? 0 : 1);
}
List<Product> products = new Vector<Product>(n);
Query query = new Query();
for (int pageNum = 1; pageNum < numPages + 1; pageNum++) {
List<Product> pageProducts = paginateQuery(query, type, pageNum, null);
if(pageProducts!=null) {
products.addAll(pageProducts);
}
}
if(n<=products.size()) {
return products.subList(0, n);
}
return products;
}
代码示例来源:origin: apache/oodt
private void computeStartEndIdx() {
if (this.productPage.getTotalPages() == 1) {
this.totalProducts = this.productPage.getPageProducts().size();
this.pageNum = 1;
} else if (productPage.getTotalPages() == 0) {
this.totalProducts = 0;
this.pageNum = 1;
} else {
this.totalProducts = (productPage.getTotalPages() - 1) * PAGE_SIZE;
this.pageNum = this.productPage.getPageNum();
// get the last page
ProductPage lastPage;
Query query = new Query();
query.getCriteria().addAll(this.criteria);
try {
lastPage = fm.getFm().pagedQuery(query, this.type,
this.productPage.getTotalPages());
this.totalProducts += lastPage.getPageProducts().size();
} catch (Exception ignore) {
}
}
this.endIdx = this.totalProducts != 0 ? Math.min(this.totalProducts,
(PAGE_SIZE) * (this.pageNum)) : 0;
this.startIdx = this.totalProducts != 0 ? ((this.pageNum - 1) * PAGE_SIZE) + 1
: 0;
}
内容来源于网络,如有侵权,请联系作者删除!