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