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