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