1
2
3
4
5
6
7
8
9
10
11
12
13
14 package org.kuali.rice.ksb.messaging;
15
16 import java.io.Serializable;
17 import java.sql.Timestamp;
18
19 import javax.persistence.Column;
20 import javax.persistence.Entity;
21 import javax.persistence.Id;
22 import javax.persistence.NamedQueries;
23 import javax.persistence.NamedQuery;
24 import javax.persistence.PrePersist;
25 import javax.persistence.Table;
26 import javax.persistence.Transient;
27 import javax.persistence.Version;
28
29 import org.kuali.rice.core.jpa.annotations.Sequence;
30 import org.kuali.rice.core.util.OrmUtils;
31 import org.kuali.rice.ksb.service.KSBServiceLocator;
32
33
34
35
36
37
38 @Entity
39 @Table(name="KRSB_MSG_QUE_T")
40 @Sequence(name="KRSB_MSG_QUE_S", property="routeQueueId")
41 @NamedQueries({
42 @NamedQuery(name="PersistedMessage.FindAll", query="select pm from PersistedMessage pm"),
43 @NamedQuery(name="PersistedMessage.FindByServiceName", query="select pm from PersistedMessage pm where pm.serviceName = :serviceName and pm.methodName = :methodName"),
44 @NamedQuery(name="PersistedMessage.GetNextDocuments", query="select pm from PersistedMessage pm where pm.serviceNamespace = :serviceNamespace and pm.queueStatus <> :queueStatus and pm.ipNumber = :ipNumber order by queuePriority asc, routeQueueId asc, queueDate asc")
45 })
46 public class PersistedMessage implements Serializable {
47
48 private static final long serialVersionUID = -7047766894738304195L;
49
50 @Id
51 @Column(name="MSG_QUE_ID")
52 private Long routeQueueId;
53 @Column(name="PRIO")
54 private Integer queuePriority;
55 @Column(name="STAT_CD")
56 private String queueStatus;
57 @Column(name="DT")
58 private Timestamp queueDate;
59 @Column(name="EXP_DT")
60 private Timestamp expirationDate;
61 @Column(name="RTRY_CNT")
62 private Integer retryCount;
63 @Version
64 @Column(name="VER_NBR")
65 private Integer lockVerNbr;
66 @Column(name="IP_NBR")
67 private String ipNumber;
68 @Column(name="SVC_NM")
69 private String serviceName;
70 @Column(name="SVC_NMSPC")
71 private String serviceNamespace;
72 @Column(name="SVC_MTHD_NM")
73 private String methodName;
74 @Transient
75 private AsynchronousCall methodCall;
76 @Transient
77 private PersistedMessagePayload payload;
78 @Column(name="APP_VAL_ONE")
79 private String value1;
80 @Column(name="APP_VAL_TWO")
81 private String value2;
82
83 public PersistedMessage() {
84
85 }
86
87 @PrePersist
88 public void beforeInsert(){
89 OrmUtils.populateAutoIncValue(this, KSBServiceLocator.getMessageEntityManagerFactory().createEntityManager());
90 }
91
92 public String getServiceNamespace() {
93 return this.serviceNamespace;
94 }
95
96 public void setServiceNamespace(String ServiceNamespace) {
97 this.serviceNamespace = ServiceNamespace;
98 }
99
100 public String getIpNumber() {
101 return this.ipNumber;
102 }
103
104 public void setIpNumber(String ipNumber) {
105 this.ipNumber = ipNumber;
106 }
107
108 public Timestamp getQueueDate() {
109 return this.queueDate;
110 }
111
112 public Integer getQueuePriority() {
113 return this.queuePriority;
114 }
115
116 public String getQueueStatus() {
117 return this.queueStatus;
118 }
119
120 public Integer getRetryCount() {
121 return this.retryCount;
122 }
123
124
125 public void setQueueDate(Timestamp timestamp) {
126 this.queueDate = timestamp;
127 }
128
129 public void setQueuePriority(Integer integer) {
130 this.queuePriority = integer;
131 }
132
133 public void setQueueStatus(String string) {
134 this.queueStatus = string;
135 }
136
137 public void setRetryCount(Integer integer) {
138 this.retryCount = integer;
139 }
140
141
142 public Integer getLockVerNbr() {
143 return this.lockVerNbr;
144 }
145
146 public void setLockVerNbr(Integer lockVerNbr) {
147 this.lockVerNbr = lockVerNbr;
148 }
149
150 public Long getRouteQueueId() {
151 return this.routeQueueId;
152 }
153
154 public void setRouteQueueId(Long queueSequence) {
155 this.routeQueueId = queueSequence;
156 }
157
158 public String getServiceName() {
159 return this.serviceName;
160 }
161
162 public void setServiceName(String serviceName) {
163 this.serviceName = serviceName;
164 }
165
166 public String toString() {
167 return "[RouteQueue: " + ", routeQueueId=" + this.routeQueueId + ", ipNumber=" + this.ipNumber
168 + "serviceNamespace=" + this.serviceNamespace + ", serviceName=" + this.serviceName + ", methodName=" + methodName
169 + ", queueStatus=" + this.queueStatus + ", queuePriority=" + this.queuePriority
170 + ", queueDate=" + this.queueDate + "]";
171 }
172
173 public AsynchronousCall getMethodCall() {
174 return this.methodCall;
175 }
176
177 public void setMethodCall(AsynchronousCall methodCall) {
178 this.methodCall = methodCall;
179 }
180
181 public String getMethodName() {
182 return this.methodName;
183 }
184
185 public void setMethodName(String methodName) {
186 this.methodName = methodName;
187 }
188
189 public Timestamp getExpirationDate() {
190 return this.expirationDate;
191 }
192
193 public void setExpirationDate(Timestamp expirationDate) {
194 this.expirationDate = expirationDate;
195 }
196
197 public PersistedMessagePayload getPayload() {
198 if (this.payload == null) {
199 if (this.getRouteQueueId() == null) {
200 return null;
201 } this.payload = KSBServiceLocator.getRouteQueueService().findByPersistedMessageByRouteQueueId(this.getRouteQueueId());
202 }
203 return this.payload;
204 }
205
206 public void setPayload(PersistedMessagePayload payload) {
207 this.payload = payload;
208 }
209
210 public String getValue1() {
211 return this.value1;
212 }
213
214 public void setValue1(String value1) {
215 this.value1 = value1;
216 }
217
218 public String getValue2() {
219 return this.value2;
220 }
221
222 public void setValue2(String value2) {
223 this.value2 = value2;
224 }
225
226 }