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 class ChannelHubManagerUtil {
024    
025            public static void confirmDelivery(
026                            long companyId, long userId,
027                            Collection<String> notificationEventUuids)
028                    throws ChannelException {
029    
030                    getChannelHubManager().confirmDelivery(
031                            companyId, userId, notificationEventUuids);
032            }
033    
034            public static void confirmDelivery(
035                            long companyId, long userId,
036                            Collection<String> notificationEventUuids, boolean archived)
037                    throws ChannelException {
038    
039                    getChannelHubManager().confirmDelivery(
040                            companyId, userId, notificationEventUuids, archived);
041            }
042    
043            public static void confirmDelivery(
044                            long companyId, long userId, String notificationEventUuid)
045                    throws ChannelException {
046    
047                    getChannelHubManager().confirmDelivery(
048                            companyId, userId, notificationEventUuid);
049            }
050    
051            public static void confirmDelivery(
052                            long companyId, long userId, String notificationEventUuid,
053                            boolean archived)
054                    throws ChannelException {
055    
056                    getChannelHubManager().confirmDelivery(
057                            companyId, userId, notificationEventUuid, archived);
058            }
059    
060            public static Channel createChannel(long companyId, long userId)
061                    throws ChannelException {
062    
063                    return getChannelHubManager().createChannel(companyId, userId);
064            }
065    
066            public static ChannelHub createChannelHub(long companyId)
067                    throws ChannelException {
068    
069                    return getChannelHubManager().createChannelHub(companyId);
070            }
071    
072            public static void deleteUserNotificiationEvent(
073                            long companyId, long userId, String notificationEventUuid)
074                    throws ChannelException {
075    
076                    getChannelHubManager().deleteUserNotificiationEvent(
077                            companyId, userId, notificationEventUuid);
078            }
079    
080            public static void deleteUserNotificiationEvents(
081                            long companyId, long userId,
082                            Collection<String> notificationEventUuids)
083                    throws ChannelException {
084    
085                    getChannelHubManager().deleteUserNotificiationEvents(
086                            companyId, userId, notificationEventUuids);
087            }
088    
089            public static void destroyChannel(long companyId, long userId)
090                    throws ChannelException {
091    
092                    getChannelHubManager().destroyChannel(companyId, userId);
093            }
094    
095            public static void destroyChannelHub(long companyId)
096                    throws ChannelException {
097    
098                    getChannelHubManager().destroyChannelHub(companyId);
099            }
100    
101            public static ChannelHub fetchChannelHub(long companyId)
102                    throws ChannelException {
103    
104                    return getChannelHubManager().fetchChannelHub(companyId);
105            }
106    
107            public static ChannelHub fetchChannelHub(
108                            long companyId, boolean createIfAbsent)
109                    throws ChannelException {
110    
111                    return getChannelHubManager().fetchChannelHub(
112                            companyId, createIfAbsent);
113            }
114    
115            public static void flush() throws ChannelException {
116                    getChannelHubManager().flush();
117            }
118    
119            public static void flush(long companyId) throws ChannelException {
120                    getChannelHubManager().flush(companyId);
121            }
122    
123            public static void flush(long companyId, long userId, long timestamp)
124                    throws ChannelException {
125    
126                    getChannelHubManager().flush(companyId, userId, timestamp);
127            }
128    
129            public static Channel getChannel(long companyId, long userId)
130                    throws ChannelException {
131    
132                    return getChannelHubManager().getChannel(companyId, userId);
133            }
134    
135            public static Channel getChannel(
136                            long companyId, long userId, boolean createIfAbsent)
137                    throws ChannelException {
138    
139                    return getChannelHubManager().getChannel(
140                            companyId, userId, createIfAbsent);
141            }
142    
143            public static ChannelHub getChannelHub(long companyId)
144                    throws ChannelException {
145    
146                    return getChannelHubManager().getChannelHub(companyId);
147            }
148    
149            public static ChannelHub getChannelHub(
150                            long companyId, boolean createIfAbsent)
151                    throws ChannelException {
152    
153                    return getChannelHubManager().getChannelHub(companyId, createIfAbsent);
154            }
155    
156            public static ChannelHubManager getChannelHubManager() {
157                    return _channelHubManager;
158            }
159    
160            public static List<NotificationEvent> getNotificationEvents(
161                            long compnayId, long userId)
162                    throws ChannelException {
163    
164                    return getChannelHubManager().getNotificationEvents(compnayId, userId);
165            }
166    
167            public static List<NotificationEvent> getNotificationEvents(
168                            long compnayId, long userId, boolean flush)
169                    throws ChannelException {
170    
171                    return getChannelHubManager().getNotificationEvents(
172                            compnayId, userId, flush);
173            }
174    
175            public static Collection<Long> getUserIds(long companyId)
176                    throws ChannelException {
177    
178                    return getChannelHubManager().getUserIds(companyId);
179            }
180    
181            public static void registerChannelListener(
182                            long companyId, long userId, ChannelListener channelListener)
183                    throws ChannelException {
184    
185                    getChannelHubManager().registerChannelListener(
186                            companyId, userId, channelListener);
187            }
188    
189            public static void removeTransientNotificationEvents(
190                            long companyId, long userId,
191                            Collection<NotificationEvent> notificationEvents)
192                    throws ChannelException {
193    
194                    getChannelHubManager().removeTransientNotificationEvents(
195                            companyId, userId, notificationEvents);
196            }
197    
198            public static void removeTransientNotificationEventsByUuid(
199                            long companyId, long userId,
200                            Collection<String> notificationEventUuids)
201                    throws ChannelException {
202    
203                    getChannelHubManager().removeTransientNotificationEventsByUuid(
204                            companyId, userId, notificationEventUuids);
205            }
206    
207            public static void sendNotificationEvent(
208                            long companyId, long userId, NotificationEvent notificationEvent)
209                    throws ChannelException {
210    
211                    getChannelHubManager().sendNotificationEvent(
212                            companyId, userId, notificationEvent);
213            }
214    
215            public static void sendNotificationEvents(
216                            long companyId, long userId,
217                            Collection<NotificationEvent> notificationEvents)
218                    throws ChannelException {
219    
220                    getChannelHubManager().sendNotificationEvents(
221                            companyId, userId, notificationEvents);
222            }
223    
224            public static void unregisterChannelListener(
225                            long companyId, long userId, ChannelListener channelListener)
226                    throws ChannelException {
227    
228                    getChannelHubManager().unregisterChannelListener(
229                            companyId, userId, channelListener);
230            }
231    
232            public void setChannelHubManager(ChannelHubManager channelHubManager) {
233                    _channelHubManager = channelHubManager;
234            }
235    
236            private static ChannelHubManager _channelHubManager;
237    
238    }