001    /**
002     * Copyright (c) 2000-2012 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.bean.BeanReference;
019    import com.liferay.portal.kernel.cache.CacheRegistryUtil;
020    import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
021    import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
022    import com.liferay.portal.kernel.dao.orm.FinderPath;
023    import com.liferay.portal.kernel.dao.orm.Query;
024    import com.liferay.portal.kernel.dao.orm.QueryPos;
025    import com.liferay.portal.kernel.dao.orm.QueryUtil;
026    import com.liferay.portal.kernel.dao.orm.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.CacheModel;
045    import com.liferay.portal.model.ModelListener;
046    import com.liferay.portal.security.auth.PrincipalThreadLocal;
047    import com.liferay.portal.security.permission.InlineSQLHelperUtil;
048    import com.liferay.portal.service.persistence.BatchSessionUtil;
049    import com.liferay.portal.service.persistence.CompanyPersistence;
050    import com.liferay.portal.service.persistence.GroupPersistence;
051    import com.liferay.portal.service.persistence.ImagePersistence;
052    import com.liferay.portal.service.persistence.OrganizationPersistence;
053    import com.liferay.portal.service.persistence.PortletPreferencesPersistence;
054    import com.liferay.portal.service.persistence.ResourcePersistence;
055    import com.liferay.portal.service.persistence.SubscriptionPersistence;
056    import com.liferay.portal.service.persistence.UserPersistence;
057    import com.liferay.portal.service.persistence.WorkflowInstanceLinkPersistence;
058    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
059    
060    import com.liferay.portlet.asset.service.persistence.AssetEntryPersistence;
061    import com.liferay.portlet.asset.service.persistence.AssetLinkPersistence;
062    import com.liferay.portlet.asset.service.persistence.AssetTagPersistence;
063    import com.liferay.portlet.blogs.NoSuchEntryException;
064    import com.liferay.portlet.blogs.model.BlogsEntry;
065    import com.liferay.portlet.blogs.model.impl.BlogsEntryImpl;
066    import com.liferay.portlet.blogs.model.impl.BlogsEntryModelImpl;
067    import com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence;
068    import com.liferay.portlet.messageboards.service.persistence.MBMessagePersistence;
069    import com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence;
070    import com.liferay.portlet.social.service.persistence.SocialActivityPersistence;
071    
072    import java.io.Serializable;
073    
074    import java.util.ArrayList;
075    import java.util.Collections;
076    import java.util.Date;
077    import java.util.List;
078    
079    /**
080     * The persistence implementation for the blogs entry service.
081     *
082     * <p>
083     * Caching information and settings can be found in <code>portal.properties</code>
084     * </p>
085     *
086     * @author Brian Wing Shun Chan
087     * @see BlogsEntryPersistence
088     * @see BlogsEntryUtil
089     * @generated
090     */
091    public class BlogsEntryPersistenceImpl extends BasePersistenceImpl<BlogsEntry>
092            implements BlogsEntryPersistence {
093            /*
094             * NOTE FOR DEVELOPERS:
095             *
096             * 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.
097             */
098            public static final String FINDER_CLASS_NAME_ENTITY = BlogsEntryImpl.class.getName();
099            public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
100                    ".List1";
101            public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
102                    ".List2";
103            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
104                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
105                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByUuid",
106                            new String[] {
107                                    String.class.getName(),
108                                    
109                            "java.lang.Integer", "java.lang.Integer",
110                                    "com.liferay.portal.kernel.util.OrderByComparator"
111                            });
112            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
113                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
114                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUuid",
115                            new String[] { String.class.getName() },
116                            BlogsEntryModelImpl.UUID_COLUMN_BITMASK);
117            public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
118                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
119                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUuid",
120                            new String[] { String.class.getName() });
121            public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
122                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
123                            FINDER_CLASS_NAME_ENTITY, "fetchByUUID_G",
124                            new String[] { String.class.getName(), Long.class.getName() },
125                            BlogsEntryModelImpl.UUID_COLUMN_BITMASK |
126                            BlogsEntryModelImpl.GROUPID_COLUMN_BITMASK);
127            public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
128                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
129                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUUID_G",
130                            new String[] { String.class.getName(), Long.class.getName() });
131            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
132                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
133                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByGroupId",
134                            new String[] {
135                                    Long.class.getName(),
136                                    
137                            "java.lang.Integer", "java.lang.Integer",
138                                    "com.liferay.portal.kernel.util.OrderByComparator"
139                            });
140            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID =
141                    new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
142                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
143                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByGroupId",
144                            new String[] { Long.class.getName() },
145                            BlogsEntryModelImpl.GROUPID_COLUMN_BITMASK);
146            public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
147                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
148                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByGroupId",
149                            new String[] { Long.class.getName() });
150            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID =
151                    new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
152                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
153                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByCompanyId",
154                            new String[] {
155                                    Long.class.getName(),
156                                    
157                            "java.lang.Integer", "java.lang.Integer",
158                                    "com.liferay.portal.kernel.util.OrderByComparator"
159                            });
160            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID =
161                    new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
162                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
163                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByCompanyId",
164                            new String[] { Long.class.getName() },
165                            BlogsEntryModelImpl.COMPANYID_COLUMN_BITMASK);
166            public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
167                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
168                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByCompanyId",
169                            new String[] { Long.class.getName() });
170            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_U = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
171                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
172                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_U",
173                            new String[] {
174                                    Long.class.getName(), Long.class.getName(),
175                                    
176                            "java.lang.Integer", "java.lang.Integer",
177                                    "com.liferay.portal.kernel.util.OrderByComparator"
178                            });
179            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_U = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
180                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
181                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_U",
182                            new String[] { Long.class.getName(), Long.class.getName() },
183                            BlogsEntryModelImpl.COMPANYID_COLUMN_BITMASK |
184                            BlogsEntryModelImpl.USERID_COLUMN_BITMASK);
185            public static final FinderPath FINDER_PATH_COUNT_BY_C_U = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
186                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
187                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_U",
188                            new String[] { Long.class.getName(), Long.class.getName() });
189            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_LTD = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
190                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
191                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_LtD",
192                            new String[] {
193                                    Long.class.getName(), Date.class.getName(),
194                                    
195                            "java.lang.Integer", "java.lang.Integer",
196                                    "com.liferay.portal.kernel.util.OrderByComparator"
197                            });
198            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_LTD = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
199                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
200                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_LtD",
201                            new String[] { Long.class.getName(), Date.class.getName() },
202                            BlogsEntryModelImpl.COMPANYID_COLUMN_BITMASK |
203                            BlogsEntryModelImpl.DISPLAYDATE_COLUMN_BITMASK);
204            public static final FinderPath FINDER_PATH_COUNT_BY_C_LTD = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
205                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
206                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_LtD",
207                            new String[] { Long.class.getName(), Date.class.getName() });
208            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
209                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
210                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_S",
211                            new String[] {
212                                    Long.class.getName(), Integer.class.getName(),
213                                    
214                            "java.lang.Integer", "java.lang.Integer",
215                                    "com.liferay.portal.kernel.util.OrderByComparator"
216                            });
217            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
218                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
219                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_S",
220                            new String[] { Long.class.getName(), Integer.class.getName() },
221                            BlogsEntryModelImpl.COMPANYID_COLUMN_BITMASK |
222                            BlogsEntryModelImpl.STATUS_COLUMN_BITMASK);
223            public static final FinderPath FINDER_PATH_COUNT_BY_C_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
224                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
225                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_S",
226                            new String[] { Long.class.getName(), Integer.class.getName() });
227            public static final FinderPath FINDER_PATH_FETCH_BY_G_UT = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
228                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
229                            FINDER_CLASS_NAME_ENTITY, "fetchByG_UT",
230                            new String[] { Long.class.getName(), String.class.getName() },
231                            BlogsEntryModelImpl.GROUPID_COLUMN_BITMASK |
232                            BlogsEntryModelImpl.URLTITLE_COLUMN_BITMASK);
233            public static final FinderPath FINDER_PATH_COUNT_BY_G_UT = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
234                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
235                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_UT",
236                            new String[] { Long.class.getName(), String.class.getName() });
237            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_LTD = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
238                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
239                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_LtD",
240                            new String[] {
241                                    Long.class.getName(), Date.class.getName(),
242                                    
243                            "java.lang.Integer", "java.lang.Integer",
244                                    "com.liferay.portal.kernel.util.OrderByComparator"
245                            });
246            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_LTD = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
247                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
248                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_LtD",
249                            new String[] { Long.class.getName(), Date.class.getName() },
250                            BlogsEntryModelImpl.GROUPID_COLUMN_BITMASK |
251                            BlogsEntryModelImpl.DISPLAYDATE_COLUMN_BITMASK);
252            public static final FinderPath FINDER_PATH_COUNT_BY_G_LTD = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
253                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
254                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_LtD",
255                            new String[] { Long.class.getName(), Date.class.getName() });
256            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
257                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
258                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_S",
259                            new String[] {
260                                    Long.class.getName(), Integer.class.getName(),
261                                    
262                            "java.lang.Integer", "java.lang.Integer",
263                                    "com.liferay.portal.kernel.util.OrderByComparator"
264                            });
265            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
266                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
267                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_S",
268                            new String[] { Long.class.getName(), Integer.class.getName() },
269                            BlogsEntryModelImpl.GROUPID_COLUMN_BITMASK |
270                            BlogsEntryModelImpl.STATUS_COLUMN_BITMASK);
271            public static final FinderPath FINDER_PATH_COUNT_BY_G_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
272                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
273                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_S",
274                            new String[] { Long.class.getName(), Integer.class.getName() });
275            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_U_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
276                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
277                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_U_S",
278                            new String[] {
279                                    Long.class.getName(), Long.class.getName(),
280                                    Integer.class.getName(),
281                                    
282                            "java.lang.Integer", "java.lang.Integer",
283                                    "com.liferay.portal.kernel.util.OrderByComparator"
284                            });
285            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_U_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
286                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
287                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_U_S",
288                            new String[] {
289                                    Long.class.getName(), Long.class.getName(),
290                                    Integer.class.getName()
291                            },
292                            BlogsEntryModelImpl.COMPANYID_COLUMN_BITMASK |
293                            BlogsEntryModelImpl.USERID_COLUMN_BITMASK |
294                            BlogsEntryModelImpl.STATUS_COLUMN_BITMASK);
295            public static final FinderPath FINDER_PATH_COUNT_BY_C_U_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
296                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
297                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_U_S",
298                            new String[] {
299                                    Long.class.getName(), Long.class.getName(),
300                                    Integer.class.getName()
301                            });
302            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_LTD_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
303                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
304                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_LtD_S",
305                            new String[] {
306                                    Long.class.getName(), Date.class.getName(),
307                                    Integer.class.getName(),
308                                    
309                            "java.lang.Integer", "java.lang.Integer",
310                                    "com.liferay.portal.kernel.util.OrderByComparator"
311                            });
312            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_LTD_S =
313                    new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
314                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
315                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_LtD_S",
316                            new String[] {
317                                    Long.class.getName(), Date.class.getName(),
318                                    Integer.class.getName()
319                            },
320                            BlogsEntryModelImpl.COMPANYID_COLUMN_BITMASK |
321                            BlogsEntryModelImpl.DISPLAYDATE_COLUMN_BITMASK |
322                            BlogsEntryModelImpl.STATUS_COLUMN_BITMASK);
323            public static final FinderPath FINDER_PATH_COUNT_BY_C_LTD_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
324                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
325                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_LtD_S",
326                            new String[] {
327                                    Long.class.getName(), Date.class.getName(),
328                                    Integer.class.getName()
329                            });
330            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_U_LTD = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
331                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
332                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_U_LtD",
333                            new String[] {
334                                    Long.class.getName(), Long.class.getName(), Date.class.getName(),
335                                    
336                            "java.lang.Integer", "java.lang.Integer",
337                                    "com.liferay.portal.kernel.util.OrderByComparator"
338                            });
339            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U_LTD =
340                    new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
341                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
342                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_U_LtD",
343                            new String[] {
344                                    Long.class.getName(), Long.class.getName(), Date.class.getName()
345                            },
346                            BlogsEntryModelImpl.GROUPID_COLUMN_BITMASK |
347                            BlogsEntryModelImpl.USERID_COLUMN_BITMASK |
348                            BlogsEntryModelImpl.DISPLAYDATE_COLUMN_BITMASK);
349            public static final FinderPath FINDER_PATH_COUNT_BY_G_U_LTD = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
350                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
351                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_U_LtD",
352                            new String[] {
353                                    Long.class.getName(), Long.class.getName(), Date.class.getName()
354                            });
355            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_U_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
356                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
357                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_U_S",
358                            new String[] {
359                                    Long.class.getName(), Long.class.getName(),
360                                    Integer.class.getName(),
361                                    
362                            "java.lang.Integer", "java.lang.Integer",
363                                    "com.liferay.portal.kernel.util.OrderByComparator"
364                            });
365            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
366                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
367                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_U_S",
368                            new String[] {
369                                    Long.class.getName(), Long.class.getName(),
370                                    Integer.class.getName()
371                            },
372                            BlogsEntryModelImpl.GROUPID_COLUMN_BITMASK |
373                            BlogsEntryModelImpl.USERID_COLUMN_BITMASK |
374                            BlogsEntryModelImpl.STATUS_COLUMN_BITMASK);
375            public static final FinderPath FINDER_PATH_COUNT_BY_G_U_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
376                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
377                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_U_S",
378                            new String[] {
379                                    Long.class.getName(), Long.class.getName(),
380                                    Integer.class.getName()
381                            });
382            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_LTD_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
383                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
384                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_LtD_S",
385                            new String[] {
386                                    Long.class.getName(), Date.class.getName(),
387                                    Integer.class.getName(),
388                                    
389                            "java.lang.Integer", "java.lang.Integer",
390                                    "com.liferay.portal.kernel.util.OrderByComparator"
391                            });
392            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_LTD_S =
393                    new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
394                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
395                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_LtD_S",
396                            new String[] {
397                                    Long.class.getName(), Date.class.getName(),
398                                    Integer.class.getName()
399                            },
400                            BlogsEntryModelImpl.GROUPID_COLUMN_BITMASK |
401                            BlogsEntryModelImpl.DISPLAYDATE_COLUMN_BITMASK |
402                            BlogsEntryModelImpl.STATUS_COLUMN_BITMASK);
403            public static final FinderPath FINDER_PATH_COUNT_BY_G_LTD_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
404                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
405                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_LtD_S",
406                            new String[] {
407                                    Long.class.getName(), Date.class.getName(),
408                                    Integer.class.getName()
409                            });
410            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_U_LTD_S =
411                    new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
412                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
413                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_U_LtD_S",
414                            new String[] {
415                                    Long.class.getName(), Long.class.getName(), Date.class.getName(),
416                                    Integer.class.getName(),
417                                    
418                            "java.lang.Integer", "java.lang.Integer",
419                                    "com.liferay.portal.kernel.util.OrderByComparator"
420                            });
421            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U_LTD_S =
422                    new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
423                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
424                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_U_LtD_S",
425                            new String[] {
426                                    Long.class.getName(), Long.class.getName(), Date.class.getName(),
427                                    Integer.class.getName()
428                            },
429                            BlogsEntryModelImpl.GROUPID_COLUMN_BITMASK |
430                            BlogsEntryModelImpl.USERID_COLUMN_BITMASK |
431                            BlogsEntryModelImpl.DISPLAYDATE_COLUMN_BITMASK |
432                            BlogsEntryModelImpl.STATUS_COLUMN_BITMASK);
433            public static final FinderPath FINDER_PATH_COUNT_BY_G_U_LTD_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
434                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
435                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_U_LtD_S",
436                            new String[] {
437                                    Long.class.getName(), Long.class.getName(), Date.class.getName(),
438                                    Integer.class.getName()
439                            });
440            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
441                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
442                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
443            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
444                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, BlogsEntryImpl.class,
445                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
446            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
447                            BlogsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
448                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
449    
450            /**
451             * Caches the blogs entry in the entity cache if it is enabled.
452             *
453             * @param blogsEntry the blogs entry
454             */
455            public void cacheResult(BlogsEntry blogsEntry) {
456                    EntityCacheUtil.putResult(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
457                            BlogsEntryImpl.class, blogsEntry.getPrimaryKey(), blogsEntry);
458    
459                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
460                            new Object[] {
461                                    blogsEntry.getUuid(), Long.valueOf(blogsEntry.getGroupId())
462                            }, blogsEntry);
463    
464                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_UT,
465                            new Object[] {
466                                    Long.valueOf(blogsEntry.getGroupId()),
467                                    
468                            blogsEntry.getUrlTitle()
469                            }, blogsEntry);
470    
471                    blogsEntry.resetOriginalValues();
472            }
473    
474            /**
475             * Caches the blogs entries in the entity cache if it is enabled.
476             *
477             * @param blogsEntries the blogs entries
478             */
479            public void cacheResult(List<BlogsEntry> blogsEntries) {
480                    for (BlogsEntry blogsEntry : blogsEntries) {
481                            if (EntityCacheUtil.getResult(
482                                                    BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
483                                                    BlogsEntryImpl.class, blogsEntry.getPrimaryKey()) == null) {
484                                    cacheResult(blogsEntry);
485                            }
486                            else {
487                                    blogsEntry.resetOriginalValues();
488                            }
489                    }
490            }
491    
492            /**
493             * Clears the cache for all blogs entries.
494             *
495             * <p>
496             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
497             * </p>
498             */
499            @Override
500            public void clearCache() {
501                    if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
502                            CacheRegistryUtil.clear(BlogsEntryImpl.class.getName());
503                    }
504    
505                    EntityCacheUtil.clearCache(BlogsEntryImpl.class.getName());
506    
507                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
508                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
509                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
510            }
511    
512            /**
513             * Clears the cache for the blogs entry.
514             *
515             * <p>
516             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
517             * </p>
518             */
519            @Override
520            public void clearCache(BlogsEntry blogsEntry) {
521                    EntityCacheUtil.removeResult(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
522                            BlogsEntryImpl.class, blogsEntry.getPrimaryKey());
523    
524                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
525                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
526    
527                    clearUniqueFindersCache(blogsEntry);
528            }
529    
530            @Override
531            public void clearCache(List<BlogsEntry> blogsEntries) {
532                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
533                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
534    
535                    for (BlogsEntry blogsEntry : blogsEntries) {
536                            EntityCacheUtil.removeResult(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
537                                    BlogsEntryImpl.class, blogsEntry.getPrimaryKey());
538    
539                            clearUniqueFindersCache(blogsEntry);
540                    }
541            }
542    
543            protected void clearUniqueFindersCache(BlogsEntry blogsEntry) {
544                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
545                            new Object[] {
546                                    blogsEntry.getUuid(), Long.valueOf(blogsEntry.getGroupId())
547                            });
548    
549                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_UT,
550                            new Object[] {
551                                    Long.valueOf(blogsEntry.getGroupId()),
552                                    
553                            blogsEntry.getUrlTitle()
554                            });
555            }
556    
557            /**
558             * Creates a new blogs entry with the primary key. Does not add the blogs entry to the database.
559             *
560             * @param entryId the primary key for the new blogs entry
561             * @return the new blogs entry
562             */
563            public BlogsEntry create(long entryId) {
564                    BlogsEntry blogsEntry = new BlogsEntryImpl();
565    
566                    blogsEntry.setNew(true);
567                    blogsEntry.setPrimaryKey(entryId);
568    
569                    String uuid = PortalUUIDUtil.generate();
570    
571                    blogsEntry.setUuid(uuid);
572    
573                    return blogsEntry;
574            }
575    
576            /**
577             * Removes the blogs entry with the primary key from the database. Also notifies the appropriate model listeners.
578             *
579             * @param entryId the primary key of the blogs entry
580             * @return the blogs entry that was removed
581             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
582             * @throws SystemException if a system exception occurred
583             */
584            public BlogsEntry remove(long entryId)
585                    throws NoSuchEntryException, SystemException {
586                    return remove(Long.valueOf(entryId));
587            }
588    
589            /**
590             * Removes the blogs entry with the primary key from the database. Also notifies the appropriate model listeners.
591             *
592             * @param primaryKey the primary key of the blogs entry
593             * @return the blogs entry that was removed
594             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
595             * @throws SystemException if a system exception occurred
596             */
597            @Override
598            public BlogsEntry remove(Serializable primaryKey)
599                    throws NoSuchEntryException, SystemException {
600                    Session session = null;
601    
602                    try {
603                            session = openSession();
604    
605                            BlogsEntry blogsEntry = (BlogsEntry)session.get(BlogsEntryImpl.class,
606                                            primaryKey);
607    
608                            if (blogsEntry == null) {
609                                    if (_log.isWarnEnabled()) {
610                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
611                                    }
612    
613                                    throw new NoSuchEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
614                                            primaryKey);
615                            }
616    
617                            return remove(blogsEntry);
618                    }
619                    catch (NoSuchEntryException nsee) {
620                            throw nsee;
621                    }
622                    catch (Exception e) {
623                            throw processException(e);
624                    }
625                    finally {
626                            closeSession(session);
627                    }
628            }
629    
630            @Override
631            protected BlogsEntry removeImpl(BlogsEntry blogsEntry)
632                    throws SystemException {
633                    blogsEntry = toUnwrappedModel(blogsEntry);
634    
635                    Session session = null;
636    
637                    try {
638                            session = openSession();
639    
640                            BatchSessionUtil.delete(session, blogsEntry);
641                    }
642                    catch (Exception e) {
643                            throw processException(e);
644                    }
645                    finally {
646                            closeSession(session);
647                    }
648    
649                    clearCache(blogsEntry);
650    
651                    return blogsEntry;
652            }
653    
654            @Override
655            public BlogsEntry updateImpl(
656                    com.liferay.portlet.blogs.model.BlogsEntry blogsEntry, boolean merge)
657                    throws SystemException {
658                    blogsEntry = toUnwrappedModel(blogsEntry);
659    
660                    boolean isNew = blogsEntry.isNew();
661    
662                    BlogsEntryModelImpl blogsEntryModelImpl = (BlogsEntryModelImpl)blogsEntry;
663    
664                    if (Validator.isNull(blogsEntry.getUuid())) {
665                            String uuid = PortalUUIDUtil.generate();
666    
667                            blogsEntry.setUuid(uuid);
668                    }
669    
670                    long userId = GetterUtil.getLong(PrincipalThreadLocal.getName());
671    
672                    if (userId > 0) {
673                            long companyId = blogsEntry.getCompanyId();
674    
675                            long groupId = blogsEntry.getGroupId();
676    
677                            long entryId = 0;
678    
679                            if (!isNew) {
680                                    entryId = blogsEntry.getPrimaryKey();
681                            }
682    
683                            try {
684                                    blogsEntry.setTitle(SanitizerUtil.sanitize(companyId, groupId,
685                                                    userId,
686                                                    com.liferay.portlet.blogs.model.BlogsEntry.class.getName(),
687                                                    entryId, ContentTypes.TEXT_PLAIN, Sanitizer.MODE_ALL,
688                                                    blogsEntry.getTitle(), null));
689    
690                                    blogsEntry.setContent(SanitizerUtil.sanitize(companyId,
691                                                    groupId, userId,
692                                                    com.liferay.portlet.blogs.model.BlogsEntry.class.getName(),
693                                                    entryId, ContentTypes.TEXT_HTML, Sanitizer.MODE_ALL,
694                                                    blogsEntry.getContent(), null));
695                            }
696                            catch (SanitizerException se) {
697                                    throw new SystemException(se);
698                            }
699                    }
700    
701                    Session session = null;
702    
703                    try {
704                            session = openSession();
705    
706                            BatchSessionUtil.update(session, blogsEntry, merge);
707    
708                            blogsEntry.setNew(false);
709                    }
710                    catch (Exception e) {
711                            throw processException(e);
712                    }
713                    finally {
714                            closeSession(session);
715                    }
716    
717                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
718    
719                    if (isNew || !BlogsEntryModelImpl.COLUMN_BITMASK_ENABLED) {
720                            FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
721                    }
722                    else {
723                            if ((blogsEntryModelImpl.getColumnBitmask() &
724                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID.getColumnBitmask()) != 0) {
725                                    Object[] args = new Object[] {
726                                                    blogsEntryModelImpl.getOriginalUuid()
727                                            };
728    
729                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
730                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
731                                            args);
732    
733                                    args = new Object[] { blogsEntryModelImpl.getUuid() };
734    
735                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
736                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
737                                            args);
738                            }
739    
740                            if ((blogsEntryModelImpl.getColumnBitmask() &
741                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) {
742                                    Object[] args = new Object[] {
743                                                    Long.valueOf(blogsEntryModelImpl.getOriginalGroupId())
744                                            };
745    
746                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
747                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
748                                            args);
749    
750                                    args = new Object[] {
751                                                    Long.valueOf(blogsEntryModelImpl.getGroupId())
752                                            };
753    
754                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
755                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
756                                            args);
757                            }
758    
759                            if ((blogsEntryModelImpl.getColumnBitmask() &
760                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID.getColumnBitmask()) != 0) {
761                                    Object[] args = new Object[] {
762                                                    Long.valueOf(blogsEntryModelImpl.getOriginalCompanyId())
763                                            };
764    
765                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
766                                            args);
767                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
768                                            args);
769    
770                                    args = new Object[] {
771                                                    Long.valueOf(blogsEntryModelImpl.getCompanyId())
772                                            };
773    
774                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
775                                            args);
776                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
777                                            args);
778                            }
779    
780                            if ((blogsEntryModelImpl.getColumnBitmask() &
781                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_U.getColumnBitmask()) != 0) {
782                                    Object[] args = new Object[] {
783                                                    Long.valueOf(blogsEntryModelImpl.getOriginalCompanyId()),
784                                                    Long.valueOf(blogsEntryModelImpl.getOriginalUserId())
785                                            };
786    
787                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_U, args);
788                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_U,
789                                            args);
790    
791                                    args = new Object[] {
792                                                    Long.valueOf(blogsEntryModelImpl.getCompanyId()),
793                                                    Long.valueOf(blogsEntryModelImpl.getUserId())
794                                            };
795    
796                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_U, args);
797                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_U,
798                                            args);
799                            }
800    
801                            if ((blogsEntryModelImpl.getColumnBitmask() &
802                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_LTD.getColumnBitmask()) != 0) {
803                                    Object[] args = new Object[] {
804                                                    Long.valueOf(blogsEntryModelImpl.getOriginalCompanyId()),
805                                                    
806                                                    blogsEntryModelImpl.getOriginalDisplayDate()
807                                            };
808    
809                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_LTD, args);
810                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_LTD,
811                                            args);
812    
813                                    args = new Object[] {
814                                                    Long.valueOf(blogsEntryModelImpl.getCompanyId()),
815                                                    
816                                                    blogsEntryModelImpl.getDisplayDate()
817                                            };
818    
819                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_LTD, args);
820                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_LTD,
821                                            args);
822                            }
823    
824                            if ((blogsEntryModelImpl.getColumnBitmask() &
825                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_S.getColumnBitmask()) != 0) {
826                                    Object[] args = new Object[] {
827                                                    Long.valueOf(blogsEntryModelImpl.getOriginalCompanyId()),
828                                                    Integer.valueOf(blogsEntryModelImpl.getOriginalStatus())
829                                            };
830    
831                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_S, args);
832                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_S,
833                                            args);
834    
835                                    args = new Object[] {
836                                                    Long.valueOf(blogsEntryModelImpl.getCompanyId()),
837                                                    Integer.valueOf(blogsEntryModelImpl.getStatus())
838                                            };
839    
840                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_S, args);
841                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_S,
842                                            args);
843                            }
844    
845                            if ((blogsEntryModelImpl.getColumnBitmask() &
846                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_LTD.getColumnBitmask()) != 0) {
847                                    Object[] args = new Object[] {
848                                                    Long.valueOf(blogsEntryModelImpl.getOriginalGroupId()),
849                                                    
850                                                    blogsEntryModelImpl.getOriginalDisplayDate()
851                                            };
852    
853                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_LTD, args);
854                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_LTD,
855                                            args);
856    
857                                    args = new Object[] {
858                                                    Long.valueOf(blogsEntryModelImpl.getGroupId()),
859                                                    
860                                                    blogsEntryModelImpl.getDisplayDate()
861                                            };
862    
863                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_LTD, args);
864                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_LTD,
865                                            args);
866                            }
867    
868                            if ((blogsEntryModelImpl.getColumnBitmask() &
869                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S.getColumnBitmask()) != 0) {
870                                    Object[] args = new Object[] {
871                                                    Long.valueOf(blogsEntryModelImpl.getOriginalGroupId()),
872                                                    Integer.valueOf(blogsEntryModelImpl.getOriginalStatus())
873                                            };
874    
875                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_S, args);
876                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S,
877                                            args);
878    
879                                    args = new Object[] {
880                                                    Long.valueOf(blogsEntryModelImpl.getGroupId()),
881                                                    Integer.valueOf(blogsEntryModelImpl.getStatus())
882                                            };
883    
884                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_S, args);
885                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S,
886                                            args);
887                            }
888    
889                            if ((blogsEntryModelImpl.getColumnBitmask() &
890                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_U_S.getColumnBitmask()) != 0) {
891                                    Object[] args = new Object[] {
892                                                    Long.valueOf(blogsEntryModelImpl.getOriginalCompanyId()),
893                                                    Long.valueOf(blogsEntryModelImpl.getOriginalUserId()),
894                                                    Integer.valueOf(blogsEntryModelImpl.getOriginalStatus())
895                                            };
896    
897                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_U_S, args);
898                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_U_S,
899                                            args);
900    
901                                    args = new Object[] {
902                                                    Long.valueOf(blogsEntryModelImpl.getCompanyId()),
903                                                    Long.valueOf(blogsEntryModelImpl.getUserId()),
904                                                    Integer.valueOf(blogsEntryModelImpl.getStatus())
905                                            };
906    
907                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_U_S, args);
908                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_U_S,
909                                            args);
910                            }
911    
912                            if ((blogsEntryModelImpl.getColumnBitmask() &
913                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_LTD_S.getColumnBitmask()) != 0) {
914                                    Object[] args = new Object[] {
915                                                    Long.valueOf(blogsEntryModelImpl.getOriginalCompanyId()),
916                                                    
917                                                    blogsEntryModelImpl.getOriginalDisplayDate(),
918                                                    Integer.valueOf(blogsEntryModelImpl.getOriginalStatus())
919                                            };
920    
921                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_LTD_S, args);
922                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_LTD_S,
923                                            args);
924    
925                                    args = new Object[] {
926                                                    Long.valueOf(blogsEntryModelImpl.getCompanyId()),
927                                                    
928                                                    blogsEntryModelImpl.getDisplayDate(),
929                                                    Integer.valueOf(blogsEntryModelImpl.getStatus())
930                                            };
931    
932                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_LTD_S, args);
933                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_LTD_S,
934                                            args);
935                            }
936    
937                            if ((blogsEntryModelImpl.getColumnBitmask() &
938                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U_LTD.getColumnBitmask()) != 0) {
939                                    Object[] args = new Object[] {
940                                                    Long.valueOf(blogsEntryModelImpl.getOriginalGroupId()),
941                                                    Long.valueOf(blogsEntryModelImpl.getOriginalUserId()),
942                                                    
943                                                    blogsEntryModelImpl.getOriginalDisplayDate()
944                                            };
945    
946                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_U_LTD, args);
947                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U_LTD,
948                                            args);
949    
950                                    args = new Object[] {
951                                                    Long.valueOf(blogsEntryModelImpl.getGroupId()),
952                                                    Long.valueOf(blogsEntryModelImpl.getUserId()),
953                                                    
954                                                    blogsEntryModelImpl.getDisplayDate()
955                                            };
956    
957                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_U_LTD, args);
958                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U_LTD,
959                                            args);
960                            }
961    
962                            if ((blogsEntryModelImpl.getColumnBitmask() &
963                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U_S.getColumnBitmask()) != 0) {
964                                    Object[] args = new Object[] {
965                                                    Long.valueOf(blogsEntryModelImpl.getOriginalGroupId()),
966                                                    Long.valueOf(blogsEntryModelImpl.getOriginalUserId()),
967                                                    Integer.valueOf(blogsEntryModelImpl.getOriginalStatus())
968                                            };
969    
970                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_U_S, args);
971                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U_S,
972                                            args);
973    
974                                    args = new Object[] {
975                                                    Long.valueOf(blogsEntryModelImpl.getGroupId()),
976                                                    Long.valueOf(blogsEntryModelImpl.getUserId()),
977                                                    Integer.valueOf(blogsEntryModelImpl.getStatus())
978                                            };
979    
980                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_U_S, args);
981                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U_S,
982                                            args);
983                            }
984    
985                            if ((blogsEntryModelImpl.getColumnBitmask() &
986                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_LTD_S.getColumnBitmask()) != 0) {
987                                    Object[] args = new Object[] {
988                                                    Long.valueOf(blogsEntryModelImpl.getOriginalGroupId()),
989                                                    
990                                                    blogsEntryModelImpl.getOriginalDisplayDate(),
991                                                    Integer.valueOf(blogsEntryModelImpl.getOriginalStatus())
992                                            };
993    
994                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_LTD_S, args);
995                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_LTD_S,
996                                            args);
997    
998                                    args = new Object[] {
999                                                    Long.valueOf(blogsEntryModelImpl.getGroupId()),
1000                                                    
1001                                                    blogsEntryModelImpl.getDisplayDate(),
1002                                                    Integer.valueOf(blogsEntryModelImpl.getStatus())
1003                                            };
1004    
1005                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_LTD_S, args);
1006                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_LTD_S,
1007                                            args);
1008                            }
1009    
1010                            if ((blogsEntryModelImpl.getColumnBitmask() &
1011                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U_LTD_S.getColumnBitmask()) != 0) {
1012                                    Object[] args = new Object[] {
1013                                                    Long.valueOf(blogsEntryModelImpl.getOriginalGroupId()),
1014                                                    Long.valueOf(blogsEntryModelImpl.getOriginalUserId()),
1015                                                    
1016                                                    blogsEntryModelImpl.getOriginalDisplayDate(),
1017                                                    Integer.valueOf(blogsEntryModelImpl.getOriginalStatus())
1018                                            };
1019    
1020                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_U_LTD_S,
1021                                            args);
1022                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U_LTD_S,
1023                                            args);
1024    
1025                                    args = new Object[] {
1026                                                    Long.valueOf(blogsEntryModelImpl.getGroupId()),
1027                                                    Long.valueOf(blogsEntryModelImpl.getUserId()),
1028                                                    
1029                                                    blogsEntryModelImpl.getDisplayDate(),
1030                                                    Integer.valueOf(blogsEntryModelImpl.getStatus())
1031                                            };
1032    
1033                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_U_LTD_S,
1034                                            args);
1035                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U_LTD_S,
1036                                            args);
1037                            }
1038                    }
1039    
1040                    EntityCacheUtil.putResult(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
1041                            BlogsEntryImpl.class, blogsEntry.getPrimaryKey(), blogsEntry);
1042    
1043                    if (isNew) {
1044                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1045                                    new Object[] {
1046                                            blogsEntry.getUuid(), Long.valueOf(blogsEntry.getGroupId())
1047                                    }, blogsEntry);
1048    
1049                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_UT,
1050                                    new Object[] {
1051                                            Long.valueOf(blogsEntry.getGroupId()),
1052                                            
1053                                    blogsEntry.getUrlTitle()
1054                                    }, blogsEntry);
1055                    }
1056                    else {
1057                            if ((blogsEntryModelImpl.getColumnBitmask() &
1058                                            FINDER_PATH_FETCH_BY_UUID_G.getColumnBitmask()) != 0) {
1059                                    Object[] args = new Object[] {
1060                                                    blogsEntryModelImpl.getOriginalUuid(),
1061                                                    Long.valueOf(blogsEntryModelImpl.getOriginalGroupId())
1062                                            };
1063    
1064                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID_G, args);
1065                                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G, args);
1066    
1067                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1068                                            new Object[] {
1069                                                    blogsEntry.getUuid(),
1070                                                    Long.valueOf(blogsEntry.getGroupId())
1071                                            }, blogsEntry);
1072                            }
1073    
1074                            if ((blogsEntryModelImpl.getColumnBitmask() &
1075                                            FINDER_PATH_FETCH_BY_G_UT.getColumnBitmask()) != 0) {
1076                                    Object[] args = new Object[] {
1077                                                    Long.valueOf(blogsEntryModelImpl.getOriginalGroupId()),
1078                                                    
1079                                                    blogsEntryModelImpl.getOriginalUrlTitle()
1080                                            };
1081    
1082                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_UT, args);
1083                                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_UT, args);
1084    
1085                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_UT,
1086                                            new Object[] {
1087                                                    Long.valueOf(blogsEntry.getGroupId()),
1088                                                    
1089                                            blogsEntry.getUrlTitle()
1090                                            }, blogsEntry);
1091                            }
1092                    }
1093    
1094                    return blogsEntry;
1095            }
1096    
1097            protected BlogsEntry toUnwrappedModel(BlogsEntry blogsEntry) {
1098                    if (blogsEntry instanceof BlogsEntryImpl) {
1099                            return blogsEntry;
1100                    }
1101    
1102                    BlogsEntryImpl blogsEntryImpl = new BlogsEntryImpl();
1103    
1104                    blogsEntryImpl.setNew(blogsEntry.isNew());
1105                    blogsEntryImpl.setPrimaryKey(blogsEntry.getPrimaryKey());
1106    
1107                    blogsEntryImpl.setUuid(blogsEntry.getUuid());
1108                    blogsEntryImpl.setEntryId(blogsEntry.getEntryId());
1109                    blogsEntryImpl.setGroupId(blogsEntry.getGroupId());
1110                    blogsEntryImpl.setCompanyId(blogsEntry.getCompanyId());
1111                    blogsEntryImpl.setUserId(blogsEntry.getUserId());
1112                    blogsEntryImpl.setUserName(blogsEntry.getUserName());
1113                    blogsEntryImpl.setCreateDate(blogsEntry.getCreateDate());
1114                    blogsEntryImpl.setModifiedDate(blogsEntry.getModifiedDate());
1115                    blogsEntryImpl.setTitle(blogsEntry.getTitle());
1116                    blogsEntryImpl.setUrlTitle(blogsEntry.getUrlTitle());
1117                    blogsEntryImpl.setDescription(blogsEntry.getDescription());
1118                    blogsEntryImpl.setContent(blogsEntry.getContent());
1119                    blogsEntryImpl.setDisplayDate(blogsEntry.getDisplayDate());
1120                    blogsEntryImpl.setAllowPingbacks(blogsEntry.isAllowPingbacks());
1121                    blogsEntryImpl.setAllowTrackbacks(blogsEntry.isAllowTrackbacks());
1122                    blogsEntryImpl.setTrackbacks(blogsEntry.getTrackbacks());
1123                    blogsEntryImpl.setSmallImage(blogsEntry.isSmallImage());
1124                    blogsEntryImpl.setSmallImageId(blogsEntry.getSmallImageId());
1125                    blogsEntryImpl.setSmallImageURL(blogsEntry.getSmallImageURL());
1126                    blogsEntryImpl.setStatus(blogsEntry.getStatus());
1127                    blogsEntryImpl.setStatusByUserId(blogsEntry.getStatusByUserId());
1128                    blogsEntryImpl.setStatusByUserName(blogsEntry.getStatusByUserName());
1129                    blogsEntryImpl.setStatusDate(blogsEntry.getStatusDate());
1130    
1131                    return blogsEntryImpl;
1132            }
1133    
1134            /**
1135             * Returns the blogs entry with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
1136             *
1137             * @param primaryKey the primary key of the blogs entry
1138             * @return the blogs entry
1139             * @throws com.liferay.portal.NoSuchModelException if a blogs entry with the primary key could not be found
1140             * @throws SystemException if a system exception occurred
1141             */
1142            @Override
1143            public BlogsEntry findByPrimaryKey(Serializable primaryKey)
1144                    throws NoSuchModelException, SystemException {
1145                    return findByPrimaryKey(((Long)primaryKey).longValue());
1146            }
1147    
1148            /**
1149             * Returns the blogs entry with the primary key or throws a {@link com.liferay.portlet.blogs.NoSuchEntryException} if it could not be found.
1150             *
1151             * @param entryId the primary key of the blogs entry
1152             * @return the blogs entry
1153             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
1154             * @throws SystemException if a system exception occurred
1155             */
1156            public BlogsEntry findByPrimaryKey(long entryId)
1157                    throws NoSuchEntryException, SystemException {
1158                    BlogsEntry blogsEntry = fetchByPrimaryKey(entryId);
1159    
1160                    if (blogsEntry == null) {
1161                            if (_log.isWarnEnabled()) {
1162                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + entryId);
1163                            }
1164    
1165                            throw new NoSuchEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
1166                                    entryId);
1167                    }
1168    
1169                    return blogsEntry;
1170            }
1171    
1172            /**
1173             * Returns the blogs entry with the primary key or returns <code>null</code> if it could not be found.
1174             *
1175             * @param primaryKey the primary key of the blogs entry
1176             * @return the blogs entry, or <code>null</code> if a blogs entry with the primary key could not be found
1177             * @throws SystemException if a system exception occurred
1178             */
1179            @Override
1180            public BlogsEntry fetchByPrimaryKey(Serializable primaryKey)
1181                    throws SystemException {
1182                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
1183            }
1184    
1185            /**
1186             * Returns the blogs entry with the primary key or returns <code>null</code> if it could not be found.
1187             *
1188             * @param entryId the primary key of the blogs entry
1189             * @return the blogs entry, or <code>null</code> if a blogs entry with the primary key could not be found
1190             * @throws SystemException if a system exception occurred
1191             */
1192            public BlogsEntry fetchByPrimaryKey(long entryId) throws SystemException {
1193                    BlogsEntry blogsEntry = (BlogsEntry)EntityCacheUtil.getResult(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
1194                                    BlogsEntryImpl.class, entryId);
1195    
1196                    if (blogsEntry == _nullBlogsEntry) {
1197                            return null;
1198                    }
1199    
1200                    if (blogsEntry == null) {
1201                            Session session = null;
1202    
1203                            boolean hasException = false;
1204    
1205                            try {
1206                                    session = openSession();
1207    
1208                                    blogsEntry = (BlogsEntry)session.get(BlogsEntryImpl.class,
1209                                                    Long.valueOf(entryId));
1210                            }
1211                            catch (Exception e) {
1212                                    hasException = true;
1213    
1214                                    throw processException(e);
1215                            }
1216                            finally {
1217                                    if (blogsEntry != null) {
1218                                            cacheResult(blogsEntry);
1219                                    }
1220                                    else if (!hasException) {
1221                                            EntityCacheUtil.putResult(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
1222                                                    BlogsEntryImpl.class, entryId, _nullBlogsEntry);
1223                                    }
1224    
1225                                    closeSession(session);
1226                            }
1227                    }
1228    
1229                    return blogsEntry;
1230            }
1231    
1232            /**
1233             * Returns all the blogs entries where uuid = &#63;.
1234             *
1235             * @param uuid the uuid
1236             * @return the matching blogs entries
1237             * @throws SystemException if a system exception occurred
1238             */
1239            public List<BlogsEntry> findByUuid(String uuid) throws SystemException {
1240                    return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1241            }
1242    
1243            /**
1244             * Returns a range of all the blogs entries where uuid = &#63;.
1245             *
1246             * <p>
1247             * 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.
1248             * </p>
1249             *
1250             * @param uuid the uuid
1251             * @param start the lower bound of the range of blogs entries
1252             * @param end the upper bound of the range of blogs entries (not inclusive)
1253             * @return the range of matching blogs entries
1254             * @throws SystemException if a system exception occurred
1255             */
1256            public List<BlogsEntry> findByUuid(String uuid, int start, int end)
1257                    throws SystemException {
1258                    return findByUuid(uuid, start, end, null);
1259            }
1260    
1261            /**
1262             * Returns an ordered range of all the blogs entries where uuid = &#63;.
1263             *
1264             * <p>
1265             * 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.
1266             * </p>
1267             *
1268             * @param uuid the uuid
1269             * @param start the lower bound of the range of blogs entries
1270             * @param end the upper bound of the range of blogs entries (not inclusive)
1271             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1272             * @return the ordered range of matching blogs entries
1273             * @throws SystemException if a system exception occurred
1274             */
1275            public List<BlogsEntry> findByUuid(String uuid, int start, int end,
1276                    OrderByComparator orderByComparator) throws SystemException {
1277                    FinderPath finderPath = null;
1278                    Object[] finderArgs = null;
1279    
1280                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1281                                    (orderByComparator == null)) {
1282                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID;
1283                            finderArgs = new Object[] { uuid };
1284                    }
1285                    else {
1286                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID;
1287                            finderArgs = new Object[] { uuid, start, end, orderByComparator };
1288                    }
1289    
1290                    List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
1291                                    finderArgs, this);
1292    
1293                    if ((list != null) && !list.isEmpty()) {
1294                            for (BlogsEntry blogsEntry : list) {
1295                                    if (!Validator.equals(uuid, blogsEntry.getUuid())) {
1296                                            list = null;
1297    
1298                                            break;
1299                                    }
1300                            }
1301                    }
1302    
1303                    if (list == null) {
1304                            StringBundler query = null;
1305    
1306                            if (orderByComparator != null) {
1307                                    query = new StringBundler(3 +
1308                                                    (orderByComparator.getOrderByFields().length * 3));
1309                            }
1310                            else {
1311                                    query = new StringBundler(3);
1312                            }
1313    
1314                            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1315    
1316                            if (uuid == null) {
1317                                    query.append(_FINDER_COLUMN_UUID_UUID_1);
1318                            }
1319                            else {
1320                                    if (uuid.equals(StringPool.BLANK)) {
1321                                            query.append(_FINDER_COLUMN_UUID_UUID_3);
1322                                    }
1323                                    else {
1324                                            query.append(_FINDER_COLUMN_UUID_UUID_2);
1325                                    }
1326                            }
1327    
1328                            if (orderByComparator != null) {
1329                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1330                                            orderByComparator);
1331                            }
1332    
1333                            else {
1334                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1335                            }
1336    
1337                            String sql = query.toString();
1338    
1339                            Session session = null;
1340    
1341                            try {
1342                                    session = openSession();
1343    
1344                                    Query q = session.createQuery(sql);
1345    
1346                                    QueryPos qPos = QueryPos.getInstance(q);
1347    
1348                                    if (uuid != null) {
1349                                            qPos.add(uuid);
1350                                    }
1351    
1352                                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
1353                                                    end);
1354                            }
1355                            catch (Exception e) {
1356                                    throw processException(e);
1357                            }
1358                            finally {
1359                                    if (list == null) {
1360                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
1361                                    }
1362                                    else {
1363                                            cacheResult(list);
1364    
1365                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
1366                                    }
1367    
1368                                    closeSession(session);
1369                            }
1370                    }
1371    
1372                    return list;
1373            }
1374    
1375            /**
1376             * Returns the first blogs entry in the ordered set where uuid = &#63;.
1377             *
1378             * <p>
1379             * 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.
1380             * </p>
1381             *
1382             * @param uuid the uuid
1383             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1384             * @return the first matching blogs entry
1385             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
1386             * @throws SystemException if a system exception occurred
1387             */
1388            public BlogsEntry findByUuid_First(String uuid,
1389                    OrderByComparator orderByComparator)
1390                    throws NoSuchEntryException, SystemException {
1391                    List<BlogsEntry> list = findByUuid(uuid, 0, 1, orderByComparator);
1392    
1393                    if (list.isEmpty()) {
1394                            StringBundler msg = new StringBundler(4);
1395    
1396                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1397    
1398                            msg.append("uuid=");
1399                            msg.append(uuid);
1400    
1401                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1402    
1403                            throw new NoSuchEntryException(msg.toString());
1404                    }
1405                    else {
1406                            return list.get(0);
1407                    }
1408            }
1409    
1410            /**
1411             * Returns the last blogs entry in the ordered set where uuid = &#63;.
1412             *
1413             * <p>
1414             * 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.
1415             * </p>
1416             *
1417             * @param uuid the uuid
1418             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1419             * @return the last matching blogs entry
1420             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
1421             * @throws SystemException if a system exception occurred
1422             */
1423            public BlogsEntry findByUuid_Last(String uuid,
1424                    OrderByComparator orderByComparator)
1425                    throws NoSuchEntryException, SystemException {
1426                    int count = countByUuid(uuid);
1427    
1428                    List<BlogsEntry> list = findByUuid(uuid, count - 1, count,
1429                                    orderByComparator);
1430    
1431                    if (list.isEmpty()) {
1432                            StringBundler msg = new StringBundler(4);
1433    
1434                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1435    
1436                            msg.append("uuid=");
1437                            msg.append(uuid);
1438    
1439                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1440    
1441                            throw new NoSuchEntryException(msg.toString());
1442                    }
1443                    else {
1444                            return list.get(0);
1445                    }
1446            }
1447    
1448            /**
1449             * Returns the blogs entries before and after the current blogs entry in the ordered set where uuid = &#63;.
1450             *
1451             * <p>
1452             * 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.
1453             * </p>
1454             *
1455             * @param entryId the primary key of the current blogs entry
1456             * @param uuid the uuid
1457             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1458             * @return the previous, current, and next blogs entry
1459             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
1460             * @throws SystemException if a system exception occurred
1461             */
1462            public BlogsEntry[] findByUuid_PrevAndNext(long entryId, String uuid,
1463                    OrderByComparator orderByComparator)
1464                    throws NoSuchEntryException, SystemException {
1465                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
1466    
1467                    Session session = null;
1468    
1469                    try {
1470                            session = openSession();
1471    
1472                            BlogsEntry[] array = new BlogsEntryImpl[3];
1473    
1474                            array[0] = getByUuid_PrevAndNext(session, blogsEntry, uuid,
1475                                            orderByComparator, true);
1476    
1477                            array[1] = blogsEntry;
1478    
1479                            array[2] = getByUuid_PrevAndNext(session, blogsEntry, uuid,
1480                                            orderByComparator, false);
1481    
1482                            return array;
1483                    }
1484                    catch (Exception e) {
1485                            throw processException(e);
1486                    }
1487                    finally {
1488                            closeSession(session);
1489                    }
1490            }
1491    
1492            protected BlogsEntry getByUuid_PrevAndNext(Session session,
1493                    BlogsEntry blogsEntry, String uuid,
1494                    OrderByComparator orderByComparator, boolean previous) {
1495                    StringBundler query = null;
1496    
1497                    if (orderByComparator != null) {
1498                            query = new StringBundler(6 +
1499                                            (orderByComparator.getOrderByFields().length * 6));
1500                    }
1501                    else {
1502                            query = new StringBundler(3);
1503                    }
1504    
1505                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1506    
1507                    if (uuid == null) {
1508                            query.append(_FINDER_COLUMN_UUID_UUID_1);
1509                    }
1510                    else {
1511                            if (uuid.equals(StringPool.BLANK)) {
1512                                    query.append(_FINDER_COLUMN_UUID_UUID_3);
1513                            }
1514                            else {
1515                                    query.append(_FINDER_COLUMN_UUID_UUID_2);
1516                            }
1517                    }
1518    
1519                    if (orderByComparator != null) {
1520                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1521    
1522                            if (orderByConditionFields.length > 0) {
1523                                    query.append(WHERE_AND);
1524                            }
1525    
1526                            for (int i = 0; i < orderByConditionFields.length; i++) {
1527                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1528                                    query.append(orderByConditionFields[i]);
1529    
1530                                    if ((i + 1) < orderByConditionFields.length) {
1531                                            if (orderByComparator.isAscending() ^ previous) {
1532                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1533                                            }
1534                                            else {
1535                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1536                                            }
1537                                    }
1538                                    else {
1539                                            if (orderByComparator.isAscending() ^ previous) {
1540                                                    query.append(WHERE_GREATER_THAN);
1541                                            }
1542                                            else {
1543                                                    query.append(WHERE_LESSER_THAN);
1544                                            }
1545                                    }
1546                            }
1547    
1548                            query.append(ORDER_BY_CLAUSE);
1549    
1550                            String[] orderByFields = orderByComparator.getOrderByFields();
1551    
1552                            for (int i = 0; i < orderByFields.length; i++) {
1553                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1554                                    query.append(orderByFields[i]);
1555    
1556                                    if ((i + 1) < orderByFields.length) {
1557                                            if (orderByComparator.isAscending() ^ previous) {
1558                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1559                                            }
1560                                            else {
1561                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1562                                            }
1563                                    }
1564                                    else {
1565                                            if (orderByComparator.isAscending() ^ previous) {
1566                                                    query.append(ORDER_BY_ASC);
1567                                            }
1568                                            else {
1569                                                    query.append(ORDER_BY_DESC);
1570                                            }
1571                                    }
1572                            }
1573                    }
1574    
1575                    else {
1576                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1577                    }
1578    
1579                    String sql = query.toString();
1580    
1581                    Query q = session.createQuery(sql);
1582    
1583                    q.setFirstResult(0);
1584                    q.setMaxResults(2);
1585    
1586                    QueryPos qPos = QueryPos.getInstance(q);
1587    
1588                    if (uuid != null) {
1589                            qPos.add(uuid);
1590                    }
1591    
1592                    if (orderByComparator != null) {
1593                            Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
1594    
1595                            for (Object value : values) {
1596                                    qPos.add(value);
1597                            }
1598                    }
1599    
1600                    List<BlogsEntry> list = q.list();
1601    
1602                    if (list.size() == 2) {
1603                            return list.get(1);
1604                    }
1605                    else {
1606                            return null;
1607                    }
1608            }
1609    
1610            /**
1611             * Returns the blogs entry where uuid = &#63; and groupId = &#63; or throws a {@link com.liferay.portlet.blogs.NoSuchEntryException} if it could not be found.
1612             *
1613             * @param uuid the uuid
1614             * @param groupId the group ID
1615             * @return the matching blogs entry
1616             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
1617             * @throws SystemException if a system exception occurred
1618             */
1619            public BlogsEntry findByUUID_G(String uuid, long groupId)
1620                    throws NoSuchEntryException, SystemException {
1621                    BlogsEntry blogsEntry = fetchByUUID_G(uuid, groupId);
1622    
1623                    if (blogsEntry == null) {
1624                            StringBundler msg = new StringBundler(6);
1625    
1626                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1627    
1628                            msg.append("uuid=");
1629                            msg.append(uuid);
1630    
1631                            msg.append(", groupId=");
1632                            msg.append(groupId);
1633    
1634                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1635    
1636                            if (_log.isWarnEnabled()) {
1637                                    _log.warn(msg.toString());
1638                            }
1639    
1640                            throw new NoSuchEntryException(msg.toString());
1641                    }
1642    
1643                    return blogsEntry;
1644            }
1645    
1646            /**
1647             * Returns the blogs entry where uuid = &#63; and groupId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
1648             *
1649             * @param uuid the uuid
1650             * @param groupId the group ID
1651             * @return the matching blogs entry, or <code>null</code> if a matching blogs entry could not be found
1652             * @throws SystemException if a system exception occurred
1653             */
1654            public BlogsEntry fetchByUUID_G(String uuid, long groupId)
1655                    throws SystemException {
1656                    return fetchByUUID_G(uuid, groupId, true);
1657            }
1658    
1659            /**
1660             * Returns 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.
1661             *
1662             * @param uuid the uuid
1663             * @param groupId the group ID
1664             * @param retrieveFromCache whether to use the finder cache
1665             * @return the matching blogs entry, or <code>null</code> if a matching blogs entry could not be found
1666             * @throws SystemException if a system exception occurred
1667             */
1668            public BlogsEntry fetchByUUID_G(String uuid, long groupId,
1669                    boolean retrieveFromCache) throws SystemException {
1670                    Object[] finderArgs = new Object[] { uuid, groupId };
1671    
1672                    Object result = null;
1673    
1674                    if (retrieveFromCache) {
1675                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
1676                                            finderArgs, this);
1677                    }
1678    
1679                    if (result instanceof BlogsEntry) {
1680                            BlogsEntry blogsEntry = (BlogsEntry)result;
1681    
1682                            if (!Validator.equals(uuid, blogsEntry.getUuid()) ||
1683                                            (groupId != blogsEntry.getGroupId())) {
1684                                    result = null;
1685                            }
1686                    }
1687    
1688                    if (result == null) {
1689                            StringBundler query = new StringBundler(4);
1690    
1691                            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1692    
1693                            if (uuid == null) {
1694                                    query.append(_FINDER_COLUMN_UUID_G_UUID_1);
1695                            }
1696                            else {
1697                                    if (uuid.equals(StringPool.BLANK)) {
1698                                            query.append(_FINDER_COLUMN_UUID_G_UUID_3);
1699                                    }
1700                                    else {
1701                                            query.append(_FINDER_COLUMN_UUID_G_UUID_2);
1702                                    }
1703                            }
1704    
1705                            query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
1706    
1707                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1708    
1709                            String sql = query.toString();
1710    
1711                            Session session = null;
1712    
1713                            try {
1714                                    session = openSession();
1715    
1716                                    Query q = session.createQuery(sql);
1717    
1718                                    QueryPos qPos = QueryPos.getInstance(q);
1719    
1720                                    if (uuid != null) {
1721                                            qPos.add(uuid);
1722                                    }
1723    
1724                                    qPos.add(groupId);
1725    
1726                                    List<BlogsEntry> list = q.list();
1727    
1728                                    result = list;
1729    
1730                                    BlogsEntry blogsEntry = null;
1731    
1732                                    if (list.isEmpty()) {
1733                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1734                                                    finderArgs, list);
1735                                    }
1736                                    else {
1737                                            blogsEntry = list.get(0);
1738    
1739                                            cacheResult(blogsEntry);
1740    
1741                                            if ((blogsEntry.getUuid() == null) ||
1742                                                            !blogsEntry.getUuid().equals(uuid) ||
1743                                                            (blogsEntry.getGroupId() != groupId)) {
1744                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1745                                                            finderArgs, blogsEntry);
1746                                            }
1747                                    }
1748    
1749                                    return blogsEntry;
1750                            }
1751                            catch (Exception e) {
1752                                    throw processException(e);
1753                            }
1754                            finally {
1755                                    if (result == null) {
1756                                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
1757                                                    finderArgs);
1758                                    }
1759    
1760                                    closeSession(session);
1761                            }
1762                    }
1763                    else {
1764                            if (result instanceof List<?>) {
1765                                    return null;
1766                            }
1767                            else {
1768                                    return (BlogsEntry)result;
1769                            }
1770                    }
1771            }
1772    
1773            /**
1774             * Returns all the blogs entries where groupId = &#63;.
1775             *
1776             * @param groupId the group ID
1777             * @return the matching blogs entries
1778             * @throws SystemException if a system exception occurred
1779             */
1780            public List<BlogsEntry> findByGroupId(long groupId)
1781                    throws SystemException {
1782                    return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1783            }
1784    
1785            /**
1786             * Returns a range of all the blogs entries where groupId = &#63;.
1787             *
1788             * <p>
1789             * 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.
1790             * </p>
1791             *
1792             * @param groupId the group ID
1793             * @param start the lower bound of the range of blogs entries
1794             * @param end the upper bound of the range of blogs entries (not inclusive)
1795             * @return the range of matching blogs entries
1796             * @throws SystemException if a system exception occurred
1797             */
1798            public List<BlogsEntry> findByGroupId(long groupId, int start, int end)
1799                    throws SystemException {
1800                    return findByGroupId(groupId, start, end, null);
1801            }
1802    
1803            /**
1804             * Returns an ordered range of all the blogs entries where groupId = &#63;.
1805             *
1806             * <p>
1807             * 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.
1808             * </p>
1809             *
1810             * @param groupId the group ID
1811             * @param start the lower bound of the range of blogs entries
1812             * @param end the upper bound of the range of blogs entries (not inclusive)
1813             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1814             * @return the ordered range of matching blogs entries
1815             * @throws SystemException if a system exception occurred
1816             */
1817            public List<BlogsEntry> findByGroupId(long groupId, int start, int end,
1818                    OrderByComparator orderByComparator) throws SystemException {
1819                    FinderPath finderPath = null;
1820                    Object[] finderArgs = null;
1821    
1822                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1823                                    (orderByComparator == null)) {
1824                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID;
1825                            finderArgs = new Object[] { groupId };
1826                    }
1827                    else {
1828                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID;
1829                            finderArgs = new Object[] { groupId, start, end, orderByComparator };
1830                    }
1831    
1832                    List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
1833                                    finderArgs, this);
1834    
1835                    if ((list != null) && !list.isEmpty()) {
1836                            for (BlogsEntry blogsEntry : list) {
1837                                    if ((groupId != blogsEntry.getGroupId())) {
1838                                            list = null;
1839    
1840                                            break;
1841                                    }
1842                            }
1843                    }
1844    
1845                    if (list == null) {
1846                            StringBundler query = null;
1847    
1848                            if (orderByComparator != null) {
1849                                    query = new StringBundler(3 +
1850                                                    (orderByComparator.getOrderByFields().length * 3));
1851                            }
1852                            else {
1853                                    query = new StringBundler(3);
1854                            }
1855    
1856                            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1857    
1858                            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1859    
1860                            if (orderByComparator != null) {
1861                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1862                                            orderByComparator);
1863                            }
1864    
1865                            else {
1866                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1867                            }
1868    
1869                            String sql = query.toString();
1870    
1871                            Session session = null;
1872    
1873                            try {
1874                                    session = openSession();
1875    
1876                                    Query q = session.createQuery(sql);
1877    
1878                                    QueryPos qPos = QueryPos.getInstance(q);
1879    
1880                                    qPos.add(groupId);
1881    
1882                                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
1883                                                    end);
1884                            }
1885                            catch (Exception e) {
1886                                    throw processException(e);
1887                            }
1888                            finally {
1889                                    if (list == null) {
1890                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
1891                                    }
1892                                    else {
1893                                            cacheResult(list);
1894    
1895                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
1896                                    }
1897    
1898                                    closeSession(session);
1899                            }
1900                    }
1901    
1902                    return list;
1903            }
1904    
1905            /**
1906             * Returns the first blogs entry in the ordered set where groupId = &#63;.
1907             *
1908             * <p>
1909             * 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.
1910             * </p>
1911             *
1912             * @param groupId the group ID
1913             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1914             * @return the first matching blogs entry
1915             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
1916             * @throws SystemException if a system exception occurred
1917             */
1918            public BlogsEntry findByGroupId_First(long groupId,
1919                    OrderByComparator orderByComparator)
1920                    throws NoSuchEntryException, SystemException {
1921                    List<BlogsEntry> list = findByGroupId(groupId, 0, 1, orderByComparator);
1922    
1923                    if (list.isEmpty()) {
1924                            StringBundler msg = new StringBundler(4);
1925    
1926                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1927    
1928                            msg.append("groupId=");
1929                            msg.append(groupId);
1930    
1931                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1932    
1933                            throw new NoSuchEntryException(msg.toString());
1934                    }
1935                    else {
1936                            return list.get(0);
1937                    }
1938            }
1939    
1940            /**
1941             * Returns the last blogs entry in the ordered set where groupId = &#63;.
1942             *
1943             * <p>
1944             * 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.
1945             * </p>
1946             *
1947             * @param groupId the group ID
1948             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1949             * @return the last matching blogs entry
1950             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
1951             * @throws SystemException if a system exception occurred
1952             */
1953            public BlogsEntry findByGroupId_Last(long groupId,
1954                    OrderByComparator orderByComparator)
1955                    throws NoSuchEntryException, SystemException {
1956                    int count = countByGroupId(groupId);
1957    
1958                    List<BlogsEntry> list = findByGroupId(groupId, count - 1, count,
1959                                    orderByComparator);
1960    
1961                    if (list.isEmpty()) {
1962                            StringBundler msg = new StringBundler(4);
1963    
1964                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1965    
1966                            msg.append("groupId=");
1967                            msg.append(groupId);
1968    
1969                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1970    
1971                            throw new NoSuchEntryException(msg.toString());
1972                    }
1973                    else {
1974                            return list.get(0);
1975                    }
1976            }
1977    
1978            /**
1979             * Returns the blogs entries before and after the current blogs entry in the ordered set where groupId = &#63;.
1980             *
1981             * <p>
1982             * 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.
1983             * </p>
1984             *
1985             * @param entryId the primary key of the current blogs entry
1986             * @param groupId the group ID
1987             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1988             * @return the previous, current, and next blogs entry
1989             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
1990             * @throws SystemException if a system exception occurred
1991             */
1992            public BlogsEntry[] findByGroupId_PrevAndNext(long entryId, long groupId,
1993                    OrderByComparator orderByComparator)
1994                    throws NoSuchEntryException, SystemException {
1995                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
1996    
1997                    Session session = null;
1998    
1999                    try {
2000                            session = openSession();
2001    
2002                            BlogsEntry[] array = new BlogsEntryImpl[3];
2003    
2004                            array[0] = getByGroupId_PrevAndNext(session, blogsEntry, groupId,
2005                                            orderByComparator, true);
2006    
2007                            array[1] = blogsEntry;
2008    
2009                            array[2] = getByGroupId_PrevAndNext(session, blogsEntry, groupId,
2010                                            orderByComparator, false);
2011    
2012                            return array;
2013                    }
2014                    catch (Exception e) {
2015                            throw processException(e);
2016                    }
2017                    finally {
2018                            closeSession(session);
2019                    }
2020            }
2021    
2022            protected BlogsEntry getByGroupId_PrevAndNext(Session session,
2023                    BlogsEntry blogsEntry, long groupId,
2024                    OrderByComparator orderByComparator, boolean previous) {
2025                    StringBundler query = null;
2026    
2027                    if (orderByComparator != null) {
2028                            query = new StringBundler(6 +
2029                                            (orderByComparator.getOrderByFields().length * 6));
2030                    }
2031                    else {
2032                            query = new StringBundler(3);
2033                    }
2034    
2035                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2036    
2037                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2038    
2039                    if (orderByComparator != null) {
2040                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2041    
2042                            if (orderByConditionFields.length > 0) {
2043                                    query.append(WHERE_AND);
2044                            }
2045    
2046                            for (int i = 0; i < orderByConditionFields.length; i++) {
2047                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2048                                    query.append(orderByConditionFields[i]);
2049    
2050                                    if ((i + 1) < orderByConditionFields.length) {
2051                                            if (orderByComparator.isAscending() ^ previous) {
2052                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
2053                                            }
2054                                            else {
2055                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
2056                                            }
2057                                    }
2058                                    else {
2059                                            if (orderByComparator.isAscending() ^ previous) {
2060                                                    query.append(WHERE_GREATER_THAN);
2061                                            }
2062                                            else {
2063                                                    query.append(WHERE_LESSER_THAN);
2064                                            }
2065                                    }
2066                            }
2067    
2068                            query.append(ORDER_BY_CLAUSE);
2069    
2070                            String[] orderByFields = orderByComparator.getOrderByFields();
2071    
2072                            for (int i = 0; i < orderByFields.length; i++) {
2073                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2074                                    query.append(orderByFields[i]);
2075    
2076                                    if ((i + 1) < orderByFields.length) {
2077                                            if (orderByComparator.isAscending() ^ previous) {
2078                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
2079                                            }
2080                                            else {
2081                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
2082                                            }
2083                                    }
2084                                    else {
2085                                            if (orderByComparator.isAscending() ^ previous) {
2086                                                    query.append(ORDER_BY_ASC);
2087                                            }
2088                                            else {
2089                                                    query.append(ORDER_BY_DESC);
2090                                            }
2091                                    }
2092                            }
2093                    }
2094    
2095                    else {
2096                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2097                    }
2098    
2099                    String sql = query.toString();
2100    
2101                    Query q = session.createQuery(sql);
2102    
2103                    q.setFirstResult(0);
2104                    q.setMaxResults(2);
2105    
2106                    QueryPos qPos = QueryPos.getInstance(q);
2107    
2108                    qPos.add(groupId);
2109    
2110                    if (orderByComparator != null) {
2111                            Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
2112    
2113                            for (Object value : values) {
2114                                    qPos.add(value);
2115                            }
2116                    }
2117    
2118                    List<BlogsEntry> list = q.list();
2119    
2120                    if (list.size() == 2) {
2121                            return list.get(1);
2122                    }
2123                    else {
2124                            return null;
2125                    }
2126            }
2127    
2128            /**
2129             * Returns all the blogs entries that the user has permission to view where groupId = &#63;.
2130             *
2131             * @param groupId the group ID
2132             * @return the matching blogs entries that the user has permission to view
2133             * @throws SystemException if a system exception occurred
2134             */
2135            public List<BlogsEntry> filterFindByGroupId(long groupId)
2136                    throws SystemException {
2137                    return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
2138                            QueryUtil.ALL_POS, null);
2139            }
2140    
2141            /**
2142             * Returns a range of all the blogs entries that the user has permission to view where groupId = &#63;.
2143             *
2144             * <p>
2145             * 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.
2146             * </p>
2147             *
2148             * @param groupId the group ID
2149             * @param start the lower bound of the range of blogs entries
2150             * @param end the upper bound of the range of blogs entries (not inclusive)
2151             * @return the range of matching blogs entries that the user has permission to view
2152             * @throws SystemException if a system exception occurred
2153             */
2154            public List<BlogsEntry> filterFindByGroupId(long groupId, int start, int end)
2155                    throws SystemException {
2156                    return filterFindByGroupId(groupId, start, end, null);
2157            }
2158    
2159            /**
2160             * Returns an ordered range of all the blogs entries that the user has permissions to view where groupId = &#63;.
2161             *
2162             * <p>
2163             * 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.
2164             * </p>
2165             *
2166             * @param groupId the group ID
2167             * @param start the lower bound of the range of blogs entries
2168             * @param end the upper bound of the range of blogs entries (not inclusive)
2169             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
2170             * @return the ordered range of matching blogs entries that the user has permission to view
2171             * @throws SystemException if a system exception occurred
2172             */
2173            public List<BlogsEntry> filterFindByGroupId(long groupId, int start,
2174                    int end, OrderByComparator orderByComparator) throws SystemException {
2175                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2176                            return findByGroupId(groupId, start, end, orderByComparator);
2177                    }
2178    
2179                    StringBundler query = null;
2180    
2181                    if (orderByComparator != null) {
2182                            query = new StringBundler(3 +
2183                                            (orderByComparator.getOrderByFields().length * 3));
2184                    }
2185                    else {
2186                            query = new StringBundler(3);
2187                    }
2188    
2189                    if (getDB().isSupportsInlineDistinct()) {
2190                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
2191                    }
2192                    else {
2193                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1);
2194                    }
2195    
2196                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2197    
2198                    if (!getDB().isSupportsInlineDistinct()) {
2199                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2);
2200                    }
2201    
2202                    if (orderByComparator != null) {
2203                            if (getDB().isSupportsInlineDistinct()) {
2204                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2205                                            orderByComparator);
2206                            }
2207                            else {
2208                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
2209                                            orderByComparator);
2210                            }
2211                    }
2212    
2213                    else {
2214                            if (getDB().isSupportsInlineDistinct()) {
2215                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2216                            }
2217                            else {
2218                                    query.append(BlogsEntryModelImpl.ORDER_BY_SQL);
2219                            }
2220                    }
2221    
2222                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2223                                    BlogsEntry.class.getName(),
2224                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
2225    
2226                    Session session = null;
2227    
2228                    try {
2229                            session = openSession();
2230    
2231                            SQLQuery q = session.createSQLQuery(sql);
2232    
2233                            if (getDB().isSupportsInlineDistinct()) {
2234                                    q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
2235                            }
2236                            else {
2237                                    q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class);
2238                            }
2239    
2240                            QueryPos qPos = QueryPos.getInstance(q);
2241    
2242                            qPos.add(groupId);
2243    
2244                            return (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start, end);
2245                    }
2246                    catch (Exception e) {
2247                            throw processException(e);
2248                    }
2249                    finally {
2250                            closeSession(session);
2251                    }
2252            }
2253    
2254            /**
2255             * Returns the blogs entries before and after the current blogs entry in the ordered set of blogs entries that the user has permission to view where groupId = &#63;.
2256             *
2257             * @param entryId the primary key of the current blogs entry
2258             * @param groupId the group ID
2259             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
2260             * @return the previous, current, and next blogs entry
2261             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
2262             * @throws SystemException if a system exception occurred
2263             */
2264            public BlogsEntry[] filterFindByGroupId_PrevAndNext(long entryId,
2265                    long groupId, OrderByComparator orderByComparator)
2266                    throws NoSuchEntryException, SystemException {
2267                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2268                            return findByGroupId_PrevAndNext(entryId, groupId, orderByComparator);
2269                    }
2270    
2271                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
2272    
2273                    Session session = null;
2274    
2275                    try {
2276                            session = openSession();
2277    
2278                            BlogsEntry[] array = new BlogsEntryImpl[3];
2279    
2280                            array[0] = filterGetByGroupId_PrevAndNext(session, blogsEntry,
2281                                            groupId, orderByComparator, true);
2282    
2283                            array[1] = blogsEntry;
2284    
2285                            array[2] = filterGetByGroupId_PrevAndNext(session, blogsEntry,
2286                                            groupId, orderByComparator, false);
2287    
2288                            return array;
2289                    }
2290                    catch (Exception e) {
2291                            throw processException(e);
2292                    }
2293                    finally {
2294                            closeSession(session);
2295                    }
2296            }
2297    
2298            protected BlogsEntry filterGetByGroupId_PrevAndNext(Session session,
2299                    BlogsEntry blogsEntry, long groupId,
2300                    OrderByComparator orderByComparator, boolean previous) {
2301                    StringBundler query = null;
2302    
2303                    if (orderByComparator != null) {
2304                            query = new StringBundler(6 +
2305                                            (orderByComparator.getOrderByFields().length * 6));
2306                    }
2307                    else {
2308                            query = new StringBundler(3);
2309                    }
2310    
2311                    if (getDB().isSupportsInlineDistinct()) {
2312                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
2313                    }
2314                    else {
2315                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1);
2316                    }
2317    
2318                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2319    
2320                    if (!getDB().isSupportsInlineDistinct()) {
2321                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2);
2322                    }
2323    
2324                    if (orderByComparator != null) {
2325                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2326    
2327                            if (orderByConditionFields.length > 0) {
2328                                    query.append(WHERE_AND);
2329                            }
2330    
2331                            for (int i = 0; i < orderByConditionFields.length; i++) {
2332                                    if (getDB().isSupportsInlineDistinct()) {
2333                                            query.append(_ORDER_BY_ENTITY_ALIAS);
2334                                    }
2335                                    else {
2336                                            query.append(_ORDER_BY_ENTITY_TABLE);
2337                                    }
2338    
2339                                    query.append(orderByConditionFields[i]);
2340    
2341                                    if ((i + 1) < orderByConditionFields.length) {
2342                                            if (orderByComparator.isAscending() ^ previous) {
2343                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
2344                                            }
2345                                            else {
2346                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
2347                                            }
2348                                    }
2349                                    else {
2350                                            if (orderByComparator.isAscending() ^ previous) {
2351                                                    query.append(WHERE_GREATER_THAN);
2352                                            }
2353                                            else {
2354                                                    query.append(WHERE_LESSER_THAN);
2355                                            }
2356                                    }
2357                            }
2358    
2359                            query.append(ORDER_BY_CLAUSE);
2360    
2361                            String[] orderByFields = orderByComparator.getOrderByFields();
2362    
2363                            for (int i = 0; i < orderByFields.length; i++) {
2364                                    if (getDB().isSupportsInlineDistinct()) {
2365                                            query.append(_ORDER_BY_ENTITY_ALIAS);
2366                                    }
2367                                    else {
2368                                            query.append(_ORDER_BY_ENTITY_TABLE);
2369                                    }
2370    
2371                                    query.append(orderByFields[i]);
2372    
2373                                    if ((i + 1) < orderByFields.length) {
2374                                            if (orderByComparator.isAscending() ^ previous) {
2375                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
2376                                            }
2377                                            else {
2378                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
2379                                            }
2380                                    }
2381                                    else {
2382                                            if (orderByComparator.isAscending() ^ previous) {
2383                                                    query.append(ORDER_BY_ASC);
2384                                            }
2385                                            else {
2386                                                    query.append(ORDER_BY_DESC);
2387                                            }
2388                                    }
2389                            }
2390                    }
2391    
2392                    else {
2393                            if (getDB().isSupportsInlineDistinct()) {
2394                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2395                            }
2396                            else {
2397                                    query.append(BlogsEntryModelImpl.ORDER_BY_SQL);
2398                            }
2399                    }
2400    
2401                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2402                                    BlogsEntry.class.getName(),
2403                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
2404    
2405                    SQLQuery q = session.createSQLQuery(sql);
2406    
2407                    q.setFirstResult(0);
2408                    q.setMaxResults(2);
2409    
2410                    if (getDB().isSupportsInlineDistinct()) {
2411                            q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
2412                    }
2413                    else {
2414                            q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class);
2415                    }
2416    
2417                    QueryPos qPos = QueryPos.getInstance(q);
2418    
2419                    qPos.add(groupId);
2420    
2421                    if (orderByComparator != null) {
2422                            Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
2423    
2424                            for (Object value : values) {
2425                                    qPos.add(value);
2426                            }
2427                    }
2428    
2429                    List<BlogsEntry> list = q.list();
2430    
2431                    if (list.size() == 2) {
2432                            return list.get(1);
2433                    }
2434                    else {
2435                            return null;
2436                    }
2437            }
2438    
2439            /**
2440             * Returns all the blogs entries where companyId = &#63;.
2441             *
2442             * @param companyId the company ID
2443             * @return the matching blogs entries
2444             * @throws SystemException if a system exception occurred
2445             */
2446            public List<BlogsEntry> findByCompanyId(long companyId)
2447                    throws SystemException {
2448                    return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
2449                            null);
2450            }
2451    
2452            /**
2453             * Returns a range of all the blogs entries where companyId = &#63;.
2454             *
2455             * <p>
2456             * 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.
2457             * </p>
2458             *
2459             * @param companyId the company ID
2460             * @param start the lower bound of the range of blogs entries
2461             * @param end the upper bound of the range of blogs entries (not inclusive)
2462             * @return the range of matching blogs entries
2463             * @throws SystemException if a system exception occurred
2464             */
2465            public List<BlogsEntry> findByCompanyId(long companyId, int start, int end)
2466                    throws SystemException {
2467                    return findByCompanyId(companyId, start, end, null);
2468            }
2469    
2470            /**
2471             * Returns an ordered range of all the blogs entries where companyId = &#63;.
2472             *
2473             * <p>
2474             * 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.
2475             * </p>
2476             *
2477             * @param companyId the company ID
2478             * @param start the lower bound of the range of blogs entries
2479             * @param end the upper bound of the range of blogs entries (not inclusive)
2480             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
2481             * @return the ordered range of matching blogs entries
2482             * @throws SystemException if a system exception occurred
2483             */
2484            public List<BlogsEntry> findByCompanyId(long companyId, int start, int end,
2485                    OrderByComparator orderByComparator) throws SystemException {
2486                    FinderPath finderPath = null;
2487                    Object[] finderArgs = null;
2488    
2489                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2490                                    (orderByComparator == null)) {
2491                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID;
2492                            finderArgs = new Object[] { companyId };
2493                    }
2494                    else {
2495                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID;
2496                            finderArgs = new Object[] { companyId, start, end, orderByComparator };
2497                    }
2498    
2499                    List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
2500                                    finderArgs, this);
2501    
2502                    if ((list != null) && !list.isEmpty()) {
2503                            for (BlogsEntry blogsEntry : list) {
2504                                    if ((companyId != blogsEntry.getCompanyId())) {
2505                                            list = null;
2506    
2507                                            break;
2508                                    }
2509                            }
2510                    }
2511    
2512                    if (list == null) {
2513                            StringBundler query = null;
2514    
2515                            if (orderByComparator != null) {
2516                                    query = new StringBundler(3 +
2517                                                    (orderByComparator.getOrderByFields().length * 3));
2518                            }
2519                            else {
2520                                    query = new StringBundler(3);
2521                            }
2522    
2523                            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2524    
2525                            query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
2526    
2527                            if (orderByComparator != null) {
2528                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2529                                            orderByComparator);
2530                            }
2531    
2532                            else {
2533                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2534                            }
2535    
2536                            String sql = query.toString();
2537    
2538                            Session session = null;
2539    
2540                            try {
2541                                    session = openSession();
2542    
2543                                    Query q = session.createQuery(sql);
2544    
2545                                    QueryPos qPos = QueryPos.getInstance(q);
2546    
2547                                    qPos.add(companyId);
2548    
2549                                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
2550                                                    end);
2551                            }
2552                            catch (Exception e) {
2553                                    throw processException(e);
2554                            }
2555                            finally {
2556                                    if (list == null) {
2557                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
2558                                    }
2559                                    else {
2560                                            cacheResult(list);
2561    
2562                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
2563                                    }
2564    
2565                                    closeSession(session);
2566                            }
2567                    }
2568    
2569                    return list;
2570            }
2571    
2572            /**
2573             * Returns the first blogs entry in the ordered set where companyId = &#63;.
2574             *
2575             * <p>
2576             * 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.
2577             * </p>
2578             *
2579             * @param companyId the company ID
2580             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
2581             * @return the first 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 findByCompanyId_First(long companyId,
2586                    OrderByComparator orderByComparator)
2587                    throws NoSuchEntryException, SystemException {
2588                    List<BlogsEntry> list = findByCompanyId(companyId, 0, 1,
2589                                    orderByComparator);
2590    
2591                    if (list.isEmpty()) {
2592                            StringBundler msg = new StringBundler(4);
2593    
2594                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2595    
2596                            msg.append("companyId=");
2597                            msg.append(companyId);
2598    
2599                            msg.append(StringPool.CLOSE_CURLY_BRACE);
2600    
2601                            throw new NoSuchEntryException(msg.toString());
2602                    }
2603                    else {
2604                            return list.get(0);
2605                    }
2606            }
2607    
2608            /**
2609             * Returns the last blogs entry in the ordered set where companyId = &#63;.
2610             *
2611             * <p>
2612             * 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.
2613             * </p>
2614             *
2615             * @param companyId the company ID
2616             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
2617             * @return the last matching blogs entry
2618             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
2619             * @throws SystemException if a system exception occurred
2620             */
2621            public BlogsEntry findByCompanyId_Last(long companyId,
2622                    OrderByComparator orderByComparator)
2623                    throws NoSuchEntryException, SystemException {
2624                    int count = countByCompanyId(companyId);
2625    
2626                    List<BlogsEntry> list = findByCompanyId(companyId, count - 1, count,
2627                                    orderByComparator);
2628    
2629                    if (list.isEmpty()) {
2630                            StringBundler msg = new StringBundler(4);
2631    
2632                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2633    
2634                            msg.append("companyId=");
2635                            msg.append(companyId);
2636    
2637                            msg.append(StringPool.CLOSE_CURLY_BRACE);
2638    
2639                            throw new NoSuchEntryException(msg.toString());
2640                    }
2641                    else {
2642                            return list.get(0);
2643                    }
2644            }
2645    
2646            /**
2647             * Returns the blogs entries before and after the current blogs entry in the ordered set where companyId = &#63;.
2648             *
2649             * <p>
2650             * 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.
2651             * </p>
2652             *
2653             * @param entryId the primary key of the current blogs entry
2654             * @param companyId the company ID
2655             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
2656             * @return the previous, current, and next blogs entry
2657             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
2658             * @throws SystemException if a system exception occurred
2659             */
2660            public BlogsEntry[] findByCompanyId_PrevAndNext(long entryId,
2661                    long companyId, OrderByComparator orderByComparator)
2662                    throws NoSuchEntryException, SystemException {
2663                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
2664    
2665                    Session session = null;
2666    
2667                    try {
2668                            session = openSession();
2669    
2670                            BlogsEntry[] array = new BlogsEntryImpl[3];
2671    
2672                            array[0] = getByCompanyId_PrevAndNext(session, blogsEntry,
2673                                            companyId, orderByComparator, true);
2674    
2675                            array[1] = blogsEntry;
2676    
2677                            array[2] = getByCompanyId_PrevAndNext(session, blogsEntry,
2678                                            companyId, orderByComparator, false);
2679    
2680                            return array;
2681                    }
2682                    catch (Exception e) {
2683                            throw processException(e);
2684                    }
2685                    finally {
2686                            closeSession(session);
2687                    }
2688            }
2689    
2690            protected BlogsEntry getByCompanyId_PrevAndNext(Session session,
2691                    BlogsEntry blogsEntry, long companyId,
2692                    OrderByComparator orderByComparator, boolean previous) {
2693                    StringBundler query = null;
2694    
2695                    if (orderByComparator != null) {
2696                            query = new StringBundler(6 +
2697                                            (orderByComparator.getOrderByFields().length * 6));
2698                    }
2699                    else {
2700                            query = new StringBundler(3);
2701                    }
2702    
2703                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2704    
2705                    query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
2706    
2707                    if (orderByComparator != null) {
2708                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2709    
2710                            if (orderByConditionFields.length > 0) {
2711                                    query.append(WHERE_AND);
2712                            }
2713    
2714                            for (int i = 0; i < orderByConditionFields.length; i++) {
2715                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2716                                    query.append(orderByConditionFields[i]);
2717    
2718                                    if ((i + 1) < orderByConditionFields.length) {
2719                                            if (orderByComparator.isAscending() ^ previous) {
2720                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
2721                                            }
2722                                            else {
2723                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
2724                                            }
2725                                    }
2726                                    else {
2727                                            if (orderByComparator.isAscending() ^ previous) {
2728                                                    query.append(WHERE_GREATER_THAN);
2729                                            }
2730                                            else {
2731                                                    query.append(WHERE_LESSER_THAN);
2732                                            }
2733                                    }
2734                            }
2735    
2736                            query.append(ORDER_BY_CLAUSE);
2737    
2738                            String[] orderByFields = orderByComparator.getOrderByFields();
2739    
2740                            for (int i = 0; i < orderByFields.length; i++) {
2741                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2742                                    query.append(orderByFields[i]);
2743    
2744                                    if ((i + 1) < orderByFields.length) {
2745                                            if (orderByComparator.isAscending() ^ previous) {
2746                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
2747                                            }
2748                                            else {
2749                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
2750                                            }
2751                                    }
2752                                    else {
2753                                            if (orderByComparator.isAscending() ^ previous) {
2754                                                    query.append(ORDER_BY_ASC);
2755                                            }
2756                                            else {
2757                                                    query.append(ORDER_BY_DESC);
2758                                            }
2759                                    }
2760                            }
2761                    }
2762    
2763                    else {
2764                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2765                    }
2766    
2767                    String sql = query.toString();
2768    
2769                    Query q = session.createQuery(sql);
2770    
2771                    q.setFirstResult(0);
2772                    q.setMaxResults(2);
2773    
2774                    QueryPos qPos = QueryPos.getInstance(q);
2775    
2776                    qPos.add(companyId);
2777    
2778                    if (orderByComparator != null) {
2779                            Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
2780    
2781                            for (Object value : values) {
2782                                    qPos.add(value);
2783                            }
2784                    }
2785    
2786                    List<BlogsEntry> list = q.list();
2787    
2788                    if (list.size() == 2) {
2789                            return list.get(1);
2790                    }
2791                    else {
2792                            return null;
2793                    }
2794            }
2795    
2796            /**
2797             * Returns all the blogs entries where companyId = &#63; and userId = &#63;.
2798             *
2799             * @param companyId the company ID
2800             * @param userId the user ID
2801             * @return the matching blogs entries
2802             * @throws SystemException if a system exception occurred
2803             */
2804            public List<BlogsEntry> findByC_U(long companyId, long userId)
2805                    throws SystemException {
2806                    return findByC_U(companyId, userId, QueryUtil.ALL_POS,
2807                            QueryUtil.ALL_POS, null);
2808            }
2809    
2810            /**
2811             * Returns a range of all the blogs entries where companyId = &#63; and userId = &#63;.
2812             *
2813             * <p>
2814             * 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.
2815             * </p>
2816             *
2817             * @param companyId the company ID
2818             * @param userId the user ID
2819             * @param start the lower bound of the range of blogs entries
2820             * @param end the upper bound of the range of blogs entries (not inclusive)
2821             * @return the range of matching blogs entries
2822             * @throws SystemException if a system exception occurred
2823             */
2824            public List<BlogsEntry> findByC_U(long companyId, long userId, int start,
2825                    int end) throws SystemException {
2826                    return findByC_U(companyId, userId, start, end, null);
2827            }
2828    
2829            /**
2830             * Returns an ordered range of all the blogs entries where companyId = &#63; and userId = &#63;.
2831             *
2832             * <p>
2833             * 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.
2834             * </p>
2835             *
2836             * @param companyId the company ID
2837             * @param userId the user ID
2838             * @param start the lower bound of the range of blogs entries
2839             * @param end the upper bound of the range of blogs entries (not inclusive)
2840             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
2841             * @return the ordered range of matching blogs entries
2842             * @throws SystemException if a system exception occurred
2843             */
2844            public List<BlogsEntry> findByC_U(long companyId, long userId, int start,
2845                    int end, OrderByComparator orderByComparator) throws SystemException {
2846                    FinderPath finderPath = null;
2847                    Object[] finderArgs = null;
2848    
2849                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2850                                    (orderByComparator == null)) {
2851                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_U;
2852                            finderArgs = new Object[] { companyId, userId };
2853                    }
2854                    else {
2855                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_U;
2856                            finderArgs = new Object[] {
2857                                            companyId, userId,
2858                                            
2859                                            start, end, orderByComparator
2860                                    };
2861                    }
2862    
2863                    List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
2864                                    finderArgs, this);
2865    
2866                    if ((list != null) && !list.isEmpty()) {
2867                            for (BlogsEntry blogsEntry : list) {
2868                                    if ((companyId != blogsEntry.getCompanyId()) ||
2869                                                    (userId != blogsEntry.getUserId())) {
2870                                            list = null;
2871    
2872                                            break;
2873                                    }
2874                            }
2875                    }
2876    
2877                    if (list == null) {
2878                            StringBundler query = null;
2879    
2880                            if (orderByComparator != null) {
2881                                    query = new StringBundler(4 +
2882                                                    (orderByComparator.getOrderByFields().length * 3));
2883                            }
2884                            else {
2885                                    query = new StringBundler(4);
2886                            }
2887    
2888                            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2889    
2890                            query.append(_FINDER_COLUMN_C_U_COMPANYID_2);
2891    
2892                            query.append(_FINDER_COLUMN_C_U_USERID_2);
2893    
2894                            if (orderByComparator != null) {
2895                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2896                                            orderByComparator);
2897                            }
2898    
2899                            else {
2900                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2901                            }
2902    
2903                            String sql = query.toString();
2904    
2905                            Session session = null;
2906    
2907                            try {
2908                                    session = openSession();
2909    
2910                                    Query q = session.createQuery(sql);
2911    
2912                                    QueryPos qPos = QueryPos.getInstance(q);
2913    
2914                                    qPos.add(companyId);
2915    
2916                                    qPos.add(userId);
2917    
2918                                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
2919                                                    end);
2920                            }
2921                            catch (Exception e) {
2922                                    throw processException(e);
2923                            }
2924                            finally {
2925                                    if (list == null) {
2926                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
2927                                    }
2928                                    else {
2929                                            cacheResult(list);
2930    
2931                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
2932                                    }
2933    
2934                                    closeSession(session);
2935                            }
2936                    }
2937    
2938                    return list;
2939            }
2940    
2941            /**
2942             * Returns the first blogs entry in the ordered set where companyId = &#63; and userId = &#63;.
2943             *
2944             * <p>
2945             * 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.
2946             * </p>
2947             *
2948             * @param companyId the company ID
2949             * @param userId the user ID
2950             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
2951             * @return the first matching blogs entry
2952             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
2953             * @throws SystemException if a system exception occurred
2954             */
2955            public BlogsEntry findByC_U_First(long companyId, long userId,
2956                    OrderByComparator orderByComparator)
2957                    throws NoSuchEntryException, SystemException {
2958                    List<BlogsEntry> list = findByC_U(companyId, userId, 0, 1,
2959                                    orderByComparator);
2960    
2961                    if (list.isEmpty()) {
2962                            StringBundler msg = new StringBundler(6);
2963    
2964                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2965    
2966                            msg.append("companyId=");
2967                            msg.append(companyId);
2968    
2969                            msg.append(", userId=");
2970                            msg.append(userId);
2971    
2972                            msg.append(StringPool.CLOSE_CURLY_BRACE);
2973    
2974                            throw new NoSuchEntryException(msg.toString());
2975                    }
2976                    else {
2977                            return list.get(0);
2978                    }
2979            }
2980    
2981            /**
2982             * Returns the last blogs entry in the ordered set where companyId = &#63; and userId = &#63;.
2983             *
2984             * <p>
2985             * 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.
2986             * </p>
2987             *
2988             * @param companyId the company ID
2989             * @param userId the user ID
2990             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
2991             * @return the last matching blogs entry
2992             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
2993             * @throws SystemException if a system exception occurred
2994             */
2995            public BlogsEntry findByC_U_Last(long companyId, long userId,
2996                    OrderByComparator orderByComparator)
2997                    throws NoSuchEntryException, SystemException {
2998                    int count = countByC_U(companyId, userId);
2999    
3000                    List<BlogsEntry> list = findByC_U(companyId, userId, count - 1, count,
3001                                    orderByComparator);
3002    
3003                    if (list.isEmpty()) {
3004                            StringBundler msg = new StringBundler(6);
3005    
3006                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3007    
3008                            msg.append("companyId=");
3009                            msg.append(companyId);
3010    
3011                            msg.append(", userId=");
3012                            msg.append(userId);
3013    
3014                            msg.append(StringPool.CLOSE_CURLY_BRACE);
3015    
3016                            throw new NoSuchEntryException(msg.toString());
3017                    }
3018                    else {
3019                            return list.get(0);
3020                    }
3021            }
3022    
3023            /**
3024             * Returns the blogs entries before and after the current blogs entry in the ordered set where companyId = &#63; and userId = &#63;.
3025             *
3026             * <p>
3027             * 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.
3028             * </p>
3029             *
3030             * @param entryId the primary key of the current blogs entry
3031             * @param companyId the company ID
3032             * @param userId the user ID
3033             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
3034             * @return the previous, current, and next blogs entry
3035             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
3036             * @throws SystemException if a system exception occurred
3037             */
3038            public BlogsEntry[] findByC_U_PrevAndNext(long entryId, long companyId,
3039                    long userId, OrderByComparator orderByComparator)
3040                    throws NoSuchEntryException, SystemException {
3041                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
3042    
3043                    Session session = null;
3044    
3045                    try {
3046                            session = openSession();
3047    
3048                            BlogsEntry[] array = new BlogsEntryImpl[3];
3049    
3050                            array[0] = getByC_U_PrevAndNext(session, blogsEntry, companyId,
3051                                            userId, orderByComparator, true);
3052    
3053                            array[1] = blogsEntry;
3054    
3055                            array[2] = getByC_U_PrevAndNext(session, blogsEntry, companyId,
3056                                            userId, orderByComparator, false);
3057    
3058                            return array;
3059                    }
3060                    catch (Exception e) {
3061                            throw processException(e);
3062                    }
3063                    finally {
3064                            closeSession(session);
3065                    }
3066            }
3067    
3068            protected BlogsEntry getByC_U_PrevAndNext(Session session,
3069                    BlogsEntry blogsEntry, long companyId, long userId,
3070                    OrderByComparator orderByComparator, boolean previous) {
3071                    StringBundler query = null;
3072    
3073                    if (orderByComparator != null) {
3074                            query = new StringBundler(6 +
3075                                            (orderByComparator.getOrderByFields().length * 6));
3076                    }
3077                    else {
3078                            query = new StringBundler(3);
3079                    }
3080    
3081                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
3082    
3083                    query.append(_FINDER_COLUMN_C_U_COMPANYID_2);
3084    
3085                    query.append(_FINDER_COLUMN_C_U_USERID_2);
3086    
3087                    if (orderByComparator != null) {
3088                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
3089    
3090                            if (orderByConditionFields.length > 0) {
3091                                    query.append(WHERE_AND);
3092                            }
3093    
3094                            for (int i = 0; i < orderByConditionFields.length; i++) {
3095                                    query.append(_ORDER_BY_ENTITY_ALIAS);
3096                                    query.append(orderByConditionFields[i]);
3097    
3098                                    if ((i + 1) < orderByConditionFields.length) {
3099                                            if (orderByComparator.isAscending() ^ previous) {
3100                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
3101                                            }
3102                                            else {
3103                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
3104                                            }
3105                                    }
3106                                    else {
3107                                            if (orderByComparator.isAscending() ^ previous) {
3108                                                    query.append(WHERE_GREATER_THAN);
3109                                            }
3110                                            else {
3111                                                    query.append(WHERE_LESSER_THAN);
3112                                            }
3113                                    }
3114                            }
3115    
3116                            query.append(ORDER_BY_CLAUSE);
3117    
3118                            String[] orderByFields = orderByComparator.getOrderByFields();
3119    
3120                            for (int i = 0; i < orderByFields.length; i++) {
3121                                    query.append(_ORDER_BY_ENTITY_ALIAS);
3122                                    query.append(orderByFields[i]);
3123    
3124                                    if ((i + 1) < orderByFields.length) {
3125                                            if (orderByComparator.isAscending() ^ previous) {
3126                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
3127                                            }
3128                                            else {
3129                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
3130                                            }
3131                                    }
3132                                    else {
3133                                            if (orderByComparator.isAscending() ^ previous) {
3134                                                    query.append(ORDER_BY_ASC);
3135                                            }
3136                                            else {
3137                                                    query.append(ORDER_BY_DESC);
3138                                            }
3139                                    }
3140                            }
3141                    }
3142    
3143                    else {
3144                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
3145                    }
3146    
3147                    String sql = query.toString();
3148    
3149                    Query q = session.createQuery(sql);
3150    
3151                    q.setFirstResult(0);
3152                    q.setMaxResults(2);
3153    
3154                    QueryPos qPos = QueryPos.getInstance(q);
3155    
3156                    qPos.add(companyId);
3157    
3158                    qPos.add(userId);
3159    
3160                    if (orderByComparator != null) {
3161                            Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
3162    
3163                            for (Object value : values) {
3164                                    qPos.add(value);
3165                            }
3166                    }
3167    
3168                    List<BlogsEntry> list = q.list();
3169    
3170                    if (list.size() == 2) {
3171                            return list.get(1);
3172                    }
3173                    else {
3174                            return null;
3175                    }
3176            }
3177    
3178            /**
3179             * Returns all the blogs entries where companyId = &#63; and displayDate &lt; &#63;.
3180             *
3181             * @param companyId the company ID
3182             * @param displayDate the display date
3183             * @return the matching blogs entries
3184             * @throws SystemException if a system exception occurred
3185             */
3186            public List<BlogsEntry> findByC_LtD(long companyId, Date displayDate)
3187                    throws SystemException {
3188                    return findByC_LtD(companyId, displayDate, QueryUtil.ALL_POS,
3189                            QueryUtil.ALL_POS, null);
3190            }
3191    
3192            /**
3193             * Returns a range of all the blogs entries where companyId = &#63; and displayDate &lt; &#63;.
3194             *
3195             * <p>
3196             * 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.
3197             * </p>
3198             *
3199             * @param companyId the company ID
3200             * @param displayDate the display date
3201             * @param start the lower bound of the range of blogs entries
3202             * @param end the upper bound of the range of blogs entries (not inclusive)
3203             * @return the range of matching blogs entries
3204             * @throws SystemException if a system exception occurred
3205             */
3206            public List<BlogsEntry> findByC_LtD(long companyId, Date displayDate,
3207                    int start, int end) throws SystemException {
3208                    return findByC_LtD(companyId, displayDate, start, end, null);
3209            }
3210    
3211            /**
3212             * Returns an ordered range of all the blogs entries where companyId = &#63; and displayDate &lt; &#63;.
3213             *
3214             * <p>
3215             * 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.
3216             * </p>
3217             *
3218             * @param companyId the company ID
3219             * @param displayDate the display date
3220             * @param start the lower bound of the range of blogs entries
3221             * @param end the upper bound of the range of blogs entries (not inclusive)
3222             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
3223             * @return the ordered range of matching blogs entries
3224             * @throws SystemException if a system exception occurred
3225             */
3226            public List<BlogsEntry> findByC_LtD(long companyId, Date displayDate,
3227                    int start, int end, OrderByComparator orderByComparator)
3228                    throws SystemException {
3229                    FinderPath finderPath = null;
3230                    Object[] finderArgs = null;
3231    
3232                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
3233                                    (orderByComparator == null)) {
3234                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_LTD;
3235                            finderArgs = new Object[] { companyId, displayDate };
3236                    }
3237                    else {
3238                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_LTD;
3239                            finderArgs = new Object[] {
3240                                            companyId, displayDate,
3241                                            
3242                                            start, end, orderByComparator
3243                                    };
3244                    }
3245    
3246                    List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
3247                                    finderArgs, this);
3248    
3249                    if ((list != null) && !list.isEmpty()) {
3250                            for (BlogsEntry blogsEntry : list) {
3251                                    if ((companyId != blogsEntry.getCompanyId()) ||
3252                                                    !Validator.equals(displayDate,
3253                                                            blogsEntry.getDisplayDate())) {
3254                                            list = null;
3255    
3256                                            break;
3257                                    }
3258                            }
3259                    }
3260    
3261                    if (list == null) {
3262                            StringBundler query = null;
3263    
3264                            if (orderByComparator != null) {
3265                                    query = new StringBundler(4 +
3266                                                    (orderByComparator.getOrderByFields().length * 3));
3267                            }
3268                            else {
3269                                    query = new StringBundler(4);
3270                            }
3271    
3272                            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
3273    
3274                            query.append(_FINDER_COLUMN_C_LTD_COMPANYID_2);
3275    
3276                            if (displayDate == null) {
3277                                    query.append(_FINDER_COLUMN_C_LTD_DISPLAYDATE_1);
3278                            }
3279                            else {
3280                                    query.append(_FINDER_COLUMN_C_LTD_DISPLAYDATE_2);
3281                            }
3282    
3283                            if (orderByComparator != null) {
3284                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3285                                            orderByComparator);
3286                            }
3287    
3288                            else {
3289                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
3290                            }
3291    
3292                            String sql = query.toString();
3293    
3294                            Session session = null;
3295    
3296                            try {
3297                                    session = openSession();
3298    
3299                                    Query q = session.createQuery(sql);
3300    
3301                                    QueryPos qPos = QueryPos.getInstance(q);
3302    
3303                                    qPos.add(companyId);
3304    
3305                                    if (displayDate != null) {
3306                                            qPos.add(CalendarUtil.getTimestamp(displayDate));
3307                                    }
3308    
3309                                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
3310                                                    end);
3311                            }
3312                            catch (Exception e) {
3313                                    throw processException(e);
3314                            }
3315                            finally {
3316                                    if (list == null) {
3317                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
3318                                    }
3319                                    else {
3320                                            cacheResult(list);
3321    
3322                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
3323                                    }
3324    
3325                                    closeSession(session);
3326                            }
3327                    }
3328    
3329                    return list;
3330            }
3331    
3332            /**
3333             * Returns the first blogs entry in the ordered set where companyId = &#63; and displayDate &lt; &#63;.
3334             *
3335             * <p>
3336             * 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.
3337             * </p>
3338             *
3339             * @param companyId the company ID
3340             * @param displayDate the display date
3341             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
3342             * @return the first matching blogs entry
3343             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
3344             * @throws SystemException if a system exception occurred
3345             */
3346            public BlogsEntry findByC_LtD_First(long companyId, Date displayDate,
3347                    OrderByComparator orderByComparator)
3348                    throws NoSuchEntryException, SystemException {
3349                    List<BlogsEntry> list = findByC_LtD(companyId, displayDate, 0, 1,
3350                                    orderByComparator);
3351    
3352                    if (list.isEmpty()) {
3353                            StringBundler msg = new StringBundler(6);
3354    
3355                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3356    
3357                            msg.append("companyId=");
3358                            msg.append(companyId);
3359    
3360                            msg.append(", displayDate=");
3361                            msg.append(displayDate);
3362    
3363                            msg.append(StringPool.CLOSE_CURLY_BRACE);
3364    
3365                            throw new NoSuchEntryException(msg.toString());
3366                    }
3367                    else {
3368                            return list.get(0);
3369                    }
3370            }
3371    
3372            /**
3373             * Returns the last blogs entry in the ordered set where companyId = &#63; and displayDate &lt; &#63;.
3374             *
3375             * <p>
3376             * 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.
3377             * </p>
3378             *
3379             * @param companyId the company ID
3380             * @param displayDate the display date
3381             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
3382             * @return the last matching blogs entry
3383             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
3384             * @throws SystemException if a system exception occurred
3385             */
3386            public BlogsEntry findByC_LtD_Last(long companyId, Date displayDate,
3387                    OrderByComparator orderByComparator)
3388                    throws NoSuchEntryException, SystemException {
3389                    int count = countByC_LtD(companyId, displayDate);
3390    
3391                    List<BlogsEntry> list = findByC_LtD(companyId, displayDate, count - 1,
3392                                    count, orderByComparator);
3393    
3394                    if (list.isEmpty()) {
3395                            StringBundler msg = new StringBundler(6);
3396    
3397                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3398    
3399                            msg.append("companyId=");
3400                            msg.append(companyId);
3401    
3402                            msg.append(", displayDate=");
3403                            msg.append(displayDate);
3404    
3405                            msg.append(StringPool.CLOSE_CURLY_BRACE);
3406    
3407                            throw new NoSuchEntryException(msg.toString());
3408                    }
3409                    else {
3410                            return list.get(0);
3411                    }
3412            }
3413    
3414            /**
3415             * Returns the blogs entries before and after the current blogs entry in the ordered set where companyId = &#63; and displayDate &lt; &#63;.
3416             *
3417             * <p>
3418             * 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.
3419             * </p>
3420             *
3421             * @param entryId the primary key of the current blogs entry
3422             * @param companyId the company ID
3423             * @param displayDate the display date
3424             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
3425             * @return the previous, current, and next blogs entry
3426             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
3427             * @throws SystemException if a system exception occurred
3428             */
3429            public BlogsEntry[] findByC_LtD_PrevAndNext(long entryId, long companyId,
3430                    Date displayDate, OrderByComparator orderByComparator)
3431                    throws NoSuchEntryException, SystemException {
3432                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
3433    
3434                    Session session = null;
3435    
3436                    try {
3437                            session = openSession();
3438    
3439                            BlogsEntry[] array = new BlogsEntryImpl[3];
3440    
3441                            array[0] = getByC_LtD_PrevAndNext(session, blogsEntry, companyId,
3442                                            displayDate, orderByComparator, true);
3443    
3444                            array[1] = blogsEntry;
3445    
3446                            array[2] = getByC_LtD_PrevAndNext(session, blogsEntry, companyId,
3447                                            displayDate, orderByComparator, false);
3448    
3449                            return array;
3450                    }
3451                    catch (Exception e) {
3452                            throw processException(e);
3453                    }
3454                    finally {
3455                            closeSession(session);
3456                    }
3457            }
3458    
3459            protected BlogsEntry getByC_LtD_PrevAndNext(Session session,
3460                    BlogsEntry blogsEntry, long companyId, Date displayDate,
3461                    OrderByComparator orderByComparator, boolean previous) {
3462                    StringBundler query = null;
3463    
3464                    if (orderByComparator != null) {
3465                            query = new StringBundler(6 +
3466                                            (orderByComparator.getOrderByFields().length * 6));
3467                    }
3468                    else {
3469                            query = new StringBundler(3);
3470                    }
3471    
3472                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
3473    
3474                    query.append(_FINDER_COLUMN_C_LTD_COMPANYID_2);
3475    
3476                    if (displayDate == null) {
3477                            query.append(_FINDER_COLUMN_C_LTD_DISPLAYDATE_1);
3478                    }
3479                    else {
3480                            query.append(_FINDER_COLUMN_C_LTD_DISPLAYDATE_2);
3481                    }
3482    
3483                    if (orderByComparator != null) {
3484                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
3485    
3486                            if (orderByConditionFields.length > 0) {
3487                                    query.append(WHERE_AND);
3488                            }
3489    
3490                            for (int i = 0; i < orderByConditionFields.length; i++) {
3491                                    query.append(_ORDER_BY_ENTITY_ALIAS);
3492                                    query.append(orderByConditionFields[i]);
3493    
3494                                    if ((i + 1) < orderByConditionFields.length) {
3495                                            if (orderByComparator.isAscending() ^ previous) {
3496                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
3497                                            }
3498                                            else {
3499                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
3500                                            }
3501                                    }
3502                                    else {
3503                                            if (orderByComparator.isAscending() ^ previous) {
3504                                                    query.append(WHERE_GREATER_THAN);
3505                                            }
3506                                            else {
3507                                                    query.append(WHERE_LESSER_THAN);
3508                                            }
3509                                    }
3510                            }
3511    
3512                            query.append(ORDER_BY_CLAUSE);
3513    
3514                            String[] orderByFields = orderByComparator.getOrderByFields();
3515    
3516                            for (int i = 0; i < orderByFields.length; i++) {
3517                                    query.append(_ORDER_BY_ENTITY_ALIAS);
3518                                    query.append(orderByFields[i]);
3519    
3520                                    if ((i + 1) < orderByFields.length) {
3521                                            if (orderByComparator.isAscending() ^ previous) {
3522                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
3523                                            }
3524                                            else {
3525                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
3526                                            }
3527                                    }
3528                                    else {
3529                                            if (orderByComparator.isAscending() ^ previous) {
3530                                                    query.append(ORDER_BY_ASC);
3531                                            }
3532                                            else {
3533                                                    query.append(ORDER_BY_DESC);
3534                                            }
3535                                    }
3536                            }
3537                    }
3538    
3539                    else {
3540                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
3541                    }
3542    
3543                    String sql = query.toString();
3544    
3545                    Query q = session.createQuery(sql);
3546    
3547                    q.setFirstResult(0);
3548                    q.setMaxResults(2);
3549    
3550                    QueryPos qPos = QueryPos.getInstance(q);
3551    
3552                    qPos.add(companyId);
3553    
3554                    if (displayDate != null) {
3555                            qPos.add(CalendarUtil.getTimestamp(displayDate));
3556                    }
3557    
3558                    if (orderByComparator != null) {
3559                            Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
3560    
3561                            for (Object value : values) {
3562                                    qPos.add(value);
3563                            }
3564                    }
3565    
3566                    List<BlogsEntry> list = q.list();
3567    
3568                    if (list.size() == 2) {
3569                            return list.get(1);
3570                    }
3571                    else {
3572                            return null;
3573                    }
3574            }
3575    
3576            /**
3577             * Returns all the blogs entries where companyId = &#63; and status = &#63;.
3578             *
3579             * @param companyId the company ID
3580             * @param status the status
3581             * @return the matching blogs entries
3582             * @throws SystemException if a system exception occurred
3583             */
3584            public List<BlogsEntry> findByC_S(long companyId, int status)
3585                    throws SystemException {
3586                    return findByC_S(companyId, status, QueryUtil.ALL_POS,
3587                            QueryUtil.ALL_POS, null);
3588            }
3589    
3590            /**
3591             * Returns a range of all the blogs entries where companyId = &#63; and status = &#63;.
3592             *
3593             * <p>
3594             * 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.
3595             * </p>
3596             *
3597             * @param companyId the company ID
3598             * @param status the status
3599             * @param start the lower bound of the range of blogs entries
3600             * @param end the upper bound of the range of blogs entries (not inclusive)
3601             * @return the range of matching blogs entries
3602             * @throws SystemException if a system exception occurred
3603             */
3604            public List<BlogsEntry> findByC_S(long companyId, int status, int start,
3605                    int end) throws SystemException {
3606                    return findByC_S(companyId, status, start, end, null);
3607            }
3608    
3609            /**
3610             * Returns an ordered range of all the blogs entries where companyId = &#63; and status = &#63;.
3611             *
3612             * <p>
3613             * 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.
3614             * </p>
3615             *
3616             * @param companyId the company ID
3617             * @param status the status
3618             * @param start the lower bound of the range of blogs entries
3619             * @param end the upper bound of the range of blogs entries (not inclusive)
3620             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
3621             * @return the ordered range of matching blogs entries
3622             * @throws SystemException if a system exception occurred
3623             */
3624            public List<BlogsEntry> findByC_S(long companyId, int status, int start,
3625                    int end, OrderByComparator orderByComparator) throws SystemException {
3626                    FinderPath finderPath = null;
3627                    Object[] finderArgs = null;
3628    
3629                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
3630                                    (orderByComparator == null)) {
3631                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_S;
3632                            finderArgs = new Object[] { companyId, status };
3633                    }
3634                    else {
3635                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_S;
3636                            finderArgs = new Object[] {
3637                                            companyId, status,
3638                                            
3639                                            start, end, orderByComparator
3640                                    };
3641                    }
3642    
3643                    List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
3644                                    finderArgs, this);
3645    
3646                    if ((list != null) && !list.isEmpty()) {
3647                            for (BlogsEntry blogsEntry : list) {
3648                                    if ((companyId != blogsEntry.getCompanyId()) ||
3649                                                    (status != blogsEntry.getStatus())) {
3650                                            list = null;
3651    
3652                                            break;
3653                                    }
3654                            }
3655                    }
3656    
3657                    if (list == null) {
3658                            StringBundler query = null;
3659    
3660                            if (orderByComparator != null) {
3661                                    query = new StringBundler(4 +
3662                                                    (orderByComparator.getOrderByFields().length * 3));
3663                            }
3664                            else {
3665                                    query = new StringBundler(4);
3666                            }
3667    
3668                            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
3669    
3670                            query.append(_FINDER_COLUMN_C_S_COMPANYID_2);
3671    
3672                            query.append(_FINDER_COLUMN_C_S_STATUS_2);
3673    
3674                            if (orderByComparator != null) {
3675                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3676                                            orderByComparator);
3677                            }
3678    
3679                            else {
3680                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
3681                            }
3682    
3683                            String sql = query.toString();
3684    
3685                            Session session = null;
3686    
3687                            try {
3688                                    session = openSession();
3689    
3690                                    Query q = session.createQuery(sql);
3691    
3692                                    QueryPos qPos = QueryPos.getInstance(q);
3693    
3694                                    qPos.add(companyId);
3695    
3696                                    qPos.add(status);
3697    
3698                                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
3699                                                    end);
3700                            }
3701                            catch (Exception e) {
3702                                    throw processException(e);
3703                            }
3704                            finally {
3705                                    if (list == null) {
3706                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
3707                                    }
3708                                    else {
3709                                            cacheResult(list);
3710    
3711                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
3712                                    }
3713    
3714                                    closeSession(session);
3715                            }
3716                    }
3717    
3718                    return list;
3719            }
3720    
3721            /**
3722             * Returns the first blogs entry in the ordered set where companyId = &#63; and status = &#63;.
3723             *
3724             * <p>
3725             * 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.
3726             * </p>
3727             *
3728             * @param companyId the company ID
3729             * @param status the status
3730             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
3731             * @return the first matching blogs entry
3732             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
3733             * @throws SystemException if a system exception occurred
3734             */
3735            public BlogsEntry findByC_S_First(long companyId, int status,
3736                    OrderByComparator orderByComparator)
3737                    throws NoSuchEntryException, SystemException {
3738                    List<BlogsEntry> list = findByC_S(companyId, status, 0, 1,
3739                                    orderByComparator);
3740    
3741                    if (list.isEmpty()) {
3742                            StringBundler msg = new StringBundler(6);
3743    
3744                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3745    
3746                            msg.append("companyId=");
3747                            msg.append(companyId);
3748    
3749                            msg.append(", status=");
3750                            msg.append(status);
3751    
3752                            msg.append(StringPool.CLOSE_CURLY_BRACE);
3753    
3754                            throw new NoSuchEntryException(msg.toString());
3755                    }
3756                    else {
3757                            return list.get(0);
3758                    }
3759            }
3760    
3761            /**
3762             * Returns the last blogs entry in the ordered set where companyId = &#63; and status = &#63;.
3763             *
3764             * <p>
3765             * 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.
3766             * </p>
3767             *
3768             * @param companyId the company ID
3769             * @param status the status
3770             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
3771             * @return the last matching blogs entry
3772             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
3773             * @throws SystemException if a system exception occurred
3774             */
3775            public BlogsEntry findByC_S_Last(long companyId, int status,
3776                    OrderByComparator orderByComparator)
3777                    throws NoSuchEntryException, SystemException {
3778                    int count = countByC_S(companyId, status);
3779    
3780                    List<BlogsEntry> list = findByC_S(companyId, status, count - 1, count,
3781                                    orderByComparator);
3782    
3783                    if (list.isEmpty()) {
3784                            StringBundler msg = new StringBundler(6);
3785    
3786                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3787    
3788                            msg.append("companyId=");
3789                            msg.append(companyId);
3790    
3791                            msg.append(", status=");
3792                            msg.append(status);
3793    
3794                            msg.append(StringPool.CLOSE_CURLY_BRACE);
3795    
3796                            throw new NoSuchEntryException(msg.toString());
3797                    }
3798                    else {
3799                            return list.get(0);
3800                    }
3801            }
3802    
3803            /**
3804             * Returns the blogs entries before and after the current blogs entry in the ordered set where companyId = &#63; and status = &#63;.
3805             *
3806             * <p>
3807             * 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.
3808             * </p>
3809             *
3810             * @param entryId the primary key of the current blogs entry
3811             * @param companyId the company ID
3812             * @param status the status
3813             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
3814             * @return the previous, current, and next blogs entry
3815             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
3816             * @throws SystemException if a system exception occurred
3817             */
3818            public BlogsEntry[] findByC_S_PrevAndNext(long entryId, long companyId,
3819                    int status, OrderByComparator orderByComparator)
3820                    throws NoSuchEntryException, SystemException {
3821                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
3822    
3823                    Session session = null;
3824    
3825                    try {
3826                            session = openSession();
3827    
3828                            BlogsEntry[] array = new BlogsEntryImpl[3];
3829    
3830                            array[0] = getByC_S_PrevAndNext(session, blogsEntry, companyId,
3831                                            status, orderByComparator, true);
3832    
3833                            array[1] = blogsEntry;
3834    
3835                            array[2] = getByC_S_PrevAndNext(session, blogsEntry, companyId,
3836                                            status, orderByComparator, false);
3837    
3838                            return array;
3839                    }
3840                    catch (Exception e) {
3841                            throw processException(e);
3842                    }
3843                    finally {
3844                            closeSession(session);
3845                    }
3846            }
3847    
3848            protected BlogsEntry getByC_S_PrevAndNext(Session session,
3849                    BlogsEntry blogsEntry, long companyId, int status,
3850                    OrderByComparator orderByComparator, boolean previous) {
3851                    StringBundler query = null;
3852    
3853                    if (orderByComparator != null) {
3854                            query = new StringBundler(6 +
3855                                            (orderByComparator.getOrderByFields().length * 6));
3856                    }
3857                    else {
3858                            query = new StringBundler(3);
3859                    }
3860    
3861                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
3862    
3863                    query.append(_FINDER_COLUMN_C_S_COMPANYID_2);
3864    
3865                    query.append(_FINDER_COLUMN_C_S_STATUS_2);
3866    
3867                    if (orderByComparator != null) {
3868                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
3869    
3870                            if (orderByConditionFields.length > 0) {
3871                                    query.append(WHERE_AND);
3872                            }
3873    
3874                            for (int i = 0; i < orderByConditionFields.length; i++) {
3875                                    query.append(_ORDER_BY_ENTITY_ALIAS);
3876                                    query.append(orderByConditionFields[i]);
3877    
3878                                    if ((i + 1) < orderByConditionFields.length) {
3879                                            if (orderByComparator.isAscending() ^ previous) {
3880                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
3881                                            }
3882                                            else {
3883                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
3884                                            }
3885                                    }
3886                                    else {
3887                                            if (orderByComparator.isAscending() ^ previous) {
3888                                                    query.append(WHERE_GREATER_THAN);
3889                                            }
3890                                            else {
3891                                                    query.append(WHERE_LESSER_THAN);
3892                                            }
3893                                    }
3894                            }
3895    
3896                            query.append(ORDER_BY_CLAUSE);
3897    
3898                            String[] orderByFields = orderByComparator.getOrderByFields();
3899    
3900                            for (int i = 0; i < orderByFields.length; i++) {
3901                                    query.append(_ORDER_BY_ENTITY_ALIAS);
3902                                    query.append(orderByFields[i]);
3903    
3904                                    if ((i + 1) < orderByFields.length) {
3905                                            if (orderByComparator.isAscending() ^ previous) {
3906                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
3907                                            }
3908                                            else {
3909                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
3910                                            }
3911                                    }
3912                                    else {
3913                                            if (orderByComparator.isAscending() ^ previous) {
3914                                                    query.append(ORDER_BY_ASC);
3915                                            }
3916                                            else {
3917                                                    query.append(ORDER_BY_DESC);
3918                                            }
3919                                    }
3920                            }
3921                    }
3922    
3923                    else {
3924                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
3925                    }
3926    
3927                    String sql = query.toString();
3928    
3929                    Query q = session.createQuery(sql);
3930    
3931                    q.setFirstResult(0);
3932                    q.setMaxResults(2);
3933    
3934                    QueryPos qPos = QueryPos.getInstance(q);
3935    
3936                    qPos.add(companyId);
3937    
3938                    qPos.add(status);
3939    
3940                    if (orderByComparator != null) {
3941                            Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
3942    
3943                            for (Object value : values) {
3944                                    qPos.add(value);
3945                            }
3946                    }
3947    
3948                    List<BlogsEntry> list = q.list();
3949    
3950                    if (list.size() == 2) {
3951                            return list.get(1);
3952                    }
3953                    else {
3954                            return null;
3955                    }
3956            }
3957    
3958            /**
3959             * Returns the blogs entry where groupId = &#63; and urlTitle = &#63; or throws a {@link com.liferay.portlet.blogs.NoSuchEntryException} if it could not be found.
3960             *
3961             * @param groupId the group ID
3962             * @param urlTitle the url title
3963             * @return the matching blogs entry
3964             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
3965             * @throws SystemException if a system exception occurred
3966             */
3967            public BlogsEntry findByG_UT(long groupId, String urlTitle)
3968                    throws NoSuchEntryException, SystemException {
3969                    BlogsEntry blogsEntry = fetchByG_UT(groupId, urlTitle);
3970    
3971                    if (blogsEntry == null) {
3972                            StringBundler msg = new StringBundler(6);
3973    
3974                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3975    
3976                            msg.append("groupId=");
3977                            msg.append(groupId);
3978    
3979                            msg.append(", urlTitle=");
3980                            msg.append(urlTitle);
3981    
3982                            msg.append(StringPool.CLOSE_CURLY_BRACE);
3983    
3984                            if (_log.isWarnEnabled()) {
3985                                    _log.warn(msg.toString());
3986                            }
3987    
3988                            throw new NoSuchEntryException(msg.toString());
3989                    }
3990    
3991                    return blogsEntry;
3992            }
3993    
3994            /**
3995             * Returns the blogs entry where groupId = &#63; and urlTitle = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
3996             *
3997             * @param groupId the group ID
3998             * @param urlTitle the url title
3999             * @return the matching blogs entry, or <code>null</code> if a matching blogs entry could not be found
4000             * @throws SystemException if a system exception occurred
4001             */
4002            public BlogsEntry fetchByG_UT(long groupId, String urlTitle)
4003                    throws SystemException {
4004                    return fetchByG_UT(groupId, urlTitle, true);
4005            }
4006    
4007            /**
4008             * Returns 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.
4009             *
4010             * @param groupId the group ID
4011             * @param urlTitle the url title
4012             * @param retrieveFromCache whether to use the finder cache
4013             * @return the matching blogs entry, or <code>null</code> if a matching blogs entry could not be found
4014             * @throws SystemException if a system exception occurred
4015             */
4016            public BlogsEntry fetchByG_UT(long groupId, String urlTitle,
4017                    boolean retrieveFromCache) throws SystemException {
4018                    Object[] finderArgs = new Object[] { groupId, urlTitle };
4019    
4020                    Object result = null;
4021    
4022                    if (retrieveFromCache) {
4023                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_UT,
4024                                            finderArgs, this);
4025                    }
4026    
4027                    if (result instanceof BlogsEntry) {
4028                            BlogsEntry blogsEntry = (BlogsEntry)result;
4029    
4030                            if ((groupId != blogsEntry.getGroupId()) ||
4031                                            !Validator.equals(urlTitle, blogsEntry.getUrlTitle())) {
4032                                    result = null;
4033                            }
4034                    }
4035    
4036                    if (result == null) {
4037                            StringBundler query = new StringBundler(4);
4038    
4039                            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
4040    
4041                            query.append(_FINDER_COLUMN_G_UT_GROUPID_2);
4042    
4043                            if (urlTitle == null) {
4044                                    query.append(_FINDER_COLUMN_G_UT_URLTITLE_1);
4045                            }
4046                            else {
4047                                    if (urlTitle.equals(StringPool.BLANK)) {
4048                                            query.append(_FINDER_COLUMN_G_UT_URLTITLE_3);
4049                                    }
4050                                    else {
4051                                            query.append(_FINDER_COLUMN_G_UT_URLTITLE_2);
4052                                    }
4053                            }
4054    
4055                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
4056    
4057                            String sql = query.toString();
4058    
4059                            Session session = null;
4060    
4061                            try {
4062                                    session = openSession();
4063    
4064                                    Query q = session.createQuery(sql);
4065    
4066                                    QueryPos qPos = QueryPos.getInstance(q);
4067    
4068                                    qPos.add(groupId);
4069    
4070                                    if (urlTitle != null) {
4071                                            qPos.add(urlTitle);
4072                                    }
4073    
4074                                    List<BlogsEntry> list = q.list();
4075    
4076                                    result = list;
4077    
4078                                    BlogsEntry blogsEntry = null;
4079    
4080                                    if (list.isEmpty()) {
4081                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_UT,
4082                                                    finderArgs, list);
4083                                    }
4084                                    else {
4085                                            blogsEntry = list.get(0);
4086    
4087                                            cacheResult(blogsEntry);
4088    
4089                                            if ((blogsEntry.getGroupId() != groupId) ||
4090                                                            (blogsEntry.getUrlTitle() == null) ||
4091                                                            !blogsEntry.getUrlTitle().equals(urlTitle)) {
4092                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_UT,
4093                                                            finderArgs, blogsEntry);
4094                                            }
4095                                    }
4096    
4097                                    return blogsEntry;
4098                            }
4099                            catch (Exception e) {
4100                                    throw processException(e);
4101                            }
4102                            finally {
4103                                    if (result == null) {
4104                                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_UT,
4105                                                    finderArgs);
4106                                    }
4107    
4108                                    closeSession(session);
4109                            }
4110                    }
4111                    else {
4112                            if (result instanceof List<?>) {
4113                                    return null;
4114                            }
4115                            else {
4116                                    return (BlogsEntry)result;
4117                            }
4118                    }
4119            }
4120    
4121            /**
4122             * Returns all the blogs entries where groupId = &#63; and displayDate &lt; &#63;.
4123             *
4124             * @param groupId the group ID
4125             * @param displayDate the display date
4126             * @return the matching blogs entries
4127             * @throws SystemException if a system exception occurred
4128             */
4129            public List<BlogsEntry> findByG_LtD(long groupId, Date displayDate)
4130                    throws SystemException {
4131                    return findByG_LtD(groupId, displayDate, QueryUtil.ALL_POS,
4132                            QueryUtil.ALL_POS, null);
4133            }
4134    
4135            /**
4136             * Returns a range of all the blogs entries where groupId = &#63; and displayDate &lt; &#63;.
4137             *
4138             * <p>
4139             * 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.
4140             * </p>
4141             *
4142             * @param groupId the group ID
4143             * @param displayDate the display date
4144             * @param start the lower bound of the range of blogs entries
4145             * @param end the upper bound of the range of blogs entries (not inclusive)
4146             * @return the range of matching blogs entries
4147             * @throws SystemException if a system exception occurred
4148             */
4149            public List<BlogsEntry> findByG_LtD(long groupId, Date displayDate,
4150                    int start, int end) throws SystemException {
4151                    return findByG_LtD(groupId, displayDate, start, end, null);
4152            }
4153    
4154            /**
4155             * Returns an ordered range of all the blogs entries where groupId = &#63; and displayDate &lt; &#63;.
4156             *
4157             * <p>
4158             * 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.
4159             * </p>
4160             *
4161             * @param groupId the group ID
4162             * @param displayDate the display date
4163             * @param start the lower bound of the range of blogs entries
4164             * @param end the upper bound of the range of blogs entries (not inclusive)
4165             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
4166             * @return the ordered range of matching blogs entries
4167             * @throws SystemException if a system exception occurred
4168             */
4169            public List<BlogsEntry> findByG_LtD(long groupId, Date displayDate,
4170                    int start, int end, OrderByComparator orderByComparator)
4171                    throws SystemException {
4172                    FinderPath finderPath = null;
4173                    Object[] finderArgs = null;
4174    
4175                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
4176                                    (orderByComparator == null)) {
4177                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_LTD;
4178                            finderArgs = new Object[] { groupId, displayDate };
4179                    }
4180                    else {
4181                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_LTD;
4182                            finderArgs = new Object[] {
4183                                            groupId, displayDate,
4184                                            
4185                                            start, end, orderByComparator
4186                                    };
4187                    }
4188    
4189                    List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
4190                                    finderArgs, this);
4191    
4192                    if ((list != null) && !list.isEmpty()) {
4193                            for (BlogsEntry blogsEntry : list) {
4194                                    if ((groupId != blogsEntry.getGroupId()) ||
4195                                                    !Validator.equals(displayDate,
4196                                                            blogsEntry.getDisplayDate())) {
4197                                            list = null;
4198    
4199                                            break;
4200                                    }
4201                            }
4202                    }
4203    
4204                    if (list == null) {
4205                            StringBundler query = null;
4206    
4207                            if (orderByComparator != null) {
4208                                    query = new StringBundler(4 +
4209                                                    (orderByComparator.getOrderByFields().length * 3));
4210                            }
4211                            else {
4212                                    query = new StringBundler(4);
4213                            }
4214    
4215                            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
4216    
4217                            query.append(_FINDER_COLUMN_G_LTD_GROUPID_2);
4218    
4219                            if (displayDate == null) {
4220                                    query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_1);
4221                            }
4222                            else {
4223                                    query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_2);
4224                            }
4225    
4226                            if (orderByComparator != null) {
4227                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
4228                                            orderByComparator);
4229                            }
4230    
4231                            else {
4232                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
4233                            }
4234    
4235                            String sql = query.toString();
4236    
4237                            Session session = null;
4238    
4239                            try {
4240                                    session = openSession();
4241    
4242                                    Query q = session.createQuery(sql);
4243    
4244                                    QueryPos qPos = QueryPos.getInstance(q);
4245    
4246                                    qPos.add(groupId);
4247    
4248                                    if (displayDate != null) {
4249                                            qPos.add(CalendarUtil.getTimestamp(displayDate));
4250                                    }
4251    
4252                                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
4253                                                    end);
4254                            }
4255                            catch (Exception e) {
4256                                    throw processException(e);
4257                            }
4258                            finally {
4259                                    if (list == null) {
4260                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
4261                                    }
4262                                    else {
4263                                            cacheResult(list);
4264    
4265                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
4266                                    }
4267    
4268                                    closeSession(session);
4269                            }
4270                    }
4271    
4272                    return list;
4273            }
4274    
4275            /**
4276             * Returns the first blogs entry in the ordered set where groupId = &#63; and displayDate &lt; &#63;.
4277             *
4278             * <p>
4279             * 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.
4280             * </p>
4281             *
4282             * @param groupId the group ID
4283             * @param displayDate the display date
4284             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
4285             * @return the first matching blogs entry
4286             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
4287             * @throws SystemException if a system exception occurred
4288             */
4289            public BlogsEntry findByG_LtD_First(long groupId, Date displayDate,
4290                    OrderByComparator orderByComparator)
4291                    throws NoSuchEntryException, SystemException {
4292                    List<BlogsEntry> list = findByG_LtD(groupId, displayDate, 0, 1,
4293                                    orderByComparator);
4294    
4295                    if (list.isEmpty()) {
4296                            StringBundler msg = new StringBundler(6);
4297    
4298                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4299    
4300                            msg.append("groupId=");
4301                            msg.append(groupId);
4302    
4303                            msg.append(", displayDate=");
4304                            msg.append(displayDate);
4305    
4306                            msg.append(StringPool.CLOSE_CURLY_BRACE);
4307    
4308                            throw new NoSuchEntryException(msg.toString());
4309                    }
4310                    else {
4311                            return list.get(0);
4312                    }
4313            }
4314    
4315            /**
4316             * Returns the last blogs entry in the ordered set where groupId = &#63; and displayDate &lt; &#63;.
4317             *
4318             * <p>
4319             * 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.
4320             * </p>
4321             *
4322             * @param groupId the group ID
4323             * @param displayDate the display date
4324             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
4325             * @return the last matching blogs entry
4326             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
4327             * @throws SystemException if a system exception occurred
4328             */
4329            public BlogsEntry findByG_LtD_Last(long groupId, Date displayDate,
4330                    OrderByComparator orderByComparator)
4331                    throws NoSuchEntryException, SystemException {
4332                    int count = countByG_LtD(groupId, displayDate);
4333    
4334                    List<BlogsEntry> list = findByG_LtD(groupId, displayDate, count - 1,
4335                                    count, orderByComparator);
4336    
4337                    if (list.isEmpty()) {
4338                            StringBundler msg = new StringBundler(6);
4339    
4340                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4341    
4342                            msg.append("groupId=");
4343                            msg.append(groupId);
4344    
4345                            msg.append(", displayDate=");
4346                            msg.append(displayDate);
4347    
4348                            msg.append(StringPool.CLOSE_CURLY_BRACE);
4349    
4350                            throw new NoSuchEntryException(msg.toString());
4351                    }
4352                    else {
4353                            return list.get(0);
4354                    }
4355            }
4356    
4357            /**
4358             * Returns the blogs entries before and after the current blogs entry in the ordered set where groupId = &#63; and displayDate &lt; &#63;.
4359             *
4360             * <p>
4361             * 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.
4362             * </p>
4363             *
4364             * @param entryId the primary key of the current blogs entry
4365             * @param groupId the group ID
4366             * @param displayDate the display date
4367             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
4368             * @return the previous, current, and next blogs entry
4369             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
4370             * @throws SystemException if a system exception occurred
4371             */
4372            public BlogsEntry[] findByG_LtD_PrevAndNext(long entryId, long groupId,
4373                    Date displayDate, OrderByComparator orderByComparator)
4374                    throws NoSuchEntryException, SystemException {
4375                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
4376    
4377                    Session session = null;
4378    
4379                    try {
4380                            session = openSession();
4381    
4382                            BlogsEntry[] array = new BlogsEntryImpl[3];
4383    
4384                            array[0] = getByG_LtD_PrevAndNext(session, blogsEntry, groupId,
4385                                            displayDate, orderByComparator, true);
4386    
4387                            array[1] = blogsEntry;
4388    
4389                            array[2] = getByG_LtD_PrevAndNext(session, blogsEntry, groupId,
4390                                            displayDate, orderByComparator, false);
4391    
4392                            return array;
4393                    }
4394                    catch (Exception e) {
4395                            throw processException(e);
4396                    }
4397                    finally {
4398                            closeSession(session);
4399                    }
4400            }
4401    
4402            protected BlogsEntry getByG_LtD_PrevAndNext(Session session,
4403                    BlogsEntry blogsEntry, long groupId, Date displayDate,
4404                    OrderByComparator orderByComparator, boolean previous) {
4405                    StringBundler query = null;
4406    
4407                    if (orderByComparator != null) {
4408                            query = new StringBundler(6 +
4409                                            (orderByComparator.getOrderByFields().length * 6));
4410                    }
4411                    else {
4412                            query = new StringBundler(3);
4413                    }
4414    
4415                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
4416    
4417                    query.append(_FINDER_COLUMN_G_LTD_GROUPID_2);
4418    
4419                    if (displayDate == null) {
4420                            query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_1);
4421                    }
4422                    else {
4423                            query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_2);
4424                    }
4425    
4426                    if (orderByComparator != null) {
4427                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
4428    
4429                            if (orderByConditionFields.length > 0) {
4430                                    query.append(WHERE_AND);
4431                            }
4432    
4433                            for (int i = 0; i < orderByConditionFields.length; i++) {
4434                                    query.append(_ORDER_BY_ENTITY_ALIAS);
4435                                    query.append(orderByConditionFields[i]);
4436    
4437                                    if ((i + 1) < orderByConditionFields.length) {
4438                                            if (orderByComparator.isAscending() ^ previous) {
4439                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
4440                                            }
4441                                            else {
4442                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
4443                                            }
4444                                    }
4445                                    else {
4446                                            if (orderByComparator.isAscending() ^ previous) {
4447                                                    query.append(WHERE_GREATER_THAN);
4448                                            }
4449                                            else {
4450                                                    query.append(WHERE_LESSER_THAN);
4451                                            }
4452                                    }
4453                            }
4454    
4455                            query.append(ORDER_BY_CLAUSE);
4456    
4457                            String[] orderByFields = orderByComparator.getOrderByFields();
4458    
4459                            for (int i = 0; i < orderByFields.length; i++) {
4460                                    query.append(_ORDER_BY_ENTITY_ALIAS);
4461                                    query.append(orderByFields[i]);
4462    
4463                                    if ((i + 1) < orderByFields.length) {
4464                                            if (orderByComparator.isAscending() ^ previous) {
4465                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
4466                                            }
4467                                            else {
4468                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
4469                                            }
4470                                    }
4471                                    else {
4472                                            if (orderByComparator.isAscending() ^ previous) {
4473                                                    query.append(ORDER_BY_ASC);
4474                                            }
4475                                            else {
4476                                                    query.append(ORDER_BY_DESC);
4477                                            }
4478                                    }
4479                            }
4480                    }
4481    
4482                    else {
4483                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
4484                    }
4485    
4486                    String sql = query.toString();
4487    
4488                    Query q = session.createQuery(sql);
4489    
4490                    q.setFirstResult(0);
4491                    q.setMaxResults(2);
4492    
4493                    QueryPos qPos = QueryPos.getInstance(q);
4494    
4495                    qPos.add(groupId);
4496    
4497                    if (displayDate != null) {
4498                            qPos.add(CalendarUtil.getTimestamp(displayDate));
4499                    }
4500    
4501                    if (orderByComparator != null) {
4502                            Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
4503    
4504                            for (Object value : values) {
4505                                    qPos.add(value);
4506                            }
4507                    }
4508    
4509                    List<BlogsEntry> list = q.list();
4510    
4511                    if (list.size() == 2) {
4512                            return list.get(1);
4513                    }
4514                    else {
4515                            return null;
4516                    }
4517            }
4518    
4519            /**
4520             * Returns all the blogs entries that the user has permission to view where groupId = &#63; and displayDate &lt; &#63;.
4521             *
4522             * @param groupId the group ID
4523             * @param displayDate the display date
4524             * @return the matching blogs entries that the user has permission to view
4525             * @throws SystemException if a system exception occurred
4526             */
4527            public List<BlogsEntry> filterFindByG_LtD(long groupId, Date displayDate)
4528                    throws SystemException {
4529                    return filterFindByG_LtD(groupId, displayDate, QueryUtil.ALL_POS,
4530                            QueryUtil.ALL_POS, null);
4531            }
4532    
4533            /**
4534             * Returns a range of all the blogs entries that the user has permission to view where groupId = &#63; and displayDate &lt; &#63;.
4535             *
4536             * <p>
4537             * 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.
4538             * </p>
4539             *
4540             * @param groupId the group ID
4541             * @param displayDate the display date
4542             * @param start the lower bound of the range of blogs entries
4543             * @param end the upper bound of the range of blogs entries (not inclusive)
4544             * @return the range of matching blogs entries that the user has permission to view
4545             * @throws SystemException if a system exception occurred
4546             */
4547            public List<BlogsEntry> filterFindByG_LtD(long groupId, Date displayDate,
4548                    int start, int end) throws SystemException {
4549                    return filterFindByG_LtD(groupId, displayDate, start, end, null);
4550            }
4551    
4552            /**
4553             * Returns an ordered range of all the blogs entries that the user has permissions to view where groupId = &#63; and displayDate &lt; &#63;.
4554             *
4555             * <p>
4556             * 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.
4557             * </p>
4558             *
4559             * @param groupId the group ID
4560             * @param displayDate the display date
4561             * @param start the lower bound of the range of blogs entries
4562             * @param end the upper bound of the range of blogs entries (not inclusive)
4563             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
4564             * @return the ordered range of matching blogs entries that the user has permission to view
4565             * @throws SystemException if a system exception occurred
4566             */
4567            public List<BlogsEntry> filterFindByG_LtD(long groupId, Date displayDate,
4568                    int start, int end, OrderByComparator orderByComparator)
4569                    throws SystemException {
4570                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
4571                            return findByG_LtD(groupId, displayDate, start, end,
4572                                    orderByComparator);
4573                    }
4574    
4575                    StringBundler query = null;
4576    
4577                    if (orderByComparator != null) {
4578                            query = new StringBundler(4 +
4579                                            (orderByComparator.getOrderByFields().length * 3));
4580                    }
4581                    else {
4582                            query = new StringBundler(4);
4583                    }
4584    
4585                    if (getDB().isSupportsInlineDistinct()) {
4586                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
4587                    }
4588                    else {
4589                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1);
4590                    }
4591    
4592                    query.append(_FINDER_COLUMN_G_LTD_GROUPID_2);
4593    
4594                    if (displayDate == null) {
4595                            query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_1);
4596                    }
4597                    else {
4598                            query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_2);
4599                    }
4600    
4601                    if (!getDB().isSupportsInlineDistinct()) {
4602                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2);
4603                    }
4604    
4605                    if (orderByComparator != null) {
4606                            if (getDB().isSupportsInlineDistinct()) {
4607                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
4608                                            orderByComparator);
4609                            }
4610                            else {
4611                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
4612                                            orderByComparator);
4613                            }
4614                    }
4615    
4616                    else {
4617                            if (getDB().isSupportsInlineDistinct()) {
4618                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
4619                            }
4620                            else {
4621                                    query.append(BlogsEntryModelImpl.ORDER_BY_SQL);
4622                            }
4623                    }
4624    
4625                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
4626                                    BlogsEntry.class.getName(),
4627                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
4628    
4629                    Session session = null;
4630    
4631                    try {
4632                            session = openSession();
4633    
4634                            SQLQuery q = session.createSQLQuery(sql);
4635    
4636                            if (getDB().isSupportsInlineDistinct()) {
4637                                    q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
4638                            }
4639                            else {
4640                                    q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class);
4641                            }
4642    
4643                            QueryPos qPos = QueryPos.getInstance(q);
4644    
4645                            qPos.add(groupId);
4646    
4647                            if (displayDate != null) {
4648                                    qPos.add(CalendarUtil.getTimestamp(displayDate));
4649                            }
4650    
4651                            return (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start, end);
4652                    }
4653                    catch (Exception e) {
4654                            throw processException(e);
4655                    }
4656                    finally {
4657                            closeSession(session);
4658                    }
4659            }
4660    
4661            /**
4662             * Returns the blogs entries before and after the current blogs entry in the ordered set of blogs entries that the user has permission to view where groupId = &#63; and displayDate &lt; &#63;.
4663             *
4664             * @param entryId the primary key of the current blogs entry
4665             * @param groupId the group ID
4666             * @param displayDate the display date
4667             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
4668             * @return the previous, current, and next blogs entry
4669             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
4670             * @throws SystemException if a system exception occurred
4671             */
4672            public BlogsEntry[] filterFindByG_LtD_PrevAndNext(long entryId,
4673                    long groupId, Date displayDate, OrderByComparator orderByComparator)
4674                    throws NoSuchEntryException, SystemException {
4675                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
4676                            return findByG_LtD_PrevAndNext(entryId, groupId, displayDate,
4677                                    orderByComparator);
4678                    }
4679    
4680                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
4681    
4682                    Session session = null;
4683    
4684                    try {
4685                            session = openSession();
4686    
4687                            BlogsEntry[] array = new BlogsEntryImpl[3];
4688    
4689                            array[0] = filterGetByG_LtD_PrevAndNext(session, blogsEntry,
4690                                            groupId, displayDate, orderByComparator, true);
4691    
4692                            array[1] = blogsEntry;
4693    
4694                            array[2] = filterGetByG_LtD_PrevAndNext(session, blogsEntry,
4695                                            groupId, displayDate, orderByComparator, false);
4696    
4697                            return array;
4698                    }
4699                    catch (Exception e) {
4700                            throw processException(e);
4701                    }
4702                    finally {
4703                            closeSession(session);
4704                    }
4705            }
4706    
4707            protected BlogsEntry filterGetByG_LtD_PrevAndNext(Session session,
4708                    BlogsEntry blogsEntry, long groupId, Date displayDate,
4709                    OrderByComparator orderByComparator, boolean previous) {
4710                    StringBundler query = null;
4711    
4712                    if (orderByComparator != null) {
4713                            query = new StringBundler(6 +
4714                                            (orderByComparator.getOrderByFields().length * 6));
4715                    }
4716                    else {
4717                            query = new StringBundler(3);
4718                    }
4719    
4720                    if (getDB().isSupportsInlineDistinct()) {
4721                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
4722                    }
4723                    else {
4724                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1);
4725                    }
4726    
4727                    query.append(_FINDER_COLUMN_G_LTD_GROUPID_2);
4728    
4729                    if (displayDate == null) {
4730                            query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_1);
4731                    }
4732                    else {
4733                            query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_2);
4734                    }
4735    
4736                    if (!getDB().isSupportsInlineDistinct()) {
4737                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2);
4738                    }
4739    
4740                    if (orderByComparator != null) {
4741                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
4742    
4743                            if (orderByConditionFields.length > 0) {
4744                                    query.append(WHERE_AND);
4745                            }
4746    
4747                            for (int i = 0; i < orderByConditionFields.length; i++) {
4748                                    if (getDB().isSupportsInlineDistinct()) {
4749                                            query.append(_ORDER_BY_ENTITY_ALIAS);
4750                                    }
4751                                    else {
4752                                            query.append(_ORDER_BY_ENTITY_TABLE);
4753                                    }
4754    
4755                                    query.append(orderByConditionFields[i]);
4756    
4757                                    if ((i + 1) < orderByConditionFields.length) {
4758                                            if (orderByComparator.isAscending() ^ previous) {
4759                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
4760                                            }
4761                                            else {
4762                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
4763                                            }
4764                                    }
4765                                    else {
4766                                            if (orderByComparator.isAscending() ^ previous) {
4767                                                    query.append(WHERE_GREATER_THAN);
4768                                            }
4769                                            else {
4770                                                    query.append(WHERE_LESSER_THAN);
4771                                            }
4772                                    }
4773                            }
4774    
4775                            query.append(ORDER_BY_CLAUSE);
4776    
4777                            String[] orderByFields = orderByComparator.getOrderByFields();
4778    
4779                            for (int i = 0; i < orderByFields.length; i++) {
4780                                    if (getDB().isSupportsInlineDistinct()) {
4781                                            query.append(_ORDER_BY_ENTITY_ALIAS);
4782                                    }
4783                                    else {
4784                                            query.append(_ORDER_BY_ENTITY_TABLE);
4785                                    }
4786    
4787                                    query.append(orderByFields[i]);
4788    
4789                                    if ((i + 1) < orderByFields.length) {
4790                                            if (orderByComparator.isAscending() ^ previous) {
4791                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
4792                                            }
4793                                            else {
4794                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
4795                                            }
4796                                    }
4797                                    else {
4798                                            if (orderByComparator.isAscending() ^ previous) {
4799                                                    query.append(ORDER_BY_ASC);
4800                                            }
4801                                            else {
4802                                                    query.append(ORDER_BY_DESC);
4803                                            }
4804                                    }
4805                            }
4806                    }
4807    
4808                    else {
4809                            if (getDB().isSupportsInlineDistinct()) {
4810                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
4811                            }
4812                            else {
4813                                    query.append(BlogsEntryModelImpl.ORDER_BY_SQL);
4814                            }
4815                    }
4816    
4817                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
4818                                    BlogsEntry.class.getName(),
4819                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
4820    
4821                    SQLQuery q = session.createSQLQuery(sql);
4822    
4823                    q.setFirstResult(0);
4824                    q.setMaxResults(2);
4825    
4826                    if (getDB().isSupportsInlineDistinct()) {
4827                            q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
4828                    }
4829                    else {
4830                            q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class);
4831                    }
4832    
4833                    QueryPos qPos = QueryPos.getInstance(q);
4834    
4835                    qPos.add(groupId);
4836    
4837                    if (displayDate != null) {
4838                            qPos.add(CalendarUtil.getTimestamp(displayDate));
4839                    }
4840    
4841                    if (orderByComparator != null) {
4842                            Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
4843    
4844                            for (Object value : values) {
4845                                    qPos.add(value);
4846                            }
4847                    }
4848    
4849                    List<BlogsEntry> list = q.list();
4850    
4851                    if (list.size() == 2) {
4852                            return list.get(1);
4853                    }
4854                    else {
4855                            return null;
4856                    }
4857            }
4858    
4859            /**
4860             * Returns all the blogs entries where groupId = &#63; and status = &#63;.
4861             *
4862             * @param groupId the group ID
4863             * @param status the status
4864             * @return the matching blogs entries
4865             * @throws SystemException if a system exception occurred
4866             */
4867            public List<BlogsEntry> findByG_S(long groupId, int status)
4868                    throws SystemException {
4869                    return findByG_S(groupId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
4870                            null);
4871            }
4872    
4873            /**
4874             * Returns a range of all the blogs entries where groupId = &#63; and status = &#63;.
4875             *
4876             * <p>
4877             * 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.
4878             * </p>
4879             *
4880             * @param groupId the group ID
4881             * @param status the status
4882             * @param start the lower bound of the range of blogs entries
4883             * @param end the upper bound of the range of blogs entries (not inclusive)
4884             * @return the range of matching blogs entries
4885             * @throws SystemException if a system exception occurred
4886             */
4887            public List<BlogsEntry> findByG_S(long groupId, int status, int start,
4888                    int end) throws SystemException {
4889                    return findByG_S(groupId, status, start, end, null);
4890            }
4891    
4892            /**
4893             * Returns an ordered range of all the blogs entries where groupId = &#63; and status = &#63;.
4894             *
4895             * <p>
4896             * 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.
4897             * </p>
4898             *
4899             * @param groupId the group ID
4900             * @param status the status
4901             * @param start the lower bound of the range of blogs entries
4902             * @param end the upper bound of the range of blogs entries (not inclusive)
4903             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
4904             * @return the ordered range of matching blogs entries
4905             * @throws SystemException if a system exception occurred
4906             */
4907            public List<BlogsEntry> findByG_S(long groupId, int status, int start,
4908                    int end, OrderByComparator orderByComparator) throws SystemException {
4909                    FinderPath finderPath = null;
4910                    Object[] finderArgs = null;
4911    
4912                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
4913                                    (orderByComparator == null)) {
4914                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S;
4915                            finderArgs = new Object[] { groupId, status };
4916                    }
4917                    else {
4918                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_S;
4919                            finderArgs = new Object[] {
4920                                            groupId, status,
4921                                            
4922                                            start, end, orderByComparator
4923                                    };
4924                    }
4925    
4926                    List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
4927                                    finderArgs, this);
4928    
4929                    if ((list != null) && !list.isEmpty()) {
4930                            for (BlogsEntry blogsEntry : list) {
4931                                    if ((groupId != blogsEntry.getGroupId()) ||
4932                                                    (status != blogsEntry.getStatus())) {
4933                                            list = null;
4934    
4935                                            break;
4936                                    }
4937                            }
4938                    }
4939    
4940                    if (list == null) {
4941                            StringBundler query = null;
4942    
4943                            if (orderByComparator != null) {
4944                                    query = new StringBundler(4 +
4945                                                    (orderByComparator.getOrderByFields().length * 3));
4946                            }
4947                            else {
4948                                    query = new StringBundler(4);
4949                            }
4950    
4951                            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
4952    
4953                            query.append(_FINDER_COLUMN_G_S_GROUPID_2);
4954    
4955                            query.append(_FINDER_COLUMN_G_S_STATUS_2);
4956    
4957                            if (orderByComparator != null) {
4958                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
4959                                            orderByComparator);
4960                            }
4961    
4962                            else {
4963                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
4964                            }
4965    
4966                            String sql = query.toString();
4967    
4968                            Session session = null;
4969    
4970                            try {
4971                                    session = openSession();
4972    
4973                                    Query q = session.createQuery(sql);
4974    
4975                                    QueryPos qPos = QueryPos.getInstance(q);
4976    
4977                                    qPos.add(groupId);
4978    
4979                                    qPos.add(status);
4980    
4981                                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
4982                                                    end);
4983                            }
4984                            catch (Exception e) {
4985                                    throw processException(e);
4986                            }
4987                            finally {
4988                                    if (list == null) {
4989                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
4990                                    }
4991                                    else {
4992                                            cacheResult(list);
4993    
4994                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
4995                                    }
4996    
4997                                    closeSession(session);
4998                            }
4999                    }
5000    
5001                    return list;
5002            }
5003    
5004            /**
5005             * Returns the first blogs entry in the ordered set where groupId = &#63; and status = &#63;.
5006             *
5007             * <p>
5008             * 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.
5009             * </p>
5010             *
5011             * @param groupId the group ID
5012             * @param status the status
5013             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
5014             * @return the first matching blogs entry
5015             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
5016             * @throws SystemException if a system exception occurred
5017             */
5018            public BlogsEntry findByG_S_First(long groupId, int status,
5019                    OrderByComparator orderByComparator)
5020                    throws NoSuchEntryException, SystemException {
5021                    List<BlogsEntry> list = findByG_S(groupId, status, 0, 1,
5022                                    orderByComparator);
5023    
5024                    if (list.isEmpty()) {
5025                            StringBundler msg = new StringBundler(6);
5026    
5027                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
5028    
5029                            msg.append("groupId=");
5030                            msg.append(groupId);
5031    
5032                            msg.append(", status=");
5033                            msg.append(status);
5034    
5035                            msg.append(StringPool.CLOSE_CURLY_BRACE);
5036    
5037                            throw new NoSuchEntryException(msg.toString());
5038                    }
5039                    else {
5040                            return list.get(0);
5041                    }
5042            }
5043    
5044            /**
5045             * Returns the last blogs entry in the ordered set where groupId = &#63; and status = &#63;.
5046             *
5047             * <p>
5048             * 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.
5049             * </p>
5050             *
5051             * @param groupId the group ID
5052             * @param status the status
5053             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
5054             * @return the last matching blogs entry
5055             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
5056             * @throws SystemException if a system exception occurred
5057             */
5058            public BlogsEntry findByG_S_Last(long groupId, int status,
5059                    OrderByComparator orderByComparator)
5060                    throws NoSuchEntryException, SystemException {
5061                    int count = countByG_S(groupId, status);
5062    
5063                    List<BlogsEntry> list = findByG_S(groupId, status, count - 1, count,
5064                                    orderByComparator);
5065    
5066                    if (list.isEmpty()) {
5067                            StringBundler msg = new StringBundler(6);
5068    
5069                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
5070    
5071                            msg.append("groupId=");
5072                            msg.append(groupId);
5073    
5074                            msg.append(", status=");
5075                            msg.append(status);
5076    
5077                            msg.append(StringPool.CLOSE_CURLY_BRACE);
5078    
5079                            throw new NoSuchEntryException(msg.toString());
5080                    }
5081                    else {
5082                            return list.get(0);
5083                    }
5084            }
5085    
5086            /**
5087             * Returns the blogs entries before and after the current blogs entry in the ordered set where groupId = &#63; and status = &#63;.
5088             *
5089             * <p>
5090             * 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.
5091             * </p>
5092             *
5093             * @param entryId the primary key of the current blogs entry
5094             * @param groupId the group ID
5095             * @param status the status
5096             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
5097             * @return the previous, current, and next blogs entry
5098             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
5099             * @throws SystemException if a system exception occurred
5100             */
5101            public BlogsEntry[] findByG_S_PrevAndNext(long entryId, long groupId,
5102                    int status, OrderByComparator orderByComparator)
5103                    throws NoSuchEntryException, SystemException {
5104                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
5105    
5106                    Session session = null;
5107    
5108                    try {
5109                            session = openSession();
5110    
5111                            BlogsEntry[] array = new BlogsEntryImpl[3];
5112    
5113                            array[0] = getByG_S_PrevAndNext(session, blogsEntry, groupId,
5114                                            status, orderByComparator, true);
5115    
5116                            array[1] = blogsEntry;
5117    
5118                            array[2] = getByG_S_PrevAndNext(session, blogsEntry, groupId,
5119                                            status, orderByComparator, false);
5120    
5121                            return array;
5122                    }
5123                    catch (Exception e) {
5124                            throw processException(e);
5125                    }
5126                    finally {
5127                            closeSession(session);
5128                    }
5129            }
5130    
5131            protected BlogsEntry getByG_S_PrevAndNext(Session session,
5132                    BlogsEntry blogsEntry, long groupId, int status,
5133                    OrderByComparator orderByComparator, boolean previous) {
5134                    StringBundler query = null;
5135    
5136                    if (orderByComparator != null) {
5137                            query = new StringBundler(6 +
5138                                            (orderByComparator.getOrderByFields().length * 6));
5139                    }
5140                    else {
5141                            query = new StringBundler(3);
5142                    }
5143    
5144                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
5145    
5146                    query.append(_FINDER_COLUMN_G_S_GROUPID_2);
5147    
5148                    query.append(_FINDER_COLUMN_G_S_STATUS_2);
5149    
5150                    if (orderByComparator != null) {
5151                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
5152    
5153                            if (orderByConditionFields.length > 0) {
5154                                    query.append(WHERE_AND);
5155                            }
5156    
5157                            for (int i = 0; i < orderByConditionFields.length; i++) {
5158                                    query.append(_ORDER_BY_ENTITY_ALIAS);
5159                                    query.append(orderByConditionFields[i]);
5160    
5161                                    if ((i + 1) < orderByConditionFields.length) {
5162                                            if (orderByComparator.isAscending() ^ previous) {
5163                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
5164                                            }
5165                                            else {
5166                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
5167                                            }
5168                                    }
5169                                    else {
5170                                            if (orderByComparator.isAscending() ^ previous) {
5171                                                    query.append(WHERE_GREATER_THAN);
5172                                            }
5173                                            else {
5174                                                    query.append(WHERE_LESSER_THAN);
5175                                            }
5176                                    }
5177                            }
5178    
5179                            query.append(ORDER_BY_CLAUSE);
5180    
5181                            String[] orderByFields = orderByComparator.getOrderByFields();
5182    
5183                            for (int i = 0; i < orderByFields.length; i++) {
5184                                    query.append(_ORDER_BY_ENTITY_ALIAS);
5185                                    query.append(orderByFields[i]);
5186    
5187                                    if ((i + 1) < orderByFields.length) {
5188                                            if (orderByComparator.isAscending() ^ previous) {
5189                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
5190                                            }
5191                                            else {
5192                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
5193                                            }
5194                                    }
5195                                    else {
5196                                            if (orderByComparator.isAscending() ^ previous) {
5197                                                    query.append(ORDER_BY_ASC);
5198                                            }
5199                                            else {
5200                                                    query.append(ORDER_BY_DESC);
5201                                            }
5202                                    }
5203                            }
5204                    }
5205    
5206                    else {
5207                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
5208                    }
5209    
5210                    String sql = query.toString();
5211    
5212                    Query q = session.createQuery(sql);
5213    
5214                    q.setFirstResult(0);
5215                    q.setMaxResults(2);
5216    
5217                    QueryPos qPos = QueryPos.getInstance(q);
5218    
5219                    qPos.add(groupId);
5220    
5221                    qPos.add(status);
5222    
5223                    if (orderByComparator != null) {
5224                            Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
5225    
5226                            for (Object value : values) {
5227                                    qPos.add(value);
5228                            }
5229                    }
5230    
5231                    List<BlogsEntry> list = q.list();
5232    
5233                    if (list.size() == 2) {
5234                            return list.get(1);
5235                    }
5236                    else {
5237                            return null;
5238                    }
5239            }
5240    
5241            /**
5242             * Returns all the blogs entries that the user has permission to view where groupId = &#63; and status = &#63;.
5243             *
5244             * @param groupId the group ID
5245             * @param status the status
5246             * @return the matching blogs entries that the user has permission to view
5247             * @throws SystemException if a system exception occurred
5248             */
5249            public List<BlogsEntry> filterFindByG_S(long groupId, int status)
5250                    throws SystemException {
5251                    return filterFindByG_S(groupId, status, QueryUtil.ALL_POS,
5252                            QueryUtil.ALL_POS, null);
5253            }
5254    
5255            /**
5256             * Returns a range of all the blogs entries that the user has permission to view where groupId = &#63; and status = &#63;.
5257             *
5258             * <p>
5259             * 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.
5260             * </p>
5261             *
5262             * @param groupId the group ID
5263             * @param status the status
5264             * @param start the lower bound of the range of blogs entries
5265             * @param end the upper bound of the range of blogs entries (not inclusive)
5266             * @return the range of matching blogs entries that the user has permission to view
5267             * @throws SystemException if a system exception occurred
5268             */
5269            public List<BlogsEntry> filterFindByG_S(long groupId, int status,
5270                    int start, int end) throws SystemException {
5271                    return filterFindByG_S(groupId, status, start, end, null);
5272            }
5273    
5274            /**
5275             * Returns an ordered range of all the blogs entries that the user has permissions to view where groupId = &#63; and status = &#63;.
5276             *
5277             * <p>
5278             * 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.
5279             * </p>
5280             *
5281             * @param groupId the group ID
5282             * @param status the status
5283             * @param start the lower bound of the range of blogs entries
5284             * @param end the upper bound of the range of blogs entries (not inclusive)
5285             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
5286             * @return the ordered range of matching blogs entries that the user has permission to view
5287             * @throws SystemException if a system exception occurred
5288             */
5289            public List<BlogsEntry> filterFindByG_S(long groupId, int status,
5290                    int start, int end, OrderByComparator orderByComparator)
5291                    throws SystemException {
5292                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
5293                            return findByG_S(groupId, status, start, end, orderByComparator);
5294                    }
5295    
5296                    StringBundler query = null;
5297    
5298                    if (orderByComparator != null) {
5299                            query = new StringBundler(4 +
5300                                            (orderByComparator.getOrderByFields().length * 3));
5301                    }
5302                    else {
5303                            query = new StringBundler(4);
5304                    }
5305    
5306                    if (getDB().isSupportsInlineDistinct()) {
5307                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
5308                    }
5309                    else {
5310                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1);
5311                    }
5312    
5313                    query.append(_FINDER_COLUMN_G_S_GROUPID_2);
5314    
5315                    query.append(_FINDER_COLUMN_G_S_STATUS_2);
5316    
5317                    if (!getDB().isSupportsInlineDistinct()) {
5318                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2);
5319                    }
5320    
5321                    if (orderByComparator != null) {
5322                            if (getDB().isSupportsInlineDistinct()) {
5323                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
5324                                            orderByComparator);
5325                            }
5326                            else {
5327                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
5328                                            orderByComparator);
5329                            }
5330                    }
5331    
5332                    else {
5333                            if (getDB().isSupportsInlineDistinct()) {
5334                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
5335                            }
5336                            else {
5337                                    query.append(BlogsEntryModelImpl.ORDER_BY_SQL);
5338                            }
5339                    }
5340    
5341                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
5342                                    BlogsEntry.class.getName(),
5343                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
5344    
5345                    Session session = null;
5346    
5347                    try {
5348                            session = openSession();
5349    
5350                            SQLQuery q = session.createSQLQuery(sql);
5351    
5352                            if (getDB().isSupportsInlineDistinct()) {
5353                                    q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
5354                            }
5355                            else {
5356                                    q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class);
5357                            }
5358    
5359                            QueryPos qPos = QueryPos.getInstance(q);
5360    
5361                            qPos.add(groupId);
5362    
5363                            qPos.add(status);
5364    
5365                            return (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start, end);
5366                    }
5367                    catch (Exception e) {
5368                            throw processException(e);
5369                    }
5370                    finally {
5371                            closeSession(session);
5372                    }
5373            }
5374    
5375            /**
5376             * Returns the blogs entries before and after the current blogs entry in the ordered set of blogs entries that the user has permission to view where groupId = &#63; and status = &#63;.
5377             *
5378             * @param entryId the primary key of the current blogs entry
5379             * @param groupId the group ID
5380             * @param status the status
5381             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
5382             * @return the previous, current, and next blogs entry
5383             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
5384             * @throws SystemException if a system exception occurred
5385             */
5386            public BlogsEntry[] filterFindByG_S_PrevAndNext(long entryId, long groupId,
5387                    int status, OrderByComparator orderByComparator)
5388                    throws NoSuchEntryException, SystemException {
5389                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
5390                            return findByG_S_PrevAndNext(entryId, groupId, status,
5391                                    orderByComparator);
5392                    }
5393    
5394                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
5395    
5396                    Session session = null;
5397    
5398                    try {
5399                            session = openSession();
5400    
5401                            BlogsEntry[] array = new BlogsEntryImpl[3];
5402    
5403                            array[0] = filterGetByG_S_PrevAndNext(session, blogsEntry, groupId,
5404                                            status, orderByComparator, true);
5405    
5406                            array[1] = blogsEntry;
5407    
5408                            array[2] = filterGetByG_S_PrevAndNext(session, blogsEntry, groupId,
5409                                            status, orderByComparator, false);
5410    
5411                            return array;
5412                    }
5413                    catch (Exception e) {
5414                            throw processException(e);
5415                    }
5416                    finally {
5417                            closeSession(session);
5418                    }
5419            }
5420    
5421            protected BlogsEntry filterGetByG_S_PrevAndNext(Session session,
5422                    BlogsEntry blogsEntry, long groupId, int status,
5423                    OrderByComparator orderByComparator, boolean previous) {
5424                    StringBundler query = null;
5425    
5426                    if (orderByComparator != null) {
5427                            query = new StringBundler(6 +
5428                                            (orderByComparator.getOrderByFields().length * 6));
5429                    }
5430                    else {
5431                            query = new StringBundler(3);
5432                    }
5433    
5434                    if (getDB().isSupportsInlineDistinct()) {
5435                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
5436                    }
5437                    else {
5438                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1);
5439                    }
5440    
5441                    query.append(_FINDER_COLUMN_G_S_GROUPID_2);
5442    
5443                    query.append(_FINDER_COLUMN_G_S_STATUS_2);
5444    
5445                    if (!getDB().isSupportsInlineDistinct()) {
5446                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2);
5447                    }
5448    
5449                    if (orderByComparator != null) {
5450                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
5451    
5452                            if (orderByConditionFields.length > 0) {
5453                                    query.append(WHERE_AND);
5454                            }
5455    
5456                            for (int i = 0; i < orderByConditionFields.length; i++) {
5457                                    if (getDB().isSupportsInlineDistinct()) {
5458                                            query.append(_ORDER_BY_ENTITY_ALIAS);
5459                                    }
5460                                    else {
5461                                            query.append(_ORDER_BY_ENTITY_TABLE);
5462                                    }
5463    
5464                                    query.append(orderByConditionFields[i]);
5465    
5466                                    if ((i + 1) < orderByConditionFields.length) {
5467                                            if (orderByComparator.isAscending() ^ previous) {
5468                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
5469                                            }
5470                                            else {
5471                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
5472                                            }
5473                                    }
5474                                    else {
5475                                            if (orderByComparator.isAscending() ^ previous) {
5476                                                    query.append(WHERE_GREATER_THAN);
5477                                            }
5478                                            else {
5479                                                    query.append(WHERE_LESSER_THAN);
5480                                            }
5481                                    }
5482                            }
5483    
5484                            query.append(ORDER_BY_CLAUSE);
5485    
5486                            String[] orderByFields = orderByComparator.getOrderByFields();
5487    
5488                            for (int i = 0; i < orderByFields.length; i++) {
5489                                    if (getDB().isSupportsInlineDistinct()) {
5490                                            query.append(_ORDER_BY_ENTITY_ALIAS);
5491                                    }
5492                                    else {
5493                                            query.append(_ORDER_BY_ENTITY_TABLE);
5494                                    }
5495    
5496                                    query.append(orderByFields[i]);
5497    
5498                                    if ((i + 1) < orderByFields.length) {
5499                                            if (orderByComparator.isAscending() ^ previous) {
5500                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
5501                                            }
5502                                            else {
5503                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
5504                                            }
5505                                    }
5506                                    else {
5507                                            if (orderByComparator.isAscending() ^ previous) {
5508                                                    query.append(ORDER_BY_ASC);
5509                                            }
5510                                            else {
5511                                                    query.append(ORDER_BY_DESC);
5512                                            }
5513                                    }
5514                            }
5515                    }
5516    
5517                    else {
5518                            if (getDB().isSupportsInlineDistinct()) {
5519                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
5520                            }
5521                            else {
5522                                    query.append(BlogsEntryModelImpl.ORDER_BY_SQL);
5523                            }
5524                    }
5525    
5526                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
5527                                    BlogsEntry.class.getName(),
5528                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
5529    
5530                    SQLQuery q = session.createSQLQuery(sql);
5531    
5532                    q.setFirstResult(0);
5533                    q.setMaxResults(2);
5534    
5535                    if (getDB().isSupportsInlineDistinct()) {
5536                            q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
5537                    }
5538                    else {
5539                            q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class);
5540                    }
5541    
5542                    QueryPos qPos = QueryPos.getInstance(q);
5543    
5544                    qPos.add(groupId);
5545    
5546                    qPos.add(status);
5547    
5548                    if (orderByComparator != null) {
5549                            Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
5550    
5551                            for (Object value : values) {
5552                                    qPos.add(value);
5553                            }
5554                    }
5555    
5556                    List<BlogsEntry> list = q.list();
5557    
5558                    if (list.size() == 2) {
5559                            return list.get(1);
5560                    }
5561                    else {
5562                            return null;
5563                    }
5564            }
5565    
5566            /**
5567             * Returns all the blogs entries where companyId = &#63; and userId = &#63; and status = &#63;.
5568             *
5569             * @param companyId the company ID
5570             * @param userId the user ID
5571             * @param status the status
5572             * @return the matching blogs entries
5573             * @throws SystemException if a system exception occurred
5574             */
5575            public List<BlogsEntry> findByC_U_S(long companyId, long userId, int status)
5576                    throws SystemException {
5577                    return findByC_U_S(companyId, userId, status, QueryUtil.ALL_POS,
5578                            QueryUtil.ALL_POS, null);
5579            }
5580    
5581            /**
5582             * Returns a range of all the blogs entries where companyId = &#63; and userId = &#63; and status = &#63;.
5583             *
5584             * <p>
5585             * 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.
5586             * </p>
5587             *
5588             * @param companyId the company ID
5589             * @param userId the user ID
5590             * @param status the status
5591             * @param start the lower bound of the range of blogs entries
5592             * @param end the upper bound of the range of blogs entries (not inclusive)
5593             * @return the range of matching blogs entries
5594             * @throws SystemException if a system exception occurred
5595             */
5596            public List<BlogsEntry> findByC_U_S(long companyId, long userId,
5597                    int status, int start, int end) throws SystemException {
5598                    return findByC_U_S(companyId, userId, status, start, end, null);
5599            }
5600    
5601            /**
5602             * Returns an ordered range of all the blogs entries where companyId = &#63; and userId = &#63; and status = &#63;.
5603             *
5604             * <p>
5605             * 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.
5606             * </p>
5607             *
5608             * @param companyId the company ID
5609             * @param userId the user ID
5610             * @param status the status
5611             * @param start the lower bound of the range of blogs entries
5612             * @param end the upper bound of the range of blogs entries (not inclusive)
5613             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
5614             * @return the ordered range of matching blogs entries
5615             * @throws SystemException if a system exception occurred
5616             */
5617            public List<BlogsEntry> findByC_U_S(long companyId, long userId,
5618                    int status, int start, int end, OrderByComparator orderByComparator)
5619                    throws SystemException {
5620                    FinderPath finderPath = null;
5621                    Object[] finderArgs = null;
5622    
5623                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
5624                                    (orderByComparator == null)) {
5625                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_U_S;
5626                            finderArgs = new Object[] { companyId, userId, status };
5627                    }
5628                    else {
5629                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_U_S;
5630                            finderArgs = new Object[] {
5631                                            companyId, userId, status,
5632                                            
5633                                            start, end, orderByComparator
5634                                    };
5635                    }
5636    
5637                    List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
5638                                    finderArgs, this);
5639    
5640                    if ((list != null) && !list.isEmpty()) {
5641                            for (BlogsEntry blogsEntry : list) {
5642                                    if ((companyId != blogsEntry.getCompanyId()) ||
5643                                                    (userId != blogsEntry.getUserId()) ||
5644                                                    (status != blogsEntry.getStatus())) {
5645                                            list = null;
5646    
5647                                            break;
5648                                    }
5649                            }
5650                    }
5651    
5652                    if (list == null) {
5653                            StringBundler query = null;
5654    
5655                            if (orderByComparator != null) {
5656                                    query = new StringBundler(5 +
5657                                                    (orderByComparator.getOrderByFields().length * 3));
5658                            }
5659                            else {
5660                                    query = new StringBundler(5);
5661                            }
5662    
5663                            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
5664    
5665                            query.append(_FINDER_COLUMN_C_U_S_COMPANYID_2);
5666    
5667                            query.append(_FINDER_COLUMN_C_U_S_USERID_2);
5668    
5669                            query.append(_FINDER_COLUMN_C_U_S_STATUS_2);
5670    
5671                            if (orderByComparator != null) {
5672                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
5673                                            orderByComparator);
5674                            }
5675    
5676                            else {
5677                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
5678                            }
5679    
5680                            String sql = query.toString();
5681    
5682                            Session session = null;
5683    
5684                            try {
5685                                    session = openSession();
5686    
5687                                    Query q = session.createQuery(sql);
5688    
5689                                    QueryPos qPos = QueryPos.getInstance(q);
5690    
5691                                    qPos.add(companyId);
5692    
5693                                    qPos.add(userId);
5694    
5695                                    qPos.add(status);
5696    
5697                                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
5698                                                    end);
5699                            }
5700                            catch (Exception e) {
5701                                    throw processException(e);
5702                            }
5703                            finally {
5704                                    if (list == null) {
5705                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
5706                                    }
5707                                    else {
5708                                            cacheResult(list);
5709    
5710                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
5711                                    }
5712    
5713                                    closeSession(session);
5714                            }
5715                    }
5716    
5717                    return list;
5718            }
5719    
5720            /**
5721             * Returns the first blogs entry in the ordered set where companyId = &#63; and userId = &#63; and status = &#63;.
5722             *
5723             * <p>
5724             * 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.
5725             * </p>
5726             *
5727             * @param companyId the company ID
5728             * @param userId the user ID
5729             * @param status the status
5730             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
5731             * @return the first matching blogs entry
5732             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
5733             * @throws SystemException if a system exception occurred
5734             */
5735            public BlogsEntry findByC_U_S_First(long companyId, long userId,
5736                    int status, OrderByComparator orderByComparator)
5737                    throws NoSuchEntryException, SystemException {
5738                    List<BlogsEntry> list = findByC_U_S(companyId, userId, status, 0, 1,
5739                                    orderByComparator);
5740    
5741                    if (list.isEmpty()) {
5742                            StringBundler msg = new StringBundler(8);
5743    
5744                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
5745    
5746                            msg.append("companyId=");
5747                            msg.append(companyId);
5748    
5749                            msg.append(", userId=");
5750                            msg.append(userId);
5751    
5752                            msg.append(", status=");
5753                            msg.append(status);
5754    
5755                            msg.append(StringPool.CLOSE_CURLY_BRACE);
5756    
5757                            throw new NoSuchEntryException(msg.toString());
5758                    }
5759                    else {
5760                            return list.get(0);
5761                    }
5762            }
5763    
5764            /**
5765             * Returns the last blogs entry in the ordered set where companyId = &#63; and userId = &#63; and status = &#63;.
5766             *
5767             * <p>
5768             * 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.
5769             * </p>
5770             *
5771             * @param companyId the company ID
5772             * @param userId the user ID
5773             * @param status the status
5774             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
5775             * @return the last matching blogs entry
5776             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
5777             * @throws SystemException if a system exception occurred
5778             */
5779            public BlogsEntry findByC_U_S_Last(long companyId, long userId, int status,
5780                    OrderByComparator orderByComparator)
5781                    throws NoSuchEntryException, SystemException {
5782                    int count = countByC_U_S(companyId, userId, status);
5783    
5784                    List<BlogsEntry> list = findByC_U_S(companyId, userId, status,
5785                                    count - 1, count, orderByComparator);
5786    
5787                    if (list.isEmpty()) {
5788                            StringBundler msg = new StringBundler(8);
5789    
5790                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
5791    
5792                            msg.append("companyId=");
5793                            msg.append(companyId);
5794    
5795                            msg.append(", userId=");
5796                            msg.append(userId);
5797    
5798                            msg.append(", status=");
5799                            msg.append(status);
5800    
5801                            msg.append(StringPool.CLOSE_CURLY_BRACE);
5802    
5803                            throw new NoSuchEntryException(msg.toString());
5804                    }
5805                    else {
5806                            return list.get(0);
5807                    }
5808            }
5809    
5810            /**
5811             * Returns the blogs entries before and after the current blogs entry in the ordered set where companyId = &#63; and userId = &#63; and status = &#63;.
5812             *
5813             * <p>
5814             * 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.
5815             * </p>
5816             *
5817             * @param entryId the primary key of the current blogs entry
5818             * @param companyId the company ID
5819             * @param userId the user ID
5820             * @param status the status
5821             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
5822             * @return the previous, current, and next blogs entry
5823             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
5824             * @throws SystemException if a system exception occurred
5825             */
5826            public BlogsEntry[] findByC_U_S_PrevAndNext(long entryId, long companyId,
5827                    long userId, int status, OrderByComparator orderByComparator)
5828                    throws NoSuchEntryException, SystemException {
5829                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
5830    
5831                    Session session = null;
5832    
5833                    try {
5834                            session = openSession();
5835    
5836                            BlogsEntry[] array = new BlogsEntryImpl[3];
5837    
5838                            array[0] = getByC_U_S_PrevAndNext(session, blogsEntry, companyId,
5839                                            userId, status, orderByComparator, true);
5840    
5841                            array[1] = blogsEntry;
5842    
5843                            array[2] = getByC_U_S_PrevAndNext(session, blogsEntry, companyId,
5844                                            userId, status, orderByComparator, false);
5845    
5846                            return array;
5847                    }
5848                    catch (Exception e) {
5849                            throw processException(e);
5850                    }
5851                    finally {
5852                            closeSession(session);
5853                    }
5854            }
5855    
5856            protected BlogsEntry getByC_U_S_PrevAndNext(Session session,
5857                    BlogsEntry blogsEntry, long companyId, long userId, int status,
5858                    OrderByComparator orderByComparator, boolean previous) {
5859                    StringBundler query = null;
5860    
5861                    if (orderByComparator != null) {
5862                            query = new StringBundler(6 +
5863                                            (orderByComparator.getOrderByFields().length * 6));
5864                    }
5865                    else {
5866                            query = new StringBundler(3);
5867                    }
5868    
5869                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
5870    
5871                    query.append(_FINDER_COLUMN_C_U_S_COMPANYID_2);
5872    
5873                    query.append(_FINDER_COLUMN_C_U_S_USERID_2);
5874    
5875                    query.append(_FINDER_COLUMN_C_U_S_STATUS_2);
5876    
5877                    if (orderByComparator != null) {
5878                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
5879    
5880                            if (orderByConditionFields.length > 0) {
5881                                    query.append(WHERE_AND);
5882                            }
5883    
5884                            for (int i = 0; i < orderByConditionFields.length; i++) {
5885                                    query.append(_ORDER_BY_ENTITY_ALIAS);
5886                                    query.append(orderByConditionFields[i]);
5887    
5888                                    if ((i + 1) < orderByConditionFields.length) {
5889                                            if (orderByComparator.isAscending() ^ previous) {
5890                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
5891                                            }
5892                                            else {
5893                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
5894                                            }
5895                                    }
5896                                    else {
5897                                            if (orderByComparator.isAscending() ^ previous) {
5898                                                    query.append(WHERE_GREATER_THAN);
5899                                            }
5900                                            else {
5901                                                    query.append(WHERE_LESSER_THAN);
5902                                            }
5903                                    }
5904                            }
5905    
5906                            query.append(ORDER_BY_CLAUSE);
5907    
5908                            String[] orderByFields = orderByComparator.getOrderByFields();
5909    
5910                            for (int i = 0; i < orderByFields.length; i++) {
5911                                    query.append(_ORDER_BY_ENTITY_ALIAS);
5912                                    query.append(orderByFields[i]);
5913    
5914                                    if ((i + 1) < orderByFields.length) {
5915                                            if (orderByComparator.isAscending() ^ previous) {
5916                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
5917                                            }
5918                                            else {
5919                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
5920                                            }
5921                                    }
5922                                    else {
5923                                            if (orderByComparator.isAscending() ^ previous) {
5924                                                    query.append(ORDER_BY_ASC);
5925                                            }
5926                                            else {
5927                                                    query.append(ORDER_BY_DESC);
5928                                            }
5929                                    }
5930                            }
5931                    }
5932    
5933                    else {
5934                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
5935                    }
5936    
5937                    String sql = query.toString();
5938    
5939                    Query q = session.createQuery(sql);
5940    
5941                    q.setFirstResult(0);
5942                    q.setMaxResults(2);
5943    
5944                    QueryPos qPos = QueryPos.getInstance(q);
5945    
5946                    qPos.add(companyId);
5947    
5948                    qPos.add(userId);
5949    
5950                    qPos.add(status);
5951    
5952                    if (orderByComparator != null) {
5953                            Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
5954    
5955                            for (Object value : values) {
5956                                    qPos.add(value);
5957                            }
5958                    }
5959    
5960                    List<BlogsEntry> list = q.list();
5961    
5962                    if (list.size() == 2) {
5963                            return list.get(1);
5964                    }
5965                    else {
5966                            return null;
5967                    }
5968            }
5969    
5970            /**
5971             * Returns all the blogs entries where companyId = &#63; and displayDate &lt; &#63; and status = &#63;.
5972             *
5973             * @param companyId the company ID
5974             * @param displayDate the display date
5975             * @param status the status
5976             * @return the matching blogs entries
5977             * @throws SystemException if a system exception occurred
5978             */
5979            public List<BlogsEntry> findByC_LtD_S(long companyId, Date displayDate,
5980                    int status) throws SystemException {
5981                    return findByC_LtD_S(companyId, displayDate, status, QueryUtil.ALL_POS,
5982                            QueryUtil.ALL_POS, null);
5983            }
5984    
5985            /**
5986             * Returns a range of all the blogs entries where companyId = &#63; and displayDate &lt; &#63; and status = &#63;.
5987             *
5988             * <p>
5989             * 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.
5990             * </p>
5991             *
5992             * @param companyId the company ID
5993             * @param displayDate the display date
5994             * @param status the status
5995             * @param start the lower bound of the range of blogs entries
5996             * @param end the upper bound of the range of blogs entries (not inclusive)
5997             * @return the range of matching blogs entries
5998             * @throws SystemException if a system exception occurred
5999             */
6000            public List<BlogsEntry> findByC_LtD_S(long companyId, Date displayDate,
6001                    int status, int start, int end) throws SystemException {
6002                    return findByC_LtD_S(companyId, displayDate, status, start, end, null);
6003            }
6004    
6005            /**
6006             * Returns an ordered range of all the blogs entries where companyId = &#63; and displayDate &lt; &#63; and status = &#63;.
6007             *
6008             * <p>
6009             * 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.
6010             * </p>
6011             *
6012             * @param companyId the company ID
6013             * @param displayDate the display date
6014             * @param status the status
6015             * @param start the lower bound of the range of blogs entries
6016             * @param end the upper bound of the range of blogs entries (not inclusive)
6017             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
6018             * @return the ordered range of matching blogs entries
6019             * @throws SystemException if a system exception occurred
6020             */
6021            public List<BlogsEntry> findByC_LtD_S(long companyId, Date displayDate,
6022                    int status, int start, int end, OrderByComparator orderByComparator)
6023                    throws SystemException {
6024                    FinderPath finderPath = null;
6025                    Object[] finderArgs = null;
6026    
6027                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
6028                                    (orderByComparator == null)) {
6029                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_LTD_S;
6030                            finderArgs = new Object[] { companyId, displayDate, status };
6031                    }
6032                    else {
6033                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_LTD_S;
6034                            finderArgs = new Object[] {
6035                                            companyId, displayDate, status,
6036                                            
6037                                            start, end, orderByComparator
6038                                    };
6039                    }
6040    
6041                    List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
6042                                    finderArgs, this);
6043    
6044                    if ((list != null) && !list.isEmpty()) {
6045                            for (BlogsEntry blogsEntry : list) {
6046                                    if ((companyId != blogsEntry.getCompanyId()) ||
6047                                                    !Validator.equals(displayDate,
6048                                                            blogsEntry.getDisplayDate()) ||
6049                                                    (status != blogsEntry.getStatus())) {
6050                                            list = null;
6051    
6052                                            break;
6053                                    }
6054                            }
6055                    }
6056    
6057                    if (list == null) {
6058                            StringBundler query = null;
6059    
6060                            if (orderByComparator != null) {
6061                                    query = new StringBundler(5 +
6062                                                    (orderByComparator.getOrderByFields().length * 3));
6063                            }
6064                            else {
6065                                    query = new StringBundler(5);
6066                            }
6067    
6068                            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
6069    
6070                            query.append(_FINDER_COLUMN_C_LTD_S_COMPANYID_2);
6071    
6072                            if (displayDate == null) {
6073                                    query.append(_FINDER_COLUMN_C_LTD_S_DISPLAYDATE_1);
6074                            }
6075                            else {
6076                                    query.append(_FINDER_COLUMN_C_LTD_S_DISPLAYDATE_2);
6077                            }
6078    
6079                            query.append(_FINDER_COLUMN_C_LTD_S_STATUS_2);
6080    
6081                            if (orderByComparator != null) {
6082                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
6083                                            orderByComparator);
6084                            }
6085    
6086                            else {
6087                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
6088                            }
6089    
6090                            String sql = query.toString();
6091    
6092                            Session session = null;
6093    
6094                            try {
6095                                    session = openSession();
6096    
6097                                    Query q = session.createQuery(sql);
6098    
6099                                    QueryPos qPos = QueryPos.getInstance(q);
6100    
6101                                    qPos.add(companyId);
6102    
6103                                    if (displayDate != null) {
6104                                            qPos.add(CalendarUtil.getTimestamp(displayDate));
6105                                    }
6106    
6107                                    qPos.add(status);
6108    
6109                                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
6110                                                    end);
6111                            }
6112                            catch (Exception e) {
6113                                    throw processException(e);
6114                            }
6115                            finally {
6116                                    if (list == null) {
6117                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
6118                                    }
6119                                    else {
6120                                            cacheResult(list);
6121    
6122                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
6123                                    }
6124    
6125                                    closeSession(session);
6126                            }
6127                    }
6128    
6129                    return list;
6130            }
6131    
6132            /**
6133             * Returns the first blogs entry in the ordered set where companyId = &#63; and displayDate &lt; &#63; and status = &#63;.
6134             *
6135             * <p>
6136             * 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.
6137             * </p>
6138             *
6139             * @param companyId the company ID
6140             * @param displayDate the display date
6141             * @param status the status
6142             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
6143             * @return the first matching blogs entry
6144             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
6145             * @throws SystemException if a system exception occurred
6146             */
6147            public BlogsEntry findByC_LtD_S_First(long companyId, Date displayDate,
6148                    int status, OrderByComparator orderByComparator)
6149                    throws NoSuchEntryException, SystemException {
6150                    List<BlogsEntry> list = findByC_LtD_S(companyId, displayDate, status,
6151                                    0, 1, orderByComparator);
6152    
6153                    if (list.isEmpty()) {
6154                            StringBundler msg = new StringBundler(8);
6155    
6156                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
6157    
6158                            msg.append("companyId=");
6159                            msg.append(companyId);
6160    
6161                            msg.append(", displayDate=");
6162                            msg.append(displayDate);
6163    
6164                            msg.append(", status=");
6165                            msg.append(status);
6166    
6167                            msg.append(StringPool.CLOSE_CURLY_BRACE);
6168    
6169                            throw new NoSuchEntryException(msg.toString());
6170                    }
6171                    else {
6172                            return list.get(0);
6173                    }
6174            }
6175    
6176            /**
6177             * Returns the last blogs entry in the ordered set where companyId = &#63; and displayDate &lt; &#63; and status = &#63;.
6178             *
6179             * <p>
6180             * 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.
6181             * </p>
6182             *
6183             * @param companyId the company ID
6184             * @param displayDate the display date
6185             * @param status the status
6186             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
6187             * @return the last matching blogs entry
6188             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
6189             * @throws SystemException if a system exception occurred
6190             */
6191            public BlogsEntry findByC_LtD_S_Last(long companyId, Date displayDate,
6192                    int status, OrderByComparator orderByComparator)
6193                    throws NoSuchEntryException, SystemException {
6194                    int count = countByC_LtD_S(companyId, displayDate, status);
6195    
6196                    List<BlogsEntry> list = findByC_LtD_S(companyId, displayDate, status,
6197                                    count - 1, count, orderByComparator);
6198    
6199                    if (list.isEmpty()) {
6200                            StringBundler msg = new StringBundler(8);
6201    
6202                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
6203    
6204                            msg.append("companyId=");
6205                            msg.append(companyId);
6206    
6207                            msg.append(", displayDate=");
6208                            msg.append(displayDate);
6209    
6210                            msg.append(", status=");
6211                            msg.append(status);
6212    
6213                            msg.append(StringPool.CLOSE_CURLY_BRACE);
6214    
6215                            throw new NoSuchEntryException(msg.toString());
6216                    }
6217                    else {
6218                            return list.get(0);
6219                    }
6220            }
6221    
6222            /**
6223             * Returns the blogs entries before and after the current blogs entry in the ordered set where companyId = &#63; and displayDate &lt; &#63; and status = &#63;.
6224             *
6225             * <p>
6226             * 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.
6227             * </p>
6228             *
6229             * @param entryId the primary key of the current blogs entry
6230             * @param companyId the company ID
6231             * @param displayDate the display date
6232             * @param status the status
6233             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
6234             * @return the previous, current, and next blogs entry
6235             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
6236             * @throws SystemException if a system exception occurred
6237             */
6238            public BlogsEntry[] findByC_LtD_S_PrevAndNext(long entryId, long companyId,
6239                    Date displayDate, int status, OrderByComparator orderByComparator)
6240                    throws NoSuchEntryException, SystemException {
6241                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
6242    
6243                    Session session = null;
6244    
6245                    try {
6246                            session = openSession();
6247    
6248                            BlogsEntry[] array = new BlogsEntryImpl[3];
6249    
6250                            array[0] = getByC_LtD_S_PrevAndNext(session, blogsEntry, companyId,
6251                                            displayDate, status, orderByComparator, true);
6252    
6253                            array[1] = blogsEntry;
6254    
6255                            array[2] = getByC_LtD_S_PrevAndNext(session, blogsEntry, companyId,
6256                                            displayDate, status, orderByComparator, false);
6257    
6258                            return array;
6259                    }
6260                    catch (Exception e) {
6261                            throw processException(e);
6262                    }
6263                    finally {
6264                            closeSession(session);
6265                    }
6266            }
6267    
6268            protected BlogsEntry getByC_LtD_S_PrevAndNext(Session session,
6269                    BlogsEntry blogsEntry, long companyId, Date displayDate, int status,
6270                    OrderByComparator orderByComparator, boolean previous) {
6271                    StringBundler query = null;
6272    
6273                    if (orderByComparator != null) {
6274                            query = new StringBundler(6 +
6275                                            (orderByComparator.getOrderByFields().length * 6));
6276                    }
6277                    else {
6278                            query = new StringBundler(3);
6279                    }
6280    
6281                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
6282    
6283                    query.append(_FINDER_COLUMN_C_LTD_S_COMPANYID_2);
6284    
6285                    if (displayDate == null) {
6286                            query.append(_FINDER_COLUMN_C_LTD_S_DISPLAYDATE_1);
6287                    }
6288                    else {
6289                            query.append(_FINDER_COLUMN_C_LTD_S_DISPLAYDATE_2);
6290                    }
6291    
6292                    query.append(_FINDER_COLUMN_C_LTD_S_STATUS_2);
6293    
6294                    if (orderByComparator != null) {
6295                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
6296    
6297                            if (orderByConditionFields.length > 0) {
6298                                    query.append(WHERE_AND);
6299                            }
6300    
6301                            for (int i = 0; i < orderByConditionFields.length; i++) {
6302                                    query.append(_ORDER_BY_ENTITY_ALIAS);
6303                                    query.append(orderByConditionFields[i]);
6304    
6305                                    if ((i + 1) < orderByConditionFields.length) {
6306                                            if (orderByComparator.isAscending() ^ previous) {
6307                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
6308                                            }
6309                                            else {
6310                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
6311                                            }
6312                                    }
6313                                    else {
6314                                            if (orderByComparator.isAscending() ^ previous) {
6315                                                    query.append(WHERE_GREATER_THAN);
6316                                            }
6317                                            else {
6318                                                    query.append(WHERE_LESSER_THAN);
6319                                            }
6320                                    }
6321                            }
6322    
6323                            query.append(ORDER_BY_CLAUSE);
6324    
6325                            String[] orderByFields = orderByComparator.getOrderByFields();
6326    
6327                            for (int i = 0; i < orderByFields.length; i++) {
6328                                    query.append(_ORDER_BY_ENTITY_ALIAS);
6329                                    query.append(orderByFields[i]);
6330    
6331                                    if ((i + 1) < orderByFields.length) {
6332                                            if (orderByComparator.isAscending() ^ previous) {
6333                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
6334                                            }
6335                                            else {
6336                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
6337                                            }
6338                                    }
6339                                    else {
6340                                            if (orderByComparator.isAscending() ^ previous) {
6341                                                    query.append(ORDER_BY_ASC);
6342                                            }
6343                                            else {
6344                                                    query.append(ORDER_BY_DESC);
6345                                            }
6346                                    }
6347                            }
6348                    }
6349    
6350                    else {
6351                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
6352                    }
6353    
6354                    String sql = query.toString();
6355    
6356                    Query q = session.createQuery(sql);
6357    
6358                    q.setFirstResult(0);
6359                    q.setMaxResults(2);
6360    
6361                    QueryPos qPos = QueryPos.getInstance(q);
6362    
6363                    qPos.add(companyId);
6364    
6365                    if (displayDate != null) {
6366                            qPos.add(CalendarUtil.getTimestamp(displayDate));
6367                    }
6368    
6369                    qPos.add(status);
6370    
6371                    if (orderByComparator != null) {
6372                            Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
6373    
6374                            for (Object value : values) {
6375                                    qPos.add(value);
6376                            }
6377                    }
6378    
6379                    List<BlogsEntry> list = q.list();
6380    
6381                    if (list.size() == 2) {
6382                            return list.get(1);
6383                    }
6384                    else {
6385                            return null;
6386                    }
6387            }
6388    
6389            /**
6390             * Returns all the blogs entries where groupId = &#63; and userId = &#63; and displayDate &lt; &#63;.
6391             *
6392             * @param groupId the group ID
6393             * @param userId the user ID
6394             * @param displayDate the display date
6395             * @return the matching blogs entries
6396             * @throws SystemException if a system exception occurred
6397             */
6398            public List<BlogsEntry> findByG_U_LtD(long groupId, long userId,
6399                    Date displayDate) throws SystemException {
6400                    return findByG_U_LtD(groupId, userId, displayDate, QueryUtil.ALL_POS,
6401                            QueryUtil.ALL_POS, null);
6402            }
6403    
6404            /**
6405             * Returns a range of all the blogs entries where groupId = &#63; and userId = &#63; and displayDate &lt; &#63;.
6406             *
6407             * <p>
6408             * 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.
6409             * </p>
6410             *
6411             * @param groupId the group ID
6412             * @param userId the user ID
6413             * @param displayDate the display date
6414             * @param start the lower bound of the range of blogs entries
6415             * @param end the upper bound of the range of blogs entries (not inclusive)
6416             * @return the range of matching blogs entries
6417             * @throws SystemException if a system exception occurred
6418             */
6419            public List<BlogsEntry> findByG_U_LtD(long groupId, long userId,
6420                    Date displayDate, int start, int end) throws SystemException {
6421                    return findByG_U_LtD(groupId, userId, displayDate, start, end, null);
6422            }
6423    
6424            /**
6425             * Returns an ordered range of all the blogs entries where groupId = &#63; and userId = &#63; and displayDate &lt; &#63;.
6426             *
6427             * <p>
6428             * 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.
6429             * </p>
6430             *
6431             * @param groupId the group ID
6432             * @param userId the user ID
6433             * @param displayDate the display date
6434             * @param start the lower bound of the range of blogs entries
6435             * @param end the upper bound of the range of blogs entries (not inclusive)
6436             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
6437             * @return the ordered range of matching blogs entries
6438             * @throws SystemException if a system exception occurred
6439             */
6440            public List<BlogsEntry> findByG_U_LtD(long groupId, long userId,
6441                    Date displayDate, int start, int end,
6442                    OrderByComparator orderByComparator) throws SystemException {
6443                    FinderPath finderPath = null;
6444                    Object[] finderArgs = null;
6445    
6446                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
6447                                    (orderByComparator == null)) {
6448                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U_LTD;
6449                            finderArgs = new Object[] { groupId, userId, displayDate };
6450                    }
6451                    else {
6452                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_U_LTD;
6453                            finderArgs = new Object[] {
6454                                            groupId, userId, displayDate,
6455                                            
6456                                            start, end, orderByComparator
6457                                    };
6458                    }
6459    
6460                    List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
6461                                    finderArgs, this);
6462    
6463                    if ((list != null) && !list.isEmpty()) {
6464                            for (BlogsEntry blogsEntry : list) {
6465                                    if ((groupId != blogsEntry.getGroupId()) ||
6466                                                    (userId != blogsEntry.getUserId()) ||
6467                                                    !Validator.equals(displayDate,
6468                                                            blogsEntry.getDisplayDate())) {
6469                                            list = null;
6470    
6471                                            break;
6472                                    }
6473                            }
6474                    }
6475    
6476                    if (list == null) {
6477                            StringBundler query = null;
6478    
6479                            if (orderByComparator != null) {
6480                                    query = new StringBundler(5 +
6481                                                    (orderByComparator.getOrderByFields().length * 3));
6482                            }
6483                            else {
6484                                    query = new StringBundler(5);
6485                            }
6486    
6487                            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
6488    
6489                            query.append(_FINDER_COLUMN_G_U_LTD_GROUPID_2);
6490    
6491                            query.append(_FINDER_COLUMN_G_U_LTD_USERID_2);
6492    
6493                            if (displayDate == null) {
6494                                    query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_1);
6495                            }
6496                            else {
6497                                    query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_2);
6498                            }
6499    
6500                            if (orderByComparator != null) {
6501                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
6502                                            orderByComparator);
6503                            }
6504    
6505                            else {
6506                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
6507                            }
6508    
6509                            String sql = query.toString();
6510    
6511                            Session session = null;
6512    
6513                            try {
6514                                    session = openSession();
6515    
6516                                    Query q = session.createQuery(sql);
6517    
6518                                    QueryPos qPos = QueryPos.getInstance(q);
6519    
6520                                    qPos.add(groupId);
6521    
6522                                    qPos.add(userId);
6523    
6524                                    if (displayDate != null) {
6525                                            qPos.add(CalendarUtil.getTimestamp(displayDate));
6526                                    }
6527    
6528                                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
6529                                                    end);
6530                            }
6531                            catch (Exception e) {
6532                                    throw processException(e);
6533                            }
6534                            finally {
6535                                    if (list == null) {
6536                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
6537                                    }
6538                                    else {
6539                                            cacheResult(list);
6540    
6541                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
6542                                    }
6543    
6544                                    closeSession(session);
6545                            }
6546                    }
6547    
6548                    return list;
6549            }
6550    
6551            /**
6552             * Returns the first blogs entry in the ordered set where groupId = &#63; and userId = &#63; and displayDate &lt; &#63;.
6553             *
6554             * <p>
6555             * 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.
6556             * </p>
6557             *
6558             * @param groupId the group ID
6559             * @param userId the user ID
6560             * @param displayDate the display date
6561             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
6562             * @return the first matching blogs entry
6563             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
6564             * @throws SystemException if a system exception occurred
6565             */
6566            public BlogsEntry findByG_U_LtD_First(long groupId, long userId,
6567                    Date displayDate, OrderByComparator orderByComparator)
6568                    throws NoSuchEntryException, SystemException {
6569                    List<BlogsEntry> list = findByG_U_LtD(groupId, userId, displayDate, 0,
6570                                    1, orderByComparator);
6571    
6572                    if (list.isEmpty()) {
6573                            StringBundler msg = new StringBundler(8);
6574    
6575                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
6576    
6577                            msg.append("groupId=");
6578                            msg.append(groupId);
6579    
6580                            msg.append(", userId=");
6581                            msg.append(userId);
6582    
6583                            msg.append(", displayDate=");
6584                            msg.append(displayDate);
6585    
6586                            msg.append(StringPool.CLOSE_CURLY_BRACE);
6587    
6588                            throw new NoSuchEntryException(msg.toString());
6589                    }
6590                    else {
6591                            return list.get(0);
6592                    }
6593            }
6594    
6595            /**
6596             * Returns the last blogs entry in the ordered set where groupId = &#63; and userId = &#63; and displayDate &lt; &#63;.
6597             *
6598             * <p>
6599             * 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.
6600             * </p>
6601             *
6602             * @param groupId the group ID
6603             * @param userId the user ID
6604             * @param displayDate the display date
6605             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
6606             * @return the last matching blogs entry
6607             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
6608             * @throws SystemException if a system exception occurred
6609             */
6610            public BlogsEntry findByG_U_LtD_Last(long groupId, long userId,
6611                    Date displayDate, OrderByComparator orderByComparator)
6612                    throws NoSuchEntryException, SystemException {
6613                    int count = countByG_U_LtD(groupId, userId, displayDate);
6614    
6615                    List<BlogsEntry> list = findByG_U_LtD(groupId, userId, displayDate,
6616                                    count - 1, count, orderByComparator);
6617    
6618                    if (list.isEmpty()) {
6619                            StringBundler msg = new StringBundler(8);
6620    
6621                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
6622    
6623                            msg.append("groupId=");
6624                            msg.append(groupId);
6625    
6626                            msg.append(", userId=");
6627                            msg.append(userId);
6628    
6629                            msg.append(", displayDate=");
6630                            msg.append(displayDate);
6631    
6632                            msg.append(StringPool.CLOSE_CURLY_BRACE);
6633    
6634                            throw new NoSuchEntryException(msg.toString());
6635                    }
6636                    else {
6637                            return list.get(0);
6638                    }
6639            }
6640    
6641            /**
6642             * Returns the blogs entries before and after the current blogs entry in the ordered set where groupId = &#63; and userId = &#63; and displayDate &lt; &#63;.
6643             *
6644             * <p>
6645             * 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.
6646             * </p>
6647             *
6648             * @param entryId the primary key of the current blogs entry
6649             * @param groupId the group ID
6650             * @param userId the user ID
6651             * @param displayDate the display date
6652             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
6653             * @return the previous, current, and next blogs entry
6654             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
6655             * @throws SystemException if a system exception occurred
6656             */
6657            public BlogsEntry[] findByG_U_LtD_PrevAndNext(long entryId, long groupId,
6658                    long userId, Date displayDate, OrderByComparator orderByComparator)
6659                    throws NoSuchEntryException, SystemException {
6660                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
6661    
6662                    Session session = null;
6663    
6664                    try {
6665                            session = openSession();
6666    
6667                            BlogsEntry[] array = new BlogsEntryImpl[3];
6668    
6669                            array[0] = getByG_U_LtD_PrevAndNext(session, blogsEntry, groupId,
6670                                            userId, displayDate, orderByComparator, true);
6671    
6672                            array[1] = blogsEntry;
6673    
6674                            array[2] = getByG_U_LtD_PrevAndNext(session, blogsEntry, groupId,
6675                                            userId, displayDate, orderByComparator, false);
6676    
6677                            return array;
6678                    }
6679                    catch (Exception e) {
6680                            throw processException(e);
6681                    }
6682                    finally {
6683                            closeSession(session);
6684                    }
6685            }
6686    
6687            protected BlogsEntry getByG_U_LtD_PrevAndNext(Session session,
6688                    BlogsEntry blogsEntry, long groupId, long userId, Date displayDate,
6689                    OrderByComparator orderByComparator, boolean previous) {
6690                    StringBundler query = null;
6691    
6692                    if (orderByComparator != null) {
6693                            query = new StringBundler(6 +
6694                                            (orderByComparator.getOrderByFields().length * 6));
6695                    }
6696                    else {
6697                            query = new StringBundler(3);
6698                    }
6699    
6700                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
6701    
6702                    query.append(_FINDER_COLUMN_G_U_LTD_GROUPID_2);
6703    
6704                    query.append(_FINDER_COLUMN_G_U_LTD_USERID_2);
6705    
6706                    if (displayDate == null) {
6707                            query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_1);
6708                    }
6709                    else {
6710                            query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_2);
6711                    }
6712    
6713                    if (orderByComparator != null) {
6714                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
6715    
6716                            if (orderByConditionFields.length > 0) {
6717                                    query.append(WHERE_AND);
6718                            }
6719    
6720                            for (int i = 0; i < orderByConditionFields.length; i++) {
6721                                    query.append(_ORDER_BY_ENTITY_ALIAS);
6722                                    query.append(orderByConditionFields[i]);
6723    
6724                                    if ((i + 1) < orderByConditionFields.length) {
6725                                            if (orderByComparator.isAscending() ^ previous) {
6726                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
6727                                            }
6728                                            else {
6729                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
6730                                            }
6731                                    }
6732                                    else {
6733                                            if (orderByComparator.isAscending() ^ previous) {
6734                                                    query.append(WHERE_GREATER_THAN);
6735                                            }
6736                                            else {
6737                                                    query.append(WHERE_LESSER_THAN);
6738                                            }
6739                                    }
6740                            }
6741    
6742                            query.append(ORDER_BY_CLAUSE);
6743    
6744                            String[] orderByFields = orderByComparator.getOrderByFields();
6745    
6746                            for (int i = 0; i < orderByFields.length; i++) {
6747                                    query.append(_ORDER_BY_ENTITY_ALIAS);
6748                                    query.append(orderByFields[i]);
6749    
6750                                    if ((i + 1) < orderByFields.length) {
6751                                            if (orderByComparator.isAscending() ^ previous) {
6752                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
6753                                            }
6754                                            else {
6755                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
6756                                            }
6757                                    }
6758                                    else {
6759                                            if (orderByComparator.isAscending() ^ previous) {
6760                                                    query.append(ORDER_BY_ASC);
6761                                            }
6762                                            else {
6763                                                    query.append(ORDER_BY_DESC);
6764                                            }
6765                                    }
6766                            }
6767                    }
6768    
6769                    else {
6770                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
6771                    }
6772    
6773                    String sql = query.toString();
6774    
6775                    Query q = session.createQuery(sql);
6776    
6777                    q.setFirstResult(0);
6778                    q.setMaxResults(2);
6779    
6780                    QueryPos qPos = QueryPos.getInstance(q);
6781    
6782                    qPos.add(groupId);
6783    
6784                    qPos.add(userId);
6785    
6786                    if (displayDate != null) {
6787                            qPos.add(CalendarUtil.getTimestamp(displayDate));
6788                    }
6789    
6790                    if (orderByComparator != null) {
6791                            Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
6792    
6793                            for (Object value : values) {
6794                                    qPos.add(value);
6795                            }
6796                    }
6797    
6798                    List<BlogsEntry> list = q.list();
6799    
6800                    if (list.size() == 2) {
6801                            return list.get(1);
6802                    }
6803                    else {
6804                            return null;
6805                    }
6806            }
6807    
6808            /**
6809             * Returns all the blogs entries that the user has permission to view where groupId = &#63; and userId = &#63; and displayDate &lt; &#63;.
6810             *
6811             * @param groupId the group ID
6812             * @param userId the user ID
6813             * @param displayDate the display date
6814             * @return the matching blogs entries that the user has permission to view
6815             * @throws SystemException if a system exception occurred
6816             */
6817            public List<BlogsEntry> filterFindByG_U_LtD(long groupId, long userId,
6818                    Date displayDate) throws SystemException {
6819                    return filterFindByG_U_LtD(groupId, userId, displayDate,
6820                            QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
6821            }
6822    
6823            /**
6824             * Returns a range of all the blogs entries that the user has permission to view where groupId = &#63; and userId = &#63; and displayDate &lt; &#63;.
6825             *
6826             * <p>
6827             * 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.
6828             * </p>
6829             *
6830             * @param groupId the group ID
6831             * @param userId the user ID
6832             * @param displayDate the display date
6833             * @param start the lower bound of the range of blogs entries
6834             * @param end the upper bound of the range of blogs entries (not inclusive)
6835             * @return the range of matching blogs entries that the user has permission to view
6836             * @throws SystemException if a system exception occurred
6837             */
6838            public List<BlogsEntry> filterFindByG_U_LtD(long groupId, long userId,
6839                    Date displayDate, int start, int end) throws SystemException {
6840                    return filterFindByG_U_LtD(groupId, userId, displayDate, start, end,
6841                            null);
6842            }
6843    
6844            /**
6845             * Returns an ordered range of all the blogs entries that the user has permissions to view where groupId = &#63; and userId = &#63; and displayDate &lt; &#63;.
6846             *
6847             * <p>
6848             * 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.
6849             * </p>
6850             *
6851             * @param groupId the group ID
6852             * @param userId the user ID
6853             * @param displayDate the display date
6854             * @param start the lower bound of the range of blogs entries
6855             * @param end the upper bound of the range of blogs entries (not inclusive)
6856             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
6857             * @return the ordered range of matching blogs entries that the user has permission to view
6858             * @throws SystemException if a system exception occurred
6859             */
6860            public List<BlogsEntry> filterFindByG_U_LtD(long groupId, long userId,
6861                    Date displayDate, int start, int end,
6862                    OrderByComparator orderByComparator) throws SystemException {
6863                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
6864                            return findByG_U_LtD(groupId, userId, displayDate, start, end,
6865                                    orderByComparator);
6866                    }
6867    
6868                    StringBundler query = null;
6869    
6870                    if (orderByComparator != null) {
6871                            query = new StringBundler(5 +
6872                                            (orderByComparator.getOrderByFields().length * 3));
6873                    }
6874                    else {
6875                            query = new StringBundler(5);
6876                    }
6877    
6878                    if (getDB().isSupportsInlineDistinct()) {
6879                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
6880                    }
6881                    else {
6882                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1);
6883                    }
6884    
6885                    query.append(_FINDER_COLUMN_G_U_LTD_GROUPID_2);
6886    
6887                    query.append(_FINDER_COLUMN_G_U_LTD_USERID_2);
6888    
6889                    if (displayDate == null) {
6890                            query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_1);
6891                    }
6892                    else {
6893                            query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_2);
6894                    }
6895    
6896                    if (!getDB().isSupportsInlineDistinct()) {
6897                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2);
6898                    }
6899    
6900                    if (orderByComparator != null) {
6901                            if (getDB().isSupportsInlineDistinct()) {
6902                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
6903                                            orderByComparator);
6904                            }
6905                            else {
6906                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
6907                                            orderByComparator);
6908                            }
6909                    }
6910    
6911                    else {
6912                            if (getDB().isSupportsInlineDistinct()) {
6913                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
6914                            }
6915                            else {
6916                                    query.append(BlogsEntryModelImpl.ORDER_BY_SQL);
6917                            }
6918                    }
6919    
6920                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
6921                                    BlogsEntry.class.getName(),
6922                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
6923    
6924                    Session session = null;
6925    
6926                    try {
6927                            session = openSession();
6928    
6929                            SQLQuery q = session.createSQLQuery(sql);
6930    
6931                            if (getDB().isSupportsInlineDistinct()) {
6932                                    q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
6933                            }
6934                            else {
6935                                    q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class);
6936                            }
6937    
6938                            QueryPos qPos = QueryPos.getInstance(q);
6939    
6940                            qPos.add(groupId);
6941    
6942                            qPos.add(userId);
6943    
6944                            if (displayDate != null) {
6945                                    qPos.add(CalendarUtil.getTimestamp(displayDate));
6946                            }
6947    
6948                            return (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start, end);
6949                    }
6950                    catch (Exception e) {
6951                            throw processException(e);
6952                    }
6953                    finally {
6954                            closeSession(session);
6955                    }
6956            }
6957    
6958            /**
6959             * Returns the blogs entries before and after the current blogs entry in the ordered set of blogs entries that the user has permission to view where groupId = &#63; and userId = &#63; and displayDate &lt; &#63;.
6960             *
6961             * @param entryId the primary key of the current blogs entry
6962             * @param groupId the group ID
6963             * @param userId the user ID
6964             * @param displayDate the display date
6965             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
6966             * @return the previous, current, and next blogs entry
6967             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
6968             * @throws SystemException if a system exception occurred
6969             */
6970            public BlogsEntry[] filterFindByG_U_LtD_PrevAndNext(long entryId,
6971                    long groupId, long userId, Date displayDate,
6972                    OrderByComparator orderByComparator)
6973                    throws NoSuchEntryException, SystemException {
6974                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
6975                            return findByG_U_LtD_PrevAndNext(entryId, groupId, userId,
6976                                    displayDate, orderByComparator);
6977                    }
6978    
6979                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
6980    
6981                    Session session = null;
6982    
6983                    try {
6984                            session = openSession();
6985    
6986                            BlogsEntry[] array = new BlogsEntryImpl[3];
6987    
6988                            array[0] = filterGetByG_U_LtD_PrevAndNext(session, blogsEntry,
6989                                            groupId, userId, displayDate, orderByComparator, true);
6990    
6991                            array[1] = blogsEntry;
6992    
6993                            array[2] = filterGetByG_U_LtD_PrevAndNext(session, blogsEntry,
6994                                            groupId, userId, displayDate, orderByComparator, false);
6995    
6996                            return array;
6997                    }
6998                    catch (Exception e) {
6999                            throw processException(e);
7000                    }
7001                    finally {
7002                            closeSession(session);
7003                    }
7004            }
7005    
7006            protected BlogsEntry filterGetByG_U_LtD_PrevAndNext(Session session,
7007                    BlogsEntry blogsEntry, long groupId, long userId, Date displayDate,
7008                    OrderByComparator orderByComparator, boolean previous) {
7009                    StringBundler query = null;
7010    
7011                    if (orderByComparator != null) {
7012                            query = new StringBundler(6 +
7013                                            (orderByComparator.getOrderByFields().length * 6));
7014                    }
7015                    else {
7016                            query = new StringBundler(3);
7017                    }
7018    
7019                    if (getDB().isSupportsInlineDistinct()) {
7020                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
7021                    }
7022                    else {
7023                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1);
7024                    }
7025    
7026                    query.append(_FINDER_COLUMN_G_U_LTD_GROUPID_2);
7027    
7028                    query.append(_FINDER_COLUMN_G_U_LTD_USERID_2);
7029    
7030                    if (displayDate == null) {
7031                            query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_1);
7032                    }
7033                    else {
7034                            query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_2);
7035                    }
7036    
7037                    if (!getDB().isSupportsInlineDistinct()) {
7038                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2);
7039                    }
7040    
7041                    if (orderByComparator != null) {
7042                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
7043    
7044                            if (orderByConditionFields.length > 0) {
7045                                    query.append(WHERE_AND);
7046                            }
7047    
7048                            for (int i = 0; i < orderByConditionFields.length; i++) {
7049                                    if (getDB().isSupportsInlineDistinct()) {
7050                                            query.append(_ORDER_BY_ENTITY_ALIAS);
7051                                    }
7052                                    else {
7053                                            query.append(_ORDER_BY_ENTITY_TABLE);
7054                                    }
7055    
7056                                    query.append(orderByConditionFields[i]);
7057    
7058                                    if ((i + 1) < orderByConditionFields.length) {
7059                                            if (orderByComparator.isAscending() ^ previous) {
7060                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
7061                                            }
7062                                            else {
7063                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
7064                                            }
7065                                    }
7066                                    else {
7067                                            if (orderByComparator.isAscending() ^ previous) {
7068                                                    query.append(WHERE_GREATER_THAN);
7069                                            }
7070                                            else {
7071                                                    query.append(WHERE_LESSER_THAN);
7072                                            }
7073                                    }
7074                            }
7075    
7076                            query.append(ORDER_BY_CLAUSE);
7077    
7078                            String[] orderByFields = orderByComparator.getOrderByFields();
7079    
7080                            for (int i = 0; i < orderByFields.length; i++) {
7081                                    if (getDB().isSupportsInlineDistinct()) {
7082                                            query.append(_ORDER_BY_ENTITY_ALIAS);
7083                                    }
7084                                    else {
7085                                            query.append(_ORDER_BY_ENTITY_TABLE);
7086                                    }
7087    
7088                                    query.append(orderByFields[i]);
7089    
7090                                    if ((i + 1) < orderByFields.length) {
7091                                            if (orderByComparator.isAscending() ^ previous) {
7092                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
7093                                            }
7094                                            else {
7095                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
7096                                            }
7097                                    }
7098                                    else {
7099                                            if (orderByComparator.isAscending() ^ previous) {
7100                                                    query.append(ORDER_BY_ASC);
7101                                            }
7102                                            else {
7103                                                    query.append(ORDER_BY_DESC);
7104                                            }
7105                                    }
7106                            }
7107                    }
7108    
7109                    else {
7110                            if (getDB().isSupportsInlineDistinct()) {
7111                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
7112                            }
7113                            else {
7114                                    query.append(BlogsEntryModelImpl.ORDER_BY_SQL);
7115                            }
7116                    }
7117    
7118                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
7119                                    BlogsEntry.class.getName(),
7120                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
7121    
7122                    SQLQuery q = session.createSQLQuery(sql);
7123    
7124                    q.setFirstResult(0);
7125                    q.setMaxResults(2);
7126    
7127                    if (getDB().isSupportsInlineDistinct()) {
7128                            q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
7129                    }
7130                    else {
7131                            q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class);
7132                    }
7133    
7134                    QueryPos qPos = QueryPos.getInstance(q);
7135    
7136                    qPos.add(groupId);
7137    
7138                    qPos.add(userId);
7139    
7140                    if (displayDate != null) {
7141                            qPos.add(CalendarUtil.getTimestamp(displayDate));
7142                    }
7143    
7144                    if (orderByComparator != null) {
7145                            Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
7146    
7147                            for (Object value : values) {
7148                                    qPos.add(value);
7149                            }
7150                    }
7151    
7152                    List<BlogsEntry> list = q.list();
7153    
7154                    if (list.size() == 2) {
7155                            return list.get(1);
7156                    }
7157                    else {
7158                            return null;
7159                    }
7160            }
7161    
7162            /**
7163             * Returns all the blogs entries where groupId = &#63; and userId = &#63; and status = &#63;.
7164             *
7165             * @param groupId the group ID
7166             * @param userId the user ID
7167             * @param status the status
7168             * @return the matching blogs entries
7169             * @throws SystemException if a system exception occurred
7170             */
7171            public List<BlogsEntry> findByG_U_S(long groupId, long userId, int status)
7172                    throws SystemException {
7173                    return findByG_U_S(groupId, userId, status, QueryUtil.ALL_POS,
7174                            QueryUtil.ALL_POS, null);
7175            }
7176    
7177            /**
7178             * Returns a range of all the blogs entries where groupId = &#63; and userId = &#63; and status = &#63;.
7179             *
7180             * <p>
7181             * 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.
7182             * </p>
7183             *
7184             * @param groupId the group ID
7185             * @param userId the user ID
7186             * @param status the status
7187             * @param start the lower bound of the range of blogs entries
7188             * @param end the upper bound of the range of blogs entries (not inclusive)
7189             * @return the range of matching blogs entries
7190             * @throws SystemException if a system exception occurred
7191             */
7192            public List<BlogsEntry> findByG_U_S(long groupId, long userId, int status,
7193                    int start, int end) throws SystemException {
7194                    return findByG_U_S(groupId, userId, status, start, end, null);
7195            }
7196    
7197            /**
7198             * Returns an ordered range of all the blogs entries where groupId = &#63; and userId = &#63; and status = &#63;.
7199             *
7200             * <p>
7201             * 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.
7202             * </p>
7203             *
7204             * @param groupId the group ID
7205             * @param userId the user ID
7206             * @param status the status
7207             * @param start the lower bound of the range of blogs entries
7208             * @param end the upper bound of the range of blogs entries (not inclusive)
7209             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
7210             * @return the ordered range of matching blogs entries
7211             * @throws SystemException if a system exception occurred
7212             */
7213            public List<BlogsEntry> findByG_U_S(long groupId, long userId, int status,
7214                    int start, int end, OrderByComparator orderByComparator)
7215                    throws SystemException {
7216                    FinderPath finderPath = null;
7217                    Object[] finderArgs = null;
7218    
7219                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
7220                                    (orderByComparator == null)) {
7221                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U_S;
7222                            finderArgs = new Object[] { groupId, userId, status };
7223                    }
7224                    else {
7225                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_U_S;
7226                            finderArgs = new Object[] {
7227                                            groupId, userId, status,
7228                                            
7229                                            start, end, orderByComparator
7230                                    };
7231                    }
7232    
7233                    List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
7234                                    finderArgs, this);
7235    
7236                    if ((list != null) && !list.isEmpty()) {
7237                            for (BlogsEntry blogsEntry : list) {
7238                                    if ((groupId != blogsEntry.getGroupId()) ||
7239                                                    (userId != blogsEntry.getUserId()) ||
7240                                                    (status != blogsEntry.getStatus())) {
7241                                            list = null;
7242    
7243                                            break;
7244                                    }
7245                            }
7246                    }
7247    
7248                    if (list == null) {
7249                            StringBundler query = null;
7250    
7251                            if (orderByComparator != null) {
7252                                    query = new StringBundler(5 +
7253                                                    (orderByComparator.getOrderByFields().length * 3));
7254                            }
7255                            else {
7256                                    query = new StringBundler(5);
7257                            }
7258    
7259                            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
7260    
7261                            query.append(_FINDER_COLUMN_G_U_S_GROUPID_2);
7262    
7263                            query.append(_FINDER_COLUMN_G_U_S_USERID_2);
7264    
7265                            query.append(_FINDER_COLUMN_G_U_S_STATUS_2);
7266    
7267                            if (orderByComparator != null) {
7268                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
7269                                            orderByComparator);
7270                            }
7271    
7272                            else {
7273                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
7274                            }
7275    
7276                            String sql = query.toString();
7277    
7278                            Session session = null;
7279    
7280                            try {
7281                                    session = openSession();
7282    
7283                                    Query q = session.createQuery(sql);
7284    
7285                                    QueryPos qPos = QueryPos.getInstance(q);
7286    
7287                                    qPos.add(groupId);
7288    
7289                                    qPos.add(userId);
7290    
7291                                    qPos.add(status);
7292    
7293                                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
7294                                                    end);
7295                            }
7296                            catch (Exception e) {
7297                                    throw processException(e);
7298                            }
7299                            finally {
7300                                    if (list == null) {
7301                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
7302                                    }
7303                                    else {
7304                                            cacheResult(list);
7305    
7306                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
7307                                    }
7308    
7309                                    closeSession(session);
7310                            }
7311                    }
7312    
7313                    return list;
7314            }
7315    
7316            /**
7317             * Returns the first blogs entry in the ordered set where groupId = &#63; and userId = &#63; and status = &#63;.
7318             *
7319             * <p>
7320             * 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.
7321             * </p>
7322             *
7323             * @param groupId the group ID
7324             * @param userId the user ID
7325             * @param status the status
7326             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
7327             * @return the first matching blogs entry
7328             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
7329             * @throws SystemException if a system exception occurred
7330             */
7331            public BlogsEntry findByG_U_S_First(long groupId, long userId, int status,
7332                    OrderByComparator orderByComparator)
7333                    throws NoSuchEntryException, SystemException {
7334                    List<BlogsEntry> list = findByG_U_S(groupId, userId, status, 0, 1,
7335                                    orderByComparator);
7336    
7337                    if (list.isEmpty()) {
7338                            StringBundler msg = new StringBundler(8);
7339    
7340                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
7341    
7342                            msg.append("groupId=");
7343                            msg.append(groupId);
7344    
7345                            msg.append(", userId=");
7346                            msg.append(userId);
7347    
7348                            msg.append(", status=");
7349                            msg.append(status);
7350    
7351                            msg.append(StringPool.CLOSE_CURLY_BRACE);
7352    
7353                            throw new NoSuchEntryException(msg.toString());
7354                    }
7355                    else {
7356                            return list.get(0);
7357                    }
7358            }
7359    
7360            /**
7361             * Returns the last blogs entry in the ordered set where groupId = &#63; and userId = &#63; and status = &#63;.
7362             *
7363             * <p>
7364             * 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.
7365             * </p>
7366             *
7367             * @param groupId the group ID
7368             * @param userId the user ID
7369             * @param status the status
7370             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
7371             * @return the last matching blogs entry
7372             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
7373             * @throws SystemException if a system exception occurred
7374             */
7375            public BlogsEntry findByG_U_S_Last(long groupId, long userId, int status,
7376                    OrderByComparator orderByComparator)
7377                    throws NoSuchEntryException, SystemException {
7378                    int count = countByG_U_S(groupId, userId, status);
7379    
7380                    List<BlogsEntry> list = findByG_U_S(groupId, userId, status, count - 1,
7381                                    count, orderByComparator);
7382    
7383                    if (list.isEmpty()) {
7384                            StringBundler msg = new StringBundler(8);
7385    
7386                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
7387    
7388                            msg.append("groupId=");
7389                            msg.append(groupId);
7390    
7391                            msg.append(", userId=");
7392                            msg.append(userId);
7393    
7394                            msg.append(", status=");
7395                            msg.append(status);
7396    
7397                            msg.append(StringPool.CLOSE_CURLY_BRACE);
7398    
7399                            throw new NoSuchEntryException(msg.toString());
7400                    }
7401                    else {
7402                            return list.get(0);
7403                    }
7404            }
7405    
7406            /**
7407             * Returns the blogs entries before and after the current blogs entry in the ordered set where groupId = &#63; and userId = &#63; and status = &#63;.
7408             *
7409             * <p>
7410             * 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.
7411             * </p>
7412             *
7413             * @param entryId the primary key of the current blogs entry
7414             * @param groupId the group ID
7415             * @param userId the user ID
7416             * @param status the status
7417             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
7418             * @return the previous, current, and next blogs entry
7419             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
7420             * @throws SystemException if a system exception occurred
7421             */
7422            public BlogsEntry[] findByG_U_S_PrevAndNext(long entryId, long groupId,
7423                    long userId, int status, OrderByComparator orderByComparator)
7424                    throws NoSuchEntryException, SystemException {
7425                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
7426    
7427                    Session session = null;
7428    
7429                    try {
7430                            session = openSession();
7431    
7432                            BlogsEntry[] array = new BlogsEntryImpl[3];
7433    
7434                            array[0] = getByG_U_S_PrevAndNext(session, blogsEntry, groupId,
7435                                            userId, status, orderByComparator, true);
7436    
7437                            array[1] = blogsEntry;
7438    
7439                            array[2] = getByG_U_S_PrevAndNext(session, blogsEntry, groupId,
7440                                            userId, status, orderByComparator, false);
7441    
7442                            return array;
7443                    }
7444                    catch (Exception e) {
7445                            throw processException(e);
7446                    }
7447                    finally {
7448                            closeSession(session);
7449                    }
7450            }
7451    
7452            protected BlogsEntry getByG_U_S_PrevAndNext(Session session,
7453                    BlogsEntry blogsEntry, long groupId, long userId, int status,
7454                    OrderByComparator orderByComparator, boolean previous) {
7455                    StringBundler query = null;
7456    
7457                    if (orderByComparator != null) {
7458                            query = new StringBundler(6 +
7459                                            (orderByComparator.getOrderByFields().length * 6));
7460                    }
7461                    else {
7462                            query = new StringBundler(3);
7463                    }
7464    
7465                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
7466    
7467                    query.append(_FINDER_COLUMN_G_U_S_GROUPID_2);
7468    
7469                    query.append(_FINDER_COLUMN_G_U_S_USERID_2);
7470    
7471                    query.append(_FINDER_COLUMN_G_U_S_STATUS_2);
7472    
7473                    if (orderByComparator != null) {
7474                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
7475    
7476                            if (orderByConditionFields.length > 0) {
7477                                    query.append(WHERE_AND);
7478                            }
7479    
7480                            for (int i = 0; i < orderByConditionFields.length; i++) {
7481                                    query.append(_ORDER_BY_ENTITY_ALIAS);
7482                                    query.append(orderByConditionFields[i]);
7483    
7484                                    if ((i + 1) < orderByConditionFields.length) {
7485                                            if (orderByComparator.isAscending() ^ previous) {
7486                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
7487                                            }
7488                                            else {
7489                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
7490                                            }
7491                                    }
7492                                    else {
7493                                            if (orderByComparator.isAscending() ^ previous) {
7494                                                    query.append(WHERE_GREATER_THAN);
7495                                            }
7496                                            else {
7497                                                    query.append(WHERE_LESSER_THAN);
7498                                            }
7499                                    }
7500                            }
7501    
7502                            query.append(ORDER_BY_CLAUSE);
7503    
7504                            String[] orderByFields = orderByComparator.getOrderByFields();
7505    
7506                            for (int i = 0; i < orderByFields.length; i++) {
7507                                    query.append(_ORDER_BY_ENTITY_ALIAS);
7508                                    query.append(orderByFields[i]);
7509    
7510                                    if ((i + 1) < orderByFields.length) {
7511                                            if (orderByComparator.isAscending() ^ previous) {
7512                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
7513                                            }
7514                                            else {
7515                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
7516                                            }
7517                                    }
7518                                    else {
7519                                            if (orderByComparator.isAscending() ^ previous) {
7520                                                    query.append(ORDER_BY_ASC);
7521                                            }
7522                                            else {
7523                                                    query.append(ORDER_BY_DESC);
7524                                            }
7525                                    }
7526                            }
7527                    }
7528    
7529                    else {
7530                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
7531                    }
7532    
7533                    String sql = query.toString();
7534    
7535                    Query q = session.createQuery(sql);
7536    
7537                    q.setFirstResult(0);
7538                    q.setMaxResults(2);
7539    
7540                    QueryPos qPos = QueryPos.getInstance(q);
7541    
7542                    qPos.add(groupId);
7543    
7544                    qPos.add(userId);
7545    
7546                    qPos.add(status);
7547    
7548                    if (orderByComparator != null) {
7549                            Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
7550    
7551                            for (Object value : values) {
7552                                    qPos.add(value);
7553                            }
7554                    }
7555    
7556                    List<BlogsEntry> list = q.list();
7557    
7558                    if (list.size() == 2) {
7559                            return list.get(1);
7560                    }
7561                    else {
7562                            return null;
7563                    }
7564            }
7565    
7566            /**
7567             * Returns all the blogs entries that the user has permission to view where groupId = &#63; and userId = &#63; and status = &#63;.
7568             *
7569             * @param groupId the group ID
7570             * @param userId the user ID
7571             * @param status the status
7572             * @return the matching blogs entries that the user has permission to view
7573             * @throws SystemException if a system exception occurred
7574             */
7575            public List<BlogsEntry> filterFindByG_U_S(long groupId, long userId,
7576                    int status) throws SystemException {
7577                    return filterFindByG_U_S(groupId, userId, status, QueryUtil.ALL_POS,
7578                            QueryUtil.ALL_POS, null);
7579            }
7580    
7581            /**
7582             * Returns a range of all the blogs entries that the user has permission to view where groupId = &#63; and userId = &#63; and status = &#63;.
7583             *
7584             * <p>
7585             * 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.
7586             * </p>
7587             *
7588             * @param groupId the group ID
7589             * @param userId the user ID
7590             * @param status the status
7591             * @param start the lower bound of the range of blogs entries
7592             * @param end the upper bound of the range of blogs entries (not inclusive)
7593             * @return the range of matching blogs entries that the user has permission to view
7594             * @throws SystemException if a system exception occurred
7595             */
7596            public List<BlogsEntry> filterFindByG_U_S(long groupId, long userId,
7597                    int status, int start, int end) throws SystemException {
7598                    return filterFindByG_U_S(groupId, userId, status, start, end, null);
7599            }
7600    
7601            /**
7602             * Returns an ordered range of all the blogs entries that the user has permissions to view where groupId = &#63; and userId = &#63; and status = &#63;.
7603             *
7604             * <p>
7605             * 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.
7606             * </p>
7607             *
7608             * @param groupId the group ID
7609             * @param userId the user ID
7610             * @param status the status
7611             * @param start the lower bound of the range of blogs entries
7612             * @param end the upper bound of the range of blogs entries (not inclusive)
7613             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
7614             * @return the ordered range of matching blogs entries that the user has permission to view
7615             * @throws SystemException if a system exception occurred
7616             */
7617            public List<BlogsEntry> filterFindByG_U_S(long groupId, long userId,
7618                    int status, int start, int end, OrderByComparator orderByComparator)
7619                    throws SystemException {
7620                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
7621                            return findByG_U_S(groupId, userId, status, start, end,
7622                                    orderByComparator);
7623                    }
7624    
7625                    StringBundler query = null;
7626    
7627                    if (orderByComparator != null) {
7628                            query = new StringBundler(5 +
7629                                            (orderByComparator.getOrderByFields().length * 3));
7630                    }
7631                    else {
7632                            query = new StringBundler(5);
7633                    }
7634    
7635                    if (getDB().isSupportsInlineDistinct()) {
7636                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
7637                    }
7638                    else {
7639                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1);
7640                    }
7641    
7642                    query.append(_FINDER_COLUMN_G_U_S_GROUPID_2);
7643    
7644                    query.append(_FINDER_COLUMN_G_U_S_USERID_2);
7645    
7646                    query.append(_FINDER_COLUMN_G_U_S_STATUS_2);
7647    
7648                    if (!getDB().isSupportsInlineDistinct()) {
7649                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2);
7650                    }
7651    
7652                    if (orderByComparator != null) {
7653                            if (getDB().isSupportsInlineDistinct()) {
7654                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
7655                                            orderByComparator);
7656                            }
7657                            else {
7658                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
7659                                            orderByComparator);
7660                            }
7661                    }
7662    
7663                    else {
7664                            if (getDB().isSupportsInlineDistinct()) {
7665                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
7666                            }
7667                            else {
7668                                    query.append(BlogsEntryModelImpl.ORDER_BY_SQL);
7669                            }
7670                    }
7671    
7672                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
7673                                    BlogsEntry.class.getName(),
7674                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
7675    
7676                    Session session = null;
7677    
7678                    try {
7679                            session = openSession();
7680    
7681                            SQLQuery q = session.createSQLQuery(sql);
7682    
7683                            if (getDB().isSupportsInlineDistinct()) {
7684                                    q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
7685                            }
7686                            else {
7687                                    q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class);
7688                            }
7689    
7690                            QueryPos qPos = QueryPos.getInstance(q);
7691    
7692                            qPos.add(groupId);
7693    
7694                            qPos.add(userId);
7695    
7696                            qPos.add(status);
7697    
7698                            return (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start, end);
7699                    }
7700                    catch (Exception e) {
7701                            throw processException(e);
7702                    }
7703                    finally {
7704                            closeSession(session);
7705                    }
7706            }
7707    
7708            /**
7709             * Returns the blogs entries before and after the current blogs entry in the ordered set of blogs entries that the user has permission to view where groupId = &#63; and userId = &#63; and status = &#63;.
7710             *
7711             * @param entryId the primary key of the current blogs entry
7712             * @param groupId the group ID
7713             * @param userId the user ID
7714             * @param status the status
7715             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
7716             * @return the previous, current, and next blogs entry
7717             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
7718             * @throws SystemException if a system exception occurred
7719             */
7720            public BlogsEntry[] filterFindByG_U_S_PrevAndNext(long entryId,
7721                    long groupId, long userId, int status,
7722                    OrderByComparator orderByComparator)
7723                    throws NoSuchEntryException, SystemException {
7724                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
7725                            return findByG_U_S_PrevAndNext(entryId, groupId, userId, status,
7726                                    orderByComparator);
7727                    }
7728    
7729                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
7730    
7731                    Session session = null;
7732    
7733                    try {
7734                            session = openSession();
7735    
7736                            BlogsEntry[] array = new BlogsEntryImpl[3];
7737    
7738                            array[0] = filterGetByG_U_S_PrevAndNext(session, blogsEntry,
7739                                            groupId, userId, status, orderByComparator, true);
7740    
7741                            array[1] = blogsEntry;
7742    
7743                            array[2] = filterGetByG_U_S_PrevAndNext(session, blogsEntry,
7744                                            groupId, userId, status, orderByComparator, false);
7745    
7746                            return array;
7747                    }
7748                    catch (Exception e) {
7749                            throw processException(e);
7750                    }
7751                    finally {
7752                            closeSession(session);
7753                    }
7754            }
7755    
7756            protected BlogsEntry filterGetByG_U_S_PrevAndNext(Session session,
7757                    BlogsEntry blogsEntry, long groupId, long userId, int status,
7758                    OrderByComparator orderByComparator, boolean previous) {
7759                    StringBundler query = null;
7760    
7761                    if (orderByComparator != null) {
7762                            query = new StringBundler(6 +
7763                                            (orderByComparator.getOrderByFields().length * 6));
7764                    }
7765                    else {
7766                            query = new StringBundler(3);
7767                    }
7768    
7769                    if (getDB().isSupportsInlineDistinct()) {
7770                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
7771                    }
7772                    else {
7773                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1);
7774                    }
7775    
7776                    query.append(_FINDER_COLUMN_G_U_S_GROUPID_2);
7777    
7778                    query.append(_FINDER_COLUMN_G_U_S_USERID_2);
7779    
7780                    query.append(_FINDER_COLUMN_G_U_S_STATUS_2);
7781    
7782                    if (!getDB().isSupportsInlineDistinct()) {
7783                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2);
7784                    }
7785    
7786                    if (orderByComparator != null) {
7787                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
7788    
7789                            if (orderByConditionFields.length > 0) {
7790                                    query.append(WHERE_AND);
7791                            }
7792    
7793                            for (int i = 0; i < orderByConditionFields.length; i++) {
7794                                    if (getDB().isSupportsInlineDistinct()) {
7795                                            query.append(_ORDER_BY_ENTITY_ALIAS);
7796                                    }
7797                                    else {
7798                                            query.append(_ORDER_BY_ENTITY_TABLE);
7799                                    }
7800    
7801                                    query.append(orderByConditionFields[i]);
7802    
7803                                    if ((i + 1) < orderByConditionFields.length) {
7804                                            if (orderByComparator.isAscending() ^ previous) {
7805                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
7806                                            }
7807                                            else {
7808                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
7809                                            }
7810                                    }
7811                                    else {
7812                                            if (orderByComparator.isAscending() ^ previous) {
7813                                                    query.append(WHERE_GREATER_THAN);
7814                                            }
7815                                            else {
7816                                                    query.append(WHERE_LESSER_THAN);
7817                                            }
7818                                    }
7819                            }
7820    
7821                            query.append(ORDER_BY_CLAUSE);
7822    
7823                            String[] orderByFields = orderByComparator.getOrderByFields();
7824    
7825                            for (int i = 0; i < orderByFields.length; i++) {
7826                                    if (getDB().isSupportsInlineDistinct()) {
7827                                            query.append(_ORDER_BY_ENTITY_ALIAS);
7828                                    }
7829                                    else {
7830                                            query.append(_ORDER_BY_ENTITY_TABLE);
7831                                    }
7832    
7833                                    query.append(orderByFields[i]);
7834    
7835                                    if ((i + 1) < orderByFields.length) {
7836                                            if (orderByComparator.isAscending() ^ previous) {
7837                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
7838                                            }
7839                                            else {
7840                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
7841                                            }
7842                                    }
7843                                    else {
7844                                            if (orderByComparator.isAscending() ^ previous) {
7845                                                    query.append(ORDER_BY_ASC);
7846                                            }
7847                                            else {
7848                                                    query.append(ORDER_BY_DESC);
7849                                            }
7850                                    }
7851                            }
7852                    }
7853    
7854                    else {
7855                            if (getDB().isSupportsInlineDistinct()) {
7856                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
7857                            }
7858                            else {
7859                                    query.append(BlogsEntryModelImpl.ORDER_BY_SQL);
7860                            }
7861                    }
7862    
7863                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
7864                                    BlogsEntry.class.getName(),
7865                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
7866    
7867                    SQLQuery q = session.createSQLQuery(sql);
7868    
7869                    q.setFirstResult(0);
7870                    q.setMaxResults(2);
7871    
7872                    if (getDB().isSupportsInlineDistinct()) {
7873                            q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
7874                    }
7875                    else {
7876                            q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class);
7877                    }
7878    
7879                    QueryPos qPos = QueryPos.getInstance(q);
7880    
7881                    qPos.add(groupId);
7882    
7883                    qPos.add(userId);
7884    
7885                    qPos.add(status);
7886    
7887                    if (orderByComparator != null) {
7888                            Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
7889    
7890                            for (Object value : values) {
7891                                    qPos.add(value);
7892                            }
7893                    }
7894    
7895                    List<BlogsEntry> list = q.list();
7896    
7897                    if (list.size() == 2) {
7898                            return list.get(1);
7899                    }
7900                    else {
7901                            return null;
7902                    }
7903            }
7904    
7905            /**
7906             * Returns all the blogs entries where groupId = &#63; and displayDate &lt; &#63; and status = &#63;.
7907             *
7908             * @param groupId the group ID
7909             * @param displayDate the display date
7910             * @param status the status
7911             * @return the matching blogs entries
7912             * @throws SystemException if a system exception occurred
7913             */
7914            public List<BlogsEntry> findByG_LtD_S(long groupId, Date displayDate,
7915                    int status) throws SystemException {
7916                    return findByG_LtD_S(groupId, displayDate, status, QueryUtil.ALL_POS,
7917                            QueryUtil.ALL_POS, null);
7918            }
7919    
7920            /**
7921             * Returns a range of all the blogs entries where groupId = &#63; and displayDate &lt; &#63; and status = &#63;.
7922             *
7923             * <p>
7924             * 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.
7925             * </p>
7926             *
7927             * @param groupId the group ID
7928             * @param displayDate the display date
7929             * @param status the status
7930             * @param start the lower bound of the range of blogs entries
7931             * @param end the upper bound of the range of blogs entries (not inclusive)
7932             * @return the range of matching blogs entries
7933             * @throws SystemException if a system exception occurred
7934             */
7935            public List<BlogsEntry> findByG_LtD_S(long groupId, Date displayDate,
7936                    int status, int start, int end) throws SystemException {
7937                    return findByG_LtD_S(groupId, displayDate, status, start, end, null);
7938            }
7939    
7940            /**
7941             * Returns an ordered range of all the blogs entries where groupId = &#63; and displayDate &lt; &#63; and status = &#63;.
7942             *
7943             * <p>
7944             * 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.
7945             * </p>
7946             *
7947             * @param groupId the group ID
7948             * @param displayDate the display date
7949             * @param status the status
7950             * @param start the lower bound of the range of blogs entries
7951             * @param end the upper bound of the range of blogs entries (not inclusive)
7952             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
7953             * @return the ordered range of matching blogs entries
7954             * @throws SystemException if a system exception occurred
7955             */
7956            public List<BlogsEntry> findByG_LtD_S(long groupId, Date displayDate,
7957                    int status, int start, int end, OrderByComparator orderByComparator)
7958                    throws SystemException {
7959                    FinderPath finderPath = null;
7960                    Object[] finderArgs = null;
7961    
7962                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
7963                                    (orderByComparator == null)) {
7964                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_LTD_S;
7965                            finderArgs = new Object[] { groupId, displayDate, status };
7966                    }
7967                    else {
7968                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_LTD_S;
7969                            finderArgs = new Object[] {
7970                                            groupId, displayDate, status,
7971                                            
7972                                            start, end, orderByComparator
7973                                    };
7974                    }
7975    
7976                    List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
7977                                    finderArgs, this);
7978    
7979                    if ((list != null) && !list.isEmpty()) {
7980                            for (BlogsEntry blogsEntry : list) {
7981                                    if ((groupId != blogsEntry.getGroupId()) ||
7982                                                    !Validator.equals(displayDate,
7983                                                            blogsEntry.getDisplayDate()) ||
7984                                                    (status != blogsEntry.getStatus())) {
7985                                            list = null;
7986    
7987                                            break;
7988                                    }
7989                            }
7990                    }
7991    
7992                    if (list == null) {
7993                            StringBundler query = null;
7994    
7995                            if (orderByComparator != null) {
7996                                    query = new StringBundler(5 +
7997                                                    (orderByComparator.getOrderByFields().length * 3));
7998                            }
7999                            else {
8000                                    query = new StringBundler(5);
8001                            }
8002    
8003                            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
8004    
8005                            query.append(_FINDER_COLUMN_G_LTD_S_GROUPID_2);
8006    
8007                            if (displayDate == null) {
8008                                    query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_1);
8009                            }
8010                            else {
8011                                    query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_2);
8012                            }
8013    
8014                            query.append(_FINDER_COLUMN_G_LTD_S_STATUS_2);
8015    
8016                            if (orderByComparator != null) {
8017                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
8018                                            orderByComparator);
8019                            }
8020    
8021                            else {
8022                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
8023                            }
8024    
8025                            String sql = query.toString();
8026    
8027                            Session session = null;
8028    
8029                            try {
8030                                    session = openSession();
8031    
8032                                    Query q = session.createQuery(sql);
8033    
8034                                    QueryPos qPos = QueryPos.getInstance(q);
8035    
8036                                    qPos.add(groupId);
8037    
8038                                    if (displayDate != null) {
8039                                            qPos.add(CalendarUtil.getTimestamp(displayDate));
8040                                    }
8041    
8042                                    qPos.add(status);
8043    
8044                                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
8045                                                    end);
8046                            }
8047                            catch (Exception e) {
8048                                    throw processException(e);
8049                            }
8050                            finally {
8051                                    if (list == null) {
8052                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
8053                                    }
8054                                    else {
8055                                            cacheResult(list);
8056    
8057                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
8058                                    }
8059    
8060                                    closeSession(session);
8061                            }
8062                    }
8063    
8064                    return list;
8065            }
8066    
8067            /**
8068             * Returns the first blogs entry in the ordered set where groupId = &#63; and displayDate &lt; &#63; and status = &#63;.
8069             *
8070             * <p>
8071             * 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.
8072             * </p>
8073             *
8074             * @param groupId the group ID
8075             * @param displayDate the display date
8076             * @param status the status
8077             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
8078             * @return the first matching blogs entry
8079             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
8080             * @throws SystemException if a system exception occurred
8081             */
8082            public BlogsEntry findByG_LtD_S_First(long groupId, Date displayDate,
8083                    int status, OrderByComparator orderByComparator)
8084                    throws NoSuchEntryException, SystemException {
8085                    List<BlogsEntry> list = findByG_LtD_S(groupId, displayDate, status, 0,
8086                                    1, orderByComparator);
8087    
8088                    if (list.isEmpty()) {
8089                            StringBundler msg = new StringBundler(8);
8090    
8091                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
8092    
8093                            msg.append("groupId=");
8094                            msg.append(groupId);
8095    
8096                            msg.append(", displayDate=");
8097                            msg.append(displayDate);
8098    
8099                            msg.append(", status=");
8100                            msg.append(status);
8101    
8102                            msg.append(StringPool.CLOSE_CURLY_BRACE);
8103    
8104                            throw new NoSuchEntryException(msg.toString());
8105                    }
8106                    else {
8107                            return list.get(0);
8108                    }
8109            }
8110    
8111            /**
8112             * Returns the last blogs entry in the ordered set where groupId = &#63; and displayDate &lt; &#63; and status = &#63;.
8113             *
8114             * <p>
8115             * 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.
8116             * </p>
8117             *
8118             * @param groupId the group ID
8119             * @param displayDate the display date
8120             * @param status the status
8121             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
8122             * @return the last matching blogs entry
8123             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
8124             * @throws SystemException if a system exception occurred
8125             */
8126            public BlogsEntry findByG_LtD_S_Last(long groupId, Date displayDate,
8127                    int status, OrderByComparator orderByComparator)
8128                    throws NoSuchEntryException, SystemException {
8129                    int count = countByG_LtD_S(groupId, displayDate, status);
8130    
8131                    List<BlogsEntry> list = findByG_LtD_S(groupId, displayDate, status,
8132                                    count - 1, count, orderByComparator);
8133    
8134                    if (list.isEmpty()) {
8135                            StringBundler msg = new StringBundler(8);
8136    
8137                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
8138    
8139                            msg.append("groupId=");
8140                            msg.append(groupId);
8141    
8142                            msg.append(", displayDate=");
8143                            msg.append(displayDate);
8144    
8145                            msg.append(", status=");
8146                            msg.append(status);
8147    
8148                            msg.append(StringPool.CLOSE_CURLY_BRACE);
8149    
8150                            throw new NoSuchEntryException(msg.toString());
8151                    }
8152                    else {
8153                            return list.get(0);
8154                    }
8155            }
8156    
8157            /**
8158             * Returns the blogs entries before and after the current blogs entry in the ordered set where groupId = &#63; and displayDate &lt; &#63; and status = &#63;.
8159             *
8160             * <p>
8161             * 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.
8162             * </p>
8163             *
8164             * @param entryId the primary key of the current blogs entry
8165             * @param groupId the group ID
8166             * @param displayDate the display date
8167             * @param status the status
8168             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
8169             * @return the previous, current, and next blogs entry
8170             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
8171             * @throws SystemException if a system exception occurred
8172             */
8173            public BlogsEntry[] findByG_LtD_S_PrevAndNext(long entryId, long groupId,
8174                    Date displayDate, int status, OrderByComparator orderByComparator)
8175                    throws NoSuchEntryException, SystemException {
8176                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
8177    
8178                    Session session = null;
8179    
8180                    try {
8181                            session = openSession();
8182    
8183                            BlogsEntry[] array = new BlogsEntryImpl[3];
8184    
8185                            array[0] = getByG_LtD_S_PrevAndNext(session, blogsEntry, groupId,
8186                                            displayDate, status, orderByComparator, true);
8187    
8188                            array[1] = blogsEntry;
8189    
8190                            array[2] = getByG_LtD_S_PrevAndNext(session, blogsEntry, groupId,
8191                                            displayDate, status, orderByComparator, false);
8192    
8193                            return array;
8194                    }
8195                    catch (Exception e) {
8196                            throw processException(e);
8197                    }
8198                    finally {
8199                            closeSession(session);
8200                    }
8201            }
8202    
8203            protected BlogsEntry getByG_LtD_S_PrevAndNext(Session session,
8204                    BlogsEntry blogsEntry, long groupId, Date displayDate, int status,
8205                    OrderByComparator orderByComparator, boolean previous) {
8206                    StringBundler query = null;
8207    
8208                    if (orderByComparator != null) {
8209                            query = new StringBundler(6 +
8210                                            (orderByComparator.getOrderByFields().length * 6));
8211                    }
8212                    else {
8213                            query = new StringBundler(3);
8214                    }
8215    
8216                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
8217    
8218                    query.append(_FINDER_COLUMN_G_LTD_S_GROUPID_2);
8219    
8220                    if (displayDate == null) {
8221                            query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_1);
8222                    }
8223                    else {
8224                            query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_2);
8225                    }
8226    
8227                    query.append(_FINDER_COLUMN_G_LTD_S_STATUS_2);
8228    
8229                    if (orderByComparator != null) {
8230                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
8231    
8232                            if (orderByConditionFields.length > 0) {
8233                                    query.append(WHERE_AND);
8234                            }
8235    
8236                            for (int i = 0; i < orderByConditionFields.length; i++) {
8237                                    query.append(_ORDER_BY_ENTITY_ALIAS);
8238                                    query.append(orderByConditionFields[i]);
8239    
8240                                    if ((i + 1) < orderByConditionFields.length) {
8241                                            if (orderByComparator.isAscending() ^ previous) {
8242                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
8243                                            }
8244                                            else {
8245                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
8246                                            }
8247                                    }
8248                                    else {
8249                                            if (orderByComparator.isAscending() ^ previous) {
8250                                                    query.append(WHERE_GREATER_THAN);
8251                                            }
8252                                            else {
8253                                                    query.append(WHERE_LESSER_THAN);
8254                                            }
8255                                    }
8256                            }
8257    
8258                            query.append(ORDER_BY_CLAUSE);
8259    
8260                            String[] orderByFields = orderByComparator.getOrderByFields();
8261    
8262                            for (int i = 0; i < orderByFields.length; i++) {
8263                                    query.append(_ORDER_BY_ENTITY_ALIAS);
8264                                    query.append(orderByFields[i]);
8265    
8266                                    if ((i + 1) < orderByFields.length) {
8267                                            if (orderByComparator.isAscending() ^ previous) {
8268                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
8269                                            }
8270                                            else {
8271                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
8272                                            }
8273                                    }
8274                                    else {
8275                                            if (orderByComparator.isAscending() ^ previous) {
8276                                                    query.append(ORDER_BY_ASC);
8277                                            }
8278                                            else {
8279                                                    query.append(ORDER_BY_DESC);
8280                                            }
8281                                    }
8282                            }
8283                    }
8284    
8285                    else {
8286                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
8287                    }
8288    
8289                    String sql = query.toString();
8290    
8291                    Query q = session.createQuery(sql);
8292    
8293                    q.setFirstResult(0);
8294                    q.setMaxResults(2);
8295    
8296                    QueryPos qPos = QueryPos.getInstance(q);
8297    
8298                    qPos.add(groupId);
8299    
8300                    if (displayDate != null) {
8301                            qPos.add(CalendarUtil.getTimestamp(displayDate));
8302                    }
8303    
8304                    qPos.add(status);
8305    
8306                    if (orderByComparator != null) {
8307                            Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
8308    
8309                            for (Object value : values) {
8310                                    qPos.add(value);
8311                            }
8312                    }
8313    
8314                    List<BlogsEntry> list = q.list();
8315    
8316                    if (list.size() == 2) {
8317                            return list.get(1);
8318                    }
8319                    else {
8320                            return null;
8321                    }
8322            }
8323    
8324            /**
8325             * Returns all the blogs entries that the user has permission to view where groupId = &#63; and displayDate &lt; &#63; and status = &#63;.
8326             *
8327             * @param groupId the group ID
8328             * @param displayDate the display date
8329             * @param status the status
8330             * @return the matching blogs entries that the user has permission to view
8331             * @throws SystemException if a system exception occurred
8332             */
8333            public List<BlogsEntry> filterFindByG_LtD_S(long groupId, Date displayDate,
8334                    int status) throws SystemException {
8335                    return filterFindByG_LtD_S(groupId, displayDate, status,
8336                            QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
8337            }
8338    
8339            /**
8340             * Returns a range of all the blogs entries that the user has permission to view where groupId = &#63; and displayDate &lt; &#63; and status = &#63;.
8341             *
8342             * <p>
8343             * 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.
8344             * </p>
8345             *
8346             * @param groupId the group ID
8347             * @param displayDate the display date
8348             * @param status the status
8349             * @param start the lower bound of the range of blogs entries
8350             * @param end the upper bound of the range of blogs entries (not inclusive)
8351             * @return the range of matching blogs entries that the user has permission to view
8352             * @throws SystemException if a system exception occurred
8353             */
8354            public List<BlogsEntry> filterFindByG_LtD_S(long groupId, Date displayDate,
8355                    int status, int start, int end) throws SystemException {
8356                    return filterFindByG_LtD_S(groupId, displayDate, status, start, end,
8357                            null);
8358            }
8359    
8360            /**
8361             * Returns an ordered range of all the blogs entries that the user has permissions to view where groupId = &#63; and displayDate &lt; &#63; and status = &#63;.
8362             *
8363             * <p>
8364             * 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.
8365             * </p>
8366             *
8367             * @param groupId the group ID
8368             * @param displayDate the display date
8369             * @param status the status
8370             * @param start the lower bound of the range of blogs entries
8371             * @param end the upper bound of the range of blogs entries (not inclusive)
8372             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
8373             * @return the ordered range of matching blogs entries that the user has permission to view
8374             * @throws SystemException if a system exception occurred
8375             */
8376            public List<BlogsEntry> filterFindByG_LtD_S(long groupId, Date displayDate,
8377                    int status, int start, int end, OrderByComparator orderByComparator)
8378                    throws SystemException {
8379                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
8380                            return findByG_LtD_S(groupId, displayDate, status, start, end,
8381                                    orderByComparator);
8382                    }
8383    
8384                    StringBundler query = null;
8385    
8386                    if (orderByComparator != null) {
8387                            query = new StringBundler(5 +
8388                                            (orderByComparator.getOrderByFields().length * 3));
8389                    }
8390                    else {
8391                            query = new StringBundler(5);
8392                    }
8393    
8394                    if (getDB().isSupportsInlineDistinct()) {
8395                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
8396                    }
8397                    else {
8398                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1);
8399                    }
8400    
8401                    query.append(_FINDER_COLUMN_G_LTD_S_GROUPID_2);
8402    
8403                    if (displayDate == null) {
8404                            query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_1);
8405                    }
8406                    else {
8407                            query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_2);
8408                    }
8409    
8410                    query.append(_FINDER_COLUMN_G_LTD_S_STATUS_2);
8411    
8412                    if (!getDB().isSupportsInlineDistinct()) {
8413                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2);
8414                    }
8415    
8416                    if (orderByComparator != null) {
8417                            if (getDB().isSupportsInlineDistinct()) {
8418                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
8419                                            orderByComparator);
8420                            }
8421                            else {
8422                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
8423                                            orderByComparator);
8424                            }
8425                    }
8426    
8427                    else {
8428                            if (getDB().isSupportsInlineDistinct()) {
8429                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
8430                            }
8431                            else {
8432                                    query.append(BlogsEntryModelImpl.ORDER_BY_SQL);
8433                            }
8434                    }
8435    
8436                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
8437                                    BlogsEntry.class.getName(),
8438                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
8439    
8440                    Session session = null;
8441    
8442                    try {
8443                            session = openSession();
8444    
8445                            SQLQuery q = session.createSQLQuery(sql);
8446    
8447                            if (getDB().isSupportsInlineDistinct()) {
8448                                    q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
8449                            }
8450                            else {
8451                                    q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class);
8452                            }
8453    
8454                            QueryPos qPos = QueryPos.getInstance(q);
8455    
8456                            qPos.add(groupId);
8457    
8458                            if (displayDate != null) {
8459                                    qPos.add(CalendarUtil.getTimestamp(displayDate));
8460                            }
8461    
8462                            qPos.add(status);
8463    
8464                            return (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start, end);
8465                    }
8466                    catch (Exception e) {
8467                            throw processException(e);
8468                    }
8469                    finally {
8470                            closeSession(session);
8471                    }
8472            }
8473    
8474            /**
8475             * Returns the blogs entries before and after the current blogs entry in the ordered set of blogs entries that the user has permission to view where groupId = &#63; and displayDate &lt; &#63; and status = &#63;.
8476             *
8477             * @param entryId the primary key of the current blogs entry
8478             * @param groupId the group ID
8479             * @param displayDate the display date
8480             * @param status the status
8481             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
8482             * @return the previous, current, and next blogs entry
8483             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
8484             * @throws SystemException if a system exception occurred
8485             */
8486            public BlogsEntry[] filterFindByG_LtD_S_PrevAndNext(long entryId,
8487                    long groupId, Date displayDate, int status,
8488                    OrderByComparator orderByComparator)
8489                    throws NoSuchEntryException, SystemException {
8490                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
8491                            return findByG_LtD_S_PrevAndNext(entryId, groupId, displayDate,
8492                                    status, orderByComparator);
8493                    }
8494    
8495                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
8496    
8497                    Session session = null;
8498    
8499                    try {
8500                            session = openSession();
8501    
8502                            BlogsEntry[] array = new BlogsEntryImpl[3];
8503    
8504                            array[0] = filterGetByG_LtD_S_PrevAndNext(session, blogsEntry,
8505                                            groupId, displayDate, status, orderByComparator, true);
8506    
8507                            array[1] = blogsEntry;
8508    
8509                            array[2] = filterGetByG_LtD_S_PrevAndNext(session, blogsEntry,
8510                                            groupId, displayDate, status, orderByComparator, false);
8511    
8512                            return array;
8513                    }
8514                    catch (Exception e) {
8515                            throw processException(e);
8516                    }
8517                    finally {
8518                            closeSession(session);
8519                    }
8520            }
8521    
8522            protected BlogsEntry filterGetByG_LtD_S_PrevAndNext(Session session,
8523                    BlogsEntry blogsEntry, long groupId, Date displayDate, int status,
8524                    OrderByComparator orderByComparator, boolean previous) {
8525                    StringBundler query = null;
8526    
8527                    if (orderByComparator != null) {
8528                            query = new StringBundler(6 +
8529                                            (orderByComparator.getOrderByFields().length * 6));
8530                    }
8531                    else {
8532                            query = new StringBundler(3);
8533                    }
8534    
8535                    if (getDB().isSupportsInlineDistinct()) {
8536                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
8537                    }
8538                    else {
8539                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1);
8540                    }
8541    
8542                    query.append(_FINDER_COLUMN_G_LTD_S_GROUPID_2);
8543    
8544                    if (displayDate == null) {
8545                            query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_1);
8546                    }
8547                    else {
8548                            query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_2);
8549                    }
8550    
8551                    query.append(_FINDER_COLUMN_G_LTD_S_STATUS_2);
8552    
8553                    if (!getDB().isSupportsInlineDistinct()) {
8554                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2);
8555                    }
8556    
8557                    if (orderByComparator != null) {
8558                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
8559    
8560                            if (orderByConditionFields.length > 0) {
8561                                    query.append(WHERE_AND);
8562                            }
8563    
8564                            for (int i = 0; i < orderByConditionFields.length; i++) {
8565                                    if (getDB().isSupportsInlineDistinct()) {
8566                                            query.append(_ORDER_BY_ENTITY_ALIAS);
8567                                    }
8568                                    else {
8569                                            query.append(_ORDER_BY_ENTITY_TABLE);
8570                                    }
8571    
8572                                    query.append(orderByConditionFields[i]);
8573    
8574                                    if ((i + 1) < orderByConditionFields.length) {
8575                                            if (orderByComparator.isAscending() ^ previous) {
8576                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
8577                                            }
8578                                            else {
8579                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
8580                                            }
8581                                    }
8582                                    else {
8583                                            if (orderByComparator.isAscending() ^ previous) {
8584                                                    query.append(WHERE_GREATER_THAN);
8585                                            }
8586                                            else {
8587                                                    query.append(WHERE_LESSER_THAN);
8588                                            }
8589                                    }
8590                            }
8591    
8592                            query.append(ORDER_BY_CLAUSE);
8593    
8594                            String[] orderByFields = orderByComparator.getOrderByFields();
8595    
8596                            for (int i = 0; i < orderByFields.length; i++) {
8597                                    if (getDB().isSupportsInlineDistinct()) {
8598                                            query.append(_ORDER_BY_ENTITY_ALIAS);
8599                                    }
8600                                    else {
8601                                            query.append(_ORDER_BY_ENTITY_TABLE);
8602                                    }
8603    
8604                                    query.append(orderByFields[i]);
8605    
8606                                    if ((i + 1) < orderByFields.length) {
8607                                            if (orderByComparator.isAscending() ^ previous) {
8608                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
8609                                            }
8610                                            else {
8611                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
8612                                            }
8613                                    }
8614                                    else {
8615                                            if (orderByComparator.isAscending() ^ previous) {
8616                                                    query.append(ORDER_BY_ASC);
8617                                            }
8618                                            else {
8619                                                    query.append(ORDER_BY_DESC);
8620                                            }
8621                                    }
8622                            }
8623                    }
8624    
8625                    else {
8626                            if (getDB().isSupportsInlineDistinct()) {
8627                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
8628                            }
8629                            else {
8630                                    query.append(BlogsEntryModelImpl.ORDER_BY_SQL);
8631                            }
8632                    }
8633    
8634                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
8635                                    BlogsEntry.class.getName(),
8636                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
8637    
8638                    SQLQuery q = session.createSQLQuery(sql);
8639    
8640                    q.setFirstResult(0);
8641                    q.setMaxResults(2);
8642    
8643                    if (getDB().isSupportsInlineDistinct()) {
8644                            q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
8645                    }
8646                    else {
8647                            q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class);
8648                    }
8649    
8650                    QueryPos qPos = QueryPos.getInstance(q);
8651    
8652                    qPos.add(groupId);
8653    
8654                    if (displayDate != null) {
8655                            qPos.add(CalendarUtil.getTimestamp(displayDate));
8656                    }
8657    
8658                    qPos.add(status);
8659    
8660                    if (orderByComparator != null) {
8661                            Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
8662    
8663                            for (Object value : values) {
8664                                    qPos.add(value);
8665                            }
8666                    }
8667    
8668                    List<BlogsEntry> list = q.list();
8669    
8670                    if (list.size() == 2) {
8671                            return list.get(1);
8672                    }
8673                    else {
8674                            return null;
8675                    }
8676            }
8677    
8678            /**
8679             * Returns all the blogs entries where groupId = &#63; and userId = &#63; and displayDate &lt; &#63; and status = &#63;.
8680             *
8681             * @param groupId the group ID
8682             * @param userId the user ID
8683             * @param displayDate the display date
8684             * @param status the status
8685             * @return the matching blogs entries
8686             * @throws SystemException if a system exception occurred
8687             */
8688            public List<BlogsEntry> findByG_U_LtD_S(long groupId, long userId,
8689                    Date displayDate, int status) throws SystemException {
8690                    return findByG_U_LtD_S(groupId, userId, displayDate, status,
8691                            QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
8692            }
8693    
8694            /**
8695             * Returns a range of all the blogs entries where groupId = &#63; and userId = &#63; and displayDate &lt; &#63; and status = &#63;.
8696             *
8697             * <p>
8698             * 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.
8699             * </p>
8700             *
8701             * @param groupId the group ID
8702             * @param userId the user ID
8703             * @param displayDate the display date
8704             * @param status the status
8705             * @param start the lower bound of the range of blogs entries
8706             * @param end the upper bound of the range of blogs entries (not inclusive)
8707             * @return the range of matching blogs entries
8708             * @throws SystemException if a system exception occurred
8709             */
8710            public List<BlogsEntry> findByG_U_LtD_S(long groupId, long userId,
8711                    Date displayDate, int status, int start, int end)
8712                    throws SystemException {
8713                    return findByG_U_LtD_S(groupId, userId, displayDate, status, start,
8714                            end, null);
8715            }
8716    
8717            /**
8718             * Returns an ordered range of all the blogs entries where groupId = &#63; and userId = &#63; and displayDate &lt; &#63; and status = &#63;.
8719             *
8720             * <p>
8721             * 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.
8722             * </p>
8723             *
8724             * @param groupId the group ID
8725             * @param userId the user ID
8726             * @param displayDate the display date
8727             * @param status the status
8728             * @param start the lower bound of the range of blogs entries
8729             * @param end the upper bound of the range of blogs entries (not inclusive)
8730             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
8731             * @return the ordered range of matching blogs entries
8732             * @throws SystemException if a system exception occurred
8733             */
8734            public List<BlogsEntry> findByG_U_LtD_S(long groupId, long userId,
8735                    Date displayDate, int status, int start, int end,
8736                    OrderByComparator orderByComparator) throws SystemException {
8737                    FinderPath finderPath = null;
8738                    Object[] finderArgs = null;
8739    
8740                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
8741                                    (orderByComparator == null)) {
8742                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U_LTD_S;
8743                            finderArgs = new Object[] { groupId, userId, displayDate, status };
8744                    }
8745                    else {
8746                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_U_LTD_S;
8747                            finderArgs = new Object[] {
8748                                            groupId, userId, displayDate, status,
8749                                            
8750                                            start, end, orderByComparator
8751                                    };
8752                    }
8753    
8754                    List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
8755                                    finderArgs, this);
8756    
8757                    if ((list != null) && !list.isEmpty()) {
8758                            for (BlogsEntry blogsEntry : list) {
8759                                    if ((groupId != blogsEntry.getGroupId()) ||
8760                                                    (userId != blogsEntry.getUserId()) ||
8761                                                    !Validator.equals(displayDate,
8762                                                            blogsEntry.getDisplayDate()) ||
8763                                                    (status != blogsEntry.getStatus())) {
8764                                            list = null;
8765    
8766                                            break;
8767                                    }
8768                            }
8769                    }
8770    
8771                    if (list == null) {
8772                            StringBundler query = null;
8773    
8774                            if (orderByComparator != null) {
8775                                    query = new StringBundler(6 +
8776                                                    (orderByComparator.getOrderByFields().length * 3));
8777                            }
8778                            else {
8779                                    query = new StringBundler(6);
8780                            }
8781    
8782                            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
8783    
8784                            query.append(_FINDER_COLUMN_G_U_LTD_S_GROUPID_2);
8785    
8786                            query.append(_FINDER_COLUMN_G_U_LTD_S_USERID_2);
8787    
8788                            if (displayDate == null) {
8789                                    query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_1);
8790                            }
8791                            else {
8792                                    query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_2);
8793                            }
8794    
8795                            query.append(_FINDER_COLUMN_G_U_LTD_S_STATUS_2);
8796    
8797                            if (orderByComparator != null) {
8798                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
8799                                            orderByComparator);
8800                            }
8801    
8802                            else {
8803                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
8804                            }
8805    
8806                            String sql = query.toString();
8807    
8808                            Session session = null;
8809    
8810                            try {
8811                                    session = openSession();
8812    
8813                                    Query q = session.createQuery(sql);
8814    
8815                                    QueryPos qPos = QueryPos.getInstance(q);
8816    
8817                                    qPos.add(groupId);
8818    
8819                                    qPos.add(userId);
8820    
8821                                    if (displayDate != null) {
8822                                            qPos.add(CalendarUtil.getTimestamp(displayDate));
8823                                    }
8824    
8825                                    qPos.add(status);
8826    
8827                                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
8828                                                    end);
8829                            }
8830                            catch (Exception e) {
8831                                    throw processException(e);
8832                            }
8833                            finally {
8834                                    if (list == null) {
8835                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
8836                                    }
8837                                    else {
8838                                            cacheResult(list);
8839    
8840                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
8841                                    }
8842    
8843                                    closeSession(session);
8844                            }
8845                    }
8846    
8847                    return list;
8848            }
8849    
8850            /**
8851             * Returns the first blogs entry in the ordered set where groupId = &#63; and userId = &#63; and displayDate &lt; &#63; and status = &#63;.
8852             *
8853             * <p>
8854             * 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.
8855             * </p>
8856             *
8857             * @param groupId the group ID
8858             * @param userId the user ID
8859             * @param displayDate the display date
8860             * @param status the status
8861             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
8862             * @return the first matching blogs entry
8863             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
8864             * @throws SystemException if a system exception occurred
8865             */
8866            public BlogsEntry findByG_U_LtD_S_First(long groupId, long userId,
8867                    Date displayDate, int status, OrderByComparator orderByComparator)
8868                    throws NoSuchEntryException, SystemException {
8869                    List<BlogsEntry> list = findByG_U_LtD_S(groupId, userId, displayDate,
8870                                    status, 0, 1, orderByComparator);
8871    
8872                    if (list.isEmpty()) {
8873                            StringBundler msg = new StringBundler(10);
8874    
8875                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
8876    
8877                            msg.append("groupId=");
8878                            msg.append(groupId);
8879    
8880                            msg.append(", userId=");
8881                            msg.append(userId);
8882    
8883                            msg.append(", displayDate=");
8884                            msg.append(displayDate);
8885    
8886                            msg.append(", status=");
8887                            msg.append(status);
8888    
8889                            msg.append(StringPool.CLOSE_CURLY_BRACE);
8890    
8891                            throw new NoSuchEntryException(msg.toString());
8892                    }
8893                    else {
8894                            return list.get(0);
8895                    }
8896            }
8897    
8898            /**
8899             * Returns the last blogs entry in the ordered set where groupId = &#63; and userId = &#63; and displayDate &lt; &#63; and status = &#63;.
8900             *
8901             * <p>
8902             * 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.
8903             * </p>
8904             *
8905             * @param groupId the group ID
8906             * @param userId the user ID
8907             * @param displayDate the display date
8908             * @param status the status
8909             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
8910             * @return the last matching blogs entry
8911             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a matching blogs entry could not be found
8912             * @throws SystemException if a system exception occurred
8913             */
8914            public BlogsEntry findByG_U_LtD_S_Last(long groupId, long userId,
8915                    Date displayDate, int status, OrderByComparator orderByComparator)
8916                    throws NoSuchEntryException, SystemException {
8917                    int count = countByG_U_LtD_S(groupId, userId, displayDate, status);
8918    
8919                    List<BlogsEntry> list = findByG_U_LtD_S(groupId, userId, displayDate,
8920                                    status, count - 1, count, orderByComparator);
8921    
8922                    if (list.isEmpty()) {
8923                            StringBundler msg = new StringBundler(10);
8924    
8925                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
8926    
8927                            msg.append("groupId=");
8928                            msg.append(groupId);
8929    
8930                            msg.append(", userId=");
8931                            msg.append(userId);
8932    
8933                            msg.append(", displayDate=");
8934                            msg.append(displayDate);
8935    
8936                            msg.append(", status=");
8937                            msg.append(status);
8938    
8939                            msg.append(StringPool.CLOSE_CURLY_BRACE);
8940    
8941                            throw new NoSuchEntryException(msg.toString());
8942                    }
8943                    else {
8944                            return list.get(0);
8945                    }
8946            }
8947    
8948            /**
8949             * Returns 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;.
8950             *
8951             * <p>
8952             * 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.
8953             * </p>
8954             *
8955             * @param entryId the primary key of the current blogs entry
8956             * @param groupId the group ID
8957             * @param userId the user ID
8958             * @param displayDate the display date
8959             * @param status the status
8960             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
8961             * @return the previous, current, and next blogs entry
8962             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
8963             * @throws SystemException if a system exception occurred
8964             */
8965            public BlogsEntry[] findByG_U_LtD_S_PrevAndNext(long entryId, long groupId,
8966                    long userId, Date displayDate, int status,
8967                    OrderByComparator orderByComparator)
8968                    throws NoSuchEntryException, SystemException {
8969                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
8970    
8971                    Session session = null;
8972    
8973                    try {
8974                            session = openSession();
8975    
8976                            BlogsEntry[] array = new BlogsEntryImpl[3];
8977    
8978                            array[0] = getByG_U_LtD_S_PrevAndNext(session, blogsEntry, groupId,
8979                                            userId, displayDate, status, orderByComparator, true);
8980    
8981                            array[1] = blogsEntry;
8982    
8983                            array[2] = getByG_U_LtD_S_PrevAndNext(session, blogsEntry, groupId,
8984                                            userId, displayDate, status, orderByComparator, false);
8985    
8986                            return array;
8987                    }
8988                    catch (Exception e) {
8989                            throw processException(e);
8990                    }
8991                    finally {
8992                            closeSession(session);
8993                    }
8994            }
8995    
8996            protected BlogsEntry getByG_U_LtD_S_PrevAndNext(Session session,
8997                    BlogsEntry blogsEntry, long groupId, long userId, Date displayDate,
8998                    int status, OrderByComparator orderByComparator, boolean previous) {
8999                    StringBundler query = null;
9000    
9001                    if (orderByComparator != null) {
9002                            query = new StringBundler(6 +
9003                                            (orderByComparator.getOrderByFields().length * 6));
9004                    }
9005                    else {
9006                            query = new StringBundler(3);
9007                    }
9008    
9009                    query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
9010    
9011                    query.append(_FINDER_COLUMN_G_U_LTD_S_GROUPID_2);
9012    
9013                    query.append(_FINDER_COLUMN_G_U_LTD_S_USERID_2);
9014    
9015                    if (displayDate == null) {
9016                            query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_1);
9017                    }
9018                    else {
9019                            query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_2);
9020                    }
9021    
9022                    query.append(_FINDER_COLUMN_G_U_LTD_S_STATUS_2);
9023    
9024                    if (orderByComparator != null) {
9025                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
9026    
9027                            if (orderByConditionFields.length > 0) {
9028                                    query.append(WHERE_AND);
9029                            }
9030    
9031                            for (int i = 0; i < orderByConditionFields.length; i++) {
9032                                    query.append(_ORDER_BY_ENTITY_ALIAS);
9033                                    query.append(orderByConditionFields[i]);
9034    
9035                                    if ((i + 1) < orderByConditionFields.length) {
9036                                            if (orderByComparator.isAscending() ^ previous) {
9037                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
9038                                            }
9039                                            else {
9040                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
9041                                            }
9042                                    }
9043                                    else {
9044                                            if (orderByComparator.isAscending() ^ previous) {
9045                                                    query.append(WHERE_GREATER_THAN);
9046                                            }
9047                                            else {
9048                                                    query.append(WHERE_LESSER_THAN);
9049                                            }
9050                                    }
9051                            }
9052    
9053                            query.append(ORDER_BY_CLAUSE);
9054    
9055                            String[] orderByFields = orderByComparator.getOrderByFields();
9056    
9057                            for (int i = 0; i < orderByFields.length; i++) {
9058                                    query.append(_ORDER_BY_ENTITY_ALIAS);
9059                                    query.append(orderByFields[i]);
9060    
9061                                    if ((i + 1) < orderByFields.length) {
9062                                            if (orderByComparator.isAscending() ^ previous) {
9063                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
9064                                            }
9065                                            else {
9066                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
9067                                            }
9068                                    }
9069                                    else {
9070                                            if (orderByComparator.isAscending() ^ previous) {
9071                                                    query.append(ORDER_BY_ASC);
9072                                            }
9073                                            else {
9074                                                    query.append(ORDER_BY_DESC);
9075                                            }
9076                                    }
9077                            }
9078                    }
9079    
9080                    else {
9081                            query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
9082                    }
9083    
9084                    String sql = query.toString();
9085    
9086                    Query q = session.createQuery(sql);
9087    
9088                    q.setFirstResult(0);
9089                    q.setMaxResults(2);
9090    
9091                    QueryPos qPos = QueryPos.getInstance(q);
9092    
9093                    qPos.add(groupId);
9094    
9095                    qPos.add(userId);
9096    
9097                    if (displayDate != null) {
9098                            qPos.add(CalendarUtil.getTimestamp(displayDate));
9099                    }
9100    
9101                    qPos.add(status);
9102    
9103                    if (orderByComparator != null) {
9104                            Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
9105    
9106                            for (Object value : values) {
9107                                    qPos.add(value);
9108                            }
9109                    }
9110    
9111                    List<BlogsEntry> list = q.list();
9112    
9113                    if (list.size() == 2) {
9114                            return list.get(1);
9115                    }
9116                    else {
9117                            return null;
9118                    }
9119            }
9120    
9121            /**
9122             * Returns all the blogs entries that the user has permission to view where groupId = &#63; and userId = &#63; and displayDate &lt; &#63; and status = &#63;.
9123             *
9124             * @param groupId the group ID
9125             * @param userId the user ID
9126             * @param displayDate the display date
9127             * @param status the status
9128             * @return the matching blogs entries that the user has permission to view
9129             * @throws SystemException if a system exception occurred
9130             */
9131            public List<BlogsEntry> filterFindByG_U_LtD_S(long groupId, long userId,
9132                    Date displayDate, int status) throws SystemException {
9133                    return filterFindByG_U_LtD_S(groupId, userId, displayDate, status,
9134                            QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
9135            }
9136    
9137            /**
9138             * Returns a range of all the blogs entries that the user has permission to view where groupId = &#63; and userId = &#63; and displayDate &lt; &#63; and status = &#63;.
9139             *
9140             * <p>
9141             * 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.
9142             * </p>
9143             *
9144             * @param groupId the group ID
9145             * @param userId the user ID
9146             * @param displayDate the display date
9147             * @param status the status
9148             * @param start the lower bound of the range of blogs entries
9149             * @param end the upper bound of the range of blogs entries (not inclusive)
9150             * @return the range of matching blogs entries that the user has permission to view
9151             * @throws SystemException if a system exception occurred
9152             */
9153            public List<BlogsEntry> filterFindByG_U_LtD_S(long groupId, long userId,
9154                    Date displayDate, int status, int start, int end)
9155                    throws SystemException {
9156                    return filterFindByG_U_LtD_S(groupId, userId, displayDate, status,
9157                            start, end, null);
9158            }
9159    
9160            /**
9161             * Returns an ordered range of all the blogs entries that the user has permissions to view where groupId = &#63; and userId = &#63; and displayDate &lt; &#63; and status = &#63;.
9162             *
9163             * <p>
9164             * 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.
9165             * </p>
9166             *
9167             * @param groupId the group ID
9168             * @param userId the user ID
9169             * @param displayDate the display date
9170             * @param status the status
9171             * @param start the lower bound of the range of blogs entries
9172             * @param end the upper bound of the range of blogs entries (not inclusive)
9173             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
9174             * @return the ordered range of matching blogs entries that the user has permission to view
9175             * @throws SystemException if a system exception occurred
9176             */
9177            public List<BlogsEntry> filterFindByG_U_LtD_S(long groupId, long userId,
9178                    Date displayDate, int status, int start, int end,
9179                    OrderByComparator orderByComparator) throws SystemException {
9180                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
9181                            return findByG_U_LtD_S(groupId, userId, displayDate, status, start,
9182                                    end, orderByComparator);
9183                    }
9184    
9185                    StringBundler query = null;
9186    
9187                    if (orderByComparator != null) {
9188                            query = new StringBundler(6 +
9189                                            (orderByComparator.getOrderByFields().length * 3));
9190                    }
9191                    else {
9192                            query = new StringBundler(6);
9193                    }
9194    
9195                    if (getDB().isSupportsInlineDistinct()) {
9196                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
9197                    }
9198                    else {
9199                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1);
9200                    }
9201    
9202                    query.append(_FINDER_COLUMN_G_U_LTD_S_GROUPID_2);
9203    
9204                    query.append(_FINDER_COLUMN_G_U_LTD_S_USERID_2);
9205    
9206                    if (displayDate == null) {
9207                            query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_1);
9208                    }
9209                    else {
9210                            query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_2);
9211                    }
9212    
9213                    query.append(_FINDER_COLUMN_G_U_LTD_S_STATUS_2);
9214    
9215                    if (!getDB().isSupportsInlineDistinct()) {
9216                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2);
9217                    }
9218    
9219                    if (orderByComparator != null) {
9220                            if (getDB().isSupportsInlineDistinct()) {
9221                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
9222                                            orderByComparator);
9223                            }
9224                            else {
9225                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
9226                                            orderByComparator);
9227                            }
9228                    }
9229    
9230                    else {
9231                            if (getDB().isSupportsInlineDistinct()) {
9232                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
9233                            }
9234                            else {
9235                                    query.append(BlogsEntryModelImpl.ORDER_BY_SQL);
9236                            }
9237                    }
9238    
9239                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
9240                                    BlogsEntry.class.getName(),
9241                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
9242    
9243                    Session session = null;
9244    
9245                    try {
9246                            session = openSession();
9247    
9248                            SQLQuery q = session.createSQLQuery(sql);
9249    
9250                            if (getDB().isSupportsInlineDistinct()) {
9251                                    q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
9252                            }
9253                            else {
9254                                    q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class);
9255                            }
9256    
9257                            QueryPos qPos = QueryPos.getInstance(q);
9258    
9259                            qPos.add(groupId);
9260    
9261                            qPos.add(userId);
9262    
9263                            if (displayDate != null) {
9264                                    qPos.add(CalendarUtil.getTimestamp(displayDate));
9265                            }
9266    
9267                            qPos.add(status);
9268    
9269                            return (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start, end);
9270                    }
9271                    catch (Exception e) {
9272                            throw processException(e);
9273                    }
9274                    finally {
9275                            closeSession(session);
9276                    }
9277            }
9278    
9279            /**
9280             * Returns the blogs entries before and after the current blogs entry in the ordered set of blogs entries that the user has permission to view where groupId = &#63; and userId = &#63; and displayDate &lt; &#63; and status = &#63;.
9281             *
9282             * @param entryId the primary key of the current blogs entry
9283             * @param groupId the group ID
9284             * @param userId the user ID
9285             * @param displayDate the display date
9286             * @param status the status
9287             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
9288             * @return the previous, current, and next blogs entry
9289             * @throws com.liferay.portlet.blogs.NoSuchEntryException if a blogs entry with the primary key could not be found
9290             * @throws SystemException if a system exception occurred
9291             */
9292            public BlogsEntry[] filterFindByG_U_LtD_S_PrevAndNext(long entryId,
9293                    long groupId, long userId, Date displayDate, int status,
9294                    OrderByComparator orderByComparator)
9295                    throws NoSuchEntryException, SystemException {
9296                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
9297                            return findByG_U_LtD_S_PrevAndNext(entryId, groupId, userId,
9298                                    displayDate, status, orderByComparator);
9299                    }
9300    
9301                    BlogsEntry blogsEntry = findByPrimaryKey(entryId);
9302    
9303                    Session session = null;
9304    
9305                    try {
9306                            session = openSession();
9307    
9308                            BlogsEntry[] array = new BlogsEntryImpl[3];
9309    
9310                            array[0] = filterGetByG_U_LtD_S_PrevAndNext(session, blogsEntry,
9311                                            groupId, userId, displayDate, status, orderByComparator,
9312                                            true);
9313    
9314                            array[1] = blogsEntry;
9315    
9316                            array[2] = filterGetByG_U_LtD_S_PrevAndNext(session, blogsEntry,
9317                                            groupId, userId, displayDate, status, orderByComparator,
9318                                            false);
9319    
9320                            return array;
9321                    }
9322                    catch (Exception e) {
9323                            throw processException(e);
9324                    }
9325                    finally {
9326                            closeSession(session);
9327                    }
9328            }
9329    
9330            protected BlogsEntry filterGetByG_U_LtD_S_PrevAndNext(Session session,
9331                    BlogsEntry blogsEntry, long groupId, long userId, Date displayDate,
9332                    int status, OrderByComparator orderByComparator, boolean previous) {
9333                    StringBundler query = null;
9334    
9335                    if (orderByComparator != null) {
9336                            query = new StringBundler(6 +
9337                                            (orderByComparator.getOrderByFields().length * 6));
9338                    }
9339                    else {
9340                            query = new StringBundler(3);
9341                    }
9342    
9343                    if (getDB().isSupportsInlineDistinct()) {
9344                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE);
9345                    }
9346                    else {
9347                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1);
9348                    }
9349    
9350                    query.append(_FINDER_COLUMN_G_U_LTD_S_GROUPID_2);
9351    
9352                    query.append(_FINDER_COLUMN_G_U_LTD_S_USERID_2);
9353    
9354                    if (displayDate == null) {
9355                            query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_1);
9356                    }
9357                    else {
9358                            query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_2);
9359                    }
9360    
9361                    query.append(_FINDER_COLUMN_G_U_LTD_S_STATUS_2);
9362    
9363                    if (!getDB().isSupportsInlineDistinct()) {
9364                            query.append(_FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2);
9365                    }
9366    
9367                    if (orderByComparator != null) {
9368                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
9369    
9370                            if (orderByConditionFields.length > 0) {
9371                                    query.append(WHERE_AND);
9372                            }
9373    
9374                            for (int i = 0; i < orderByConditionFields.length; i++) {
9375                                    if (getDB().isSupportsInlineDistinct()) {
9376                                            query.append(_ORDER_BY_ENTITY_ALIAS);
9377                                    }
9378                                    else {
9379                                            query.append(_ORDER_BY_ENTITY_TABLE);
9380                                    }
9381    
9382                                    query.append(orderByConditionFields[i]);
9383    
9384                                    if ((i + 1) < orderByConditionFields.length) {
9385                                            if (orderByComparator.isAscending() ^ previous) {
9386                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
9387                                            }
9388                                            else {
9389                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
9390                                            }
9391                                    }
9392                                    else {
9393                                            if (orderByComparator.isAscending() ^ previous) {
9394                                                    query.append(WHERE_GREATER_THAN);
9395                                            }
9396                                            else {
9397                                                    query.append(WHERE_LESSER_THAN);
9398                                            }
9399                                    }
9400                            }
9401    
9402                            query.append(ORDER_BY_CLAUSE);
9403    
9404                            String[] orderByFields = orderByComparator.getOrderByFields();
9405    
9406                            for (int i = 0; i < orderByFields.length; i++) {
9407                                    if (getDB().isSupportsInlineDistinct()) {
9408                                            query.append(_ORDER_BY_ENTITY_ALIAS);
9409                                    }
9410                                    else {
9411                                            query.append(_ORDER_BY_ENTITY_TABLE);
9412                                    }
9413    
9414                                    query.append(orderByFields[i]);
9415    
9416                                    if ((i + 1) < orderByFields.length) {
9417                                            if (orderByComparator.isAscending() ^ previous) {
9418                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
9419                                            }
9420                                            else {
9421                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
9422                                            }
9423                                    }
9424                                    else {
9425                                            if (orderByComparator.isAscending() ^ previous) {
9426                                                    query.append(ORDER_BY_ASC);
9427                                            }
9428                                            else {
9429                                                    query.append(ORDER_BY_DESC);
9430                                            }
9431                                    }
9432                            }
9433                    }
9434    
9435                    else {
9436                            if (getDB().isSupportsInlineDistinct()) {
9437                                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
9438                            }
9439                            else {
9440                                    query.append(BlogsEntryModelImpl.ORDER_BY_SQL);
9441                            }
9442                    }
9443    
9444                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
9445                                    BlogsEntry.class.getName(),
9446                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
9447    
9448                    SQLQuery q = session.createSQLQuery(sql);
9449    
9450                    q.setFirstResult(0);
9451                    q.setMaxResults(2);
9452    
9453                    if (getDB().isSupportsInlineDistinct()) {
9454                            q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class);
9455                    }
9456                    else {
9457                            q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class);
9458                    }
9459    
9460                    QueryPos qPos = QueryPos.getInstance(q);
9461    
9462                    qPos.add(groupId);
9463    
9464                    qPos.add(userId);
9465    
9466                    if (displayDate != null) {
9467                            qPos.add(CalendarUtil.getTimestamp(displayDate));
9468                    }
9469    
9470                    qPos.add(status);
9471    
9472                    if (orderByComparator != null) {
9473                            Object[] values = orderByComparator.getOrderByConditionValues(blogsEntry);
9474    
9475                            for (Object value : values) {
9476                                    qPos.add(value);
9477                            }
9478                    }
9479    
9480                    List<BlogsEntry> list = q.list();
9481    
9482                    if (list.size() == 2) {
9483                            return list.get(1);
9484                    }
9485                    else {
9486                            return null;
9487                    }
9488            }
9489    
9490            /**
9491             * Returns all the blogs entries.
9492             *
9493             * @return the blogs entries
9494             * @throws SystemException if a system exception occurred
9495             */
9496            public List<BlogsEntry> findAll() throws SystemException {
9497                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
9498            }
9499    
9500            /**
9501             * Returns a range of all the blogs entries.
9502             *
9503             * <p>
9504             * 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.
9505             * </p>
9506             *
9507             * @param start the lower bound of the range of blogs entries
9508             * @param end the upper bound of the range of blogs entries (not inclusive)
9509             * @return the range of blogs entries
9510             * @throws SystemException if a system exception occurred
9511             */
9512            public List<BlogsEntry> findAll(int start, int end)
9513                    throws SystemException {
9514                    return findAll(start, end, null);
9515            }
9516    
9517            /**
9518             * Returns an ordered range of all the blogs entries.
9519             *
9520             * <p>
9521             * 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.
9522             * </p>
9523             *
9524             * @param start the lower bound of the range of blogs entries
9525             * @param end the upper bound of the range of blogs entries (not inclusive)
9526             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
9527             * @return the ordered range of blogs entries
9528             * @throws SystemException if a system exception occurred
9529             */
9530            public List<BlogsEntry> findAll(int start, int end,
9531                    OrderByComparator orderByComparator) throws SystemException {
9532                    FinderPath finderPath = null;
9533                    Object[] finderArgs = new Object[] { start, end, orderByComparator };
9534    
9535                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
9536                                    (orderByComparator == null)) {
9537                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
9538                            finderArgs = FINDER_ARGS_EMPTY;
9539                    }
9540                    else {
9541                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
9542                            finderArgs = new Object[] { start, end, orderByComparator };
9543                    }
9544    
9545                    List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(finderPath,
9546                                    finderArgs, this);
9547    
9548                    if (list == null) {
9549                            StringBundler query = null;
9550                            String sql = null;
9551    
9552                            if (orderByComparator != null) {
9553                                    query = new StringBundler(2 +
9554                                                    (orderByComparator.getOrderByFields().length * 3));
9555    
9556                                    query.append(_SQL_SELECT_BLOGSENTRY);
9557    
9558                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
9559                                            orderByComparator);
9560    
9561                                    sql = query.toString();
9562                            }
9563                            else {
9564                                    sql = _SQL_SELECT_BLOGSENTRY.concat(BlogsEntryModelImpl.ORDER_BY_JPQL);
9565                            }
9566    
9567                            Session session = null;
9568    
9569                            try {
9570                                    session = openSession();
9571    
9572                                    Query q = session.createQuery(sql);
9573    
9574                                    if (orderByComparator == null) {
9575                                            list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(),
9576                                                            start, end, false);
9577    
9578                                            Collections.sort(list);
9579                                    }
9580                                    else {
9581                                            list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(),
9582                                                            start, end);
9583                                    }
9584                            }
9585                            catch (Exception e) {
9586                                    throw processException(e);
9587                            }
9588                            finally {
9589                                    if (list == null) {
9590                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
9591                                    }
9592                                    else {
9593                                            cacheResult(list);
9594    
9595                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
9596                                    }
9597    
9598                                    closeSession(session);
9599                            }
9600                    }
9601    
9602                    return list;
9603            }
9604    
9605            /**
9606             * Removes all the blogs entries where uuid = &#63; from the database.
9607             *
9608             * @param uuid the uuid
9609             * @throws SystemException if a system exception occurred
9610             */
9611            public void removeByUuid(String uuid) throws SystemException {
9612                    for (BlogsEntry blogsEntry : findByUuid(uuid)) {
9613                            remove(blogsEntry);
9614                    }
9615            }
9616    
9617            /**
9618             * Removes the blogs entry where uuid = &#63; and groupId = &#63; from the database.
9619             *
9620             * @param uuid the uuid
9621             * @param groupId the group ID
9622             * @throws SystemException if a system exception occurred
9623             */
9624            public void removeByUUID_G(String uuid, long groupId)
9625                    throws NoSuchEntryException, SystemException {
9626                    BlogsEntry blogsEntry = findByUUID_G(uuid, groupId);
9627    
9628                    remove(blogsEntry);
9629            }
9630    
9631            /**
9632             * Removes all the blogs entries where groupId = &#63; from the database.
9633             *
9634             * @param groupId the group ID
9635             * @throws SystemException if a system exception occurred
9636             */
9637            public void removeByGroupId(long groupId) throws SystemException {
9638                    for (BlogsEntry blogsEntry : findByGroupId(groupId)) {
9639                            remove(blogsEntry);
9640                    }
9641            }
9642    
9643            /**
9644             * Removes all the blogs entries where companyId = &#63; from the database.
9645             *
9646             * @param companyId the company ID
9647             * @throws SystemException if a system exception occurred
9648             */
9649            public void removeByCompanyId(long companyId) throws SystemException {
9650                    for (BlogsEntry blogsEntry : findByCompanyId(companyId)) {
9651                            remove(blogsEntry);
9652                    }
9653            }
9654    
9655            /**
9656             * Removes all the blogs entries where companyId = &#63; and userId = &#63; from the database.
9657             *
9658             * @param companyId the company ID
9659             * @param userId the user ID
9660             * @throws SystemException if a system exception occurred
9661             */
9662            public void removeByC_U(long companyId, long userId)
9663                    throws SystemException {
9664                    for (BlogsEntry blogsEntry : findByC_U(companyId, userId)) {
9665                            remove(blogsEntry);
9666                    }
9667            }
9668    
9669            /**
9670             * Removes all the blogs entries where companyId = &#63; and displayDate &lt; &#63; from the database.
9671             *
9672             * @param companyId the company ID
9673             * @param displayDate the display date
9674             * @throws SystemException if a system exception occurred
9675             */
9676            public void removeByC_LtD(long companyId, Date displayDate)
9677                    throws SystemException {
9678                    for (BlogsEntry blogsEntry : findByC_LtD(companyId, displayDate)) {
9679                            remove(blogsEntry);
9680                    }
9681            }
9682    
9683            /**
9684             * Removes all the blogs entries where companyId = &#63; and status = &#63; from the database.
9685             *
9686             * @param companyId the company ID
9687             * @param status the status
9688             * @throws SystemException if a system exception occurred
9689             */
9690            public void removeByC_S(long companyId, int status)
9691                    throws SystemException {
9692                    for (BlogsEntry blogsEntry : findByC_S(companyId, status)) {
9693                            remove(blogsEntry);
9694                    }
9695            }
9696    
9697            /**
9698             * Removes the blogs entry where groupId = &#63; and urlTitle = &#63; from the database.
9699             *
9700             * @param groupId the group ID
9701             * @param urlTitle the url title
9702             * @throws SystemException if a system exception occurred
9703             */
9704            public void removeByG_UT(long groupId, String urlTitle)
9705                    throws NoSuchEntryException, SystemException {
9706                    BlogsEntry blogsEntry = findByG_UT(groupId, urlTitle);
9707    
9708                    remove(blogsEntry);
9709            }
9710    
9711            /**
9712             * Removes all the blogs entries where groupId = &#63; and displayDate &lt; &#63; from the database.
9713             *
9714             * @param groupId the group ID
9715             * @param displayDate the display date
9716             * @throws SystemException if a system exception occurred
9717             */
9718            public void removeByG_LtD(long groupId, Date displayDate)
9719                    throws SystemException {
9720                    for (BlogsEntry blogsEntry : findByG_LtD(groupId, displayDate)) {
9721                            remove(blogsEntry);
9722                    }
9723            }
9724    
9725            /**
9726             * Removes all the blogs entries where groupId = &#63; and status = &#63; from the database.
9727             *
9728             * @param groupId the group ID
9729             * @param status the status
9730             * @throws SystemException if a system exception occurred
9731             */
9732            public void removeByG_S(long groupId, int status) throws SystemException {
9733                    for (BlogsEntry blogsEntry : findByG_S(groupId, status)) {
9734                            remove(blogsEntry);
9735                    }
9736            }
9737    
9738            /**
9739             * Removes all the blogs entries where companyId = &#63; and userId = &#63; and status = &#63; from the database.
9740             *
9741             * @param companyId the company ID
9742             * @param userId the user ID
9743             * @param status the status
9744             * @throws SystemException if a system exception occurred
9745             */
9746            public void removeByC_U_S(long companyId, long userId, int status)
9747                    throws SystemException {
9748                    for (BlogsEntry blogsEntry : findByC_U_S(companyId, userId, status)) {
9749                            remove(blogsEntry);
9750                    }
9751            }
9752    
9753            /**
9754             * Removes all the blogs entries where companyId = &#63; and displayDate &lt; &#63; and status = &#63; from the database.
9755             *
9756             * @param companyId the company ID
9757             * @param displayDate the display date
9758             * @param status the status
9759             * @throws SystemException if a system exception occurred
9760             */
9761            public void removeByC_LtD_S(long companyId, Date displayDate, int status)
9762                    throws SystemException {
9763                    for (BlogsEntry blogsEntry : findByC_LtD_S(companyId, displayDate,
9764                                    status)) {
9765                            remove(blogsEntry);
9766                    }
9767            }
9768    
9769            /**
9770             * Removes all the blogs entries where groupId = &#63; and userId = &#63; and displayDate &lt; &#63; from the database.
9771             *
9772             * @param groupId the group ID
9773             * @param userId the user ID
9774             * @param displayDate the display date
9775             * @throws SystemException if a system exception occurred
9776             */
9777            public void removeByG_U_LtD(long groupId, long userId, Date displayDate)
9778                    throws SystemException {
9779                    for (BlogsEntry blogsEntry : findByG_U_LtD(groupId, userId, displayDate)) {
9780                            remove(blogsEntry);
9781                    }
9782            }
9783    
9784            /**
9785             * Removes all the blogs entries where groupId = &#63; and userId = &#63; and status = &#63; from the database.
9786             *
9787             * @param groupId the group ID
9788             * @param userId the user ID
9789             * @param status the status
9790             * @throws SystemException if a system exception occurred
9791             */
9792            public void removeByG_U_S(long groupId, long userId, int status)
9793                    throws SystemException {
9794                    for (BlogsEntry blogsEntry : findByG_U_S(groupId, userId, status)) {
9795                            remove(blogsEntry);
9796                    }
9797            }
9798    
9799            /**
9800             * Removes all the blogs entries where groupId = &#63; and displayDate &lt; &#63; and status = &#63; from the database.
9801             *
9802             * @param groupId the group ID
9803             * @param displayDate the display date
9804             * @param status the status
9805             * @throws SystemException if a system exception occurred
9806             */
9807            public void removeByG_LtD_S(long groupId, Date displayDate, int status)
9808                    throws SystemException {
9809                    for (BlogsEntry blogsEntry : findByG_LtD_S(groupId, displayDate, status)) {
9810                            remove(blogsEntry);
9811                    }
9812            }
9813    
9814            /**
9815             * Removes all the blogs entries where groupId = &#63; and userId = &#63; and displayDate &lt; &#63; and status = &#63; from the database.
9816             *
9817             * @param groupId the group ID
9818             * @param userId the user ID
9819             * @param displayDate the display date
9820             * @param status the status
9821             * @throws SystemException if a system exception occurred
9822             */
9823            public void removeByG_U_LtD_S(long groupId, long userId, Date displayDate,
9824                    int status) throws SystemException {
9825                    for (BlogsEntry blogsEntry : findByG_U_LtD_S(groupId, userId,
9826                                    displayDate, status)) {
9827                            remove(blogsEntry);
9828                    }
9829            }
9830    
9831            /**
9832             * Removes all the blogs entries from the database.
9833             *
9834             * @throws SystemException if a system exception occurred
9835             */
9836            public void removeAll() throws SystemException {
9837                    for (BlogsEntry blogsEntry : findAll()) {
9838                            remove(blogsEntry);
9839                    }
9840            }
9841    
9842            /**
9843             * Returns the number of blogs entries where uuid = &#63;.
9844             *
9845             * @param uuid the uuid
9846             * @return the number of matching blogs entries
9847             * @throws SystemException if a system exception occurred
9848             */
9849            public int countByUuid(String uuid) throws SystemException {
9850                    Object[] finderArgs = new Object[] { uuid };
9851    
9852                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
9853                                    finderArgs, this);
9854    
9855                    if (count == null) {
9856                            StringBundler query = new StringBundler(2);
9857    
9858                            query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
9859    
9860                            if (uuid == null) {
9861                                    query.append(_FINDER_COLUMN_UUID_UUID_1);
9862                            }
9863                            else {
9864                                    if (uuid.equals(StringPool.BLANK)) {
9865                                            query.append(_FINDER_COLUMN_UUID_UUID_3);
9866                                    }
9867                                    else {
9868                                            query.append(_FINDER_COLUMN_UUID_UUID_2);
9869                                    }
9870                            }
9871    
9872                            String sql = query.toString();
9873    
9874                            Session session = null;
9875    
9876                            try {
9877                                    session = openSession();
9878    
9879                                    Query q = session.createQuery(sql);
9880    
9881                                    QueryPos qPos = QueryPos.getInstance(q);
9882    
9883                                    if (uuid != null) {
9884                                            qPos.add(uuid);
9885                                    }
9886    
9887                                    count = (Long)q.uniqueResult();
9888                            }
9889                            catch (Exception e) {
9890                                    throw processException(e);
9891                            }
9892                            finally {
9893                                    if (count == null) {
9894                                            count = Long.valueOf(0);
9895                                    }
9896    
9897                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
9898                                            finderArgs, count);
9899    
9900                                    closeSession(session);
9901                            }
9902                    }
9903    
9904                    return count.intValue();
9905            }
9906    
9907            /**
9908             * Returns the number of blogs entries where uuid = &#63; and groupId = &#63;.
9909             *
9910             * @param uuid the uuid
9911             * @param groupId the group ID
9912             * @return the number of matching blogs entries
9913             * @throws SystemException if a system exception occurred
9914             */
9915            public int countByUUID_G(String uuid, long groupId)
9916                    throws SystemException {
9917                    Object[] finderArgs = new Object[] { uuid, groupId };
9918    
9919                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
9920                                    finderArgs, this);
9921    
9922                    if (count == null) {
9923                            StringBundler query = new StringBundler(3);
9924    
9925                            query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
9926    
9927                            if (uuid == null) {
9928                                    query.append(_FINDER_COLUMN_UUID_G_UUID_1);
9929                            }
9930                            else {
9931                                    if (uuid.equals(StringPool.BLANK)) {
9932                                            query.append(_FINDER_COLUMN_UUID_G_UUID_3);
9933                                    }
9934                                    else {
9935                                            query.append(_FINDER_COLUMN_UUID_G_UUID_2);
9936                                    }
9937                            }
9938    
9939                            query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
9940    
9941                            String sql = query.toString();
9942    
9943                            Session session = null;
9944    
9945                            try {
9946                                    session = openSession();
9947    
9948                                    Query q = session.createQuery(sql);
9949    
9950                                    QueryPos qPos = QueryPos.getInstance(q);
9951    
9952                                    if (uuid != null) {
9953                                            qPos.add(uuid);
9954                                    }
9955    
9956                                    qPos.add(groupId);
9957    
9958                                    count = (Long)q.uniqueResult();
9959                            }
9960                            catch (Exception e) {
9961                                    throw processException(e);
9962                            }
9963                            finally {
9964                                    if (count == null) {
9965                                            count = Long.valueOf(0);
9966                                    }
9967    
9968                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
9969                                            finderArgs, count);
9970    
9971                                    closeSession(session);
9972                            }
9973                    }
9974    
9975                    return count.intValue();
9976            }
9977    
9978            /**
9979             * Returns the number of blogs entries where groupId = &#63;.
9980             *
9981             * @param groupId the group ID
9982             * @return the number of matching blogs entries
9983             * @throws SystemException if a system exception occurred
9984             */
9985            public int countByGroupId(long groupId) throws SystemException {
9986                    Object[] finderArgs = new Object[] { groupId };
9987    
9988                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
9989                                    finderArgs, this);
9990    
9991                    if (count == null) {
9992                            StringBundler query = new StringBundler(2);
9993    
9994                            query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
9995    
9996                            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
9997    
9998                            String sql = query.toString();
9999    
10000                            Session session = null;
10001    
10002                            try {
10003                                    session = openSession();
10004    
10005                                    Query q = session.createQuery(sql);
10006    
10007                                    QueryPos qPos = QueryPos.getInstance(q);
10008    
10009                                    qPos.add(groupId);
10010    
10011                                    count = (Long)q.uniqueResult();
10012                            }
10013                            catch (Exception e) {
10014                                    throw processException(e);
10015                            }
10016                            finally {
10017                                    if (count == null) {
10018                                            count = Long.valueOf(0);
10019                                    }
10020    
10021                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
10022                                            finderArgs, count);
10023    
10024                                    closeSession(session);
10025                            }
10026                    }
10027    
10028                    return count.intValue();
10029            }
10030    
10031            /**
10032             * Returns the number of blogs entries that the user has permission to view where groupId = &#63;.
10033             *
10034             * @param groupId the group ID
10035             * @return the number of matching blogs entries that the user has permission to view
10036             * @throws SystemException if a system exception occurred
10037             */
10038            public int filterCountByGroupId(long groupId) throws SystemException {
10039                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
10040                            return countByGroupId(groupId);
10041                    }
10042    
10043                    StringBundler query = new StringBundler(2);
10044    
10045                    query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE);
10046    
10047                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
10048    
10049                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
10050                                    BlogsEntry.class.getName(),
10051                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
10052    
10053                    Session session = null;
10054    
10055                    try {
10056                            session = openSession();
10057    
10058                            SQLQuery q = session.createSQLQuery(sql);
10059    
10060                            q.addScalar(COUNT_COLUMN_NAME,
10061                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
10062    
10063                            QueryPos qPos = QueryPos.getInstance(q);
10064    
10065                            qPos.add(groupId);
10066    
10067                            Long count = (Long)q.uniqueResult();
10068    
10069                            return count.intValue();
10070                    }
10071                    catch (Exception e) {
10072                            throw processException(e);
10073                    }
10074                    finally {
10075                            closeSession(session);
10076                    }
10077            }
10078    
10079            /**
10080             * Returns the number of blogs entries where companyId = &#63;.
10081             *
10082             * @param companyId the company ID
10083             * @return the number of matching blogs entries
10084             * @throws SystemException if a system exception occurred
10085             */
10086            public int countByCompanyId(long companyId) throws SystemException {
10087                    Object[] finderArgs = new Object[] { companyId };
10088    
10089                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
10090                                    finderArgs, this);
10091    
10092                    if (count == null) {
10093                            StringBundler query = new StringBundler(2);
10094    
10095                            query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
10096    
10097                            query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
10098    
10099                            String sql = query.toString();
10100    
10101                            Session session = null;
10102    
10103                            try {
10104                                    session = openSession();
10105    
10106                                    Query q = session.createQuery(sql);
10107    
10108                                    QueryPos qPos = QueryPos.getInstance(q);
10109    
10110                                    qPos.add(companyId);
10111    
10112                                    count = (Long)q.uniqueResult();
10113                            }
10114                            catch (Exception e) {
10115                                    throw processException(e);
10116                            }
10117                            finally {
10118                                    if (count == null) {
10119                                            count = Long.valueOf(0);
10120                                    }
10121    
10122                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
10123                                            finderArgs, count);
10124    
10125                                    closeSession(session);
10126                            }
10127                    }
10128    
10129                    return count.intValue();
10130            }
10131    
10132            /**
10133             * Returns the number of blogs entries where companyId = &#63; and userId = &#63;.
10134             *
10135             * @param companyId the company ID
10136             * @param userId the user ID
10137             * @return the number of matching blogs entries
10138             * @throws SystemException if a system exception occurred
10139             */
10140            public int countByC_U(long companyId, long userId)
10141                    throws SystemException {
10142                    Object[] finderArgs = new Object[] { companyId, userId };
10143    
10144                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_U,
10145                                    finderArgs, this);
10146    
10147                    if (count == null) {
10148                            StringBundler query = new StringBundler(3);
10149    
10150                            query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
10151    
10152                            query.append(_FINDER_COLUMN_C_U_COMPANYID_2);
10153    
10154                            query.append(_FINDER_COLUMN_C_U_USERID_2);
10155    
10156                            String sql = query.toString();
10157    
10158                            Session session = null;
10159    
10160                            try {
10161                                    session = openSession();
10162    
10163                                    Query q = session.createQuery(sql);
10164    
10165                                    QueryPos qPos = QueryPos.getInstance(q);
10166    
10167                                    qPos.add(companyId);
10168    
10169                                    qPos.add(userId);
10170    
10171                                    count = (Long)q.uniqueResult();
10172                            }
10173                            catch (Exception e) {
10174                                    throw processException(e);
10175                            }
10176                            finally {
10177                                    if (count == null) {
10178                                            count = Long.valueOf(0);
10179                                    }
10180    
10181                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_U, finderArgs,
10182                                            count);
10183    
10184                                    closeSession(session);
10185                            }
10186                    }
10187    
10188                    return count.intValue();
10189            }
10190    
10191            /**
10192             * Returns the number of blogs entries where companyId = &#63; and displayDate &lt; &#63;.
10193             *
10194             * @param companyId the company ID
10195             * @param displayDate the display date
10196             * @return the number of matching blogs entries
10197             * @throws SystemException if a system exception occurred
10198             */
10199            public int countByC_LtD(long companyId, Date displayDate)
10200                    throws SystemException {
10201                    Object[] finderArgs = new Object[] { companyId, displayDate };
10202    
10203                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_LTD,
10204                                    finderArgs, this);
10205    
10206                    if (count == null) {
10207                            StringBundler query = new StringBundler(3);
10208    
10209                            query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
10210    
10211                            query.append(_FINDER_COLUMN_C_LTD_COMPANYID_2);
10212    
10213                            if (displayDate == null) {
10214                                    query.append(_FINDER_COLUMN_C_LTD_DISPLAYDATE_1);
10215                            }
10216                            else {
10217                                    query.append(_FINDER_COLUMN_C_LTD_DISPLAYDATE_2);
10218                            }
10219    
10220                            String sql = query.toString();
10221    
10222                            Session session = null;
10223    
10224                            try {
10225                                    session = openSession();
10226    
10227                                    Query q = session.createQuery(sql);
10228    
10229                                    QueryPos qPos = QueryPos.getInstance(q);
10230    
10231                                    qPos.add(companyId);
10232    
10233                                    if (displayDate != null) {
10234                                            qPos.add(CalendarUtil.getTimestamp(displayDate));
10235                                    }
10236    
10237                                    count = (Long)q.uniqueResult();
10238                            }
10239                            catch (Exception e) {
10240                                    throw processException(e);
10241                            }
10242                            finally {
10243                                    if (count == null) {
10244                                            count = Long.valueOf(0);
10245                                    }
10246    
10247                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_LTD,
10248                                            finderArgs, count);
10249    
10250                                    closeSession(session);
10251                            }
10252                    }
10253    
10254                    return count.intValue();
10255            }
10256    
10257            /**
10258             * Returns the number of blogs entries where companyId = &#63; and status = &#63;.
10259             *
10260             * @param companyId the company ID
10261             * @param status the status
10262             * @return the number of matching blogs entries
10263             * @throws SystemException if a system exception occurred
10264             */
10265            public int countByC_S(long companyId, int status) throws SystemException {
10266                    Object[] finderArgs = new Object[] { companyId, status };
10267    
10268                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_S,
10269                                    finderArgs, this);
10270    
10271                    if (count == null) {
10272                            StringBundler query = new StringBundler(3);
10273    
10274                            query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
10275    
10276                            query.append(_FINDER_COLUMN_C_S_COMPANYID_2);
10277    
10278                            query.append(_FINDER_COLUMN_C_S_STATUS_2);
10279    
10280                            String sql = query.toString();
10281    
10282                            Session session = null;
10283    
10284                            try {
10285                                    session = openSession();
10286    
10287                                    Query q = session.createQuery(sql);
10288    
10289                                    QueryPos qPos = QueryPos.getInstance(q);
10290    
10291                                    qPos.add(companyId);
10292    
10293                                    qPos.add(status);
10294    
10295                                    count = (Long)q.uniqueResult();
10296                            }
10297                            catch (Exception e) {
10298                                    throw processException(e);
10299                            }
10300                            finally {
10301                                    if (count == null) {
10302                                            count = Long.valueOf(0);
10303                                    }
10304    
10305                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_S, finderArgs,
10306                                            count);
10307    
10308                                    closeSession(session);
10309                            }
10310                    }
10311    
10312                    return count.intValue();
10313            }
10314    
10315            /**
10316             * Returns the number of blogs entries where groupId = &#63; and urlTitle = &#63;.
10317             *
10318             * @param groupId the group ID
10319             * @param urlTitle the url title
10320             * @return the number of matching blogs entries
10321             * @throws SystemException if a system exception occurred
10322             */
10323            public int countByG_UT(long groupId, String urlTitle)
10324                    throws SystemException {
10325                    Object[] finderArgs = new Object[] { groupId, urlTitle };
10326    
10327                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_UT,
10328                                    finderArgs, this);
10329    
10330                    if (count == null) {
10331                            StringBundler query = new StringBundler(3);
10332    
10333                            query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
10334    
10335                            query.append(_FINDER_COLUMN_G_UT_GROUPID_2);
10336    
10337                            if (urlTitle == null) {
10338                                    query.append(_FINDER_COLUMN_G_UT_URLTITLE_1);
10339                            }
10340                            else {
10341                                    if (urlTitle.equals(StringPool.BLANK)) {
10342                                            query.append(_FINDER_COLUMN_G_UT_URLTITLE_3);
10343                                    }
10344                                    else {
10345                                            query.append(_FINDER_COLUMN_G_UT_URLTITLE_2);
10346                                    }
10347                            }
10348    
10349                            String sql = query.toString();
10350    
10351                            Session session = null;
10352    
10353                            try {
10354                                    session = openSession();
10355    
10356                                    Query q = session.createQuery(sql);
10357    
10358                                    QueryPos qPos = QueryPos.getInstance(q);
10359    
10360                                    qPos.add(groupId);
10361    
10362                                    if (urlTitle != null) {
10363                                            qPos.add(urlTitle);
10364                                    }
10365    
10366                                    count = (Long)q.uniqueResult();
10367                            }
10368                            catch (Exception e) {
10369                                    throw processException(e);
10370                            }
10371                            finally {
10372                                    if (count == null) {
10373                                            count = Long.valueOf(0);
10374                                    }
10375    
10376                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_UT,
10377                                            finderArgs, count);
10378    
10379                                    closeSession(session);
10380                            }
10381                    }
10382    
10383                    return count.intValue();
10384            }
10385    
10386            /**
10387             * Returns the number of blogs entries where groupId = &#63; and displayDate &lt; &#63;.
10388             *
10389             * @param groupId the group ID
10390             * @param displayDate the display date
10391             * @return the number of matching blogs entries
10392             * @throws SystemException if a system exception occurred
10393             */
10394            public int countByG_LtD(long groupId, Date displayDate)
10395                    throws SystemException {
10396                    Object[] finderArgs = new Object[] { groupId, displayDate };
10397    
10398                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_LTD,
10399                                    finderArgs, this);
10400    
10401                    if (count == null) {
10402                            StringBundler query = new StringBundler(3);
10403    
10404                            query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
10405    
10406                            query.append(_FINDER_COLUMN_G_LTD_GROUPID_2);
10407    
10408                            if (displayDate == null) {
10409                                    query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_1);
10410                            }
10411                            else {
10412                                    query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_2);
10413                            }
10414    
10415                            String sql = query.toString();
10416    
10417                            Session session = null;
10418    
10419                            try {
10420                                    session = openSession();
10421    
10422                                    Query q = session.createQuery(sql);
10423    
10424                                    QueryPos qPos = QueryPos.getInstance(q);
10425    
10426                                    qPos.add(groupId);
10427    
10428                                    if (displayDate != null) {
10429                                            qPos.add(CalendarUtil.getTimestamp(displayDate));
10430                                    }
10431    
10432                                    count = (Long)q.uniqueResult();
10433                            }
10434                            catch (Exception e) {
10435                                    throw processException(e);
10436                            }
10437                            finally {
10438                                    if (count == null) {
10439                                            count = Long.valueOf(0);
10440                                    }
10441    
10442                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_LTD,
10443                                            finderArgs, count);
10444    
10445                                    closeSession(session);
10446                            }
10447                    }
10448    
10449                    return count.intValue();
10450            }
10451    
10452            /**
10453             * Returns the number of blogs entries that the user has permission to view where groupId = &#63; and displayDate &lt; &#63;.
10454             *
10455             * @param groupId the group ID
10456             * @param displayDate the display date
10457             * @return the number of matching blogs entries that the user has permission to view
10458             * @throws SystemException if a system exception occurred
10459             */
10460            public int filterCountByG_LtD(long groupId, Date displayDate)
10461                    throws SystemException {
10462                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
10463                            return countByG_LtD(groupId, displayDate);
10464                    }
10465    
10466                    StringBundler query = new StringBundler(3);
10467    
10468                    query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE);
10469    
10470                    query.append(_FINDER_COLUMN_G_LTD_GROUPID_2);
10471    
10472                    if (displayDate == null) {
10473                            query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_1);
10474                    }
10475                    else {
10476                            query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_2);
10477                    }
10478    
10479                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
10480                                    BlogsEntry.class.getName(),
10481                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
10482    
10483                    Session session = null;
10484    
10485                    try {
10486                            session = openSession();
10487    
10488                            SQLQuery q = session.createSQLQuery(sql);
10489    
10490                            q.addScalar(COUNT_COLUMN_NAME,
10491                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
10492    
10493                            QueryPos qPos = QueryPos.getInstance(q);
10494    
10495                            qPos.add(groupId);
10496    
10497                            if (displayDate != null) {
10498                                    qPos.add(CalendarUtil.getTimestamp(displayDate));
10499                            }
10500    
10501                            Long count = (Long)q.uniqueResult();
10502    
10503                            return count.intValue();
10504                    }
10505                    catch (Exception e) {
10506                            throw processException(e);
10507                    }
10508                    finally {
10509                            closeSession(session);
10510                    }
10511            }
10512    
10513            /**
10514             * Returns the number of blogs entries where groupId = &#63; and status = &#63;.
10515             *
10516             * @param groupId the group ID
10517             * @param status the status
10518             * @return the number of matching blogs entries
10519             * @throws SystemException if a system exception occurred
10520             */
10521            public int countByG_S(long groupId, int status) throws SystemException {
10522                    Object[] finderArgs = new Object[] { groupId, status };
10523    
10524                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_S,
10525                                    finderArgs, this);
10526    
10527                    if (count == null) {
10528                            StringBundler query = new StringBundler(3);
10529    
10530                            query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
10531    
10532                            query.append(_FINDER_COLUMN_G_S_GROUPID_2);
10533    
10534                            query.append(_FINDER_COLUMN_G_S_STATUS_2);
10535    
10536                            String sql = query.toString();
10537    
10538                            Session session = null;
10539    
10540                            try {
10541                                    session = openSession();
10542    
10543                                    Query q = session.createQuery(sql);
10544    
10545                                    QueryPos qPos = QueryPos.getInstance(q);
10546    
10547                                    qPos.add(groupId);
10548    
10549                                    qPos.add(status);
10550    
10551                                    count = (Long)q.uniqueResult();
10552                            }
10553                            catch (Exception e) {
10554                                    throw processException(e);
10555                            }
10556                            finally {
10557                                    if (count == null) {
10558                                            count = Long.valueOf(0);
10559                                    }
10560    
10561                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_S, finderArgs,
10562                                            count);
10563    
10564                                    closeSession(session);
10565                            }
10566                    }
10567    
10568                    return count.intValue();
10569            }
10570    
10571            /**
10572             * Returns the number of blogs entries that the user has permission to view where groupId = &#63; and status = &#63;.
10573             *
10574             * @param groupId the group ID
10575             * @param status the status
10576             * @return the number of matching blogs entries that the user has permission to view
10577             * @throws SystemException if a system exception occurred
10578             */
10579            public int filterCountByG_S(long groupId, int status)
10580                    throws SystemException {
10581                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
10582                            return countByG_S(groupId, status);
10583                    }
10584    
10585                    StringBundler query = new StringBundler(3);
10586    
10587                    query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE);
10588    
10589                    query.append(_FINDER_COLUMN_G_S_GROUPID_2);
10590    
10591                    query.append(_FINDER_COLUMN_G_S_STATUS_2);
10592    
10593                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
10594                                    BlogsEntry.class.getName(),
10595                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
10596    
10597                    Session session = null;
10598    
10599                    try {
10600                            session = openSession();
10601    
10602                            SQLQuery q = session.createSQLQuery(sql);
10603    
10604                            q.addScalar(COUNT_COLUMN_NAME,
10605                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
10606    
10607                            QueryPos qPos = QueryPos.getInstance(q);
10608    
10609                            qPos.add(groupId);
10610    
10611                            qPos.add(status);
10612    
10613                            Long count = (Long)q.uniqueResult();
10614    
10615                            return count.intValue();
10616                    }
10617                    catch (Exception e) {
10618                            throw processException(e);
10619                    }
10620                    finally {
10621                            closeSession(session);
10622                    }
10623            }
10624    
10625            /**
10626             * Returns the number of blogs entries where companyId = &#63; and userId = &#63; and status = &#63;.
10627             *
10628             * @param companyId the company ID
10629             * @param userId the user ID
10630             * @param status the status
10631             * @return the number of matching blogs entries
10632             * @throws SystemException if a system exception occurred
10633             */
10634            public int countByC_U_S(long companyId, long userId, int status)
10635                    throws SystemException {
10636                    Object[] finderArgs = new Object[] { companyId, userId, status };
10637    
10638                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_U_S,
10639                                    finderArgs, this);
10640    
10641                    if (count == null) {
10642                            StringBundler query = new StringBundler(4);
10643    
10644                            query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
10645    
10646                            query.append(_FINDER_COLUMN_C_U_S_COMPANYID_2);
10647    
10648                            query.append(_FINDER_COLUMN_C_U_S_USERID_2);
10649    
10650                            query.append(_FINDER_COLUMN_C_U_S_STATUS_2);
10651    
10652                            String sql = query.toString();
10653    
10654                            Session session = null;
10655    
10656                            try {
10657                                    session = openSession();
10658    
10659                                    Query q = session.createQuery(sql);
10660    
10661                                    QueryPos qPos = QueryPos.getInstance(q);
10662    
10663                                    qPos.add(companyId);
10664    
10665                                    qPos.add(userId);
10666    
10667                                    qPos.add(status);
10668    
10669                                    count = (Long)q.uniqueResult();
10670                            }
10671                            catch (Exception e) {
10672                                    throw processException(e);
10673                            }
10674                            finally {
10675                                    if (count == null) {
10676                                            count = Long.valueOf(0);
10677                                    }
10678    
10679                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_U_S,
10680                                            finderArgs, count);
10681    
10682                                    closeSession(session);
10683                            }
10684                    }
10685    
10686                    return count.intValue();
10687            }
10688    
10689            /**
10690             * Returns the number of blogs entries where companyId = &#63; and displayDate &lt; &#63; and status = &#63;.
10691             *
10692             * @param companyId the company ID
10693             * @param displayDate the display date
10694             * @param status the status
10695             * @return the number of matching blogs entries
10696             * @throws SystemException if a system exception occurred
10697             */
10698            public int countByC_LtD_S(long companyId, Date displayDate, int status)
10699                    throws SystemException {
10700                    Object[] finderArgs = new Object[] { companyId, displayDate, status };
10701    
10702                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_LTD_S,
10703                                    finderArgs, this);
10704    
10705                    if (count == null) {
10706                            StringBundler query = new StringBundler(4);
10707    
10708                            query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
10709    
10710                            query.append(_FINDER_COLUMN_C_LTD_S_COMPANYID_2);
10711    
10712                            if (displayDate == null) {
10713                                    query.append(_FINDER_COLUMN_C_LTD_S_DISPLAYDATE_1);
10714                            }
10715                            else {
10716                                    query.append(_FINDER_COLUMN_C_LTD_S_DISPLAYDATE_2);
10717                            }
10718    
10719                            query.append(_FINDER_COLUMN_C_LTD_S_STATUS_2);
10720    
10721                            String sql = query.toString();
10722    
10723                            Session session = null;
10724    
10725                            try {
10726                                    session = openSession();
10727    
10728                                    Query q = session.createQuery(sql);
10729    
10730                                    QueryPos qPos = QueryPos.getInstance(q);
10731    
10732                                    qPos.add(companyId);
10733    
10734                                    if (displayDate != null) {
10735                                            qPos.add(CalendarUtil.getTimestamp(displayDate));
10736                                    }
10737    
10738                                    qPos.add(status);
10739    
10740                                    count = (Long)q.uniqueResult();
10741                            }
10742                            catch (Exception e) {
10743                                    throw processException(e);
10744                            }
10745                            finally {
10746                                    if (count == null) {
10747                                            count = Long.valueOf(0);
10748                                    }
10749    
10750                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_LTD_S,
10751                                            finderArgs, count);
10752    
10753                                    closeSession(session);
10754                            }
10755                    }
10756    
10757                    return count.intValue();
10758            }
10759    
10760            /**
10761             * Returns the number of blogs entries where groupId = &#63; and userId = &#63; and displayDate &lt; &#63;.
10762             *
10763             * @param groupId the group ID
10764             * @param userId the user ID
10765             * @param displayDate the display date
10766             * @return the number of matching blogs entries
10767             * @throws SystemException if a system exception occurred
10768             */
10769            public int countByG_U_LtD(long groupId, long userId, Date displayDate)
10770                    throws SystemException {
10771                    Object[] finderArgs = new Object[] { groupId, userId, displayDate };
10772    
10773                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_U_LTD,
10774                                    finderArgs, this);
10775    
10776                    if (count == null) {
10777                            StringBundler query = new StringBundler(4);
10778    
10779                            query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
10780    
10781                            query.append(_FINDER_COLUMN_G_U_LTD_GROUPID_2);
10782    
10783                            query.append(_FINDER_COLUMN_G_U_LTD_USERID_2);
10784    
10785                            if (displayDate == null) {
10786                                    query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_1);
10787                            }
10788                            else {
10789                                    query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_2);
10790                            }
10791    
10792                            String sql = query.toString();
10793    
10794                            Session session = null;
10795    
10796                            try {
10797                                    session = openSession();
10798    
10799                                    Query q = session.createQuery(sql);
10800    
10801                                    QueryPos qPos = QueryPos.getInstance(q);
10802    
10803                                    qPos.add(groupId);
10804    
10805                                    qPos.add(userId);
10806    
10807                                    if (displayDate != null) {
10808                                            qPos.add(CalendarUtil.getTimestamp(displayDate));
10809                                    }
10810    
10811                                    count = (Long)q.uniqueResult();
10812                            }
10813                            catch (Exception e) {
10814                                    throw processException(e);
10815                            }
10816                            finally {
10817                                    if (count == null) {
10818                                            count = Long.valueOf(0);
10819                                    }
10820    
10821                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_U_LTD,
10822                                            finderArgs, count);
10823    
10824                                    closeSession(session);
10825                            }
10826                    }
10827    
10828                    return count.intValue();
10829            }
10830    
10831            /**
10832             * Returns the number of blogs entries that the user has permission to view where groupId = &#63; and userId = &#63; and displayDate &lt; &#63;.
10833             *
10834             * @param groupId the group ID
10835             * @param userId the user ID
10836             * @param displayDate the display date
10837             * @return the number of matching blogs entries that the user has permission to view
10838             * @throws SystemException if a system exception occurred
10839             */
10840            public int filterCountByG_U_LtD(long groupId, long userId, Date displayDate)
10841                    throws SystemException {
10842                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
10843                            return countByG_U_LtD(groupId, userId, displayDate);
10844                    }
10845    
10846                    StringBundler query = new StringBundler(4);
10847    
10848                    query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE);
10849    
10850                    query.append(_FINDER_COLUMN_G_U_LTD_GROUPID_2);
10851    
10852                    query.append(_FINDER_COLUMN_G_U_LTD_USERID_2);
10853    
10854                    if (displayDate == null) {
10855                            query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_1);
10856                    }
10857                    else {
10858                            query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_2);
10859                    }
10860    
10861                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
10862                                    BlogsEntry.class.getName(),
10863                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
10864    
10865                    Session session = null;
10866    
10867                    try {
10868                            session = openSession();
10869    
10870                            SQLQuery q = session.createSQLQuery(sql);
10871    
10872                            q.addScalar(COUNT_COLUMN_NAME,
10873                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
10874    
10875                            QueryPos qPos = QueryPos.getInstance(q);
10876    
10877                            qPos.add(groupId);
10878    
10879                            qPos.add(userId);
10880    
10881                            if (displayDate != null) {
10882                                    qPos.add(CalendarUtil.getTimestamp(displayDate));
10883                            }
10884    
10885                            Long count = (Long)q.uniqueResult();
10886    
10887                            return count.intValue();
10888                    }
10889                    catch (Exception e) {
10890                            throw processException(e);
10891                    }
10892                    finally {
10893                            closeSession(session);
10894                    }
10895            }
10896    
10897            /**
10898             * Returns the number of blogs entries where groupId = &#63; and userId = &#63; and status = &#63;.
10899             *
10900             * @param groupId the group ID
10901             * @param userId the user ID
10902             * @param status the status
10903             * @return the number of matching blogs entries
10904             * @throws SystemException if a system exception occurred
10905             */
10906            public int countByG_U_S(long groupId, long userId, int status)
10907                    throws SystemException {
10908                    Object[] finderArgs = new Object[] { groupId, userId, status };
10909    
10910                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_U_S,
10911                                    finderArgs, this);
10912    
10913                    if (count == null) {
10914                            StringBundler query = new StringBundler(4);
10915    
10916                            query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
10917    
10918                            query.append(_FINDER_COLUMN_G_U_S_GROUPID_2);
10919    
10920                            query.append(_FINDER_COLUMN_G_U_S_USERID_2);
10921    
10922                            query.append(_FINDER_COLUMN_G_U_S_STATUS_2);
10923    
10924                            String sql = query.toString();
10925    
10926                            Session session = null;
10927    
10928                            try {
10929                                    session = openSession();
10930    
10931                                    Query q = session.createQuery(sql);
10932    
10933                                    QueryPos qPos = QueryPos.getInstance(q);
10934    
10935                                    qPos.add(groupId);
10936    
10937                                    qPos.add(userId);
10938    
10939                                    qPos.add(status);
10940    
10941                                    count = (Long)q.uniqueResult();
10942                            }
10943                            catch (Exception e) {
10944                                    throw processException(e);
10945                            }
10946                            finally {
10947                                    if (count == null) {
10948                                            count = Long.valueOf(0);
10949                                    }
10950    
10951                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_U_S,
10952                                            finderArgs, count);
10953    
10954                                    closeSession(session);
10955                            }
10956                    }
10957    
10958                    return count.intValue();
10959            }
10960    
10961            /**
10962             * Returns the number of blogs entries that the user has permission to view where groupId = &#63; and userId = &#63; and status = &#63;.
10963             *
10964             * @param groupId the group ID
10965             * @param userId the user ID
10966             * @param status the status
10967             * @return the number of matching blogs entries that the user has permission to view
10968             * @throws SystemException if a system exception occurred
10969             */
10970            public int filterCountByG_U_S(long groupId, long userId, int status)
10971                    throws SystemException {
10972                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
10973                            return countByG_U_S(groupId, userId, status);
10974                    }
10975    
10976                    StringBundler query = new StringBundler(4);
10977    
10978                    query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE);
10979    
10980                    query.append(_FINDER_COLUMN_G_U_S_GROUPID_2);
10981    
10982                    query.append(_FINDER_COLUMN_G_U_S_USERID_2);
10983    
10984                    query.append(_FINDER_COLUMN_G_U_S_STATUS_2);
10985    
10986                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
10987                                    BlogsEntry.class.getName(),
10988                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
10989    
10990                    Session session = null;
10991    
10992                    try {
10993                            session = openSession();
10994    
10995                            SQLQuery q = session.createSQLQuery(sql);
10996    
10997                            q.addScalar(COUNT_COLUMN_NAME,
10998                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
10999    
11000                            QueryPos qPos = QueryPos.getInstance(q);
11001    
11002                            qPos.add(groupId);
11003    
11004                            qPos.add(userId);
11005    
11006                            qPos.add(status);
11007    
11008                            Long count = (Long)q.uniqueResult();
11009    
11010                            return count.intValue();
11011                    }
11012                    catch (Exception e) {
11013                            throw processException(e);
11014                    }
11015                    finally {
11016                            closeSession(session);
11017                    }
11018            }
11019    
11020            /**
11021             * Returns the number of blogs entries where groupId = &#63; and displayDate &lt; &#63; and status = &#63;.
11022             *
11023             * @param groupId the group ID
11024             * @param displayDate the display date
11025             * @param status the status
11026             * @return the number of matching blogs entries
11027             * @throws SystemException if a system exception occurred
11028             */
11029            public int countByG_LtD_S(long groupId, Date displayDate, int status)
11030                    throws SystemException {
11031                    Object[] finderArgs = new Object[] { groupId, displayDate, status };
11032    
11033                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_LTD_S,
11034                                    finderArgs, this);
11035    
11036                    if (count == null) {
11037                            StringBundler query = new StringBundler(4);
11038    
11039                            query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
11040    
11041                            query.append(_FINDER_COLUMN_G_LTD_S_GROUPID_2);
11042    
11043                            if (displayDate == null) {
11044                                    query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_1);
11045                            }
11046                            else {
11047                                    query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_2);
11048                            }
11049    
11050                            query.append(_FINDER_COLUMN_G_LTD_S_STATUS_2);
11051    
11052                            String sql = query.toString();
11053    
11054                            Session session = null;
11055    
11056                            try {
11057                                    session = openSession();
11058    
11059                                    Query q = session.createQuery(sql);
11060    
11061                                    QueryPos qPos = QueryPos.getInstance(q);
11062    
11063                                    qPos.add(groupId);
11064    
11065                                    if (displayDate != null) {
11066                                            qPos.add(CalendarUtil.getTimestamp(displayDate));
11067                                    }
11068    
11069                                    qPos.add(status);
11070    
11071                                    count = (Long)q.uniqueResult();
11072                            }
11073                            catch (Exception e) {
11074                                    throw processException(e);
11075                            }
11076                            finally {
11077                                    if (count == null) {
11078                                            count = Long.valueOf(0);
11079                                    }
11080    
11081                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_LTD_S,
11082                                            finderArgs, count);
11083    
11084                                    closeSession(session);
11085                            }
11086                    }
11087    
11088                    return count.intValue();
11089            }
11090    
11091            /**
11092             * Returns the number of blogs entries that the user has permission to view where groupId = &#63; and displayDate &lt; &#63; and status = &#63;.
11093             *
11094             * @param groupId the group ID
11095             * @param displayDate the display date
11096             * @param status the status
11097             * @return the number of matching blogs entries that the user has permission to view
11098             * @throws SystemException if a system exception occurred
11099             */
11100            public int filterCountByG_LtD_S(long groupId, Date displayDate, int status)
11101                    throws SystemException {
11102                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
11103                            return countByG_LtD_S(groupId, displayDate, status);
11104                    }
11105    
11106                    StringBundler query = new StringBundler(4);
11107    
11108                    query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE);
11109    
11110                    query.append(_FINDER_COLUMN_G_LTD_S_GROUPID_2);
11111    
11112                    if (displayDate == null) {
11113                            query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_1);
11114                    }
11115                    else {
11116                            query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_2);
11117                    }
11118    
11119                    query.append(_FINDER_COLUMN_G_LTD_S_STATUS_2);
11120    
11121                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
11122                                    BlogsEntry.class.getName(),
11123                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
11124    
11125                    Session session = null;
11126    
11127                    try {
11128                            session = openSession();
11129    
11130                            SQLQuery q = session.createSQLQuery(sql);
11131    
11132                            q.addScalar(COUNT_COLUMN_NAME,
11133                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
11134    
11135                            QueryPos qPos = QueryPos.getInstance(q);
11136    
11137                            qPos.add(groupId);
11138    
11139                            if (displayDate != null) {
11140                                    qPos.add(CalendarUtil.getTimestamp(displayDate));
11141                            }
11142    
11143                            qPos.add(status);
11144    
11145                            Long count = (Long)q.uniqueResult();
11146    
11147                            return count.intValue();
11148                    }
11149                    catch (Exception e) {
11150                            throw processException(e);
11151                    }
11152                    finally {
11153                            closeSession(session);
11154                    }
11155            }
11156    
11157            /**
11158             * Returns the number of blogs entries where groupId = &#63; and userId = &#63; and displayDate &lt; &#63; and status = &#63;.
11159             *
11160             * @param groupId the group ID
11161             * @param userId the user ID
11162             * @param displayDate the display date
11163             * @param status the status
11164             * @return the number of matching blogs entries
11165             * @throws SystemException if a system exception occurred
11166             */
11167            public int countByG_U_LtD_S(long groupId, long userId, Date displayDate,
11168                    int status) throws SystemException {
11169                    Object[] finderArgs = new Object[] { groupId, userId, displayDate, status };
11170    
11171                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_U_LTD_S,
11172                                    finderArgs, this);
11173    
11174                    if (count == null) {
11175                            StringBundler query = new StringBundler(5);
11176    
11177                            query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
11178    
11179                            query.append(_FINDER_COLUMN_G_U_LTD_S_GROUPID_2);
11180    
11181                            query.append(_FINDER_COLUMN_G_U_LTD_S_USERID_2);
11182    
11183                            if (displayDate == null) {
11184                                    query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_1);
11185                            }
11186                            else {
11187                                    query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_2);
11188                            }
11189    
11190                            query.append(_FINDER_COLUMN_G_U_LTD_S_STATUS_2);
11191    
11192                            String sql = query.toString();
11193    
11194                            Session session = null;
11195    
11196                            try {
11197                                    session = openSession();
11198    
11199                                    Query q = session.createQuery(sql);
11200    
11201                                    QueryPos qPos = QueryPos.getInstance(q);
11202    
11203                                    qPos.add(groupId);
11204    
11205                                    qPos.add(userId);
11206    
11207                                    if (displayDate != null) {
11208                                            qPos.add(CalendarUtil.getTimestamp(displayDate));
11209                                    }
11210    
11211                                    qPos.add(status);
11212    
11213                                    count = (Long)q.uniqueResult();
11214                            }
11215                            catch (Exception e) {
11216                                    throw processException(e);
11217                            }
11218                            finally {
11219                                    if (count == null) {
11220                                            count = Long.valueOf(0);
11221                                    }
11222    
11223                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_U_LTD_S,
11224                                            finderArgs, count);
11225    
11226                                    closeSession(session);
11227                            }
11228                    }
11229    
11230                    return count.intValue();
11231            }
11232    
11233            /**
11234             * Returns the number of blogs entries that the user has permission to view where groupId = &#63; and userId = &#63; and displayDate &lt; &#63; and status = &#63;.
11235             *
11236             * @param groupId the group ID
11237             * @param userId the user ID
11238             * @param displayDate the display date
11239             * @param status the status
11240             * @return the number of matching blogs entries that the user has permission to view
11241             * @throws SystemException if a system exception occurred
11242             */
11243            public int filterCountByG_U_LtD_S(long groupId, long userId,
11244                    Date displayDate, int status) throws SystemException {
11245                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
11246                            return countByG_U_LtD_S(groupId, userId, displayDate, status);
11247                    }
11248    
11249                    StringBundler query = new StringBundler(5);
11250    
11251                    query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE);
11252    
11253                    query.append(_FINDER_COLUMN_G_U_LTD_S_GROUPID_2);
11254    
11255                    query.append(_FINDER_COLUMN_G_U_LTD_S_USERID_2);
11256    
11257                    if (displayDate == null) {
11258                            query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_1);
11259                    }
11260                    else {
11261                            query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_2);
11262                    }
11263    
11264                    query.append(_FINDER_COLUMN_G_U_LTD_S_STATUS_2);
11265    
11266                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
11267                                    BlogsEntry.class.getName(),
11268                                    _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
11269    
11270                    Session session = null;
11271    
11272                    try {
11273                            session = openSession();
11274    
11275                            SQLQuery q = session.createSQLQuery(sql);
11276    
11277                            q.addScalar(COUNT_COLUMN_NAME,
11278                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
11279    
11280                            QueryPos qPos = QueryPos.getInstance(q);
11281    
11282                            qPos.add(groupId);
11283    
11284                            qPos.add(userId);
11285    
11286                            if (displayDate != null) {
11287                                    qPos.add(CalendarUtil.getTimestamp(displayDate));
11288                            }
11289    
11290                            qPos.add(status);
11291    
11292                            Long count = (Long)q.uniqueResult();
11293    
11294                            return count.intValue();
11295                    }
11296                    catch (Exception e) {
11297                            throw processException(e);
11298                    }
11299                    finally {
11300                            closeSession(session);
11301                    }
11302            }
11303    
11304            /**
11305             * Returns the number of blogs entries.
11306             *
11307             * @return the number of blogs entries
11308             * @throws SystemException if a system exception occurred
11309             */
11310            public int countAll() throws SystemException {
11311                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
11312                                    FINDER_ARGS_EMPTY, this);
11313    
11314                    if (count == null) {
11315                            Session session = null;
11316    
11317                            try {
11318                                    session = openSession();
11319    
11320                                    Query q = session.createQuery(_SQL_COUNT_BLOGSENTRY);
11321    
11322                                    count = (Long)q.uniqueResult();
11323                            }
11324                            catch (Exception e) {
11325                                    throw processException(e);
11326                            }
11327                            finally {
11328                                    if (count == null) {
11329                                            count = Long.valueOf(0);
11330                                    }
11331    
11332                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
11333                                            FINDER_ARGS_EMPTY, count);
11334    
11335                                    closeSession(session);
11336                            }
11337                    }
11338    
11339                    return count.intValue();
11340            }
11341    
11342            /**
11343             * Initializes the blogs entry persistence.
11344             */
11345            public void afterPropertiesSet() {
11346                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
11347                                            com.liferay.portal.util.PropsUtil.get(
11348                                                    "value.object.listener.com.liferay.portlet.blogs.model.BlogsEntry")));
11349    
11350                    if (listenerClassNames.length > 0) {
11351                            try {
11352                                    List<ModelListener<BlogsEntry>> listenersList = new ArrayList<ModelListener<BlogsEntry>>();
11353    
11354                                    for (String listenerClassName : listenerClassNames) {
11355                                            listenersList.add((ModelListener<BlogsEntry>)InstanceFactory.newInstance(
11356                                                            listenerClassName));
11357                                    }
11358    
11359                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
11360                            }
11361                            catch (Exception e) {
11362                                    _log.error(e);
11363                            }
11364                    }
11365            }
11366    
11367            public void destroy() {
11368                    EntityCacheUtil.removeCache(BlogsEntryImpl.class.getName());
11369                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
11370                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
11371            }
11372    
11373            @BeanReference(type = BlogsEntryPersistence.class)
11374            protected BlogsEntryPersistence blogsEntryPersistence;
11375            @BeanReference(type = BlogsStatsUserPersistence.class)
11376            protected BlogsStatsUserPersistence blogsStatsUserPersistence;
11377            @BeanReference(type = CompanyPersistence.class)
11378            protected CompanyPersistence companyPersistence;
11379            @BeanReference(type = GroupPersistence.class)
11380            protected GroupPersistence groupPersistence;
11381            @BeanReference(type = ImagePersistence.class)
11382            protected ImagePersistence imagePersistence;
11383            @BeanReference(type = OrganizationPersistence.class)
11384            protected OrganizationPersistence organizationPersistence;
11385            @BeanReference(type = PortletPreferencesPersistence.class)
11386            protected PortletPreferencesPersistence portletPreferencesPersistence;
11387            @BeanReference(type = ResourcePersistence.class)
11388            protected ResourcePersistence resourcePersistence;
11389            @BeanReference(type = SubscriptionPersistence.class)
11390            protected SubscriptionPersistence subscriptionPersistence;
11391            @BeanReference(type = UserPersistence.class)
11392            protected UserPersistence userPersistence;
11393            @BeanReference(type = WorkflowInstanceLinkPersistence.class)
11394            protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
11395            @BeanReference(type = AssetEntryPersistence.class)
11396            protected AssetEntryPersistence assetEntryPersistence;
11397            @BeanReference(type = AssetLinkPersistence.class)
11398            protected AssetLinkPersistence assetLinkPersistence;
11399            @BeanReference(type = AssetTagPersistence.class)
11400            protected AssetTagPersistence assetTagPersistence;
11401            @BeanReference(type = ExpandoValuePersistence.class)
11402            protected ExpandoValuePersistence expandoValuePersistence;
11403            @BeanReference(type = MBMessagePersistence.class)
11404            protected MBMessagePersistence mbMessagePersistence;
11405            @BeanReference(type = RatingsStatsPersistence.class)
11406            protected RatingsStatsPersistence ratingsStatsPersistence;
11407            @BeanReference(type = SocialActivityPersistence.class)
11408            protected SocialActivityPersistence socialActivityPersistence;
11409            private static final String _SQL_SELECT_BLOGSENTRY = "SELECT blogsEntry FROM BlogsEntry blogsEntry";
11410            private static final String _SQL_SELECT_BLOGSENTRY_WHERE = "SELECT blogsEntry FROM BlogsEntry blogsEntry WHERE ";
11411            private static final String _SQL_COUNT_BLOGSENTRY = "SELECT COUNT(blogsEntry) FROM BlogsEntry blogsEntry";
11412            private static final String _SQL_COUNT_BLOGSENTRY_WHERE = "SELECT COUNT(blogsEntry) FROM BlogsEntry blogsEntry WHERE ";
11413            private static final String _FINDER_COLUMN_UUID_UUID_1 = "blogsEntry.uuid IS NULL";
11414            private static final String _FINDER_COLUMN_UUID_UUID_2 = "blogsEntry.uuid = ?";
11415            private static final String _FINDER_COLUMN_UUID_UUID_3 = "(blogsEntry.uuid IS NULL OR blogsEntry.uuid = ?)";
11416            private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "blogsEntry.uuid IS NULL AND ";
11417            private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "blogsEntry.uuid = ? AND ";
11418            private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(blogsEntry.uuid IS NULL OR blogsEntry.uuid = ?) AND ";
11419            private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "blogsEntry.groupId = ?";
11420            private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "blogsEntry.groupId = ?";
11421            private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "blogsEntry.companyId = ?";
11422            private static final String _FINDER_COLUMN_C_U_COMPANYID_2 = "blogsEntry.companyId = ? AND ";
11423            private static final String _FINDER_COLUMN_C_U_USERID_2 = "blogsEntry.userId = ?";
11424            private static final String _FINDER_COLUMN_C_LTD_COMPANYID_2 = "blogsEntry.companyId = ? AND ";
11425            private static final String _FINDER_COLUMN_C_LTD_DISPLAYDATE_1 = "blogsEntry.displayDate < NULL";
11426            private static final String _FINDER_COLUMN_C_LTD_DISPLAYDATE_2 = "blogsEntry.displayDate < ?";
11427            private static final String _FINDER_COLUMN_C_S_COMPANYID_2 = "blogsEntry.companyId = ? AND ";
11428            private static final String _FINDER_COLUMN_C_S_STATUS_2 = "blogsEntry.status = ?";
11429            private static final String _FINDER_COLUMN_G_UT_GROUPID_2 = "blogsEntry.groupId = ? AND ";
11430            private static final String _FINDER_COLUMN_G_UT_URLTITLE_1 = "blogsEntry.urlTitle IS NULL";
11431            private static final String _FINDER_COLUMN_G_UT_URLTITLE_2 = "blogsEntry.urlTitle = ?";
11432            private static final String _FINDER_COLUMN_G_UT_URLTITLE_3 = "(blogsEntry.urlTitle IS NULL OR blogsEntry.urlTitle = ?)";
11433            private static final String _FINDER_COLUMN_G_LTD_GROUPID_2 = "blogsEntry.groupId = ? AND ";
11434            private static final String _FINDER_COLUMN_G_LTD_DISPLAYDATE_1 = "blogsEntry.displayDate < NULL";
11435            private static final String _FINDER_COLUMN_G_LTD_DISPLAYDATE_2 = "blogsEntry.displayDate < ?";
11436            private static final String _FINDER_COLUMN_G_S_GROUPID_2 = "blogsEntry.groupId = ? AND ";
11437            private static final String _FINDER_COLUMN_G_S_STATUS_2 = "blogsEntry.status = ?";
11438            private static final String _FINDER_COLUMN_C_U_S_COMPANYID_2 = "blogsEntry.companyId = ? AND ";
11439            private static final String _FINDER_COLUMN_C_U_S_USERID_2 = "blogsEntry.userId = ? AND ";
11440            private static final String _FINDER_COLUMN_C_U_S_STATUS_2 = "blogsEntry.status = ?";
11441            private static final String _FINDER_COLUMN_C_LTD_S_COMPANYID_2 = "blogsEntry.companyId = ? AND ";
11442            private static final String _FINDER_COLUMN_C_LTD_S_DISPLAYDATE_1 = "blogsEntry.displayDate < NULL AND ";
11443            private static final String _FINDER_COLUMN_C_LTD_S_DISPLAYDATE_2 = "blogsEntry.displayDate < ? AND ";
11444            private static final String _FINDER_COLUMN_C_LTD_S_STATUS_2 = "blogsEntry.status = ?";
11445            private static final String _FINDER_COLUMN_G_U_LTD_GROUPID_2 = "blogsEntry.groupId = ? AND ";
11446            private static final String _FINDER_COLUMN_G_U_LTD_USERID_2 = "blogsEntry.userId = ? AND ";
11447            private static final String _FINDER_COLUMN_G_U_LTD_DISPLAYDATE_1 = "blogsEntry.displayDate < NULL";
11448            private static final String _FINDER_COLUMN_G_U_LTD_DISPLAYDATE_2 = "blogsEntry.displayDate < ?";
11449            private static final String _FINDER_COLUMN_G_U_S_GROUPID_2 = "blogsEntry.groupId = ? AND ";
11450            private static final String _FINDER_COLUMN_G_U_S_USERID_2 = "blogsEntry.userId = ? AND ";
11451            private static final String _FINDER_COLUMN_G_U_S_STATUS_2 = "blogsEntry.status = ?";
11452            private static final String _FINDER_COLUMN_G_LTD_S_GROUPID_2 = "blogsEntry.groupId = ? AND ";
11453            private static final String _FINDER_COLUMN_G_LTD_S_DISPLAYDATE_1 = "blogsEntry.displayDate < NULL AND ";
11454            private static final String _FINDER_COLUMN_G_LTD_S_DISPLAYDATE_2 = "blogsEntry.displayDate < ? AND ";
11455            private static final String _FINDER_COLUMN_G_LTD_S_STATUS_2 = "blogsEntry.status = ?";
11456            private static final String _FINDER_COLUMN_G_U_LTD_S_GROUPID_2 = "blogsEntry.groupId = ? AND ";
11457            private static final String _FINDER_COLUMN_G_U_LTD_S_USERID_2 = "blogsEntry.userId = ? AND ";
11458            private static final String _FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_1 = "blogsEntry.displayDate < NULL AND ";
11459            private static final String _FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_2 = "blogsEntry.displayDate < ? AND ";
11460            private static final String _FINDER_COLUMN_G_U_LTD_S_STATUS_2 = "blogsEntry.status = ?";
11461            private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN = "blogsEntry.entryId";
11462            private static final String _FILTER_SQL_SELECT_BLOGSENTRY_WHERE = "SELECT DISTINCT {blogsEntry.*} FROM BlogsEntry blogsEntry WHERE ";
11463            private static final String _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1 =
11464                    "SELECT {BlogsEntry.*} FROM (SELECT DISTINCT blogsEntry.entryId FROM BlogsEntry blogsEntry WHERE ";
11465            private static final String _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2 =
11466                    ") TEMP_TABLE INNER JOIN BlogsEntry ON TEMP_TABLE.entryId = BlogsEntry.entryId";
11467            private static final String _FILTER_SQL_COUNT_BLOGSENTRY_WHERE = "SELECT COUNT(DISTINCT blogsEntry.entryId) AS COUNT_VALUE FROM BlogsEntry blogsEntry WHERE ";
11468            private static final String _FILTER_ENTITY_ALIAS = "blogsEntry";
11469            private static final String _FILTER_ENTITY_TABLE = "BlogsEntry";
11470            private static final String _ORDER_BY_ENTITY_ALIAS = "blogsEntry.";
11471            private static final String _ORDER_BY_ENTITY_TABLE = "BlogsEntry.";
11472            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No BlogsEntry exists with the primary key ";
11473            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No BlogsEntry exists with the key {";
11474            private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
11475            private static Log _log = LogFactoryUtil.getLog(BlogsEntryPersistenceImpl.class);
11476            private static BlogsEntry _nullBlogsEntry = new BlogsEntryImpl() {
11477                            @Override
11478                            public Object clone() {
11479                                    return this;
11480                            }
11481    
11482                            @Override
11483                            public CacheModel<BlogsEntry> toCacheModel() {
11484                                    return _nullBlogsEntryCacheModel;
11485                            }
11486                    };
11487    
11488            private static CacheModel<BlogsEntry> _nullBlogsEntryCacheModel = new CacheModel<BlogsEntry>() {
11489                            public BlogsEntry toEntityModel() {
11490                                    return _nullBlogsEntry;
11491                            }
11492                    };
11493    }