2 * ================================================================================
\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
11 * http://www.apache.org/licenses/LICENSE-2.0
\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
20 package org.openecomp.portalapp.portal.transport;
\r
22 import java.util.Date;
\r
23 import java.util.List;
\r
24 import java.util.Set;
\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
38 import org.openecomp.portalsdk.core.domain.support.DomainVo;
\r
42 * This is to handle notifications in notification PopUp
\r
47 @Table(name = "ep_notification")
\r
48 public class EpNotificationItem extends DomainVo {
\r
49 public EpNotificationItem() {
\r
52 private static final long serialVersionUID = 1L;
\r
55 @GeneratedValue(strategy = GenerationType.IDENTITY)
\r
56 @Column(name = "notification_ID")
\r
57 public Long notificationId;
\r
59 @Column(name = "is_for_online_users")
\r
60 public String isForOnlineUsers;
\r
62 @Column(name = "is_for_all_roles")
\r
63 public String isForAllRoles;
\r
65 @Column(name = "active_YN")
\r
66 public String activeYn;
\r
68 @Column(name = "msg_header")
\r
69 public String msgHeader;
\r
71 @Column(name = "msg_description")
\r
72 public String msgDescription;
\r
74 @Column(name = "msg_source")
\r
75 public String msgSource;
\r
77 @Column(name = "start_time")
\r
78 public Date startTime;
\r
80 @Column(name = "end_time")
\r
81 public Date endTime;
\r
83 @Column(name = "priority")
\r
84 public Long priority;
\r
86 @Column(name = "creator_ID")
\r
87 public Long creatorId;
\r
89 @Column(name = "created_date")
\r
90 public Date createdDate;
\r
93 @OneToMany(fetch = FetchType.LAZY, cascade = {CascadeType.ALL}, orphanRemoval = true)
\r
94 @JoinColumn(name="notification_ID")
\r
95 private Set<EpRoleNotificationItem> roles;
\r
98 private List<Long> roleIds;
\r
100 public Long getNotificationId() {
\r
101 return notificationId;
\r
104 public void setNotificationId(Long notificationId) {
\r
105 this.notificationId = notificationId;
\r
108 public String getIsForOnlineUsers() {
\r
109 return isForOnlineUsers;
\r
112 public void setIsForOnlineUsers(String isForOnlineUsers) {
\r
113 this.isForOnlineUsers = isForOnlineUsers;
\r
116 public String getIsForAllRoles() {
\r
117 return isForAllRoles;
\r
120 public void setIsForAllRoles(String isForAllRoles) {
\r
121 this.isForAllRoles = isForAllRoles;
\r
124 public String getActiveYn() {
\r
128 public void setActiveYn(String activeYn) {
\r
129 this.activeYn = activeYn;
\r
132 public String getMsgHeader() {
\r
136 public void setMsgHeader(String msgHeader) {
\r
137 this.msgHeader = msgHeader;
\r
140 public String getMsgDescription() {
\r
141 return msgDescription;
\r
144 public void setMsgDescription(String msgDescription) {
\r
145 this.msgDescription = msgDescription;
\r
148 public Date getStartTime() {
\r
152 public void setStartTime(Date startTime) {
\r
153 this.startTime = startTime;
\r
156 public Date getEndTime() {
\r
160 public void setEndTime(Date endTime) {
\r
161 this.endTime = endTime;
\r
164 public Long getPriority() {
\r
168 public void setPriority(Long priority) {
\r
169 this.priority = priority;
\r
172 public Long getCreatorId() {
\r
176 public void setCreatorId(Long creatorId) {
\r
177 this.creatorId = creatorId;
\r
180 public Date getCreatedDate() {
\r
181 return createdDate;
\r
184 public void setCreatedDate(Date createdDate) {
\r
185 this.createdDate = createdDate;
\r
188 public static long getSerialversionuid() {
\r
189 return serialVersionUID;
\r
192 public Set<EpRoleNotificationItem> getRoles() {
\r
196 public void setRoles(Set<EpRoleNotificationItem> roles) {
\r
197 this.roles = roles;
\r
200 public List<Long> getRoleIds() {
\r
204 public void setRoleIds(List<Long> roleIds) {
\r
205 this.roleIds = roleIds;
\r
208 public String getMsgSource() {
\r
212 public void setMsgSource(String msgSource) {
\r
213 this.msgSource = msgSource;
\r
217 public int hashCode() {
\r
218 final int prime = 31;
\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
238 public boolean equals(Object obj) {
\r
243 if (getClass() != obj.getClass())
\r
245 EpNotificationItem other = (EpNotificationItem) obj;
\r
246 if (activeYn == null) {
\r
247 if (other.activeYn != null)
\r
249 } else if (!activeYn.equals(other.activeYn))
\r
251 if (createdDate == null) {
\r
252 if (other.createdDate != null)
\r
254 } else if (!createdDate.equals(other.createdDate))
\r
256 if (creatorId == null) {
\r
257 if (other.creatorId != null)
\r
259 } else if (!creatorId.equals(other.creatorId))
\r
261 if (endTime == null) {
\r
262 if (other.endTime != null)
\r
264 } else if (!endTime.equals(other.endTime))
\r
266 if (isForAllRoles == null) {
\r
267 if (other.isForAllRoles != null)
\r
269 } else if (!isForAllRoles.equals(other.isForAllRoles))
\r
271 if (isForOnlineUsers == null) {
\r
272 if (other.isForOnlineUsers != null)
\r
274 } else if (!isForOnlineUsers.equals(other.isForOnlineUsers))
\r
276 if (msgDescription == null) {
\r
277 if (other.msgDescription != null)
\r
279 } else if (!msgDescription.equals(other.msgDescription))
\r
281 if (msgHeader == null) {
\r
282 if (other.msgHeader != null)
\r
284 } else if (!msgHeader.equals(other.msgHeader))
\r
286 if (msgSource == null) {
\r
287 if (other.msgSource != null)
\r
289 } else if (!msgSource.equals(other.msgSource))
\r
291 if (notificationId == null) {
\r
292 if (other.notificationId != null)
\r
294 } else if (!notificationId.equals(other.notificationId))
\r
296 if (priority == null) {
\r
297 if (other.priority != null)
\r
299 } else if (!priority.equals(other.priority))
\r
301 if (roleIds == null) {
\r
302 if (other.roleIds != null)
\r
304 } else if (!roleIds.equals(other.roleIds))
\r
306 if (roles == null) {
\r
307 if (other.roles != null)
\r
309 } else if (!roles.equals(other.roles))
\r
311 if (startTime == null) {
\r
312 if (other.startTime != null)
\r
314 } else if (!startTime.equals(other.startTime))
\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