本文整理汇总了Java中org.example.domain.Customer类的典型用法代码示例。如果您正苦于以下问题:Java Customer类的具体用法?Java Customer怎么用?Java Customer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Customer类属于org.example.domain包,在下文中一共展示了Customer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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\"}}}");
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
}
示例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);
}
示例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");
}
示例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%\"}}}}");
}
示例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%\"}}}}}");
}
示例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%\"}}}}}");
}
示例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%\"}}}}}");
}
示例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);
}
示例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);
}
示例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\":");
}
示例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);
}