001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.notifications;
016    
017    import java.util.Collection;
018    import java.util.List;
019    
020    /**
021     * @author Edward Han
022     */
023    public interface ChannelHub {
024    
025            public void cleanUp() throws ChannelException;
026    
027            public void cleanUp(long userId) throws ChannelException;
028    
029            public void confirmDelivery(
030                            long userId, Collection<String> notificationEventUuids)
031                    throws ChannelException;
032    
033            public void confirmDelivery(
034                            long userId, Collection<String> notificationEventUuids,
035                            boolean archive)
036                    throws ChannelException;
037    
038            public void confirmDelivery(long userId, String notificationEventUuid)
039                    throws ChannelException;
040    
041            public void confirmDelivery(
042                            long userId, String notificationEventUuid, boolean archive)
043                    throws ChannelException;
044    
045            public Channel createChannel(long userId) throws ChannelException;
046    
047            public void deleteUserNotificiationEvent(
048                            long userId, String notificationEventUuid)
049                    throws ChannelException;
050    
051            public void deleteUserNotificiationEvents(
052                            long userId, Collection<String> notificationEventUuids)
053                    throws ChannelException;
054    
055            public void destroy() throws ChannelException;
056    
057            public Channel destroyChannel(long userId) throws ChannelException;
058    
059            public Channel fetchChannel(long userId) throws ChannelException;
060    
061            public Channel fetchChannel(long userId, boolean createIfAbsent)
062                    throws ChannelException;
063    
064            public List<NotificationEvent> fetchNotificationEvents(long userId)
065                    throws ChannelException;
066    
067            public List<NotificationEvent> fetchNotificationEvents(
068                            long userId, boolean flush)
069                    throws ChannelException;
070    
071            public void flush() throws ChannelException;
072    
073            public void flush(long userId) throws ChannelException;
074    
075            public void flush(long userId, long timestamp) throws ChannelException;
076    
077            public Channel getChannel(long userId) throws ChannelException;
078    
079            public Channel getChannel(long userId, boolean createIfAbsent)
080                    throws ChannelException;
081    
082            public List<NotificationEvent> getNotificationEvents(long userId)
083                    throws ChannelException;
084    
085            public List<NotificationEvent> getNotificationEvents(
086                            long userId, boolean flush)
087                    throws ChannelException;
088    
089            public Collection<Long> getUserIds();
090    
091            public void registerChannelListener(
092                            long userId, ChannelListener channelListener)
093                    throws ChannelException;
094    
095            public void removeTransientNotificationEvents(
096                            long userId, Collection<NotificationEvent> notificationEvents)
097                    throws ChannelException;
098    
099            public void removeTransientNotificationEventsByUuid(
100                            long userId, Collection<String> notificationEventUuids)
101                    throws ChannelException;
102    
103            public void sendNotificationEvent(
104                            long userId, NotificationEvent notificationEvent)
105                    throws ChannelException;
106    
107            public void sendNotificationEvents(
108                            long userId, Collection<NotificationEvent> notificationEvents)
109                    throws ChannelException;
110    
111            public void storeNotificationEvent(
112                            long userId, NotificationEvent notificationEvent)
113                    throws ChannelException;
114    
115            public void unregisterChannelListener(
116                            long userId, ChannelListener channelListener)
117                    throws ChannelException;
118    
119    }