All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apereo.cas.jmx.ticket.TicketRegistryManagedResource Maven / Gradle / Ivy

There is a newer version: 7.2.0-RC4
Show newest version
package org.apereo.cas.jmx.ticket;

import org.apereo.cas.ticket.Ticket;
import org.apereo.cas.ticket.registry.TicketRegistry;

import lombok.RequiredArgsConstructor;
import lombok.val;
import org.springframework.jmx.export.annotation.ManagedOperation;
import org.springframework.jmx.export.annotation.ManagedResource;

import java.util.Collection;
import java.util.stream.Collectors;

/**
 * This is {@link TicketRegistryManagedResource}.
 *
 * @author Misagh Moayyed
 * @since 6.1.0
 */
@ManagedResource
@RequiredArgsConstructor
public class TicketRegistryManagedResource {
    private final TicketRegistry ticketRegistry;

    /**
     * Gets tickets.
     *
     * @return the tickets
     */
    @ManagedOperation
    public Collection getTickets() {
        try (val stream = ticketRegistry.stream()) {
            return stream.map(Ticket::getId).collect(Collectors.toSet());
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy