@Override public int getNumberOfReservations(String company, String type) { Set<Reservation> out = new HashSet<Reservation>(); try { for (Car c : em.find(CarRentalCompany.class, company).getCars(type)) { out.addAll(c.getReservations()); } } catch (IllegalArgumentException ex) { Logger.getLogger(ManagerSession.class.getName()).log(Level.SEVERE, null, ex); return 0; } return out.size(); }
@Override public Set<Integer> getCarIds(String company, String type) { Set<Integer> out = new HashSet<Integer>(); try { for (Car c : em.find(CarRentalCompany.class, company).getCars(type)) { out.add(c.getId()); } } catch (IllegalArgumentException ex) { Logger.getLogger(ManagerSession.class.getName()).log(Level.SEVERE, null, ex); return null; } return out; }