1 /*
2 * This software was designed and created by Jason Carroll.
3 * Copyright (c) 2002, 2003, 2004 Jason Carroll.
4 * The author can be reached at jcarroll@cowsultants.com
5 * ITracker website: http://www.cowsultants.com
6 * ITracker forums: http://www.cowsultants.com/phpBB/index.php
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it only under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
18
19 package org.itracker.services;
20
21 import org.itracker.model.Issue;
22 import org.itracker.model.Notification;
23 import org.itracker.model.Notification.Role;
24 import org.itracker.model.Notification.Type;
25 import org.itracker.model.User;
26
27 import javax.mail.internet.InternetAddress;
28 import java.util.List;
29
30
31 public interface NotificationService {
32
33
34 /**
35 * Retrieves the primary issue notifications. Primary notifications
36 * are defined as the issue owner (or creator if not assigned), and any project owners.
37 * This should encompass the list of people that should be notified so that action
38 * can be taken on an issue that needs immediate attention.
39 *
40 * @param issue the issue to find notifications for
41 */
42 List<Notification> getPrimaryIssueNotifications(Issue issue);
43
44 /**
45 * Retrieves all notifications for an issue where the notification's user is also active.
46 *
47 * @param issue the issue to find notifications for
48 */
49 List<Notification> getIssueNotifications(Issue issue);
50
51 /**
52 * Retrieves an array of issue notifications. The notifications by default
53 * is the creator and owner of the issue, all project admins for the issue's project,
54 * and anyone else that has a notfication on file.
55 *
56 * @param notificationId id of the notification
57 */
58 boolean removeIssueNotification(Integer notificationId);
59
60 /**
61 * @param issue
62 * @param primaryOnly
63 * @param activeOnly
64 * @return
65 */
66 List<Notification> getIssueNotifications(Issue issue, boolean primaryOnly, boolean activeOnly);
67
68 /**
69 * @param issue
70 * @param userId
71 * @return
72 */
73 boolean hasIssueNotification(Issue issue, Integer userId);
74
75 boolean hasIssueNotification(Issue issue, String login);
76 boolean hasIssueNotification(Issue issue, String login, Role role);
77 boolean hasIssueNotification(Issue issue, Integer userId, Role role);
78
79 /**
80 * @param notification
81 * @param type
82 * @param baseURL
83 */
84 void sendNotification(Notification notification, Type type, String baseURL);
85
86 /**
87 * @param issue
88 * @param type
89 * @param baseURL
90 */
91 void sendNotification(Issue issue, Type type, String baseURL);
92
93 /**
94 * @param issue
95 * @param type
96 * @param baseURL
97 * @param receipients
98 * @param lastModifiedDays
99 * @deprecated
100 */
101 @Deprecated
102 void sendNotification(Issue issue, Type type, String baseURL, InternetAddress[] receipients, Integer lastModifiedDays);
103
104 /**
105 * TODO: whats its use?
106 * <p/>
107 * Moved from {@link IssueService}, could not find out the purpose of this method. What will happen with this added {@link Notification}?
108 */
109 boolean addIssueNotification(Notification notification);
110
111 void sendReminder(Issue issue, User user, String baseURL, int issueAge);
112 }