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

Java OrderByExpression类代码示例

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

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



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

示例1: visitOrderByExpression

import org.apache.olingo.odata2.api.uri.expression.OrderByExpression; //导入依赖的package包/类
@Override
public Object visitOrderByExpression(OrderByExpression order_expression,
      String expression_string, List<Object> orders)
{
   if (hqlOrder == null)
   {
      StringBuilder sb = new StringBuilder();
      Iterator<Object> it = orders.iterator();
      while (it.hasNext())
      {
         String order = (String) it.next();
         sb.append(order);
         if (it.hasNext())
         {
            sb.append(", ");
         }
      }
      hqlOrder = sb.toString();
   }
   return hqlOrder;
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:22,代码来源:SQLVisitor.java


示例2: visitOrderByExpression

import org.apache.olingo.odata2.api.uri.expression.OrderByExpression; //导入依赖的package包/类
@Override
public Object visitOrderByExpression(OrderByExpression orderByExpression, String expressionString, List<Object> orders) {
  StringBuilder buffer = new StringBuilder();
  
  for(Object order : orders) {
    if (buffer.length() > 0) {
      buffer.append(",");
    }
    buffer.append(order);
  }
  
  if (buffer.length() > 0) {
    buffer.insert(0, " order by ");
  }
  
  return buffer.toString();
}
 
开发者ID:SAP,项目名称:SAPJamWorkPatternJIRAIntegration,代码行数:18,代码来源:IssueFilter.java


示例3: getProducts

import org.apache.olingo.odata2.api.uri.expression.OrderByExpression; //导入依赖的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


示例4: getUsers

import org.apache.olingo.odata2.api.uri.expression.OrderByExpression; //导入依赖的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


示例5: readOrder

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

  OrderByExpression exp = UriParserImpl.parseOrderBy(edm, edm.getEntityType("RefScenario", "Room"), "Name");
  Mockito.when(uriInfo.getOrderBy()).thenReturn(exp);

  List<Room> results = createRooms(1, 10);
  Collections.reverse(results);
  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(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,代码行数:23,代码来源:DataSourceProcessorTest.java


示例6: optimizedReadOrder

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

  OrderByExpression exp = UriParserImpl.parseOrderBy(edm, edm.getEntityType("RefScenario", "Room"), "Name");
  Mockito.when(uriInfo.getOrderBy()).thenReturn(exp);

  List<Room> results = createRooms(1, 10);
  Collections.shuffle(results);
  ReadResult<Room> readResult = ReadResult.forResult(results).orderApplied().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,代码行数:23,代码来源:DataSourceProcessorTest.java


示例7: visitOrderByExpression

import org.apache.olingo.odata2.api.uri.expression.OrderByExpression; //导入依赖的package包/类
@Override
public Object visitOrderByExpression(final OrderByExpression orderByExpression, final String expressionString,
    final List<Object> orders) {
  try {
    StringWriter writer = new StringWriter();
    JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
    jsonStreamWriter.beginObject().namedStringValueRaw("nodeType", "order collection").separator().name("orders")
        .beginArray();
    boolean first = true;
    for (final Object order : orders) {
      if (first) {
        first = false;
      } else {
        jsonStreamWriter.separator();
      }
      jsonStreamWriter.unquotedValue(order.toString());
    }
    jsonStreamWriter.endArray().endObject();
    writer.flush();
    return writer.toString();
  } catch (final IOException e) {
    return null;
  }
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:25,代码来源:JsonVisitor.java


示例8: visitOrderByExpression

import org.apache.olingo.odata2.api.uri.expression.OrderByExpression; //导入依赖的package包/类
@Override
public Object visitOrderByExpression(final OrderByExpression orderByExpression, final String expressionString,
    final List<Object> orders) {
  StringBuilder sb = new StringBuilder();
  sb.append("{");
  sb.append("oc");

  sb.append("(");
  for (int i = 0; i < orders.size(); i++) {
    if (i != 0) {
      sb.append(",");
    }
    sb.append(orders.get(i));
  }

  sb.append(")}");

  return sb.toString();
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:20,代码来源:VisitorTool.java


示例9: UserMap

import org.apache.olingo.odata2.api.uri.expression.OrderByExpression; //导入依赖的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


示例10: CollectionProductsMap

import org.apache.olingo.odata2.api.uri.expression.OrderByExpression; //导入依赖的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


示例11: ProductsMap

import org.apache.olingo.odata2.api.uri.expression.OrderByExpression; //导入依赖的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


示例12: CollectionMap

import org.apache.olingo.odata2.api.uri.expression.OrderByExpression; //导入依赖的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


示例13: DeletedProductsMap

import org.apache.olingo.odata2.api.uri.expression.OrderByExpression; //导入依赖的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


示例14: SQLVisitor

import org.apache.olingo.odata2.api.uri.expression.OrderByExpression; //导入依赖的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


示例15: getDeletedProducts

import org.apache.olingo.odata2.api.uri.expression.OrderByExpression; //导入依赖的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


示例16: getProducts

import org.apache.olingo.odata2.api.uri.expression.OrderByExpression; //导入依赖的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


示例17: getUsers

import org.apache.olingo.odata2.api.uri.expression.OrderByExpression; //导入依赖的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


示例18: visitOrderByExpression

import org.apache.olingo.odata2.api.uri.expression.OrderByExpression; //导入依赖的package包/类
@Override
public Object visitOrderByExpression(OrderByExpression orderby, String exp, List<Object> orders)
{
   final ExecutableExpressionTree.Node node = (ExecutableExpressionTree.Node) (orders.get(0));

   return new Comparator()
   {
      @Override
      public int compare(Object o1, Object o2)
      {
         return (Integer) node.exec(new Duo<>(o1, o2));
      }
   };
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:15,代码来源:FunctionalVisitor.java


示例19: visitOrderByExpression

import org.apache.olingo.odata2.api.uri.expression.OrderByExpression; //导入依赖的package包/类
@Override
public Object visitOrderByExpression(OrderByExpression order_expression,
      String expression_string, List<Object> orders)
{
   for (Object object: orders)
   {
      Order order = Order.class.cast(object);
      criteria.addOrder(order);
   }
   return criteria;
}
 
开发者ID:SentinelDataHub,项目名称:DataHubSystem,代码行数:12,代码来源:SQLVisitor.java


示例20: sort

import org.apache.olingo.odata2.api.uri.expression.OrderByExpression; //导入依赖的package包/类
private <T> void sort(final List<T> data, final OrderByExpression orderBy) {
  Collections.sort(data, new Comparator<T>() {
    @Override
    public int compare(final T entity1, final T entity2) {
      try {
        int result = 0;
        for (final OrderExpression expression : orderBy.getOrders()) {
          String first = evaluateExpression(entity1, expression.getExpression());
          String second = evaluateExpression(entity2, expression.getExpression());

          if (first != null && second != null) {
            result = first.compareTo(second);
          } else if (first == null && second != null) {
            result = 1;
          } else if (first != null && second == null) {
            result = -1;
          }

          if (expression.getSortOrder() == SortOrder.desc) {
            result = -result;
          }

          if (result != 0) {
            break;
          }
        }
        return result;
      } catch (final ODataException e) {
        return 0;
      }
    }
  });
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:34,代码来源:ListsProcessor.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java GraphAlgoFactory类代码示例发布时间:2022-05-22
下一篇:
Java ParameterExpression类代码示例发布时间: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