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.kuali.rice.ken.api.notification.NotificationListRecipient;
19 import org.kuali.rice.ken.api.notification.NotificationListRecipientContract;
20 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
21 import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
22
23 import javax.persistence.CascadeType;
24 import javax.persistence.Column;
25 import javax.persistence.Entity;
26 import javax.persistence.FetchType;
27 import javax.persistence.GeneratedValue;
28 import javax.persistence.Id;
29 import javax.persistence.JoinColumn;
30 import javax.persistence.ManyToOne;
31 import javax.persistence.Table;
32
33
34
35
36
37 @Entity
38 @Table(name="KREN_RECIP_LIST_T")
39 public class NotificationRecipientListBo extends PersistableBusinessObjectBase implements NotificationListRecipientContract {
40 @Id
41 @GeneratedValue(generator="KREN_RECIP_LIST_S")
42 @PortableSequenceGenerator(name="KREN_RECIP_LIST_S")
43 @Column(name="RECIP_LIST_ID")
44 private Long id;
45 @Column(name="RECIP_TYP_CD", nullable=false)
46 private String recipientType;
47 @Column(name="RECIP_ID", nullable=false)
48 private String recipientId;
49
50 @ManyToOne(fetch=FetchType.EAGER, cascade={CascadeType.REFRESH, CascadeType.MERGE})
51 @JoinColumn(name="CHNL_ID", insertable=false, updatable=false)
52 private NotificationChannelBo channel;
53
54
55
56
57 public NotificationRecipientListBo() {
58 }
59
60
61
62
63
64 public NotificationChannelBo getChannel() {
65 return channel;
66 }
67
68
69
70
71
72
73 public void setChannel(NotificationChannelBo channel) {
74 this.channel = channel;
75 }
76
77
78
79
80
81 public Long getId() {
82 return id;
83 }
84
85
86
87
88
89 public void setId(Long id) {
90 this.id = id;
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 NotificationListRecipient to(NotificationRecipientListBo bo) {
131 if (bo == null) {
132 return null;
133 }
134
135 return NotificationListRecipient.Builder.create(bo).build();
136 }
137
138
139
140
141
142
143 public static NotificationRecipientListBo from(NotificationListRecipient im) {
144 if (im == null) {
145 return null;
146 }
147
148 NotificationRecipientListBo bo = new NotificationRecipientListBo();
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
156 bo.setChannel(im.getChannel() == null ? null : NotificationChannelBo.from(im.getChannel()));
157 return bo;
158 }
159 }
160