Пример #1
0
  // ref: 18.3
  public void assignToClerkManual(Clerk clerk, Order order) {
    Assert.notNull(clerk);
    Assert.isTrue(clerk.getId() != 0);
    Assert.notNull(order);
    Assert.isTrue(order.getId() != 0);
    Assert.isNull(order.getClerk());

    order.setClerk(clerk);

    this.save(order);
  }
Пример #2
0
  // req: 16.1
  public void cancelOrder(Order order) {
    Assert.notNull(order);
    Assert.isTrue(order.getId() != 0);
    Assert.isTrue(
        order.getConsumer().equals(consumerService.findByPrincipal()),
        "Only the owner can cancel the order");
    Assert.isTrue(order.getCancelMoment() == null, "order.cancel.error.isCancelled");
    Clerk clerk;

    clerk = clerkService.findByOrder(order);

    Assert.isNull(clerk, "Can't remove a order when a clerk has assigned");

    order.setCancelMoment(new Date());
    this.save(order);
  }