本文整理汇总了Java中org.apache.olingo.odata2.api.uri.expression.OrderByExpression类的典型用法代码示例。如果您正苦于以下问题:Java OrderByExpression类的具体用法?Java OrderByExpression怎么用?Java OrderByExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OrderByExpression类属于org.apache.olingo.odata2.api.uri.expression包,在下文中一共展示了OrderByExpression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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();
}
示例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);
}
示例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);
}
示例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"));
}
示例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"));
}
示例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;
}
}
示例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();
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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);
}