001    /**
002     * Copyright (c) 2000-2012 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 void flush() throws ChannelException;
067    
068            public void flush(long userId) throws ChannelException;
069    
070            public void flush(long userId, long timestamp) throws ChannelException;
071    
072            public Channel getChannel(long userId) throws ChannelException ;
073    
074            public Channel getChannel(long userId, boolean createIfAbsent)
075                    throws ChannelException;
076    
077            public List<NotificationEvent> getNotificationEvents(long userId)
078                    throws ChannelException;
079    
080            public List<NotificationEvent> getNotificationEvents(
081                            long userId, boolean flush)
082                    throws ChannelException;
083    
084            public Collection<Long> getUserIds();
085    
086            public void registerChannelListener(
087                            long userId, ChannelListener channelListener)
088                    throws ChannelException;
089    
090            public void removeTransientNotificationEvents(
091                            long userId, Collection<NotificationEvent> notificationEvents)
092                    throws ChannelException;
093    
094            public void removeTransientNotificationEventsByUuid(
095                            long userId, Collection<String> notificationEventUuids)
096                    throws ChannelException;
097    
098            public void sendNotificationEvent(
099                            long userId, NotificationEvent notificationEvent)
100                    throws ChannelException;
101    
102            public void sendNotificationEvents(
103                            long userId, Collection<NotificationEvent> notificationEvents)
104                    throws ChannelException;
105    
106            public void unregisterChannelListener(
107                            long userId, ChannelListener channelListener)
108                    throws ChannelException;
109    
110    }