本文整理汇总了Java中org.example.domain.Customer类的典型用法代码示例。如果您正苦于以下问题:Java Customer类的具体用法?Java Customer怎么用?Java Customer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Customer类属于org.example.domain包,在下文中一共展示了Customer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: allOptions
import org.example.domain.Customer; //导入依赖的package包/类
@Test
public void allOptions() {
TextSimple options = new TextSimple()
.analyzer("whitespace")
.analyzeWildcard(true)
.fields("name")
.lenient(true)
.locale("EN")
.lowercaseExpandedTerms(false)
.minShouldMatch("1")
.opAnd();
Query<Customer> query = server.find(Customer.class)
.text()
.textSimple("quick brown", options)
.query();
List<Customer> list = query.findList();
assertThat(list).hasSize(0);
assertEquals(query.getGeneratedSql(), "{\"query\":{\"simple_query_string\":{\"query\":\"quick brown\",\"analyzer\":\"whitespace\",\"fields\":[\"name\"],\"default_operator\":\"and\",\"lowercase_expanded_terms\":false,\"analyze_wildcard\":true,\"locale\":\"EN\",\"lenient\":true,\"minimum_should_match\":\"1\"}}}");
}
开发者ID:ebean-orm,项目名称:ebean-elastic,代码行数:23,代码来源:QueryTextSimpleTest.java
示例2: multiMatch_with_allOptions
import org.example.domain.Customer; //导入依赖的package包/类
@Test
public void multiMatch_with_allOptions() {
MultiMatch match = MultiMatch.fields("name", "smallNotes")
.opAnd()
.boost(2)
.minShouldMatch("1")
.analyzer("whitespace")
.cutoffFrequency(2)
.maxExpansions(10)
.tieBreaker(0.3)
.type(MultiMatch.Type.CROSS_FIELDS)
.zeroTerms("all");
Query<Customer> query = server.find(Customer.class)
.text()
.multiMatch("Rob", match)
.query();
List<Customer> list = query.findList();
assertEquals(query.getGeneratedSql(), "{\"query\":{\"multi_match\":{\"query\":\"Rob\",\"fields\":[\"name\",\"smallNotes\"],\"type\":\"cross_fields\",\"tie_breaker\":0.3,\"max_expansions\":10,\"operator\":\"and\",\"boost\":2.0,\"cutoff_frequency\":2.0,\"minimum_should_match\":\"1\",\"zero_terms_query\":\"all\",\"analyzer\":\"whitespace\"}}}");
assertThat(list).hasSize(0);
}
开发者ID:ebean-orm,项目名称:ebean-elastic,代码行数:25,代码来源:QueryMultiMatchTest.java
示例3: matchAllPhraseOptions
import org.example.domain.Customer; //导入依赖的package包/类
@Test
public void matchAllPhraseOptions() {
Match options = new Match().opAnd().phrase()
.analyzer("whitespace")
.boost(2)
.cutoffFrequency(1)
.minShouldMatch("50%")
.zeroTerms("all")
.maxExpansions(3) // maxExpansions is for phrasePrefix only
.phrase();
Query<Customer> query = server.find(Customer.class)
.text()
.match("name", "Cust DoesNotExist", options)
.query();
List<Customer> list = query.findList();
assertEquals(query.getGeneratedSql(), "{\"query\":{\"match\":{\"name\":{\"query\":\"Cust DoesNotExist\",\"operator\":\"and\",\"boost\":2.0,\"cutoff_frequency\":1.0,\"minimum_should_match\":\"50%\",\"zero_terms_query\":\"all\",\"analyzer\":\"whitespace\",\"type\":\"phrase\"}}}}");
assertThat(list).hasSize(0);
}
开发者ID:ebean-orm,项目名称:ebean-elastic,代码行数:22,代码来源:QueryMatchOptionTest.java
示例4: matchAllPhrasePrefixOptions
import org.example.domain.Customer; //导入依赖的package包/类
@Test
public void matchAllPhrasePrefixOptions() {
Match options = new Match().opAnd().phrase()
.analyzer("whitespace")
.boost(2)
.cutoffFrequency(1)
.minShouldMatch("50%")
.maxExpansions(3)
.phrasePrefix();
Query<Customer> query = server.find(Customer.class)
.text()
.match("name", "Cust NoAdd", options)
.query();
List<Customer> list = query.findList();
assertEquals(query.getGeneratedSql(), "{\"query\":{\"match\":{\"name\":{\"query\":\"Cust NoAdd\",\"operator\":\"and\",\"boost\":2.0,\"cutoff_frequency\":1.0,\"minimum_should_match\":\"50%\",\"analyzer\":\"whitespace\",\"type\":\"phrase_prefix\",\"max_expansions\":3}}}}");
assertThat(list).hasSize(0);
}
开发者ID:ebean-orm,项目名称:ebean-elastic,代码行数:21,代码来源:QueryMatchOptionTest.java
示例5: init
import org.example.domain.Customer; //导入依赖的package包/类
private void init() {
SeedDbData.reset(false);
if (indexOnStart) {
documentStore.indexAll(Country.class);
documentStore.indexAll(Product.class);
documentStore.indexAll(Customer.class);
documentStore.indexAll(Contact.class);
documentStore.indexAll(Order.class);
documentStore.indexAll(Vehicle.class);
try {
// allow the indexing time to store
Thread.sleep(1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}
开发者ID:ebean-orm,项目名称:ebean-elastic,代码行数:20,代码来源:EmbeddedServer.java
示例6: createOrder3
import org.example.domain.Customer; //导入依赖的package包/类
private void createOrder3(Customer customer) {
Product product1 = Ebean.getReference(Product.class, 1);
Product product3 = Ebean.getReference(Product.class, 3);
Order order = new Order();
order.setStatus(Order.Status.COMPLETE);
order.setCustomer(customer);
List<OrderDetail> details = new ArrayList<OrderDetail>();
details.add(new OrderDetail(product1, 3, 10.50));
details.add(new OrderDetail(product3, 40, 2.10));
details.add(new OrderDetail(product1, 5, 10.00));
order.setDetails(details);
order.getShipments().add(new OrderShipment());
Ebean.save(order);
}
开发者ID:ebean-orm,项目名称:ebean-elastic,代码行数:20,代码来源:SeedDbData.java
示例7: partial_update
import org.example.domain.Customer; //导入依赖的package包/类
public void partial_update() throws InterruptedException {
Customer rob = server.find(Customer.class)
.select("id, status, name, smallNote")
.where().eq("name", "Rob")
.findOne();
rob.setSmallNote("Modify small note");
server.save(rob);
sleepToPropagate();
Customer robDoc = server.find(Customer.class)
.setId(rob.getId()).setUseDocStore(true)
.findOne();
assertThat(robDoc.getSmallNote()).isEqualTo(rob.getSmallNote());
assertThat(robDoc.getStatus()).isEqualTo(rob.getStatus());
assertThat(robDoc.getName()).isEqualTo("Rob");
assertThat(robDoc.getBillingAddress().getCountry().getCode()).isEqualTo("NZ");
}
开发者ID:ebean-orm,项目名称:ebean-elastic,代码行数:22,代码来源:PartialUpdateTest.java
示例8: minShouldMatch_fullOptions
import org.example.domain.Customer; //导入依赖的package包/类
@Test
public void minShouldMatch_fullOptions() {
TextCommonTerms options = new TextCommonTerms()
.cutoffFrequency(0.001)
.minShouldMatch("50%")
.lowFreqOperatorAnd(true)
.highFreqOperatorAnd(true);
Query<Customer> query = server.find(Customer.class)
.text()
.textCommonTerms("the brown", options)
.query();
List<Customer> list = query.findList();
assertThat(list).hasSize(0);
assertEquals(query.getGeneratedSql(), "{\"query\":{\"common\":{\"body\":{\"query\":\"the brown\",\"cutoff_frequency\":0.001,\"low_freq_operator\":\"and\",\"high_freq_operator\":\"and\",\"minimum_should_match\":\"50%\"}}}}");
}
开发者ID:ebean-orm,项目名称:ebean-elastic,代码行数:19,代码来源:QueryTextCommonTermsTest.java
示例9: minShouldMatch_Low
import org.example.domain.Customer; //导入依赖的package包/类
@Test
public void minShouldMatch_Low() {
TextCommonTerms options = new TextCommonTerms()
.cutoffFrequency(1)
.minShouldMatchLowFreq("50%")
.lowFreqOperatorAnd(true)
.highFreqOperatorAnd(true);
Query<Customer> query = server.find(Customer.class)
.text()
.textCommonTerms("the brown", options)
.setUseDocStore(true);
List<Customer> list = query.findList();
assertThat(list).hasSize(0);
assertEquals(query.getGeneratedSql(), "{\"query\":{\"common\":{\"body\":{\"query\":\"the brown\",\"cutoff_frequency\":1.0,\"low_freq_operator\":\"and\",\"high_freq_operator\":\"and\",\"minimum_should_match\":{\"low_freq\":\"50%\"}}}}}");
}
开发者ID:ebean-orm,项目名称:ebean-elastic,代码行数:19,代码来源:QueryTextCommonTermsTest.java
示例10: minShouldMatch_High
import org.example.domain.Customer; //导入依赖的package包/类
@Test
public void minShouldMatch_High() {
TextCommonTerms options = new TextCommonTerms()
.cutoffFrequency(1)
.minShouldMatchHighFreq("50%")
.lowFreqOperatorAnd(true)
.highFreqOperatorAnd(true);
Query<Customer> query = server.find(Customer.class)
.text()
.textCommonTerms("the brown", options)
.setUseDocStore(true);
List<Customer> list = query.findList();
assertThat(list).hasSize(0);
assertEquals(query.getGeneratedSql(), "{\"query\":{\"common\":{\"body\":{\"query\":\"the brown\",\"cutoff_frequency\":1.0,\"low_freq_operator\":\"and\",\"high_freq_operator\":\"and\",\"minimum_should_match\":{\"high_freq\":\"50%\"}}}}}");
}
开发者ID:ebean-orm,项目名称:ebean-elastic,代码行数:19,代码来源:QueryTextCommonTermsTest.java
示例11: minShouldMatch_LowAndHigh
import org.example.domain.Customer; //导入依赖的package包/类
@Test
public void minShouldMatch_LowAndHigh() {
TextCommonTerms options = new TextCommonTerms()
.cutoffFrequency(1)
.minShouldMatchLowFreq("2")
.minShouldMatchHighFreq("50%");
Query<Customer> query = server.find(Customer.class)
.text()
.textCommonTerms("the brown", options)
.setUseDocStore(true);
List<Customer> list = query.findList();
assertThat(list).hasSize(0);
assertEquals(query.getGeneratedSql(), "{\"query\":{\"common\":{\"body\":{\"query\":\"the brown\",\"cutoff_frequency\":1.0,\"minimum_should_match\":{\"low_freq\":\"2\",\"high_freq\":\"50%\"}}}}}");
}
开发者ID:ebean-orm,项目名称:ebean-elastic,代码行数:18,代码来源:QueryTextCommonTermsTest.java
示例12: mustAndShould
import org.example.domain.Customer; //导入依赖的package包/类
@Test
public void mustAndShould() {
Query<Customer> query = server.find(Customer.class)
.text()
.must()
.match("name", "Rob")
.eq("status", Customer.Status.NEW)
.endJunction()
.should()
.match("smallNote", "foo")
.match("smallNote", "bar")
.setUseDocStore(true);
List<Customer> list = query.findList();
assertEquals(query.getGeneratedSql(), "{\"query\":{\"bool\":{\"must\":[{\"match\":{\"name\":\"Rob\"}},{\"term\":{\"status\":\"NEW\"}}],\"should\":[{\"match\":{\"smallNote\":\"foo\"}},{\"match\":{\"smallNote\":\"bar\"}}]}}}");
assertThat(list).hasSize(1);
}
开发者ID:ebean-orm,项目名称:ebean-elastic,代码行数:19,代码来源:QueryMatchTest.java
示例13: must_withNestedShould
import org.example.domain.Customer; //导入依赖的package包/类
@Test
public void must_withNestedShould() {
Query<Customer> query = server.find(Customer.class)
.text()
.must()
.match("name", "Rob")
.should()
.match("smallNote", "foo")
.match("smallNote", "bar")
.setUseDocStore(true);
List<Customer> list = query.findList();
assertEquals(query.getGeneratedSql(), "{\"query\":{\"bool\":{\"must\":[{\"match\":{\"name\":\"Rob\"}},{\"bool\":{\"should\":[{\"match\":{\"smallNote\":\"foo\"}},{\"match\":{\"smallNote\":\"bar\"}}]}}]}}}");
assertThat(list).hasSize(0);
}
开发者ID:ebean-orm,项目名称:ebean-elastic,代码行数:17,代码来源:QueryMatchTest.java
示例14: where_between_dateTime
import org.example.domain.Customer; //导入依赖的package包/类
@Test
public void where_between_dateTime() {
Timestamp before = new Timestamp(System.currentTimeMillis() - 1000000);
Timestamp now = new Timestamp(System.currentTimeMillis() - 1000000);
Query<Customer> query = server.find(Customer.class)
.setUseDocStore(true)
.where().between("anniversary", before, now)
.query();
List<Customer> customers = query.findList();
assertEquals(customers.size(), 0);
assertThat(query.getGeneratedSql()).contains("{\"query\":{\"bool\":{\"filter\":{\"range\":{\"anniversary\":{\"gte\":");
}
开发者ID:ebean-orm,项目名称:ebean-elastic,代码行数:17,代码来源:QueryListTest.java
示例15: contacts_to_customer
import org.example.domain.Customer; //导入依赖的package包/类
@Test
public void contacts_to_customer() {
List<Contact> contacts = server.find(Contact.class)
.setUseDocStore(true)
.findList();
for (Contact contact : contacts) {
Customer customer = contact.getCustomer();
// invoke lazy loading
customer.getWhenCreated();
}
String json = Ebean.json().toJson(contacts);
System.out.println(json);
}
开发者ID:ebean-orm,项目名称:ebean-elastic,代码行数:18,代码来源:QueryJoinTest.java
示例16: customer_to_orders
import org.example.domain.Customer; //导入依赖的package包/类
@Test
public void customer_to_orders() {
List<Customer> customers = server.find(Customer.class)
.setUseDocStore(true)
.findList();
for (Customer customer : customers) {
List<Order> orders = customer.getOrders();
orders.size();
}
String json = Ebean.json().toJson(customers);
System.out.println(json);
assertThat(json).contains("\"orders\":[{\"id\":");
}
开发者ID:ebean-orm,项目名称:ebean-elastic,代码行数:17,代码来源:QueryJoinTest.java
示例17: customer_queryJoin
import org.example.domain.Customer; //导入依赖的package包/类
@Test
public void customer_queryJoin() {
List<Customer> customers = server.find(Customer.class)
.setUseDocStore(true)
.fetchQuery("orders")
.fetchQuery("contacts")
.fetchQuery("orders.shipments")
.findList();
String json = Ebean.json().toJson(customers);
System.out.println(json);
assertThat(json).contains("\"orders\":[{\"id\":");
assertThat(json).contains("\"contacts\":[{\"id\":");
assertThat(json).contains("\"shipments\":[{\"id\":");
}
开发者ID:ebean-orm,项目名称:ebean-elastic,代码行数:18,代码来源:QueryJoinTest.java
示例18: findEach_with_queryJoinToIndex
import org.example.domain.Customer; //导入依赖的package包/类
@Test
public void findEach_with_queryJoinToIndex() {
final List<Customer> collect = new ArrayList<Customer>();
server.find(Customer.class)
.setUseDocStore(true)
.setMaxRows(2) // reduce size to 2 such that we get multiple scrolls
.fetch("orders", new FetchConfig().query())
.fetch("contacts", new FetchConfig().query())
.findEach(bean -> collect.add(bean));
String json = Ebean.json().toJson(collect);
System.out.println(json);
assertThat(json).contains("\"contacts\":[{\"id\":");
assertThat(json).contains("\"orders\":[{\"id\":");
}
开发者ID:ebean-orm,项目名称:ebean-elastic,代码行数:18,代码来源:QueryJoinTest.java
示例19: query_useDocStore_then_lazyLoadAssocMany
import org.example.domain.Customer; //导入依赖的package包/类
@Test
public void query_useDocStore_then_lazyLoadAssocMany() throws InterruptedException {
List<Customer> customers = Ebean.find(Customer.class)
.select("*")
.orderBy().asc("name")
.setUseDocStore(true)
//.setDisableLazyLoading(true)
.findList();
for (Customer customer : customers) {
List<Contact> contacts = customer.getContacts();
for (Contact contact : contacts) {
contact.getFirstName();
contact.getLastName();
}
}
assertThat(customers).hasSize(4);
}
开发者ID:ebean-orm,项目名称:ebean-elastic,代码行数:21,代码来源:ElasticDocumentStoreTest.java
示例20: query_useDocStore_then_lazyLoadAssocOne
import org.example.domain.Customer; //导入依赖的package包/类
@Test
public void query_useDocStore_then_lazyLoadAssocOne() throws InterruptedException {
List<Contact> contacts = Ebean.find(Contact.class)
.where().icontains("lastName", "bunny")
.orderBy().asc("lastName")
.setUseDocStore(true)
.findList();
for (Contact contact : contacts) {
Customer customer = contact.getCustomer();
customer.getId();
customer.getName();
customer.getSmallNote();
customer.getId();
}
assertThat(contacts).hasSize(1);
}
开发者ID:ebean-orm,项目名称:ebean-elastic,代码行数:20,代码来源:ElasticDocumentStoreTest.java
注:本文中的org.example.domain.Customer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论