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 com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.model.UserNotificationEvent;
020    import com.liferay.portal.service.ServiceContext;
021    
022    import java.util.List;
023    import java.util.Map;
024    
025    /**
026     * @author Jonathan Lee
027     */
028    public interface UserNotificationManager {
029    
030            public void addUserNotificationDefinition(
031                    String portletIf,
032                    UserNotificationDefinition userNotificationDefinition);
033    
034            public void addUserNotificationHandler(
035                    UserNotificationHandler userNotificationHandler);
036    
037            public void deleteUserNotificationDefinitions(String portletId);
038    
039            public void deleteUserNotificationHandler(
040                    UserNotificationHandler userNotificationHandler);
041    
042            public UserNotificationDefinition fetchUserNotificationDefinition(
043                    String portletId, long classNameId, int notificationType);
044    
045            public Map<String, List<UserNotificationDefinition>>
046                    getUserNotificationDefinitions();
047    
048            public Map<String, Map<String, UserNotificationHandler>>
049                    getUserNotificationHandlers();
050    
051            public UserNotificationFeedEntry interpret(
052                            String selector, UserNotificationEvent userNotificationEvent,
053                            ServiceContext serviceContext)
054                    throws PortalException;
055    
056            public boolean isDeliver(
057                            long userId, String portletId, long classNameId,
058                            int notificationType, int deliveryType)
059                    throws PortalException, SystemException;
060    
061            public boolean isDeliver(
062                            long userId, String selector, String portletId, long classNameId,
063                            int notificationType, int deliveryType,
064                            ServiceContext serviceContext)
065                    throws PortalException, SystemException;
066    
067    }