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.NotificationListRecipient;
21 import org.kuali.rice.ken.api.notification.NotificationRecipient;
22 import org.kuali.rice.ken.api.notification.NotificationRecipientContract;
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_RECIP_T")
34 public class NotificationRecipientBo extends PersistableBusinessObjectBase implements NotificationRecipientContract {
35 @Id
36 @GeneratedValue(generator="KREN_RECIP_S")
37 @GenericGenerator(name="KREN_RECIP_S",strategy="org.hibernate.id.enhanced.SequenceStyleGenerator",parameters={
38 @Parameter(name="sequence_name",value="KREN_RECIP_S"),
39 @Parameter(name="value_column",value="id")
40 })
41 @Column(name="RECIP_ID")
42 private Long id;
43 @Column(name="NTFCTN_ID", nullable=false)
44 private Long notificationId;
45 @Column(name="RECIP_TYP_CD", nullable=false)
46 private String recipientType;
47 @Column(name="PRNCPL_ID", nullable=false)
48 private String recipientId;
49
50
51 @ManyToOne(fetch=FetchType.EAGER, cascade={CascadeType.PERSIST, CascadeType.REMOVE})
52 @JoinColumn(name="NTFCTN_ID", insertable=false, updatable=false)
53 private NotificationBo notification;
54
55
56
57
58 public NotificationRecipientBo() {
59 }
60
61
62
63
64
65 public Long getId() {
66 return id;
67 }
68
69
70
71
72
73 public void setId(Long id) {
74 this.id = id;
75 }
76
77
78
79
80
81 public Long getNotificationId() {
82 return notificationId;
83 }
84
85
86
87
88
89 public void setNotificationId(Long notificationId) {
90 this.notificationId = notificationId;
91 }
92
93
94
95
96
97 public String getRecipientId() {
98 return recipientId;
99 }
100
101
102
103
104
105 public void setRecipientId(String recipientId) {
106 this.recipientId = recipientId;
107 }
108
109
110
111
112
113 public String getRecipientType() {
114 return recipientType;
115 }
116
117
118
119
120
121 public void setRecipientType(String recipientType) {
122 this.recipientType = recipientType;
123 }
124
125
126
127
128
129
130 public static NotificationRecipient to(NotificationRecipientBo bo) {
131 if (bo == null) {
132 return null;
133 }
134
135 return NotificationRecipient.Builder.create(bo).build();
136 }
137
138
139
140
141
142
143 public static NotificationRecipientBo from(NotificationRecipient im) {
144 if (im == null) {
145 return null;
146 }
147
148 NotificationRecipientBo bo = new NotificationRecipientBo();
149 bo.setId(im.getId());
150 bo.setVersionNumber(im.getVersionNumber());
151 bo.setObjectId(im.getObjectId());
152
153 bo.setRecipientType(im.getRecipientType());
154 bo.setRecipientId(im.getRecipientId());
155 bo.setNotificationId(im.getNotificationId());
156 return bo;
157 }
158 }
159