1
14
15 package com.liferay.portlet.social.service.persistence;
16
17 import com.liferay.portal.NoSuchModelException;
18 import com.liferay.portal.SystemException;
19 import com.liferay.portal.kernel.annotation.BeanReference;
20 import com.liferay.portal.kernel.cache.CacheRegistry;
21 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
22 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
23 import com.liferay.portal.kernel.dao.orm.FinderPath;
24 import com.liferay.portal.kernel.dao.orm.Query;
25 import com.liferay.portal.kernel.dao.orm.QueryPos;
26 import com.liferay.portal.kernel.dao.orm.QueryUtil;
27 import com.liferay.portal.kernel.dao.orm.Session;
28 import com.liferay.portal.kernel.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.ResourcePersistence;
40 import com.liferay.portal.service.persistence.UserPersistence;
41 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
42
43 import com.liferay.portlet.social.NoSuchRequestException;
44 import com.liferay.portlet.social.model.SocialRequest;
45 import com.liferay.portlet.social.model.impl.SocialRequestImpl;
46 import com.liferay.portlet.social.model.impl.SocialRequestModelImpl;
47
48 import java.io.Serializable;
49
50 import java.util.ArrayList;
51 import java.util.Collections;
52 import java.util.List;
53
54
67 public class SocialRequestPersistenceImpl extends BasePersistenceImpl<SocialRequest>
68 implements SocialRequestPersistence {
69 public static final String FINDER_CLASS_NAME_ENTITY = SocialRequestImpl.class.getName();
70 public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
71 ".List";
72 public static final FinderPath FINDER_PATH_FIND_BY_UUID = new FinderPath(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
73 SocialRequestModelImpl.FINDER_CACHE_ENABLED,
74 FINDER_CLASS_NAME_LIST, "findByUuid",
75 new String[] { String.class.getName() });
76 public static final FinderPath FINDER_PATH_FIND_BY_OBC_UUID = new FinderPath(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
77 SocialRequestModelImpl.FINDER_CACHE_ENABLED,
78 FINDER_CLASS_NAME_LIST, "findByUuid",
79 new String[] {
80 String.class.getName(),
81
82 "java.lang.Integer", "java.lang.Integer",
83 "com.liferay.portal.kernel.util.OrderByComparator"
84 });
85 public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
86 SocialRequestModelImpl.FINDER_CACHE_ENABLED,
87 FINDER_CLASS_NAME_LIST, "countByUuid",
88 new String[] { String.class.getName() });
89 public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
90 SocialRequestModelImpl.FINDER_CACHE_ENABLED,
91 FINDER_CLASS_NAME_ENTITY, "fetchByUUID_G",
92 new String[] { String.class.getName(), Long.class.getName() });
93 public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
94 SocialRequestModelImpl.FINDER_CACHE_ENABLED,
95 FINDER_CLASS_NAME_LIST, "countByUUID_G",
96 new String[] { String.class.getName(), Long.class.getName() });
97 public static final FinderPath FINDER_PATH_FIND_BY_COMPANYID = new FinderPath(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
98 SocialRequestModelImpl.FINDER_CACHE_ENABLED,
99 FINDER_CLASS_NAME_LIST, "findByCompanyId",
100 new String[] { Long.class.getName() });
101 public static final FinderPath FINDER_PATH_FIND_BY_OBC_COMPANYID = new FinderPath(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
102 SocialRequestModelImpl.FINDER_CACHE_ENABLED,
103 FINDER_CLASS_NAME_LIST, "findByCompanyId",
104 new String[] {
105 Long.class.getName(),
106
107 "java.lang.Integer", "java.lang.Integer",
108 "com.liferay.portal.kernel.util.OrderByComparator"
109 });
110 public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
111 SocialRequestModelImpl.FINDER_CACHE_ENABLED,
112 FINDER_CLASS_NAME_LIST, "countByCompanyId",
113 new String[] { Long.class.getName() });
114 public static final FinderPath FINDER_PATH_FIND_BY_USERID = new FinderPath(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
115 SocialRequestModelImpl.FINDER_CACHE_ENABLED,
116 FINDER_CLASS_NAME_LIST, "findByUserId",
117 new String[] { Long.class.getName() });
118 public static final FinderPath FINDER_PATH_FIND_BY_OBC_USERID = new FinderPath(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
119 SocialRequestModelImpl.FINDER_CACHE_ENABLED,
120 FINDER_CLASS_NAME_LIST, "findByUserId",
121 new String[] {
122 Long.class.getName(),
123
124 "java.lang.Integer", "java.lang.Integer",
125 "com.liferay.portal.kernel.util.OrderByComparator"
126 });
127 public static final FinderPath FINDER_PATH_COUNT_BY_USERID = new FinderPath(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
128 SocialRequestModelImpl.FINDER_CACHE_ENABLED,
129 FINDER_CLASS_NAME_LIST, "countByUserId",
130 new String[] { Long.class.getName() });
131 public static final FinderPath FINDER_PATH_FIND_BY_RECEIVERUSERID = new FinderPath(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
132 SocialRequestModelImpl.FINDER_CACHE_ENABLED,
133 FINDER_CLASS_NAME_LIST, "findByReceiverUserId",
134 new String[] { Long.class.getName() });
135 public static final FinderPath FINDER_PATH_FIND_BY_OBC_RECEIVERUSERID = new FinderPath(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
136 SocialRequestModelImpl.FINDER_CACHE_ENABLED,
137 FINDER_CLASS_NAME_LIST, "findByReceiverUserId",
138 new String[] {
139 Long.class.getName(),
140
141 "java.lang.Integer", "java.lang.Integer",
142 "com.liferay.portal.kernel.util.OrderByComparator"
143 });
144 public static final FinderPath FINDER_PATH_COUNT_BY_RECEIVERUSERID = new FinderPath(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
145 SocialRequestModelImpl.FINDER_CACHE_ENABLED,
146 FINDER_CLASS_NAME_LIST, "countByReceiverUserId",
147 new String[] { Long.class.getName() });
148 public static final FinderPath FINDER_PATH_FIND_BY_U_S = new FinderPath(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
149 SocialRequestModelImpl.FINDER_CACHE_ENABLED,
150 FINDER_CLASS_NAME_LIST, "findByU_S",
151 new String[] { Long.class.getName(), Integer.class.getName() });
152 public static final FinderPath FINDER_PATH_FIND_BY_OBC_U_S = new FinderPath(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
153 SocialRequestModelImpl.FINDER_CACHE_ENABLED,
154 FINDER_CLASS_NAME_LIST, "findByU_S",
155 new String[] {
156 Long.class.getName(), Integer.class.getName(),
157
158 "java.lang.Integer", "java.lang.Integer",
159 "com.liferay.portal.kernel.util.OrderByComparator"
160 });
161 public static final FinderPath FINDER_PATH_COUNT_BY_U_S = new FinderPath(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
162 SocialRequestModelImpl.FINDER_CACHE_ENABLED,
163 FINDER_CLASS_NAME_LIST, "countByU_S",
164 new String[] { Long.class.getName(), Integer.class.getName() });
165 public static final FinderPath FINDER_PATH_FIND_BY_R_S = new FinderPath(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
166 SocialRequestModelImpl.FINDER_CACHE_ENABLED,
167 FINDER_CLASS_NAME_LIST, "findByR_S",
168 new String[] { Long.class.getName(), Integer.class.getName() });
169 public static final FinderPath FINDER_PATH_FIND_BY_OBC_R_S = new FinderPath(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
170 SocialRequestModelImpl.FINDER_CACHE_ENABLED,
171 FINDER_CLASS_NAME_LIST, "findByR_S",
172 new String[] {
173 Long.class.getName(), Integer.class.getName(),
174
175 "java.lang.Integer", "java.lang.Integer",
176 "com.liferay.portal.kernel.util.OrderByComparator"
177 });
178 public static final FinderPath FINDER_PATH_COUNT_BY_R_S = new FinderPath(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
179 SocialRequestModelImpl.FINDER_CACHE_ENABLED,
180 FINDER_CLASS_NAME_LIST, "countByR_S",
181 new String[] { Long.class.getName(), Integer.class.getName() });
182 public static final FinderPath FINDER_PATH_FETCH_BY_U_C_C_T_R = new FinderPath(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
183 SocialRequestModelImpl.FINDER_CACHE_ENABLED,
184 FINDER_CLASS_NAME_ENTITY, "fetchByU_C_C_T_R",
185 new String[] {
186 Long.class.getName(), Long.class.getName(), Long.class.getName(),
187 Integer.class.getName(), Long.class.getName()
188 });
189 public static final FinderPath FINDER_PATH_COUNT_BY_U_C_C_T_R = new FinderPath(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
190 SocialRequestModelImpl.FINDER_CACHE_ENABLED,
191 FINDER_CLASS_NAME_LIST, "countByU_C_C_T_R",
192 new String[] {
193 Long.class.getName(), Long.class.getName(), Long.class.getName(),
194 Integer.class.getName(), Long.class.getName()
195 });
196 public static final FinderPath FINDER_PATH_FIND_BY_U_C_C_T_S = new FinderPath(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
197 SocialRequestModelImpl.FINDER_CACHE_ENABLED,
198 FINDER_CLASS_NAME_LIST, "findByU_C_C_T_S",
199 new String[] {
200 Long.class.getName(), Long.class.getName(), Long.class.getName(),
201 Integer.class.getName(), Integer.class.getName()
202 });
203 public static final FinderPath FINDER_PATH_FIND_BY_OBC_U_C_C_T_S = new FinderPath(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
204 SocialRequestModelImpl.FINDER_CACHE_ENABLED,
205 FINDER_CLASS_NAME_LIST, "findByU_C_C_T_S",
206 new String[] {
207 Long.class.getName(), Long.class.getName(), Long.class.getName(),
208 Integer.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_U_C_C_T_S = new FinderPath(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
214 SocialRequestModelImpl.FINDER_CACHE_ENABLED,
215 FINDER_CLASS_NAME_LIST, "countByU_C_C_T_S",
216 new String[] {
217 Long.class.getName(), Long.class.getName(), Long.class.getName(),
218 Integer.class.getName(), Integer.class.getName()
219 });
220 public static final FinderPath FINDER_PATH_FIND_BY_C_C_T_R_S = new FinderPath(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
221 SocialRequestModelImpl.FINDER_CACHE_ENABLED,
222 FINDER_CLASS_NAME_LIST, "findByC_C_T_R_S",
223 new String[] {
224 Long.class.getName(), Long.class.getName(),
225 Integer.class.getName(), Long.class.getName(),
226 Integer.class.getName()
227 });
228 public static final FinderPath FINDER_PATH_FIND_BY_OBC_C_C_T_R_S = new FinderPath(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
229 SocialRequestModelImpl.FINDER_CACHE_ENABLED,
230 FINDER_CLASS_NAME_LIST, "findByC_C_T_R_S",
231 new String[] {
232 Long.class.getName(), Long.class.getName(),
233 Integer.class.getName(), Long.class.getName(),
234 Integer.class.getName(),
235
236 "java.lang.Integer", "java.lang.Integer",
237 "com.liferay.portal.kernel.util.OrderByComparator"
238 });
239 public static final FinderPath FINDER_PATH_COUNT_BY_C_C_T_R_S = new FinderPath(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
240 SocialRequestModelImpl.FINDER_CACHE_ENABLED,
241 FINDER_CLASS_NAME_LIST, "countByC_C_T_R_S",
242 new String[] {
243 Long.class.getName(), Long.class.getName(),
244 Integer.class.getName(), Long.class.getName(),
245 Integer.class.getName()
246 });
247 public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
248 SocialRequestModelImpl.FINDER_CACHE_ENABLED,
249 FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
250 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
251 SocialRequestModelImpl.FINDER_CACHE_ENABLED,
252 FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
253
254 public void cacheResult(SocialRequest socialRequest) {
255 EntityCacheUtil.putResult(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
256 SocialRequestImpl.class, socialRequest.getPrimaryKey(),
257 socialRequest);
258
259 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
260 new Object[] {
261 socialRequest.getUuid(), new Long(socialRequest.getGroupId())
262 }, socialRequest);
263
264 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U_C_C_T_R,
265 new Object[] {
266 new Long(socialRequest.getUserId()),
267 new Long(socialRequest.getClassNameId()),
268 new Long(socialRequest.getClassPK()),
269 new Integer(socialRequest.getType()),
270 new Long(socialRequest.getReceiverUserId())
271 }, socialRequest);
272 }
273
274 public void cacheResult(List<SocialRequest> socialRequests) {
275 for (SocialRequest socialRequest : socialRequests) {
276 if (EntityCacheUtil.getResult(
277 SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
278 SocialRequestImpl.class, socialRequest.getPrimaryKey(),
279 this) == null) {
280 cacheResult(socialRequest);
281 }
282 }
283 }
284
285 public void clearCache() {
286 CacheRegistry.clear(SocialRequestImpl.class.getName());
287 EntityCacheUtil.clearCache(SocialRequestImpl.class.getName());
288 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
289 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
290 }
291
292 public SocialRequest create(long requestId) {
293 SocialRequest socialRequest = new SocialRequestImpl();
294
295 socialRequest.setNew(true);
296 socialRequest.setPrimaryKey(requestId);
297
298 String uuid = PortalUUIDUtil.generate();
299
300 socialRequest.setUuid(uuid);
301
302 return socialRequest;
303 }
304
305 public SocialRequest remove(Serializable primaryKey)
306 throws NoSuchModelException, SystemException {
307 return remove(((Long)primaryKey).longValue());
308 }
309
310 public SocialRequest remove(long requestId)
311 throws NoSuchRequestException, SystemException {
312 Session session = null;
313
314 try {
315 session = openSession();
316
317 SocialRequest socialRequest = (SocialRequest)session.get(SocialRequestImpl.class,
318 new Long(requestId));
319
320 if (socialRequest == null) {
321 if (_log.isWarnEnabled()) {
322 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + requestId);
323 }
324
325 throw new NoSuchRequestException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
326 requestId);
327 }
328
329 return remove(socialRequest);
330 }
331 catch (NoSuchRequestException nsee) {
332 throw nsee;
333 }
334 catch (Exception e) {
335 throw processException(e);
336 }
337 finally {
338 closeSession(session);
339 }
340 }
341
342 public SocialRequest remove(SocialRequest socialRequest)
343 throws SystemException {
344 for (ModelListener<SocialRequest> listener : listeners) {
345 listener.onBeforeRemove(socialRequest);
346 }
347
348 socialRequest = removeImpl(socialRequest);
349
350 for (ModelListener<SocialRequest> listener : listeners) {
351 listener.onAfterRemove(socialRequest);
352 }
353
354 return socialRequest;
355 }
356
357 protected SocialRequest removeImpl(SocialRequest socialRequest)
358 throws SystemException {
359 socialRequest = toUnwrappedModel(socialRequest);
360
361 Session session = null;
362
363 try {
364 session = openSession();
365
366 if (socialRequest.isCachedModel() || BatchSessionUtil.isEnabled()) {
367 Object staleObject = session.get(SocialRequestImpl.class,
368 socialRequest.getPrimaryKeyObj());
369
370 if (staleObject != null) {
371 session.evict(staleObject);
372 }
373 }
374
375 session.delete(socialRequest);
376
377 session.flush();
378 }
379 catch (Exception e) {
380 throw processException(e);
381 }
382 finally {
383 closeSession(session);
384 }
385
386 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
387
388 SocialRequestModelImpl socialRequestModelImpl = (SocialRequestModelImpl)socialRequest;
389
390 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
391 new Object[] {
392 socialRequestModelImpl.getOriginalUuid(),
393 new Long(socialRequestModelImpl.getOriginalGroupId())
394 });
395
396 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_U_C_C_T_R,
397 new Object[] {
398 new Long(socialRequestModelImpl.getOriginalUserId()),
399 new Long(socialRequestModelImpl.getOriginalClassNameId()),
400 new Long(socialRequestModelImpl.getOriginalClassPK()),
401 new Integer(socialRequestModelImpl.getOriginalType()),
402 new Long(socialRequestModelImpl.getOriginalReceiverUserId())
403 });
404
405 EntityCacheUtil.removeResult(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
406 SocialRequestImpl.class, socialRequest.getPrimaryKey());
407
408 return socialRequest;
409 }
410
411
414 public SocialRequest update(SocialRequest socialRequest)
415 throws SystemException {
416 if (_log.isWarnEnabled()) {
417 _log.warn(
418 "Using the deprecated update(SocialRequest socialRequest) method. Use update(SocialRequest socialRequest, boolean merge) instead.");
419 }
420
421 return update(socialRequest, false);
422 }
423
424 public SocialRequest updateImpl(
425 com.liferay.portlet.social.model.SocialRequest socialRequest,
426 boolean merge) throws SystemException {
427 socialRequest = toUnwrappedModel(socialRequest);
428
429 boolean isNew = socialRequest.isNew();
430
431 SocialRequestModelImpl socialRequestModelImpl = (SocialRequestModelImpl)socialRequest;
432
433 if (Validator.isNull(socialRequest.getUuid())) {
434 String uuid = PortalUUIDUtil.generate();
435
436 socialRequest.setUuid(uuid);
437 }
438
439 Session session = null;
440
441 try {
442 session = openSession();
443
444 BatchSessionUtil.update(session, socialRequest, merge);
445
446 socialRequest.setNew(false);
447 }
448 catch (Exception e) {
449 throw processException(e);
450 }
451 finally {
452 closeSession(session);
453 }
454
455 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
456
457 EntityCacheUtil.putResult(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
458 SocialRequestImpl.class, socialRequest.getPrimaryKey(),
459 socialRequest);
460
461 if (!isNew &&
462 (!Validator.equals(socialRequest.getUuid(),
463 socialRequestModelImpl.getOriginalUuid()) ||
464 (socialRequest.getGroupId() != socialRequestModelImpl.getOriginalGroupId()))) {
465 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
466 new Object[] {
467 socialRequestModelImpl.getOriginalUuid(),
468 new Long(socialRequestModelImpl.getOriginalGroupId())
469 });
470 }
471
472 if (isNew ||
473 (!Validator.equals(socialRequest.getUuid(),
474 socialRequestModelImpl.getOriginalUuid()) ||
475 (socialRequest.getGroupId() != socialRequestModelImpl.getOriginalGroupId()))) {
476 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
477 new Object[] {
478 socialRequest.getUuid(),
479 new Long(socialRequest.getGroupId())
480 }, socialRequest);
481 }
482
483 if (!isNew &&
484 ((socialRequest.getUserId() != socialRequestModelImpl.getOriginalUserId()) ||
485 (socialRequest.getClassNameId() != socialRequestModelImpl.getOriginalClassNameId()) ||
486 (socialRequest.getClassPK() != socialRequestModelImpl.getOriginalClassPK()) ||
487 (socialRequest.getType() != socialRequestModelImpl.getOriginalType()) ||
488 (socialRequest.getReceiverUserId() != socialRequestModelImpl.getOriginalReceiverUserId()))) {
489 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_U_C_C_T_R,
490 new Object[] {
491 new Long(socialRequestModelImpl.getOriginalUserId()),
492 new Long(socialRequestModelImpl.getOriginalClassNameId()),
493 new Long(socialRequestModelImpl.getOriginalClassPK()),
494 new Integer(socialRequestModelImpl.getOriginalType()),
495 new Long(socialRequestModelImpl.getOriginalReceiverUserId())
496 });
497 }
498
499 if (isNew ||
500 ((socialRequest.getUserId() != socialRequestModelImpl.getOriginalUserId()) ||
501 (socialRequest.getClassNameId() != socialRequestModelImpl.getOriginalClassNameId()) ||
502 (socialRequest.getClassPK() != socialRequestModelImpl.getOriginalClassPK()) ||
503 (socialRequest.getType() != socialRequestModelImpl.getOriginalType()) ||
504 (socialRequest.getReceiverUserId() != socialRequestModelImpl.getOriginalReceiverUserId()))) {
505 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U_C_C_T_R,
506 new Object[] {
507 new Long(socialRequest.getUserId()),
508 new Long(socialRequest.getClassNameId()),
509 new Long(socialRequest.getClassPK()),
510 new Integer(socialRequest.getType()),
511 new Long(socialRequest.getReceiverUserId())
512 }, socialRequest);
513 }
514
515 return socialRequest;
516 }
517
518 protected SocialRequest toUnwrappedModel(SocialRequest socialRequest) {
519 if (socialRequest instanceof SocialRequestImpl) {
520 return socialRequest;
521 }
522
523 SocialRequestImpl socialRequestImpl = new SocialRequestImpl();
524
525 socialRequestImpl.setNew(socialRequest.isNew());
526 socialRequestImpl.setPrimaryKey(socialRequest.getPrimaryKey());
527
528 socialRequestImpl.setUuid(socialRequest.getUuid());
529 socialRequestImpl.setRequestId(socialRequest.getRequestId());
530 socialRequestImpl.setGroupId(socialRequest.getGroupId());
531 socialRequestImpl.setCompanyId(socialRequest.getCompanyId());
532 socialRequestImpl.setUserId(socialRequest.getUserId());
533 socialRequestImpl.setCreateDate(socialRequest.getCreateDate());
534 socialRequestImpl.setModifiedDate(socialRequest.getModifiedDate());
535 socialRequestImpl.setClassNameId(socialRequest.getClassNameId());
536 socialRequestImpl.setClassPK(socialRequest.getClassPK());
537 socialRequestImpl.setType(socialRequest.getType());
538 socialRequestImpl.setExtraData(socialRequest.getExtraData());
539 socialRequestImpl.setReceiverUserId(socialRequest.getReceiverUserId());
540 socialRequestImpl.setStatus(socialRequest.getStatus());
541
542 return socialRequestImpl;
543 }
544
545 public SocialRequest findByPrimaryKey(Serializable primaryKey)
546 throws NoSuchModelException, SystemException {
547 return findByPrimaryKey(((Long)primaryKey).longValue());
548 }
549
550 public SocialRequest findByPrimaryKey(long requestId)
551 throws NoSuchRequestException, SystemException {
552 SocialRequest socialRequest = fetchByPrimaryKey(requestId);
553
554 if (socialRequest == null) {
555 if (_log.isWarnEnabled()) {
556 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + requestId);
557 }
558
559 throw new NoSuchRequestException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
560 requestId);
561 }
562
563 return socialRequest;
564 }
565
566 public SocialRequest fetchByPrimaryKey(Serializable primaryKey)
567 throws SystemException {
568 return fetchByPrimaryKey(((Long)primaryKey).longValue());
569 }
570
571 public SocialRequest fetchByPrimaryKey(long requestId)
572 throws SystemException {
573 SocialRequest socialRequest = (SocialRequest)EntityCacheUtil.getResult(SocialRequestModelImpl.ENTITY_CACHE_ENABLED,
574 SocialRequestImpl.class, requestId, this);
575
576 if (socialRequest == null) {
577 Session session = null;
578
579 try {
580 session = openSession();
581
582 socialRequest = (SocialRequest)session.get(SocialRequestImpl.class,
583 new Long(requestId));
584 }
585 catch (Exception e) {
586 throw processException(e);
587 }
588 finally {
589 if (socialRequest != null) {
590 cacheResult(socialRequest);
591 }
592
593 closeSession(session);
594 }
595 }
596
597 return socialRequest;
598 }
599
600 public List<SocialRequest> findByUuid(String uuid)
601 throws SystemException {
602 Object[] finderArgs = new Object[] { uuid };
603
604 List<SocialRequest> list = (List<SocialRequest>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_UUID,
605 finderArgs, this);
606
607 if (list == null) {
608 Session session = null;
609
610 try {
611 session = openSession();
612
613 StringBundler query = new StringBundler(3);
614
615 query.append(_SQL_SELECT_SOCIALREQUEST_WHERE);
616
617 if (uuid == null) {
618 query.append(_FINDER_COLUMN_UUID_UUID_1);
619 }
620 else {
621 if (uuid.equals(StringPool.BLANK)) {
622 query.append(_FINDER_COLUMN_UUID_UUID_3);
623 }
624 else {
625 query.append(_FINDER_COLUMN_UUID_UUID_2);
626 }
627 }
628
629 query.append(SocialRequestModelImpl.ORDER_BY_JPQL);
630
631 String sql = query.toString();
632
633 Query q = session.createQuery(sql);
634
635 QueryPos qPos = QueryPos.getInstance(q);
636
637 if (uuid != null) {
638 qPos.add(uuid);
639 }
640
641 list = q.list();
642 }
643 catch (Exception e) {
644 throw processException(e);
645 }
646 finally {
647 if (list == null) {
648 list = new ArrayList<SocialRequest>();
649 }
650
651 cacheResult(list);
652
653 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_UUID, finderArgs,
654 list);
655
656 closeSession(session);
657 }
658 }
659
660 return list;
661 }
662
663 public List<SocialRequest> findByUuid(String uuid, int start, int end)
664 throws SystemException {
665 return findByUuid(uuid, start, end, null);
666 }
667
668 public List<SocialRequest> findByUuid(String uuid, int start, int end,
669 OrderByComparator orderByComparator) throws SystemException {
670 Object[] finderArgs = new Object[] {
671 uuid,
672
673 String.valueOf(start), String.valueOf(end),
674 String.valueOf(orderByComparator)
675 };
676
677 List<SocialRequest> list = (List<SocialRequest>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_UUID,
678 finderArgs, this);
679
680 if (list == null) {
681 Session session = null;
682
683 try {
684 session = openSession();
685
686 StringBundler query = null;
687
688 if (orderByComparator != null) {
689 query = new StringBundler(3 +
690 (orderByComparator.getOrderByFields().length * 3));
691 }
692 else {
693 query = new StringBundler(3);
694 }
695
696 query.append(_SQL_SELECT_SOCIALREQUEST_WHERE);
697
698 if (uuid == null) {
699 query.append(_FINDER_COLUMN_UUID_UUID_1);
700 }
701 else {
702 if (uuid.equals(StringPool.BLANK)) {
703 query.append(_FINDER_COLUMN_UUID_UUID_3);
704 }
705 else {
706 query.append(_FINDER_COLUMN_UUID_UUID_2);
707 }
708 }
709
710 if (orderByComparator != null) {
711 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
712 orderByComparator);
713 }
714
715 else {
716 query.append(SocialRequestModelImpl.ORDER_BY_JPQL);
717 }
718
719 String sql = query.toString();
720
721 Query q = session.createQuery(sql);
722
723 QueryPos qPos = QueryPos.getInstance(q);
724
725 if (uuid != null) {
726 qPos.add(uuid);
727 }
728
729 list = (List<SocialRequest>)QueryUtil.list(q, getDialect(),
730 start, end);
731 }
732 catch (Exception e) {
733 throw processException(e);
734 }
735 finally {
736 if (list == null) {
737 list = new ArrayList<SocialRequest>();
738 }
739
740 cacheResult(list);
741
742 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_UUID,
743 finderArgs, list);
744
745 closeSession(session);
746 }
747 }
748
749 return list;
750 }
751
752 public SocialRequest findByUuid_First(String uuid,
753 OrderByComparator orderByComparator)
754 throws NoSuchRequestException, SystemException {
755 List<SocialRequest> list = findByUuid(uuid, 0, 1, orderByComparator);
756
757 if (list.isEmpty()) {
758 StringBundler msg = new StringBundler(4);
759
760 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
761
762 msg.append("uuid=");
763 msg.append(uuid);
764
765 msg.append(StringPool.CLOSE_CURLY_BRACE);
766
767 throw new NoSuchRequestException(msg.toString());
768 }
769 else {
770 return list.get(0);
771 }
772 }
773
774 public SocialRequest findByUuid_Last(String uuid,
775 OrderByComparator orderByComparator)
776 throws NoSuchRequestException, SystemException {
777 int count = countByUuid(uuid);
778
779 List<SocialRequest> list = findByUuid(uuid, count - 1, count,
780 orderByComparator);
781
782 if (list.isEmpty()) {
783 StringBundler msg = new StringBundler(4);
784
785 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
786
787 msg.append("uuid=");
788 msg.append(uuid);
789
790 msg.append(StringPool.CLOSE_CURLY_BRACE);
791
792 throw new NoSuchRequestException(msg.toString());
793 }
794 else {
795 return list.get(0);
796 }
797 }
798
799 public SocialRequest[] findByUuid_PrevAndNext(long requestId, String uuid,
800 OrderByComparator orderByComparator)
801 throws NoSuchRequestException, SystemException {
802 SocialRequest socialRequest = findByPrimaryKey(requestId);
803
804 int count = countByUuid(uuid);
805
806 Session session = null;
807
808 try {
809 session = openSession();
810
811 StringBundler query = null;
812
813 if (orderByComparator != null) {
814 query = new StringBundler(3 +
815 (orderByComparator.getOrderByFields().length * 3));
816 }
817 else {
818 query = new StringBundler(3);
819 }
820
821 query.append(_SQL_SELECT_SOCIALREQUEST_WHERE);
822
823 if (uuid == null) {
824 query.append(_FINDER_COLUMN_UUID_UUID_1);
825 }
826 else {
827 if (uuid.equals(StringPool.BLANK)) {
828 query.append(_FINDER_COLUMN_UUID_UUID_3);
829 }
830 else {
831 query.append(_FINDER_COLUMN_UUID_UUID_2);
832 }
833 }
834
835 if (orderByComparator != null) {
836 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
837 orderByComparator);
838 }
839
840 else {
841 query.append(SocialRequestModelImpl.ORDER_BY_JPQL);
842 }
843
844 String sql = query.toString();
845
846 Query q = session.createQuery(sql);
847
848 QueryPos qPos = QueryPos.getInstance(q);
849
850 if (uuid != null) {
851 qPos.add(uuid);
852 }
853
854 Object[] objArray = QueryUtil.getPrevAndNext(q, count,
855 orderByComparator, socialRequest);
856
857 SocialRequest[] array = new SocialRequestImpl[3];
858
859 array[0] = (SocialRequest)objArray[0];
860 array[1] = (SocialRequest)objArray[1];
861 array[2] = (SocialRequest)objArray[2];
862
863 return array;
864 }
865 catch (Exception e) {
866 throw processException(e);
867 }
868 finally {
869 closeSession(session);
870 }
871 }
872
873 public SocialRequest findByUUID_G(String uuid, long groupId)
874 throws NoSuchRequestException, SystemException {
875 SocialRequest socialRequest = fetchByUUID_G(uuid, groupId);
876
877 if (socialRequest == null) {
878 StringBundler msg = new StringBundler(6);
879
880 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
881
882 msg.append("uuid=");
883 msg.append(uuid);
884
885 msg.append(", groupId=");
886 msg.append(groupId);
887
888 msg.append(StringPool.CLOSE_CURLY_BRACE);
889
890 if (_log.isWarnEnabled()) {
891 _log.warn(msg.toString());
892 }
893
894 throw new NoSuchRequestException(msg.toString());
895 }
896
897 return socialRequest;
898 }
899
900 public SocialRequest fetchByUUID_G(String uuid, long groupId)
901 throws SystemException {
902 return fetchByUUID_G(uuid, groupId, true);
903 }
904
905 public SocialRequest fetchByUUID_G(String uuid, long groupId,
906 boolean retrieveFromCache) throws SystemException {
907 Object[] finderArgs = new Object[] { uuid, new Long(groupId) };
908
909 Object result = null;
910
911 if (retrieveFromCache) {
912 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
913 finderArgs, this);
914 }
915
916 if (result == null) {
917 Session session = null;
918
919 try {
920 session = openSession();
921
922 StringBundler query = new StringBundler(4);
923
924 query.append(_SQL_SELECT_SOCIALREQUEST_WHERE);
925
926 if (uuid == null) {
927 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
928 }
929 else {
930 if (uuid.equals(StringPool.BLANK)) {
931 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
932 }
933 else {
934 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
935 }
936 }
937
938 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
939
940 query.append(SocialRequestModelImpl.ORDER_BY_JPQL);
941
942 String sql = query.toString();
943
944 Query q = session.createQuery(sql);
945
946 QueryPos qPos = QueryPos.getInstance(q);
947
948 if (uuid != null) {
949 qPos.add(uuid);
950 }
951
952 qPos.add(groupId);
953
954 List<SocialRequest> list = q.list();
955
956 result = list;
957
958 SocialRequest socialRequest = null;
959
960 if (list.isEmpty()) {
961 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
962 finderArgs, list);
963 }
964 else {
965 socialRequest = list.get(0);
966
967 cacheResult(socialRequest);
968
969 if ((socialRequest.getUuid() == null) ||
970 !socialRequest.getUuid().equals(uuid) ||
971 (socialRequest.getGroupId() != groupId)) {
972 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
973 finderArgs, socialRequest);
974 }
975 }
976
977 return socialRequest;
978 }
979 catch (Exception e) {
980 throw processException(e);
981 }
982 finally {
983 if (result == null) {
984 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
985 finderArgs, new ArrayList<SocialRequest>());
986 }
987
988 closeSession(session);
989 }
990 }
991 else {
992 if (result instanceof List<?>) {
993 return null;
994 }
995 else {
996 return (SocialRequest)result;
997 }
998 }
999 }
1000
1001 public List<SocialRequest> findByCompanyId(long companyId)
1002 throws SystemException {
1003 Object[] finderArgs = new Object[] { new Long(companyId) };
1004
1005 List<SocialRequest> list = (List<SocialRequest>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
1006 finderArgs, this);
1007
1008 if (list == null) {
1009 Session session = null;
1010
1011 try {
1012 session = openSession();
1013
1014 StringBundler query = new StringBundler(3);
1015
1016 query.append(_SQL_SELECT_SOCIALREQUEST_WHERE);
1017
1018 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1019
1020 query.append(SocialRequestModelImpl.ORDER_BY_JPQL);
1021
1022 String sql = query.toString();
1023
1024 Query q = session.createQuery(sql);
1025
1026 QueryPos qPos = QueryPos.getInstance(q);
1027
1028 qPos.add(companyId);
1029
1030 list = q.list();
1031 }
1032 catch (Exception e) {
1033 throw processException(e);
1034 }
1035 finally {
1036 if (list == null) {
1037 list = new ArrayList<SocialRequest>();
1038 }
1039
1040 cacheResult(list);
1041
1042 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
1043 finderArgs, list);
1044
1045 closeSession(session);
1046 }
1047 }
1048
1049 return list;
1050 }
1051
1052 public List<SocialRequest> findByCompanyId(long companyId, int start,
1053 int end) throws SystemException {
1054 return findByCompanyId(companyId, start, end, null);
1055 }
1056
1057 public List<SocialRequest> findByCompanyId(long companyId, int start,
1058 int end, OrderByComparator orderByComparator) throws SystemException {
1059 Object[] finderArgs = new Object[] {
1060 new Long(companyId),
1061
1062 String.valueOf(start), String.valueOf(end),
1063 String.valueOf(orderByComparator)
1064 };
1065
1066 List<SocialRequest> list = (List<SocialRequest>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_COMPANYID,
1067 finderArgs, this);
1068
1069 if (list == null) {
1070 Session session = null;
1071
1072 try {
1073 session = openSession();
1074
1075 StringBundler query = null;
1076
1077 if (orderByComparator != null) {
1078 query = new StringBundler(3 +
1079 (orderByComparator.getOrderByFields().length * 3));
1080 }
1081 else {
1082 query = new StringBundler(3);
1083 }
1084
1085 query.append(_SQL_SELECT_SOCIALREQUEST_WHERE);
1086
1087 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1088
1089 if (orderByComparator != null) {
1090 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1091 orderByComparator);
1092 }
1093
1094 else {
1095 query.append(SocialRequestModelImpl.ORDER_BY_JPQL);
1096 }
1097
1098 String sql = query.toString();
1099
1100 Query q = session.createQuery(sql);
1101
1102 QueryPos qPos = QueryPos.getInstance(q);
1103
1104 qPos.add(companyId);
1105
1106 list = (List<SocialRequest>)QueryUtil.list(q, getDialect(),
1107 start, end);
1108 }
1109 catch (Exception e) {
1110 throw processException(e);
1111 }
1112 finally {
1113 if (list == null) {
1114 list = new ArrayList<SocialRequest>();
1115 }
1116
1117 cacheResult(list);
1118
1119 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_COMPANYID,
1120 finderArgs, list);
1121
1122 closeSession(session);
1123 }
1124 }
1125
1126 return list;
1127 }
1128
1129 public SocialRequest findByCompanyId_First(long companyId,
1130 OrderByComparator orderByComparator)
1131 throws NoSuchRequestException, SystemException {
1132 List<SocialRequest> list = findByCompanyId(companyId, 0, 1,
1133 orderByComparator);
1134
1135 if (list.isEmpty()) {
1136 StringBundler msg = new StringBundler(4);
1137
1138 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1139
1140 msg.append("companyId=");
1141 msg.append(companyId);
1142
1143 msg.append(StringPool.CLOSE_CURLY_BRACE);
1144
1145 throw new NoSuchRequestException(msg.toString());
1146 }
1147 else {
1148 return list.get(0);
1149 }
1150 }
1151
1152 public SocialRequest findByCompanyId_Last(long companyId,
1153 OrderByComparator orderByComparator)
1154 throws NoSuchRequestException, SystemException {
1155 int count = countByCompanyId(companyId);
1156
1157 List<SocialRequest> list = findByCompanyId(companyId, count - 1, count,
1158 orderByComparator);
1159
1160 if (list.isEmpty()) {
1161 StringBundler msg = new StringBundler(4);
1162
1163 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1164
1165 msg.append("companyId=");
1166 msg.append(companyId);
1167
1168 msg.append(StringPool.CLOSE_CURLY_BRACE);
1169
1170 throw new NoSuchRequestException(msg.toString());
1171 }
1172 else {
1173 return list.get(0);
1174 }
1175 }
1176
1177 public SocialRequest[] findByCompanyId_PrevAndNext(long requestId,
1178 long companyId, OrderByComparator orderByComparator)
1179 throws NoSuchRequestException, SystemException {
1180 SocialRequest socialRequest = findByPrimaryKey(requestId);
1181
1182 int count = countByCompanyId(companyId);
1183
1184 Session session = null;
1185
1186 try {
1187 session = openSession();
1188
1189 StringBundler query = null;
1190
1191 if (orderByComparator != null) {
1192 query = new StringBundler(3 +
1193 (orderByComparator.getOrderByFields().length * 3));
1194 }
1195 else {
1196 query = new StringBundler(3);
1197 }
1198
1199 query.append(_SQL_SELECT_SOCIALREQUEST_WHERE);
1200
1201 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1202
1203 if (orderByComparator != null) {
1204 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1205 orderByComparator);
1206 }
1207
1208 else {
1209 query.append(SocialRequestModelImpl.ORDER_BY_JPQL);
1210 }
1211
1212 String sql = query.toString();
1213
1214 Query q = session.createQuery(sql);
1215
1216 QueryPos qPos = QueryPos.getInstance(q);
1217
1218 qPos.add(companyId);
1219
1220 Object[] objArray = QueryUtil.getPrevAndNext(q, count,
1221 orderByComparator, socialRequest);
1222
1223 SocialRequest[] array = new SocialRequestImpl[3];
1224
1225 array[0] = (SocialRequest)objArray[0];
1226 array[1] = (SocialRequest)objArray[1];
1227 array[2] = (SocialRequest)objArray[2];
1228
1229 return array;
1230 }
1231 catch (Exception e) {
1232 throw processException(e);
1233 }
1234 finally {
1235 closeSession(session);
1236 }
1237 }
1238
1239 public List<SocialRequest> findByUserId(long userId)
1240 throws SystemException {
1241 Object[] finderArgs = new Object[] { new Long(userId) };
1242
1243 List<SocialRequest> list = (List<SocialRequest>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_USERID,
1244 finderArgs, this);
1245
1246 if (list == null) {
1247 Session session = null;
1248
1249 try {
1250 session = openSession();
1251
1252 StringBundler query = new StringBundler(3);
1253
1254 query.append(_SQL_SELECT_SOCIALREQUEST_WHERE);
1255
1256 query.append(_FINDER_COLUMN_USERID_USERID_2);
1257
1258 query.append(SocialRequestModelImpl.ORDER_BY_JPQL);
1259
1260 String sql = query.toString();
1261
1262 Query q = session.createQuery(sql);
1263
1264 QueryPos qPos = QueryPos.getInstance(q);
1265
1266 qPos.add(userId);
1267
1268 list = q.list();
1269 }
1270 catch (Exception e) {
1271 throw processException(e);
1272 }
1273 finally {
1274 if (list == null) {
1275 list = new ArrayList<SocialRequest>();
1276 }
1277
1278 cacheResult(list);
1279
1280 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_USERID,
1281 finderArgs, list);
1282
1283 closeSession(session);
1284 }
1285 }
1286
1287 return list;
1288 }
1289
1290 public List<SocialRequest> findByUserId(long userId, int start, int end)
1291 throws SystemException {
1292 return findByUserId(userId, start, end, null);
1293 }
1294
1295 public List<SocialRequest> findByUserId(long userId, int start, int end,
1296 OrderByComparator orderByComparator) throws SystemException {
1297 Object[] finderArgs = new Object[] {
1298 new Long(userId),
1299
1300 String.valueOf(start), String.valueOf(end),
1301 String.valueOf(orderByComparator)
1302 };
1303
1304 List<SocialRequest> list = (List<SocialRequest>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_USERID,
1305 finderArgs, this);
1306
1307 if (list == null) {
1308 Session session = null;
1309
1310 try {
1311 session = openSession();
1312
1313 StringBundler query = null;
1314
1315 if (orderByComparator != null) {
1316 query = new StringBundler(3 +
1317 (orderByComparator.getOrderByFields().length * 3));
1318 }
1319 else {
1320 query = new StringBundler(3);
1321 }
1322
1323 query.append(_SQL_SELECT_SOCIALREQUEST_WHERE);
1324
1325 query.append(_FINDER_COLUMN_USERID_USERID_2);
1326
1327 if (orderByComparator != null) {
1328 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1329 orderByComparator);
1330 }
1331
1332 else {
1333 query.append(SocialRequestModelImpl.ORDER_BY_JPQL);
1334 }
1335
1336 String sql = query.toString();
1337
1338 Query q = session.createQuery(sql);
1339
1340 QueryPos qPos = QueryPos.getInstance(q);
1341
1342 qPos.add(userId);
1343
1344 list = (List<SocialRequest>)QueryUtil.list(q, getDialect(),
1345 start, end);
1346 }
1347 catch (Exception e) {
1348 throw processException(e);
1349 }
1350 finally {
1351 if (list == null) {
1352 list = new ArrayList<SocialRequest>();
1353 }
1354
1355 cacheResult(list);
1356
1357 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_USERID,
1358 finderArgs, list);
1359
1360 closeSession(session);
1361 }
1362 }
1363
1364 return list;
1365 }
1366
1367 public SocialRequest findByUserId_First(long userId,
1368 OrderByComparator orderByComparator)
1369 throws NoSuchRequestException, SystemException {
1370 List<SocialRequest> list = findByUserId(userId, 0, 1, orderByComparator);
1371
1372 if (list.isEmpty()) {
1373 StringBundler msg = new StringBundler(4);
1374
1375 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1376
1377 msg.append("userId=");
1378 msg.append(userId);
1379
1380 msg.append(StringPool.CLOSE_CURLY_BRACE);
1381
1382 throw new NoSuchRequestException(msg.toString());
1383 }
1384 else {
1385 return list.get(0);
1386 }
1387 }
1388
1389 public SocialRequest findByUserId_Last(long userId,
1390 OrderByComparator orderByComparator)
1391 throws NoSuchRequestException, SystemException {
1392 int count = countByUserId(userId);
1393
1394 List<SocialRequest> list = findByUserId(userId, count - 1, count,
1395 orderByComparator);
1396
1397 if (list.isEmpty()) {
1398 StringBundler msg = new StringBundler(4);
1399
1400 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1401
1402 msg.append("userId=");
1403 msg.append(userId);
1404
1405 msg.append(StringPool.CLOSE_CURLY_BRACE);
1406
1407 throw new NoSuchRequestException(msg.toString());
1408 }
1409 else {
1410 return list.get(0);
1411 }
1412 }
1413
1414 public SocialRequest[] findByUserId_PrevAndNext(long requestId,
1415 long userId, OrderByComparator orderByComparator)
1416 throws NoSuchRequestException, SystemException {
1417 SocialRequest socialRequest = findByPrimaryKey(requestId);
1418
1419 int count = countByUserId(userId);
1420
1421 Session session = null;
1422
1423 try {
1424 session = openSession();
1425
1426 StringBundler query = null;
1427
1428 if (orderByComparator != null) {
1429 query = new StringBundler(3 +
1430 (orderByComparator.getOrderByFields().length * 3));
1431 }
1432 else {
1433 query = new StringBundler(3);
1434 }
1435
1436 query.append(_SQL_SELECT_SOCIALREQUEST_WHERE);
1437
1438 query.append(_FINDER_COLUMN_USERID_USERID_2);
1439
1440 if (orderByComparator != null) {
1441 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1442 orderByComparator);
1443 }
1444
1445 else {
1446 query.append(SocialRequestModelImpl.ORDER_BY_JPQL);
1447 }
1448
1449 String sql = query.toString();
1450
1451 Query q = session.createQuery(sql);
1452
1453 QueryPos qPos = QueryPos.getInstance(q);
1454
1455 qPos.add(userId);
1456
1457 Object[] objArray = QueryUtil.getPrevAndNext(q, count,
1458 orderByComparator, socialRequest);
1459
1460 SocialRequest[] array = new SocialRequestImpl[3];
1461
1462 array[0] = (SocialRequest)objArray[0];
1463 array[1] = (SocialRequest)objArray[1];
1464 array[2] = (SocialRequest)objArray[2];
1465
1466 return array;
1467 }
1468 catch (Exception e) {
1469 throw processException(e);
1470 }
1471 finally {
1472 closeSession(session);
1473 }
1474 }
1475
1476 public List<SocialRequest> findByReceiverUserId(long receiverUserId)
1477 throws SystemException {
1478 Object[] finderArgs = new Object[] { new Long(receiverUserId) };
1479
1480 List<SocialRequest> list = (List<SocialRequest>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_RECEIVERUSERID,
1481 finderArgs, this);
1482
1483 if (list == null) {
1484 Session session = null;
1485
1486 try {
1487 session = openSession();
1488
1489 StringBundler query = new StringBundler(3);
1490
1491 query.append(_SQL_SELECT_SOCIALREQUEST_WHERE);
1492
1493 query.append(_FINDER_COLUMN_RECEIVERUSERID_RECEIVERUSERID_2);
1494
1495 query.append(SocialRequestModelImpl.ORDER_BY_JPQL);
1496
1497 String sql = query.toString();
1498
1499 Query q = session.createQuery(sql);
1500
1501 QueryPos qPos = QueryPos.getInstance(q);
1502
1503 qPos.add(receiverUserId);
1504
1505 list = q.list();
1506 }
1507 catch (Exception e) {
1508 throw processException(e);
1509 }
1510 finally {
1511 if (list == null) {
1512 list = new ArrayList<SocialRequest>();
1513 }
1514
1515 cacheResult(list);
1516
1517 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_RECEIVERUSERID,
1518 finderArgs, list);
1519
1520 closeSession(session);
1521 }
1522 }
1523
1524 return list;
1525 }
1526
1527 public List<SocialRequest> findByReceiverUserId(long receiverUserId,
1528 int start, int end) throws SystemException {
1529 return findByReceiverUserId(receiverUserId, start, end, null);
1530 }
1531
1532 public List<SocialRequest> findByReceiverUserId(long receiverUserId,
1533 int start, int end, OrderByComparator orderByComparator)
1534 throws SystemException {
1535 Object[] finderArgs = new Object[] {
1536 new Long(receiverUserId),
1537
1538 String.valueOf(start), String.valueOf(end),
1539 String.valueOf(orderByComparator)
1540 };
1541
1542 List<SocialRequest> list = (List<SocialRequest>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_RECEIVERUSERID,
1543 finderArgs, this);
1544
1545 if (list == null) {
1546 Session session = null;
1547
1548 try {
1549 session = openSession();
1550
1551 StringBundler query = null;
1552
1553 if (orderByComparator != null) {
1554 query = new StringBundler(3 +
1555 (orderByComparator.getOrderByFields().length * 3));
1556 }
1557 else {
1558 query = new StringBundler(3);
1559 }
1560
1561 query.append(_SQL_SELECT_SOCIALREQUEST_WHERE);
1562
1563 query.append(_FINDER_COLUMN_RECEIVERUSERID_RECEIVERUSERID_2);
1564
1565 if (orderByComparator != null) {
1566 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1567 orderByComparator);
1568 }
1569
1570 else {
1571 query.append(SocialRequestModelImpl.ORDER_BY_JPQL);
1572 }
1573
1574 String sql = query.toString();
1575
1576 Query q = session.createQuery(sql);
1577
1578 QueryPos qPos = QueryPos.getInstance(q);
1579
1580 qPos.add(receiverUserId);
1581
1582 list = (List<SocialRequest>)QueryUtil.list(q, getDialect(),
1583 start, end);
1584 }
1585 catch (Exception e) {
1586 throw processException(e);
1587 }
1588 finally {
1589 if (list == null) {
1590 list = new ArrayList<SocialRequest>();
1591 }
1592
1593 cacheResult(list);
1594
1595 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_RECEIVERUSERID,
1596 finderArgs, list);
1597
1598 closeSession(session);
1599 }
1600 }
1601
1602 return list;
1603 }
1604
1605 public SocialRequest findByReceiverUserId_First(long receiverUserId,
1606 OrderByComparator orderByComparator)
1607 throws NoSuchRequestException, SystemException {
1608 List<SocialRequest> list = findByReceiverUserId(receiverUserId, 0, 1,
1609 orderByComparator);
1610
1611 if (list.isEmpty()) {
1612 StringBundler msg = new StringBundler(4);
1613
1614 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1615
1616 msg.append("receiverUserId=");
1617 msg.append(receiverUserId);
1618
1619 msg.append(StringPool.CLOSE_CURLY_BRACE);
1620
1621 throw new NoSuchRequestException(msg.toString());
1622 }
1623 else {
1624 return list.get(0);
1625 }
1626 }
1627
1628 public SocialRequest findByReceiverUserId_Last(long receiverUserId,
1629 OrderByComparator orderByComparator)
1630 throws NoSuchRequestException, SystemException {
1631 int count = countByReceiverUserId(receiverUserId);
1632
1633 List<SocialRequest> list = findByReceiverUserId(receiverUserId,
1634 count - 1, count, orderByComparator);
1635
1636 if (list.isEmpty()) {
1637 StringBundler msg = new StringBundler(4);
1638
1639 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1640
1641 msg.append("receiverUserId=");
1642 msg.append(receiverUserId);
1643
1644 msg.append(StringPool.CLOSE_CURLY_BRACE);
1645
1646 throw new NoSuchRequestException(msg.toString());
1647 }
1648 else {
1649 return list.get(0);
1650 }
1651 }
1652
1653 public SocialRequest[] findByReceiverUserId_PrevAndNext(long requestId,
1654 long receiverUserId, OrderByComparator orderByComparator)
1655 throws NoSuchRequestException, SystemException {
1656 SocialRequest socialRequest = findByPrimaryKey(requestId);
1657
1658 int count = countByReceiverUserId(receiverUserId);
1659
1660 Session session = null;
1661
1662 try {
1663 session = openSession();
1664
1665 StringBundler query = null;
1666
1667 if (orderByComparator != null) {
1668 query = new StringBundler(3 +
1669 (orderByComparator.getOrderByFields().length * 3));
1670 }
1671 else {
1672 query = new StringBundler(3);
1673 }
1674
1675 query.append(_SQL_SELECT_SOCIALREQUEST_WHERE);
1676
1677 query.append(_FINDER_COLUMN_RECEIVERUSERID_RECEIVERUSERID_2);
1678
1679 if (orderByComparator != null) {
1680 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1681 orderByComparator);
1682 }
1683
1684 else {
1685 query.append(SocialRequestModelImpl.ORDER_BY_JPQL);
1686 }
1687
1688 String sql = query.toString();
1689
1690 Query q = session.createQuery(sql);
1691
1692 QueryPos qPos = QueryPos.getInstance(q);
1693
1694 qPos.add(receiverUserId);
1695
1696 Object[] objArray = QueryUtil.getPrevAndNext(q, count,
1697 orderByComparator, socialRequest);
1698
1699 SocialRequest[] array = new SocialRequestImpl[3];
1700
1701 array[0] = (SocialRequest)objArray[0];
1702 array[1] = (SocialRequest)objArray[1];
1703 array[2] = (SocialRequest)objArray[2];
1704
1705 return array;
1706 }
1707 catch (Exception e) {
1708 throw processException(e);
1709 }
1710 finally {
1711 closeSession(session);
1712 }
1713 }
1714
1715 public List<SocialRequest> findByU_S(long userId, int status)
1716 throws SystemException {
1717 Object[] finderArgs = new Object[] { new Long(userId), new Integer(status) };
1718
1719 List<SocialRequest> list = (List<SocialRequest>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_U_S,
1720 finderArgs, this);
1721
1722 if (list == null) {
1723 Session session = null;
1724
1725 try {
1726 session = openSession();
1727
1728 StringBundler query = new StringBundler(4);
1729
1730 query.append(_SQL_SELECT_SOCIALREQUEST_WHERE);
1731
1732 query.append(_FINDER_COLUMN_U_S_USERID_2);
1733
1734 query.append(_FINDER_COLUMN_U_S_STATUS_2);
1735
1736 query.append(SocialRequestModelImpl.ORDER_BY_JPQL);
1737
1738 String sql = query.toString();
1739
1740 Query q = session.createQuery(sql);
1741
1742 QueryPos qPos = QueryPos.getInstance(q);
1743
1744 qPos.add(userId);
1745
1746 qPos.add(status);
1747
1748 list = q.list();
1749 }
1750 catch (Exception e) {
1751 throw processException(e);
1752 }
1753 finally {
1754 if (list == null) {
1755 list = new ArrayList<SocialRequest>();
1756 }
1757
1758 cacheResult(list);
1759
1760 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_U_S, finderArgs,
1761 list);
1762
1763 closeSession(session);
1764 }
1765 }
1766
1767 return list;
1768 }
1769
1770 public List<SocialRequest> findByU_S(long userId, int status, int start,
1771 int end) throws SystemException {
1772 return findByU_S(userId, status, start, end, null);
1773 }
1774
1775 public List<SocialRequest> findByU_S(long userId, int status, int start,
1776 int end, OrderByComparator orderByComparator) throws SystemException {
1777 Object[] finderArgs = new Object[] {
1778 new Long(userId), new Integer(status),
1779
1780 String.valueOf(start), String.valueOf(end),
1781 String.valueOf(orderByComparator)
1782 };
1783
1784 List<SocialRequest> list = (List<SocialRequest>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_U_S,
1785 finderArgs, this);
1786
1787 if (list == null) {
1788 Session session = null;
1789
1790 try {
1791 session = openSession();
1792
1793 StringBundler query = null;
1794
1795 if (orderByComparator != null) {
1796 query = new StringBundler(4 +
1797 (orderByComparator.getOrderByFields().length * 3));
1798 }
1799 else {
1800 query = new StringBundler(4);
1801 }
1802
1803 query.append(_SQL_SELECT_SOCIALREQUEST_WHERE);
1804
1805 query.append(_FINDER_COLUMN_U_S_USERID_2);
1806
1807 query.append(_FINDER_COLUMN_U_S_STATUS_2);
1808
1809 if (orderByComparator != null) {
1810 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1811 orderByComparator);
1812 }
1813
1814 else {
1815 query.append(SocialRequestModelImpl.ORDER_BY_JPQL);
1816 }
1817
1818 String sql = query.toString();
1819
1820 Query q = session.createQuery(sql);
1821
1822 QueryPos qPos = QueryPos.getInstance(q);
1823
1824 qPos.add(userId);
1825
1826 qPos.add(status);
1827
1828 list = (List<SocialRequest>)QueryUtil.list(q, getDialect(),
1829 start, end);
1830 }
1831 catch (Exception e) {
1832 throw processException(e);
1833 }
1834 finally {
1835 if (list == null) {
1836 list = new ArrayList<SocialRequest>();
1837 }
1838
1839 cacheResult(list);
1840
1841 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_U_S,
1842 finderArgs, list);
1843
1844 closeSession(session);
1845 }
1846 }
1847
1848 return list;
1849 }
1850
1851 public SocialRequest findByU_S_First(long userId, int status,
1852 OrderByComparator orderByComparator)
1853 throws NoSuchRequestException, SystemException {
1854 List<SocialRequest> list = findByU_S(userId, status, 0, 1,
1855 orderByComparator);
1856
1857 if (list.isEmpty()) {
1858 StringBundler msg = new StringBundler(6);
1859
1860 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1861
1862 msg.append("userId=");
1863 msg.append(userId);
1864
1865 msg.append(", status=");
1866 msg.append(status);
1867
1868 msg.append(StringPool.CLOSE_CURLY_BRACE);
1869
1870 throw new NoSuchRequestException(msg.toString());
1871 }
1872 else {
1873 return list.get(0);
1874 }
1875 }
1876
1877 public SocialRequest findByU_S_Last(long userId, int status,
1878 OrderByComparator orderByComparator)
1879 throws NoSuchRequestException, SystemException {
1880 int count = countByU_S(userId, status);
1881
1882 List<SocialRequest> list = findByU_S(userId, status, count - 1, count,
1883 orderByComparator);
1884
1885 if (list.isEmpty()) {
1886 StringBundler msg = new StringBundler(6);
1887
1888 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1889
1890 msg.append("userId=");
1891 msg.append(userId);
1892
1893 msg.append(", status=");
1894 msg.append(status);
1895
1896 msg.append(StringPool.CLOSE_CURLY_BRACE);
1897
1898 throw new NoSuchRequestException(msg.toString());
1899 }
1900 else {
1901 return list.get(0);
1902 }
1903 }
1904
1905 public SocialRequest[] findByU_S_PrevAndNext(long requestId, long userId,
1906 int status, OrderByComparator orderByComparator)
1907 throws NoSuchRequestException, SystemException {
1908 SocialRequest socialRequest = findByPrimaryKey(requestId);
1909
1910 int count = countByU_S(userId, status);
1911
1912 Session session = null;
1913
1914 try {
1915 session = openSession();
1916
1917 StringBundler query = null;
1918
1919 if (orderByComparator != null) {
1920 query = new StringBundler(4 +
1921 (orderByComparator.getOrderByFields().length * 3));
1922 }
1923 else {
1924 query = new StringBundler(4);
1925 }
1926
1927 query.append(_SQL_SELECT_SOCIALREQUEST_WHERE);
1928
1929 query.append(_FINDER_COLUMN_U_S_USERID_2);
1930
1931 query.append(_FINDER_COLUMN_U_S_STATUS_2);
1932
1933 if (orderByComparator != null) {
1934 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1935 orderByComparator);
1936 }
1937
1938 else {
1939 query.append(SocialRequestModelImpl.ORDER_BY_JPQL);
1940 }
1941
1942 String sql = query.toString();
1943
1944 Query q = session.createQuery(sql);
1945
1946 QueryPos qPos = QueryPos.getInstance(q);
1947
1948 qPos.add(userId);
1949
1950 qPos.add(status);
1951
1952 Object[] objArray = QueryUtil.getPrevAndNext(q, count,
1953 orderByComparator, socialRequest);
1954
1955 SocialRequest[] array = new SocialRequestImpl[3];
1956
1957 array[0] = (SocialRequest)objArray[0];
1958 array[1] = (SocialRequest)objArray[1];
1959 array[2] = (SocialRequest)objArray[2];
1960
1961 return array;
1962 }
1963 catch (Exception e) {
1964 throw processException(e);
1965 }
1966 finally {
1967 closeSession(session);
1968 }
1969 }
1970
1971 public List<SocialRequest> findByR_S(long receiverUserId, int status)
1972 throws SystemException {
1973 Object[] finderArgs = new Object[] {
1974 new Long(receiverUserId), new Integer(status)
1975 };
1976
1977 List<SocialRequest> list = (List<SocialRequest>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_R_S,
1978 finderArgs, this);
1979
1980 if (list == null) {
1981 Session session = null;
1982
1983 try {
1984 session = openSession();
1985
1986 StringBundler query = new StringBundler(4);
1987
1988 query.append(_SQL_SELECT_SOCIALREQUEST_WHERE);
1989
1990 query.append(_FINDER_COLUMN_R_S_RECEIVERUSERID_2);
1991
1992 query.append(_FINDER_COLUMN_R_S_STATUS_2);
1993
1994 query.append(SocialRequestModelImpl.ORDER_BY_JPQL);
1995
1996 String sql = query.toString();
1997
1998 Query q = session.createQuery(sql);
1999
2000 QueryPos qPos = QueryPos.getInstance(q);
2001
2002 qPos.add(receiverUserId);
2003
2004 qPos.add(status);
2005
2006 list = q.list();
2007 }
2008 catch (Exception e) {
2009 throw processException(e);
2010 }
2011 finally {
2012 if (list == null) {
2013 list = new ArrayList<SocialRequest>();
2014 }
2015
2016 cacheResult(list);
2017
2018 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_R_S, finderArgs,
2019 list);
2020
2021 closeSession(session);
2022 }
2023 }
2024
2025 return list;
2026 }
2027
2028 public List<SocialRequest> findByR_S(long receiverUserId, int status,
2029 int start, int end) throws SystemException {
2030 return findByR_S(receiverUserId, status, start, end, null);
2031 }
2032
2033 public List<SocialRequest> findByR_S(long receiverUserId, int status,
2034 int start, int end, OrderByComparator orderByComparator)
2035 throws SystemException {
2036 Object[] finderArgs = new Object[] {
2037 new Long(receiverUserId), new Integer(status),
2038
2039 String.valueOf(start), String.valueOf(end),
2040 String.valueOf(orderByComparator)
2041 };
2042
2043 List<SocialRequest> list = (List<SocialRequest>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_R_S,
2044 finderArgs, this);
2045
2046 if (list == null) {
2047 Session session = null;
2048
2049 try {
2050 session = openSession();
2051
2052 StringBundler query = null;
2053
2054 if (orderByComparator != null) {
2055 query = new StringBundler(4 +
2056 (orderByComparator.getOrderByFields().length * 3));
2057 }
2058 else {
2059 query = new StringBundler(4);
2060 }
2061
2062 query.append(_SQL_SELECT_SOCIALREQUEST_WHERE);
2063
2064 query.append(_FINDER_COLUMN_R_S_RECEIVERUSERID_2);
2065
2066 query.append(_FINDER_COLUMN_R_S_STATUS_2);
2067
2068 if (orderByComparator != null) {
2069 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2070 orderByComparator);
2071 }
2072
2073 else {
2074 query.append(SocialRequestModelImpl.ORDER_BY_JPQL);
2075 }
2076
2077 String sql = query.toString();
2078
2079 Query q = session.createQuery(sql);
2080
2081 QueryPos qPos = QueryPos.getInstance(q);
2082
2083 qPos.add(receiverUserId);
2084
2085 qPos.add(status);
2086
2087 list = (List<SocialRequest>)QueryUtil.list(q, getDialect(),
2088 start, end);
2089 }
2090 catch (Exception e) {
2091 throw processException(e);
2092 }
2093 finally {
2094 if (list == null) {
2095 list = new ArrayList<SocialRequest>();
2096 }
2097
2098 cacheResult(list);
2099
2100 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_R_S,
2101 finderArgs, list);
2102
2103 closeSession(session);
2104 }
2105 }
2106
2107 return list;
2108 }
2109
2110 public SocialRequest findByR_S_First(long receiverUserId, int status,
2111 OrderByComparator orderByComparator)
2112 throws NoSuchRequestException, SystemException {
2113 List<SocialRequest> list = findByR_S(receiverUserId, status, 0, 1,
2114 orderByComparator);
2115
2116 if (list.isEmpty()) {
2117 StringBundler msg = new StringBundler(6);
2118
2119 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2120
2121 msg.append("receiverUserId=");
2122 msg.append(receiverUserId);
2123
2124 msg.append(", status=");
2125 msg.append(status);
2126
2127 msg.append(StringPool.CLOSE_CURLY_BRACE);
2128
2129 throw new NoSuchRequestException(msg.toString());
2130 }
2131 else {
2132 return list.get(0);
2133 }
2134 }
2135
2136 public SocialRequest findByR_S_Last(long receiverUserId, int status,
2137 OrderByComparator orderByComparator)
2138 throws NoSuchRequestException, SystemException {
2139 int count = countByR_S(receiverUserId, status);
2140
2141 List<SocialRequest> list = findByR_S(receiverUserId, status, count - 1,
2142 count, orderByComparator);
2143
2144 if (list.isEmpty()) {
2145 StringBundler msg = new StringBundler(6);
2146
2147 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2148
2149 msg.append("receiverUserId=");
2150 msg.append(receiverUserId);
2151
2152 msg.append(", status=");
2153 msg.append(status);
2154
2155 msg.append(StringPool.CLOSE_CURLY_BRACE);
2156
2157 throw new NoSuchRequestException(msg.toString());
2158 }
2159 else {
2160 return list.get(0);
2161 }
2162 }
2163
2164 public SocialRequest[] findByR_S_PrevAndNext(long requestId,
2165 long receiverUserId, int status, OrderByComparator orderByComparator)
2166 throws NoSuchRequestException, SystemException {
2167 SocialRequest socialRequest = findByPrimaryKey(requestId);
2168
2169 int count = countByR_S(receiverUserId, status);
2170
2171 Session session = null;
2172
2173 try {
2174 session = openSession();
2175
2176 StringBundler query = null;
2177
2178 if (orderByComparator != null) {
2179 query = new StringBundler(4 +
2180 (orderByComparator.getOrderByFields().length * 3));
2181 }
2182 else {
2183 query = new StringBundler(4);
2184 }
2185
2186 query.append(_SQL_SELECT_SOCIALREQUEST_WHERE);
2187
2188 query.append(_FINDER_COLUMN_R_S_RECEIVERUSERID_2);
2189
2190 query.append(_FINDER_COLUMN_R_S_STATUS_2);
2191
2192 if (orderByComparator != null) {
2193 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2194 orderByComparator);
2195 }
2196
2197 else {
2198 query.append(SocialRequestModelImpl.ORDER_BY_JPQL);
2199 }
2200
2201 String sql = query.toString();
2202
2203 Query q = session.createQuery(sql);
2204
2205 QueryPos qPos = QueryPos.getInstance(q);
2206
2207 qPos.add(receiverUserId);
2208
2209 qPos.add(status);
2210
2211 Object[] objArray = QueryUtil.getPrevAndNext(q, count,
2212 orderByComparator, socialRequest);
2213
2214 SocialRequest[] array = new SocialRequestImpl[3];
2215
2216 array[0] = (SocialRequest)objArray[0];
2217 array[1] = (SocialRequest)objArray[1];
2218 array[2] = (SocialRequest)objArray[2];
2219
2220 return array;
2221 }
2222 catch (Exception e) {
2223 throw processException(e);
2224 }
2225 finally {
2226 closeSession(session);
2227 }
2228 }
2229
2230 public SocialRequest findByU_C_C_T_R(long userId, long classNameId,
2231 long classPK, int type, long receiverUserId)
2232 throws NoSuchRequestException, SystemException {
2233 SocialRequest socialRequest = fetchByU_C_C_T_R(userId, classNameId,
2234 classPK, type, receiverUserId);
2235
2236 if (socialRequest == null) {
2237 StringBundler msg = new StringBundler(12);
2238
2239 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2240
2241 msg.append("userId=");
2242 msg.append(userId);
2243
2244 msg.append(", classNameId=");
2245 msg.append(classNameId);
2246
2247 msg.append(", classPK=");
2248 msg.append(classPK);
2249
2250 msg.append(", type=");
2251 msg.append(type);
2252
2253 msg.append(", receiverUserId=");
2254 msg.append(receiverUserId);
2255
2256 msg.append(StringPool.CLOSE_CURLY_BRACE);
2257
2258 if (_log.isWarnEnabled()) {
2259 _log.warn(msg.toString());
2260 }
2261
2262 throw new NoSuchRequestException(msg.toString());
2263 }
2264
2265 return socialRequest;
2266 }
2267
2268 public SocialRequest fetchByU_C_C_T_R(long userId, long classNameId,
2269 long classPK, int type, long receiverUserId) throws SystemException {
2270 return fetchByU_C_C_T_R(userId, classNameId, classPK, type,
2271 receiverUserId, true);
2272 }
2273
2274 public SocialRequest fetchByU_C_C_T_R(long userId, long classNameId,
2275 long classPK, int type, long receiverUserId, boolean retrieveFromCache)
2276 throws SystemException {
2277 Object[] finderArgs = new Object[] {
2278 new Long(userId), new Long(classNameId), new Long(classPK),
2279 new Integer(type), new Long(receiverUserId)
2280 };
2281
2282 Object result = null;
2283
2284 if (retrieveFromCache) {
2285 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_U_C_C_T_R,
2286 finderArgs, this);
2287 }
2288
2289 if (result == null) {
2290 Session session = null;
2291
2292 try {
2293 session = openSession();
2294
2295 StringBundler query = new StringBundler(7);
2296
2297 query.append(_SQL_SELECT_SOCIALREQUEST_WHERE);
2298
2299 query.append(_FINDER_COLUMN_U_C_C_T_R_USERID_2);
2300
2301 query.append(_FINDER_COLUMN_U_C_C_T_R_CLASSNAMEID_2);
2302
2303 query.append(_FINDER_COLUMN_U_C_C_T_R_CLASSPK_2);
2304
2305 query.append(_FINDER_COLUMN_U_C_C_T_R_TYPE_2);
2306
2307 query.append(_FINDER_COLUMN_U_C_C_T_R_RECEIVERUSERID_2);
2308
2309 query.append(SocialRequestModelImpl.ORDER_BY_JPQL);
2310
2311 String sql = query.toString();
2312
2313 Query q = session.createQuery(sql);
2314
2315 QueryPos qPos = QueryPos.getInstance(q);
2316
2317 qPos.add(userId);
2318
2319 qPos.add(classNameId);
2320
2321 qPos.add(classPK);
2322
2323 qPos.add(type);
2324
2325 qPos.add(receiverUserId);
2326
2327 List<SocialRequest> list = q.list();
2328
2329 result = list;
2330
2331 SocialRequest socialRequest = null;
2332
2333 if (list.isEmpty()) {
2334 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U_C_C_T_R,
2335 finderArgs, list);
2336 }
2337 else {
2338 socialRequest = list.get(0);
2339
2340 cacheResult(socialRequest);
2341
2342 if ((socialRequest.getUserId() != userId) ||
2343 (socialRequest.getClassNameId() != classNameId) ||
2344 (socialRequest.getClassPK() != classPK) ||
2345 (socialRequest.getType() != type) ||
2346 (socialRequest.getReceiverUserId() != receiverUserId)) {
2347 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U_C_C_T_R,
2348 finderArgs, socialRequest);
2349 }
2350 }
2351
2352 return socialRequest;
2353 }
2354 catch (Exception e) {
2355 throw processException(e);
2356 }
2357 finally {
2358 if (result == null) {
2359 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U_C_C_T_R,
2360 finderArgs, new ArrayList<SocialRequest>());
2361 }
2362
2363 closeSession(session);
2364 }
2365 }
2366 else {
2367 if (result instanceof List<?>) {
2368 return null;
2369 }
2370 else {
2371 return (SocialRequest)result;
2372 }
2373 }
2374 }
2375
2376 public List<SocialRequest> findByU_C_C_T_S(long userId, long classNameId,
2377 long classPK, int type, int status) throws SystemException {
2378 Object[] finderArgs = new Object[] {
2379 new Long(userId), new Long(classNameId), new Long(classPK),
2380 new Integer(type), new Integer(status)
2381 };
2382
2383 List<SocialRequest> list = (List<SocialRequest>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_U_C_C_T_S,
2384 finderArgs, this);
2385
2386 if (list == null) {
2387 Session session = null;
2388
2389 try {
2390 session = openSession();
2391
2392 StringBundler query = new StringBundler(7);
2393
2394 query.append(_SQL_SELECT_SOCIALREQUEST_WHERE);
2395
2396 query.append(_FINDER_COLUMN_U_C_C_T_S_USERID_2);
2397
2398 query.append(_FINDER_COLUMN_U_C_C_T_S_CLASSNAMEID_2);
2399
2400 query.append(_FINDER_COLUMN_U_C_C_T_S_CLASSPK_2);
2401
2402 query.append(_FINDER_COLUMN_U_C_C_T_S_TYPE_2);
2403
2404 query.append(_FINDER_COLUMN_U_C_C_T_S_STATUS_2);
2405
2406 query.append(SocialRequestModelImpl.ORDER_BY_JPQL);
2407
2408 String sql = query.toString();
2409
2410 Query q = session.createQuery(sql);
2411
2412 QueryPos qPos = QueryPos.getInstance(q);
2413
2414 qPos.add(userId);
2415
2416 qPos.add(classNameId);
2417
2418 qPos.add(classPK);
2419
2420 qPos.add(type);
2421
2422 qPos.add(status);
2423
2424 list = q.list();
2425 }
2426 catch (Exception e) {
2427 throw processException(e);
2428 }
2429 finally {
2430 if (list == null) {
2431 list = new ArrayList<SocialRequest>();
2432 }
2433
2434 cacheResult(list);
2435
2436 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_U_C_C_T_S,
2437 finderArgs, list);
2438
2439 closeSession(session);
2440 }
2441 }
2442
2443 return list;
2444 }
2445
2446 public List<SocialRequest> findByU_C_C_T_S(long userId, long classNameId,
2447 long classPK, int type, int status, int start, int end)
2448 throws SystemException {
2449 return findByU_C_C_T_S(userId, classNameId, classPK, type, status,
2450 start, end, null);
2451 }
2452
2453 public List<SocialRequest> findByU_C_C_T_S(long userId, long classNameId,
2454 long classPK, int type, int status, int start, int end,
2455 OrderByComparator orderByComparator) throws SystemException {
2456 Object[] finderArgs = new Object[] {
2457 new Long(userId), new Long(classNameId), new Long(classPK),
2458 new Integer(type), new Integer(status),
2459
2460 String.valueOf(start), String.valueOf(end),
2461 String.valueOf(orderByComparator)
2462 };
2463
2464 List<SocialRequest> list = (List<SocialRequest>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_U_C_C_T_S,
2465 finderArgs, this);
2466
2467 if (list == null) {
2468 Session session = null;
2469
2470 try {
2471 session = openSession();
2472
2473 StringBundler query = null;
2474
2475 if (orderByComparator != null) {
2476 query = new StringBundler(7 +
2477 (orderByComparator.getOrderByFields().length * 3));
2478 }
2479 else {
2480 query = new StringBundler(7);
2481 }
2482
2483 query.append(_SQL_SELECT_SOCIALREQUEST_WHERE);
2484
2485 query.append(_FINDER_COLUMN_U_C_C_T_S_USERID_2);
2486
2487 query.append(_FINDER_COLUMN_U_C_C_T_S_CLASSNAMEID_2);
2488
2489 query.append(_FINDER_COLUMN_U_C_C_T_S_CLASSPK_2);
2490
2491 query.append(_FINDER_COLUMN_U_C_C_T_S_TYPE_2);
2492
2493 query.append(_FINDER_COLUMN_U_C_C_T_S_STATUS_2);
2494
2495 if (orderByComparator != null) {
2496 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2497 orderByComparator);
2498 }
2499
2500 else {
2501 query.append(SocialRequestModelImpl.ORDER_BY_JPQL);
2502 }
2503
2504 String sql = query.toString();
2505
2506 Query q = session.createQuery(sql);
2507
2508 QueryPos qPos = QueryPos.getInstance(q);
2509
2510 qPos.add(userId);
2511
2512 qPos.add(classNameId);
2513
2514 qPos.add(classPK);
2515
2516 qPos.add(type);
2517
2518 qPos.add(status);
2519
2520 list = (List<SocialRequest>)QueryUtil.list(q, getDialect(),
2521 start, end);
2522 }
2523 catch (Exception e) {
2524 throw processException(e);
2525 }
2526 finally {
2527 if (list == null) {
2528 list = new ArrayList<SocialRequest>();
2529 }
2530
2531 cacheResult(list);
2532
2533 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_U_C_C_T_S,
2534 finderArgs, list);
2535
2536 closeSession(session);
2537 }
2538 }
2539
2540 return list;
2541 }
2542
2543 public SocialRequest findByU_C_C_T_S_First(long userId, long classNameId,
2544 long classPK, int type, int status, OrderByComparator orderByComparator)
2545 throws NoSuchRequestException, SystemException {
2546 List<SocialRequest> list = findByU_C_C_T_S(userId, classNameId,
2547 classPK, type, status, 0, 1, orderByComparator);
2548
2549 if (list.isEmpty()) {
2550 StringBundler msg = new StringBundler(12);
2551
2552 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2553
2554 msg.append("userId=");
2555 msg.append(userId);
2556
2557 msg.append(", classNameId=");
2558 msg.append(classNameId);
2559
2560 msg.append(", classPK=");
2561 msg.append(classPK);
2562
2563 msg.append(", type=");
2564 msg.append(type);
2565
2566 msg.append(", status=");
2567 msg.append(status);
2568
2569 msg.append(StringPool.CLOSE_CURLY_BRACE);
2570
2571 throw new NoSuchRequestException(msg.toString());
2572 }
2573 else {
2574 return list.get(0);
2575 }
2576 }
2577
2578 public SocialRequest findByU_C_C_T_S_Last(long userId, long classNameId,
2579 long classPK, int type, int status, OrderByComparator orderByComparator)
2580 throws NoSuchRequestException, SystemException {
2581 int count = countByU_C_C_T_S(userId, classNameId, classPK, type, status);
2582
2583 List<SocialRequest> list = findByU_C_C_T_S(userId, classNameId,
2584 classPK, type, status, count - 1, count, orderByComparator);
2585
2586 if (list.isEmpty()) {
2587 StringBundler msg = new StringBundler(12);
2588
2589 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2590
2591 msg.append("userId=");
2592 msg.append(userId);
2593
2594 msg.append(", classNameId=");
2595 msg.append(classNameId);
2596
2597 msg.append(", classPK=");
2598 msg.append(classPK);
2599
2600 msg.append(", type=");
2601 msg.append(type);
2602
2603 msg.append(", status=");
2604 msg.append(status);
2605
2606 msg.append(StringPool.CLOSE_CURLY_BRACE);
2607
2608 throw new NoSuchRequestException(msg.toString());
2609 }
2610 else {
2611 return list.get(0);
2612 }
2613 }
2614
2615 public SocialRequest[] findByU_C_C_T_S_PrevAndNext(long requestId,
2616 long userId, long classNameId, long classPK, int type, int status,
2617 OrderByComparator orderByComparator)
2618 throws NoSuchRequestException, SystemException {
2619 SocialRequest socialRequest = findByPrimaryKey(requestId);
2620
2621 int count = countByU_C_C_T_S(userId, classNameId, classPK, type, status);
2622
2623 Session session = null;
2624
2625 try {
2626 session = openSession();
2627
2628 StringBundler query = null;
2629
2630 if (orderByComparator != null) {
2631 query = new StringBundler(7 +
2632 (orderByComparator.getOrderByFields().length * 3));
2633 }
2634 else {
2635 query = new StringBundler(7);
2636 }
2637
2638 query.append(_SQL_SELECT_SOCIALREQUEST_WHERE);
2639
2640 query.append(_FINDER_COLUMN_U_C_C_T_S_USERID_2);
2641
2642 query.append(_FINDER_COLUMN_U_C_C_T_S_CLASSNAMEID_2);
2643
2644 query.append(_FINDER_COLUMN_U_C_C_T_S_CLASSPK_2);
2645
2646 query.append(_FINDER_COLUMN_U_C_C_T_S_TYPE_2);
2647
2648 query.append(_FINDER_COLUMN_U_C_C_T_S_STATUS_2);
2649
2650 if (orderByComparator != null) {
2651 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2652 orderByComparator);
2653 }
2654
2655 else {
2656 query.append(SocialRequestModelImpl.ORDER_BY_JPQL);
2657 }
2658
2659 String sql = query.toString();
2660
2661 Query q = session.createQuery(sql);
2662
2663 QueryPos qPos = QueryPos.getInstance(q);
2664
2665 qPos.add(userId);
2666
2667 qPos.add(classNameId);
2668
2669 qPos.add(classPK);
2670
2671 qPos.add(type);
2672
2673 qPos.add(status);
2674
2675 Object[] objArray = QueryUtil.getPrevAndNext(q, count,
2676 orderByComparator, socialRequest);
2677
2678 SocialRequest[] array = new SocialRequestImpl[3];
2679
2680 array[0] = (SocialRequest)objArray[0];
2681 array[1] = (SocialRequest)objArray[1];
2682 array[2] = (SocialRequest)objArray[2];
2683
2684 return array;
2685 }
2686 catch (Exception e) {
2687 throw processException(e);
2688 }
2689 finally {
2690 closeSession(session);
2691 }
2692 }
2693
2694 public List<SocialRequest> findByC_C_T_R_S(long classNameId, long classPK,
2695 int type, long receiverUserId, int status) throws SystemException {
2696 Object[] finderArgs = new Object[] {
2697 new Long(classNameId), new Long(classPK), new Integer(type),
2698 new Long(receiverUserId), new Integer(status)
2699 };
2700
2701 List<SocialRequest> list = (List<SocialRequest>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_C_T_R_S,
2702 finderArgs, this);
2703
2704 if (list == null) {
2705 Session session = null;
2706
2707 try {
2708 session = openSession();
2709
2710 StringBundler query = new StringBundler(7);
2711
2712 query.append(_SQL_SELECT_SOCIALREQUEST_WHERE);
2713
2714 query.append(_FINDER_COLUMN_C_C_T_R_S_CLASSNAMEID_2);
2715
2716 query.append(_FINDER_COLUMN_C_C_T_R_S_CLASSPK_2);
2717
2718 query.append(_FINDER_COLUMN_C_C_T_R_S_TYPE_2);
2719
2720 query.append(_FINDER_COLUMN_C_C_T_R_S_RECEIVERUSERID_2);
2721
2722 query.append(_FINDER_COLUMN_C_C_T_R_S_STATUS_2);
2723
2724 query.append(SocialRequestModelImpl.ORDER_BY_JPQL);
2725
2726 String sql = query.toString();
2727
2728 Query q = session.createQuery(sql);
2729
2730 QueryPos qPos = QueryPos.getInstance(q);
2731
2732 qPos.add(classNameId);
2733
2734 qPos.add(classPK);
2735
2736 qPos.add(type);
2737
2738 qPos.add(receiverUserId);
2739
2740 qPos.add(status);
2741
2742 list = q.list();
2743 }
2744 catch (Exception e) {
2745 throw processException(e);
2746 }
2747 finally {
2748 if (list == null) {
2749 list = new ArrayList<SocialRequest>();
2750 }
2751
2752 cacheResult(list);
2753
2754 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_C_T_R_S,
2755 finderArgs, list);
2756
2757 closeSession(session);
2758 }
2759 }
2760
2761 return list;
2762 }
2763
2764 public List<SocialRequest> findByC_C_T_R_S(long classNameId, long classPK,
2765 int type, long receiverUserId, int status, int start, int end)
2766 throws SystemException {
2767 return findByC_C_T_R_S(classNameId, classPK, type, receiverUserId,
2768 status, start, end, null);
2769 }
2770
2771 public List<SocialRequest> findByC_C_T_R_S(long classNameId, long classPK,
2772 int type, long receiverUserId, int status, int start, int end,
2773 OrderByComparator orderByComparator) throws SystemException {
2774 Object[] finderArgs = new Object[] {
2775 new Long(classNameId), new Long(classPK), new Integer(type),
2776 new Long(receiverUserId), new Integer(status),
2777
2778 String.valueOf(start), String.valueOf(end),
2779 String.valueOf(orderByComparator)
2780 };
2781
2782 List<SocialRequest> list = (List<SocialRequest>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_C_C_T_R_S,
2783 finderArgs, this);
2784
2785 if (list == null) {
2786 Session session = null;
2787
2788 try {
2789 session = openSession();
2790
2791 StringBundler query = null;
2792
2793 if (orderByComparator != null) {
2794 query = new StringBundler(7 +
2795 (orderByComparator.getOrderByFields().length * 3));
2796 }
2797 else {
2798 query = new StringBundler(7);
2799 }
2800
2801 query.append(_SQL_SELECT_SOCIALREQUEST_WHERE);
2802
2803 query.append(_FINDER_COLUMN_C_C_T_R_S_CLASSNAMEID_2);
2804
2805 query.append(_FINDER_COLUMN_C_C_T_R_S_CLASSPK_2);
2806
2807 query.append(_FINDER_COLUMN_C_C_T_R_S_TYPE_2);
2808
2809 query.append(_FINDER_COLUMN_C_C_T_R_S_RECEIVERUSERID_2);
2810
2811 query.append(_FINDER_COLUMN_C_C_T_R_S_STATUS_2);
2812
2813 if (orderByComparator != null) {
2814 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2815 orderByComparator);
2816 }
2817
2818 else {
2819 query.append(SocialRequestModelImpl.ORDER_BY_JPQL);
2820 }
2821
2822 String sql = query.toString();
2823
2824 Query q = session.createQuery(sql);
2825
2826 QueryPos qPos = QueryPos.getInstance(q);
2827
2828 qPos.add(classNameId);
2829
2830 qPos.add(classPK);
2831
2832 qPos.add(type);
2833
2834 qPos.add(receiverUserId);
2835
2836 qPos.add(status);
2837
2838 list = (List<SocialRequest>)QueryUtil.list(q, getDialect(),
2839 start, end);
2840 }
2841 catch (Exception e) {
2842 throw processException(e);
2843 }
2844 finally {
2845 if (list == null) {
2846 list = new ArrayList<SocialRequest>();
2847 }
2848
2849 cacheResult(list);
2850
2851 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_C_C_T_R_S,
2852 finderArgs, list);
2853
2854 closeSession(session);
2855 }
2856 }
2857
2858 return list;
2859 }
2860
2861 public SocialRequest findByC_C_T_R_S_First(long classNameId, long classPK,
2862 int type, long receiverUserId, int status,
2863 OrderByComparator orderByComparator)
2864 throws NoSuchRequestException, SystemException {
2865 List<SocialRequest> list = findByC_C_T_R_S(classNameId, classPK, type,
2866 receiverUserId, status, 0, 1, orderByComparator);
2867
2868 if (list.isEmpty()) {
2869 StringBundler msg = new StringBundler(12);
2870
2871 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2872
2873 msg.append("classNameId=");
2874 msg.append(classNameId);
2875
2876 msg.append(", classPK=");
2877 msg.append(classPK);
2878
2879 msg.append(", type=");
2880 msg.append(type);
2881
2882 msg.append(", receiverUserId=");
2883 msg.append(receiverUserId);
2884
2885 msg.append(", status=");
2886 msg.append(status);
2887
2888 msg.append(StringPool.CLOSE_CURLY_BRACE);
2889
2890 throw new NoSuchRequestException(msg.toString());
2891 }
2892 else {
2893 return list.get(0);
2894 }
2895 }
2896
2897 public SocialRequest findByC_C_T_R_S_Last(long classNameId, long classPK,
2898 int type, long receiverUserId, int status,
2899 OrderByComparator orderByComparator)
2900 throws NoSuchRequestException, SystemException {
2901 int count = countByC_C_T_R_S(classNameId, classPK, type,
2902 receiverUserId, status);
2903
2904 List<SocialRequest> list = findByC_C_T_R_S(classNameId, classPK, type,
2905 receiverUserId, status, count - 1, count, orderByComparator);
2906
2907 if (list.isEmpty()) {
2908 StringBundler msg = new StringBundler(12);
2909
2910 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2911
2912 msg.append("classNameId=");
2913 msg.append(classNameId);
2914
2915 msg.append(", classPK=");
2916 msg.append(classPK);
2917
2918 msg.append(", type=");
2919 msg.append(type);
2920
2921 msg.append(", receiverUserId=");
2922 msg.append(receiverUserId);
2923
2924 msg.append(", status=");
2925 msg.append(status);
2926
2927 msg.append(StringPool.CLOSE_CURLY_BRACE);
2928
2929 throw new NoSuchRequestException(msg.toString());
2930 }
2931 else {
2932 return list.get(0);
2933 }
2934 }
2935
2936 public SocialRequest[] findByC_C_T_R_S_PrevAndNext(long requestId,
2937 long classNameId, long classPK, int type, long receiverUserId,
2938 int status, OrderByComparator orderByComparator)
2939 throws NoSuchRequestException, SystemException {
2940 SocialRequest socialRequest = findByPrimaryKey(requestId);
2941
2942 int count = countByC_C_T_R_S(classNameId, classPK, type,
2943 receiverUserId, status);
2944
2945 Session session = null;
2946
2947 try {
2948 session = openSession();
2949
2950 StringBundler query = null;
2951
2952 if (orderByComparator != null) {
2953 query = new StringBundler(7 +
2954 (orderByComparator.getOrderByFields().length * 3));
2955 }
2956 else {
2957 query = new StringBundler(7);
2958 }
2959
2960 query.append(_SQL_SELECT_SOCIALREQUEST_WHERE);
2961
2962 query.append(_FINDER_COLUMN_C_C_T_R_S_CLASSNAMEID_2);
2963
2964 query.append(_FINDER_COLUMN_C_C_T_R_S_CLASSPK_2);
2965
2966 query.append(_FINDER_COLUMN_C_C_T_R_S_TYPE_2);
2967
2968 query.append(_FINDER_COLUMN_C_C_T_R_S_RECEIVERUSERID_2);
2969
2970 query.append(_FINDER_COLUMN_C_C_T_R_S_STATUS_2);
2971
2972 if (orderByComparator != null) {
2973 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2974 orderByComparator);
2975 }
2976
2977 else {
2978 query.append(SocialRequestModelImpl.ORDER_BY_JPQL);
2979 }
2980
2981 String sql = query.toString();
2982
2983 Query q = session.createQuery(sql);
2984
2985 QueryPos qPos = QueryPos.getInstance(q);
2986
2987 qPos.add(classNameId);
2988
2989 qPos.add(classPK);
2990
2991 qPos.add(type);
2992
2993 qPos.add(receiverUserId);
2994
2995 qPos.add(status);
2996
2997 Object[] objArray = QueryUtil.getPrevAndNext(q, count,
2998 orderByComparator, socialRequest);
2999
3000 SocialRequest[] array = new SocialRequestImpl[3];
3001
3002 array[0] = (SocialRequest)objArray[0];
3003 array[1] = (SocialRequest)objArray[1];
3004 array[2] = (SocialRequest)objArray[2];
3005
3006 return array;
3007 }
3008 catch (Exception e) {
3009 throw processException(e);
3010 }
3011 finally {
3012 closeSession(session);
3013 }
3014 }
3015
3016 public List<SocialRequest> findAll() throws SystemException {
3017 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
3018 }
3019
3020 public List<SocialRequest> findAll(int start, int end)
3021 throws SystemException {
3022 return findAll(start, end, null);
3023 }
3024
3025 public List<SocialRequest> findAll(int start, int end,
3026 OrderByComparator orderByComparator) throws SystemException {
3027 Object[] finderArgs = new Object[] {
3028 String.valueOf(start), String.valueOf(end),
3029 String.valueOf(orderByComparator)
3030 };
3031
3032 List<SocialRequest> list = (List<SocialRequest>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
3033 finderArgs, this);
3034
3035 if (list == null) {
3036 Session session = null;
3037
3038 try {
3039 session = openSession();
3040
3041 StringBundler query = null;
3042 String sql = null;
3043
3044 if (orderByComparator != null) {
3045 query = new StringBundler(2 +
3046 (orderByComparator.getOrderByFields().length * 3));
3047
3048 query.append(_SQL_SELECT_SOCIALREQUEST);
3049
3050 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3051 orderByComparator);
3052
3053 sql = query.toString();
3054 }
3055
3056 else {
3057 sql = _SQL_SELECT_SOCIALREQUEST.concat(SocialRequestModelImpl.ORDER_BY_JPQL);
3058 }
3059
3060 Query q = session.createQuery(sql);
3061
3062 if (orderByComparator == null) {
3063 list = (List<SocialRequest>)QueryUtil.list(q, getDialect(),
3064 start, end, false);
3065
3066 Collections.sort(list);
3067 }
3068 else {
3069 list = (List<SocialRequest>)QueryUtil.list(q, getDialect(),
3070 start, end);
3071 }
3072 }
3073 catch (Exception e) {
3074 throw processException(e);
3075 }
3076 finally {
3077 if (list == null) {
3078 list = new ArrayList<SocialRequest>();
3079 }
3080
3081 cacheResult(list);
3082
3083 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
3084
3085 closeSession(session);
3086 }
3087 }
3088
3089 return list;
3090 }
3091
3092 public void removeByUuid(String uuid) throws SystemException {
3093 for (SocialRequest socialRequest : findByUuid(uuid)) {
3094 remove(socialRequest);
3095 }
3096 }
3097
3098 public void removeByUUID_G(String uuid, long groupId)
3099 throws NoSuchRequestException, SystemException {
3100 SocialRequest socialRequest = findByUUID_G(uuid, groupId);
3101
3102 remove(socialRequest);
3103 }
3104
3105 public void removeByCompanyId(long companyId) throws SystemException {
3106 for (SocialRequest socialRequest : findByCompanyId(companyId)) {
3107 remove(socialRequest);
3108 }
3109 }
3110
3111 public void removeByUserId(long userId) throws SystemException {
3112 for (SocialRequest socialRequest : findByUserId(userId)) {
3113 remove(socialRequest);
3114 }
3115 }
3116
3117 public void removeByReceiverUserId(long receiverUserId)
3118 throws SystemException {
3119 for (SocialRequest socialRequest : findByReceiverUserId(receiverUserId)) {
3120 remove(socialRequest);
3121 }
3122 }
3123
3124 public void removeByU_S(long userId, int status) throws SystemException {
3125 for (SocialRequest socialRequest : findByU_S(userId, status)) {
3126 remove(socialRequest);
3127 }
3128 }
3129
3130 public void removeByR_S(long receiverUserId, int status)
3131 throws SystemException {
3132 for (SocialRequest socialRequest : findByR_S(receiverUserId, status)) {
3133 remove(socialRequest);
3134 }
3135 }
3136
3137 public void removeByU_C_C_T_R(long userId, long classNameId, long classPK,
3138 int type, long receiverUserId)
3139 throws NoSuchRequestException, SystemException {
3140 SocialRequest socialRequest = findByU_C_C_T_R(userId, classNameId,
3141 classPK, type, receiverUserId);
3142
3143 remove(socialRequest);
3144 }
3145
3146 public void removeByU_C_C_T_S(long userId, long classNameId, long classPK,
3147 int type, int status) throws SystemException {
3148 for (SocialRequest socialRequest : findByU_C_C_T_S(userId, classNameId,
3149 classPK, type, status)) {
3150 remove(socialRequest);
3151 }
3152 }
3153
3154 public void removeByC_C_T_R_S(long classNameId, long classPK, int type,
3155 long receiverUserId, int status) throws SystemException {
3156 for (SocialRequest socialRequest : findByC_C_T_R_S(classNameId,
3157 classPK, type, receiverUserId, status)) {
3158 remove(socialRequest);
3159 }
3160 }
3161
3162 public void removeAll() throws SystemException {
3163 for (SocialRequest socialRequest : findAll()) {
3164 remove(socialRequest);
3165 }
3166 }
3167
3168 public int countByUuid(String uuid) throws SystemException {
3169 Object[] finderArgs = new Object[] { uuid };
3170
3171 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
3172 finderArgs, this);
3173
3174 if (count == null) {
3175 Session session = null;
3176
3177 try {
3178 session = openSession();
3179
3180 StringBundler query = new StringBundler(2);
3181
3182 query.append(_SQL_COUNT_SOCIALREQUEST_WHERE);
3183
3184 if (uuid == null) {
3185 query.append(_FINDER_COLUMN_UUID_UUID_1);
3186 }
3187 else {
3188 if (uuid.equals(StringPool.BLANK)) {
3189 query.append(_FINDER_COLUMN_UUID_UUID_3);
3190 }
3191 else {
3192 query.append(_FINDER_COLUMN_UUID_UUID_2);
3193 }
3194 }
3195
3196 String sql = query.toString();
3197
3198 Query q = session.createQuery(sql);
3199
3200 QueryPos qPos = QueryPos.getInstance(q);
3201
3202 if (uuid != null) {
3203 qPos.add(uuid);
3204 }
3205
3206 count = (Long)q.uniqueResult();
3207 }
3208 catch (Exception e) {
3209 throw processException(e);
3210 }
3211 finally {
3212 if (count == null) {
3213 count = Long.valueOf(0);
3214 }
3215
3216 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
3217 finderArgs, count);
3218
3219 closeSession(session);
3220 }
3221 }
3222
3223 return count.intValue();
3224 }
3225
3226 public int countByUUID_G(String uuid, long groupId)
3227 throws SystemException {
3228 Object[] finderArgs = new Object[] { uuid, new Long(groupId) };
3229
3230 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
3231 finderArgs, this);
3232
3233 if (count == null) {
3234 Session session = null;
3235
3236 try {
3237 session = openSession();
3238
3239 StringBundler query = new StringBundler(3);
3240
3241 query.append(_SQL_COUNT_SOCIALREQUEST_WHERE);
3242
3243 if (uuid == null) {
3244 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
3245 }
3246 else {
3247 if (uuid.equals(StringPool.BLANK)) {
3248 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
3249 }
3250 else {
3251 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
3252 }
3253 }
3254
3255 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
3256
3257 String sql = query.toString();
3258
3259 Query q = session.createQuery(sql);
3260
3261 QueryPos qPos = QueryPos.getInstance(q);
3262
3263 if (uuid != null) {
3264 qPos.add(uuid);
3265 }
3266
3267 qPos.add(groupId);
3268
3269 count = (Long)q.uniqueResult();
3270 }
3271 catch (Exception e) {
3272 throw processException(e);
3273 }
3274 finally {
3275 if (count == null) {
3276 count = Long.valueOf(0);
3277 }
3278
3279 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
3280 finderArgs, count);
3281
3282 closeSession(session);
3283 }
3284 }
3285
3286 return count.intValue();
3287 }
3288
3289 public int countByCompanyId(long companyId) throws SystemException {
3290 Object[] finderArgs = new Object[] { new Long(companyId) };
3291
3292 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
3293 finderArgs, this);
3294
3295 if (count == null) {
3296 Session session = null;
3297
3298 try {
3299 session = openSession();
3300
3301 StringBundler query = new StringBundler(2);
3302
3303 query.append(_SQL_COUNT_SOCIALREQUEST_WHERE);
3304
3305 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
3306
3307 String sql = query.toString();
3308
3309 Query q = session.createQuery(sql);
3310
3311 QueryPos qPos = QueryPos.getInstance(q);
3312
3313 qPos.add(companyId);
3314
3315 count = (Long)q.uniqueResult();
3316 }
3317 catch (Exception e) {
3318 throw processException(e);
3319 }
3320 finally {
3321 if (count == null) {
3322 count = Long.valueOf(0);
3323 }
3324
3325 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
3326 finderArgs, count);
3327
3328 closeSession(session);
3329 }
3330 }
3331
3332 return count.intValue();
3333 }
3334
3335 public int countByUserId(long userId) throws SystemException {
3336 Object[] finderArgs = new Object[] { new Long(userId) };
3337
3338 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERID,
3339 finderArgs, this);
3340
3341 if (count == null) {
3342 Session session = null;
3343
3344 try {
3345 session = openSession();
3346
3347 StringBundler query = new StringBundler(2);
3348
3349 query.append(_SQL_COUNT_SOCIALREQUEST_WHERE);
3350
3351 query.append(_FINDER_COLUMN_USERID_USERID_2);
3352
3353 String sql = query.toString();
3354
3355 Query q = session.createQuery(sql);
3356
3357 QueryPos qPos = QueryPos.getInstance(q);
3358
3359 qPos.add(userId);
3360
3361 count = (Long)q.uniqueResult();
3362 }
3363 catch (Exception e) {
3364 throw processException(e);
3365 }
3366 finally {
3367 if (count == null) {
3368 count = Long.valueOf(0);
3369 }
3370
3371 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERID,
3372 finderArgs, count);
3373
3374 closeSession(session);
3375 }
3376 }
3377
3378 return count.intValue();
3379 }
3380
3381 public int countByReceiverUserId(long receiverUserId)
3382 throws SystemException {
3383 Object[] finderArgs = new Object[] { new Long(receiverUserId) };
3384
3385 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_RECEIVERUSERID,
3386 finderArgs, this);
3387
3388 if (count == null) {
3389 Session session = null;
3390
3391 try {
3392 session = openSession();
3393
3394 StringBundler query = new StringBundler(2);
3395
3396 query.append(_SQL_COUNT_SOCIALREQUEST_WHERE);
3397
3398 query.append(_FINDER_COLUMN_RECEIVERUSERID_RECEIVERUSERID_2);
3399
3400 String sql = query.toString();
3401
3402 Query q = session.createQuery(sql);
3403
3404 QueryPos qPos = QueryPos.getInstance(q);
3405
3406 qPos.add(receiverUserId);
3407
3408 count = (Long)q.uniqueResult();
3409 }
3410 catch (Exception e) {
3411 throw processException(e);
3412 }
3413 finally {
3414 if (count == null) {
3415 count = Long.valueOf(0);
3416 }
3417
3418 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_RECEIVERUSERID,
3419 finderArgs, count);
3420
3421 closeSession(session);
3422 }
3423 }
3424
3425 return count.intValue();
3426 }
3427
3428 public int countByU_S(long userId, int status) throws SystemException {
3429 Object[] finderArgs = new Object[] { new Long(userId), new Integer(status) };
3430
3431 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_U_S,
3432 finderArgs, this);
3433
3434 if (count == null) {
3435 Session session = null;
3436
3437 try {
3438 session = openSession();
3439
3440 StringBundler query = new StringBundler(3);
3441
3442 query.append(_SQL_COUNT_SOCIALREQUEST_WHERE);
3443
3444 query.append(_FINDER_COLUMN_U_S_USERID_2);
3445
3446 query.append(_FINDER_COLUMN_U_S_STATUS_2);
3447
3448 String sql = query.toString();
3449
3450 Query q = session.createQuery(sql);
3451
3452 QueryPos qPos = QueryPos.getInstance(q);
3453
3454 qPos.add(userId);
3455
3456 qPos.add(status);
3457
3458 count = (Long)q.uniqueResult();
3459 }
3460 catch (Exception e) {
3461 throw processException(e);
3462 }
3463 finally {
3464 if (count == null) {
3465 count = Long.valueOf(0);
3466 }
3467
3468 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_U_S, finderArgs,
3469 count);
3470
3471 closeSession(session);
3472 }
3473 }
3474
3475 return count.intValue();
3476 }
3477
3478 public int countByR_S(long receiverUserId, int status)
3479 throws SystemException {
3480 Object[] finderArgs = new Object[] {
3481 new Long(receiverUserId), new Integer(status)
3482 };
3483
3484 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_R_S,
3485 finderArgs, this);
3486
3487 if (count == null) {
3488 Session session = null;
3489
3490 try {
3491 session = openSession();
3492
3493 StringBundler query = new StringBundler(3);
3494
3495 query.append(_SQL_COUNT_SOCIALREQUEST_WHERE);
3496
3497 query.append(_FINDER_COLUMN_R_S_RECEIVERUSERID_2);
3498
3499 query.append(_FINDER_COLUMN_R_S_STATUS_2);
3500
3501 String sql = query.toString();
3502
3503 Query q = session.createQuery(sql);
3504
3505 QueryPos qPos = QueryPos.getInstance(q);
3506
3507 qPos.add(receiverUserId);
3508
3509 qPos.add(status);
3510
3511 count = (Long)q.uniqueResult();
3512 }
3513 catch (Exception e) {
3514 throw processException(e);
3515 }
3516 finally {
3517 if (count == null) {
3518 count = Long.valueOf(0);
3519 }
3520
3521 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_R_S, finderArgs,
3522 count);
3523
3524 closeSession(session);
3525 }
3526 }
3527
3528 return count.intValue();
3529 }
3530
3531 public int countByU_C_C_T_R(long userId, long classNameId, long classPK,
3532 int type, long receiverUserId) throws SystemException {
3533 Object[] finderArgs = new Object[] {
3534 new Long(userId), new Long(classNameId), new Long(classPK),
3535 new Integer(type), new Long(receiverUserId)
3536 };
3537
3538 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_U_C_C_T_R,
3539 finderArgs, this);
3540
3541 if (count == null) {
3542 Session session = null;
3543
3544 try {
3545 session = openSession();
3546
3547 StringBundler query = new StringBundler(6);
3548
3549 query.append(_SQL_COUNT_SOCIALREQUEST_WHERE);
3550
3551 query.append(_FINDER_COLUMN_U_C_C_T_R_USERID_2);
3552
3553 query.append(_FINDER_COLUMN_U_C_C_T_R_CLASSNAMEID_2);
3554
3555 query.append(_FINDER_COLUMN_U_C_C_T_R_CLASSPK_2);
3556
3557 query.append(_FINDER_COLUMN_U_C_C_T_R_TYPE_2);
3558
3559 query.append(_FINDER_COLUMN_U_C_C_T_R_RECEIVERUSERID_2);
3560
3561 String sql = query.toString();
3562
3563 Query q = session.createQuery(sql);
3564
3565 QueryPos qPos = QueryPos.getInstance(q);
3566
3567 qPos.add(userId);
3568
3569 qPos.add(classNameId);
3570
3571 qPos.add(classPK);
3572
3573 qPos.add(type);
3574
3575 qPos.add(receiverUserId);
3576
3577 count = (Long)q.uniqueResult();
3578 }
3579 catch (Exception e) {
3580 throw processException(e);
3581 }
3582 finally {
3583 if (count == null) {
3584 count = Long.valueOf(0);
3585 }
3586
3587 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_U_C_C_T_R,
3588 finderArgs, count);
3589
3590 closeSession(session);
3591 }
3592 }
3593
3594 return count.intValue();
3595 }
3596
3597 public int countByU_C_C_T_S(long userId, long classNameId, long classPK,
3598 int type, int status) throws SystemException {
3599 Object[] finderArgs = new Object[] {
3600 new Long(userId), new Long(classNameId), new Long(classPK),
3601 new Integer(type), new Integer(status)
3602 };
3603
3604 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_U_C_C_T_S,
3605 finderArgs, this);
3606
3607 if (count == null) {
3608 Session session = null;
3609
3610 try {
3611 session = openSession();
3612
3613 StringBundler query = new StringBundler(6);
3614
3615 query.append(_SQL_COUNT_SOCIALREQUEST_WHERE);
3616
3617 query.append(_FINDER_COLUMN_U_C_C_T_S_USERID_2);
3618
3619 query.append(_FINDER_COLUMN_U_C_C_T_S_CLASSNAMEID_2);
3620
3621 query.append(_FINDER_COLUMN_U_C_C_T_S_CLASSPK_2);
3622
3623 query.append(_FINDER_COLUMN_U_C_C_T_S_TYPE_2);
3624
3625 query.append(_FINDER_COLUMN_U_C_C_T_S_STATUS_2);
3626
3627 String sql = query.toString();
3628
3629 Query q = session.createQuery(sql);
3630
3631 QueryPos qPos = QueryPos.getInstance(q);
3632
3633 qPos.add(userId);
3634
3635 qPos.add(classNameId);
3636
3637 qPos.add(classPK);
3638
3639 qPos.add(type);
3640
3641 qPos.add(status);
3642
3643 count = (Long)q.uniqueResult();
3644 }
3645 catch (Exception e) {
3646 throw processException(e);
3647 }
3648 finally {
3649 if (count == null) {
3650 count = Long.valueOf(0);
3651 }
3652
3653 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_U_C_C_T_S,
3654 finderArgs, count);
3655
3656 closeSession(session);
3657 }
3658 }
3659
3660 return count.intValue();
3661 }
3662
3663 public int countByC_C_T_R_S(long classNameId, long classPK, int type,
3664 long receiverUserId, int status) throws SystemException {
3665 Object[] finderArgs = new Object[] {
3666 new Long(classNameId), new Long(classPK), new Integer(type),
3667 new Long(receiverUserId), new Integer(status)
3668 };
3669
3670 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C_T_R_S,
3671 finderArgs, this);
3672
3673 if (count == null) {
3674 Session session = null;
3675
3676 try {
3677 session = openSession();
3678
3679 StringBundler query = new StringBundler(6);
3680
3681 query.append(_SQL_COUNT_SOCIALREQUEST_WHERE);
3682
3683 query.append(_FINDER_COLUMN_C_C_T_R_S_CLASSNAMEID_2);
3684
3685 query.append(_FINDER_COLUMN_C_C_T_R_S_CLASSPK_2);
3686
3687 query.append(_FINDER_COLUMN_C_C_T_R_S_TYPE_2);
3688
3689 query.append(_FINDER_COLUMN_C_C_T_R_S_RECEIVERUSERID_2);
3690
3691 query.append(_FINDER_COLUMN_C_C_T_R_S_STATUS_2);
3692
3693 String sql = query.toString();
3694
3695 Query q = session.createQuery(sql);
3696
3697 QueryPos qPos = QueryPos.getInstance(q);
3698
3699 qPos.add(classNameId);
3700
3701 qPos.add(classPK);
3702
3703 qPos.add(type);
3704
3705 qPos.add(receiverUserId);
3706
3707 qPos.add(status);
3708
3709 count = (Long)q.uniqueResult();
3710 }
3711 catch (Exception e) {
3712 throw processException(e);
3713 }
3714 finally {
3715 if (count == null) {
3716 count = Long.valueOf(0);
3717 }
3718
3719 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C_T_R_S,
3720 finderArgs, count);
3721
3722 closeSession(session);
3723 }
3724 }
3725
3726 return count.intValue();
3727 }
3728
3729 public int countAll() throws SystemException {
3730 Object[] finderArgs = new Object[0];
3731
3732 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3733 finderArgs, this);
3734
3735 if (count == null) {
3736 Session session = null;
3737
3738 try {
3739 session = openSession();
3740
3741 Query q = session.createQuery(_SQL_COUNT_SOCIALREQUEST);
3742
3743 count = (Long)q.uniqueResult();
3744 }
3745 catch (Exception e) {
3746 throw processException(e);
3747 }
3748 finally {
3749 if (count == null) {
3750 count = Long.valueOf(0);
3751 }
3752
3753 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
3754 count);
3755
3756 closeSession(session);
3757 }
3758 }
3759
3760 return count.intValue();
3761 }
3762
3763 public void afterPropertiesSet() {
3764 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3765 com.liferay.portal.util.PropsUtil.get(
3766 "value.object.listener.com.liferay.portlet.social.model.SocialRequest")));
3767
3768 if (listenerClassNames.length > 0) {
3769 try {
3770 List<ModelListener<SocialRequest>> listenersList = new ArrayList<ModelListener<SocialRequest>>();
3771
3772 for (String listenerClassName : listenerClassNames) {
3773 listenersList.add((ModelListener<SocialRequest>)Class.forName(
3774 listenerClassName).newInstance());
3775 }
3776
3777 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3778 }
3779 catch (Exception e) {
3780 _log.error(e);
3781 }
3782 }
3783 }
3784
3785 @BeanReference(type = SocialActivityPersistence.class)
3786 protected SocialActivityPersistence socialActivityPersistence;
3787 @BeanReference(type = SocialRelationPersistence.class)
3788 protected SocialRelationPersistence socialRelationPersistence;
3789 @BeanReference(type = SocialRequestPersistence.class)
3790 protected SocialRequestPersistence socialRequestPersistence;
3791 @BeanReference(type = ResourcePersistence.class)
3792 protected ResourcePersistence resourcePersistence;
3793 @BeanReference(type = UserPersistence.class)
3794 protected UserPersistence userPersistence;
3795 private static final String _SQL_SELECT_SOCIALREQUEST = "SELECT socialRequest FROM SocialRequest socialRequest";
3796 private static final String _SQL_SELECT_SOCIALREQUEST_WHERE = "SELECT socialRequest FROM SocialRequest socialRequest WHERE ";
3797 private static final String _SQL_COUNT_SOCIALREQUEST = "SELECT COUNT(socialRequest) FROM SocialRequest socialRequest";
3798 private static final String _SQL_COUNT_SOCIALREQUEST_WHERE = "SELECT COUNT(socialRequest) FROM SocialRequest socialRequest WHERE ";
3799 private static final String _FINDER_COLUMN_UUID_UUID_1 = "socialRequest.uuid IS NULL";
3800 private static final String _FINDER_COLUMN_UUID_UUID_2 = "socialRequest.uuid = ?";
3801 private static final String _FINDER_COLUMN_UUID_UUID_3 = "(socialRequest.uuid IS NULL OR socialRequest.uuid = ?)";
3802 private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "socialRequest.uuid IS NULL AND ";
3803 private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "socialRequest.uuid = ? AND ";
3804 private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(socialRequest.uuid IS NULL OR socialRequest.uuid = ?) AND ";
3805 private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "socialRequest.groupId = ?";
3806 private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "socialRequest.companyId = ?";
3807 private static final String _FINDER_COLUMN_USERID_USERID_2 = "socialRequest.userId = ?";
3808 private static final String _FINDER_COLUMN_RECEIVERUSERID_RECEIVERUSERID_2 = "socialRequest.receiverUserId = ?";
3809 private static final String _FINDER_COLUMN_U_S_USERID_2 = "socialRequest.userId = ? AND ";
3810 private static final String _FINDER_COLUMN_U_S_STATUS_2 = "socialRequest.status = ?";
3811 private static final String _FINDER_COLUMN_R_S_RECEIVERUSERID_2 = "socialRequest.receiverUserId = ? AND ";
3812 private static final String _FINDER_COLUMN_R_S_STATUS_2 = "socialRequest.status = ?";
3813 private static final String _FINDER_COLUMN_U_C_C_T_R_USERID_2 = "socialRequest.userId = ? AND ";
3814 private static final String _FINDER_COLUMN_U_C_C_T_R_CLASSNAMEID_2 = "socialRequest.classNameId = ? AND ";
3815 private static final String _FINDER_COLUMN_U_C_C_T_R_CLASSPK_2 = "socialRequest.classPK = ? AND ";
3816 private static final String _FINDER_COLUMN_U_C_C_T_R_TYPE_2 = "socialRequest.type = ? AND ";
3817 private static final String _FINDER_COLUMN_U_C_C_T_R_RECEIVERUSERID_2 = "socialRequest.receiverUserId = ?";
3818 private static final String _FINDER_COLUMN_U_C_C_T_S_USERID_2 = "socialRequest.userId = ? AND ";
3819 private static final String _FINDER_COLUMN_U_C_C_T_S_CLASSNAMEID_2 = "socialRequest.classNameId = ? AND ";
3820 private static final String _FINDER_COLUMN_U_C_C_T_S_CLASSPK_2 = "socialRequest.classPK = ? AND ";
3821 private static final String _FINDER_COLUMN_U_C_C_T_S_TYPE_2 = "socialRequest.type = ? AND ";
3822 private static final String _FINDER_COLUMN_U_C_C_T_S_STATUS_2 = "socialRequest.status = ?";
3823 private static final String _FINDER_COLUMN_C_C_T_R_S_CLASSNAMEID_2 = "socialRequest.classNameId = ? AND ";
3824 private static final String _FINDER_COLUMN_C_C_T_R_S_CLASSPK_2 = "socialRequest.classPK = ? AND ";
3825 private static final String _FINDER_COLUMN_C_C_T_R_S_TYPE_2 = "socialRequest.type = ? AND ";
3826 private static final String _FINDER_COLUMN_C_C_T_R_S_RECEIVERUSERID_2 = "socialRequest.receiverUserId = ? AND ";
3827 private static final String _FINDER_COLUMN_C_C_T_R_S_STATUS_2 = "socialRequest.status = ?";
3828 private static final String _ORDER_BY_ENTITY_ALIAS = "socialRequest.";
3829 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No SocialRequest exists with the primary key ";
3830 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No SocialRequest exists with the key {";
3831 private static Log _log = LogFactoryUtil.getLog(SocialRequestPersistenceImpl.class);
3832}