当前位置: 首页>>代码示例>>Java>>正文


Java Order.ASC属性代码示例

本文整理汇总了Java中com.mysema.query.types.Order.ASC属性的典型用法代码示例。如果您正苦于以下问题:Java Order.ASC属性的具体用法?Java Order.ASC怎么用?Java Order.ASC使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.mysema.query.types.Order的用法示例。


在下文中一共展示了Order.ASC属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createOrderSpecifier

/**
 * {@inheritDoc}
 */
@Override
public <T, E extends Comparable<?>> OrderSpecifier<?> createOrderSpecifier(
        PathBuilder<T> entityPath, String fieldName, Class<E> fieldType,
        Order order) {
    OrderSpecifier<?> orderBy = null;

    // Get the OrderSpecifier
    if (order == Order.ASC) {
        orderBy = entityPath.getComparable(fieldName, fieldType).asc();
    }
    else if (order == Order.DESC) {
        orderBy = entityPath.getComparable(fieldName, fieldType).desc();
    }
    return orderBy;
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:18,代码来源:QuerydslUtilsBeanImpl.java

示例2: applyListParams

private <T extends Comparable<? super T>> SQLQuery applyListParams(SQLQuery query, ListQuery listQuery, ComparableExpressionBase<T> orderBy) {
	Order order = listQuery.getOrder();
	Long limit = listQuery.getLimit();
	Long offset = listQuery.getOffset();
	
	if(order != null) {
		if(order == Order.ASC) {
			query = query.orderBy(orderBy.asc());
		} else {
			query = query.orderBy(orderBy.desc());
		}
	}
	
	if(limit != null) {
		query = query.limit(limit);
	}
	
	if(offset != null) {
		query = query.offset(offset);
	}
	
	return query;
}
 
开发者ID:IDgis,项目名称:geo-publisher,代码行数:23,代码来源:PublisherTransaction.java

示例3: createOrderSpecifier

/**
 * Create an order-by-element in a Query instance
 * 
 * @param entityPath Full path to entity and associations. For example:
 *        {@code Pet} , {@code Pet.owner}
 * @param fieldName Property name in the given entity path. For example:
 *        {@code weight} in {@code Pet} entity, {@code age} in
 *        {@code Pet.owner} entity.
 * @param fieldType Property value {@code Class}. Must implements
 *        {@link Comparable}
 * @param order ascending or descending order
 * @return
 */
public static <T, E extends Comparable<?>> OrderSpecifier<?> createOrderSpecifier(
        PathBuilder<T> entityPath, String fieldName, Class<E> fieldType,
        Order order) {
    OrderSpecifier<?> orderBy = null;

    // Get the OrderSpecifier
    if (order == Order.ASC) {
        orderBy = entityPath.getComparable(fieldName, fieldType).asc();
    }
    else if (order == Order.DESC) {
        orderBy = entityPath.getComparable(fieldName, fieldType).desc();
    }
    return orderBy;
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:27,代码来源:QuerydslUtils.java

示例4: addSorting

@SuppressWarnings({ "unchecked", "rawtypes" })
protected void addSorting(ExtDirectStoreReadRequest request, JPQLQuery query,
		PathBuilder<?> pathBuilder) {

	Class<?> clazz = getTypeClass();

	if (!request.getSorters().isEmpty()) {
		for (SortInfo sortInfo : request.getSorters()) {

			Order order;
			if (sortInfo.getDirection() == SortDirection.ASCENDING) {
				order = Order.ASC;
			}
			else {
				order = Order.DESC;
			}

			Field field = ReflectionUtils.findField(clazz, sortInfo.getProperty());
			SortProperty sortProperty = field.getAnnotation(SortProperty.class);

			if (sortProperty != null) {
				String[] splittedValue = sortProperty.value().split("\\.");
				field = ReflectionUtils.findField(clazz, splittedValue[0]);
				PathBuilder path = new PathBuilder(field.getType(), splittedValue[0]);
				query.leftJoin(pathBuilder.get(splittedValue[0]), path);
				query.orderBy(new OrderSpecifier(order, path.get(splittedValue[1])));
			}
			else {
				query.orderBy(new OrderSpecifier(order, pathBuilder.get(sortInfo
						.getProperty())));
			}

		}
	}
}
 
开发者ID:khun777,项目名称:edsutil,代码行数:35,代码来源:BaseCRUDService.java

示例5: createOrderSpecifiers

@SuppressWarnings({ "rawtypes", "unchecked" })
public static OrderSpecifier[] createOrderSpecifiers(
		ExtDirectStoreReadRequest request, Class<?> clazz,
		EntityPathBase<?> entityPathBase, Map<String, String> mapGuiColumn2Dbfield,
		Set<String> sortIgnoreProperties) {

	List<OrderSpecifier> orders;

	if (!request.getSorters().isEmpty()) {
		orders = new ArrayList<>();
		PathBuilder<?> entityPath = new PathBuilder<>(clazz,
				entityPathBase.getMetadata());
		for (SortInfo sortInfo : request.getSorters()) {

			if (!sortIgnoreProperties.contains(sortInfo.getProperty())) {
				Order order;
				if (sortInfo.getDirection() == SortDirection.ASCENDING) {
					order = Order.ASC;
				}
				else {
					order = Order.DESC;
				}

				String property = mapGuiColumn2Dbfield.get(sortInfo.getProperty());
				if (property == null) {
					property = sortInfo.getProperty();
				}

				orders.add(new OrderSpecifier(order, entityPath.get(property)));
			}
		}

	}
	else {
		orders = Collections.emptyList();
	}

	return orders.toArray(new OrderSpecifier[orders.size()]);
}
 
开发者ID:khun777,项目名称:edsutil,代码行数:39,代码来源:QueryUtil.java

示例6: sort

public void sort(OrderSpecifier<?>... order) {
    Object[] propertyId = new Object[order.length];
    boolean[] ascending = new boolean[order.length];
    for (int i = 0; i < order.length; i++) {
        propertyId[i] = ((Path)order[i].getTarget()).getMetadata().getName();
        ascending[i] = order[i].getOrder() == Order.ASC;
    }
    super.sort(propertyId, ascending);
}
 
开发者ID:mysema,项目名称:vaadin-querydsl-prototype,代码行数:9,代码来源:QuerydslJPAContainer.java

示例7: getOrderSpecifier

@SuppressWarnings("unchecked")
private Optional<OrderSpecifier> getOrderSpecifier(QueryParameters parameters, Expression<?>... args) {
	final String sortColumn = parameters.getSortColumn();
	final String sortDirection = parameters.getSortDirection();
	if (StringUtils.hasText(sortColumn) && StringUtils.hasText(sortDirection)) {
		Order order = (Sort.Direction.ASC.compareTo(pageableFactory.getDirection(sortDirection)) == 0) ? Order.ASC : Order.DESC;
		return Optional.of(new OrderSpecifier(order, new EntityPathBase(args[0].getType(), suppressUniquePrefixIfAny(sortColumn))));
	}
	return Optional.absent();
}
 
开发者ID:fernaspiazu,项目名称:recruiting-old-style,代码行数:10,代码来源:PaginationServiceImpl.java

示例8: transformOrder

private <T extends Comparable> OrderSpecifier<T> transformOrder(QueryOrder<T> queryOrder) {
    return new OrderSpecifier<>(queryOrder.isAsc() ? Order.ASC : Order.DESC, queryOrder.getTarget());
}
 
开发者ID:encircled,项目名称:Joiner,代码行数:3,代码来源:Joiner.java


注:本文中的com.mysema.query.types.Order.ASC属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。