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