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;
 
  93         @OneToMany(fetch = FetchType.LAZY, cascade = {CascadeType.ALL}, orphanRemoval = true)
 
  94         @JoinColumn(name="notification_ID")
 
  95         private Set<EpRoleNotificationItem> roles;
 
  98         private List<Long> roleIds;
 
 100         public Long getNotificationId() {
 
 101                 return notificationId;
 
 104         public void setNotificationId(Long notificationId) {
 
 105                 this.notificationId = notificationId;
 
 108         public String getIsForOnlineUsers() {
 
 109                 return isForOnlineUsers;
 
 112         public void setIsForOnlineUsers(String isForOnlineUsers) {
 
 113                 this.isForOnlineUsers = isForOnlineUsers;
 
 116         public String getIsForAllRoles() {
 
 117                 return isForAllRoles;
 
 120         public void setIsForAllRoles(String isForAllRoles) {
 
 121                 this.isForAllRoles = isForAllRoles;
 
 124         public String getActiveYn() {
 
 128         public void setActiveYn(String activeYn) {
 
 129                 this.activeYn = activeYn;
 
 132         public String getMsgHeader() {
 
 136         public void setMsgHeader(String msgHeader) {
 
 137                 this.msgHeader = msgHeader;
 
 140         public String getMsgDescription() {
 
 141                 return msgDescription;
 
 144         public void setMsgDescription(String msgDescription) {
 
 145                 this.msgDescription = msgDescription;
 
 148         public Date getStartTime() {
 
 152         public void setStartTime(Date startTime) {
 
 153                 this.startTime = startTime;
 
 156         public Date getEndTime() {
 
 160         public void setEndTime(Date endTime) {
 
 161                 this.endTime = endTime;
 
 164         public Long getPriority() {
 
 168         public void setPriority(Long priority) {
 
 169                 this.priority = priority;
 
 172         public Long getCreatorId() {
 
 176         public void setCreatorId(Long creatorId) {
 
 177                 this.creatorId = creatorId;
 
 180         public Date getCreatedDate() {
 
 184         public void setCreatedDate(Date createdDate) {
 
 185                 this.createdDate = createdDate;
 
 188         public static long getSerialversionuid() {
 
 189                 return serialVersionUID;
 
 192         public Set<EpRoleNotificationItem> getRoles() {
 
 196         public void setRoles(Set<EpRoleNotificationItem> roles) {
 
 200         public List<Long> getRoleIds() {
 
 204         public void setRoleIds(List<Long> roleIds) {
 
 205                 this.roleIds = roleIds;
 
 208         public String getMsgSource() {
 
 212         public void setMsgSource(String msgSource) {
 
 213                 this.msgSource = msgSource;
 
 217         public int hashCode() {
 
 218                 final int prime = 31;
 
 220                 result = prime * result + ((activeYn == null) ? 0 : activeYn.hashCode());
 
 221                 result = prime * result + ((createdDate == null) ? 0 : createdDate.hashCode());
 
 222                 result = prime * result + ((creatorId == null) ? 0 : creatorId.hashCode());
 
 223                 result = prime * result + ((endTime == null) ? 0 : endTime.hashCode());
 
 224                 result = prime * result + ((isForAllRoles == null) ? 0 : isForAllRoles.hashCode());
 
 225                 result = prime * result + ((isForOnlineUsers == null) ? 0 : isForOnlineUsers.hashCode());
 
 226                 result = prime * result + ((msgDescription == null) ? 0 : msgDescription.hashCode());
 
 227                 result = prime * result + ((msgHeader == null) ? 0 : msgHeader.hashCode());
 
 228                 result = prime * result + ((msgSource == null) ? 0 : msgSource.hashCode());
 
 229                 result = prime * result + ((notificationId == null) ? 0 : notificationId.hashCode());
 
 230                 result = prime * result + ((priority == null) ? 0 : priority.hashCode());
 
 231                 result = prime * result + ((roleIds == null) ? 0 : roleIds.hashCode());
 
 232                 result = prime * result + ((roles == null) ? 0 : roles.hashCode());
 
 233                 result = prime * result + ((startTime == null) ? 0 : startTime.hashCode());
 
 238         public boolean equals(Object obj) {
 
 243                 if (getClass() != obj.getClass())
 
 245                 EpNotificationItem other = (EpNotificationItem) obj;
 
 246                 if (activeYn == null) {
 
 247                         if (other.activeYn != null)
 
 249                 } else if (!activeYn.equals(other.activeYn))
 
 251                 if (createdDate == null) {
 
 252                         if (other.createdDate != null)
 
 254                 } else if (!createdDate.equals(other.createdDate))
 
 256                 if (creatorId == null) {
 
 257                         if (other.creatorId != null)
 
 259                 } else if (!creatorId.equals(other.creatorId))
 
 261                 if (endTime == null) {
 
 262                         if (other.endTime != null)
 
 264                 } else if (!endTime.equals(other.endTime))
 
 266                 if (isForAllRoles == null) {
 
 267                         if (other.isForAllRoles != null)
 
 269                 } else if (!isForAllRoles.equals(other.isForAllRoles))
 
 271                 if (isForOnlineUsers == null) {
 
 272                         if (other.isForOnlineUsers != null)
 
 274                 } else if (!isForOnlineUsers.equals(other.isForOnlineUsers))
 
 276                 if (msgDescription == null) {
 
 277                         if (other.msgDescription != null)
 
 279                 } else if (!msgDescription.equals(other.msgDescription))
 
 281                 if (msgHeader == null) {
 
 282                         if (other.msgHeader != null)
 
 284                 } else if (!msgHeader.equals(other.msgHeader))
 
 286                 if (msgSource == null) {
 
 287                         if (other.msgSource != null)
 
 289                 } else if (!msgSource.equals(other.msgSource))
 
 291                 if (notificationId == null) {
 
 292                         if (other.notificationId != null)
 
 294                 } else if (!notificationId.equals(other.notificationId))
 
 296                 if (priority == null) {
 
 297                         if (other.priority != null)
 
 299                 } else if (!priority.equals(other.priority))
 
 301                 if (roleIds == null) {
 
 302                         if (other.roleIds != null)
 
 304                 } else if (!roleIds.equals(other.roleIds))
 
 307                         if (other.roles != null)
 
 309                 } else if (!roles.equals(other.roles))
 
 311                 if (startTime == null) {
 
 312                         if (other.startTime != null)
 
 314                 } else if (!startTime.equals(other.startTime))
 
 320         public String toString() {
 
 321                 return "EpNotificationItem [notificationId=" + notificationId + ", isForOnlineUsers=" + isForOnlineUsers
 
 322                                 + ", isForAllRoles=" + isForAllRoles + ", activeYn=" + activeYn + ", msgHeader=" + msgHeader
 
 323                                 + ", msgDescription=" + msgDescription + ", msgSource=" + msgSource + ", startTime=" + startTime
 
 324                                 + ", endTime=" + endTime + ", priority=" + priority + ", creatorId=" + creatorId + ", createdDate="
 
 325                                 + createdDate + ", roles=" + roles + ", roleIds=" + roleIds + "]";