當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。