001    /**
002     * Copyright (c) 2000-2010 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.SQLQuery;
027    import com.liferay.portal.kernel.dao.orm.Session;
028    import com.liferay.portal.kernel.exception.SystemException;
029    import com.liferay.portal.kernel.log.Log;
030    import com.liferay.portal.kernel.log.LogFactoryUtil;
031    import com.liferay.portal.kernel.sanitizer.Sanitizer;
032    import com.liferay.portal.kernel.sanitizer.SanitizerException;
033    import com.liferay.portal.kernel.sanitizer.SanitizerUtil;
034    import com.liferay.portal.kernel.util.CalendarUtil;
035    import com.liferay.portal.kernel.util.ContentTypes;
036    import com.liferay.portal.kernel.util.GetterUtil;
037    import com.liferay.portal.kernel.util.InstanceFactory;
038    import com.liferay.portal.kernel.util.OrderByComparator;
039    import com.liferay.portal.kernel.util.StringBundler;
040    import com.liferay.portal.kernel.util.StringPool;
041    import com.liferay.portal.kernel.util.StringUtil;
042    import com.liferay.portal.kernel.util.Validator;
043    import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
044    import com.liferay.portal.model.ModelListener;
045    import com.liferay.portal.security.auth.PrincipalThreadLocal;
046    import com.liferay.portal.security.permission.InlineSQLHelperUtil;
047    import com.liferay.portal.service.persistence.BatchSessionUtil;
048    import com.liferay.portal.service.persistence.CompanyPersistence;
049    import com.liferay.portal.service.persistence.GroupPersistence;
050    import com.liferay.portal.service.persistence.OrganizationPersistence;
051    import com.liferay.portal.service.persistence.PortletPreferencesPersistence;
052    import com.liferay.portal.service.persistence.ResourcePersistence;
053    import com.liferay.portal.service.persistence.UserPersistence;
054    import com.liferay.portal.service.persistence.WorkflowInstanceLinkPersistence;
055    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
056    
057    import com.liferay.portlet.asset.service.persistence.AssetEntryPersistence;
058    import com.liferay.portlet.asset.service.persistence.AssetTagPersistence;
059    import com.liferay.portlet.blogs.NoSuchEntryException;
060    import com.liferay.portlet.blogs.model.BlogsEntry;
061    import com.liferay.portlet.blogs.model.impl.BlogsEntryImpl;
062    import com.liferay.portlet.blogs.model.impl.BlogsEntryModelImpl;
063    import com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence;
064    import com.liferay.portlet.messageboards.service.persistence.MBMessagePersistence;
065    import com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence;
066    import com.liferay.portlet.social.service.persistence.SocialActivityPersistence;
067    import com.liferay.portlet.social.service.persistence.SocialEquityLogPersistence;
068    
069    import java.io.Serializable;
070    
071    import java.util.ArrayList;
072    import java.util.Collections;
073    import java.util.Date;
074    import java.util.List;
075    
076    /**
077     * The persistence implementation for the blogs entry service.
078     *
079     * <p>
080     * Never modify or reference this class directly. Always use {@link BlogsEntryUtil} to access the blogs entry persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
081     * </p>
082     *
083     * <p>
084     * Caching information and settings can be found in <code>portal.properties</code>
085     * </p>
086     *
087     * @author Brian Wing Shun Chan
088     * @see BlogsEntryPersistence
089     * @see BlogsEntryUtil
090     * @generated
091     */
092    public class BlogsEntryPersistenceImpl extends BasePersistenceImpl<BlogsEntry>
093            implements BlogsEntryPersistence {
094            public static final String FINDER_CLASS_NAME_ENTITY = BlogsEntryImpl.class.getName();
095            public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
096                    ".List";
097            public static final FinderPath FINDER_PATH_FIND_BY_UUID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
098                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
099                            "findByUuid",
100                            new String[] {
101                                    String.class.getName(),
102                                    
103                            "java.lang.Integer", "java.lang.Integer",
104                                    "com.liferay.portal.kernel.util.OrderByComparator"
105                            });
106            public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
107                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
108                            "countByUuid", new String[] { String.class.getName() });
109            public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
110                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
111                            "fetchByUUID_G",
112                            new String[] { String.class.getName(), Long.class.getName() });
113            public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
114                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
115                            "countByUUID_G",
116                            new String[] { String.class.getName(), Long.class.getName() });
117            public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
118                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
119                            "findByGroupId",
120                            new String[] {
121                                    Long.class.getName(),
122                                    
123                            "java.lang.Integer", "java.lang.Integer",
124                                    "com.liferay.portal.kernel.util.OrderByComparator"
125                            });
126            public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
127                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
128                            "countByGroupId", new String[] { Long.class.getName() });
129            public static final FinderPath FINDER_PATH_FIND_BY_COMPANYID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
130                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
131                            "findByCompanyId",
132                            new String[] {
133                                    Long.class.getName(),
134                                    
135                            "java.lang.Integer", "java.lang.Integer",
136                                    "com.liferay.portal.kernel.util.OrderByComparator"
137                            });
138            public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
139                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
140                            "countByCompanyId", new String[] { Long.class.getName() });
141            public static final FinderPath FINDER_PATH_FIND_BY_C_U = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
142                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
143                            "findByC_U",
144                            new String[] {
145                                    Long.class.getName(), Long.class.getName(),
146                                    
147                            "java.lang.Integer", "java.lang.Integer",
148                                    "com.liferay.portal.kernel.util.OrderByComparator"
149                            });
150            public static final FinderPath FINDER_PATH_COUNT_BY_C_U = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
151                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
152                            "countByC_U",
153                            new String[] { Long.class.getName(), Long.class.getName() });
154            public static final FinderPath FINDER_PATH_FIND_BY_C_LTD = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
155                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
156                            "findByC_LtD",
157                            new String[] {
158                                    Long.class.getName(), Date.class.getName(),
159                                    
160                            "java.lang.Integer", "java.lang.Integer",
161                                    "com.liferay.portal.kernel.util.OrderByComparator"
162                            });
163            public static final FinderPath FINDER_PATH_COUNT_BY_C_LTD = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
164                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
165                            "countByC_LtD",
166                            new String[] { Long.class.getName(), Date.class.getName() });
167            public static final FinderPath FINDER_PATH_FIND_BY_C_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
168                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
169                            "findByC_S",
170                            new String[] {
171                                    Long.class.getName(), Integer.class.getName(),
172                                    
173                            "java.lang.Integer", "java.lang.Integer",
174                                    "com.liferay.portal.kernel.util.OrderByComparator"
175                            });
176            public static final FinderPath FINDER_PATH_COUNT_BY_C_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
177                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
178                            "countByC_S",
179                            new String[] { Long.class.getName(), Integer.class.getName() });
180            public static final FinderPath FINDER_PATH_FETCH_BY_G_UT = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
181                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
182                            "fetchByG_UT",
183                            new String[] { Long.class.getName(), String.class.getName() });
184            public static final FinderPath FINDER_PATH_COUNT_BY_G_UT = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
185                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
186                            "countByG_UT",
187                            new String[] { Long.class.getName(), String.class.getName() });
188            public static final FinderPath FINDER_PATH_FIND_BY_G_LTD = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
189                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
190                            "findByG_LtD",
191                            new String[] {
192                                    Long.class.getName(), Date.class.getName(),
193                                    
194                            "java.lang.Integer", "java.lang.Integer",
195                                    "com.liferay.portal.kernel.util.OrderByComparator"
196                            });
197            public static final FinderPath FINDER_PATH_COUNT_BY_G_LTD = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
198                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
199                            "countByG_LtD",
200                            new String[] { Long.class.getName(), Date.class.getName() });
201            public static final FinderPath FINDER_PATH_FIND_BY_G_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
202                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
203                            "findByG_S",
204                            new String[] {
205                                    Long.class.getName(), Integer.class.getName(),
206                                    
207                            "java.lang.Integer", "java.lang.Integer",
208                                    "com.liferay.portal.kernel.util.OrderByComparator"
209                            });
210            public static final FinderPath FINDER_PATH_COUNT_BY_G_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
211                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
212                            "countByG_S",
213                            new String[] { Long.class.getName(), Integer.class.getName() });
214            public static final FinderPath FINDER_PATH_FIND_BY_C_U_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
215                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
216                            "findByC_U_S",
217                            new String[] {
218                                    Long.class.getName(), Long.class.getName(),
219                                    Integer.class.getName(),
220                                    
221                            "java.lang.Integer", "java.lang.Integer",
222                                    "com.liferay.portal.kernel.util.OrderByComparator"
223                            });
224            public static final FinderPath FINDER_PATH_COUNT_BY_C_U_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
225                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
226                            "countByC_U_S",
227                            new String[] {
228                                    Long.class.getName(), Long.class.getName(),
229                                    Integer.class.getName()
230                            });
231            public static final FinderPath FINDER_PATH_FIND_BY_C_LTD_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
232                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
233                            "findByC_LtD_S",
234                            new String[] {
235                                    Long.class.getName(), Date.class.getName(),
236                                    Integer.class.getName(),
237                                    
238                            "java.lang.Integer", "java.lang.Integer",
239                                    "com.liferay.portal.kernel.util.OrderByComparator"
240                            });
241            public static final FinderPath FINDER_PATH_COUNT_BY_C_LTD_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
242                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
243                            "countByC_LtD_S",
244                            new String[] {
245                                    Long.class.getName(), Date.class.getName(),
246                                    Integer.class.getName()
247                            });
248            public static final FinderPath FINDER_PATH_FIND_BY_G_U_LTD = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
249                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
250                            "findByG_U_LtD",
251                            new String[] {
252                                    Long.class.getName(), Long.class.getName(), Date.class.getName(),
253                                    
254                            "java.lang.Integer", "java.lang.Integer",
255                                    "com.liferay.portal.kernel.util.OrderByComparator"
256                            });
257            public static final FinderPath FINDER_PATH_COUNT_BY_G_U_LTD = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
258                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
259                            "countByG_U_LtD",
260                            new String[] {
261                                    Long.class.getName(), Long.class.getName(), Date.class.getName()
262                            });
263            public static final FinderPath FINDER_PATH_FIND_BY_G_U_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
264                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
265                            "findByG_U_S",
266                            new String[] {
267                                    Long.class.getName(), Long.class.getName(),
268                                    Integer.class.getName(),
269                                    
270                            "java.lang.Integer", "java.lang.Integer",
271                                    "com.liferay.portal.kernel.util.OrderByComparator"
272                            });
273            public static final FinderPath FINDER_PATH_COUNT_BY_G_U_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
274                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
275                            "countByG_U_S",
276                            new String[] {
277                                    Long.class.getName(), Long.class.getName(),
278                                    Integer.class.getName()
279                            });
280            public static final FinderPath FINDER_PATH_FIND_BY_G_LTD_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
281                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
282                            "findByG_LtD_S",
283                            new String[] {
284                                    Long.class.getName(), Date.class.getName(),
285                                    Integer.class.getName(),
286                                    
287                            "java.lang.Integer", "java.lang.Integer",
288                                    "com.liferay.portal.kernel.util.OrderByComparator"
289                            });
290            public static final FinderPath FINDER_PATH_COUNT_BY_G_LTD_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
291                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
292                            "countByG_LtD_S",
293                            new String[] {
294                                    Long.class.getName(), Date.class.getName(),
295                                    Integer.class.getName()
296                            });
297            public static final FinderPath FINDER_PATH_FIND_BY_G_U_LTD_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
298                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
299                            "findByG_U_LtD_S",
300                            new String[] {
301                                    Long.class.getName(), Long.class.getName(), Date.class.getName(),
302                                    Integer.class.getName(),
303                                    
304                            "java.lang.Integer", "java.lang.Integer",
305                                    "com.liferay.portal.kernel.util.OrderByComparator"
306                            });
307            public static final FinderPath FINDER_PATH_COUNT_BY_G_U_LTD_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
308                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
309                            "countByG_U_LtD_S",
310                            new String[] {
311                                    Long.class.getName(), Long.class.getName(), Date.class.getName(),
312                                    Integer.class.getName()
313                            });
314            public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
315                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
316                            "findAll", new String[0]);
317            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
318                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
319                            "countAll", new String[0]);
320    
321            /**
322             * Caches the blogs entry in the entity cache if it is enabled.
323             *
324             * @param blogsEntry the blogs entry to cache
325             */
326            public void cacheResult(BlogsEntry blogsEntry) {
327                    EntityCacheUtil.putResult(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
328                            BlogsEntryImpl.class, blogsEntry.getPrimaryKey(), blogsEntry);
329    
330                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
331                            new Object[] { blogsEntry.getUuid(), new Long(
332                                            blogsEntry.getGroupId()) }, blogsEntry);
333    
334                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_UT,
335                            new Object[] {
336                                    new Long(blogsEntry.getGroupId()),
337                                    
338                            blogsEntry.getUrlTitle()
339                            }, blogsEntry);
340            }
341    
342            /**
343             * Caches the blogs entries in the entity cache if it is enabled.
344             *
345             * @param blogsEntries the blogs entries to cache
346             */
347            public void cacheResult(List<BlogsEntry> blogsEntries) {
348                    for (BlogsEntry blogsEntry : blogsEntries) {
349                            if (EntityCacheUtil.getResult(
350                                                    BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
351                                                    BlogsEntryImpl.class, blogsEntry.getPrimaryKey(), this) == null) {
352                                    cacheResult(blogsEntry);
353                            }
354                    }
355            }
356    
357            /**
358             * Clears the cache for all blogs entries.
359             *
360             * <p>
361             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
362             * </p>
363             */
364            public void clearCache() {
365                    CacheRegistryUtil.clear(BlogsEntryImpl.class.getName());
366                    EntityCacheUtil.clearCache(BlogsEntryImpl.class.getName());
367                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
368                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
369            }
370    
371            /**
372             * Clears the cache for the blogs entry.
373             *
374             * <p>
375             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
376             * </p>
377             */
378            public void clearCache(BlogsEntry blogsEntry) {
379                    EntityCacheUtil.removeResult(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
380                            BlogsEntryImpl.class, blogsEntry.getPrimaryKey());
381    
382                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
383                            new Object[] { blogsEntry.getUuid(), new Long(
384                                            blogsEntry.getGroupId()) });
385    
386                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_UT,
387                            new Object[] {
388                                    new Long(blogsEntry.getGroupId()),
389                                    
390                            blogsEntry.getUrlTitle()
391                            });
392            }
393    
394            /**
395             * Creates a new blogs entry with the primary key. Does not add the blogs entry to the database.
396             *
397             * @param entryId the primary key for the new blogs entry
398             * @return the new blogs entry
399             */
400            public BlogsEntry create(long entryId) {
401                    BlogsEntry blogsEntry = new BlogsEntryImpl();
402    
403                    blogsEntry.setNew(true);
404                    blogsEntry.setPrimaryKey(entryId);
405    
406                    String uuid = PortalUUIDUtil.generate();
407    
408                    blogsEntry.setUuid(uuid);
409    
410                    return blogsEntry;
411            }
412    
413            /**
414             * Removes the blogs entry with the primary key from the database. Also notifies the appropriate model listeners.
415             *
416             * @param primaryKey the primary key of the blogs entry to remove
417             * @return the blogs entry that was removed
418             * @throws com.liferay.portal.NoSuchModelException if a blogs entry with the primary key could not be found
419             * @throws SystemException if a system exception occurred
420             */
421            public BlogsEntry remove(Serializable primaryKey)
422                    throws NoSuchModelException, SystemException {
423                    return remove(((Long)primaryKey).longValue());
424            }
425    
426            /**
427             * Removes the blogs entry with the primary key from the database. Also notifies the appropriate model listeners.
428             *
429             * @param entryId the primary key of the blogs entry to remove
430             * @return the blogs entry that was removed
431             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
432             * @throws SystemException if a system exception occurred
433             */
434            public BlogsEntry remove(long entryId)
435                    throws NoSuchEntryException, SystemException {
436                    Session session = null;
437    
438                    try {
439                            session = openSession();
440    
441                            BlogsEntry blogsEntry = (BlogsEntry)session.get(BlogsEntryImpl.class,
442                                            new Long(entryId));
443    
444                            if (blogsEntry == null) {
445                                    if (_log.isWarnEnabled()) {
446                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + entryId);
447                                    }
448    
449                                    throw new NoSuchEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
450                                            entryId);
451                            }
452    
453                            return remove(blogsEntry);
454                    }
455                    catch (NoSuchEntryException nsee) {
456                            throw nsee;
457                    }
458                    catch (Exception e) {
459                            throw processException(e);
460                    }
461                    finally {
462                            closeSession(session);
463                    }
464            }
465    
466            protected BlogsEntry removeImpl(BlogsEntry blogsEntry)
467                    throws SystemException {
468                    blogsEntry = toUnwrappedModel(blogsEntry);
469    
470                    Session session = null;
471    
472                    try {
473                            session = openSession();
474    
475                            if (blogsEntry.isCachedModel() || BatchSessionUtil.isEnabled()) {
476                                    Object staleObject = session.get(BlogsEntryImpl.class,
477                                                    blogsEntry.getPrimaryKeyObj());
478    
479                                    if (staleObject != null) {
480                                            session.evict(staleObject);
481                                    }
482                            }
483    
484                            session.delete(blogsEntry);
485    
486                            session.flush();
487                    }
488                    catch (Exception e) {
489                            throw processException(e);
490                    }
491                    finally {
492                            closeSession(session);
493                    }
494    
495                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
496    
497                    BlogsEntryModelImpl blogsEntryModelImpl = (BlogsEntryModelImpl)blogsEntry;
498    
499                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
500                            new Object[] {
501                                    blogsEntryModelImpl.getOriginalUuid(),
502                                    new Long(blogsEntryModelImpl.getOriginalGroupId())
503                            });
504    
505                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_UT,
506                            new Object[] {
507                                    new Long(blogsEntryModelImpl.getOriginalGroupId()),
508                                    
509                            blogsEntryModelImpl.getOriginalUrlTitle()
510                            });
511    
512                    EntityCacheUtil.removeResult(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
513                            BlogsEntryImpl.class, blogsEntry.getPrimaryKey());
514    
515                    return blogsEntry;
516            }
517    
518            public BlogsEntry updateImpl(
519                    com.liferay.portlet.blogs.model.BlogsEntry blogsEntry, boolean merge)
520                    throws SystemException {
521                    blogsEntry = toUnwrappedModel(blogsEntry);
522    
523                    boolean isNew = blogsEntry.isNew();
524    
525                    BlogsEntryModelImpl blogsEntryModelImpl = (BlogsEntryModelImpl)blogsEntry;
526    
527                    if (Validator.isNull(blogsEntry.getUuid())) {
528                            String uuid = PortalUUIDUtil.generate();
529    
530                            blogsEntry.setUuid(uuid);
531                    }
532    
533                    long userId = GetterUtil.getLong(PrincipalThreadLocal.getName());
534    
535                    if (userId > 0) {
536                            long companyId = blogsEntry.getCompanyId();
537    
538                            long groupId = blogsEntry.getGroupId();
539    
540                            long entryId = 0;
541    
542                            if (!isNew) {
543                                    entryId = blogsEntry.getPrimaryKey();
544                            }
545    
546                            try {
547                                    blogsEntry.setTitle(SanitizerUtil.sanitize(companyId, groupId,
548                                                    userId,
549                                                    com.liferay.portlet.blogs.model.BlogsEntry.class.getName(),
550                                                    entryId, ContentTypes.TEXT_PLAIN, Sanitizer.MODE_ALL,
551                                                    blogsEntry.getTitle(), null));
552    
553                                    blogsEntry.setContent(SanitizerUtil.sanitize(companyId,
554                                                    groupId, userId,
555                                                    com.liferay.portlet.blogs.model.BlogsEntry.class.getName(),
556                                                    entryId, ContentTypes.TEXT_HTML, Sanitizer.MODE_ALL,
557                                                    blogsEntry.getContent(), null));
558                            }
559                            catch (SanitizerException se) {
560                                    throw new SystemException(se);
561                            }
562                    }
563    
564                    Session session = null;
565    
566                    try {
567                            session = openSession();
568    
569                            BatchSessionUtil.update(session, blogsEntry, merge);
570    
571                            blogsEntry.setNew(false);
572                    }
573                    catch (Exception e) {
574                            throw processException(e);
575                    }
576                    finally {
577                            closeSession(session);
578                    }
579    
580                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
581    
582                    EntityCacheUtil.putResult(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
583                            BlogsEntryImpl.class, blogsEntry.getPrimaryKey(), blogsEntry);
584    
585                    if (!isNew &&
586                                    (!Validator.equals(blogsEntry.getUuid(),
587                                            blogsEntryModelImpl.getOriginalUuid()) ||
588                                    (blogsEntry.getGroupId() != blogsEntryModelImpl.getOriginalGroupId()))) {
589                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
590                                    new Object[] {
591                                            blogsEntryModelImpl.getOriginalUuid(),
592                                            new Long(blogsEntryModelImpl.getOriginalGroupId())
593                                    });
594                    }
595    
596                    if (isNew ||
597                                    (!Validator.equals(blogsEntry.getUuid(),
598                                            blogsEntryModelImpl.getOriginalUuid()) ||
599                                    (blogsEntry.getGroupId() != blogsEntryModelImpl.getOriginalGroupId()))) {
600                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
601                                    new Object[] {
602                                            blogsEntry.getUuid(), new Long(blogsEntry.getGroupId())
603                                    }, blogsEntry);
604                    }
605    
606                    if (!isNew &&
607                                    ((blogsEntry.getGroupId() != blogsEntryModelImpl.getOriginalGroupId()) ||
608                                    !Validator.equals(blogsEntry.getUrlTitle(),
609                                            blogsEntryModelImpl.getOriginalUrlTitle()))) {
610                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_UT,
611                                    new Object[] {
612                                            new Long(blogsEntryModelImpl.getOriginalGroupId()),
613                                            
614                                    blogsEntryModelImpl.getOriginalUrlTitle()
615                                    });
616                    }
617    
618                    if (isNew ||
619                                    ((blogsEntry.getGroupId() != blogsEntryModelImpl.getOriginalGroupId()) ||
620                                    !Validator.equals(blogsEntry.getUrlTitle(),
621                                            blogsEntryModelImpl.getOriginalUrlTitle()))) {
622                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_UT,
623                                    new Object[] {
624                                            new Long(blogsEntry.getGroupId()),
625                                            
626                                    blogsEntry.getUrlTitle()
627                                    }, blogsEntry);
628                    }
629    
630                    return blogsEntry;
631            }
632    
633            protected BlogsEntry toUnwrappedModel(BlogsEntry blogsEntry) {
634                    if (blogsEntry instanceof BlogsEntryImpl) {
635                            return blogsEntry;
636                    }
637    
638                    BlogsEntryImpl blogsEntryImpl = new BlogsEntryImpl();
639    
640                    blogsEntryImpl.setNew(blogsEntry.isNew());
641                    blogsEntryImpl.setPrimaryKey(blogsEntry.getPrimaryKey());
642    
643                    blogsEntryImpl.setUuid(blogsEntry.getUuid());
644                    blogsEntryImpl.setEntryId(blogsEntry.getEntryId());
645                    blogsEntryImpl.setGroupId(blogsEntry.getGroupId());
646                    blogsEntryImpl.setCompanyId(blogsEntry.getCompanyId());
647                    blogsEntryImpl.setUserId(blogsEntry.getUserId());
648                    blogsEntryImpl.setUserName(blogsEntry.getUserName());
649                    blogsEntryImpl.setCreateDate(blogsEntry.getCreateDate());
650                    blogsEntryImpl.setModifiedDate(blogsEntry.getModifiedDate());
651                    blogsEntryImpl.setTitle(blogsEntry.getTitle());
652                    blogsEntryImpl.setUrlTitle(blogsEntry.getUrlTitle());
653                    blogsEntryImpl.setContent(blogsEntry.getContent());
654                    blogsEntryImpl.setDisplayDate(blogsEntry.getDisplayDate());
655                    blogsEntryImpl.setAllowPingbacks(blogsEntry.isAllowPingbacks());
656                    blogsEntryImpl.setAllowTrackbacks(blogsEntry.isAllowTrackbacks());
657                    blogsEntryImpl.setTrackbacks(blogsEntry.getTrackbacks());
658                    blogsEntryImpl.setStatus(blogsEntry.getStatus());
659                    blogsEntryImpl.setStatusByUserId(blogsEntry.getStatusByUserId());
660                    blogsEntryImpl.setStatusByUserName(blogsEntry.getStatusByUserName());
661                    blogsEntryImpl.setStatusDate(blogsEntry.getStatusDate());
662    
663                    return blogsEntryImpl;
664            }
665    
666            /**
667             * Finds the blogs entry with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
668             *
669             * @param primaryKey the primary key of the blogs entry to find
670             * @return the blogs entry
671             * @throws com.liferay.portal.NoSuchModelException if a blogs entry with the primary key could not be found
672             * @throws SystemException if a system exception occurred
673             */
674            public BlogsEntry findByPrimaryKey(Serializable primaryKey)
675                    throws NoSuchModelException, SystemException {
676                    return findByPrimaryKey(((Long)primaryKey).longValue());
677            }
678    
679            /**
680             * Finds the blogs entry with the primary key or throws a {@link com.liferay.portlet.blogs.NoSuchEntryException} if it could not be found.
681             *
682             * @param entryId the primary key of the blogs entry to find
683             * @return the blogs entry
684             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
685             * @throws SystemException if a system exception occurred
686             */
687            public BlogsEntry findByPrimaryKey(long entryId)
688                    throws NoSuchEntryException, SystemException {
689                    BlogsEntry blogsEntry = fetchByPrimaryKey(entryId);
690    
691                    if (blogsEntry == null) {
692                            if (_log.isWarnEnabled()) {
693                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + entryId);
694                            }
695    
696                            throw new NoSuchEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
697                                    entryId);
698                    }
699    
700                    return blogsEntry;
701            }
702    
703            /**
704             * Finds the blogs entry with the primary key or returns <code>null</code> if it could not be found.
705             *
706             * @param primaryKey the primary key of the blogs entry to find
707             * @return the blogs entry, or <code>null</code> if a blogs entry with the primary key could not be found
708             * @throws SystemException if a system exception occurred
709             */
710            public BlogsEntry fetchByPrimaryKey(Serializable primaryKey)
711                    throws SystemException {
712                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
713            }
714    
715            /**
716             * Finds the blogs entry with the primary key or returns <code>null</code> if it could not be found.
717             *
718             * @param entryId the primary key of the blogs entry to find
719             * @return the blogs entry, or <code>null</code> if a blogs entry with the primary key could not be found
720             * @throws SystemException if a system exception occurred
721             */
722            public BlogsEntry fetchByPrimaryKey(long entryId) throws SystemException {
723                    BlogsEntry blogsEntry = (BlogsEntry)EntityCacheUtil.getResult(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
724                                    BlogsEntryImpl.class, entryId, this);
725    
726                    if (blogsEntry == null) {
727                            Session session = null;
728    
729                            try {
730                                    session = openSession();
731    
732                                    blogsEntry = (BlogsEntry)session.get(BlogsEntryImpl.class,
733                                                    new Long(entryId));
734                            }
735                            catch (Exception e) {
736                                    throw processException(e);
737                            }
738                            finally {
739                                    if (blogsEntry != null) {
740                                            cacheResult(blogsEntry);
741                                    }
742    
743                                    closeSession(session);
744                            }
745                    }
746    
747                    return blogsEntry;
748            }
749    
750            /**
751             * Finds all the blogs entries where uuid = &#63;.
752             *
753             * @param uuid the uuid to search with
754             * @return the matching blogs entries
755             * @throws SystemException if a system exception occurred
756             */
757            public List<BlogsEntry> findByUuid(String uuid) throws SystemException {
758                    return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
759            }
760    
761            /**
762             * Finds a range of all the blogs entries where uuid = &#63;.
763             *
764             * <p>
765             * 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.
766             * </p>
767             *
768             * @param uuid the uuid to search with
769             * @param start the lower bound of the range of blogs entries to return
770             * @param end the upper bound of the range of blogs entries to return (not inclusive)
771             * @return the range of matching blogs entries
772             * @throws SystemException if a system exception occurred
773             */
774            public List<BlogsEntry> findByUuid(String uuid, int start, int end)
775                    throws SystemException {
776                    return findByUuid(uuid, start, end, null);
777            }
778    
779            /**
780             * Finds an ordered range of all the blogs entries where uuid = &#63;.
781             *
782             * <p>
783             * 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.
784             * </p>
785             *
786             * @param uuid the uuid to search with
787             * @param start the lower bound of the range of blogs entries to return
788             * @param end the upper bound of the range of blogs entries to return (not inclusive)
789             * @param orderByComparator the comparator to order the results by
790             * @return the ordered range of matching blogs entries
791             * @throws SystemException if a system exception occurred
792             */
793            public List<BlogsEntry> findByUuid(String uuid, int start, int end,
794                    OrderByComparator orderByComparator) throws SystemException {
795                    Object[] finderArgs = new Object[] {
796                                    uuid,
797                                    
798                                    String.valueOf(start), String.valueOf(end),
799                                    String.valueOf(orderByComparator)
800                            };
801    
802                    List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_UUID,
803                                    finderArgs, this);
804    
805                    if (list == null) {
806                            Session session = null;
807    
808                            try {
809                                    session = openSession();
810    
811                                    StringBundler query = null;
812    
813                                    if (orderByComparator != null) {
814                                            query = new StringBundler(3 +
815                                                            (orderByComparator.getOrderByFields().length * 3));
816                                    }
817                                    else {
818                                            query = new StringBundler(3);
819                                    }
820    
821                                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
822    
823                                    if (uuid == null) {
824                                            query.append(_FINDER_COLUMN_UUID_UUID_1);
825                                    }
826                                    else {
827                                            if (uuid.equals(StringPool.BLANK)) {
828                                                    query.append(_FINDER_COLUMN_UUID_UUID_3);
829                                            }
830                                            else {
831                                                    query.append(_FINDER_COLUMN_UUID_UUID_2);
832                                            }
833                                    }
834    
835                                    if (orderByComparator != null) {
836                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
837                                                    orderByComparator);
838                                    }
839    
840                                    else {
841                                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
842                                    }
843    
844                                    String sql = query.toString();
845    
846                                    Query q = session.createQuery(sql);
847    
848                                    QueryPos qPos = QueryPos.getInstance(q);
849    
850                                    if (uuid != null) {
851                                            qPos.add(uuid);
852                                    }
853    
854                                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
855                                                    end);
856                            }
857                            catch (Exception e) {
858                                    throw processException(e);
859                            }
860                            finally {
861                                    if (list == null) {
862                                            list = new ArrayList<BlogsEntry>();
863                                    }
864    
865                                    cacheResult(list);
866    
867                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_UUID, finderArgs,
868                                            list);
869    
870                                    closeSession(session);
871                            }
872                    }
873    
874                    return list;
875            }
876    
877            /**
878             * Finds the first blogs entry in the ordered set where uuid = &#63;.
879             *
880             * <p>
881             * 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.
882             * </p>
883             *
884             * @param uuid the uuid to search with
885             * @param orderByComparator the comparator to order the set by
886             * @return the first matching blogs entry
887             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
888             * @throws SystemException if a system exception occurred
889             */
890            public BlogsEntry findByUuid_First(String uuid,
891                    OrderByComparator orderByComparator)
892                    throws NoSuchEntryException, SystemException {
893                    List<BlogsEntry> list = findByUuid(uuid, 0, 1, orderByComparator);
894    
895                    if (list.isEmpty()) {
896                            StringBundler msg = new StringBundler(4);
897    
898                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
899    
900                            msg.append("uuid=");
901                            msg.append(uuid);
902    
903                            msg.append(StringPool.CLOSE_CURLY_BRACE);
904    
905                            throw new NoSuchEntryException(msg.toString());
906                    }
907                    else {
908                            return list.get(0);
909                    }
910            }
911    
912            /**
913             * Finds the last blogs entry in the ordered set where uuid = &#63;.
914             *
915             * <p>
916             * 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.
917             * </p>
918             *
919             * @param uuid the uuid to search with
920             * @param orderByComparator the comparator to order the set by
921             * @return the last matching blogs entry
922             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
923             * @throws SystemException if a system exception occurred
924             */
925            public BlogsEntry findByUuid_Last(String uuid,
926                    OrderByComparator orderByComparator)
927                    throws NoSuchEntryException, SystemException {
928                    int count = countByUuid(uuid);
929    
930                    List<BlogsEntry> list = findByUuid(uuid, count - 1, count,
931                                    orderByComparator);
932    
933                    if (list.isEmpty()) {
934                            StringBundler msg = new StringBundler(4);
935    
936                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
937    
938                            msg.append("uuid=");
939                            msg.append(uuid);
940    
941                            msg.append(StringPool.CLOSE_CURLY_BRACE);
942    
943                            throw new NoSuchEntryException(msg.toString());
944                    }
945                    else {
946                            return list.get(0);
947                    }
948            }
949    
950            /**
951             * Finds the blogs entries before and after the current blogs entry in the ordered set where uuid = &#63;.
952             *
953             * <p>
954             * 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.
955             * </p>
956             *
957             * @param entryId the primary key of the current blogs entry
958             * @param uuid the uuid to search with
959             * @param orderByComparator the comparator to order the set by
960             * @return the previous, current, and next blogs entry
961             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
962             * @throws SystemException if a system exception occurred
963             */
964            public BlogsEntry[] findByUuid_PrevAndNext(long entryId, String uuid,
965                    OrderByComparator orderByComparator)
966                    throws NoSuchEntryException, SystemException {
967                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
968    
969                    Session session = null;
970    
971                    try {
972                            session = openSession();
973    
974                            BlogsEntry[] array = new BlogsEntryImpl[3];
975    
976                            array[0] = getByUuid_PrevAndNext(session, blogsEntry, uuid,
977                                            orderByComparator, true);
978    
979                            array[1] = blogsEntry;
980    
981                            array[2] = getByUuid_PrevAndNext(session, blogsEntry, uuid,
982                                            orderByComparator, false);
983    
984                            return array;
985                    }
986                    catch (Exception e) {
987                            throw processException(e);
988                    }
989                    finally {
990                            closeSession(session);
991                    }
992            }
993    
994            protected BlogsEntry getByUuid_PrevAndNext(Session session,
995                    BlogsEntry blogsEntry, String uuid,
996                    OrderByComparator orderByComparator, boolean previous) {
997                    StringBundler query = null;
998    
999                    if (orderByComparator != null) {
1000                            query = new StringBundler(6 +
1001                                            (orderByComparator.getOrderByFields().length * 6));
1002                    }
1003                    else {
1004                            query = new StringBundler(3);
1005                    }
1006    
1007                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1008    
1009                    if (uuid == null) {
1010                            query.append(_FINDER_COLUMN_UUID_UUID_1);
1011                    }
1012                    else {
1013                            if (uuid.equals(StringPool.BLANK)) {
1014                                    query.append(_FINDER_COLUMN_UUID_UUID_3);
1015                            }
1016                            else {
1017                                    query.append(_FINDER_COLUMN_UUID_UUID_2);
1018                            }
1019                    }
1020    
1021                    if (orderByComparator != null) {
1022                            String[] orderByFields = orderByComparator.getOrderByFields();
1023    
1024                            if (orderByFields.length > 0) {
1025                                    query.append(WHERE_AND);
1026                            }
1027    
1028                            for (int i = 0; i < orderByFields.length; i++) {
1029                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1030                                    query.append(orderByFields[i]);
1031    
1032                                    if ((i + 1) < orderByFields.length) {
1033                                            if (orderByComparator.isAscending() ^ previous) {
1034                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1035                                            }
1036                                            else {
1037                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1038                                            }
1039                                    }
1040                                    else {
1041                                            if (orderByComparator.isAscending() ^ previous) {
1042                                                    query.append(WHERE_GREATER_THAN);
1043                                            }
1044                                            else {
1045                                                    query.append(WHERE_LESSER_THAN);
1046                                            }
1047                                    }
1048                            }
1049    
1050                            query.append(ORDER_BY_CLAUSE);
1051    
1052                            for (int i = 0; i < orderByFields.length; i++) {
1053                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1054                                    query.append(orderByFields[i]);
1055    
1056                                    if ((i + 1) < orderByFields.length) {
1057                                            if (orderByComparator.isAscending() ^ previous) {
1058                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1059                                            }
1060                                            else {
1061                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1062                                            }
1063                                    }
1064                                    else {
1065                                            if (orderByComparator.isAscending() ^ previous) {
1066                                                    query.append(ORDER_BY_ASC);
1067                                            }
1068                                            else {
1069                                                    query.append(ORDER_BY_DESC);
1070                                            }
1071                                    }
1072                            }
1073                    }
1074    
1075                    else {
1076                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1077                    }
1078    
1079                    String sql = query.toString();
1080    
1081                    Query q = session.createQuery(sql);
1082    
1083                    q.setFirstResult(0);
1084                    q.setMaxResults(2);
1085    
1086                    QueryPos qPos = QueryPos.getInstance(q);
1087    
1088                    if (uuid != null) {
1089                            qPos.add(uuid);
1090                    }
1091    
1092                    if (orderByComparator != null) {
1093                            Object[] values = orderByComparator.getOrderByValues(blogsEntry);
1094    
1095                            for (Object value : values) {
1096                                    qPos.add(value);
1097                            }
1098                    }
1099    
1100                    List<BlogsEntry> list = q.list();
1101    
1102                    if (list.size() == 2) {
1103                            return list.get(1);
1104                    }
1105                    else {
1106                            return null;
1107                    }
1108            }
1109    
1110            /**
1111             * Finds the blogs entry where uuid = &#63; and groupId = &#63; or throws a {@link com.liferay.portlet.blogs.NoSuchEntryException} if it could not be found.
1112             *
1113             * @param uuid the uuid to search with
1114             * @param groupId the group id to search with
1115             * @return the matching blogs entry
1116             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
1117             * @throws SystemException if a system exception occurred
1118             */
1119            public BlogsEntry findByUUID_G(String uuid, long groupId)
1120                    throws NoSuchEntryException, SystemException {
1121                    BlogsEntry blogsEntry = fetchByUUID_G(uuid, groupId);
1122    
1123                    if (blogsEntry == null) {
1124                            StringBundler msg = new StringBundler(6);
1125    
1126                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1127    
1128                            msg.append("uuid=");
1129                            msg.append(uuid);
1130    
1131                            msg.append(", groupId=");
1132                            msg.append(groupId);
1133    
1134                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1135    
1136                            if (_log.isWarnEnabled()) {
1137                                    _log.warn(msg.toString());
1138                            }
1139    
1140                            throw new NoSuchEntryException(msg.toString());
1141                    }
1142    
1143                    return blogsEntry;
1144            }
1145    
1146            /**
1147             * Finds the blogs entry where uuid = &#63; and groupId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
1148             *
1149             * @param uuid the uuid to search with
1150             * @param groupId the group id to search with
1151             * @return the matching blogs entry, or <code>null</code> if a matching blogs entry could not be found
1152             * @throws SystemException if a system exception occurred
1153             */
1154            public BlogsEntry fetchByUUID_G(String uuid, long groupId)
1155                    throws SystemException {
1156                    return fetchByUUID_G(uuid, groupId, true);
1157            }
1158    
1159            /**
1160             * Finds the blogs entry where uuid = &#63; and groupId = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
1161             *
1162             * @param uuid the uuid to search with
1163             * @param groupId the group id to search with
1164             * @return the matching blogs entry, or <code>null</code> if a matching blogs entry could not be found
1165             * @throws SystemException if a system exception occurred
1166             */
1167            public BlogsEntry fetchByUUID_G(String uuid, long groupId,
1168                    boolean retrieveFromCache) throws SystemException {
1169                    Object[] finderArgs = new Object[] { uuid, groupId };
1170    
1171                    Object result = null;
1172    
1173                    if (retrieveFromCache) {
1174                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
1175                                            finderArgs, this);
1176                    }
1177    
1178                    if (result == null) {
1179                            Session session = null;
1180    
1181                            try {
1182                                    session = openSession();
1183    
1184                                    StringBundler query = new StringBundler(4);
1185    
1186                                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1187    
1188                                    if (uuid == null) {
1189                                            query.append(_FINDER_COLUMN_UUID_G_UUID_1);
1190                                    }
1191                                    else {
1192                                            if (uuid.equals(StringPool.BLANK)) {
1193                                                    query.append(_FINDER_COLUMN_UUID_G_UUID_3);
1194                                            }
1195                                            else {
1196                                                    query.append(_FINDER_COLUMN_UUID_G_UUID_2);
1197                                            }
1198                                    }
1199    
1200                                    query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
1201    
1202                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1203    
1204                                    String sql = query.toString();
1205    
1206                                    Query q = session.createQuery(sql);
1207    
1208                                    QueryPos qPos = QueryPos.getInstance(q);
1209    
1210                                    if (uuid != null) {
1211                                            qPos.add(uuid);
1212                                    }
1213    
1214                                    qPos.add(groupId);
1215    
1216                                    List<BlogsEntry> list = q.list();
1217    
1218                                    result = list;
1219    
1220                                    BlogsEntry blogsEntry = null;
1221    
1222                                    if (list.isEmpty()) {
1223                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1224                                                    finderArgs, list);
1225                                    }
1226                                    else {
1227                                            blogsEntry = list.get(0);
1228    
1229                                            cacheResult(blogsEntry);
1230    
1231                                            if ((blogsEntry.getUuid() == null) ||
1232                                                            !blogsEntry.getUuid().equals(uuid) ||
1233                                                            (blogsEntry.getGroupId() != groupId)) {
1234                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1235                                                            finderArgs, blogsEntry);
1236                                            }
1237                                    }
1238    
1239                                    return blogsEntry;
1240                            }
1241                            catch (Exception e) {
1242                                    throw processException(e);
1243                            }
1244                            finally {
1245                                    if (result == null) {
1246                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1247                                                    finderArgs, new ArrayList<BlogsEntry>());
1248                                    }
1249    
1250                                    closeSession(session);
1251                            }
1252                    }
1253                    else {
1254                            if (result instanceof List<?>) {
1255                                    return null;
1256                            }
1257                            else {
1258                                    return (BlogsEntry)result;
1259                            }
1260                    }
1261            }
1262    
1263            /**
1264             * Finds all the blogs entries where groupId = &#63;.
1265             *
1266             * @param groupId the group id to search with
1267             * @return the matching blogs entries
1268             * @throws SystemException if a system exception occurred
1269             */
1270            public List<BlogsEntry> findByGroupId(long groupId)
1271                    throws SystemException {
1272                    return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1273            }
1274    
1275            /**
1276             * Finds a range of all the blogs entries where groupId = &#63;.
1277             *
1278             * <p>
1279             * 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.
1280             * </p>
1281             *
1282             * @param groupId the group id to search with
1283             * @param start the lower bound of the range of blogs entries to return
1284             * @param end the upper bound of the range of blogs entries to return (not inclusive)
1285             * @return the range of matching blogs entries
1286             * @throws SystemException if a system exception occurred
1287             */
1288            public List<BlogsEntry> findByGroupId(long groupId, int start, int end)
1289                    throws SystemException {
1290                    return findByGroupId(groupId, start, end, null);
1291            }
1292    
1293            /**
1294             * Finds an ordered range of all the blogs entries where groupId = &#63;.
1295             *
1296             * <p>
1297             * 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.
1298             * </p>
1299             *
1300             * @param groupId the group id to search with
1301             * @param start the lower bound of the range of blogs entries to return
1302             * @param end the upper bound of the range of blogs entries to return (not inclusive)
1303             * @param orderByComparator the comparator to order the results by
1304             * @return the ordered range of matching blogs entries
1305             * @throws SystemException if a system exception occurred
1306             */
1307            public List<BlogsEntry> findByGroupId(long groupId, int start, int end,
1308                    OrderByComparator orderByComparator) throws SystemException {
1309                    Object[] finderArgs = new Object[] {
1310                                    groupId,
1311                                    
1312                                    String.valueOf(start), String.valueOf(end),
1313                                    String.valueOf(orderByComparator)
1314                            };
1315    
1316                    List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
1317                                    finderArgs, this);
1318    
1319                    if (list == null) {
1320                            Session session = null;
1321    
1322                            try {
1323                                    session = openSession();
1324    
1325                                    StringBundler query = null;
1326    
1327                                    if (orderByComparator != null) {
1328                                            query = new StringBundler(3 +
1329                                                            (orderByComparator.getOrderByFields().length * 3));
1330                                    }
1331                                    else {
1332                                            query = new StringBundler(3);
1333                                    }
1334    
1335                                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1336    
1337                                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1338    
1339                                    if (orderByComparator != null) {
1340                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1341                                                    orderByComparator);
1342                                    }
1343    
1344                                    else {
1345                                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1346                                    }
1347    
1348                                    String sql = query.toString();
1349    
1350                                    Query q = session.createQuery(sql);
1351    
1352                                    QueryPos qPos = QueryPos.getInstance(q);
1353    
1354                                    qPos.add(groupId);
1355    
1356                                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
1357                                                    end);
1358                            }
1359                            catch (Exception e) {
1360                                    throw processException(e);
1361                            }
1362                            finally {
1363                                    if (list == null) {
1364                                            list = new ArrayList<BlogsEntry>();
1365                                    }
1366    
1367                                    cacheResult(list);
1368    
1369                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
1370                                            finderArgs, list);
1371    
1372                                    closeSession(session);
1373                            }
1374                    }
1375    
1376                    return list;
1377            }
1378    
1379            /**
1380             * Finds the first blogs entry in the ordered set where groupId = &#63;.
1381             *
1382             * <p>
1383             * 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.
1384             * </p>
1385             *
1386             * @param groupId the group id to search with
1387             * @param orderByComparator the comparator to order the set by
1388             * @return the first matching blogs entry
1389             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
1390             * @throws SystemException if a system exception occurred
1391             */
1392            public BlogsEntry findByGroupId_First(long groupId,
1393                    OrderByComparator orderByComparator)
1394                    throws NoSuchEntryException, SystemException {
1395                    List<BlogsEntry> list = findByGroupId(groupId, 0, 1, orderByComparator);
1396    
1397                    if (list.isEmpty()) {
1398                            StringBundler msg = new StringBundler(4);
1399    
1400                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1401    
1402                            msg.append("groupId=");
1403                            msg.append(groupId);
1404    
1405                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1406    
1407                            throw new NoSuchEntryException(msg.toString());
1408                    }
1409                    else {
1410                            return list.get(0);
1411                    }
1412            }
1413    
1414            /**
1415             * Finds the last blogs entry in the ordered set where groupId = &#63;.
1416             *
1417             * <p>
1418             * 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.
1419             * </p>
1420             *
1421             * @param groupId the group id to search with
1422             * @param orderByComparator the comparator to order the set by
1423             * @return the last matching blogs entry
1424             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
1425             * @throws SystemException if a system exception occurred
1426             */
1427            public BlogsEntry findByGroupId_Last(long groupId,
1428                    OrderByComparator orderByComparator)
1429                    throws NoSuchEntryException, SystemException {
1430                    int count = countByGroupId(groupId);
1431    
1432                    List<BlogsEntry> list = findByGroupId(groupId, count - 1, count,
1433                                    orderByComparator);
1434    
1435                    if (list.isEmpty()) {
1436                            StringBundler msg = new StringBundler(4);
1437    
1438                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1439    
1440                            msg.append("groupId=");
1441                            msg.append(groupId);
1442    
1443                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1444    
1445                            throw new NoSuchEntryException(msg.toString());
1446                    }
1447                    else {
1448                            return list.get(0);
1449                    }
1450            }
1451    
1452            /**
1453             * Finds the blogs entries before and after the current blogs entry in the ordered set where groupId = &#63;.
1454             *
1455             * <p>
1456             * 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.
1457             * </p>
1458             *
1459             * @param entryId the primary key of the current blogs entry
1460             * @param groupId the group id to search with
1461             * @param orderByComparator the comparator to order the set by
1462             * @return the previous, current, and next blogs entry
1463             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
1464             * @throws SystemException if a system exception occurred
1465             */
1466            public BlogsEntry[] findByGroupId_PrevAndNext(long entryId, long groupId,
1467                    OrderByComparator orderByComparator)
1468                    throws NoSuchEntryException, SystemException {
1469                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
1470    
1471                    Session session = null;
1472    
1473                    try {
1474                            session = openSession();
1475    
1476                            BlogsEntry[] array = new BlogsEntryImpl[3];
1477    
1478                            array[0] = getByGroupId_PrevAndNext(session, blogsEntry, groupId,
1479                                            orderByComparator, true);
1480    
1481                            array[1] = blogsEntry;
1482    
1483                            array[2] = getByGroupId_PrevAndNext(session, blogsEntry, groupId,
1484                                            orderByComparator, false);
1485    
1486                            return array;
1487                    }
1488                    catch (Exception e) {
1489                            throw processException(e);
1490                    }
1491                    finally {
1492                            closeSession(session);
1493                    }
1494            }
1495    
1496            protected BlogsEntry getByGroupId_PrevAndNext(Session session,
1497                    BlogsEntry blogsEntry, long groupId,
1498                    OrderByComparator orderByComparator, boolean previous) {
1499                    StringBundler query = null;
1500    
1501                    if (orderByComparator != null) {
1502                            query = new StringBundler(6 +
1503                                            (orderByComparator.getOrderByFields().length * 6));
1504                    }
1505                    else {
1506                            query = new StringBundler(3);
1507                    }
1508    
1509                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1510    
1511                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1512    
1513                    if (orderByComparator != null) {
1514                            String[] orderByFields = orderByComparator.getOrderByFields();
1515    
1516                            if (orderByFields.length > 0) {
1517                                    query.append(WHERE_AND);
1518                            }
1519    
1520                            for (int i = 0; i < orderByFields.length; i++) {
1521                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1522                                    query.append(orderByFields[i]);
1523    
1524                                    if ((i + 1) < orderByFields.length) {
1525                                            if (orderByComparator.isAscending() ^ previous) {
1526                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1527                                            }
1528                                            else {
1529                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1530                                            }
1531                                    }
1532                                    else {
1533                                            if (orderByComparator.isAscending() ^ previous) {
1534                                                    query.append(WHERE_GREATER_THAN);
1535                                            }
1536                                            else {
1537                                                    query.append(WHERE_LESSER_THAN);
1538                                            }
1539                                    }
1540                            }
1541    
1542                            query.append(ORDER_BY_CLAUSE);
1543    
1544                            for (int i = 0; i < orderByFields.length; i++) {
1545                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1546                                    query.append(orderByFields[i]);
1547    
1548                                    if ((i + 1) < orderByFields.length) {
1549                                            if (orderByComparator.isAscending() ^ previous) {
1550                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1551                                            }
1552                                            else {
1553                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1554                                            }
1555                                    }
1556                                    else {
1557                                            if (orderByComparator.isAscending() ^ previous) {
1558                                                    query.append(ORDER_BY_ASC);
1559                                            }
1560                                            else {
1561                                                    query.append(ORDER_BY_DESC);
1562                                            }
1563                                    }
1564                            }
1565                    }
1566    
1567                    else {
1568                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1569                    }
1570    
1571                    String sql = query.toString();
1572    
1573                    Query q = session.createQuery(sql);
1574    
1575                    q.setFirstResult(0);
1576                    q.setMaxResults(2);
1577    
1578                    QueryPos qPos = QueryPos.getInstance(q);
1579    
1580                    qPos.add(groupId);
1581    
1582                    if (orderByComparator != null) {
1583                            Object[] values = orderByComparator.getOrderByValues(blogsEntry);
1584    
1585                            for (Object value : values) {
1586                                    qPos.add(value);
1587                            }
1588                    }
1589    
1590                    List<BlogsEntry> list = q.list();
1591    
1592                    if (list.size() == 2) {
1593                            return list.get(1);
1594                    }
1595                    else {
1596                            return null;
1597                    }
1598            }
1599    
1600            /**
1601             * Filters by the user's permissions and finds all the blogs entries where groupId = &#63;.
1602             *
1603             * @param groupId the group id to search with
1604             * @return the matching blogs entries that the user has permission to view
1605             * @throws SystemException if a system exception occurred
1606             */
1607            public List<BlogsEntry> filterFindByGroupId(long groupId)
1608                    throws SystemException {
1609                    return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
1610                            QueryUtil.ALL_POS, null);
1611            }
1612    
1613            /**
1614             * Filters by the user's permissions and finds a range of all the blogs entries where groupId = &#63;.
1615             *
1616             * <p>
1617             * 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.
1618             * </p>
1619             *
1620             * @param groupId the group id to search with
1621             * @param start the lower bound of the range of blogs entries to return
1622             * @param end the upper bound of the range of blogs entries to return (not inclusive)
1623             * @return the range of matching blogs entries that the user has permission to view
1624             * @throws SystemException if a system exception occurred
1625             */
1626            public List<BlogsEntry> filterFindByGroupId(long groupId, int start, int end)
1627                    throws SystemException {
1628                    return filterFindByGroupId(groupId, start, end, null);
1629            }
1630    
1631            /**
1632             * Filters by the user's permissions and finds an ordered range of all the blogs entries where groupId = &#63;.
1633             *
1634             * <p>
1635             * 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.
1636             * </p>
1637             *
1638             * @param groupId the group id to search with
1639             * @param start the lower bound of the range of blogs entries to return
1640             * @param end the upper bound of the range of blogs entries to return (not inclusive)
1641             * @param orderByComparator the comparator to order the results by
1642             * @return the ordered range of matching blogs entries that the user has permission to view
1643             * @throws SystemException if a system exception occurred
1644             */
1645            public List<BlogsEntry> filterFindByGroupId(long groupId, int start,
1646                    int end, OrderByComparator orderByComparator) throws SystemException {
1647                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1648                            return findByGroupId(groupId, start, end, orderByComparator);
1649                    }
1650    
1651                    Session session = null;
1652    
1653                    try {
1654                            session = openSession();
1655    
1656                            StringBundler query = null;
1657    
1658                            if (orderByComparator != null) {
1659                                    query = new StringBundler(3 +
1660                                                    (orderByComparator.getOrderByFields().length * 3));
1661                            }
1662                            else {
1663                                    query = new StringBundler(3);
1664                            }
1665    
1666                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
1667    
1668                            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1669    
1670                            if (orderByComparator != null) {
1671                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1672                                            orderByComparator);
1673                            }
1674    
1675                            else {
1676                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1677                            }
1678    
1679                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1680                                            BlogsEntry.class.getName(), _FILTER_COLUMN_PK,
1681                                            _FILTER_COLUMN_USERID, groupId);
1682    
1683                            SQLQuery q = session.createSQLQuery(sql);
1684    
1685                            q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
1686    
1687                            QueryPos qPos = QueryPos.getInstance(q);
1688    
1689                            qPos.add(groupId);
1690    
1691                            return (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start, end);
1692                    }
1693                    catch (Exception e) {
1694                            throw processException(e);
1695                    }
1696                    finally {
1697                            closeSession(session);
1698                    }
1699            }
1700    
1701            /**
1702             * Finds all the blogs entries where companyId = &#63;.
1703             *
1704             * @param companyId the company id to search with
1705             * @return the matching blogs entries
1706             * @throws SystemException if a system exception occurred
1707             */
1708            public List<BlogsEntry> findByCompanyId(long companyId)
1709                    throws SystemException {
1710                    return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1711                            null);
1712            }
1713    
1714            /**
1715             * Finds a range of all the blogs entries where companyId = &#63;.
1716             *
1717             * <p>
1718             * 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.
1719             * </p>
1720             *
1721             * @param companyId the company id to search with
1722             * @param start the lower bound of the range of blogs entries to return
1723             * @param end the upper bound of the range of blogs entries to return (not inclusive)
1724             * @return the range of matching blogs entries
1725             * @throws SystemException if a system exception occurred
1726             */
1727            public List<BlogsEntry> findByCompanyId(long companyId, int start, int end)
1728                    throws SystemException {
1729                    return findByCompanyId(companyId, start, end, null);
1730            }
1731    
1732            /**
1733             * Finds an ordered range of all the blogs entries where companyId = &#63;.
1734             *
1735             * <p>
1736             * 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.
1737             * </p>
1738             *
1739             * @param companyId the company id to search with
1740             * @param start the lower bound of the range of blogs entries to return
1741             * @param end the upper bound of the range of blogs entries to return (not inclusive)
1742             * @param orderByComparator the comparator to order the results by
1743             * @return the ordered range of matching blogs entries
1744             * @throws SystemException if a system exception occurred
1745             */
1746            public List<BlogsEntry> findByCompanyId(long companyId, int start, int end,
1747                    OrderByComparator orderByComparator) throws SystemException {
1748                    Object[] finderArgs = new Object[] {
1749                                    companyId,
1750                                    
1751                                    String.valueOf(start), String.valueOf(end),
1752                                    String.valueOf(orderByComparator)
1753                            };
1754    
1755                    List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
1756                                    finderArgs, this);
1757    
1758                    if (list == null) {
1759                            Session session = null;
1760    
1761                            try {
1762                                    session = openSession();
1763    
1764                                    StringBundler query = null;
1765    
1766                                    if (orderByComparator != null) {
1767                                            query = new StringBundler(3 +
1768                                                            (orderByComparator.getOrderByFields().length * 3));
1769                                    }
1770                                    else {
1771                                            query = new StringBundler(3);
1772                                    }
1773    
1774                                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1775    
1776                                    query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1777    
1778                                    if (orderByComparator != null) {
1779                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1780                                                    orderByComparator);
1781                                    }
1782    
1783                                    else {
1784                                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1785                                    }
1786    
1787                                    String sql = query.toString();
1788    
1789                                    Query q = session.createQuery(sql);
1790    
1791                                    QueryPos qPos = QueryPos.getInstance(q);
1792    
1793                                    qPos.add(companyId);
1794    
1795                                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
1796                                                    end);
1797                            }
1798                            catch (Exception e) {
1799                                    throw processException(e);
1800                            }
1801                            finally {
1802                                    if (list == null) {
1803                                            list = new ArrayList<BlogsEntry>();
1804                                    }
1805    
1806                                    cacheResult(list);
1807    
1808                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
1809                                            finderArgs, list);
1810    
1811                                    closeSession(session);
1812                            }
1813                    }
1814    
1815                    return list;
1816            }
1817    
1818            /**
1819             * Finds the first blogs entry in the ordered set where companyId = &#63;.
1820             *
1821             * <p>
1822             * 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.
1823             * </p>
1824             *
1825             * @param companyId the company id to search with
1826             * @param orderByComparator the comparator to order the set by
1827             * @return the first matching blogs entry
1828             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
1829             * @throws SystemException if a system exception occurred
1830             */
1831            public BlogsEntry findByCompanyId_First(long companyId,
1832                    OrderByComparator orderByComparator)
1833                    throws NoSuchEntryException, SystemException {
1834                    List<BlogsEntry> list = findByCompanyId(companyId, 0, 1,
1835                                    orderByComparator);
1836    
1837                    if (list.isEmpty()) {
1838                            StringBundler msg = new StringBundler(4);
1839    
1840                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1841    
1842                            msg.append("companyId=");
1843                            msg.append(companyId);
1844    
1845                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1846    
1847                            throw new NoSuchEntryException(msg.toString());
1848                    }
1849                    else {
1850                            return list.get(0);
1851                    }
1852            }
1853    
1854            /**
1855             * Finds the last blogs entry in the ordered set where companyId = &#63;.
1856             *
1857             * <p>
1858             * 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.
1859             * </p>
1860             *
1861             * @param companyId the company id to search with
1862             * @param orderByComparator the comparator to order the set by
1863             * @return the last matching blogs entry
1864             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
1865             * @throws SystemException if a system exception occurred
1866             */
1867            public BlogsEntry findByCompanyId_Last(long companyId,
1868                    OrderByComparator orderByComparator)
1869                    throws NoSuchEntryException, SystemException {
1870                    int count = countByCompanyId(companyId);
1871    
1872                    List<BlogsEntry> list = findByCompanyId(companyId, count - 1, count,
1873                                    orderByComparator);
1874    
1875                    if (list.isEmpty()) {
1876                            StringBundler msg = new StringBundler(4);
1877    
1878                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1879    
1880                            msg.append("companyId=");
1881                            msg.append(companyId);
1882    
1883                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1884    
1885                            throw new NoSuchEntryException(msg.toString());
1886                    }
1887                    else {
1888                            return list.get(0);
1889                    }
1890            }
1891    
1892            /**
1893             * Finds the blogs entries before and after the current blogs entry in the ordered set where companyId = &#63;.
1894             *
1895             * <p>
1896             * 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.
1897             * </p>
1898             *
1899             * @param entryId the primary key of the current blogs entry
1900             * @param companyId the company id to search with
1901             * @param orderByComparator the comparator to order the set by
1902             * @return the previous, current, and next blogs entry
1903             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
1904             * @throws SystemException if a system exception occurred
1905             */
1906            public BlogsEntry[] findByCompanyId_PrevAndNext(long entryId,
1907                    long companyId, OrderByComparator orderByComparator)
1908                    throws NoSuchEntryException, SystemException {
1909                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
1910    
1911                    Session session = null;
1912    
1913                    try {
1914                            session = openSession();
1915    
1916                            BlogsEntry[] array = new BlogsEntryImpl[3];
1917    
1918                            array[0] = getByCompanyId_PrevAndNext(session, blogsEntry,
1919                                            companyId, orderByComparator, true);
1920    
1921                            array[1] = blogsEntry;
1922    
1923                            array[2] = getByCompanyId_PrevAndNext(session, blogsEntry,
1924                                            companyId, orderByComparator, false);
1925    
1926                            return array;
1927                    }
1928                    catch (Exception e) {
1929                            throw processException(e);
1930                    }
1931                    finally {
1932                            closeSession(session);
1933                    }
1934            }
1935    
1936            protected BlogsEntry getByCompanyId_PrevAndNext(Session session,
1937                    BlogsEntry blogsEntry, long companyId,
1938                    OrderByComparator orderByComparator, boolean previous) {
1939                    StringBundler query = null;
1940    
1941                    if (orderByComparator != null) {
1942                            query = new StringBundler(6 +
1943                                            (orderByComparator.getOrderByFields().length * 6));
1944                    }
1945                    else {
1946                            query = new StringBundler(3);
1947                    }
1948    
1949                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1950    
1951                    query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1952    
1953                    if (orderByComparator != null) {
1954                            String[] orderByFields = orderByComparator.getOrderByFields();
1955    
1956                            if (orderByFields.length > 0) {
1957                                    query.append(WHERE_AND);
1958                            }
1959    
1960                            for (int i = 0; i < orderByFields.length; i++) {
1961                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1962                                    query.append(orderByFields[i]);
1963    
1964                                    if ((i + 1) < orderByFields.length) {
1965                                            if (orderByComparator.isAscending() ^ previous) {
1966                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1967                                            }
1968                                            else {
1969                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1970                                            }
1971                                    }
1972                                    else {
1973                                            if (orderByComparator.isAscending() ^ previous) {
1974                                                    query.append(WHERE_GREATER_THAN);
1975                                            }
1976                                            else {
1977                                                    query.append(WHERE_LESSER_THAN);
1978                                            }
1979                                    }
1980                            }
1981    
1982                            query.append(ORDER_BY_CLAUSE);
1983    
1984                            for (int i = 0; i < orderByFields.length; i++) {
1985                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1986                                    query.append(orderByFields[i]);
1987    
1988                                    if ((i + 1) < orderByFields.length) {
1989                                            if (orderByComparator.isAscending() ^ previous) {
1990                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1991                                            }
1992                                            else {
1993                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1994                                            }
1995                                    }
1996                                    else {
1997                                            if (orderByComparator.isAscending() ^ previous) {
1998                                                    query.append(ORDER_BY_ASC);
1999                                            }
2000                                            else {
2001                                                    query.append(ORDER_BY_DESC);
2002                                            }
2003                                    }
2004                            }
2005                    }
2006    
2007                    else {
2008                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2009                    }
2010    
2011                    String sql = query.toString();
2012    
2013                    Query q = session.createQuery(sql);
2014    
2015                    q.setFirstResult(0);
2016                    q.setMaxResults(2);
2017    
2018                    QueryPos qPos = QueryPos.getInstance(q);
2019    
2020                    qPos.add(companyId);
2021    
2022                    if (orderByComparator != null) {
2023                            Object[] values = orderByComparator.getOrderByValues(blogsEntry);
2024    
2025                            for (Object value : values) {
2026                                    qPos.add(value);
2027                            }
2028                    }
2029    
2030                    List<BlogsEntry> list = q.list();
2031    
2032                    if (list.size() == 2) {
2033                            return list.get(1);
2034                    }
2035                    else {
2036                            return null;
2037                    }
2038            }
2039    
2040            /**
2041             * Finds all the blogs entries where companyId = &#63; and userId = &#63;.
2042             *
2043             * @param companyId the company id to search with
2044             * @param userId the user id to search with
2045             * @return the matching blogs entries
2046             * @throws SystemException if a system exception occurred
2047             */
2048            public List<BlogsEntry> findByC_U(long companyId, long userId)
2049                    throws SystemException {
2050                    return findByC_U(companyId, userId, QueryUtil.ALL_POS,
2051                            QueryUtil.ALL_POS, null);
2052            }
2053    
2054            /**
2055             * Finds a range of all the blogs entries where companyId = &#63; and userId = &#63;.
2056             *
2057             * <p>
2058             * 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.
2059             * </p>
2060             *
2061             * @param companyId the company id to search with
2062             * @param userId the user id to search with
2063             * @param start the lower bound of the range of blogs entries to return
2064             * @param end the upper bound of the range of blogs entries to return (not inclusive)
2065             * @return the range of matching blogs entries
2066             * @throws SystemException if a system exception occurred
2067             */
2068            public List<BlogsEntry> findByC_U(long companyId, long userId, int start,
2069                    int end) throws SystemException {
2070                    return findByC_U(companyId, userId, start, end, null);
2071            }
2072    
2073            /**
2074             * Finds an ordered range of all the blogs entries where companyId = &#63; and userId = &#63;.
2075             *
2076             * <p>
2077             * 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.
2078             * </p>
2079             *
2080             * @param companyId the company id to search with
2081             * @param userId the user id to search with
2082             * @param start the lower bound of the range of blogs entries to return
2083             * @param end the upper bound of the range of blogs entries to return (not inclusive)
2084             * @param orderByComparator the comparator to order the results by
2085             * @return the ordered range of matching blogs entries
2086             * @throws SystemException if a system exception occurred
2087             */
2088            public List<BlogsEntry> findByC_U(long companyId, long userId, int start,
2089                    int end, OrderByComparator orderByComparator) throws SystemException {
2090                    Object[] finderArgs = new Object[] {
2091                                    companyId, userId,
2092                                    
2093                                    String.valueOf(start), String.valueOf(end),
2094                                    String.valueOf(orderByComparator)
2095                            };
2096    
2097                    List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_U,
2098                                    finderArgs, this);
2099    
2100                    if (list == null) {
2101                            Session session = null;
2102    
2103                            try {
2104                                    session = openSession();
2105    
2106                                    StringBundler query = null;
2107    
2108                                    if (orderByComparator != null) {
2109                                            query = new StringBundler(4 +
2110                                                            (orderByComparator.getOrderByFields().length * 3));
2111                                    }
2112                                    else {
2113                                            query = new StringBundler(4);
2114                                    }
2115    
2116                                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2117    
2118                                    query.append(_FINDER_COLUMN_C_U_COMPANYID_2);
2119    
2120                                    query.append(_FINDER_COLUMN_C_U_USERID_2);
2121    
2122                                    if (orderByComparator != null) {
2123                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2124                                                    orderByComparator);
2125                                    }
2126    
2127                                    else {
2128                                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2129                                    }
2130    
2131                                    String sql = query.toString();
2132    
2133                                    Query q = session.createQuery(sql);
2134    
2135                                    QueryPos qPos = QueryPos.getInstance(q);
2136    
2137                                    qPos.add(companyId);
2138    
2139                                    qPos.add(userId);
2140    
2141                                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
2142                                                    end);
2143                            }
2144                            catch (Exception e) {
2145                                    throw processException(e);
2146                            }
2147                            finally {
2148                                    if (list == null) {
2149                                            list = new ArrayList<BlogsEntry>();
2150                                    }
2151    
2152                                    cacheResult(list);
2153    
2154                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_U, finderArgs,
2155                                            list);
2156    
2157                                    closeSession(session);
2158                            }
2159                    }
2160    
2161                    return list;
2162            }
2163    
2164            /**
2165             * Finds the first blogs entry in the ordered set where companyId = &#63; and userId = &#63;.
2166             *
2167             * <p>
2168             * 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.
2169             * </p>
2170             *
2171             * @param companyId the company id to search with
2172             * @param userId the user id to search with
2173             * @param orderByComparator the comparator to order the set by
2174             * @return the first matching blogs entry
2175             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
2176             * @throws SystemException if a system exception occurred
2177             */
2178            public BlogsEntry findByC_U_First(long companyId, long userId,
2179                    OrderByComparator orderByComparator)
2180                    throws NoSuchEntryException, SystemException {
2181                    List<BlogsEntry> list = findByC_U(companyId, userId, 0, 1,
2182                                    orderByComparator);
2183    
2184                    if (list.isEmpty()) {
2185                            StringBundler msg = new StringBundler(6);
2186    
2187                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2188    
2189                            msg.append("companyId=");
2190                            msg.append(companyId);
2191    
2192                            msg.append(", userId=");
2193                            msg.append(userId);
2194    
2195                            msg.append(StringPool.CLOSE_CURLY_BRACE);
2196    
2197                            throw new NoSuchEntryException(msg.toString());
2198                    }
2199                    else {
2200                            return list.get(0);
2201                    }
2202            }
2203    
2204            /**
2205             * Finds the last blogs entry in the ordered set where companyId = &#63; and userId = &#63;.
2206             *
2207             * <p>
2208             * 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.
2209             * </p>
2210             *
2211             * @param companyId the company id to search with
2212             * @param userId the user id to search with
2213             * @param orderByComparator the comparator to order the set by
2214             * @return the last matching blogs entry
2215             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
2216             * @throws SystemException if a system exception occurred
2217             */
2218            public BlogsEntry findByC_U_Last(long companyId, long userId,
2219                    OrderByComparator orderByComparator)
2220                    throws NoSuchEntryException, SystemException {
2221                    int count = countByC_U(companyId, userId);
2222    
2223                    List<BlogsEntry> list = findByC_U(companyId, userId, count - 1, count,
2224                                    orderByComparator);
2225    
2226                    if (list.isEmpty()) {
2227                            StringBundler msg = new StringBundler(6);
2228    
2229                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2230    
2231                            msg.append("companyId=");
2232                            msg.append(companyId);
2233    
2234                            msg.append(", userId=");
2235                            msg.append(userId);
2236    
2237                            msg.append(StringPool.CLOSE_CURLY_BRACE);
2238    
2239                            throw new NoSuchEntryException(msg.toString());
2240                    }
2241                    else {
2242                            return list.get(0);
2243                    }
2244            }
2245    
2246            /**
2247             * Finds the blogs entries before and after the current blogs entry in the ordered set where companyId = &#63; and userId = &#63;.
2248             *
2249             * <p>
2250             * 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.
2251             * </p>
2252             *
2253             * @param entryId the primary key of the current blogs entry
2254             * @param companyId the company id to search with
2255             * @param userId the user id to search with
2256             * @param orderByComparator the comparator to order the set by
2257             * @return the previous, current, and next blogs entry
2258             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
2259             * @throws SystemException if a system exception occurred
2260             */
2261            public BlogsEntry[] findByC_U_PrevAndNext(long entryId, long companyId,
2262                    long userId, OrderByComparator orderByComparator)
2263                    throws NoSuchEntryException, SystemException {
2264                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
2265    
2266                    Session session = null;
2267    
2268                    try {
2269                            session = openSession();
2270    
2271                            BlogsEntry[] array = new BlogsEntryImpl[3];
2272    
2273                            array[0] = getByC_U_PrevAndNext(session, blogsEntry, companyId,
2274                                            userId, orderByComparator, true);
2275    
2276                            array[1] = blogsEntry;
2277    
2278                            array[2] = getByC_U_PrevAndNext(session, blogsEntry, companyId,
2279                                            userId, orderByComparator, false);
2280    
2281                            return array;
2282                    }
2283                    catch (Exception e) {
2284                            throw processException(e);
2285                    }
2286                    finally {
2287                            closeSession(session);
2288                    }
2289            }
2290    
2291            protected BlogsEntry getByC_U_PrevAndNext(Session session,
2292                    BlogsEntry blogsEntry, long companyId, long userId,
2293                    OrderByComparator orderByComparator, boolean previous) {
2294                    StringBundler query = null;
2295    
2296                    if (orderByComparator != null) {
2297                            query = new StringBundler(6 +
2298                                            (orderByComparator.getOrderByFields().length * 6));
2299                    }
2300                    else {
2301                            query = new StringBundler(3);
2302                    }
2303    
2304                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2305    
2306                    query.append(_FINDER_COLUMN_C_U_COMPANYID_2);
2307    
2308                    query.append(_FINDER_COLUMN_C_U_USERID_2);
2309    
2310                    if (orderByComparator != null) {
2311                            String[] orderByFields = orderByComparator.getOrderByFields();
2312    
2313                            if (orderByFields.length > 0) {
2314                                    query.append(WHERE_AND);
2315                            }
2316    
2317                            for (int i = 0; i < orderByFields.length; i++) {
2318                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2319                                    query.append(orderByFields[i]);
2320    
2321                                    if ((i + 1) < orderByFields.length) {
2322                                            if (orderByComparator.isAscending() ^ previous) {
2323                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
2324                                            }
2325                                            else {
2326                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
2327                                            }
2328                                    }
2329                                    else {
2330                                            if (orderByComparator.isAscending() ^ previous) {
2331                                                    query.append(WHERE_GREATER_THAN);
2332                                            }
2333                                            else {
2334                                                    query.append(WHERE_LESSER_THAN);
2335                                            }
2336                                    }
2337                            }
2338    
2339                            query.append(ORDER_BY_CLAUSE);
2340    
2341                            for (int i = 0; i < orderByFields.length; i++) {
2342                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2343                                    query.append(orderByFields[i]);
2344    
2345                                    if ((i + 1) < orderByFields.length) {
2346                                            if (orderByComparator.isAscending() ^ previous) {
2347                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
2348                                            }
2349                                            else {
2350                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
2351                                            }
2352                                    }
2353                                    else {
2354                                            if (orderByComparator.isAscending() ^ previous) {
2355                                                    query.append(ORDER_BY_ASC);
2356                                            }
2357                                            else {
2358                                                    query.append(ORDER_BY_DESC);
2359                                            }
2360                                    }
2361                            }
2362                    }
2363    
2364                    else {
2365                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2366                    }
2367    
2368                    String sql = query.toString();
2369    
2370                    Query q = session.createQuery(sql);
2371    
2372                    q.setFirstResult(0);
2373                    q.setMaxResults(2);
2374    
2375                    QueryPos qPos = QueryPos.getInstance(q);
2376    
2377                    qPos.add(companyId);
2378    
2379                    qPos.add(userId);
2380    
2381                    if (orderByComparator != null) {
2382                            Object[] values = orderByComparator.getOrderByValues(blogsEntry);
2383    
2384                            for (Object value : values) {
2385                                    qPos.add(value);
2386                            }
2387                    }
2388    
2389                    List<BlogsEntry> list = q.list();
2390    
2391                    if (list.size() == 2) {
2392                            return list.get(1);
2393                    }
2394                    else {
2395                            return null;
2396                    }
2397            }
2398    
2399            /**
2400             * Finds all the blogs entries where companyId = &#63; and displayDate &lt; &#63;.
2401             *
2402             * @param companyId the company id to search with
2403             * @param displayDate the display date to search with
2404             * @return the matching blogs entries
2405             * @throws SystemException if a system exception occurred
2406             */
2407            public List<BlogsEntry> findByC_LtD(long companyId, Date displayDate)
2408                    throws SystemException {
2409                    return findByC_LtD(companyId, displayDate, QueryUtil.ALL_POS,
2410                            QueryUtil.ALL_POS, null);
2411            }
2412    
2413            /**
2414             * Finds a range of all the blogs entries where companyId = &#63; and displayDate &lt; &#63;.
2415             *
2416             * <p>
2417             * 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.
2418             * </p>
2419             *
2420             * @param companyId the company id to search with
2421             * @param displayDate the display date to search with
2422             * @param start the lower bound of the range of blogs entries to return
2423             * @param end the upper bound of the range of blogs entries to return (not inclusive)
2424             * @return the range of matching blogs entries
2425             * @throws SystemException if a system exception occurred
2426             */
2427            public List<BlogsEntry> findByC_LtD(long companyId, Date displayDate,
2428                    int start, int end) throws SystemException {
2429                    return findByC_LtD(companyId, displayDate, start, end, null);
2430            }
2431    
2432            /**
2433             * Finds an ordered range of all the blogs entries where companyId = &#63; and displayDate &lt; &#63;.
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 companyId the company id to search with
2440             * @param displayDate the display date to search with
2441             * @param start the lower bound of the range of blogs entries to return
2442             * @param end the upper bound of the range of blogs entries to return (not inclusive)
2443             * @param orderByComparator the comparator to order the results by
2444             * @return the ordered range of matching blogs entries
2445             * @throws SystemException if a system exception occurred
2446             */
2447            public List<BlogsEntry> findByC_LtD(long companyId, Date displayDate,
2448                    int start, int end, OrderByComparator orderByComparator)
2449                    throws SystemException {
2450                    Object[] finderArgs = new Object[] {
2451                                    companyId, displayDate,
2452                                    
2453                                    String.valueOf(start), String.valueOf(end),
2454                                    String.valueOf(orderByComparator)
2455                            };
2456    
2457                    List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_LTD,
2458                                    finderArgs, this);
2459    
2460                    if (list == null) {
2461                            Session session = null;
2462    
2463                            try {
2464                                    session = openSession();
2465    
2466                                    StringBundler query = null;
2467    
2468                                    if (orderByComparator != null) {
2469                                            query = new StringBundler(4 +
2470                                                            (orderByComparator.getOrderByFields().length * 3));
2471                                    }
2472                                    else {
2473                                            query = new StringBundler(4);
2474                                    }
2475    
2476                                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2477    
2478                                    query.append(_FINDER_COLUMN_C_LTD_COMPANYID_2);
2479    
2480                                    if (displayDate == null) {
2481                                            query.append(_FINDER_COLUMN_C_LTD_DISPLAYDATE_1);
2482                                    }
2483                                    else {
2484                                            query.append(_FINDER_COLUMN_C_LTD_DISPLAYDATE_2);
2485                                    }
2486    
2487                                    if (orderByComparator != null) {
2488                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2489                                                    orderByComparator);
2490                                    }
2491    
2492                                    else {
2493                                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2494                                    }
2495    
2496                                    String sql = query.toString();
2497    
2498                                    Query q = session.createQuery(sql);
2499    
2500                                    QueryPos qPos = QueryPos.getInstance(q);
2501    
2502                                    qPos.add(companyId);
2503    
2504                                    if (displayDate != null) {
2505                                            qPos.add(CalendarUtil.getTimestamp(displayDate));
2506                                    }
2507    
2508                                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
2509                                                    end);
2510                            }
2511                            catch (Exception e) {
2512                                    throw processException(e);
2513                            }
2514                            finally {
2515                                    if (list == null) {
2516                                            list = new ArrayList<BlogsEntry>();
2517                                    }
2518    
2519                                    cacheResult(list);
2520    
2521                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_LTD,
2522                                            finderArgs, list);
2523    
2524                                    closeSession(session);
2525                            }
2526                    }
2527    
2528                    return list;
2529            }
2530    
2531            /**
2532             * Finds the first blogs entry in the ordered set where companyId = &#63; and displayDate &lt; &#63;.
2533             *
2534             * <p>
2535             * 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.
2536             * </p>
2537             *
2538             * @param companyId the company id to search with
2539             * @param displayDate the display date to search with
2540             * @param orderByComparator the comparator to order the set by
2541             * @return the first matching blogs entry
2542             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
2543             * @throws SystemException if a system exception occurred
2544             */
2545            public BlogsEntry findByC_LtD_First(long companyId, Date displayDate,
2546                    OrderByComparator orderByComparator)
2547                    throws NoSuchEntryException, SystemException {
2548                    List<BlogsEntry> list = findByC_LtD(companyId, displayDate, 0, 1,
2549                                    orderByComparator);
2550    
2551                    if (list.isEmpty()) {
2552                            StringBundler msg = new StringBundler(6);
2553    
2554                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2555    
2556                            msg.append("companyId=");
2557                            msg.append(companyId);
2558    
2559                            msg.append(", displayDate=");
2560                            msg.append(displayDate);
2561    
2562                            msg.append(StringPool.CLOSE_CURLY_BRACE);
2563    
2564                            throw new NoSuchEntryException(msg.toString());
2565                    }
2566                    else {
2567                            return list.get(0);
2568                    }
2569            }
2570    
2571            /**
2572             * Finds the last blogs entry in the ordered set where companyId = &#63; and displayDate &lt; &#63;.
2573             *
2574             * <p>
2575             * 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.
2576             * </p>
2577             *
2578             * @param companyId the company id to search with
2579             * @param displayDate the display date to search with
2580             * @param orderByComparator the comparator to order the set by
2581             * @return the last matching blogs entry
2582             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
2583             * @throws SystemException if a system exception occurred
2584             */
2585            public BlogsEntry findByC_LtD_Last(long companyId, Date displayDate,
2586                    OrderByComparator orderByComparator)
2587                    throws NoSuchEntryException, SystemException {
2588                    int count = countByC_LtD(companyId, displayDate);
2589    
2590                    List<BlogsEntry> list = findByC_LtD(companyId, displayDate, count - 1,
2591                                    count, orderByComparator);
2592    
2593                    if (list.isEmpty()) {
2594                            StringBundler msg = new StringBundler(6);
2595    
2596                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2597    
2598                            msg.append("companyId=");
2599                            msg.append(companyId);
2600    
2601                            msg.append(", displayDate=");
2602                            msg.append(displayDate);
2603    
2604                            msg.append(StringPool.CLOSE_CURLY_BRACE);
2605    
2606                            throw new NoSuchEntryException(msg.toString());
2607                    }
2608                    else {
2609                            return list.get(0);
2610                    }
2611            }
2612    
2613            /**
2614             * Finds the blogs entries before and after the current blogs entry in the ordered set where companyId = &#63; and displayDate &lt; &#63;.
2615             *
2616             * <p>
2617             * 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.
2618             * </p>
2619             *
2620             * @param entryId the primary key of the current blogs entry
2621             * @param companyId the company id to search with
2622             * @param displayDate the display date to search with
2623             * @param orderByComparator the comparator to order the set by
2624             * @return the previous, current, and next blogs entry
2625             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
2626             * @throws SystemException if a system exception occurred
2627             */
2628            public BlogsEntry[] findByC_LtD_PrevAndNext(long entryId, long companyId,
2629                    Date displayDate, OrderByComparator orderByComparator)
2630                    throws NoSuchEntryException, SystemException {
2631                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
2632    
2633                    Session session = null;
2634    
2635                    try {
2636                            session = openSession();
2637    
2638                            BlogsEntry[] array = new BlogsEntryImpl[3];
2639    
2640                            array[0] = getByC_LtD_PrevAndNext(session, blogsEntry, companyId,
2641                                            displayDate, orderByComparator, true);
2642    
2643                            array[1] = blogsEntry;
2644    
2645                            array[2] = getByC_LtD_PrevAndNext(session, blogsEntry, companyId,
2646                                            displayDate, orderByComparator, false);
2647    
2648                            return array;
2649                    }
2650                    catch (Exception e) {
2651                            throw processException(e);
2652                    }
2653                    finally {
2654                            closeSession(session);
2655                    }
2656            }
2657    
2658            protected BlogsEntry getByC_LtD_PrevAndNext(Session session,
2659                    BlogsEntry blogsEntry, long companyId, Date displayDate,
2660                    OrderByComparator orderByComparator, boolean previous) {
2661                    StringBundler query = null;
2662    
2663                    if (orderByComparator != null) {
2664                            query = new StringBundler(6 +
2665                                            (orderByComparator.getOrderByFields().length * 6));
2666                    }
2667                    else {
2668                            query = new StringBundler(3);
2669                    }
2670    
2671                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2672    
2673                    query.append(_FINDER_COLUMN_C_LTD_COMPANYID_2);
2674    
2675                    if (displayDate == null) {
2676                            query.append(_FINDER_COLUMN_C_LTD_DISPLAYDATE_1);
2677                    }
2678                    else {
2679                            query.append(_FINDER_COLUMN_C_LTD_DISPLAYDATE_2);
2680                    }
2681    
2682                    if (orderByComparator != null) {
2683                            String[] orderByFields = orderByComparator.getOrderByFields();
2684    
2685                            if (orderByFields.length > 0) {
2686                                    query.append(WHERE_AND);
2687                            }
2688    
2689                            for (int i = 0; i < orderByFields.length; i++) {
2690                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2691                                    query.append(orderByFields[i]);
2692    
2693                                    if ((i + 1) < orderByFields.length) {
2694                                            if (orderByComparator.isAscending() ^ previous) {
2695                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
2696                                            }
2697                                            else {
2698                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
2699                                            }
2700                                    }
2701                                    else {
2702                                            if (orderByComparator.isAscending() ^ previous) {
2703                                                    query.append(WHERE_GREATER_THAN);
2704                                            }
2705                                            else {
2706                                                    query.append(WHERE_LESSER_THAN);
2707                                            }
2708                                    }
2709                            }
2710    
2711                            query.append(ORDER_BY_CLAUSE);
2712    
2713                            for (int i = 0; i < orderByFields.length; i++) {
2714                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2715                                    query.append(orderByFields[i]);
2716    
2717                                    if ((i + 1) < orderByFields.length) {
2718                                            if (orderByComparator.isAscending() ^ previous) {
2719                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
2720                                            }
2721                                            else {
2722                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
2723                                            }
2724                                    }
2725                                    else {
2726                                            if (orderByComparator.isAscending() ^ previous) {
2727                                                    query.append(ORDER_BY_ASC);
2728                                            }
2729                                            else {
2730                                                    query.append(ORDER_BY_DESC);
2731                                            }
2732                                    }
2733                            }
2734                    }
2735    
2736                    else {
2737                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2738                    }
2739    
2740                    String sql = query.toString();
2741    
2742                    Query q = session.createQuery(sql);
2743    
2744                    q.setFirstResult(0);
2745                    q.setMaxResults(2);
2746    
2747                    QueryPos qPos = QueryPos.getInstance(q);
2748    
2749                    qPos.add(companyId);
2750    
2751                    if (displayDate != null) {
2752                            qPos.add(CalendarUtil.getTimestamp(displayDate));
2753                    }
2754    
2755                    if (orderByComparator != null) {
2756                            Object[] values = orderByComparator.getOrderByValues(blogsEntry);
2757    
2758                            for (Object value : values) {
2759                                    qPos.add(value);
2760                            }
2761                    }
2762    
2763                    List<BlogsEntry> list = q.list();
2764    
2765                    if (list.size() == 2) {
2766                            return list.get(1);
2767                    }
2768                    else {
2769                            return null;
2770                    }
2771            }
2772    
2773            /**
2774             * Finds all the blogs entries where companyId = &#63; and status = &#63;.
2775             *
2776             * @param companyId the company id to search with
2777             * @param status the status to search with
2778             * @return the matching blogs entries
2779             * @throws SystemException if a system exception occurred
2780             */
2781            public List<BlogsEntry> findByC_S(long companyId, int status)
2782                    throws SystemException {
2783                    return findByC_S(companyId, status, QueryUtil.ALL_POS,
2784                            QueryUtil.ALL_POS, null);
2785            }
2786    
2787            /**
2788             * Finds a range of all the blogs entries where companyId = &#63; and status = &#63;.
2789             *
2790             * <p>
2791             * 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.
2792             * </p>
2793             *
2794             * @param companyId the company id to search with
2795             * @param status the status to search with
2796             * @param start the lower bound of the range of blogs entries to return
2797             * @param end the upper bound of the range of blogs entries to return (not inclusive)
2798             * @return the range of matching blogs entries
2799             * @throws SystemException if a system exception occurred
2800             */
2801            public List<BlogsEntry> findByC_S(long companyId, int status, int start,
2802                    int end) throws SystemException {
2803                    return findByC_S(companyId, status, start, end, null);
2804            }
2805    
2806            /**
2807             * Finds an ordered range of all the blogs entries where companyId = &#63; and status = &#63;.
2808             *
2809             * <p>
2810             * 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.
2811             * </p>
2812             *
2813             * @param companyId the company id to search with
2814             * @param status the status to search with
2815             * @param start the lower bound of the range of blogs entries to return
2816             * @param end the upper bound of the range of blogs entries to return (not inclusive)
2817             * @param orderByComparator the comparator to order the results by
2818             * @return the ordered range of matching blogs entries
2819             * @throws SystemException if a system exception occurred
2820             */
2821            public List<BlogsEntry> findByC_S(long companyId, int status, int start,
2822                    int end, OrderByComparator orderByComparator) throws SystemException {
2823                    Object[] finderArgs = new Object[] {
2824                                    companyId, status,
2825                                    
2826                                    String.valueOf(start), String.valueOf(end),
2827                                    String.valueOf(orderByComparator)
2828                            };
2829    
2830                    List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_S,
2831                                    finderArgs, this);
2832    
2833                    if (list == null) {
2834                            Session session = null;
2835    
2836                            try {
2837                                    session = openSession();
2838    
2839                                    StringBundler query = null;
2840    
2841                                    if (orderByComparator != null) {
2842                                            query = new StringBundler(4 +
2843                                                            (orderByComparator.getOrderByFields().length * 3));
2844                                    }
2845                                    else {
2846                                            query = new StringBundler(4);
2847                                    }
2848    
2849                                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2850    
2851                                    query.append(_FINDER_COLUMN_C_S_COMPANYID_2);
2852    
2853                                    query.append(_FINDER_COLUMN_C_S_STATUS_2);
2854    
2855                                    if (orderByComparator != null) {
2856                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2857                                                    orderByComparator);
2858                                    }
2859    
2860                                    else {
2861                                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2862                                    }
2863    
2864                                    String sql = query.toString();
2865    
2866                                    Query q = session.createQuery(sql);
2867    
2868                                    QueryPos qPos = QueryPos.getInstance(q);
2869    
2870                                    qPos.add(companyId);
2871    
2872                                    qPos.add(status);
2873    
2874                                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
2875                                                    end);
2876                            }
2877                            catch (Exception e) {
2878                                    throw processException(e);
2879                            }
2880                            finally {
2881                                    if (list == null) {
2882                                            list = new ArrayList<BlogsEntry>();
2883                                    }
2884    
2885                                    cacheResult(list);
2886    
2887                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_S, finderArgs,
2888                                            list);
2889    
2890                                    closeSession(session);
2891                            }
2892                    }
2893    
2894                    return list;
2895            }
2896    
2897            /**
2898             * Finds the first blogs entry in the ordered set where companyId = &#63; and status = &#63;.
2899             *
2900             * <p>
2901             * 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.
2902             * </p>
2903             *
2904             * @param companyId the company id to search with
2905             * @param status the status to search with
2906             * @param orderByComparator the comparator to order the set by
2907             * @return the first matching blogs entry
2908             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
2909             * @throws SystemException if a system exception occurred
2910             */
2911            public BlogsEntry findByC_S_First(long companyId, int status,
2912                    OrderByComparator orderByComparator)
2913                    throws NoSuchEntryException, SystemException {
2914                    List<BlogsEntry> list = findByC_S(companyId, status, 0, 1,
2915                                    orderByComparator);
2916    
2917                    if (list.isEmpty()) {
2918                            StringBundler msg = new StringBundler(6);
2919    
2920                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2921    
2922                            msg.append("companyId=");
2923                            msg.append(companyId);
2924    
2925                            msg.append(", status=");
2926                            msg.append(status);
2927    
2928                            msg.append(StringPool.CLOSE_CURLY_BRACE);
2929    
2930                            throw new NoSuchEntryException(msg.toString());
2931                    }
2932                    else {
2933                            return list.get(0);
2934                    }
2935            }
2936    
2937            /**
2938             * Finds the last blogs entry in the ordered set where companyId = &#63; and status = &#63;.
2939             *
2940             * <p>
2941             * 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.
2942             * </p>
2943             *
2944             * @param companyId the company id to search with
2945             * @param status the status to search with
2946             * @param orderByComparator the comparator to order the set by
2947             * @return the last matching blogs entry
2948             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
2949             * @throws SystemException if a system exception occurred
2950             */
2951            public BlogsEntry findByC_S_Last(long companyId, int status,
2952                    OrderByComparator orderByComparator)
2953                    throws NoSuchEntryException, SystemException {
2954                    int count = countByC_S(companyId, status);
2955    
2956                    List<BlogsEntry> list = findByC_S(companyId, status, count - 1, count,
2957                                    orderByComparator);
2958    
2959                    if (list.isEmpty()) {
2960                            StringBundler msg = new StringBundler(6);
2961    
2962                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2963    
2964                            msg.append("companyId=");
2965                            msg.append(companyId);
2966    
2967                            msg.append(", status=");
2968                            msg.append(status);
2969    
2970                            msg.append(StringPool.CLOSE_CURLY_BRACE);
2971    
2972                            throw new NoSuchEntryException(msg.toString());
2973                    }
2974                    else {
2975                            return list.get(0);
2976                    }
2977            }
2978    
2979            /**
2980             * Finds the blogs entries before and after the current blogs entry in the ordered set where companyId = &#63; and status = &#63;.
2981             *
2982             * <p>
2983             * 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.
2984             * </p>
2985             *
2986             * @param entryId the primary key of the current blogs entry
2987             * @param companyId the company id to search with
2988             * @param status the status to search with
2989             * @param orderByComparator the comparator to order the set by
2990             * @return the previous, current, and next blogs entry
2991             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
2992             * @throws SystemException if a system exception occurred
2993             */
2994            public BlogsEntry[] findByC_S_PrevAndNext(long entryId, long companyId,
2995                    int status, OrderByComparator orderByComparator)
2996                    throws NoSuchEntryException, SystemException {
2997                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
2998    
2999                    Session session = null;
3000    
3001                    try {
3002                            session = openSession();
3003    
3004                            BlogsEntry[] array = new BlogsEntryImpl[3];
3005    
3006                            array[0] = getByC_S_PrevAndNext(session, blogsEntry, companyId,
3007                                            status, orderByComparator, true);
3008    
3009                            array[1] = blogsEntry;
3010    
3011                            array[2] = getByC_S_PrevAndNext(session, blogsEntry, companyId,
3012                                            status, orderByComparator, false);
3013    
3014                            return array;
3015                    }
3016                    catch (Exception e) {
3017                            throw processException(e);
3018                    }
3019                    finally {
3020                            closeSession(session);
3021                    }
3022            }
3023    
3024            protected BlogsEntry getByC_S_PrevAndNext(Session session,
3025                    BlogsEntry blogsEntry, long companyId, int status,
3026                    OrderByComparator orderByComparator, boolean previous) {
3027                    StringBundler query = null;
3028    
3029                    if (orderByComparator != null) {
3030                            query = new StringBundler(6 +
3031                                            (orderByComparator.getOrderByFields().length * 6));
3032                    }
3033                    else {
3034                            query = new StringBundler(3);
3035                    }
3036    
3037                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
3038    
3039                    query.append(_FINDER_COLUMN_C_S_COMPANYID_2);
3040    
3041                    query.append(_FINDER_COLUMN_C_S_STATUS_2);
3042    
3043                    if (orderByComparator != null) {
3044                            String[] orderByFields = orderByComparator.getOrderByFields();
3045    
3046                            if (orderByFields.length > 0) {
3047                                    query.append(WHERE_AND);
3048                            }
3049    
3050                            for (int i = 0; i < orderByFields.length; i++) {
3051                                    query.append(_ORDER_BY_ENTITY_ALIAS);
3052                                    query.append(orderByFields[i]);
3053    
3054                                    if ((i + 1) < orderByFields.length) {
3055                                            if (orderByComparator.isAscending() ^ previous) {
3056                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
3057                                            }
3058                                            else {
3059                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
3060                                            }
3061                                    }
3062                                    else {
3063                                            if (orderByComparator.isAscending() ^ previous) {
3064                                                    query.append(WHERE_GREATER_THAN);
3065                                            }
3066                                            else {
3067                                                    query.append(WHERE_LESSER_THAN);
3068                                            }
3069                                    }
3070                            }
3071    
3072                            query.append(ORDER_BY_CLAUSE);
3073    
3074                            for (int i = 0; i < orderByFields.length; i++) {
3075                                    query.append(_ORDER_BY_ENTITY_ALIAS);
3076                                    query.append(orderByFields[i]);
3077    
3078                                    if ((i + 1) < orderByFields.length) {
3079                                            if (orderByComparator.isAscending() ^ previous) {
3080                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
3081                                            }
3082                                            else {
3083                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
3084                                            }
3085                                    }
3086                                    else {
3087                                            if (orderByComparator.isAscending() ^ previous) {
3088                                                    query.append(ORDER_BY_ASC);
3089                                            }
3090                                            else {
3091                                                    query.append(ORDER_BY_DESC);
3092                                            }
3093                                    }
3094                            }
3095                    }
3096    
3097                    else {
3098                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
3099                    }
3100    
3101                    String sql = query.toString();
3102    
3103                    Query q = session.createQuery(sql);
3104    
3105                    q.setFirstResult(0);
3106                    q.setMaxResults(2);
3107    
3108                    QueryPos qPos = QueryPos.getInstance(q);
3109    
3110                    qPos.add(companyId);
3111    
3112                    qPos.add(status);
3113    
3114                    if (orderByComparator != null) {
3115                            Object[] values = orderByComparator.getOrderByValues(blogsEntry);
3116    
3117                            for (Object value : values) {
3118                                    qPos.add(value);
3119                            }
3120                    }
3121    
3122                    List<BlogsEntry> list = q.list();
3123    
3124                    if (list.size() == 2) {
3125                            return list.get(1);
3126                    }
3127                    else {
3128                            return null;
3129                    }
3130            }
3131    
3132            /**
3133             * Finds the blogs entry where groupId = &#63; and urlTitle = &#63; or throws a {@link com.liferay.portlet.blogs.NoSuchEntryException} if it could not be found.
3134             *
3135             * @param groupId the group id to search with
3136             * @param urlTitle the url title to search with
3137             * @return the matching blogs entry
3138             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
3139             * @throws SystemException if a system exception occurred
3140             */
3141            public BlogsEntry findByG_UT(long groupId, String urlTitle)
3142                    throws NoSuchEntryException, SystemException {
3143                    BlogsEntry blogsEntry = fetchByG_UT(groupId, urlTitle);
3144    
3145                    if (blogsEntry == null) {
3146                            StringBundler msg = new StringBundler(6);
3147    
3148                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3149    
3150                            msg.append("groupId=");
3151                            msg.append(groupId);
3152    
3153                            msg.append(", urlTitle=");
3154                            msg.append(urlTitle);
3155    
3156                            msg.append(StringPool.CLOSE_CURLY_BRACE);
3157    
3158                            if (_log.isWarnEnabled()) {
3159                                    _log.warn(msg.toString());
3160                            }
3161    
3162                            throw new NoSuchEntryException(msg.toString());
3163                    }
3164    
3165                    return blogsEntry;
3166            }
3167    
3168            /**
3169             * Finds the blogs entry where groupId = &#63; and urlTitle = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
3170             *
3171             * @param groupId the group id to search with
3172             * @param urlTitle the url title to search with
3173             * @return the matching blogs entry, or <code>null</code> if a matching blogs entry could not be found
3174             * @throws SystemException if a system exception occurred
3175             */
3176            public BlogsEntry fetchByG_UT(long groupId, String urlTitle)
3177                    throws SystemException {
3178                    return fetchByG_UT(groupId, urlTitle, true);
3179            }
3180    
3181            /**
3182             * Finds the blogs entry where groupId = &#63; and urlTitle = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
3183             *
3184             * @param groupId the group id to search with
3185             * @param urlTitle the url title to search with
3186             * @return the matching blogs entry, or <code>null</code> if a matching blogs entry could not be found
3187             * @throws SystemException if a system exception occurred
3188             */
3189            public BlogsEntry fetchByG_UT(long groupId, String urlTitle,
3190                    boolean retrieveFromCache) throws SystemException {
3191                    Object[] finderArgs = new Object[] { groupId, urlTitle };
3192    
3193                    Object result = null;
3194    
3195                    if (retrieveFromCache) {
3196                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_UT,
3197                                            finderArgs, this);
3198                    }
3199    
3200                    if (result == null) {
3201                            Session session = null;
3202    
3203                            try {
3204                                    session = openSession();
3205    
3206                                    StringBundler query = new StringBundler(4);
3207    
3208                                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
3209    
3210                                    query.append(_FINDER_COLUMN_G_UT_GROUPID_2);
3211    
3212                                    if (urlTitle == null) {
3213                                            query.append(_FINDER_COLUMN_G_UT_URLTITLE_1);
3214                                    }
3215                                    else {
3216                                            if (urlTitle.equals(StringPool.BLANK)) {
3217                                                    query.append(_FINDER_COLUMN_G_UT_URLTITLE_3);
3218                                            }
3219                                            else {
3220                                                    query.append(_FINDER_COLUMN_G_UT_URLTITLE_2);
3221                                            }
3222                                    }
3223    
3224                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
3225    
3226                                    String sql = query.toString();
3227    
3228                                    Query q = session.createQuery(sql);
3229    
3230                                    QueryPos qPos = QueryPos.getInstance(q);
3231    
3232                                    qPos.add(groupId);
3233    
3234                                    if (urlTitle != null) {
3235                                            qPos.add(urlTitle);
3236                                    }
3237    
3238                                    List<BlogsEntry> list = q.list();
3239    
3240                                    result = list;
3241    
3242                                    BlogsEntry blogsEntry = null;
3243    
3244                                    if (list.isEmpty()) {
3245                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_UT,
3246                                                    finderArgs, list);
3247                                    }
3248                                    else {
3249                                            blogsEntry = list.get(0);
3250    
3251                                            cacheResult(blogsEntry);
3252    
3253                                            if ((blogsEntry.getGroupId() != groupId) ||
3254                                                            (blogsEntry.getUrlTitle() == null) ||
3255                                                            !blogsEntry.getUrlTitle().equals(urlTitle)) {
3256                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_UT,
3257                                                            finderArgs, blogsEntry);
3258                                            }
3259                                    }
3260    
3261                                    return blogsEntry;
3262                            }
3263                            catch (Exception e) {
3264                                    throw processException(e);
3265                            }
3266                            finally {
3267                                    if (result == null) {
3268                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_UT,
3269                                                    finderArgs, new ArrayList<BlogsEntry>());
3270                                    }
3271    
3272                                    closeSession(session);
3273                            }
3274                    }
3275                    else {
3276                            if (result instanceof List<?>) {
3277                                    return null;
3278                            }
3279                            else {
3280                                    return (BlogsEntry)result;
3281                            }
3282                    }
3283            }
3284    
3285            /**
3286             * Finds all the blogs entries where groupId = &#63; and displayDate &lt; &#63;.
3287             *
3288             * @param groupId the group id to search with
3289             * @param displayDate the display date to search with
3290             * @return the matching blogs entries
3291             * @throws SystemException if a system exception occurred
3292             */
3293            public List<BlogsEntry> findByG_LtD(long groupId, Date displayDate)
3294                    throws SystemException {
3295                    return findByG_LtD(groupId, displayDate, QueryUtil.ALL_POS,
3296                            QueryUtil.ALL_POS, null);
3297            }
3298    
3299            /**
3300             * Finds a range of all the blogs entries where groupId = &#63; and displayDate &lt; &#63;.
3301             *
3302             * <p>
3303             * 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.
3304             * </p>
3305             *
3306             * @param groupId the group id to search with
3307             * @param displayDate the display date to search with
3308             * @param start the lower bound of the range of blogs entries to return
3309             * @param end the upper bound of the range of blogs entries to return (not inclusive)
3310             * @return the range of matching blogs entries
3311             * @throws SystemException if a system exception occurred
3312             */
3313            public List<BlogsEntry> findByG_LtD(long groupId, Date displayDate,
3314                    int start, int end) throws SystemException {
3315                    return findByG_LtD(groupId, displayDate, start, end, null);
3316            }
3317    
3318            /**
3319             * Finds an ordered range of all the blogs entries where groupId = &#63; and displayDate &lt; &#63;.
3320             *
3321             * <p>
3322             * 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.
3323             * </p>
3324             *
3325             * @param groupId the group id to search with
3326             * @param displayDate the display date to search with
3327             * @param start the lower bound of the range of blogs entries to return
3328             * @param end the upper bound of the range of blogs entries to return (not inclusive)
3329             * @param orderByComparator the comparator to order the results by
3330             * @return the ordered range of matching blogs entries
3331             * @throws SystemException if a system exception occurred
3332             */
3333            public List<BlogsEntry> findByG_LtD(long groupId, Date displayDate,
3334                    int start, int end, OrderByComparator orderByComparator)
3335                    throws SystemException {
3336                    Object[] finderArgs = new Object[] {
3337                                    groupId, displayDate,
3338                                    
3339                                    String.valueOf(start), String.valueOf(end),
3340                                    String.valueOf(orderByComparator)
3341                            };
3342    
3343                    List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_LTD,
3344                                    finderArgs, this);
3345    
3346                    if (list == null) {
3347                            Session session = null;
3348    
3349                            try {
3350                                    session = openSession();
3351    
3352                                    StringBundler query = null;
3353    
3354                                    if (orderByComparator != null) {
3355                                            query = new StringBundler(4 +
3356                                                            (orderByComparator.getOrderByFields().length * 3));
3357                                    }
3358                                    else {
3359                                            query = new StringBundler(4);
3360                                    }
3361    
3362                                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
3363    
3364                                    query.append(_FINDER_COLUMN_G_LTD_GROUPID_2);
3365    
3366                                    if (displayDate == null) {
3367                                            query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_1);
3368                                    }
3369                                    else {
3370                                            query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_2);
3371                                    }
3372    
3373                                    if (orderByComparator != null) {
3374                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3375                                                    orderByComparator);
3376                                    }
3377    
3378                                    else {
3379                                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
3380                                    }
3381    
3382                                    String sql = query.toString();
3383    
3384                                    Query q = session.createQuery(sql);
3385    
3386                                    QueryPos qPos = QueryPos.getInstance(q);
3387    
3388                                    qPos.add(groupId);
3389    
3390                                    if (displayDate != null) {
3391                                            qPos.add(CalendarUtil.getTimestamp(displayDate));
3392                                    }
3393    
3394                                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
3395                                                    end);
3396                            }
3397                            catch (Exception e) {
3398                                    throw processException(e);
3399                            }
3400                            finally {
3401                                    if (list == null) {
3402                                            list = new ArrayList<BlogsEntry>();
3403                                    }
3404    
3405                                    cacheResult(list);
3406    
3407                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_LTD,
3408                                            finderArgs, list);
3409    
3410                                    closeSession(session);
3411                            }
3412                    }
3413    
3414                    return list;
3415            }
3416    
3417            /**
3418             * Finds the first blogs entry in the ordered set where groupId = &#63; and displayDate &lt; &#63;.
3419             *
3420             * <p>
3421             * 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.
3422             * </p>
3423             *
3424             * @param groupId the group id to search with
3425             * @param displayDate the display date to search with
3426             * @param orderByComparator the comparator to order the set by
3427             * @return the first matching blogs entry
3428             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
3429             * @throws SystemException if a system exception occurred
3430             */
3431            public BlogsEntry findByG_LtD_First(long groupId, Date displayDate,
3432                    OrderByComparator orderByComparator)
3433                    throws NoSuchEntryException, SystemException {
3434                    List<BlogsEntry> list = findByG_LtD(groupId, displayDate, 0, 1,
3435                                    orderByComparator);
3436    
3437                    if (list.isEmpty()) {
3438                            StringBundler msg = new StringBundler(6);
3439    
3440                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3441    
3442                            msg.append("groupId=");
3443                            msg.append(groupId);
3444    
3445                            msg.append(", displayDate=");
3446                            msg.append(displayDate);
3447    
3448                            msg.append(StringPool.CLOSE_CURLY_BRACE);
3449    
3450                            throw new NoSuchEntryException(msg.toString());
3451                    }
3452                    else {
3453                            return list.get(0);
3454                    }
3455            }
3456    
3457            /**
3458             * Finds the last blogs entry in the ordered set where groupId = &#63; and displayDate &lt; &#63;.
3459             *
3460             * <p>
3461             * 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.
3462             * </p>
3463             *
3464             * @param groupId the group id to search with
3465             * @param displayDate the display date to search with
3466             * @param orderByComparator the comparator to order the set by
3467             * @return the last matching blogs entry
3468             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
3469             * @throws SystemException if a system exception occurred
3470             */
3471            public BlogsEntry findByG_LtD_Last(long groupId, Date displayDate,
3472                    OrderByComparator orderByComparator)
3473                    throws NoSuchEntryException, SystemException {
3474                    int count = countByG_LtD(groupId, displayDate);
3475    
3476                    List<BlogsEntry> list = findByG_LtD(groupId, displayDate, count - 1,
3477                                    count, orderByComparator);
3478    
3479                    if (list.isEmpty()) {
3480                            StringBundler msg = new StringBundler(6);
3481    
3482                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3483    
3484                            msg.append("groupId=");
3485                            msg.append(groupId);
3486    
3487                            msg.append(", displayDate=");
3488                            msg.append(displayDate);
3489    
3490                            msg.append(StringPool.CLOSE_CURLY_BRACE);
3491    
3492                            throw new NoSuchEntryException(msg.toString());
3493                    }
3494                    else {
3495                            return list.get(0);
3496                    }
3497            }
3498    
3499            /**
3500             * Finds the blogs entries before and after the current blogs entry in the ordered set where groupId = &#63; and displayDate &lt; &#63;.
3501             *
3502             * <p>
3503             * 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.
3504             * </p>
3505             *
3506             * @param entryId the primary key of the current blogs entry
3507             * @param groupId the group id to search with
3508             * @param displayDate the display date to search with
3509             * @param orderByComparator the comparator to order the set by
3510             * @return the previous, current, and next blogs entry
3511             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
3512             * @throws SystemException if a system exception occurred
3513             */
3514            public BlogsEntry[] findByG_LtD_PrevAndNext(long entryId, long groupId,
3515                    Date displayDate, OrderByComparator orderByComparator)
3516                    throws NoSuchEntryException, SystemException {
3517                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
3518    
3519                    Session session = null;
3520    
3521                    try {
3522                            session = openSession();
3523    
3524                            BlogsEntry[] array = new BlogsEntryImpl[3];
3525    
3526                            array[0] = getByG_LtD_PrevAndNext(session, blogsEntry, groupId,
3527                                            displayDate, orderByComparator, true);
3528    
3529                            array[1] = blogsEntry;
3530    
3531                            array[2] = getByG_LtD_PrevAndNext(session, blogsEntry, groupId,
3532                                            displayDate, orderByComparator, false);
3533    
3534                            return array;
3535                    }
3536                    catch (Exception e) {
3537                            throw processException(e);
3538                    }
3539                    finally {
3540                            closeSession(session);
3541                    }
3542            }
3543    
3544            protected BlogsEntry getByG_LtD_PrevAndNext(Session session,
3545                    BlogsEntry blogsEntry, long groupId, Date displayDate,
3546                    OrderByComparator orderByComparator, boolean previous) {
3547                    StringBundler query = null;
3548    
3549                    if (orderByComparator != null) {
3550                            query = new StringBundler(6 +
3551                                            (orderByComparator.getOrderByFields().length * 6));
3552                    }
3553                    else {
3554                            query = new StringBundler(3);
3555                    }
3556    
3557                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
3558    
3559                    query.append(_FINDER_COLUMN_G_LTD_GROUPID_2);
3560    
3561                    if (displayDate == null) {
3562                            query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_1);
3563                    }
3564                    else {
3565                            query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_2);
3566                    }
3567    
3568                    if (orderByComparator != null) {
3569                            String[] orderByFields = orderByComparator.getOrderByFields();
3570    
3571                            if (orderByFields.length > 0) {
3572                                    query.append(WHERE_AND);
3573                            }
3574    
3575                            for (int i = 0; i < orderByFields.length; i++) {
3576                                    query.append(_ORDER_BY_ENTITY_ALIAS);
3577                                    query.append(orderByFields[i]);
3578    
3579                                    if ((i + 1) < orderByFields.length) {
3580                                            if (orderByComparator.isAscending() ^ previous) {
3581                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
3582                                            }
3583                                            else {
3584                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
3585                                            }
3586                                    }
3587                                    else {
3588                                            if (orderByComparator.isAscending() ^ previous) {
3589                                                    query.append(WHERE_GREATER_THAN);
3590                                            }
3591                                            else {
3592                                                    query.append(WHERE_LESSER_THAN);
3593                                            }
3594                                    }
3595                            }
3596    
3597                            query.append(ORDER_BY_CLAUSE);
3598    
3599                            for (int i = 0; i < orderByFields.length; i++) {
3600                                    query.append(_ORDER_BY_ENTITY_ALIAS);
3601                                    query.append(orderByFields[i]);
3602    
3603                                    if ((i + 1) < orderByFields.length) {
3604                                            if (orderByComparator.isAscending() ^ previous) {
3605                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
3606                                            }
3607                                            else {
3608                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
3609                                            }
3610                                    }
3611                                    else {
3612                                            if (orderByComparator.isAscending() ^ previous) {
3613                                                    query.append(ORDER_BY_ASC);
3614                                            }
3615                                            else {
3616                                                    query.append(ORDER_BY_DESC);
3617                                            }
3618                                    }
3619                            }
3620                    }
3621    
3622                    else {
3623                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
3624                    }
3625    
3626                    String sql = query.toString();
3627    
3628                    Query q = session.createQuery(sql);
3629    
3630                    q.setFirstResult(0);
3631                    q.setMaxResults(2);
3632    
3633                    QueryPos qPos = QueryPos.getInstance(q);
3634    
3635                    qPos.add(groupId);
3636    
3637                    if (displayDate != null) {
3638                            qPos.add(CalendarUtil.getTimestamp(displayDate));
3639                    }
3640    
3641                    if (orderByComparator != null) {
3642                            Object[] values = orderByComparator.getOrderByValues(blogsEntry);
3643    
3644                            for (Object value : values) {
3645                                    qPos.add(value);
3646                            }
3647                    }
3648    
3649                    List<BlogsEntry> list = q.list();
3650    
3651                    if (list.size() == 2) {
3652                            return list.get(1);
3653                    }
3654                    else {
3655                            return null;
3656                    }
3657            }
3658    
3659            /**
3660             * Filters by the user's permissions and finds all the blogs entries where groupId = &#63; and displayDate &lt; &#63;.
3661             *
3662             * @param groupId the group id to search with
3663             * @param displayDate the display date to search with
3664             * @return the matching blogs entries that the user has permission to view
3665             * @throws SystemException if a system exception occurred
3666             */
3667            public List<BlogsEntry> filterFindByG_LtD(long groupId, Date displayDate)
3668                    throws SystemException {
3669                    return filterFindByG_LtD(groupId, displayDate, QueryUtil.ALL_POS,
3670                            QueryUtil.ALL_POS, null);
3671            }
3672    
3673            /**
3674             * Filters by the user's permissions and finds a range of all the blogs entries where groupId = &#63; and displayDate &lt; &#63;.
3675             *
3676             * <p>
3677             * 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.
3678             * </p>
3679             *
3680             * @param groupId the group id to search with
3681             * @param displayDate the display date to search with
3682             * @param start the lower bound of the range of blogs entries to return
3683             * @param end the upper bound of the range of blogs entries to return (not inclusive)
3684             * @return the range of matching blogs entries that the user has permission to view
3685             * @throws SystemException if a system exception occurred
3686             */
3687            public List<BlogsEntry> filterFindByG_LtD(long groupId, Date displayDate,
3688                    int start, int end) throws SystemException {
3689                    return filterFindByG_LtD(groupId, displayDate, start, end, null);
3690            }
3691    
3692            /**
3693             * Filters by the user's permissions and finds an ordered range of all the blogs entries where groupId = &#63; and displayDate &lt; &#63;.
3694             *
3695             * <p>
3696             * 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.
3697             * </p>
3698             *
3699             * @param groupId the group id to search with
3700             * @param displayDate the display date to search with
3701             * @param start the lower bound of the range of blogs entries to return
3702             * @param end the upper bound of the range of blogs entries to return (not inclusive)
3703             * @param orderByComparator the comparator to order the results by
3704             * @return the ordered range of matching blogs entries that the user has permission to view
3705             * @throws SystemException if a system exception occurred
3706             */
3707            public List<BlogsEntry> filterFindByG_LtD(long groupId, Date displayDate,
3708                    int start, int end, OrderByComparator orderByComparator)
3709                    throws SystemException {
3710                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3711                            return findByG_LtD(groupId, displayDate, start, end,
3712                                    orderByComparator);
3713                    }
3714    
3715                    Session session = null;
3716    
3717                    try {
3718                            session = openSession();
3719    
3720                            StringBundler query = null;
3721    
3722                            if (orderByComparator != null) {
3723                                    query = new StringBundler(4 +
3724                                                    (orderByComparator.getOrderByFields().length * 3));
3725                            }
3726                            else {
3727                                    query = new StringBundler(4);
3728                            }
3729    
3730                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
3731    
3732                            query.append(_FINDER_COLUMN_G_LTD_GROUPID_2);
3733    
3734                            if (displayDate == null) {
3735                                    query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_1);
3736                            }
3737                            else {
3738                                    query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_2);
3739                            }
3740    
3741                            if (orderByComparator != null) {
3742                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3743                                            orderByComparator);
3744                            }
3745    
3746                            else {
3747                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
3748                            }
3749    
3750                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3751                                            BlogsEntry.class.getName(), _FILTER_COLUMN_PK,
3752                                            _FILTER_COLUMN_USERID, groupId);
3753    
3754                            SQLQuery q = session.createSQLQuery(sql);
3755    
3756                            q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
3757    
3758                            QueryPos qPos = QueryPos.getInstance(q);
3759    
3760                            qPos.add(groupId);
3761    
3762                            if (displayDate != null) {
3763                                    qPos.add(CalendarUtil.getTimestamp(displayDate));
3764                            }
3765    
3766                            return (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start, end);
3767                    }
3768                    catch (Exception e) {
3769                            throw processException(e);
3770                    }
3771                    finally {
3772                            closeSession(session);
3773                    }
3774            }
3775    
3776            /**
3777             * Finds all the blogs entries where groupId = &#63; and status = &#63;.
3778             *
3779             * @param groupId the group id to search with
3780             * @param status the status to search with
3781             * @return the matching blogs entries
3782             * @throws SystemException if a system exception occurred
3783             */
3784            public List<BlogsEntry> findByG_S(long groupId, int status)
3785                    throws SystemException {
3786                    return findByG_S(groupId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
3787                            null);
3788            }
3789    
3790            /**
3791             * Finds a range of all the blogs entries where groupId = &#63; and status = &#63;.
3792             *
3793             * <p>
3794             * 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.
3795             * </p>
3796             *
3797             * @param groupId the group id to search with
3798             * @param status the status to search with
3799             * @param start the lower bound of the range of blogs entries to return
3800             * @param end the upper bound of the range of blogs entries to return (not inclusive)
3801             * @return the range of matching blogs entries
3802             * @throws SystemException if a system exception occurred
3803             */
3804            public List<BlogsEntry> findByG_S(long groupId, int status, int start,
3805                    int end) throws SystemException {
3806                    return findByG_S(groupId, status, start, end, null);
3807            }
3808    
3809            /**
3810             * Finds an ordered range of all the blogs entries where groupId = &#63; and status = &#63;.
3811             *
3812             * <p>
3813             * 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.
3814             * </p>
3815             *
3816             * @param groupId the group id to search with
3817             * @param status the status to search with
3818             * @param start the lower bound of the range of blogs entries to return
3819             * @param end the upper bound of the range of blogs entries to return (not inclusive)
3820             * @param orderByComparator the comparator to order the results by
3821             * @return the ordered range of matching blogs entries
3822             * @throws SystemException if a system exception occurred
3823             */
3824            public List<BlogsEntry> findByG_S(long groupId, int status, int start,
3825                    int end, OrderByComparator orderByComparator) throws SystemException {
3826                    Object[] finderArgs = new Object[] {
3827                                    groupId, status,
3828                                    
3829                                    String.valueOf(start), String.valueOf(end),
3830                                    String.valueOf(orderByComparator)
3831                            };
3832    
3833                    List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_S,
3834                                    finderArgs, this);
3835    
3836                    if (list == null) {
3837                            Session session = null;
3838    
3839                            try {
3840                                    session = openSession();
3841    
3842                                    StringBundler query = null;
3843    
3844                                    if (orderByComparator != null) {
3845                                            query = new StringBundler(4 +
3846                                                            (orderByComparator.getOrderByFields().length * 3));
3847                                    }
3848                                    else {
3849                                            query = new StringBundler(4);
3850                                    }
3851    
3852                                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
3853    
3854                                    query.append(_FINDER_COLUMN_G_S_GROUPID_2);
3855    
3856                                    query.append(_FINDER_COLUMN_G_S_STATUS_2);
3857    
3858                                    if (orderByComparator != null) {
3859                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3860                                                    orderByComparator);
3861                                    }
3862    
3863                                    else {
3864                                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
3865                                    }
3866    
3867                                    String sql = query.toString();
3868    
3869                                    Query q = session.createQuery(sql);
3870    
3871                                    QueryPos qPos = QueryPos.getInstance(q);
3872    
3873                                    qPos.add(groupId);
3874    
3875                                    qPos.add(status);
3876    
3877                                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
3878                                                    end);
3879                            }
3880                            catch (Exception e) {
3881                                    throw processException(e);
3882                            }
3883                            finally {
3884                                    if (list == null) {
3885                                            list = new ArrayList<BlogsEntry>();
3886                                    }
3887    
3888                                    cacheResult(list);
3889    
3890                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_S, finderArgs,
3891                                            list);
3892    
3893                                    closeSession(session);
3894                            }
3895                    }
3896    
3897                    return list;
3898            }
3899    
3900            /**
3901             * Finds the first blogs entry in the ordered set where groupId = &#63; and status = &#63;.
3902             *
3903             * <p>
3904             * 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.
3905             * </p>
3906             *
3907             * @param groupId the group id to search with
3908             * @param status the status to search with
3909             * @param orderByComparator the comparator to order the set by
3910             * @return the first matching blogs entry
3911             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
3912             * @throws SystemException if a system exception occurred
3913             */
3914            public BlogsEntry findByG_S_First(long groupId, int status,
3915                    OrderByComparator orderByComparator)
3916                    throws NoSuchEntryException, SystemException {
3917                    List<BlogsEntry> list = findByG_S(groupId, status, 0, 1,
3918                                    orderByComparator);
3919    
3920                    if (list.isEmpty()) {
3921                            StringBundler msg = new StringBundler(6);
3922    
3923                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3924    
3925                            msg.append("groupId=");
3926                            msg.append(groupId);
3927    
3928                            msg.append(", status=");
3929                            msg.append(status);
3930    
3931                            msg.append(StringPool.CLOSE_CURLY_BRACE);
3932    
3933                            throw new NoSuchEntryException(msg.toString());
3934                    }
3935                    else {
3936                            return list.get(0);
3937                    }
3938            }
3939    
3940            /**
3941             * Finds the last blogs entry in the ordered set where groupId = &#63; and status = &#63;.
3942             *
3943             * <p>
3944             * 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.
3945             * </p>
3946             *
3947             * @param groupId the group id to search with
3948             * @param status the status to search with
3949             * @param orderByComparator the comparator to order the set by
3950             * @return the last matching blogs entry
3951             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
3952             * @throws SystemException if a system exception occurred
3953             */
3954            public BlogsEntry findByG_S_Last(long groupId, int status,
3955                    OrderByComparator orderByComparator)
3956                    throws NoSuchEntryException, SystemException {
3957                    int count = countByG_S(groupId, status);
3958    
3959                    List<BlogsEntry> list = findByG_S(groupId, status, count - 1, count,
3960                                    orderByComparator);
3961    
3962                    if (list.isEmpty()) {
3963                            StringBundler msg = new StringBundler(6);
3964    
3965                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3966    
3967                            msg.append("groupId=");
3968                            msg.append(groupId);
3969    
3970                            msg.append(", status=");
3971                            msg.append(status);
3972    
3973                            msg.append(StringPool.CLOSE_CURLY_BRACE);
3974    
3975                            throw new NoSuchEntryException(msg.toString());
3976                    }
3977                    else {
3978                            return list.get(0);
3979                    }
3980            }
3981    
3982            /**
3983             * Finds the blogs entries before and after the current blogs entry in the ordered set where groupId = &#63; and status = &#63;.
3984             *
3985             * <p>
3986             * 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.
3987             * </p>
3988             *
3989             * @param entryId the primary key of the current blogs entry
3990             * @param groupId the group id to search with
3991             * @param status the status to search with
3992             * @param orderByComparator the comparator to order the set by
3993             * @return the previous, current, and next blogs entry
3994             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
3995             * @throws SystemException if a system exception occurred
3996             */
3997            public BlogsEntry[] findByG_S_PrevAndNext(long entryId, long groupId,
3998                    int status, OrderByComparator orderByComparator)
3999                    throws NoSuchEntryException, SystemException {
4000                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
4001    
4002                    Session session = null;
4003    
4004                    try {
4005                            session = openSession();
4006    
4007                            BlogsEntry[] array = new BlogsEntryImpl[3];
4008    
4009                            array[0] = getByG_S_PrevAndNext(session, blogsEntry, groupId,
4010                                            status, orderByComparator, true);
4011    
4012                            array[1] = blogsEntry;
4013    
4014                            array[2] = getByG_S_PrevAndNext(session, blogsEntry, groupId,
4015                                            status, orderByComparator, false);
4016    
4017                            return array;
4018                    }
4019                    catch (Exception e) {
4020                            throw processException(e);
4021                    }
4022                    finally {
4023                            closeSession(session);
4024                    }
4025            }
4026    
4027            protected BlogsEntry getByG_S_PrevAndNext(Session session,
4028                    BlogsEntry blogsEntry, long groupId, int status,
4029                    OrderByComparator orderByComparator, boolean previous) {
4030                    StringBundler query = null;
4031    
4032                    if (orderByComparator != null) {
4033                            query = new StringBundler(6 +
4034                                            (orderByComparator.getOrderByFields().length * 6));
4035                    }
4036                    else {
4037                            query = new StringBundler(3);
4038                    }
4039    
4040                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
4041    
4042                    query.append(_FINDER_COLUMN_G_S_GROUPID_2);
4043    
4044                    query.append(_FINDER_COLUMN_G_S_STATUS_2);
4045    
4046                    if (orderByComparator != null) {
4047                            String[] orderByFields = orderByComparator.getOrderByFields();
4048    
4049                            if (orderByFields.length > 0) {
4050                                    query.append(WHERE_AND);
4051                            }
4052    
4053                            for (int i = 0; i < orderByFields.length; i++) {
4054                                    query.append(_ORDER_BY_ENTITY_ALIAS);
4055                                    query.append(orderByFields[i]);
4056    
4057                                    if ((i + 1) < orderByFields.length) {
4058                                            if (orderByComparator.isAscending() ^ previous) {
4059                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
4060                                            }
4061                                            else {
4062                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
4063                                            }
4064                                    }
4065                                    else {
4066                                            if (orderByComparator.isAscending() ^ previous) {
4067                                                    query.append(WHERE_GREATER_THAN);
4068                                            }
4069                                            else {
4070                                                    query.append(WHERE_LESSER_THAN);
4071                                            }
4072                                    }
4073                            }
4074    
4075                            query.append(ORDER_BY_CLAUSE);
4076    
4077                            for (int i = 0; i < orderByFields.length; i++) {
4078                                    query.append(_ORDER_BY_ENTITY_ALIAS);
4079                                    query.append(orderByFields[i]);
4080    
4081                                    if ((i + 1) < orderByFields.length) {
4082                                            if (orderByComparator.isAscending() ^ previous) {
4083                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
4084                                            }
4085                                            else {
4086                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
4087                                            }
4088                                    }
4089                                    else {
4090                                            if (orderByComparator.isAscending() ^ previous) {
4091                                                    query.append(ORDER_BY_ASC);
4092                                            }
4093                                            else {
4094                                                    query.append(ORDER_BY_DESC);
4095                                            }
4096                                    }
4097                            }
4098                    }
4099    
4100                    else {
4101                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
4102                    }
4103    
4104                    String sql = query.toString();
4105    
4106                    Query q = session.createQuery(sql);
4107    
4108                    q.setFirstResult(0);
4109                    q.setMaxResults(2);
4110    
4111                    QueryPos qPos = QueryPos.getInstance(q);
4112    
4113                    qPos.add(groupId);
4114    
4115                    qPos.add(status);
4116    
4117                    if (orderByComparator != null) {
4118                            Object[] values = orderByComparator.getOrderByValues(blogsEntry);
4119    
4120                            for (Object value : values) {
4121                                    qPos.add(value);
4122                            }
4123                    }
4124    
4125                    List<BlogsEntry> list = q.list();
4126    
4127                    if (list.size() == 2) {
4128                            return list.get(1);
4129                    }
4130                    else {
4131                            return null;
4132                    }
4133            }
4134    
4135            /**
4136             * Filters by the user's permissions and finds all the blogs entries where groupId = &#63; and status = &#63;.
4137             *
4138             * @param groupId the group id to search with
4139             * @param status the status to search with
4140             * @return the matching blogs entries that the user has permission to view
4141             * @throws SystemException if a system exception occurred
4142             */
4143            public List<BlogsEntry> filterFindByG_S(long groupId, int status)
4144                    throws SystemException {
4145                    return filterFindByG_S(groupId, status, QueryUtil.ALL_POS,
4146                            QueryUtil.ALL_POS, null);
4147            }
4148    
4149            /**
4150             * Filters by the user's permissions and finds a range of all the blogs entries where groupId = &#63; and status = &#63;.
4151             *
4152             * <p>
4153             * 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.
4154             * </p>
4155             *
4156             * @param groupId the group id to search with
4157             * @param status the status to search with
4158             * @param start the lower bound of the range of blogs entries to return
4159             * @param end the upper bound of the range of blogs entries to return (not inclusive)
4160             * @return the range of matching blogs entries that the user has permission to view
4161             * @throws SystemException if a system exception occurred
4162             */
4163            public List<BlogsEntry> filterFindByG_S(long groupId, int status,
4164                    int start, int end) throws SystemException {
4165                    return filterFindByG_S(groupId, status, start, end, null);
4166            }
4167    
4168            /**
4169             * Filters by the user's permissions and finds an ordered range of all the blogs entries where groupId = &#63; and status = &#63;.
4170             *
4171             * <p>
4172             * 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.
4173             * </p>
4174             *
4175             * @param groupId the group id to search with
4176             * @param status the status to search with
4177             * @param start the lower bound of the range of blogs entries to return
4178             * @param end the upper bound of the range of blogs entries to return (not inclusive)
4179             * @param orderByComparator the comparator to order the results by
4180             * @return the ordered range of matching blogs entries that the user has permission to view
4181             * @throws SystemException if a system exception occurred
4182             */
4183            public List<BlogsEntry> filterFindByG_S(long groupId, int status,
4184                    int start, int end, OrderByComparator orderByComparator)
4185                    throws SystemException {
4186                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
4187                            return findByG_S(groupId, status, start, end, orderByComparator);
4188                    }
4189    
4190                    Session session = null;
4191    
4192                    try {
4193                            session = openSession();
4194    
4195                            StringBundler query = null;
4196    
4197                            if (orderByComparator != null) {
4198                                    query = new StringBundler(4 +
4199                                                    (orderByComparator.getOrderByFields().length * 3));
4200                            }
4201                            else {
4202                                    query = new StringBundler(4);
4203                            }
4204    
4205                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
4206    
4207                            query.append(_FINDER_COLUMN_G_S_GROUPID_2);
4208    
4209                            query.append(_FINDER_COLUMN_G_S_STATUS_2);
4210    
4211                            if (orderByComparator != null) {
4212                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
4213                                            orderByComparator);
4214                            }
4215    
4216                            else {
4217                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
4218                            }
4219    
4220                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
4221                                            BlogsEntry.class.getName(), _FILTER_COLUMN_PK,
4222                                            _FILTER_COLUMN_USERID, groupId);
4223    
4224                            SQLQuery q = session.createSQLQuery(sql);
4225    
4226                            q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
4227    
4228                            QueryPos qPos = QueryPos.getInstance(q);
4229    
4230                            qPos.add(groupId);
4231    
4232                            qPos.add(status);
4233    
4234                            return (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start, end);
4235                    }
4236                    catch (Exception e) {
4237                            throw processException(e);
4238                    }
4239                    finally {
4240                            closeSession(session);
4241                    }
4242            }
4243    
4244            /**
4245             * Finds all the blogs entries where companyId = &#63; and userId = &#63; and status = &#63;.
4246             *
4247             * @param companyId the company id to search with
4248             * @param userId the user id to search with
4249             * @param status the status to search with
4250             * @return the matching blogs entries
4251             * @throws SystemException if a system exception occurred
4252             */
4253            public List<BlogsEntry> findByC_U_S(long companyId, long userId, int status)
4254                    throws SystemException {
4255                    return findByC_U_S(companyId, userId, status, QueryUtil.ALL_POS,
4256                            QueryUtil.ALL_POS, null);
4257            }
4258    
4259            /**
4260             * Finds a range of all the blogs entries where companyId = &#63; and userId = &#63; and status = &#63;.
4261             *
4262             * <p>
4263             * 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.
4264             * </p>
4265             *
4266             * @param companyId the company id to search with
4267             * @param userId the user id to search with
4268             * @param status the status to search with
4269             * @param start the lower bound of the range of blogs entries to return
4270             * @param end the upper bound of the range of blogs entries to return (not inclusive)
4271             * @return the range of matching blogs entries
4272             * @throws SystemException if a system exception occurred
4273             */
4274            public List<BlogsEntry> findByC_U_S(long companyId, long userId,
4275                    int status, int start, int end) throws SystemException {
4276                    return findByC_U_S(companyId, userId, status, start, end, null);
4277            }
4278    
4279            /**
4280             * Finds an ordered range of all the blogs entries where companyId = &#63; and userId = &#63; and status = &#63;.
4281             *
4282             * <p>
4283             * 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.
4284             * </p>
4285             *
4286             * @param companyId the company id to search with
4287             * @param userId the user id to search with
4288             * @param status the status to search with
4289             * @param start the lower bound of the range of blogs entries to return
4290             * @param end the upper bound of the range of blogs entries to return (not inclusive)
4291             * @param orderByComparator the comparator to order the results by
4292             * @return the ordered range of matching blogs entries
4293             * @throws SystemException if a system exception occurred
4294             */
4295            public List<BlogsEntry> findByC_U_S(long companyId, long userId,
4296                    int status, int start, int end, OrderByComparator orderByComparator)
4297                    throws SystemException {
4298                    Object[] finderArgs = new Object[] {
4299                                    companyId, userId, status,
4300                                    
4301                                    String.valueOf(start), String.valueOf(end),
4302                                    String.valueOf(orderByComparator)
4303                            };
4304    
4305                    List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_U_S,
4306                                    finderArgs, this);
4307    
4308                    if (list == null) {
4309                            Session session = null;
4310    
4311                            try {
4312                                    session = openSession();
4313    
4314                                    StringBundler query = null;
4315    
4316                                    if (orderByComparator != null) {
4317                                            query = new StringBundler(5 +
4318                                                            (orderByComparator.getOrderByFields().length * 3));
4319                                    }
4320                                    else {
4321                                            query = new StringBundler(5);
4322                                    }
4323    
4324                                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
4325    
4326                                    query.append(_FINDER_COLUMN_C_U_S_COMPANYID_2);
4327    
4328                                    query.append(_FINDER_COLUMN_C_U_S_USERID_2);
4329    
4330                                    query.append(_FINDER_COLUMN_C_U_S_STATUS_2);
4331    
4332                                    if (orderByComparator != null) {
4333                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
4334                                                    orderByComparator);
4335                                    }
4336    
4337                                    else {
4338                                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
4339                                    }
4340    
4341                                    String sql = query.toString();
4342    
4343                                    Query q = session.createQuery(sql);
4344    
4345                                    QueryPos qPos = QueryPos.getInstance(q);
4346    
4347                                    qPos.add(companyId);
4348    
4349                                    qPos.add(userId);
4350    
4351                                    qPos.add(status);
4352    
4353                                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
4354                                                    end);
4355                            }
4356                            catch (Exception e) {
4357                                    throw processException(e);
4358                            }
4359                            finally {
4360                                    if (list == null) {
4361                                            list = new ArrayList<BlogsEntry>();
4362                                    }
4363    
4364                                    cacheResult(list);
4365    
4366                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_U_S,
4367                                            finderArgs, list);
4368    
4369                                    closeSession(session);
4370                            }
4371                    }
4372    
4373                    return list;
4374            }
4375    
4376            /**
4377             * Finds the first blogs entry in the ordered set where companyId = &#63; and userId = &#63; and status = &#63;.
4378             *
4379             * <p>
4380             * 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.
4381             * </p>
4382             *
4383             * @param companyId the company id to search with
4384             * @param userId the user id to search with
4385             * @param status the status to search with
4386             * @param orderByComparator the comparator to order the set by
4387             * @return the first matching blogs entry
4388             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
4389             * @throws SystemException if a system exception occurred
4390             */
4391            public BlogsEntry findByC_U_S_First(long companyId, long userId,
4392                    int status, OrderByComparator orderByComparator)
4393                    throws NoSuchEntryException, SystemException {
4394                    List<BlogsEntry> list = findByC_U_S(companyId, userId, status, 0, 1,
4395                                    orderByComparator);
4396    
4397                    if (list.isEmpty()) {
4398                            StringBundler msg = new StringBundler(8);
4399    
4400                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4401    
4402                            msg.append("companyId=");
4403                            msg.append(companyId);
4404    
4405                            msg.append(", userId=");
4406                            msg.append(userId);
4407    
4408                            msg.append(", status=");
4409                            msg.append(status);
4410    
4411                            msg.append(StringPool.CLOSE_CURLY_BRACE);
4412    
4413                            throw new NoSuchEntryException(msg.toString());
4414                    }
4415                    else {
4416                            return list.get(0);
4417                    }
4418            }
4419    
4420            /**
4421             * Finds the last blogs entry in the ordered set where companyId = &#63; and userId = &#63; and status = &#63;.
4422             *
4423             * <p>
4424             * 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.
4425             * </p>
4426             *
4427             * @param companyId the company id to search with
4428             * @param userId the user id to search with
4429             * @param status the status to search with
4430             * @param orderByComparator the comparator to order the set by
4431             * @return the last matching blogs entry
4432             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
4433             * @throws SystemException if a system exception occurred
4434             */
4435            public BlogsEntry findByC_U_S_Last(long companyId, long userId, int status,
4436                    OrderByComparator orderByComparator)
4437                    throws NoSuchEntryException, SystemException {
4438                    int count = countByC_U_S(companyId, userId, status);
4439    
4440                    List<BlogsEntry> list = findByC_U_S(companyId, userId, status,
4441                                    count - 1, count, orderByComparator);
4442    
4443                    if (list.isEmpty()) {
4444                            StringBundler msg = new StringBundler(8);
4445    
4446                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4447    
4448                            msg.append("companyId=");
4449                            msg.append(companyId);
4450    
4451                            msg.append(", userId=");
4452                            msg.append(userId);
4453    
4454                            msg.append(", status=");
4455                            msg.append(status);
4456    
4457                            msg.append(StringPool.CLOSE_CURLY_BRACE);
4458    
4459                            throw new NoSuchEntryException(msg.toString());
4460                    }
4461                    else {
4462                            return list.get(0);
4463                    }
4464            }
4465    
4466            /**
4467             * Finds the blogs entries before and after the current blogs entry in the ordered set where companyId = &#63; and userId = &#63; and status = &#63;.
4468             *
4469             * <p>
4470             * 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.
4471             * </p>
4472             *
4473             * @param entryId the primary key of the current blogs entry
4474             * @param companyId the company id to search with
4475             * @param userId the user id to search with
4476             * @param status the status to search with
4477             * @param orderByComparator the comparator to order the set by
4478             * @return the previous, current, and next blogs entry
4479             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
4480             * @throws SystemException if a system exception occurred
4481             */
4482            public BlogsEntry[] findByC_U_S_PrevAndNext(long entryId, long companyId,
4483                    long userId, int status, OrderByComparator orderByComparator)
4484                    throws NoSuchEntryException, SystemException {
4485                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
4486    
4487                    Session session = null;
4488    
4489                    try {
4490                            session = openSession();
4491    
4492                            BlogsEntry[] array = new BlogsEntryImpl[3];
4493    
4494                            array[0] = getByC_U_S_PrevAndNext(session, blogsEntry, companyId,
4495                                            userId, status, orderByComparator, true);
4496    
4497                            array[1] = blogsEntry;
4498    
4499                            array[2] = getByC_U_S_PrevAndNext(session, blogsEntry, companyId,
4500                                            userId, status, orderByComparator, false);
4501    
4502                            return array;
4503                    }
4504                    catch (Exception e) {
4505                            throw processException(e);
4506                    }
4507                    finally {
4508                            closeSession(session);
4509                    }
4510            }
4511    
4512            protected BlogsEntry getByC_U_S_PrevAndNext(Session session,
4513                    BlogsEntry blogsEntry, long companyId, long userId, int status,
4514                    OrderByComparator orderByComparator, boolean previous) {
4515                    StringBundler query = null;
4516    
4517                    if (orderByComparator != null) {
4518                            query = new StringBundler(6 +
4519                                            (orderByComparator.getOrderByFields().length * 6));
4520                    }
4521                    else {
4522                            query = new StringBundler(3);
4523                    }
4524    
4525                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
4526    
4527                    query.append(_FINDER_COLUMN_C_U_S_COMPANYID_2);
4528    
4529                    query.append(_FINDER_COLUMN_C_U_S_USERID_2);
4530    
4531                    query.append(_FINDER_COLUMN_C_U_S_STATUS_2);
4532    
4533                    if (orderByComparator != null) {
4534                            String[] orderByFields = orderByComparator.getOrderByFields();
4535    
4536                            if (orderByFields.length > 0) {
4537                                    query.append(WHERE_AND);
4538                            }
4539    
4540                            for (int i = 0; i < orderByFields.length; i++) {
4541                                    query.append(_ORDER_BY_ENTITY_ALIAS);
4542                                    query.append(orderByFields[i]);
4543    
4544                                    if ((i + 1) < orderByFields.length) {
4545                                            if (orderByComparator.isAscending() ^ previous) {
4546                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
4547                                            }
4548                                            else {
4549                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
4550                                            }
4551                                    }
4552                                    else {
4553                                            if (orderByComparator.isAscending() ^ previous) {
4554                                                    query.append(WHERE_GREATER_THAN);
4555                                            }
4556                                            else {
4557                                                    query.append(WHERE_LESSER_THAN);
4558                                            }
4559                                    }
4560                            }
4561    
4562                            query.append(ORDER_BY_CLAUSE);
4563    
4564                            for (int i = 0; i < orderByFields.length; i++) {
4565                                    query.append(_ORDER_BY_ENTITY_ALIAS);
4566                                    query.append(orderByFields[i]);
4567    
4568                                    if ((i + 1) < orderByFields.length) {
4569                                            if (orderByComparator.isAscending() ^ previous) {
4570                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
4571                                            }
4572                                            else {
4573                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
4574                                            }
4575                                    }
4576                                    else {
4577                                            if (orderByComparator.isAscending() ^ previous) {
4578                                                    query.append(ORDER_BY_ASC);
4579                                            }
4580                                            else {
4581                                                    query.append(ORDER_BY_DESC);
4582                                            }
4583                                    }
4584                            }
4585                    }
4586    
4587                    else {
4588                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
4589                    }
4590    
4591                    String sql = query.toString();
4592    
4593                    Query q = session.createQuery(sql);
4594    
4595                    q.setFirstResult(0);
4596                    q.setMaxResults(2);
4597    
4598                    QueryPos qPos = QueryPos.getInstance(q);
4599    
4600                    qPos.add(companyId);
4601    
4602                    qPos.add(userId);
4603    
4604                    qPos.add(status);
4605    
4606                    if (orderByComparator != null) {
4607                            Object[] values = orderByComparator.getOrderByValues(blogsEntry);
4608    
4609                            for (Object value : values) {
4610                                    qPos.add(value);
4611                            }
4612                    }
4613    
4614                    List<BlogsEntry> list = q.list();
4615    
4616                    if (list.size() == 2) {
4617                            return list.get(1);
4618                    }
4619                    else {
4620                            return null;
4621                    }
4622            }
4623    
4624            /**
4625             * Finds all the blogs entries where companyId = &#63; and displayDate &lt; &#63; and status = &#63;.
4626             *
4627             * @param companyId the company id to search with
4628             * @param displayDate the display date to search with
4629             * @param status the status to search with
4630             * @return the matching blogs entries
4631             * @throws SystemException if a system exception occurred
4632             */
4633            public List<BlogsEntry> findByC_LtD_S(long companyId, Date displayDate,
4634                    int status) throws SystemException {
4635                    return findByC_LtD_S(companyId, displayDate, status, QueryUtil.ALL_POS,
4636                            QueryUtil.ALL_POS, null);
4637            }
4638    
4639            /**
4640             * Finds a range of all the blogs entries where companyId = &#63; and displayDate &lt; &#63; and status = &#63;.
4641             *
4642             * <p>
4643             * 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.
4644             * </p>
4645             *
4646             * @param companyId the company id to search with
4647             * @param displayDate the display date to search with
4648             * @param status the status to search with
4649             * @param start the lower bound of the range of blogs entries to return
4650             * @param end the upper bound of the range of blogs entries to return (not inclusive)
4651             * @return the range of matching blogs entries
4652             * @throws SystemException if a system exception occurred
4653             */
4654            public List<BlogsEntry> findByC_LtD_S(long companyId, Date displayDate,
4655                    int status, int start, int end) throws SystemException {
4656                    return findByC_LtD_S(companyId, displayDate, status, start, end, null);
4657            }
4658    
4659            /**
4660             * Finds an ordered range of all the blogs entries where companyId = &#63; and displayDate &lt; &#63; and status = &#63;.
4661             *
4662             * <p>
4663             * 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.
4664             * </p>
4665             *
4666             * @param companyId the company id to search with
4667             * @param displayDate the display date to search with
4668             * @param status the status to search with
4669             * @param start the lower bound of the range of blogs entries to return
4670             * @param end the upper bound of the range of blogs entries to return (not inclusive)
4671             * @param orderByComparator the comparator to order the results by
4672             * @return the ordered range of matching blogs entries
4673             * @throws SystemException if a system exception occurred
4674             */
4675            public List<BlogsEntry> findByC_LtD_S(long companyId, Date displayDate,
4676                    int status, int start, int end, OrderByComparator orderByComparator)
4677                    throws SystemException {
4678                    Object[] finderArgs = new Object[] {
4679                                    companyId, displayDate, status,
4680                                    
4681                                    String.valueOf(start), String.valueOf(end),
4682                                    String.valueOf(orderByComparator)
4683                            };
4684    
4685                    List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_LTD_S,
4686                                    finderArgs, this);
4687    
4688                    if (list == null) {
4689                            Session session = null;
4690    
4691                            try {
4692                                    session = openSession();
4693    
4694                                    StringBundler query = null;
4695    
4696                                    if (orderByComparator != null) {
4697                                            query = new StringBundler(5 +
4698                                                            (orderByComparator.getOrderByFields().length * 3));
4699                                    }
4700                                    else {
4701                                            query = new StringBundler(5);
4702                                    }
4703    
4704                                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
4705    
4706                                    query.append(_FINDER_COLUMN_C_LTD_S_COMPANYID_2);
4707    
4708                                    if (displayDate == null) {
4709                                            query.append(_FINDER_COLUMN_C_LTD_S_DISPLAYDATE_1);
4710                                    }
4711                                    else {
4712                                            query.append(_FINDER_COLUMN_C_LTD_S_DISPLAYDATE_2);
4713                                    }
4714    
4715                                    query.append(_FINDER_COLUMN_C_LTD_S_STATUS_2);
4716    
4717                                    if (orderByComparator != null) {
4718                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
4719                                                    orderByComparator);
4720                                    }
4721    
4722                                    else {
4723                                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
4724                                    }
4725    
4726                                    String sql = query.toString();
4727    
4728                                    Query q = session.createQuery(sql);
4729    
4730                                    QueryPos qPos = QueryPos.getInstance(q);
4731    
4732                                    qPos.add(companyId);
4733    
4734                                    if (displayDate != null) {
4735                                            qPos.add(CalendarUtil.getTimestamp(displayDate));
4736                                    }
4737    
4738                                    qPos.add(status);
4739    
4740                                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
4741                                                    end);
4742                            }
4743                            catch (Exception e) {
4744                                    throw processException(e);
4745                            }
4746                            finally {
4747                                    if (list == null) {
4748                                            list = new ArrayList<BlogsEntry>();
4749                                    }
4750    
4751                                    cacheResult(list);
4752    
4753                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_LTD_S,
4754                                            finderArgs, list);
4755    
4756                                    closeSession(session);
4757                            }
4758                    }
4759    
4760                    return list;
4761            }
4762    
4763            /**
4764             * Finds the first blogs entry in the ordered set where companyId = &#63; and displayDate &lt; &#63; and status = &#63;.
4765             *
4766             * <p>
4767             * 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.
4768             * </p>
4769             *
4770             * @param companyId the company id to search with
4771             * @param displayDate the display date to search with
4772             * @param status the status to search with
4773             * @param orderByComparator the comparator to order the set by
4774             * @return the first matching blogs entry
4775             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
4776             * @throws SystemException if a system exception occurred
4777             */
4778            public BlogsEntry findByC_LtD_S_First(long companyId, Date displayDate,
4779                    int status, OrderByComparator orderByComparator)
4780                    throws NoSuchEntryException, SystemException {
4781                    List<BlogsEntry> list = findByC_LtD_S(companyId, displayDate, status,
4782                                    0, 1, orderByComparator);
4783    
4784                    if (list.isEmpty()) {
4785                            StringBundler msg = new StringBundler(8);
4786    
4787                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4788    
4789                            msg.append("companyId=");
4790                            msg.append(companyId);
4791    
4792                            msg.append(", displayDate=");
4793                            msg.append(displayDate);
4794    
4795                            msg.append(", status=");
4796                            msg.append(status);
4797    
4798                            msg.append(StringPool.CLOSE_CURLY_BRACE);
4799    
4800                            throw new NoSuchEntryException(msg.toString());
4801                    }
4802                    else {
4803                            return list.get(0);
4804                    }
4805            }
4806    
4807            /**
4808             * Finds the last blogs entry in the ordered set where companyId = &#63; and displayDate &lt; &#63; and status = &#63;.
4809             *
4810             * <p>
4811             * 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.
4812             * </p>
4813             *
4814             * @param companyId the company id to search with
4815             * @param displayDate the display date to search with
4816             * @param status the status to search with
4817             * @param orderByComparator the comparator to order the set by
4818             * @return the last matching blogs entry
4819             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
4820             * @throws SystemException if a system exception occurred
4821             */
4822            public BlogsEntry findByC_LtD_S_Last(long companyId, Date displayDate,
4823                    int status, OrderByComparator orderByComparator)
4824                    throws NoSuchEntryException, SystemException {
4825                    int count = countByC_LtD_S(companyId, displayDate, status);
4826    
4827                    List<BlogsEntry> list = findByC_LtD_S(companyId, displayDate, status,
4828                                    count - 1, count, orderByComparator);
4829    
4830                    if (list.isEmpty()) {
4831                            StringBundler msg = new StringBundler(8);
4832    
4833                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4834    
4835                            msg.append("companyId=");
4836                            msg.append(companyId);
4837    
4838                            msg.append(", displayDate=");
4839                            msg.append(displayDate);
4840    
4841                            msg.append(", status=");
4842                            msg.append(status);
4843    
4844                            msg.append(StringPool.CLOSE_CURLY_BRACE);
4845    
4846                            throw new NoSuchEntryException(msg.toString());
4847                    }
4848                    else {
4849                            return list.get(0);
4850                    }
4851            }
4852    
4853            /**
4854             * Finds the blogs entries before and after the current blogs entry in the ordered set where companyId = &#63; and displayDate &lt; &#63; and status = &#63;.
4855             *
4856             * <p>
4857             * 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.
4858             * </p>
4859             *
4860             * @param entryId the primary key of the current blogs entry
4861             * @param companyId the company id to search with
4862             * @param displayDate the display date to search with
4863             * @param status the status to search with
4864             * @param orderByComparator the comparator to order the set by
4865             * @return the previous, current, and next blogs entry
4866             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
4867             * @throws SystemException if a system exception occurred
4868             */
4869            public BlogsEntry[] findByC_LtD_S_PrevAndNext(long entryId, long companyId,
4870                    Date displayDate, int status, OrderByComparator orderByComparator)
4871                    throws NoSuchEntryException, SystemException {
4872                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
4873    
4874                    Session session = null;
4875    
4876                    try {
4877                            session = openSession();
4878    
4879                            BlogsEntry[] array = new BlogsEntryImpl[3];
4880    
4881                            array[0] = getByC_LtD_S_PrevAndNext(session, blogsEntry, companyId,
4882                                            displayDate, status, orderByComparator, true);
4883    
4884                            array[1] = blogsEntry;
4885    
4886                            array[2] = getByC_LtD_S_PrevAndNext(session, blogsEntry, companyId,
4887                                            displayDate, status, orderByComparator, false);
4888    
4889                            return array;
4890                    }
4891                    catch (Exception e) {
4892                            throw processException(e);
4893                    }
4894                    finally {
4895                            closeSession(session);
4896                    }
4897            }
4898    
4899            protected BlogsEntry getByC_LtD_S_PrevAndNext(Session session,
4900                    BlogsEntry blogsEntry, long companyId, Date displayDate, int status,
4901                    OrderByComparator orderByComparator, boolean previous) {
4902                    StringBundler query = null;
4903    
4904                    if (orderByComparator != null) {
4905                            query = new StringBundler(6 +
4906                                            (orderByComparator.getOrderByFields().length * 6));
4907                    }
4908                    else {
4909                            query = new StringBundler(3);
4910                    }
4911    
4912                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
4913    
4914                    query.append(_FINDER_COLUMN_C_LTD_S_COMPANYID_2);
4915    
4916                    if (displayDate == null) {
4917                            query.append(_FINDER_COLUMN_C_LTD_S_DISPLAYDATE_1);
4918                    }
4919                    else {
4920                            query.append(_FINDER_COLUMN_C_LTD_S_DISPLAYDATE_2);
4921                    }
4922    
4923                    query.append(_FINDER_COLUMN_C_LTD_S_STATUS_2);
4924    
4925                    if (orderByComparator != null) {
4926                            String[] orderByFields = orderByComparator.getOrderByFields();
4927    
4928                            if (orderByFields.length > 0) {
4929                                    query.append(WHERE_AND);
4930                            }
4931    
4932                            for (int i = 0; i < orderByFields.length; i++) {
4933                                    query.append(_ORDER_BY_ENTITY_ALIAS);
4934                                    query.append(orderByFields[i]);
4935    
4936                                    if ((i + 1) < orderByFields.length) {
4937                                            if (orderByComparator.isAscending() ^ previous) {
4938                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
4939                                            }
4940                                            else {
4941                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
4942                                            }
4943                                    }
4944                                    else {
4945                                            if (orderByComparator.isAscending() ^ previous) {
4946                                                    query.append(WHERE_GREATER_THAN);
4947                                            }
4948                                            else {
4949                                                    query.append(WHERE_LESSER_THAN);
4950                                            }
4951                                    }
4952                            }
4953    
4954                            query.append(ORDER_BY_CLAUSE);
4955    
4956                            for (int i = 0; i < orderByFields.length; i++) {
4957                                    query.append(_ORDER_BY_ENTITY_ALIAS);
4958                                    query.append(orderByFields[i]);
4959    
4960                                    if ((i + 1) < orderByFields.length) {
4961                                            if (orderByComparator.isAscending() ^ previous) {
4962                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
4963                                            }
4964                                            else {
4965                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
4966                                            }
4967                                    }
4968                                    else {
4969                                            if (orderByComparator.isAscending() ^ previous) {
4970                                                    query.append(ORDER_BY_ASC);
4971                                            }
4972                                            else {
4973                                                    query.append(ORDER_BY_DESC);
4974                                            }
4975                                    }
4976                            }
4977                    }
4978    
4979                    else {
4980                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
4981                    }
4982    
4983                    String sql = query.toString();
4984    
4985                    Query q = session.createQuery(sql);
4986    
4987                    q.setFirstResult(0);
4988                    q.setMaxResults(2);
4989    
4990                    QueryPos qPos = QueryPos.getInstance(q);
4991    
4992                    qPos.add(companyId);
4993    
4994                    if (displayDate != null) {
4995                            qPos.add(CalendarUtil.getTimestamp(displayDate));
4996                    }
4997    
4998                    qPos.add(status);
4999    
5000                    if (orderByComparator != null) {
5001                            Object[] values = orderByComparator.getOrderByValues(blogsEntry);
5002    
5003                            for (Object value : values) {
5004                                    qPos.add(value);
5005                            }
5006                    }
5007    
5008                    List<BlogsEntry> list = q.list();
5009    
5010                    if (list.size() == 2) {
5011                            return list.get(1);
5012                    }
5013                    else {
5014                            return null;
5015                    }
5016            }
5017    
5018            /**
5019             * Finds all the blogs entries where groupId = &#63; and userId = &#63; and displayDate &lt; &#63;.
5020             *
5021             * @param groupId the group id to search with
5022             * @param userId the user id to search with
5023             * @param displayDate the display date to search with
5024             * @return the matching blogs entries
5025             * @throws SystemException if a system exception occurred
5026             */
5027            public List<BlogsEntry> findByG_U_LtD(long groupId, long userId,
5028                    Date displayDate) throws SystemException {
5029                    return findByG_U_LtD(groupId, userId, displayDate, QueryUtil.ALL_POS,
5030                            QueryUtil.ALL_POS, null);
5031            }
5032    
5033            /**
5034             * Finds a range of all the blogs entries where groupId = &#63; and userId = &#63; and displayDate &lt; &#63;.
5035             *
5036             * <p>
5037             * 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.
5038             * </p>
5039             *
5040             * @param groupId the group id to search with
5041             * @param userId the user id to search with
5042             * @param displayDate the display date to search with
5043             * @param start the lower bound of the range of blogs entries to return
5044             * @param end the upper bound of the range of blogs entries to return (not inclusive)
5045             * @return the range of matching blogs entries
5046             * @throws SystemException if a system exception occurred
5047             */
5048            public List<BlogsEntry> findByG_U_LtD(long groupId, long userId,
5049                    Date displayDate, int start, int end) throws SystemException {
5050                    return findByG_U_LtD(groupId, userId, displayDate, start, end, null);
5051            }
5052    
5053            /**
5054             * Finds an ordered range of all the blogs entries where groupId = &#63; and userId = &#63; and displayDate &lt; &#63;.
5055             *
5056             * <p>
5057             * 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.
5058             * </p>
5059             *
5060             * @param groupId the group id to search with
5061             * @param userId the user id to search with
5062             * @param displayDate the display date to search with
5063             * @param start the lower bound of the range of blogs entries to return
5064             * @param end the upper bound of the range of blogs entries to return (not inclusive)
5065             * @param orderByComparator the comparator to order the results by
5066             * @return the ordered range of matching blogs entries
5067             * @throws SystemException if a system exception occurred
5068             */
5069            public List<BlogsEntry> findByG_U_LtD(long groupId, long userId,
5070                    Date displayDate, int start, int end,
5071                    OrderByComparator orderByComparator) throws SystemException {
5072                    Object[] finderArgs = new Object[] {
5073                                    groupId, userId, displayDate,
5074                                    
5075                                    String.valueOf(start), String.valueOf(end),
5076                                    String.valueOf(orderByComparator)
5077                            };
5078    
5079                    List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_U_LTD,
5080                                    finderArgs, this);
5081    
5082                    if (list == null) {
5083                            Session session = null;
5084    
5085                            try {
5086                                    session = openSession();
5087    
5088                                    StringBundler query = null;
5089    
5090                                    if (orderByComparator != null) {
5091                                            query = new StringBundler(5 +
5092                                                            (orderByComparator.getOrderByFields().length * 3));
5093                                    }
5094                                    else {
5095                                            query = new StringBundler(5);
5096                                    }
5097    
5098                                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
5099    
5100                                    query.append(_FINDER_COLUMN_G_U_LTD_GROUPID_2);
5101    
5102                                    query.append(_FINDER_COLUMN_G_U_LTD_USERID_2);
5103    
5104                                    if (displayDate == null) {
5105                                            query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_1);
5106                                    }
5107                                    else {
5108                                            query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_2);
5109                                    }
5110    
5111                                    if (orderByComparator != null) {
5112                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
5113                                                    orderByComparator);
5114                                    }
5115    
5116                                    else {
5117                                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
5118                                    }
5119    
5120                                    String sql = query.toString();
5121    
5122                                    Query q = session.createQuery(sql);
5123    
5124                                    QueryPos qPos = QueryPos.getInstance(q);
5125    
5126                                    qPos.add(groupId);
5127    
5128                                    qPos.add(userId);
5129    
5130                                    if (displayDate != null) {
5131                                            qPos.add(CalendarUtil.getTimestamp(displayDate));
5132                                    }
5133    
5134                                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
5135                                                    end);
5136                            }
5137                            catch (Exception e) {
5138                                    throw processException(e);
5139                            }
5140                            finally {
5141                                    if (list == null) {
5142                                            list = new ArrayList<BlogsEntry>();
5143                                    }
5144    
5145                                    cacheResult(list);
5146    
5147                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_U_LTD,
5148                                            finderArgs, list);
5149    
5150                                    closeSession(session);
5151                            }
5152                    }
5153    
5154                    return list;
5155            }
5156    
5157            /**
5158             * Finds the first blogs entry in the ordered set where groupId = &#63; and userId = &#63; and displayDate &lt; &#63;.
5159             *
5160             * <p>
5161             * 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.
5162             * </p>
5163             *
5164             * @param groupId the group id to search with
5165             * @param userId the user id to search with
5166             * @param displayDate the display date to search with
5167             * @param orderByComparator the comparator to order the set by
5168             * @return the first matching blogs entry
5169             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
5170             * @throws SystemException if a system exception occurred
5171             */
5172            public BlogsEntry findByG_U_LtD_First(long groupId, long userId,
5173                    Date displayDate, OrderByComparator orderByComparator)
5174                    throws NoSuchEntryException, SystemException {
5175                    List<BlogsEntry> list = findByG_U_LtD(groupId, userId, displayDate, 0,
5176                                    1, orderByComparator);
5177    
5178                    if (list.isEmpty()) {
5179                            StringBundler msg = new StringBundler(8);
5180    
5181                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
5182    
5183                            msg.append("groupId=");
5184                            msg.append(groupId);
5185    
5186                            msg.append(", userId=");
5187                            msg.append(userId);
5188    
5189                            msg.append(", displayDate=");
5190                            msg.append(displayDate);
5191    
5192                            msg.append(StringPool.CLOSE_CURLY_BRACE);
5193    
5194                            throw new NoSuchEntryException(msg.toString());
5195                    }
5196                    else {
5197                            return list.get(0);
5198                    }
5199            }
5200    
5201            /**
5202             * Finds the last blogs entry in the ordered set where groupId = &#63; and userId = &#63; and displayDate &lt; &#63;.
5203             *
5204             * <p>
5205             * 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.
5206             * </p>
5207             *
5208             * @param groupId the group id to search with
5209             * @param userId the user id to search with
5210             * @param displayDate the display date to search with
5211             * @param orderByComparator the comparator to order the set by
5212             * @return the last matching blogs entry
5213             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
5214             * @throws SystemException if a system exception occurred
5215             */
5216            public BlogsEntry findByG_U_LtD_Last(long groupId, long userId,
5217                    Date displayDate, OrderByComparator orderByComparator)
5218                    throws NoSuchEntryException, SystemException {
5219                    int count = countByG_U_LtD(groupId, userId, displayDate);
5220    
5221                    List<BlogsEntry> list = findByG_U_LtD(groupId, userId, displayDate,
5222                                    count - 1, count, orderByComparator);
5223    
5224                    if (list.isEmpty()) {
5225                            StringBundler msg = new StringBundler(8);
5226    
5227                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
5228    
5229                            msg.append("groupId=");
5230                            msg.append(groupId);
5231    
5232                            msg.append(", userId=");
5233                            msg.append(userId);
5234    
5235                            msg.append(", displayDate=");
5236                            msg.append(displayDate);
5237    
5238                            msg.append(StringPool.CLOSE_CURLY_BRACE);
5239    
5240                            throw new NoSuchEntryException(msg.toString());
5241                    }
5242                    else {
5243                            return list.get(0);
5244                    }
5245            }
5246    
5247            /**
5248             * Finds the blogs entries before and after the current blogs entry in the ordered set where groupId = &#63; and userId = &#63; and displayDate &lt; &#63;.
5249             *
5250             * <p>
5251             * 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.
5252             * </p>
5253             *
5254             * @param entryId the primary key of the current blogs entry
5255             * @param groupId the group id to search with
5256             * @param userId the user id to search with
5257             * @param displayDate the display date to search with
5258             * @param orderByComparator the comparator to order the set by
5259             * @return the previous, current, and next blogs entry
5260             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
5261             * @throws SystemException if a system exception occurred
5262             */
5263            public BlogsEntry[] findByG_U_LtD_PrevAndNext(long entryId, long groupId,
5264                    long userId, Date displayDate, OrderByComparator orderByComparator)
5265                    throws NoSuchEntryException, SystemException {
5266                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
5267    
5268                    Session session = null;
5269    
5270                    try {
5271                            session = openSession();
5272    
5273                            BlogsEntry[] array = new BlogsEntryImpl[3];
5274    
5275                            array[0] = getByG_U_LtD_PrevAndNext(session, blogsEntry, groupId,
5276                                            userId, displayDate, orderByComparator, true);
5277    
5278                            array[1] = blogsEntry;
5279    
5280                            array[2] = getByG_U_LtD_PrevAndNext(session, blogsEntry, groupId,
5281                                            userId, displayDate, orderByComparator, false);
5282    
5283                            return array;
5284                    }
5285                    catch (Exception e) {
5286                            throw processException(e);
5287                    }
5288                    finally {
5289                            closeSession(session);
5290                    }
5291            }
5292    
5293            protected BlogsEntry getByG_U_LtD_PrevAndNext(Session session,
5294                    BlogsEntry blogsEntry, long groupId, long userId, Date displayDate,
5295                    OrderByComparator orderByComparator, boolean previous) {
5296                    StringBundler query = null;
5297    
5298                    if (orderByComparator != null) {
5299                            query = new StringBundler(6 +
5300                                            (orderByComparator.getOrderByFields().length * 6));
5301                    }
5302                    else {
5303                            query = new StringBundler(3);
5304                    }
5305    
5306                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
5307    
5308                    query.append(_FINDER_COLUMN_G_U_LTD_GROUPID_2);
5309    
5310                    query.append(_FINDER_COLUMN_G_U_LTD_USERID_2);
5311    
5312                    if (displayDate == null) {
5313                            query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_1);
5314                    }
5315                    else {
5316                            query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_2);
5317                    }
5318    
5319                    if (orderByComparator != null) {
5320                            String[] orderByFields = orderByComparator.getOrderByFields();
5321    
5322                            if (orderByFields.length > 0) {
5323                                    query.append(WHERE_AND);
5324                            }
5325    
5326                            for (int i = 0; i < orderByFields.length; i++) {
5327                                    query.append(_ORDER_BY_ENTITY_ALIAS);
5328                                    query.append(orderByFields[i]);
5329    
5330                                    if ((i + 1) < orderByFields.length) {
5331                                            if (orderByComparator.isAscending() ^ previous) {
5332                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
5333                                            }
5334                                            else {
5335                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
5336                                            }
5337                                    }
5338                                    else {
5339                                            if (orderByComparator.isAscending() ^ previous) {
5340                                                    query.append(WHERE_GREATER_THAN);
5341                                            }
5342                                            else {
5343                                                    query.append(WHERE_LESSER_THAN);
5344                                            }
5345                                    }
5346                            }
5347    
5348                            query.append(ORDER_BY_CLAUSE);
5349    
5350                            for (int i = 0; i < orderByFields.length; i++) {
5351                                    query.append(_ORDER_BY_ENTITY_ALIAS);
5352                                    query.append(orderByFields[i]);
5353    
5354                                    if ((i + 1) < orderByFields.length) {
5355                                            if (orderByComparator.isAscending() ^ previous) {
5356                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
5357                                            }
5358                                            else {
5359                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
5360                                            }
5361                                    }
5362                                    else {
5363                                            if (orderByComparator.isAscending() ^ previous) {
5364                                                    query.append(ORDER_BY_ASC);
5365                                            }
5366                                            else {
5367                                                    query.append(ORDER_BY_DESC);
5368                                            }
5369                                    }
5370                            }
5371                    }
5372    
5373                    else {
5374                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
5375                    }
5376    
5377                    String sql = query.toString();
5378    
5379                    Query q = session.createQuery(sql);
5380    
5381                    q.setFirstResult(0);
5382                    q.setMaxResults(2);
5383    
5384                    QueryPos qPos = QueryPos.getInstance(q);
5385    
5386                    qPos.add(groupId);
5387    
5388                    qPos.add(userId);
5389    
5390                    if (displayDate != null) {
5391                            qPos.add(CalendarUtil.getTimestamp(displayDate));
5392                    }
5393    
5394                    if (orderByComparator != null) {
5395                            Object[] values = orderByComparator.getOrderByValues(blogsEntry);
5396    
5397                            for (Object value : values) {
5398                                    qPos.add(value);
5399                            }
5400                    }
5401    
5402                    List<BlogsEntry> list = q.list();
5403    
5404                    if (list.size() == 2) {
5405                            return list.get(1);
5406                    }
5407                    else {
5408                            return null;
5409                    }
5410            }
5411    
5412            /**
5413             * Filters by the user's permissions and finds all the blogs entries where groupId = &#63; and userId = &#63; and displayDate &lt; &#63;.
5414             *
5415             * @param groupId the group id to search with
5416             * @param userId the user id to search with
5417             * @param displayDate the display date to search with
5418             * @return the matching blogs entries that the user has permission to view
5419             * @throws SystemException if a system exception occurred
5420             */
5421            public List<BlogsEntry> filterFindByG_U_LtD(long groupId, long userId,
5422                    Date displayDate) throws SystemException {
5423                    return filterFindByG_U_LtD(groupId, userId, displayDate,
5424                            QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
5425            }
5426    
5427            /**
5428             * Filters by the user's permissions and finds a range of all the blogs entries where groupId = &#63; and userId = &#63; and displayDate &lt; &#63;.
5429             *
5430             * <p>
5431             * 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.
5432             * </p>
5433             *
5434             * @param groupId the group id to search with
5435             * @param userId the user id to search with
5436             * @param displayDate the display date to search with
5437             * @param start the lower bound of the range of blogs entries to return
5438             * @param end the upper bound of the range of blogs entries to return (not inclusive)
5439             * @return the range of matching blogs entries that the user has permission to view
5440             * @throws SystemException if a system exception occurred
5441             */
5442            public List<BlogsEntry> filterFindByG_U_LtD(long groupId, long userId,
5443                    Date displayDate, int start, int end) throws SystemException {
5444                    return filterFindByG_U_LtD(groupId, userId, displayDate, start, end,
5445                            null);
5446            }
5447    
5448            /**
5449             * Filters by the user's permissions and finds an ordered range of all the blogs entries where groupId = &#63; and userId = &#63; and displayDate &lt; &#63;.
5450             *
5451             * <p>
5452             * 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.
5453             * </p>
5454             *
5455             * @param groupId the group id to search with
5456             * @param userId the user id to search with
5457             * @param displayDate the display date to search with
5458             * @param start the lower bound of the range of blogs entries to return
5459             * @param end the upper bound of the range of blogs entries to return (not inclusive)
5460             * @param orderByComparator the comparator to order the results by
5461             * @return the ordered range of matching blogs entries that the user has permission to view
5462             * @throws SystemException if a system exception occurred
5463             */
5464            public List<BlogsEntry> filterFindByG_U_LtD(long groupId, long userId,
5465                    Date displayDate, int start, int end,
5466                    OrderByComparator orderByComparator) throws SystemException {
5467                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
5468                            return findByG_U_LtD(groupId, userId, displayDate, start, end,
5469                                    orderByComparator);
5470                    }
5471    
5472                    Session session = null;
5473    
5474                    try {
5475                            session = openSession();
5476    
5477                            StringBundler query = null;
5478    
5479                            if (orderByComparator != null) {
5480                                    query = new StringBundler(5 +
5481                                                    (orderByComparator.getOrderByFields().length * 3));
5482                            }
5483                            else {
5484                                    query = new StringBundler(5);
5485                            }
5486    
5487                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
5488    
5489                            query.append(_FINDER_COLUMN_G_U_LTD_GROUPID_2);
5490    
5491                            query.append(_FINDER_COLUMN_G_U_LTD_USERID_2);
5492    
5493                            if (displayDate == null) {
5494                                    query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_1);
5495                            }
5496                            else {
5497                                    query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_2);
5498                            }
5499    
5500                            if (orderByComparator != null) {
5501                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
5502                                            orderByComparator);
5503                            }
5504    
5505                            else {
5506                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
5507                            }
5508    
5509                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
5510                                            BlogsEntry.class.getName(), _FILTER_COLUMN_PK,
5511                                            _FILTER_COLUMN_USERID, groupId);
5512    
5513                            SQLQuery q = session.createSQLQuery(sql);
5514    
5515                            q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
5516    
5517                            QueryPos qPos = QueryPos.getInstance(q);
5518    
5519                            qPos.add(groupId);
5520    
5521                            qPos.add(userId);
5522    
5523                            if (displayDate != null) {
5524                                    qPos.add(CalendarUtil.getTimestamp(displayDate));
5525                            }
5526    
5527                            return (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start, end);
5528                    }
5529                    catch (Exception e) {
5530                            throw processException(e);
5531                    }
5532                    finally {
5533                            closeSession(session);
5534                    }
5535            }
5536    
5537            /**
5538             * Finds all the blogs entries where groupId = &#63; and userId = &#63; and status = &#63;.
5539             *
5540             * @param groupId the group id to search with
5541             * @param userId the user id to search with
5542             * @param status the status to search with
5543             * @return the matching blogs entries
5544             * @throws SystemException if a system exception occurred
5545             */
5546            public List<BlogsEntry> findByG_U_S(long groupId, long userId, int status)
5547                    throws SystemException {
5548                    return findByG_U_S(groupId, userId, status, QueryUtil.ALL_POS,
5549                            QueryUtil.ALL_POS, null);
5550            }
5551    
5552            /**
5553             * Finds a range of all the blogs entries where groupId = &#63; and userId = &#63; and status = &#63;.
5554             *
5555             * <p>
5556             * 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.
5557             * </p>
5558             *
5559             * @param groupId the group id to search with
5560             * @param userId the user id to search with
5561             * @param status the status to search with
5562             * @param start the lower bound of the range of blogs entries to return
5563             * @param end the upper bound of the range of blogs entries to return (not inclusive)
5564             * @return the range of matching blogs entries
5565             * @throws SystemException if a system exception occurred
5566             */
5567            public List<BlogsEntry> findByG_U_S(long groupId, long userId, int status,
5568                    int start, int end) throws SystemException {
5569                    return findByG_U_S(groupId, userId, status, start, end, null);
5570            }
5571    
5572            /**
5573             * Finds an ordered range of all the blogs entries where groupId = &#63; and userId = &#63; and status = &#63;.
5574             *
5575             * <p>
5576             * 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.
5577             * </p>
5578             *
5579             * @param groupId the group id to search with
5580             * @param userId the user id to search with
5581             * @param status the status to search with
5582             * @param start the lower bound of the range of blogs entries to return
5583             * @param end the upper bound of the range of blogs entries to return (not inclusive)
5584             * @param orderByComparator the comparator to order the results by
5585             * @return the ordered range of matching blogs entries
5586             * @throws SystemException if a system exception occurred
5587             */
5588            public List<BlogsEntry> findByG_U_S(long groupId, long userId, int status,
5589                    int start, int end, OrderByComparator orderByComparator)
5590                    throws SystemException {
5591                    Object[] finderArgs = new Object[] {
5592                                    groupId, userId, status,
5593                                    
5594                                    String.valueOf(start), String.valueOf(end),
5595                                    String.valueOf(orderByComparator)
5596                            };
5597    
5598                    List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_U_S,
5599                                    finderArgs, this);
5600    
5601                    if (list == null) {
5602                            Session session = null;
5603    
5604                            try {
5605                                    session = openSession();
5606    
5607                                    StringBundler query = null;
5608    
5609                                    if (orderByComparator != null) {
5610                                            query = new StringBundler(5 +
5611                                                            (orderByComparator.getOrderByFields().length * 3));
5612                                    }
5613                                    else {
5614                                            query = new StringBundler(5);
5615                                    }
5616    
5617                                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
5618    
5619                                    query.append(_FINDER_COLUMN_G_U_S_GROUPID_2);
5620    
5621                                    query.append(_FINDER_COLUMN_G_U_S_USERID_2);
5622    
5623                                    query.append(_FINDER_COLUMN_G_U_S_STATUS_2);
5624    
5625                                    if (orderByComparator != null) {
5626                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
5627                                                    orderByComparator);
5628                                    }
5629    
5630                                    else {
5631                                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
5632                                    }
5633    
5634                                    String sql = query.toString();
5635    
5636                                    Query q = session.createQuery(sql);
5637    
5638                                    QueryPos qPos = QueryPos.getInstance(q);
5639    
5640                                    qPos.add(groupId);
5641    
5642                                    qPos.add(userId);
5643    
5644                                    qPos.add(status);
5645    
5646                                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
5647                                                    end);
5648                            }
5649                            catch (Exception e) {
5650                                    throw processException(e);
5651                            }
5652                            finally {
5653                                    if (list == null) {
5654                                            list = new ArrayList<BlogsEntry>();
5655                                    }
5656    
5657                                    cacheResult(list);
5658    
5659                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_U_S,
5660                                            finderArgs, list);
5661    
5662                                    closeSession(session);
5663                            }
5664                    }
5665    
5666                    return list;
5667            }
5668    
5669            /**
5670             * Finds the first blogs entry in the ordered set where groupId = &#63; and userId = &#63; and status = &#63;.
5671             *
5672             * <p>
5673             * 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.
5674             * </p>
5675             *
5676             * @param groupId the group id to search with
5677             * @param userId the user id to search with
5678             * @param status the status to search with
5679             * @param orderByComparator the comparator to order the set by
5680             * @return the first matching blogs entry
5681             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
5682             * @throws SystemException if a system exception occurred
5683             */
5684            public BlogsEntry findByG_U_S_First(long groupId, long userId, int status,
5685                    OrderByComparator orderByComparator)
5686                    throws NoSuchEntryException, SystemException {
5687                    List<BlogsEntry> list = findByG_U_S(groupId, userId, status, 0, 1,
5688                                    orderByComparator);
5689    
5690                    if (list.isEmpty()) {
5691                            StringBundler msg = new StringBundler(8);
5692    
5693                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
5694    
5695                            msg.append("groupId=");
5696                            msg.append(groupId);
5697    
5698                            msg.append(", userId=");
5699                            msg.append(userId);
5700    
5701                            msg.append(", status=");
5702                            msg.append(status);
5703    
5704                            msg.append(StringPool.CLOSE_CURLY_BRACE);
5705    
5706                            throw new NoSuchEntryException(msg.toString());
5707                    }
5708                    else {
5709                            return list.get(0);
5710                    }
5711            }
5712    
5713            /**
5714             * Finds the last blogs entry in the ordered set where groupId = &#63; and userId = &#63; and status = &#63;.
5715             *
5716             * <p>
5717             * 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.
5718             * </p>
5719             *
5720             * @param groupId the group id to search with
5721             * @param userId the user id to search with
5722             * @param status the status to search with
5723             * @param orderByComparator the comparator to order the set by
5724             * @return the last matching blogs entry
5725             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
5726             * @throws SystemException if a system exception occurred
5727             */
5728            public BlogsEntry findByG_U_S_Last(long groupId, long userId, int status,
5729                    OrderByComparator orderByComparator)
5730                    throws NoSuchEntryException, SystemException {
5731                    int count = countByG_U_S(groupId, userId, status);
5732    
5733                    List<BlogsEntry> list = findByG_U_S(groupId, userId, status, count - 1,
5734                                    count, orderByComparator);
5735    
5736                    if (list.isEmpty()) {
5737                            StringBundler msg = new StringBundler(8);
5738    
5739                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
5740    
5741                            msg.append("groupId=");
5742                            msg.append(groupId);
5743    
5744                            msg.append(", userId=");
5745                            msg.append(userId);
5746    
5747                            msg.append(", status=");
5748                            msg.append(status);
5749    
5750                            msg.append(StringPool.CLOSE_CURLY_BRACE);
5751    
5752                            throw new NoSuchEntryException(msg.toString());
5753                    }
5754                    else {
5755                            return list.get(0);
5756                    }
5757            }
5758    
5759            /**
5760             * Finds the blogs entries before and after the current blogs entry in the ordered set where groupId = &#63; and userId = &#63; and status = &#63;.
5761             *
5762             * <p>
5763             * 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.
5764             * </p>
5765             *
5766             * @param entryId the primary key of the current blogs entry
5767             * @param groupId the group id to search with
5768             * @param userId the user id to search with
5769             * @param status the status to search with
5770             * @param orderByComparator the comparator to order the set by
5771             * @return the previous, current, and next blogs entry
5772             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
5773             * @throws SystemException if a system exception occurred
5774             */
5775            public BlogsEntry[] findByG_U_S_PrevAndNext(long entryId, long groupId,
5776                    long userId, int status, OrderByComparator orderByComparator)
5777                    throws NoSuchEntryException, SystemException {
5778                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
5779    
5780                    Session session = null;
5781    
5782                    try {
5783                            session = openSession();
5784    
5785                            BlogsEntry[] array = new BlogsEntryImpl[3];
5786    
5787                            array[0] = getByG_U_S_PrevAndNext(session, blogsEntry, groupId,
5788                                            userId, status, orderByComparator, true);
5789    
5790                            array[1] = blogsEntry;
5791    
5792                            array[2] = getByG_U_S_PrevAndNext(session, blogsEntry, groupId,
5793                                            userId, status, orderByComparator, false);
5794    
5795                            return array;
5796                    }
5797                    catch (Exception e) {
5798                            throw processException(e);
5799                    }
5800                    finally {
5801                            closeSession(session);
5802                    }
5803            }
5804    
5805            protected BlogsEntry getByG_U_S_PrevAndNext(Session session,
5806                    BlogsEntry blogsEntry, long groupId, long userId, int status,
5807                    OrderByComparator orderByComparator, boolean previous) {
5808                    StringBundler query = null;
5809    
5810                    if (orderByComparator != null) {
5811                            query = new StringBundler(6 +
5812                                            (orderByComparator.getOrderByFields().length * 6));
5813                    }
5814                    else {
5815                            query = new StringBundler(3);
5816                    }
5817    
5818                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
5819    
5820                    query.append(_FINDER_COLUMN_G_U_S_GROUPID_2);
5821    
5822                    query.append(_FINDER_COLUMN_G_U_S_USERID_2);
5823    
5824                    query.append(_FINDER_COLUMN_G_U_S_STATUS_2);
5825    
5826                    if (orderByComparator != null) {
5827                            String[] orderByFields = orderByComparator.getOrderByFields();
5828    
5829                            if (orderByFields.length > 0) {
5830                                    query.append(WHERE_AND);
5831                            }
5832    
5833                            for (int i = 0; i < orderByFields.length; i++) {
5834                                    query.append(_ORDER_BY_ENTITY_ALIAS);
5835                                    query.append(orderByFields[i]);
5836    
5837                                    if ((i + 1) < orderByFields.length) {
5838                                            if (orderByComparator.isAscending() ^ previous) {
5839                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
5840                                            }
5841                                            else {
5842                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
5843                                            }
5844                                    }
5845                                    else {
5846                                            if (orderByComparator.isAscending() ^ previous) {
5847                                                    query.append(WHERE_GREATER_THAN);
5848                                            }
5849                                            else {
5850                                                    query.append(WHERE_LESSER_THAN);
5851                                            }
5852                                    }
5853                            }
5854    
5855                            query.append(ORDER_BY_CLAUSE);
5856    
5857                            for (int i = 0; i < orderByFields.length; i++) {
5858                                    query.append(_ORDER_BY_ENTITY_ALIAS);
5859                                    query.append(orderByFields[i]);
5860    
5861                                    if ((i + 1) < orderByFields.length) {
5862                                            if (orderByComparator.isAscending() ^ previous) {
5863                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
5864                                            }
5865                                            else {
5866                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
5867                                            }
5868                                    }
5869                                    else {
5870                                            if (orderByComparator.isAscending() ^ previous) {
5871                                                    query.append(ORDER_BY_ASC);
5872                                            }
5873                                            else {
5874                                                    query.append(ORDER_BY_DESC);
5875                                            }
5876                                    }
5877                            }
5878                    }
5879    
5880                    else {
5881                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
5882                    }
5883    
5884                    String sql = query.toString();
5885    
5886                    Query q = session.createQuery(sql);
5887    
5888                    q.setFirstResult(0);
5889                    q.setMaxResults(2);
5890    
5891                    QueryPos qPos = QueryPos.getInstance(q);
5892    
5893                    qPos.add(groupId);
5894    
5895                    qPos.add(userId);
5896    
5897                    qPos.add(status);
5898    
5899                    if (orderByComparator != null) {
5900                            Object[] values = orderByComparator.getOrderByValues(blogsEntry);
5901    
5902                            for (Object value : values) {
5903                                    qPos.add(value);
5904                            }
5905                    }
5906    
5907                    List<BlogsEntry> list = q.list();
5908    
5909                    if (list.size() == 2) {
5910                            return list.get(1);
5911                    }
5912                    else {
5913                            return null;
5914                    }
5915            }
5916    
5917            /**
5918             * Filters by the user's permissions and finds all the blogs entries where groupId = &#63; and userId = &#63; and status = &#63;.
5919             *
5920             * @param groupId the group id to search with
5921             * @param userId the user id to search with
5922             * @param status the status to search with
5923             * @return the matching blogs entries that the user has permission to view
5924             * @throws SystemException if a system exception occurred
5925             */
5926            public List<BlogsEntry> filterFindByG_U_S(long groupId, long userId,
5927                    int status) throws SystemException {
5928                    return filterFindByG_U_S(groupId, userId, status, QueryUtil.ALL_POS,
5929                            QueryUtil.ALL_POS, null);
5930            }
5931    
5932            /**
5933             * Filters by the user's permissions and finds a range of all the blogs entries where groupId = &#63; and userId = &#63; and status = &#63;.
5934             *
5935             * <p>
5936             * 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.
5937             * </p>
5938             *
5939             * @param groupId the group id to search with
5940             * @param userId the user id to search with
5941             * @param status the status to search with
5942             * @param start the lower bound of the range of blogs entries to return
5943             * @param end the upper bound of the range of blogs entries to return (not inclusive)
5944             * @return the range of matching blogs entries that the user has permission to view
5945             * @throws SystemException if a system exception occurred
5946             */
5947            public List<BlogsEntry> filterFindByG_U_S(long groupId, long userId,
5948                    int status, int start, int end) throws SystemException {
5949                    return filterFindByG_U_S(groupId, userId, status, start, end, null);
5950            }
5951    
5952            /**
5953             * Filters by the user's permissions and finds an ordered range of all the blogs entries where groupId = &#63; and userId = &#63; and status = &#63;.
5954             *
5955             * <p>
5956             * 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.
5957             * </p>
5958             *
5959             * @param groupId the group id to search with
5960             * @param userId the user id to search with
5961             * @param status the status to search with
5962             * @param start the lower bound of the range of blogs entries to return
5963             * @param end the upper bound of the range of blogs entries to return (not inclusive)
5964             * @param orderByComparator the comparator to order the results by
5965             * @return the ordered range of matching blogs entries that the user has permission to view
5966             * @throws SystemException if a system exception occurred
5967             */
5968            public List<BlogsEntry> filterFindByG_U_S(long groupId, long userId,
5969                    int status, int start, int end, OrderByComparator orderByComparator)
5970                    throws SystemException {
5971                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
5972                            return findByG_U_S(groupId, userId, status, start, end,
5973                                    orderByComparator);
5974                    }
5975    
5976                    Session session = null;
5977    
5978                    try {
5979                            session = openSession();
5980    
5981                            StringBundler query = null;
5982    
5983                            if (orderByComparator != null) {
5984                                    query = new StringBundler(5 +
5985                                                    (orderByComparator.getOrderByFields().length * 3));
5986                            }
5987                            else {
5988                                    query = new StringBundler(5);
5989                            }
5990    
5991                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
5992    
5993                            query.append(_FINDER_COLUMN_G_U_S_GROUPID_2);
5994    
5995                            query.append(_FINDER_COLUMN_G_U_S_USERID_2);
5996    
5997                            query.append(_FINDER_COLUMN_G_U_S_STATUS_2);
5998    
5999                            if (orderByComparator != null) {
6000                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
6001                                            orderByComparator);
6002                            }
6003    
6004                            else {
6005                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
6006                            }
6007    
6008                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
6009                                            BlogsEntry.class.getName(), _FILTER_COLUMN_PK,
6010                                            _FILTER_COLUMN_USERID, groupId);
6011    
6012                            SQLQuery q = session.createSQLQuery(sql);
6013    
6014                            q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
6015    
6016                            QueryPos qPos = QueryPos.getInstance(q);
6017    
6018                            qPos.add(groupId);
6019    
6020                            qPos.add(userId);
6021    
6022                            qPos.add(status);
6023    
6024                            return (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start, end);
6025                    }
6026                    catch (Exception e) {
6027                            throw processException(e);
6028                    }
6029                    finally {
6030                            closeSession(session);
6031                    }
6032            }
6033    
6034            /**
6035             * Finds all the blogs entries where groupId = &#63; and displayDate &lt; &#63; and status = &#63;.
6036             *
6037             * @param groupId the group id to search with
6038             * @param displayDate the display date to search with
6039             * @param status the status to search with
6040             * @return the matching blogs entries
6041             * @throws SystemException if a system exception occurred
6042             */
6043            public List<BlogsEntry> findByG_LtD_S(long groupId, Date displayDate,
6044                    int status) throws SystemException {
6045                    return findByG_LtD_S(groupId, displayDate, status, QueryUtil.ALL_POS,
6046                            QueryUtil.ALL_POS, null);
6047            }
6048    
6049            /**
6050             * Finds a range of all the blogs entries where groupId = &#63; and displayDate &lt; &#63; and status = &#63;.
6051             *
6052             * <p>
6053             * 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.
6054             * </p>
6055             *
6056             * @param groupId the group id to search with
6057             * @param displayDate the display date to search with
6058             * @param status the status to search with
6059             * @param start the lower bound of the range of blogs entries to return
6060             * @param end the upper bound of the range of blogs entries to return (not inclusive)
6061             * @return the range of matching blogs entries
6062             * @throws SystemException if a system exception occurred
6063             */
6064            public List<BlogsEntry> findByG_LtD_S(long groupId, Date displayDate,
6065                    int status, int start, int end) throws SystemException {
6066                    return findByG_LtD_S(groupId, displayDate, status, start, end, null);
6067            }
6068    
6069            /**
6070             * Finds an ordered range of all the blogs entries where groupId = &#63; and displayDate &lt; &#63; and status = &#63;.
6071             *
6072             * <p>
6073             * 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.
6074             * </p>
6075             *
6076             * @param groupId the group id to search with
6077             * @param displayDate the display date to search with
6078             * @param status the status to search with
6079             * @param start the lower bound of the range of blogs entries to return
6080             * @param end the upper bound of the range of blogs entries to return (not inclusive)
6081             * @param orderByComparator the comparator to order the results by
6082             * @return the ordered range of matching blogs entries
6083             * @throws SystemException if a system exception occurred
6084             */
6085            public List<BlogsEntry> findByG_LtD_S(long groupId, Date displayDate,
6086                    int status, int start, int end, OrderByComparator orderByComparator)
6087                    throws SystemException {
6088                    Object[] finderArgs = new Object[] {
6089                                    groupId, displayDate, status,
6090                                    
6091                                    String.valueOf(start), String.valueOf(end),
6092                                    String.valueOf(orderByComparator)
6093                            };
6094    
6095                    List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_LTD_S,
6096                                    finderArgs, this);
6097    
6098                    if (list == null) {
6099                            Session session = null;
6100    
6101                            try {
6102                                    session = openSession();
6103    
6104                                    StringBundler query = null;
6105    
6106                                    if (orderByComparator != null) {
6107                                            query = new StringBundler(5 +
6108                                                            (orderByComparator.getOrderByFields().length * 3));
6109                                    }
6110                                    else {
6111                                            query = new StringBundler(5);
6112                                    }
6113    
6114                                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
6115    
6116                                    query.append(_FINDER_COLUMN_G_LTD_S_GROUPID_2);
6117    
6118                                    if (displayDate == null) {
6119                                            query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_1);
6120                                    }
6121                                    else {
6122                                            query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_2);
6123                                    }
6124    
6125                                    query.append(_FINDER_COLUMN_G_LTD_S_STATUS_2);
6126    
6127                                    if (orderByComparator != null) {
6128                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
6129                                                    orderByComparator);
6130                                    }
6131    
6132                                    else {
6133                                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
6134                                    }
6135    
6136                                    String sql = query.toString();
6137    
6138                                    Query q = session.createQuery(sql);
6139    
6140                                    QueryPos qPos = QueryPos.getInstance(q);
6141    
6142                                    qPos.add(groupId);
6143    
6144                                    if (displayDate != null) {
6145                                            qPos.add(CalendarUtil.getTimestamp(displayDate));
6146                                    }
6147    
6148                                    qPos.add(status);
6149    
6150                                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
6151                                                    end);
6152                            }
6153                            catch (Exception e) {
6154                                    throw processException(e);
6155                            }
6156                            finally {
6157                                    if (list == null) {
6158                                            list = new ArrayList<BlogsEntry>();
6159                                    }
6160    
6161                                    cacheResult(list);
6162    
6163                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_LTD_S,
6164                                            finderArgs, list);
6165    
6166                                    closeSession(session);
6167                            }
6168                    }
6169    
6170                    return list;
6171            }
6172    
6173            /**
6174             * Finds the first blogs entry in the ordered set where groupId = &#63; and displayDate &lt; &#63; and status = &#63;.
6175             *
6176             * <p>
6177             * 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.
6178             * </p>
6179             *
6180             * @param groupId the group id to search with
6181             * @param displayDate the display date to search with
6182             * @param status the status to search with
6183             * @param orderByComparator the comparator to order the set by
6184             * @return the first matching blogs entry
6185             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
6186             * @throws SystemException if a system exception occurred
6187             */
6188            public BlogsEntry findByG_LtD_S_First(long groupId, Date displayDate,
6189                    int status, OrderByComparator orderByComparator)
6190                    throws NoSuchEntryException, SystemException {
6191                    List<BlogsEntry> list = findByG_LtD_S(groupId, displayDate, status, 0,
6192                                    1, orderByComparator);
6193    
6194                    if (list.isEmpty()) {
6195                            StringBundler msg = new StringBundler(8);
6196    
6197                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
6198    
6199                            msg.append("groupId=");
6200                            msg.append(groupId);
6201    
6202                            msg.append(", displayDate=");
6203                            msg.append(displayDate);
6204    
6205                            msg.append(", status=");
6206                            msg.append(status);
6207    
6208                            msg.append(StringPool.CLOSE_CURLY_BRACE);
6209    
6210                            throw new NoSuchEntryException(msg.toString());
6211                    }
6212                    else {
6213                            return list.get(0);
6214                    }
6215            }
6216    
6217            /**
6218             * Finds the last blogs entry in the ordered set where groupId = &#63; and displayDate &lt; &#63; and status = &#63;.
6219             *
6220             * <p>
6221             * 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.
6222             * </p>
6223             *
6224             * @param groupId the group id to search with
6225             * @param displayDate the display date to search with
6226             * @param status the status to search with
6227             * @param orderByComparator the comparator to order the set by
6228             * @return the last matching blogs entry
6229             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
6230             * @throws SystemException if a system exception occurred
6231             */
6232            public BlogsEntry findByG_LtD_S_Last(long groupId, Date displayDate,
6233                    int status, OrderByComparator orderByComparator)
6234                    throws NoSuchEntryException, SystemException {
6235                    int count = countByG_LtD_S(groupId, displayDate, status);
6236    
6237                    List<BlogsEntry> list = findByG_LtD_S(groupId, displayDate, status,
6238                                    count - 1, count, orderByComparator);
6239    
6240                    if (list.isEmpty()) {
6241                            StringBundler msg = new StringBundler(8);
6242    
6243                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
6244    
6245                            msg.append("groupId=");
6246                            msg.append(groupId);
6247    
6248                            msg.append(", displayDate=");
6249                            msg.append(displayDate);
6250    
6251                            msg.append(", status=");
6252                            msg.append(status);
6253    
6254                            msg.append(StringPool.CLOSE_CURLY_BRACE);
6255    
6256                            throw new NoSuchEntryException(msg.toString());
6257                    }
6258                    else {
6259                            return list.get(0);
6260                    }
6261            }
6262    
6263            /**
6264             * Finds the blogs entries before and after the current blogs entry in the ordered set where groupId = &#63; and displayDate &lt; &#63; and status = &#63;.
6265             *
6266             * <p>
6267             * 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.
6268             * </p>
6269             *
6270             * @param entryId the primary key of the current blogs entry
6271             * @param groupId the group id to search with
6272             * @param displayDate the display date to search with
6273             * @param status the status to search with
6274             * @param orderByComparator the comparator to order the set by
6275             * @return the previous, current, and next blogs entry
6276             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
6277             * @throws SystemException if a system exception occurred
6278             */
6279            public BlogsEntry[] findByG_LtD_S_PrevAndNext(long entryId, long groupId,
6280                    Date displayDate, int status, OrderByComparator orderByComparator)
6281                    throws NoSuchEntryException, SystemException {
6282                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
6283    
6284                    Session session = null;
6285    
6286                    try {
6287                            session = openSession();
6288    
6289                            BlogsEntry[] array = new BlogsEntryImpl[3];
6290    
6291                            array[0] = getByG_LtD_S_PrevAndNext(session, blogsEntry, groupId,
6292                                            displayDate, status, orderByComparator, true);
6293    
6294                            array[1] = blogsEntry;
6295    
6296                            array[2] = getByG_LtD_S_PrevAndNext(session, blogsEntry, groupId,
6297                                            displayDate, status, orderByComparator, false);
6298    
6299                            return array;
6300                    }
6301                    catch (Exception e) {
6302                            throw processException(e);
6303                    }
6304                    finally {
6305                            closeSession(session);
6306                    }
6307            }
6308    
6309            protected BlogsEntry getByG_LtD_S_PrevAndNext(Session session,
6310                    BlogsEntry blogsEntry, long groupId, Date displayDate, int status,
6311                    OrderByComparator orderByComparator, boolean previous) {
6312                    StringBundler query = null;
6313    
6314                    if (orderByComparator != null) {
6315                            query = new StringBundler(6 +
6316                                            (orderByComparator.getOrderByFields().length * 6));
6317                    }
6318                    else {
6319                            query = new StringBundler(3);
6320                    }
6321    
6322                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
6323    
6324                    query.append(_FINDER_COLUMN_G_LTD_S_GROUPID_2);
6325    
6326                    if (displayDate == null) {
6327                            query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_1);
6328                    }
6329                    else {
6330                            query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_2);
6331                    }
6332    
6333                    query.append(_FINDER_COLUMN_G_LTD_S_STATUS_2);
6334    
6335                    if (orderByComparator != null) {
6336                            String[] orderByFields = orderByComparator.getOrderByFields();
6337    
6338                            if (orderByFields.length > 0) {
6339                                    query.append(WHERE_AND);
6340                            }
6341    
6342                            for (int i = 0; i < orderByFields.length; i++) {
6343                                    query.append(_ORDER_BY_ENTITY_ALIAS);
6344                                    query.append(orderByFields[i]);
6345    
6346                                    if ((i + 1) < orderByFields.length) {
6347                                            if (orderByComparator.isAscending() ^ previous) {
6348                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
6349                                            }
6350                                            else {
6351                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
6352                                            }
6353                                    }
6354                                    else {
6355                                            if (orderByComparator.isAscending() ^ previous) {
6356                                                    query.append(WHERE_GREATER_THAN);
6357                                            }
6358                                            else {
6359                                                    query.append(WHERE_LESSER_THAN);
6360                                            }
6361                                    }
6362                            }
6363    
6364                            query.append(ORDER_BY_CLAUSE);
6365    
6366                            for (int i = 0; i < orderByFields.length; i++) {
6367                                    query.append(_ORDER_BY_ENTITY_ALIAS);
6368                                    query.append(orderByFields[i]);
6369    
6370                                    if ((i + 1) < orderByFields.length) {
6371                                            if (orderByComparator.isAscending() ^ previous) {
6372                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
6373                                            }
6374                                            else {
6375                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
6376                                            }
6377                                    }
6378                                    else {
6379                                            if (orderByComparator.isAscending() ^ previous) {
6380                                                    query.append(ORDER_BY_ASC);
6381                                            }
6382                                            else {
6383                                                    query.append(ORDER_BY_DESC);
6384                                            }
6385                                    }
6386                            }
6387                    }
6388    
6389                    else {
6390                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
6391                    }
6392    
6393                    String sql = query.toString();
6394    
6395                    Query q = session.createQuery(sql);
6396    
6397                    q.setFirstResult(0);
6398                    q.setMaxResults(2);
6399    
6400                    QueryPos qPos = QueryPos.getInstance(q);
6401    
6402                    qPos.add(groupId);
6403    
6404                    if (displayDate != null) {
6405                            qPos.add(CalendarUtil.getTimestamp(displayDate));
6406                    }
6407    
6408                    qPos.add(status);
6409    
6410                    if (orderByComparator != null) {
6411                            Object[] values = orderByComparator.getOrderByValues(blogsEntry);
6412    
6413                            for (Object value : values) {
6414                                    qPos.add(value);
6415                            }
6416                    }
6417    
6418                    List<BlogsEntry> list = q.list();
6419    
6420                    if (list.size() == 2) {
6421                            return list.get(1);
6422                    }
6423                    else {
6424                            return null;
6425                    }
6426            }
6427    
6428            /**
6429             * Filters by the user's permissions and finds all the blogs entries where groupId = &#63; and displayDate &lt; &#63; and status = &#63;.
6430             *
6431             * @param groupId the group id to search with
6432             * @param displayDate the display date to search with
6433             * @param status the status to search with
6434             * @return the matching blogs entries that the user has permission to view
6435             * @throws SystemException if a system exception occurred
6436             */
6437            public List<BlogsEntry> filterFindByG_LtD_S(long groupId, Date displayDate,
6438                    int status) throws SystemException {
6439                    return filterFindByG_LtD_S(groupId, displayDate, status,
6440                            QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
6441            }
6442    
6443            /**
6444             * Filters by the user's permissions and finds a range of all the blogs entries where groupId = &#63; and displayDate &lt; &#63; and status = &#63;.
6445             *
6446             * <p>
6447             * 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.
6448             * </p>
6449             *
6450             * @param groupId the group id to search with
6451             * @param displayDate the display date to search with
6452             * @param status the status to search with
6453             * @param start the lower bound of the range of blogs entries to return
6454             * @param end the upper bound of the range of blogs entries to return (not inclusive)
6455             * @return the range of matching blogs entries that the user has permission to view
6456             * @throws SystemException if a system exception occurred
6457             */
6458            public List<BlogsEntry> filterFindByG_LtD_S(long groupId, Date displayDate,
6459                    int status, int start, int end) throws SystemException {
6460                    return filterFindByG_LtD_S(groupId, displayDate, status, start, end,
6461                            null);
6462            }
6463    
6464            /**
6465             * Filters by the user's permissions and finds an ordered range of all the blogs entries where groupId = &#63; and displayDate &lt; &#63; and status = &#63;.
6466             *
6467             * <p>
6468             * 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.
6469             * </p>
6470             *
6471             * @param groupId the group id to search with
6472             * @param displayDate the display date to search with
6473             * @param status the status to search with
6474             * @param start the lower bound of the range of blogs entries to return
6475             * @param end the upper bound of the range of blogs entries to return (not inclusive)
6476             * @param orderByComparator the comparator to order the results by
6477             * @return the ordered range of matching blogs entries that the user has permission to view
6478             * @throws SystemException if a system exception occurred
6479             */
6480            public List<BlogsEntry> filterFindByG_LtD_S(long groupId, Date displayDate,
6481                    int status, int start, int end, OrderByComparator orderByComparator)
6482                    throws SystemException {
6483                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
6484                            return findByG_LtD_S(groupId, displayDate, status, start, end,
6485                                    orderByComparator);
6486                    }
6487    
6488                    Session session = null;
6489    
6490                    try {
6491                            session = openSession();
6492    
6493                            StringBundler query = null;
6494    
6495                            if (orderByComparator != null) {
6496                                    query = new StringBundler(5 +
6497                                                    (orderByComparator.getOrderByFields().length * 3));
6498                            }
6499                            else {
6500                                    query = new StringBundler(5);
6501                            }
6502    
6503                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
6504    
6505                            query.append(_FINDER_COLUMN_G_LTD_S_GROUPID_2);
6506    
6507                            if (displayDate == null) {
6508                                    query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_1);
6509                            }
6510                            else {
6511                                    query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_2);
6512                            }
6513    
6514                            query.append(_FINDER_COLUMN_G_LTD_S_STATUS_2);
6515    
6516                            if (orderByComparator != null) {
6517                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
6518                                            orderByComparator);
6519                            }
6520    
6521                            else {
6522                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
6523                            }
6524    
6525                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
6526                                            BlogsEntry.class.getName(), _FILTER_COLUMN_PK,
6527                                            _FILTER_COLUMN_USERID, groupId);
6528    
6529                            SQLQuery q = session.createSQLQuery(sql);
6530    
6531                            q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
6532    
6533                            QueryPos qPos = QueryPos.getInstance(q);
6534    
6535                            qPos.add(groupId);
6536    
6537                            if (displayDate != null) {
6538                                    qPos.add(CalendarUtil.getTimestamp(displayDate));
6539                            }
6540    
6541                            qPos.add(status);
6542    
6543                            return (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start, end);
6544                    }
6545                    catch (Exception e) {
6546                            throw processException(e);
6547                    }
6548                    finally {
6549                            closeSession(session);
6550                    }
6551            }
6552    
6553            /**
6554             * Finds all the blogs entries where groupId = &#63; and userId = &#63; and displayDate &lt; &#63; and status = &#63;.
6555             *
6556             * @param groupId the group id to search with
6557             * @param userId the user id to search with
6558             * @param displayDate the display date to search with
6559             * @param status the status to search with
6560             * @return the matching blogs entries
6561             * @throws SystemException if a system exception occurred
6562             */
6563            public List<BlogsEntry> findByG_U_LtD_S(long groupId, long userId,
6564                    Date displayDate, int status) throws SystemException {
6565                    return findByG_U_LtD_S(groupId, userId, displayDate, status,
6566                            QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
6567            }
6568    
6569            /**
6570             * Finds a range of all the blogs entries where groupId = &#63; and userId = &#63; and displayDate &lt; &#63; and status = &#63;.
6571             *
6572             * <p>
6573             * 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.
6574             * </p>
6575             *
6576             * @param groupId the group id to search with
6577             * @param userId the user id to search with
6578             * @param displayDate the display date to search with
6579             * @param status the status to search with
6580             * @param start the lower bound of the range of blogs entries to return
6581             * @param end the upper bound of the range of blogs entries to return (not inclusive)
6582             * @return the range of matching blogs entries
6583             * @throws SystemException if a system exception occurred
6584             */
6585            public List<BlogsEntry> findByG_U_LtD_S(long groupId, long userId,
6586                    Date displayDate, int status, int start, int end)
6587                    throws SystemException {
6588                    return findByG_U_LtD_S(groupId, userId, displayDate, status, start,
6589                            end, null);
6590            }
6591    
6592            /**
6593             * Finds an ordered range of all the blogs entries where groupId = &#63; and userId = &#63; and displayDate &lt; &#63; and status = &#63;.
6594             *
6595             * <p>
6596             * 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.
6597             * </p>
6598             *
6599             * @param groupId the group id to search with
6600             * @param userId the user id to search with
6601             * @param displayDate the display date to search with
6602             * @param status the status to search with
6603             * @param start the lower bound of the range of blogs entries to return
6604             * @param end the upper bound of the range of blogs entries to return (not inclusive)
6605             * @param orderByComparator the comparator to order the results by
6606             * @return the ordered range of matching blogs entries
6607             * @throws SystemException if a system exception occurred
6608             */
6609            public List<BlogsEntry> findByG_U_LtD_S(long groupId, long userId,
6610                    Date displayDate, int status, int start, int end,
6611                    OrderByComparator orderByComparator) throws SystemException {
6612                    Object[] finderArgs = new Object[] {
6613                                    groupId, userId, displayDate, status,
6614                                    
6615                                    String.valueOf(start), String.valueOf(end),
6616                                    String.valueOf(orderByComparator)
6617                            };
6618    
6619                    List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_U_LTD_S,
6620                                    finderArgs, this);
6621    
6622                    if (list == null) {
6623                            Session session = null;
6624    
6625                            try {
6626                                    session = openSession();
6627    
6628                                    StringBundler query = null;
6629    
6630                                    if (orderByComparator != null) {
6631                                            query = new StringBundler(6 +
6632                                                            (orderByComparator.getOrderByFields().length * 3));
6633                                    }
6634                                    else {
6635                                            query = new StringBundler(6);
6636                                    }
6637    
6638                                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
6639    
6640                                    query.append(_FINDER_COLUMN_G_U_LTD_S_GROUPID_2);
6641    
6642                                    query.append(_FINDER_COLUMN_G_U_LTD_S_USERID_2);
6643    
6644                                    if (displayDate == null) {
6645                                            query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_1);
6646                                    }
6647                                    else {
6648                                            query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_2);
6649                                    }
6650    
6651                                    query.append(_FINDER_COLUMN_G_U_LTD_S_STATUS_2);
6652    
6653                                    if (orderByComparator != null) {
6654                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
6655                                                    orderByComparator);
6656                                    }
6657    
6658                                    else {
6659                                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
6660                                    }
6661    
6662                                    String sql = query.toString();
6663    
6664                                    Query q = session.createQuery(sql);
6665    
6666                                    QueryPos qPos = QueryPos.getInstance(q);
6667    
6668                                    qPos.add(groupId);
6669    
6670                                    qPos.add(userId);
6671    
6672                                    if (displayDate != null) {
6673                                            qPos.add(CalendarUtil.getTimestamp(displayDate));
6674                                    }
6675    
6676                                    qPos.add(status);
6677    
6678                                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
6679                                                    end);
6680                            }
6681                            catch (Exception e) {
6682                                    throw processException(e);
6683                            }
6684                            finally {
6685                                    if (list == null) {
6686                                            list = new ArrayList<BlogsEntry>();
6687                                    }
6688    
6689                                    cacheResult(list);
6690    
6691                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_U_LTD_S,
6692                                            finderArgs, list);
6693    
6694                                    closeSession(session);
6695                            }
6696                    }
6697    
6698                    return list;
6699            }
6700    
6701            /**
6702             * Finds the first blogs entry in the ordered set where groupId = &#63; and userId = &#63; and displayDate &lt; &#63; and status = &#63;.
6703             *
6704             * <p>
6705             * 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.
6706             * </p>
6707             *
6708             * @param groupId the group id to search with
6709             * @param userId the user id to search with
6710             * @param displayDate the display date to search with
6711             * @param status the status to search with
6712             * @param orderByComparator the comparator to order the set by
6713             * @return the first matching blogs entry
6714             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
6715             * @throws SystemException if a system exception occurred
6716             */
6717            public BlogsEntry findByG_U_LtD_S_First(long groupId, long userId,
6718                    Date displayDate, int status, OrderByComparator orderByComparator)
6719                    throws NoSuchEntryException, SystemException {
6720                    List<BlogsEntry> list = findByG_U_LtD_S(groupId, userId, displayDate,
6721                                    status, 0, 1, orderByComparator);
6722    
6723                    if (list.isEmpty()) {
6724                            StringBundler msg = new StringBundler(10);
6725    
6726                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
6727    
6728                            msg.append("groupId=");
6729                            msg.append(groupId);
6730    
6731                            msg.append(", userId=");
6732                            msg.append(userId);
6733    
6734                            msg.append(", displayDate=");
6735                            msg.append(displayDate);
6736    
6737                            msg.append(", status=");
6738                            msg.append(status);
6739    
6740                            msg.append(StringPool.CLOSE_CURLY_BRACE);
6741    
6742                            throw new NoSuchEntryException(msg.toString());
6743                    }
6744                    else {
6745                            return list.get(0);
6746                    }
6747            }
6748    
6749            /**
6750             * Finds the last blogs entry in the ordered set where groupId = &#63; and userId = &#63; and displayDate &lt; &#63; and status = &#63;.
6751             *
6752             * <p>
6753             * 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.
6754             * </p>
6755             *
6756             * @param groupId the group id to search with
6757             * @param userId the user id to search with
6758             * @param displayDate the display date to search with
6759             * @param status the status to search with
6760             * @param orderByComparator the comparator to order the set by
6761             * @return the last matching blogs entry
6762             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
6763             * @throws SystemException if a system exception occurred
6764             */
6765            public BlogsEntry findByG_U_LtD_S_Last(long groupId, long userId,
6766                    Date displayDate, int status, OrderByComparator orderByComparator)
6767                    throws NoSuchEntryException, SystemException {
6768                    int count = countByG_U_LtD_S(groupId, userId, displayDate, status);
6769    
6770                    List<BlogsEntry> list = findByG_U_LtD_S(groupId, userId, displayDate,
6771                                    status, count - 1, count, orderByComparator);
6772    
6773                    if (list.isEmpty()) {
6774                            StringBundler msg = new StringBundler(10);
6775    
6776                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
6777    
6778                            msg.append("groupId=");
6779                            msg.append(groupId);
6780    
6781                            msg.append(", userId=");
6782                            msg.append(userId);
6783    
6784                            msg.append(", displayDate=");
6785                            msg.append(displayDate);
6786    
6787                            msg.append(", status=");
6788                            msg.append(status);
6789    
6790                            msg.append(StringPool.CLOSE_CURLY_BRACE);
6791    
6792                            throw new NoSuchEntryException(msg.toString());
6793                    }
6794                    else {
6795                            return list.get(0);
6796                    }
6797            }
6798    
6799            /**
6800             * Finds the blogs entries before and after the current blogs entry in the ordered set where groupId = &#63; and userId = &#63; and displayDate &lt; &#63; and status = &#63;.
6801             *
6802             * <p>
6803             * 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.
6804             * </p>
6805             *
6806             * @param entryId the primary key of the current blogs entry
6807             * @param groupId the group id to search with
6808             * @param userId the user id to search with
6809             * @param displayDate the display date to search with
6810             * @param status the status to search with
6811             * @param orderByComparator the comparator to order the set by
6812             * @return the previous, current, and next blogs entry
6813             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
6814             * @throws SystemException if a system exception occurred
6815             */
6816            public BlogsEntry[] findByG_U_LtD_S_PrevAndNext(long entryId, long groupId,
6817                    long userId, Date displayDate, int status,
6818                    OrderByComparator orderByComparator)
6819                    throws NoSuchEntryException, SystemException {
6820                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
6821    
6822                    Session session = null;
6823    
6824                    try {
6825                            session = openSession();
6826    
6827                            BlogsEntry[] array = new BlogsEntryImpl[3];
6828    
6829                            array[0] = getByG_U_LtD_S_PrevAndNext(session, blogsEntry, groupId,
6830                                            userId, displayDate, status, orderByComparator, true);
6831    
6832                            array[1] = blogsEntry;
6833    
6834                            array[2] = getByG_U_LtD_S_PrevAndNext(session, blogsEntry, groupId,
6835                                            userId, displayDate, status, orderByComparator, false);
6836    
6837                            return array;
6838                    }
6839                    catch (Exception e) {
6840                            throw processException(e);
6841                    }
6842                    finally {
6843                            closeSession(session);
6844                    }
6845            }
6846    
6847            protected BlogsEntry getByG_U_LtD_S_PrevAndNext(Session session,
6848                    BlogsEntry blogsEntry, long groupId, long userId, Date displayDate,
6849                    int status, OrderByComparator orderByComparator, boolean previous) {
6850                    StringBundler query = null;
6851    
6852                    if (orderByComparator != null) {
6853                            query = new StringBundler(6 +
6854                                            (orderByComparator.getOrderByFields().length * 6));
6855                    }
6856                    else {
6857                            query = new StringBundler(3);
6858                    }
6859    
6860                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
6861    
6862                    query.append(_FINDER_COLUMN_G_U_LTD_S_GROUPID_2);
6863    
6864                    query.append(_FINDER_COLUMN_G_U_LTD_S_USERID_2);
6865    
6866                    if (displayDate == null) {
6867                            query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_1);
6868                    }
6869                    else {
6870                            query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_2);
6871                    }
6872    
6873                    query.append(_FINDER_COLUMN_G_U_LTD_S_STATUS_2);
6874    
6875                    if (orderByComparator != null) {
6876                            String[] orderByFields = orderByComparator.getOrderByFields();
6877    
6878                            if (orderByFields.length > 0) {
6879                                    query.append(WHERE_AND);
6880                            }
6881    
6882                            for (int i = 0; i < orderByFields.length; i++) {
6883                                    query.append(_ORDER_BY_ENTITY_ALIAS);
6884                                    query.append(orderByFields[i]);
6885    
6886                                    if ((i + 1) < orderByFields.length) {
6887                                            if (orderByComparator.isAscending() ^ previous) {
6888                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
6889                                            }
6890                                            else {
6891                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
6892                                            }
6893                                    }
6894                                    else {
6895                                            if (orderByComparator.isAscending() ^ previous) {
6896                                                    query.append(WHERE_GREATER_THAN);
6897                                            }
6898                                            else {
6899                                                    query.append(WHERE_LESSER_THAN);
6900                                            }
6901                                    }
6902                            }
6903    
6904                            query.append(ORDER_BY_CLAUSE);
6905    
6906                            for (int i = 0; i < orderByFields.length; i++) {
6907                                    query.append(_ORDER_BY_ENTITY_ALIAS);
6908                                    query.append(orderByFields[i]);
6909    
6910                                    if ((i + 1) < orderByFields.length) {
6911                                            if (orderByComparator.isAscending() ^ previous) {
6912                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
6913                                            }
6914                                            else {
6915                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
6916                                            }
6917                                    }
6918                                    else {
6919                                            if (orderByComparator.isAscending() ^ previous) {
6920                                                    query.append(ORDER_BY_ASC);
6921                                            }
6922                                            else {
6923                                                    query.append(ORDER_BY_DESC);
6924                                            }
6925                                    }
6926                            }
6927                    }
6928    
6929                    else {
6930                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
6931                    }
6932    
6933                    String sql = query.toString();
6934    
6935                    Query q = session.createQuery(sql);
6936    
6937                    q.setFirstResult(0);
6938                    q.setMaxResults(2);
6939    
6940                    QueryPos qPos = QueryPos.getInstance(q);
6941    
6942                    qPos.add(groupId);
6943    
6944                    qPos.add(userId);
6945    
6946                    if (displayDate != null) {
6947                            qPos.add(CalendarUtil.getTimestamp(displayDate));
6948                    }
6949    
6950                    qPos.add(status);
6951    
6952                    if (orderByComparator != null) {
6953                            Object[] values = orderByComparator.getOrderByValues(blogsEntry);
6954    
6955                            for (Object value : values) {
6956                                    qPos.add(value);
6957                            }
6958                    }
6959    
6960                    List<BlogsEntry> list = q.list();
6961    
6962                    if (list.size() == 2) {
6963                            return list.get(1);
6964                    }
6965                    else {
6966                            return null;
6967                    }
6968            }
6969    
6970            /**
6971             * Filters by the user's permissions and finds all the blogs entries where groupId = &#63; and userId = &#63; and displayDate &lt; &#63; and status = &#63;.
6972             *
6973             * @param groupId the group id to search with
6974             * @param userId the user id to search with
6975             * @param displayDate the display date to search with
6976             * @param status the status to search with
6977             * @return the matching blogs entries that the user has permission to view
6978             * @throws SystemException if a system exception occurred
6979             */
6980            public List<BlogsEntry> filterFindByG_U_LtD_S(long groupId, long userId,
6981                    Date displayDate, int status) throws SystemException {
6982                    return filterFindByG_U_LtD_S(groupId, userId, displayDate, status,
6983                            QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
6984            }
6985    
6986            /**
6987             * Filters by the user's permissions and finds a range of all the blogs entries where groupId = &#63; and userId = &#63; and displayDate &lt; &#63; and status = &#63;.
6988             *
6989             * <p>
6990             * 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.
6991             * </p>
6992             *
6993             * @param groupId the group id to search with
6994             * @param userId the user id to search with
6995             * @param displayDate the display date to search with
6996             * @param status the status to search with
6997             * @param start the lower bound of the range of blogs entries to return
6998             * @param end the upper bound of the range of blogs entries to return (not inclusive)
6999             * @return the range of matching blogs entries that the user has permission to view
7000             * @throws SystemException if a system exception occurred
7001             */
7002            public List<BlogsEntry> filterFindByG_U_LtD_S(long groupId, long userId,
7003                    Date displayDate, int status, int start, int end)
7004                    throws SystemException {
7005                    return filterFindByG_U_LtD_S(groupId, userId, displayDate, status,
7006                            start, end, null);
7007            }
7008    
7009            /**
7010             * Filters by the user's permissions and finds an ordered range of all the blogs entries where groupId = &#63; and userId = &#63; and displayDate &lt; &#63; and status = &#63;.
7011             *
7012             * <p>
7013             * 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.
7014             * </p>
7015             *
7016             * @param groupId the group id to search with
7017             * @param userId the user id to search with
7018             * @param displayDate the display date to search with
7019             * @param status the status to search with
7020             * @param start the lower bound of the range of blogs entries to return
7021             * @param end the upper bound of the range of blogs entries to return (not inclusive)
7022             * @param orderByComparator the comparator to order the results by
7023             * @return the ordered range of matching blogs entries that the user has permission to view
7024             * @throws SystemException if a system exception occurred
7025             */
7026            public List<BlogsEntry> filterFindByG_U_LtD_S(long groupId, long userId,
7027                    Date displayDate, int status, int start, int end,
7028                    OrderByComparator orderByComparator) throws SystemException {
7029                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
7030                            return findByG_U_LtD_S(groupId, userId, displayDate, status, start,
7031                                    end, orderByComparator);
7032                    }
7033    
7034                    Session session = null;
7035    
7036                    try {
7037                            session = openSession();
7038    
7039                            StringBundler query = null;
7040    
7041                            if (orderByComparator != null) {
7042                                    query = new StringBundler(6 +
7043                                                    (orderByComparator.getOrderByFields().length * 3));
7044                            }
7045                            else {
7046                                    query = new StringBundler(6);
7047                            }
7048    
7049                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
7050    
7051                            query.append(_FINDER_COLUMN_G_U_LTD_S_GROUPID_2);
7052    
7053                            query.append(_FINDER_COLUMN_G_U_LTD_S_USERID_2);
7054    
7055                            if (displayDate == null) {
7056                                    query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_1);
7057                            }
7058                            else {
7059                                    query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_2);
7060                            }
7061    
7062                            query.append(_FINDER_COLUMN_G_U_LTD_S_STATUS_2);
7063    
7064                            if (orderByComparator != null) {
7065                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
7066                                            orderByComparator);
7067                            }
7068    
7069                            else {
7070                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
7071                            }
7072    
7073                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
7074                                            BlogsEntry.class.getName(), _FILTER_COLUMN_PK,
7075                                            _FILTER_COLUMN_USERID, groupId);
7076    
7077                            SQLQuery q = session.createSQLQuery(sql);
7078    
7079                            q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
7080    
7081                            QueryPos qPos = QueryPos.getInstance(q);
7082    
7083                            qPos.add(groupId);
7084    
7085                            qPos.add(userId);
7086    
7087                            if (displayDate != null) {
7088                                    qPos.add(CalendarUtil.getTimestamp(displayDate));
7089                            }
7090    
7091                            qPos.add(status);
7092    
7093                            return (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start, end);
7094                    }
7095                    catch (Exception e) {
7096                            throw processException(e);
7097                    }
7098                    finally {
7099                            closeSession(session);
7100                    }
7101            }
7102    
7103            /**
7104             * Finds all the blogs entries.
7105             *
7106             * @return the blogs entries
7107             * @throws SystemException if a system exception occurred
7108             */
7109            public List<BlogsEntry> findAll() throws SystemException {
7110                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
7111            }
7112    
7113            /**
7114             * Finds a range of all the blogs entries.
7115             *
7116             * <p>
7117             * 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.
7118             * </p>
7119             *
7120             * @param start the lower bound of the range of blogs entries to return
7121             * @param end the upper bound of the range of blogs entries to return (not inclusive)
7122             * @return the range of blogs entries
7123             * @throws SystemException if a system exception occurred
7124             */
7125            public List<BlogsEntry> findAll(int start, int end)
7126                    throws SystemException {
7127                    return findAll(start, end, null);
7128            }
7129    
7130            /**
7131             * Finds an ordered range of all the blogs entries.
7132             *
7133             * <p>
7134             * 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.
7135             * </p>
7136             *
7137             * @param start the lower bound of the range of blogs entries to return
7138             * @param end the upper bound of the range of blogs entries to return (not inclusive)
7139             * @param orderByComparator the comparator to order the results by
7140             * @return the ordered range of blogs entries
7141             * @throws SystemException if a system exception occurred
7142             */
7143            public List<BlogsEntry> findAll(int start, int end,
7144                    OrderByComparator orderByComparator) throws SystemException {
7145                    Object[] finderArgs = new Object[] {
7146                                    String.valueOf(start), String.valueOf(end),
7147                                    String.valueOf(orderByComparator)
7148                            };
7149    
7150                    List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
7151                                    finderArgs, this);
7152    
7153                    if (list == null) {
7154                            Session session = null;
7155    
7156                            try {
7157                                    session = openSession();
7158    
7159                                    StringBundler query = null;
7160                                    String sql = null;
7161    
7162                                    if (orderByComparator != null) {
7163                                            query = new StringBundler(2 +
7164                                                            (orderByComparator.getOrderByFields().length * 3));
7165    
7166                                            query.append(_SQL_SELECT_BLOGSENTRY);
7167    
7168                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
7169                                                    orderByComparator);
7170    
7171                                            sql = query.toString();
7172                                    }
7173                                    else {
7174                                            sql = _SQL_SELECT_BLOGSENTRY.concat(BlogsEntryModelImpl.ORDER_BY_JPQL);
7175                                    }
7176    
7177                                    Query q = session.createQuery(sql);
7178    
7179                                    if (orderByComparator == null) {
7180                                            list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(),
7181                                                            start, end, false);
7182    
7183                                            Collections.sort(list);
7184                                    }
7185                                    else {
7186                                            list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(),
7187                                                            start, end);
7188                                    }
7189                            }
7190                            catch (Exception e) {
7191                                    throw processException(e);
7192                            }
7193                            finally {
7194                                    if (list == null) {
7195                                            list = new ArrayList<BlogsEntry>();
7196                                    }
7197    
7198                                    cacheResult(list);
7199    
7200                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
7201    
7202                                    closeSession(session);
7203                            }
7204                    }
7205    
7206                    return list;
7207            }
7208    
7209            /**
7210             * Removes all the blogs entries where uuid = &#63; from the database.
7211             *
7212             * @param uuid the uuid to search with
7213             * @throws SystemException if a system exception occurred
7214             */
7215            public void removeByUuid(String uuid) throws SystemException {
7216                    for (BlogsEntry blogsEntry : findByUuid(uuid)) {
7217                            remove(blogsEntry);
7218                    }
7219            }
7220    
7221            /**
7222             * Removes the blogs entry where uuid = &#63; and groupId = &#63; from the database.
7223             *
7224             * @param uuid the uuid to search with
7225             * @param groupId the group id to search with
7226             * @throws SystemException if a system exception occurred
7227             */
7228            public void removeByUUID_G(String uuid, long groupId)
7229                    throws NoSuchEntryException, SystemException {
7230                    BlogsEntry blogsEntry = findByUUID_G(uuid, groupId);
7231    
7232                    remove(blogsEntry);
7233            }
7234    
7235            /**
7236             * Removes all the blogs entries where groupId = &#63; from the database.
7237             *
7238             * @param groupId the group id to search with
7239             * @throws SystemException if a system exception occurred
7240             */
7241            public void removeByGroupId(long groupId) throws SystemException {
7242                    for (BlogsEntry blogsEntry : findByGroupId(groupId)) {
7243                            remove(blogsEntry);
7244                    }
7245            }
7246    
7247            /**
7248             * Removes all the blogs entries where companyId = &#63; from the database.
7249             *
7250             * @param companyId the company id to search with
7251             * @throws SystemException if a system exception occurred
7252             */
7253            public void removeByCompanyId(long companyId) throws SystemException {
7254                    for (BlogsEntry blogsEntry : findByCompanyId(companyId)) {
7255                            remove(blogsEntry);
7256                    }
7257            }
7258    
7259            /**
7260             * Removes all the blogs entries where companyId = &#63; and userId = &#63; from the database.
7261             *
7262             * @param companyId the company id to search with
7263             * @param userId the user id to search with
7264             * @throws SystemException if a system exception occurred
7265             */
7266            public void removeByC_U(long companyId, long userId)
7267                    throws SystemException {
7268                    for (BlogsEntry blogsEntry : findByC_U(companyId, userId)) {
7269                            remove(blogsEntry);
7270                    }
7271            }
7272    
7273            /**
7274             * Removes all the blogs entries where companyId = &#63; and displayDate &lt; &#63; from the database.
7275             *
7276             * @param companyId the company id to search with
7277             * @param displayDate the display date to search with
7278             * @throws SystemException if a system exception occurred
7279             */
7280            public void removeByC_LtD(long companyId, Date displayDate)
7281                    throws SystemException {
7282                    for (BlogsEntry blogsEntry : findByC_LtD(companyId, displayDate)) {
7283                            remove(blogsEntry);
7284                    }
7285            }
7286    
7287            /**
7288             * Removes all the blogs entries where companyId = &#63; and status = &#63; from the database.
7289             *
7290             * @param companyId the company id to search with
7291             * @param status the status to search with
7292             * @throws SystemException if a system exception occurred
7293             */
7294            public void removeByC_S(long companyId, int status)
7295                    throws SystemException {
7296                    for (BlogsEntry blogsEntry : findByC_S(companyId, status)) {
7297                            remove(blogsEntry);
7298                    }
7299            }
7300    
7301            /**
7302             * Removes the blogs entry where groupId = &#63; and urlTitle = &#63; from the database.
7303             *
7304             * @param groupId the group id to search with
7305             * @param urlTitle the url title to search with
7306             * @throws SystemException if a system exception occurred
7307             */
7308            public void removeByG_UT(long groupId, String urlTitle)
7309                    throws NoSuchEntryException, SystemException {
7310                    BlogsEntry blogsEntry = findByG_UT(groupId, urlTitle);
7311    
7312                    remove(blogsEntry);
7313            }
7314    
7315            /**
7316             * Removes all the blogs entries where groupId = &#63; and displayDate &lt; &#63; from the database.
7317             *
7318             * @param groupId the group id to search with
7319             * @param displayDate the display date to search with
7320             * @throws SystemException if a system exception occurred
7321             */
7322            public void removeByG_LtD(long groupId, Date displayDate)
7323                    throws SystemException {
7324                    for (BlogsEntry blogsEntry : findByG_LtD(groupId, displayDate)) {
7325                            remove(blogsEntry);
7326                    }
7327            }
7328    
7329            /**
7330             * Removes all the blogs entries where groupId = &#63; and status = &#63; from the database.
7331             *
7332             * @param groupId the group id to search with
7333             * @param status the status to search with
7334             * @throws SystemException if a system exception occurred
7335             */
7336            public void removeByG_S(long groupId, int status) throws SystemException {
7337                    for (BlogsEntry blogsEntry : findByG_S(groupId, status)) {
7338                            remove(blogsEntry);
7339                    }
7340            }
7341    
7342            /**
7343             * Removes all the blogs entries where companyId = &#63; and userId = &#63; and status = &#63; from the database.
7344             *
7345             * @param companyId the company id to search with
7346             * @param userId the user id to search with
7347             * @param status the status to search with
7348             * @throws SystemException if a system exception occurred
7349             */
7350            public void removeByC_U_S(long companyId, long userId, int status)
7351                    throws SystemException {
7352                    for (BlogsEntry blogsEntry : findByC_U_S(companyId, userId, status)) {
7353                            remove(blogsEntry);
7354                    }
7355            }
7356    
7357            /**
7358             * Removes all the blogs entries where companyId = &#63; and displayDate &lt; &#63; and status = &#63; from the database.
7359             *
7360             * @param companyId the company id to search with
7361             * @param displayDate the display date to search with
7362             * @param status the status to search with
7363             * @throws SystemException if a system exception occurred
7364             */
7365            public void removeByC_LtD_S(long companyId, Date displayDate, int status)
7366                    throws SystemException {
7367                    for (BlogsEntry blogsEntry : findByC_LtD_S(companyId, displayDate,
7368                                    status)) {
7369                            remove(blogsEntry);
7370                    }
7371            }
7372    
7373            /**
7374             * Removes all the blogs entries where groupId = &#63; and userId = &#63; and displayDate &lt; &#63; from the database.
7375             *
7376             * @param groupId the group id to search with
7377             * @param userId the user id to search with
7378             * @param displayDate the display date to search with
7379             * @throws SystemException if a system exception occurred
7380             */
7381            public void removeByG_U_LtD(long groupId, long userId, Date displayDate)
7382                    throws SystemException {
7383                    for (BlogsEntry blogsEntry : findByG_U_LtD(groupId, userId, displayDate)) {
7384                            remove(blogsEntry);
7385                    }
7386            }
7387    
7388            /**
7389             * Removes all the blogs entries where groupId = &#63; and userId = &#63; and status = &#63; from the database.
7390             *
7391             * @param groupId the group id to search with
7392             * @param userId the user id to search with
7393             * @param status the status to search with
7394             * @throws SystemException if a system exception occurred
7395             */
7396            public void removeByG_U_S(long groupId, long userId, int status)
7397                    throws SystemException {
7398                    for (BlogsEntry blogsEntry : findByG_U_S(groupId, userId, status)) {
7399                            remove(blogsEntry);
7400                    }
7401            }
7402    
7403            /**
7404             * Removes all the blogs entries where groupId = &#63; and displayDate &lt; &#63; and status = &#63; from the database.
7405             *
7406             * @param groupId the group id to search with
7407             * @param displayDate the display date to search with
7408             * @param status the status to search with
7409             * @throws SystemException if a system exception occurred
7410             */
7411            public void removeByG_LtD_S(long groupId, Date displayDate, int status)
7412                    throws SystemException {
7413                    for (BlogsEntry blogsEntry : findByG_LtD_S(groupId, displayDate, status)) {
7414                            remove(blogsEntry);
7415                    }
7416            }
7417    
7418            /**
7419             * Removes all the blogs entries where groupId = &#63; and userId = &#63; and displayDate &lt; &#63; and status = &#63; from the database.
7420             *
7421             * @param groupId the group id to search with
7422             * @param userId the user id to search with
7423             * @param displayDate the display date to search with
7424             * @param status the status to search with
7425             * @throws SystemException if a system exception occurred
7426             */
7427            public void removeByG_U_LtD_S(long groupId, long userId, Date displayDate,
7428                    int status) throws SystemException {
7429                    for (BlogsEntry blogsEntry : findByG_U_LtD_S(groupId, userId,
7430                                    displayDate, status)) {
7431                            remove(blogsEntry);
7432                    }
7433            }
7434    
7435            /**
7436             * Removes all the blogs entries from the database.
7437             *
7438             * @throws SystemException if a system exception occurred
7439             */
7440            public void removeAll() throws SystemException {
7441                    for (BlogsEntry blogsEntry : findAll()) {
7442                            remove(blogsEntry);
7443                    }
7444            }
7445    
7446            /**
7447             * Counts all the blogs entries where uuid = &#63;.
7448             *
7449             * @param uuid the uuid to search with
7450             * @return the number of matching blogs entries
7451             * @throws SystemException if a system exception occurred
7452             */
7453            public int countByUuid(String uuid) throws SystemException {
7454                    Object[] finderArgs = new Object[] { uuid };
7455    
7456                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
7457                                    finderArgs, this);
7458    
7459                    if (count == null) {
7460                            Session session = null;
7461    
7462                            try {
7463                                    session = openSession();
7464    
7465                                    StringBundler query = new StringBundler(2);
7466    
7467                                    query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
7468    
7469                                    if (uuid == null) {
7470                                            query.append(_FINDER_COLUMN_UUID_UUID_1);
7471                                    }
7472                                    else {
7473                                            if (uuid.equals(StringPool.BLANK)) {
7474                                                    query.append(_FINDER_COLUMN_UUID_UUID_3);
7475                                            }
7476                                            else {
7477                                                    query.append(_FINDER_COLUMN_UUID_UUID_2);
7478                                            }
7479                                    }
7480    
7481                                    String sql = query.toString();
7482    
7483                                    Query q = session.createQuery(sql);
7484    
7485                                    QueryPos qPos = QueryPos.getInstance(q);
7486    
7487                                    if (uuid != null) {
7488                                            qPos.add(uuid);
7489                                    }
7490    
7491                                    count = (Long)q.uniqueResult();
7492                            }
7493                            catch (Exception e) {
7494                                    throw processException(e);
7495                            }
7496                            finally {
7497                                    if (count == null) {
7498                                            count = Long.valueOf(0);
7499                                    }
7500    
7501                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
7502                                            finderArgs, count);
7503    
7504                                    closeSession(session);
7505                            }
7506                    }
7507    
7508                    return count.intValue();
7509            }
7510    
7511            /**
7512             * Counts all the blogs entries where uuid = &#63; and groupId = &#63;.
7513             *
7514             * @param uuid the uuid to search with
7515             * @param groupId the group id to search with
7516             * @return the number of matching blogs entries
7517             * @throws SystemException if a system exception occurred
7518             */
7519            public int countByUUID_G(String uuid, long groupId)
7520                    throws SystemException {
7521                    Object[] finderArgs = new Object[] { uuid, groupId };
7522    
7523                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
7524                                    finderArgs, this);
7525    
7526                    if (count == null) {
7527                            Session session = null;
7528    
7529                            try {
7530                                    session = openSession();
7531    
7532                                    StringBundler query = new StringBundler(3);
7533    
7534                                    query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
7535    
7536                                    if (uuid == null) {
7537                                            query.append(_FINDER_COLUMN_UUID_G_UUID_1);
7538                                    }
7539                                    else {
7540                                            if (uuid.equals(StringPool.BLANK)) {
7541                                                    query.append(_FINDER_COLUMN_UUID_G_UUID_3);
7542                                            }
7543                                            else {
7544                                                    query.append(_FINDER_COLUMN_UUID_G_UUID_2);
7545                                            }
7546                                    }
7547    
7548                                    query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
7549    
7550                                    String sql = query.toString();
7551    
7552                                    Query q = session.createQuery(sql);
7553    
7554                                    QueryPos qPos = QueryPos.getInstance(q);
7555    
7556                                    if (uuid != null) {
7557                                            qPos.add(uuid);
7558                                    }
7559    
7560                                    qPos.add(groupId);
7561    
7562                                    count = (Long)q.uniqueResult();
7563                            }
7564                            catch (Exception e) {
7565                                    throw processException(e);
7566                            }
7567                            finally {
7568                                    if (count == null) {
7569                                            count = Long.valueOf(0);
7570                                    }
7571    
7572                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
7573                                            finderArgs, count);
7574    
7575                                    closeSession(session);
7576                            }
7577                    }
7578    
7579                    return count.intValue();
7580            }
7581    
7582            /**
7583             * Counts all the blogs entries where groupId = &#63;.
7584             *
7585             * @param groupId the group id to search with
7586             * @return the number of matching blogs entries
7587             * @throws SystemException if a system exception occurred
7588             */
7589            public int countByGroupId(long groupId) throws SystemException {
7590                    Object[] finderArgs = new Object[] { groupId };
7591    
7592                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
7593                                    finderArgs, this);
7594    
7595                    if (count == null) {
7596                            Session session = null;
7597    
7598                            try {
7599                                    session = openSession();
7600    
7601                                    StringBundler query = new StringBundler(2);
7602    
7603                                    query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
7604    
7605                                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
7606    
7607                                    String sql = query.toString();
7608    
7609                                    Query q = session.createQuery(sql);
7610    
7611                                    QueryPos qPos = QueryPos.getInstance(q);
7612    
7613                                    qPos.add(groupId);
7614    
7615                                    count = (Long)q.uniqueResult();
7616                            }
7617                            catch (Exception e) {
7618                                    throw processException(e);
7619                            }
7620                            finally {
7621                                    if (count == null) {
7622                                            count = Long.valueOf(0);
7623                                    }
7624    
7625                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
7626                                            finderArgs, count);
7627    
7628                                    closeSession(session);
7629                            }
7630                    }
7631    
7632                    return count.intValue();
7633            }
7634    
7635            /**
7636             * Filters by the user's permissions and counts all the blogs entries where groupId = &#63;.
7637             *
7638             * @param groupId the group id to search with
7639             * @return the number of matching blogs entries that the user has permission to view
7640             * @throws SystemException if a system exception occurred
7641             */
7642            public int filterCountByGroupId(long groupId) throws SystemException {
7643                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
7644                            return countByGroupId(groupId);
7645                    }
7646    
7647                    Session session = null;
7648    
7649                    try {
7650                            session = openSession();
7651    
7652                            StringBundler query = new StringBundler(2);
7653    
7654                            query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE);
7655    
7656                            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
7657    
7658                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
7659                                            BlogsEntry.class.getName(), _FILTER_COLUMN_PK,
7660                                            _FILTER_COLUMN_USERID, groupId);
7661    
7662                            SQLQuery q = session.createSQLQuery(sql);
7663    
7664                            q.addScalar(COUNT_COLUMN_NAME,
7665                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
7666    
7667                            QueryPos qPos = QueryPos.getInstance(q);
7668    
7669                            qPos.add(groupId);
7670    
7671                            Long count = (Long)q.uniqueResult();
7672    
7673                            return count.intValue();
7674                    }
7675                    catch (Exception e) {
7676                            throw processException(e);
7677                    }
7678                    finally {
7679                            closeSession(session);
7680                    }
7681            }
7682    
7683            /**
7684             * Counts all the blogs entries where companyId = &#63;.
7685             *
7686             * @param companyId the company id to search with
7687             * @return the number of matching blogs entries
7688             * @throws SystemException if a system exception occurred
7689             */
7690            public int countByCompanyId(long companyId) throws SystemException {
7691                    Object[] finderArgs = new Object[] { companyId };
7692    
7693                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
7694                                    finderArgs, this);
7695    
7696                    if (count == null) {
7697                            Session session = null;
7698    
7699                            try {
7700                                    session = openSession();
7701    
7702                                    StringBundler query = new StringBundler(2);
7703    
7704                                    query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
7705    
7706                                    query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
7707    
7708                                    String sql = query.toString();
7709    
7710                                    Query q = session.createQuery(sql);
7711    
7712                                    QueryPos qPos = QueryPos.getInstance(q);
7713    
7714                                    qPos.add(companyId);
7715    
7716                                    count = (Long)q.uniqueResult();
7717                            }
7718                            catch (Exception e) {
7719                                    throw processException(e);
7720                            }
7721                            finally {
7722                                    if (count == null) {
7723                                            count = Long.valueOf(0);
7724                                    }
7725    
7726                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
7727                                            finderArgs, count);
7728    
7729                                    closeSession(session);
7730                            }
7731                    }
7732    
7733                    return count.intValue();
7734            }
7735    
7736            /**
7737             * Counts all the blogs entries where companyId = &#63; and userId = &#63;.
7738             *
7739             * @param companyId the company id to search with
7740             * @param userId the user id to search with
7741             * @return the number of matching blogs entries
7742             * @throws SystemException if a system exception occurred
7743             */
7744            public int countByC_U(long companyId, long userId)
7745                    throws SystemException {
7746                    Object[] finderArgs = new Object[] { companyId, userId };
7747    
7748                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_U,
7749                                    finderArgs, this);
7750    
7751                    if (count == null) {
7752                            Session session = null;
7753    
7754                            try {
7755                                    session = openSession();
7756    
7757                                    StringBundler query = new StringBundler(3);
7758    
7759                                    query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
7760    
7761                                    query.append(_FINDER_COLUMN_C_U_COMPANYID_2);
7762    
7763                                    query.append(_FINDER_COLUMN_C_U_USERID_2);
7764    
7765                                    String sql = query.toString();
7766    
7767                                    Query q = session.createQuery(sql);
7768    
7769                                    QueryPos qPos = QueryPos.getInstance(q);
7770    
7771                                    qPos.add(companyId);
7772    
7773                                    qPos.add(userId);
7774    
7775                                    count = (Long)q.uniqueResult();
7776                            }
7777                            catch (Exception e) {
7778                                    throw processException(e);
7779                            }
7780                            finally {
7781                                    if (count == null) {
7782                                            count = Long.valueOf(0);
7783                                    }
7784    
7785                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_U, finderArgs,
7786                                            count);
7787    
7788                                    closeSession(session);
7789                            }
7790                    }
7791    
7792                    return count.intValue();
7793            }
7794    
7795            /**
7796             * Counts all the blogs entries where companyId = &#63; and displayDate &lt; &#63;.
7797             *
7798             * @param companyId the company id to search with
7799             * @param displayDate the display date to search with
7800             * @return the number of matching blogs entries
7801             * @throws SystemException if a system exception occurred
7802             */
7803            public int countByC_LtD(long companyId, Date displayDate)
7804                    throws SystemException {
7805                    Object[] finderArgs = new Object[] { companyId, displayDate };
7806    
7807                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_LTD,
7808                                    finderArgs, this);
7809    
7810                    if (count == null) {
7811                            Session session = null;
7812    
7813                            try {
7814                                    session = openSession();
7815    
7816                                    StringBundler query = new StringBundler(3);
7817    
7818                                    query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
7819    
7820                                    query.append(_FINDER_COLUMN_C_LTD_COMPANYID_2);
7821    
7822                                    if (displayDate == null) {
7823                                            query.append(_FINDER_COLUMN_C_LTD_DISPLAYDATE_1);
7824                                    }
7825                                    else {
7826                                            query.append(_FINDER_COLUMN_C_LTD_DISPLAYDATE_2);
7827                                    }
7828    
7829                                    String sql = query.toString();
7830    
7831                                    Query q = session.createQuery(sql);
7832    
7833                                    QueryPos qPos = QueryPos.getInstance(q);
7834    
7835                                    qPos.add(companyId);
7836    
7837                                    if (displayDate != null) {
7838                                            qPos.add(CalendarUtil.getTimestamp(displayDate));
7839                                    }
7840    
7841                                    count = (Long)q.uniqueResult();
7842                            }
7843                            catch (Exception e) {
7844                                    throw processException(e);
7845                            }
7846                            finally {
7847                                    if (count == null) {
7848                                            count = Long.valueOf(0);
7849                                    }
7850    
7851                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_LTD,
7852                                            finderArgs, count);
7853    
7854                                    closeSession(session);
7855                            }
7856                    }
7857    
7858                    return count.intValue();
7859            }
7860    
7861            /**
7862             * Counts all the blogs entries where companyId = &#63; and status = &#63;.
7863             *
7864             * @param companyId the company id to search with
7865             * @param status the status to search with
7866             * @return the number of matching blogs entries
7867             * @throws SystemException if a system exception occurred
7868             */
7869            public int countByC_S(long companyId, int status) throws SystemException {
7870                    Object[] finderArgs = new Object[] { companyId, status };
7871    
7872                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_S,
7873                                    finderArgs, this);
7874    
7875                    if (count == null) {
7876                            Session session = null;
7877    
7878                            try {
7879                                    session = openSession();
7880    
7881                                    StringBundler query = new StringBundler(3);
7882    
7883                                    query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
7884    
7885                                    query.append(_FINDER_COLUMN_C_S_COMPANYID_2);
7886    
7887                                    query.append(_FINDER_COLUMN_C_S_STATUS_2);
7888    
7889                                    String sql = query.toString();
7890    
7891                                    Query q = session.createQuery(sql);
7892    
7893                                    QueryPos qPos = QueryPos.getInstance(q);
7894    
7895                                    qPos.add(companyId);
7896    
7897                                    qPos.add(status);
7898    
7899                                    count = (Long)q.uniqueResult();
7900                            }
7901                            catch (Exception e) {
7902                                    throw processException(e);
7903                            }
7904                            finally {
7905                                    if (count == null) {
7906                                            count = Long.valueOf(0);
7907                                    }
7908    
7909                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_S, finderArgs,
7910                                            count);
7911    
7912                                    closeSession(session);
7913                            }
7914                    }
7915    
7916                    return count.intValue();
7917            }
7918    
7919            /**
7920             * Counts all the blogs entries where groupId = &#63; and urlTitle = &#63;.
7921             *
7922             * @param groupId the group id to search with
7923             * @param urlTitle the url title to search with
7924             * @return the number of matching blogs entries
7925             * @throws SystemException if a system exception occurred
7926             */
7927            public int countByG_UT(long groupId, String urlTitle)
7928                    throws SystemException {
7929                    Object[] finderArgs = new Object[] { groupId, urlTitle };
7930    
7931                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_UT,
7932                                    finderArgs, this);
7933    
7934                    if (count == null) {
7935                            Session session = null;
7936    
7937                            try {
7938                                    session = openSession();
7939    
7940                                    StringBundler query = new StringBundler(3);
7941    
7942                                    query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
7943    
7944                                    query.append(_FINDER_COLUMN_G_UT_GROUPID_2);
7945    
7946                                    if (urlTitle == null) {
7947                                            query.append(_FINDER_COLUMN_G_UT_URLTITLE_1);
7948                                    }
7949                                    else {
7950                                            if (urlTitle.equals(StringPool.BLANK)) {
7951                                                    query.append(_FINDER_COLUMN_G_UT_URLTITLE_3);
7952                                            }
7953                                            else {
7954                                                    query.append(_FINDER_COLUMN_G_UT_URLTITLE_2);
7955                                            }
7956                                    }
7957    
7958                                    String sql = query.toString();
7959    
7960                                    Query q = session.createQuery(sql);
7961    
7962                                    QueryPos qPos = QueryPos.getInstance(q);
7963    
7964                                    qPos.add(groupId);
7965    
7966                                    if (urlTitle != null) {
7967                                            qPos.add(urlTitle);
7968                                    }
7969    
7970                                    count = (Long)q.uniqueResult();
7971                            }
7972                            catch (Exception e) {
7973                                    throw processException(e);
7974                            }
7975                            finally {
7976                                    if (count == null) {
7977                                            count = Long.valueOf(0);
7978                                    }
7979    
7980                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_UT,
7981                                            finderArgs, count);
7982    
7983                                    closeSession(session);
7984                            }
7985                    }
7986    
7987                    return count.intValue();
7988            }
7989    
7990            /**
7991             * Filters by the user's permissions and counts all the blogs entries where groupId = &#63; and urlTitle = &#63;.
7992             *
7993             * @param groupId the group id to search with
7994             * @param urlTitle the url title to search with
7995             * @return the number of matching blogs entries that the user has permission to view
7996             * @throws SystemException if a system exception occurred
7997             */
7998            public int filterCountByG_UT(long groupId, String urlTitle)
7999                    throws SystemException {
8000                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
8001                            return countByG_UT(groupId, urlTitle);
8002                    }
8003    
8004                    Session session = null;
8005    
8006                    try {
8007                            session = openSession();
8008    
8009                            StringBundler query = new StringBundler(3);
8010    
8011                            query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE);
8012    
8013                            query.append(_FINDER_COLUMN_G_UT_GROUPID_2);
8014    
8015                            if (urlTitle == null) {
8016                                    query.append(_FINDER_COLUMN_G_UT_URLTITLE_1);
8017                            }
8018                            else {
8019                                    if (urlTitle.equals(StringPool.BLANK)) {
8020                                            query.append(_FINDER_COLUMN_G_UT_URLTITLE_3);
8021                                    }
8022                                    else {
8023                                            query.append(_FINDER_COLUMN_G_UT_URLTITLE_2);
8024                                    }
8025                            }
8026    
8027                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
8028                                            BlogsEntry.class.getName(), _FILTER_COLUMN_PK,
8029                                            _FILTER_COLUMN_USERID, groupId);
8030    
8031                            SQLQuery q = session.createSQLQuery(sql);
8032    
8033                            q.addScalar(COUNT_COLUMN_NAME,
8034                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
8035    
8036                            QueryPos qPos = QueryPos.getInstance(q);
8037    
8038                            qPos.add(groupId);
8039    
8040                            if (urlTitle != null) {
8041                                    qPos.add(urlTitle);
8042                            }
8043    
8044                            Long count = (Long)q.uniqueResult();
8045    
8046                            return count.intValue();
8047                    }
8048                    catch (Exception e) {
8049                            throw processException(e);
8050                    }
8051                    finally {
8052                            closeSession(session);
8053                    }
8054            }
8055    
8056            /**
8057             * Counts all the blogs entries where groupId = &#63; and displayDate &lt; &#63;.
8058             *
8059             * @param groupId the group id to search with
8060             * @param displayDate the display date to search with
8061             * @return the number of matching blogs entries
8062             * @throws SystemException if a system exception occurred
8063             */
8064            public int countByG_LtD(long groupId, Date displayDate)
8065                    throws SystemException {
8066                    Object[] finderArgs = new Object[] { groupId, displayDate };
8067    
8068                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_LTD,
8069                                    finderArgs, this);
8070    
8071                    if (count == null) {
8072                            Session session = null;
8073    
8074                            try {
8075                                    session = openSession();
8076    
8077                                    StringBundler query = new StringBundler(3);
8078    
8079                                    query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
8080    
8081                                    query.append(_FINDER_COLUMN_G_LTD_GROUPID_2);
8082    
8083                                    if (displayDate == null) {
8084                                            query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_1);
8085                                    }
8086                                    else {
8087                                            query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_2);
8088                                    }
8089    
8090                                    String sql = query.toString();
8091    
8092                                    Query q = session.createQuery(sql);
8093    
8094                                    QueryPos qPos = QueryPos.getInstance(q);
8095    
8096                                    qPos.add(groupId);
8097    
8098                                    if (displayDate != null) {
8099                                            qPos.add(CalendarUtil.getTimestamp(displayDate));
8100                                    }
8101    
8102                                    count = (Long)q.uniqueResult();
8103                            }
8104                            catch (Exception e) {
8105                                    throw processException(e);
8106                            }
8107                            finally {
8108                                    if (count == null) {
8109                                            count = Long.valueOf(0);
8110                                    }
8111    
8112                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_LTD,
8113                                            finderArgs, count);
8114    
8115                                    closeSession(session);
8116                            }
8117                    }
8118    
8119                    return count.intValue();
8120            }
8121    
8122            /**
8123             * Filters by the user's permissions and counts all the blogs entries where groupId = &#63; and displayDate &lt; &#63;.
8124             *
8125             * @param groupId the group id to search with
8126             * @param displayDate the display date to search with
8127             * @return the number of matching blogs entries that the user has permission to view
8128             * @throws SystemException if a system exception occurred
8129             */
8130            public int filterCountByG_LtD(long groupId, Date displayDate)
8131                    throws SystemException {
8132                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
8133                            return countByG_LtD(groupId, displayDate);
8134                    }
8135    
8136                    Session session = null;
8137    
8138                    try {
8139                            session = openSession();
8140    
8141                            StringBundler query = new StringBundler(3);
8142    
8143                            query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE);
8144    
8145                            query.append(_FINDER_COLUMN_G_LTD_GROUPID_2);
8146    
8147                            if (displayDate == null) {
8148                                    query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_1);
8149                            }
8150                            else {
8151                                    query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_2);
8152                            }
8153    
8154                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
8155                                            BlogsEntry.class.getName(), _FILTER_COLUMN_PK,
8156                                            _FILTER_COLUMN_USERID, groupId);
8157    
8158                            SQLQuery q = session.createSQLQuery(sql);
8159    
8160                            q.addScalar(COUNT_COLUMN_NAME,
8161                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
8162    
8163                            QueryPos qPos = QueryPos.getInstance(q);
8164    
8165                            qPos.add(groupId);
8166    
8167                            if (displayDate != null) {
8168                                    qPos.add(CalendarUtil.getTimestamp(displayDate));
8169                            }
8170    
8171                            Long count = (Long)q.uniqueResult();
8172    
8173                            return count.intValue();
8174                    }
8175                    catch (Exception e) {
8176                            throw processException(e);
8177                    }
8178                    finally {
8179                            closeSession(session);
8180                    }
8181            }
8182    
8183            /**
8184             * Counts all the blogs entries where groupId = &#63; and status = &#63;.
8185             *
8186             * @param groupId the group id to search with
8187             * @param status the status to search with
8188             * @return the number of matching blogs entries
8189             * @throws SystemException if a system exception occurred
8190             */
8191            public int countByG_S(long groupId, int status) throws SystemException {
8192                    Object[] finderArgs = new Object[] { groupId, status };
8193    
8194                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_S,
8195                                    finderArgs, this);
8196    
8197                    if (count == null) {
8198                            Session session = null;
8199    
8200                            try {
8201                                    session = openSession();
8202    
8203                                    StringBundler query = new StringBundler(3);
8204    
8205                                    query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
8206    
8207                                    query.append(_FINDER_COLUMN_G_S_GROUPID_2);
8208    
8209                                    query.append(_FINDER_COLUMN_G_S_STATUS_2);
8210    
8211                                    String sql = query.toString();
8212    
8213                                    Query q = session.createQuery(sql);
8214    
8215                                    QueryPos qPos = QueryPos.getInstance(q);
8216    
8217                                    qPos.add(groupId);
8218    
8219                                    qPos.add(status);
8220    
8221                                    count = (Long)q.uniqueResult();
8222                            }
8223                            catch (Exception e) {
8224                                    throw processException(e);
8225                            }
8226                            finally {
8227                                    if (count == null) {
8228                                            count = Long.valueOf(0);
8229                                    }
8230    
8231                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_S, finderArgs,
8232                                            count);
8233    
8234                                    closeSession(session);
8235                            }
8236                    }
8237    
8238                    return count.intValue();
8239            }
8240    
8241            /**
8242             * Filters by the user's permissions and counts all the blogs entries where groupId = &#63; and status = &#63;.
8243             *
8244             * @param groupId the group id to search with
8245             * @param status the status to search with
8246             * @return the number of matching blogs entries that the user has permission to view
8247             * @throws SystemException if a system exception occurred
8248             */
8249            public int filterCountByG_S(long groupId, int status)
8250                    throws SystemException {
8251                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
8252                            return countByG_S(groupId, status);
8253                    }
8254    
8255                    Session session = null;
8256    
8257                    try {
8258                            session = openSession();
8259    
8260                            StringBundler query = new StringBundler(3);
8261    
8262                            query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE);
8263    
8264                            query.append(_FINDER_COLUMN_G_S_GROUPID_2);
8265    
8266                            query.append(_FINDER_COLUMN_G_S_STATUS_2);
8267    
8268                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
8269                                            BlogsEntry.class.getName(), _FILTER_COLUMN_PK,
8270                                            _FILTER_COLUMN_USERID, groupId);
8271    
8272                            SQLQuery q = session.createSQLQuery(sql);
8273    
8274                            q.addScalar(COUNT_COLUMN_NAME,
8275                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
8276    
8277                            QueryPos qPos = QueryPos.getInstance(q);
8278    
8279                            qPos.add(groupId);
8280    
8281                            qPos.add(status);
8282    
8283                            Long count = (Long)q.uniqueResult();
8284    
8285                            return count.intValue();
8286                    }
8287                    catch (Exception e) {
8288                            throw processException(e);
8289                    }
8290                    finally {
8291                            closeSession(session);
8292                    }
8293            }
8294    
8295            /**
8296             * Counts all the blogs entries where companyId = &#63; and userId = &#63; and status = &#63;.
8297             *
8298             * @param companyId the company id to search with
8299             * @param userId the user id to search with
8300             * @param status the status to search with
8301             * @return the number of matching blogs entries
8302             * @throws SystemException if a system exception occurred
8303             */
8304            public int countByC_U_S(long companyId, long userId, int status)
8305                    throws SystemException {
8306                    Object[] finderArgs = new Object[] { companyId, userId, status };
8307    
8308                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_U_S,
8309                                    finderArgs, this);
8310    
8311                    if (count == null) {
8312                            Session session = null;
8313    
8314                            try {
8315                                    session = openSession();
8316    
8317                                    StringBundler query = new StringBundler(4);
8318    
8319                                    query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
8320    
8321                                    query.append(_FINDER_COLUMN_C_U_S_COMPANYID_2);
8322    
8323                                    query.append(_FINDER_COLUMN_C_U_S_USERID_2);
8324    
8325                                    query.append(_FINDER_COLUMN_C_U_S_STATUS_2);
8326    
8327                                    String sql = query.toString();
8328    
8329                                    Query q = session.createQuery(sql);
8330    
8331                                    QueryPos qPos = QueryPos.getInstance(q);
8332    
8333                                    qPos.add(companyId);
8334    
8335                                    qPos.add(userId);
8336    
8337                                    qPos.add(status);
8338    
8339                                    count = (Long)q.uniqueResult();
8340                            }
8341                            catch (Exception e) {
8342                                    throw processException(e);
8343                            }
8344                            finally {
8345                                    if (count == null) {
8346                                            count = Long.valueOf(0);
8347                                    }
8348    
8349                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_U_S,
8350                                            finderArgs, count);
8351    
8352                                    closeSession(session);
8353                            }
8354                    }
8355    
8356                    return count.intValue();
8357            }
8358    
8359            /**
8360             * Counts all the blogs entries where companyId = &#63; and displayDate &lt; &#63; and status = &#63;.
8361             *
8362             * @param companyId the company id to search with
8363             * @param displayDate the display date to search with
8364             * @param status the status to search with
8365             * @return the number of matching blogs entries
8366             * @throws SystemException if a system exception occurred
8367             */
8368            public int countByC_LtD_S(long companyId, Date displayDate, int status)
8369                    throws SystemException {
8370                    Object[] finderArgs = new Object[] { companyId, displayDate, status };
8371    
8372                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_LTD_S,
8373                                    finderArgs, this);
8374    
8375                    if (count == null) {
8376                            Session session = null;
8377    
8378                            try {
8379                                    session = openSession();
8380    
8381                                    StringBundler query = new StringBundler(4);
8382    
8383                                    query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
8384    
8385                                    query.append(_FINDER_COLUMN_C_LTD_S_COMPANYID_2);
8386    
8387                                    if (displayDate == null) {
8388                                            query.append(_FINDER_COLUMN_C_LTD_S_DISPLAYDATE_1);
8389                                    }
8390                                    else {
8391                                            query.append(_FINDER_COLUMN_C_LTD_S_DISPLAYDATE_2);
8392                                    }
8393    
8394                                    query.append(_FINDER_COLUMN_C_LTD_S_STATUS_2);
8395    
8396                                    String sql = query.toString();
8397    
8398                                    Query q = session.createQuery(sql);
8399    
8400                                    QueryPos qPos = QueryPos.getInstance(q);
8401    
8402                                    qPos.add(companyId);
8403    
8404                                    if (displayDate != null) {
8405                                            qPos.add(CalendarUtil.getTimestamp(displayDate));
8406                                    }
8407    
8408                                    qPos.add(status);
8409    
8410                                    count = (Long)q.uniqueResult();
8411                            }
8412                            catch (Exception e) {
8413                                    throw processException(e);
8414                            }
8415                            finally {
8416                                    if (count == null) {
8417                                            count = Long.valueOf(0);
8418                                    }
8419    
8420                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_LTD_S,
8421                                            finderArgs, count);
8422    
8423                                    closeSession(session);
8424                            }
8425                    }
8426    
8427                    return count.intValue();
8428            }
8429    
8430            /**
8431             * Counts all the blogs entries where groupId = &#63; and userId = &#63; and displayDate &lt; &#63;.
8432             *
8433             * @param groupId the group id to search with
8434             * @param userId the user id to search with
8435             * @param displayDate the display date to search with
8436             * @return the number of matching blogs entries
8437             * @throws SystemException if a system exception occurred
8438             */
8439            public int countByG_U_LtD(long groupId, long userId, Date displayDate)
8440                    throws SystemException {
8441                    Object[] finderArgs = new Object[] { groupId, userId, displayDate };
8442    
8443                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_U_LTD,
8444                                    finderArgs, this);
8445    
8446                    if (count == null) {
8447                            Session session = null;
8448    
8449                            try {
8450                                    session = openSession();
8451    
8452                                    StringBundler query = new StringBundler(4);
8453    
8454                                    query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
8455    
8456                                    query.append(_FINDER_COLUMN_G_U_LTD_GROUPID_2);
8457    
8458                                    query.append(_FINDER_COLUMN_G_U_LTD_USERID_2);
8459    
8460                                    if (displayDate == null) {
8461                                            query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_1);
8462                                    }
8463                                    else {
8464                                            query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_2);
8465                                    }
8466    
8467                                    String sql = query.toString();
8468    
8469                                    Query q = session.createQuery(sql);
8470    
8471                                    QueryPos qPos = QueryPos.getInstance(q);
8472    
8473                                    qPos.add(groupId);
8474    
8475                                    qPos.add(userId);
8476    
8477                                    if (displayDate != null) {
8478                                            qPos.add(CalendarUtil.getTimestamp(displayDate));
8479                                    }
8480    
8481                                    count = (Long)q.uniqueResult();
8482                            }
8483                            catch (Exception e) {
8484                                    throw processException(e);
8485                            }
8486                            finally {
8487                                    if (count == null) {
8488                                            count = Long.valueOf(0);
8489                                    }
8490    
8491                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_U_LTD,
8492                                            finderArgs, count);
8493    
8494                                    closeSession(session);
8495                            }
8496                    }
8497    
8498                    return count.intValue();
8499            }
8500    
8501            /**
8502             * Filters by the user's permissions and counts all the blogs entries where groupId = &#63; and userId = &#63; and displayDate &lt; &#63;.
8503             *
8504             * @param groupId the group id to search with
8505             * @param userId the user id to search with
8506             * @param displayDate the display date to search with
8507             * @return the number of matching blogs entries that the user has permission to view
8508             * @throws SystemException if a system exception occurred
8509             */
8510            public int filterCountByG_U_LtD(long groupId, long userId, Date displayDate)
8511                    throws SystemException {
8512                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
8513                            return countByG_U_LtD(groupId, userId, displayDate);
8514                    }
8515    
8516                    Session session = null;
8517    
8518                    try {
8519                            session = openSession();
8520    
8521                            StringBundler query = new StringBundler(4);
8522    
8523                            query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE);
8524    
8525                            query.append(_FINDER_COLUMN_G_U_LTD_GROUPID_2);
8526    
8527                            query.append(_FINDER_COLUMN_G_U_LTD_USERID_2);
8528    
8529                            if (displayDate == null) {
8530                                    query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_1);
8531                            }
8532                            else {
8533                                    query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_2);
8534                            }
8535    
8536                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
8537                                            BlogsEntry.class.getName(), _FILTER_COLUMN_PK,
8538                                            _FILTER_COLUMN_USERID, groupId);
8539    
8540                            SQLQuery q = session.createSQLQuery(sql);
8541    
8542                            q.addScalar(COUNT_COLUMN_NAME,
8543                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
8544    
8545                            QueryPos qPos = QueryPos.getInstance(q);
8546    
8547                            qPos.add(groupId);
8548    
8549                            qPos.add(userId);
8550    
8551                            if (displayDate != null) {
8552                                    qPos.add(CalendarUtil.getTimestamp(displayDate));
8553                            }
8554    
8555                            Long count = (Long)q.uniqueResult();
8556    
8557                            return count.intValue();
8558                    }
8559                    catch (Exception e) {
8560                            throw processException(e);
8561                    }
8562                    finally {
8563                            closeSession(session);
8564                    }
8565            }
8566    
8567            /**
8568             * Counts all the blogs entries where groupId = &#63; and userId = &#63; and status = &#63;.
8569             *
8570             * @param groupId the group id to search with
8571             * @param userId the user id to search with
8572             * @param status the status to search with
8573             * @return the number of matching blogs entries
8574             * @throws SystemException if a system exception occurred
8575             */
8576            public int countByG_U_S(long groupId, long userId, int status)
8577                    throws SystemException {
8578                    Object[] finderArgs = new Object[] { groupId, userId, status };
8579    
8580                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_U_S,
8581                                    finderArgs, this);
8582    
8583                    if (count == null) {
8584                            Session session = null;
8585    
8586                            try {
8587                                    session = openSession();
8588    
8589                                    StringBundler query = new StringBundler(4);
8590    
8591                                    query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
8592    
8593                                    query.append(_FINDER_COLUMN_G_U_S_GROUPID_2);
8594    
8595                                    query.append(_FINDER_COLUMN_G_U_S_USERID_2);
8596    
8597                                    query.append(_FINDER_COLUMN_G_U_S_STATUS_2);
8598    
8599                                    String sql = query.toString();
8600    
8601                                    Query q = session.createQuery(sql);
8602    
8603                                    QueryPos qPos = QueryPos.getInstance(q);
8604    
8605                                    qPos.add(groupId);
8606    
8607                                    qPos.add(userId);
8608    
8609                                    qPos.add(status);
8610    
8611                                    count = (Long)q.uniqueResult();
8612                            }
8613                            catch (Exception e) {
8614                                    throw processException(e);
8615                            }
8616                            finally {
8617                                    if (count == null) {
8618                                            count = Long.valueOf(0);
8619                                    }
8620    
8621                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_U_S,
8622                                            finderArgs, count);
8623    
8624                                    closeSession(session);
8625                            }
8626                    }
8627    
8628                    return count.intValue();
8629            }
8630    
8631            /**
8632             * Filters by the user's permissions and counts all the blogs entries where groupId = &#63; and userId = &#63; and status = &#63;.
8633             *
8634             * @param groupId the group id to search with
8635             * @param userId the user id to search with
8636             * @param status the status to search with
8637             * @return the number of matching blogs entries that the user has permission to view
8638             * @throws SystemException if a system exception occurred
8639             */
8640            public int filterCountByG_U_S(long groupId, long userId, int status)
8641                    throws SystemException {
8642                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
8643                            return countByG_U_S(groupId, userId, status);
8644                    }
8645    
8646                    Session session = null;
8647    
8648                    try {
8649                            session = openSession();
8650    
8651                            StringBundler query = new StringBundler(4);
8652    
8653                            query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE);
8654    
8655                            query.append(_FINDER_COLUMN_G_U_S_GROUPID_2);
8656    
8657                            query.append(_FINDER_COLUMN_G_U_S_USERID_2);
8658    
8659                            query.append(_FINDER_COLUMN_G_U_S_STATUS_2);
8660    
8661                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
8662                                            BlogsEntry.class.getName(), _FILTER_COLUMN_PK,
8663                                            _FILTER_COLUMN_USERID, groupId);
8664    
8665                            SQLQuery q = session.createSQLQuery(sql);
8666    
8667                            q.addScalar(COUNT_COLUMN_NAME,
8668                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
8669    
8670                            QueryPos qPos = QueryPos.getInstance(q);
8671    
8672                            qPos.add(groupId);
8673    
8674                            qPos.add(userId);
8675    
8676                            qPos.add(status);
8677    
8678                            Long count = (Long)q.uniqueResult();
8679    
8680                            return count.intValue();
8681                    }
8682                    catch (Exception e) {
8683                            throw processException(e);
8684                    }
8685                    finally {
8686                            closeSession(session);
8687                    }
8688            }
8689    
8690            /**
8691             * Counts all the blogs entries where groupId = &#63; and displayDate &lt; &#63; and status = &#63;.
8692             *
8693             * @param groupId the group id to search with
8694             * @param displayDate the display date to search with
8695             * @param status the status to search with
8696             * @return the number of matching blogs entries
8697             * @throws SystemException if a system exception occurred
8698             */
8699            public int countByG_LtD_S(long groupId, Date displayDate, int status)
8700                    throws SystemException {
8701                    Object[] finderArgs = new Object[] { groupId, displayDate, status };
8702    
8703                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_LTD_S,
8704                                    finderArgs, this);
8705    
8706                    if (count == null) {
8707                            Session session = null;
8708    
8709                            try {
8710                                    session = openSession();
8711    
8712                                    StringBundler query = new StringBundler(4);
8713    
8714                                    query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
8715    
8716                                    query.append(_FINDER_COLUMN_G_LTD_S_GROUPID_2);
8717    
8718                                    if (displayDate == null) {
8719                                            query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_1);
8720                                    }
8721                                    else {
8722                                            query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_2);
8723                                    }
8724    
8725                                    query.append(_FINDER_COLUMN_G_LTD_S_STATUS_2);
8726    
8727                                    String sql = query.toString();
8728    
8729                                    Query q = session.createQuery(sql);
8730    
8731                                    QueryPos qPos = QueryPos.getInstance(q);
8732    
8733                                    qPos.add(groupId);
8734    
8735                                    if (displayDate != null) {
8736                                            qPos.add(CalendarUtil.getTimestamp(displayDate));
8737                                    }
8738    
8739                                    qPos.add(status);
8740    
8741                                    count = (Long)q.uniqueResult();
8742                            }
8743                            catch (Exception e) {
8744                                    throw processException(e);
8745                            }
8746                            finally {
8747                                    if (count == null) {
8748                                            count = Long.valueOf(0);
8749                                    }
8750    
8751                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_LTD_S,
8752                                            finderArgs, count);
8753    
8754                                    closeSession(session);
8755                            }
8756                    }
8757    
8758                    return count.intValue();
8759            }
8760    
8761            /**
8762             * Filters by the user's permissions and counts all the blogs entries where groupId = &#63; and displayDate &lt; &#63; and status = &#63;.
8763             *
8764             * @param groupId the group id to search with
8765             * @param displayDate the display date to search with
8766             * @param status the status to search with
8767             * @return the number of matching blogs entries that the user has permission to view
8768             * @throws SystemException if a system exception occurred
8769             */
8770            public int filterCountByG_LtD_S(long groupId, Date displayDate, int status)
8771                    throws SystemException {
8772                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
8773                            return countByG_LtD_S(groupId, displayDate, status);
8774                    }
8775    
8776                    Session session = null;
8777    
8778                    try {
8779                            session = openSession();
8780    
8781                            StringBundler query = new StringBundler(4);
8782    
8783                            query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE);
8784    
8785                            query.append(_FINDER_COLUMN_G_LTD_S_GROUPID_2);
8786    
8787                            if (displayDate == null) {
8788                                    query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_1);
8789                            }
8790                            else {
8791                                    query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_2);
8792                            }
8793    
8794                            query.append(_FINDER_COLUMN_G_LTD_S_STATUS_2);
8795    
8796                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
8797                                            BlogsEntry.class.getName(), _FILTER_COLUMN_PK,
8798                                            _FILTER_COLUMN_USERID, groupId);
8799    
8800                            SQLQuery q = session.createSQLQuery(sql);
8801    
8802                            q.addScalar(COUNT_COLUMN_NAME,
8803                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
8804    
8805                            QueryPos qPos = QueryPos.getInstance(q);
8806    
8807                            qPos.add(groupId);
8808    
8809                            if (displayDate != null) {
8810                                    qPos.add(CalendarUtil.getTimestamp(displayDate));
8811                            }
8812    
8813                            qPos.add(status);
8814    
8815                            Long count = (Long)q.uniqueResult();
8816    
8817                            return count.intValue();
8818                    }
8819                    catch (Exception e) {
8820                            throw processException(e);
8821                    }
8822                    finally {
8823                            closeSession(session);
8824                    }
8825            }
8826    
8827            /**
8828             * Counts all the blogs entries where groupId = &#63; and userId = &#63; and displayDate &lt; &#63; and status = &#63;.
8829             *
8830             * @param groupId the group id to search with
8831             * @param userId the user id to search with
8832             * @param displayDate the display date to search with
8833             * @param status the status to search with
8834             * @return the number of matching blogs entries
8835             * @throws SystemException if a system exception occurred
8836             */
8837            public int countByG_U_LtD_S(long groupId, long userId, Date displayDate,
8838                    int status) throws SystemException {
8839                    Object[] finderArgs = new Object[] { groupId, userId, displayDate, status };
8840    
8841                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_U_LTD_S,
8842                                    finderArgs, this);
8843    
8844                    if (count == null) {
8845                            Session session = null;
8846    
8847                            try {
8848                                    session = openSession();
8849    
8850                                    StringBundler query = new StringBundler(5);
8851    
8852                                    query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
8853    
8854                                    query.append(_FINDER_COLUMN_G_U_LTD_S_GROUPID_2);
8855    
8856                                    query.append(_FINDER_COLUMN_G_U_LTD_S_USERID_2);
8857    
8858                                    if (displayDate == null) {
8859                                            query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_1);
8860                                    }
8861                                    else {
8862                                            query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_2);
8863                                    }
8864    
8865                                    query.append(_FINDER_COLUMN_G_U_LTD_S_STATUS_2);
8866    
8867                                    String sql = query.toString();
8868    
8869                                    Query q = session.createQuery(sql);
8870    
8871                                    QueryPos qPos = QueryPos.getInstance(q);
8872    
8873                                    qPos.add(groupId);
8874    
8875                                    qPos.add(userId);
8876    
8877                                    if (displayDate != null) {
8878                                            qPos.add(CalendarUtil.getTimestamp(displayDate));
8879                                    }
8880    
8881                                    qPos.add(status);
8882    
8883                                    count = (Long)q.uniqueResult();
8884                            }
8885                            catch (Exception e) {
8886                                    throw processException(e);
8887                            }
8888                            finally {
8889                                    if (count == null) {
8890                                            count = Long.valueOf(0);
8891                                    }
8892    
8893                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_U_LTD_S,
8894                                            finderArgs, count);
8895    
8896                                    closeSession(session);
8897                            }
8898                    }
8899    
8900                    return count.intValue();
8901            }
8902    
8903            /**
8904             * Filters by the user's permissions and counts all the blogs entries where groupId = &#63; and userId = &#63; and displayDate &lt; &#63; and status = &#63;.
8905             *
8906             * @param groupId the group id to search with
8907             * @param userId the user id to search with
8908             * @param displayDate the display date to search with
8909             * @param status the status to search with
8910             * @return the number of matching blogs entries that the user has permission to view
8911             * @throws SystemException if a system exception occurred
8912             */
8913            public int filterCountByG_U_LtD_S(long groupId, long userId,
8914                    Date displayDate, int status) throws SystemException {
8915                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
8916                            return countByG_U_LtD_S(groupId, userId, displayDate, status);
8917                    }
8918    
8919                    Session session = null;
8920    
8921                    try {
8922                            session = openSession();
8923    
8924                            StringBundler query = new StringBundler(5);
8925    
8926                            query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE);
8927    
8928                            query.append(_FINDER_COLUMN_G_U_LTD_S_GROUPID_2);
8929    
8930                            query.append(_FINDER_COLUMN_G_U_LTD_S_USERID_2);
8931    
8932                            if (displayDate == null) {
8933                                    query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_1);
8934                            }
8935                            else {
8936                                    query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_2);
8937                            }
8938    
8939                            query.append(_FINDER_COLUMN_G_U_LTD_S_STATUS_2);
8940    
8941                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
8942                                            BlogsEntry.class.getName(), _FILTER_COLUMN_PK,
8943                                            _FILTER_COLUMN_USERID, groupId);
8944    
8945                            SQLQuery q = session.createSQLQuery(sql);
8946    
8947                            q.addScalar(COUNT_COLUMN_NAME,
8948                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
8949    
8950                            QueryPos qPos = QueryPos.getInstance(q);
8951    
8952                            qPos.add(groupId);
8953    
8954                            qPos.add(userId);
8955    
8956                            if (displayDate != null) {
8957                                    qPos.add(CalendarUtil.getTimestamp(displayDate));
8958                            }
8959    
8960                            qPos.add(status);
8961    
8962                            Long count = (Long)q.uniqueResult();
8963    
8964                            return count.intValue();
8965                    }
8966                    catch (Exception e) {
8967                            throw processException(e);
8968                    }
8969                    finally {
8970                            closeSession(session);
8971                    }
8972            }
8973    
8974            /**
8975             * Counts all the blogs entries.
8976             *
8977             * @return the number of blogs entries
8978             * @throws SystemException if a system exception occurred
8979             */
8980            public int countAll() throws SystemException {
8981                    Object[] finderArgs = new Object[0];
8982    
8983                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
8984                                    finderArgs, this);
8985    
8986                    if (count == null) {
8987                            Session session = null;
8988    
8989                            try {
8990                                    session = openSession();
8991    
8992                                    Query q = session.createQuery(_SQL_COUNT_BLOGSENTRY);
8993    
8994                                    count = (Long)q.uniqueResult();
8995                            }
8996                            catch (Exception e) {
8997                                    throw processException(e);
8998                            }
8999                            finally {
9000                                    if (count == null) {
9001                                            count = Long.valueOf(0);
9002                                    }
9003    
9004                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
9005                                            count);
9006    
9007                                    closeSession(session);
9008                            }
9009                    }
9010    
9011                    return count.intValue();
9012            }
9013    
9014            /**
9015             * Initializes the blogs entry persistence.
9016             */
9017            public void afterPropertiesSet() {
9018                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
9019                                            com.liferay.portal.util.PropsUtil.get(
9020                                                    "value.object.listener.com.liferay.portlet.blogs.model.BlogsEntry")));
9021    
9022                    if (listenerClassNames.length > 0) {
9023                            try {
9024                                    List<ModelListener<BlogsEntry>> listenersList = new ArrayList<ModelListener<BlogsEntry>>();
9025    
9026                                    for (String listenerClassName : listenerClassNames) {
9027                                            listenersList.add((ModelListener<BlogsEntry>)InstanceFactory.newInstance(
9028                                                            listenerClassName));
9029                                    }
9030    
9031                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
9032                            }
9033                            catch (Exception e) {
9034                                    _log.error(e);
9035                            }
9036                    }
9037            }
9038    
9039            @BeanReference(type = BlogsEntryPersistence.class)
9040            protected BlogsEntryPersistence blogsEntryPersistence;
9041            @BeanReference(type = BlogsStatsUserPersistence.class)
9042            protected BlogsStatsUserPersistence blogsStatsUserPersistence;
9043            @BeanReference(type = CompanyPersistence.class)
9044            protected CompanyPersistence companyPersistence;
9045            @BeanReference(type = GroupPersistence.class)
9046            protected GroupPersistence groupPersistence;
9047            @BeanReference(type = OrganizationPersistence.class)
9048            protected OrganizationPersistence organizationPersistence;
9049            @BeanReference(type = PortletPreferencesPersistence.class)
9050            protected PortletPreferencesPersistence portletPreferencesPersistence;
9051            @BeanReference(type = ResourcePersistence.class)
9052            protected ResourcePersistence resourcePersistence;
9053            @BeanReference(type = UserPersistence.class)
9054            protected UserPersistence userPersistence;
9055            @BeanReference(type = WorkflowInstanceLinkPersistence.class)
9056            protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
9057            @BeanReference(type = AssetEntryPersistence.class)
9058            protected AssetEntryPersistence assetEntryPersistence;
9059            @BeanReference(type = AssetTagPersistence.class)
9060            protected AssetTagPersistence assetTagPersistence;
9061            @BeanReference(type = ExpandoValuePersistence.class)
9062            protected ExpandoValuePersistence expandoValuePersistence;
9063            @BeanReference(type = MBMessagePersistence.class)
9064            protected MBMessagePersistence mbMessagePersistence;
9065            @BeanReference(type = RatingsStatsPersistence.class)
9066            protected RatingsStatsPersistence ratingsStatsPersistence;
9067            @BeanReference(type = SocialActivityPersistence.class)
9068            protected SocialActivityPersistence socialActivityPersistence;
9069            @BeanReference(type = SocialEquityLogPersistence.class)
9070            protected SocialEquityLogPersistence socialEquityLogPersistence;
9071            private static final String _SQL_SELECT_BLOGSENTRY = "SELECT blogsEntry FROM BlogsEntry blogsEntry";
9072            private static final String _SQL_SELECT_BLOGSENTRY_WHERE = "SELECT blogsEntry FROM BlogsEntry blogsEntry WHERE ";
9073            private static final String _SQL_COUNT_BLOGSENTRY = "SELECT COUNT(blogsEntry) FROM BlogsEntry blogsEntry";
9074            private static final String _SQL_COUNT_BLOGSENTRY_WHERE = "SELECT COUNT(blogsEntry) FROM BlogsEntry blogsEntry WHERE ";
9075            private static final String _FINDER_COLUMN_UUID_UUID_1 = "blogsEntry.uuid IS NULL";
9076            private static final String _FINDER_COLUMN_UUID_UUID_2 = "blogsEntry.uuid = ?";
9077            private static final String _FINDER_COLUMN_UUID_UUID_3 = "(blogsEntry.uuid IS NULL OR blogsEntry.uuid = ?)";
9078            private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "blogsEntry.uuid IS NULL AND ";
9079            private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "blogsEntry.uuid = ? AND ";
9080            private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(blogsEntry.uuid IS NULL OR blogsEntry.uuid = ?) AND ";
9081            private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "blogsEntry.groupId = ?";
9082            private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "blogsEntry.groupId = ?";
9083            private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "blogsEntry.companyId = ?";
9084            private static final String _FINDER_COLUMN_C_U_COMPANYID_2 = "blogsEntry.companyId = ? AND ";
9085            private static final String _FINDER_COLUMN_C_U_USERID_2 = "blogsEntry.userId = ?";
9086            private static final String _FINDER_COLUMN_C_LTD_COMPANYID_2 = "blogsEntry.companyId = ? AND ";
9087            private static final String _FINDER_COLUMN_C_LTD_DISPLAYDATE_1 = "blogsEntry.displayDate < NULL";
9088            private static final String _FINDER_COLUMN_C_LTD_DISPLAYDATE_2 = "blogsEntry.displayDate < ?";
9089            private static final String _FINDER_COLUMN_C_S_COMPANYID_2 = "blogsEntry.companyId = ? AND ";
9090            private static final String _FINDER_COLUMN_C_S_STATUS_2 = "blogsEntry.status = ?";
9091            private static final String _FINDER_COLUMN_G_UT_GROUPID_2 = "blogsEntry.groupId = ? AND ";
9092            private static final String _FINDER_COLUMN_G_UT_URLTITLE_1 = "blogsEntry.urlTitle IS NULL";
9093            private static final String _FINDER_COLUMN_G_UT_URLTITLE_2 = "blogsEntry.urlTitle = ?";
9094            private static final String _FINDER_COLUMN_G_UT_URLTITLE_3 = "(blogsEntry.urlTitle IS NULL OR blogsEntry.urlTitle = ?)";
9095            private static final String _FINDER_COLUMN_G_LTD_GROUPID_2 = "blogsEntry.groupId = ? AND ";
9096            private static final String _FINDER_COLUMN_G_LTD_DISPLAYDATE_1 = "blogsEntry.displayDate < NULL";
9097            private static final String _FINDER_COLUMN_G_LTD_DISPLAYDATE_2 = "blogsEntry.displayDate < ?";
9098            private static final String _FINDER_COLUMN_G_S_GROUPID_2 = "blogsEntry.groupId = ? AND ";
9099            private static final String _FINDER_COLUMN_G_S_STATUS_2 = "blogsEntry.status = ?";
9100            private static final String _FINDER_COLUMN_C_U_S_COMPANYID_2 = "blogsEntry.companyId = ? AND ";
9101            private static final String _FINDER_COLUMN_C_U_S_USERID_2 = "blogsEntry.userId = ? AND ";
9102            private static final String _FINDER_COLUMN_C_U_S_STATUS_2 = "blogsEntry.status = ?";
9103            private static final String _FINDER_COLUMN_C_LTD_S_COMPANYID_2 = "blogsEntry.companyId = ? AND ";
9104            private static final String _FINDER_COLUMN_C_LTD_S_DISPLAYDATE_1 = "blogsEntry.displayDate < NULL AND ";
9105            private static final String _FINDER_COLUMN_C_LTD_S_DISPLAYDATE_2 = "blogsEntry.displayDate < ? AND ";
9106            private static final String _FINDER_COLUMN_C_LTD_S_STATUS_2 = "blogsEntry.status = ?";
9107            private static final String _FINDER_COLUMN_G_U_LTD_GROUPID_2 = "blogsEntry.groupId = ? AND ";
9108            private static final String _FINDER_COLUMN_G_U_LTD_USERID_2 = "blogsEntry.userId = ? AND ";
9109            private static final String _FINDER_COLUMN_G_U_LTD_DISPLAYDATE_1 = "blogsEntry.displayDate < NULL";
9110            private static final String _FINDER_COLUMN_G_U_LTD_DISPLAYDATE_2 = "blogsEntry.displayDate < ?";
9111            private static final String _FINDER_COLUMN_G_U_S_GROUPID_2 = "blogsEntry.groupId = ? AND ";
9112            private static final String _FINDER_COLUMN_G_U_S_USERID_2 = "blogsEntry.userId = ? AND ";
9113            private static final String _FINDER_COLUMN_G_U_S_STATUS_2 = "blogsEntry.status = ?";
9114            private static final String _FINDER_COLUMN_G_LTD_S_GROUPID_2 = "blogsEntry.groupId = ? AND ";
9115            private static final String _FINDER_COLUMN_G_LTD_S_DISPLAYDATE_1 = "blogsEntry.displayDate < NULL AND ";
9116            private static final String _FINDER_COLUMN_G_LTD_S_DISPLAYDATE_2 = "blogsEntry.displayDate < ? AND ";
9117            private static final String _FINDER_COLUMN_G_LTD_S_STATUS_2 = "blogsEntry.status = ?";
9118            private static final String _FINDER_COLUMN_G_U_LTD_S_GROUPID_2 = "blogsEntry.groupId = ? AND ";
9119            private static final String _FINDER_COLUMN_G_U_LTD_S_USERID_2 = "blogsEntry.userId = ? AND ";
9120            private static final String _FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_1 = "blogsEntry.displayDate < NULL AND ";
9121            private static final String _FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_2 = "blogsEntry.displayDate < ? AND ";
9122            private static final String _FINDER_COLUMN_G_U_LTD_S_STATUS_2 = "blogsEntry.status = ?";
9123            private static final String _FILTER_SQL_SELECT_BLOGSENTRY_WHERE = "SELECT DISTINCT {blogsEntry.*} FROM BlogsEntry blogsEntry WHERE ";
9124            private static final String _FILTER_SQL_COUNT_BLOGSENTRY_WHERE = "SELECT COUNT(DISTINCT blogsEntry.entryId) AS COUNT_VALUE FROM BlogsEntry blogsEntry WHERE ";
9125            private static final String _FILTER_COLUMN_PK = "blogsEntry.entryId";
9126            private static final String _FILTER_COLUMN_USERID = "blogsEntry.userId";
9127            private static final String _FILTER_ENTITY_ALIAS = "blogsEntry";
9128            private static final String _ORDER_BY_ENTITY_ALIAS = "blogsEntry.";
9129            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No BlogsEntry exists with the primary key ";
9130            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No BlogsEntry exists with the key {";
9131            private static Log _log = LogFactoryUtil.getLog(BlogsEntryPersistenceImpl.class);
9132    }