2 * ================================================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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 * ================================================================================
20 package org.openecomp.portalapp.portal.transport;
22 import java.util.Date;
23 import java.util.List;
26 import javax.persistence.CascadeType;
27 import javax.persistence.Column;
28 import javax.persistence.Entity;
29 import javax.persistence.FetchType;
30 import javax.persistence.GeneratedValue;
31 import javax.persistence.GenerationType;
32 import javax.persistence.Id;
33 import javax.persistence.JoinColumn;
34 import javax.persistence.OneToMany;
35 import javax.persistence.Table;
36 import javax.persistence.Transient;
38 import org.openecomp.portalsdk.core.domain.support.DomainVo;
42 * This is to handle notifications in notification PopUp
47 @Table(name = "ep_notification")
48 public class EpNotificationItem extends DomainVo {
49 public EpNotificationItem() {
52 private static final long serialVersionUID = 1L;
55 @GeneratedValue(strategy = GenerationType.IDENTITY)
56 @Column(name = "notification_ID")
57 public Long notificationId;
59 @Column(name = "is_for_online_users")
60 public String isForOnlineUsers;
62 @Column(name = "is_for_all_roles")
63 public String isForAllRoles;
65 @Column(name = "active_YN")
66 public String activeYn;
68 @Column(name = "msg_header")
69 public String msgHeader;
71 @Column(name = "msg_description")
72 public String msgDescription;
74 @Column(name = "msg_source")
75 public String msgSource;
77 @Column(name = "start_time")
78 public Date startTime;
80 @Column(name = "end_time")
83 @Column(name = "priority")
86 @Column(name = "creator_ID")
87 public Long creatorId;
89 @Column(name = "created_date")
90 public Date createdDate;
92 @Column(name = "notification_hyperlink")
93 public String notificationHyperlink;
96 @OneToMany(fetch = FetchType.LAZY, cascade = {CascadeType.ALL}, orphanRemoval = true)
97 @JoinColumn(name="notification_ID")
98 private Set<EpRoleNotificationItem> roles;
101 private List<Long> roleIds;
103 public Long getNotificationId() {
104 return notificationId;
107 public void setNotificationId(Long notificationId) {
108 this.notificationId = notificationId;
111 public String getIsForOnlineUsers() {
112 return isForOnlineUsers;
115 public void setIsForOnlineUsers(String isForOnlineUsers) {
116 this.isForOnlineUsers = isForOnlineUsers;
119 public String getIsForAllRoles() {
120 return isForAllRoles;
123 public void setIsForAllRoles(String isForAllRoles) {
124 this.isForAllRoles = isForAllRoles;
127 public String getActiveYn() {
131 public void setActiveYn(String activeYn) {
132 this.activeYn = activeYn;
135 public String getMsgHeader() {
139 public void setMsgHeader(String msgHeader) {
140 this.msgHeader = msgHeader;
143 public String getMsgDescription() {
144 return msgDescription;
147 public void setMsgDescription(String msgDescription) {
148 this.msgDescription = msgDescription;
151 public Date getStartTime() {
155 public void setStartTime(Date startTime) {
156 this.startTime = startTime;
159 public Date getEndTime() {
163 public void setEndTime(Date endTime) {
164 this.endTime = endTime;
167 public Long getPriority() {
171 public void setPriority(Long priority) {
172 this.priority = priority;
175 public Long getCreatorId() {
179 public void setCreatorId(Long creatorId) {
180 this.creatorId = creatorId;
183 public Date getCreatedDate() {
187 public void setCreatedDate(Date createdDate) {
188 this.createdDate = createdDate;
191 public static long getSerialversionuid() {
192 return serialVersionUID;
195 public Set<EpRoleNotificationItem> getRoles() {
199 public void setRoles(Set<EpRoleNotificationItem> roles) {
203 public List<Long> getRoleIds() {
207 public void setRoleIds(List<Long> roleIds) {
208 this.roleIds = roleIds;
211 public String getMsgSource() {
215 public void setMsgSource(String msgSource) {
216 this.msgSource = msgSource;
219 public String getNotificationHyperlink() {
220 return notificationHyperlink;
223 public void setNotificationHyperlink(String notificationHyperlink) {
224 this.notificationHyperlink = notificationHyperlink;
228 public int hashCode() {
229 final int prime = 31;
231 result = prime * result + ((activeYn == null) ? 0 : activeYn.hashCode());
232 result = prime * result + ((createdDate == null) ? 0 : createdDate.hashCode());
233 result = prime * result + ((creatorId == null) ? 0 : creatorId.hashCode());
234 result = prime * result + ((endTime == null) ? 0 : endTime.hashCode());
235 result = prime * result + ((isForAllRoles == null) ? 0 : isForAllRoles.hashCode());
236 result = prime * result + ((isForOnlineUsers == null) ? 0 : isForOnlineUsers.hashCode());
237 result = prime * result + ((msgDescription == null) ? 0 : msgDescription.hashCode());
238 result = prime * result + ((msgHeader == null) ? 0 : msgHeader.hashCode());
239 result = prime * result + ((msgSource == null) ? 0 : msgSource.hashCode());
240 result = prime * result + ((notificationId == null) ? 0 : notificationId.hashCode());
241 result = prime * result + ((priority == null) ? 0 : priority.hashCode());
242 result = prime * result + ((roleIds == null) ? 0 : roleIds.hashCode());
243 result = prime * result + ((roles == null) ? 0 : roles.hashCode());
244 result = prime * result + ((startTime == null) ? 0 : startTime.hashCode());
249 public boolean equals(Object obj) {
254 if (getClass() != obj.getClass())
256 EpNotificationItem other = (EpNotificationItem) obj;
257 if (activeYn == null) {
258 if (other.activeYn != null)
260 } else if (!activeYn.equals(other.activeYn))
262 if (createdDate == null) {
263 if (other.createdDate != null)
265 } else if (!createdDate.equals(other.createdDate))
267 if (creatorId == null) {
268 if (other.creatorId != null)
270 } else if (!creatorId.equals(other.creatorId))
272 if (endTime == null) {
273 if (other.endTime != null)
275 } else if (!endTime.equals(other.endTime))
277 if (isForAllRoles == null) {
278 if (other.isForAllRoles != null)
280 } else if (!isForAllRoles.equals(other.isForAllRoles))
282 if (isForOnlineUsers == null) {
283 if (other.isForOnlineUsers != null)
285 } else if (!isForOnlineUsers.equals(other.isForOnlineUsers))
287 if (msgDescription == null) {
288 if (other.msgDescription != null)
290 } else if (!msgDescription.equals(other.msgDescription))
292 if (msgHeader == null) {
293 if (other.msgHeader != null)
295 } else if (!msgHeader.equals(other.msgHeader))
297 if (msgSource == null) {
298 if (other.msgSource != null)
300 } else if (!msgSource.equals(other.msgSource))
302 if (notificationId == null) {
303 if (other.notificationId != null)
305 } else if (!notificationId.equals(other.notificationId))
307 if (priority == null) {
308 if (other.priority != null)
310 } else if (!priority.equals(other.priority))
312 if (roleIds == null) {
313 if (other.roleIds != null)
315 } else if (!roleIds.equals(other.roleIds))
318 if (other.roles != null)
320 } else if (!roles.equals(other.roles))
322 if (startTime == null) {
323 if (other.startTime != null)
325 } else if (!startTime.equals(other.startTime))
331 public String toString() {
332 return "EpNotificationItem [notificationId=" + notificationId + ", isForOnlineUsers=" + isForOnlineUsers
333 + ", isForAllRoles=" + isForAllRoles + ", activeYn=" + activeYn + ", msgHeader=" + msgHeader
334 + ", msgDescription=" + msgDescription + ", msgSource=" + msgSource + ", startTime=" + startTime
335 + ", endTime=" + endTime + ", priority=" + priority + ", creatorId=" + creatorId + ", createdDate="
336 + createdDate + ", roles=" + roles + ", roleIds=" + roleIds + "]";