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

Java QuerySort类代码示例

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

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



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

示例1: buildQuery

import com.holonplatform.core.query.QuerySort; //导入依赖的package包/类
/**
 * Build a {@link Query} using the Datastore and configuring query filters and sorts.
 * @param configuration Query configuration
 * @param withSorts Whether to apply sorts, if any, to query
 * @return Query instance
 */
protected Query buildQuery(QueryConfigurationProvider configuration, boolean withSorts) {
	Query q = getDatastore().query();
	// target
	if (getTarget() != null) {
		q.target(getTarget());
	}
	// filter
	QueryFilter filter = configuration.getQueryFilter();
	if (filter != null) {
		q.filter(filter);
	}
	// sort
	if (withSorts) {
		QuerySort sort = configuration.getQuerySort();
		if (sort != null) {
			q.sort(sort);
		}
	}
	// parameters
	ParameterSet parameters = configuration.getQueryParameters();
	if (parameters != null) {
		parameters.forEachParameter((n, v) -> q.parameter(n, v));
	}
	return q;
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:32,代码来源:DatastoreItemDataProvider.java


示例2: testQueryDefinition

import com.holonplatform.core.query.QuerySort; //导入依赖的package包/类
@Test
public void testQueryDefinition() {

	DefaultQueryDefinition qd = new DefaultQueryDefinition();
	qd.setTarget(DataTarget.named("target"));

	assertTrue(qd.getTarget().isPresent());
	assertEquals("target", qd.getTarget().get().getName());

	qd.setLimit(Integer.valueOf(10));
	qd.setOffset(Integer.valueOf(20));

	assertTrue(qd.getLimit().isPresent());
	assertTrue(qd.getLimit().isPresent());
	assertEquals(new Integer(10), qd.getLimit().get());
	assertEquals(new Integer(20), qd.getOffset().get());

	qd.addFilter(TestPropertySet.NAME.isNotNull());
	assertTrue(qd.getFilter().isPresent());

	QuerySort qs = TestPropertySet.NAME.asc();
	qd.addSort(qs);
	assertEquals(qs, qd.getSort().get());

}
 
开发者ID:holon-platform,项目名称:holon-core,代码行数:26,代码来源:TestQuery.java


示例3: getConfiguration

import com.holonplatform.core.query.QuerySort; //导入依赖的package包/类
protected QueryConfigurationProvider getConfiguration(final Query<ITEM, QueryFilter> query) {
	final QueryFilter filter = query.getFilter().orElse(null);

	final List<QuerySort> sorts = new LinkedList<>();
	List<QuerySortOrder> orders = query.getSortOrders();
	if (orders != null && !orders.isEmpty()) {
		orders.forEach(o -> sorts.add(fromOrder(o)));
	}
	final QuerySort sort = getSort(sorts);

	return new QueryConfigurationProvider() {

		@Override
		public QueryFilter getQueryFilter() {
			return filter;
		}

		@Override
		public QuerySort getQuerySort() {
			return sort;
		}

	};
}
 
开发者ID:holon-platform,项目名称:holon-vaadin,代码行数:25,代码来源:ItemDataProviderAdapter.java


示例4: sort1

import com.holonplatform.core.query.QuerySort; //导入依赖的package包/类
public void sort1() {
	// tag::sort1[]
	final PathProperty<String> PROPERTY = PathProperty.create("test", String.class);
	final PathProperty<String> ANOTHER_PROPERTY = PathProperty.create("another", String.class);

	QuerySort sort = QuerySort.asc(PROPERTY); // sort ASCENDING on given property
	sort = QuerySort.desc(PROPERTY); // sort DESCENDING on given property

	QuerySort sort2 = QuerySort.of(ANOTHER_PROPERTY, SortDirection.ASCENDING); // sort ASCENDING on given property
	sort2 = QuerySort.of(ANOTHER_PROPERTY, true); // sort ASCENDING on given property

	QuerySort.of(sort, sort2); // sort using 'sort' and 'sort2' declarations, in the given order
	// end::sort1[]
}
 
开发者ID:holon-platform,项目名称:holon-core,代码行数:15,代码来源:ExampleQuery.java


示例5: sort2

import com.holonplatform.core.query.QuerySort; //导入依赖的package包/类
public void sort2() {
	// tag::sort2[]
	final PathProperty<String> PROPERTY = PathProperty.create("test", String.class);
	final PathProperty<String> ANOTHER_PROPERTY = PathProperty.create("another", String.class);

	QuerySort sort = PROPERTY.asc(); // sort ASCENDING on given property
	sort = PROPERTY.desc(); // sort DESCENDING on given property

	PROPERTY.asc().and(ANOTHER_PROPERTY.desc()); // sort ASCENDING on PROPERTY, than sort DESCENDING on
													// ANOTHER_PROPERTY
	// end::sort2[]
}
 
开发者ID:holon-platform,项目名称:holon-core,代码行数:13,代码来源:ExampleQuery.java


示例6: flattenQuerySorts

import com.holonplatform.core.query.QuerySort; //导入依赖的package包/类
/**
 * "flatten" QuerySorts declaration into an ordered List of simple QuerySort
 * @param sorts QuerySorts
 * @return Flattened QuerySort
 */
private static List<QuerySort> flattenQuerySorts(List<QuerySort> sorts) {
	List<QuerySort> flatten = new LinkedList<>();
	if (sorts != null) {
		for (QuerySort sort : sorts) {
			if (sort instanceof CompositeQuerySort) {
				flatten.addAll(flattenQuerySorts(((CompositeQuerySort) sort).getComposition()));
			} else {
				flatten.add(sort);
			}
		}
	}
	return flatten;
}
 
开发者ID:holon-platform,项目名称:holon-core,代码行数:19,代码来源:QueryUtils.java


示例7: MultiSort

import com.holonplatform.core.query.QuerySort; //导入依赖的package包/类
/**
 * Constructor with initial value
 * @param sorts Build MultiSort including this sorts list as initial value
 */
public MultiSort(List<? extends QuerySort> sorts) {
	super();
	this.sorts = new LinkedList<>();
	if (sorts != null) {
		this.sorts.addAll(sorts);
	}
}
 
开发者ID:holon-platform,项目名称:holon-core,代码行数:12,代码来源:MultiSort.java


示例8: toString

import com.holonplatform.core.query.QuerySort; //导入依赖的package包/类
@Override
public String toString() {
	StringBuilder sb = new StringBuilder();
	sb.append("MultiSort of " + sorts.size() + " sorts");
	if (!sorts.isEmpty()) {
		sb.append(" [");
		for (QuerySort sort : sorts) {
			sb.append(sort);
			sb.append(" ");
		}
		sb.append("]");
	}
	return sb.toString();
}
 
开发者ID:holon-platform,项目名称:holon-core,代码行数:15,代码来源:MultiSort.java


示例9: addSort

import com.holonplatform.core.query.QuerySort; //导入依赖的package包/类
/**
 * Add a sort to query. If any sort was present, sort will be appended in specified order
 * @param sort Sort to add
 */
@Override
public void addSort(QuerySort sort) {
	ObjectUtils.argumentNotNull(sort, "QuerySort must be not null");
	if (this.sort == null) {
		this.sort = sort;
	} else {
		this.sort = this.sort.and(sort);
	}
}
 
开发者ID:holon-platform,项目名称:holon-core,代码行数:14,代码来源:DefaultQueryDefinition.java


示例10: fromOrder

import com.holonplatform.core.query.QuerySort; //导入依赖的package包/类
private static QuerySort fromOrder(PropertySet<?> set, QuerySortOrder order) {
	Path<?> path = getPathByName(set, order.getSorted()).orElseThrow(() -> new IllegalArgumentException(
			"No property of the set matches with sort name: " + order.getSorted()));
	SortDirection direction = (order.getDirection() != null
			&& order.getDirection() == com.vaadin.shared.data.sort.SortDirection.DESCENDING)
					? SortDirection.DESCENDING : SortDirection.ASCENDING;
	return QuerySort.of(path, direction);
}
 
开发者ID:holon-platform,项目名称:holon-vaadin,代码行数:9,代码来源:DefaultDatastoreDataProvider.java


示例11: fromOrder

import com.holonplatform.core.query.QuerySort; //导入依赖的package包/类
private static QuerySort fromOrder(QuerySortOrder order, Iterable<?> properties) {
	return getPropertyPath(order.getSorted(), properties).map(path -> QuerySort.of(path,
			(order.getDirection() != null
					&& order.getDirection() == com.vaadin.shared.data.sort.SortDirection.DESCENDING)
							? SortDirection.DESCENDING : SortDirection.ASCENDING))
			.orElse(null);
}
 
开发者ID:holon-platform,项目名称:holon-vaadin,代码行数:8,代码来源:DefaultItemDataSource.java


示例12: fromOrder

import com.holonplatform.core.query.QuerySort; //导入依赖的package包/类
private QuerySort fromOrder(QuerySortOrder order) {
	final SortDirection direction = (order.getDirection() != null
			&& order.getDirection() == com.vaadin.shared.data.sort.SortDirection.DESCENDING)
					? SortDirection.DESCENDING : SortDirection.ASCENDING;

	return getConfiguration().flatMap(cfg -> getSortUsingConfiguration(order.getSorted(), direction, cfg))
			.orElse(getSortFromOrder(order, direction));
}
 
开发者ID:holon-platform,项目名称:holon-vaadin,代码行数:9,代码来源:ItemDataProviderAdapter.java


示例13: getSort

import com.holonplatform.core.query.QuerySort; //导入依赖的package包/类
private static QuerySort getSort(List<QuerySort> sorts) {
	if (!sorts.isEmpty()) {
		if (sorts.size() == 1) {
			return sorts.get(0);
		} else {
			return QuerySort.of(sorts);
		}
	}
	return null;
}
 
开发者ID:holon-platform,项目名称:holon-vaadin,代码行数:11,代码来源:ItemDataProviderAdapter.java


示例14: sortUsing

import com.holonplatform.core.query.QuerySort; //导入依赖的package包/类
@Override
public B sortUsing(P property, final Path<?> sortPath) {
	ObjectUtils.argumentNotNull(property, "Property must be not null");
	dataSourceBuilder.sortable(property, true);
	dataSourceBuilder.withPropertySortGenerator(property, (p, asc) -> QuerySort.of(sortPath, asc));
	return builder();
}
 
开发者ID:holon-platform,项目名称:holon-vaadin,代码行数:8,代码来源:AbstractItemListingBuilder.java


示例15: setFixedSort

import com.holonplatform.core.query.QuerySort; //导入依赖的package包/类
@Override
public void setFixedSort(QuerySort sort) {
	this.fixedSort = sort;
	// reset store
	resetStorePreservingFreezeState();
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:7,代码来源:DefaultItemDataSourceContainer.java


示例16: setDefaultSort

import com.holonplatform.core.query.QuerySort; //导入依赖的package包/类
@Override
public void setDefaultSort(QuerySort sort) {
	this.defaultSort = sort;
	// reset store
	resetStorePreservingFreezeState();
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:7,代码来源:DefaultItemDataSourceContainer.java


示例17: fixedSort

import com.holonplatform.core.query.QuerySort; //导入依赖的package包/类
@Override
public B fixedSort(QuerySort sort) {
	container.setFixedSort(sort);
	return builder();
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:6,代码来源:AbstractItemDataSourceContainerBuilder.java


示例18: defaultSort

import com.holonplatform.core.query.QuerySort; //导入依赖的package包/类
@Override
public B defaultSort(QuerySort sort) {
	container.setDefaultSort(sort);
	return builder();
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:6,代码来源:AbstractItemDataSourceContainerBuilder.java


示例19: sortUsing

import com.holonplatform.core.query.QuerySort; //导入依赖的package包/类
@Override
public B sortUsing(P property, final Path<?> sortPath) {
	ObjectUtils.argumentNotNull(property, "Property must be not null");
	dataSourceBuilder.withPropertySortGenerator(property, (p, asc) -> QuerySort.of(sortPath, asc));
	return builder();
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:7,代码来源:AbstractItemListingBuilder.java


示例20: fixedSort

import com.holonplatform.core.query.QuerySort; //导入依赖的package包/类
@Override
public B fixedSort(QuerySort sort) {
	dataSourceBuilder.fixedSort(sort);
	return builder();
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:6,代码来源:AbstractItemListingBuilder.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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