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