001    /**
002     * Copyright (c) 2000-2013 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 ChannelHub clone(long companyId);
030    
031            public void confirmDelivery(
032                            long userId, Collection<String> notificationEventUuids)
033                    throws ChannelException;
034    
035            public void confirmDelivery(
036                            long userId, Collection<String> notificationEventUuids,
037                            boolean archive)
038                    throws ChannelException;
039    
040            public void confirmDelivery(long userId, String notificationEventUuid)
041                    throws ChannelException;
042    
043            public void confirmDelivery(
044                            long userId, String notificationEventUuid, boolean archive)
045                    throws ChannelException;
046    
047            public Channel createChannel(long userId) throws ChannelException;
048    
049            public void deleteUserNotificiationEvent(
050                            long userId, String notificationEventUuid)
051                    throws ChannelException;
052    
053            public void deleteUserNotificiationEvents(
054                            long userId, Collection<String> notificationEventUuids)
055                    throws ChannelException;
056    
057            public void destroy() throws ChannelException;
058    
059            public Channel destroyChannel(long userId) throws ChannelException;
060    
061            public Channel fetchChannel(long userId) throws ChannelException;
062    
063            public Channel fetchChannel(long userId, boolean createIfAbsent)
064                    throws ChannelException;
065    
066            public List<NotificationEvent> fetchNotificationEvents(long userId)
067                    throws ChannelException;
068    
069            public List<NotificationEvent> fetchNotificationEvents(
070                            long userId, boolean flush)
071                    throws ChannelException;
072    
073            public void flush() throws ChannelException;
074    
075            public void flush(long userId) throws ChannelException;
076    
077            public void flush(long userId, long timestamp) throws ChannelException;
078    
079            public Channel getChannel(long userId) throws ChannelException;
080    
081            public Channel getChannel(long userId, boolean createIfAbsent)
082                    throws ChannelException;
083    
084            public List<NotificationEvent> getNotificationEvents(long userId)
085                    throws ChannelException;
086    
087            public List<NotificationEvent> getNotificationEvents(
088                            long userId, boolean flush)
089                    throws ChannelException;
090    
091            public Collection<Long> getUserIds();
092    
093            public void registerChannelListener(
094                            long userId, ChannelListener channelListener)
095                    throws ChannelException;
096    
097            public void removeTransientNotificationEvents(
098                            long userId, Collection<NotificationEvent> notificationEvents)
099                    throws ChannelException;
100    
101            public void removeTransientNotificationEventsByUuid(
102                            long userId, Collection<String> notificationEventUuids)
103                    throws ChannelException;
104    
105            public void sendNotificationEvent(
106                            long userId, NotificationEvent notificationEvent)
107                    throws ChannelException;
108    
109            public void sendNotificationEvents(
110                            long userId, Collection<NotificationEvent> notificationEvents)
111                    throws ChannelException;
112    
113            public void storeNotificationEvent(
114                            long userId, NotificationEvent notificationEvent)
115                    throws ChannelException;
116    
117            public void unregisterChannelListener(
118                            long userId, ChannelListener channelListener)
119                    throws ChannelException;
120    
121    }