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; }
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; }