Пример #1
0
 public static Set<Category> getDistinctCategories(Order order) {
   Set<Category> catSet = new HashSet<Category>();
   for (OrderLine line : order.getOrderLines()) {
     catSet.add(line.getItem().getProduct().getCategory());
   }
   return catSet;
 }
Пример #2
0
  public Float getTotal() {
    if (orderLines == null || orderLines.isEmpty()) return 0f;

    Float total = 0f;

    // sum up the quantities
    for (OrderLine orderLine : orderLines) {
      total += (orderLine.getSubTotal());
    }

    return total;
  }