예제 #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
파일: Driver.java 프로젝트: STimur/LogiWeb
  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;
  }
예제 #3
0
 public void addOrder(Order anOrder) {
   getOrders().add(anOrder);
   anOrder.setCustomer(this);
 }
예제 #4
0
  public Order removeOrder(Order order) {
    getOrders().remove(order);
    order.setSendMethod(null);

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

    return order;
  }