@Override public Collection<Ticket> getTickets() { return this.ticketRegistry.getTickets(); }
@Transactional(readOnly = true, transactionManager = "ticketTransactionManager") @Timed(name = "GET_TICKETS_TIMER") @Metered(name = "GET_TICKETS_METER") @Counted(name = "GET_TICKETS_COUNTER", monotonic = true) @Override public Collection<Ticket> getTickets(final Predicate<Ticket> predicate) { final Collection<Ticket> c = new HashSet<>(this.ticketRegistry.getTickets()); final Iterator<Ticket> it = c.iterator(); while (it.hasNext()) { if (!predicate.apply(it.next())) { it.remove(); } } return c; }
@Override public List<TicketGrantingTicket> getNonExpiredTicketGrantingTickets() throws BulkRetrievalOfTicketsNotSupportedException { final List<TicketGrantingTicket> tgts = new ArrayList<TicketGrantingTicket>(); try { for (Ticket ticket : this.ticketRegistry.getTickets()) { if ((ticket instanceof TicketGrantingTicket) && !ticket.isExpired()) { tgts.add((TicketGrantingTicket) ticket); } } } catch (UnsupportedOperationException e) { throw new BulkRetrievalOfTicketsNotSupportedException("The underlying implementation of <TicketRegistry> does not support a bulk retrieval of tickets", e); } return tgts; } }
logger.debug("Cleaning up tickets from an instance of {}", registry); final Collection<Integer> deletedTicketCounts = Collections2.transform(registry.getTickets(), new Function<Ticket, Integer>() { @Override public Integer apply(@Nullable final Ticket ticket) {