181920212223242526
public class CartService implements RepositoryService<Cart> { @Override public Cart store(Cart cart) { CartDAO repository = new CartDAO(); return repository.save(cart); }
262728293031323334
} @Override public void remove(Cart cart) { CartDAO repository = new CartDAO(); repository.delete(cart); }
343536373839404142
} @Override public Collection<Cart> getAll() { CartDAO repository = new CartDAO(); return repository.getAll(); }
4142434445464748
} @Override public Cart getById(Serializable id) { CartDAO repository = new CartDAO(); return repository.get(id); }
4849505152535455
} public Cart getByCustomerId(Serializable customerID) { Customer customer = new CustomerService().getById(customerID); CartDAO repository = new CartDAO(); return repository.getByCustomer(customer); }