[PORTAL-16 PORTAL-18] Widget ms; staging
[portal.git] / ecomp-portal-BE-common / src / main / java / org / openecomp / portalapp / portal / service / UserNotificationService.java
1 /*-
2  * ================================================================================
3  * ECOMP Portal
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ================================================================================
19  */
20 package org.openecomp.portalapp.portal.service;
21
22 import java.util.List;
23
24 import org.openecomp.portalapp.portal.domain.EPUser;
25 import org.openecomp.portalapp.portal.domain.EcompAppRole;
26 import org.openecomp.portalapp.portal.transport.EpNotificationItem;
27 import org.openecomp.portalapp.portal.transport.EpNotificationItemVO;
28 import org.openecomp.portalapp.portal.transport.EpRoleNotificationItem;
29
30 public interface UserNotificationService {
31
32         /**
33          * Gets the specified notifications with userId from ep_notification
34          * 
35          * @param userId
36          * 
37          * @return the notifications with the specified userId
38          */
39
40         List<EpNotificationItem> getNotifications(Long userId);
41
42         /**
43          * Gets the specified roles from ep_role_notification
44          * 
45          * @param notificationId
46          * 
47          * @return the roles for a specified notification
48          */
49
50         List<EpRoleNotificationItem> getNotificationRoles(Long notificationId);
51
52         /**
53          * Get all app role list from the fn_app and fn_role table
54          * 
55          * @return list of all roles associated with the applications
56          */
57         List<EcompAppRole> getAppRoleList();
58
59         /**
60          * Marks the notification as viewed by the specified user.
61          * 
62          * @param notificationId
63          * @param userId
64          */
65         void setNotificationRead(Long notificationId, int userId);
66
67         /**
68          * Saves the specified notification to the table ep_notification
69          * 
70          * @param notificationItem
71          * @throws Exception
72          */
73
74         String saveNotification(EpNotificationItem notificationItem) throws Exception;
75
76         /**
77          * Gets the specified notification with the userId for view all recent
78          * notifications
79          * 
80          * @param userId
81          * 
82          * @return the notification list
83          */
84
85         List<EpNotificationItemVO> getNotificationHistoryVO(Long userId);
86
87         /**
88          * Gets the notifications with the userId for user notifications
89          * 
90          * @param userId
91          * 
92          * @return the notification list
93          */
94
95         List<EpNotificationItemVO> getAdminNotificationVOS(Long userId);
96
97         /**
98          * Gets the user list from fn_user
99          * 
100          * @param OrgIds
101          * 
102          * @return the users list
103          */
104
105         List<EPUser> getUsersByOrgIds(List<String> OrgIds);
106
107         /**
108          * Gets the received recipient to whom the notification is delivered from
109          * external system
110          * 
111          * @param notificationId
112          * 
113          * @return the active users
114          */
115
116         List<String> getMessageRecipients(Long notificationId);
117
118         /**
119          * delete the records from ep_notification table when the endtime is more
120          * than 3 months
121          * 
122          */
123
124         void deleteNotificationsFromEpNotificationTable();
125
126         /**
127          * delete the records from ep_user_notification table when the endtime is
128          * more than 3 months
129          * 
130          */
131         void deleteNotificationsFromEpUserNotificationTable();
132
133         /**
134          * delete the records from ep_role_notification table when the endtime is
135          * more than 3 months
136          * 
137          */
138         void deleteNotificationsFromEpRoleNotificationTable();
139
140 }