// 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); }
public Collection<Order> findAllByClerk() { Collection<Order> result; Clerk clerk; clerk = clerkService.findByprincipal(); Assert.notNull(clerk); result = orderRepository.findAllByClerkId(clerk.getId()); return result; }