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