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