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

Java Datastore类代码示例

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

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



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

示例1: selectable9

import com.holonplatform.core.datastore.Datastore; //导入依赖的package包/类
public void selectable9() {
	// tag::selectable9[]
	Datastore datastore = obtainDatastore();

	final PathProperty<Long> ID = PathProperty.create("id", Long.class);
	final PathProperty<String> DESCRIPTION = PathProperty.create("description", String.class);

	SingleSelect<Long> singleSelect = Components.input.singleSelect(ID) // <1>
			.dataSource(datastore, DataTarget.named("testData"), PropertySet.of(ID, DESCRIPTION)) // <2>
			.itemCaptionGenerator(propertyBox -> propertyBox.getValue(DESCRIPTION)) // <3>
			.build();

	singleSelect.setValue(Long.valueOf(1)); // <4>
	Long selectedId = singleSelect.getValue(); // <5>

	singleSelect.refresh(); // <6>
	// end::selectable9[]
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:19,代码来源:ExampleSelectable.java


示例2: listing10

import com.holonplatform.core.datastore.Datastore; //导入依赖的package包/类
public void listing10() {
	// tag::listing10[]
	Datastore datastore = getDatastore();

	PropertyListing listing = Components.listing.properties(PROPERTIES) //
			.dataSource(datastore, DataTarget.named("test"), ID) // <1>
			.commitHandler((addedItems, modifiedItems, removedItems) -> { // <2>
				// ...
			}).build();

	final PropertyBox ITEM = PropertyBox.builder(PROPERTIES).set(ID, 777L).set(DESCRIPTION, "A description")
			.build();

	listing.addItem(ITEM); // <3>

	listing.refreshItem(ITEM); // <4>

	listing.removeItem(ITEM); // <5>
	// end::listing10[]
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:21,代码来源:ExampleListing.java


示例3: listing11

import com.holonplatform.core.datastore.Datastore; //导入依赖的package包/类
public void listing11() {
	// tag::listing11[]
	Datastore datastore = getDatastore();

	PropertyListing listing = Components.listing.properties(PROPERTIES) //
			.dataSource(datastore, DataTarget.named("test"), ID) //
			.buffered(true) // <1>
			.build();

	final PropertyBox ITEM = PropertyBox.builder(PROPERTIES).set(ID, 777L).set(DESCRIPTION, "A description")
			.build();

	listing.addItem(ITEM); // <2>
	listing.refreshItem(ITEM); // <3>
	listing.removeItem(ITEM); // <4>

	listing.commit(); // <5>
	listing.discard(); // <6>
	// end::listing11[]
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:21,代码来源:ExampleListing.java


示例4: configureDatastore

import com.holonplatform.core.datastore.Datastore; //导入依赖的package包/类
/**
 * Register {@link DatastoreResolver}s bean into given <code>datastore</code>.
 * @param datastore Datastore
 * @param datastoreBeanName Datastore bean name
 * @param factory BeanFactory
 */
public static void configureDatastore(Datastore datastore, String datastoreBeanName, BeanFactory factory) {
	ObjectUtils.argumentNotNull(datastore, "Null Datastore");
	ObjectUtils.argumentNotNull(datastoreBeanName, "Null Datastore bean name");
	ObjectUtils.argumentNotNull(factory, "Null BeanFactory");

	if (factory instanceof ListableBeanFactory) {
		configureDatastoreResolvers(datastore, datastoreBeanName, (ListableBeanFactory) factory);
		configureDatastoreCommodityFactories(datastore, datastoreBeanName, (ListableBeanFactory) factory);
		configureDatastorePostProcessors(datastore, datastoreBeanName, (ListableBeanFactory) factory);
	} else {
		LOGGER.warn(
				"The BeanFactory [" + factory + "] is not a ListableBeanFactory: skipping Datastore configuration");
	}

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


示例5: configureDatastoreResolvers

import com.holonplatform.core.datastore.Datastore; //导入依赖的package包/类
/**
 * Register {@link DatastoreResolver} annotated beans as <code>datastore</code> {@link ExpressionResolver}s.
 * @param datastore Datastore to configure
 * @param datastoreBeanName Datastore bean name to configure
 * @param beanFactory Bean factory
 */
private static void configureDatastoreResolvers(Datastore datastore, String datastoreBeanName,
		ListableBeanFactory beanFactory) {
	final String[] beanNames = beanFactory.getBeanNamesForAnnotation(DatastoreResolver.class);
	if (beanNames != null && beanNames.length > 0) {
		for (String beanName : beanNames) {
			if (!ExpressionResolver.class.isAssignableFrom(beanFactory.getType(beanName))) {
				throw new BeanNotOfRequiredTypeException(beanName, ExpressionResolver.class,
						beanFactory.getType(beanName));
			}
			DatastoreResolver dr = beanFactory.findAnnotationOnBean(beanName, DatastoreResolver.class);
			String datastoreRef = AnnotationUtils.getStringValue(dr.datastoreBeanName());
			if (datastoreRef == null || datastoreRef.equals(datastoreBeanName)) {
				// register resolver
				ExpressionResolver<?, ?> resolver = (ExpressionResolver<?, ?>) beanFactory.getBean(beanName);
				datastore.addExpressionResolver(resolver);
				LOGGER.debug(() -> "Registered expression resolver [" + resolver.getClass().getName()
						+ "] into Datastore with bean name [" + datastoreBeanName + "]");
			}
		}
	}
}
 
开发者ID:holon-platform,项目名称:holon-core,代码行数:28,代码来源:DatastoreInitializer.java


示例6: projection

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

	Datastore datastore = getDatastore(); // build or obtain a concrete Datastore implementation

	Stream<Integer> values = datastore.query().target(DataTarget.named("testTarget")).stream(PROPERTY); // <1>
	Optional<Integer> value = datastore.query().target(DataTarget.named("testTarget")).findOne(PROPERTY); // <2>
	Stream<PropertyBox> boxes = datastore.query().target(DataTarget.named("testTarget")).stream(PROPERTY,
			ANOTHER_PROPERTY); // <3>
	List<PropertyBox> list = datastore.query().target(DataTarget.named("testTarget")).list(PROPERTY,
			ANOTHER_PROPERTY); // <4>
	Optional<PropertyBox> box = datastore.query().target(DataTarget.named("testTarget")).findOne(PROPERTY,
			ANOTHER_PROPERTY); // <5>
	Optional<Integer> sum = datastore.query().target(DataTarget.named("testTarget")).findOne(PROPERTY.sum()); // <6>
	// end::projection[]
}
 
开发者ID:holon-platform,项目名称:holon-core,代码行数:19,代码来源:ExampleQuery.java


示例7: subquery1

import com.holonplatform.core.datastore.Datastore; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
public void subquery1() {
	// tag::subquery1[]
	Datastore datastore = getDatastore(); // this is supposed to be a relational Datastore implementation

	final DataTarget TARGET1 = DataTarget.named("testTarget1");
	final PathProperty<Integer> PROPERTY1 = TARGET1.property("test", Integer.class);

	final DataTarget TARGET2 = DataTarget.named("testTarget2");
	final PathProperty<Integer> PROPERTY2 = TARGET2.property("test", Integer.class);

	SubQuery<Integer> subQuery = SubQuery.create(datastore).target(TARGET2).filter(PROPERTY1.goe(1))
			.select(PROPERTY1); // <1>

	Stream<Integer> results = datastore.query().target(TARGET1).filter(PROPERTY2.in(subQuery)).stream(PROPERTY2); // <2>
	// end::subquery1[]
}
 
开发者ID:holon-platform,项目名称:holon-core,代码行数:18,代码来源:ExampleQuery.java


示例8: subquery2

import com.holonplatform.core.datastore.Datastore; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
public void subquery2() {
	// tag::subquery2[]
	Datastore datastore = getDatastore(); // this is supposed to be a relational Datastore implementation

	final DataTarget TARGET1 = DataTarget.named("testTarget1");
	final PathProperty<Integer> PROPERTY1 = TARGET1.property("test", Integer.class);

	final DataTarget TARGET2 = DataTarget.named("testTarget2");
	final PathProperty<Integer> PROPERTY2 = TARGET2.property("test", Integer.class);

	Stream<Integer> results = datastore.query().target(TARGET1)
			.filter(SubQuery.create(datastore).target(TARGET2).filter(PROPERTY2.eq(PROPERTY1)).exists())
			.stream(PROPERTY2); // <1>

	results = datastore.query().target(TARGET1)
			.filter(SubQuery.create(datastore).target(TARGET2).filter(PROPERTY2.eq(PROPERTY1)).notExists())
			.stream(PROPERTY2); // <2>
	// end::subquery2[]
}
 
开发者ID:holon-platform,项目名称:holon-core,代码行数:21,代码来源:ExampleQuery.java


示例9: selectable11

import com.holonplatform.core.datastore.Datastore; //导入依赖的package包/类
public void selectable11() {
	// tag::selectable11[]
	Datastore datastore = obtainDatastore();

	final PathProperty<Long> ID = PathProperty.create("id", Long.class);
	final PathProperty<String> DESCRIPTION = PathProperty.create("description", String.class);
	final DataTarget<?> TARGET = DataTarget.named("testData");
	final PropertySet<?> PROPERTIES = PropertySet.of(ID, DESCRIPTION);

	SingleSelect<Long> singleSelect = Components.input.singleSelect(ID)
			.dataSource(datastore, DataTarget.named("testData"), PROPERTIES)
			.itemConverter(
					value -> datastore.query().target(TARGET).filter(ID.eq(value)).findOne(PROPERTIES).orElse(null)) // <1>
			.build();
	// end::selectable11[]
}
 
开发者ID:holon-platform,项目名称:holon-vaadin,代码行数:17,代码来源:ExampleSelectable.java


示例10: target

import com.holonplatform.core.datastore.Datastore; //导入依赖的package包/类
public void target() {
	PropertyBox value = null;
	// tag::target[]
	final QueryDslTarget<Test> TARGET = QueryDslTarget.of(QTest.test); // <1>

	Datastore datastore = getDatastore(); // build or obtain a JPA Datastore

	datastore.refresh(TARGET, value); // <2>
	// end::target[]
}
 
开发者ID:holon-platform,项目名称:holon-datastore-jpa-querydsl,代码行数:11,代码来源:ExampleJpaQueryDsl.java


示例11: property

import com.holonplatform.core.datastore.Datastore; //导入依赖的package包/类
public void property() {
	// tag::property[]
	final QueryDslProperty<Long> ID = QueryDslProperty.of(QTest.test.id); // <1>
	final QueryDslProperty<String> NAME = QueryDslProperty.of(QTest.test.name); // <2>

	Datastore datastore = getDatastore(); // build or obtain a JPA Datastore

	datastore.save(QueryDslTarget.of(QTest.test),
			PropertyBox.builder(ID, NAME).set(ID, 1L).set(NAME, "TestName").build()); // <3>
	// end::property[]
}
 
开发者ID:holon-platform,项目名称:holon-datastore-jpa-querydsl,代码行数:12,代码来源:ExampleJpaQueryDsl.java


示例12: commodity

import com.holonplatform.core.datastore.Datastore; //导入依赖的package包/类
@SuppressWarnings("unused")
public void commodity() {
	// tag::commodity[]
	Datastore datastore = getDatastore(); // build or obtain a JPA Datastore

	QueryDsl queryDslCommodity = datastore.create(QueryDsl.class); // <1>

	JpaQuery<?> query = queryDslCommodity.query(); // <2>
	query = queryDslCommodity.selectFrom(QTest.test); // <3>

	queryDslCommodity.update(QTest.test).set(QTest.test.name, "UpdatedName").where(QTest.test.id.eq(1L)).execute(); // <4>
	queryDslCommodity.delete(QTest.test).where(QTest.test.id.loe(1L)).execute(); // <5>
	// end::commodity[]
}
 
开发者ID:holon-platform,项目名称:holon-datastore-jpa-querydsl,代码行数:15,代码来源:ExampleJpaQueryDsl.java


示例13: query

import com.holonplatform.core.datastore.Datastore; //导入依赖的package包/类
@SuppressWarnings("unused")
public void query() {
	// tag::query[]
	Datastore datastore = getDatastore(); // build or obtain a JPA Datastore

	final PathProperty<Long> ID = QueryDslProperty.of(QTest.test.id); // <1>
	final PathProperty<String> NAME = PathProperty.create("name", String.class); // <2>

	long count = getDatastore().create(QueryDsl.class).query().from(QTest.test)
			.filter(ID.gt(2L).and(NAME.startsWith("n"))).count(); // <3>
	// end::query[]
}
 
开发者ID:holon-platform,项目名称:holon-datastore-jpa-querydsl,代码行数:13,代码来源:ExampleJpaQueryDsl.java


示例14: selectable10

import com.holonplatform.core.datastore.Datastore; //导入依赖的package包/类
public void selectable10() {
	// tag::selectable10[]
	Datastore datastore = obtainDatastore();

	final PathProperty<Long> ID = PathProperty.create("id", Long.class);
	final PathProperty<String> DESCRIPTION = PathProperty.create("description", String.class);

	SingleSelect<Long> singleSelect = Components.input.singleSelect(ID)
			.dataSource(datastore, DataTarget.named("testData"), PropertySet.of(ID, DESCRIPTION)) //
			.withQueryConfigurationProvider(() -> ID.gt(0L)) // <1>
			.itemCaptionGenerator(propertyBox -> propertyBox.getValue(DESCRIPTION)).build();
	// end::selectable10[]
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:14,代码来源:ExampleSelectable.java


示例15: listing3

import com.holonplatform.core.datastore.Datastore; //导入依赖的package包/类
public void listing3() {
	// tag::listing3[]
	Datastore datastore = getDatastore();

	PropertyListing listing = Components.listing.properties(PROPERTIES) //
			.dataSource(datastore, DataTarget.named("test"), ID) // <1>
			.build();
	// end::listing3[]
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:10,代码来源:ExampleListing.java


示例16: DatastoreItemDataProvider

import com.holonplatform.core.datastore.Datastore; //导入依赖的package包/类
/**
 * Construct a new DatastoreItemDataProvider.
 * @param datastore Datastore to use (not null)
 * @param target Data target (not null)
 * @param propertySet Property set to load
 */
public DatastoreItemDataProvider(Datastore datastore, DataTarget<?> target, PropertySet<?> propertySet) {
	super();
	ObjectUtils.argumentNotNull(datastore, "Datastore must be not null");
	ObjectUtils.argumentNotNull(target, "DataTarget must be not null");
	ObjectUtils.argumentNotNull(propertySet, "PropertySet supplier must be not null");
	this.datastore = datastore;
	this.target = target;
	this.propertySet = propertySet;
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:16,代码来源:DatastoreItemDataProvider.java


示例17: DatastoreCommitHandler

import com.holonplatform.core.datastore.Datastore; //导入依赖的package包/类
/**
 * Construct a new DatastoreItemDataProvider.
 * @param datastore Datastore to use (not null)
 * @param target Query target (not null)
 */
public DatastoreCommitHandler(Datastore datastore, DataTarget<?> target) {
	super();
	ObjectUtils.argumentNotNull(datastore, "Datastore must be not null");
	ObjectUtils.argumentNotNull(target, "DataTarget must be not null");
	this.datastore = datastore;
	this.target = target;
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:13,代码来源:DatastoreCommitHandler.java


示例18: dataSource

import com.holonplatform.core.datastore.Datastore; //导入依赖的package包/类
@Override
public GridPropertyListingBuilder dataSource(Datastore datastore, DataTarget<?> dataTarget,
		Property... identifierProperties) {
	commitHandler(new DatastoreCommitHandler(datastore, dataTarget));
	dataSource(new DatastoreItemDataProvider(datastore, dataTarget, PropertySet.of(properties)),
			identifierProperties);
	return builder();
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:9,代码来源:DefaultGridPropertyListingBuilder.java


示例19: dataSource

import com.holonplatform.core.datastore.Datastore; //导入依赖的package包/类
@Override
public TablePropertyListingBuilder dataSource(Datastore datastore, DataTarget<?> dataTarget,
		Property... identifierProperties) {
	commitHandler(new DatastoreCommitHandler(datastore, dataTarget));
	dataSource(new DatastoreItemDataProvider(datastore, dataTarget, PropertySet.of(properties)),
			identifierProperties);
	return builder();
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:9,代码来源:DefaultTablePropertyListingBuilder.java


示例20: dataSource

import com.holonplatform.core.datastore.Datastore; //导入依赖的package包/类
/**
 * Use given {@link Datastore} with given <code>dataTarget</code> as items data source.
 * @param <P> Property type
 * @param datastore Datastore to use (not null)
 * @param dataTarget Data target to use to load items (not null)
 * @param properties Item property set (not null)
 * @return this
 */
default <P extends Property<?>> B dataSource(Datastore datastore, DataTarget<?> dataTarget,
		Iterable<P> properties) {
	ObjectUtils.argumentNotNull(properties, "Properties must be not null");
	return dataSource(
			ItemDataProvider.create(datastore, dataTarget,
					(properties instanceof PropertySet) ? (PropertySet<?>) properties : PropertySet.of(properties)),
			properties);
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:17,代码来源:PropertySelectInputBuilder.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java RemoveCachePoolRequestProto类代码示例发布时间:2022-05-23
下一篇:
Java StdStats类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap