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 boolean IsEnoughTimeForOrder(Order order) { // TODO unit unittest and reimplement/refactor it if needed int maxHoursOfWorkInDay = 8; int maxHoursOfWorkMonthly = 176; Calendar c = Calendar.getInstance(); int monthMaxDays = c.getActualMaximum(Calendar.DAY_OF_MONTH); int daysRemaining = monthMaxDays - c.get(Calendar.DAY_OF_MONTH); int timeRemainingInThisMonth = Math.min( (maxHoursOfWorkMonthly - getHoursWorkedThisMonth()), daysRemaining * maxHoursOfWorkInDay); boolean isEnoughTime = (timeRemainingInThisMonth > order.getTimeEstimate()); if (isEnoughTime) return true; return false; }
public void addOrder(Order anOrder) { getOrders().add(anOrder); anOrder.setCustomer(this); }
public Order removeOrder(Order order) { getOrders().remove(order); order.setSendMethod(null); return order; }
public Order addOrder(Order order) { getOrders().add(order); order.setSendMethod(this); return order; }