001    /**
002     * Copyright (c) 2000-present 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.HashMap;
018    import java.util.Map;
019    
020    /**
021     * @author Jonathan Lee
022     */
023    public class UserNotificationDefinition {
024    
025            public static final int NOTIFICATION_TYPE_ADD_ENTRY = 0;
026    
027            public static final int NOTIFICATION_TYPE_UPDATE_ENTRY = 1;
028    
029            public UserNotificationDefinition(
030                    String portletId, long classNameId, int notificationType,
031                    String description) {
032    
033                    _portletId = portletId;
034                    _classNameId = classNameId;
035                    _notificationType = notificationType;
036                    _description = description;
037            }
038    
039            public void addUserNotificationDeliveryType(
040                    UserNotificationDeliveryType userNotificationDeliveryType) {
041    
042                    _userNotificationDeliveryTypes.put(
043                            userNotificationDeliveryType.getType(),
044                            userNotificationDeliveryType);
045            }
046    
047            public long getClassNameId() {
048                    return _classNameId;
049            }
050    
051            public String getDescription() {
052                    return _description;
053            }
054    
055            public int getNotificationType() {
056                    return _notificationType;
057            }
058    
059            public String getPortletId() {
060                    return _portletId;
061            }
062    
063            public UserNotificationDeliveryType getUserNotificationDeliveryType(
064                    int deliveryType) {
065    
066                    return _userNotificationDeliveryTypes.get(deliveryType);
067            }
068    
069            public Map<Integer, UserNotificationDeliveryType>
070                    getUserNotificationDeliveryTypes() {
071    
072                    return _userNotificationDeliveryTypes;
073            }
074    
075            private final long _classNameId;
076            private final String _description;
077            private final int _notificationType;
078            private final String _portletId;
079            private final Map<Integer, UserNotificationDeliveryType>
080                    _userNotificationDeliveryTypes = new HashMap<>();
081    
082    }