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