View Javadoc

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 java.util.List;
22  
23  import javax.mail.internet.InternetAddress;
24  
25  import org.itracker.model.Issue;
26  import org.itracker.model.Notification;
27  import org.itracker.model.Notification.Role;
28  import org.itracker.model.Notification.Type;
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       * @param issueId the id of the issue to find notifications for
40       * @returns an array of NotificationModels
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       * @param issueId the id of the issue to find notifications for
47       * @returns an array of NotificationModels
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       * @param issueId the id of the issue to find notifications for
56       * @param pimaryOnly only include the primary notifications
57       * @param activeOnly only include the notification if the user is currently active (not locked or deleted)
58       * @returns an array of NotificationModels
59       * @see org.itracker.services.implementations.IssueServiceImpl#getPrimaryIssueNotifications
60       */
61      boolean removeIssueNotification(Integer notificationId);
62      
63      /**
64       * @param issueId
65       * @param primaryOnly
66       * @param activeOnly
67       * @return
68       */
69      List<Notification> getIssueNotifications(Issue issue, boolean primaryOnly, boolean activeOnly);
70      /**
71       * @param issueId
72       * @param userId
73       * @return
74       */
75      boolean hasIssueNotification(Issue issue, Integer userId);
76      public boolean hasIssueNotification(Issue issue, Integer userId, Role role);
77      /**
78       * 
79       * @param notification
80       * @param type
81       * @param baseURL
82       */
83      void sendNotification(Notification notification, Type type, String baseURL);    
84      /**
85       * 
86       * @param issue
87       * @param type
88       * @param baseURL
89       */
90      void sendNotification(Issue issue, Type type, String baseURL);
91      /**
92       * @param issueId
93       * @param type
94       * @param baseURL
95       * @param receipients
96       * @param lastModifiedDays
97       */
98      void sendNotification(Issue issue, Type type, String baseURL, InternetAddress[] receipients, Integer lastModifiedDays);
99      
100 	/**
101 	 * TODO: whats its use? 
102 	 * 
103 	 * Moved from {@link IssueService}, could not find out the purpose of this method. What will happen with this added {@link Notification}?
104 	 * 
105 	 */
106 	boolean addIssueNotification(Notification notification);
107 }