Example #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;
 }
Example #2
0
  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;
  }
Example #3
0
 public void addOrder(Order anOrder) {
   getOrders().add(anOrder);
   anOrder.setCustomer(this);
 }
Example #4
0
  public Order removeOrder(Order order) {
    getOrders().remove(order);
    order.setSendMethod(null);

    return order;
  }
Example #5
0
  public Order addOrder(Order order) {
    getOrders().add(order);
    order.setSendMethod(this);

    return order;
  }