• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java FilterExpression类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.olingo.odata2.api.uri.expression.FilterExpression的典型用法代码示例。如果您正苦于以下问题:Java FilterExpression类的具体用法?Java FilterExpression怎么用?Java FilterExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FilterExpression类属于org.apache.olingo.odata2.api.uri.expression包,在下文中一共展示了FilterExpression类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: readOptimizedFilter

import org.apache.olingo.odata2.api.uri.expression.FilterExpression; //导入依赖的package包/类
@Test
public void readOptimizedFilter() throws Exception {
  GetEntitySetUriInfo uriInfo = createMockedUriInfo("Rooms");
  Edm edm = EdmMock.createMockEdm();

  FilterExpression exp = UriParserImpl.parseFilter(edm, edm.getEntityType("RefScenario", "Room"), "Version gt 105");
  Mockito.when(uriInfo.getFilter()).thenReturn(exp);

  List<Room> results = createRooms(1, 10);
  ReadResult<Room> readResult = ReadResult.forResult(results).filterApplied().build();
  Mockito.when(mockedDataSource.readData(Mockito.any(EdmEntitySet.class), Mockito.any(ReadOptions.class)))
      .thenReturn((ReadResult)readResult);

  ODataResponse result = dataSourceProcessor.readEntitySet(uriInfo, "application/json");

  StringHelper.Stream resultStream = StringHelper.toStream(result.getEntityAsStream());
  List<LinkedTreeMap<?, ?>> parsedResults = JsonHelper.getResults(resultStream.asString());
  Assert.assertEquals(10, parsedResults.size());
  Assert.assertEquals("Room with id: 1", parsedResults.get(0).get("Name"));
  Assert.assertEquals("Room with id: 9", parsedResults.get(9).get("Name"));
}
 
开发者ID:mibo,项目名称:janos,代码行数:22,代码来源:DataSourceProcessorTest.java


示例2: getProducts

import org.apache.olingo.odata2.api.uri.expression.FilterExpression; //导入依赖的package包/类
public List<Product> getProducts(User user, String uuid,
      FilterExpression filter_expr, OrderByExpression order_expr, int skip,
      int top) throws ExceptionVisitExpression, ODataApplicationException
{
   ProductSQLVisitor expV = new ProductSQLVisitor();
   Object visit_result = null;

   if (filter_expr != null)
   {
      visit_result = filter_expr.accept(expV);
   }
   if (order_expr != null)
   {
      visit_result = order_expr.accept(expV);
   }

   return productService.getProducts((DetachedCriteria) visit_result, uuid,
         skip, top);
}
 
开发者ID:SentinelDataHub,项目名称:DataHubSystem,代码行数:20,代码来源:OlingoManager.java


示例3: getUsers

import org.apache.olingo.odata2.api.uri.expression.FilterExpression; //导入依赖的package包/类
public List<User> getUsers(
      FilterExpression filter_expr, OrderByExpression order_expr, int skip,
      int top) throws ExceptionVisitExpression, ODataApplicationException
{
   UserSQLVisitor expV = new UserSQLVisitor();
   Object visit = null;
   if (filter_expr != null)
   {
      visit = filter_expr.accept(expV);
   }
   if (order_expr != null)
   {
      visit = order_expr.accept(expV);
   }
   return userService.getUsers((DetachedCriteria) visit, skip, top);
}
 
开发者ID:SentinelDataHub,项目名称:DataHubSystem,代码行数:17,代码来源:OlingoManager.java


示例4: parseFilterExpression

import org.apache.olingo.odata2.api.uri.expression.FilterExpression; //导入依赖的package包/类
/**
 * Parse an OData filter expression and return a JPA predicate
 * 
 * @param oDataFilter OData filter string e.g. "displayName eq 'Test' and version = 1"
 * @return
 */
public Predicate parseFilterExpression(CriteriaBuilder cb, Root<T> table, String oDataFilter)
{
	if (logger != null && logger.isDebugEnabled())
		logger.debug(LOG_TAG, "ODataFilterToJpaQueryBuilder.parseFilterExpression \"" + oDataFilter + "\"");

	if (oDataFilter == null || oDataFilter.trim().length() == 0)
	{
		return null;
	}

	Edm edm = null;
	EdmEntityType edmType = null;
	FilterExpression filterExpression;
	try
	{
		filterExpression = UriParser.parseFilter(edm, edmType, oDataFilter);
	}
	catch (ODataMessageException e)
	{
		throw new IllegalArgumentException("Cannot parse OData filter \"" + oDataFilter + "\"", e);
	}
	CommonExpression commonExpression = filterExpression.getExpression();
	return this.processFilterExpression(cb, table, commonExpression);
}
 
开发者ID:giraone,项目名称:pms-sample-jee-01,代码行数:31,代码来源:ODataToJpaQueryBuilder.java


示例5: readFilter

import org.apache.olingo.odata2.api.uri.expression.FilterExpression; //导入依赖的package包/类
@Test
public void readFilter() throws Exception {
  GetEntitySetUriInfo uriInfo = createMockedUriInfo("Rooms");
  Edm edm = EdmMock.createMockEdm();

  FilterExpression exp = UriParserImpl.parseFilter(edm, edm.getEntityType("RefScenario", "Room"), "Version gt 105");
  Mockito.when(uriInfo.getFilter()).thenReturn(exp);

  List<Room> results = createRooms(1, 10);
  ReadResult<Room> readResult = ReadResult.forResult(results).build();
  Mockito.when(mockedDataSource.readData(Mockito.any(EdmEntitySet.class), Mockito.any(ReadOptions.class)))
      .thenReturn((ReadResult)readResult);

  ODataResponse result = dataSourceProcessor.readEntitySet(uriInfo, "application/json");

  StringHelper.Stream resultStream = StringHelper.toStream(result.getEntityAsStream());
  List<LinkedTreeMap<?, ?>> parsedResults = JsonHelper.getResults(resultStream.asString());
  Assert.assertEquals(5, parsedResults.size());
  Assert.assertEquals("Room with id: 10", parsedResults.get(0).get("Name"));
  Assert.assertEquals("Room with id: 9", parsedResults.get(4).get("Name"));
}
 
开发者ID:mibo,项目名称:janos,代码行数:22,代码来源:DataSourceProcessorTest.java


示例6: testToJsonBinaryProperty

import org.apache.olingo.odata2.api.uri.expression.FilterExpression; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testToJsonBinaryProperty() throws Exception {
  FilterExpression expression = UriParser.parseFilter(null, null, "a eq b");
  String jsonString = toJson(expression);
  Gson gsonConverter = new Gson();

  LinkedTreeMap<String, Object> jsonMap = gsonConverter.fromJson(jsonString, LinkedTreeMap.class);
  checkBinary(jsonMap, "eq", null);

  LinkedTreeMap<String, Object> left = (LinkedTreeMap<String, Object>) jsonMap.get(LEFT);
  checkProperty(left, null, "a");

  LinkedTreeMap<String, Object> right = (LinkedTreeMap<String, Object>) jsonMap.get(RIGHT);
  checkProperty(right, null, "b");
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:17,代码来源:FilterToJsonTest.java


示例7: testToJsonBinaryLiteral

import org.apache.olingo.odata2.api.uri.expression.FilterExpression; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testToJsonBinaryLiteral() throws Exception {
  FilterExpression expression = UriParser.parseFilter(null, null, "'a' eq 'b'");
  String jsonString = toJson(expression);
  Gson gsonConverter = new Gson();

  LinkedTreeMap<String, Object> jsonMap = gsonConverter.fromJson(jsonString, LinkedTreeMap.class);
  checkBinary(jsonMap, "eq", "Edm.Boolean");

  LinkedTreeMap<String, Object> left = (LinkedTreeMap<String, Object>) jsonMap.get(LEFT);
  checkLiteral(left, "Edm.String", "a");

  LinkedTreeMap<String, Object> right = (LinkedTreeMap<String, Object>) jsonMap.get(RIGHT);
  checkLiteral(right, "Edm.String", "b");
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:17,代码来源:FilterToJsonTest.java


示例8: testToJsonMember

import org.apache.olingo.odata2.api.uri.expression.FilterExpression; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testToJsonMember() throws Exception {
  FilterExpression expression = UriParser.parseFilter(null, null, "Location/Country");
  String jsonString = toJson(expression);
  Gson gsonConverter = new Gson();

  LinkedTreeMap<String, Object> jsonMap = gsonConverter.fromJson(jsonString, LinkedTreeMap.class);
  checkMember(jsonMap, null);

  LinkedTreeMap<String, Object> source = (LinkedTreeMap<String, Object>) jsonMap.get(SOURCE);
  checkProperty(source, null, "Location");

  LinkedTreeMap<String, Object> path = (LinkedTreeMap<String, Object>) jsonMap.get(PATH);
  checkProperty(path, null, "Country");
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:17,代码来源:FilterToJsonTest.java


示例9: testToJsonMember2

import org.apache.olingo.odata2.api.uri.expression.FilterExpression; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testToJsonMember2() throws Exception {
  FilterExpression expression = UriParser.parseFilter(null, null, "Location/Country/PostalCode");
  String jsonString = toJson(expression);
  Gson gsonConverter = new Gson();

  LinkedTreeMap<String, Object> jsonMap = gsonConverter.fromJson(jsonString, LinkedTreeMap.class);
  checkMember(jsonMap, null);

  LinkedTreeMap<String, Object> source1 = (LinkedTreeMap<String, Object>) jsonMap.get(SOURCE);
  checkMember(source1, null);

  LinkedTreeMap<String, Object> source2 = (LinkedTreeMap<String, Object>) source1.get(SOURCE);
  checkProperty(source2, null, "Location");

  LinkedTreeMap<String, Object> path1 = (LinkedTreeMap<String, Object>) source1.get(PATH);
  checkProperty(path1, null, "Country");

  LinkedTreeMap<String, Object> path = (LinkedTreeMap<String, Object>) jsonMap.get(PATH);
  checkProperty(path, null, "PostalCode");
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:23,代码来源:FilterToJsonTest.java


示例10: UserMap

import org.apache.olingo.odata2.api.uri.expression.FilterExpression; //导入依赖的package包/类
/** Private constructor used by {@link ProductsMap#getSubMapBuilder()}. */
private UserMap (FilterExpression filter, OrderByExpression order, int skip,
   int top)
{
   this.filter = filter;
   this.orderBy = order;
   this.skip = skip;
   this.top = top;

   hasRole = Security.currentUserHasRole(Role.SYSTEM_MANAGER, Role.USER_MANAGER);
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:12,代码来源:UserMap.java


示例11: CollectionProductsMap

import org.apache.olingo.odata2.api.uri.expression.FilterExpression; //导入依赖的package包/类
/**
 * Private constructor used by
 * {@link CollectionProductsMap#getSubMapBuilder()}
 */
public CollectionProductsMap (String collection_uuid, FilterExpression filter,
   OrderByExpression order, int skip, int top)
{
   this.collectionUUID = collection_uuid;

   this.filter = filter;
   this.orderBy = order;
   this.skip = skip;
   this.top = top;
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:15,代码来源:CollectionProductsMap.java


示例12: ProductsMap

import org.apache.olingo.odata2.api.uri.expression.FilterExpression; //导入依赖的package包/类
/** Private constructor used by {@link ProductsMap#getSubMapBuilder()}. */
private ProductsMap (FilterExpression filter, OrderByExpression order,
   int skip, int top)
{
   this.filter = filter;
   this.orderBy = order;
   this.skip = skip;
   this.top = top;
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:10,代码来源:ProductsMap.java


示例13: CollectionMap

import org.apache.olingo.odata2.api.uri.expression.FilterExpression; //导入依赖的package包/类
private CollectionMap (FilterExpression filter, OrderByExpression order,
   int skip, int top, String parent_id)
{
   this.filter = filter;
   this.orderBy = order;
   this.skip = skip;
   this.top = top;
   this.parentId = parent_id;
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:10,代码来源:CollectionMap.java


示例14: DeletedProductsMap

import org.apache.olingo.odata2.api.uri.expression.FilterExpression; //导入依赖的package包/类
/** Private constructor used by {@link DeletedProductsMap#getSubMapBuilder()}. */
private DeletedProductsMap(FilterExpression filter, OrderByExpression order,
      int skip, int top)
{
   this.filter = filter;
   this.orderBy = order;
   this.skip = skip;
   this.top = top;
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:10,代码来源:DeletedProductsMap.java


示例15: SQLVisitor

import org.apache.olingo.odata2.api.uri.expression.FilterExpression; //导入依赖的package包/类
protected SQLVisitor(Class entity, FilterExpression filter, OrderByExpression order)
      throws ExceptionVisitExpression, ODataApplicationException
{
   this.hqlPrefix = new StringBuilder(HQL_PREFIX).append(entity.getName()).append(" ").toString();
   this.filterExpression = filter;
   this.orderExpression = order;
   this.hqlParameters = new LinkedList<>();
   compute();
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:10,代码来源:SQLVisitor.java


示例16: visitFilterExpression

import org.apache.olingo.odata2.api.uri.expression.FilterExpression; //导入依赖的package包/类
@Override
public Object visitFilterExpression(FilterExpression filter_expression,
      String expression_string, Object expression)
{
   if (hqlFilter == null)
   {
      this.hqlFilter = (String) expression;
   }
   return hqlFilter;
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:11,代码来源:SQLVisitor.java


示例17: getDeletedProducts

import org.apache.olingo.odata2.api.uri.expression.FilterExpression; //导入依赖的package包/类
public List<DeletedProduct> getDeletedProducts(FilterExpression filter_expr,
      OrderByExpression order_expr, int skip, int top)
      throws ExceptionVisitExpression, ODataApplicationException
{
   DeletedProductSQLVisitor expV = new DeletedProductSQLVisitor(filter_expr, order_expr);
   return deletedProductService.getProducts(expV, skip, top);
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:8,代码来源:OlingoManager.java


示例18: getProducts

import org.apache.olingo.odata2.api.uri.expression.FilterExpression; //导入依赖的package包/类
public List<Product> getProducts(String uuid, FilterExpression filter_expr,
      OrderByExpression order_expr, int skip,
      int top) throws ExceptionVisitExpression, ODataApplicationException
{
   ProductSQLVisitor expV = new ProductSQLVisitor(filter_expr, order_expr);
   return productService.getProducts(expV, uuid, skip, top);
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:8,代码来源:OlingoManager.java


示例19: getProductsNumber

import org.apache.olingo.odata2.api.uri.expression.FilterExpression; //导入依赖的package包/类
public int getProductsNumber(FilterExpression filter_expr)
      throws ExceptionVisitExpression, ODataApplicationException
{
   // if no filter, using a count method with a smart cache
   if (filter_expr == null)
   {
      return productService.count();
   }
   return getProductsNumber(null, filter_expr);
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:11,代码来源:OlingoManager.java


示例20: getUsers

import org.apache.olingo.odata2.api.uri.expression.FilterExpression; //导入依赖的package包/类
public List<User> getUsers(
      FilterExpression filter_expr, OrderByExpression order_expr, int skip,
      int top) throws ExceptionVisitExpression, ODataApplicationException
{
   UserSQLVisitor expV = new UserSQLVisitor(filter_expr, order_expr);
   return userService.getUsers(expV, skip, top);
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:8,代码来源:OlingoManager.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java UserDataHelper类代码示例发布时间:2022-05-22
下一篇:
Java ParticleColor类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap