本文整理汇总了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);
}
}
示例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")));
}
}
示例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"));
}
示例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));
}
示例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));
}
示例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());
}
示例7: CQLWrapper
import org.z3950.zing.cql.cql2pgjson.CQL2PgJSON; //导入依赖的package包/类
public CQLWrapper(CQL2PgJSON field, String query) {
super();
this.field = field;
this.query = query;
}
示例8: getField
import org.z3950.zing.cql.cql2pgjson.CQL2PgJSON; //导入依赖的package包/类
public CQL2PgJSON getField() {
return field;
}
示例9: setField
import org.z3950.zing.cql.cql2pgjson.CQL2PgJSON; //导入依赖的package包/类
public CQLWrapper setField(CQL2PgJSON field) {
this.field = field;
return this;
}
示例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 "));
}
示例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"));
}
示例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();
}
示例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"));
}