001
014
015 package com.liferay.portlet.blogs.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.kernel.bean.BeanReference;
019 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
020 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
021 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
022 import com.liferay.portal.kernel.dao.orm.FinderPath;
023 import com.liferay.portal.kernel.dao.orm.Query;
024 import com.liferay.portal.kernel.dao.orm.QueryPos;
025 import com.liferay.portal.kernel.dao.orm.QueryUtil;
026 import com.liferay.portal.kernel.dao.orm.Session;
027 import com.liferay.portal.kernel.exception.SystemException;
028 import com.liferay.portal.kernel.log.Log;
029 import com.liferay.portal.kernel.log.LogFactoryUtil;
030 import com.liferay.portal.kernel.util.CalendarUtil;
031 import com.liferay.portal.kernel.util.GetterUtil;
032 import com.liferay.portal.kernel.util.InstanceFactory;
033 import com.liferay.portal.kernel.util.OrderByComparator;
034 import com.liferay.portal.kernel.util.StringBundler;
035 import com.liferay.portal.kernel.util.StringPool;
036 import com.liferay.portal.kernel.util.StringUtil;
037 import com.liferay.portal.kernel.util.Validator;
038 import com.liferay.portal.model.CacheModel;
039 import com.liferay.portal.model.ModelListener;
040 import com.liferay.portal.service.persistence.BatchSessionUtil;
041 import com.liferay.portal.service.persistence.GroupPersistence;
042 import com.liferay.portal.service.persistence.ResourcePersistence;
043 import com.liferay.portal.service.persistence.UserPersistence;
044 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
045
046 import com.liferay.portlet.blogs.NoSuchStatsUserException;
047 import com.liferay.portlet.blogs.model.BlogsStatsUser;
048 import com.liferay.portlet.blogs.model.impl.BlogsStatsUserImpl;
049 import com.liferay.portlet.blogs.model.impl.BlogsStatsUserModelImpl;
050
051 import java.io.Serializable;
052
053 import java.util.ArrayList;
054 import java.util.Collections;
055 import java.util.Date;
056 import java.util.List;
057
058
070 public class BlogsStatsUserPersistenceImpl extends BasePersistenceImpl<BlogsStatsUser>
071 implements BlogsStatsUserPersistence {
072
077 public static final String FINDER_CLASS_NAME_ENTITY = BlogsStatsUserImpl.class.getName();
078 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
079 ".List1";
080 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
081 ".List2";
082 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
083 BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
084 BlogsStatsUserImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
085 "findByGroupId",
086 new String[] {
087 Long.class.getName(),
088
089 "java.lang.Integer", "java.lang.Integer",
090 "com.liferay.portal.kernel.util.OrderByComparator"
091 });
092 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID =
093 new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
094 BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
095 BlogsStatsUserImpl.class,
096 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByGroupId",
097 new String[] { Long.class.getName() },
098 BlogsStatsUserModelImpl.GROUPID_COLUMN_BITMASK);
099 public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
100 BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED, Long.class,
101 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByGroupId",
102 new String[] { Long.class.getName() });
103 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_USERID = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
104 BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
105 BlogsStatsUserImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
106 "findByUserId",
107 new String[] {
108 Long.class.getName(),
109
110 "java.lang.Integer", "java.lang.Integer",
111 "com.liferay.portal.kernel.util.OrderByComparator"
112 });
113 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID =
114 new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
115 BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
116 BlogsStatsUserImpl.class,
117 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUserId",
118 new String[] { Long.class.getName() },
119 BlogsStatsUserModelImpl.USERID_COLUMN_BITMASK);
120 public static final FinderPath FINDER_PATH_COUNT_BY_USERID = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
121 BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED, Long.class,
122 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUserId",
123 new String[] { Long.class.getName() });
124 public static final FinderPath FINDER_PATH_FETCH_BY_G_U = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
125 BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
126 BlogsStatsUserImpl.class, FINDER_CLASS_NAME_ENTITY, "fetchByG_U",
127 new String[] { Long.class.getName(), Long.class.getName() },
128 BlogsStatsUserModelImpl.GROUPID_COLUMN_BITMASK |
129 BlogsStatsUserModelImpl.USERID_COLUMN_BITMASK);
130 public static final FinderPath FINDER_PATH_COUNT_BY_G_U = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
131 BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED, Long.class,
132 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_U",
133 new String[] { Long.class.getName(), Long.class.getName() });
134 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_NOTE = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
135 BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
136 BlogsStatsUserImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
137 "findByG_NotE",
138 new String[] {
139 Long.class.getName(), Integer.class.getName(),
140
141 "java.lang.Integer", "java.lang.Integer",
142 "com.liferay.portal.kernel.util.OrderByComparator"
143 });
144 public static final FinderPath FINDER_PATH_WITH_PAGINATION_COUNT_BY_G_NOTE = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
145 BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED, Long.class,
146 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByG_NotE",
147 new String[] { Long.class.getName(), Integer.class.getName() });
148 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_NOTE = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
149 BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
150 BlogsStatsUserImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
151 "findByC_NotE",
152 new String[] {
153 Long.class.getName(), Integer.class.getName(),
154
155 "java.lang.Integer", "java.lang.Integer",
156 "com.liferay.portal.kernel.util.OrderByComparator"
157 });
158 public static final FinderPath FINDER_PATH_WITH_PAGINATION_COUNT_BY_C_NOTE = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
159 BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED, Long.class,
160 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByC_NotE",
161 new String[] { Long.class.getName(), Integer.class.getName() });
162 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_U_L = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
163 BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
164 BlogsStatsUserImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
165 "findByU_L",
166 new String[] {
167 Long.class.getName(), Date.class.getName(),
168
169 "java.lang.Integer", "java.lang.Integer",
170 "com.liferay.portal.kernel.util.OrderByComparator"
171 });
172 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_U_L = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
173 BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
174 BlogsStatsUserImpl.class,
175 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByU_L",
176 new String[] { Long.class.getName(), Date.class.getName() },
177 BlogsStatsUserModelImpl.USERID_COLUMN_BITMASK |
178 BlogsStatsUserModelImpl.LASTPOSTDATE_COLUMN_BITMASK);
179 public static final FinderPath FINDER_PATH_COUNT_BY_U_L = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
180 BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED, Long.class,
181 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByU_L",
182 new String[] { Long.class.getName(), Date.class.getName() });
183 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
184 BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
185 BlogsStatsUserImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
186 "findAll", new String[0]);
187 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
188 BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
189 BlogsStatsUserImpl.class,
190 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
191 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
192 BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED, Long.class,
193 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
194
195
200 public void cacheResult(BlogsStatsUser blogsStatsUser) {
201 EntityCacheUtil.putResult(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
202 BlogsStatsUserImpl.class, blogsStatsUser.getPrimaryKey(),
203 blogsStatsUser);
204
205 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_U,
206 new Object[] {
207 Long.valueOf(blogsStatsUser.getGroupId()),
208 Long.valueOf(blogsStatsUser.getUserId())
209 }, blogsStatsUser);
210
211 blogsStatsUser.resetOriginalValues();
212 }
213
214
219 public void cacheResult(List<BlogsStatsUser> blogsStatsUsers) {
220 for (BlogsStatsUser blogsStatsUser : blogsStatsUsers) {
221 if (EntityCacheUtil.getResult(
222 BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
223 BlogsStatsUserImpl.class, blogsStatsUser.getPrimaryKey()) == null) {
224 cacheResult(blogsStatsUser);
225 }
226 else {
227 blogsStatsUser.resetOriginalValues();
228 }
229 }
230 }
231
232
239 @Override
240 public void clearCache() {
241 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
242 CacheRegistryUtil.clear(BlogsStatsUserImpl.class.getName());
243 }
244
245 EntityCacheUtil.clearCache(BlogsStatsUserImpl.class.getName());
246
247 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
248 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
249 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
250 }
251
252
259 @Override
260 public void clearCache(BlogsStatsUser blogsStatsUser) {
261 EntityCacheUtil.removeResult(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
262 BlogsStatsUserImpl.class, blogsStatsUser.getPrimaryKey());
263
264 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
265 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
266
267 clearUniqueFindersCache(blogsStatsUser);
268 }
269
270 @Override
271 public void clearCache(List<BlogsStatsUser> blogsStatsUsers) {
272 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
273 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
274
275 for (BlogsStatsUser blogsStatsUser : blogsStatsUsers) {
276 EntityCacheUtil.removeResult(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
277 BlogsStatsUserImpl.class, blogsStatsUser.getPrimaryKey());
278
279 clearUniqueFindersCache(blogsStatsUser);
280 }
281 }
282
283 protected void cacheUniqueFindersCache(BlogsStatsUser blogsStatsUser) {
284 if (blogsStatsUser.isNew()) {
285 Object[] args = new Object[] {
286 Long.valueOf(blogsStatsUser.getGroupId()),
287 Long.valueOf(blogsStatsUser.getUserId())
288 };
289
290 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_U, args,
291 Long.valueOf(1));
292 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_U, args,
293 blogsStatsUser);
294 }
295 else {
296 BlogsStatsUserModelImpl blogsStatsUserModelImpl = (BlogsStatsUserModelImpl)blogsStatsUser;
297
298 if ((blogsStatsUserModelImpl.getColumnBitmask() &
299 FINDER_PATH_FETCH_BY_G_U.getColumnBitmask()) != 0) {
300 Object[] args = new Object[] {
301 Long.valueOf(blogsStatsUser.getGroupId()),
302 Long.valueOf(blogsStatsUser.getUserId())
303 };
304
305 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_U, args,
306 Long.valueOf(1));
307 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_U, args,
308 blogsStatsUser);
309 }
310 }
311 }
312
313 protected void clearUniqueFindersCache(BlogsStatsUser blogsStatsUser) {
314 BlogsStatsUserModelImpl blogsStatsUserModelImpl = (BlogsStatsUserModelImpl)blogsStatsUser;
315
316 Object[] args = new Object[] {
317 Long.valueOf(blogsStatsUser.getGroupId()),
318 Long.valueOf(blogsStatsUser.getUserId())
319 };
320
321 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_U, args);
322 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_U, args);
323
324 if ((blogsStatsUserModelImpl.getColumnBitmask() &
325 FINDER_PATH_FETCH_BY_G_U.getColumnBitmask()) != 0) {
326 args = new Object[] {
327 Long.valueOf(blogsStatsUserModelImpl.getOriginalGroupId()),
328 Long.valueOf(blogsStatsUserModelImpl.getOriginalUserId())
329 };
330
331 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_U, args);
332 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_U, args);
333 }
334 }
335
336
342 public BlogsStatsUser create(long statsUserId) {
343 BlogsStatsUser blogsStatsUser = new BlogsStatsUserImpl();
344
345 blogsStatsUser.setNew(true);
346 blogsStatsUser.setPrimaryKey(statsUserId);
347
348 return blogsStatsUser;
349 }
350
351
359 public BlogsStatsUser remove(long statsUserId)
360 throws NoSuchStatsUserException, SystemException {
361 return remove(Long.valueOf(statsUserId));
362 }
363
364
372 @Override
373 public BlogsStatsUser remove(Serializable primaryKey)
374 throws NoSuchStatsUserException, SystemException {
375 Session session = null;
376
377 try {
378 session = openSession();
379
380 BlogsStatsUser blogsStatsUser = (BlogsStatsUser)session.get(BlogsStatsUserImpl.class,
381 primaryKey);
382
383 if (blogsStatsUser == null) {
384 if (_log.isWarnEnabled()) {
385 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
386 }
387
388 throw new NoSuchStatsUserException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
389 primaryKey);
390 }
391
392 return remove(blogsStatsUser);
393 }
394 catch (NoSuchStatsUserException nsee) {
395 throw nsee;
396 }
397 catch (Exception e) {
398 throw processException(e);
399 }
400 finally {
401 closeSession(session);
402 }
403 }
404
405 @Override
406 protected BlogsStatsUser removeImpl(BlogsStatsUser blogsStatsUser)
407 throws SystemException {
408 blogsStatsUser = toUnwrappedModel(blogsStatsUser);
409
410 Session session = null;
411
412 try {
413 session = openSession();
414
415 BatchSessionUtil.delete(session, blogsStatsUser);
416 }
417 catch (Exception e) {
418 throw processException(e);
419 }
420 finally {
421 closeSession(session);
422 }
423
424 clearCache(blogsStatsUser);
425
426 return blogsStatsUser;
427 }
428
429 @Override
430 public BlogsStatsUser updateImpl(
431 com.liferay.portlet.blogs.model.BlogsStatsUser blogsStatsUser,
432 boolean merge) throws SystemException {
433 blogsStatsUser = toUnwrappedModel(blogsStatsUser);
434
435 boolean isNew = blogsStatsUser.isNew();
436
437 BlogsStatsUserModelImpl blogsStatsUserModelImpl = (BlogsStatsUserModelImpl)blogsStatsUser;
438
439 Session session = null;
440
441 try {
442 session = openSession();
443
444 BatchSessionUtil.update(session, blogsStatsUser, merge);
445
446 blogsStatsUser.setNew(false);
447 }
448 catch (Exception e) {
449 throw processException(e);
450 }
451 finally {
452 closeSession(session);
453 }
454
455 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
456
457 if (isNew || !BlogsStatsUserModelImpl.COLUMN_BITMASK_ENABLED) {
458 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
459 }
460
461 else {
462 if ((blogsStatsUserModelImpl.getColumnBitmask() &
463 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) {
464 Object[] args = new Object[] {
465 Long.valueOf(blogsStatsUserModelImpl.getOriginalGroupId())
466 };
467
468 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
469 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
470 args);
471
472 args = new Object[] {
473 Long.valueOf(blogsStatsUserModelImpl.getGroupId())
474 };
475
476 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
477 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
478 args);
479 }
480
481 if ((blogsStatsUserModelImpl.getColumnBitmask() &
482 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID.getColumnBitmask()) != 0) {
483 Object[] args = new Object[] {
484 Long.valueOf(blogsStatsUserModelImpl.getOriginalUserId())
485 };
486
487 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
488 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID,
489 args);
490
491 args = new Object[] {
492 Long.valueOf(blogsStatsUserModelImpl.getUserId())
493 };
494
495 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
496 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID,
497 args);
498 }
499
500 if ((blogsStatsUserModelImpl.getColumnBitmask() &
501 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_U_L.getColumnBitmask()) != 0) {
502 Object[] args = new Object[] {
503 Long.valueOf(blogsStatsUserModelImpl.getOriginalUserId()),
504
505 blogsStatsUserModelImpl.getOriginalLastPostDate()
506 };
507
508 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_U_L, args);
509 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_U_L,
510 args);
511
512 args = new Object[] {
513 Long.valueOf(blogsStatsUserModelImpl.getUserId()),
514
515 blogsStatsUserModelImpl.getLastPostDate()
516 };
517
518 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_U_L, args);
519 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_U_L,
520 args);
521 }
522 }
523
524 EntityCacheUtil.putResult(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
525 BlogsStatsUserImpl.class, blogsStatsUser.getPrimaryKey(),
526 blogsStatsUser);
527
528 clearUniqueFindersCache(blogsStatsUser);
529 cacheUniqueFindersCache(blogsStatsUser);
530
531 return blogsStatsUser;
532 }
533
534 protected BlogsStatsUser toUnwrappedModel(BlogsStatsUser blogsStatsUser) {
535 if (blogsStatsUser instanceof BlogsStatsUserImpl) {
536 return blogsStatsUser;
537 }
538
539 BlogsStatsUserImpl blogsStatsUserImpl = new BlogsStatsUserImpl();
540
541 blogsStatsUserImpl.setNew(blogsStatsUser.isNew());
542 blogsStatsUserImpl.setPrimaryKey(blogsStatsUser.getPrimaryKey());
543
544 blogsStatsUserImpl.setStatsUserId(blogsStatsUser.getStatsUserId());
545 blogsStatsUserImpl.setGroupId(blogsStatsUser.getGroupId());
546 blogsStatsUserImpl.setCompanyId(blogsStatsUser.getCompanyId());
547 blogsStatsUserImpl.setUserId(blogsStatsUser.getUserId());
548 blogsStatsUserImpl.setEntryCount(blogsStatsUser.getEntryCount());
549 blogsStatsUserImpl.setLastPostDate(blogsStatsUser.getLastPostDate());
550 blogsStatsUserImpl.setRatingsTotalEntries(blogsStatsUser.getRatingsTotalEntries());
551 blogsStatsUserImpl.setRatingsTotalScore(blogsStatsUser.getRatingsTotalScore());
552 blogsStatsUserImpl.setRatingsAverageScore(blogsStatsUser.getRatingsAverageScore());
553
554 return blogsStatsUserImpl;
555 }
556
557
565 @Override
566 public BlogsStatsUser findByPrimaryKey(Serializable primaryKey)
567 throws NoSuchModelException, SystemException {
568 return findByPrimaryKey(((Long)primaryKey).longValue());
569 }
570
571
579 public BlogsStatsUser findByPrimaryKey(long statsUserId)
580 throws NoSuchStatsUserException, SystemException {
581 BlogsStatsUser blogsStatsUser = fetchByPrimaryKey(statsUserId);
582
583 if (blogsStatsUser == null) {
584 if (_log.isWarnEnabled()) {
585 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + statsUserId);
586 }
587
588 throw new NoSuchStatsUserException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
589 statsUserId);
590 }
591
592 return blogsStatsUser;
593 }
594
595
602 @Override
603 public BlogsStatsUser fetchByPrimaryKey(Serializable primaryKey)
604 throws SystemException {
605 return fetchByPrimaryKey(((Long)primaryKey).longValue());
606 }
607
608
615 public BlogsStatsUser fetchByPrimaryKey(long statsUserId)
616 throws SystemException {
617 BlogsStatsUser blogsStatsUser = (BlogsStatsUser)EntityCacheUtil.getResult(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
618 BlogsStatsUserImpl.class, statsUserId);
619
620 if (blogsStatsUser == _nullBlogsStatsUser) {
621 return null;
622 }
623
624 if (blogsStatsUser == null) {
625 Session session = null;
626
627 boolean hasException = false;
628
629 try {
630 session = openSession();
631
632 blogsStatsUser = (BlogsStatsUser)session.get(BlogsStatsUserImpl.class,
633 Long.valueOf(statsUserId));
634 }
635 catch (Exception e) {
636 hasException = true;
637
638 throw processException(e);
639 }
640 finally {
641 if (blogsStatsUser != null) {
642 cacheResult(blogsStatsUser);
643 }
644 else if (!hasException) {
645 EntityCacheUtil.putResult(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
646 BlogsStatsUserImpl.class, statsUserId,
647 _nullBlogsStatsUser);
648 }
649
650 closeSession(session);
651 }
652 }
653
654 return blogsStatsUser;
655 }
656
657
664 public List<BlogsStatsUser> findByGroupId(long groupId)
665 throws SystemException {
666 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
667 }
668
669
682 public List<BlogsStatsUser> findByGroupId(long groupId, int start, int end)
683 throws SystemException {
684 return findByGroupId(groupId, start, end, null);
685 }
686
687
701 public List<BlogsStatsUser> findByGroupId(long groupId, int start, int end,
702 OrderByComparator orderByComparator) throws SystemException {
703 FinderPath finderPath = null;
704 Object[] finderArgs = null;
705
706 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
707 (orderByComparator == null)) {
708 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID;
709 finderArgs = new Object[] { groupId };
710 }
711 else {
712 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID;
713 finderArgs = new Object[] { groupId, start, end, orderByComparator };
714 }
715
716 List<BlogsStatsUser> list = (List<BlogsStatsUser>)FinderCacheUtil.getResult(finderPath,
717 finderArgs, this);
718
719 if ((list != null) && !list.isEmpty()) {
720 for (BlogsStatsUser blogsStatsUser : list) {
721 if ((groupId != blogsStatsUser.getGroupId())) {
722 list = null;
723
724 break;
725 }
726 }
727 }
728
729 if (list == null) {
730 StringBundler query = null;
731
732 if (orderByComparator != null) {
733 query = new StringBundler(3 +
734 (orderByComparator.getOrderByFields().length * 3));
735 }
736 else {
737 query = new StringBundler(3);
738 }
739
740 query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
741
742 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
743
744 if (orderByComparator != null) {
745 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
746 orderByComparator);
747 }
748
749 else {
750 query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
751 }
752
753 String sql = query.toString();
754
755 Session session = null;
756
757 try {
758 session = openSession();
759
760 Query q = session.createQuery(sql);
761
762 QueryPos qPos = QueryPos.getInstance(q);
763
764 qPos.add(groupId);
765
766 list = (List<BlogsStatsUser>)QueryUtil.list(q, getDialect(),
767 start, end);
768 }
769 catch (Exception e) {
770 throw processException(e);
771 }
772 finally {
773 if (list == null) {
774 FinderCacheUtil.removeResult(finderPath, finderArgs);
775 }
776 else {
777 cacheResult(list);
778
779 FinderCacheUtil.putResult(finderPath, finderArgs, list);
780 }
781
782 closeSession(session);
783 }
784 }
785
786 return list;
787 }
788
789
798 public BlogsStatsUser findByGroupId_First(long groupId,
799 OrderByComparator orderByComparator)
800 throws NoSuchStatsUserException, SystemException {
801 BlogsStatsUser blogsStatsUser = fetchByGroupId_First(groupId,
802 orderByComparator);
803
804 if (blogsStatsUser != null) {
805 return blogsStatsUser;
806 }
807
808 StringBundler msg = new StringBundler(4);
809
810 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
811
812 msg.append("groupId=");
813 msg.append(groupId);
814
815 msg.append(StringPool.CLOSE_CURLY_BRACE);
816
817 throw new NoSuchStatsUserException(msg.toString());
818 }
819
820
828 public BlogsStatsUser fetchByGroupId_First(long groupId,
829 OrderByComparator orderByComparator) throws SystemException {
830 List<BlogsStatsUser> list = findByGroupId(groupId, 0, 1,
831 orderByComparator);
832
833 if (!list.isEmpty()) {
834 return list.get(0);
835 }
836
837 return null;
838 }
839
840
849 public BlogsStatsUser findByGroupId_Last(long groupId,
850 OrderByComparator orderByComparator)
851 throws NoSuchStatsUserException, SystemException {
852 BlogsStatsUser blogsStatsUser = fetchByGroupId_Last(groupId,
853 orderByComparator);
854
855 if (blogsStatsUser != null) {
856 return blogsStatsUser;
857 }
858
859 StringBundler msg = new StringBundler(4);
860
861 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
862
863 msg.append("groupId=");
864 msg.append(groupId);
865
866 msg.append(StringPool.CLOSE_CURLY_BRACE);
867
868 throw new NoSuchStatsUserException(msg.toString());
869 }
870
871
879 public BlogsStatsUser fetchByGroupId_Last(long groupId,
880 OrderByComparator orderByComparator) throws SystemException {
881 int count = countByGroupId(groupId);
882
883 List<BlogsStatsUser> list = findByGroupId(groupId, count - 1, count,
884 orderByComparator);
885
886 if (!list.isEmpty()) {
887 return list.get(0);
888 }
889
890 return null;
891 }
892
893
903 public BlogsStatsUser[] findByGroupId_PrevAndNext(long statsUserId,
904 long groupId, OrderByComparator orderByComparator)
905 throws NoSuchStatsUserException, SystemException {
906 BlogsStatsUser blogsStatsUser = findByPrimaryKey(statsUserId);
907
908 Session session = null;
909
910 try {
911 session = openSession();
912
913 BlogsStatsUser[] array = new BlogsStatsUserImpl[3];
914
915 array[0] = getByGroupId_PrevAndNext(session, blogsStatsUser,
916 groupId, orderByComparator, true);
917
918 array[1] = blogsStatsUser;
919
920 array[2] = getByGroupId_PrevAndNext(session, blogsStatsUser,
921 groupId, orderByComparator, false);
922
923 return array;
924 }
925 catch (Exception e) {
926 throw processException(e);
927 }
928 finally {
929 closeSession(session);
930 }
931 }
932
933 protected BlogsStatsUser getByGroupId_PrevAndNext(Session session,
934 BlogsStatsUser blogsStatsUser, long groupId,
935 OrderByComparator orderByComparator, boolean previous) {
936 StringBundler query = null;
937
938 if (orderByComparator != null) {
939 query = new StringBundler(6 +
940 (orderByComparator.getOrderByFields().length * 6));
941 }
942 else {
943 query = new StringBundler(3);
944 }
945
946 query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
947
948 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
949
950 if (orderByComparator != null) {
951 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
952
953 if (orderByConditionFields.length > 0) {
954 query.append(WHERE_AND);
955 }
956
957 for (int i = 0; i < orderByConditionFields.length; i++) {
958 query.append(_ORDER_BY_ENTITY_ALIAS);
959 query.append(orderByConditionFields[i]);
960
961 if ((i + 1) < orderByConditionFields.length) {
962 if (orderByComparator.isAscending() ^ previous) {
963 query.append(WHERE_GREATER_THAN_HAS_NEXT);
964 }
965 else {
966 query.append(WHERE_LESSER_THAN_HAS_NEXT);
967 }
968 }
969 else {
970 if (orderByComparator.isAscending() ^ previous) {
971 query.append(WHERE_GREATER_THAN);
972 }
973 else {
974 query.append(WHERE_LESSER_THAN);
975 }
976 }
977 }
978
979 query.append(ORDER_BY_CLAUSE);
980
981 String[] orderByFields = orderByComparator.getOrderByFields();
982
983 for (int i = 0; i < orderByFields.length; i++) {
984 query.append(_ORDER_BY_ENTITY_ALIAS);
985 query.append(orderByFields[i]);
986
987 if ((i + 1) < orderByFields.length) {
988 if (orderByComparator.isAscending() ^ previous) {
989 query.append(ORDER_BY_ASC_HAS_NEXT);
990 }
991 else {
992 query.append(ORDER_BY_DESC_HAS_NEXT);
993 }
994 }
995 else {
996 if (orderByComparator.isAscending() ^ previous) {
997 query.append(ORDER_BY_ASC);
998 }
999 else {
1000 query.append(ORDER_BY_DESC);
1001 }
1002 }
1003 }
1004 }
1005
1006 else {
1007 query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
1008 }
1009
1010 String sql = query.toString();
1011
1012 Query q = session.createQuery(sql);
1013
1014 q.setFirstResult(0);
1015 q.setMaxResults(2);
1016
1017 QueryPos qPos = QueryPos.getInstance(q);
1018
1019 qPos.add(groupId);
1020
1021 if (orderByComparator != null) {
1022 Object[] values = orderByComparator.getOrderByConditionValues(blogsStatsUser);
1023
1024 for (Object value : values) {
1025 qPos.add(value);
1026 }
1027 }
1028
1029 List<BlogsStatsUser> list = q.list();
1030
1031 if (list.size() == 2) {
1032 return list.get(1);
1033 }
1034 else {
1035 return null;
1036 }
1037 }
1038
1039
1046 public List<BlogsStatsUser> findByUserId(long userId)
1047 throws SystemException {
1048 return findByUserId(userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1049 }
1050
1051
1064 public List<BlogsStatsUser> findByUserId(long userId, int start, int end)
1065 throws SystemException {
1066 return findByUserId(userId, start, end, null);
1067 }
1068
1069
1083 public List<BlogsStatsUser> findByUserId(long userId, int start, int end,
1084 OrderByComparator orderByComparator) throws SystemException {
1085 FinderPath finderPath = null;
1086 Object[] finderArgs = null;
1087
1088 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1089 (orderByComparator == null)) {
1090 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID;
1091 finderArgs = new Object[] { userId };
1092 }
1093 else {
1094 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_USERID;
1095 finderArgs = new Object[] { userId, start, end, orderByComparator };
1096 }
1097
1098 List<BlogsStatsUser> list = (List<BlogsStatsUser>)FinderCacheUtil.getResult(finderPath,
1099 finderArgs, this);
1100
1101 if ((list != null) && !list.isEmpty()) {
1102 for (BlogsStatsUser blogsStatsUser : list) {
1103 if ((userId != blogsStatsUser.getUserId())) {
1104 list = null;
1105
1106 break;
1107 }
1108 }
1109 }
1110
1111 if (list == null) {
1112 StringBundler query = null;
1113
1114 if (orderByComparator != null) {
1115 query = new StringBundler(3 +
1116 (orderByComparator.getOrderByFields().length * 3));
1117 }
1118 else {
1119 query = new StringBundler(3);
1120 }
1121
1122 query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
1123
1124 query.append(_FINDER_COLUMN_USERID_USERID_2);
1125
1126 if (orderByComparator != null) {
1127 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1128 orderByComparator);
1129 }
1130
1131 else {
1132 query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
1133 }
1134
1135 String sql = query.toString();
1136
1137 Session session = null;
1138
1139 try {
1140 session = openSession();
1141
1142 Query q = session.createQuery(sql);
1143
1144 QueryPos qPos = QueryPos.getInstance(q);
1145
1146 qPos.add(userId);
1147
1148 list = (List<BlogsStatsUser>)QueryUtil.list(q, getDialect(),
1149 start, end);
1150 }
1151 catch (Exception e) {
1152 throw processException(e);
1153 }
1154 finally {
1155 if (list == null) {
1156 FinderCacheUtil.removeResult(finderPath, finderArgs);
1157 }
1158 else {
1159 cacheResult(list);
1160
1161 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1162 }
1163
1164 closeSession(session);
1165 }
1166 }
1167
1168 return list;
1169 }
1170
1171
1180 public BlogsStatsUser findByUserId_First(long userId,
1181 OrderByComparator orderByComparator)
1182 throws NoSuchStatsUserException, SystemException {
1183 BlogsStatsUser blogsStatsUser = fetchByUserId_First(userId,
1184 orderByComparator);
1185
1186 if (blogsStatsUser != null) {
1187 return blogsStatsUser;
1188 }
1189
1190 StringBundler msg = new StringBundler(4);
1191
1192 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1193
1194 msg.append("userId=");
1195 msg.append(userId);
1196
1197 msg.append(StringPool.CLOSE_CURLY_BRACE);
1198
1199 throw new NoSuchStatsUserException(msg.toString());
1200 }
1201
1202
1210 public BlogsStatsUser fetchByUserId_First(long userId,
1211 OrderByComparator orderByComparator) throws SystemException {
1212 List<BlogsStatsUser> list = findByUserId(userId, 0, 1, orderByComparator);
1213
1214 if (!list.isEmpty()) {
1215 return list.get(0);
1216 }
1217
1218 return null;
1219 }
1220
1221
1230 public BlogsStatsUser findByUserId_Last(long userId,
1231 OrderByComparator orderByComparator)
1232 throws NoSuchStatsUserException, SystemException {
1233 BlogsStatsUser blogsStatsUser = fetchByUserId_Last(userId,
1234 orderByComparator);
1235
1236 if (blogsStatsUser != null) {
1237 return blogsStatsUser;
1238 }
1239
1240 StringBundler msg = new StringBundler(4);
1241
1242 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1243
1244 msg.append("userId=");
1245 msg.append(userId);
1246
1247 msg.append(StringPool.CLOSE_CURLY_BRACE);
1248
1249 throw new NoSuchStatsUserException(msg.toString());
1250 }
1251
1252
1260 public BlogsStatsUser fetchByUserId_Last(long userId,
1261 OrderByComparator orderByComparator) throws SystemException {
1262 int count = countByUserId(userId);
1263
1264 List<BlogsStatsUser> list = findByUserId(userId, count - 1, count,
1265 orderByComparator);
1266
1267 if (!list.isEmpty()) {
1268 return list.get(0);
1269 }
1270
1271 return null;
1272 }
1273
1274
1284 public BlogsStatsUser[] findByUserId_PrevAndNext(long statsUserId,
1285 long userId, OrderByComparator orderByComparator)
1286 throws NoSuchStatsUserException, SystemException {
1287 BlogsStatsUser blogsStatsUser = findByPrimaryKey(statsUserId);
1288
1289 Session session = null;
1290
1291 try {
1292 session = openSession();
1293
1294 BlogsStatsUser[] array = new BlogsStatsUserImpl[3];
1295
1296 array[0] = getByUserId_PrevAndNext(session, blogsStatsUser, userId,
1297 orderByComparator, true);
1298
1299 array[1] = blogsStatsUser;
1300
1301 array[2] = getByUserId_PrevAndNext(session, blogsStatsUser, userId,
1302 orderByComparator, false);
1303
1304 return array;
1305 }
1306 catch (Exception e) {
1307 throw processException(e);
1308 }
1309 finally {
1310 closeSession(session);
1311 }
1312 }
1313
1314 protected BlogsStatsUser getByUserId_PrevAndNext(Session session,
1315 BlogsStatsUser blogsStatsUser, long userId,
1316 OrderByComparator orderByComparator, boolean previous) {
1317 StringBundler query = null;
1318
1319 if (orderByComparator != null) {
1320 query = new StringBundler(6 +
1321 (orderByComparator.getOrderByFields().length * 6));
1322 }
1323 else {
1324 query = new StringBundler(3);
1325 }
1326
1327 query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
1328
1329 query.append(_FINDER_COLUMN_USERID_USERID_2);
1330
1331 if (orderByComparator != null) {
1332 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1333
1334 if (orderByConditionFields.length > 0) {
1335 query.append(WHERE_AND);
1336 }
1337
1338 for (int i = 0; i < orderByConditionFields.length; i++) {
1339 query.append(_ORDER_BY_ENTITY_ALIAS);
1340 query.append(orderByConditionFields[i]);
1341
1342 if ((i + 1) < orderByConditionFields.length) {
1343 if (orderByComparator.isAscending() ^ previous) {
1344 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1345 }
1346 else {
1347 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1348 }
1349 }
1350 else {
1351 if (orderByComparator.isAscending() ^ previous) {
1352 query.append(WHERE_GREATER_THAN);
1353 }
1354 else {
1355 query.append(WHERE_LESSER_THAN);
1356 }
1357 }
1358 }
1359
1360 query.append(ORDER_BY_CLAUSE);
1361
1362 String[] orderByFields = orderByComparator.getOrderByFields();
1363
1364 for (int i = 0; i < orderByFields.length; i++) {
1365 query.append(_ORDER_BY_ENTITY_ALIAS);
1366 query.append(orderByFields[i]);
1367
1368 if ((i + 1) < orderByFields.length) {
1369 if (orderByComparator.isAscending() ^ previous) {
1370 query.append(ORDER_BY_ASC_HAS_NEXT);
1371 }
1372 else {
1373 query.append(ORDER_BY_DESC_HAS_NEXT);
1374 }
1375 }
1376 else {
1377 if (orderByComparator.isAscending() ^ previous) {
1378 query.append(ORDER_BY_ASC);
1379 }
1380 else {
1381 query.append(ORDER_BY_DESC);
1382 }
1383 }
1384 }
1385 }
1386
1387 else {
1388 query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
1389 }
1390
1391 String sql = query.toString();
1392
1393 Query q = session.createQuery(sql);
1394
1395 q.setFirstResult(0);
1396 q.setMaxResults(2);
1397
1398 QueryPos qPos = QueryPos.getInstance(q);
1399
1400 qPos.add(userId);
1401
1402 if (orderByComparator != null) {
1403 Object[] values = orderByComparator.getOrderByConditionValues(blogsStatsUser);
1404
1405 for (Object value : values) {
1406 qPos.add(value);
1407 }
1408 }
1409
1410 List<BlogsStatsUser> list = q.list();
1411
1412 if (list.size() == 2) {
1413 return list.get(1);
1414 }
1415 else {
1416 return null;
1417 }
1418 }
1419
1420
1429 public BlogsStatsUser findByG_U(long groupId, long userId)
1430 throws NoSuchStatsUserException, SystemException {
1431 BlogsStatsUser blogsStatsUser = fetchByG_U(groupId, userId);
1432
1433 if (blogsStatsUser == null) {
1434 StringBundler msg = new StringBundler(6);
1435
1436 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1437
1438 msg.append("groupId=");
1439 msg.append(groupId);
1440
1441 msg.append(", userId=");
1442 msg.append(userId);
1443
1444 msg.append(StringPool.CLOSE_CURLY_BRACE);
1445
1446 if (_log.isWarnEnabled()) {
1447 _log.warn(msg.toString());
1448 }
1449
1450 throw new NoSuchStatsUserException(msg.toString());
1451 }
1452
1453 return blogsStatsUser;
1454 }
1455
1456
1464 public BlogsStatsUser fetchByG_U(long groupId, long userId)
1465 throws SystemException {
1466 return fetchByG_U(groupId, userId, true);
1467 }
1468
1469
1478 public BlogsStatsUser fetchByG_U(long groupId, long userId,
1479 boolean retrieveFromCache) throws SystemException {
1480 Object[] finderArgs = new Object[] { groupId, userId };
1481
1482 Object result = null;
1483
1484 if (retrieveFromCache) {
1485 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_U,
1486 finderArgs, this);
1487 }
1488
1489 if (result instanceof BlogsStatsUser) {
1490 BlogsStatsUser blogsStatsUser = (BlogsStatsUser)result;
1491
1492 if ((groupId != blogsStatsUser.getGroupId()) ||
1493 (userId != blogsStatsUser.getUserId())) {
1494 result = null;
1495 }
1496 }
1497
1498 if (result == null) {
1499 StringBundler query = new StringBundler(4);
1500
1501 query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
1502
1503 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
1504
1505 query.append(_FINDER_COLUMN_G_U_USERID_2);
1506
1507 query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
1508
1509 String sql = query.toString();
1510
1511 Session session = null;
1512
1513 try {
1514 session = openSession();
1515
1516 Query q = session.createQuery(sql);
1517
1518 QueryPos qPos = QueryPos.getInstance(q);
1519
1520 qPos.add(groupId);
1521
1522 qPos.add(userId);
1523
1524 List<BlogsStatsUser> list = q.list();
1525
1526 result = list;
1527
1528 BlogsStatsUser blogsStatsUser = null;
1529
1530 if (list.isEmpty()) {
1531 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_U,
1532 finderArgs, list);
1533 }
1534 else {
1535 blogsStatsUser = list.get(0);
1536
1537 cacheResult(blogsStatsUser);
1538
1539 if ((blogsStatsUser.getGroupId() != groupId) ||
1540 (blogsStatsUser.getUserId() != userId)) {
1541 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_U,
1542 finderArgs, blogsStatsUser);
1543 }
1544 }
1545
1546 return blogsStatsUser;
1547 }
1548 catch (Exception e) {
1549 throw processException(e);
1550 }
1551 finally {
1552 if (result == null) {
1553 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_U,
1554 finderArgs);
1555 }
1556
1557 closeSession(session);
1558 }
1559 }
1560 else {
1561 if (result instanceof List<?>) {
1562 return null;
1563 }
1564 else {
1565 return (BlogsStatsUser)result;
1566 }
1567 }
1568 }
1569
1570
1578 public List<BlogsStatsUser> findByG_NotE(long groupId, int entryCount)
1579 throws SystemException {
1580 return findByG_NotE(groupId, entryCount, QueryUtil.ALL_POS,
1581 QueryUtil.ALL_POS, null);
1582 }
1583
1584
1598 public List<BlogsStatsUser> findByG_NotE(long groupId, int entryCount,
1599 int start, int end) throws SystemException {
1600 return findByG_NotE(groupId, entryCount, start, end, null);
1601 }
1602
1603
1618 public List<BlogsStatsUser> findByG_NotE(long groupId, int entryCount,
1619 int start, int end, OrderByComparator orderByComparator)
1620 throws SystemException {
1621 FinderPath finderPath = null;
1622 Object[] finderArgs = null;
1623
1624 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_NOTE;
1625 finderArgs = new Object[] {
1626 groupId, entryCount,
1627
1628 start, end, orderByComparator
1629 };
1630
1631 List<BlogsStatsUser> list = (List<BlogsStatsUser>)FinderCacheUtil.getResult(finderPath,
1632 finderArgs, this);
1633
1634 if ((list != null) && !list.isEmpty()) {
1635 for (BlogsStatsUser blogsStatsUser : list) {
1636 if ((groupId != blogsStatsUser.getGroupId()) ||
1637 (entryCount != blogsStatsUser.getEntryCount())) {
1638 list = null;
1639
1640 break;
1641 }
1642 }
1643 }
1644
1645 if (list == null) {
1646 StringBundler query = null;
1647
1648 if (orderByComparator != null) {
1649 query = new StringBundler(4 +
1650 (orderByComparator.getOrderByFields().length * 3));
1651 }
1652 else {
1653 query = new StringBundler(4);
1654 }
1655
1656 query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
1657
1658 query.append(_FINDER_COLUMN_G_NOTE_GROUPID_2);
1659
1660 query.append(_FINDER_COLUMN_G_NOTE_ENTRYCOUNT_2);
1661
1662 if (orderByComparator != null) {
1663 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1664 orderByComparator);
1665 }
1666
1667 else {
1668 query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
1669 }
1670
1671 String sql = query.toString();
1672
1673 Session session = null;
1674
1675 try {
1676 session = openSession();
1677
1678 Query q = session.createQuery(sql);
1679
1680 QueryPos qPos = QueryPos.getInstance(q);
1681
1682 qPos.add(groupId);
1683
1684 qPos.add(entryCount);
1685
1686 list = (List<BlogsStatsUser>)QueryUtil.list(q, getDialect(),
1687 start, end);
1688 }
1689 catch (Exception e) {
1690 throw processException(e);
1691 }
1692 finally {
1693 if (list == null) {
1694 FinderCacheUtil.removeResult(finderPath, finderArgs);
1695 }
1696 else {
1697 cacheResult(list);
1698
1699 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1700 }
1701
1702 closeSession(session);
1703 }
1704 }
1705
1706 return list;
1707 }
1708
1709
1719 public BlogsStatsUser findByG_NotE_First(long groupId, int entryCount,
1720 OrderByComparator orderByComparator)
1721 throws NoSuchStatsUserException, SystemException {
1722 BlogsStatsUser blogsStatsUser = fetchByG_NotE_First(groupId,
1723 entryCount, orderByComparator);
1724
1725 if (blogsStatsUser != null) {
1726 return blogsStatsUser;
1727 }
1728
1729 StringBundler msg = new StringBundler(6);
1730
1731 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1732
1733 msg.append("groupId=");
1734 msg.append(groupId);
1735
1736 msg.append(", entryCount=");
1737 msg.append(entryCount);
1738
1739 msg.append(StringPool.CLOSE_CURLY_BRACE);
1740
1741 throw new NoSuchStatsUserException(msg.toString());
1742 }
1743
1744
1753 public BlogsStatsUser fetchByG_NotE_First(long groupId, int entryCount,
1754 OrderByComparator orderByComparator) throws SystemException {
1755 List<BlogsStatsUser> list = findByG_NotE(groupId, entryCount, 0, 1,
1756 orderByComparator);
1757
1758 if (!list.isEmpty()) {
1759 return list.get(0);
1760 }
1761
1762 return null;
1763 }
1764
1765
1775 public BlogsStatsUser findByG_NotE_Last(long groupId, int entryCount,
1776 OrderByComparator orderByComparator)
1777 throws NoSuchStatsUserException, SystemException {
1778 BlogsStatsUser blogsStatsUser = fetchByG_NotE_Last(groupId, entryCount,
1779 orderByComparator);
1780
1781 if (blogsStatsUser != null) {
1782 return blogsStatsUser;
1783 }
1784
1785 StringBundler msg = new StringBundler(6);
1786
1787 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1788
1789 msg.append("groupId=");
1790 msg.append(groupId);
1791
1792 msg.append(", entryCount=");
1793 msg.append(entryCount);
1794
1795 msg.append(StringPool.CLOSE_CURLY_BRACE);
1796
1797 throw new NoSuchStatsUserException(msg.toString());
1798 }
1799
1800
1809 public BlogsStatsUser fetchByG_NotE_Last(long groupId, int entryCount,
1810 OrderByComparator orderByComparator) throws SystemException {
1811 int count = countByG_NotE(groupId, entryCount);
1812
1813 List<BlogsStatsUser> list = findByG_NotE(groupId, entryCount,
1814 count - 1, count, orderByComparator);
1815
1816 if (!list.isEmpty()) {
1817 return list.get(0);
1818 }
1819
1820 return null;
1821 }
1822
1823
1834 public BlogsStatsUser[] findByG_NotE_PrevAndNext(long statsUserId,
1835 long groupId, int entryCount, OrderByComparator orderByComparator)
1836 throws NoSuchStatsUserException, SystemException {
1837 BlogsStatsUser blogsStatsUser = findByPrimaryKey(statsUserId);
1838
1839 Session session = null;
1840
1841 try {
1842 session = openSession();
1843
1844 BlogsStatsUser[] array = new BlogsStatsUserImpl[3];
1845
1846 array[0] = getByG_NotE_PrevAndNext(session, blogsStatsUser,
1847 groupId, entryCount, orderByComparator, true);
1848
1849 array[1] = blogsStatsUser;
1850
1851 array[2] = getByG_NotE_PrevAndNext(session, blogsStatsUser,
1852 groupId, entryCount, orderByComparator, false);
1853
1854 return array;
1855 }
1856 catch (Exception e) {
1857 throw processException(e);
1858 }
1859 finally {
1860 closeSession(session);
1861 }
1862 }
1863
1864 protected BlogsStatsUser getByG_NotE_PrevAndNext(Session session,
1865 BlogsStatsUser blogsStatsUser, long groupId, int entryCount,
1866 OrderByComparator orderByComparator, boolean previous) {
1867 StringBundler query = null;
1868
1869 if (orderByComparator != null) {
1870 query = new StringBundler(6 +
1871 (orderByComparator.getOrderByFields().length * 6));
1872 }
1873 else {
1874 query = new StringBundler(3);
1875 }
1876
1877 query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
1878
1879 query.append(_FINDER_COLUMN_G_NOTE_GROUPID_2);
1880
1881 query.append(_FINDER_COLUMN_G_NOTE_ENTRYCOUNT_2);
1882
1883 if (orderByComparator != null) {
1884 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1885
1886 if (orderByConditionFields.length > 0) {
1887 query.append(WHERE_AND);
1888 }
1889
1890 for (int i = 0; i < orderByConditionFields.length; i++) {
1891 query.append(_ORDER_BY_ENTITY_ALIAS);
1892 query.append(orderByConditionFields[i]);
1893
1894 if ((i + 1) < orderByConditionFields.length) {
1895 if (orderByComparator.isAscending() ^ previous) {
1896 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1897 }
1898 else {
1899 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1900 }
1901 }
1902 else {
1903 if (orderByComparator.isAscending() ^ previous) {
1904 query.append(WHERE_GREATER_THAN);
1905 }
1906 else {
1907 query.append(WHERE_LESSER_THAN);
1908 }
1909 }
1910 }
1911
1912 query.append(ORDER_BY_CLAUSE);
1913
1914 String[] orderByFields = orderByComparator.getOrderByFields();
1915
1916 for (int i = 0; i < orderByFields.length; i++) {
1917 query.append(_ORDER_BY_ENTITY_ALIAS);
1918 query.append(orderByFields[i]);
1919
1920 if ((i + 1) < orderByFields.length) {
1921 if (orderByComparator.isAscending() ^ previous) {
1922 query.append(ORDER_BY_ASC_HAS_NEXT);
1923 }
1924 else {
1925 query.append(ORDER_BY_DESC_HAS_NEXT);
1926 }
1927 }
1928 else {
1929 if (orderByComparator.isAscending() ^ previous) {
1930 query.append(ORDER_BY_ASC);
1931 }
1932 else {
1933 query.append(ORDER_BY_DESC);
1934 }
1935 }
1936 }
1937 }
1938
1939 else {
1940 query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
1941 }
1942
1943 String sql = query.toString();
1944
1945 Query q = session.createQuery(sql);
1946
1947 q.setFirstResult(0);
1948 q.setMaxResults(2);
1949
1950 QueryPos qPos = QueryPos.getInstance(q);
1951
1952 qPos.add(groupId);
1953
1954 qPos.add(entryCount);
1955
1956 if (orderByComparator != null) {
1957 Object[] values = orderByComparator.getOrderByConditionValues(blogsStatsUser);
1958
1959 for (Object value : values) {
1960 qPos.add(value);
1961 }
1962 }
1963
1964 List<BlogsStatsUser> list = q.list();
1965
1966 if (list.size() == 2) {
1967 return list.get(1);
1968 }
1969 else {
1970 return null;
1971 }
1972 }
1973
1974
1982 public List<BlogsStatsUser> findByC_NotE(long companyId, int entryCount)
1983 throws SystemException {
1984 return findByC_NotE(companyId, entryCount, QueryUtil.ALL_POS,
1985 QueryUtil.ALL_POS, null);
1986 }
1987
1988
2002 public List<BlogsStatsUser> findByC_NotE(long companyId, int entryCount,
2003 int start, int end) throws SystemException {
2004 return findByC_NotE(companyId, entryCount, start, end, null);
2005 }
2006
2007
2022 public List<BlogsStatsUser> findByC_NotE(long companyId, int entryCount,
2023 int start, int end, OrderByComparator orderByComparator)
2024 throws SystemException {
2025 FinderPath finderPath = null;
2026 Object[] finderArgs = null;
2027
2028 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_NOTE;
2029 finderArgs = new Object[] {
2030 companyId, entryCount,
2031
2032 start, end, orderByComparator
2033 };
2034
2035 List<BlogsStatsUser> list = (List<BlogsStatsUser>)FinderCacheUtil.getResult(finderPath,
2036 finderArgs, this);
2037
2038 if ((list != null) && !list.isEmpty()) {
2039 for (BlogsStatsUser blogsStatsUser : list) {
2040 if ((companyId != blogsStatsUser.getCompanyId()) ||
2041 (entryCount != blogsStatsUser.getEntryCount())) {
2042 list = null;
2043
2044 break;
2045 }
2046 }
2047 }
2048
2049 if (list == null) {
2050 StringBundler query = null;
2051
2052 if (orderByComparator != null) {
2053 query = new StringBundler(4 +
2054 (orderByComparator.getOrderByFields().length * 3));
2055 }
2056 else {
2057 query = new StringBundler(4);
2058 }
2059
2060 query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
2061
2062 query.append(_FINDER_COLUMN_C_NOTE_COMPANYID_2);
2063
2064 query.append(_FINDER_COLUMN_C_NOTE_ENTRYCOUNT_2);
2065
2066 if (orderByComparator != null) {
2067 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2068 orderByComparator);
2069 }
2070
2071 else {
2072 query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
2073 }
2074
2075 String sql = query.toString();
2076
2077 Session session = null;
2078
2079 try {
2080 session = openSession();
2081
2082 Query q = session.createQuery(sql);
2083
2084 QueryPos qPos = QueryPos.getInstance(q);
2085
2086 qPos.add(companyId);
2087
2088 qPos.add(entryCount);
2089
2090 list = (List<BlogsStatsUser>)QueryUtil.list(q, getDialect(),
2091 start, end);
2092 }
2093 catch (Exception e) {
2094 throw processException(e);
2095 }
2096 finally {
2097 if (list == null) {
2098 FinderCacheUtil.removeResult(finderPath, finderArgs);
2099 }
2100 else {
2101 cacheResult(list);
2102
2103 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2104 }
2105
2106 closeSession(session);
2107 }
2108 }
2109
2110 return list;
2111 }
2112
2113
2123 public BlogsStatsUser findByC_NotE_First(long companyId, int entryCount,
2124 OrderByComparator orderByComparator)
2125 throws NoSuchStatsUserException, SystemException {
2126 BlogsStatsUser blogsStatsUser = fetchByC_NotE_First(companyId,
2127 entryCount, orderByComparator);
2128
2129 if (blogsStatsUser != null) {
2130 return blogsStatsUser;
2131 }
2132
2133 StringBundler msg = new StringBundler(6);
2134
2135 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2136
2137 msg.append("companyId=");
2138 msg.append(companyId);
2139
2140 msg.append(", entryCount=");
2141 msg.append(entryCount);
2142
2143 msg.append(StringPool.CLOSE_CURLY_BRACE);
2144
2145 throw new NoSuchStatsUserException(msg.toString());
2146 }
2147
2148
2157 public BlogsStatsUser fetchByC_NotE_First(long companyId, int entryCount,
2158 OrderByComparator orderByComparator) throws SystemException {
2159 List<BlogsStatsUser> list = findByC_NotE(companyId, entryCount, 0, 1,
2160 orderByComparator);
2161
2162 if (!list.isEmpty()) {
2163 return list.get(0);
2164 }
2165
2166 return null;
2167 }
2168
2169
2179 public BlogsStatsUser findByC_NotE_Last(long companyId, int entryCount,
2180 OrderByComparator orderByComparator)
2181 throws NoSuchStatsUserException, SystemException {
2182 BlogsStatsUser blogsStatsUser = fetchByC_NotE_Last(companyId,
2183 entryCount, orderByComparator);
2184
2185 if (blogsStatsUser != null) {
2186 return blogsStatsUser;
2187 }
2188
2189 StringBundler msg = new StringBundler(6);
2190
2191 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2192
2193 msg.append("companyId=");
2194 msg.append(companyId);
2195
2196 msg.append(", entryCount=");
2197 msg.append(entryCount);
2198
2199 msg.append(StringPool.CLOSE_CURLY_BRACE);
2200
2201 throw new NoSuchStatsUserException(msg.toString());
2202 }
2203
2204
2213 public BlogsStatsUser fetchByC_NotE_Last(long companyId, int entryCount,
2214 OrderByComparator orderByComparator) throws SystemException {
2215 int count = countByC_NotE(companyId, entryCount);
2216
2217 List<BlogsStatsUser> list = findByC_NotE(companyId, entryCount,
2218 count - 1, count, orderByComparator);
2219
2220 if (!list.isEmpty()) {
2221 return list.get(0);
2222 }
2223
2224 return null;
2225 }
2226
2227
2238 public BlogsStatsUser[] findByC_NotE_PrevAndNext(long statsUserId,
2239 long companyId, int entryCount, OrderByComparator orderByComparator)
2240 throws NoSuchStatsUserException, SystemException {
2241 BlogsStatsUser blogsStatsUser = findByPrimaryKey(statsUserId);
2242
2243 Session session = null;
2244
2245 try {
2246 session = openSession();
2247
2248 BlogsStatsUser[] array = new BlogsStatsUserImpl[3];
2249
2250 array[0] = getByC_NotE_PrevAndNext(session, blogsStatsUser,
2251 companyId, entryCount, orderByComparator, true);
2252
2253 array[1] = blogsStatsUser;
2254
2255 array[2] = getByC_NotE_PrevAndNext(session, blogsStatsUser,
2256 companyId, entryCount, orderByComparator, false);
2257
2258 return array;
2259 }
2260 catch (Exception e) {
2261 throw processException(e);
2262 }
2263 finally {
2264 closeSession(session);
2265 }
2266 }
2267
2268 protected BlogsStatsUser getByC_NotE_PrevAndNext(Session session,
2269 BlogsStatsUser blogsStatsUser, long companyId, int entryCount,
2270 OrderByComparator orderByComparator, boolean previous) {
2271 StringBundler query = null;
2272
2273 if (orderByComparator != null) {
2274 query = new StringBundler(6 +
2275 (orderByComparator.getOrderByFields().length * 6));
2276 }
2277 else {
2278 query = new StringBundler(3);
2279 }
2280
2281 query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
2282
2283 query.append(_FINDER_COLUMN_C_NOTE_COMPANYID_2);
2284
2285 query.append(_FINDER_COLUMN_C_NOTE_ENTRYCOUNT_2);
2286
2287 if (orderByComparator != null) {
2288 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2289
2290 if (orderByConditionFields.length > 0) {
2291 query.append(WHERE_AND);
2292 }
2293
2294 for (int i = 0; i < orderByConditionFields.length; i++) {
2295 query.append(_ORDER_BY_ENTITY_ALIAS);
2296 query.append(orderByConditionFields[i]);
2297
2298 if ((i + 1) < orderByConditionFields.length) {
2299 if (orderByComparator.isAscending() ^ previous) {
2300 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2301 }
2302 else {
2303 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2304 }
2305 }
2306 else {
2307 if (orderByComparator.isAscending() ^ previous) {
2308 query.append(WHERE_GREATER_THAN);
2309 }
2310 else {
2311 query.append(WHERE_LESSER_THAN);
2312 }
2313 }
2314 }
2315
2316 query.append(ORDER_BY_CLAUSE);
2317
2318 String[] orderByFields = orderByComparator.getOrderByFields();
2319
2320 for (int i = 0; i < orderByFields.length; i++) {
2321 query.append(_ORDER_BY_ENTITY_ALIAS);
2322 query.append(orderByFields[i]);
2323
2324 if ((i + 1) < orderByFields.length) {
2325 if (orderByComparator.isAscending() ^ previous) {
2326 query.append(ORDER_BY_ASC_HAS_NEXT);
2327 }
2328 else {
2329 query.append(ORDER_BY_DESC_HAS_NEXT);
2330 }
2331 }
2332 else {
2333 if (orderByComparator.isAscending() ^ previous) {
2334 query.append(ORDER_BY_ASC);
2335 }
2336 else {
2337 query.append(ORDER_BY_DESC);
2338 }
2339 }
2340 }
2341 }
2342
2343 else {
2344 query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
2345 }
2346
2347 String sql = query.toString();
2348
2349 Query q = session.createQuery(sql);
2350
2351 q.setFirstResult(0);
2352 q.setMaxResults(2);
2353
2354 QueryPos qPos = QueryPos.getInstance(q);
2355
2356 qPos.add(companyId);
2357
2358 qPos.add(entryCount);
2359
2360 if (orderByComparator != null) {
2361 Object[] values = orderByComparator.getOrderByConditionValues(blogsStatsUser);
2362
2363 for (Object value : values) {
2364 qPos.add(value);
2365 }
2366 }
2367
2368 List<BlogsStatsUser> list = q.list();
2369
2370 if (list.size() == 2) {
2371 return list.get(1);
2372 }
2373 else {
2374 return null;
2375 }
2376 }
2377
2378
2386 public List<BlogsStatsUser> findByU_L(long userId, Date lastPostDate)
2387 throws SystemException {
2388 return findByU_L(userId, lastPostDate, QueryUtil.ALL_POS,
2389 QueryUtil.ALL_POS, null);
2390 }
2391
2392
2406 public List<BlogsStatsUser> findByU_L(long userId, Date lastPostDate,
2407 int start, int end) throws SystemException {
2408 return findByU_L(userId, lastPostDate, start, end, null);
2409 }
2410
2411
2426 public List<BlogsStatsUser> findByU_L(long userId, Date lastPostDate,
2427 int start, int end, OrderByComparator orderByComparator)
2428 throws SystemException {
2429 FinderPath finderPath = null;
2430 Object[] finderArgs = null;
2431
2432 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2433 (orderByComparator == null)) {
2434 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_U_L;
2435 finderArgs = new Object[] { userId, lastPostDate };
2436 }
2437 else {
2438 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_U_L;
2439 finderArgs = new Object[] {
2440 userId, lastPostDate,
2441
2442 start, end, orderByComparator
2443 };
2444 }
2445
2446 List<BlogsStatsUser> list = (List<BlogsStatsUser>)FinderCacheUtil.getResult(finderPath,
2447 finderArgs, this);
2448
2449 if ((list != null) && !list.isEmpty()) {
2450 for (BlogsStatsUser blogsStatsUser : list) {
2451 if ((userId != blogsStatsUser.getUserId()) ||
2452 !Validator.equals(lastPostDate,
2453 blogsStatsUser.getLastPostDate())) {
2454 list = null;
2455
2456 break;
2457 }
2458 }
2459 }
2460
2461 if (list == null) {
2462 StringBundler query = null;
2463
2464 if (orderByComparator != null) {
2465 query = new StringBundler(4 +
2466 (orderByComparator.getOrderByFields().length * 3));
2467 }
2468 else {
2469 query = new StringBundler(4);
2470 }
2471
2472 query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
2473
2474 query.append(_FINDER_COLUMN_U_L_USERID_2);
2475
2476 if (lastPostDate == null) {
2477 query.append(_FINDER_COLUMN_U_L_LASTPOSTDATE_1);
2478 }
2479 else {
2480 query.append(_FINDER_COLUMN_U_L_LASTPOSTDATE_2);
2481 }
2482
2483 if (orderByComparator != null) {
2484 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2485 orderByComparator);
2486 }
2487
2488 else {
2489 query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
2490 }
2491
2492 String sql = query.toString();
2493
2494 Session session = null;
2495
2496 try {
2497 session = openSession();
2498
2499 Query q = session.createQuery(sql);
2500
2501 QueryPos qPos = QueryPos.getInstance(q);
2502
2503 qPos.add(userId);
2504
2505 if (lastPostDate != null) {
2506 qPos.add(CalendarUtil.getTimestamp(lastPostDate));
2507 }
2508
2509 list = (List<BlogsStatsUser>)QueryUtil.list(q, getDialect(),
2510 start, end);
2511 }
2512 catch (Exception e) {
2513 throw processException(e);
2514 }
2515 finally {
2516 if (list == null) {
2517 FinderCacheUtil.removeResult(finderPath, finderArgs);
2518 }
2519 else {
2520 cacheResult(list);
2521
2522 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2523 }
2524
2525 closeSession(session);
2526 }
2527 }
2528
2529 return list;
2530 }
2531
2532
2542 public BlogsStatsUser findByU_L_First(long userId, Date lastPostDate,
2543 OrderByComparator orderByComparator)
2544 throws NoSuchStatsUserException, SystemException {
2545 BlogsStatsUser blogsStatsUser = fetchByU_L_First(userId, lastPostDate,
2546 orderByComparator);
2547
2548 if (blogsStatsUser != null) {
2549 return blogsStatsUser;
2550 }
2551
2552 StringBundler msg = new StringBundler(6);
2553
2554 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2555
2556 msg.append("userId=");
2557 msg.append(userId);
2558
2559 msg.append(", lastPostDate=");
2560 msg.append(lastPostDate);
2561
2562 msg.append(StringPool.CLOSE_CURLY_BRACE);
2563
2564 throw new NoSuchStatsUserException(msg.toString());
2565 }
2566
2567
2576 public BlogsStatsUser fetchByU_L_First(long userId, Date lastPostDate,
2577 OrderByComparator orderByComparator) throws SystemException {
2578 List<BlogsStatsUser> list = findByU_L(userId, lastPostDate, 0, 1,
2579 orderByComparator);
2580
2581 if (!list.isEmpty()) {
2582 return list.get(0);
2583 }
2584
2585 return null;
2586 }
2587
2588
2598 public BlogsStatsUser findByU_L_Last(long userId, Date lastPostDate,
2599 OrderByComparator orderByComparator)
2600 throws NoSuchStatsUserException, SystemException {
2601 BlogsStatsUser blogsStatsUser = fetchByU_L_Last(userId, lastPostDate,
2602 orderByComparator);
2603
2604 if (blogsStatsUser != null) {
2605 return blogsStatsUser;
2606 }
2607
2608 StringBundler msg = new StringBundler(6);
2609
2610 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2611
2612 msg.append("userId=");
2613 msg.append(userId);
2614
2615 msg.append(", lastPostDate=");
2616 msg.append(lastPostDate);
2617
2618 msg.append(StringPool.CLOSE_CURLY_BRACE);
2619
2620 throw new NoSuchStatsUserException(msg.toString());
2621 }
2622
2623
2632 public BlogsStatsUser fetchByU_L_Last(long userId, Date lastPostDate,
2633 OrderByComparator orderByComparator) throws SystemException {
2634 int count = countByU_L(userId, lastPostDate);
2635
2636 List<BlogsStatsUser> list = findByU_L(userId, lastPostDate, count - 1,
2637 count, orderByComparator);
2638
2639 if (!list.isEmpty()) {
2640 return list.get(0);
2641 }
2642
2643 return null;
2644 }
2645
2646
2657 public BlogsStatsUser[] findByU_L_PrevAndNext(long statsUserId,
2658 long userId, Date lastPostDate, OrderByComparator orderByComparator)
2659 throws NoSuchStatsUserException, SystemException {
2660 BlogsStatsUser blogsStatsUser = findByPrimaryKey(statsUserId);
2661
2662 Session session = null;
2663
2664 try {
2665 session = openSession();
2666
2667 BlogsStatsUser[] array = new BlogsStatsUserImpl[3];
2668
2669 array[0] = getByU_L_PrevAndNext(session, blogsStatsUser, userId,
2670 lastPostDate, orderByComparator, true);
2671
2672 array[1] = blogsStatsUser;
2673
2674 array[2] = getByU_L_PrevAndNext(session, blogsStatsUser, userId,
2675 lastPostDate, orderByComparator, false);
2676
2677 return array;
2678 }
2679 catch (Exception e) {
2680 throw processException(e);
2681 }
2682 finally {
2683 closeSession(session);
2684 }
2685 }
2686
2687 protected BlogsStatsUser getByU_L_PrevAndNext(Session session,
2688 BlogsStatsUser blogsStatsUser, long userId, Date lastPostDate,
2689 OrderByComparator orderByComparator, boolean previous) {
2690 StringBundler query = null;
2691
2692 if (orderByComparator != null) {
2693 query = new StringBundler(6 +
2694 (orderByComparator.getOrderByFields().length * 6));
2695 }
2696 else {
2697 query = new StringBundler(3);
2698 }
2699
2700 query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
2701
2702 query.append(_FINDER_COLUMN_U_L_USERID_2);
2703
2704 if (lastPostDate == null) {
2705 query.append(_FINDER_COLUMN_U_L_LASTPOSTDATE_1);
2706 }
2707 else {
2708 query.append(_FINDER_COLUMN_U_L_LASTPOSTDATE_2);
2709 }
2710
2711 if (orderByComparator != null) {
2712 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2713
2714 if (orderByConditionFields.length > 0) {
2715 query.append(WHERE_AND);
2716 }
2717
2718 for (int i = 0; i < orderByConditionFields.length; i++) {
2719 query.append(_ORDER_BY_ENTITY_ALIAS);
2720 query.append(orderByConditionFields[i]);
2721
2722 if ((i + 1) < orderByConditionFields.length) {
2723 if (orderByComparator.isAscending() ^ previous) {
2724 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2725 }
2726 else {
2727 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2728 }
2729 }
2730 else {
2731 if (orderByComparator.isAscending() ^ previous) {
2732 query.append(WHERE_GREATER_THAN);
2733 }
2734 else {
2735 query.append(WHERE_LESSER_THAN);
2736 }
2737 }
2738 }
2739
2740 query.append(ORDER_BY_CLAUSE);
2741
2742 String[] orderByFields = orderByComparator.getOrderByFields();
2743
2744 for (int i = 0; i < orderByFields.length; i++) {
2745 query.append(_ORDER_BY_ENTITY_ALIAS);
2746 query.append(orderByFields[i]);
2747
2748 if ((i + 1) < orderByFields.length) {
2749 if (orderByComparator.isAscending() ^ previous) {
2750 query.append(ORDER_BY_ASC_HAS_NEXT);
2751 }
2752 else {
2753 query.append(ORDER_BY_DESC_HAS_NEXT);
2754 }
2755 }
2756 else {
2757 if (orderByComparator.isAscending() ^ previous) {
2758 query.append(ORDER_BY_ASC);
2759 }
2760 else {
2761 query.append(ORDER_BY_DESC);
2762 }
2763 }
2764 }
2765 }
2766
2767 else {
2768 query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
2769 }
2770
2771 String sql = query.toString();
2772
2773 Query q = session.createQuery(sql);
2774
2775 q.setFirstResult(0);
2776 q.setMaxResults(2);
2777
2778 QueryPos qPos = QueryPos.getInstance(q);
2779
2780 qPos.add(userId);
2781
2782 if (lastPostDate != null) {
2783 qPos.add(CalendarUtil.getTimestamp(lastPostDate));
2784 }
2785
2786 if (orderByComparator != null) {
2787 Object[] values = orderByComparator.getOrderByConditionValues(blogsStatsUser);
2788
2789 for (Object value : values) {
2790 qPos.add(value);
2791 }
2792 }
2793
2794 List<BlogsStatsUser> list = q.list();
2795
2796 if (list.size() == 2) {
2797 return list.get(1);
2798 }
2799 else {
2800 return null;
2801 }
2802 }
2803
2804
2810 public List<BlogsStatsUser> findAll() throws SystemException {
2811 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2812 }
2813
2814
2826 public List<BlogsStatsUser> findAll(int start, int end)
2827 throws SystemException {
2828 return findAll(start, end, null);
2829 }
2830
2831
2844 public List<BlogsStatsUser> findAll(int start, int end,
2845 OrderByComparator orderByComparator) throws SystemException {
2846 FinderPath finderPath = null;
2847 Object[] finderArgs = new Object[] { start, end, orderByComparator };
2848
2849 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2850 (orderByComparator == null)) {
2851 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
2852 finderArgs = FINDER_ARGS_EMPTY;
2853 }
2854 else {
2855 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
2856 finderArgs = new Object[] { start, end, orderByComparator };
2857 }
2858
2859 List<BlogsStatsUser> list = (List<BlogsStatsUser>)FinderCacheUtil.getResult(finderPath,
2860 finderArgs, this);
2861
2862 if (list == null) {
2863 StringBundler query = null;
2864 String sql = null;
2865
2866 if (orderByComparator != null) {
2867 query = new StringBundler(2 +
2868 (orderByComparator.getOrderByFields().length * 3));
2869
2870 query.append(_SQL_SELECT_BLOGSSTATSUSER);
2871
2872 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2873 orderByComparator);
2874
2875 sql = query.toString();
2876 }
2877 else {
2878 sql = _SQL_SELECT_BLOGSSTATSUSER.concat(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
2879 }
2880
2881 Session session = null;
2882
2883 try {
2884 session = openSession();
2885
2886 Query q = session.createQuery(sql);
2887
2888 if (orderByComparator == null) {
2889 list = (List<BlogsStatsUser>)QueryUtil.list(q,
2890 getDialect(), start, end, false);
2891
2892 Collections.sort(list);
2893 }
2894 else {
2895 list = (List<BlogsStatsUser>)QueryUtil.list(q,
2896 getDialect(), start, end);
2897 }
2898 }
2899 catch (Exception e) {
2900 throw processException(e);
2901 }
2902 finally {
2903 if (list == null) {
2904 FinderCacheUtil.removeResult(finderPath, finderArgs);
2905 }
2906 else {
2907 cacheResult(list);
2908
2909 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2910 }
2911
2912 closeSession(session);
2913 }
2914 }
2915
2916 return list;
2917 }
2918
2919
2925 public void removeByGroupId(long groupId) throws SystemException {
2926 for (BlogsStatsUser blogsStatsUser : findByGroupId(groupId)) {
2927 remove(blogsStatsUser);
2928 }
2929 }
2930
2931
2937 public void removeByUserId(long userId) throws SystemException {
2938 for (BlogsStatsUser blogsStatsUser : findByUserId(userId)) {
2939 remove(blogsStatsUser);
2940 }
2941 }
2942
2943
2951 public BlogsStatsUser removeByG_U(long groupId, long userId)
2952 throws NoSuchStatsUserException, SystemException {
2953 BlogsStatsUser blogsStatsUser = findByG_U(groupId, userId);
2954
2955 return remove(blogsStatsUser);
2956 }
2957
2958
2965 public void removeByG_NotE(long groupId, int entryCount)
2966 throws SystemException {
2967 for (BlogsStatsUser blogsStatsUser : findByG_NotE(groupId, entryCount)) {
2968 remove(blogsStatsUser);
2969 }
2970 }
2971
2972
2979 public void removeByC_NotE(long companyId, int entryCount)
2980 throws SystemException {
2981 for (BlogsStatsUser blogsStatsUser : findByC_NotE(companyId, entryCount)) {
2982 remove(blogsStatsUser);
2983 }
2984 }
2985
2986
2993 public void removeByU_L(long userId, Date lastPostDate)
2994 throws SystemException {
2995 for (BlogsStatsUser blogsStatsUser : findByU_L(userId, lastPostDate)) {
2996 remove(blogsStatsUser);
2997 }
2998 }
2999
3000
3005 public void removeAll() throws SystemException {
3006 for (BlogsStatsUser blogsStatsUser : findAll()) {
3007 remove(blogsStatsUser);
3008 }
3009 }
3010
3011
3018 public int countByGroupId(long groupId) throws SystemException {
3019 Object[] finderArgs = new Object[] { groupId };
3020
3021 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
3022 finderArgs, this);
3023
3024 if (count == null) {
3025 StringBundler query = new StringBundler(2);
3026
3027 query.append(_SQL_COUNT_BLOGSSTATSUSER_WHERE);
3028
3029 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
3030
3031 String sql = query.toString();
3032
3033 Session session = null;
3034
3035 try {
3036 session = openSession();
3037
3038 Query q = session.createQuery(sql);
3039
3040 QueryPos qPos = QueryPos.getInstance(q);
3041
3042 qPos.add(groupId);
3043
3044 count = (Long)q.uniqueResult();
3045 }
3046 catch (Exception e) {
3047 throw processException(e);
3048 }
3049 finally {
3050 if (count == null) {
3051 count = Long.valueOf(0);
3052 }
3053
3054 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
3055 finderArgs, count);
3056
3057 closeSession(session);
3058 }
3059 }
3060
3061 return count.intValue();
3062 }
3063
3064
3071 public int countByUserId(long userId) throws SystemException {
3072 Object[] finderArgs = new Object[] { userId };
3073
3074 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERID,
3075 finderArgs, this);
3076
3077 if (count == null) {
3078 StringBundler query = new StringBundler(2);
3079
3080 query.append(_SQL_COUNT_BLOGSSTATSUSER_WHERE);
3081
3082 query.append(_FINDER_COLUMN_USERID_USERID_2);
3083
3084 String sql = query.toString();
3085
3086 Session session = null;
3087
3088 try {
3089 session = openSession();
3090
3091 Query q = session.createQuery(sql);
3092
3093 QueryPos qPos = QueryPos.getInstance(q);
3094
3095 qPos.add(userId);
3096
3097 count = (Long)q.uniqueResult();
3098 }
3099 catch (Exception e) {
3100 throw processException(e);
3101 }
3102 finally {
3103 if (count == null) {
3104 count = Long.valueOf(0);
3105 }
3106
3107 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERID,
3108 finderArgs, count);
3109
3110 closeSession(session);
3111 }
3112 }
3113
3114 return count.intValue();
3115 }
3116
3117
3125 public int countByG_U(long groupId, long userId) throws SystemException {
3126 Object[] finderArgs = new Object[] { groupId, userId };
3127
3128 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_U,
3129 finderArgs, this);
3130
3131 if (count == null) {
3132 StringBundler query = new StringBundler(3);
3133
3134 query.append(_SQL_COUNT_BLOGSSTATSUSER_WHERE);
3135
3136 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
3137
3138 query.append(_FINDER_COLUMN_G_U_USERID_2);
3139
3140 String sql = query.toString();
3141
3142 Session session = null;
3143
3144 try {
3145 session = openSession();
3146
3147 Query q = session.createQuery(sql);
3148
3149 QueryPos qPos = QueryPos.getInstance(q);
3150
3151 qPos.add(groupId);
3152
3153 qPos.add(userId);
3154
3155 count = (Long)q.uniqueResult();
3156 }
3157 catch (Exception e) {
3158 throw processException(e);
3159 }
3160 finally {
3161 if (count == null) {
3162 count = Long.valueOf(0);
3163 }
3164
3165 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_U, finderArgs,
3166 count);
3167
3168 closeSession(session);
3169 }
3170 }
3171
3172 return count.intValue();
3173 }
3174
3175
3183 public int countByG_NotE(long groupId, int entryCount)
3184 throws SystemException {
3185 Object[] finderArgs = new Object[] { groupId, entryCount };
3186
3187 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_G_NOTE,
3188 finderArgs, this);
3189
3190 if (count == null) {
3191 StringBundler query = new StringBundler(3);
3192
3193 query.append(_SQL_COUNT_BLOGSSTATSUSER_WHERE);
3194
3195 query.append(_FINDER_COLUMN_G_NOTE_GROUPID_2);
3196
3197 query.append(_FINDER_COLUMN_G_NOTE_ENTRYCOUNT_2);
3198
3199 String sql = query.toString();
3200
3201 Session session = null;
3202
3203 try {
3204 session = openSession();
3205
3206 Query q = session.createQuery(sql);
3207
3208 QueryPos qPos = QueryPos.getInstance(q);
3209
3210 qPos.add(groupId);
3211
3212 qPos.add(entryCount);
3213
3214 count = (Long)q.uniqueResult();
3215 }
3216 catch (Exception e) {
3217 throw processException(e);
3218 }
3219 finally {
3220 if (count == null) {
3221 count = Long.valueOf(0);
3222 }
3223
3224 FinderCacheUtil.putResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_G_NOTE,
3225 finderArgs, count);
3226
3227 closeSession(session);
3228 }
3229 }
3230
3231 return count.intValue();
3232 }
3233
3234
3242 public int countByC_NotE(long companyId, int entryCount)
3243 throws SystemException {
3244 Object[] finderArgs = new Object[] { companyId, entryCount };
3245
3246 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_C_NOTE,
3247 finderArgs, this);
3248
3249 if (count == null) {
3250 StringBundler query = new StringBundler(3);
3251
3252 query.append(_SQL_COUNT_BLOGSSTATSUSER_WHERE);
3253
3254 query.append(_FINDER_COLUMN_C_NOTE_COMPANYID_2);
3255
3256 query.append(_FINDER_COLUMN_C_NOTE_ENTRYCOUNT_2);
3257
3258 String sql = query.toString();
3259
3260 Session session = null;
3261
3262 try {
3263 session = openSession();
3264
3265 Query q = session.createQuery(sql);
3266
3267 QueryPos qPos = QueryPos.getInstance(q);
3268
3269 qPos.add(companyId);
3270
3271 qPos.add(entryCount);
3272
3273 count = (Long)q.uniqueResult();
3274 }
3275 catch (Exception e) {
3276 throw processException(e);
3277 }
3278 finally {
3279 if (count == null) {
3280 count = Long.valueOf(0);
3281 }
3282
3283 FinderCacheUtil.putResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_C_NOTE,
3284 finderArgs, count);
3285
3286 closeSession(session);
3287 }
3288 }
3289
3290 return count.intValue();
3291 }
3292
3293
3301 public int countByU_L(long userId, Date lastPostDate)
3302 throws SystemException {
3303 Object[] finderArgs = new Object[] { userId, lastPostDate };
3304
3305 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_U_L,
3306 finderArgs, this);
3307
3308 if (count == null) {
3309 StringBundler query = new StringBundler(3);
3310
3311 query.append(_SQL_COUNT_BLOGSSTATSUSER_WHERE);
3312
3313 query.append(_FINDER_COLUMN_U_L_USERID_2);
3314
3315 if (lastPostDate == null) {
3316 query.append(_FINDER_COLUMN_U_L_LASTPOSTDATE_1);
3317 }
3318 else {
3319 query.append(_FINDER_COLUMN_U_L_LASTPOSTDATE_2);
3320 }
3321
3322 String sql = query.toString();
3323
3324 Session session = null;
3325
3326 try {
3327 session = openSession();
3328
3329 Query q = session.createQuery(sql);
3330
3331 QueryPos qPos = QueryPos.getInstance(q);
3332
3333 qPos.add(userId);
3334
3335 if (lastPostDate != null) {
3336 qPos.add(CalendarUtil.getTimestamp(lastPostDate));
3337 }
3338
3339 count = (Long)q.uniqueResult();
3340 }
3341 catch (Exception e) {
3342 throw processException(e);
3343 }
3344 finally {
3345 if (count == null) {
3346 count = Long.valueOf(0);
3347 }
3348
3349 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_U_L, finderArgs,
3350 count);
3351
3352 closeSession(session);
3353 }
3354 }
3355
3356 return count.intValue();
3357 }
3358
3359
3365 public int countAll() throws SystemException {
3366 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3367 FINDER_ARGS_EMPTY, this);
3368
3369 if (count == null) {
3370 Session session = null;
3371
3372 try {
3373 session = openSession();
3374
3375 Query q = session.createQuery(_SQL_COUNT_BLOGSSTATSUSER);
3376
3377 count = (Long)q.uniqueResult();
3378 }
3379 catch (Exception e) {
3380 throw processException(e);
3381 }
3382 finally {
3383 if (count == null) {
3384 count = Long.valueOf(0);
3385 }
3386
3387 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
3388 FINDER_ARGS_EMPTY, count);
3389
3390 closeSession(session);
3391 }
3392 }
3393
3394 return count.intValue();
3395 }
3396
3397
3400 public void afterPropertiesSet() {
3401 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3402 com.liferay.portal.util.PropsUtil.get(
3403 "value.object.listener.com.liferay.portlet.blogs.model.BlogsStatsUser")));
3404
3405 if (listenerClassNames.length > 0) {
3406 try {
3407 List<ModelListener<BlogsStatsUser>> listenersList = new ArrayList<ModelListener<BlogsStatsUser>>();
3408
3409 for (String listenerClassName : listenerClassNames) {
3410 Class<?> clazz = getClass();
3411
3412 listenersList.add((ModelListener<BlogsStatsUser>)InstanceFactory.newInstance(
3413 clazz.getClassLoader(), listenerClassName));
3414 }
3415
3416 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3417 }
3418 catch (Exception e) {
3419 _log.error(e);
3420 }
3421 }
3422 }
3423
3424 public void destroy() {
3425 EntityCacheUtil.removeCache(BlogsStatsUserImpl.class.getName());
3426 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
3427 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
3428 }
3429
3430 @BeanReference(type = BlogsEntryPersistence.class)
3431 protected BlogsEntryPersistence blogsEntryPersistence;
3432 @BeanReference(type = BlogsStatsUserPersistence.class)
3433 protected BlogsStatsUserPersistence blogsStatsUserPersistence;
3434 @BeanReference(type = GroupPersistence.class)
3435 protected GroupPersistence groupPersistence;
3436 @BeanReference(type = ResourcePersistence.class)
3437 protected ResourcePersistence resourcePersistence;
3438 @BeanReference(type = UserPersistence.class)
3439 protected UserPersistence userPersistence;
3440 private static final String _SQL_SELECT_BLOGSSTATSUSER = "SELECT blogsStatsUser FROM BlogsStatsUser blogsStatsUser";
3441 private static final String _SQL_SELECT_BLOGSSTATSUSER_WHERE = "SELECT blogsStatsUser FROM BlogsStatsUser blogsStatsUser WHERE ";
3442 private static final String _SQL_COUNT_BLOGSSTATSUSER = "SELECT COUNT(blogsStatsUser) FROM BlogsStatsUser blogsStatsUser";
3443 private static final String _SQL_COUNT_BLOGSSTATSUSER_WHERE = "SELECT COUNT(blogsStatsUser) FROM BlogsStatsUser blogsStatsUser WHERE ";
3444 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "blogsStatsUser.groupId = ?";
3445 private static final String _FINDER_COLUMN_USERID_USERID_2 = "blogsStatsUser.userId = ?";
3446 private static final String _FINDER_COLUMN_G_U_GROUPID_2 = "blogsStatsUser.groupId = ? AND ";
3447 private static final String _FINDER_COLUMN_G_U_USERID_2 = "blogsStatsUser.userId = ?";
3448 private static final String _FINDER_COLUMN_G_NOTE_GROUPID_2 = "blogsStatsUser.groupId = ? AND ";
3449 private static final String _FINDER_COLUMN_G_NOTE_ENTRYCOUNT_2 = "blogsStatsUser.entryCount != ?";
3450 private static final String _FINDER_COLUMN_C_NOTE_COMPANYID_2 = "blogsStatsUser.companyId = ? AND ";
3451 private static final String _FINDER_COLUMN_C_NOTE_ENTRYCOUNT_2 = "blogsStatsUser.entryCount != ?";
3452 private static final String _FINDER_COLUMN_U_L_USERID_2 = "blogsStatsUser.userId = ? AND ";
3453 private static final String _FINDER_COLUMN_U_L_LASTPOSTDATE_1 = "blogsStatsUser.lastPostDate IS NULL";
3454 private static final String _FINDER_COLUMN_U_L_LASTPOSTDATE_2 = "blogsStatsUser.lastPostDate = ?";
3455 private static final String _ORDER_BY_ENTITY_ALIAS = "blogsStatsUser.";
3456 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No BlogsStatsUser exists with the primary key ";
3457 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No BlogsStatsUser exists with the key {";
3458 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
3459 private static Log _log = LogFactoryUtil.getLog(BlogsStatsUserPersistenceImpl.class);
3460 private static BlogsStatsUser _nullBlogsStatsUser = new BlogsStatsUserImpl() {
3461 @Override
3462 public Object clone() {
3463 return this;
3464 }
3465
3466 @Override
3467 public CacheModel<BlogsStatsUser> toCacheModel() {
3468 return _nullBlogsStatsUserCacheModel;
3469 }
3470 };
3471
3472 private static CacheModel<BlogsStatsUser> _nullBlogsStatsUserCacheModel = new CacheModel<BlogsStatsUser>() {
3473 public BlogsStatsUser toEntityModel() {
3474 return _nullBlogsStatsUser;
3475 }
3476 };
3477 }