本文整理了Java中org.springframework.data.gemfire.examples.domain.Order.getLineItems()
方法的一些代码示例,展示了Order.getLineItems()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Order.getLineItems()
方法的具体详情如下:
包路径:org.springframework.data.gemfire.examples.domain.Order
类名称:Order
方法名:getLineItems
[英]Returns all LineItems currently belonging to the Order.
[中]返回当前属于订单的所有行项目。
代码示例来源:origin: spring-projects/spring-gemfire-examples
@Override
public Iterator<LineItem> iterator() {
return getLineItems().iterator();
}
代码示例来源:origin: spring-projects/spring-gemfire-examples
@Override
public void afterCreate(EntryEvent<Long, Order> event) {
Order order = event.getNewValue();
System.err.printf("[%s] made an Order [%s] for [%s]%n",
findCustomerById(order.getCustomerId()), order, order.getLineItems());
}
};
代码示例来源:origin: spring-projects/spring-gemfire-examples
/**
* Create an order
*/
public Order createOrder(Order order) {
Assert.notNull(order, "order cannot be null");
Assert.notNull(order.getId(), "order ID cannot be null");
Assert.notNull(order.getCustomerId(), "order customer ID cannot be null");
Assert.notEmpty(order.getLineItems(), "order must contain at least one line item");
Assert.notNull(order.getBillingAddress(), "order billing address cannot be null");
log.debug("creating new order " + order.getId());
return orderRepository.save(order);
}
代码示例来源:origin: spring-projects/spring-gemfire-examples
/**
* Create an order
* @param order
* @return
*/
public Order createOrder(Order order) {
Assert.notNull(order, "order cannot be null");
Assert.notNull(order.getId(),"order id cannot be null");
Assert.notNull(order.getCustomerId(), "order customer ID cannot be null");
Assert.notEmpty(order.getLineItems(),"order must contain at least one line item");
log.debug("creating order ID:" + order.getId() );
return orderDao.save(order);
}
代码示例来源:origin: spring-projects/spring-gemfire-examples
private ContinuousQueryListener newQueryListener(Region<Long, Customer> customers, String qualifier) {
return event -> {
Order order = (Order) event.getNewValue();
System.err.printf("[%s] made an %s Order [%s] for [%s]%n",
findByCustomerId(customers, order.getCustomerId()), qualifier, order, order.getLineItems());
};
}
代码示例来源:origin: spring-projects/spring-gemfire-examples
for (LineItem lineItem: order.getLineItems()) {
if (lineItem.getProductId() == productId) {
total = total.add(lineItem.getTotal());
代码示例来源:origin: spring-projects/spring-gemfire-examples
private void findOrders() {
log.debug("looking for orders for customer ID 2");
for (Order order: orderService.findOrdersByCustomerId(2L)) {
log.debug("found order ID " + order.getId() + " " +
order.getBillingAddress().getStreet() + " " +
order.getBillingAddress().getCity() + " " +
order.getBillingAddress().getCountry());
for (LineItem lineItem: order.getLineItems()) {
log.debug("product ID:" + lineItem.getProductId() +
" quantity:" + lineItem.getAmount() +
" unit price:" + lineItem.getUnitPrice().setScale(2,BigDecimal.ROUND_DOWN) +
" total price:" + lineItem.getTotal().setScale(2,BigDecimal.ROUND_DOWN));
}
}
}
代码示例来源:origin: spring-projects/spring-gemfire-examples
@Override
public void execute(FunctionContext functionContext) {
ResultSender<BigDecimal> resultSender = functionContext.getResultSender();
String productName = (String)functionContext.getArguments();
log.debug("searching for product name '" + productName + "'");
SelectResults<Product> results = productTemplate.query("name = '" + productName + "'");
if (results.isEmpty()) {
log.warn("cannot find product '" + productName + "'");
resultSender.lastResult(new BigDecimal(0.0));
return;
}
Product product = results.asList().get(0);
long productId = product.getId();
BigDecimal total = new BigDecimal(0.0);
for (Order order: orderRegion.values()) {
for (LineItem lineItem: order.getLineItems()) {
if (lineItem.getProductId() == productId) {
total = total.add(lineItem.getTotal());
}
}
}
resultSender.lastResult(total.setScale(2,BigDecimal.ROUND_CEILING));
}
内容来源于网络,如有侵权,请联系作者删除!