1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.kuali.rice.kns.bo; |
18 | |
|
19 | |
import org.hibernate.annotations.GenericGenerator; |
20 | |
import org.hibernate.annotations.Parameter; |
21 | |
import org.kuali.rice.kim.bo.Person; |
22 | |
import org.kuali.rice.kim.service.KIMServiceLocator; |
23 | |
import org.kuali.rice.kns.service.KNSServiceLocator; |
24 | |
import org.kuali.rice.kns.util.KNSConstants; |
25 | |
|
26 | |
import javax.persistence.*; |
27 | |
import java.sql.Timestamp; |
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
@Entity |
33 | |
@Table(name="KRNS_NTE_T") |
34 | |
public class Note extends PersistableBusinessObjectBase { |
35 | |
private static final long serialVersionUID = -7647166354016356770L; |
36 | |
|
37 | |
@Id |
38 | |
@GeneratedValue(generator="KRNS_NTE_S") |
39 | |
@GenericGenerator(name="KRNS_NTE_S",strategy="org.hibernate.id.enhanced.SequenceStyleGenerator",parameters={ |
40 | |
@Parameter(name="sequence_name",value="KRNS_NTE_S"), |
41 | |
@Parameter(name="value_column",value="id") |
42 | |
}) |
43 | |
@Column(name="NTE_ID") |
44 | |
private Long noteIdentifier; |
45 | |
@Column(name="RMT_OBJ_ID") |
46 | |
private String remoteObjectIdentifier; |
47 | |
@Column(name="AUTH_PRNCPL_ID") |
48 | |
private String authorUniversalIdentifier; |
49 | |
@Column(name="POST_TS") |
50 | |
private Timestamp notePostedTimestamp; |
51 | |
@Column(name="NTE_TYP_CD") |
52 | |
private String noteTypeCode; |
53 | |
@Column(name="TXT") |
54 | |
private String noteText; |
55 | |
@Column(name="TPC_TXT") |
56 | |
private String noteTopicText; |
57 | |
@Column(name="PRG_CD") |
58 | |
private String notePurgeCode; |
59 | |
@Transient |
60 | |
private String attachmentIdentifier; |
61 | |
|
62 | |
@OneToOne(fetch=FetchType.EAGER) |
63 | |
@JoinColumn(name="NTE_TYP_CD", insertable=false, updatable=false) |
64 | |
private NoteType noteType; |
65 | |
@Transient |
66 | |
private Person authorUniversal; |
67 | |
@OneToOne(fetch = FetchType.EAGER, cascade = { CascadeType.ALL }) |
68 | |
@JoinColumn(name = "NTE_ID", insertable = false, updatable = false) |
69 | |
private Attachment attachment; |
70 | |
@Transient |
71 | |
private AdHocRouteRecipient adHocRouteRecipient; |
72 | |
|
73 | |
|
74 | |
|
75 | |
|
76 | |
public Note() { |
77 | 0 | super(); |
78 | |
|
79 | |
|
80 | 0 | this.setNoteText(KNSConstants.EMPTY_STRING); |
81 | |
|
82 | 0 | this.setNoteTypeCode("DH"); |
83 | |
|
84 | 0 | this.setAdHocRouteRecipient(new AdHocRoutePerson()); |
85 | 0 | } |
86 | |
|
87 | |
|
88 | |
|
89 | |
|
90 | |
public void setNotePostedTimestampToCurrent() { |
91 | 0 | final Timestamp now = KNSServiceLocator.getDateTimeService().getCurrentTimestamp(); |
92 | 0 | this.setNotePostedTimestamp(now); |
93 | 0 | } |
94 | |
|
95 | |
|
96 | |
|
97 | |
|
98 | |
|
99 | |
|
100 | |
public Long getNoteIdentifier() { |
101 | 0 | return noteIdentifier; |
102 | |
} |
103 | |
|
104 | |
|
105 | |
|
106 | |
|
107 | |
|
108 | |
|
109 | |
public void setNoteIdentifier(Long noteIdentifier) { |
110 | 0 | this.noteIdentifier = noteIdentifier; |
111 | 0 | } |
112 | |
|
113 | |
|
114 | |
|
115 | |
|
116 | |
|
117 | |
|
118 | |
public String getRemoteObjectIdentifier() { |
119 | 0 | return remoteObjectIdentifier; |
120 | |
} |
121 | |
|
122 | |
|
123 | |
|
124 | |
|
125 | |
|
126 | |
|
127 | |
public void setRemoteObjectIdentifier(String remoteObjectIdentifier) { |
128 | 0 | this.remoteObjectIdentifier = remoteObjectIdentifier; |
129 | 0 | } |
130 | |
|
131 | |
|
132 | |
|
133 | |
|
134 | |
|
135 | |
|
136 | |
|
137 | |
public String getAuthorUniversalIdentifier() { |
138 | 0 | return authorUniversalIdentifier; |
139 | |
} |
140 | |
|
141 | |
|
142 | |
|
143 | |
|
144 | |
|
145 | |
|
146 | |
public void setAuthorUniversalIdentifier(String noteAuthorIdentifier) { |
147 | 0 | this.authorUniversalIdentifier = noteAuthorIdentifier; |
148 | 0 | } |
149 | |
|
150 | |
|
151 | |
|
152 | |
|
153 | |
|
154 | |
|
155 | |
|
156 | |
public Timestamp getNotePostedTimestamp() { |
157 | 0 | return notePostedTimestamp; |
158 | |
} |
159 | |
|
160 | |
|
161 | |
|
162 | |
|
163 | |
|
164 | |
|
165 | |
public void setNotePostedTimestamp(Timestamp notePostedTimestamp) { |
166 | 0 | this.notePostedTimestamp = notePostedTimestamp; |
167 | 0 | } |
168 | |
|
169 | |
|
170 | |
|
171 | |
|
172 | |
|
173 | |
|
174 | |
|
175 | |
public String getNoteTypeCode() { |
176 | 0 | return noteTypeCode; |
177 | |
} |
178 | |
|
179 | |
|
180 | |
|
181 | |
|
182 | |
|
183 | |
|
184 | |
public void setNoteTypeCode(String noteTypeCode) { |
185 | 0 | this.noteTypeCode = noteTypeCode; |
186 | 0 | } |
187 | |
|
188 | |
|
189 | |
|
190 | |
|
191 | |
|
192 | |
|
193 | |
|
194 | |
public String getNoteText() { |
195 | 0 | return noteText; |
196 | |
} |
197 | |
|
198 | |
|
199 | |
|
200 | |
|
201 | |
|
202 | |
|
203 | |
public void setNoteText(String noteText) { |
204 | 0 | this.noteText = noteText; |
205 | 0 | } |
206 | |
|
207 | |
|
208 | |
|
209 | |
|
210 | |
|
211 | |
|
212 | |
|
213 | |
public String getNoteTopicText() { |
214 | 0 | return noteTopicText; |
215 | |
} |
216 | |
|
217 | |
|
218 | |
|
219 | |
|
220 | |
|
221 | |
|
222 | |
public void setNoteTopicText(String noteTopicText) { |
223 | 0 | this.noteTopicText = noteTopicText; |
224 | 0 | } |
225 | |
|
226 | |
|
227 | |
|
228 | |
|
229 | |
|
230 | |
|
231 | |
public String getNotePurgeCode() { |
232 | 0 | return notePurgeCode; |
233 | |
} |
234 | |
|
235 | |
|
236 | |
|
237 | |
|
238 | |
|
239 | |
|
240 | |
public void setNotePurgeCode(String notePurgeCode) { |
241 | 0 | this.notePurgeCode = notePurgeCode; |
242 | 0 | } |
243 | |
|
244 | |
|
245 | |
|
246 | |
|
247 | |
|
248 | |
|
249 | |
public NoteType getNoteType() { |
250 | 0 | return noteType; |
251 | |
} |
252 | |
|
253 | |
|
254 | |
|
255 | |
|
256 | |
|
257 | |
|
258 | |
|
259 | |
public void setNoteType(NoteType noteType) { |
260 | 0 | this.noteType = noteType; |
261 | 0 | } |
262 | |
|
263 | |
|
264 | |
|
265 | |
|
266 | |
|
267 | |
|
268 | |
public Person getAuthorUniversal() { |
269 | 0 | authorUniversal = KIMServiceLocator.getPersonService().updatePersonIfNecessary(authorUniversalIdentifier, authorUniversal); |
270 | 0 | return authorUniversal; |
271 | |
} |
272 | |
|
273 | |
|
274 | |
|
275 | |
|
276 | |
|
277 | |
|
278 | |
|
279 | |
public void setAuthorUniversal(Person authorUniversal) { |
280 | 0 | this.authorUniversal = authorUniversal; |
281 | 0 | } |
282 | |
|
283 | |
|
284 | |
|
285 | |
|
286 | |
|
287 | |
|
288 | |
public Attachment getAttachment() { |
289 | 0 | return attachment; |
290 | |
} |
291 | |
|
292 | |
|
293 | |
|
294 | |
|
295 | |
|
296 | |
|
297 | |
public void setAttachment(Attachment attachment) { |
298 | 0 | this.attachment = attachment; |
299 | 0 | } |
300 | |
|
301 | |
|
302 | |
|
303 | |
|
304 | |
|
305 | |
|
306 | |
public String getAttachmentIdentifier() { |
307 | 0 | return attachmentIdentifier; |
308 | |
} |
309 | |
|
310 | |
|
311 | |
|
312 | |
|
313 | |
|
314 | |
|
315 | |
public void setAttachmentIdentifier(String attachmentIdentifier) { |
316 | 0 | this.attachmentIdentifier = attachmentIdentifier; |
317 | 0 | } |
318 | |
|
319 | |
|
320 | |
|
321 | |
|
322 | |
|
323 | |
|
324 | |
|
325 | |
public void addAttachment(Attachment attachment) { |
326 | 0 | setAttachmentIdentifier(attachment.getAttachmentIdentifier()); |
327 | 0 | setAttachment(attachment); |
328 | |
|
329 | |
|
330 | 0 | attachment.setNoteIdentifier(noteIdentifier); |
331 | |
|
332 | |
|
333 | 0 | attachment.setNote(this); |
334 | 0 | } |
335 | |
|
336 | |
|
337 | |
|
338 | |
|
339 | |
|
340 | |
public void removeAttachment() { |
341 | 0 | setAttachment(null); |
342 | 0 | setAttachmentIdentifier(null); |
343 | 0 | } |
344 | |
|
345 | |
|
346 | |
|
347 | |
|
348 | |
public AdHocRouteRecipient getAdHocRouteRecipient() { |
349 | 0 | return adHocRouteRecipient; |
350 | |
} |
351 | |
|
352 | |
|
353 | |
|
354 | |
|
355 | |
public void setAdHocRouteRecipient(AdHocRouteRecipient adHocRouteRecipient) { |
356 | 0 | this.adHocRouteRecipient = adHocRouteRecipient; |
357 | 0 | } |
358 | |
|
359 | |
} |
360 | |
|
361 | |
|