2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ===================================================================
8 * Unless otherwise specified, all software contained herein is licensed
9 * under the Apache License, Version 2.0 (the "License");
10 * you may not use this software except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
21 * Unless otherwise specified, all documentation contained herein is licensed
22 * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
23 * you may not use this documentation except in compliance with the License.
24 * You may obtain a copy of the License at
26 * https://creativecommons.org/licenses/by/4.0/
28 * Unless required by applicable law or agreed to in writing, documentation
29 * distributed under the License is distributed on an "AS IS" BASIS,
30 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31 * See the License for the specific language governing permissions and
32 * limitations under the License.
34 * ============LICENSE_END============================================
38 package org.onap.portalapp.portal.transport;
40 import java.util.Date;
41 import java.util.List;
44 import javax.persistence.CascadeType;
45 import javax.persistence.Column;
46 import javax.persistence.Entity;
47 import javax.persistence.FetchType;
48 import javax.persistence.GeneratedValue;
49 import javax.persistence.GenerationType;
50 import javax.persistence.Id;
51 import javax.persistence.JoinColumn;
52 import javax.persistence.OneToMany;
53 import javax.persistence.Table;
54 import javax.persistence.Transient;
56 import org.onap.portalsdk.core.domain.support.DomainVo;
60 * This is to handle notifications in notification PopUp
65 @Table(name = "ep_notification")
66 public class EpNotificationItem extends DomainVo {
67 public EpNotificationItem() {
70 private static final long serialVersionUID = 1L;
73 @GeneratedValue(strategy = GenerationType.IDENTITY)
74 @Column(name = "notification_ID")
75 public Long notificationId;
77 @Column(name = "is_for_online_users")
78 public String isForOnlineUsers;
80 @Column(name = "is_for_all_roles")
81 public String isForAllRoles;
83 @Column(name = "active_YN")
84 public String activeYn;
86 @Column(name = "msg_header")
87 public String msgHeader;
89 @Column(name = "msg_description")
90 public String msgDescription;
92 @Column(name = "msg_source")
93 public String msgSource;
95 @Column(name = "start_time")
96 public Date startTime;
98 @Column(name = "end_time")
101 @Column(name = "priority")
102 public Long priority;
104 @Column(name = "creator_ID")
105 public Long creatorId;
107 @Column(name = "created_date")
108 public Date createdDate;
110 @Column(name = "notification_hyperlink")
111 public String notificationHyperlink;
114 @OneToMany(fetch = FetchType.LAZY, cascade = {CascadeType.ALL}, orphanRemoval = true)
115 @JoinColumn(name="notification_ID")
116 private Set<EpRoleNotificationItem> roles;
119 private List<Long> roleIds;
121 public Long getNotificationId() {
122 return notificationId;
125 public void setNotificationId(Long notificationId) {
126 this.notificationId = notificationId;
129 public String getIsForOnlineUsers() {
130 return isForOnlineUsers;
133 public void setIsForOnlineUsers(String isForOnlineUsers) {
134 this.isForOnlineUsers = isForOnlineUsers;
137 public String getIsForAllRoles() {
138 return isForAllRoles;
141 public void setIsForAllRoles(String isForAllRoles) {
142 this.isForAllRoles = isForAllRoles;
145 public String getActiveYn() {
149 public void setActiveYn(String activeYn) {
150 this.activeYn = activeYn;
153 public String getMsgHeader() {
157 public void setMsgHeader(String msgHeader) {
158 this.msgHeader = msgHeader;
161 public String getMsgDescription() {
162 return msgDescription;
165 public void setMsgDescription(String msgDescription) {
166 this.msgDescription = msgDescription;
169 public Date getStartTime() {
173 public void setStartTime(Date startTime) {
174 this.startTime = startTime;
177 public Date getEndTime() {
181 public void setEndTime(Date endTime) {
182 this.endTime = endTime;
185 public Long getPriority() {
189 public void setPriority(Long priority) {
190 this.priority = priority;
193 public Long getCreatorId() {
197 public void setCreatorId(Long creatorId) {
198 this.creatorId = creatorId;
201 public Date getCreatedDate() {
205 public void setCreatedDate(Date createdDate) {
206 this.createdDate = createdDate;
209 public static long getSerialversionuid() {
210 return serialVersionUID;
213 public Set<EpRoleNotificationItem> getRoles() {
217 public void setRoles(Set<EpRoleNotificationItem> roles) {
221 public List<Long> getRoleIds() {
225 public void setRoleIds(List<Long> roleIds) {
226 this.roleIds = roleIds;
229 public String getMsgSource() {
233 public void setMsgSource(String msgSource) {
234 this.msgSource = msgSource;
237 public String getNotificationHyperlink() {
238 return notificationHyperlink;
241 public void setNotificationHyperlink(String notificationHyperlink) {
242 this.notificationHyperlink = notificationHyperlink;
246 public int hashCode() {
247 final int prime = 31;
249 result = prime * result + ((activeYn == null) ? 0 : activeYn.hashCode());
250 result = prime * result + ((createdDate == null) ? 0 : createdDate.hashCode());
251 result = prime * result + ((creatorId == null) ? 0 : creatorId.hashCode());
252 result = prime * result + ((endTime == null) ? 0 : endTime.hashCode());
253 result = prime * result + ((isForAllRoles == null) ? 0 : isForAllRoles.hashCode());
254 result = prime * result + ((isForOnlineUsers == null) ? 0 : isForOnlineUsers.hashCode());
255 result = prime * result + ((msgDescription == null) ? 0 : msgDescription.hashCode());
256 result = prime * result + ((msgHeader == null) ? 0 : msgHeader.hashCode());
257 result = prime * result + ((msgSource == null) ? 0 : msgSource.hashCode());
258 result = prime * result + ((notificationId == null) ? 0 : notificationId.hashCode());
259 result = prime * result + ((priority == null) ? 0 : priority.hashCode());
260 result = prime * result + ((roleIds == null) ? 0 : roleIds.hashCode());
261 result = prime * result + ((roles == null) ? 0 : roles.hashCode());
262 result = prime * result + ((startTime == null) ? 0 : startTime.hashCode());
267 public boolean equals(Object obj) {
272 if (getClass() != obj.getClass())
274 EpNotificationItem other = (EpNotificationItem) obj;
275 if (activeYn == null) {
276 if (other.activeYn != null)
278 } else if (!activeYn.equals(other.activeYn))
280 if (createdDate == null) {
281 if (other.createdDate != null)
283 } else if (!createdDate.equals(other.createdDate))
285 if (creatorId == null) {
286 if (other.creatorId != null)
288 } else if (!creatorId.equals(other.creatorId))
290 if (endTime == null) {
291 if (other.endTime != null)
293 } else if (!endTime.equals(other.endTime))
295 if (isForAllRoles == null) {
296 if (other.isForAllRoles != null)
298 } else if (!isForAllRoles.equals(other.isForAllRoles))
300 if (isForOnlineUsers == null) {
301 if (other.isForOnlineUsers != null)
303 } else if (!isForOnlineUsers.equals(other.isForOnlineUsers))
305 if (msgDescription == null) {
306 if (other.msgDescription != null)
308 } else if (!msgDescription.equals(other.msgDescription))
310 if (msgHeader == null) {
311 if (other.msgHeader != null)
313 } else if (!msgHeader.equals(other.msgHeader))
315 if (msgSource == null) {
316 if (other.msgSource != null)
318 } else if (!msgSource.equals(other.msgSource))
320 if (notificationId == null) {
321 if (other.notificationId != null)
323 } else if (!notificationId.equals(other.notificationId))
325 if (priority == null) {
326 if (other.priority != null)
328 } else if (!priority.equals(other.priority))
330 if (roleIds == null) {
331 if (other.roleIds != null)
333 } else if (!roleIds.equals(other.roleIds))
336 if (other.roles != null)
338 } else if (!roles.equals(other.roles))
340 if (startTime == null) {
341 if (other.startTime != null)
343 } else if (!startTime.equals(other.startTime))
349 public String toString() {
350 return "EpNotificationItem [notificationId=" + notificationId + ", isForOnlineUsers=" + isForOnlineUsers
351 + ", isForAllRoles=" + isForAllRoles + ", activeYn=" + activeYn + ", msgHeader=" + msgHeader
352 + ", msgDescription=" + msgDescription + ", msgSource=" + msgSource + ", startTime=" + startTime
353 + ", endTime=" + endTime + ", priority=" + priority + ", creatorId=" + creatorId + ", createdDate="
354 + createdDate + ", roles=" + roles + ", roleIds=" + roleIds + "]";