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.hibernate.annotations.GenericGenerator;
19 import org.hibernate.annotations.Parameter;
20 import org.kuali.rice.ken.api.notification.NotificationRecipient;
21 import org.kuali.rice.ken.api.notification.NotificationSender;
22 import org.kuali.rice.ken.api.notification.NotificationSenderContract;
23 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
24
25 import javax.persistence.*;
26
27
28
29
30
31
32 @Entity
33 @Table(name="KREN_SNDR_T")
34 public class NotificationSenderBo extends PersistableBusinessObjectBase implements NotificationSenderContract {
35 @Id
36 @GeneratedValue(generator="KREN_SNDR_S")
37 @GenericGenerator(name="KREN_SNDR_S",strategy="org.hibernate.id.enhanced.SequenceStyleGenerator",parameters={
38 @Parameter(name="sequence_name",value="KREN_SNDR_S"),
39 @Parameter(name="value_column",value="id")
40 })
41 @Column(name="SNDR_ID")
42 private Long id;
43 @Column(name="NTFCTN_ID", nullable=false)
44 private Long notificationId;
45 @Column(name="NM", nullable=false)
46 private String senderName;
47
48
49 @ManyToOne(fetch=FetchType.EAGER, cascade={CascadeType.PERSIST, CascadeType.REMOVE})
50 @JoinColumn(name="NTFCTN_ID", insertable=false, updatable=false)
51 private NotificationBo notification;
52
53
54
55
56 public NotificationSenderBo() {
57 }
58
59
60
61
62
63 public Long getId() {
64 return id;
65 }
66
67
68
69
70
71 public void setId(Long id) {
72 this.id = id;
73 }
74
75
76
77
78
79 public Long getNotificationId() {
80 return notificationId;
81 }
82
83
84
85
86
87 public void setNotificationId(Long notificationId) {
88 this.notificationId = notificationId;
89 }
90
91
92
93
94
95 public String getSenderName() {
96 return senderName;
97 }
98
99
100
101
102
103 public void setSenderName(String userId) {
104 this.senderName = userId;
105 }
106
107
108
109
110
111
112 public static NotificationSender to(NotificationSenderBo bo) {
113 if (bo == null) {
114 return null;
115 }
116
117 return NotificationSender.Builder.create(bo).build();
118 }
119
120
121
122
123
124
125 public static NotificationSenderBo from(NotificationSender im) {
126 if (im == null) {
127 return null;
128 }
129
130 NotificationSenderBo bo = new NotificationSenderBo();
131 bo.setId(im.getId());
132 bo.setVersionNumber(im.getVersionNumber());
133 bo.setObjectId(im.getObjectId());
134 bo.setSenderName(im.getSenderName());
135 bo.setNotificationId(im.getNotificationId());
136 return bo;
137 }
138 }