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