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


Java Order类代码示例

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


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

示例1: createOrderSpecifier

import com.mysema.query.types.Order; //导入依赖的package包/类
/**
 * {@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,代码行数:19,代码来源:QuerydslUtilsBeanImpl.java

示例2: applyListParams

import com.mysema.query.types.Order; //导入依赖的package包/类
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,代码行数:24,代码来源:PublisherTransaction.java

示例3: createOrderSpecifier

import com.mysema.query.types.Order; //导入依赖的package包/类
/**
 * 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,代码行数:28,代码来源:QuerydslUtils.java

示例4: addSorting

import com.mysema.query.types.Order; //导入依赖的package包/类
@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,代码行数:36,代码来源:BaseCRUDService.java

示例5: createOrderSpecifiers

import com.mysema.query.types.Order; //导入依赖的package包/类
@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,代码行数:40,代码来源:QueryUtil.java

示例6: sort

import com.mysema.query.types.Order; //导入依赖的package包/类
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,代码行数:10,代码来源:QuerydslJPAContainer.java

示例7: GetNotifications

import com.mysema.query.types.Order; //导入依赖的package包/类
public GetNotifications (
		final Order order, 
		final Long offset, 
		final Long limit, 
		final boolean includeRejected, 
		final Timestamp since) {
	
	super (order, offset, limit);
	
	this.includeRejected = includeRejected;
	this.since = since;
}
 
开发者ID:IDgis,项目名称:geo-publisher,代码行数:13,代码来源:GetNotifications.java

示例8: getOrderSpecifier

import com.mysema.query.types.Order; //导入依赖的package包/类
@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,代码行数:11,代码来源:PaginationServiceImpl.java

示例9: transformOrder

import com.mysema.query.types.Order; //导入依赖的package包/类
private <T extends Comparable> OrderSpecifier<T> transformOrder(QueryOrder<T> queryOrder) {
    return new OrderSpecifier<>(queryOrder.isAsc() ? Order.ASC : Order.DESC, queryOrder.getTarget());
}
 
开发者ID:encircled,项目名称:Joiner,代码行数:4,代码来源:Joiner.java

示例10: ListQuery

import com.mysema.query.types.Order; //导入依赖的package包/类
public ListQuery(Order order, Long offset, Long limit) {
	this.offset = offset;
	this.limit = limit;
	this.order = order;
}
 
开发者ID:IDgis,项目名称:geo-publisher,代码行数:6,代码来源:ListQuery.java

示例11: getOrder

import com.mysema.query.types.Order; //导入依赖的package包/类
public Order getOrder() {
	return order;
}
 
开发者ID:IDgis,项目名称:geo-publisher,代码行数:4,代码来源:ListQuery.java

示例12: GetJobLog

import com.mysema.query.types.Order; //导入依赖的package包/类
public GetJobLog(Order order, Set<LogLevel> logLevels) {
	this(order, logLevels, null);
}
 
开发者ID:IDgis,项目名称:geo-publisher,代码行数:4,代码来源:GetJobLog.java

示例13: handleListActiveNotifications

import com.mysema.query.types.Order; //导入依赖的package包/类
private CompletableFuture<Page<Notification>> handleListActiveNotifications (final ListActiveNotifications listNotifications) {
	final long page = listNotifications.getPage () != null ? Math.max (1, listNotifications.getPage ()) : 1;
	final long limit = listNotifications.getLimit () != null ? Math.max (1, listNotifications.getLimit ()) : DEFAULT_ITEMS_PER_PAGE;
	final long offset = Math.max (0, (page - 1) * limit);
	
	final CompletableFuture<List<Notification>> importNotificationsFuture = 
		f.ask(
			database, 
			new GetNotifications(
				Order.DESC,
				offset,
				limit,
				listNotifications.isIncludeRejected(),
				listNotifications.getSince()),
			InfoList.class)
				.thenApply(storedNotifications ->
					((InfoList<StoredNotification>)storedNotifications).getList().stream()
						.map(this::createNotification)
						.collect(Collectors.toList()));
	
	final CompletableFuture<List<Notification>> harvestNotificationsFuture = db.query().from(harvestNotification)
		.join(sourceDatasetVersion).on(sourceDatasetVersion.id.eq(harvestNotification.sourceDatasetVersionId))
		.join(sourceDataset).on(sourceDataset.id.eq(harvestNotification.sourceDatasetId))
		.where(harvestNotification.done.eq(false))
		.orderBy(harvestNotification.createTime.desc())
		.list(harvestNotification.id, harvestNotification.notificationType, 
				harvestNotification.sourceDatasetId, sourceDataset.identification, sourceDatasetVersion.name)
		.thenApply(typedList -> {
			List<Tuple> listTuple = typedList.list().stream().collect(Collectors.toList());
			
			return listTuple.stream()
				.limit(limit)
				.map(t ->
					new Notification("" + t.get(harvestNotification.id),
						new Message(
								HarvestNotificationType.getHarvestNotificationType
									(t.get(harvestNotification.notificationType)),
							new NotificationProperties(
								EntityType.SOURCE_DATASET,
								t.get(sourceDataset.identification),
								t.get(sourceDatasetVersion.name),
								null,
								null))))
			.collect(Collectors.toList());
		});
	
	return 
		importNotificationsFuture.thenCompose(importNotifications -> 
		harvestNotificationsFuture.thenApply(harvestNotifications -> {
		
		final Page.Builder<Notification> dashboardNotifications = new Page.Builder<Notification>();
		
		dashboardNotifications.addAll(harvestNotifications);
		dashboardNotifications.addAll(importNotifications);
		
		// Paging:
		long count = importNotifications.size() + harvestNotifications.size();
		long pages = count / limit + Math.min(1, count % limit);
		
		if(pages > 1) {
			dashboardNotifications
				.setHasMorePages(true)
				.setPageCount(pages)
				.setCurrentPage(page);
		}
		
		return dashboardNotifications.build();
	}));
}
 
开发者ID:IDgis,项目名称:geo-publisher,代码行数:70,代码来源:DatasetAdmin.java

示例14: handleListIssues

import com.mysema.query.types.Order; //导入依赖的package包/类
private CompletableFuture<Page<Issue>> handleListIssues (final ListIssues listIssues) {
	log.debug("handleListIssues logLevels=" + listIssues.getLogLevels () + ", since=" + listIssues.getSince () + ", page=" + listIssues.getPage () + ", limit=" + listIssues.getLimit ());
	
	final Long page = listIssues.getPage () != null ? Math.max (1, listIssues.getPage ()) : 1;
	final long limit = listIssues.getLimit () != null ? Math.max (1, listIssues.getLimit ()) : DEFAULT_ITEMS_PER_PAGE;
	final long offset = Math.max (0, (page - 1) * limit);
	
	final CompletableFuture<Object> issues = f.ask (database, new GetJobLog (Order.DESC, offset, limit, listIssues.getLogLevels (), listIssues.getSince ()));
	
	return issues.thenApply(msg -> {
		final Page.Builder<Issue> dashboardIssues = new Page.Builder<Issue>();
		
		@SuppressWarnings("unchecked")
		InfoList<StoredJobLog> jobLogs = (InfoList<StoredJobLog>)msg;
		for(StoredJobLog jobLog : jobLogs.getList ()) {
			JobInfo job = jobLog.getJob();
			
			MessageType<?> type = jobLog.getType();
			
			dashboardIssues.add(
				new Issue(
					"" + job.getId(),
					new Message(
						type,
						jobLog.getContent ()
					),
					jobLog.getLevel(),
					job.getJobType(),
					jobLog.getWhen ()
				)
			);
			
		}

		// Paging:
		long count = jobLogs.getCount();
		long pages = count / limit + Math.min(1, count % limit);
		
		if(pages > 1) {
			dashboardIssues
				.setHasMorePages(true)
				.setPageCount(pages)
				.setCurrentPage(page);
		}
		
		return dashboardIssues.build();
	});	
}
 
开发者ID:IDgis,项目名称:geo-publisher,代码行数:49,代码来源:Admin.java

示例15: createOrderSpecifier

import com.mysema.query.types.Order; //导入依赖的package包/类
/**
 * 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 <T, E extends Comparable<?>> OrderSpecifier<?> createOrderSpecifier(
        PathBuilder<T> entityPath, String fieldName, Class<E> fieldType,
        Order order);
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:17,代码来源:QuerydslUtilsBean.java


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