1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.ksb.messaging;
17
18 import java.io.Serializable;
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.Transient;
28
29 import org.kuali.rice.ksb.service.KSBServiceLocator;
30
31
32
33
34
35
36
37
38 @Entity
39 @Table(name="KRSB_MSG_PYLD_T")
40 public class PersistedMessagePayload implements Serializable {
41
42 private static final long serialVersionUID = 508778527504899029L;
43
44 @Id
45 @Column(name="MSG_QUE_ID")
46 private Long routeQueueId;
47 @Lob
48 @Basic(fetch=FetchType.LAZY)
49 @Column(name="MSG_PYLD", length=4000)
50 private String payload;
51 @Transient
52 private AsynchronousCall methodCall;
53 @Transient
54 private PersistedMessage message;
55
56 public PersistedMessagePayload() {}
57
58 public PersistedMessagePayload (AsynchronousCall methodCall, PersistedMessage message) {
59 this.setPayload(KSBServiceLocator.getMessageHelper().serializeObject(methodCall));
60 this.methodCall = methodCall;
61 this.message = message;
62 }
63
64 public String getPayload() {
65 return this.payload;
66 }
67 public void setPayload(String payload) {
68 this.payload = payload;
69 }
70 public Long getRouteQueueId() {
71 return this.routeQueueId;
72 }
73 public void setRouteQueueId(Long routeQueueId) {
74 this.routeQueueId = routeQueueId;
75 }
76 public AsynchronousCall getMethodCall() {
77 if (this.methodCall != null) {
78 return this.methodCall;
79 }
80 this.methodCall = (AsynchronousCall)KSBServiceLocator.getMessageHelper().deserializeObject(getPayload());
81 return this.methodCall;
82 }
83
84 public PersistedMessage getMessage() {
85 return this.message;
86 }
87
88 public void setMessage(PersistedMessage message) {
89 this.message = message;
90 }
91
92 public void setMethodCall(AsynchronousCall methodCall) {
93 this.methodCall = methodCall;
94 }
95
96
97 }
98