001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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 class ChannelHubManagerUtil {
024    
025            public static void confirmDelivery(
026                            long companyId, long userId, String notificationEventUuid)
027                    throws ChannelException {
028    
029                    getChannelHubManager().confirmDelivery(
030                            companyId, userId, notificationEventUuid);
031            }
032    
033            public static Channel createChannel(long companyId, long userId)
034                    throws ChannelException {
035    
036                    return getChannelHubManager().createChannel(companyId, userId);
037            }
038    
039            public static ChannelHub createChannelHub(long companyId)
040                    throws ChannelException {
041    
042                    return getChannelHubManager().createChannelHub(companyId);
043            }
044    
045            public static void destroyChannel(long companyId, long userId)
046                    throws ChannelException {
047    
048                    getChannelHubManager().destroyChannel(companyId, userId);
049            }
050    
051            public static void destroyChannelHub(long companyId)
052                    throws ChannelException {
053    
054                    getChannelHubManager().destroyChannelHub(companyId);
055            }
056    
057            public static void flush() throws ChannelException {
058                    getChannelHubManager().flush();
059            }
060    
061            public static void flush(long companyId) throws ChannelException {
062                    getChannelHubManager().flush(companyId);
063            }
064    
065            public static void flush(long companyId, long userId, long timestamp)
066                    throws ChannelException {
067    
068                    getChannelHubManager().flush(companyId, userId, timestamp);
069            }
070    
071            public static Channel getChannel(long companyId, long userId)
072                    throws ChannelException {
073    
074                    return getChannelHubManager().getChannel(companyId, userId);
075            }
076    
077            public static Channel getChannel(
078                            long companyId, long userId, boolean createIfAbsent)
079                    throws ChannelException {
080    
081                    return getChannelHubManager().getChannel(
082                            companyId, userId, createIfAbsent);
083            }
084    
085            public static ChannelHub getChannelHub(long companyId)
086                    throws ChannelException {
087    
088                    return getChannelHubManager().getChannelHub(companyId);
089            }
090    
091            public static ChannelHub getChannelHub(
092                            long companyId, boolean createIfAbsent)
093                    throws ChannelException {
094    
095                    return getChannelHubManager().getChannelHub(companyId, createIfAbsent);
096            }
097    
098            public static ChannelHubManager getChannelHubManager() {
099                    return _channelHubManager;
100            }
101    
102            public static List<NotificationEvent> getNotificationEvents(
103                            long compnayId, long userId)
104                    throws ChannelException {
105    
106                    return getChannelHubManager().getNotificationEvents(compnayId, userId);
107            }
108    
109            public static List<NotificationEvent> getNotificationEvents(
110                            long compnayId, long userId, boolean flush)
111                    throws ChannelException {
112    
113                    return getChannelHubManager().getNotificationEvents(
114                            compnayId, userId, flush);
115            }
116    
117            public static Collection<Long> getUserIds(long companyId)
118                    throws ChannelException {
119    
120                    return getChannelHubManager().getUserIds(companyId);
121            }
122    
123            public static void registerChannelListener(
124                            long companyId, long userId, ChannelListener channelListener)
125                    throws ChannelException {
126    
127                    getChannelHubManager().registerChannelListener(
128                            companyId, userId, channelListener);
129            }
130    
131            public static void removeTransientNotificationEvents(
132                            long companyId, long userId,
133                            Collection<NotificationEvent> notificationEvents)
134                    throws ChannelException {
135    
136                    getChannelHubManager().removeTransientNotificationEvents(
137                            companyId, userId, notificationEvents);
138            }
139    
140            public static void removeTransientNotificationEventsByUuid(
141                            long companyId, long userId,
142                            Collection<String> notificationEventUuids)
143                    throws ChannelException {
144    
145                    getChannelHubManager().removeTransientNotificationEventsByUuid(
146                            companyId, userId, notificationEventUuids);
147            }
148    
149            public static void sendNotificationEvent(
150                            long companyId, long userId, NotificationEvent notificationEvent)
151                    throws ChannelException {
152    
153                    getChannelHubManager().sendNotificationEvent(
154                            companyId, userId, notificationEvent);
155            }
156    
157            public static void sendNotificationEvents(
158                            long companyId, long userId,
159                            Collection<NotificationEvent> notificationEvents)
160                    throws ChannelException {
161    
162                    getChannelHubManager().sendNotificationEvents(
163                            companyId, userId, notificationEvents);
164            }
165    
166            public static void unregisterChannelListener(
167                            long companyId, long userId, ChannelListener channelListener)
168                    throws ChannelException {
169    
170                    getChannelHubManager().unregisterChannelListener(
171                            companyId, userId, channelListener);
172            }
173    
174            public void setChannelHubManager(ChannelHubManager channelHubManager) {
175                    _channelHubManager = channelHubManager;
176            }
177    
178            private static ChannelHubManager _channelHubManager;
179    
180    }