| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.rice.ken.bo; |
| 17 | |
|
| 18 | |
import org.apache.commons.lang.StringUtils; |
| 19 | |
import org.hibernate.annotations.GenericGenerator; |
| 20 | |
import org.hibernate.annotations.Parameter; |
| 21 | |
import org.kuali.rice.ken.util.NotificationConstants; |
| 22 | |
import org.kuali.rice.krad.bo.PersistableBusinessObjectBase; |
| 23 | |
|
| 24 | |
import javax.persistence.*; |
| 25 | |
import java.sql.Timestamp; |
| 26 | |
import java.util.ArrayList; |
| 27 | |
import java.util.List; |
| 28 | |
|
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | |
|
| 33 | |
|
| 34 | |
@Entity |
| 35 | |
@Table(name="KREN_NTFCTN_T") |
| 36 | |
public class Notification extends PersistableBusinessObjectBase implements Lockable { |
| 37 | |
|
| 38 | |
@Id |
| 39 | |
@GeneratedValue(generator="KREN_NTFCTN_S") |
| 40 | |
@GenericGenerator(name="KREN_NTFCTN_S",strategy="org.hibernate.id.enhanced.SequenceStyleGenerator",parameters={ |
| 41 | |
@Parameter(name="sequence_name",value="KREN_NTFCTN_S"), |
| 42 | |
@Parameter(name="value_column",value="id") |
| 43 | |
}) |
| 44 | |
@Column(name="NTFCTN_ID") |
| 45 | |
private Long id; |
| 46 | |
@Column(name="DELIV_TYP", nullable=false) |
| 47 | |
private String deliveryType; |
| 48 | |
@Column(name="CRTE_DTTM", nullable=false) |
| 49 | |
private Timestamp creationDateTime; |
| 50 | |
@Column(name="SND_DTTM", nullable=true) |
| 51 | |
private Timestamp sendDateTime; |
| 52 | |
@Column(name="AUTO_RMV_DTTM", nullable=true) |
| 53 | |
private Timestamp autoRemoveDateTime; |
| 54 | |
@Column(name="TTL", nullable=true) |
| 55 | |
private String title; |
| 56 | |
@Lob |
| 57 | |
@Basic(fetch=FetchType.LAZY) |
| 58 | |
@Column(name="CNTNT", nullable=false) |
| 59 | |
private String content; |
| 60 | |
@Column(name="PROCESSING_FLAG", nullable=false) |
| 61 | |
private String processingFlag; |
| 62 | |
@Column(name="LOCKD_DTTM", nullable=true) |
| 63 | |
private Timestamp lockedDate; |
| 64 | |
|
| 65 | |
|
| 66 | |
|
| 67 | |
|
| 68 | |
|
| 69 | |
|
| 70 | |
|
| 71 | |
|
| 72 | |
@OneToOne(fetch=FetchType.EAGER, cascade={CascadeType.REFRESH, CascadeType.DETACH}) |
| 73 | |
@JoinColumn(name="PRIO_ID") |
| 74 | |
private NotificationPriority priority; |
| 75 | |
@OneToOne(fetch=FetchType.EAGER, cascade={CascadeType.REFRESH, CascadeType.DETACH}) |
| 76 | |
@JoinColumn(name="CNTNT_TYP_ID") |
| 77 | |
private NotificationContentType contentType; |
| 78 | |
@OneToOne(fetch=FetchType.EAGER, cascade={CascadeType.REFRESH, CascadeType.DETACH}) |
| 79 | |
@JoinColumn(name="CHNL_ID") |
| 80 | |
private NotificationChannel channel; |
| 81 | |
@OneToOne(fetch=FetchType.EAGER, cascade={CascadeType.REFRESH, CascadeType.DETACH}) |
| 82 | |
@JoinColumn(name="PRODCR_ID") |
| 83 | |
private NotificationProducer producer; |
| 84 | |
|
| 85 | |
|
| 86 | |
@OneToMany(cascade={CascadeType.ALL}, |
| 87 | |
targetEntity=org.kuali.rice.ken.bo.NotificationRecipient.class, mappedBy="notification") |
| 88 | |
@OrderBy("id ASC") |
| 89 | |
private List<NotificationRecipient> recipients; |
| 90 | |
@OneToMany(cascade={CascadeType.ALL}, |
| 91 | |
targetEntity=org.kuali.rice.ken.bo.NotificationSender.class, mappedBy="notification") |
| 92 | |
@OrderBy("id ASC") |
| 93 | |
private List<NotificationSender> senders; |
| 94 | |
|
| 95 | |
|
| 96 | |
|
| 97 | |
|
| 98 | 0 | public Notification() { |
| 99 | 0 | recipients = new ArrayList<NotificationRecipient>(); |
| 100 | 0 | senders = new ArrayList<NotificationSender>(); |
| 101 | 0 | processingFlag = NotificationConstants.PROCESSING_FLAGS.UNRESOLVED; |
| 102 | 0 | } |
| 103 | |
|
| 104 | |
|
| 105 | |
|
| 106 | |
|
| 107 | |
|
| 108 | |
public Timestamp getCreationDateTime() { |
| 109 | 0 | return creationDateTime; |
| 110 | |
} |
| 111 | |
|
| 112 | |
|
| 113 | |
|
| 114 | |
|
| 115 | |
|
| 116 | |
public void setCreationDateTime(Timestamp created) { |
| 117 | 0 | this.creationDateTime = created; |
| 118 | 0 | } |
| 119 | |
|
| 120 | |
|
| 121 | |
|
| 122 | |
|
| 123 | |
|
| 124 | |
|
| 125 | |
public Integer getLockVerNbr() { |
| 126 | 0 | return Integer.valueOf(super.getVersionNumber().intValue()); |
| 127 | |
} |
| 128 | |
|
| 129 | |
|
| 130 | |
|
| 131 | |
|
| 132 | |
|
| 133 | |
|
| 134 | |
public void setLockVerNbr(Integer lockVerNbr) { |
| 135 | 0 | super.setVersionNumber(lockVerNbr.longValue()); |
| 136 | 0 | } |
| 137 | |
|
| 138 | |
|
| 139 | |
|
| 140 | |
|
| 141 | |
|
| 142 | |
public List<NotificationRecipient> getRecipients() { |
| 143 | 0 | return recipients; |
| 144 | |
} |
| 145 | |
|
| 146 | |
|
| 147 | |
|
| 148 | |
|
| 149 | |
|
| 150 | |
public void setRecipients(List<NotificationRecipient> recipients) { |
| 151 | 0 | this.recipients = recipients; |
| 152 | 0 | } |
| 153 | |
|
| 154 | |
|
| 155 | |
|
| 156 | |
|
| 157 | |
|
| 158 | |
|
| 159 | |
public NotificationRecipient getRecipient(int index) { |
| 160 | 0 | return (NotificationRecipient) recipients.get(index); |
| 161 | |
} |
| 162 | |
|
| 163 | |
|
| 164 | |
|
| 165 | |
|
| 166 | |
|
| 167 | |
public void addRecipient(NotificationRecipient recipient) { |
| 168 | 0 | recipients.add(recipient); |
| 169 | 0 | } |
| 170 | |
|
| 171 | |
|
| 172 | |
|
| 173 | |
|
| 174 | |
|
| 175 | |
public List<NotificationSender> getSenders() { |
| 176 | 0 | return senders; |
| 177 | |
} |
| 178 | |
|
| 179 | |
|
| 180 | |
|
| 181 | |
|
| 182 | |
|
| 183 | |
public void setSenders(List<NotificationSender> senders) { |
| 184 | 0 | this.senders = senders; |
| 185 | 0 | } |
| 186 | |
|
| 187 | |
|
| 188 | |
|
| 189 | |
|
| 190 | |
|
| 191 | |
|
| 192 | |
public NotificationSender getSender(int index) { |
| 193 | 0 | return (NotificationSender) senders.get(index); |
| 194 | |
} |
| 195 | |
|
| 196 | |
|
| 197 | |
|
| 198 | |
|
| 199 | |
public void addSender(NotificationSender sender) { |
| 200 | 0 | senders.add(sender); |
| 201 | 0 | } |
| 202 | |
|
| 203 | |
|
| 204 | |
|
| 205 | |
|
| 206 | |
|
| 207 | |
public Timestamp getAutoRemoveDateTime() { |
| 208 | 0 | return autoRemoveDateTime; |
| 209 | |
} |
| 210 | |
|
| 211 | |
|
| 212 | |
|
| 213 | |
|
| 214 | |
|
| 215 | |
public void setAutoRemoveDateTime(Timestamp autoRemoveDateTime) { |
| 216 | 0 | this.autoRemoveDateTime = autoRemoveDateTime; |
| 217 | 0 | } |
| 218 | |
|
| 219 | |
|
| 220 | |
|
| 221 | |
|
| 222 | |
|
| 223 | |
public NotificationChannel getChannel() { |
| 224 | 0 | return channel; |
| 225 | |
} |
| 226 | |
|
| 227 | |
|
| 228 | |
|
| 229 | |
|
| 230 | |
|
| 231 | |
public void setChannel(NotificationChannel channel) { |
| 232 | 0 | this.channel = channel; |
| 233 | 0 | } |
| 234 | |
|
| 235 | |
|
| 236 | |
|
| 237 | |
|
| 238 | |
|
| 239 | |
public String getContent() { |
| 240 | 0 | return content; |
| 241 | |
} |
| 242 | |
|
| 243 | |
|
| 244 | |
|
| 245 | |
|
| 246 | |
|
| 247 | |
public void setContent(String content) { |
| 248 | 0 | this.content = content; |
| 249 | 0 | } |
| 250 | |
|
| 251 | |
|
| 252 | |
|
| 253 | |
|
| 254 | |
|
| 255 | |
public NotificationContentType getContentType() { |
| 256 | 0 | return contentType; |
| 257 | |
} |
| 258 | |
|
| 259 | |
|
| 260 | |
|
| 261 | |
|
| 262 | |
|
| 263 | |
public void setContentType(NotificationContentType contentType) { |
| 264 | 0 | this.contentType = contentType; |
| 265 | 0 | } |
| 266 | |
|
| 267 | |
|
| 268 | |
|
| 269 | |
|
| 270 | |
|
| 271 | |
public String getDeliveryType() { |
| 272 | 0 | return deliveryType; |
| 273 | |
} |
| 274 | |
|
| 275 | |
|
| 276 | |
|
| 277 | |
|
| 278 | |
|
| 279 | |
public void setDeliveryType(String deliveryType) { |
| 280 | 0 | this.deliveryType = deliveryType.toUpperCase(); |
| 281 | 0 | } |
| 282 | |
|
| 283 | |
|
| 284 | |
|
| 285 | |
|
| 286 | |
|
| 287 | |
public Long getId() { |
| 288 | 0 | return id; |
| 289 | |
} |
| 290 | |
|
| 291 | |
|
| 292 | |
|
| 293 | |
|
| 294 | |
|
| 295 | |
public void setId(Long id) { |
| 296 | 0 | this.id = id; |
| 297 | 0 | } |
| 298 | |
|
| 299 | |
|
| 300 | |
|
| 301 | |
|
| 302 | |
|
| 303 | |
public NotificationPriority getPriority() { |
| 304 | 0 | return priority; |
| 305 | |
} |
| 306 | |
|
| 307 | |
|
| 308 | |
|
| 309 | |
|
| 310 | |
|
| 311 | |
public void setPriority(NotificationPriority priority) { |
| 312 | 0 | this.priority = priority; |
| 313 | 0 | } |
| 314 | |
|
| 315 | |
|
| 316 | |
|
| 317 | |
|
| 318 | |
|
| 319 | |
public NotificationProducer getProducer() { |
| 320 | 0 | return producer; |
| 321 | |
} |
| 322 | |
|
| 323 | |
|
| 324 | |
|
| 325 | |
|
| 326 | |
|
| 327 | |
public void setProducer(NotificationProducer producer) { |
| 328 | 0 | this.producer = producer; |
| 329 | 0 | } |
| 330 | |
|
| 331 | |
|
| 332 | |
|
| 333 | |
|
| 334 | |
|
| 335 | |
public Timestamp getSendDateTime() { |
| 336 | 0 | return sendDateTime; |
| 337 | |
} |
| 338 | |
|
| 339 | |
|
| 340 | |
|
| 341 | |
|
| 342 | |
|
| 343 | |
public void setSendDateTime(Timestamp sendDateTime) { |
| 344 | 0 | this.sendDateTime = sendDateTime; |
| 345 | 0 | } |
| 346 | |
|
| 347 | |
|
| 348 | |
|
| 349 | |
|
| 350 | |
|
| 351 | |
public String getProcessingFlag() { |
| 352 | 0 | return processingFlag; |
| 353 | |
} |
| 354 | |
|
| 355 | |
|
| 356 | |
|
| 357 | |
|
| 358 | |
|
| 359 | |
public void setProcessingFlag(String processingFlag) { |
| 360 | 0 | this.processingFlag = processingFlag; |
| 361 | 0 | } |
| 362 | |
|
| 363 | |
|
| 364 | |
|
| 365 | |
|
| 366 | |
|
| 367 | |
public Timestamp getLockedDate() { |
| 368 | 0 | return lockedDate; |
| 369 | |
} |
| 370 | |
|
| 371 | |
|
| 372 | |
|
| 373 | |
|
| 374 | |
|
| 375 | |
public void setLockedDate(Timestamp lockedDate) { |
| 376 | 0 | this.lockedDate = lockedDate; |
| 377 | 0 | } |
| 378 | |
|
| 379 | |
|
| 380 | |
|
| 381 | |
|
| 382 | |
|
| 383 | |
public String getTitle() { |
| 384 | 0 | return title; |
| 385 | |
} |
| 386 | |
|
| 387 | |
|
| 388 | |
|
| 389 | |
|
| 390 | |
|
| 391 | |
public void setTitle(String title) { |
| 392 | 0 | this.title = title; |
| 393 | 0 | } |
| 394 | |
|
| 395 | |
|
| 396 | |
|
| 397 | |
|
| 398 | |
|
| 399 | |
|
| 400 | |
public String getContentMessage() { |
| 401 | 0 | return StringUtils.substringBetween(content, NotificationConstants.XML_MESSAGE_CONSTANTS.MESSAGE_OPEN, NotificationConstants.XML_MESSAGE_CONSTANTS.MESSAGE_CLOSE); |
| 402 | |
} |
| 403 | |
} |