Search in sources :

Example 1 with ClientVersionStatusEvent

use of io.apiman.manager.api.beans.events.ClientVersionStatusEvent in project apiman by apiman.

the class ClientAppRegisteredEmailNotification method wants.

/**
 * If a status change event && has transitioned into 'registered' state.
 */
@Override
public boolean wants(NotificationDto<? extends IVersionedApimanEvent> raw) {
    if (raw.getReason().equals(ClientAppStatusNotificationProducer.APIMAN_CLIENT_STATUS_CHANGE)) {
        // Get the event payload
        NotificationDto<ClientVersionStatusEvent> notification = (NotificationDto<ClientVersionStatusEvent>) raw;
        ClientVersionStatusEvent event = notification.getPayload();
        // We only want to send a notification if the previous state was unregistered, and new state is registered (for now).
        return (event.getNewStatus() == ClientStatus.Registered && event.getPreviousStatus() == ClientStatus.AwaitingApproval);
    }
    return false;
}
Also used : NotificationDto(io.apiman.manager.api.beans.notifications.dto.NotificationDto) ClientVersionStatusEvent(io.apiman.manager.api.beans.events.ClientVersionStatusEvent)

Aggregations

ClientVersionStatusEvent (io.apiman.manager.api.beans.events.ClientVersionStatusEvent)1 NotificationDto (io.apiman.manager.api.beans.notifications.dto.NotificationDto)1