本文整理汇总了Java中org.apache.olingo.server.api.uri.queryoption.SearchOption类的典型用法代码示例。如果您正苦于以下问题:Java SearchOption类的具体用法?Java SearchOption怎么用?Java SearchOption使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SearchOption类属于org.apache.olingo.server.api.uri.queryoption包,在下文中一共展示了SearchOption类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSearchQuery
import org.apache.olingo.server.api.uri.queryoption.SearchOption; //导入依赖的package包/类
/**
* Method creates search query from $search system query option from URL.
*
* @param uriInfo
* URI info
* @return search query
*/
protected BoolQueryBuilder getSearchQuery(UriInfo uriInfo) {
SearchOption searchOption = uriInfo.getSearchOption();
ApplyOption applyOption = uriInfo.getApplyOption();
BoolQueryBuilder searchQuery = new BoolQueryBuilder();
if (searchOption != null) {
buildSearchQuery(searchQuery, searchOption.getSearchExpression());
} else if (applyOption != null) {
List<SearchExpression> expressions = ApplyOptionUtils.getSearchItems(applyOption)
.stream().map(e -> e.getSearchOption().getSearchExpression())
.collect(Collectors.toList());
for (SearchExpression expression : expressions) {
buildSearchQuery(searchQuery, expression);
}
}
return searchQuery;
}
示例2: applySearchSystemQueryOption
import org.apache.olingo.server.api.uri.queryoption.SearchOption; //导入依赖的package包/类
public static void applySearchSystemQueryOption(final SearchOption searchOption, EntityCollection entitySet)
throws ODataApplicationException {
if (searchOption != null) {
SearchExpression se = searchOption.getSearchExpression();
Iterator<Entity> it = entitySet.getEntities().iterator();
while (it.hasNext()) {
boolean keep = false;
Entity entity = it.next();
ListIterator<Property> properties = entity.getProperties().listIterator();
while (properties.hasNext() && !keep) {
keep = isTrue(se, properties.next());
}
if (!keep) {
it.remove();
}
}
}
}
示例3: parse
import org.apache.olingo.server.api.uri.queryoption.SearchOption; //导入依赖的package包/类
public SearchOption parse(final String searchQuery) throws SearchParserException, SearchTokenizerException {
SearchTokenizer tokenizer = new SearchTokenizer();
SearchExpression searchExpression;
try {
searchExpression = parse(tokenizer.tokenize(searchQuery));
} catch (SearchTokenizerException e) {
String message = e.getMessage();
throw new SearchParserException("Tokenizer exception with message: " + message, e,
SearchParserException.MessageKeys.TOKENIZER_EXCEPTION, message);
}
final SearchOptionImpl searchOption = new SearchOptionImpl();
searchOption.setSearchExpression(searchExpression);
return searchOption;
}
示例4: resultsIn
import org.apache.olingo.server.api.uri.queryoption.SearchOption; //导入依赖的package包/类
private void resultsIn(final String expectedSearchExpression)
throws SearchTokenizerException, SearchParserException {
final SearchOption result = new SearchParser().parse(searchQuery);
Assert.assertNotNull(result);
final SearchExpression searchExpression = result.getSearchExpression();
Assert.assertNotNull(searchExpression);
Assert.assertEquals(expectedSearchExpression, searchExpression.toString());
}
示例5: visit
import org.apache.olingo.server.api.uri.queryoption.SearchOption; //导入依赖的package包/类
@Override
public void visit(SearchOption option) {
}
示例6: appendCommonJsonObjects
import org.apache.olingo.server.api.uri.queryoption.SearchOption; //导入依赖的package包/类
private void appendCommonJsonObjects(JsonGenerator gen,
final CountOption countOption, final SkipOption skipOption, final TopOption topOption,
final FilterOption filterOption, final OrderByOption orderByOption,
final SelectOption selectOption, final ExpandOption expandOption, final SearchOption searchOption,
final ApplyOption applyOption)
throws IOException {
if (countOption != null) {
gen.writeBooleanField("isCount", countOption.getValue());
}
if (skipOption != null) {
gen.writeNumberField("skip", skipOption.getValue());
}
if (topOption != null) {
gen.writeNumberField("top", topOption.getValue());
}
if (filterOption != null) {
gen.writeFieldName("filter");
appendExpressionJson(gen, filterOption.getExpression());
}
if (orderByOption != null && !orderByOption.getOrders().isEmpty()) {
gen.writeFieldName("orderby");
gen.writeStartObject();
gen.writeStringField("nodeType", "orderCollection");
gen.writeFieldName("orders");
appendOrderByItemsJson(gen, orderByOption.getOrders());
gen.writeEndObject();
}
if (selectOption != null && !selectOption.getSelectItems().isEmpty()) {
gen.writeFieldName("select");
appendSelectedPropertiesJson(gen, selectOption.getSelectItems());
}
if (expandOption != null && !expandOption.getExpandItems().isEmpty()) {
gen.writeFieldName("expand");
appendExpandedPropertiesJson(gen, expandOption.getExpandItems());
}
if (searchOption != null) {
gen.writeFieldName("search");
appendSearchJson(gen, searchOption.getSearchExpression());
}
if (applyOption != null) {
gen.writeFieldName("apply");
appendApplyItemsJson(gen, applyOption.getApplyItems());
}
}
示例7: parse
import org.apache.olingo.server.api.uri.queryoption.SearchOption; //导入依赖的package包/类
public SearchOption parse(UriTokenizer tokenizer) throws SearchParserException {
SearchOptionImpl searchOption = new SearchOptionImpl();
searchOption.setSearchExpression(processExprOr(tokenizer));
return searchOption;
}
示例8: parseTrafo
import org.apache.olingo.server.api.uri.queryoption.SearchOption; //导入依赖的package包/类
private ApplyItem parseTrafo(EdmStructuredType referencedType) throws UriParserException, UriValidationException {
if (tokenizer.next(TokenKind.AggregateTrafo)) {
return parseAggregateTrafo(referencedType);
} else if (tokenizer.next(TokenKind.IDENTITY)) {
return new IdentityImpl();
} else if (tokenizer.next(TokenKind.ComputeTrafo)) {
return parseComputeTrafo(referencedType);
} else if (tokenizer.next(TokenKind.ConcatMethod)) {
return parseConcatTrafo(referencedType);
} else if (tokenizer.next(TokenKind.ExpandTrafo)) {
return new ExpandImpl().setExpandOption(parseExpandTrafo(referencedType));
} else if (tokenizer.next(TokenKind.FilterTrafo)) {
final FilterOption filterOption = new FilterParser(edm, odata)
.parse(tokenizer, referencedType, crossjoinEntitySetNames, aliases);
ParserHelper.requireNext(tokenizer, TokenKind.CLOSE);
return new FilterImpl().setFilterOption(filterOption);
} else if (tokenizer.next(TokenKind.GroupByTrafo)) {
return parseGroupByTrafo(referencedType);
} else if (tokenizer.next(TokenKind.SearchTrafo)) {
final SearchOption searchOption = new SearchParser().parse(tokenizer);
ParserHelper.requireNext(tokenizer, TokenKind.CLOSE);
return new SearchImpl().setSearchOption(searchOption);
} else if (tokenizer.next(TokenKind.QualifiedName)) {
return parseCustomFunction(new FullQualifiedName(tokenizer.getText()), referencedType);
} else {
final TokenKind kind = ParserHelper.next(tokenizer,
TokenKind.BottomCountTrafo, TokenKind.BottomPercentTrafo, TokenKind.BottomSumTrafo,
TokenKind.TopCountTrafo, TokenKind.TopPercentTrafo, TokenKind.TopSumTrafo);
if (kind == null) {
throw new UriParserSyntaxException("Invalid apply expression syntax.",
UriParserSyntaxException.MessageKeys.SYNTAX);
} else {
return parseBottomTop(kind, referencedType);
}
}
}
示例9: getSearchOption
import org.apache.olingo.server.api.uri.queryoption.SearchOption; //导入依赖的package包/类
@Override
public SearchOption getSearchOption() {
return searchOption;
}
示例10: setSearchOption
import org.apache.olingo.server.api.uri.queryoption.SearchOption; //导入依赖的package包/类
public SearchImpl setSearchOption(final SearchOption searchOption) {
this.searchOption = searchOption;
return this;
}
示例11: getSearchOption
import org.apache.olingo.server.api.uri.queryoption.SearchOption; //导入依赖的package包/类
@Override
public SearchOption getSearchOption() {
return (SearchOption) systemQueryOptions.get(SystemQueryOptionKind.SEARCH);
}
示例12: getSearchOption
import org.apache.olingo.server.api.uri.queryoption.SearchOption; //导入依赖的package包/类
/**
* Gets the search option.
* @return a {@link SearchOption} (but never <code>null</code>)
*/
SearchOption getSearchOption();
示例13: getSearchOption
import org.apache.olingo.server.api.uri.queryoption.SearchOption; //导入依赖的package包/类
/**
* @return Object containing information of the $search option
*/
SearchOption getSearchOption();
示例14: visit
import org.apache.olingo.server.api.uri.queryoption.SearchOption; //导入依赖的package包/类
void visit(SearchOption option);