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