[PORTAL-7] Rebase
[portal.git] / ecomp-portal-BE-common / src / main / java / org / openecomp / portalapp / portal / transport / EpNotificationItem.java
1 /*-\r
2  * ================================================================================\r
3  * ECOMP Portal\r
4  * ================================================================================\r
5  * Copyright (C) 2017 AT&T Intellectual Property\r
6  * ================================================================================\r
7  * Licensed under the Apache License, Version 2.0 (the "License");\r
8  * you may not use this file except in compliance with the License.\r
9  * You may obtain a copy of the License at\r
10  * \r
11  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  * \r
13  * Unless required by applicable law or agreed to in writing, software\r
14  * distributed under the License is distributed on an "AS IS" BASIS,\r
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  * See the License for the specific language governing permissions and\r
17  * limitations under the License.\r
18  * ================================================================================\r
19  */\r
20 package org.openecomp.portalapp.portal.transport;\r
21 \r
22 import java.util.Date;\r
23 import java.util.List;\r
24 import java.util.Set;\r
25 \r
26 import javax.persistence.CascadeType;\r
27 import javax.persistence.Column;\r
28 import javax.persistence.Entity;\r
29 import javax.persistence.FetchType;\r
30 import javax.persistence.GeneratedValue;\r
31 import javax.persistence.GenerationType;\r
32 import javax.persistence.Id;\r
33 import javax.persistence.JoinColumn;\r
34 import javax.persistence.OneToMany;\r
35 import javax.persistence.Table;\r
36 import javax.persistence.Transient;\r
37 \r
38 import org.openecomp.portalsdk.core.domain.support.DomainVo;\r
39 \r
40 \r
41 /**\r
42  * This is to handle notifications in notification PopUp\r
43  */\r
44 \r
45 \r
46 @Entity\r
47 @Table(name = "ep_notification")\r
48 public class EpNotificationItem extends DomainVo {\r
49         public EpNotificationItem() {\r
50         };\r
51 \r
52         private static final long serialVersionUID = 1L;\r
53 \r
54         @Id\r
55         @GeneratedValue(strategy = GenerationType.IDENTITY)\r
56         @Column(name = "notification_ID")\r
57         public Long notificationId;\r
58 \r
59         @Column(name = "is_for_online_users")\r
60         public String isForOnlineUsers;\r
61 \r
62         @Column(name = "is_for_all_roles")\r
63         public String isForAllRoles;\r
64 \r
65         @Column(name = "active_YN")\r
66         public String activeYn;\r
67         \r
68         @Column(name = "msg_header")\r
69         public String msgHeader;\r
70 \r
71         @Column(name = "msg_description")\r
72         public String msgDescription;\r
73         \r
74         @Column(name = "msg_source")\r
75         public String msgSource;\r
76 \r
77         @Column(name = "start_time")\r
78         public Date startTime;\r
79         \r
80         @Column(name = "end_time")\r
81         public Date endTime;\r
82 \r
83         @Column(name = "priority")\r
84         public Long priority;\r
85         \r
86         @Column(name = "creator_ID")\r
87         public Long creatorId;\r
88         \r
89         @Column(name = "created_date")\r
90         public Date createdDate;\r
91                 \r
92         \r
93         @OneToMany(fetch = FetchType.LAZY, cascade = {CascadeType.ALL}, orphanRemoval = true)\r
94         @JoinColumn(name="notification_ID")\r
95         private Set<EpRoleNotificationItem> roles;\r
96         \r
97         @Transient\r
98         private List<Long> roleIds;\r
99         \r
100         public Long getNotificationId() {\r
101                 return notificationId;\r
102         }\r
103 \r
104         public void setNotificationId(Long notificationId) {\r
105                 this.notificationId = notificationId;\r
106         }\r
107 \r
108         public String getIsForOnlineUsers() {\r
109                 return isForOnlineUsers;\r
110         }\r
111 \r
112         public void setIsForOnlineUsers(String isForOnlineUsers) {\r
113                 this.isForOnlineUsers = isForOnlineUsers;\r
114         }\r
115 \r
116         public String getIsForAllRoles() {\r
117                 return isForAllRoles;\r
118         }\r
119 \r
120         public void setIsForAllRoles(String isForAllRoles) {\r
121                 this.isForAllRoles = isForAllRoles;\r
122         }\r
123         \r
124         public String getActiveYn() {\r
125                 return activeYn;\r
126         }\r
127 \r
128         public void setActiveYn(String activeYn) {\r
129                 this.activeYn = activeYn;\r
130         }\r
131 \r
132         public String getMsgHeader() {\r
133                 return msgHeader;\r
134         }\r
135 \r
136         public void setMsgHeader(String msgHeader) {\r
137                 this.msgHeader = msgHeader;\r
138         }\r
139 \r
140         public String getMsgDescription() {\r
141                 return msgDescription;\r
142         }\r
143 \r
144         public void setMsgDescription(String msgDescription) {\r
145                 this.msgDescription = msgDescription;\r
146         }\r
147 \r
148         public Date getStartTime() {\r
149                 return startTime;\r
150         }\r
151 \r
152         public void setStartTime(Date startTime) {\r
153                 this.startTime = startTime;\r
154         }\r
155 \r
156         public Date getEndTime() {\r
157                 return endTime;\r
158         }\r
159 \r
160         public void setEndTime(Date endTime) {\r
161                 this.endTime = endTime;\r
162         }\r
163 \r
164         public Long getPriority() {\r
165                 return priority;\r
166         }\r
167 \r
168         public void setPriority(Long priority) {\r
169                 this.priority = priority;\r
170         }\r
171 \r
172         public Long getCreatorId() {\r
173                 return creatorId;\r
174         }\r
175 \r
176         public void setCreatorId(Long creatorId) {\r
177                 this.creatorId = creatorId;\r
178         }\r
179 \r
180         public Date getCreatedDate() {\r
181                 return createdDate;\r
182         }\r
183 \r
184         public void setCreatedDate(Date createdDate) {\r
185                 this.createdDate = createdDate;\r
186         }\r
187 \r
188         public static long getSerialversionuid() {\r
189                 return serialVersionUID;\r
190         }\r
191 \r
192         public Set<EpRoleNotificationItem> getRoles() {\r
193                 return roles;\r
194         }\r
195 \r
196         public void setRoles(Set<EpRoleNotificationItem> roles) {\r
197                 this.roles = roles;\r
198         }\r
199 \r
200         public List<Long> getRoleIds() {\r
201                 return roleIds;\r
202         }\r
203 \r
204         public void setRoleIds(List<Long> roleIds) {\r
205                 this.roleIds = roleIds;\r
206         }\r
207         \r
208         public String getMsgSource() {\r
209                 return msgSource;\r
210         }\r
211 \r
212         public void setMsgSource(String msgSource) {\r
213                 this.msgSource = msgSource;\r
214         }\r
215 \r
216         @Override\r
217         public int hashCode() {\r
218                 final int prime = 31;\r
219                 int result = 1;\r
220                 result = prime * result + ((activeYn == null) ? 0 : activeYn.hashCode());\r
221                 result = prime * result + ((createdDate == null) ? 0 : createdDate.hashCode());\r
222                 result = prime * result + ((creatorId == null) ? 0 : creatorId.hashCode());\r
223                 result = prime * result + ((endTime == null) ? 0 : endTime.hashCode());\r
224                 result = prime * result + ((isForAllRoles == null) ? 0 : isForAllRoles.hashCode());\r
225                 result = prime * result + ((isForOnlineUsers == null) ? 0 : isForOnlineUsers.hashCode());\r
226                 result = prime * result + ((msgDescription == null) ? 0 : msgDescription.hashCode());\r
227                 result = prime * result + ((msgHeader == null) ? 0 : msgHeader.hashCode());\r
228                 result = prime * result + ((msgSource == null) ? 0 : msgSource.hashCode());\r
229                 result = prime * result + ((notificationId == null) ? 0 : notificationId.hashCode());\r
230                 result = prime * result + ((priority == null) ? 0 : priority.hashCode());\r
231                 result = prime * result + ((roleIds == null) ? 0 : roleIds.hashCode());\r
232                 result = prime * result + ((roles == null) ? 0 : roles.hashCode());\r
233                 result = prime * result + ((startTime == null) ? 0 : startTime.hashCode());\r
234                 return result;\r
235         }\r
236 \r
237         @Override\r
238         public boolean equals(Object obj) {\r
239                 if (this == obj)\r
240                         return true;\r
241                 if (obj == null)\r
242                         return false;\r
243                 if (getClass() != obj.getClass())\r
244                         return false;\r
245                 EpNotificationItem other = (EpNotificationItem) obj;\r
246                 if (activeYn == null) {\r
247                         if (other.activeYn != null)\r
248                                 return false;\r
249                 } else if (!activeYn.equals(other.activeYn))\r
250                         return false;\r
251                 if (createdDate == null) {\r
252                         if (other.createdDate != null)\r
253                                 return false;\r
254                 } else if (!createdDate.equals(other.createdDate))\r
255                         return false;\r
256                 if (creatorId == null) {\r
257                         if (other.creatorId != null)\r
258                                 return false;\r
259                 } else if (!creatorId.equals(other.creatorId))\r
260                         return false;\r
261                 if (endTime == null) {\r
262                         if (other.endTime != null)\r
263                                 return false;\r
264                 } else if (!endTime.equals(other.endTime))\r
265                         return false;\r
266                 if (isForAllRoles == null) {\r
267                         if (other.isForAllRoles != null)\r
268                                 return false;\r
269                 } else if (!isForAllRoles.equals(other.isForAllRoles))\r
270                         return false;\r
271                 if (isForOnlineUsers == null) {\r
272                         if (other.isForOnlineUsers != null)\r
273                                 return false;\r
274                 } else if (!isForOnlineUsers.equals(other.isForOnlineUsers))\r
275                         return false;\r
276                 if (msgDescription == null) {\r
277                         if (other.msgDescription != null)\r
278                                 return false;\r
279                 } else if (!msgDescription.equals(other.msgDescription))\r
280                         return false;\r
281                 if (msgHeader == null) {\r
282                         if (other.msgHeader != null)\r
283                                 return false;\r
284                 } else if (!msgHeader.equals(other.msgHeader))\r
285                         return false;\r
286                 if (msgSource == null) {\r
287                         if (other.msgSource != null)\r
288                                 return false;\r
289                 } else if (!msgSource.equals(other.msgSource))\r
290                         return false;\r
291                 if (notificationId == null) {\r
292                         if (other.notificationId != null)\r
293                                 return false;\r
294                 } else if (!notificationId.equals(other.notificationId))\r
295                         return false;\r
296                 if (priority == null) {\r
297                         if (other.priority != null)\r
298                                 return false;\r
299                 } else if (!priority.equals(other.priority))\r
300                         return false;\r
301                 if (roleIds == null) {\r
302                         if (other.roleIds != null)\r
303                                 return false;\r
304                 } else if (!roleIds.equals(other.roleIds))\r
305                         return false;\r
306                 if (roles == null) {\r
307                         if (other.roles != null)\r
308                                 return false;\r
309                 } else if (!roles.equals(other.roles))\r
310                         return false;\r
311                 if (startTime == null) {\r
312                         if (other.startTime != null)\r
313                                 return false;\r
314                 } else if (!startTime.equals(other.startTime))\r
315                         return false;\r
316                 return true;\r
317         }\r
318 \r
319         @Override\r
320         public String toString() {\r
321                 return "EpNotificationItem [notificationId=" + notificationId + ", isForOnlineUsers=" + isForOnlineUsers\r
322                                 + ", isForAllRoles=" + isForAllRoles + ", activeYn=" + activeYn + ", msgHeader=" + msgHeader\r
323                                 + ", msgDescription=" + msgDescription + ", msgSource=" + msgSource + ", startTime=" + startTime\r
324                                 + ", endTime=" + endTime + ", priority=" + priority + ", creatorId=" + creatorId + ", createdDate="\r
325                                 + createdDate + ", roles=" + roles + ", roleIds=" + roleIds + "]";\r
326         }\r
327         \r
328 }\r