当前位置: 首页>>代码示例>>Java>>正文


Java CQL2PgJSON类代码示例

本文整理汇总了Java中org.z3950.zing.cql.cql2pgjson.CQL2PgJSON的典型用法代码示例。如果您正苦于以下问题:Java CQL2PgJSON类的具体用法?Java CQL2PgJSON怎么用?Java CQL2PgJSON使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CQL2PgJSON类属于org.z3950.zing.cql.cql2pgjson包,在下文中一共展示了CQL2PgJSON类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: append

import org.z3950.zing.cql.cql2pgjson.CQL2PgJSON; //导入依赖的package包/类
/**
 * Append field.cql2pgJson(query) to sb.
 *
 * @param sb where to append
 * @param query CQL query
 * @param field field the query is based on
 * @throws CQLQueryValidationException when the underlying CQL2PgJSON throws a QueryValidationException
 */
private void append(StringBuilder sb, String query, CQL2PgJSON field) {
  if(query == null || field == null) {
    return;
  }
  try {
    sb.append(field.cql2pgJson(query));
  } catch (QueryValidationException e) {
    throw new CQLQueryValidationException(e);
  }
}
 
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:19,代码来源:CQLWrapper.java

示例2: invalidCQLvalidation

import org.z3950.zing.cql.cql2pgjson.CQL2PgJSON; //导入依赖的package包/类
@Test
public void invalidCQLvalidation() throws FieldException {
  CQLWrapper wrapper = new CQLWrapper().setField(new CQL2PgJSON("field")).setQuery("or name=miller");
  try {
    wrapper.toString();
    fail("exception expected");
  }
  catch (CQLQueryValidationException e) {
    assertThat(e.getMessage(), allOf(containsString("ParseException"), containsString("unexpected relation")));
  }
}
 
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:12,代码来源:CQLWrapperTest.java

示例3: wrap

import org.z3950.zing.cql.cql2pgjson.CQL2PgJSON; //导入依赖的package包/类
@Test
public void wrap() throws FieldException {
  CQLWrapper wrapper = new CQLWrapper().setField(new CQL2PgJSON("field")).setQuery("cql.allRecords=1");
  wrapper.addWrapper(wrapper);
  wrapper.addWrapper(wrapper, "or");
  assertThat(wrapper.toString(), is(" WHERE true and true or true"));
}
 
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:8,代码来源:CQLWrapperTest.java

示例4: getCQL

import org.z3950.zing.cql.cql2pgjson.CQL2PgJSON; //导入依赖的package包/类
private CQLWrapper getCQL(String query, int limit, int offset) throws FieldException {
  CQL2PgJSON cql2pgJson = new CQL2PgJSON(MATERIAL_TYPE_TABLE+".jsonb");
  return new CQLWrapper(cql2pgJson, query).setLimit(new Limit(limit)).setOffset(new Offset(offset));
}
 
开发者ID:folio-org,项目名称:deprecated-mod-metadata,代码行数:5,代码来源:MaterialTypeAPI.java

示例5: getCQL

import org.z3950.zing.cql.cql2pgjson.CQL2PgJSON; //导入依赖的package包/类
private CQLWrapper getCQL(String query, int limit, int offset) throws FieldException {
  CQL2PgJSON cql2pgJson = new CQL2PgJSON(LOAN_TYPE_TABLE+".jsonb");
  return new CQLWrapper(cql2pgJson, query).setLimit(new Limit(limit)).setOffset(new Offset(offset));
}
 
开发者ID:folio-org,项目名称:deprecated-mod-metadata,代码行数:5,代码来源:LoanTypeAPI.java

示例6: main

import org.z3950.zing.cql.cql2pgjson.CQL2PgJSON; //导入依赖的package包/类
public static void main(String args[]) throws Exception {

    FacetManager fm = new FacetManager("myuniversity_new1_mod_users.users");

    List<FacetField> facets = new ArrayList<>();
    facets.add(new FacetField("jsonb->>'lastUpdateDate'", 5));
    facets.add(new FacetField("jsonb->'personal'->>'phone'", 5));
    facets.add(new FacetField("jsonb->>'username'", 5));

    fm.setSupportFacets(facets);

    fm.setWhere(new CQLWrapper(new CQL2PgJSON("jsonb"), "username=jha* OR username=szeev*").toString());

    fm.setMainQuery("SELECT jsonb FROM myuniversity_new1_mod_users.users where jsonb->>'username' like 'jha%' OR jsonb->>'username' like 'szeev%'" );

    System.out.println(fm.generateFacetQuery());

  }
 
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:19,代码来源:FacetManager.java

示例7: CQLWrapper

import org.z3950.zing.cql.cql2pgjson.CQL2PgJSON; //导入依赖的package包/类
public CQLWrapper(CQL2PgJSON field, String query) {
  super();
  this.field = field;
  this.query = query;
}
 
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:6,代码来源:CQLWrapper.java

示例8: getField

import org.z3950.zing.cql.cql2pgjson.CQL2PgJSON; //导入依赖的package包/类
public CQL2PgJSON getField() {
  return field;
}
 
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:4,代码来源:CQLWrapper.java

示例9: setField

import org.z3950.zing.cql.cql2pgjson.CQL2PgJSON; //导入依赖的package包/类
public CQLWrapper setField(CQL2PgJSON field) {
  this.field = field;
  return this;
}
 
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:5,代码来源:CQLWrapper.java

示例10: returnsWhere

import org.z3950.zing.cql.cql2pgjson.CQL2PgJSON; //导入依赖的package包/类
@Test
public void returnsWhere() throws FieldException {
  CQLWrapper wrapper = new CQLWrapper().setField(new CQL2PgJSON("field")).setQuery("name=miller");
  assertThat(wrapper.toString(), startsWith(" WHERE "));
}
 
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:6,代码来源:CQLWrapperTest.java

示例11: allRecords

import org.z3950.zing.cql.cql2pgjson.CQL2PgJSON; //导入依赖的package包/类
@Test
public void allRecords() throws FieldException {
  CQLWrapper wrapper = new CQLWrapper().setField(new CQL2PgJSON("field")).setQuery("cql.allRecords=1");
  assertThat(wrapper.toString(), is(" WHERE true"));
}
 
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:6,代码来源:CQLWrapperTest.java

示例12: invalidCQL

import org.z3950.zing.cql.cql2pgjson.CQL2PgJSON; //导入依赖的package包/类
@Test(expected = IllegalStateException.class)
public void invalidCQL() throws FieldException {
  CQLWrapper wrapper = new CQLWrapper().setField(new CQL2PgJSON("field")).setQuery("or name=miller");
  wrapper.toString();
}
 
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:6,代码来源:CQLWrapperTest.java

示例13: sortBy

import org.z3950.zing.cql.cql2pgjson.CQL2PgJSON; //导入依赖的package包/类
@Test
public void sortBy() throws FieldException {
  CQL2PgJSON cql2pgJson = new CQL2PgJSON("field");
  CQLWrapper wrapper = new CQLWrapper().setField(cql2pgJson).setQuery("cql.allRecords=1 sortBy name");
  assertThat(wrapper.toString(), stringContainsInOrder(" WHERE true ORDER BY ", "name"));
}
 
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:7,代码来源:CQLWrapperTest.java


注:本文中的org.z3950.zing.cql.cql2pgjson.CQL2PgJSON类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。