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 org.kuali.rice.core.api.util.io.SerializationUtils;
19 import org.kuali.rice.ksb.api.KsbApiServiceLocator;
20 import org.kuali.rice.ksb.api.messaging.AsynchronousCall;
21
22 import javax.persistence.*;
23 import java.io.Serializable;
24
25
26
27
28
29
30
31
32 @Entity
33 @Table(name="KRSB_MSG_PYLD_T")
34 public class PersistedMessagePayload implements Serializable {
35
36 private static final long serialVersionUID = 508778527504899029L;
37
38 @Id
39 @Column(name="MSG_QUE_ID")
40 private Long routeQueueId;
41 @Lob
42 @Basic(fetch=FetchType.LAZY)
43 @Column(name="MSG_PYLD", length=4000)
44 private String payload;
45 @Transient
46 private AsynchronousCall methodCall;
47 @Transient
48 private PersistedMessageBO message;
49
50 public PersistedMessagePayload() {}
51
52 public PersistedMessagePayload (AsynchronousCall methodCall, PersistedMessageBO message) {
53 this.setPayload(SerializationUtils.serializeToBase64(methodCall));
54 this.methodCall = methodCall;
55 this.message = message;
56 }
57
58 public String getPayload() {
59 return this.payload;
60 }
61 public void setPayload(String payload) {
62 this.payload = payload;
63 }
64 public Long getRouteQueueId() {
65 return this.routeQueueId;
66 }
67 public void setRouteQueueId(Long routeQueueId) {
68 this.routeQueueId = routeQueueId;
69 }
70 public AsynchronousCall getMethodCall() {
71 if (this.methodCall != null) {
72 return this.methodCall;
73 }
74 this.methodCall = (AsynchronousCall) SerializationUtils.deserializeFromBase64(getPayload());
75 return this.methodCall;
76 }
77
78 public PersistedMessageBO getMessage() {
79 return this.message;
80 }
81
82 public void setMessage(PersistedMessageBO message) {
83 this.message = message;
84 }
85
86 public void setMethodCall(AsynchronousCall methodCall) {
87 this.methodCall = methodCall;
88 }
89
90
91 }
92