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