1
14
15 package com.liferay.portlet.messageboards.service.persistence;
16
17 import com.liferay.portal.NoSuchModelException;
18 import com.liferay.portal.kernel.annotation.BeanReference;
19 import com.liferay.portal.kernel.cache.CacheRegistry;
20 import com.liferay.portal.kernel.dao.orm.DynamicQuery;
21 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
22 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
23 import com.liferay.portal.kernel.dao.orm.FinderPath;
24 import com.liferay.portal.kernel.dao.orm.Query;
25 import com.liferay.portal.kernel.dao.orm.QueryPos;
26 import com.liferay.portal.kernel.dao.orm.QueryUtil;
27 import com.liferay.portal.kernel.dao.orm.Session;
28 import com.liferay.portal.kernel.exception.SystemException;
29 import com.liferay.portal.kernel.log.Log;
30 import com.liferay.portal.kernel.log.LogFactoryUtil;
31 import com.liferay.portal.kernel.util.GetterUtil;
32 import com.liferay.portal.kernel.util.OrderByComparator;
33 import com.liferay.portal.kernel.util.StringBundler;
34 import com.liferay.portal.kernel.util.StringPool;
35 import com.liferay.portal.kernel.util.StringUtil;
36 import com.liferay.portal.kernel.util.Validator;
37 import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
38 import com.liferay.portal.model.ModelListener;
39 import com.liferay.portal.service.persistence.BatchSessionUtil;
40 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
41
42 import com.liferay.portlet.messageboards.NoSuchMessageException;
43 import com.liferay.portlet.messageboards.model.MBMessage;
44 import com.liferay.portlet.messageboards.model.impl.MBMessageImpl;
45 import com.liferay.portlet.messageboards.model.impl.MBMessageModelImpl;
46
47 import java.io.Serializable;
48
49 import java.util.ArrayList;
50 import java.util.Collections;
51 import java.util.List;
52
53
66 public class MBMessagePersistenceImpl extends BasePersistenceImpl<MBMessage>
67 implements MBMessagePersistence {
68 public static final String FINDER_CLASS_NAME_ENTITY = MBMessageImpl.class.getName();
69 public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
70 ".List";
71 public static final FinderPath FINDER_PATH_FIND_BY_UUID = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
72 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
73 "findByUuid", new String[] { String.class.getName() });
74 public static final FinderPath FINDER_PATH_FIND_BY_OBC_UUID = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
75 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
76 "findByUuid",
77 new String[] {
78 String.class.getName(),
79
80 "java.lang.Integer", "java.lang.Integer",
81 "com.liferay.portal.kernel.util.OrderByComparator"
82 });
83 public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
84 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
85 "countByUuid", new String[] { String.class.getName() });
86 public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
87 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
88 "fetchByUUID_G",
89 new String[] { String.class.getName(), Long.class.getName() });
90 public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
91 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
92 "countByUUID_G",
93 new String[] { String.class.getName(), Long.class.getName() });
94 public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
95 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
96 "findByGroupId", new String[] { Long.class.getName() });
97 public static final FinderPath FINDER_PATH_FIND_BY_OBC_GROUPID = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
98 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
99 "findByGroupId",
100 new String[] {
101 Long.class.getName(),
102
103 "java.lang.Integer", "java.lang.Integer",
104 "com.liferay.portal.kernel.util.OrderByComparator"
105 });
106 public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
107 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
108 "countByGroupId", new String[] { Long.class.getName() });
109 public static final FinderPath FINDER_PATH_FIND_BY_COMPANYID = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
110 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
111 "findByCompanyId", new String[] { Long.class.getName() });
112 public static final FinderPath FINDER_PATH_FIND_BY_OBC_COMPANYID = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
113 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
114 "findByCompanyId",
115 new String[] {
116 Long.class.getName(),
117
118 "java.lang.Integer", "java.lang.Integer",
119 "com.liferay.portal.kernel.util.OrderByComparator"
120 });
121 public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
122 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
123 "countByCompanyId", new String[] { Long.class.getName() });
124 public static final FinderPath FINDER_PATH_FIND_BY_THREADID = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
125 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
126 "findByThreadId", new String[] { Long.class.getName() });
127 public static final FinderPath FINDER_PATH_FIND_BY_OBC_THREADID = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
128 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
129 "findByThreadId",
130 new String[] {
131 Long.class.getName(),
132
133 "java.lang.Integer", "java.lang.Integer",
134 "com.liferay.portal.kernel.util.OrderByComparator"
135 });
136 public static final FinderPath FINDER_PATH_COUNT_BY_THREADID = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
137 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
138 "countByThreadId", new String[] { Long.class.getName() });
139 public static final FinderPath FINDER_PATH_FIND_BY_THREADREPLIES = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
140 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
141 "findByThreadReplies", new String[] { Long.class.getName() });
142 public static final FinderPath FINDER_PATH_FIND_BY_OBC_THREADREPLIES = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
143 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
144 "findByThreadReplies",
145 new String[] {
146 Long.class.getName(),
147
148 "java.lang.Integer", "java.lang.Integer",
149 "com.liferay.portal.kernel.util.OrderByComparator"
150 });
151 public static final FinderPath FINDER_PATH_COUNT_BY_THREADREPLIES = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
152 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
153 "countByThreadReplies", new String[] { Long.class.getName() });
154 public static final FinderPath FINDER_PATH_FIND_BY_G_U = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
155 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
156 "findByG_U",
157 new String[] { Long.class.getName(), Long.class.getName() });
158 public static final FinderPath FINDER_PATH_FIND_BY_OBC_G_U = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
159 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
160 "findByG_U",
161 new String[] {
162 Long.class.getName(), Long.class.getName(),
163
164 "java.lang.Integer", "java.lang.Integer",
165 "com.liferay.portal.kernel.util.OrderByComparator"
166 });
167 public static final FinderPath FINDER_PATH_COUNT_BY_G_U = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
168 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
169 "countByG_U",
170 new String[] { Long.class.getName(), Long.class.getName() });
171 public static final FinderPath FINDER_PATH_FIND_BY_G_C = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
172 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
173 "findByG_C",
174 new String[] { Long.class.getName(), Long.class.getName() });
175 public static final FinderPath FINDER_PATH_FIND_BY_OBC_G_C = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
176 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
177 "findByG_C",
178 new String[] {
179 Long.class.getName(), Long.class.getName(),
180
181 "java.lang.Integer", "java.lang.Integer",
182 "com.liferay.portal.kernel.util.OrderByComparator"
183 });
184 public static final FinderPath FINDER_PATH_COUNT_BY_G_C = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
185 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
186 "countByG_C",
187 new String[] { Long.class.getName(), Long.class.getName() });
188 public static final FinderPath FINDER_PATH_FIND_BY_G_S = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
189 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
190 "findByG_S",
191 new String[] { Long.class.getName(), Integer.class.getName() });
192 public static final FinderPath FINDER_PATH_FIND_BY_OBC_G_S = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
193 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
194 "findByG_S",
195 new String[] {
196 Long.class.getName(), Integer.class.getName(),
197
198 "java.lang.Integer", "java.lang.Integer",
199 "com.liferay.portal.kernel.util.OrderByComparator"
200 });
201 public static final FinderPath FINDER_PATH_COUNT_BY_G_S = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
202 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
203 "countByG_S",
204 new String[] { Long.class.getName(), Integer.class.getName() });
205 public static final FinderPath FINDER_PATH_FIND_BY_C_S = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
206 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
207 "findByC_S",
208 new String[] { Long.class.getName(), Integer.class.getName() });
209 public static final FinderPath FINDER_PATH_FIND_BY_OBC_C_S = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
210 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
211 "findByC_S",
212 new String[] {
213 Long.class.getName(), Integer.class.getName(),
214
215 "java.lang.Integer", "java.lang.Integer",
216 "com.liferay.portal.kernel.util.OrderByComparator"
217 });
218 public static final FinderPath FINDER_PATH_COUNT_BY_C_S = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
219 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
220 "countByC_S",
221 new String[] { Long.class.getName(), Integer.class.getName() });
222 public static final FinderPath FINDER_PATH_FIND_BY_C_C = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
223 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
224 "findByC_C",
225 new String[] { Long.class.getName(), Long.class.getName() });
226 public static final FinderPath FINDER_PATH_FIND_BY_OBC_C_C = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
227 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
228 "findByC_C",
229 new String[] {
230 Long.class.getName(), Long.class.getName(),
231
232 "java.lang.Integer", "java.lang.Integer",
233 "com.liferay.portal.kernel.util.OrderByComparator"
234 });
235 public static final FinderPath FINDER_PATH_COUNT_BY_C_C = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
236 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
237 "countByC_C",
238 new String[] { Long.class.getName(), Long.class.getName() });
239 public static final FinderPath FINDER_PATH_FIND_BY_T_P = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
240 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
241 "findByT_P",
242 new String[] { Long.class.getName(), Long.class.getName() });
243 public static final FinderPath FINDER_PATH_FIND_BY_OBC_T_P = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
244 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
245 "findByT_P",
246 new String[] {
247 Long.class.getName(), Long.class.getName(),
248
249 "java.lang.Integer", "java.lang.Integer",
250 "com.liferay.portal.kernel.util.OrderByComparator"
251 });
252 public static final FinderPath FINDER_PATH_COUNT_BY_T_P = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
253 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
254 "countByT_P",
255 new String[] { Long.class.getName(), Long.class.getName() });
256 public static final FinderPath FINDER_PATH_FIND_BY_T_S = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
257 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
258 "findByT_S",
259 new String[] { Long.class.getName(), Integer.class.getName() });
260 public static final FinderPath FINDER_PATH_FIND_BY_OBC_T_S = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
261 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
262 "findByT_S",
263 new String[] {
264 Long.class.getName(), Integer.class.getName(),
265
266 "java.lang.Integer", "java.lang.Integer",
267 "com.liferay.portal.kernel.util.OrderByComparator"
268 });
269 public static final FinderPath FINDER_PATH_COUNT_BY_T_S = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
270 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
271 "countByT_S",
272 new String[] { Long.class.getName(), Integer.class.getName() });
273 public static final FinderPath FINDER_PATH_FIND_BY_TR_S = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
274 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
275 "findByTR_S",
276 new String[] { Long.class.getName(), Integer.class.getName() });
277 public static final FinderPath FINDER_PATH_FIND_BY_OBC_TR_S = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
278 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
279 "findByTR_S",
280 new String[] {
281 Long.class.getName(), Integer.class.getName(),
282
283 "java.lang.Integer", "java.lang.Integer",
284 "com.liferay.portal.kernel.util.OrderByComparator"
285 });
286 public static final FinderPath FINDER_PATH_COUNT_BY_TR_S = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
287 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
288 "countByTR_S",
289 new String[] { Long.class.getName(), Integer.class.getName() });
290 public static final FinderPath FINDER_PATH_FIND_BY_G_U_S = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
291 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
292 "findByG_U_S",
293 new String[] {
294 Long.class.getName(), Long.class.getName(),
295 Integer.class.getName()
296 });
297 public static final FinderPath FINDER_PATH_FIND_BY_OBC_G_U_S = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
298 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
299 "findByG_U_S",
300 new String[] {
301 Long.class.getName(), Long.class.getName(),
302 Integer.class.getName(),
303
304 "java.lang.Integer", "java.lang.Integer",
305 "com.liferay.portal.kernel.util.OrderByComparator"
306 });
307 public static final FinderPath FINDER_PATH_COUNT_BY_G_U_S = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
308 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
309 "countByG_U_S",
310 new String[] {
311 Long.class.getName(), Long.class.getName(),
312 Integer.class.getName()
313 });
314 public static final FinderPath FINDER_PATH_FIND_BY_G_C_T = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
315 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
316 "findByG_C_T",
317 new String[] {
318 Long.class.getName(), Long.class.getName(), Long.class.getName()
319 });
320 public static final FinderPath FINDER_PATH_FIND_BY_OBC_G_C_T = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
321 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
322 "findByG_C_T",
323 new String[] {
324 Long.class.getName(), Long.class.getName(), Long.class.getName(),
325
326 "java.lang.Integer", "java.lang.Integer",
327 "com.liferay.portal.kernel.util.OrderByComparator"
328 });
329 public static final FinderPath FINDER_PATH_COUNT_BY_G_C_T = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
330 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
331 "countByG_C_T",
332 new String[] {
333 Long.class.getName(), Long.class.getName(), Long.class.getName()
334 });
335 public static final FinderPath FINDER_PATH_FIND_BY_G_C_S = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
336 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
337 "findByG_C_S",
338 new String[] {
339 Long.class.getName(), Long.class.getName(),
340 Integer.class.getName()
341 });
342 public static final FinderPath FINDER_PATH_FIND_BY_OBC_G_C_S = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
343 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
344 "findByG_C_S",
345 new String[] {
346 Long.class.getName(), Long.class.getName(),
347 Integer.class.getName(),
348
349 "java.lang.Integer", "java.lang.Integer",
350 "com.liferay.portal.kernel.util.OrderByComparator"
351 });
352 public static final FinderPath FINDER_PATH_COUNT_BY_G_C_S = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
353 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
354 "countByG_C_S",
355 new String[] {
356 Long.class.getName(), Long.class.getName(),
357 Integer.class.getName()
358 });
359 public static final FinderPath FINDER_PATH_FIND_BY_C_C_S = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
360 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
361 "findByC_C_S",
362 new String[] {
363 Long.class.getName(), Long.class.getName(),
364 Integer.class.getName()
365 });
366 public static final FinderPath FINDER_PATH_FIND_BY_OBC_C_C_S = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
367 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
368 "findByC_C_S",
369 new String[] {
370 Long.class.getName(), Long.class.getName(),
371 Integer.class.getName(),
372
373 "java.lang.Integer", "java.lang.Integer",
374 "com.liferay.portal.kernel.util.OrderByComparator"
375 });
376 public static final FinderPath FINDER_PATH_COUNT_BY_C_C_S = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
377 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
378 "countByC_C_S",
379 new String[] {
380 Long.class.getName(), Long.class.getName(),
381 Integer.class.getName()
382 });
383 public static final FinderPath FINDER_PATH_FIND_BY_G_C_T_S = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
384 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
385 "findByG_C_T_S",
386 new String[] {
387 Long.class.getName(), Long.class.getName(), Long.class.getName(),
388 Integer.class.getName()
389 });
390 public static final FinderPath FINDER_PATH_FIND_BY_OBC_G_C_T_S = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
391 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
392 "findByG_C_T_S",
393 new String[] {
394 Long.class.getName(), Long.class.getName(), Long.class.getName(),
395 Integer.class.getName(),
396
397 "java.lang.Integer", "java.lang.Integer",
398 "com.liferay.portal.kernel.util.OrderByComparator"
399 });
400 public static final FinderPath FINDER_PATH_COUNT_BY_G_C_T_S = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
401 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
402 "countByG_C_T_S",
403 new String[] {
404 Long.class.getName(), Long.class.getName(), Long.class.getName(),
405 Integer.class.getName()
406 });
407 public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
408 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
409 "findAll", new String[0]);
410 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
411 MBMessageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
412 "countAll", new String[0]);
413
414 public void cacheResult(MBMessage mbMessage) {
415 EntityCacheUtil.putResult(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
416 MBMessageImpl.class, mbMessage.getPrimaryKey(), mbMessage);
417
418 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
419 new Object[] { mbMessage.getUuid(), new Long(mbMessage.getGroupId()) },
420 mbMessage);
421 }
422
423 public void cacheResult(List<MBMessage> mbMessages) {
424 for (MBMessage mbMessage : mbMessages) {
425 if (EntityCacheUtil.getResult(
426 MBMessageModelImpl.ENTITY_CACHE_ENABLED,
427 MBMessageImpl.class, mbMessage.getPrimaryKey(), this) == null) {
428 cacheResult(mbMessage);
429 }
430 }
431 }
432
433 public void clearCache() {
434 CacheRegistry.clear(MBMessageImpl.class.getName());
435 EntityCacheUtil.clearCache(MBMessageImpl.class.getName());
436 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
437 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
438 }
439
440 public MBMessage create(long messageId) {
441 MBMessage mbMessage = new MBMessageImpl();
442
443 mbMessage.setNew(true);
444 mbMessage.setPrimaryKey(messageId);
445
446 String uuid = PortalUUIDUtil.generate();
447
448 mbMessage.setUuid(uuid);
449
450 return mbMessage;
451 }
452
453 public MBMessage remove(Serializable primaryKey)
454 throws NoSuchModelException, SystemException {
455 return remove(((Long)primaryKey).longValue());
456 }
457
458 public MBMessage remove(long messageId)
459 throws NoSuchMessageException, SystemException {
460 Session session = null;
461
462 try {
463 session = openSession();
464
465 MBMessage mbMessage = (MBMessage)session.get(MBMessageImpl.class,
466 new Long(messageId));
467
468 if (mbMessage == null) {
469 if (_log.isWarnEnabled()) {
470 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + messageId);
471 }
472
473 throw new NoSuchMessageException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
474 messageId);
475 }
476
477 return remove(mbMessage);
478 }
479 catch (NoSuchMessageException nsee) {
480 throw nsee;
481 }
482 catch (Exception e) {
483 throw processException(e);
484 }
485 finally {
486 closeSession(session);
487 }
488 }
489
490 public MBMessage remove(MBMessage mbMessage) throws SystemException {
491 for (ModelListener<MBMessage> listener : listeners) {
492 listener.onBeforeRemove(mbMessage);
493 }
494
495 mbMessage = removeImpl(mbMessage);
496
497 for (ModelListener<MBMessage> listener : listeners) {
498 listener.onAfterRemove(mbMessage);
499 }
500
501 return mbMessage;
502 }
503
504 protected MBMessage removeImpl(MBMessage mbMessage)
505 throws SystemException {
506 mbMessage = toUnwrappedModel(mbMessage);
507
508 Session session = null;
509
510 try {
511 session = openSession();
512
513 if (mbMessage.isCachedModel() || BatchSessionUtil.isEnabled()) {
514 Object staleObject = session.get(MBMessageImpl.class,
515 mbMessage.getPrimaryKeyObj());
516
517 if (staleObject != null) {
518 session.evict(staleObject);
519 }
520 }
521
522 session.delete(mbMessage);
523
524 session.flush();
525 }
526 catch (Exception e) {
527 throw processException(e);
528 }
529 finally {
530 closeSession(session);
531 }
532
533 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
534
535 MBMessageModelImpl mbMessageModelImpl = (MBMessageModelImpl)mbMessage;
536
537 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
538 new Object[] {
539 mbMessageModelImpl.getOriginalUuid(),
540 new Long(mbMessageModelImpl.getOriginalGroupId())
541 });
542
543 EntityCacheUtil.removeResult(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
544 MBMessageImpl.class, mbMessage.getPrimaryKey());
545
546 return mbMessage;
547 }
548
549 public MBMessage updateImpl(
550 com.liferay.portlet.messageboards.model.MBMessage mbMessage,
551 boolean merge) throws SystemException {
552 mbMessage = toUnwrappedModel(mbMessage);
553
554 boolean isNew = mbMessage.isNew();
555
556 MBMessageModelImpl mbMessageModelImpl = (MBMessageModelImpl)mbMessage;
557
558 if (Validator.isNull(mbMessage.getUuid())) {
559 String uuid = PortalUUIDUtil.generate();
560
561 mbMessage.setUuid(uuid);
562 }
563
564 Session session = null;
565
566 try {
567 session = openSession();
568
569 BatchSessionUtil.update(session, mbMessage, merge);
570
571 mbMessage.setNew(false);
572 }
573 catch (Exception e) {
574 throw processException(e);
575 }
576 finally {
577 closeSession(session);
578 }
579
580 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
581
582 EntityCacheUtil.putResult(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
583 MBMessageImpl.class, mbMessage.getPrimaryKey(), mbMessage);
584
585 if (!isNew &&
586 (!Validator.equals(mbMessage.getUuid(),
587 mbMessageModelImpl.getOriginalUuid()) ||
588 (mbMessage.getGroupId() != mbMessageModelImpl.getOriginalGroupId()))) {
589 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
590 new Object[] {
591 mbMessageModelImpl.getOriginalUuid(),
592 new Long(mbMessageModelImpl.getOriginalGroupId())
593 });
594 }
595
596 if (isNew ||
597 (!Validator.equals(mbMessage.getUuid(),
598 mbMessageModelImpl.getOriginalUuid()) ||
599 (mbMessage.getGroupId() != mbMessageModelImpl.getOriginalGroupId()))) {
600 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
601 new Object[] {
602 mbMessage.getUuid(), new Long(mbMessage.getGroupId())
603 }, mbMessage);
604 }
605
606 return mbMessage;
607 }
608
609 protected MBMessage toUnwrappedModel(MBMessage mbMessage) {
610 if (mbMessage instanceof MBMessageImpl) {
611 return mbMessage;
612 }
613
614 MBMessageImpl mbMessageImpl = new MBMessageImpl();
615
616 mbMessageImpl.setNew(mbMessage.isNew());
617 mbMessageImpl.setPrimaryKey(mbMessage.getPrimaryKey());
618
619 mbMessageImpl.setUuid(mbMessage.getUuid());
620 mbMessageImpl.setMessageId(mbMessage.getMessageId());
621 mbMessageImpl.setGroupId(mbMessage.getGroupId());
622 mbMessageImpl.setCompanyId(mbMessage.getCompanyId());
623 mbMessageImpl.setUserId(mbMessage.getUserId());
624 mbMessageImpl.setUserName(mbMessage.getUserName());
625 mbMessageImpl.setCreateDate(mbMessage.getCreateDate());
626 mbMessageImpl.setModifiedDate(mbMessage.getModifiedDate());
627 mbMessageImpl.setClassNameId(mbMessage.getClassNameId());
628 mbMessageImpl.setClassPK(mbMessage.getClassPK());
629 mbMessageImpl.setCategoryId(mbMessage.getCategoryId());
630 mbMessageImpl.setThreadId(mbMessage.getThreadId());
631 mbMessageImpl.setParentMessageId(mbMessage.getParentMessageId());
632 mbMessageImpl.setSubject(mbMessage.getSubject());
633 mbMessageImpl.setBody(mbMessage.getBody());
634 mbMessageImpl.setAttachments(mbMessage.isAttachments());
635 mbMessageImpl.setAnonymous(mbMessage.isAnonymous());
636 mbMessageImpl.setPriority(mbMessage.getPriority());
637 mbMessageImpl.setAllowPingbacks(mbMessage.isAllowPingbacks());
638 mbMessageImpl.setStatus(mbMessage.getStatus());
639 mbMessageImpl.setStatusByUserId(mbMessage.getStatusByUserId());
640 mbMessageImpl.setStatusByUserName(mbMessage.getStatusByUserName());
641 mbMessageImpl.setStatusDate(mbMessage.getStatusDate());
642
643 return mbMessageImpl;
644 }
645
646 public MBMessage findByPrimaryKey(Serializable primaryKey)
647 throws NoSuchModelException, SystemException {
648 return findByPrimaryKey(((Long)primaryKey).longValue());
649 }
650
651 public MBMessage findByPrimaryKey(long messageId)
652 throws NoSuchMessageException, SystemException {
653 MBMessage mbMessage = fetchByPrimaryKey(messageId);
654
655 if (mbMessage == null) {
656 if (_log.isWarnEnabled()) {
657 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + messageId);
658 }
659
660 throw new NoSuchMessageException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
661 messageId);
662 }
663
664 return mbMessage;
665 }
666
667 public MBMessage fetchByPrimaryKey(Serializable primaryKey)
668 throws SystemException {
669 return fetchByPrimaryKey(((Long)primaryKey).longValue());
670 }
671
672 public MBMessage fetchByPrimaryKey(long messageId)
673 throws SystemException {
674 MBMessage mbMessage = (MBMessage)EntityCacheUtil.getResult(MBMessageModelImpl.ENTITY_CACHE_ENABLED,
675 MBMessageImpl.class, messageId, this);
676
677 if (mbMessage == null) {
678 Session session = null;
679
680 try {
681 session = openSession();
682
683 mbMessage = (MBMessage)session.get(MBMessageImpl.class,
684 new Long(messageId));
685 }
686 catch (Exception e) {
687 throw processException(e);
688 }
689 finally {
690 if (mbMessage != null) {
691 cacheResult(mbMessage);
692 }
693
694 closeSession(session);
695 }
696 }
697
698 return mbMessage;
699 }
700
701 public List<MBMessage> findByUuid(String uuid) throws SystemException {
702 Object[] finderArgs = new Object[] { uuid };
703
704 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_UUID,
705 finderArgs, this);
706
707 if (list == null) {
708 Session session = null;
709
710 try {
711 session = openSession();
712
713 StringBundler query = new StringBundler(3);
714
715 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
716
717 if (uuid == null) {
718 query.append(_FINDER_COLUMN_UUID_UUID_1);
719 }
720 else {
721 if (uuid.equals(StringPool.BLANK)) {
722 query.append(_FINDER_COLUMN_UUID_UUID_3);
723 }
724 else {
725 query.append(_FINDER_COLUMN_UUID_UUID_2);
726 }
727 }
728
729 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
730
731 String sql = query.toString();
732
733 Query q = session.createQuery(sql);
734
735 QueryPos qPos = QueryPos.getInstance(q);
736
737 if (uuid != null) {
738 qPos.add(uuid);
739 }
740
741 list = q.list();
742 }
743 catch (Exception e) {
744 throw processException(e);
745 }
746 finally {
747 if (list == null) {
748 list = new ArrayList<MBMessage>();
749 }
750
751 cacheResult(list);
752
753 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_UUID, finderArgs,
754 list);
755
756 closeSession(session);
757 }
758 }
759
760 return list;
761 }
762
763 public List<MBMessage> findByUuid(String uuid, int start, int end)
764 throws SystemException {
765 return findByUuid(uuid, start, end, null);
766 }
767
768 public List<MBMessage> findByUuid(String uuid, int start, int end,
769 OrderByComparator obc) throws SystemException {
770 Object[] finderArgs = new Object[] {
771 uuid,
772
773 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
774 };
775
776 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_UUID,
777 finderArgs, this);
778
779 if (list == null) {
780 Session session = null;
781
782 try {
783 session = openSession();
784
785 StringBundler query = null;
786
787 if (obc != null) {
788 query = new StringBundler(3 +
789 (obc.getOrderByFields().length * 3));
790 }
791 else {
792 query = new StringBundler(3);
793 }
794
795 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
796
797 if (uuid == null) {
798 query.append(_FINDER_COLUMN_UUID_UUID_1);
799 }
800 else {
801 if (uuid.equals(StringPool.BLANK)) {
802 query.append(_FINDER_COLUMN_UUID_UUID_3);
803 }
804 else {
805 query.append(_FINDER_COLUMN_UUID_UUID_2);
806 }
807 }
808
809 if (obc != null) {
810 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
811 }
812
813 else {
814 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
815 }
816
817 String sql = query.toString();
818
819 Query q = session.createQuery(sql);
820
821 QueryPos qPos = QueryPos.getInstance(q);
822
823 if (uuid != null) {
824 qPos.add(uuid);
825 }
826
827 list = (List<MBMessage>)QueryUtil.list(q, getDialect(), start,
828 end);
829 }
830 catch (Exception e) {
831 throw processException(e);
832 }
833 finally {
834 if (list == null) {
835 list = new ArrayList<MBMessage>();
836 }
837
838 cacheResult(list);
839
840 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_UUID,
841 finderArgs, list);
842
843 closeSession(session);
844 }
845 }
846
847 return list;
848 }
849
850 public MBMessage findByUuid_First(String uuid, OrderByComparator obc)
851 throws NoSuchMessageException, SystemException {
852 List<MBMessage> list = findByUuid(uuid, 0, 1, obc);
853
854 if (list.isEmpty()) {
855 StringBundler msg = new StringBundler(4);
856
857 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
858
859 msg.append("uuid=");
860 msg.append(uuid);
861
862 msg.append(StringPool.CLOSE_CURLY_BRACE);
863
864 throw new NoSuchMessageException(msg.toString());
865 }
866 else {
867 return list.get(0);
868 }
869 }
870
871 public MBMessage findByUuid_Last(String uuid, OrderByComparator obc)
872 throws NoSuchMessageException, SystemException {
873 int count = countByUuid(uuid);
874
875 List<MBMessage> list = findByUuid(uuid, count - 1, count, obc);
876
877 if (list.isEmpty()) {
878 StringBundler msg = new StringBundler(4);
879
880 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
881
882 msg.append("uuid=");
883 msg.append(uuid);
884
885 msg.append(StringPool.CLOSE_CURLY_BRACE);
886
887 throw new NoSuchMessageException(msg.toString());
888 }
889 else {
890 return list.get(0);
891 }
892 }
893
894 public MBMessage[] findByUuid_PrevAndNext(long messageId, String uuid,
895 OrderByComparator obc) throws NoSuchMessageException, SystemException {
896 MBMessage mbMessage = findByPrimaryKey(messageId);
897
898 int count = countByUuid(uuid);
899
900 Session session = null;
901
902 try {
903 session = openSession();
904
905 StringBundler query = null;
906
907 if (obc != null) {
908 query = new StringBundler(3 +
909 (obc.getOrderByFields().length * 3));
910 }
911 else {
912 query = new StringBundler(3);
913 }
914
915 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
916
917 if (uuid == null) {
918 query.append(_FINDER_COLUMN_UUID_UUID_1);
919 }
920 else {
921 if (uuid.equals(StringPool.BLANK)) {
922 query.append(_FINDER_COLUMN_UUID_UUID_3);
923 }
924 else {
925 query.append(_FINDER_COLUMN_UUID_UUID_2);
926 }
927 }
928
929 if (obc != null) {
930 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
931 }
932
933 else {
934 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
935 }
936
937 String sql = query.toString();
938
939 Query q = session.createQuery(sql);
940
941 QueryPos qPos = QueryPos.getInstance(q);
942
943 if (uuid != null) {
944 qPos.add(uuid);
945 }
946
947 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
948 mbMessage);
949
950 MBMessage[] array = new MBMessageImpl[3];
951
952 array[0] = (MBMessage)objArray[0];
953 array[1] = (MBMessage)objArray[1];
954 array[2] = (MBMessage)objArray[2];
955
956 return array;
957 }
958 catch (Exception e) {
959 throw processException(e);
960 }
961 finally {
962 closeSession(session);
963 }
964 }
965
966 public MBMessage findByUUID_G(String uuid, long groupId)
967 throws NoSuchMessageException, SystemException {
968 MBMessage mbMessage = fetchByUUID_G(uuid, groupId);
969
970 if (mbMessage == null) {
971 StringBundler msg = new StringBundler(6);
972
973 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
974
975 msg.append("uuid=");
976 msg.append(uuid);
977
978 msg.append(", groupId=");
979 msg.append(groupId);
980
981 msg.append(StringPool.CLOSE_CURLY_BRACE);
982
983 if (_log.isWarnEnabled()) {
984 _log.warn(msg.toString());
985 }
986
987 throw new NoSuchMessageException(msg.toString());
988 }
989
990 return mbMessage;
991 }
992
993 public MBMessage fetchByUUID_G(String uuid, long groupId)
994 throws SystemException {
995 return fetchByUUID_G(uuid, groupId, true);
996 }
997
998 public MBMessage fetchByUUID_G(String uuid, long groupId,
999 boolean retrieveFromCache) throws SystemException {
1000 Object[] finderArgs = new Object[] { uuid, new Long(groupId) };
1001
1002 Object result = null;
1003
1004 if (retrieveFromCache) {
1005 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
1006 finderArgs, this);
1007 }
1008
1009 if (result == null) {
1010 Session session = null;
1011
1012 try {
1013 session = openSession();
1014
1015 StringBundler query = new StringBundler(4);
1016
1017 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
1018
1019 if (uuid == null) {
1020 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
1021 }
1022 else {
1023 if (uuid.equals(StringPool.BLANK)) {
1024 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
1025 }
1026 else {
1027 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
1028 }
1029 }
1030
1031 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
1032
1033 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
1034
1035 String sql = query.toString();
1036
1037 Query q = session.createQuery(sql);
1038
1039 QueryPos qPos = QueryPos.getInstance(q);
1040
1041 if (uuid != null) {
1042 qPos.add(uuid);
1043 }
1044
1045 qPos.add(groupId);
1046
1047 List<MBMessage> list = q.list();
1048
1049 result = list;
1050
1051 MBMessage mbMessage = null;
1052
1053 if (list.isEmpty()) {
1054 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1055 finderArgs, list);
1056 }
1057 else {
1058 mbMessage = list.get(0);
1059
1060 cacheResult(mbMessage);
1061
1062 if ((mbMessage.getUuid() == null) ||
1063 !mbMessage.getUuid().equals(uuid) ||
1064 (mbMessage.getGroupId() != groupId)) {
1065 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1066 finderArgs, mbMessage);
1067 }
1068 }
1069
1070 return mbMessage;
1071 }
1072 catch (Exception e) {
1073 throw processException(e);
1074 }
1075 finally {
1076 if (result == null) {
1077 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1078 finderArgs, new ArrayList<MBMessage>());
1079 }
1080
1081 closeSession(session);
1082 }
1083 }
1084 else {
1085 if (result instanceof List<?>) {
1086 return null;
1087 }
1088 else {
1089 return (MBMessage)result;
1090 }
1091 }
1092 }
1093
1094 public List<MBMessage> findByGroupId(long groupId)
1095 throws SystemException {
1096 Object[] finderArgs = new Object[] { new Long(groupId) };
1097
1098 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
1099 finderArgs, this);
1100
1101 if (list == null) {
1102 Session session = null;
1103
1104 try {
1105 session = openSession();
1106
1107 StringBundler query = new StringBundler(3);
1108
1109 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
1110
1111 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1112
1113 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
1114
1115 String sql = query.toString();
1116
1117 Query q = session.createQuery(sql);
1118
1119 QueryPos qPos = QueryPos.getInstance(q);
1120
1121 qPos.add(groupId);
1122
1123 list = q.list();
1124 }
1125 catch (Exception e) {
1126 throw processException(e);
1127 }
1128 finally {
1129 if (list == null) {
1130 list = new ArrayList<MBMessage>();
1131 }
1132
1133 cacheResult(list);
1134
1135 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
1136 finderArgs, list);
1137
1138 closeSession(session);
1139 }
1140 }
1141
1142 return list;
1143 }
1144
1145 public List<MBMessage> findByGroupId(long groupId, int start, int end)
1146 throws SystemException {
1147 return findByGroupId(groupId, start, end, null);
1148 }
1149
1150 public List<MBMessage> findByGroupId(long groupId, int start, int end,
1151 OrderByComparator obc) throws SystemException {
1152 Object[] finderArgs = new Object[] {
1153 new Long(groupId),
1154
1155 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1156 };
1157
1158 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_GROUPID,
1159 finderArgs, this);
1160
1161 if (list == null) {
1162 Session session = null;
1163
1164 try {
1165 session = openSession();
1166
1167 StringBundler query = null;
1168
1169 if (obc != null) {
1170 query = new StringBundler(3 +
1171 (obc.getOrderByFields().length * 3));
1172 }
1173 else {
1174 query = new StringBundler(3);
1175 }
1176
1177 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
1178
1179 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1180
1181 if (obc != null) {
1182 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1183 }
1184
1185 else {
1186 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
1187 }
1188
1189 String sql = query.toString();
1190
1191 Query q = session.createQuery(sql);
1192
1193 QueryPos qPos = QueryPos.getInstance(q);
1194
1195 qPos.add(groupId);
1196
1197 list = (List<MBMessage>)QueryUtil.list(q, getDialect(), start,
1198 end);
1199 }
1200 catch (Exception e) {
1201 throw processException(e);
1202 }
1203 finally {
1204 if (list == null) {
1205 list = new ArrayList<MBMessage>();
1206 }
1207
1208 cacheResult(list);
1209
1210 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_GROUPID,
1211 finderArgs, list);
1212
1213 closeSession(session);
1214 }
1215 }
1216
1217 return list;
1218 }
1219
1220 public MBMessage findByGroupId_First(long groupId, OrderByComparator obc)
1221 throws NoSuchMessageException, SystemException {
1222 List<MBMessage> list = findByGroupId(groupId, 0, 1, obc);
1223
1224 if (list.isEmpty()) {
1225 StringBundler msg = new StringBundler(4);
1226
1227 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1228
1229 msg.append("groupId=");
1230 msg.append(groupId);
1231
1232 msg.append(StringPool.CLOSE_CURLY_BRACE);
1233
1234 throw new NoSuchMessageException(msg.toString());
1235 }
1236 else {
1237 return list.get(0);
1238 }
1239 }
1240
1241 public MBMessage findByGroupId_Last(long groupId, OrderByComparator obc)
1242 throws NoSuchMessageException, SystemException {
1243 int count = countByGroupId(groupId);
1244
1245 List<MBMessage> list = findByGroupId(groupId, count - 1, count, obc);
1246
1247 if (list.isEmpty()) {
1248 StringBundler msg = new StringBundler(4);
1249
1250 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1251
1252 msg.append("groupId=");
1253 msg.append(groupId);
1254
1255 msg.append(StringPool.CLOSE_CURLY_BRACE);
1256
1257 throw new NoSuchMessageException(msg.toString());
1258 }
1259 else {
1260 return list.get(0);
1261 }
1262 }
1263
1264 public MBMessage[] findByGroupId_PrevAndNext(long messageId, long groupId,
1265 OrderByComparator obc) throws NoSuchMessageException, SystemException {
1266 MBMessage mbMessage = findByPrimaryKey(messageId);
1267
1268 int count = countByGroupId(groupId);
1269
1270 Session session = null;
1271
1272 try {
1273 session = openSession();
1274
1275 StringBundler query = null;
1276
1277 if (obc != null) {
1278 query = new StringBundler(3 +
1279 (obc.getOrderByFields().length * 3));
1280 }
1281 else {
1282 query = new StringBundler(3);
1283 }
1284
1285 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
1286
1287 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1288
1289 if (obc != null) {
1290 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1291 }
1292
1293 else {
1294 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
1295 }
1296
1297 String sql = query.toString();
1298
1299 Query q = session.createQuery(sql);
1300
1301 QueryPos qPos = QueryPos.getInstance(q);
1302
1303 qPos.add(groupId);
1304
1305 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1306 mbMessage);
1307
1308 MBMessage[] array = new MBMessageImpl[3];
1309
1310 array[0] = (MBMessage)objArray[0];
1311 array[1] = (MBMessage)objArray[1];
1312 array[2] = (MBMessage)objArray[2];
1313
1314 return array;
1315 }
1316 catch (Exception e) {
1317 throw processException(e);
1318 }
1319 finally {
1320 closeSession(session);
1321 }
1322 }
1323
1324 public List<MBMessage> findByCompanyId(long companyId)
1325 throws SystemException {
1326 Object[] finderArgs = new Object[] { new Long(companyId) };
1327
1328 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
1329 finderArgs, this);
1330
1331 if (list == null) {
1332 Session session = null;
1333
1334 try {
1335 session = openSession();
1336
1337 StringBundler query = new StringBundler(3);
1338
1339 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
1340
1341 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1342
1343 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
1344
1345 String sql = query.toString();
1346
1347 Query q = session.createQuery(sql);
1348
1349 QueryPos qPos = QueryPos.getInstance(q);
1350
1351 qPos.add(companyId);
1352
1353 list = q.list();
1354 }
1355 catch (Exception e) {
1356 throw processException(e);
1357 }
1358 finally {
1359 if (list == null) {
1360 list = new ArrayList<MBMessage>();
1361 }
1362
1363 cacheResult(list);
1364
1365 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
1366 finderArgs, list);
1367
1368 closeSession(session);
1369 }
1370 }
1371
1372 return list;
1373 }
1374
1375 public List<MBMessage> findByCompanyId(long companyId, int start, int end)
1376 throws SystemException {
1377 return findByCompanyId(companyId, start, end, null);
1378 }
1379
1380 public List<MBMessage> findByCompanyId(long companyId, int start, int end,
1381 OrderByComparator obc) throws SystemException {
1382 Object[] finderArgs = new Object[] {
1383 new Long(companyId),
1384
1385 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1386 };
1387
1388 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_COMPANYID,
1389 finderArgs, this);
1390
1391 if (list == null) {
1392 Session session = null;
1393
1394 try {
1395 session = openSession();
1396
1397 StringBundler query = null;
1398
1399 if (obc != null) {
1400 query = new StringBundler(3 +
1401 (obc.getOrderByFields().length * 3));
1402 }
1403 else {
1404 query = new StringBundler(3);
1405 }
1406
1407 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
1408
1409 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1410
1411 if (obc != null) {
1412 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1413 }
1414
1415 else {
1416 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
1417 }
1418
1419 String sql = query.toString();
1420
1421 Query q = session.createQuery(sql);
1422
1423 QueryPos qPos = QueryPos.getInstance(q);
1424
1425 qPos.add(companyId);
1426
1427 list = (List<MBMessage>)QueryUtil.list(q, getDialect(), start,
1428 end);
1429 }
1430 catch (Exception e) {
1431 throw processException(e);
1432 }
1433 finally {
1434 if (list == null) {
1435 list = new ArrayList<MBMessage>();
1436 }
1437
1438 cacheResult(list);
1439
1440 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_COMPANYID,
1441 finderArgs, list);
1442
1443 closeSession(session);
1444 }
1445 }
1446
1447 return list;
1448 }
1449
1450 public MBMessage findByCompanyId_First(long companyId, OrderByComparator obc)
1451 throws NoSuchMessageException, SystemException {
1452 List<MBMessage> list = findByCompanyId(companyId, 0, 1, obc);
1453
1454 if (list.isEmpty()) {
1455 StringBundler msg = new StringBundler(4);
1456
1457 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1458
1459 msg.append("companyId=");
1460 msg.append(companyId);
1461
1462 msg.append(StringPool.CLOSE_CURLY_BRACE);
1463
1464 throw new NoSuchMessageException(msg.toString());
1465 }
1466 else {
1467 return list.get(0);
1468 }
1469 }
1470
1471 public MBMessage findByCompanyId_Last(long companyId, OrderByComparator obc)
1472 throws NoSuchMessageException, SystemException {
1473 int count = countByCompanyId(companyId);
1474
1475 List<MBMessage> list = findByCompanyId(companyId, count - 1, count, obc);
1476
1477 if (list.isEmpty()) {
1478 StringBundler msg = new StringBundler(4);
1479
1480 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1481
1482 msg.append("companyId=");
1483 msg.append(companyId);
1484
1485 msg.append(StringPool.CLOSE_CURLY_BRACE);
1486
1487 throw new NoSuchMessageException(msg.toString());
1488 }
1489 else {
1490 return list.get(0);
1491 }
1492 }
1493
1494 public MBMessage[] findByCompanyId_PrevAndNext(long messageId,
1495 long companyId, OrderByComparator obc)
1496 throws NoSuchMessageException, SystemException {
1497 MBMessage mbMessage = findByPrimaryKey(messageId);
1498
1499 int count = countByCompanyId(companyId);
1500
1501 Session session = null;
1502
1503 try {
1504 session = openSession();
1505
1506 StringBundler query = null;
1507
1508 if (obc != null) {
1509 query = new StringBundler(3 +
1510 (obc.getOrderByFields().length * 3));
1511 }
1512 else {
1513 query = new StringBundler(3);
1514 }
1515
1516 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
1517
1518 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1519
1520 if (obc != null) {
1521 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1522 }
1523
1524 else {
1525 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
1526 }
1527
1528 String sql = query.toString();
1529
1530 Query q = session.createQuery(sql);
1531
1532 QueryPos qPos = QueryPos.getInstance(q);
1533
1534 qPos.add(companyId);
1535
1536 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1537 mbMessage);
1538
1539 MBMessage[] array = new MBMessageImpl[3];
1540
1541 array[0] = (MBMessage)objArray[0];
1542 array[1] = (MBMessage)objArray[1];
1543 array[2] = (MBMessage)objArray[2];
1544
1545 return array;
1546 }
1547 catch (Exception e) {
1548 throw processException(e);
1549 }
1550 finally {
1551 closeSession(session);
1552 }
1553 }
1554
1555 public List<MBMessage> findByThreadId(long threadId)
1556 throws SystemException {
1557 Object[] finderArgs = new Object[] { new Long(threadId) };
1558
1559 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_THREADID,
1560 finderArgs, this);
1561
1562 if (list == null) {
1563 Session session = null;
1564
1565 try {
1566 session = openSession();
1567
1568 StringBundler query = new StringBundler(3);
1569
1570 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
1571
1572 query.append(_FINDER_COLUMN_THREADID_THREADID_2);
1573
1574 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
1575
1576 String sql = query.toString();
1577
1578 Query q = session.createQuery(sql);
1579
1580 QueryPos qPos = QueryPos.getInstance(q);
1581
1582 qPos.add(threadId);
1583
1584 list = q.list();
1585 }
1586 catch (Exception e) {
1587 throw processException(e);
1588 }
1589 finally {
1590 if (list == null) {
1591 list = new ArrayList<MBMessage>();
1592 }
1593
1594 cacheResult(list);
1595
1596 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_THREADID,
1597 finderArgs, list);
1598
1599 closeSession(session);
1600 }
1601 }
1602
1603 return list;
1604 }
1605
1606 public List<MBMessage> findByThreadId(long threadId, int start, int end)
1607 throws SystemException {
1608 return findByThreadId(threadId, start, end, null);
1609 }
1610
1611 public List<MBMessage> findByThreadId(long threadId, int start, int end,
1612 OrderByComparator obc) throws SystemException {
1613 Object[] finderArgs = new Object[] {
1614 new Long(threadId),
1615
1616 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1617 };
1618
1619 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_THREADID,
1620 finderArgs, this);
1621
1622 if (list == null) {
1623 Session session = null;
1624
1625 try {
1626 session = openSession();
1627
1628 StringBundler query = null;
1629
1630 if (obc != null) {
1631 query = new StringBundler(3 +
1632 (obc.getOrderByFields().length * 3));
1633 }
1634 else {
1635 query = new StringBundler(3);
1636 }
1637
1638 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
1639
1640 query.append(_FINDER_COLUMN_THREADID_THREADID_2);
1641
1642 if (obc != null) {
1643 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1644 }
1645
1646 else {
1647 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
1648 }
1649
1650 String sql = query.toString();
1651
1652 Query q = session.createQuery(sql);
1653
1654 QueryPos qPos = QueryPos.getInstance(q);
1655
1656 qPos.add(threadId);
1657
1658 list = (List<MBMessage>)QueryUtil.list(q, getDialect(), start,
1659 end);
1660 }
1661 catch (Exception e) {
1662 throw processException(e);
1663 }
1664 finally {
1665 if (list == null) {
1666 list = new ArrayList<MBMessage>();
1667 }
1668
1669 cacheResult(list);
1670
1671 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_THREADID,
1672 finderArgs, list);
1673
1674 closeSession(session);
1675 }
1676 }
1677
1678 return list;
1679 }
1680
1681 public MBMessage findByThreadId_First(long threadId, OrderByComparator obc)
1682 throws NoSuchMessageException, SystemException {
1683 List<MBMessage> list = findByThreadId(threadId, 0, 1, obc);
1684
1685 if (list.isEmpty()) {
1686 StringBundler msg = new StringBundler(4);
1687
1688 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1689
1690 msg.append("threadId=");
1691 msg.append(threadId);
1692
1693 msg.append(StringPool.CLOSE_CURLY_BRACE);
1694
1695 throw new NoSuchMessageException(msg.toString());
1696 }
1697 else {
1698 return list.get(0);
1699 }
1700 }
1701
1702 public MBMessage findByThreadId_Last(long threadId, OrderByComparator obc)
1703 throws NoSuchMessageException, SystemException {
1704 int count = countByThreadId(threadId);
1705
1706 List<MBMessage> list = findByThreadId(threadId, count - 1, count, obc);
1707
1708 if (list.isEmpty()) {
1709 StringBundler msg = new StringBundler(4);
1710
1711 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1712
1713 msg.append("threadId=");
1714 msg.append(threadId);
1715
1716 msg.append(StringPool.CLOSE_CURLY_BRACE);
1717
1718 throw new NoSuchMessageException(msg.toString());
1719 }
1720 else {
1721 return list.get(0);
1722 }
1723 }
1724
1725 public MBMessage[] findByThreadId_PrevAndNext(long messageId,
1726 long threadId, OrderByComparator obc)
1727 throws NoSuchMessageException, SystemException {
1728 MBMessage mbMessage = findByPrimaryKey(messageId);
1729
1730 int count = countByThreadId(threadId);
1731
1732 Session session = null;
1733
1734 try {
1735 session = openSession();
1736
1737 StringBundler query = null;
1738
1739 if (obc != null) {
1740 query = new StringBundler(3 +
1741 (obc.getOrderByFields().length * 3));
1742 }
1743 else {
1744 query = new StringBundler(3);
1745 }
1746
1747 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
1748
1749 query.append(_FINDER_COLUMN_THREADID_THREADID_2);
1750
1751 if (obc != null) {
1752 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1753 }
1754
1755 else {
1756 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
1757 }
1758
1759 String sql = query.toString();
1760
1761 Query q = session.createQuery(sql);
1762
1763 QueryPos qPos = QueryPos.getInstance(q);
1764
1765 qPos.add(threadId);
1766
1767 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1768 mbMessage);
1769
1770 MBMessage[] array = new MBMessageImpl[3];
1771
1772 array[0] = (MBMessage)objArray[0];
1773 array[1] = (MBMessage)objArray[1];
1774 array[2] = (MBMessage)objArray[2];
1775
1776 return array;
1777 }
1778 catch (Exception e) {
1779 throw processException(e);
1780 }
1781 finally {
1782 closeSession(session);
1783 }
1784 }
1785
1786 public List<MBMessage> findByThreadReplies(long threadId)
1787 throws SystemException {
1788 Object[] finderArgs = new Object[] { new Long(threadId) };
1789
1790 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_THREADREPLIES,
1791 finderArgs, this);
1792
1793 if (list == null) {
1794 Session session = null;
1795
1796 try {
1797 session = openSession();
1798
1799 StringBundler query = new StringBundler(3);
1800
1801 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
1802
1803 query.append(_FINDER_COLUMN_THREADREPLIES_THREADID_2);
1804
1805 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
1806
1807 String sql = query.toString();
1808
1809 Query q = session.createQuery(sql);
1810
1811 QueryPos qPos = QueryPos.getInstance(q);
1812
1813 qPos.add(threadId);
1814
1815 list = q.list();
1816 }
1817 catch (Exception e) {
1818 throw processException(e);
1819 }
1820 finally {
1821 if (list == null) {
1822 list = new ArrayList<MBMessage>();
1823 }
1824
1825 cacheResult(list);
1826
1827 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_THREADREPLIES,
1828 finderArgs, list);
1829
1830 closeSession(session);
1831 }
1832 }
1833
1834 return list;
1835 }
1836
1837 public List<MBMessage> findByThreadReplies(long threadId, int start, int end)
1838 throws SystemException {
1839 return findByThreadReplies(threadId, start, end, null);
1840 }
1841
1842 public List<MBMessage> findByThreadReplies(long threadId, int start,
1843 int end, OrderByComparator obc) throws SystemException {
1844 Object[] finderArgs = new Object[] {
1845 new Long(threadId),
1846
1847 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1848 };
1849
1850 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_THREADREPLIES,
1851 finderArgs, this);
1852
1853 if (list == null) {
1854 Session session = null;
1855
1856 try {
1857 session = openSession();
1858
1859 StringBundler query = null;
1860
1861 if (obc != null) {
1862 query = new StringBundler(3 +
1863 (obc.getOrderByFields().length * 3));
1864 }
1865 else {
1866 query = new StringBundler(3);
1867 }
1868
1869 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
1870
1871 query.append(_FINDER_COLUMN_THREADREPLIES_THREADID_2);
1872
1873 if (obc != null) {
1874 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1875 }
1876
1877 else {
1878 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
1879 }
1880
1881 String sql = query.toString();
1882
1883 Query q = session.createQuery(sql);
1884
1885 QueryPos qPos = QueryPos.getInstance(q);
1886
1887 qPos.add(threadId);
1888
1889 list = (List<MBMessage>)QueryUtil.list(q, getDialect(), start,
1890 end);
1891 }
1892 catch (Exception e) {
1893 throw processException(e);
1894 }
1895 finally {
1896 if (list == null) {
1897 list = new ArrayList<MBMessage>();
1898 }
1899
1900 cacheResult(list);
1901
1902 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_THREADREPLIES,
1903 finderArgs, list);
1904
1905 closeSession(session);
1906 }
1907 }
1908
1909 return list;
1910 }
1911
1912 public MBMessage findByThreadReplies_First(long threadId,
1913 OrderByComparator obc) throws NoSuchMessageException, SystemException {
1914 List<MBMessage> list = findByThreadReplies(threadId, 0, 1, obc);
1915
1916 if (list.isEmpty()) {
1917 StringBundler msg = new StringBundler(4);
1918
1919 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1920
1921 msg.append("threadId=");
1922 msg.append(threadId);
1923
1924 msg.append(StringPool.CLOSE_CURLY_BRACE);
1925
1926 throw new NoSuchMessageException(msg.toString());
1927 }
1928 else {
1929 return list.get(0);
1930 }
1931 }
1932
1933 public MBMessage findByThreadReplies_Last(long threadId,
1934 OrderByComparator obc) throws NoSuchMessageException, SystemException {
1935 int count = countByThreadReplies(threadId);
1936
1937 List<MBMessage> list = findByThreadReplies(threadId, count - 1, count,
1938 obc);
1939
1940 if (list.isEmpty()) {
1941 StringBundler msg = new StringBundler(4);
1942
1943 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1944
1945 msg.append("threadId=");
1946 msg.append(threadId);
1947
1948 msg.append(StringPool.CLOSE_CURLY_BRACE);
1949
1950 throw new NoSuchMessageException(msg.toString());
1951 }
1952 else {
1953 return list.get(0);
1954 }
1955 }
1956
1957 public MBMessage[] findByThreadReplies_PrevAndNext(long messageId,
1958 long threadId, OrderByComparator obc)
1959 throws NoSuchMessageException, SystemException {
1960 MBMessage mbMessage = findByPrimaryKey(messageId);
1961
1962 int count = countByThreadReplies(threadId);
1963
1964 Session session = null;
1965
1966 try {
1967 session = openSession();
1968
1969 StringBundler query = null;
1970
1971 if (obc != null) {
1972 query = new StringBundler(3 +
1973 (obc.getOrderByFields().length * 3));
1974 }
1975 else {
1976 query = new StringBundler(3);
1977 }
1978
1979 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
1980
1981 query.append(_FINDER_COLUMN_THREADREPLIES_THREADID_2);
1982
1983 if (obc != null) {
1984 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1985 }
1986
1987 else {
1988 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
1989 }
1990
1991 String sql = query.toString();
1992
1993 Query q = session.createQuery(sql);
1994
1995 QueryPos qPos = QueryPos.getInstance(q);
1996
1997 qPos.add(threadId);
1998
1999 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
2000 mbMessage);
2001
2002 MBMessage[] array = new MBMessageImpl[3];
2003
2004 array[0] = (MBMessage)objArray[0];
2005 array[1] = (MBMessage)objArray[1];
2006 array[2] = (MBMessage)objArray[2];
2007
2008 return array;
2009 }
2010 catch (Exception e) {
2011 throw processException(e);
2012 }
2013 finally {
2014 closeSession(session);
2015 }
2016 }
2017
2018 public List<MBMessage> findByG_U(long groupId, long userId)
2019 throws SystemException {
2020 Object[] finderArgs = new Object[] { new Long(groupId), new Long(userId) };
2021
2022 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_U,
2023 finderArgs, this);
2024
2025 if (list == null) {
2026 Session session = null;
2027
2028 try {
2029 session = openSession();
2030
2031 StringBundler query = new StringBundler(4);
2032
2033 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
2034
2035 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
2036
2037 query.append(_FINDER_COLUMN_G_U_USERID_2);
2038
2039 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
2040
2041 String sql = query.toString();
2042
2043 Query q = session.createQuery(sql);
2044
2045 QueryPos qPos = QueryPos.getInstance(q);
2046
2047 qPos.add(groupId);
2048
2049 qPos.add(userId);
2050
2051 list = q.list();
2052 }
2053 catch (Exception e) {
2054 throw processException(e);
2055 }
2056 finally {
2057 if (list == null) {
2058 list = new ArrayList<MBMessage>();
2059 }
2060
2061 cacheResult(list);
2062
2063 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_U, finderArgs,
2064 list);
2065
2066 closeSession(session);
2067 }
2068 }
2069
2070 return list;
2071 }
2072
2073 public List<MBMessage> findByG_U(long groupId, long userId, int start,
2074 int end) throws SystemException {
2075 return findByG_U(groupId, userId, start, end, null);
2076 }
2077
2078 public List<MBMessage> findByG_U(long groupId, long userId, int start,
2079 int end, OrderByComparator obc) throws SystemException {
2080 Object[] finderArgs = new Object[] {
2081 new Long(groupId), new Long(userId),
2082
2083 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
2084 };
2085
2086 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_G_U,
2087 finderArgs, this);
2088
2089 if (list == null) {
2090 Session session = null;
2091
2092 try {
2093 session = openSession();
2094
2095 StringBundler query = null;
2096
2097 if (obc != null) {
2098 query = new StringBundler(4 +
2099 (obc.getOrderByFields().length * 3));
2100 }
2101 else {
2102 query = new StringBundler(4);
2103 }
2104
2105 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
2106
2107 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
2108
2109 query.append(_FINDER_COLUMN_G_U_USERID_2);
2110
2111 if (obc != null) {
2112 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
2113 }
2114
2115 else {
2116 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
2117 }
2118
2119 String sql = query.toString();
2120
2121 Query q = session.createQuery(sql);
2122
2123 QueryPos qPos = QueryPos.getInstance(q);
2124
2125 qPos.add(groupId);
2126
2127 qPos.add(userId);
2128
2129 list = (List<MBMessage>)QueryUtil.list(q, getDialect(), start,
2130 end);
2131 }
2132 catch (Exception e) {
2133 throw processException(e);
2134 }
2135 finally {
2136 if (list == null) {
2137 list = new ArrayList<MBMessage>();
2138 }
2139
2140 cacheResult(list);
2141
2142 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_G_U,
2143 finderArgs, list);
2144
2145 closeSession(session);
2146 }
2147 }
2148
2149 return list;
2150 }
2151
2152 public MBMessage findByG_U_First(long groupId, long userId,
2153 OrderByComparator obc) throws NoSuchMessageException, SystemException {
2154 List<MBMessage> list = findByG_U(groupId, userId, 0, 1, obc);
2155
2156 if (list.isEmpty()) {
2157 StringBundler msg = new StringBundler(6);
2158
2159 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2160
2161 msg.append("groupId=");
2162 msg.append(groupId);
2163
2164 msg.append(", userId=");
2165 msg.append(userId);
2166
2167 msg.append(StringPool.CLOSE_CURLY_BRACE);
2168
2169 throw new NoSuchMessageException(msg.toString());
2170 }
2171 else {
2172 return list.get(0);
2173 }
2174 }
2175
2176 public MBMessage findByG_U_Last(long groupId, long userId,
2177 OrderByComparator obc) throws NoSuchMessageException, SystemException {
2178 int count = countByG_U(groupId, userId);
2179
2180 List<MBMessage> list = findByG_U(groupId, userId, count - 1, count, obc);
2181
2182 if (list.isEmpty()) {
2183 StringBundler msg = new StringBundler(6);
2184
2185 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2186
2187 msg.append("groupId=");
2188 msg.append(groupId);
2189
2190 msg.append(", userId=");
2191 msg.append(userId);
2192
2193 msg.append(StringPool.CLOSE_CURLY_BRACE);
2194
2195 throw new NoSuchMessageException(msg.toString());
2196 }
2197 else {
2198 return list.get(0);
2199 }
2200 }
2201
2202 public MBMessage[] findByG_U_PrevAndNext(long messageId, long groupId,
2203 long userId, OrderByComparator obc)
2204 throws NoSuchMessageException, SystemException {
2205 MBMessage mbMessage = findByPrimaryKey(messageId);
2206
2207 int count = countByG_U(groupId, userId);
2208
2209 Session session = null;
2210
2211 try {
2212 session = openSession();
2213
2214 StringBundler query = null;
2215
2216 if (obc != null) {
2217 query = new StringBundler(4 +
2218 (obc.getOrderByFields().length * 3));
2219 }
2220 else {
2221 query = new StringBundler(4);
2222 }
2223
2224 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
2225
2226 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
2227
2228 query.append(_FINDER_COLUMN_G_U_USERID_2);
2229
2230 if (obc != null) {
2231 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
2232 }
2233
2234 else {
2235 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
2236 }
2237
2238 String sql = query.toString();
2239
2240 Query q = session.createQuery(sql);
2241
2242 QueryPos qPos = QueryPos.getInstance(q);
2243
2244 qPos.add(groupId);
2245
2246 qPos.add(userId);
2247
2248 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
2249 mbMessage);
2250
2251 MBMessage[] array = new MBMessageImpl[3];
2252
2253 array[0] = (MBMessage)objArray[0];
2254 array[1] = (MBMessage)objArray[1];
2255 array[2] = (MBMessage)objArray[2];
2256
2257 return array;
2258 }
2259 catch (Exception e) {
2260 throw processException(e);
2261 }
2262 finally {
2263 closeSession(session);
2264 }
2265 }
2266
2267 public List<MBMessage> findByG_C(long groupId, long categoryId)
2268 throws SystemException {
2269 Object[] finderArgs = new Object[] {
2270 new Long(groupId), new Long(categoryId)
2271 };
2272
2273 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_C,
2274 finderArgs, this);
2275
2276 if (list == null) {
2277 Session session = null;
2278
2279 try {
2280 session = openSession();
2281
2282 StringBundler query = new StringBundler(4);
2283
2284 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
2285
2286 query.append(_FINDER_COLUMN_G_C_GROUPID_2);
2287
2288 query.append(_FINDER_COLUMN_G_C_CATEGORYID_2);
2289
2290 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
2291
2292 String sql = query.toString();
2293
2294 Query q = session.createQuery(sql);
2295
2296 QueryPos qPos = QueryPos.getInstance(q);
2297
2298 qPos.add(groupId);
2299
2300 qPos.add(categoryId);
2301
2302 list = q.list();
2303 }
2304 catch (Exception e) {
2305 throw processException(e);
2306 }
2307 finally {
2308 if (list == null) {
2309 list = new ArrayList<MBMessage>();
2310 }
2311
2312 cacheResult(list);
2313
2314 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_C, finderArgs,
2315 list);
2316
2317 closeSession(session);
2318 }
2319 }
2320
2321 return list;
2322 }
2323
2324 public List<MBMessage> findByG_C(long groupId, long categoryId, int start,
2325 int end) throws SystemException {
2326 return findByG_C(groupId, categoryId, start, end, null);
2327 }
2328
2329 public List<MBMessage> findByG_C(long groupId, long categoryId, int start,
2330 int end, OrderByComparator obc) throws SystemException {
2331 Object[] finderArgs = new Object[] {
2332 new Long(groupId), new Long(categoryId),
2333
2334 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
2335 };
2336
2337 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_G_C,
2338 finderArgs, this);
2339
2340 if (list == null) {
2341 Session session = null;
2342
2343 try {
2344 session = openSession();
2345
2346 StringBundler query = null;
2347
2348 if (obc != null) {
2349 query = new StringBundler(4 +
2350 (obc.getOrderByFields().length * 3));
2351 }
2352 else {
2353 query = new StringBundler(4);
2354 }
2355
2356 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
2357
2358 query.append(_FINDER_COLUMN_G_C_GROUPID_2);
2359
2360 query.append(_FINDER_COLUMN_G_C_CATEGORYID_2);
2361
2362 if (obc != null) {
2363 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
2364 }
2365
2366 else {
2367 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
2368 }
2369
2370 String sql = query.toString();
2371
2372 Query q = session.createQuery(sql);
2373
2374 QueryPos qPos = QueryPos.getInstance(q);
2375
2376 qPos.add(groupId);
2377
2378 qPos.add(categoryId);
2379
2380 list = (List<MBMessage>)QueryUtil.list(q, getDialect(), start,
2381 end);
2382 }
2383 catch (Exception e) {
2384 throw processException(e);
2385 }
2386 finally {
2387 if (list == null) {
2388 list = new ArrayList<MBMessage>();
2389 }
2390
2391 cacheResult(list);
2392
2393 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_G_C,
2394 finderArgs, list);
2395
2396 closeSession(session);
2397 }
2398 }
2399
2400 return list;
2401 }
2402
2403 public MBMessage findByG_C_First(long groupId, long categoryId,
2404 OrderByComparator obc) throws NoSuchMessageException, SystemException {
2405 List<MBMessage> list = findByG_C(groupId, categoryId, 0, 1, obc);
2406
2407 if (list.isEmpty()) {
2408 StringBundler msg = new StringBundler(6);
2409
2410 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2411
2412 msg.append("groupId=");
2413 msg.append(groupId);
2414
2415 msg.append(", categoryId=");
2416 msg.append(categoryId);
2417
2418 msg.append(StringPool.CLOSE_CURLY_BRACE);
2419
2420 throw new NoSuchMessageException(msg.toString());
2421 }
2422 else {
2423 return list.get(0);
2424 }
2425 }
2426
2427 public MBMessage findByG_C_Last(long groupId, long categoryId,
2428 OrderByComparator obc) throws NoSuchMessageException, SystemException {
2429 int count = countByG_C(groupId, categoryId);
2430
2431 List<MBMessage> list = findByG_C(groupId, categoryId, count - 1, count,
2432 obc);
2433
2434 if (list.isEmpty()) {
2435 StringBundler msg = new StringBundler(6);
2436
2437 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2438
2439 msg.append("groupId=");
2440 msg.append(groupId);
2441
2442 msg.append(", categoryId=");
2443 msg.append(categoryId);
2444
2445 msg.append(StringPool.CLOSE_CURLY_BRACE);
2446
2447 throw new NoSuchMessageException(msg.toString());
2448 }
2449 else {
2450 return list.get(0);
2451 }
2452 }
2453
2454 public MBMessage[] findByG_C_PrevAndNext(long messageId, long groupId,
2455 long categoryId, OrderByComparator obc)
2456 throws NoSuchMessageException, SystemException {
2457 MBMessage mbMessage = findByPrimaryKey(messageId);
2458
2459 int count = countByG_C(groupId, categoryId);
2460
2461 Session session = null;
2462
2463 try {
2464 session = openSession();
2465
2466 StringBundler query = null;
2467
2468 if (obc != null) {
2469 query = new StringBundler(4 +
2470 (obc.getOrderByFields().length * 3));
2471 }
2472 else {
2473 query = new StringBundler(4);
2474 }
2475
2476 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
2477
2478 query.append(_FINDER_COLUMN_G_C_GROUPID_2);
2479
2480 query.append(_FINDER_COLUMN_G_C_CATEGORYID_2);
2481
2482 if (obc != null) {
2483 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
2484 }
2485
2486 else {
2487 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
2488 }
2489
2490 String sql = query.toString();
2491
2492 Query q = session.createQuery(sql);
2493
2494 QueryPos qPos = QueryPos.getInstance(q);
2495
2496 qPos.add(groupId);
2497
2498 qPos.add(categoryId);
2499
2500 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
2501 mbMessage);
2502
2503 MBMessage[] array = new MBMessageImpl[3];
2504
2505 array[0] = (MBMessage)objArray[0];
2506 array[1] = (MBMessage)objArray[1];
2507 array[2] = (MBMessage)objArray[2];
2508
2509 return array;
2510 }
2511 catch (Exception e) {
2512 throw processException(e);
2513 }
2514 finally {
2515 closeSession(session);
2516 }
2517 }
2518
2519 public List<MBMessage> findByG_S(long groupId, int status)
2520 throws SystemException {
2521 Object[] finderArgs = new Object[] {
2522 new Long(groupId), new Integer(status)
2523 };
2524
2525 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_S,
2526 finderArgs, this);
2527
2528 if (list == null) {
2529 Session session = null;
2530
2531 try {
2532 session = openSession();
2533
2534 StringBundler query = new StringBundler(4);
2535
2536 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
2537
2538 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
2539
2540 query.append(_FINDER_COLUMN_G_S_STATUS_2);
2541
2542 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
2543
2544 String sql = query.toString();
2545
2546 Query q = session.createQuery(sql);
2547
2548 QueryPos qPos = QueryPos.getInstance(q);
2549
2550 qPos.add(groupId);
2551
2552 qPos.add(status);
2553
2554 list = q.list();
2555 }
2556 catch (Exception e) {
2557 throw processException(e);
2558 }
2559 finally {
2560 if (list == null) {
2561 list = new ArrayList<MBMessage>();
2562 }
2563
2564 cacheResult(list);
2565
2566 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_S, finderArgs,
2567 list);
2568
2569 closeSession(session);
2570 }
2571 }
2572
2573 return list;
2574 }
2575
2576 public List<MBMessage> findByG_S(long groupId, int status, int start,
2577 int end) throws SystemException {
2578 return findByG_S(groupId, status, start, end, null);
2579 }
2580
2581 public List<MBMessage> findByG_S(long groupId, int status, int start,
2582 int end, OrderByComparator obc) throws SystemException {
2583 Object[] finderArgs = new Object[] {
2584 new Long(groupId), new Integer(status),
2585
2586 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
2587 };
2588
2589 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_G_S,
2590 finderArgs, this);
2591
2592 if (list == null) {
2593 Session session = null;
2594
2595 try {
2596 session = openSession();
2597
2598 StringBundler query = null;
2599
2600 if (obc != null) {
2601 query = new StringBundler(4 +
2602 (obc.getOrderByFields().length * 3));
2603 }
2604 else {
2605 query = new StringBundler(4);
2606 }
2607
2608 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
2609
2610 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
2611
2612 query.append(_FINDER_COLUMN_G_S_STATUS_2);
2613
2614 if (obc != null) {
2615 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
2616 }
2617
2618 else {
2619 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
2620 }
2621
2622 String sql = query.toString();
2623
2624 Query q = session.createQuery(sql);
2625
2626 QueryPos qPos = QueryPos.getInstance(q);
2627
2628 qPos.add(groupId);
2629
2630 qPos.add(status);
2631
2632 list = (List<MBMessage>)QueryUtil.list(q, getDialect(), start,
2633 end);
2634 }
2635 catch (Exception e) {
2636 throw processException(e);
2637 }
2638 finally {
2639 if (list == null) {
2640 list = new ArrayList<MBMessage>();
2641 }
2642
2643 cacheResult(list);
2644
2645 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_G_S,
2646 finderArgs, list);
2647
2648 closeSession(session);
2649 }
2650 }
2651
2652 return list;
2653 }
2654
2655 public MBMessage findByG_S_First(long groupId, int status,
2656 OrderByComparator obc) throws NoSuchMessageException, SystemException {
2657 List<MBMessage> list = findByG_S(groupId, status, 0, 1, obc);
2658
2659 if (list.isEmpty()) {
2660 StringBundler msg = new StringBundler(6);
2661
2662 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2663
2664 msg.append("groupId=");
2665 msg.append(groupId);
2666
2667 msg.append(", status=");
2668 msg.append(status);
2669
2670 msg.append(StringPool.CLOSE_CURLY_BRACE);
2671
2672 throw new NoSuchMessageException(msg.toString());
2673 }
2674 else {
2675 return list.get(0);
2676 }
2677 }
2678
2679 public MBMessage findByG_S_Last(long groupId, int status,
2680 OrderByComparator obc) throws NoSuchMessageException, SystemException {
2681 int count = countByG_S(groupId, status);
2682
2683 List<MBMessage> list = findByG_S(groupId, status, count - 1, count, obc);
2684
2685 if (list.isEmpty()) {
2686 StringBundler msg = new StringBundler(6);
2687
2688 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2689
2690 msg.append("groupId=");
2691 msg.append(groupId);
2692
2693 msg.append(", status=");
2694 msg.append(status);
2695
2696 msg.append(StringPool.CLOSE_CURLY_BRACE);
2697
2698 throw new NoSuchMessageException(msg.toString());
2699 }
2700 else {
2701 return list.get(0);
2702 }
2703 }
2704
2705 public MBMessage[] findByG_S_PrevAndNext(long messageId, long groupId,
2706 int status, OrderByComparator obc)
2707 throws NoSuchMessageException, SystemException {
2708 MBMessage mbMessage = findByPrimaryKey(messageId);
2709
2710 int count = countByG_S(groupId, status);
2711
2712 Session session = null;
2713
2714 try {
2715 session = openSession();
2716
2717 StringBundler query = null;
2718
2719 if (obc != null) {
2720 query = new StringBundler(4 +
2721 (obc.getOrderByFields().length * 3));
2722 }
2723 else {
2724 query = new StringBundler(4);
2725 }
2726
2727 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
2728
2729 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
2730
2731 query.append(_FINDER_COLUMN_G_S_STATUS_2);
2732
2733 if (obc != null) {
2734 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
2735 }
2736
2737 else {
2738 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
2739 }
2740
2741 String sql = query.toString();
2742
2743 Query q = session.createQuery(sql);
2744
2745 QueryPos qPos = QueryPos.getInstance(q);
2746
2747 qPos.add(groupId);
2748
2749 qPos.add(status);
2750
2751 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
2752 mbMessage);
2753
2754 MBMessage[] array = new MBMessageImpl[3];
2755
2756 array[0] = (MBMessage)objArray[0];
2757 array[1] = (MBMessage)objArray[1];
2758 array[2] = (MBMessage)objArray[2];
2759
2760 return array;
2761 }
2762 catch (Exception e) {
2763 throw processException(e);
2764 }
2765 finally {
2766 closeSession(session);
2767 }
2768 }
2769
2770 public List<MBMessage> findByC_S(long companyId, int status)
2771 throws SystemException {
2772 Object[] finderArgs = new Object[] {
2773 new Long(companyId), new Integer(status)
2774 };
2775
2776 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_S,
2777 finderArgs, this);
2778
2779 if (list == null) {
2780 Session session = null;
2781
2782 try {
2783 session = openSession();
2784
2785 StringBundler query = new StringBundler(4);
2786
2787 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
2788
2789 query.append(_FINDER_COLUMN_C_S_COMPANYID_2);
2790
2791 query.append(_FINDER_COLUMN_C_S_STATUS_2);
2792
2793 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
2794
2795 String sql = query.toString();
2796
2797 Query q = session.createQuery(sql);
2798
2799 QueryPos qPos = QueryPos.getInstance(q);
2800
2801 qPos.add(companyId);
2802
2803 qPos.add(status);
2804
2805 list = q.list();
2806 }
2807 catch (Exception e) {
2808 throw processException(e);
2809 }
2810 finally {
2811 if (list == null) {
2812 list = new ArrayList<MBMessage>();
2813 }
2814
2815 cacheResult(list);
2816
2817 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_S, finderArgs,
2818 list);
2819
2820 closeSession(session);
2821 }
2822 }
2823
2824 return list;
2825 }
2826
2827 public List<MBMessage> findByC_S(long companyId, int status, int start,
2828 int end) throws SystemException {
2829 return findByC_S(companyId, status, start, end, null);
2830 }
2831
2832 public List<MBMessage> findByC_S(long companyId, int status, int start,
2833 int end, OrderByComparator obc) throws SystemException {
2834 Object[] finderArgs = new Object[] {
2835 new Long(companyId), new Integer(status),
2836
2837 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
2838 };
2839
2840 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_C_S,
2841 finderArgs, this);
2842
2843 if (list == null) {
2844 Session session = null;
2845
2846 try {
2847 session = openSession();
2848
2849 StringBundler query = null;
2850
2851 if (obc != null) {
2852 query = new StringBundler(4 +
2853 (obc.getOrderByFields().length * 3));
2854 }
2855 else {
2856 query = new StringBundler(4);
2857 }
2858
2859 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
2860
2861 query.append(_FINDER_COLUMN_C_S_COMPANYID_2);
2862
2863 query.append(_FINDER_COLUMN_C_S_STATUS_2);
2864
2865 if (obc != null) {
2866 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
2867 }
2868
2869 else {
2870 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
2871 }
2872
2873 String sql = query.toString();
2874
2875 Query q = session.createQuery(sql);
2876
2877 QueryPos qPos = QueryPos.getInstance(q);
2878
2879 qPos.add(companyId);
2880
2881 qPos.add(status);
2882
2883 list = (List<MBMessage>)QueryUtil.list(q, getDialect(), start,
2884 end);
2885 }
2886 catch (Exception e) {
2887 throw processException(e);
2888 }
2889 finally {
2890 if (list == null) {
2891 list = new ArrayList<MBMessage>();
2892 }
2893
2894 cacheResult(list);
2895
2896 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_C_S,
2897 finderArgs, list);
2898
2899 closeSession(session);
2900 }
2901 }
2902
2903 return list;
2904 }
2905
2906 public MBMessage findByC_S_First(long companyId, int status,
2907 OrderByComparator obc) throws NoSuchMessageException, SystemException {
2908 List<MBMessage> list = findByC_S(companyId, status, 0, 1, obc);
2909
2910 if (list.isEmpty()) {
2911 StringBundler msg = new StringBundler(6);
2912
2913 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2914
2915 msg.append("companyId=");
2916 msg.append(companyId);
2917
2918 msg.append(", status=");
2919 msg.append(status);
2920
2921 msg.append(StringPool.CLOSE_CURLY_BRACE);
2922
2923 throw new NoSuchMessageException(msg.toString());
2924 }
2925 else {
2926 return list.get(0);
2927 }
2928 }
2929
2930 public MBMessage findByC_S_Last(long companyId, int status,
2931 OrderByComparator obc) throws NoSuchMessageException, SystemException {
2932 int count = countByC_S(companyId, status);
2933
2934 List<MBMessage> list = findByC_S(companyId, status, count - 1, count,
2935 obc);
2936
2937 if (list.isEmpty()) {
2938 StringBundler msg = new StringBundler(6);
2939
2940 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2941
2942 msg.append("companyId=");
2943 msg.append(companyId);
2944
2945 msg.append(", status=");
2946 msg.append(status);
2947
2948 msg.append(StringPool.CLOSE_CURLY_BRACE);
2949
2950 throw new NoSuchMessageException(msg.toString());
2951 }
2952 else {
2953 return list.get(0);
2954 }
2955 }
2956
2957 public MBMessage[] findByC_S_PrevAndNext(long messageId, long companyId,
2958 int status, OrderByComparator obc)
2959 throws NoSuchMessageException, SystemException {
2960 MBMessage mbMessage = findByPrimaryKey(messageId);
2961
2962 int count = countByC_S(companyId, status);
2963
2964 Session session = null;
2965
2966 try {
2967 session = openSession();
2968
2969 StringBundler query = null;
2970
2971 if (obc != null) {
2972 query = new StringBundler(4 +
2973 (obc.getOrderByFields().length * 3));
2974 }
2975 else {
2976 query = new StringBundler(4);
2977 }
2978
2979 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
2980
2981 query.append(_FINDER_COLUMN_C_S_COMPANYID_2);
2982
2983 query.append(_FINDER_COLUMN_C_S_STATUS_2);
2984
2985 if (obc != null) {
2986 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
2987 }
2988
2989 else {
2990 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
2991 }
2992
2993 String sql = query.toString();
2994
2995 Query q = session.createQuery(sql);
2996
2997 QueryPos qPos = QueryPos.getInstance(q);
2998
2999 qPos.add(companyId);
3000
3001 qPos.add(status);
3002
3003 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
3004 mbMessage);
3005
3006 MBMessage[] array = new MBMessageImpl[3];
3007
3008 array[0] = (MBMessage)objArray[0];
3009 array[1] = (MBMessage)objArray[1];
3010 array[2] = (MBMessage)objArray[2];
3011
3012 return array;
3013 }
3014 catch (Exception e) {
3015 throw processException(e);
3016 }
3017 finally {
3018 closeSession(session);
3019 }
3020 }
3021
3022 public List<MBMessage> findByC_C(long classNameId, long classPK)
3023 throws SystemException {
3024 Object[] finderArgs = new Object[] {
3025 new Long(classNameId), new Long(classPK)
3026 };
3027
3028 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_C,
3029 finderArgs, this);
3030
3031 if (list == null) {
3032 Session session = null;
3033
3034 try {
3035 session = openSession();
3036
3037 StringBundler query = new StringBundler(4);
3038
3039 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
3040
3041 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
3042
3043 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
3044
3045 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
3046
3047 String sql = query.toString();
3048
3049 Query q = session.createQuery(sql);
3050
3051 QueryPos qPos = QueryPos.getInstance(q);
3052
3053 qPos.add(classNameId);
3054
3055 qPos.add(classPK);
3056
3057 list = q.list();
3058 }
3059 catch (Exception e) {
3060 throw processException(e);
3061 }
3062 finally {
3063 if (list == null) {
3064 list = new ArrayList<MBMessage>();
3065 }
3066
3067 cacheResult(list);
3068
3069 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_C, finderArgs,
3070 list);
3071
3072 closeSession(session);
3073 }
3074 }
3075
3076 return list;
3077 }
3078
3079 public List<MBMessage> findByC_C(long classNameId, long classPK, int start,
3080 int end) throws SystemException {
3081 return findByC_C(classNameId, classPK, start, end, null);
3082 }
3083
3084 public List<MBMessage> findByC_C(long classNameId, long classPK, int start,
3085 int end, OrderByComparator obc) throws SystemException {
3086 Object[] finderArgs = new Object[] {
3087 new Long(classNameId), new Long(classPK),
3088
3089 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
3090 };
3091
3092 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_C_C,
3093 finderArgs, this);
3094
3095 if (list == null) {
3096 Session session = null;
3097
3098 try {
3099 session = openSession();
3100
3101 StringBundler query = null;
3102
3103 if (obc != null) {
3104 query = new StringBundler(4 +
3105 (obc.getOrderByFields().length * 3));
3106 }
3107 else {
3108 query = new StringBundler(4);
3109 }
3110
3111 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
3112
3113 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
3114
3115 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
3116
3117 if (obc != null) {
3118 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
3119 }
3120
3121 else {
3122 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
3123 }
3124
3125 String sql = query.toString();
3126
3127 Query q = session.createQuery(sql);
3128
3129 QueryPos qPos = QueryPos.getInstance(q);
3130
3131 qPos.add(classNameId);
3132
3133 qPos.add(classPK);
3134
3135 list = (List<MBMessage>)QueryUtil.list(q, getDialect(), start,
3136 end);
3137 }
3138 catch (Exception e) {
3139 throw processException(e);
3140 }
3141 finally {
3142 if (list == null) {
3143 list = new ArrayList<MBMessage>();
3144 }
3145
3146 cacheResult(list);
3147
3148 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_C_C,
3149 finderArgs, list);
3150
3151 closeSession(session);
3152 }
3153 }
3154
3155 return list;
3156 }
3157
3158 public MBMessage findByC_C_First(long classNameId, long classPK,
3159 OrderByComparator obc) throws NoSuchMessageException, SystemException {
3160 List<MBMessage> list = findByC_C(classNameId, classPK, 0, 1, obc);
3161
3162 if (list.isEmpty()) {
3163 StringBundler msg = new StringBundler(6);
3164
3165 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3166
3167 msg.append("classNameId=");
3168 msg.append(classNameId);
3169
3170 msg.append(", classPK=");
3171 msg.append(classPK);
3172
3173 msg.append(StringPool.CLOSE_CURLY_BRACE);
3174
3175 throw new NoSuchMessageException(msg.toString());
3176 }
3177 else {
3178 return list.get(0);
3179 }
3180 }
3181
3182 public MBMessage findByC_C_Last(long classNameId, long classPK,
3183 OrderByComparator obc) throws NoSuchMessageException, SystemException {
3184 int count = countByC_C(classNameId, classPK);
3185
3186 List<MBMessage> list = findByC_C(classNameId, classPK, count - 1,
3187 count, obc);
3188
3189 if (list.isEmpty()) {
3190 StringBundler msg = new StringBundler(6);
3191
3192 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3193
3194 msg.append("classNameId=");
3195 msg.append(classNameId);
3196
3197 msg.append(", classPK=");
3198 msg.append(classPK);
3199
3200 msg.append(StringPool.CLOSE_CURLY_BRACE);
3201
3202 throw new NoSuchMessageException(msg.toString());
3203 }
3204 else {
3205 return list.get(0);
3206 }
3207 }
3208
3209 public MBMessage[] findByC_C_PrevAndNext(long messageId, long classNameId,
3210 long classPK, OrderByComparator obc)
3211 throws NoSuchMessageException, SystemException {
3212 MBMessage mbMessage = findByPrimaryKey(messageId);
3213
3214 int count = countByC_C(classNameId, classPK);
3215
3216 Session session = null;
3217
3218 try {
3219 session = openSession();
3220
3221 StringBundler query = null;
3222
3223 if (obc != null) {
3224 query = new StringBundler(4 +
3225 (obc.getOrderByFields().length * 3));
3226 }
3227 else {
3228 query = new StringBundler(4);
3229 }
3230
3231 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
3232
3233 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
3234
3235 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
3236
3237 if (obc != null) {
3238 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
3239 }
3240
3241 else {
3242 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
3243 }
3244
3245 String sql = query.toString();
3246
3247 Query q = session.createQuery(sql);
3248
3249 QueryPos qPos = QueryPos.getInstance(q);
3250
3251 qPos.add(classNameId);
3252
3253 qPos.add(classPK);
3254
3255 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
3256 mbMessage);
3257
3258 MBMessage[] array = new MBMessageImpl[3];
3259
3260 array[0] = (MBMessage)objArray[0];
3261 array[1] = (MBMessage)objArray[1];
3262 array[2] = (MBMessage)objArray[2];
3263
3264 return array;
3265 }
3266 catch (Exception e) {
3267 throw processException(e);
3268 }
3269 finally {
3270 closeSession(session);
3271 }
3272 }
3273
3274 public List<MBMessage> findByT_P(long threadId, long parentMessageId)
3275 throws SystemException {
3276 Object[] finderArgs = new Object[] {
3277 new Long(threadId), new Long(parentMessageId)
3278 };
3279
3280 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_T_P,
3281 finderArgs, this);
3282
3283 if (list == null) {
3284 Session session = null;
3285
3286 try {
3287 session = openSession();
3288
3289 StringBundler query = new StringBundler(4);
3290
3291 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
3292
3293 query.append(_FINDER_COLUMN_T_P_THREADID_2);
3294
3295 query.append(_FINDER_COLUMN_T_P_PARENTMESSAGEID_2);
3296
3297 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
3298
3299 String sql = query.toString();
3300
3301 Query q = session.createQuery(sql);
3302
3303 QueryPos qPos = QueryPos.getInstance(q);
3304
3305 qPos.add(threadId);
3306
3307 qPos.add(parentMessageId);
3308
3309 list = q.list();
3310 }
3311 catch (Exception e) {
3312 throw processException(e);
3313 }
3314 finally {
3315 if (list == null) {
3316 list = new ArrayList<MBMessage>();
3317 }
3318
3319 cacheResult(list);
3320
3321 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_T_P, finderArgs,
3322 list);
3323
3324 closeSession(session);
3325 }
3326 }
3327
3328 return list;
3329 }
3330
3331 public List<MBMessage> findByT_P(long threadId, long parentMessageId,
3332 int start, int end) throws SystemException {
3333 return findByT_P(threadId, parentMessageId, start, end, null);
3334 }
3335
3336 public List<MBMessage> findByT_P(long threadId, long parentMessageId,
3337 int start, int end, OrderByComparator obc) throws SystemException {
3338 Object[] finderArgs = new Object[] {
3339 new Long(threadId), new Long(parentMessageId),
3340
3341 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
3342 };
3343
3344 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_T_P,
3345 finderArgs, this);
3346
3347 if (list == null) {
3348 Session session = null;
3349
3350 try {
3351 session = openSession();
3352
3353 StringBundler query = null;
3354
3355 if (obc != null) {
3356 query = new StringBundler(4 +
3357 (obc.getOrderByFields().length * 3));
3358 }
3359 else {
3360 query = new StringBundler(4);
3361 }
3362
3363 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
3364
3365 query.append(_FINDER_COLUMN_T_P_THREADID_2);
3366
3367 query.append(_FINDER_COLUMN_T_P_PARENTMESSAGEID_2);
3368
3369 if (obc != null) {
3370 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
3371 }
3372
3373 else {
3374 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
3375 }
3376
3377 String sql = query.toString();
3378
3379 Query q = session.createQuery(sql);
3380
3381 QueryPos qPos = QueryPos.getInstance(q);
3382
3383 qPos.add(threadId);
3384
3385 qPos.add(parentMessageId);
3386
3387 list = (List<MBMessage>)QueryUtil.list(q, getDialect(), start,
3388 end);
3389 }
3390 catch (Exception e) {
3391 throw processException(e);
3392 }
3393 finally {
3394 if (list == null) {
3395 list = new ArrayList<MBMessage>();
3396 }
3397
3398 cacheResult(list);
3399
3400 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_T_P,
3401 finderArgs, list);
3402
3403 closeSession(session);
3404 }
3405 }
3406
3407 return list;
3408 }
3409
3410 public MBMessage findByT_P_First(long threadId, long parentMessageId,
3411 OrderByComparator obc) throws NoSuchMessageException, SystemException {
3412 List<MBMessage> list = findByT_P(threadId, parentMessageId, 0, 1, obc);
3413
3414 if (list.isEmpty()) {
3415 StringBundler msg = new StringBundler(6);
3416
3417 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3418
3419 msg.append("threadId=");
3420 msg.append(threadId);
3421
3422 msg.append(", parentMessageId=");
3423 msg.append(parentMessageId);
3424
3425 msg.append(StringPool.CLOSE_CURLY_BRACE);
3426
3427 throw new NoSuchMessageException(msg.toString());
3428 }
3429 else {
3430 return list.get(0);
3431 }
3432 }
3433
3434 public MBMessage findByT_P_Last(long threadId, long parentMessageId,
3435 OrderByComparator obc) throws NoSuchMessageException, SystemException {
3436 int count = countByT_P(threadId, parentMessageId);
3437
3438 List<MBMessage> list = findByT_P(threadId, parentMessageId, count - 1,
3439 count, obc);
3440
3441 if (list.isEmpty()) {
3442 StringBundler msg = new StringBundler(6);
3443
3444 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3445
3446 msg.append("threadId=");
3447 msg.append(threadId);
3448
3449 msg.append(", parentMessageId=");
3450 msg.append(parentMessageId);
3451
3452 msg.append(StringPool.CLOSE_CURLY_BRACE);
3453
3454 throw new NoSuchMessageException(msg.toString());
3455 }
3456 else {
3457 return list.get(0);
3458 }
3459 }
3460
3461 public MBMessage[] findByT_P_PrevAndNext(long messageId, long threadId,
3462 long parentMessageId, OrderByComparator obc)
3463 throws NoSuchMessageException, SystemException {
3464 MBMessage mbMessage = findByPrimaryKey(messageId);
3465
3466 int count = countByT_P(threadId, parentMessageId);
3467
3468 Session session = null;
3469
3470 try {
3471 session = openSession();
3472
3473 StringBundler query = null;
3474
3475 if (obc != null) {
3476 query = new StringBundler(4 +
3477 (obc.getOrderByFields().length * 3));
3478 }
3479 else {
3480 query = new StringBundler(4);
3481 }
3482
3483 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
3484
3485 query.append(_FINDER_COLUMN_T_P_THREADID_2);
3486
3487 query.append(_FINDER_COLUMN_T_P_PARENTMESSAGEID_2);
3488
3489 if (obc != null) {
3490 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
3491 }
3492
3493 else {
3494 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
3495 }
3496
3497 String sql = query.toString();
3498
3499 Query q = session.createQuery(sql);
3500
3501 QueryPos qPos = QueryPos.getInstance(q);
3502
3503 qPos.add(threadId);
3504
3505 qPos.add(parentMessageId);
3506
3507 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
3508 mbMessage);
3509
3510 MBMessage[] array = new MBMessageImpl[3];
3511
3512 array[0] = (MBMessage)objArray[0];
3513 array[1] = (MBMessage)objArray[1];
3514 array[2] = (MBMessage)objArray[2];
3515
3516 return array;
3517 }
3518 catch (Exception e) {
3519 throw processException(e);
3520 }
3521 finally {
3522 closeSession(session);
3523 }
3524 }
3525
3526 public List<MBMessage> findByT_S(long threadId, int status)
3527 throws SystemException {
3528 Object[] finderArgs = new Object[] {
3529 new Long(threadId), new Integer(status)
3530 };
3531
3532 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_T_S,
3533 finderArgs, this);
3534
3535 if (list == null) {
3536 Session session = null;
3537
3538 try {
3539 session = openSession();
3540
3541 StringBundler query = new StringBundler(4);
3542
3543 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
3544
3545 query.append(_FINDER_COLUMN_T_S_THREADID_2);
3546
3547 query.append(_FINDER_COLUMN_T_S_STATUS_2);
3548
3549 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
3550
3551 String sql = query.toString();
3552
3553 Query q = session.createQuery(sql);
3554
3555 QueryPos qPos = QueryPos.getInstance(q);
3556
3557 qPos.add(threadId);
3558
3559 qPos.add(status);
3560
3561 list = q.list();
3562 }
3563 catch (Exception e) {
3564 throw processException(e);
3565 }
3566 finally {
3567 if (list == null) {
3568 list = new ArrayList<MBMessage>();
3569 }
3570
3571 cacheResult(list);
3572
3573 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_T_S, finderArgs,
3574 list);
3575
3576 closeSession(session);
3577 }
3578 }
3579
3580 return list;
3581 }
3582
3583 public List<MBMessage> findByT_S(long threadId, int status, int start,
3584 int end) throws SystemException {
3585 return findByT_S(threadId, status, start, end, null);
3586 }
3587
3588 public List<MBMessage> findByT_S(long threadId, int status, int start,
3589 int end, OrderByComparator obc) throws SystemException {
3590 Object[] finderArgs = new Object[] {
3591 new Long(threadId), new Integer(status),
3592
3593 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
3594 };
3595
3596 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_T_S,
3597 finderArgs, this);
3598
3599 if (list == null) {
3600 Session session = null;
3601
3602 try {
3603 session = openSession();
3604
3605 StringBundler query = null;
3606
3607 if (obc != null) {
3608 query = new StringBundler(4 +
3609 (obc.getOrderByFields().length * 3));
3610 }
3611 else {
3612 query = new StringBundler(4);
3613 }
3614
3615 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
3616
3617 query.append(_FINDER_COLUMN_T_S_THREADID_2);
3618
3619 query.append(_FINDER_COLUMN_T_S_STATUS_2);
3620
3621 if (obc != null) {
3622 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
3623 }
3624
3625 else {
3626 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
3627 }
3628
3629 String sql = query.toString();
3630
3631 Query q = session.createQuery(sql);
3632
3633 QueryPos qPos = QueryPos.getInstance(q);
3634
3635 qPos.add(threadId);
3636
3637 qPos.add(status);
3638
3639 list = (List<MBMessage>)QueryUtil.list(q, getDialect(), start,
3640 end);
3641 }
3642 catch (Exception e) {
3643 throw processException(e);
3644 }
3645 finally {
3646 if (list == null) {
3647 list = new ArrayList<MBMessage>();
3648 }
3649
3650 cacheResult(list);
3651
3652 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_T_S,
3653 finderArgs, list);
3654
3655 closeSession(session);
3656 }
3657 }
3658
3659 return list;
3660 }
3661
3662 public MBMessage findByT_S_First(long threadId, int status,
3663 OrderByComparator obc) throws NoSuchMessageException, SystemException {
3664 List<MBMessage> list = findByT_S(threadId, status, 0, 1, obc);
3665
3666 if (list.isEmpty()) {
3667 StringBundler msg = new StringBundler(6);
3668
3669 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3670
3671 msg.append("threadId=");
3672 msg.append(threadId);
3673
3674 msg.append(", status=");
3675 msg.append(status);
3676
3677 msg.append(StringPool.CLOSE_CURLY_BRACE);
3678
3679 throw new NoSuchMessageException(msg.toString());
3680 }
3681 else {
3682 return list.get(0);
3683 }
3684 }
3685
3686 public MBMessage findByT_S_Last(long threadId, int status,
3687 OrderByComparator obc) throws NoSuchMessageException, SystemException {
3688 int count = countByT_S(threadId, status);
3689
3690 List<MBMessage> list = findByT_S(threadId, status, count - 1, count, obc);
3691
3692 if (list.isEmpty()) {
3693 StringBundler msg = new StringBundler(6);
3694
3695 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3696
3697 msg.append("threadId=");
3698 msg.append(threadId);
3699
3700 msg.append(", status=");
3701 msg.append(status);
3702
3703 msg.append(StringPool.CLOSE_CURLY_BRACE);
3704
3705 throw new NoSuchMessageException(msg.toString());
3706 }
3707 else {
3708 return list.get(0);
3709 }
3710 }
3711
3712 public MBMessage[] findByT_S_PrevAndNext(long messageId, long threadId,
3713 int status, OrderByComparator obc)
3714 throws NoSuchMessageException, SystemException {
3715 MBMessage mbMessage = findByPrimaryKey(messageId);
3716
3717 int count = countByT_S(threadId, status);
3718
3719 Session session = null;
3720
3721 try {
3722 session = openSession();
3723
3724 StringBundler query = null;
3725
3726 if (obc != null) {
3727 query = new StringBundler(4 +
3728 (obc.getOrderByFields().length * 3));
3729 }
3730 else {
3731 query = new StringBundler(4);
3732 }
3733
3734 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
3735
3736 query.append(_FINDER_COLUMN_T_S_THREADID_2);
3737
3738 query.append(_FINDER_COLUMN_T_S_STATUS_2);
3739
3740 if (obc != null) {
3741 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
3742 }
3743
3744 else {
3745 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
3746 }
3747
3748 String sql = query.toString();
3749
3750 Query q = session.createQuery(sql);
3751
3752 QueryPos qPos = QueryPos.getInstance(q);
3753
3754 qPos.add(threadId);
3755
3756 qPos.add(status);
3757
3758 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
3759 mbMessage);
3760
3761 MBMessage[] array = new MBMessageImpl[3];
3762
3763 array[0] = (MBMessage)objArray[0];
3764 array[1] = (MBMessage)objArray[1];
3765 array[2] = (MBMessage)objArray[2];
3766
3767 return array;
3768 }
3769 catch (Exception e) {
3770 throw processException(e);
3771 }
3772 finally {
3773 closeSession(session);
3774 }
3775 }
3776
3777 public List<MBMessage> findByTR_S(long threadId, int status)
3778 throws SystemException {
3779 Object[] finderArgs = new Object[] {
3780 new Long(threadId), new Integer(status)
3781 };
3782
3783 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_TR_S,
3784 finderArgs, this);
3785
3786 if (list == null) {
3787 Session session = null;
3788
3789 try {
3790 session = openSession();
3791
3792 StringBundler query = new StringBundler(4);
3793
3794 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
3795
3796 query.append(_FINDER_COLUMN_TR_S_THREADID_2);
3797
3798 query.append(_FINDER_COLUMN_TR_S_STATUS_2);
3799
3800 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
3801
3802 String sql = query.toString();
3803
3804 Query q = session.createQuery(sql);
3805
3806 QueryPos qPos = QueryPos.getInstance(q);
3807
3808 qPos.add(threadId);
3809
3810 qPos.add(status);
3811
3812 list = q.list();
3813 }
3814 catch (Exception e) {
3815 throw processException(e);
3816 }
3817 finally {
3818 if (list == null) {
3819 list = new ArrayList<MBMessage>();
3820 }
3821
3822 cacheResult(list);
3823
3824 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_TR_S, finderArgs,
3825 list);
3826
3827 closeSession(session);
3828 }
3829 }
3830
3831 return list;
3832 }
3833
3834 public List<MBMessage> findByTR_S(long threadId, int status, int start,
3835 int end) throws SystemException {
3836 return findByTR_S(threadId, status, start, end, null);
3837 }
3838
3839 public List<MBMessage> findByTR_S(long threadId, int status, int start,
3840 int end, OrderByComparator obc) throws SystemException {
3841 Object[] finderArgs = new Object[] {
3842 new Long(threadId), new Integer(status),
3843
3844 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
3845 };
3846
3847 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_TR_S,
3848 finderArgs, this);
3849
3850 if (list == null) {
3851 Session session = null;
3852
3853 try {
3854 session = openSession();
3855
3856 StringBundler query = null;
3857
3858 if (obc != null) {
3859 query = new StringBundler(4 +
3860 (obc.getOrderByFields().length * 3));
3861 }
3862 else {
3863 query = new StringBundler(4);
3864 }
3865
3866 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
3867
3868 query.append(_FINDER_COLUMN_TR_S_THREADID_2);
3869
3870 query.append(_FINDER_COLUMN_TR_S_STATUS_2);
3871
3872 if (obc != null) {
3873 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
3874 }
3875
3876 else {
3877 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
3878 }
3879
3880 String sql = query.toString();
3881
3882 Query q = session.createQuery(sql);
3883
3884 QueryPos qPos = QueryPos.getInstance(q);
3885
3886 qPos.add(threadId);
3887
3888 qPos.add(status);
3889
3890 list = (List<MBMessage>)QueryUtil.list(q, getDialect(), start,
3891 end);
3892 }
3893 catch (Exception e) {
3894 throw processException(e);
3895 }
3896 finally {
3897 if (list == null) {
3898 list = new ArrayList<MBMessage>();
3899 }
3900
3901 cacheResult(list);
3902
3903 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_TR_S,
3904 finderArgs, list);
3905
3906 closeSession(session);
3907 }
3908 }
3909
3910 return list;
3911 }
3912
3913 public MBMessage findByTR_S_First(long threadId, int status,
3914 OrderByComparator obc) throws NoSuchMessageException, SystemException {
3915 List<MBMessage> list = findByTR_S(threadId, status, 0, 1, obc);
3916
3917 if (list.isEmpty()) {
3918 StringBundler msg = new StringBundler(6);
3919
3920 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3921
3922 msg.append("threadId=");
3923 msg.append(threadId);
3924
3925 msg.append(", status=");
3926 msg.append(status);
3927
3928 msg.append(StringPool.CLOSE_CURLY_BRACE);
3929
3930 throw new NoSuchMessageException(msg.toString());
3931 }
3932 else {
3933 return list.get(0);
3934 }
3935 }
3936
3937 public MBMessage findByTR_S_Last(long threadId, int status,
3938 OrderByComparator obc) throws NoSuchMessageException, SystemException {
3939 int count = countByTR_S(threadId, status);
3940
3941 List<MBMessage> list = findByTR_S(threadId, status, count - 1, count,
3942 obc);
3943
3944 if (list.isEmpty()) {
3945 StringBundler msg = new StringBundler(6);
3946
3947 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3948
3949 msg.append("threadId=");
3950 msg.append(threadId);
3951
3952 msg.append(", status=");
3953 msg.append(status);
3954
3955 msg.append(StringPool.CLOSE_CURLY_BRACE);
3956
3957 throw new NoSuchMessageException(msg.toString());
3958 }
3959 else {
3960 return list.get(0);
3961 }
3962 }
3963
3964 public MBMessage[] findByTR_S_PrevAndNext(long messageId, long threadId,
3965 int status, OrderByComparator obc)
3966 throws NoSuchMessageException, SystemException {
3967 MBMessage mbMessage = findByPrimaryKey(messageId);
3968
3969 int count = countByTR_S(threadId, status);
3970
3971 Session session = null;
3972
3973 try {
3974 session = openSession();
3975
3976 StringBundler query = null;
3977
3978 if (obc != null) {
3979 query = new StringBundler(4 +
3980 (obc.getOrderByFields().length * 3));
3981 }
3982 else {
3983 query = new StringBundler(4);
3984 }
3985
3986 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
3987
3988 query.append(_FINDER_COLUMN_TR_S_THREADID_2);
3989
3990 query.append(_FINDER_COLUMN_TR_S_STATUS_2);
3991
3992 if (obc != null) {
3993 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
3994 }
3995
3996 else {
3997 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
3998 }
3999
4000 String sql = query.toString();
4001
4002 Query q = session.createQuery(sql);
4003
4004 QueryPos qPos = QueryPos.getInstance(q);
4005
4006 qPos.add(threadId);
4007
4008 qPos.add(status);
4009
4010 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
4011 mbMessage);
4012
4013 MBMessage[] array = new MBMessageImpl[3];
4014
4015 array[0] = (MBMessage)objArray[0];
4016 array[1] = (MBMessage)objArray[1];
4017 array[2] = (MBMessage)objArray[2];
4018
4019 return array;
4020 }
4021 catch (Exception e) {
4022 throw processException(e);
4023 }
4024 finally {
4025 closeSession(session);
4026 }
4027 }
4028
4029 public List<MBMessage> findByG_U_S(long groupId, long userId, int status)
4030 throws SystemException {
4031 Object[] finderArgs = new Object[] {
4032 new Long(groupId), new Long(userId), new Integer(status)
4033 };
4034
4035 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_U_S,
4036 finderArgs, this);
4037
4038 if (list == null) {
4039 Session session = null;
4040
4041 try {
4042 session = openSession();
4043
4044 StringBundler query = new StringBundler(5);
4045
4046 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
4047
4048 query.append(_FINDER_COLUMN_G_U_S_GROUPID_2);
4049
4050 query.append(_FINDER_COLUMN_G_U_S_USERID_2);
4051
4052 query.append(_FINDER_COLUMN_G_U_S_STATUS_2);
4053
4054 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
4055
4056 String sql = query.toString();
4057
4058 Query q = session.createQuery(sql);
4059
4060 QueryPos qPos = QueryPos.getInstance(q);
4061
4062 qPos.add(groupId);
4063
4064 qPos.add(userId);
4065
4066 qPos.add(status);
4067
4068 list = q.list();
4069 }
4070 catch (Exception e) {
4071 throw processException(e);
4072 }
4073 finally {
4074 if (list == null) {
4075 list = new ArrayList<MBMessage>();
4076 }
4077
4078 cacheResult(list);
4079
4080 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_U_S,
4081 finderArgs, list);
4082
4083 closeSession(session);
4084 }
4085 }
4086
4087 return list;
4088 }
4089
4090 public List<MBMessage> findByG_U_S(long groupId, long userId, int status,
4091 int start, int end) throws SystemException {
4092 return findByG_U_S(groupId, userId, status, start, end, null);
4093 }
4094
4095 public List<MBMessage> findByG_U_S(long groupId, long userId, int status,
4096 int start, int end, OrderByComparator obc) throws SystemException {
4097 Object[] finderArgs = new Object[] {
4098 new Long(groupId), new Long(userId), new Integer(status),
4099
4100 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
4101 };
4102
4103 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_G_U_S,
4104 finderArgs, this);
4105
4106 if (list == null) {
4107 Session session = null;
4108
4109 try {
4110 session = openSession();
4111
4112 StringBundler query = null;
4113
4114 if (obc != null) {
4115 query = new StringBundler(5 +
4116 (obc.getOrderByFields().length * 3));
4117 }
4118 else {
4119 query = new StringBundler(5);
4120 }
4121
4122 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
4123
4124 query.append(_FINDER_COLUMN_G_U_S_GROUPID_2);
4125
4126 query.append(_FINDER_COLUMN_G_U_S_USERID_2);
4127
4128 query.append(_FINDER_COLUMN_G_U_S_STATUS_2);
4129
4130 if (obc != null) {
4131 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
4132 }
4133
4134 else {
4135 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
4136 }
4137
4138 String sql = query.toString();
4139
4140 Query q = session.createQuery(sql);
4141
4142 QueryPos qPos = QueryPos.getInstance(q);
4143
4144 qPos.add(groupId);
4145
4146 qPos.add(userId);
4147
4148 qPos.add(status);
4149
4150 list = (List<MBMessage>)QueryUtil.list(q, getDialect(), start,
4151 end);
4152 }
4153 catch (Exception e) {
4154 throw processException(e);
4155 }
4156 finally {
4157 if (list == null) {
4158 list = new ArrayList<MBMessage>();
4159 }
4160
4161 cacheResult(list);
4162
4163 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_G_U_S,
4164 finderArgs, list);
4165
4166 closeSession(session);
4167 }
4168 }
4169
4170 return list;
4171 }
4172
4173 public MBMessage findByG_U_S_First(long groupId, long userId, int status,
4174 OrderByComparator obc) throws NoSuchMessageException, SystemException {
4175 List<MBMessage> list = findByG_U_S(groupId, userId, status, 0, 1, obc);
4176
4177 if (list.isEmpty()) {
4178 StringBundler msg = new StringBundler(8);
4179
4180 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4181
4182 msg.append("groupId=");
4183 msg.append(groupId);
4184
4185 msg.append(", userId=");
4186 msg.append(userId);
4187
4188 msg.append(", status=");
4189 msg.append(status);
4190
4191 msg.append(StringPool.CLOSE_CURLY_BRACE);
4192
4193 throw new NoSuchMessageException(msg.toString());
4194 }
4195 else {
4196 return list.get(0);
4197 }
4198 }
4199
4200 public MBMessage findByG_U_S_Last(long groupId, long userId, int status,
4201 OrderByComparator obc) throws NoSuchMessageException, SystemException {
4202 int count = countByG_U_S(groupId, userId, status);
4203
4204 List<MBMessage> list = findByG_U_S(groupId, userId, status, count - 1,
4205 count, obc);
4206
4207 if (list.isEmpty()) {
4208 StringBundler msg = new StringBundler(8);
4209
4210 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4211
4212 msg.append("groupId=");
4213 msg.append(groupId);
4214
4215 msg.append(", userId=");
4216 msg.append(userId);
4217
4218 msg.append(", status=");
4219 msg.append(status);
4220
4221 msg.append(StringPool.CLOSE_CURLY_BRACE);
4222
4223 throw new NoSuchMessageException(msg.toString());
4224 }
4225 else {
4226 return list.get(0);
4227 }
4228 }
4229
4230 public MBMessage[] findByG_U_S_PrevAndNext(long messageId, long groupId,
4231 long userId, int status, OrderByComparator obc)
4232 throws NoSuchMessageException, SystemException {
4233 MBMessage mbMessage = findByPrimaryKey(messageId);
4234
4235 int count = countByG_U_S(groupId, userId, status);
4236
4237 Session session = null;
4238
4239 try {
4240 session = openSession();
4241
4242 StringBundler query = null;
4243
4244 if (obc != null) {
4245 query = new StringBundler(5 +
4246 (obc.getOrderByFields().length * 3));
4247 }
4248 else {
4249 query = new StringBundler(5);
4250 }
4251
4252 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
4253
4254 query.append(_FINDER_COLUMN_G_U_S_GROUPID_2);
4255
4256 query.append(_FINDER_COLUMN_G_U_S_USERID_2);
4257
4258 query.append(_FINDER_COLUMN_G_U_S_STATUS_2);
4259
4260 if (obc != null) {
4261 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
4262 }
4263
4264 else {
4265 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
4266 }
4267
4268 String sql = query.toString();
4269
4270 Query q = session.createQuery(sql);
4271
4272 QueryPos qPos = QueryPos.getInstance(q);
4273
4274 qPos.add(groupId);
4275
4276 qPos.add(userId);
4277
4278 qPos.add(status);
4279
4280 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
4281 mbMessage);
4282
4283 MBMessage[] array = new MBMessageImpl[3];
4284
4285 array[0] = (MBMessage)objArray[0];
4286 array[1] = (MBMessage)objArray[1];
4287 array[2] = (MBMessage)objArray[2];
4288
4289 return array;
4290 }
4291 catch (Exception e) {
4292 throw processException(e);
4293 }
4294 finally {
4295 closeSession(session);
4296 }
4297 }
4298
4299 public List<MBMessage> findByG_C_T(long groupId, long categoryId,
4300 long threadId) throws SystemException {
4301 Object[] finderArgs = new Object[] {
4302 new Long(groupId), new Long(categoryId), new Long(threadId)
4303 };
4304
4305 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_C_T,
4306 finderArgs, this);
4307
4308 if (list == null) {
4309 Session session = null;
4310
4311 try {
4312 session = openSession();
4313
4314 StringBundler query = new StringBundler(5);
4315
4316 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
4317
4318 query.append(_FINDER_COLUMN_G_C_T_GROUPID_2);
4319
4320 query.append(_FINDER_COLUMN_G_C_T_CATEGORYID_2);
4321
4322 query.append(_FINDER_COLUMN_G_C_T_THREADID_2);
4323
4324 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
4325
4326 String sql = query.toString();
4327
4328 Query q = session.createQuery(sql);
4329
4330 QueryPos qPos = QueryPos.getInstance(q);
4331
4332 qPos.add(groupId);
4333
4334 qPos.add(categoryId);
4335
4336 qPos.add(threadId);
4337
4338 list = q.list();
4339 }
4340 catch (Exception e) {
4341 throw processException(e);
4342 }
4343 finally {
4344 if (list == null) {
4345 list = new ArrayList<MBMessage>();
4346 }
4347
4348 cacheResult(list);
4349
4350 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_C_T,
4351 finderArgs, list);
4352
4353 closeSession(session);
4354 }
4355 }
4356
4357 return list;
4358 }
4359
4360 public List<MBMessage> findByG_C_T(long groupId, long categoryId,
4361 long threadId, int start, int end) throws SystemException {
4362 return findByG_C_T(groupId, categoryId, threadId, start, end, null);
4363 }
4364
4365 public List<MBMessage> findByG_C_T(long groupId, long categoryId,
4366 long threadId, int start, int end, OrderByComparator obc)
4367 throws SystemException {
4368 Object[] finderArgs = new Object[] {
4369 new Long(groupId), new Long(categoryId), new Long(threadId),
4370
4371 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
4372 };
4373
4374 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_G_C_T,
4375 finderArgs, this);
4376
4377 if (list == null) {
4378 Session session = null;
4379
4380 try {
4381 session = openSession();
4382
4383 StringBundler query = null;
4384
4385 if (obc != null) {
4386 query = new StringBundler(5 +
4387 (obc.getOrderByFields().length * 3));
4388 }
4389 else {
4390 query = new StringBundler(5);
4391 }
4392
4393 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
4394
4395 query.append(_FINDER_COLUMN_G_C_T_GROUPID_2);
4396
4397 query.append(_FINDER_COLUMN_G_C_T_CATEGORYID_2);
4398
4399 query.append(_FINDER_COLUMN_G_C_T_THREADID_2);
4400
4401 if (obc != null) {
4402 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
4403 }
4404
4405 else {
4406 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
4407 }
4408
4409 String sql = query.toString();
4410
4411 Query q = session.createQuery(sql);
4412
4413 QueryPos qPos = QueryPos.getInstance(q);
4414
4415 qPos.add(groupId);
4416
4417 qPos.add(categoryId);
4418
4419 qPos.add(threadId);
4420
4421 list = (List<MBMessage>)QueryUtil.list(q, getDialect(), start,
4422 end);
4423 }
4424 catch (Exception e) {
4425 throw processException(e);
4426 }
4427 finally {
4428 if (list == null) {
4429 list = new ArrayList<MBMessage>();
4430 }
4431
4432 cacheResult(list);
4433
4434 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_G_C_T,
4435 finderArgs, list);
4436
4437 closeSession(session);
4438 }
4439 }
4440
4441 return list;
4442 }
4443
4444 public MBMessage findByG_C_T_First(long groupId, long categoryId,
4445 long threadId, OrderByComparator obc)
4446 throws NoSuchMessageException, SystemException {
4447 List<MBMessage> list = findByG_C_T(groupId, categoryId, threadId, 0, 1,
4448 obc);
4449
4450 if (list.isEmpty()) {
4451 StringBundler msg = new StringBundler(8);
4452
4453 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4454
4455 msg.append("groupId=");
4456 msg.append(groupId);
4457
4458 msg.append(", categoryId=");
4459 msg.append(categoryId);
4460
4461 msg.append(", threadId=");
4462 msg.append(threadId);
4463
4464 msg.append(StringPool.CLOSE_CURLY_BRACE);
4465
4466 throw new NoSuchMessageException(msg.toString());
4467 }
4468 else {
4469 return list.get(0);
4470 }
4471 }
4472
4473 public MBMessage findByG_C_T_Last(long groupId, long categoryId,
4474 long threadId, OrderByComparator obc)
4475 throws NoSuchMessageException, SystemException {
4476 int count = countByG_C_T(groupId, categoryId, threadId);
4477
4478 List<MBMessage> list = findByG_C_T(groupId, categoryId, threadId,
4479 count - 1, count, obc);
4480
4481 if (list.isEmpty()) {
4482 StringBundler msg = new StringBundler(8);
4483
4484 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4485
4486 msg.append("groupId=");
4487 msg.append(groupId);
4488
4489 msg.append(", categoryId=");
4490 msg.append(categoryId);
4491
4492 msg.append(", threadId=");
4493 msg.append(threadId);
4494
4495 msg.append(StringPool.CLOSE_CURLY_BRACE);
4496
4497 throw new NoSuchMessageException(msg.toString());
4498 }
4499 else {
4500 return list.get(0);
4501 }
4502 }
4503
4504 public MBMessage[] findByG_C_T_PrevAndNext(long messageId, long groupId,
4505 long categoryId, long threadId, OrderByComparator obc)
4506 throws NoSuchMessageException, SystemException {
4507 MBMessage mbMessage = findByPrimaryKey(messageId);
4508
4509 int count = countByG_C_T(groupId, categoryId, threadId);
4510
4511 Session session = null;
4512
4513 try {
4514 session = openSession();
4515
4516 StringBundler query = null;
4517
4518 if (obc != null) {
4519 query = new StringBundler(5 +
4520 (obc.getOrderByFields().length * 3));
4521 }
4522 else {
4523 query = new StringBundler(5);
4524 }
4525
4526 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
4527
4528 query.append(_FINDER_COLUMN_G_C_T_GROUPID_2);
4529
4530 query.append(_FINDER_COLUMN_G_C_T_CATEGORYID_2);
4531
4532 query.append(_FINDER_COLUMN_G_C_T_THREADID_2);
4533
4534 if (obc != null) {
4535 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
4536 }
4537
4538 else {
4539 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
4540 }
4541
4542 String sql = query.toString();
4543
4544 Query q = session.createQuery(sql);
4545
4546 QueryPos qPos = QueryPos.getInstance(q);
4547
4548 qPos.add(groupId);
4549
4550 qPos.add(categoryId);
4551
4552 qPos.add(threadId);
4553
4554 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
4555 mbMessage);
4556
4557 MBMessage[] array = new MBMessageImpl[3];
4558
4559 array[0] = (MBMessage)objArray[0];
4560 array[1] = (MBMessage)objArray[1];
4561 array[2] = (MBMessage)objArray[2];
4562
4563 return array;
4564 }
4565 catch (Exception e) {
4566 throw processException(e);
4567 }
4568 finally {
4569 closeSession(session);
4570 }
4571 }
4572
4573 public List<MBMessage> findByG_C_S(long groupId, long categoryId, int status)
4574 throws SystemException {
4575 Object[] finderArgs = new Object[] {
4576 new Long(groupId), new Long(categoryId), new Integer(status)
4577 };
4578
4579 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_C_S,
4580 finderArgs, this);
4581
4582 if (list == null) {
4583 Session session = null;
4584
4585 try {
4586 session = openSession();
4587
4588 StringBundler query = new StringBundler(5);
4589
4590 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
4591
4592 query.append(_FINDER_COLUMN_G_C_S_GROUPID_2);
4593
4594 query.append(_FINDER_COLUMN_G_C_S_CATEGORYID_2);
4595
4596 query.append(_FINDER_COLUMN_G_C_S_STATUS_2);
4597
4598 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
4599
4600 String sql = query.toString();
4601
4602 Query q = session.createQuery(sql);
4603
4604 QueryPos qPos = QueryPos.getInstance(q);
4605
4606 qPos.add(groupId);
4607
4608 qPos.add(categoryId);
4609
4610 qPos.add(status);
4611
4612 list = q.list();
4613 }
4614 catch (Exception e) {
4615 throw processException(e);
4616 }
4617 finally {
4618 if (list == null) {
4619 list = new ArrayList<MBMessage>();
4620 }
4621
4622 cacheResult(list);
4623
4624 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_C_S,
4625 finderArgs, list);
4626
4627 closeSession(session);
4628 }
4629 }
4630
4631 return list;
4632 }
4633
4634 public List<MBMessage> findByG_C_S(long groupId, long categoryId,
4635 int status, int start, int end) throws SystemException {
4636 return findByG_C_S(groupId, categoryId, status, start, end, null);
4637 }
4638
4639 public List<MBMessage> findByG_C_S(long groupId, long categoryId,
4640 int status, int start, int end, OrderByComparator obc)
4641 throws SystemException {
4642 Object[] finderArgs = new Object[] {
4643 new Long(groupId), new Long(categoryId), new Integer(status),
4644
4645 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
4646 };
4647
4648 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_G_C_S,
4649 finderArgs, this);
4650
4651 if (list == null) {
4652 Session session = null;
4653
4654 try {
4655 session = openSession();
4656
4657 StringBundler query = null;
4658
4659 if (obc != null) {
4660 query = new StringBundler(5 +
4661 (obc.getOrderByFields().length * 3));
4662 }
4663 else {
4664 query = new StringBundler(5);
4665 }
4666
4667 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
4668
4669 query.append(_FINDER_COLUMN_G_C_S_GROUPID_2);
4670
4671 query.append(_FINDER_COLUMN_G_C_S_CATEGORYID_2);
4672
4673 query.append(_FINDER_COLUMN_G_C_S_STATUS_2);
4674
4675 if (obc != null) {
4676 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
4677 }
4678
4679 else {
4680 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
4681 }
4682
4683 String sql = query.toString();
4684
4685 Query q = session.createQuery(sql);
4686
4687 QueryPos qPos = QueryPos.getInstance(q);
4688
4689 qPos.add(groupId);
4690
4691 qPos.add(categoryId);
4692
4693 qPos.add(status);
4694
4695 list = (List<MBMessage>)QueryUtil.list(q, getDialect(), start,
4696 end);
4697 }
4698 catch (Exception e) {
4699 throw processException(e);
4700 }
4701 finally {
4702 if (list == null) {
4703 list = new ArrayList<MBMessage>();
4704 }
4705
4706 cacheResult(list);
4707
4708 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_G_C_S,
4709 finderArgs, list);
4710
4711 closeSession(session);
4712 }
4713 }
4714
4715 return list;
4716 }
4717
4718 public MBMessage findByG_C_S_First(long groupId, long categoryId,
4719 int status, OrderByComparator obc)
4720 throws NoSuchMessageException, SystemException {
4721 List<MBMessage> list = findByG_C_S(groupId, categoryId, status, 0, 1,
4722 obc);
4723
4724 if (list.isEmpty()) {
4725 StringBundler msg = new StringBundler(8);
4726
4727 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4728
4729 msg.append("groupId=");
4730 msg.append(groupId);
4731
4732 msg.append(", categoryId=");
4733 msg.append(categoryId);
4734
4735 msg.append(", status=");
4736 msg.append(status);
4737
4738 msg.append(StringPool.CLOSE_CURLY_BRACE);
4739
4740 throw new NoSuchMessageException(msg.toString());
4741 }
4742 else {
4743 return list.get(0);
4744 }
4745 }
4746
4747 public MBMessage findByG_C_S_Last(long groupId, long categoryId,
4748 int status, OrderByComparator obc)
4749 throws NoSuchMessageException, SystemException {
4750 int count = countByG_C_S(groupId, categoryId, status);
4751
4752 List<MBMessage> list = findByG_C_S(groupId, categoryId, status,
4753 count - 1, count, obc);
4754
4755 if (list.isEmpty()) {
4756 StringBundler msg = new StringBundler(8);
4757
4758 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4759
4760 msg.append("groupId=");
4761 msg.append(groupId);
4762
4763 msg.append(", categoryId=");
4764 msg.append(categoryId);
4765
4766 msg.append(", status=");
4767 msg.append(status);
4768
4769 msg.append(StringPool.CLOSE_CURLY_BRACE);
4770
4771 throw new NoSuchMessageException(msg.toString());
4772 }
4773 else {
4774 return list.get(0);
4775 }
4776 }
4777
4778 public MBMessage[] findByG_C_S_PrevAndNext(long messageId, long groupId,
4779 long categoryId, int status, OrderByComparator obc)
4780 throws NoSuchMessageException, SystemException {
4781 MBMessage mbMessage = findByPrimaryKey(messageId);
4782
4783 int count = countByG_C_S(groupId, categoryId, status);
4784
4785 Session session = null;
4786
4787 try {
4788 session = openSession();
4789
4790 StringBundler query = null;
4791
4792 if (obc != null) {
4793 query = new StringBundler(5 +
4794 (obc.getOrderByFields().length * 3));
4795 }
4796 else {
4797 query = new StringBundler(5);
4798 }
4799
4800 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
4801
4802 query.append(_FINDER_COLUMN_G_C_S_GROUPID_2);
4803
4804 query.append(_FINDER_COLUMN_G_C_S_CATEGORYID_2);
4805
4806 query.append(_FINDER_COLUMN_G_C_S_STATUS_2);
4807
4808 if (obc != null) {
4809 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
4810 }
4811
4812 else {
4813 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
4814 }
4815
4816 String sql = query.toString();
4817
4818 Query q = session.createQuery(sql);
4819
4820 QueryPos qPos = QueryPos.getInstance(q);
4821
4822 qPos.add(groupId);
4823
4824 qPos.add(categoryId);
4825
4826 qPos.add(status);
4827
4828 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
4829 mbMessage);
4830
4831 MBMessage[] array = new MBMessageImpl[3];
4832
4833 array[0] = (MBMessage)objArray[0];
4834 array[1] = (MBMessage)objArray[1];
4835 array[2] = (MBMessage)objArray[2];
4836
4837 return array;
4838 }
4839 catch (Exception e) {
4840 throw processException(e);
4841 }
4842 finally {
4843 closeSession(session);
4844 }
4845 }
4846
4847 public List<MBMessage> findByC_C_S(long classNameId, long classPK,
4848 int status) throws SystemException {
4849 Object[] finderArgs = new Object[] {
4850 new Long(classNameId), new Long(classPK), new Integer(status)
4851 };
4852
4853 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_C_S,
4854 finderArgs, this);
4855
4856 if (list == null) {
4857 Session session = null;
4858
4859 try {
4860 session = openSession();
4861
4862 StringBundler query = new StringBundler(5);
4863
4864 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
4865
4866 query.append(_FINDER_COLUMN_C_C_S_CLASSNAMEID_2);
4867
4868 query.append(_FINDER_COLUMN_C_C_S_CLASSPK_2);
4869
4870 query.append(_FINDER_COLUMN_C_C_S_STATUS_2);
4871
4872 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
4873
4874 String sql = query.toString();
4875
4876 Query q = session.createQuery(sql);
4877
4878 QueryPos qPos = QueryPos.getInstance(q);
4879
4880 qPos.add(classNameId);
4881
4882 qPos.add(classPK);
4883
4884 qPos.add(status);
4885
4886 list = q.list();
4887 }
4888 catch (Exception e) {
4889 throw processException(e);
4890 }
4891 finally {
4892 if (list == null) {
4893 list = new ArrayList<MBMessage>();
4894 }
4895
4896 cacheResult(list);
4897
4898 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_C_S,
4899 finderArgs, list);
4900
4901 closeSession(session);
4902 }
4903 }
4904
4905 return list;
4906 }
4907
4908 public List<MBMessage> findByC_C_S(long classNameId, long classPK,
4909 int status, int start, int end) throws SystemException {
4910 return findByC_C_S(classNameId, classPK, status, start, end, null);
4911 }
4912
4913 public List<MBMessage> findByC_C_S(long classNameId, long classPK,
4914 int status, int start, int end, OrderByComparator obc)
4915 throws SystemException {
4916 Object[] finderArgs = new Object[] {
4917 new Long(classNameId), new Long(classPK), new Integer(status),
4918
4919 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
4920 };
4921
4922 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_C_C_S,
4923 finderArgs, this);
4924
4925 if (list == null) {
4926 Session session = null;
4927
4928 try {
4929 session = openSession();
4930
4931 StringBundler query = null;
4932
4933 if (obc != null) {
4934 query = new StringBundler(5 +
4935 (obc.getOrderByFields().length * 3));
4936 }
4937 else {
4938 query = new StringBundler(5);
4939 }
4940
4941 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
4942
4943 query.append(_FINDER_COLUMN_C_C_S_CLASSNAMEID_2);
4944
4945 query.append(_FINDER_COLUMN_C_C_S_CLASSPK_2);
4946
4947 query.append(_FINDER_COLUMN_C_C_S_STATUS_2);
4948
4949 if (obc != null) {
4950 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
4951 }
4952
4953 else {
4954 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
4955 }
4956
4957 String sql = query.toString();
4958
4959 Query q = session.createQuery(sql);
4960
4961 QueryPos qPos = QueryPos.getInstance(q);
4962
4963 qPos.add(classNameId);
4964
4965 qPos.add(classPK);
4966
4967 qPos.add(status);
4968
4969 list = (List<MBMessage>)QueryUtil.list(q, getDialect(), start,
4970 end);
4971 }
4972 catch (Exception e) {
4973 throw processException(e);
4974 }
4975 finally {
4976 if (list == null) {
4977 list = new ArrayList<MBMessage>();
4978 }
4979
4980 cacheResult(list);
4981
4982 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_C_C_S,
4983 finderArgs, list);
4984
4985 closeSession(session);
4986 }
4987 }
4988
4989 return list;
4990 }
4991
4992 public MBMessage findByC_C_S_First(long classNameId, long classPK,
4993 int status, OrderByComparator obc)
4994 throws NoSuchMessageException, SystemException {
4995 List<MBMessage> list = findByC_C_S(classNameId, classPK, status, 0, 1,
4996 obc);
4997
4998 if (list.isEmpty()) {
4999 StringBundler msg = new StringBundler(8);
5000
5001 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
5002
5003 msg.append("classNameId=");
5004 msg.append(classNameId);
5005
5006 msg.append(", classPK=");
5007 msg.append(classPK);
5008
5009 msg.append(", status=");
5010 msg.append(status);
5011
5012 msg.append(StringPool.CLOSE_CURLY_BRACE);
5013
5014 throw new NoSuchMessageException(msg.toString());
5015 }
5016 else {
5017 return list.get(0);
5018 }
5019 }
5020
5021 public MBMessage findByC_C_S_Last(long classNameId, long classPK,
5022 int status, OrderByComparator obc)
5023 throws NoSuchMessageException, SystemException {
5024 int count = countByC_C_S(classNameId, classPK, status);
5025
5026 List<MBMessage> list = findByC_C_S(classNameId, classPK, status,
5027 count - 1, count, obc);
5028
5029 if (list.isEmpty()) {
5030 StringBundler msg = new StringBundler(8);
5031
5032 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
5033
5034 msg.append("classNameId=");
5035 msg.append(classNameId);
5036
5037 msg.append(", classPK=");
5038 msg.append(classPK);
5039
5040 msg.append(", status=");
5041 msg.append(status);
5042
5043 msg.append(StringPool.CLOSE_CURLY_BRACE);
5044
5045 throw new NoSuchMessageException(msg.toString());
5046 }
5047 else {
5048 return list.get(0);
5049 }
5050 }
5051
5052 public MBMessage[] findByC_C_S_PrevAndNext(long messageId,
5053 long classNameId, long classPK, int status, OrderByComparator obc)
5054 throws NoSuchMessageException, SystemException {
5055 MBMessage mbMessage = findByPrimaryKey(messageId);
5056
5057 int count = countByC_C_S(classNameId, classPK, status);
5058
5059 Session session = null;
5060
5061 try {
5062 session = openSession();
5063
5064 StringBundler query = null;
5065
5066 if (obc != null) {
5067 query = new StringBundler(5 +
5068 (obc.getOrderByFields().length * 3));
5069 }
5070 else {
5071 query = new StringBundler(5);
5072 }
5073
5074 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
5075
5076 query.append(_FINDER_COLUMN_C_C_S_CLASSNAMEID_2);
5077
5078 query.append(_FINDER_COLUMN_C_C_S_CLASSPK_2);
5079
5080 query.append(_FINDER_COLUMN_C_C_S_STATUS_2);
5081
5082 if (obc != null) {
5083 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
5084 }
5085
5086 else {
5087 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
5088 }
5089
5090 String sql = query.toString();
5091
5092 Query q = session.createQuery(sql);
5093
5094 QueryPos qPos = QueryPos.getInstance(q);
5095
5096 qPos.add(classNameId);
5097
5098 qPos.add(classPK);
5099
5100 qPos.add(status);
5101
5102 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
5103 mbMessage);
5104
5105 MBMessage[] array = new MBMessageImpl[3];
5106
5107 array[0] = (MBMessage)objArray[0];
5108 array[1] = (MBMessage)objArray[1];
5109 array[2] = (MBMessage)objArray[2];
5110
5111 return array;
5112 }
5113 catch (Exception e) {
5114 throw processException(e);
5115 }
5116 finally {
5117 closeSession(session);
5118 }
5119 }
5120
5121 public List<MBMessage> findByG_C_T_S(long groupId, long categoryId,
5122 long threadId, int status) throws SystemException {
5123 Object[] finderArgs = new Object[] {
5124 new Long(groupId), new Long(categoryId), new Long(threadId),
5125 new Integer(status)
5126 };
5127
5128 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_C_T_S,
5129 finderArgs, this);
5130
5131 if (list == null) {
5132 Session session = null;
5133
5134 try {
5135 session = openSession();
5136
5137 StringBundler query = new StringBundler(6);
5138
5139 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
5140
5141 query.append(_FINDER_COLUMN_G_C_T_S_GROUPID_2);
5142
5143 query.append(_FINDER_COLUMN_G_C_T_S_CATEGORYID_2);
5144
5145 query.append(_FINDER_COLUMN_G_C_T_S_THREADID_2);
5146
5147 query.append(_FINDER_COLUMN_G_C_T_S_STATUS_2);
5148
5149 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
5150
5151 String sql = query.toString();
5152
5153 Query q = session.createQuery(sql);
5154
5155 QueryPos qPos = QueryPos.getInstance(q);
5156
5157 qPos.add(groupId);
5158
5159 qPos.add(categoryId);
5160
5161 qPos.add(threadId);
5162
5163 qPos.add(status);
5164
5165 list = q.list();
5166 }
5167 catch (Exception e) {
5168 throw processException(e);
5169 }
5170 finally {
5171 if (list == null) {
5172 list = new ArrayList<MBMessage>();
5173 }
5174
5175 cacheResult(list);
5176
5177 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_C_T_S,
5178 finderArgs, list);
5179
5180 closeSession(session);
5181 }
5182 }
5183
5184 return list;
5185 }
5186
5187 public List<MBMessage> findByG_C_T_S(long groupId, long categoryId,
5188 long threadId, int status, int start, int end)
5189 throws SystemException {
5190 return findByG_C_T_S(groupId, categoryId, threadId, status, start, end,
5191 null);
5192 }
5193
5194 public List<MBMessage> findByG_C_T_S(long groupId, long categoryId,
5195 long threadId, int status, int start, int end, OrderByComparator obc)
5196 throws SystemException {
5197 Object[] finderArgs = new Object[] {
5198 new Long(groupId), new Long(categoryId), new Long(threadId),
5199 new Integer(status),
5200
5201 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
5202 };
5203
5204 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_G_C_T_S,
5205 finderArgs, this);
5206
5207 if (list == null) {
5208 Session session = null;
5209
5210 try {
5211 session = openSession();
5212
5213 StringBundler query = null;
5214
5215 if (obc != null) {
5216 query = new StringBundler(6 +
5217 (obc.getOrderByFields().length * 3));
5218 }
5219 else {
5220 query = new StringBundler(6);
5221 }
5222
5223 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
5224
5225 query.append(_FINDER_COLUMN_G_C_T_S_GROUPID_2);
5226
5227 query.append(_FINDER_COLUMN_G_C_T_S_CATEGORYID_2);
5228
5229 query.append(_FINDER_COLUMN_G_C_T_S_THREADID_2);
5230
5231 query.append(_FINDER_COLUMN_G_C_T_S_STATUS_2);
5232
5233 if (obc != null) {
5234 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
5235 }
5236
5237 else {
5238 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
5239 }
5240
5241 String sql = query.toString();
5242
5243 Query q = session.createQuery(sql);
5244
5245 QueryPos qPos = QueryPos.getInstance(q);
5246
5247 qPos.add(groupId);
5248
5249 qPos.add(categoryId);
5250
5251 qPos.add(threadId);
5252
5253 qPos.add(status);
5254
5255 list = (List<MBMessage>)QueryUtil.list(q, getDialect(), start,
5256 end);
5257 }
5258 catch (Exception e) {
5259 throw processException(e);
5260 }
5261 finally {
5262 if (list == null) {
5263 list = new ArrayList<MBMessage>();
5264 }
5265
5266 cacheResult(list);
5267
5268 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_G_C_T_S,
5269 finderArgs, list);
5270
5271 closeSession(session);
5272 }
5273 }
5274
5275 return list;
5276 }
5277
5278 public MBMessage findByG_C_T_S_First(long groupId, long categoryId,
5279 long threadId, int status, OrderByComparator obc)
5280 throws NoSuchMessageException, SystemException {
5281 List<MBMessage> list = findByG_C_T_S(groupId, categoryId, threadId,
5282 status, 0, 1, obc);
5283
5284 if (list.isEmpty()) {
5285 StringBundler msg = new StringBundler(10);
5286
5287 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
5288
5289 msg.append("groupId=");
5290 msg.append(groupId);
5291
5292 msg.append(", categoryId=");
5293 msg.append(categoryId);
5294
5295 msg.append(", threadId=");
5296 msg.append(threadId);
5297
5298 msg.append(", status=");
5299 msg.append(status);
5300
5301 msg.append(StringPool.CLOSE_CURLY_BRACE);
5302
5303 throw new NoSuchMessageException(msg.toString());
5304 }
5305 else {
5306 return list.get(0);
5307 }
5308 }
5309
5310 public MBMessage findByG_C_T_S_Last(long groupId, long categoryId,
5311 long threadId, int status, OrderByComparator obc)
5312 throws NoSuchMessageException, SystemException {
5313 int count = countByG_C_T_S(groupId, categoryId, threadId, status);
5314
5315 List<MBMessage> list = findByG_C_T_S(groupId, categoryId, threadId,
5316 status, count - 1, count, obc);
5317
5318 if (list.isEmpty()) {
5319 StringBundler msg = new StringBundler(10);
5320
5321 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
5322
5323 msg.append("groupId=");
5324 msg.append(groupId);
5325
5326 msg.append(", categoryId=");
5327 msg.append(categoryId);
5328
5329 msg.append(", threadId=");
5330 msg.append(threadId);
5331
5332 msg.append(", status=");
5333 msg.append(status);
5334
5335 msg.append(StringPool.CLOSE_CURLY_BRACE);
5336
5337 throw new NoSuchMessageException(msg.toString());
5338 }
5339 else {
5340 return list.get(0);
5341 }
5342 }
5343
5344 public MBMessage[] findByG_C_T_S_PrevAndNext(long messageId, long groupId,
5345 long categoryId, long threadId, int status, OrderByComparator obc)
5346 throws NoSuchMessageException, SystemException {
5347 MBMessage mbMessage = findByPrimaryKey(messageId);
5348
5349 int count = countByG_C_T_S(groupId, categoryId, threadId, status);
5350
5351 Session session = null;
5352
5353 try {
5354 session = openSession();
5355
5356 StringBundler query = null;
5357
5358 if (obc != null) {
5359 query = new StringBundler(6 +
5360 (obc.getOrderByFields().length * 3));
5361 }
5362 else {
5363 query = new StringBundler(6);
5364 }
5365
5366 query.append(_SQL_SELECT_MBMESSAGE_WHERE);
5367
5368 query.append(_FINDER_COLUMN_G_C_T_S_GROUPID_2);
5369
5370 query.append(_FINDER_COLUMN_G_C_T_S_CATEGORYID_2);
5371
5372 query.append(_FINDER_COLUMN_G_C_T_S_THREADID_2);
5373
5374 query.append(_FINDER_COLUMN_G_C_T_S_STATUS_2);
5375
5376 if (obc != null) {
5377 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
5378 }
5379
5380 else {
5381 query.append(MBMessageModelImpl.ORDER_BY_JPQL);
5382 }
5383
5384 String sql = query.toString();
5385
5386 Query q = session.createQuery(sql);
5387
5388 QueryPos qPos = QueryPos.getInstance(q);
5389
5390 qPos.add(groupId);
5391
5392 qPos.add(categoryId);
5393
5394 qPos.add(threadId);
5395
5396 qPos.add(status);
5397
5398 Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
5399 mbMessage);
5400
5401 MBMessage[] array = new MBMessageImpl[3];
5402
5403 array[0] = (MBMessage)objArray[0];
5404 array[1] = (MBMessage)objArray[1];
5405 array[2] = (MBMessage)objArray[2];
5406
5407 return array;
5408 }
5409 catch (Exception e) {
5410 throw processException(e);
5411 }
5412 finally {
5413 closeSession(session);
5414 }
5415 }
5416
5417 public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
5418 throws SystemException {
5419 Session session = null;
5420
5421 try {
5422 session = openSession();
5423
5424 dynamicQuery.compile(session);
5425
5426 return dynamicQuery.list();
5427 }
5428 catch (Exception e) {
5429 throw processException(e);
5430 }
5431 finally {
5432 closeSession(session);
5433 }
5434 }
5435
5436 public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
5437 int start, int end) throws SystemException {
5438 Session session = null;
5439
5440 try {
5441 session = openSession();
5442
5443 dynamicQuery.setLimit(start, end);
5444
5445 dynamicQuery.compile(session);
5446
5447 return dynamicQuery.list();
5448 }
5449 catch (Exception e) {
5450 throw processException(e);
5451 }
5452 finally {
5453 closeSession(session);
5454 }
5455 }
5456
5457 public List<MBMessage> findAll() throws SystemException {
5458 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
5459 }
5460
5461 public List<MBMessage> findAll(int start, int end)
5462 throws SystemException {
5463 return findAll(start, end, null);
5464 }
5465
5466 public List<MBMessage> findAll(int start, int end, OrderByComparator obc)
5467 throws SystemException {
5468 Object[] finderArgs = new Object[] {
5469 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
5470 };
5471
5472 List<MBMessage> list = (List<MBMessage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
5473 finderArgs, this);
5474
5475 if (list == null) {
5476 Session session = null;
5477
5478 try {
5479 session = openSession();
5480
5481 StringBundler query = null;
5482 String sql = null;
5483
5484 if (obc != null) {
5485 query = new StringBundler(2 +
5486 (obc.getOrderByFields().length * 3));
5487
5488 query.append(_SQL_SELECT_MBMESSAGE);
5489
5490 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
5491
5492 sql = query.toString();
5493 }
5494
5495 else {
5496 sql = _SQL_SELECT_MBMESSAGE.concat(MBMessageModelImpl.ORDER_BY_JPQL);
5497 }
5498
5499 Query q = session.createQuery(sql);
5500
5501 if (obc == null) {
5502 list = (List<MBMessage>)QueryUtil.list(q, getDialect(),
5503 start, end, false);
5504
5505 Collections.sort(list);
5506 }
5507 else {
5508 list = (List<MBMessage>)QueryUtil.list(q, getDialect(),
5509 start, end);
5510 }
5511 }
5512 catch (Exception e) {
5513 throw processException(e);
5514 }
5515 finally {
5516 if (list == null) {
5517 list = new ArrayList<MBMessage>();
5518 }
5519
5520 cacheResult(list);
5521
5522 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
5523
5524 closeSession(session);
5525 }
5526 }
5527
5528 return list;
5529 }
5530
5531 public void removeByUuid(String uuid) throws SystemException {
5532 for (MBMessage mbMessage : findByUuid(uuid)) {
5533 remove(mbMessage);
5534 }
5535 }
5536
5537 public void removeByUUID_G(String uuid, long groupId)
5538 throws NoSuchMessageException, SystemException {
5539 MBMessage mbMessage = findByUUID_G(uuid, groupId);
5540
5541 remove(mbMessage);
5542 }
5543
5544 public void removeByGroupId(long groupId) throws SystemException {
5545 for (MBMessage mbMessage : findByGroupId(groupId)) {
5546 remove(mbMessage);
5547 }
5548 }
5549
5550 public void removeByCompanyId(long companyId) throws SystemException {
5551 for (MBMessage mbMessage : findByCompanyId(companyId)) {
5552 remove(mbMessage);
5553 }
5554 }
5555
5556 public void removeByThreadId(long threadId) throws SystemException {
5557 for (MBMessage mbMessage : findByThreadId(threadId)) {
5558 remove(mbMessage);
5559 }
5560 }
5561
5562 public void removeByThreadReplies(long threadId) throws SystemException {
5563 for (MBMessage mbMessage : findByThreadReplies(threadId)) {
5564 remove(mbMessage);
5565 }
5566 }
5567
5568 public void removeByG_U(long groupId, long userId)
5569 throws SystemException {
5570 for (MBMessage mbMessage : findByG_U(groupId, userId)) {
5571 remove(mbMessage);
5572 }
5573 }
5574
5575 public void removeByG_C(long groupId, long categoryId)
5576 throws SystemException {
5577 for (MBMessage mbMessage : findByG_C(groupId, categoryId)) {
5578 remove(mbMessage);
5579 }
5580 }
5581
5582 public void removeByG_S(long groupId, int status) throws SystemException {
5583 for (MBMessage mbMessage : findByG_S(groupId, status)) {
5584 remove(mbMessage);
5585 }
5586 }
5587
5588 public void removeByC_S(long companyId, int status)
5589 throws SystemException {
5590 for (MBMessage mbMessage : findByC_S(companyId, status)) {
5591 remove(mbMessage);
5592 }
5593 }
5594
5595 public void removeByC_C(long classNameId, long classPK)
5596 throws SystemException {
5597 for (MBMessage mbMessage : findByC_C(classNameId, classPK)) {
5598 remove(mbMessage);
5599 }
5600 }
5601
5602 public void removeByT_P(long threadId, long parentMessageId)
5603 throws SystemException {
5604 for (MBMessage mbMessage : findByT_P(threadId, parentMessageId)) {
5605 remove(mbMessage);
5606 }
5607 }
5608
5609 public void removeByT_S(long threadId, int status)
5610 throws SystemException {
5611 for (MBMessage mbMessage : findByT_S(threadId, status)) {
5612 remove(mbMessage);
5613 }
5614 }
5615
5616 public void removeByTR_S(long threadId, int status)
5617 throws SystemException {
5618 for (MBMessage mbMessage : findByTR_S(threadId, status)) {
5619 remove(mbMessage);
5620 }
5621 }
5622
5623 public void removeByG_U_S(long groupId, long userId, int status)
5624 throws SystemException {
5625 for (MBMessage mbMessage : findByG_U_S(groupId, userId, status)) {
5626 remove(mbMessage);
5627 }
5628 }
5629
5630 public void removeByG_C_T(long groupId, long categoryId, long threadId)
5631 throws SystemException {
5632 for (MBMessage mbMessage : findByG_C_T(groupId, categoryId, threadId)) {
5633 remove(mbMessage);
5634 }
5635 }
5636
5637 public void removeByG_C_S(long groupId, long categoryId, int status)
5638 throws SystemException {
5639 for (MBMessage mbMessage : findByG_C_S(groupId, categoryId, status)) {
5640 remove(mbMessage);
5641 }
5642 }
5643
5644 public void removeByC_C_S(long classNameId, long classPK, int status)
5645 throws SystemException {
5646 for (MBMessage mbMessage : findByC_C_S(classNameId, classPK, status)) {
5647 remove(mbMessage);
5648 }
5649 }
5650
5651 public void removeByG_C_T_S(long groupId, long categoryId, long threadId,
5652 int status) throws SystemException {
5653 for (MBMessage mbMessage : findByG_C_T_S(groupId, categoryId, threadId,
5654 status)) {
5655 remove(mbMessage);
5656 }
5657 }
5658
5659 public void removeAll() throws SystemException {
5660 for (MBMessage mbMessage : findAll()) {
5661 remove(mbMessage);
5662 }
5663 }
5664
5665 public int countByUuid(String uuid) throws SystemException {
5666 Object[] finderArgs = new Object[] { uuid };
5667
5668 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
5669 finderArgs, this);
5670
5671 if (count == null) {
5672 Session session = null;
5673
5674 try {
5675 session = openSession();
5676
5677 StringBundler query = new StringBundler(2);
5678
5679 query.append(_SQL_COUNT_MBMESSAGE_WHERE);
5680
5681 if (uuid == null) {
5682 query.append(_FINDER_COLUMN_UUID_UUID_1);
5683 }
5684 else {
5685 if (uuid.equals(StringPool.BLANK)) {
5686 query.append(_FINDER_COLUMN_UUID_UUID_3);
5687 }
5688 else {
5689 query.append(_FINDER_COLUMN_UUID_UUID_2);
5690 }
5691 }
5692
5693 String sql = query.toString();
5694
5695 Query q = session.createQuery(sql);
5696
5697 QueryPos qPos = QueryPos.getInstance(q);
5698
5699 if (uuid != null) {
5700 qPos.add(uuid);
5701 }
5702
5703 count = (Long)q.uniqueResult();
5704 }
5705 catch (Exception e) {
5706 throw processException(e);
5707 }
5708 finally {
5709 if (count == null) {
5710 count = Long.valueOf(0);
5711 }
5712
5713 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
5714 finderArgs, count);
5715
5716 closeSession(session);
5717 }
5718 }
5719
5720 return count.intValue();
5721 }
5722
5723 public int countByUUID_G(String uuid, long groupId)
5724 throws SystemException {
5725 Object[] finderArgs = new Object[] { uuid, new Long(groupId) };
5726
5727 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
5728 finderArgs, this);
5729
5730 if (count == null) {
5731 Session session = null;
5732
5733 try {
5734 session = openSession();
5735
5736 StringBundler query = new StringBundler(3);
5737
5738 query.append(_SQL_COUNT_MBMESSAGE_WHERE);
5739
5740 if (uuid == null) {
5741 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
5742 }
5743 else {
5744 if (uuid.equals(StringPool.BLANK)) {
5745 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
5746 }
5747 else {
5748 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
5749 }
5750 }
5751
5752 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
5753
5754 String sql = query.toString();
5755
5756 Query q = session.createQuery(sql);
5757
5758 QueryPos qPos = QueryPos.getInstance(q);
5759
5760 if (uuid != null) {
5761 qPos.add(uuid);
5762 }
5763
5764 qPos.add(groupId);
5765
5766 count = (Long)q.uniqueResult();
5767 }
5768 catch (Exception e) {
5769 throw processException(e);
5770 }
5771 finally {
5772 if (count == null) {
5773 count = Long.valueOf(0);
5774 }
5775
5776 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
5777 finderArgs, count);
5778
5779 closeSession(session);
5780 }
5781 }
5782
5783 return count.intValue();
5784 }
5785
5786 public int countByGroupId(long groupId) throws SystemException {
5787 Object[] finderArgs = new Object[] { new Long(groupId) };
5788
5789 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
5790 finderArgs, this);
5791
5792 if (count == null) {
5793 Session session = null;
5794
5795 try {
5796 session = openSession();
5797
5798 StringBundler query = new StringBundler(2);
5799
5800 query.append(_SQL_COUNT_MBMESSAGE_WHERE);
5801
5802 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
5803
5804 String sql = query.toString();
5805
5806 Query q = session.createQuery(sql);
5807
5808 QueryPos qPos = QueryPos.getInstance(q);
5809
5810 qPos.add(groupId);
5811
5812 count = (Long)q.uniqueResult();
5813 }
5814 catch (Exception e) {
5815 throw processException(e);
5816 }
5817 finally {
5818 if (count == null) {
5819 count = Long.valueOf(0);
5820 }
5821
5822 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
5823 finderArgs, count);
5824
5825 closeSession(session);
5826 }
5827 }
5828
5829 return count.intValue();
5830 }
5831
5832 public int countByCompanyId(long companyId) throws SystemException {
5833 Object[] finderArgs = new Object[] { new Long(companyId) };
5834
5835 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
5836 finderArgs, this);
5837
5838 if (count == null) {
5839 Session session = null;
5840
5841 try {
5842 session = openSession();
5843
5844 StringBundler query = new StringBundler(2);
5845
5846 query.append(_SQL_COUNT_MBMESSAGE_WHERE);
5847
5848 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
5849
5850 String sql = query.toString();
5851
5852 Query q = session.createQuery(sql);
5853
5854 QueryPos qPos = QueryPos.getInstance(q);
5855
5856 qPos.add(companyId);
5857
5858 count = (Long)q.uniqueResult();
5859 }
5860 catch (Exception e) {
5861 throw processException(e);
5862 }
5863 finally {
5864 if (count == null) {
5865 count = Long.valueOf(0);
5866 }
5867
5868 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
5869 finderArgs, count);
5870
5871 closeSession(session);
5872 }
5873 }
5874
5875 return count.intValue();
5876 }
5877
5878 public int countByThreadId(long threadId) throws SystemException {
5879 Object[] finderArgs = new Object[] { new Long(threadId) };
5880
5881 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_THREADID,
5882 finderArgs, this);
5883
5884 if (count == null) {
5885 Session session = null;
5886
5887 try {
5888 session = openSession();
5889
5890 StringBundler query = new StringBundler(2);
5891
5892 query.append(_SQL_COUNT_MBMESSAGE_WHERE);
5893
5894 query.append(_FINDER_COLUMN_THREADID_THREADID_2);
5895
5896 String sql = query.toString();
5897
5898 Query q = session.createQuery(sql);
5899
5900 QueryPos qPos = QueryPos.getInstance(q);
5901
5902 qPos.add(threadId);
5903
5904 count = (Long)q.uniqueResult();
5905 }
5906 catch (Exception e) {
5907 throw processException(e);
5908 }
5909 finally {
5910 if (count == null) {
5911 count = Long.valueOf(0);
5912 }
5913
5914 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_THREADID,
5915 finderArgs, count);
5916
5917 closeSession(session);
5918 }
5919 }
5920
5921 return count.intValue();
5922 }
5923
5924 public int countByThreadReplies(long threadId) throws SystemException {
5925 Object[] finderArgs = new Object[] { new Long(threadId) };
5926
5927 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_THREADREPLIES,
5928 finderArgs, this);
5929
5930 if (count == null) {
5931 Session session = null;
5932
5933 try {
5934 session = openSession();
5935
5936 StringBundler query = new StringBundler(2);
5937
5938 query.append(_SQL_COUNT_MBMESSAGE_WHERE);
5939
5940 query.append(_FINDER_COLUMN_THREADREPLIES_THREADID_2);
5941
5942 String sql = query.toString();
5943
5944 Query q = session.createQuery(sql);
5945
5946 QueryPos qPos = QueryPos.getInstance(q);
5947
5948 qPos.add(threadId);
5949
5950 count = (Long)q.uniqueResult();
5951 }
5952 catch (Exception e) {
5953 throw processException(e);
5954 }
5955 finally {
5956 if (count == null) {
5957 count = Long.valueOf(0);
5958 }
5959
5960 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_THREADREPLIES,
5961 finderArgs, count);
5962
5963 closeSession(session);
5964 }
5965 }
5966
5967 return count.intValue();
5968 }
5969
5970 public int countByG_U(long groupId, long userId) throws SystemException {
5971 Object[] finderArgs = new Object[] { new Long(groupId), new Long(userId) };
5972
5973 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_U,
5974 finderArgs, this);
5975
5976 if (count == null) {
5977 Session session = null;
5978
5979 try {
5980 session = openSession();
5981
5982 StringBundler query = new StringBundler(3);
5983
5984 query.append(_SQL_COUNT_MBMESSAGE_WHERE);
5985
5986 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
5987
5988 query.append(_FINDER_COLUMN_G_U_USERID_2);
5989
5990 String sql = query.toString();
5991
5992 Query q = session.createQuery(sql);
5993
5994 QueryPos qPos = QueryPos.getInstance(q);
5995
5996 qPos.add(groupId);
5997
5998 qPos.add(userId);
5999
6000 count = (Long)q.uniqueResult();
6001 }
6002 catch (Exception e) {
6003 throw processException(e);
6004 }
6005 finally {
6006 if (count == null) {
6007 count = Long.valueOf(0);
6008 }
6009
6010 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_U, finderArgs,
6011 count);
6012
6013 closeSession(session);
6014 }
6015 }
6016
6017 return count.intValue();
6018 }
6019
6020 public int countByG_C(long groupId, long categoryId)
6021 throws SystemException {
6022 Object[] finderArgs = new Object[] {
6023 new Long(groupId), new Long(categoryId)
6024 };
6025
6026 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_C,
6027 finderArgs, this);
6028
6029 if (count == null) {
6030 Session session = null;
6031
6032 try {
6033 session = openSession();
6034
6035 StringBundler query = new StringBundler(3);
6036
6037 query.append(_SQL_COUNT_MBMESSAGE_WHERE);
6038
6039 query.append(_FINDER_COLUMN_G_C_GROUPID_2);
6040
6041 query.append(_FINDER_COLUMN_G_C_CATEGORYID_2);
6042
6043 String sql = query.toString();
6044
6045 Query q = session.createQuery(sql);
6046
6047 QueryPos qPos = QueryPos.getInstance(q);
6048
6049 qPos.add(groupId);
6050
6051 qPos.add(categoryId);
6052
6053 count = (Long)q.uniqueResult();
6054 }
6055 catch (Exception e) {
6056 throw processException(e);
6057 }
6058 finally {
6059 if (count == null) {
6060 count = Long.valueOf(0);
6061 }
6062
6063 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_C, finderArgs,
6064 count);
6065
6066 closeSession(session);
6067 }
6068 }
6069
6070 return count.intValue();
6071 }
6072
6073 public int countByG_S(long groupId, int status) throws SystemException {
6074 Object[] finderArgs = new Object[] {
6075 new Long(groupId), new Integer(status)
6076 };
6077
6078 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_S,
6079 finderArgs, this);
6080
6081 if (count == null) {
6082 Session session = null;
6083
6084 try {
6085 session = openSession();
6086
6087 StringBundler query = new StringBundler(3);
6088
6089 query.append(_SQL_COUNT_MBMESSAGE_WHERE);
6090
6091 query.append(_FINDER_COLUMN_G_S_GROUPID_2);
6092
6093 query.append(_FINDER_COLUMN_G_S_STATUS_2);
6094
6095 String sql = query.toString();
6096
6097 Query q = session.createQuery(sql);
6098
6099 QueryPos qPos = QueryPos.getInstance(q);
6100
6101 qPos.add(groupId);
6102
6103 qPos.add(status);
6104
6105 count = (Long)q.uniqueResult();
6106 }
6107 catch (Exception e) {
6108 throw processException(e);
6109 }
6110 finally {
6111 if (count == null) {
6112 count = Long.valueOf(0);
6113 }
6114
6115 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_S, finderArgs,
6116 count);
6117
6118 closeSession(session);
6119 }
6120 }
6121
6122 return count.intValue();
6123 }
6124
6125 public int countByC_S(long companyId, int status) throws SystemException {
6126 Object[] finderArgs = new Object[] {
6127 new Long(companyId), new Integer(status)
6128 };
6129
6130 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_S,
6131 finderArgs, this);
6132
6133 if (count == null) {
6134 Session session = null;
6135
6136 try {
6137 session = openSession();
6138
6139 StringBundler query = new StringBundler(3);
6140
6141 query.append(_SQL_COUNT_MBMESSAGE_WHERE);
6142
6143 query.append(_FINDER_COLUMN_C_S_COMPANYID_2);
6144
6145 query.append(_FINDER_COLUMN_C_S_STATUS_2);
6146
6147 String sql = query.toString();
6148
6149 Query q = session.createQuery(sql);
6150
6151 QueryPos qPos = QueryPos.getInstance(q);
6152
6153 qPos.add(companyId);
6154
6155 qPos.add(status);
6156
6157 count = (Long)q.uniqueResult();
6158 }
6159 catch (Exception e) {
6160 throw processException(e);
6161 }
6162 finally {
6163 if (count == null) {
6164 count = Long.valueOf(0);
6165 }
6166
6167 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_S, finderArgs,
6168 count);
6169
6170 closeSession(session);
6171 }
6172 }
6173
6174 return count.intValue();
6175 }
6176
6177 public int countByC_C(long classNameId, long classPK)
6178 throws SystemException {
6179 Object[] finderArgs = new Object[] {
6180 new Long(classNameId), new Long(classPK)
6181 };
6182
6183 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C,
6184 finderArgs, this);
6185
6186 if (count == null) {
6187 Session session = null;
6188
6189 try {
6190 session = openSession();
6191
6192 StringBundler query = new StringBundler(3);
6193
6194 query.append(_SQL_COUNT_MBMESSAGE_WHERE);
6195
6196 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
6197
6198 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
6199
6200 String sql = query.toString();
6201
6202 Query q = session.createQuery(sql);
6203
6204 QueryPos qPos = QueryPos.getInstance(q);
6205
6206 qPos.add(classNameId);
6207
6208 qPos.add(classPK);
6209
6210 count = (Long)q.uniqueResult();
6211 }
6212 catch (Exception e) {
6213 throw processException(e);
6214 }
6215 finally {
6216 if (count == null) {
6217 count = Long.valueOf(0);
6218 }
6219
6220 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, finderArgs,
6221 count);
6222
6223 closeSession(session);
6224 }
6225 }
6226
6227 return count.intValue();
6228 }
6229
6230 public int countByT_P(long threadId, long parentMessageId)
6231 throws SystemException {
6232 Object[] finderArgs = new Object[] {
6233 new Long(threadId), new Long(parentMessageId)
6234 };
6235
6236 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_T_P,
6237 finderArgs, this);
6238
6239 if (count == null) {
6240 Session session = null;
6241
6242 try {
6243 session = openSession();
6244
6245 StringBundler query = new StringBundler(3);
6246
6247 query.append(_SQL_COUNT_MBMESSAGE_WHERE);
6248
6249 query.append(_FINDER_COLUMN_T_P_THREADID_2);
6250
6251 query.append(_FINDER_COLUMN_T_P_PARENTMESSAGEID_2);
6252
6253 String sql = query.toString();
6254
6255 Query q = session.createQuery(sql);
6256
6257 QueryPos qPos = QueryPos.getInstance(q);
6258
6259 qPos.add(threadId);
6260
6261 qPos.add(parentMessageId);
6262
6263 count = (Long)q.uniqueResult();
6264 }
6265 catch (Exception e) {
6266 throw processException(e);
6267 }
6268 finally {
6269 if (count == null) {
6270 count = Long.valueOf(0);
6271 }
6272
6273 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_T_P, finderArgs,
6274 count);
6275
6276 closeSession(session);
6277 }
6278 }
6279
6280 return count.intValue();
6281 }
6282
6283 public int countByT_S(long threadId, int status) throws SystemException {
6284 Object[] finderArgs = new Object[] {
6285 new Long(threadId), new Integer(status)
6286 };
6287
6288 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_T_S,
6289 finderArgs, this);
6290
6291 if (count == null) {
6292 Session session = null;
6293
6294 try {
6295 session = openSession();
6296
6297 StringBundler query = new StringBundler(3);
6298
6299 query.append(_SQL_COUNT_MBMESSAGE_WHERE);
6300
6301 query.append(_FINDER_COLUMN_T_S_THREADID_2);
6302
6303 query.append(_FINDER_COLUMN_T_S_STATUS_2);
6304
6305 String sql = query.toString();
6306
6307 Query q = session.createQuery(sql);
6308
6309 QueryPos qPos = QueryPos.getInstance(q);
6310
6311 qPos.add(threadId);
6312
6313 qPos.add(status);
6314
6315 count = (Long)q.uniqueResult();
6316 }
6317 catch (Exception e) {
6318 throw processException(e);
6319 }
6320 finally {
6321 if (count == null) {
6322 count = Long.valueOf(0);
6323 }
6324
6325 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_T_S, finderArgs,
6326 count);
6327
6328 closeSession(session);
6329 }
6330 }
6331
6332 return count.intValue();
6333 }
6334
6335 public int countByTR_S(long threadId, int status) throws SystemException {
6336 Object[] finderArgs = new Object[] {
6337 new Long(threadId), new Integer(status)
6338 };
6339
6340 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_TR_S,
6341 finderArgs, this);
6342
6343 if (count == null) {
6344 Session session = null;
6345
6346 try {
6347 session = openSession();
6348
6349 StringBundler query = new StringBundler(3);
6350
6351 query.append(_SQL_COUNT_MBMESSAGE_WHERE);
6352
6353 query.append(_FINDER_COLUMN_TR_S_THREADID_2);
6354
6355 query.append(_FINDER_COLUMN_TR_S_STATUS_2);
6356
6357 String sql = query.toString();
6358
6359 Query q = session.createQuery(sql);
6360
6361 QueryPos qPos = QueryPos.getInstance(q);
6362
6363 qPos.add(threadId);
6364
6365 qPos.add(status);
6366
6367 count = (Long)q.uniqueResult();
6368 }
6369 catch (Exception e) {
6370 throw processException(e);
6371 }
6372 finally {
6373 if (count == null) {
6374 count = Long.valueOf(0);
6375 }
6376
6377 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_TR_S,
6378 finderArgs, count);
6379
6380 closeSession(session);
6381 }
6382 }
6383
6384 return count.intValue();
6385 }
6386
6387 public int countByG_U_S(long groupId, long userId, int status)
6388 throws SystemException {
6389 Object[] finderArgs = new Object[] {
6390 new Long(groupId), new Long(userId), new Integer(status)
6391 };
6392
6393 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_U_S,
6394 finderArgs, this);
6395
6396 if (count == null) {
6397 Session session = null;
6398
6399 try {
6400 session = openSession();
6401
6402 StringBundler query = new StringBundler(4);
6403
6404 query.append(_SQL_COUNT_MBMESSAGE_WHERE);
6405
6406 query.append(_FINDER_COLUMN_G_U_S_GROUPID_2);
6407
6408 query.append(_FINDER_COLUMN_G_U_S_USERID_2);
6409
6410 query.append(_FINDER_COLUMN_G_U_S_STATUS_2);
6411
6412 String sql = query.toString();
6413
6414 Query q = session.createQuery(sql);
6415
6416 QueryPos qPos = QueryPos.getInstance(q);
6417
6418 qPos.add(groupId);
6419
6420 qPos.add(userId);
6421
6422 qPos.add(status);
6423
6424 count = (Long)q.uniqueResult();
6425 }
6426 catch (Exception e) {
6427 throw processException(e);
6428 }
6429 finally {
6430 if (count == null) {
6431 count = Long.valueOf(0);
6432 }
6433
6434 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_U_S,
6435 finderArgs, count);
6436
6437 closeSession(session);
6438 }
6439 }
6440
6441 return count.intValue();
6442 }
6443
6444 public int countByG_C_T(long groupId, long categoryId, long threadId)
6445 throws SystemException {
6446 Object[] finderArgs = new Object[] {
6447 new Long(groupId), new Long(categoryId), new Long(threadId)
6448 };
6449
6450 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_C_T,
6451 finderArgs, this);
6452
6453 if (count == null) {
6454 Session session = null;
6455
6456 try {
6457 session = openSession();
6458
6459 StringBundler query = new StringBundler(4);
6460
6461 query.append(_SQL_COUNT_MBMESSAGE_WHERE);
6462
6463 query.append(_FINDER_COLUMN_G_C_T_GROUPID_2);
6464
6465 query.append(_FINDER_COLUMN_G_C_T_CATEGORYID_2);
6466
6467 query.append(_FINDER_COLUMN_G_C_T_THREADID_2);
6468
6469 String sql = query.toString();
6470
6471 Query q = session.createQuery(sql);
6472
6473 QueryPos qPos = QueryPos.getInstance(q);
6474
6475 qPos.add(groupId);
6476
6477 qPos.add(categoryId);
6478
6479 qPos.add(threadId);
6480
6481 count = (Long)q.uniqueResult();
6482 }
6483 catch (Exception e) {
6484 throw processException(e);
6485 }
6486 finally {
6487 if (count == null) {
6488 count = Long.valueOf(0);
6489 }
6490
6491 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_C_T,
6492 finderArgs, count);
6493
6494 closeSession(session);
6495 }
6496 }
6497
6498 return count.intValue();
6499 }
6500
6501 public int countByG_C_S(long groupId, long categoryId, int status)
6502 throws SystemException {
6503 Object[] finderArgs = new Object[] {
6504 new Long(groupId), new Long(categoryId), new Integer(status)
6505 };
6506
6507 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_C_S,
6508 finderArgs, this);
6509
6510 if (count == null) {
6511 Session session = null;
6512
6513 try {
6514 session = openSession();
6515
6516 StringBundler query = new StringBundler(4);
6517
6518 query.append(_SQL_COUNT_MBMESSAGE_WHERE);
6519
6520 query.append(_FINDER_COLUMN_G_C_S_GROUPID_2);
6521
6522 query.append(_FINDER_COLUMN_G_C_S_CATEGORYID_2);
6523
6524 query.append(_FINDER_COLUMN_G_C_S_STATUS_2);
6525
6526 String sql = query.toString();
6527
6528 Query q = session.createQuery(sql);
6529
6530 QueryPos qPos = QueryPos.getInstance(q);
6531
6532 qPos.add(groupId);
6533
6534 qPos.add(categoryId);
6535
6536 qPos.add(status);
6537
6538 count = (Long)q.uniqueResult();
6539 }
6540 catch (Exception e) {
6541 throw processException(e);
6542 }
6543 finally {
6544 if (count == null) {
6545 count = Long.valueOf(0);
6546 }
6547
6548 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_C_S,
6549 finderArgs, count);
6550
6551 closeSession(session);
6552 }
6553 }
6554
6555 return count.intValue();
6556 }
6557
6558 public int countByC_C_S(long classNameId, long classPK, int status)
6559 throws SystemException {
6560 Object[] finderArgs = new Object[] {
6561 new Long(classNameId), new Long(classPK), new Integer(status)
6562 };
6563
6564 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C_S,
6565 finderArgs, this);
6566
6567 if (count == null) {
6568 Session session = null;
6569
6570 try {
6571 session = openSession();
6572
6573 StringBundler query = new StringBundler(4);
6574
6575 query.append(_SQL_COUNT_MBMESSAGE_WHERE);
6576
6577 query.append(_FINDER_COLUMN_C_C_S_CLASSNAMEID_2);
6578
6579 query.append(_FINDER_COLUMN_C_C_S_CLASSPK_2);
6580
6581 query.append(_FINDER_COLUMN_C_C_S_STATUS_2);
6582
6583 String sql = query.toString();
6584
6585 Query q = session.createQuery(sql);
6586
6587 QueryPos qPos = QueryPos.getInstance(q);
6588
6589 qPos.add(classNameId);
6590
6591 qPos.add(classPK);
6592
6593 qPos.add(status);
6594
6595 count = (Long)q.uniqueResult();
6596 }
6597 catch (Exception e) {
6598 throw processException(e);
6599 }
6600 finally {
6601 if (count == null) {
6602 count = Long.valueOf(0);
6603 }
6604
6605 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C_S,
6606 finderArgs, count);
6607
6608 closeSession(session);
6609 }
6610 }
6611
6612 return count.intValue();
6613 }
6614
6615 public int countByG_C_T_S(long groupId, long categoryId, long threadId,
6616 int status) throws SystemException {
6617 Object[] finderArgs = new Object[] {
6618 new Long(groupId), new Long(categoryId), new Long(threadId),
6619 new Integer(status)
6620 };
6621
6622 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_C_T_S,
6623 finderArgs, this);
6624
6625 if (count == null) {
6626 Session session = null;
6627
6628 try {
6629 session = openSession();
6630
6631 StringBundler query = new StringBundler(5);
6632
6633 query.append(_SQL_COUNT_MBMESSAGE_WHERE);
6634
6635 query.append(_FINDER_COLUMN_G_C_T_S_GROUPID_2);
6636
6637 query.append(_FINDER_COLUMN_G_C_T_S_CATEGORYID_2);
6638
6639 query.append(_FINDER_COLUMN_G_C_T_S_THREADID_2);
6640
6641 query.append(_FINDER_COLUMN_G_C_T_S_STATUS_2);
6642
6643 String sql = query.toString();
6644
6645 Query q = session.createQuery(sql);
6646
6647 QueryPos qPos = QueryPos.getInstance(q);
6648
6649 qPos.add(groupId);
6650
6651 qPos.add(categoryId);
6652
6653 qPos.add(threadId);
6654
6655 qPos.add(status);
6656
6657 count = (Long)q.uniqueResult();
6658 }
6659 catch (Exception e) {
6660 throw processException(e);
6661 }
6662 finally {
6663 if (count == null) {
6664 count = Long.valueOf(0);
6665 }
6666
6667 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_C_T_S,
6668 finderArgs, count);
6669
6670 closeSession(session);
6671 }
6672 }
6673
6674 return count.intValue();
6675 }
6676
6677 public int countAll() throws SystemException {
6678 Object[] finderArgs = new Object[0];
6679
6680 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
6681 finderArgs, this);
6682
6683 if (count == null) {
6684 Session session = null;
6685
6686 try {
6687 session = openSession();
6688
6689 Query q = session.createQuery(_SQL_COUNT_MBMESSAGE);
6690
6691 count = (Long)q.uniqueResult();
6692 }
6693 catch (Exception e) {
6694 throw processException(e);
6695 }
6696 finally {
6697 if (count == null) {
6698 count = Long.valueOf(0);
6699 }
6700
6701 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
6702 count);
6703
6704 closeSession(session);
6705 }
6706 }
6707
6708 return count.intValue();
6709 }
6710
6711 public void afterPropertiesSet() {
6712 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
6713 com.liferay.portal.util.PropsUtil.get(
6714 "value.object.listener.com.liferay.portlet.messageboards.model.MBMessage")));
6715
6716 if (listenerClassNames.length > 0) {
6717 try {
6718 List<ModelListener<MBMessage>> listenersList = new ArrayList<ModelListener<MBMessage>>();
6719
6720 for (String listenerClassName : listenerClassNames) {
6721 listenersList.add((ModelListener<MBMessage>)Class.forName(
6722 listenerClassName).newInstance());
6723 }
6724
6725 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
6726 }
6727 catch (Exception e) {
6728 _log.error(e);
6729 }
6730 }
6731 }
6732
6733 @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBBanPersistence")
6734 protected com.liferay.portlet.messageboards.service.persistence.MBBanPersistence mbBanPersistence;
6735 @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBCategoryPersistence")
6736 protected com.liferay.portlet.messageboards.service.persistence.MBCategoryPersistence mbCategoryPersistence;
6737 @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBDiscussionPersistence")
6738 protected com.liferay.portlet.messageboards.service.persistence.MBDiscussionPersistence mbDiscussionPersistence;
6739 @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBMailingListPersistence")
6740 protected com.liferay.portlet.messageboards.service.persistence.MBMailingListPersistence mbMailingListPersistence;
6741 @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBMessagePersistence")
6742 protected com.liferay.portlet.messageboards.service.persistence.MBMessagePersistence mbMessagePersistence;
6743 @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBMessageFlagPersistence")
6744 protected com.liferay.portlet.messageboards.service.persistence.MBMessageFlagPersistence mbMessageFlagPersistence;
6745 @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBStatsUserPersistence")
6746 protected com.liferay.portlet.messageboards.service.persistence.MBStatsUserPersistence mbStatsUserPersistence;
6747 @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBThreadPersistence")
6748 protected com.liferay.portlet.messageboards.service.persistence.MBThreadPersistence mbThreadPersistence;
6749 @BeanReference(name = "com.liferay.portal.service.persistence.CompanyPersistence")
6750 protected com.liferay.portal.service.persistence.CompanyPersistence companyPersistence;
6751 @BeanReference(name = "com.liferay.portal.service.persistence.GroupPersistence")
6752 protected com.liferay.portal.service.persistence.GroupPersistence groupPersistence;
6753 @BeanReference(name = "com.liferay.portal.service.persistence.LockPersistence")
6754 protected com.liferay.portal.service.persistence.LockPersistence lockPersistence;
6755 @BeanReference(name = "com.liferay.portal.service.persistence.PortletPreferencesPersistence")
6756 protected com.liferay.portal.service.persistence.PortletPreferencesPersistence portletPreferencesPersistence;
6757 @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence")
6758 protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
6759 @BeanReference(name = "com.liferay.portal.service.persistence.SubscriptionPersistence")
6760 protected com.liferay.portal.service.persistence.SubscriptionPersistence subscriptionPersistence;
6761 @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence")
6762 protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
6763 @BeanReference(name = "com.liferay.portlet.asset.service.persistence.AssetEntryPersistence")
6764 protected com.liferay.portlet.asset.service.persistence.AssetEntryPersistence assetEntryPersistence;
6765 @BeanReference(name = "com.liferay.portlet.asset.service.persistence.AssetTagPersistence")
6766 protected com.liferay.portlet.asset.service.persistence.AssetTagPersistence assetTagPersistence;
6767 @BeanReference(name = "com.liferay.portlet.blogs.service.persistence.BlogsEntryPersistence")
6768 protected com.liferay.portlet.blogs.service.persistence.BlogsEntryPersistence blogsEntryPersistence;
6769 @BeanReference(name = "com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence")
6770 protected com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence expandoValuePersistence;
6771 @BeanReference(name = "com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence")
6772 protected com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence ratingsStatsPersistence;
6773 @BeanReference(name = "com.liferay.portlet.social.service.persistence.SocialActivityPersistence")
6774 protected com.liferay.portlet.social.service.persistence.SocialActivityPersistence socialActivityPersistence;
6775 private static final String _SQL_SELECT_MBMESSAGE = "SELECT mbMessage FROM MBMessage mbMessage";
6776 private static final String _SQL_SELECT_MBMESSAGE_WHERE = "SELECT mbMessage FROM MBMessage mbMessage WHERE ";
6777 private static final String _SQL_COUNT_MBMESSAGE = "SELECT COUNT(mbMessage) FROM MBMessage mbMessage";
6778 private static final String _SQL_COUNT_MBMESSAGE_WHERE = "SELECT COUNT(mbMessage) FROM MBMessage mbMessage WHERE ";
6779 private static final String _FINDER_COLUMN_UUID_UUID_1 = "mbMessage.uuid IS NULL";
6780 private static final String _FINDER_COLUMN_UUID_UUID_2 = "mbMessage.uuid = ?";
6781 private static final String _FINDER_COLUMN_UUID_UUID_3 = "(mbMessage.uuid IS NULL OR mbMessage.uuid = ?)";
6782 private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "mbMessage.uuid IS NULL AND ";
6783 private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "mbMessage.uuid = ? AND ";
6784 private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(mbMessage.uuid IS NULL OR mbMessage.uuid = ?) AND ";
6785 private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "mbMessage.groupId = ?";
6786 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "mbMessage.groupId = ?";
6787 private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "mbMessage.companyId = ?";
6788 private static final String _FINDER_COLUMN_THREADID_THREADID_2 = "mbMessage.threadId = ?";
6789 private static final String _FINDER_COLUMN_THREADREPLIES_THREADID_2 = "mbMessage.threadId = ? AND mbMessage.parentMessageId != 0";
6790 private static final String _FINDER_COLUMN_G_U_GROUPID_2 = "mbMessage.groupId = ? AND ";
6791 private static final String _FINDER_COLUMN_G_U_USERID_2 = "mbMessage.userId = ?";
6792 private static final String _FINDER_COLUMN_G_C_GROUPID_2 = "mbMessage.groupId = ? AND ";
6793 private static final String _FINDER_COLUMN_G_C_CATEGORYID_2 = "mbMessage.categoryId = ?";
6794 private static final String _FINDER_COLUMN_G_S_GROUPID_2 = "mbMessage.groupId = ? AND ";
6795 private static final String _FINDER_COLUMN_G_S_STATUS_2 = "mbMessage.status = ?";
6796 private static final String _FINDER_COLUMN_C_S_COMPANYID_2 = "mbMessage.companyId = ? AND ";
6797 private static final String _FINDER_COLUMN_C_S_STATUS_2 = "mbMessage.status = ?";
6798 private static final String _FINDER_COLUMN_C_C_CLASSNAMEID_2 = "mbMessage.classNameId = ? AND ";
6799 private static final String _FINDER_COLUMN_C_C_CLASSPK_2 = "mbMessage.classPK = ?";
6800 private static final String _FINDER_COLUMN_T_P_THREADID_2 = "mbMessage.threadId = ? AND ";
6801 private static final String _FINDER_COLUMN_T_P_PARENTMESSAGEID_2 = "mbMessage.parentMessageId = ?";
6802 private static final String _FINDER_COLUMN_T_S_THREADID_2 = "mbMessage.threadId = ? AND ";
6803 private static final String _FINDER_COLUMN_T_S_STATUS_2 = "mbMessage.status = ?";
6804 private static final String _FINDER_COLUMN_TR_S_THREADID_2 = "mbMessage.threadId = ? AND ";
6805 private static final String _FINDER_COLUMN_TR_S_STATUS_2 = "mbMessage.status = ? AND mbMessage.parentMessageId != 0";
6806 private static final String _FINDER_COLUMN_G_U_S_GROUPID_2 = "mbMessage.groupId = ? AND ";
6807 private static final String _FINDER_COLUMN_G_U_S_USERID_2 = "mbMessage.userId = ? AND ";
6808 private static final String _FINDER_COLUMN_G_U_S_STATUS_2 = "mbMessage.status = ?";
6809 private static final String _FINDER_COLUMN_G_C_T_GROUPID_2 = "mbMessage.groupId = ? AND ";
6810 private static final String _FINDER_COLUMN_G_C_T_CATEGORYID_2 = "mbMessage.categoryId = ? AND ";
6811 private static final String _FINDER_COLUMN_G_C_T_THREADID_2 = "mbMessage.threadId = ?";
6812 private static final String _FINDER_COLUMN_G_C_S_GROUPID_2 = "mbMessage.groupId = ? AND ";
6813 private static final String _FINDER_COLUMN_G_C_S_CATEGORYID_2 = "mbMessage.categoryId = ? AND ";
6814 private static final String _FINDER_COLUMN_G_C_S_STATUS_2 = "mbMessage.status = ?";
6815 private static final String _FINDER_COLUMN_C_C_S_CLASSNAMEID_2 = "mbMessage.classNameId = ? AND ";
6816 private static final String _FINDER_COLUMN_C_C_S_CLASSPK_2 = "mbMessage.classPK = ? AND ";
6817 private static final String _FINDER_COLUMN_C_C_S_STATUS_2 = "mbMessage.status = ?";
6818 private static final String _FINDER_COLUMN_G_C_T_S_GROUPID_2 = "mbMessage.groupId = ? AND ";
6819 private static final String _FINDER_COLUMN_G_C_T_S_CATEGORYID_2 = "mbMessage.categoryId = ? AND ";
6820 private static final String _FINDER_COLUMN_G_C_T_S_THREADID_2 = "mbMessage.threadId = ? AND ";
6821 private static final String _FINDER_COLUMN_G_C_T_S_STATUS_2 = "mbMessage.status = ?";
6822 private static final String _ORDER_BY_ENTITY_ALIAS = "mbMessage.";
6823 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No MBMessage exists with the primary key ";
6824 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No MBMessage exists with the key {";
6825 private static Log _log = LogFactoryUtil.getLog(MBMessagePersistenceImpl.class);
6826}