001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.blogs.service.persistence;
016    
017    import com.liferay.portal.NoSuchModelException;
018    import com.liferay.portal.kernel.annotation.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.model.ModelListener;
038    import com.liferay.portal.service.persistence.BatchSessionUtil;
039    import com.liferay.portal.service.persistence.GroupPersistence;
040    import com.liferay.portal.service.persistence.ResourcePersistence;
041    import com.liferay.portal.service.persistence.UserPersistence;
042    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
043    
044    import com.liferay.portlet.blogs.NoSuchStatsUserException;
045    import com.liferay.portlet.blogs.model.BlogsStatsUser;
046    import com.liferay.portlet.blogs.model.impl.BlogsStatsUserImpl;
047    import com.liferay.portlet.blogs.model.impl.BlogsStatsUserModelImpl;
048    
049    import java.io.Serializable;
050    
051    import java.util.ArrayList;
052    import java.util.Collections;
053    import java.util.Date;
054    import java.util.List;
055    
056    /**
057     * The persistence implementation for the blogs stats user service.
058     *
059     * <p>
060     * Never modify or reference this class directly. Always use {@link BlogsStatsUserUtil} to access the blogs stats user persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
061     * </p>
062     *
063     * <p>
064     * Caching information and settings can be found in <code>portal.properties</code>
065     * </p>
066     *
067     * @author Brian Wing Shun Chan
068     * @see BlogsStatsUserPersistence
069     * @see BlogsStatsUserUtil
070     * @generated
071     */
072    public class BlogsStatsUserPersistenceImpl extends BasePersistenceImpl<BlogsStatsUser>
073            implements BlogsStatsUserPersistence {
074            public static final String FINDER_CLASS_NAME_ENTITY = BlogsStatsUserImpl.class.getName();
075            public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
076                    ".List";
077            public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
078                            BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
079                            FINDER_CLASS_NAME_LIST, "findByGroupId",
080                            new String[] {
081                                    Long.class.getName(),
082                                    
083                            "java.lang.Integer", "java.lang.Integer",
084                                    "com.liferay.portal.kernel.util.OrderByComparator"
085                            });
086            public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
087                            BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
088                            FINDER_CLASS_NAME_LIST, "countByGroupId",
089                            new String[] { Long.class.getName() });
090            public static final FinderPath FINDER_PATH_FIND_BY_USERID = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
091                            BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
092                            FINDER_CLASS_NAME_LIST, "findByUserId",
093                            new String[] {
094                                    Long.class.getName(),
095                                    
096                            "java.lang.Integer", "java.lang.Integer",
097                                    "com.liferay.portal.kernel.util.OrderByComparator"
098                            });
099            public static final FinderPath FINDER_PATH_COUNT_BY_USERID = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
100                            BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
101                            FINDER_CLASS_NAME_LIST, "countByUserId",
102                            new String[] { Long.class.getName() });
103            public static final FinderPath FINDER_PATH_FETCH_BY_G_U = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
104                            BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
105                            FINDER_CLASS_NAME_ENTITY, "fetchByG_U",
106                            new String[] { Long.class.getName(), Long.class.getName() });
107            public static final FinderPath FINDER_PATH_COUNT_BY_G_U = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
108                            BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
109                            FINDER_CLASS_NAME_LIST, "countByG_U",
110                            new String[] { Long.class.getName(), Long.class.getName() });
111            public static final FinderPath FINDER_PATH_FIND_BY_G_NOTE = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
112                            BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
113                            FINDER_CLASS_NAME_LIST, "findByG_NotE",
114                            new String[] {
115                                    Long.class.getName(), Integer.class.getName(),
116                                    
117                            "java.lang.Integer", "java.lang.Integer",
118                                    "com.liferay.portal.kernel.util.OrderByComparator"
119                            });
120            public static final FinderPath FINDER_PATH_COUNT_BY_G_NOTE = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
121                            BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
122                            FINDER_CLASS_NAME_LIST, "countByG_NotE",
123                            new String[] { Long.class.getName(), Integer.class.getName() });
124            public static final FinderPath FINDER_PATH_FIND_BY_C_NOTE = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
125                            BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
126                            FINDER_CLASS_NAME_LIST, "findByC_NotE",
127                            new String[] {
128                                    Long.class.getName(), Integer.class.getName(),
129                                    
130                            "java.lang.Integer", "java.lang.Integer",
131                                    "com.liferay.portal.kernel.util.OrderByComparator"
132                            });
133            public static final FinderPath FINDER_PATH_COUNT_BY_C_NOTE = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
134                            BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
135                            FINDER_CLASS_NAME_LIST, "countByC_NotE",
136                            new String[] { Long.class.getName(), Integer.class.getName() });
137            public static final FinderPath FINDER_PATH_FIND_BY_U_L = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
138                            BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
139                            FINDER_CLASS_NAME_LIST, "findByU_L",
140                            new String[] {
141                                    Long.class.getName(), Date.class.getName(),
142                                    
143                            "java.lang.Integer", "java.lang.Integer",
144                                    "com.liferay.portal.kernel.util.OrderByComparator"
145                            });
146            public static final FinderPath FINDER_PATH_COUNT_BY_U_L = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
147                            BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
148                            FINDER_CLASS_NAME_LIST, "countByU_L",
149                            new String[] { Long.class.getName(), Date.class.getName() });
150            public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
151                            BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
152                            FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
153            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
154                            BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
155                            FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
156    
157            /**
158             * Caches the blogs stats user in the entity cache if it is enabled.
159             *
160             * @param blogsStatsUser the blogs stats user to cache
161             */
162            public void cacheResult(BlogsStatsUser blogsStatsUser) {
163                    EntityCacheUtil.putResult(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
164                            BlogsStatsUserImpl.class, blogsStatsUser.getPrimaryKey(),
165                            blogsStatsUser);
166    
167                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_U,
168                            new Object[] {
169                                    new Long(blogsStatsUser.getGroupId()),
170                                    new Long(blogsStatsUser.getUserId())
171                            }, blogsStatsUser);
172            }
173    
174            /**
175             * Caches the blogs stats users in the entity cache if it is enabled.
176             *
177             * @param blogsStatsUsers the blogs stats users to cache
178             */
179            public void cacheResult(List<BlogsStatsUser> blogsStatsUsers) {
180                    for (BlogsStatsUser blogsStatsUser : blogsStatsUsers) {
181                            if (EntityCacheUtil.getResult(
182                                                    BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
183                                                    BlogsStatsUserImpl.class,
184                                                    blogsStatsUser.getPrimaryKey(), this) == null) {
185                                    cacheResult(blogsStatsUser);
186                            }
187                    }
188            }
189    
190            /**
191             * Clears the cache for all blogs stats users.
192             *
193             * <p>
194             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
195             * </p>
196             */
197            public void clearCache() {
198                    CacheRegistryUtil.clear(BlogsStatsUserImpl.class.getName());
199                    EntityCacheUtil.clearCache(BlogsStatsUserImpl.class.getName());
200                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
201                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
202            }
203    
204            /**
205             * Clears the cache for the blogs stats user.
206             *
207             * <p>
208             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
209             * </p>
210             */
211            public void clearCache(BlogsStatsUser blogsStatsUser) {
212                    EntityCacheUtil.removeResult(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
213                            BlogsStatsUserImpl.class, blogsStatsUser.getPrimaryKey());
214    
215                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_U,
216                            new Object[] {
217                                    new Long(blogsStatsUser.getGroupId()),
218                                    new Long(blogsStatsUser.getUserId())
219                            });
220            }
221    
222            /**
223             * Creates a new blogs stats user with the primary key. Does not add the blogs stats user to the database.
224             *
225             * @param statsUserId the primary key for the new blogs stats user
226             * @return the new blogs stats user
227             */
228            public BlogsStatsUser create(long statsUserId) {
229                    BlogsStatsUser blogsStatsUser = new BlogsStatsUserImpl();
230    
231                    blogsStatsUser.setNew(true);
232                    blogsStatsUser.setPrimaryKey(statsUserId);
233    
234                    return blogsStatsUser;
235            }
236    
237            /**
238             * Removes the blogs stats user with the primary key from the database. Also notifies the appropriate model listeners.
239             *
240             * @param primaryKey the primary key of the blogs stats user to remove
241             * @return the blogs stats user that was removed
242             * @throws com.liferay.portal.NoSuchModelException if a blogs stats user with the primary key could not be found
243             * @throws SystemException if a system exception occurred
244             */
245            public BlogsStatsUser remove(Serializable primaryKey)
246                    throws NoSuchModelException, SystemException {
247                    return remove(((Long)primaryKey).longValue());
248            }
249    
250            /**
251             * Removes the blogs stats user with the primary key from the database. Also notifies the appropriate model listeners.
252             *
253             * @param statsUserId the primary key of the blogs stats user to remove
254             * @return the blogs stats user that was removed
255             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a blogs stats user with the primary key could not be found
256             * @throws SystemException if a system exception occurred
257             */
258            public BlogsStatsUser remove(long statsUserId)
259                    throws NoSuchStatsUserException, SystemException {
260                    Session session = null;
261    
262                    try {
263                            session = openSession();
264    
265                            BlogsStatsUser blogsStatsUser = (BlogsStatsUser)session.get(BlogsStatsUserImpl.class,
266                                            new Long(statsUserId));
267    
268                            if (blogsStatsUser == null) {
269                                    if (_log.isWarnEnabled()) {
270                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + statsUserId);
271                                    }
272    
273                                    throw new NoSuchStatsUserException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
274                                            statsUserId);
275                            }
276    
277                            return remove(blogsStatsUser);
278                    }
279                    catch (NoSuchStatsUserException nsee) {
280                            throw nsee;
281                    }
282                    catch (Exception e) {
283                            throw processException(e);
284                    }
285                    finally {
286                            closeSession(session);
287                    }
288            }
289    
290            protected BlogsStatsUser removeImpl(BlogsStatsUser blogsStatsUser)
291                    throws SystemException {
292                    blogsStatsUser = toUnwrappedModel(blogsStatsUser);
293    
294                    Session session = null;
295    
296                    try {
297                            session = openSession();
298    
299                            BatchSessionUtil.delete(session, blogsStatsUser);
300                    }
301                    catch (Exception e) {
302                            throw processException(e);
303                    }
304                    finally {
305                            closeSession(session);
306                    }
307    
308                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
309    
310                    BlogsStatsUserModelImpl blogsStatsUserModelImpl = (BlogsStatsUserModelImpl)blogsStatsUser;
311    
312                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_U,
313                            new Object[] {
314                                    new Long(blogsStatsUserModelImpl.getGroupId()),
315                                    new Long(blogsStatsUserModelImpl.getUserId())
316                            });
317    
318                    EntityCacheUtil.removeResult(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
319                            BlogsStatsUserImpl.class, blogsStatsUser.getPrimaryKey());
320    
321                    return blogsStatsUser;
322            }
323    
324            public BlogsStatsUser updateImpl(
325                    com.liferay.portlet.blogs.model.BlogsStatsUser blogsStatsUser,
326                    boolean merge) throws SystemException {
327                    blogsStatsUser = toUnwrappedModel(blogsStatsUser);
328    
329                    boolean isNew = blogsStatsUser.isNew();
330    
331                    BlogsStatsUserModelImpl blogsStatsUserModelImpl = (BlogsStatsUserModelImpl)blogsStatsUser;
332    
333                    Session session = null;
334    
335                    try {
336                            session = openSession();
337    
338                            BatchSessionUtil.update(session, blogsStatsUser, merge);
339    
340                            blogsStatsUser.setNew(false);
341                    }
342                    catch (Exception e) {
343                            throw processException(e);
344                    }
345                    finally {
346                            closeSession(session);
347                    }
348    
349                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
350    
351                    EntityCacheUtil.putResult(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
352                            BlogsStatsUserImpl.class, blogsStatsUser.getPrimaryKey(),
353                            blogsStatsUser);
354    
355                    if (!isNew &&
356                                    ((blogsStatsUser.getGroupId() != blogsStatsUserModelImpl.getOriginalGroupId()) ||
357                                    (blogsStatsUser.getUserId() != blogsStatsUserModelImpl.getOriginalUserId()))) {
358                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_U,
359                                    new Object[] {
360                                            new Long(blogsStatsUserModelImpl.getOriginalGroupId()),
361                                            new Long(blogsStatsUserModelImpl.getOriginalUserId())
362                                    });
363                    }
364    
365                    if (isNew ||
366                                    ((blogsStatsUser.getGroupId() != blogsStatsUserModelImpl.getOriginalGroupId()) ||
367                                    (blogsStatsUser.getUserId() != blogsStatsUserModelImpl.getOriginalUserId()))) {
368                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_U,
369                                    new Object[] {
370                                            new Long(blogsStatsUser.getGroupId()),
371                                            new Long(blogsStatsUser.getUserId())
372                                    }, blogsStatsUser);
373                    }
374    
375                    return blogsStatsUser;
376            }
377    
378            protected BlogsStatsUser toUnwrappedModel(BlogsStatsUser blogsStatsUser) {
379                    if (blogsStatsUser instanceof BlogsStatsUserImpl) {
380                            return blogsStatsUser;
381                    }
382    
383                    BlogsStatsUserImpl blogsStatsUserImpl = new BlogsStatsUserImpl();
384    
385                    blogsStatsUserImpl.setNew(blogsStatsUser.isNew());
386                    blogsStatsUserImpl.setPrimaryKey(blogsStatsUser.getPrimaryKey());
387    
388                    blogsStatsUserImpl.setStatsUserId(blogsStatsUser.getStatsUserId());
389                    blogsStatsUserImpl.setGroupId(blogsStatsUser.getGroupId());
390                    blogsStatsUserImpl.setCompanyId(blogsStatsUser.getCompanyId());
391                    blogsStatsUserImpl.setUserId(blogsStatsUser.getUserId());
392                    blogsStatsUserImpl.setEntryCount(blogsStatsUser.getEntryCount());
393                    blogsStatsUserImpl.setLastPostDate(blogsStatsUser.getLastPostDate());
394                    blogsStatsUserImpl.setRatingsTotalEntries(blogsStatsUser.getRatingsTotalEntries());
395                    blogsStatsUserImpl.setRatingsTotalScore(blogsStatsUser.getRatingsTotalScore());
396                    blogsStatsUserImpl.setRatingsAverageScore(blogsStatsUser.getRatingsAverageScore());
397    
398                    return blogsStatsUserImpl;
399            }
400    
401            /**
402             * Finds the blogs stats user with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
403             *
404             * @param primaryKey the primary key of the blogs stats user to find
405             * @return the blogs stats user
406             * @throws com.liferay.portal.NoSuchModelException if a blogs stats user with the primary key could not be found
407             * @throws SystemException if a system exception occurred
408             */
409            public BlogsStatsUser findByPrimaryKey(Serializable primaryKey)
410                    throws NoSuchModelException, SystemException {
411                    return findByPrimaryKey(((Long)primaryKey).longValue());
412            }
413    
414            /**
415             * Finds the blogs stats user with the primary key or throws a {@link com.liferay.portlet.blogs.NoSuchStatsUserException} if it could not be found.
416             *
417             * @param statsUserId the primary key of the blogs stats user to find
418             * @return the blogs stats user
419             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a blogs stats user with the primary key could not be found
420             * @throws SystemException if a system exception occurred
421             */
422            public BlogsStatsUser findByPrimaryKey(long statsUserId)
423                    throws NoSuchStatsUserException, SystemException {
424                    BlogsStatsUser blogsStatsUser = fetchByPrimaryKey(statsUserId);
425    
426                    if (blogsStatsUser == null) {
427                            if (_log.isWarnEnabled()) {
428                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + statsUserId);
429                            }
430    
431                            throw new NoSuchStatsUserException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
432                                    statsUserId);
433                    }
434    
435                    return blogsStatsUser;
436            }
437    
438            /**
439             * Finds the blogs stats user with the primary key or returns <code>null</code> if it could not be found.
440             *
441             * @param primaryKey the primary key of the blogs stats user to find
442             * @return the blogs stats user, or <code>null</code> if a blogs stats user with the primary key could not be found
443             * @throws SystemException if a system exception occurred
444             */
445            public BlogsStatsUser fetchByPrimaryKey(Serializable primaryKey)
446                    throws SystemException {
447                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
448            }
449    
450            /**
451             * Finds the blogs stats user with the primary key or returns <code>null</code> if it could not be found.
452             *
453             * @param statsUserId the primary key of the blogs stats user to find
454             * @return the blogs stats user, or <code>null</code> if a blogs stats user with the primary key could not be found
455             * @throws SystemException if a system exception occurred
456             */
457            public BlogsStatsUser fetchByPrimaryKey(long statsUserId)
458                    throws SystemException {
459                    BlogsStatsUser blogsStatsUser = (BlogsStatsUser)EntityCacheUtil.getResult(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
460                                    BlogsStatsUserImpl.class, statsUserId, this);
461    
462                    if (blogsStatsUser == null) {
463                            Session session = null;
464    
465                            try {
466                                    session = openSession();
467    
468                                    blogsStatsUser = (BlogsStatsUser)session.get(BlogsStatsUserImpl.class,
469                                                    new Long(statsUserId));
470                            }
471                            catch (Exception e) {
472                                    throw processException(e);
473                            }
474                            finally {
475                                    if (blogsStatsUser != null) {
476                                            cacheResult(blogsStatsUser);
477                                    }
478    
479                                    closeSession(session);
480                            }
481                    }
482    
483                    return blogsStatsUser;
484            }
485    
486            /**
487             * Finds all the blogs stats users where groupId = &#63;.
488             *
489             * @param groupId the group id to search with
490             * @return the matching blogs stats users
491             * @throws SystemException if a system exception occurred
492             */
493            public List<BlogsStatsUser> findByGroupId(long groupId)
494                    throws SystemException {
495                    return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
496            }
497    
498            /**
499             * Finds a range of all the blogs stats users where groupId = &#63;.
500             *
501             * <p>
502             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
503             * </p>
504             *
505             * @param groupId the group id to search with
506             * @param start the lower bound of the range of blogs stats users to return
507             * @param end the upper bound of the range of blogs stats users to return (not inclusive)
508             * @return the range of matching blogs stats users
509             * @throws SystemException if a system exception occurred
510             */
511            public List<BlogsStatsUser> findByGroupId(long groupId, int start, int end)
512                    throws SystemException {
513                    return findByGroupId(groupId, start, end, null);
514            }
515    
516            /**
517             * Finds an ordered range of all the blogs stats users where groupId = &#63;.
518             *
519             * <p>
520             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
521             * </p>
522             *
523             * @param groupId the group id to search with
524             * @param start the lower bound of the range of blogs stats users to return
525             * @param end the upper bound of the range of blogs stats users to return (not inclusive)
526             * @param orderByComparator the comparator to order the results by
527             * @return the ordered range of matching blogs stats users
528             * @throws SystemException if a system exception occurred
529             */
530            public List<BlogsStatsUser> findByGroupId(long groupId, int start, int end,
531                    OrderByComparator orderByComparator) throws SystemException {
532                    Object[] finderArgs = new Object[] {
533                                    groupId,
534                                    
535                                    String.valueOf(start), String.valueOf(end),
536                                    String.valueOf(orderByComparator)
537                            };
538    
539                    List<BlogsStatsUser> list = (List<BlogsStatsUser>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
540                                    finderArgs, this);
541    
542                    if (list == null) {
543                            StringBundler query = null;
544    
545                            if (orderByComparator != null) {
546                                    query = new StringBundler(3 +
547                                                    (orderByComparator.getOrderByFields().length * 3));
548                            }
549                            else {
550                                    query = new StringBundler(3);
551                            }
552    
553                            query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
554    
555                            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
556    
557                            if (orderByComparator != null) {
558                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
559                                            orderByComparator);
560                            }
561    
562                            else {
563                                    query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
564                            }
565    
566                            String sql = query.toString();
567    
568                            Session session = null;
569    
570                            try {
571                                    session = openSession();
572    
573                                    Query q = session.createQuery(sql);
574    
575                                    QueryPos qPos = QueryPos.getInstance(q);
576    
577                                    qPos.add(groupId);
578    
579                                    list = (List<BlogsStatsUser>)QueryUtil.list(q, getDialect(),
580                                                    start, end);
581                            }
582                            catch (Exception e) {
583                                    throw processException(e);
584                            }
585                            finally {
586                                    if (list == null) {
587                                            FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_GROUPID,
588                                                    finderArgs);
589                                    }
590                                    else {
591                                            cacheResult(list);
592    
593                                            FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
594                                                    finderArgs, list);
595                                    }
596    
597                                    closeSession(session);
598                            }
599                    }
600    
601                    return list;
602            }
603    
604            /**
605             * Finds the first blogs stats user in the ordered set where groupId = &#63;.
606             *
607             * <p>
608             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
609             * </p>
610             *
611             * @param groupId the group id to search with
612             * @param orderByComparator the comparator to order the set by
613             * @return the first matching blogs stats user
614             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a matching blogs stats user could not be found
615             * @throws SystemException if a system exception occurred
616             */
617            public BlogsStatsUser findByGroupId_First(long groupId,
618                    OrderByComparator orderByComparator)
619                    throws NoSuchStatsUserException, SystemException {
620                    List<BlogsStatsUser> list = findByGroupId(groupId, 0, 1,
621                                    orderByComparator);
622    
623                    if (list.isEmpty()) {
624                            StringBundler msg = new StringBundler(4);
625    
626                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
627    
628                            msg.append("groupId=");
629                            msg.append(groupId);
630    
631                            msg.append(StringPool.CLOSE_CURLY_BRACE);
632    
633                            throw new NoSuchStatsUserException(msg.toString());
634                    }
635                    else {
636                            return list.get(0);
637                    }
638            }
639    
640            /**
641             * Finds the last blogs stats user in the ordered set where groupId = &#63;.
642             *
643             * <p>
644             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
645             * </p>
646             *
647             * @param groupId the group id to search with
648             * @param orderByComparator the comparator to order the set by
649             * @return the last matching blogs stats user
650             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a matching blogs stats user could not be found
651             * @throws SystemException if a system exception occurred
652             */
653            public BlogsStatsUser findByGroupId_Last(long groupId,
654                    OrderByComparator orderByComparator)
655                    throws NoSuchStatsUserException, SystemException {
656                    int count = countByGroupId(groupId);
657    
658                    List<BlogsStatsUser> list = findByGroupId(groupId, count - 1, count,
659                                    orderByComparator);
660    
661                    if (list.isEmpty()) {
662                            StringBundler msg = new StringBundler(4);
663    
664                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
665    
666                            msg.append("groupId=");
667                            msg.append(groupId);
668    
669                            msg.append(StringPool.CLOSE_CURLY_BRACE);
670    
671                            throw new NoSuchStatsUserException(msg.toString());
672                    }
673                    else {
674                            return list.get(0);
675                    }
676            }
677    
678            /**
679             * Finds the blogs stats users before and after the current blogs stats user in the ordered set where groupId = &#63;.
680             *
681             * <p>
682             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
683             * </p>
684             *
685             * @param statsUserId the primary key of the current blogs stats user
686             * @param groupId the group id to search with
687             * @param orderByComparator the comparator to order the set by
688             * @return the previous, current, and next blogs stats user
689             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a blogs stats user with the primary key could not be found
690             * @throws SystemException if a system exception occurred
691             */
692            public BlogsStatsUser[] findByGroupId_PrevAndNext(long statsUserId,
693                    long groupId, OrderByComparator orderByComparator)
694                    throws NoSuchStatsUserException, SystemException {
695                    BlogsStatsUser blogsStatsUser = findByPrimaryKey(statsUserId);
696    
697                    Session session = null;
698    
699                    try {
700                            session = openSession();
701    
702                            BlogsStatsUser[] array = new BlogsStatsUserImpl[3];
703    
704                            array[0] = getByGroupId_PrevAndNext(session, blogsStatsUser,
705                                            groupId, orderByComparator, true);
706    
707                            array[1] = blogsStatsUser;
708    
709                            array[2] = getByGroupId_PrevAndNext(session, blogsStatsUser,
710                                            groupId, orderByComparator, false);
711    
712                            return array;
713                    }
714                    catch (Exception e) {
715                            throw processException(e);
716                    }
717                    finally {
718                            closeSession(session);
719                    }
720            }
721    
722            protected BlogsStatsUser getByGroupId_PrevAndNext(Session session,
723                    BlogsStatsUser blogsStatsUser, long groupId,
724                    OrderByComparator orderByComparator, boolean previous) {
725                    StringBundler query = null;
726    
727                    if (orderByComparator != null) {
728                            query = new StringBundler(6 +
729                                            (orderByComparator.getOrderByFields().length * 6));
730                    }
731                    else {
732                            query = new StringBundler(3);
733                    }
734    
735                    query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
736    
737                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
738    
739                    if (orderByComparator != null) {
740                            String[] orderByFields = orderByComparator.getOrderByFields();
741    
742                            if (orderByFields.length > 0) {
743                                    query.append(WHERE_AND);
744                            }
745    
746                            for (int i = 0; i < orderByFields.length; i++) {
747                                    query.append(_ORDER_BY_ENTITY_ALIAS);
748                                    query.append(orderByFields[i]);
749    
750                                    if ((i + 1) < orderByFields.length) {
751                                            if (orderByComparator.isAscending() ^ previous) {
752                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
753                                            }
754                                            else {
755                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
756                                            }
757                                    }
758                                    else {
759                                            if (orderByComparator.isAscending() ^ previous) {
760                                                    query.append(WHERE_GREATER_THAN);
761                                            }
762                                            else {
763                                                    query.append(WHERE_LESSER_THAN);
764                                            }
765                                    }
766                            }
767    
768                            query.append(ORDER_BY_CLAUSE);
769    
770                            for (int i = 0; i < orderByFields.length; i++) {
771                                    query.append(_ORDER_BY_ENTITY_ALIAS);
772                                    query.append(orderByFields[i]);
773    
774                                    if ((i + 1) < orderByFields.length) {
775                                            if (orderByComparator.isAscending() ^ previous) {
776                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
777                                            }
778                                            else {
779                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
780                                            }
781                                    }
782                                    else {
783                                            if (orderByComparator.isAscending() ^ previous) {
784                                                    query.append(ORDER_BY_ASC);
785                                            }
786                                            else {
787                                                    query.append(ORDER_BY_DESC);
788                                            }
789                                    }
790                            }
791                    }
792    
793                    else {
794                            query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
795                    }
796    
797                    String sql = query.toString();
798    
799                    Query q = session.createQuery(sql);
800    
801                    q.setFirstResult(0);
802                    q.setMaxResults(2);
803    
804                    QueryPos qPos = QueryPos.getInstance(q);
805    
806                    qPos.add(groupId);
807    
808                    if (orderByComparator != null) {
809                            Object[] values = orderByComparator.getOrderByValues(blogsStatsUser);
810    
811                            for (Object value : values) {
812                                    qPos.add(value);
813                            }
814                    }
815    
816                    List<BlogsStatsUser> list = q.list();
817    
818                    if (list.size() == 2) {
819                            return list.get(1);
820                    }
821                    else {
822                            return null;
823                    }
824            }
825    
826            /**
827             * Finds all the blogs stats users where userId = &#63;.
828             *
829             * @param userId the user id to search with
830             * @return the matching blogs stats users
831             * @throws SystemException if a system exception occurred
832             */
833            public List<BlogsStatsUser> findByUserId(long userId)
834                    throws SystemException {
835                    return findByUserId(userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
836            }
837    
838            /**
839             * Finds a range of all the blogs stats users where userId = &#63;.
840             *
841             * <p>
842             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
843             * </p>
844             *
845             * @param userId the user id to search with
846             * @param start the lower bound of the range of blogs stats users to return
847             * @param end the upper bound of the range of blogs stats users to return (not inclusive)
848             * @return the range of matching blogs stats users
849             * @throws SystemException if a system exception occurred
850             */
851            public List<BlogsStatsUser> findByUserId(long userId, int start, int end)
852                    throws SystemException {
853                    return findByUserId(userId, start, end, null);
854            }
855    
856            /**
857             * Finds an ordered range of all the blogs stats users where userId = &#63;.
858             *
859             * <p>
860             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
861             * </p>
862             *
863             * @param userId the user id to search with
864             * @param start the lower bound of the range of blogs stats users to return
865             * @param end the upper bound of the range of blogs stats users to return (not inclusive)
866             * @param orderByComparator the comparator to order the results by
867             * @return the ordered range of matching blogs stats users
868             * @throws SystemException if a system exception occurred
869             */
870            public List<BlogsStatsUser> findByUserId(long userId, int start, int end,
871                    OrderByComparator orderByComparator) throws SystemException {
872                    Object[] finderArgs = new Object[] {
873                                    userId,
874                                    
875                                    String.valueOf(start), String.valueOf(end),
876                                    String.valueOf(orderByComparator)
877                            };
878    
879                    List<BlogsStatsUser> list = (List<BlogsStatsUser>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_USERID,
880                                    finderArgs, this);
881    
882                    if (list == null) {
883                            StringBundler query = null;
884    
885                            if (orderByComparator != null) {
886                                    query = new StringBundler(3 +
887                                                    (orderByComparator.getOrderByFields().length * 3));
888                            }
889                            else {
890                                    query = new StringBundler(3);
891                            }
892    
893                            query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
894    
895                            query.append(_FINDER_COLUMN_USERID_USERID_2);
896    
897                            if (orderByComparator != null) {
898                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
899                                            orderByComparator);
900                            }
901    
902                            else {
903                                    query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
904                            }
905    
906                            String sql = query.toString();
907    
908                            Session session = null;
909    
910                            try {
911                                    session = openSession();
912    
913                                    Query q = session.createQuery(sql);
914    
915                                    QueryPos qPos = QueryPos.getInstance(q);
916    
917                                    qPos.add(userId);
918    
919                                    list = (List<BlogsStatsUser>)QueryUtil.list(q, getDialect(),
920                                                    start, end);
921                            }
922                            catch (Exception e) {
923                                    throw processException(e);
924                            }
925                            finally {
926                                    if (list == null) {
927                                            FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_USERID,
928                                                    finderArgs);
929                                    }
930                                    else {
931                                            cacheResult(list);
932    
933                                            FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_USERID,
934                                                    finderArgs, list);
935                                    }
936    
937                                    closeSession(session);
938                            }
939                    }
940    
941                    return list;
942            }
943    
944            /**
945             * Finds the first blogs stats user in the ordered set where userId = &#63;.
946             *
947             * <p>
948             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
949             * </p>
950             *
951             * @param userId the user id to search with
952             * @param orderByComparator the comparator to order the set by
953             * @return the first matching blogs stats user
954             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a matching blogs stats user could not be found
955             * @throws SystemException if a system exception occurred
956             */
957            public BlogsStatsUser findByUserId_First(long userId,
958                    OrderByComparator orderByComparator)
959                    throws NoSuchStatsUserException, SystemException {
960                    List<BlogsStatsUser> list = findByUserId(userId, 0, 1, orderByComparator);
961    
962                    if (list.isEmpty()) {
963                            StringBundler msg = new StringBundler(4);
964    
965                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
966    
967                            msg.append("userId=");
968                            msg.append(userId);
969    
970                            msg.append(StringPool.CLOSE_CURLY_BRACE);
971    
972                            throw new NoSuchStatsUserException(msg.toString());
973                    }
974                    else {
975                            return list.get(0);
976                    }
977            }
978    
979            /**
980             * Finds the last blogs stats user in the ordered set where userId = &#63;.
981             *
982             * <p>
983             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
984             * </p>
985             *
986             * @param userId the user id to search with
987             * @param orderByComparator the comparator to order the set by
988             * @return the last matching blogs stats user
989             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a matching blogs stats user could not be found
990             * @throws SystemException if a system exception occurred
991             */
992            public BlogsStatsUser findByUserId_Last(long userId,
993                    OrderByComparator orderByComparator)
994                    throws NoSuchStatsUserException, SystemException {
995                    int count = countByUserId(userId);
996    
997                    List<BlogsStatsUser> list = findByUserId(userId, count - 1, count,
998                                    orderByComparator);
999    
1000                    if (list.isEmpty()) {
1001                            StringBundler msg = new StringBundler(4);
1002    
1003                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1004    
1005                            msg.append("userId=");
1006                            msg.append(userId);
1007    
1008                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1009    
1010                            throw new NoSuchStatsUserException(msg.toString());
1011                    }
1012                    else {
1013                            return list.get(0);
1014                    }
1015            }
1016    
1017            /**
1018             * Finds the blogs stats users before and after the current blogs stats user in the ordered set where userId = &#63;.
1019             *
1020             * <p>
1021             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1022             * </p>
1023             *
1024             * @param statsUserId the primary key of the current blogs stats user
1025             * @param userId the user id to search with
1026             * @param orderByComparator the comparator to order the set by
1027             * @return the previous, current, and next blogs stats user
1028             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a blogs stats user with the primary key could not be found
1029             * @throws SystemException if a system exception occurred
1030             */
1031            public BlogsStatsUser[] findByUserId_PrevAndNext(long statsUserId,
1032                    long userId, OrderByComparator orderByComparator)
1033                    throws NoSuchStatsUserException, SystemException {
1034                    BlogsStatsUser blogsStatsUser = findByPrimaryKey(statsUserId);
1035    
1036                    Session session = null;
1037    
1038                    try {
1039                            session = openSession();
1040    
1041                            BlogsStatsUser[] array = new BlogsStatsUserImpl[3];
1042    
1043                            array[0] = getByUserId_PrevAndNext(session, blogsStatsUser, userId,
1044                                            orderByComparator, true);
1045    
1046                            array[1] = blogsStatsUser;
1047    
1048                            array[2] = getByUserId_PrevAndNext(session, blogsStatsUser, userId,
1049                                            orderByComparator, false);
1050    
1051                            return array;
1052                    }
1053                    catch (Exception e) {
1054                            throw processException(e);
1055                    }
1056                    finally {
1057                            closeSession(session);
1058                    }
1059            }
1060    
1061            protected BlogsStatsUser getByUserId_PrevAndNext(Session session,
1062                    BlogsStatsUser blogsStatsUser, long userId,
1063                    OrderByComparator orderByComparator, boolean previous) {
1064                    StringBundler query = null;
1065    
1066                    if (orderByComparator != null) {
1067                            query = new StringBundler(6 +
1068                                            (orderByComparator.getOrderByFields().length * 6));
1069                    }
1070                    else {
1071                            query = new StringBundler(3);
1072                    }
1073    
1074                    query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
1075    
1076                    query.append(_FINDER_COLUMN_USERID_USERID_2);
1077    
1078                    if (orderByComparator != null) {
1079                            String[] orderByFields = orderByComparator.getOrderByFields();
1080    
1081                            if (orderByFields.length > 0) {
1082                                    query.append(WHERE_AND);
1083                            }
1084    
1085                            for (int i = 0; i < orderByFields.length; i++) {
1086                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1087                                    query.append(orderByFields[i]);
1088    
1089                                    if ((i + 1) < orderByFields.length) {
1090                                            if (orderByComparator.isAscending() ^ previous) {
1091                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1092                                            }
1093                                            else {
1094                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1095                                            }
1096                                    }
1097                                    else {
1098                                            if (orderByComparator.isAscending() ^ previous) {
1099                                                    query.append(WHERE_GREATER_THAN);
1100                                            }
1101                                            else {
1102                                                    query.append(WHERE_LESSER_THAN);
1103                                            }
1104                                    }
1105                            }
1106    
1107                            query.append(ORDER_BY_CLAUSE);
1108    
1109                            for (int i = 0; i < orderByFields.length; i++) {
1110                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1111                                    query.append(orderByFields[i]);
1112    
1113                                    if ((i + 1) < orderByFields.length) {
1114                                            if (orderByComparator.isAscending() ^ previous) {
1115                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1116                                            }
1117                                            else {
1118                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1119                                            }
1120                                    }
1121                                    else {
1122                                            if (orderByComparator.isAscending() ^ previous) {
1123                                                    query.append(ORDER_BY_ASC);
1124                                            }
1125                                            else {
1126                                                    query.append(ORDER_BY_DESC);
1127                                            }
1128                                    }
1129                            }
1130                    }
1131    
1132                    else {
1133                            query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
1134                    }
1135    
1136                    String sql = query.toString();
1137    
1138                    Query q = session.createQuery(sql);
1139    
1140                    q.setFirstResult(0);
1141                    q.setMaxResults(2);
1142    
1143                    QueryPos qPos = QueryPos.getInstance(q);
1144    
1145                    qPos.add(userId);
1146    
1147                    if (orderByComparator != null) {
1148                            Object[] values = orderByComparator.getOrderByValues(blogsStatsUser);
1149    
1150                            for (Object value : values) {
1151                                    qPos.add(value);
1152                            }
1153                    }
1154    
1155                    List<BlogsStatsUser> list = q.list();
1156    
1157                    if (list.size() == 2) {
1158                            return list.get(1);
1159                    }
1160                    else {
1161                            return null;
1162                    }
1163            }
1164    
1165            /**
1166             * Finds the blogs stats user where groupId = &#63; and userId = &#63; or throws a {@link com.liferay.portlet.blogs.NoSuchStatsUserException} if it could not be found.
1167             *
1168             * @param groupId the group id to search with
1169             * @param userId the user id to search with
1170             * @return the matching blogs stats user
1171             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a matching blogs stats user could not be found
1172             * @throws SystemException if a system exception occurred
1173             */
1174            public BlogsStatsUser findByG_U(long groupId, long userId)
1175                    throws NoSuchStatsUserException, SystemException {
1176                    BlogsStatsUser blogsStatsUser = fetchByG_U(groupId, userId);
1177    
1178                    if (blogsStatsUser == null) {
1179                            StringBundler msg = new StringBundler(6);
1180    
1181                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1182    
1183                            msg.append("groupId=");
1184                            msg.append(groupId);
1185    
1186                            msg.append(", userId=");
1187                            msg.append(userId);
1188    
1189                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1190    
1191                            if (_log.isWarnEnabled()) {
1192                                    _log.warn(msg.toString());
1193                            }
1194    
1195                            throw new NoSuchStatsUserException(msg.toString());
1196                    }
1197    
1198                    return blogsStatsUser;
1199            }
1200    
1201            /**
1202             * Finds the blogs stats user where groupId = &#63; and userId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
1203             *
1204             * @param groupId the group id to search with
1205             * @param userId the user id to search with
1206             * @return the matching blogs stats user, or <code>null</code> if a matching blogs stats user could not be found
1207             * @throws SystemException if a system exception occurred
1208             */
1209            public BlogsStatsUser fetchByG_U(long groupId, long userId)
1210                    throws SystemException {
1211                    return fetchByG_U(groupId, userId, true);
1212            }
1213    
1214            /**
1215             * Finds the blogs stats user where groupId = &#63; and userId = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
1216             *
1217             * @param groupId the group id to search with
1218             * @param userId the user id to search with
1219             * @return the matching blogs stats user, or <code>null</code> if a matching blogs stats user could not be found
1220             * @throws SystemException if a system exception occurred
1221             */
1222            public BlogsStatsUser fetchByG_U(long groupId, long userId,
1223                    boolean retrieveFromCache) throws SystemException {
1224                    Object[] finderArgs = new Object[] { groupId, userId };
1225    
1226                    Object result = null;
1227    
1228                    if (retrieveFromCache) {
1229                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_U,
1230                                            finderArgs, this);
1231                    }
1232    
1233                    if (result == null) {
1234                            StringBundler query = new StringBundler(4);
1235    
1236                            query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
1237    
1238                            query.append(_FINDER_COLUMN_G_U_GROUPID_2);
1239    
1240                            query.append(_FINDER_COLUMN_G_U_USERID_2);
1241    
1242                            query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
1243    
1244                            String sql = query.toString();
1245    
1246                            Session session = null;
1247    
1248                            try {
1249                                    session = openSession();
1250    
1251                                    Query q = session.createQuery(sql);
1252    
1253                                    QueryPos qPos = QueryPos.getInstance(q);
1254    
1255                                    qPos.add(groupId);
1256    
1257                                    qPos.add(userId);
1258    
1259                                    List<BlogsStatsUser> list = q.list();
1260    
1261                                    result = list;
1262    
1263                                    BlogsStatsUser blogsStatsUser = null;
1264    
1265                                    if (list.isEmpty()) {
1266                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_U,
1267                                                    finderArgs, list);
1268                                    }
1269                                    else {
1270                                            blogsStatsUser = list.get(0);
1271    
1272                                            cacheResult(blogsStatsUser);
1273    
1274                                            if ((blogsStatsUser.getGroupId() != groupId) ||
1275                                                            (blogsStatsUser.getUserId() != userId)) {
1276                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_U,
1277                                                            finderArgs, blogsStatsUser);
1278                                            }
1279                                    }
1280    
1281                                    return blogsStatsUser;
1282                            }
1283                            catch (Exception e) {
1284                                    throw processException(e);
1285                            }
1286                            finally {
1287                                    if (result == null) {
1288                                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_U,
1289                                                    finderArgs);
1290                                    }
1291    
1292                                    closeSession(session);
1293                            }
1294                    }
1295                    else {
1296                            if (result instanceof List<?>) {
1297                                    return null;
1298                            }
1299                            else {
1300                                    return (BlogsStatsUser)result;
1301                            }
1302                    }
1303            }
1304    
1305            /**
1306             * Finds all the blogs stats users where groupId = &#63; and entryCount &ne; &#63;.
1307             *
1308             * @param groupId the group id to search with
1309             * @param entryCount the entry count to search with
1310             * @return the matching blogs stats users
1311             * @throws SystemException if a system exception occurred
1312             */
1313            public List<BlogsStatsUser> findByG_NotE(long groupId, int entryCount)
1314                    throws SystemException {
1315                    return findByG_NotE(groupId, entryCount, QueryUtil.ALL_POS,
1316                            QueryUtil.ALL_POS, null);
1317            }
1318    
1319            /**
1320             * Finds a range of all the blogs stats users where groupId = &#63; and entryCount &ne; &#63;.
1321             *
1322             * <p>
1323             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1324             * </p>
1325             *
1326             * @param groupId the group id to search with
1327             * @param entryCount the entry count to search with
1328             * @param start the lower bound of the range of blogs stats users to return
1329             * @param end the upper bound of the range of blogs stats users to return (not inclusive)
1330             * @return the range of matching blogs stats users
1331             * @throws SystemException if a system exception occurred
1332             */
1333            public List<BlogsStatsUser> findByG_NotE(long groupId, int entryCount,
1334                    int start, int end) throws SystemException {
1335                    return findByG_NotE(groupId, entryCount, start, end, null);
1336            }
1337    
1338            /**
1339             * Finds an ordered range of all the blogs stats users where groupId = &#63; and entryCount &ne; &#63;.
1340             *
1341             * <p>
1342             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1343             * </p>
1344             *
1345             * @param groupId the group id to search with
1346             * @param entryCount the entry count to search with
1347             * @param start the lower bound of the range of blogs stats users to return
1348             * @param end the upper bound of the range of blogs stats users to return (not inclusive)
1349             * @param orderByComparator the comparator to order the results by
1350             * @return the ordered range of matching blogs stats users
1351             * @throws SystemException if a system exception occurred
1352             */
1353            public List<BlogsStatsUser> findByG_NotE(long groupId, int entryCount,
1354                    int start, int end, OrderByComparator orderByComparator)
1355                    throws SystemException {
1356                    Object[] finderArgs = new Object[] {
1357                                    groupId, entryCount,
1358                                    
1359                                    String.valueOf(start), String.valueOf(end),
1360                                    String.valueOf(orderByComparator)
1361                            };
1362    
1363                    List<BlogsStatsUser> list = (List<BlogsStatsUser>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_NOTE,
1364                                    finderArgs, this);
1365    
1366                    if (list == null) {
1367                            StringBundler query = null;
1368    
1369                            if (orderByComparator != null) {
1370                                    query = new StringBundler(4 +
1371                                                    (orderByComparator.getOrderByFields().length * 3));
1372                            }
1373                            else {
1374                                    query = new StringBundler(4);
1375                            }
1376    
1377                            query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
1378    
1379                            query.append(_FINDER_COLUMN_G_NOTE_GROUPID_2);
1380    
1381                            query.append(_FINDER_COLUMN_G_NOTE_ENTRYCOUNT_2);
1382    
1383                            if (orderByComparator != null) {
1384                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1385                                            orderByComparator);
1386                            }
1387    
1388                            else {
1389                                    query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
1390                            }
1391    
1392                            String sql = query.toString();
1393    
1394                            Session session = null;
1395    
1396                            try {
1397                                    session = openSession();
1398    
1399                                    Query q = session.createQuery(sql);
1400    
1401                                    QueryPos qPos = QueryPos.getInstance(q);
1402    
1403                                    qPos.add(groupId);
1404    
1405                                    qPos.add(entryCount);
1406    
1407                                    list = (List<BlogsStatsUser>)QueryUtil.list(q, getDialect(),
1408                                                    start, end);
1409                            }
1410                            catch (Exception e) {
1411                                    throw processException(e);
1412                            }
1413                            finally {
1414                                    if (list == null) {
1415                                            FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_G_NOTE,
1416                                                    finderArgs);
1417                                    }
1418                                    else {
1419                                            cacheResult(list);
1420    
1421                                            FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_NOTE,
1422                                                    finderArgs, list);
1423                                    }
1424    
1425                                    closeSession(session);
1426                            }
1427                    }
1428    
1429                    return list;
1430            }
1431    
1432            /**
1433             * Finds the first blogs stats user in the ordered set where groupId = &#63; and entryCount &ne; &#63;.
1434             *
1435             * <p>
1436             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1437             * </p>
1438             *
1439             * @param groupId the group id to search with
1440             * @param entryCount the entry count to search with
1441             * @param orderByComparator the comparator to order the set by
1442             * @return the first matching blogs stats user
1443             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a matching blogs stats user could not be found
1444             * @throws SystemException if a system exception occurred
1445             */
1446            public BlogsStatsUser findByG_NotE_First(long groupId, int entryCount,
1447                    OrderByComparator orderByComparator)
1448                    throws NoSuchStatsUserException, SystemException {
1449                    List<BlogsStatsUser> list = findByG_NotE(groupId, entryCount, 0, 1,
1450                                    orderByComparator);
1451    
1452                    if (list.isEmpty()) {
1453                            StringBundler msg = new StringBundler(6);
1454    
1455                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1456    
1457                            msg.append("groupId=");
1458                            msg.append(groupId);
1459    
1460                            msg.append(", entryCount=");
1461                            msg.append(entryCount);
1462    
1463                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1464    
1465                            throw new NoSuchStatsUserException(msg.toString());
1466                    }
1467                    else {
1468                            return list.get(0);
1469                    }
1470            }
1471    
1472            /**
1473             * Finds the last blogs stats user in the ordered set where groupId = &#63; and entryCount &ne; &#63;.
1474             *
1475             * <p>
1476             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1477             * </p>
1478             *
1479             * @param groupId the group id to search with
1480             * @param entryCount the entry count to search with
1481             * @param orderByComparator the comparator to order the set by
1482             * @return the last matching blogs stats user
1483             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a matching blogs stats user could not be found
1484             * @throws SystemException if a system exception occurred
1485             */
1486            public BlogsStatsUser findByG_NotE_Last(long groupId, int entryCount,
1487                    OrderByComparator orderByComparator)
1488                    throws NoSuchStatsUserException, SystemException {
1489                    int count = countByG_NotE(groupId, entryCount);
1490    
1491                    List<BlogsStatsUser> list = findByG_NotE(groupId, entryCount,
1492                                    count - 1, count, orderByComparator);
1493    
1494                    if (list.isEmpty()) {
1495                            StringBundler msg = new StringBundler(6);
1496    
1497                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1498    
1499                            msg.append("groupId=");
1500                            msg.append(groupId);
1501    
1502                            msg.append(", entryCount=");
1503                            msg.append(entryCount);
1504    
1505                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1506    
1507                            throw new NoSuchStatsUserException(msg.toString());
1508                    }
1509                    else {
1510                            return list.get(0);
1511                    }
1512            }
1513    
1514            /**
1515             * Finds the blogs stats users before and after the current blogs stats user in the ordered set where groupId = &#63; and entryCount &ne; &#63;.
1516             *
1517             * <p>
1518             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1519             * </p>
1520             *
1521             * @param statsUserId the primary key of the current blogs stats user
1522             * @param groupId the group id to search with
1523             * @param entryCount the entry count to search with
1524             * @param orderByComparator the comparator to order the set by
1525             * @return the previous, current, and next blogs stats user
1526             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a blogs stats user with the primary key could not be found
1527             * @throws SystemException if a system exception occurred
1528             */
1529            public BlogsStatsUser[] findByG_NotE_PrevAndNext(long statsUserId,
1530                    long groupId, int entryCount, OrderByComparator orderByComparator)
1531                    throws NoSuchStatsUserException, SystemException {
1532                    BlogsStatsUser blogsStatsUser = findByPrimaryKey(statsUserId);
1533    
1534                    Session session = null;
1535    
1536                    try {
1537                            session = openSession();
1538    
1539                            BlogsStatsUser[] array = new BlogsStatsUserImpl[3];
1540    
1541                            array[0] = getByG_NotE_PrevAndNext(session, blogsStatsUser,
1542                                            groupId, entryCount, orderByComparator, true);
1543    
1544                            array[1] = blogsStatsUser;
1545    
1546                            array[2] = getByG_NotE_PrevAndNext(session, blogsStatsUser,
1547                                            groupId, entryCount, orderByComparator, false);
1548    
1549                            return array;
1550                    }
1551                    catch (Exception e) {
1552                            throw processException(e);
1553                    }
1554                    finally {
1555                            closeSession(session);
1556                    }
1557            }
1558    
1559            protected BlogsStatsUser getByG_NotE_PrevAndNext(Session session,
1560                    BlogsStatsUser blogsStatsUser, long groupId, int entryCount,
1561                    OrderByComparator orderByComparator, boolean previous) {
1562                    StringBundler query = null;
1563    
1564                    if (orderByComparator != null) {
1565                            query = new StringBundler(6 +
1566                                            (orderByComparator.getOrderByFields().length * 6));
1567                    }
1568                    else {
1569                            query = new StringBundler(3);
1570                    }
1571    
1572                    query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
1573    
1574                    query.append(_FINDER_COLUMN_G_NOTE_GROUPID_2);
1575    
1576                    query.append(_FINDER_COLUMN_G_NOTE_ENTRYCOUNT_2);
1577    
1578                    if (orderByComparator != null) {
1579                            String[] orderByFields = orderByComparator.getOrderByFields();
1580    
1581                            if (orderByFields.length > 0) {
1582                                    query.append(WHERE_AND);
1583                            }
1584    
1585                            for (int i = 0; i < orderByFields.length; i++) {
1586                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1587                                    query.append(orderByFields[i]);
1588    
1589                                    if ((i + 1) < orderByFields.length) {
1590                                            if (orderByComparator.isAscending() ^ previous) {
1591                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1592                                            }
1593                                            else {
1594                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1595                                            }
1596                                    }
1597                                    else {
1598                                            if (orderByComparator.isAscending() ^ previous) {
1599                                                    query.append(WHERE_GREATER_THAN);
1600                                            }
1601                                            else {
1602                                                    query.append(WHERE_LESSER_THAN);
1603                                            }
1604                                    }
1605                            }
1606    
1607                            query.append(ORDER_BY_CLAUSE);
1608    
1609                            for (int i = 0; i < orderByFields.length; i++) {
1610                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1611                                    query.append(orderByFields[i]);
1612    
1613                                    if ((i + 1) < orderByFields.length) {
1614                                            if (orderByComparator.isAscending() ^ previous) {
1615                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1616                                            }
1617                                            else {
1618                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1619                                            }
1620                                    }
1621                                    else {
1622                                            if (orderByComparator.isAscending() ^ previous) {
1623                                                    query.append(ORDER_BY_ASC);
1624                                            }
1625                                            else {
1626                                                    query.append(ORDER_BY_DESC);
1627                                            }
1628                                    }
1629                            }
1630                    }
1631    
1632                    else {
1633                            query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
1634                    }
1635    
1636                    String sql = query.toString();
1637    
1638                    Query q = session.createQuery(sql);
1639    
1640                    q.setFirstResult(0);
1641                    q.setMaxResults(2);
1642    
1643                    QueryPos qPos = QueryPos.getInstance(q);
1644    
1645                    qPos.add(groupId);
1646    
1647                    qPos.add(entryCount);
1648    
1649                    if (orderByComparator != null) {
1650                            Object[] values = orderByComparator.getOrderByValues(blogsStatsUser);
1651    
1652                            for (Object value : values) {
1653                                    qPos.add(value);
1654                            }
1655                    }
1656    
1657                    List<BlogsStatsUser> list = q.list();
1658    
1659                    if (list.size() == 2) {
1660                            return list.get(1);
1661                    }
1662                    else {
1663                            return null;
1664                    }
1665            }
1666    
1667            /**
1668             * Finds all the blogs stats users where companyId = &#63; and entryCount &ne; &#63;.
1669             *
1670             * @param companyId the company id to search with
1671             * @param entryCount the entry count to search with
1672             * @return the matching blogs stats users
1673             * @throws SystemException if a system exception occurred
1674             */
1675            public List<BlogsStatsUser> findByC_NotE(long companyId, int entryCount)
1676                    throws SystemException {
1677                    return findByC_NotE(companyId, entryCount, QueryUtil.ALL_POS,
1678                            QueryUtil.ALL_POS, null);
1679            }
1680    
1681            /**
1682             * Finds a range of all the blogs stats users where companyId = &#63; and entryCount &ne; &#63;.
1683             *
1684             * <p>
1685             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1686             * </p>
1687             *
1688             * @param companyId the company id to search with
1689             * @param entryCount the entry count to search with
1690             * @param start the lower bound of the range of blogs stats users to return
1691             * @param end the upper bound of the range of blogs stats users to return (not inclusive)
1692             * @return the range of matching blogs stats users
1693             * @throws SystemException if a system exception occurred
1694             */
1695            public List<BlogsStatsUser> findByC_NotE(long companyId, int entryCount,
1696                    int start, int end) throws SystemException {
1697                    return findByC_NotE(companyId, entryCount, start, end, null);
1698            }
1699    
1700            /**
1701             * Finds an ordered range of all the blogs stats users where companyId = &#63; and entryCount &ne; &#63;.
1702             *
1703             * <p>
1704             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1705             * </p>
1706             *
1707             * @param companyId the company id to search with
1708             * @param entryCount the entry count to search with
1709             * @param start the lower bound of the range of blogs stats users to return
1710             * @param end the upper bound of the range of blogs stats users to return (not inclusive)
1711             * @param orderByComparator the comparator to order the results by
1712             * @return the ordered range of matching blogs stats users
1713             * @throws SystemException if a system exception occurred
1714             */
1715            public List<BlogsStatsUser> findByC_NotE(long companyId, int entryCount,
1716                    int start, int end, OrderByComparator orderByComparator)
1717                    throws SystemException {
1718                    Object[] finderArgs = new Object[] {
1719                                    companyId, entryCount,
1720                                    
1721                                    String.valueOf(start), String.valueOf(end),
1722                                    String.valueOf(orderByComparator)
1723                            };
1724    
1725                    List<BlogsStatsUser> list = (List<BlogsStatsUser>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_NOTE,
1726                                    finderArgs, this);
1727    
1728                    if (list == null) {
1729                            StringBundler query = null;
1730    
1731                            if (orderByComparator != null) {
1732                                    query = new StringBundler(4 +
1733                                                    (orderByComparator.getOrderByFields().length * 3));
1734                            }
1735                            else {
1736                                    query = new StringBundler(4);
1737                            }
1738    
1739                            query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
1740    
1741                            query.append(_FINDER_COLUMN_C_NOTE_COMPANYID_2);
1742    
1743                            query.append(_FINDER_COLUMN_C_NOTE_ENTRYCOUNT_2);
1744    
1745                            if (orderByComparator != null) {
1746                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1747                                            orderByComparator);
1748                            }
1749    
1750                            else {
1751                                    query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
1752                            }
1753    
1754                            String sql = query.toString();
1755    
1756                            Session session = null;
1757    
1758                            try {
1759                                    session = openSession();
1760    
1761                                    Query q = session.createQuery(sql);
1762    
1763                                    QueryPos qPos = QueryPos.getInstance(q);
1764    
1765                                    qPos.add(companyId);
1766    
1767                                    qPos.add(entryCount);
1768    
1769                                    list = (List<BlogsStatsUser>)QueryUtil.list(q, getDialect(),
1770                                                    start, end);
1771                            }
1772                            catch (Exception e) {
1773                                    throw processException(e);
1774                            }
1775                            finally {
1776                                    if (list == null) {
1777                                            FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_C_NOTE,
1778                                                    finderArgs);
1779                                    }
1780                                    else {
1781                                            cacheResult(list);
1782    
1783                                            FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_NOTE,
1784                                                    finderArgs, list);
1785                                    }
1786    
1787                                    closeSession(session);
1788                            }
1789                    }
1790    
1791                    return list;
1792            }
1793    
1794            /**
1795             * Finds the first blogs stats user in the ordered set where companyId = &#63; and entryCount &ne; &#63;.
1796             *
1797             * <p>
1798             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1799             * </p>
1800             *
1801             * @param companyId the company id to search with
1802             * @param entryCount the entry count to search with
1803             * @param orderByComparator the comparator to order the set by
1804             * @return the first matching blogs stats user
1805             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a matching blogs stats user could not be found
1806             * @throws SystemException if a system exception occurred
1807             */
1808            public BlogsStatsUser findByC_NotE_First(long companyId, int entryCount,
1809                    OrderByComparator orderByComparator)
1810                    throws NoSuchStatsUserException, SystemException {
1811                    List<BlogsStatsUser> list = findByC_NotE(companyId, entryCount, 0, 1,
1812                                    orderByComparator);
1813    
1814                    if (list.isEmpty()) {
1815                            StringBundler msg = new StringBundler(6);
1816    
1817                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1818    
1819                            msg.append("companyId=");
1820                            msg.append(companyId);
1821    
1822                            msg.append(", entryCount=");
1823                            msg.append(entryCount);
1824    
1825                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1826    
1827                            throw new NoSuchStatsUserException(msg.toString());
1828                    }
1829                    else {
1830                            return list.get(0);
1831                    }
1832            }
1833    
1834            /**
1835             * Finds the last blogs stats user in the ordered set where companyId = &#63; and entryCount &ne; &#63;.
1836             *
1837             * <p>
1838             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1839             * </p>
1840             *
1841             * @param companyId the company id to search with
1842             * @param entryCount the entry count to search with
1843             * @param orderByComparator the comparator to order the set by
1844             * @return the last matching blogs stats user
1845             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a matching blogs stats user could not be found
1846             * @throws SystemException if a system exception occurred
1847             */
1848            public BlogsStatsUser findByC_NotE_Last(long companyId, int entryCount,
1849                    OrderByComparator orderByComparator)
1850                    throws NoSuchStatsUserException, SystemException {
1851                    int count = countByC_NotE(companyId, entryCount);
1852    
1853                    List<BlogsStatsUser> list = findByC_NotE(companyId, entryCount,
1854                                    count - 1, count, orderByComparator);
1855    
1856                    if (list.isEmpty()) {
1857                            StringBundler msg = new StringBundler(6);
1858    
1859                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1860    
1861                            msg.append("companyId=");
1862                            msg.append(companyId);
1863    
1864                            msg.append(", entryCount=");
1865                            msg.append(entryCount);
1866    
1867                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1868    
1869                            throw new NoSuchStatsUserException(msg.toString());
1870                    }
1871                    else {
1872                            return list.get(0);
1873                    }
1874            }
1875    
1876            /**
1877             * Finds the blogs stats users before and after the current blogs stats user in the ordered set where companyId = &#63; and entryCount &ne; &#63;.
1878             *
1879             * <p>
1880             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1881             * </p>
1882             *
1883             * @param statsUserId the primary key of the current blogs stats user
1884             * @param companyId the company id to search with
1885             * @param entryCount the entry count to search with
1886             * @param orderByComparator the comparator to order the set by
1887             * @return the previous, current, and next blogs stats user
1888             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a blogs stats user with the primary key could not be found
1889             * @throws SystemException if a system exception occurred
1890             */
1891            public BlogsStatsUser[] findByC_NotE_PrevAndNext(long statsUserId,
1892                    long companyId, int entryCount, OrderByComparator orderByComparator)
1893                    throws NoSuchStatsUserException, SystemException {
1894                    BlogsStatsUser blogsStatsUser = findByPrimaryKey(statsUserId);
1895    
1896                    Session session = null;
1897    
1898                    try {
1899                            session = openSession();
1900    
1901                            BlogsStatsUser[] array = new BlogsStatsUserImpl[3];
1902    
1903                            array[0] = getByC_NotE_PrevAndNext(session, blogsStatsUser,
1904                                            companyId, entryCount, orderByComparator, true);
1905    
1906                            array[1] = blogsStatsUser;
1907    
1908                            array[2] = getByC_NotE_PrevAndNext(session, blogsStatsUser,
1909                                            companyId, entryCount, orderByComparator, false);
1910    
1911                            return array;
1912                    }
1913                    catch (Exception e) {
1914                            throw processException(e);
1915                    }
1916                    finally {
1917                            closeSession(session);
1918                    }
1919            }
1920    
1921            protected BlogsStatsUser getByC_NotE_PrevAndNext(Session session,
1922                    BlogsStatsUser blogsStatsUser, long companyId, int entryCount,
1923                    OrderByComparator orderByComparator, boolean previous) {
1924                    StringBundler query = null;
1925    
1926                    if (orderByComparator != null) {
1927                            query = new StringBundler(6 +
1928                                            (orderByComparator.getOrderByFields().length * 6));
1929                    }
1930                    else {
1931                            query = new StringBundler(3);
1932                    }
1933    
1934                    query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
1935    
1936                    query.append(_FINDER_COLUMN_C_NOTE_COMPANYID_2);
1937    
1938                    query.append(_FINDER_COLUMN_C_NOTE_ENTRYCOUNT_2);
1939    
1940                    if (orderByComparator != null) {
1941                            String[] orderByFields = orderByComparator.getOrderByFields();
1942    
1943                            if (orderByFields.length > 0) {
1944                                    query.append(WHERE_AND);
1945                            }
1946    
1947                            for (int i = 0; i < orderByFields.length; i++) {
1948                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1949                                    query.append(orderByFields[i]);
1950    
1951                                    if ((i + 1) < orderByFields.length) {
1952                                            if (orderByComparator.isAscending() ^ previous) {
1953                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1954                                            }
1955                                            else {
1956                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1957                                            }
1958                                    }
1959                                    else {
1960                                            if (orderByComparator.isAscending() ^ previous) {
1961                                                    query.append(WHERE_GREATER_THAN);
1962                                            }
1963                                            else {
1964                                                    query.append(WHERE_LESSER_THAN);
1965                                            }
1966                                    }
1967                            }
1968    
1969                            query.append(ORDER_BY_CLAUSE);
1970    
1971                            for (int i = 0; i < orderByFields.length; i++) {
1972                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1973                                    query.append(orderByFields[i]);
1974    
1975                                    if ((i + 1) < orderByFields.length) {
1976                                            if (orderByComparator.isAscending() ^ previous) {
1977                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1978                                            }
1979                                            else {
1980                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1981                                            }
1982                                    }
1983                                    else {
1984                                            if (orderByComparator.isAscending() ^ previous) {
1985                                                    query.append(ORDER_BY_ASC);
1986                                            }
1987                                            else {
1988                                                    query.append(ORDER_BY_DESC);
1989                                            }
1990                                    }
1991                            }
1992                    }
1993    
1994                    else {
1995                            query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
1996                    }
1997    
1998                    String sql = query.toString();
1999    
2000                    Query q = session.createQuery(sql);
2001    
2002                    q.setFirstResult(0);
2003                    q.setMaxResults(2);
2004    
2005                    QueryPos qPos = QueryPos.getInstance(q);
2006    
2007                    qPos.add(companyId);
2008    
2009                    qPos.add(entryCount);
2010    
2011                    if (orderByComparator != null) {
2012                            Object[] values = orderByComparator.getOrderByValues(blogsStatsUser);
2013    
2014                            for (Object value : values) {
2015                                    qPos.add(value);
2016                            }
2017                    }
2018    
2019                    List<BlogsStatsUser> list = q.list();
2020    
2021                    if (list.size() == 2) {
2022                            return list.get(1);
2023                    }
2024                    else {
2025                            return null;
2026                    }
2027            }
2028    
2029            /**
2030             * Finds all the blogs stats users where userId = &#63; and lastPostDate = &#63;.
2031             *
2032             * @param userId the user id to search with
2033             * @param lastPostDate the last post date to search with
2034             * @return the matching blogs stats users
2035             * @throws SystemException if a system exception occurred
2036             */
2037            public List<BlogsStatsUser> findByU_L(long userId, Date lastPostDate)
2038                    throws SystemException {
2039                    return findByU_L(userId, lastPostDate, QueryUtil.ALL_POS,
2040                            QueryUtil.ALL_POS, null);
2041            }
2042    
2043            /**
2044             * Finds a range of all the blogs stats users where userId = &#63; and lastPostDate = &#63;.
2045             *
2046             * <p>
2047             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2048             * </p>
2049             *
2050             * @param userId the user id to search with
2051             * @param lastPostDate the last post date to search with
2052             * @param start the lower bound of the range of blogs stats users to return
2053             * @param end the upper bound of the range of blogs stats users to return (not inclusive)
2054             * @return the range of matching blogs stats users
2055             * @throws SystemException if a system exception occurred
2056             */
2057            public List<BlogsStatsUser> findByU_L(long userId, Date lastPostDate,
2058                    int start, int end) throws SystemException {
2059                    return findByU_L(userId, lastPostDate, start, end, null);
2060            }
2061    
2062            /**
2063             * Finds an ordered range of all the blogs stats users where userId = &#63; and lastPostDate = &#63;.
2064             *
2065             * <p>
2066             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2067             * </p>
2068             *
2069             * @param userId the user id to search with
2070             * @param lastPostDate the last post date to search with
2071             * @param start the lower bound of the range of blogs stats users to return
2072             * @param end the upper bound of the range of blogs stats users to return (not inclusive)
2073             * @param orderByComparator the comparator to order the results by
2074             * @return the ordered range of matching blogs stats users
2075             * @throws SystemException if a system exception occurred
2076             */
2077            public List<BlogsStatsUser> findByU_L(long userId, Date lastPostDate,
2078                    int start, int end, OrderByComparator orderByComparator)
2079                    throws SystemException {
2080                    Object[] finderArgs = new Object[] {
2081                                    userId, lastPostDate,
2082                                    
2083                                    String.valueOf(start), String.valueOf(end),
2084                                    String.valueOf(orderByComparator)
2085                            };
2086    
2087                    List<BlogsStatsUser> list = (List<BlogsStatsUser>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_U_L,
2088                                    finderArgs, this);
2089    
2090                    if (list == null) {
2091                            StringBundler query = null;
2092    
2093                            if (orderByComparator != null) {
2094                                    query = new StringBundler(4 +
2095                                                    (orderByComparator.getOrderByFields().length * 3));
2096                            }
2097                            else {
2098                                    query = new StringBundler(4);
2099                            }
2100    
2101                            query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
2102    
2103                            query.append(_FINDER_COLUMN_U_L_USERID_2);
2104    
2105                            if (lastPostDate == null) {
2106                                    query.append(_FINDER_COLUMN_U_L_LASTPOSTDATE_1);
2107                            }
2108                            else {
2109                                    query.append(_FINDER_COLUMN_U_L_LASTPOSTDATE_2);
2110                            }
2111    
2112                            if (orderByComparator != null) {
2113                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2114                                            orderByComparator);
2115                            }
2116    
2117                            else {
2118                                    query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
2119                            }
2120    
2121                            String sql = query.toString();
2122    
2123                            Session session = null;
2124    
2125                            try {
2126                                    session = openSession();
2127    
2128                                    Query q = session.createQuery(sql);
2129    
2130                                    QueryPos qPos = QueryPos.getInstance(q);
2131    
2132                                    qPos.add(userId);
2133    
2134                                    if (lastPostDate != null) {
2135                                            qPos.add(CalendarUtil.getTimestamp(lastPostDate));
2136                                    }
2137    
2138                                    list = (List<BlogsStatsUser>)QueryUtil.list(q, getDialect(),
2139                                                    start, end);
2140                            }
2141                            catch (Exception e) {
2142                                    throw processException(e);
2143                            }
2144                            finally {
2145                                    if (list == null) {
2146                                            FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_U_L,
2147                                                    finderArgs);
2148                                    }
2149                                    else {
2150                                            cacheResult(list);
2151    
2152                                            FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_U_L,
2153                                                    finderArgs, list);
2154                                    }
2155    
2156                                    closeSession(session);
2157                            }
2158                    }
2159    
2160                    return list;
2161            }
2162    
2163            /**
2164             * Finds the first blogs stats user in the ordered set where userId = &#63; and lastPostDate = &#63;.
2165             *
2166             * <p>
2167             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2168             * </p>
2169             *
2170             * @param userId the user id to search with
2171             * @param lastPostDate the last post date to search with
2172             * @param orderByComparator the comparator to order the set by
2173             * @return the first matching blogs stats user
2174             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a matching blogs stats user could not be found
2175             * @throws SystemException if a system exception occurred
2176             */
2177            public BlogsStatsUser findByU_L_First(long userId, Date lastPostDate,
2178                    OrderByComparator orderByComparator)
2179                    throws NoSuchStatsUserException, SystemException {
2180                    List<BlogsStatsUser> list = findByU_L(userId, lastPostDate, 0, 1,
2181                                    orderByComparator);
2182    
2183                    if (list.isEmpty()) {
2184                            StringBundler msg = new StringBundler(6);
2185    
2186                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2187    
2188                            msg.append("userId=");
2189                            msg.append(userId);
2190    
2191                            msg.append(", lastPostDate=");
2192                            msg.append(lastPostDate);
2193    
2194                            msg.append(StringPool.CLOSE_CURLY_BRACE);
2195    
2196                            throw new NoSuchStatsUserException(msg.toString());
2197                    }
2198                    else {
2199                            return list.get(0);
2200                    }
2201            }
2202    
2203            /**
2204             * Finds the last blogs stats user in the ordered set where userId = &#63; and lastPostDate = &#63;.
2205             *
2206             * <p>
2207             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2208             * </p>
2209             *
2210             * @param userId the user id to search with
2211             * @param lastPostDate the last post date to search with
2212             * @param orderByComparator the comparator to order the set by
2213             * @return the last matching blogs stats user
2214             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a matching blogs stats user could not be found
2215             * @throws SystemException if a system exception occurred
2216             */
2217            public BlogsStatsUser findByU_L_Last(long userId, Date lastPostDate,
2218                    OrderByComparator orderByComparator)
2219                    throws NoSuchStatsUserException, SystemException {
2220                    int count = countByU_L(userId, lastPostDate);
2221    
2222                    List<BlogsStatsUser> list = findByU_L(userId, lastPostDate, count - 1,
2223                                    count, orderByComparator);
2224    
2225                    if (list.isEmpty()) {
2226                            StringBundler msg = new StringBundler(6);
2227    
2228                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2229    
2230                            msg.append("userId=");
2231                            msg.append(userId);
2232    
2233                            msg.append(", lastPostDate=");
2234                            msg.append(lastPostDate);
2235    
2236                            msg.append(StringPool.CLOSE_CURLY_BRACE);
2237    
2238                            throw new NoSuchStatsUserException(msg.toString());
2239                    }
2240                    else {
2241                            return list.get(0);
2242                    }
2243            }
2244    
2245            /**
2246             * Finds the blogs stats users before and after the current blogs stats user in the ordered set where userId = &#63; and lastPostDate = &#63;.
2247             *
2248             * <p>
2249             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2250             * </p>
2251             *
2252             * @param statsUserId the primary key of the current blogs stats user
2253             * @param userId the user id to search with
2254             * @param lastPostDate the last post date to search with
2255             * @param orderByComparator the comparator to order the set by
2256             * @return the previous, current, and next blogs stats user
2257             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a blogs stats user with the primary key could not be found
2258             * @throws SystemException if a system exception occurred
2259             */
2260            public BlogsStatsUser[] findByU_L_PrevAndNext(long statsUserId,
2261                    long userId, Date lastPostDate, OrderByComparator orderByComparator)
2262                    throws NoSuchStatsUserException, SystemException {
2263                    BlogsStatsUser blogsStatsUser = findByPrimaryKey(statsUserId);
2264    
2265                    Session session = null;
2266    
2267                    try {
2268                            session = openSession();
2269    
2270                            BlogsStatsUser[] array = new BlogsStatsUserImpl[3];
2271    
2272                            array[0] = getByU_L_PrevAndNext(session, blogsStatsUser, userId,
2273                                            lastPostDate, orderByComparator, true);
2274    
2275                            array[1] = blogsStatsUser;
2276    
2277                            array[2] = getByU_L_PrevAndNext(session, blogsStatsUser, userId,
2278                                            lastPostDate, orderByComparator, false);
2279    
2280                            return array;
2281                    }
2282                    catch (Exception e) {
2283                            throw processException(e);
2284                    }
2285                    finally {
2286                            closeSession(session);
2287                    }
2288            }
2289    
2290            protected BlogsStatsUser getByU_L_PrevAndNext(Session session,
2291                    BlogsStatsUser blogsStatsUser, long userId, Date lastPostDate,
2292                    OrderByComparator orderByComparator, boolean previous) {
2293                    StringBundler query = null;
2294    
2295                    if (orderByComparator != null) {
2296                            query = new StringBundler(6 +
2297                                            (orderByComparator.getOrderByFields().length * 6));
2298                    }
2299                    else {
2300                            query = new StringBundler(3);
2301                    }
2302    
2303                    query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
2304    
2305                    query.append(_FINDER_COLUMN_U_L_USERID_2);
2306    
2307                    if (lastPostDate == null) {
2308                            query.append(_FINDER_COLUMN_U_L_LASTPOSTDATE_1);
2309                    }
2310                    else {
2311                            query.append(_FINDER_COLUMN_U_L_LASTPOSTDATE_2);
2312                    }
2313    
2314                    if (orderByComparator != null) {
2315                            String[] orderByFields = orderByComparator.getOrderByFields();
2316    
2317                            if (orderByFields.length > 0) {
2318                                    query.append(WHERE_AND);
2319                            }
2320    
2321                            for (int i = 0; i < orderByFields.length; i++) {
2322                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2323                                    query.append(orderByFields[i]);
2324    
2325                                    if ((i + 1) < orderByFields.length) {
2326                                            if (orderByComparator.isAscending() ^ previous) {
2327                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
2328                                            }
2329                                            else {
2330                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
2331                                            }
2332                                    }
2333                                    else {
2334                                            if (orderByComparator.isAscending() ^ previous) {
2335                                                    query.append(WHERE_GREATER_THAN);
2336                                            }
2337                                            else {
2338                                                    query.append(WHERE_LESSER_THAN);
2339                                            }
2340                                    }
2341                            }
2342    
2343                            query.append(ORDER_BY_CLAUSE);
2344    
2345                            for (int i = 0; i < orderByFields.length; i++) {
2346                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2347                                    query.append(orderByFields[i]);
2348    
2349                                    if ((i + 1) < orderByFields.length) {
2350                                            if (orderByComparator.isAscending() ^ previous) {
2351                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
2352                                            }
2353                                            else {
2354                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
2355                                            }
2356                                    }
2357                                    else {
2358                                            if (orderByComparator.isAscending() ^ previous) {
2359                                                    query.append(ORDER_BY_ASC);
2360                                            }
2361                                            else {
2362                                                    query.append(ORDER_BY_DESC);
2363                                            }
2364                                    }
2365                            }
2366                    }
2367    
2368                    else {
2369                            query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
2370                    }
2371    
2372                    String sql = query.toString();
2373    
2374                    Query q = session.createQuery(sql);
2375    
2376                    q.setFirstResult(0);
2377                    q.setMaxResults(2);
2378    
2379                    QueryPos qPos = QueryPos.getInstance(q);
2380    
2381                    qPos.add(userId);
2382    
2383                    if (lastPostDate != null) {
2384                            qPos.add(CalendarUtil.getTimestamp(lastPostDate));
2385                    }
2386    
2387                    if (orderByComparator != null) {
2388                            Object[] values = orderByComparator.getOrderByValues(blogsStatsUser);
2389    
2390                            for (Object value : values) {
2391                                    qPos.add(value);
2392                            }
2393                    }
2394    
2395                    List<BlogsStatsUser> list = q.list();
2396    
2397                    if (list.size() == 2) {
2398                            return list.get(1);
2399                    }
2400                    else {
2401                            return null;
2402                    }
2403            }
2404    
2405            /**
2406             * Finds all the blogs stats users.
2407             *
2408             * @return the blogs stats users
2409             * @throws SystemException if a system exception occurred
2410             */
2411            public List<BlogsStatsUser> findAll() throws SystemException {
2412                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2413            }
2414    
2415            /**
2416             * Finds a range of all the blogs stats users.
2417             *
2418             * <p>
2419             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2420             * </p>
2421             *
2422             * @param start the lower bound of the range of blogs stats users to return
2423             * @param end the upper bound of the range of blogs stats users to return (not inclusive)
2424             * @return the range of blogs stats users
2425             * @throws SystemException if a system exception occurred
2426             */
2427            public List<BlogsStatsUser> findAll(int start, int end)
2428                    throws SystemException {
2429                    return findAll(start, end, null);
2430            }
2431    
2432            /**
2433             * Finds an ordered range of all the blogs stats users.
2434             *
2435             * <p>
2436             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2437             * </p>
2438             *
2439             * @param start the lower bound of the range of blogs stats users to return
2440             * @param end the upper bound of the range of blogs stats users to return (not inclusive)
2441             * @param orderByComparator the comparator to order the results by
2442             * @return the ordered range of blogs stats users
2443             * @throws SystemException if a system exception occurred
2444             */
2445            public List<BlogsStatsUser> findAll(int start, int end,
2446                    OrderByComparator orderByComparator) throws SystemException {
2447                    Object[] finderArgs = new Object[] {
2448                                    String.valueOf(start), String.valueOf(end),
2449                                    String.valueOf(orderByComparator)
2450                            };
2451    
2452                    List<BlogsStatsUser> list = (List<BlogsStatsUser>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
2453                                    finderArgs, this);
2454    
2455                    if (list == null) {
2456                            StringBundler query = null;
2457                            String sql = null;
2458    
2459                            if (orderByComparator != null) {
2460                                    query = new StringBundler(2 +
2461                                                    (orderByComparator.getOrderByFields().length * 3));
2462    
2463                                    query.append(_SQL_SELECT_BLOGSSTATSUSER);
2464    
2465                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2466                                            orderByComparator);
2467    
2468                                    sql = query.toString();
2469                            }
2470                            else {
2471                                    sql = _SQL_SELECT_BLOGSSTATSUSER.concat(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
2472                            }
2473    
2474                            Session session = null;
2475    
2476                            try {
2477                                    session = openSession();
2478    
2479                                    Query q = session.createQuery(sql);
2480    
2481                                    if (orderByComparator == null) {
2482                                            list = (List<BlogsStatsUser>)QueryUtil.list(q,
2483                                                            getDialect(), start, end, false);
2484    
2485                                            Collections.sort(list);
2486                                    }
2487                                    else {
2488                                            list = (List<BlogsStatsUser>)QueryUtil.list(q,
2489                                                            getDialect(), start, end);
2490                                    }
2491                            }
2492                            catch (Exception e) {
2493                                    throw processException(e);
2494                            }
2495                            finally {
2496                                    if (list == null) {
2497                                            FinderCacheUtil.removeResult(FINDER_PATH_FIND_ALL,
2498                                                    finderArgs);
2499                                    }
2500                                    else {
2501                                            cacheResult(list);
2502    
2503                                            FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs,
2504                                                    list);
2505                                    }
2506    
2507                                    closeSession(session);
2508                            }
2509                    }
2510    
2511                    return list;
2512            }
2513    
2514            /**
2515             * Removes all the blogs stats users where groupId = &#63; from the database.
2516             *
2517             * @param groupId the group id to search with
2518             * @throws SystemException if a system exception occurred
2519             */
2520            public void removeByGroupId(long groupId) throws SystemException {
2521                    for (BlogsStatsUser blogsStatsUser : findByGroupId(groupId)) {
2522                            remove(blogsStatsUser);
2523                    }
2524            }
2525    
2526            /**
2527             * Removes all the blogs stats users where userId = &#63; from the database.
2528             *
2529             * @param userId the user id to search with
2530             * @throws SystemException if a system exception occurred
2531             */
2532            public void removeByUserId(long userId) throws SystemException {
2533                    for (BlogsStatsUser blogsStatsUser : findByUserId(userId)) {
2534                            remove(blogsStatsUser);
2535                    }
2536            }
2537    
2538            /**
2539             * Removes the blogs stats user where groupId = &#63; and userId = &#63; from the database.
2540             *
2541             * @param groupId the group id to search with
2542             * @param userId the user id to search with
2543             * @throws SystemException if a system exception occurred
2544             */
2545            public void removeByG_U(long groupId, long userId)
2546                    throws NoSuchStatsUserException, SystemException {
2547                    BlogsStatsUser blogsStatsUser = findByG_U(groupId, userId);
2548    
2549                    remove(blogsStatsUser);
2550            }
2551    
2552            /**
2553             * Removes all the blogs stats users where groupId = &#63; and entryCount &ne; &#63; from the database.
2554             *
2555             * @param groupId the group id to search with
2556             * @param entryCount the entry count to search with
2557             * @throws SystemException if a system exception occurred
2558             */
2559            public void removeByG_NotE(long groupId, int entryCount)
2560                    throws SystemException {
2561                    for (BlogsStatsUser blogsStatsUser : findByG_NotE(groupId, entryCount)) {
2562                            remove(blogsStatsUser);
2563                    }
2564            }
2565    
2566            /**
2567             * Removes all the blogs stats users where companyId = &#63; and entryCount &ne; &#63; from the database.
2568             *
2569             * @param companyId the company id to search with
2570             * @param entryCount the entry count to search with
2571             * @throws SystemException if a system exception occurred
2572             */
2573            public void removeByC_NotE(long companyId, int entryCount)
2574                    throws SystemException {
2575                    for (BlogsStatsUser blogsStatsUser : findByC_NotE(companyId, entryCount)) {
2576                            remove(blogsStatsUser);
2577                    }
2578            }
2579    
2580            /**
2581             * Removes all the blogs stats users where userId = &#63; and lastPostDate = &#63; from the database.
2582             *
2583             * @param userId the user id to search with
2584             * @param lastPostDate the last post date to search with
2585             * @throws SystemException if a system exception occurred
2586             */
2587            public void removeByU_L(long userId, Date lastPostDate)
2588                    throws SystemException {
2589                    for (BlogsStatsUser blogsStatsUser : findByU_L(userId, lastPostDate)) {
2590                            remove(blogsStatsUser);
2591                    }
2592            }
2593    
2594            /**
2595             * Removes all the blogs stats users from the database.
2596             *
2597             * @throws SystemException if a system exception occurred
2598             */
2599            public void removeAll() throws SystemException {
2600                    for (BlogsStatsUser blogsStatsUser : findAll()) {
2601                            remove(blogsStatsUser);
2602                    }
2603            }
2604    
2605            /**
2606             * Counts all the blogs stats users where groupId = &#63;.
2607             *
2608             * @param groupId the group id to search with
2609             * @return the number of matching blogs stats users
2610             * @throws SystemException if a system exception occurred
2611             */
2612            public int countByGroupId(long groupId) throws SystemException {
2613                    Object[] finderArgs = new Object[] { groupId };
2614    
2615                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
2616                                    finderArgs, this);
2617    
2618                    if (count == null) {
2619                            StringBundler query = new StringBundler(2);
2620    
2621                            query.append(_SQL_COUNT_BLOGSSTATSUSER_WHERE);
2622    
2623                            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2624    
2625                            String sql = query.toString();
2626    
2627                            Session session = null;
2628    
2629                            try {
2630                                    session = openSession();
2631    
2632                                    Query q = session.createQuery(sql);
2633    
2634                                    QueryPos qPos = QueryPos.getInstance(q);
2635    
2636                                    qPos.add(groupId);
2637    
2638                                    count = (Long)q.uniqueResult();
2639                            }
2640                            catch (Exception e) {
2641                                    throw processException(e);
2642                            }
2643                            finally {
2644                                    if (count == null) {
2645                                            count = Long.valueOf(0);
2646                                    }
2647    
2648                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
2649                                            finderArgs, count);
2650    
2651                                    closeSession(session);
2652                            }
2653                    }
2654    
2655                    return count.intValue();
2656            }
2657    
2658            /**
2659             * Counts all the blogs stats users where userId = &#63;.
2660             *
2661             * @param userId the user id to search with
2662             * @return the number of matching blogs stats users
2663             * @throws SystemException if a system exception occurred
2664             */
2665            public int countByUserId(long userId) throws SystemException {
2666                    Object[] finderArgs = new Object[] { userId };
2667    
2668                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERID,
2669                                    finderArgs, this);
2670    
2671                    if (count == null) {
2672                            StringBundler query = new StringBundler(2);
2673    
2674                            query.append(_SQL_COUNT_BLOGSSTATSUSER_WHERE);
2675    
2676                            query.append(_FINDER_COLUMN_USERID_USERID_2);
2677    
2678                            String sql = query.toString();
2679    
2680                            Session session = null;
2681    
2682                            try {
2683                                    session = openSession();
2684    
2685                                    Query q = session.createQuery(sql);
2686    
2687                                    QueryPos qPos = QueryPos.getInstance(q);
2688    
2689                                    qPos.add(userId);
2690    
2691                                    count = (Long)q.uniqueResult();
2692                            }
2693                            catch (Exception e) {
2694                                    throw processException(e);
2695                            }
2696                            finally {
2697                                    if (count == null) {
2698                                            count = Long.valueOf(0);
2699                                    }
2700    
2701                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERID,
2702                                            finderArgs, count);
2703    
2704                                    closeSession(session);
2705                            }
2706                    }
2707    
2708                    return count.intValue();
2709            }
2710    
2711            /**
2712             * Counts all the blogs stats users where groupId = &#63; and userId = &#63;.
2713             *
2714             * @param groupId the group id to search with
2715             * @param userId the user id to search with
2716             * @return the number of matching blogs stats users
2717             * @throws SystemException if a system exception occurred
2718             */
2719            public int countByG_U(long groupId, long userId) throws SystemException {
2720                    Object[] finderArgs = new Object[] { groupId, userId };
2721    
2722                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_U,
2723                                    finderArgs, this);
2724    
2725                    if (count == null) {
2726                            StringBundler query = new StringBundler(3);
2727    
2728                            query.append(_SQL_COUNT_BLOGSSTATSUSER_WHERE);
2729    
2730                            query.append(_FINDER_COLUMN_G_U_GROUPID_2);
2731    
2732                            query.append(_FINDER_COLUMN_G_U_USERID_2);
2733    
2734                            String sql = query.toString();
2735    
2736                            Session session = null;
2737    
2738                            try {
2739                                    session = openSession();
2740    
2741                                    Query q = session.createQuery(sql);
2742    
2743                                    QueryPos qPos = QueryPos.getInstance(q);
2744    
2745                                    qPos.add(groupId);
2746    
2747                                    qPos.add(userId);
2748    
2749                                    count = (Long)q.uniqueResult();
2750                            }
2751                            catch (Exception e) {
2752                                    throw processException(e);
2753                            }
2754                            finally {
2755                                    if (count == null) {
2756                                            count = Long.valueOf(0);
2757                                    }
2758    
2759                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_U, finderArgs,
2760                                            count);
2761    
2762                                    closeSession(session);
2763                            }
2764                    }
2765    
2766                    return count.intValue();
2767            }
2768    
2769            /**
2770             * Counts all the blogs stats users where groupId = &#63; and entryCount &ne; &#63;.
2771             *
2772             * @param groupId the group id to search with
2773             * @param entryCount the entry count to search with
2774             * @return the number of matching blogs stats users
2775             * @throws SystemException if a system exception occurred
2776             */
2777            public int countByG_NotE(long groupId, int entryCount)
2778                    throws SystemException {
2779                    Object[] finderArgs = new Object[] { groupId, entryCount };
2780    
2781                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_NOTE,
2782                                    finderArgs, this);
2783    
2784                    if (count == null) {
2785                            StringBundler query = new StringBundler(3);
2786    
2787                            query.append(_SQL_COUNT_BLOGSSTATSUSER_WHERE);
2788    
2789                            query.append(_FINDER_COLUMN_G_NOTE_GROUPID_2);
2790    
2791                            query.append(_FINDER_COLUMN_G_NOTE_ENTRYCOUNT_2);
2792    
2793                            String sql = query.toString();
2794    
2795                            Session session = null;
2796    
2797                            try {
2798                                    session = openSession();
2799    
2800                                    Query q = session.createQuery(sql);
2801    
2802                                    QueryPos qPos = QueryPos.getInstance(q);
2803    
2804                                    qPos.add(groupId);
2805    
2806                                    qPos.add(entryCount);
2807    
2808                                    count = (Long)q.uniqueResult();
2809                            }
2810                            catch (Exception e) {
2811                                    throw processException(e);
2812                            }
2813                            finally {
2814                                    if (count == null) {
2815                                            count = Long.valueOf(0);
2816                                    }
2817    
2818                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_NOTE,
2819                                            finderArgs, count);
2820    
2821                                    closeSession(session);
2822                            }
2823                    }
2824    
2825                    return count.intValue();
2826            }
2827    
2828            /**
2829             * Counts all the blogs stats users where companyId = &#63; and entryCount &ne; &#63;.
2830             *
2831             * @param companyId the company id to search with
2832             * @param entryCount the entry count to search with
2833             * @return the number of matching blogs stats users
2834             * @throws SystemException if a system exception occurred
2835             */
2836            public int countByC_NotE(long companyId, int entryCount)
2837                    throws SystemException {
2838                    Object[] finderArgs = new Object[] { companyId, entryCount };
2839    
2840                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_NOTE,
2841                                    finderArgs, this);
2842    
2843                    if (count == null) {
2844                            StringBundler query = new StringBundler(3);
2845    
2846                            query.append(_SQL_COUNT_BLOGSSTATSUSER_WHERE);
2847    
2848                            query.append(_FINDER_COLUMN_C_NOTE_COMPANYID_2);
2849    
2850                            query.append(_FINDER_COLUMN_C_NOTE_ENTRYCOUNT_2);
2851    
2852                            String sql = query.toString();
2853    
2854                            Session session = null;
2855    
2856                            try {
2857                                    session = openSession();
2858    
2859                                    Query q = session.createQuery(sql);
2860    
2861                                    QueryPos qPos = QueryPos.getInstance(q);
2862    
2863                                    qPos.add(companyId);
2864    
2865                                    qPos.add(entryCount);
2866    
2867                                    count = (Long)q.uniqueResult();
2868                            }
2869                            catch (Exception e) {
2870                                    throw processException(e);
2871                            }
2872                            finally {
2873                                    if (count == null) {
2874                                            count = Long.valueOf(0);
2875                                    }
2876    
2877                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_NOTE,
2878                                            finderArgs, count);
2879    
2880                                    closeSession(session);
2881                            }
2882                    }
2883    
2884                    return count.intValue();
2885            }
2886    
2887            /**
2888             * Counts all the blogs stats users where userId = &#63; and lastPostDate = &#63;.
2889             *
2890             * @param userId the user id to search with
2891             * @param lastPostDate the last post date to search with
2892             * @return the number of matching blogs stats users
2893             * @throws SystemException if a system exception occurred
2894             */
2895            public int countByU_L(long userId, Date lastPostDate)
2896                    throws SystemException {
2897                    Object[] finderArgs = new Object[] { userId, lastPostDate };
2898    
2899                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_U_L,
2900                                    finderArgs, this);
2901    
2902                    if (count == null) {
2903                            StringBundler query = new StringBundler(3);
2904    
2905                            query.append(_SQL_COUNT_BLOGSSTATSUSER_WHERE);
2906    
2907                            query.append(_FINDER_COLUMN_U_L_USERID_2);
2908    
2909                            if (lastPostDate == null) {
2910                                    query.append(_FINDER_COLUMN_U_L_LASTPOSTDATE_1);
2911                            }
2912                            else {
2913                                    query.append(_FINDER_COLUMN_U_L_LASTPOSTDATE_2);
2914                            }
2915    
2916                            String sql = query.toString();
2917    
2918                            Session session = null;
2919    
2920                            try {
2921                                    session = openSession();
2922    
2923                                    Query q = session.createQuery(sql);
2924    
2925                                    QueryPos qPos = QueryPos.getInstance(q);
2926    
2927                                    qPos.add(userId);
2928    
2929                                    if (lastPostDate != null) {
2930                                            qPos.add(CalendarUtil.getTimestamp(lastPostDate));
2931                                    }
2932    
2933                                    count = (Long)q.uniqueResult();
2934                            }
2935                            catch (Exception e) {
2936                                    throw processException(e);
2937                            }
2938                            finally {
2939                                    if (count == null) {
2940                                            count = Long.valueOf(0);
2941                                    }
2942    
2943                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_U_L, finderArgs,
2944                                            count);
2945    
2946                                    closeSession(session);
2947                            }
2948                    }
2949    
2950                    return count.intValue();
2951            }
2952    
2953            /**
2954             * Counts all the blogs stats users.
2955             *
2956             * @return the number of blogs stats users
2957             * @throws SystemException if a system exception occurred
2958             */
2959            public int countAll() throws SystemException {
2960                    Object[] finderArgs = new Object[0];
2961    
2962                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2963                                    finderArgs, this);
2964    
2965                    if (count == null) {
2966                            Session session = null;
2967    
2968                            try {
2969                                    session = openSession();
2970    
2971                                    Query q = session.createQuery(_SQL_COUNT_BLOGSSTATSUSER);
2972    
2973                                    count = (Long)q.uniqueResult();
2974                            }
2975                            catch (Exception e) {
2976                                    throw processException(e);
2977                            }
2978                            finally {
2979                                    if (count == null) {
2980                                            count = Long.valueOf(0);
2981                                    }
2982    
2983                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
2984                                            count);
2985    
2986                                    closeSession(session);
2987                            }
2988                    }
2989    
2990                    return count.intValue();
2991            }
2992    
2993            /**
2994             * Initializes the blogs stats user persistence.
2995             */
2996            public void afterPropertiesSet() {
2997                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2998                                            com.liferay.portal.util.PropsUtil.get(
2999                                                    "value.object.listener.com.liferay.portlet.blogs.model.BlogsStatsUser")));
3000    
3001                    if (listenerClassNames.length > 0) {
3002                            try {
3003                                    List<ModelListener<BlogsStatsUser>> listenersList = new ArrayList<ModelListener<BlogsStatsUser>>();
3004    
3005                                    for (String listenerClassName : listenerClassNames) {
3006                                            listenersList.add((ModelListener<BlogsStatsUser>)InstanceFactory.newInstance(
3007                                                            listenerClassName));
3008                                    }
3009    
3010                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3011                            }
3012                            catch (Exception e) {
3013                                    _log.error(e);
3014                            }
3015                    }
3016            }
3017    
3018            public void destroy() {
3019                    EntityCacheUtil.removeCache(BlogsStatsUserImpl.class.getName());
3020                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
3021                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST);
3022            }
3023    
3024            @BeanReference(type = BlogsEntryPersistence.class)
3025            protected BlogsEntryPersistence blogsEntryPersistence;
3026            @BeanReference(type = BlogsStatsUserPersistence.class)
3027            protected BlogsStatsUserPersistence blogsStatsUserPersistence;
3028            @BeanReference(type = GroupPersistence.class)
3029            protected GroupPersistence groupPersistence;
3030            @BeanReference(type = ResourcePersistence.class)
3031            protected ResourcePersistence resourcePersistence;
3032            @BeanReference(type = UserPersistence.class)
3033            protected UserPersistence userPersistence;
3034            private static final String _SQL_SELECT_BLOGSSTATSUSER = "SELECT blogsStatsUser FROM BlogsStatsUser blogsStatsUser";
3035            private static final String _SQL_SELECT_BLOGSSTATSUSER_WHERE = "SELECT blogsStatsUser FROM BlogsStatsUser blogsStatsUser WHERE ";
3036            private static final String _SQL_COUNT_BLOGSSTATSUSER = "SELECT COUNT(blogsStatsUser) FROM BlogsStatsUser blogsStatsUser";
3037            private static final String _SQL_COUNT_BLOGSSTATSUSER_WHERE = "SELECT COUNT(blogsStatsUser) FROM BlogsStatsUser blogsStatsUser WHERE ";
3038            private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "blogsStatsUser.groupId = ?";
3039            private static final String _FINDER_COLUMN_USERID_USERID_2 = "blogsStatsUser.userId = ?";
3040            private static final String _FINDER_COLUMN_G_U_GROUPID_2 = "blogsStatsUser.groupId = ? AND ";
3041            private static final String _FINDER_COLUMN_G_U_USERID_2 = "blogsStatsUser.userId = ?";
3042            private static final String _FINDER_COLUMN_G_NOTE_GROUPID_2 = "blogsStatsUser.groupId = ? AND ";
3043            private static final String _FINDER_COLUMN_G_NOTE_ENTRYCOUNT_2 = "blogsStatsUser.entryCount != ?";
3044            private static final String _FINDER_COLUMN_C_NOTE_COMPANYID_2 = "blogsStatsUser.companyId = ? AND ";
3045            private static final String _FINDER_COLUMN_C_NOTE_ENTRYCOUNT_2 = "blogsStatsUser.entryCount != ?";
3046            private static final String _FINDER_COLUMN_U_L_USERID_2 = "blogsStatsUser.userId = ? AND ";
3047            private static final String _FINDER_COLUMN_U_L_LASTPOSTDATE_1 = "blogsStatsUser.lastPostDate IS NULL";
3048            private static final String _FINDER_COLUMN_U_L_LASTPOSTDATE_2 = "blogsStatsUser.lastPostDate = ?";
3049            private static final String _ORDER_BY_ENTITY_ALIAS = "blogsStatsUser.";
3050            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No BlogsStatsUser exists with the primary key ";
3051            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No BlogsStatsUser exists with the key {";
3052            private static Log _log = LogFactoryUtil.getLog(BlogsStatsUserPersistenceImpl.class);
3053    }