1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kcb.bo;
17
18 import java.sql.Timestamp;
19
20 import javax.persistence.Basic;
21 import javax.persistence.Column;
22 import javax.persistence.Entity;
23 import javax.persistence.FetchType;
24 import javax.persistence.GeneratedValue;
25 import javax.persistence.Id;
26 import javax.persistence.Lob;
27 import javax.persistence.Table;
28 import javax.persistence.Version;
29
30 import org.apache.commons.lang.StringUtils;
31 import org.apache.commons.lang.builder.ToStringBuilder;
32 import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
33
34
35
36
37
38
39
40 @Entity
41 @Table(name="KREN_MSG_T")
42 public class Message {
43
44
45
46 public static final String ID_FIELD = "id";
47 public static final String ORIGINID_FIELD = "originId";
48
49 @Id
50 @GeneratedValue(generator="KREN_MSG_S")
51 @PortableSequenceGenerator(name="KREN_MSG_S")
52 @Column(name="MSG_ID")
53 private Long id;
54
55
56
57 @Column(name="ORGN_ID", nullable=false)
58 private String originId;
59 @Column(name="DELIV_TYP", nullable=false)
60 private String deliveryType;
61 @Column(name="CHNL", nullable=false)
62 private String channel;
63 @Column(name="PRODCR", nullable=true)
64 private String producer;
65 @Column(name="CRTE_DTTM", nullable=false)
66 private Timestamp creationDateTime = new Timestamp(System.currentTimeMillis());
67 @Column(name="TTL", nullable=true)
68 private String title;
69 @Lob
70 @Basic(fetch=FetchType.LAZY)
71 @Column(name="CNTNT", nullable=false)
72 private String content;
73 @Column(name="CNTNT_TYP", nullable=true)
74 private String contentType;
75 @Column(name="URL", nullable=true)
76 private String url;
77 @Column(name="RECIP_ID", nullable=false)
78 private String recipient;
79
80
81
82
83 @Version
84 @Column(name="VER_NBR")
85 private Integer lockVerNbr;
86
87
88
89
90 public Message() {}
91
92
93
94
95
96 public Message(Message m) {
97 this.id = m.id;
98 this.channel = m.channel;
99 this.content = m.content;
100 this.contentType = m.contentType;
101 this.creationDateTime = m.creationDateTime;
102 this.deliveryType = m.deliveryType;
103 this.lockVerNbr = m.lockVerNbr;
104 this.producer = m.producer;
105 this.recipient = m.recipient;
106 this.title = m.title;
107 }
108
109
110
111
112
113 public Long getId() {
114 return id;
115 }
116
117
118
119
120
121 public void setId(Long id) {
122 this.id = id;
123 }
124
125
126
127
128
129 public String getOriginId() {
130 return this.originId;
131 }
132
133
134
135
136
137 public void setOriginId(String originId) {
138 this.originId = originId;
139 }
140
141
142
143
144
145 public Timestamp getCreationDateTime() {
146 return creationDateTime;
147 }
148
149
150
151
152
153 public void setCreationDateTime(Timestamp created) {
154 this.creationDateTime = created;
155 }
156
157
158
159
160
161 public Integer getLockVerNbr() {
162 return lockVerNbr;
163 }
164
165
166
167
168
169 public void setLockVerNbr(Integer lockVerNbr) {
170 this.lockVerNbr = lockVerNbr;
171 }
172
173
174
175
176
177 public String getRecipient() {
178 return recipient;
179 }
180
181
182
183
184
185 public void setRecipient(String recipient) {
186 this.recipient = recipient;
187 }
188
189
190
191
192
193 public String getContent() {
194 return content;
195 }
196
197
198
199
200
201 public void setContent(String content) {
202 this.content = content;
203 }
204
205
206
207
208
209 public String getContentType() {
210 return contentType;
211 }
212
213
214
215
216
217 public void setContentType(String contentType) {
218 this.contentType = contentType;
219 }
220
221
222
223
224 public String getUrl() {
225 return this.url;
226 }
227
228
229
230
231 public void setUrl(String url) {
232 this.url = url;
233 }
234
235
236
237
238
239 public String getDeliveryType() {
240 return deliveryType;
241 }
242
243
244
245
246
247 public void setDeliveryType(String deliveryType) {
248 this.deliveryType = deliveryType.toUpperCase();
249 }
250
251
252
253
254
255 public String getTitle() {
256 return title;
257 }
258
259
260
261
262
263 public void setTitle(String title) {
264 this.title = title;
265 }
266
267
268
269
270
271 public String getChannel() {
272 return this.channel;
273 }
274
275
276
277
278
279 public void setChannel(String channel) {
280 this.channel = channel;
281 }
282
283
284
285
286
287 public String getProducer() {
288 return this.producer;
289 }
290
291
292
293
294
295 public void setProducer(String producer) {
296 this.producer = producer;
297 }
298
299
300
301
302 @Override
303 public String toString() {
304 return new ToStringBuilder(this)
305 .append("id", id)
306 .append("creationDateTime", creationDateTime)
307 .append("deliveryType", deliveryType)
308 .append("recipient", recipient)
309 .append("title", title)
310 .append("channel", channel)
311 .append("producer", producer)
312 .append("content", StringUtils.abbreviate(content, 100))
313 .append("contentType", contentType)
314 .append("lockVerNbr", lockVerNbr)
315 .toString();
316 }
317
318 }