1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.blogs.service.persistence;
16  
17  import com.liferay.portal.NoSuchModelException;
18  import com.liferay.portal.kernel.annotation.BeanReference;
19  import com.liferay.portal.kernel.cache.CacheRegistry;
20  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
21  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
22  import com.liferay.portal.kernel.dao.orm.FinderPath;
23  import com.liferay.portal.kernel.dao.orm.Query;
24  import com.liferay.portal.kernel.dao.orm.QueryPos;
25  import com.liferay.portal.kernel.dao.orm.QueryUtil;
26  import com.liferay.portal.kernel.dao.orm.Session;
27  import com.liferay.portal.kernel.exception.SystemException;
28  import com.liferay.portal.kernel.log.Log;
29  import com.liferay.portal.kernel.log.LogFactoryUtil;
30  import com.liferay.portal.kernel.util.CalendarUtil;
31  import com.liferay.portal.kernel.util.GetterUtil;
32  import com.liferay.portal.kernel.util.OrderByComparator;
33  import com.liferay.portal.kernel.util.StringBundler;
34  import com.liferay.portal.kernel.util.StringPool;
35  import com.liferay.portal.kernel.util.StringUtil;
36  import com.liferay.portal.kernel.util.Validator;
37  import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
38  import com.liferay.portal.model.ModelListener;
39  import com.liferay.portal.service.persistence.BatchSessionUtil;
40  import com.liferay.portal.service.persistence.CompanyPersistence;
41  import com.liferay.portal.service.persistence.GroupPersistence;
42  import com.liferay.portal.service.persistence.OrganizationPersistence;
43  import com.liferay.portal.service.persistence.PortletPreferencesPersistence;
44  import com.liferay.portal.service.persistence.ResourcePersistence;
45  import com.liferay.portal.service.persistence.UserPersistence;
46  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
47  
48  import com.liferay.portlet.asset.service.persistence.AssetEntryPersistence;
49  import com.liferay.portlet.asset.service.persistence.AssetTagPersistence;
50  import com.liferay.portlet.blogs.NoSuchEntryException;
51  import com.liferay.portlet.blogs.model.BlogsEntry;
52  import com.liferay.portlet.blogs.model.impl.BlogsEntryImpl;
53  import com.liferay.portlet.blogs.model.impl.BlogsEntryModelImpl;
54  import com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence;
55  import com.liferay.portlet.messageboards.service.persistence.MBMessagePersistence;
56  import com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence;
57  import com.liferay.portlet.social.service.persistence.SocialActivityPersistence;
58  
59  import java.io.Serializable;
60  
61  import java.util.ArrayList;
62  import java.util.Collections;
63  import java.util.Date;
64  import java.util.List;
65  
66  /**
67   * <a href="BlogsEntryPersistenceImpl.java.html"><b><i>View Source</i></b></a>
68   *
69   * <p>
70   * ServiceBuilder generated this class. Modifications in this class will be
71   * overwritten the next time is generated.
72   * </p>
73   *
74   * @author    Brian Wing Shun Chan
75   * @see       BlogsEntryPersistence
76   * @see       BlogsEntryUtil
77   * @generated
78   */
79  public class BlogsEntryPersistenceImpl extends BasePersistenceImpl<BlogsEntry>
80      implements BlogsEntryPersistence {
81      public static final String FINDER_CLASS_NAME_ENTITY = BlogsEntryImpl.class.getName();
82      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
83          ".List";
84      public static final FinderPath FINDER_PATH_FIND_BY_UUID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
85              BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
86              "findByUuid", new String[] { String.class.getName() });
87      public static final FinderPath FINDER_PATH_FIND_BY_OBC_UUID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
88              BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
89              "findByUuid",
90              new String[] {
91                  String.class.getName(),
92                  
93              "java.lang.Integer", "java.lang.Integer",
94                  "com.liferay.portal.kernel.util.OrderByComparator"
95              });
96      public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
97              BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
98              "countByUuid", new String[] { String.class.getName() });
99      public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
100             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
101             "fetchByUUID_G",
102             new String[] { String.class.getName(), Long.class.getName() });
103     public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
104             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
105             "countByUUID_G",
106             new String[] { String.class.getName(), Long.class.getName() });
107     public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
108             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
109             "findByGroupId", new String[] { Long.class.getName() });
110     public static final FinderPath FINDER_PATH_FIND_BY_OBC_GROUPID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
111             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
112             "findByGroupId",
113             new String[] {
114                 Long.class.getName(),
115                 
116             "java.lang.Integer", "java.lang.Integer",
117                 "com.liferay.portal.kernel.util.OrderByComparator"
118             });
119     public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
120             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
121             "countByGroupId", new String[] { Long.class.getName() });
122     public static final FinderPath FINDER_PATH_FIND_BY_COMPANYID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
123             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
124             "findByCompanyId", new String[] { Long.class.getName() });
125     public static final FinderPath FINDER_PATH_FIND_BY_OBC_COMPANYID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
126             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
127             "findByCompanyId",
128             new String[] {
129                 Long.class.getName(),
130                 
131             "java.lang.Integer", "java.lang.Integer",
132                 "com.liferay.portal.kernel.util.OrderByComparator"
133             });
134     public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
135             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
136             "countByCompanyId", new String[] { Long.class.getName() });
137     public static final FinderPath FINDER_PATH_FIND_BY_C_U = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
138             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
139             "findByC_U",
140             new String[] { Long.class.getName(), Long.class.getName() });
141     public static final FinderPath FINDER_PATH_FIND_BY_OBC_C_U = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
142             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
143             "findByC_U",
144             new String[] {
145                 Long.class.getName(), Long.class.getName(),
146                 
147             "java.lang.Integer", "java.lang.Integer",
148                 "com.liferay.portal.kernel.util.OrderByComparator"
149             });
150     public static final FinderPath FINDER_PATH_COUNT_BY_C_U = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
151             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
152             "countByC_U",
153             new String[] { Long.class.getName(), Long.class.getName() });
154     public static final FinderPath FINDER_PATH_FIND_BY_C_D = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
155             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
156             "findByC_D",
157             new String[] { Long.class.getName(), Date.class.getName() });
158     public static final FinderPath FINDER_PATH_FIND_BY_OBC_C_D = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
159             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
160             "findByC_D",
161             new String[] {
162                 Long.class.getName(), Date.class.getName(),
163                 
164             "java.lang.Integer", "java.lang.Integer",
165                 "com.liferay.portal.kernel.util.OrderByComparator"
166             });
167     public static final FinderPath FINDER_PATH_COUNT_BY_C_D = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
168             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
169             "countByC_D",
170             new String[] { Long.class.getName(), Date.class.getName() });
171     public static final FinderPath FINDER_PATH_FIND_BY_C_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
172             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
173             "findByC_S",
174             new String[] { Long.class.getName(), Integer.class.getName() });
175     public static final FinderPath FINDER_PATH_FIND_BY_OBC_C_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
176             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
177             "findByC_S",
178             new String[] {
179                 Long.class.getName(), Integer.class.getName(),
180                 
181             "java.lang.Integer", "java.lang.Integer",
182                 "com.liferay.portal.kernel.util.OrderByComparator"
183             });
184     public static final FinderPath FINDER_PATH_COUNT_BY_C_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
185             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
186             "countByC_S",
187             new String[] { Long.class.getName(), Integer.class.getName() });
188     public static final FinderPath FINDER_PATH_FETCH_BY_G_UT = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
189             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
190             "fetchByG_UT",
191             new String[] { Long.class.getName(), String.class.getName() });
192     public static final FinderPath FINDER_PATH_COUNT_BY_G_UT = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
193             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
194             "countByG_UT",
195             new String[] { Long.class.getName(), String.class.getName() });
196     public static final FinderPath FINDER_PATH_FIND_BY_G_D = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
197             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
198             "findByG_D",
199             new String[] { Long.class.getName(), Date.class.getName() });
200     public static final FinderPath FINDER_PATH_FIND_BY_OBC_G_D = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
201             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
202             "findByG_D",
203             new String[] {
204                 Long.class.getName(), Date.class.getName(),
205                 
206             "java.lang.Integer", "java.lang.Integer",
207                 "com.liferay.portal.kernel.util.OrderByComparator"
208             });
209     public static final FinderPath FINDER_PATH_COUNT_BY_G_D = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
210             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
211             "countByG_D",
212             new String[] { Long.class.getName(), Date.class.getName() });
213     public static final FinderPath FINDER_PATH_FIND_BY_G_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
214             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
215             "findByG_S",
216             new String[] { Long.class.getName(), Integer.class.getName() });
217     public static final FinderPath FINDER_PATH_FIND_BY_OBC_G_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
218             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
219             "findByG_S",
220             new String[] {
221                 Long.class.getName(), Integer.class.getName(),
222                 
223             "java.lang.Integer", "java.lang.Integer",
224                 "com.liferay.portal.kernel.util.OrderByComparator"
225             });
226     public static final FinderPath FINDER_PATH_COUNT_BY_G_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
227             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
228             "countByG_S",
229             new String[] { Long.class.getName(), Integer.class.getName() });
230     public static final FinderPath FINDER_PATH_FIND_BY_C_U_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
231             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
232             "findByC_U_S",
233             new String[] {
234                 Long.class.getName(), Long.class.getName(),
235                 Integer.class.getName()
236             });
237     public static final FinderPath FINDER_PATH_FIND_BY_OBC_C_U_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
238             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
239             "findByC_U_S",
240             new String[] {
241                 Long.class.getName(), Long.class.getName(),
242                 Integer.class.getName(),
243                 
244             "java.lang.Integer", "java.lang.Integer",
245                 "com.liferay.portal.kernel.util.OrderByComparator"
246             });
247     public static final FinderPath FINDER_PATH_COUNT_BY_C_U_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
248             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
249             "countByC_U_S",
250             new String[] {
251                 Long.class.getName(), Long.class.getName(),
252                 Integer.class.getName()
253             });
254     public static final FinderPath FINDER_PATH_FIND_BY_C_D_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
255             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
256             "findByC_D_S",
257             new String[] {
258                 Long.class.getName(), Date.class.getName(),
259                 Integer.class.getName()
260             });
261     public static final FinderPath FINDER_PATH_FIND_BY_OBC_C_D_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
262             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
263             "findByC_D_S",
264             new String[] {
265                 Long.class.getName(), Date.class.getName(),
266                 Integer.class.getName(),
267                 
268             "java.lang.Integer", "java.lang.Integer",
269                 "com.liferay.portal.kernel.util.OrderByComparator"
270             });
271     public static final FinderPath FINDER_PATH_COUNT_BY_C_D_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
272             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
273             "countByC_D_S",
274             new String[] {
275                 Long.class.getName(), Date.class.getName(),
276                 Integer.class.getName()
277             });
278     public static final FinderPath FINDER_PATH_FIND_BY_G_U_D = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
279             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
280             "findByG_U_D",
281             new String[] {
282                 Long.class.getName(), Long.class.getName(), Date.class.getName()
283             });
284     public static final FinderPath FINDER_PATH_FIND_BY_OBC_G_U_D = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
285             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
286             "findByG_U_D",
287             new String[] {
288                 Long.class.getName(), Long.class.getName(), Date.class.getName(),
289                 
290             "java.lang.Integer", "java.lang.Integer",
291                 "com.liferay.portal.kernel.util.OrderByComparator"
292             });
293     public static final FinderPath FINDER_PATH_COUNT_BY_G_U_D = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
294             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
295             "countByG_U_D",
296             new String[] {
297                 Long.class.getName(), Long.class.getName(), Date.class.getName()
298             });
299     public static final FinderPath FINDER_PATH_FIND_BY_G_U_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
300             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
301             "findByG_U_S",
302             new String[] {
303                 Long.class.getName(), Long.class.getName(),
304                 Integer.class.getName()
305             });
306     public static final FinderPath FINDER_PATH_FIND_BY_OBC_G_U_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
307             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
308             "findByG_U_S",
309             new String[] {
310                 Long.class.getName(), Long.class.getName(),
311                 Integer.class.getName(),
312                 
313             "java.lang.Integer", "java.lang.Integer",
314                 "com.liferay.portal.kernel.util.OrderByComparator"
315             });
316     public static final FinderPath FINDER_PATH_COUNT_BY_G_U_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
317             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
318             "countByG_U_S",
319             new String[] {
320                 Long.class.getName(), Long.class.getName(),
321                 Integer.class.getName()
322             });
323     public static final FinderPath FINDER_PATH_FIND_BY_G_D_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
324             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
325             "findByG_D_S",
326             new String[] {
327                 Long.class.getName(), Date.class.getName(),
328                 Integer.class.getName()
329             });
330     public static final FinderPath FINDER_PATH_FIND_BY_OBC_G_D_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
331             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
332             "findByG_D_S",
333             new String[] {
334                 Long.class.getName(), Date.class.getName(),
335                 Integer.class.getName(),
336                 
337             "java.lang.Integer", "java.lang.Integer",
338                 "com.liferay.portal.kernel.util.OrderByComparator"
339             });
340     public static final FinderPath FINDER_PATH_COUNT_BY_G_D_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
341             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
342             "countByG_D_S",
343             new String[] {
344                 Long.class.getName(), Date.class.getName(),
345                 Integer.class.getName()
346             });
347     public static final FinderPath FINDER_PATH_FIND_BY_G_U_D_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
348             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
349             "findByG_U_D_S",
350             new String[] {
351                 Long.class.getName(), Long.class.getName(), Date.class.getName(),
352                 Integer.class.getName()
353             });
354     public static final FinderPath FINDER_PATH_FIND_BY_OBC_G_U_D_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
355             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
356             "findByG_U_D_S",
357             new String[] {
358                 Long.class.getName(), Long.class.getName(), Date.class.getName(),
359                 Integer.class.getName(),
360                 
361             "java.lang.Integer", "java.lang.Integer",
362                 "com.liferay.portal.kernel.util.OrderByComparator"
363             });
364     public static final FinderPath FINDER_PATH_COUNT_BY_G_U_D_S = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
365             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
366             "countByG_U_D_S",
367             new String[] {
368                 Long.class.getName(), Long.class.getName(), Date.class.getName(),
369                 Integer.class.getName()
370             });
371     public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
372             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
373             "findAll", new String[0]);
374     public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
375             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
376             "countAll", new String[0]);
377 
378     public void cacheResult(BlogsEntry blogsEntry) {
379         EntityCacheUtil.putResult(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
380             BlogsEntryImpl.class, blogsEntry.getPrimaryKey(), blogsEntry);
381 
382         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
383             new Object[] { blogsEntry.getUuid(), new Long(
384                     blogsEntry.getGroupId()) }, blogsEntry);
385 
386         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_UT,
387             new Object[] {
388                 new Long(blogsEntry.getGroupId()),
389                 
390             blogsEntry.getUrlTitle()
391             }, blogsEntry);
392     }
393 
394     public void cacheResult(List<BlogsEntry> blogsEntries) {
395         for (BlogsEntry blogsEntry : blogsEntries) {
396             if (EntityCacheUtil.getResult(
397                         BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
398                         BlogsEntryImpl.class, blogsEntry.getPrimaryKey(), this) == null) {
399                 cacheResult(blogsEntry);
400             }
401         }
402     }
403 
404     public void clearCache() {
405         CacheRegistry.clear(BlogsEntryImpl.class.getName());
406         EntityCacheUtil.clearCache(BlogsEntryImpl.class.getName());
407         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
408         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
409     }
410 
411     public BlogsEntry create(long entryId) {
412         BlogsEntry blogsEntry = new BlogsEntryImpl();
413 
414         blogsEntry.setNew(true);
415         blogsEntry.setPrimaryKey(entryId);
416 
417         String uuid = PortalUUIDUtil.generate();
418 
419         blogsEntry.setUuid(uuid);
420 
421         return blogsEntry;
422     }
423 
424     public BlogsEntry remove(Serializable primaryKey)
425         throws NoSuchModelException, SystemException {
426         return remove(((Long)primaryKey).longValue());
427     }
428 
429     public BlogsEntry remove(long entryId)
430         throws NoSuchEntryException, SystemException {
431         Session session = null;
432 
433         try {
434             session = openSession();
435 
436             BlogsEntry blogsEntry = (BlogsEntry)session.get(BlogsEntryImpl.class,
437                     new Long(entryId));
438 
439             if (blogsEntry == null) {
440                 if (_log.isWarnEnabled()) {
441                     _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + entryId);
442                 }
443 
444                 throw new NoSuchEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
445                     entryId);
446             }
447 
448             return remove(blogsEntry);
449         }
450         catch (NoSuchEntryException nsee) {
451             throw nsee;
452         }
453         catch (Exception e) {
454             throw processException(e);
455         }
456         finally {
457             closeSession(session);
458         }
459     }
460 
461     public BlogsEntry remove(BlogsEntry blogsEntry) throws SystemException {
462         for (ModelListener<BlogsEntry> listener : listeners) {
463             listener.onBeforeRemove(blogsEntry);
464         }
465 
466         blogsEntry = removeImpl(blogsEntry);
467 
468         for (ModelListener<BlogsEntry> listener : listeners) {
469             listener.onAfterRemove(blogsEntry);
470         }
471 
472         return blogsEntry;
473     }
474 
475     protected BlogsEntry removeImpl(BlogsEntry blogsEntry)
476         throws SystemException {
477         blogsEntry = toUnwrappedModel(blogsEntry);
478 
479         Session session = null;
480 
481         try {
482             session = openSession();
483 
484             if (blogsEntry.isCachedModel() || BatchSessionUtil.isEnabled()) {
485                 Object staleObject = session.get(BlogsEntryImpl.class,
486                         blogsEntry.getPrimaryKeyObj());
487 
488                 if (staleObject != null) {
489                     session.evict(staleObject);
490                 }
491             }
492 
493             session.delete(blogsEntry);
494 
495             session.flush();
496         }
497         catch (Exception e) {
498             throw processException(e);
499         }
500         finally {
501             closeSession(session);
502         }
503 
504         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
505 
506         BlogsEntryModelImpl blogsEntryModelImpl = (BlogsEntryModelImpl)blogsEntry;
507 
508         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
509             new Object[] {
510                 blogsEntryModelImpl.getOriginalUuid(),
511                 new Long(blogsEntryModelImpl.getOriginalGroupId())
512             });
513 
514         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_UT,
515             new Object[] {
516                 new Long(blogsEntryModelImpl.getOriginalGroupId()),
517                 
518             blogsEntryModelImpl.getOriginalUrlTitle()
519             });
520 
521         EntityCacheUtil.removeResult(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
522             BlogsEntryImpl.class, blogsEntry.getPrimaryKey());
523 
524         return blogsEntry;
525     }
526 
527     public BlogsEntry updateImpl(
528         com.liferay.portlet.blogs.model.BlogsEntry blogsEntry, boolean merge)
529         throws SystemException {
530         blogsEntry = toUnwrappedModel(blogsEntry);
531 
532         boolean isNew = blogsEntry.isNew();
533 
534         BlogsEntryModelImpl blogsEntryModelImpl = (BlogsEntryModelImpl)blogsEntry;
535 
536         if (Validator.isNull(blogsEntry.getUuid())) {
537             String uuid = PortalUUIDUtil.generate();
538 
539             blogsEntry.setUuid(uuid);
540         }
541 
542         Session session = null;
543 
544         try {
545             session = openSession();
546 
547             BatchSessionUtil.update(session, blogsEntry, merge);
548 
549             blogsEntry.setNew(false);
550         }
551         catch (Exception e) {
552             throw processException(e);
553         }
554         finally {
555             closeSession(session);
556         }
557 
558         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
559 
560         EntityCacheUtil.putResult(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
561             BlogsEntryImpl.class, blogsEntry.getPrimaryKey(), blogsEntry);
562 
563         if (!isNew &&
564                 (!Validator.equals(blogsEntry.getUuid(),
565                     blogsEntryModelImpl.getOriginalUuid()) ||
566                 (blogsEntry.getGroupId() != blogsEntryModelImpl.getOriginalGroupId()))) {
567             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
568                 new Object[] {
569                     blogsEntryModelImpl.getOriginalUuid(),
570                     new Long(blogsEntryModelImpl.getOriginalGroupId())
571                 });
572         }
573 
574         if (isNew ||
575                 (!Validator.equals(blogsEntry.getUuid(),
576                     blogsEntryModelImpl.getOriginalUuid()) ||
577                 (blogsEntry.getGroupId() != blogsEntryModelImpl.getOriginalGroupId()))) {
578             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
579                 new Object[] {
580                     blogsEntry.getUuid(), new Long(blogsEntry.getGroupId())
581                 }, blogsEntry);
582         }
583 
584         if (!isNew &&
585                 ((blogsEntry.getGroupId() != blogsEntryModelImpl.getOriginalGroupId()) ||
586                 !Validator.equals(blogsEntry.getUrlTitle(),
587                     blogsEntryModelImpl.getOriginalUrlTitle()))) {
588             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_UT,
589                 new Object[] {
590                     new Long(blogsEntryModelImpl.getOriginalGroupId()),
591                     
592                 blogsEntryModelImpl.getOriginalUrlTitle()
593                 });
594         }
595 
596         if (isNew ||
597                 ((blogsEntry.getGroupId() != blogsEntryModelImpl.getOriginalGroupId()) ||
598                 !Validator.equals(blogsEntry.getUrlTitle(),
599                     blogsEntryModelImpl.getOriginalUrlTitle()))) {
600             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_UT,
601                 new Object[] {
602                     new Long(blogsEntry.getGroupId()),
603                     
604                 blogsEntry.getUrlTitle()
605                 }, blogsEntry);
606         }
607 
608         return blogsEntry;
609     }
610 
611     protected BlogsEntry toUnwrappedModel(BlogsEntry blogsEntry) {
612         if (blogsEntry instanceof BlogsEntryImpl) {
613             return blogsEntry;
614         }
615 
616         BlogsEntryImpl blogsEntryImpl = new BlogsEntryImpl();
617 
618         blogsEntryImpl.setNew(blogsEntry.isNew());
619         blogsEntryImpl.setPrimaryKey(blogsEntry.getPrimaryKey());
620 
621         blogsEntryImpl.setUuid(blogsEntry.getUuid());
622         blogsEntryImpl.setEntryId(blogsEntry.getEntryId());
623         blogsEntryImpl.setGroupId(blogsEntry.getGroupId());
624         blogsEntryImpl.setCompanyId(blogsEntry.getCompanyId());
625         blogsEntryImpl.setUserId(blogsEntry.getUserId());
626         blogsEntryImpl.setUserName(blogsEntry.getUserName());
627         blogsEntryImpl.setCreateDate(blogsEntry.getCreateDate());
628         blogsEntryImpl.setModifiedDate(blogsEntry.getModifiedDate());
629         blogsEntryImpl.setTitle(blogsEntry.getTitle());
630         blogsEntryImpl.setUrlTitle(blogsEntry.getUrlTitle());
631         blogsEntryImpl.setContent(blogsEntry.getContent());
632         blogsEntryImpl.setDisplayDate(blogsEntry.getDisplayDate());
633         blogsEntryImpl.setAllowPingbacks(blogsEntry.isAllowPingbacks());
634         blogsEntryImpl.setAllowTrackbacks(blogsEntry.isAllowTrackbacks());
635         blogsEntryImpl.setTrackbacks(blogsEntry.getTrackbacks());
636         blogsEntryImpl.setStatus(blogsEntry.getStatus());
637         blogsEntryImpl.setStatusByUserId(blogsEntry.getStatusByUserId());
638         blogsEntryImpl.setStatusByUserName(blogsEntry.getStatusByUserName());
639         blogsEntryImpl.setStatusDate(blogsEntry.getStatusDate());
640 
641         return blogsEntryImpl;
642     }
643 
644     public BlogsEntry findByPrimaryKey(Serializable primaryKey)
645         throws NoSuchModelException, SystemException {
646         return findByPrimaryKey(((Long)primaryKey).longValue());
647     }
648 
649     public BlogsEntry findByPrimaryKey(long entryId)
650         throws NoSuchEntryException, SystemException {
651         BlogsEntry blogsEntry = fetchByPrimaryKey(entryId);
652 
653         if (blogsEntry == null) {
654             if (_log.isWarnEnabled()) {
655                 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + entryId);
656             }
657 
658             throw new NoSuchEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
659                 entryId);
660         }
661 
662         return blogsEntry;
663     }
664 
665     public BlogsEntry fetchByPrimaryKey(Serializable primaryKey)
666         throws SystemException {
667         return fetchByPrimaryKey(((Long)primaryKey).longValue());
668     }
669 
670     public BlogsEntry fetchByPrimaryKey(long entryId) throws SystemException {
671         BlogsEntry blogsEntry = (BlogsEntry)EntityCacheUtil.getResult(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
672                 BlogsEntryImpl.class, entryId, this);
673 
674         if (blogsEntry == null) {
675             Session session = null;
676 
677             try {
678                 session = openSession();
679 
680                 blogsEntry = (BlogsEntry)session.get(BlogsEntryImpl.class,
681                         new Long(entryId));
682             }
683             catch (Exception e) {
684                 throw processException(e);
685             }
686             finally {
687                 if (blogsEntry != null) {
688                     cacheResult(blogsEntry);
689                 }
690 
691                 closeSession(session);
692             }
693         }
694 
695         return blogsEntry;
696     }
697 
698     public List<BlogsEntry> findByUuid(String uuid) throws SystemException {
699         Object[] finderArgs = new Object[] { uuid };
700 
701         List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_UUID,
702                 finderArgs, this);
703 
704         if (list == null) {
705             Session session = null;
706 
707             try {
708                 session = openSession();
709 
710                 StringBundler query = new StringBundler(3);
711 
712                 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
713 
714                 if (uuid == null) {
715                     query.append(_FINDER_COLUMN_UUID_UUID_1);
716                 }
717                 else {
718                     if (uuid.equals(StringPool.BLANK)) {
719                         query.append(_FINDER_COLUMN_UUID_UUID_3);
720                     }
721                     else {
722                         query.append(_FINDER_COLUMN_UUID_UUID_2);
723                     }
724                 }
725 
726                 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
727 
728                 String sql = query.toString();
729 
730                 Query q = session.createQuery(sql);
731 
732                 QueryPos qPos = QueryPos.getInstance(q);
733 
734                 if (uuid != null) {
735                     qPos.add(uuid);
736                 }
737 
738                 list = q.list();
739             }
740             catch (Exception e) {
741                 throw processException(e);
742             }
743             finally {
744                 if (list == null) {
745                     list = new ArrayList<BlogsEntry>();
746                 }
747 
748                 cacheResult(list);
749 
750                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_UUID, finderArgs,
751                     list);
752 
753                 closeSession(session);
754             }
755         }
756 
757         return list;
758     }
759 
760     public List<BlogsEntry> findByUuid(String uuid, int start, int end)
761         throws SystemException {
762         return findByUuid(uuid, start, end, null);
763     }
764 
765     public List<BlogsEntry> findByUuid(String uuid, int start, int end,
766         OrderByComparator orderByComparator) throws SystemException {
767         Object[] finderArgs = new Object[] {
768                 uuid,
769                 
770                 String.valueOf(start), String.valueOf(end),
771                 String.valueOf(orderByComparator)
772             };
773 
774         List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_UUID,
775                 finderArgs, this);
776 
777         if (list == null) {
778             Session session = null;
779 
780             try {
781                 session = openSession();
782 
783                 StringBundler query = null;
784 
785                 if (orderByComparator != null) {
786                     query = new StringBundler(3 +
787                             (orderByComparator.getOrderByFields().length * 3));
788                 }
789                 else {
790                     query = new StringBundler(3);
791                 }
792 
793                 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
794 
795                 if (uuid == null) {
796                     query.append(_FINDER_COLUMN_UUID_UUID_1);
797                 }
798                 else {
799                     if (uuid.equals(StringPool.BLANK)) {
800                         query.append(_FINDER_COLUMN_UUID_UUID_3);
801                     }
802                     else {
803                         query.append(_FINDER_COLUMN_UUID_UUID_2);
804                     }
805                 }
806 
807                 if (orderByComparator != null) {
808                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
809                         orderByComparator);
810                 }
811 
812                 else {
813                     query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
814                 }
815 
816                 String sql = query.toString();
817 
818                 Query q = session.createQuery(sql);
819 
820                 QueryPos qPos = QueryPos.getInstance(q);
821 
822                 if (uuid != null) {
823                     qPos.add(uuid);
824                 }
825 
826                 list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
827                         end);
828             }
829             catch (Exception e) {
830                 throw processException(e);
831             }
832             finally {
833                 if (list == null) {
834                     list = new ArrayList<BlogsEntry>();
835                 }
836 
837                 cacheResult(list);
838 
839                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_UUID,
840                     finderArgs, list);
841 
842                 closeSession(session);
843             }
844         }
845 
846         return list;
847     }
848 
849     public BlogsEntry findByUuid_First(String uuid,
850         OrderByComparator orderByComparator)
851         throws NoSuchEntryException, SystemException {
852         List<BlogsEntry> list = findByUuid(uuid, 0, 1, orderByComparator);
853 
854         if (list.isEmpty()) {
855             StringBundler msg = new StringBundler(4);
856 
857             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
858 
859             msg.append("uuid=");
860             msg.append(uuid);
861 
862             msg.append(StringPool.CLOSE_CURLY_BRACE);
863 
864             throw new NoSuchEntryException(msg.toString());
865         }
866         else {
867             return list.get(0);
868         }
869     }
870 
871     public BlogsEntry findByUuid_Last(String uuid,
872         OrderByComparator orderByComparator)
873         throws NoSuchEntryException, SystemException {
874         int count = countByUuid(uuid);
875 
876         List<BlogsEntry> list = findByUuid(uuid, count - 1, count,
877                 orderByComparator);
878 
879         if (list.isEmpty()) {
880             StringBundler msg = new StringBundler(4);
881 
882             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
883 
884             msg.append("uuid=");
885             msg.append(uuid);
886 
887             msg.append(StringPool.CLOSE_CURLY_BRACE);
888 
889             throw new NoSuchEntryException(msg.toString());
890         }
891         else {
892             return list.get(0);
893         }
894     }
895 
896     public BlogsEntry[] findByUuid_PrevAndNext(long entryId, String uuid,
897         OrderByComparator orderByComparator)
898         throws NoSuchEntryException, SystemException {
899         BlogsEntry blogsEntry = findByPrimaryKey(entryId);
900 
901         int count = countByUuid(uuid);
902 
903         Session session = null;
904 
905         try {
906             session = openSession();
907 
908             StringBundler query = null;
909 
910             if (orderByComparator != null) {
911                 query = new StringBundler(3 +
912                         (orderByComparator.getOrderByFields().length * 3));
913             }
914             else {
915                 query = new StringBundler(3);
916             }
917 
918             query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
919 
920             if (uuid == null) {
921                 query.append(_FINDER_COLUMN_UUID_UUID_1);
922             }
923             else {
924                 if (uuid.equals(StringPool.BLANK)) {
925                     query.append(_FINDER_COLUMN_UUID_UUID_3);
926                 }
927                 else {
928                     query.append(_FINDER_COLUMN_UUID_UUID_2);
929                 }
930             }
931 
932             if (orderByComparator != null) {
933                 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
934                     orderByComparator);
935             }
936 
937             else {
938                 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
939             }
940 
941             String sql = query.toString();
942 
943             Query q = session.createQuery(sql);
944 
945             QueryPos qPos = QueryPos.getInstance(q);
946 
947             if (uuid != null) {
948                 qPos.add(uuid);
949             }
950 
951             Object[] objArray = QueryUtil.getPrevAndNext(q, count,
952                     orderByComparator, blogsEntry);
953 
954             BlogsEntry[] array = new BlogsEntryImpl[3];
955 
956             array[0] = (BlogsEntry)objArray[0];
957             array[1] = (BlogsEntry)objArray[1];
958             array[2] = (BlogsEntry)objArray[2];
959 
960             return array;
961         }
962         catch (Exception e) {
963             throw processException(e);
964         }
965         finally {
966             closeSession(session);
967         }
968     }
969 
970     public BlogsEntry findByUUID_G(String uuid, long groupId)
971         throws NoSuchEntryException, SystemException {
972         BlogsEntry blogsEntry = fetchByUUID_G(uuid, groupId);
973 
974         if (blogsEntry == null) {
975             StringBundler msg = new StringBundler(6);
976 
977             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
978 
979             msg.append("uuid=");
980             msg.append(uuid);
981 
982             msg.append(", groupId=");
983             msg.append(groupId);
984 
985             msg.append(StringPool.CLOSE_CURLY_BRACE);
986 
987             if (_log.isWarnEnabled()) {
988                 _log.warn(msg.toString());
989             }
990 
991             throw new NoSuchEntryException(msg.toString());
992         }
993 
994         return blogsEntry;
995     }
996 
997     public BlogsEntry fetchByUUID_G(String uuid, long groupId)
998         throws SystemException {
999         return fetchByUUID_G(uuid, groupId, true);
1000    }
1001
1002    public BlogsEntry fetchByUUID_G(String uuid, long groupId,
1003        boolean retrieveFromCache) throws SystemException {
1004        Object[] finderArgs = new Object[] { uuid, new Long(groupId) };
1005
1006        Object result = null;
1007
1008        if (retrieveFromCache) {
1009            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
1010                    finderArgs, this);
1011        }
1012
1013        if (result == null) {
1014            Session session = null;
1015
1016            try {
1017                session = openSession();
1018
1019                StringBundler query = new StringBundler(4);
1020
1021                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1022
1023                if (uuid == null) {
1024                    query.append(_FINDER_COLUMN_UUID_G_UUID_1);
1025                }
1026                else {
1027                    if (uuid.equals(StringPool.BLANK)) {
1028                        query.append(_FINDER_COLUMN_UUID_G_UUID_3);
1029                    }
1030                    else {
1031                        query.append(_FINDER_COLUMN_UUID_G_UUID_2);
1032                    }
1033                }
1034
1035                query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
1036
1037                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1038
1039                String sql = query.toString();
1040
1041                Query q = session.createQuery(sql);
1042
1043                QueryPos qPos = QueryPos.getInstance(q);
1044
1045                if (uuid != null) {
1046                    qPos.add(uuid);
1047                }
1048
1049                qPos.add(groupId);
1050
1051                List<BlogsEntry> list = q.list();
1052
1053                result = list;
1054
1055                BlogsEntry blogsEntry = null;
1056
1057                if (list.isEmpty()) {
1058                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1059                        finderArgs, list);
1060                }
1061                else {
1062                    blogsEntry = list.get(0);
1063
1064                    cacheResult(blogsEntry);
1065
1066                    if ((blogsEntry.getUuid() == null) ||
1067                            !blogsEntry.getUuid().equals(uuid) ||
1068                            (blogsEntry.getGroupId() != groupId)) {
1069                        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1070                            finderArgs, blogsEntry);
1071                    }
1072                }
1073
1074                return blogsEntry;
1075            }
1076            catch (Exception e) {
1077                throw processException(e);
1078            }
1079            finally {
1080                if (result == null) {
1081                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1082                        finderArgs, new ArrayList<BlogsEntry>());
1083                }
1084
1085                closeSession(session);
1086            }
1087        }
1088        else {
1089            if (result instanceof List<?>) {
1090                return null;
1091            }
1092            else {
1093                return (BlogsEntry)result;
1094            }
1095        }
1096    }
1097
1098    public List<BlogsEntry> findByGroupId(long groupId)
1099        throws SystemException {
1100        Object[] finderArgs = new Object[] { new Long(groupId) };
1101
1102        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
1103                finderArgs, this);
1104
1105        if (list == null) {
1106            Session session = null;
1107
1108            try {
1109                session = openSession();
1110
1111                StringBundler query = new StringBundler(3);
1112
1113                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1114
1115                query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1116
1117                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1118
1119                String sql = query.toString();
1120
1121                Query q = session.createQuery(sql);
1122
1123                QueryPos qPos = QueryPos.getInstance(q);
1124
1125                qPos.add(groupId);
1126
1127                list = q.list();
1128            }
1129            catch (Exception e) {
1130                throw processException(e);
1131            }
1132            finally {
1133                if (list == null) {
1134                    list = new ArrayList<BlogsEntry>();
1135                }
1136
1137                cacheResult(list);
1138
1139                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
1140                    finderArgs, list);
1141
1142                closeSession(session);
1143            }
1144        }
1145
1146        return list;
1147    }
1148
1149    public List<BlogsEntry> findByGroupId(long groupId, int start, int end)
1150        throws SystemException {
1151        return findByGroupId(groupId, start, end, null);
1152    }
1153
1154    public List<BlogsEntry> findByGroupId(long groupId, int start, int end,
1155        OrderByComparator orderByComparator) throws SystemException {
1156        Object[] finderArgs = new Object[] {
1157                new Long(groupId),
1158                
1159                String.valueOf(start), String.valueOf(end),
1160                String.valueOf(orderByComparator)
1161            };
1162
1163        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_GROUPID,
1164                finderArgs, this);
1165
1166        if (list == null) {
1167            Session session = null;
1168
1169            try {
1170                session = openSession();
1171
1172                StringBundler query = null;
1173
1174                if (orderByComparator != null) {
1175                    query = new StringBundler(3 +
1176                            (orderByComparator.getOrderByFields().length * 3));
1177                }
1178                else {
1179                    query = new StringBundler(3);
1180                }
1181
1182                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1183
1184                query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1185
1186                if (orderByComparator != null) {
1187                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1188                        orderByComparator);
1189                }
1190
1191                else {
1192                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1193                }
1194
1195                String sql = query.toString();
1196
1197                Query q = session.createQuery(sql);
1198
1199                QueryPos qPos = QueryPos.getInstance(q);
1200
1201                qPos.add(groupId);
1202
1203                list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
1204                        end);
1205            }
1206            catch (Exception e) {
1207                throw processException(e);
1208            }
1209            finally {
1210                if (list == null) {
1211                    list = new ArrayList<BlogsEntry>();
1212                }
1213
1214                cacheResult(list);
1215
1216                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_GROUPID,
1217                    finderArgs, list);
1218
1219                closeSession(session);
1220            }
1221        }
1222
1223        return list;
1224    }
1225
1226    public BlogsEntry findByGroupId_First(long groupId,
1227        OrderByComparator orderByComparator)
1228        throws NoSuchEntryException, SystemException {
1229        List<BlogsEntry> list = findByGroupId(groupId, 0, 1, orderByComparator);
1230
1231        if (list.isEmpty()) {
1232            StringBundler msg = new StringBundler(4);
1233
1234            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1235
1236            msg.append("groupId=");
1237            msg.append(groupId);
1238
1239            msg.append(StringPool.CLOSE_CURLY_BRACE);
1240
1241            throw new NoSuchEntryException(msg.toString());
1242        }
1243        else {
1244            return list.get(0);
1245        }
1246    }
1247
1248    public BlogsEntry findByGroupId_Last(long groupId,
1249        OrderByComparator orderByComparator)
1250        throws NoSuchEntryException, SystemException {
1251        int count = countByGroupId(groupId);
1252
1253        List<BlogsEntry> list = findByGroupId(groupId, count - 1, count,
1254                orderByComparator);
1255
1256        if (list.isEmpty()) {
1257            StringBundler msg = new StringBundler(4);
1258
1259            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1260
1261            msg.append("groupId=");
1262            msg.append(groupId);
1263
1264            msg.append(StringPool.CLOSE_CURLY_BRACE);
1265
1266            throw new NoSuchEntryException(msg.toString());
1267        }
1268        else {
1269            return list.get(0);
1270        }
1271    }
1272
1273    public BlogsEntry[] findByGroupId_PrevAndNext(long entryId, long groupId,
1274        OrderByComparator orderByComparator)
1275        throws NoSuchEntryException, SystemException {
1276        BlogsEntry blogsEntry = findByPrimaryKey(entryId);
1277
1278        int count = countByGroupId(groupId);
1279
1280        Session session = null;
1281
1282        try {
1283            session = openSession();
1284
1285            StringBundler query = null;
1286
1287            if (orderByComparator != null) {
1288                query = new StringBundler(3 +
1289                        (orderByComparator.getOrderByFields().length * 3));
1290            }
1291            else {
1292                query = new StringBundler(3);
1293            }
1294
1295            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1296
1297            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1298
1299            if (orderByComparator != null) {
1300                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1301                    orderByComparator);
1302            }
1303
1304            else {
1305                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1306            }
1307
1308            String sql = query.toString();
1309
1310            Query q = session.createQuery(sql);
1311
1312            QueryPos qPos = QueryPos.getInstance(q);
1313
1314            qPos.add(groupId);
1315
1316            Object[] objArray = QueryUtil.getPrevAndNext(q, count,
1317                    orderByComparator, blogsEntry);
1318
1319            BlogsEntry[] array = new BlogsEntryImpl[3];
1320
1321            array[0] = (BlogsEntry)objArray[0];
1322            array[1] = (BlogsEntry)objArray[1];
1323            array[2] = (BlogsEntry)objArray[2];
1324
1325            return array;
1326        }
1327        catch (Exception e) {
1328            throw processException(e);
1329        }
1330        finally {
1331            closeSession(session);
1332        }
1333    }
1334
1335    public List<BlogsEntry> findByCompanyId(long companyId)
1336        throws SystemException {
1337        Object[] finderArgs = new Object[] { new Long(companyId) };
1338
1339        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
1340                finderArgs, this);
1341
1342        if (list == null) {
1343            Session session = null;
1344
1345            try {
1346                session = openSession();
1347
1348                StringBundler query = new StringBundler(3);
1349
1350                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1351
1352                query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1353
1354                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1355
1356                String sql = query.toString();
1357
1358                Query q = session.createQuery(sql);
1359
1360                QueryPos qPos = QueryPos.getInstance(q);
1361
1362                qPos.add(companyId);
1363
1364                list = q.list();
1365            }
1366            catch (Exception e) {
1367                throw processException(e);
1368            }
1369            finally {
1370                if (list == null) {
1371                    list = new ArrayList<BlogsEntry>();
1372                }
1373
1374                cacheResult(list);
1375
1376                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
1377                    finderArgs, list);
1378
1379                closeSession(session);
1380            }
1381        }
1382
1383        return list;
1384    }
1385
1386    public List<BlogsEntry> findByCompanyId(long companyId, int start, int end)
1387        throws SystemException {
1388        return findByCompanyId(companyId, start, end, null);
1389    }
1390
1391    public List<BlogsEntry> findByCompanyId(long companyId, int start, int end,
1392        OrderByComparator orderByComparator) throws SystemException {
1393        Object[] finderArgs = new Object[] {
1394                new Long(companyId),
1395                
1396                String.valueOf(start), String.valueOf(end),
1397                String.valueOf(orderByComparator)
1398            };
1399
1400        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_COMPANYID,
1401                finderArgs, this);
1402
1403        if (list == null) {
1404            Session session = null;
1405
1406            try {
1407                session = openSession();
1408
1409                StringBundler query = null;
1410
1411                if (orderByComparator != null) {
1412                    query = new StringBundler(3 +
1413                            (orderByComparator.getOrderByFields().length * 3));
1414                }
1415                else {
1416                    query = new StringBundler(3);
1417                }
1418
1419                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1420
1421                query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1422
1423                if (orderByComparator != null) {
1424                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1425                        orderByComparator);
1426                }
1427
1428                else {
1429                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1430                }
1431
1432                String sql = query.toString();
1433
1434                Query q = session.createQuery(sql);
1435
1436                QueryPos qPos = QueryPos.getInstance(q);
1437
1438                qPos.add(companyId);
1439
1440                list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
1441                        end);
1442            }
1443            catch (Exception e) {
1444                throw processException(e);
1445            }
1446            finally {
1447                if (list == null) {
1448                    list = new ArrayList<BlogsEntry>();
1449                }
1450
1451                cacheResult(list);
1452
1453                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_COMPANYID,
1454                    finderArgs, list);
1455
1456                closeSession(session);
1457            }
1458        }
1459
1460        return list;
1461    }
1462
1463    public BlogsEntry findByCompanyId_First(long companyId,
1464        OrderByComparator orderByComparator)
1465        throws NoSuchEntryException, SystemException {
1466        List<BlogsEntry> list = findByCompanyId(companyId, 0, 1,
1467                orderByComparator);
1468
1469        if (list.isEmpty()) {
1470            StringBundler msg = new StringBundler(4);
1471
1472            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1473
1474            msg.append("companyId=");
1475            msg.append(companyId);
1476
1477            msg.append(StringPool.CLOSE_CURLY_BRACE);
1478
1479            throw new NoSuchEntryException(msg.toString());
1480        }
1481        else {
1482            return list.get(0);
1483        }
1484    }
1485
1486    public BlogsEntry findByCompanyId_Last(long companyId,
1487        OrderByComparator orderByComparator)
1488        throws NoSuchEntryException, SystemException {
1489        int count = countByCompanyId(companyId);
1490
1491        List<BlogsEntry> list = findByCompanyId(companyId, count - 1, count,
1492                orderByComparator);
1493
1494        if (list.isEmpty()) {
1495            StringBundler msg = new StringBundler(4);
1496
1497            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1498
1499            msg.append("companyId=");
1500            msg.append(companyId);
1501
1502            msg.append(StringPool.CLOSE_CURLY_BRACE);
1503
1504            throw new NoSuchEntryException(msg.toString());
1505        }
1506        else {
1507            return list.get(0);
1508        }
1509    }
1510
1511    public BlogsEntry[] findByCompanyId_PrevAndNext(long entryId,
1512        long companyId, OrderByComparator orderByComparator)
1513        throws NoSuchEntryException, SystemException {
1514        BlogsEntry blogsEntry = findByPrimaryKey(entryId);
1515
1516        int count = countByCompanyId(companyId);
1517
1518        Session session = null;
1519
1520        try {
1521            session = openSession();
1522
1523            StringBundler query = null;
1524
1525            if (orderByComparator != null) {
1526                query = new StringBundler(3 +
1527                        (orderByComparator.getOrderByFields().length * 3));
1528            }
1529            else {
1530                query = new StringBundler(3);
1531            }
1532
1533            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1534
1535            query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1536
1537            if (orderByComparator != null) {
1538                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1539                    orderByComparator);
1540            }
1541
1542            else {
1543                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1544            }
1545
1546            String sql = query.toString();
1547
1548            Query q = session.createQuery(sql);
1549
1550            QueryPos qPos = QueryPos.getInstance(q);
1551
1552            qPos.add(companyId);
1553
1554            Object[] objArray = QueryUtil.getPrevAndNext(q, count,
1555                    orderByComparator, blogsEntry);
1556
1557            BlogsEntry[] array = new BlogsEntryImpl[3];
1558
1559            array[0] = (BlogsEntry)objArray[0];
1560            array[1] = (BlogsEntry)objArray[1];
1561            array[2] = (BlogsEntry)objArray[2];
1562
1563            return array;
1564        }
1565        catch (Exception e) {
1566            throw processException(e);
1567        }
1568        finally {
1569            closeSession(session);
1570        }
1571    }
1572
1573    public List<BlogsEntry> findByC_U(long companyId, long userId)
1574        throws SystemException {
1575        Object[] finderArgs = new Object[] { new Long(companyId), new Long(userId) };
1576
1577        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_U,
1578                finderArgs, this);
1579
1580        if (list == null) {
1581            Session session = null;
1582
1583            try {
1584                session = openSession();
1585
1586                StringBundler query = new StringBundler(4);
1587
1588                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1589
1590                query.append(_FINDER_COLUMN_C_U_COMPANYID_2);
1591
1592                query.append(_FINDER_COLUMN_C_U_USERID_2);
1593
1594                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1595
1596                String sql = query.toString();
1597
1598                Query q = session.createQuery(sql);
1599
1600                QueryPos qPos = QueryPos.getInstance(q);
1601
1602                qPos.add(companyId);
1603
1604                qPos.add(userId);
1605
1606                list = q.list();
1607            }
1608            catch (Exception e) {
1609                throw processException(e);
1610            }
1611            finally {
1612                if (list == null) {
1613                    list = new ArrayList<BlogsEntry>();
1614                }
1615
1616                cacheResult(list);
1617
1618                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_U, finderArgs,
1619                    list);
1620
1621                closeSession(session);
1622            }
1623        }
1624
1625        return list;
1626    }
1627
1628    public List<BlogsEntry> findByC_U(long companyId, long userId, int start,
1629        int end) throws SystemException {
1630        return findByC_U(companyId, userId, start, end, null);
1631    }
1632
1633    public List<BlogsEntry> findByC_U(long companyId, long userId, int start,
1634        int end, OrderByComparator orderByComparator) throws SystemException {
1635        Object[] finderArgs = new Object[] {
1636                new Long(companyId), new Long(userId),
1637                
1638                String.valueOf(start), String.valueOf(end),
1639                String.valueOf(orderByComparator)
1640            };
1641
1642        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_C_U,
1643                finderArgs, this);
1644
1645        if (list == null) {
1646            Session session = null;
1647
1648            try {
1649                session = openSession();
1650
1651                StringBundler query = null;
1652
1653                if (orderByComparator != null) {
1654                    query = new StringBundler(4 +
1655                            (orderByComparator.getOrderByFields().length * 3));
1656                }
1657                else {
1658                    query = new StringBundler(4);
1659                }
1660
1661                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1662
1663                query.append(_FINDER_COLUMN_C_U_COMPANYID_2);
1664
1665                query.append(_FINDER_COLUMN_C_U_USERID_2);
1666
1667                if (orderByComparator != null) {
1668                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1669                        orderByComparator);
1670                }
1671
1672                else {
1673                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1674                }
1675
1676                String sql = query.toString();
1677
1678                Query q = session.createQuery(sql);
1679
1680                QueryPos qPos = QueryPos.getInstance(q);
1681
1682                qPos.add(companyId);
1683
1684                qPos.add(userId);
1685
1686                list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
1687                        end);
1688            }
1689            catch (Exception e) {
1690                throw processException(e);
1691            }
1692            finally {
1693                if (list == null) {
1694                    list = new ArrayList<BlogsEntry>();
1695                }
1696
1697                cacheResult(list);
1698
1699                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_C_U,
1700                    finderArgs, list);
1701
1702                closeSession(session);
1703            }
1704        }
1705
1706        return list;
1707    }
1708
1709    public BlogsEntry findByC_U_First(long companyId, long userId,
1710        OrderByComparator orderByComparator)
1711        throws NoSuchEntryException, SystemException {
1712        List<BlogsEntry> list = findByC_U(companyId, userId, 0, 1,
1713                orderByComparator);
1714
1715        if (list.isEmpty()) {
1716            StringBundler msg = new StringBundler(6);
1717
1718            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1719
1720            msg.append("companyId=");
1721            msg.append(companyId);
1722
1723            msg.append(", userId=");
1724            msg.append(userId);
1725
1726            msg.append(StringPool.CLOSE_CURLY_BRACE);
1727
1728            throw new NoSuchEntryException(msg.toString());
1729        }
1730        else {
1731            return list.get(0);
1732        }
1733    }
1734
1735    public BlogsEntry findByC_U_Last(long companyId, long userId,
1736        OrderByComparator orderByComparator)
1737        throws NoSuchEntryException, SystemException {
1738        int count = countByC_U(companyId, userId);
1739
1740        List<BlogsEntry> list = findByC_U(companyId, userId, count - 1, count,
1741                orderByComparator);
1742
1743        if (list.isEmpty()) {
1744            StringBundler msg = new StringBundler(6);
1745
1746            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1747
1748            msg.append("companyId=");
1749            msg.append(companyId);
1750
1751            msg.append(", userId=");
1752            msg.append(userId);
1753
1754            msg.append(StringPool.CLOSE_CURLY_BRACE);
1755
1756            throw new NoSuchEntryException(msg.toString());
1757        }
1758        else {
1759            return list.get(0);
1760        }
1761    }
1762
1763    public BlogsEntry[] findByC_U_PrevAndNext(long entryId, long companyId,
1764        long userId, OrderByComparator orderByComparator)
1765        throws NoSuchEntryException, SystemException {
1766        BlogsEntry blogsEntry = findByPrimaryKey(entryId);
1767
1768        int count = countByC_U(companyId, userId);
1769
1770        Session session = null;
1771
1772        try {
1773            session = openSession();
1774
1775            StringBundler query = null;
1776
1777            if (orderByComparator != null) {
1778                query = new StringBundler(4 +
1779                        (orderByComparator.getOrderByFields().length * 3));
1780            }
1781            else {
1782                query = new StringBundler(4);
1783            }
1784
1785            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1786
1787            query.append(_FINDER_COLUMN_C_U_COMPANYID_2);
1788
1789            query.append(_FINDER_COLUMN_C_U_USERID_2);
1790
1791            if (orderByComparator != null) {
1792                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1793                    orderByComparator);
1794            }
1795
1796            else {
1797                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1798            }
1799
1800            String sql = query.toString();
1801
1802            Query q = session.createQuery(sql);
1803
1804            QueryPos qPos = QueryPos.getInstance(q);
1805
1806            qPos.add(companyId);
1807
1808            qPos.add(userId);
1809
1810            Object[] objArray = QueryUtil.getPrevAndNext(q, count,
1811                    orderByComparator, blogsEntry);
1812
1813            BlogsEntry[] array = new BlogsEntryImpl[3];
1814
1815            array[0] = (BlogsEntry)objArray[0];
1816            array[1] = (BlogsEntry)objArray[1];
1817            array[2] = (BlogsEntry)objArray[2];
1818
1819            return array;
1820        }
1821        catch (Exception e) {
1822            throw processException(e);
1823        }
1824        finally {
1825            closeSession(session);
1826        }
1827    }
1828
1829    public List<BlogsEntry> findByC_D(long companyId, Date displayDate)
1830        throws SystemException {
1831        Object[] finderArgs = new Object[] { new Long(companyId), displayDate };
1832
1833        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_D,
1834                finderArgs, this);
1835
1836        if (list == null) {
1837            Session session = null;
1838
1839            try {
1840                session = openSession();
1841
1842                StringBundler query = new StringBundler(4);
1843
1844                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1845
1846                query.append(_FINDER_COLUMN_C_D_COMPANYID_2);
1847
1848                if (displayDate == null) {
1849                    query.append(_FINDER_COLUMN_C_D_DISPLAYDATE_1);
1850                }
1851                else {
1852                    query.append(_FINDER_COLUMN_C_D_DISPLAYDATE_2);
1853                }
1854
1855                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1856
1857                String sql = query.toString();
1858
1859                Query q = session.createQuery(sql);
1860
1861                QueryPos qPos = QueryPos.getInstance(q);
1862
1863                qPos.add(companyId);
1864
1865                if (displayDate != null) {
1866                    qPos.add(CalendarUtil.getTimestamp(displayDate));
1867                }
1868
1869                list = q.list();
1870            }
1871            catch (Exception e) {
1872                throw processException(e);
1873            }
1874            finally {
1875                if (list == null) {
1876                    list = new ArrayList<BlogsEntry>();
1877                }
1878
1879                cacheResult(list);
1880
1881                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_D, finderArgs,
1882                    list);
1883
1884                closeSession(session);
1885            }
1886        }
1887
1888        return list;
1889    }
1890
1891    public List<BlogsEntry> findByC_D(long companyId, Date displayDate,
1892        int start, int end) throws SystemException {
1893        return findByC_D(companyId, displayDate, start, end, null);
1894    }
1895
1896    public List<BlogsEntry> findByC_D(long companyId, Date displayDate,
1897        int start, int end, OrderByComparator orderByComparator)
1898        throws SystemException {
1899        Object[] finderArgs = new Object[] {
1900                new Long(companyId),
1901                
1902                displayDate,
1903                
1904                String.valueOf(start), String.valueOf(end),
1905                String.valueOf(orderByComparator)
1906            };
1907
1908        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_C_D,
1909                finderArgs, this);
1910
1911        if (list == null) {
1912            Session session = null;
1913
1914            try {
1915                session = openSession();
1916
1917                StringBundler query = null;
1918
1919                if (orderByComparator != null) {
1920                    query = new StringBundler(4 +
1921                            (orderByComparator.getOrderByFields().length * 3));
1922                }
1923                else {
1924                    query = new StringBundler(4);
1925                }
1926
1927                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1928
1929                query.append(_FINDER_COLUMN_C_D_COMPANYID_2);
1930
1931                if (displayDate == null) {
1932                    query.append(_FINDER_COLUMN_C_D_DISPLAYDATE_1);
1933                }
1934                else {
1935                    query.append(_FINDER_COLUMN_C_D_DISPLAYDATE_2);
1936                }
1937
1938                if (orderByComparator != null) {
1939                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1940                        orderByComparator);
1941                }
1942
1943                else {
1944                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1945                }
1946
1947                String sql = query.toString();
1948
1949                Query q = session.createQuery(sql);
1950
1951                QueryPos qPos = QueryPos.getInstance(q);
1952
1953                qPos.add(companyId);
1954
1955                if (displayDate != null) {
1956                    qPos.add(CalendarUtil.getTimestamp(displayDate));
1957                }
1958
1959                list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
1960                        end);
1961            }
1962            catch (Exception e) {
1963                throw processException(e);
1964            }
1965            finally {
1966                if (list == null) {
1967                    list = new ArrayList<BlogsEntry>();
1968                }
1969
1970                cacheResult(list);
1971
1972                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_C_D,
1973                    finderArgs, list);
1974
1975                closeSession(session);
1976            }
1977        }
1978
1979        return list;
1980    }
1981
1982    public BlogsEntry findByC_D_First(long companyId, Date displayDate,
1983        OrderByComparator orderByComparator)
1984        throws NoSuchEntryException, SystemException {
1985        List<BlogsEntry> list = findByC_D(companyId, displayDate, 0, 1,
1986                orderByComparator);
1987
1988        if (list.isEmpty()) {
1989            StringBundler msg = new StringBundler(6);
1990
1991            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1992
1993            msg.append("companyId=");
1994            msg.append(companyId);
1995
1996            msg.append(", displayDate=");
1997            msg.append(displayDate);
1998
1999            msg.append(StringPool.CLOSE_CURLY_BRACE);
2000
2001            throw new NoSuchEntryException(msg.toString());
2002        }
2003        else {
2004            return list.get(0);
2005        }
2006    }
2007
2008    public BlogsEntry findByC_D_Last(long companyId, Date displayDate,
2009        OrderByComparator orderByComparator)
2010        throws NoSuchEntryException, SystemException {
2011        int count = countByC_D(companyId, displayDate);
2012
2013        List<BlogsEntry> list = findByC_D(companyId, displayDate, count - 1,
2014                count, orderByComparator);
2015
2016        if (list.isEmpty()) {
2017            StringBundler msg = new StringBundler(6);
2018
2019            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2020
2021            msg.append("companyId=");
2022            msg.append(companyId);
2023
2024            msg.append(", displayDate=");
2025            msg.append(displayDate);
2026
2027            msg.append(StringPool.CLOSE_CURLY_BRACE);
2028
2029            throw new NoSuchEntryException(msg.toString());
2030        }
2031        else {
2032            return list.get(0);
2033        }
2034    }
2035
2036    public BlogsEntry[] findByC_D_PrevAndNext(long entryId, long companyId,
2037        Date displayDate, OrderByComparator orderByComparator)
2038        throws NoSuchEntryException, SystemException {
2039        BlogsEntry blogsEntry = findByPrimaryKey(entryId);
2040
2041        int count = countByC_D(companyId, displayDate);
2042
2043        Session session = null;
2044
2045        try {
2046            session = openSession();
2047
2048            StringBundler query = null;
2049
2050            if (orderByComparator != null) {
2051                query = new StringBundler(4 +
2052                        (orderByComparator.getOrderByFields().length * 3));
2053            }
2054            else {
2055                query = new StringBundler(4);
2056            }
2057
2058            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2059
2060            query.append(_FINDER_COLUMN_C_D_COMPANYID_2);
2061
2062            if (displayDate == null) {
2063                query.append(_FINDER_COLUMN_C_D_DISPLAYDATE_1);
2064            }
2065            else {
2066                query.append(_FINDER_COLUMN_C_D_DISPLAYDATE_2);
2067            }
2068
2069            if (orderByComparator != null) {
2070                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2071                    orderByComparator);
2072            }
2073
2074            else {
2075                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2076            }
2077
2078            String sql = query.toString();
2079
2080            Query q = session.createQuery(sql);
2081
2082            QueryPos qPos = QueryPos.getInstance(q);
2083
2084            qPos.add(companyId);
2085
2086            if (displayDate != null) {
2087                qPos.add(CalendarUtil.getTimestamp(displayDate));
2088            }
2089
2090            Object[] objArray = QueryUtil.getPrevAndNext(q, count,
2091                    orderByComparator, blogsEntry);
2092
2093            BlogsEntry[] array = new BlogsEntryImpl[3];
2094
2095            array[0] = (BlogsEntry)objArray[0];
2096            array[1] = (BlogsEntry)objArray[1];
2097            array[2] = (BlogsEntry)objArray[2];
2098
2099            return array;
2100        }
2101        catch (Exception e) {
2102            throw processException(e);
2103        }
2104        finally {
2105            closeSession(session);
2106        }
2107    }
2108
2109    public List<BlogsEntry> findByC_S(long companyId, int status)
2110        throws SystemException {
2111        Object[] finderArgs = new Object[] {
2112                new Long(companyId), new Integer(status)
2113            };
2114
2115        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_S,
2116                finderArgs, this);
2117
2118        if (list == null) {
2119            Session session = null;
2120
2121            try {
2122                session = openSession();
2123
2124                StringBundler query = new StringBundler(4);
2125
2126                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2127
2128                query.append(_FINDER_COLUMN_C_S_COMPANYID_2);
2129
2130                query.append(_FINDER_COLUMN_C_S_STATUS_2);
2131
2132                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2133
2134                String sql = query.toString();
2135
2136                Query q = session.createQuery(sql);
2137
2138                QueryPos qPos = QueryPos.getInstance(q);
2139
2140                qPos.add(companyId);
2141
2142                qPos.add(status);
2143
2144                list = q.list();
2145            }
2146            catch (Exception e) {
2147                throw processException(e);
2148            }
2149            finally {
2150                if (list == null) {
2151                    list = new ArrayList<BlogsEntry>();
2152                }
2153
2154                cacheResult(list);
2155
2156                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_S, finderArgs,
2157                    list);
2158
2159                closeSession(session);
2160            }
2161        }
2162
2163        return list;
2164    }
2165
2166    public List<BlogsEntry> findByC_S(long companyId, int status, int start,
2167        int end) throws SystemException {
2168        return findByC_S(companyId, status, start, end, null);
2169    }
2170
2171    public List<BlogsEntry> findByC_S(long companyId, int status, int start,
2172        int end, OrderByComparator orderByComparator) throws SystemException {
2173        Object[] finderArgs = new Object[] {
2174                new Long(companyId), new Integer(status),
2175                
2176                String.valueOf(start), String.valueOf(end),
2177                String.valueOf(orderByComparator)
2178            };
2179
2180        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_C_S,
2181                finderArgs, this);
2182
2183        if (list == null) {
2184            Session session = null;
2185
2186            try {
2187                session = openSession();
2188
2189                StringBundler query = null;
2190
2191                if (orderByComparator != null) {
2192                    query = new StringBundler(4 +
2193                            (orderByComparator.getOrderByFields().length * 3));
2194                }
2195                else {
2196                    query = new StringBundler(4);
2197                }
2198
2199                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2200
2201                query.append(_FINDER_COLUMN_C_S_COMPANYID_2);
2202
2203                query.append(_FINDER_COLUMN_C_S_STATUS_2);
2204
2205                if (orderByComparator != null) {
2206                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2207                        orderByComparator);
2208                }
2209
2210                else {
2211                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2212                }
2213
2214                String sql = query.toString();
2215
2216                Query q = session.createQuery(sql);
2217
2218                QueryPos qPos = QueryPos.getInstance(q);
2219
2220                qPos.add(companyId);
2221
2222                qPos.add(status);
2223
2224                list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
2225                        end);
2226            }
2227            catch (Exception e) {
2228                throw processException(e);
2229            }
2230            finally {
2231                if (list == null) {
2232                    list = new ArrayList<BlogsEntry>();
2233                }
2234
2235                cacheResult(list);
2236
2237                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_C_S,
2238                    finderArgs, list);
2239
2240                closeSession(session);
2241            }
2242        }
2243
2244        return list;
2245    }
2246
2247    public BlogsEntry findByC_S_First(long companyId, int status,
2248        OrderByComparator orderByComparator)
2249        throws NoSuchEntryException, SystemException {
2250        List<BlogsEntry> list = findByC_S(companyId, status, 0, 1,
2251                orderByComparator);
2252
2253        if (list.isEmpty()) {
2254            StringBundler msg = new StringBundler(6);
2255
2256            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2257
2258            msg.append("companyId=");
2259            msg.append(companyId);
2260
2261            msg.append(", status=");
2262            msg.append(status);
2263
2264            msg.append(StringPool.CLOSE_CURLY_BRACE);
2265
2266            throw new NoSuchEntryException(msg.toString());
2267        }
2268        else {
2269            return list.get(0);
2270        }
2271    }
2272
2273    public BlogsEntry findByC_S_Last(long companyId, int status,
2274        OrderByComparator orderByComparator)
2275        throws NoSuchEntryException, SystemException {
2276        int count = countByC_S(companyId, status);
2277
2278        List<BlogsEntry> list = findByC_S(companyId, status, count - 1, count,
2279                orderByComparator);
2280
2281        if (list.isEmpty()) {
2282            StringBundler msg = new StringBundler(6);
2283
2284            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2285
2286            msg.append("companyId=");
2287            msg.append(companyId);
2288
2289            msg.append(", status=");
2290            msg.append(status);
2291
2292            msg.append(StringPool.CLOSE_CURLY_BRACE);
2293
2294            throw new NoSuchEntryException(msg.toString());
2295        }
2296        else {
2297            return list.get(0);
2298        }
2299    }
2300
2301    public BlogsEntry[] findByC_S_PrevAndNext(long entryId, long companyId,
2302        int status, OrderByComparator orderByComparator)
2303        throws NoSuchEntryException, SystemException {
2304        BlogsEntry blogsEntry = findByPrimaryKey(entryId);
2305
2306        int count = countByC_S(companyId, status);
2307
2308        Session session = null;
2309
2310        try {
2311            session = openSession();
2312
2313            StringBundler query = null;
2314
2315            if (orderByComparator != null) {
2316                query = new StringBundler(4 +
2317                        (orderByComparator.getOrderByFields().length * 3));
2318            }
2319            else {
2320                query = new StringBundler(4);
2321            }
2322
2323            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2324
2325            query.append(_FINDER_COLUMN_C_S_COMPANYID_2);
2326
2327            query.append(_FINDER_COLUMN_C_S_STATUS_2);
2328
2329            if (orderByComparator != null) {
2330                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2331                    orderByComparator);
2332            }
2333
2334            else {
2335                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2336            }
2337
2338            String sql = query.toString();
2339
2340            Query q = session.createQuery(sql);
2341
2342            QueryPos qPos = QueryPos.getInstance(q);
2343
2344            qPos.add(companyId);
2345
2346            qPos.add(status);
2347
2348            Object[] objArray = QueryUtil.getPrevAndNext(q, count,
2349                    orderByComparator, blogsEntry);
2350
2351            BlogsEntry[] array = new BlogsEntryImpl[3];
2352
2353            array[0] = (BlogsEntry)objArray[0];
2354            array[1] = (BlogsEntry)objArray[1];
2355            array[2] = (BlogsEntry)objArray[2];
2356
2357            return array;
2358        }
2359        catch (Exception e) {
2360            throw processException(e);
2361        }
2362        finally {
2363            closeSession(session);
2364        }
2365    }
2366
2367    public BlogsEntry findByG_UT(long groupId, String urlTitle)
2368        throws NoSuchEntryException, SystemException {
2369        BlogsEntry blogsEntry = fetchByG_UT(groupId, urlTitle);
2370
2371        if (blogsEntry == null) {
2372            StringBundler msg = new StringBundler(6);
2373
2374            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2375
2376            msg.append("groupId=");
2377            msg.append(groupId);
2378
2379            msg.append(", urlTitle=");
2380            msg.append(urlTitle);
2381
2382            msg.append(StringPool.CLOSE_CURLY_BRACE);
2383
2384            if (_log.isWarnEnabled()) {
2385                _log.warn(msg.toString());
2386            }
2387
2388            throw new NoSuchEntryException(msg.toString());
2389        }
2390
2391        return blogsEntry;
2392    }
2393
2394    public BlogsEntry fetchByG_UT(long groupId, String urlTitle)
2395        throws SystemException {
2396        return fetchByG_UT(groupId, urlTitle, true);
2397    }
2398
2399    public BlogsEntry fetchByG_UT(long groupId, String urlTitle,
2400        boolean retrieveFromCache) throws SystemException {
2401        Object[] finderArgs = new Object[] { new Long(groupId), urlTitle };
2402
2403        Object result = null;
2404
2405        if (retrieveFromCache) {
2406            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_UT,
2407                    finderArgs, this);
2408        }
2409
2410        if (result == null) {
2411            Session session = null;
2412
2413            try {
2414                session = openSession();
2415
2416                StringBundler query = new StringBundler(4);
2417
2418                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2419
2420                query.append(_FINDER_COLUMN_G_UT_GROUPID_2);
2421
2422                if (urlTitle == null) {
2423                    query.append(_FINDER_COLUMN_G_UT_URLTITLE_1);
2424                }
2425                else {
2426                    if (urlTitle.equals(StringPool.BLANK)) {
2427                        query.append(_FINDER_COLUMN_G_UT_URLTITLE_3);
2428                    }
2429                    else {
2430                        query.append(_FINDER_COLUMN_G_UT_URLTITLE_2);
2431                    }
2432                }
2433
2434                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2435
2436                String sql = query.toString();
2437
2438                Query q = session.createQuery(sql);
2439
2440                QueryPos qPos = QueryPos.getInstance(q);
2441
2442                qPos.add(groupId);
2443
2444                if (urlTitle != null) {
2445                    qPos.add(urlTitle);
2446                }
2447
2448                List<BlogsEntry> list = q.list();
2449
2450                result = list;
2451
2452                BlogsEntry blogsEntry = null;
2453
2454                if (list.isEmpty()) {
2455                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_UT,
2456                        finderArgs, list);
2457                }
2458                else {
2459                    blogsEntry = list.get(0);
2460
2461                    cacheResult(blogsEntry);
2462
2463                    if ((blogsEntry.getGroupId() != groupId) ||
2464                            (blogsEntry.getUrlTitle() == null) ||
2465                            !blogsEntry.getUrlTitle().equals(urlTitle)) {
2466                        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_UT,
2467                            finderArgs, blogsEntry);
2468                    }
2469                }
2470
2471                return blogsEntry;
2472            }
2473            catch (Exception e) {
2474                throw processException(e);
2475            }
2476            finally {
2477                if (result == null) {
2478                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_UT,
2479                        finderArgs, new ArrayList<BlogsEntry>());
2480                }
2481
2482                closeSession(session);
2483            }
2484        }
2485        else {
2486            if (result instanceof List<?>) {
2487                return null;
2488            }
2489            else {
2490                return (BlogsEntry)result;
2491            }
2492        }
2493    }
2494
2495    public List<BlogsEntry> findByG_D(long groupId, Date displayDate)
2496        throws SystemException {
2497        Object[] finderArgs = new Object[] { new Long(groupId), displayDate };
2498
2499        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_D,
2500                finderArgs, this);
2501
2502        if (list == null) {
2503            Session session = null;
2504
2505            try {
2506                session = openSession();
2507
2508                StringBundler query = new StringBundler(4);
2509
2510                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2511
2512                query.append(_FINDER_COLUMN_G_D_GROUPID_2);
2513
2514                if (displayDate == null) {
2515                    query.append(_FINDER_COLUMN_G_D_DISPLAYDATE_1);
2516                }
2517                else {
2518                    query.append(_FINDER_COLUMN_G_D_DISPLAYDATE_2);
2519                }
2520
2521                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2522
2523                String sql = query.toString();
2524
2525                Query q = session.createQuery(sql);
2526
2527                QueryPos qPos = QueryPos.getInstance(q);
2528
2529                qPos.add(groupId);
2530
2531                if (displayDate != null) {
2532                    qPos.add(CalendarUtil.getTimestamp(displayDate));
2533                }
2534
2535                list = q.list();
2536            }
2537            catch (Exception e) {
2538                throw processException(e);
2539            }
2540            finally {
2541                if (list == null) {
2542                    list = new ArrayList<BlogsEntry>();
2543                }
2544
2545                cacheResult(list);
2546
2547                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_D, finderArgs,
2548                    list);
2549
2550                closeSession(session);
2551            }
2552        }
2553
2554        return list;
2555    }
2556
2557    public List<BlogsEntry> findByG_D(long groupId, Date displayDate,
2558        int start, int end) throws SystemException {
2559        return findByG_D(groupId, displayDate, start, end, null);
2560    }
2561
2562    public List<BlogsEntry> findByG_D(long groupId, Date displayDate,
2563        int start, int end, OrderByComparator orderByComparator)
2564        throws SystemException {
2565        Object[] finderArgs = new Object[] {
2566                new Long(groupId),
2567                
2568                displayDate,
2569                
2570                String.valueOf(start), String.valueOf(end),
2571                String.valueOf(orderByComparator)
2572            };
2573
2574        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_G_D,
2575                finderArgs, this);
2576
2577        if (list == null) {
2578            Session session = null;
2579
2580            try {
2581                session = openSession();
2582
2583                StringBundler query = null;
2584
2585                if (orderByComparator != null) {
2586                    query = new StringBundler(4 +
2587                            (orderByComparator.getOrderByFields().length * 3));
2588                }
2589                else {
2590                    query = new StringBundler(4);
2591                }
2592
2593                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2594
2595                query.append(_FINDER_COLUMN_G_D_GROUPID_2);
2596
2597                if (displayDate == null) {
2598                    query.append(_FINDER_COLUMN_G_D_DISPLAYDATE_1);
2599                }
2600                else {
2601                    query.append(_FINDER_COLUMN_G_D_DISPLAYDATE_2);
2602                }
2603
2604                if (orderByComparator != null) {
2605                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2606                        orderByComparator);
2607                }
2608
2609                else {
2610                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2611                }
2612
2613                String sql = query.toString();
2614
2615                Query q = session.createQuery(sql);
2616
2617                QueryPos qPos = QueryPos.getInstance(q);
2618
2619                qPos.add(groupId);
2620
2621                if (displayDate != null) {
2622                    qPos.add(CalendarUtil.getTimestamp(displayDate));
2623                }
2624
2625                list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
2626                        end);
2627            }
2628            catch (Exception e) {
2629                throw processException(e);
2630            }
2631            finally {
2632                if (list == null) {
2633                    list = new ArrayList<BlogsEntry>();
2634                }
2635
2636                cacheResult(list);
2637
2638                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_G_D,
2639                    finderArgs, list);
2640
2641                closeSession(session);
2642            }
2643        }
2644
2645        return list;
2646    }
2647
2648    public BlogsEntry findByG_D_First(long groupId, Date displayDate,
2649        OrderByComparator orderByComparator)
2650        throws NoSuchEntryException, SystemException {
2651        List<BlogsEntry> list = findByG_D(groupId, displayDate, 0, 1,
2652                orderByComparator);
2653
2654        if (list.isEmpty()) {
2655            StringBundler msg = new StringBundler(6);
2656
2657            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2658
2659            msg.append("groupId=");
2660            msg.append(groupId);
2661
2662            msg.append(", displayDate=");
2663            msg.append(displayDate);
2664
2665            msg.append(StringPool.CLOSE_CURLY_BRACE);
2666
2667            throw new NoSuchEntryException(msg.toString());
2668        }
2669        else {
2670            return list.get(0);
2671        }
2672    }
2673
2674    public BlogsEntry findByG_D_Last(long groupId, Date displayDate,
2675        OrderByComparator orderByComparator)
2676        throws NoSuchEntryException, SystemException {
2677        int count = countByG_D(groupId, displayDate);
2678
2679        List<BlogsEntry> list = findByG_D(groupId, displayDate, count - 1,
2680                count, orderByComparator);
2681
2682        if (list.isEmpty()) {
2683            StringBundler msg = new StringBundler(6);
2684
2685            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2686
2687            msg.append("groupId=");
2688            msg.append(groupId);
2689
2690            msg.append(", displayDate=");
2691            msg.append(displayDate);
2692
2693            msg.append(StringPool.CLOSE_CURLY_BRACE);
2694
2695            throw new NoSuchEntryException(msg.toString());
2696        }
2697        else {
2698            return list.get(0);
2699        }
2700    }
2701
2702    public BlogsEntry[] findByG_D_PrevAndNext(long entryId, long groupId,
2703        Date displayDate, OrderByComparator orderByComparator)
2704        throws NoSuchEntryException, SystemException {
2705        BlogsEntry blogsEntry = findByPrimaryKey(entryId);
2706
2707        int count = countByG_D(groupId, displayDate);
2708
2709        Session session = null;
2710
2711        try {
2712            session = openSession();
2713
2714            StringBundler query = null;
2715
2716            if (orderByComparator != null) {
2717                query = new StringBundler(4 +
2718                        (orderByComparator.getOrderByFields().length * 3));
2719            }
2720            else {
2721                query = new StringBundler(4);
2722            }
2723
2724            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2725
2726            query.append(_FINDER_COLUMN_G_D_GROUPID_2);
2727
2728            if (displayDate == null) {
2729                query.append(_FINDER_COLUMN_G_D_DISPLAYDATE_1);
2730            }
2731            else {
2732                query.append(_FINDER_COLUMN_G_D_DISPLAYDATE_2);
2733            }
2734
2735            if (orderByComparator != null) {
2736                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2737                    orderByComparator);
2738            }
2739
2740            else {
2741                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2742            }
2743
2744            String sql = query.toString();
2745
2746            Query q = session.createQuery(sql);
2747
2748            QueryPos qPos = QueryPos.getInstance(q);
2749
2750            qPos.add(groupId);
2751
2752            if (displayDate != null) {
2753                qPos.add(CalendarUtil.getTimestamp(displayDate));
2754            }
2755
2756            Object[] objArray = QueryUtil.getPrevAndNext(q, count,
2757                    orderByComparator, blogsEntry);
2758
2759            BlogsEntry[] array = new BlogsEntryImpl[3];
2760
2761            array[0] = (BlogsEntry)objArray[0];
2762            array[1] = (BlogsEntry)objArray[1];
2763            array[2] = (BlogsEntry)objArray[2];
2764
2765            return array;
2766        }
2767        catch (Exception e) {
2768            throw processException(e);
2769        }
2770        finally {
2771            closeSession(session);
2772        }
2773    }
2774
2775    public List<BlogsEntry> findByG_S(long groupId, int status)
2776        throws SystemException {
2777        Object[] finderArgs = new Object[] {
2778                new Long(groupId), new Integer(status)
2779            };
2780
2781        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_S,
2782                finderArgs, this);
2783
2784        if (list == null) {
2785            Session session = null;
2786
2787            try {
2788                session = openSession();
2789
2790                StringBundler query = new StringBundler(4);
2791
2792                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2793
2794                query.append(_FINDER_COLUMN_G_S_GROUPID_2);
2795
2796                query.append(_FINDER_COLUMN_G_S_STATUS_2);
2797
2798                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2799
2800                String sql = query.toString();
2801
2802                Query q = session.createQuery(sql);
2803
2804                QueryPos qPos = QueryPos.getInstance(q);
2805
2806                qPos.add(groupId);
2807
2808                qPos.add(status);
2809
2810                list = q.list();
2811            }
2812            catch (Exception e) {
2813                throw processException(e);
2814            }
2815            finally {
2816                if (list == null) {
2817                    list = new ArrayList<BlogsEntry>();
2818                }
2819
2820                cacheResult(list);
2821
2822                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_S, finderArgs,
2823                    list);
2824
2825                closeSession(session);
2826            }
2827        }
2828
2829        return list;
2830    }
2831
2832    public List<BlogsEntry> findByG_S(long groupId, int status, int start,
2833        int end) throws SystemException {
2834        return findByG_S(groupId, status, start, end, null);
2835    }
2836
2837    public List<BlogsEntry> findByG_S(long groupId, int status, int start,
2838        int end, OrderByComparator orderByComparator) throws SystemException {
2839        Object[] finderArgs = new Object[] {
2840                new Long(groupId), new Integer(status),
2841                
2842                String.valueOf(start), String.valueOf(end),
2843                String.valueOf(orderByComparator)
2844            };
2845
2846        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_G_S,
2847                finderArgs, this);
2848
2849        if (list == null) {
2850            Session session = null;
2851
2852            try {
2853                session = openSession();
2854
2855                StringBundler query = null;
2856
2857                if (orderByComparator != null) {
2858                    query = new StringBundler(4 +
2859                            (orderByComparator.getOrderByFields().length * 3));
2860                }
2861                else {
2862                    query = new StringBundler(4);
2863                }
2864
2865                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2866
2867                query.append(_FINDER_COLUMN_G_S_GROUPID_2);
2868
2869                query.append(_FINDER_COLUMN_G_S_STATUS_2);
2870
2871                if (orderByComparator != null) {
2872                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2873                        orderByComparator);
2874                }
2875
2876                else {
2877                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2878                }
2879
2880                String sql = query.toString();
2881
2882                Query q = session.createQuery(sql);
2883
2884                QueryPos qPos = QueryPos.getInstance(q);
2885
2886                qPos.add(groupId);
2887
2888                qPos.add(status);
2889
2890                list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
2891                        end);
2892            }
2893            catch (Exception e) {
2894                throw processException(e);
2895            }
2896            finally {
2897                if (list == null) {
2898                    list = new ArrayList<BlogsEntry>();
2899                }
2900
2901                cacheResult(list);
2902
2903                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_G_S,
2904                    finderArgs, list);
2905
2906                closeSession(session);
2907            }
2908        }
2909
2910        return list;
2911    }
2912
2913    public BlogsEntry findByG_S_First(long groupId, int status,
2914        OrderByComparator orderByComparator)
2915        throws NoSuchEntryException, SystemException {
2916        List<BlogsEntry> list = findByG_S(groupId, status, 0, 1,
2917                orderByComparator);
2918
2919        if (list.isEmpty()) {
2920            StringBundler msg = new StringBundler(6);
2921
2922            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2923
2924            msg.append("groupId=");
2925            msg.append(groupId);
2926
2927            msg.append(", status=");
2928            msg.append(status);
2929
2930            msg.append(StringPool.CLOSE_CURLY_BRACE);
2931
2932            throw new NoSuchEntryException(msg.toString());
2933        }
2934        else {
2935            return list.get(0);
2936        }
2937    }
2938
2939    public BlogsEntry findByG_S_Last(long groupId, int status,
2940        OrderByComparator orderByComparator)
2941        throws NoSuchEntryException, SystemException {
2942        int count = countByG_S(groupId, status);
2943
2944        List<BlogsEntry> list = findByG_S(groupId, status, count - 1, count,
2945                orderByComparator);
2946
2947        if (list.isEmpty()) {
2948            StringBundler msg = new StringBundler(6);
2949
2950            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2951
2952            msg.append("groupId=");
2953            msg.append(groupId);
2954
2955            msg.append(", status=");
2956            msg.append(status);
2957
2958            msg.append(StringPool.CLOSE_CURLY_BRACE);
2959
2960            throw new NoSuchEntryException(msg.toString());
2961        }
2962        else {
2963            return list.get(0);
2964        }
2965    }
2966
2967    public BlogsEntry[] findByG_S_PrevAndNext(long entryId, long groupId,
2968        int status, OrderByComparator orderByComparator)
2969        throws NoSuchEntryException, SystemException {
2970        BlogsEntry blogsEntry = findByPrimaryKey(entryId);
2971
2972        int count = countByG_S(groupId, status);
2973
2974        Session session = null;
2975
2976        try {
2977            session = openSession();
2978
2979            StringBundler query = null;
2980
2981            if (orderByComparator != null) {
2982                query = new StringBundler(4 +
2983                        (orderByComparator.getOrderByFields().length * 3));
2984            }
2985            else {
2986                query = new StringBundler(4);
2987            }
2988
2989            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2990
2991            query.append(_FINDER_COLUMN_G_S_GROUPID_2);
2992
2993            query.append(_FINDER_COLUMN_G_S_STATUS_2);
2994
2995            if (orderByComparator != null) {
2996                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2997                    orderByComparator);
2998            }
2999
3000            else {
3001                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
3002            }
3003
3004            String sql = query.toString();
3005
3006            Query q = session.createQuery(sql);
3007
3008            QueryPos qPos = QueryPos.getInstance(q);
3009
3010            qPos.add(groupId);
3011
3012            qPos.add(status);
3013
3014            Object[] objArray = QueryUtil.getPrevAndNext(q, count,
3015                    orderByComparator, blogsEntry);
3016
3017            BlogsEntry[] array = new BlogsEntryImpl[3];
3018
3019            array[0] = (BlogsEntry)objArray[0];
3020            array[1] = (BlogsEntry)objArray[1];
3021            array[2] = (BlogsEntry)objArray[2];
3022
3023            return array;
3024        }
3025        catch (Exception e) {
3026            throw processException(e);
3027        }
3028        finally {
3029            closeSession(session);
3030        }
3031    }
3032
3033    public List<BlogsEntry> findByC_U_S(long companyId, long userId, int status)
3034        throws SystemException {
3035        Object[] finderArgs = new Object[] {
3036                new Long(companyId), new Long(userId), new Integer(status)
3037            };
3038
3039        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_U_S,
3040                finderArgs, this);
3041
3042        if (list == null) {
3043            Session session = null;
3044
3045            try {
3046                session = openSession();
3047
3048                StringBundler query = new StringBundler(5);
3049
3050                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
3051
3052                query.append(_FINDER_COLUMN_C_U_S_COMPANYID_2);
3053
3054                query.append(_FINDER_COLUMN_C_U_S_USERID_2);
3055
3056                query.append(_FINDER_COLUMN_C_U_S_STATUS_2);
3057
3058                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
3059
3060                String sql = query.toString();
3061
3062                Query q = session.createQuery(sql);
3063
3064                QueryPos qPos = QueryPos.getInstance(q);
3065
3066                qPos.add(companyId);
3067
3068                qPos.add(userId);
3069
3070                qPos.add(status);
3071
3072                list = q.list();
3073            }
3074            catch (Exception e) {
3075                throw processException(e);
3076            }
3077            finally {
3078                if (list == null) {
3079                    list = new ArrayList<BlogsEntry>();
3080                }
3081
3082                cacheResult(list);
3083
3084                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_U_S,
3085                    finderArgs, list);
3086
3087                closeSession(session);
3088            }
3089        }
3090
3091        return list;
3092    }
3093
3094    public List<BlogsEntry> findByC_U_S(long companyId, long userId,
3095        int status, int start, int end) throws SystemException {
3096        return findByC_U_S(companyId, userId, status, start, end, null);
3097    }
3098
3099    public List<BlogsEntry> findByC_U_S(long companyId, long userId,
3100        int status, int start, int end, OrderByComparator orderByComparator)
3101        throws SystemException {
3102        Object[] finderArgs = new Object[] {
3103                new Long(companyId), new Long(userId), new Integer(status),
3104                
3105                String.valueOf(start), String.valueOf(end),
3106                String.valueOf(orderByComparator)
3107            };
3108
3109        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_C_U_S,
3110                finderArgs, this);
3111
3112        if (list == null) {
3113            Session session = null;
3114
3115            try {
3116                session = openSession();
3117
3118                StringBundler query = null;
3119
3120                if (orderByComparator != null) {
3121                    query = new StringBundler(5 +
3122                            (orderByComparator.getOrderByFields().length * 3));
3123                }
3124                else {
3125                    query = new StringBundler(5);
3126                }
3127
3128                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
3129
3130                query.append(_FINDER_COLUMN_C_U_S_COMPANYID_2);
3131
3132                query.append(_FINDER_COLUMN_C_U_S_USERID_2);
3133
3134                query.append(_FINDER_COLUMN_C_U_S_STATUS_2);
3135
3136                if (orderByComparator != null) {
3137                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3138                        orderByComparator);
3139                }
3140
3141                else {
3142                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
3143                }
3144
3145                String sql = query.toString();
3146
3147                Query q = session.createQuery(sql);
3148
3149                QueryPos qPos = QueryPos.getInstance(q);
3150
3151                qPos.add(companyId);
3152
3153                qPos.add(userId);
3154
3155                qPos.add(status);
3156
3157                list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
3158                        end);
3159            }
3160            catch (Exception e) {
3161                throw processException(e);
3162            }
3163            finally {
3164                if (list == null) {
3165                    list = new ArrayList<BlogsEntry>();
3166                }
3167
3168                cacheResult(list);
3169
3170                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_C_U_S,
3171                    finderArgs, list);
3172
3173                closeSession(session);
3174            }
3175        }
3176
3177        return list;
3178    }
3179
3180    public BlogsEntry findByC_U_S_First(long companyId, long userId,
3181        int status, OrderByComparator orderByComparator)
3182        throws NoSuchEntryException, SystemException {
3183        List<BlogsEntry> list = findByC_U_S(companyId, userId, status, 0, 1,
3184                orderByComparator);
3185
3186        if (list.isEmpty()) {
3187            StringBundler msg = new StringBundler(8);
3188
3189            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3190
3191            msg.append("companyId=");
3192            msg.append(companyId);
3193
3194            msg.append(", userId=");
3195            msg.append(userId);
3196
3197            msg.append(", status=");
3198            msg.append(status);
3199
3200            msg.append(StringPool.CLOSE_CURLY_BRACE);
3201
3202            throw new NoSuchEntryException(msg.toString());
3203        }
3204        else {
3205            return list.get(0);
3206        }
3207    }
3208
3209    public BlogsEntry findByC_U_S_Last(long companyId, long userId, int status,
3210        OrderByComparator orderByComparator)
3211        throws NoSuchEntryException, SystemException {
3212        int count = countByC_U_S(companyId, userId, status);
3213
3214        List<BlogsEntry> list = findByC_U_S(companyId, userId, status,
3215                count - 1, count, orderByComparator);
3216
3217        if (list.isEmpty()) {
3218            StringBundler msg = new StringBundler(8);
3219
3220            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3221
3222            msg.append("companyId=");
3223            msg.append(companyId);
3224
3225            msg.append(", userId=");
3226            msg.append(userId);
3227
3228            msg.append(", status=");
3229            msg.append(status);
3230
3231            msg.append(StringPool.CLOSE_CURLY_BRACE);
3232
3233            throw new NoSuchEntryException(msg.toString());
3234        }
3235        else {
3236            return list.get(0);
3237        }
3238    }
3239
3240    public BlogsEntry[] findByC_U_S_PrevAndNext(long entryId, long companyId,
3241        long userId, int status, OrderByComparator orderByComparator)
3242        throws NoSuchEntryException, SystemException {
3243        BlogsEntry blogsEntry = findByPrimaryKey(entryId);
3244
3245        int count = countByC_U_S(companyId, userId, status);
3246
3247        Session session = null;
3248
3249        try {
3250            session = openSession();
3251
3252            StringBundler query = null;
3253
3254            if (orderByComparator != null) {
3255                query = new StringBundler(5 +
3256                        (orderByComparator.getOrderByFields().length * 3));
3257            }
3258            else {
3259                query = new StringBundler(5);
3260            }
3261
3262            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
3263
3264            query.append(_FINDER_COLUMN_C_U_S_COMPANYID_2);
3265
3266            query.append(_FINDER_COLUMN_C_U_S_USERID_2);
3267
3268            query.append(_FINDER_COLUMN_C_U_S_STATUS_2);
3269
3270            if (orderByComparator != null) {
3271                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3272                    orderByComparator);
3273            }
3274
3275            else {
3276                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
3277            }
3278
3279            String sql = query.toString();
3280
3281            Query q = session.createQuery(sql);
3282
3283            QueryPos qPos = QueryPos.getInstance(q);
3284
3285            qPos.add(companyId);
3286
3287            qPos.add(userId);
3288
3289            qPos.add(status);
3290
3291            Object[] objArray = QueryUtil.getPrevAndNext(q, count,
3292                    orderByComparator, blogsEntry);
3293
3294            BlogsEntry[] array = new BlogsEntryImpl[3];
3295
3296            array[0] = (BlogsEntry)objArray[0];
3297            array[1] = (BlogsEntry)objArray[1];
3298            array[2] = (BlogsEntry)objArray[2];
3299
3300            return array;
3301        }
3302        catch (Exception e) {
3303            throw processException(e);
3304        }
3305        finally {
3306            closeSession(session);
3307        }
3308    }
3309
3310    public List<BlogsEntry> findByC_D_S(long companyId, Date displayDate,
3311        int status) throws SystemException {
3312        Object[] finderArgs = new Object[] {
3313                new Long(companyId),
3314                
3315                displayDate, new Integer(status)
3316            };
3317
3318        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_D_S,
3319                finderArgs, this);
3320
3321        if (list == null) {
3322            Session session = null;
3323
3324            try {
3325                session = openSession();
3326
3327                StringBundler query = new StringBundler(5);
3328
3329                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
3330
3331                query.append(_FINDER_COLUMN_C_D_S_COMPANYID_2);
3332
3333                if (displayDate == null) {
3334                    query.append(_FINDER_COLUMN_C_D_S_DISPLAYDATE_1);
3335                }
3336                else {
3337                    query.append(_FINDER_COLUMN_C_D_S_DISPLAYDATE_2);
3338                }
3339
3340                query.append(_FINDER_COLUMN_C_D_S_STATUS_2);
3341
3342                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
3343
3344                String sql = query.toString();
3345
3346                Query q = session.createQuery(sql);
3347
3348                QueryPos qPos = QueryPos.getInstance(q);
3349
3350                qPos.add(companyId);
3351
3352                if (displayDate != null) {
3353                    qPos.add(CalendarUtil.getTimestamp(displayDate));
3354                }
3355
3356                qPos.add(status);
3357
3358                list = q.list();
3359            }
3360            catch (Exception e) {
3361                throw processException(e);
3362            }
3363            finally {
3364                if (list == null) {
3365                    list = new ArrayList<BlogsEntry>();
3366                }
3367
3368                cacheResult(list);
3369
3370                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_D_S,
3371                    finderArgs, list);
3372
3373                closeSession(session);
3374            }
3375        }
3376
3377        return list;
3378    }
3379
3380    public List<BlogsEntry> findByC_D_S(long companyId, Date displayDate,
3381        int status, int start, int end) throws SystemException {
3382        return findByC_D_S(companyId, displayDate, status, start, end, null);
3383    }
3384
3385    public List<BlogsEntry> findByC_D_S(long companyId, Date displayDate,
3386        int status, int start, int end, OrderByComparator orderByComparator)
3387        throws SystemException {
3388        Object[] finderArgs = new Object[] {
3389                new Long(companyId),
3390                
3391                displayDate, new Integer(status),
3392                
3393                String.valueOf(start), String.valueOf(end),
3394                String.valueOf(orderByComparator)
3395            };
3396
3397        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_C_D_S,
3398                finderArgs, this);
3399
3400        if (list == null) {
3401            Session session = null;
3402
3403            try {
3404                session = openSession();
3405
3406                StringBundler query = null;
3407
3408                if (orderByComparator != null) {
3409                    query = new StringBundler(5 +
3410                            (orderByComparator.getOrderByFields().length * 3));
3411                }
3412                else {
3413                    query = new StringBundler(5);
3414                }
3415
3416                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
3417
3418                query.append(_FINDER_COLUMN_C_D_S_COMPANYID_2);
3419
3420                if (displayDate == null) {
3421                    query.append(_FINDER_COLUMN_C_D_S_DISPLAYDATE_1);
3422                }
3423                else {
3424                    query.append(_FINDER_COLUMN_C_D_S_DISPLAYDATE_2);
3425                }
3426
3427                query.append(_FINDER_COLUMN_C_D_S_STATUS_2);
3428
3429                if (orderByComparator != null) {
3430                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3431                        orderByComparator);
3432                }
3433
3434                else {
3435                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
3436                }
3437
3438                String sql = query.toString();
3439
3440                Query q = session.createQuery(sql);
3441
3442                QueryPos qPos = QueryPos.getInstance(q);
3443
3444                qPos.add(companyId);
3445
3446                if (displayDate != null) {
3447                    qPos.add(CalendarUtil.getTimestamp(displayDate));
3448                }
3449
3450                qPos.add(status);
3451
3452                list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
3453                        end);
3454            }
3455            catch (Exception e) {
3456                throw processException(e);
3457            }
3458            finally {
3459                if (list == null) {
3460                    list = new ArrayList<BlogsEntry>();
3461                }
3462
3463                cacheResult(list);
3464
3465                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_C_D_S,
3466                    finderArgs, list);
3467
3468                closeSession(session);
3469            }
3470        }
3471
3472        return list;
3473    }
3474
3475    public BlogsEntry findByC_D_S_First(long companyId, Date displayDate,
3476        int status, OrderByComparator orderByComparator)
3477        throws NoSuchEntryException, SystemException {
3478        List<BlogsEntry> list = findByC_D_S(companyId, displayDate, status, 0,
3479                1, orderByComparator);
3480
3481        if (list.isEmpty()) {
3482            StringBundler msg = new StringBundler(8);
3483
3484            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3485
3486            msg.append("companyId=");
3487            msg.append(companyId);
3488
3489            msg.append(", displayDate=");
3490            msg.append(displayDate);
3491
3492            msg.append(", status=");
3493            msg.append(status);
3494
3495            msg.append(StringPool.CLOSE_CURLY_BRACE);
3496
3497            throw new NoSuchEntryException(msg.toString());
3498        }
3499        else {
3500            return list.get(0);
3501        }
3502    }
3503
3504    public BlogsEntry findByC_D_S_Last(long companyId, Date displayDate,
3505        int status, OrderByComparator orderByComparator)
3506        throws NoSuchEntryException, SystemException {
3507        int count = countByC_D_S(companyId, displayDate, status);
3508
3509        List<BlogsEntry> list = findByC_D_S(companyId, displayDate, status,
3510                count - 1, count, orderByComparator);
3511
3512        if (list.isEmpty()) {
3513            StringBundler msg = new StringBundler(8);
3514
3515            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3516
3517            msg.append("companyId=");
3518            msg.append(companyId);
3519
3520            msg.append(", displayDate=");
3521            msg.append(displayDate);
3522
3523            msg.append(", status=");
3524            msg.append(status);
3525
3526            msg.append(StringPool.CLOSE_CURLY_BRACE);
3527
3528            throw new NoSuchEntryException(msg.toString());
3529        }
3530        else {
3531            return list.get(0);
3532        }
3533    }
3534
3535    public BlogsEntry[] findByC_D_S_PrevAndNext(long entryId, long companyId,
3536        Date displayDate, int status, OrderByComparator orderByComparator)
3537        throws NoSuchEntryException, SystemException {
3538        BlogsEntry blogsEntry = findByPrimaryKey(entryId);
3539
3540        int count = countByC_D_S(companyId, displayDate, status);
3541
3542        Session session = null;
3543
3544        try {
3545            session = openSession();
3546
3547            StringBundler query = null;
3548
3549            if (orderByComparator != null) {
3550                query = new StringBundler(5 +
3551                        (orderByComparator.getOrderByFields().length * 3));
3552            }
3553            else {
3554                query = new StringBundler(5);
3555            }
3556
3557            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
3558
3559            query.append(_FINDER_COLUMN_C_D_S_COMPANYID_2);
3560
3561            if (displayDate == null) {
3562                query.append(_FINDER_COLUMN_C_D_S_DISPLAYDATE_1);
3563            }
3564            else {
3565                query.append(_FINDER_COLUMN_C_D_S_DISPLAYDATE_2);
3566            }
3567
3568            query.append(_FINDER_COLUMN_C_D_S_STATUS_2);
3569
3570            if (orderByComparator != null) {
3571                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3572                    orderByComparator);
3573            }
3574
3575            else {
3576                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
3577            }
3578
3579            String sql = query.toString();
3580
3581            Query q = session.createQuery(sql);
3582
3583            QueryPos qPos = QueryPos.getInstance(q);
3584
3585            qPos.add(companyId);
3586
3587            if (displayDate != null) {
3588                qPos.add(CalendarUtil.getTimestamp(displayDate));
3589            }
3590
3591            qPos.add(status);
3592
3593            Object[] objArray = QueryUtil.getPrevAndNext(q, count,
3594                    orderByComparator, blogsEntry);
3595
3596            BlogsEntry[] array = new BlogsEntryImpl[3];
3597
3598            array[0] = (BlogsEntry)objArray[0];
3599            array[1] = (BlogsEntry)objArray[1];
3600            array[2] = (BlogsEntry)objArray[2];
3601
3602            return array;
3603        }
3604        catch (Exception e) {
3605            throw processException(e);
3606        }
3607        finally {
3608            closeSession(session);
3609        }
3610    }
3611
3612    public List<BlogsEntry> findByG_U_D(long groupId, long userId,
3613        Date displayDate) throws SystemException {
3614        Object[] finderArgs = new Object[] {
3615                new Long(groupId), new Long(userId),
3616                
3617                displayDate
3618            };
3619
3620        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_U_D,
3621                finderArgs, this);
3622
3623        if (list == null) {
3624            Session session = null;
3625
3626            try {
3627                session = openSession();
3628
3629                StringBundler query = new StringBundler(5);
3630
3631                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
3632
3633                query.append(_FINDER_COLUMN_G_U_D_GROUPID_2);
3634
3635                query.append(_FINDER_COLUMN_G_U_D_USERID_2);
3636
3637                if (displayDate == null) {
3638                    query.append(_FINDER_COLUMN_G_U_D_DISPLAYDATE_1);
3639                }
3640                else {
3641                    query.append(_FINDER_COLUMN_G_U_D_DISPLAYDATE_2);
3642                }
3643
3644                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
3645
3646                String sql = query.toString();
3647
3648                Query q = session.createQuery(sql);
3649
3650                QueryPos qPos = QueryPos.getInstance(q);
3651
3652                qPos.add(groupId);
3653
3654                qPos.add(userId);
3655
3656                if (displayDate != null) {
3657                    qPos.add(CalendarUtil.getTimestamp(displayDate));
3658                }
3659
3660                list = q.list();
3661            }
3662            catch (Exception e) {
3663                throw processException(e);
3664            }
3665            finally {
3666                if (list == null) {
3667                    list = new ArrayList<BlogsEntry>();
3668                }
3669
3670                cacheResult(list);
3671
3672                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_U_D,
3673                    finderArgs, list);
3674
3675                closeSession(session);
3676            }
3677        }
3678
3679        return list;
3680    }
3681
3682    public List<BlogsEntry> findByG_U_D(long groupId, long userId,
3683        Date displayDate, int start, int end) throws SystemException {
3684        return findByG_U_D(groupId, userId, displayDate, start, end, null);
3685    }
3686
3687    public List<BlogsEntry> findByG_U_D(long groupId, long userId,
3688        Date displayDate, int start, int end,
3689        OrderByComparator orderByComparator) throws SystemException {
3690        Object[] finderArgs = new Object[] {
3691                new Long(groupId), new Long(userId),
3692                
3693                displayDate,
3694                
3695                String.valueOf(start), String.valueOf(end),
3696                String.valueOf(orderByComparator)
3697            };
3698
3699        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_G_U_D,
3700                finderArgs, this);
3701
3702        if (list == null) {
3703            Session session = null;
3704
3705            try {
3706                session = openSession();
3707
3708                StringBundler query = null;
3709
3710                if (orderByComparator != null) {
3711                    query = new StringBundler(5 +
3712                            (orderByComparator.getOrderByFields().length * 3));
3713                }
3714                else {
3715                    query = new StringBundler(5);
3716                }
3717
3718                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
3719
3720                query.append(_FINDER_COLUMN_G_U_D_GROUPID_2);
3721
3722                query.append(_FINDER_COLUMN_G_U_D_USERID_2);
3723
3724                if (displayDate == null) {
3725                    query.append(_FINDER_COLUMN_G_U_D_DISPLAYDATE_1);
3726                }
3727                else {
3728                    query.append(_FINDER_COLUMN_G_U_D_DISPLAYDATE_2);
3729                }
3730
3731                if (orderByComparator != null) {
3732                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3733                        orderByComparator);
3734                }
3735
3736                else {
3737                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
3738                }
3739
3740                String sql = query.toString();
3741
3742                Query q = session.createQuery(sql);
3743
3744                QueryPos qPos = QueryPos.getInstance(q);
3745
3746                qPos.add(groupId);
3747
3748                qPos.add(userId);
3749
3750                if (displayDate != null) {
3751                    qPos.add(CalendarUtil.getTimestamp(displayDate));
3752                }
3753
3754                list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
3755                        end);
3756            }
3757            catch (Exception e) {
3758                throw processException(e);
3759            }
3760            finally {
3761                if (list == null) {
3762                    list = new ArrayList<BlogsEntry>();
3763                }
3764
3765                cacheResult(list);
3766
3767                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_G_U_D,
3768                    finderArgs, list);
3769
3770                closeSession(session);
3771            }
3772        }
3773
3774        return list;
3775    }
3776
3777    public BlogsEntry findByG_U_D_First(long groupId, long userId,
3778        Date displayDate, OrderByComparator orderByComparator)
3779        throws NoSuchEntryException, SystemException {
3780        List<BlogsEntry> list = findByG_U_D(groupId, userId, displayDate, 0, 1,
3781                orderByComparator);
3782
3783        if (list.isEmpty()) {
3784            StringBundler msg = new StringBundler(8);
3785
3786            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3787
3788            msg.append("groupId=");
3789            msg.append(groupId);
3790
3791            msg.append(", userId=");
3792            msg.append(userId);
3793
3794            msg.append(", displayDate=");
3795            msg.append(displayDate);
3796
3797            msg.append(StringPool.CLOSE_CURLY_BRACE);
3798
3799            throw new NoSuchEntryException(msg.toString());
3800        }
3801        else {
3802            return list.get(0);
3803        }
3804    }
3805
3806    public BlogsEntry findByG_U_D_Last(long groupId, long userId,
3807        Date displayDate, OrderByComparator orderByComparator)
3808        throws NoSuchEntryException, SystemException {
3809        int count = countByG_U_D(groupId, userId, displayDate);
3810
3811        List<BlogsEntry> list = findByG_U_D(groupId, userId, displayDate,
3812                count - 1, count, orderByComparator);
3813
3814        if (list.isEmpty()) {
3815            StringBundler msg = new StringBundler(8);
3816
3817            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3818
3819            msg.append("groupId=");
3820            msg.append(groupId);
3821
3822            msg.append(", userId=");
3823            msg.append(userId);
3824
3825            msg.append(", displayDate=");
3826            msg.append(displayDate);
3827
3828            msg.append(StringPool.CLOSE_CURLY_BRACE);
3829
3830            throw new NoSuchEntryException(msg.toString());
3831        }
3832        else {
3833            return list.get(0);
3834        }
3835    }
3836
3837    public BlogsEntry[] findByG_U_D_PrevAndNext(long entryId, long groupId,
3838        long userId, Date displayDate, OrderByComparator orderByComparator)
3839        throws NoSuchEntryException, SystemException {
3840        BlogsEntry blogsEntry = findByPrimaryKey(entryId);
3841
3842        int count = countByG_U_D(groupId, userId, displayDate);
3843
3844        Session session = null;
3845
3846        try {
3847            session = openSession();
3848
3849            StringBundler query = null;
3850
3851            if (orderByComparator != null) {
3852                query = new StringBundler(5 +
3853                        (orderByComparator.getOrderByFields().length * 3));
3854            }
3855            else {
3856                query = new StringBundler(5);
3857            }
3858
3859            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
3860
3861            query.append(_FINDER_COLUMN_G_U_D_GROUPID_2);
3862
3863            query.append(_FINDER_COLUMN_G_U_D_USERID_2);
3864
3865            if (displayDate == null) {
3866                query.append(_FINDER_COLUMN_G_U_D_DISPLAYDATE_1);
3867            }
3868            else {
3869                query.append(_FINDER_COLUMN_G_U_D_DISPLAYDATE_2);
3870            }
3871
3872            if (orderByComparator != null) {
3873                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3874                    orderByComparator);
3875            }
3876
3877            else {
3878                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
3879            }
3880
3881            String sql = query.toString();
3882
3883            Query q = session.createQuery(sql);
3884
3885            QueryPos qPos = QueryPos.getInstance(q);
3886
3887            qPos.add(groupId);
3888
3889            qPos.add(userId);
3890
3891            if (displayDate != null) {
3892                qPos.add(CalendarUtil.getTimestamp(displayDate));
3893            }
3894
3895            Object[] objArray = QueryUtil.getPrevAndNext(q, count,
3896                    orderByComparator, blogsEntry);
3897
3898            BlogsEntry[] array = new BlogsEntryImpl[3];
3899
3900            array[0] = (BlogsEntry)objArray[0];
3901            array[1] = (BlogsEntry)objArray[1];
3902            array[2] = (BlogsEntry)objArray[2];
3903
3904            return array;
3905        }
3906        catch (Exception e) {
3907            throw processException(e);
3908        }
3909        finally {
3910            closeSession(session);
3911        }
3912    }
3913
3914    public List<BlogsEntry> findByG_U_S(long groupId, long userId, int status)
3915        throws SystemException {
3916        Object[] finderArgs = new Object[] {
3917                new Long(groupId), new Long(userId), new Integer(status)
3918            };
3919
3920        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_U_S,
3921                finderArgs, this);
3922
3923        if (list == null) {
3924            Session session = null;
3925
3926            try {
3927                session = openSession();
3928
3929                StringBundler query = new StringBundler(5);
3930
3931                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
3932
3933                query.append(_FINDER_COLUMN_G_U_S_GROUPID_2);
3934
3935                query.append(_FINDER_COLUMN_G_U_S_USERID_2);
3936
3937                query.append(_FINDER_COLUMN_G_U_S_STATUS_2);
3938
3939                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
3940
3941                String sql = query.toString();
3942
3943                Query q = session.createQuery(sql);
3944
3945                QueryPos qPos = QueryPos.getInstance(q);
3946
3947                qPos.add(groupId);
3948
3949                qPos.add(userId);
3950
3951                qPos.add(status);
3952
3953                list = q.list();
3954            }
3955            catch (Exception e) {
3956                throw processException(e);
3957            }
3958            finally {
3959                if (list == null) {
3960                    list = new ArrayList<BlogsEntry>();
3961                }
3962
3963                cacheResult(list);
3964
3965                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_U_S,
3966                    finderArgs, list);
3967
3968                closeSession(session);
3969            }
3970        }
3971
3972        return list;
3973    }
3974
3975    public List<BlogsEntry> findByG_U_S(long groupId, long userId, int status,
3976        int start, int end) throws SystemException {
3977        return findByG_U_S(groupId, userId, status, start, end, null);
3978    }
3979
3980    public List<BlogsEntry> findByG_U_S(long groupId, long userId, int status,
3981        int start, int end, OrderByComparator orderByComparator)
3982        throws SystemException {
3983        Object[] finderArgs = new Object[] {
3984                new Long(groupId), new Long(userId), new Integer(status),
3985                
3986                String.valueOf(start), String.valueOf(end),
3987                String.valueOf(orderByComparator)
3988            };
3989
3990        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_G_U_S,
3991                finderArgs, this);
3992
3993        if (list == null) {
3994            Session session = null;
3995
3996            try {
3997                session = openSession();
3998
3999                StringBundler query = null;
4000
4001                if (orderByComparator != null) {
4002                    query = new StringBundler(5 +
4003                            (orderByComparator.getOrderByFields().length * 3));
4004                }
4005                else {
4006                    query = new StringBundler(5);
4007                }
4008
4009                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
4010
4011                query.append(_FINDER_COLUMN_G_U_S_GROUPID_2);
4012
4013                query.append(_FINDER_COLUMN_G_U_S_USERID_2);
4014
4015                query.append(_FINDER_COLUMN_G_U_S_STATUS_2);
4016
4017                if (orderByComparator != null) {
4018                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
4019                        orderByComparator);
4020                }
4021
4022                else {
4023                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
4024                }
4025
4026                String sql = query.toString();
4027
4028                Query q = session.createQuery(sql);
4029
4030                QueryPos qPos = QueryPos.getInstance(q);
4031
4032                qPos.add(groupId);
4033
4034                qPos.add(userId);
4035
4036                qPos.add(status);
4037
4038                list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
4039                        end);
4040            }
4041            catch (Exception e) {
4042                throw processException(e);
4043            }
4044            finally {
4045                if (list == null) {
4046                    list = new ArrayList<BlogsEntry>();
4047                }
4048
4049                cacheResult(list);
4050
4051                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_G_U_S,
4052                    finderArgs, list);
4053
4054                closeSession(session);
4055            }
4056        }
4057
4058        return list;
4059    }
4060
4061    public BlogsEntry findByG_U_S_First(long groupId, long userId, int status,
4062        OrderByComparator orderByComparator)
4063        throws NoSuchEntryException, SystemException {
4064        List<BlogsEntry> list = findByG_U_S(groupId, userId, status, 0, 1,
4065                orderByComparator);
4066
4067        if (list.isEmpty()) {
4068            StringBundler msg = new StringBundler(8);
4069
4070            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4071
4072            msg.append("groupId=");
4073            msg.append(groupId);
4074
4075            msg.append(", userId=");
4076            msg.append(userId);
4077
4078            msg.append(", status=");
4079            msg.append(status);
4080
4081            msg.append(StringPool.CLOSE_CURLY_BRACE);
4082
4083            throw new NoSuchEntryException(msg.toString());
4084        }
4085        else {
4086            return list.get(0);
4087        }
4088    }
4089
4090    public BlogsEntry findByG_U_S_Last(long groupId, long userId, int status,
4091        OrderByComparator orderByComparator)
4092        throws NoSuchEntryException, SystemException {
4093        int count = countByG_U_S(groupId, userId, status);
4094
4095        List<BlogsEntry> list = findByG_U_S(groupId, userId, status, count - 1,
4096                count, orderByComparator);
4097
4098        if (list.isEmpty()) {
4099            StringBundler msg = new StringBundler(8);
4100
4101            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4102
4103            msg.append("groupId=");
4104            msg.append(groupId);
4105
4106            msg.append(", userId=");
4107            msg.append(userId);
4108
4109            msg.append(", status=");
4110            msg.append(status);
4111
4112            msg.append(StringPool.CLOSE_CURLY_BRACE);
4113
4114            throw new NoSuchEntryException(msg.toString());
4115        }
4116        else {
4117            return list.get(0);
4118        }
4119    }
4120
4121    public BlogsEntry[] findByG_U_S_PrevAndNext(long entryId, long groupId,
4122        long userId, int status, OrderByComparator orderByComparator)
4123        throws NoSuchEntryException, SystemException {
4124        BlogsEntry blogsEntry = findByPrimaryKey(entryId);
4125
4126        int count = countByG_U_S(groupId, userId, status);
4127
4128        Session session = null;
4129
4130        try {
4131            session = openSession();
4132
4133            StringBundler query = null;
4134
4135            if (orderByComparator != null) {
4136                query = new StringBundler(5 +
4137                        (orderByComparator.getOrderByFields().length * 3));
4138            }
4139            else {
4140                query = new StringBundler(5);
4141            }
4142
4143            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
4144
4145            query.append(_FINDER_COLUMN_G_U_S_GROUPID_2);
4146
4147            query.append(_FINDER_COLUMN_G_U_S_USERID_2);
4148
4149            query.append(_FINDER_COLUMN_G_U_S_STATUS_2);
4150
4151            if (orderByComparator != null) {
4152                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
4153                    orderByComparator);
4154            }
4155
4156            else {
4157                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
4158            }
4159
4160            String sql = query.toString();
4161
4162            Query q = session.createQuery(sql);
4163
4164            QueryPos qPos = QueryPos.getInstance(q);
4165
4166            qPos.add(groupId);
4167
4168            qPos.add(userId);
4169
4170            qPos.add(status);
4171
4172            Object[] objArray = QueryUtil.getPrevAndNext(q, count,
4173                    orderByComparator, blogsEntry);
4174
4175            BlogsEntry[] array = new BlogsEntryImpl[3];
4176
4177            array[0] = (BlogsEntry)objArray[0];
4178            array[1] = (BlogsEntry)objArray[1];
4179            array[2] = (BlogsEntry)objArray[2];
4180
4181            return array;
4182        }
4183        catch (Exception e) {
4184            throw processException(e);
4185        }
4186        finally {
4187            closeSession(session);
4188        }
4189    }
4190
4191    public List<BlogsEntry> findByG_D_S(long groupId, Date displayDate,
4192        int status) throws SystemException {
4193        Object[] finderArgs = new Object[] {
4194                new Long(groupId),
4195                
4196                displayDate, new Integer(status)
4197            };
4198
4199        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_D_S,
4200                finderArgs, this);
4201
4202        if (list == null) {
4203            Session session = null;
4204
4205            try {
4206                session = openSession();
4207
4208                StringBundler query = new StringBundler(5);
4209
4210                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
4211
4212                query.append(_FINDER_COLUMN_G_D_S_GROUPID_2);
4213
4214                if (displayDate == null) {
4215                    query.append(_FINDER_COLUMN_G_D_S_DISPLAYDATE_1);
4216                }
4217                else {
4218                    query.append(_FINDER_COLUMN_G_D_S_DISPLAYDATE_2);
4219                }
4220
4221                query.append(_FINDER_COLUMN_G_D_S_STATUS_2);
4222
4223                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
4224
4225                String sql = query.toString();
4226
4227                Query q = session.createQuery(sql);
4228
4229                QueryPos qPos = QueryPos.getInstance(q);
4230
4231                qPos.add(groupId);
4232
4233                if (displayDate != null) {
4234                    qPos.add(CalendarUtil.getTimestamp(displayDate));
4235                }
4236
4237                qPos.add(status);
4238
4239                list = q.list();
4240            }
4241            catch (Exception e) {
4242                throw processException(e);
4243            }
4244            finally {
4245                if (list == null) {
4246                    list = new ArrayList<BlogsEntry>();
4247                }
4248
4249                cacheResult(list);
4250
4251                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_D_S,
4252                    finderArgs, list);
4253
4254                closeSession(session);
4255            }
4256        }
4257
4258        return list;
4259    }
4260
4261    public List<BlogsEntry> findByG_D_S(long groupId, Date displayDate,
4262        int status, int start, int end) throws SystemException {
4263        return findByG_D_S(groupId, displayDate, status, start, end, null);
4264    }
4265
4266    public List<BlogsEntry> findByG_D_S(long groupId, Date displayDate,
4267        int status, int start, int end, OrderByComparator orderByComparator)
4268        throws SystemException {
4269        Object[] finderArgs = new Object[] {
4270                new Long(groupId),
4271                
4272                displayDate, new Integer(status),
4273                
4274                String.valueOf(start), String.valueOf(end),
4275                String.valueOf(orderByComparator)
4276            };
4277
4278        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_G_D_S,
4279                finderArgs, this);
4280
4281        if (list == null) {
4282            Session session = null;
4283
4284            try {
4285                session = openSession();
4286
4287                StringBundler query = null;
4288
4289                if (orderByComparator != null) {
4290                    query = new StringBundler(5 +
4291                            (orderByComparator.getOrderByFields().length * 3));
4292                }
4293                else {
4294                    query = new StringBundler(5);
4295                }
4296
4297                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
4298
4299                query.append(_FINDER_COLUMN_G_D_S_GROUPID_2);
4300
4301                if (displayDate == null) {
4302                    query.append(_FINDER_COLUMN_G_D_S_DISPLAYDATE_1);
4303                }
4304                else {
4305                    query.append(_FINDER_COLUMN_G_D_S_DISPLAYDATE_2);
4306                }
4307
4308                query.append(_FINDER_COLUMN_G_D_S_STATUS_2);
4309
4310                if (orderByComparator != null) {
4311                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
4312                        orderByComparator);
4313                }
4314
4315                else {
4316                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
4317                }
4318
4319                String sql = query.toString();
4320
4321                Query q = session.createQuery(sql);
4322
4323                QueryPos qPos = QueryPos.getInstance(q);
4324
4325                qPos.add(groupId);
4326
4327                if (displayDate != null) {
4328                    qPos.add(CalendarUtil.getTimestamp(displayDate));
4329                }
4330
4331                qPos.add(status);
4332
4333                list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
4334                        end);
4335            }
4336            catch (Exception e) {
4337                throw processException(e);
4338            }
4339            finally {
4340                if (list == null) {
4341                    list = new ArrayList<BlogsEntry>();
4342                }
4343
4344                cacheResult(list);
4345
4346                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_G_D_S,
4347                    finderArgs, list);
4348
4349                closeSession(session);
4350            }
4351        }
4352
4353        return list;
4354    }
4355
4356    public BlogsEntry findByG_D_S_First(long groupId, Date displayDate,
4357        int status, OrderByComparator orderByComparator)
4358        throws NoSuchEntryException, SystemException {
4359        List<BlogsEntry> list = findByG_D_S(groupId, displayDate, status, 0, 1,
4360                orderByComparator);
4361
4362        if (list.isEmpty()) {
4363            StringBundler msg = new StringBundler(8);
4364
4365            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4366
4367            msg.append("groupId=");
4368            msg.append(groupId);
4369
4370            msg.append(", displayDate=");
4371            msg.append(displayDate);
4372
4373            msg.append(", status=");
4374            msg.append(status);
4375
4376            msg.append(StringPool.CLOSE_CURLY_BRACE);
4377
4378            throw new NoSuchEntryException(msg.toString());
4379        }
4380        else {
4381            return list.get(0);
4382        }
4383    }
4384
4385    public BlogsEntry findByG_D_S_Last(long groupId, Date displayDate,
4386        int status, OrderByComparator orderByComparator)
4387        throws NoSuchEntryException, SystemException {
4388        int count = countByG_D_S(groupId, displayDate, status);
4389
4390        List<BlogsEntry> list = findByG_D_S(groupId, displayDate, status,
4391                count - 1, count, orderByComparator);
4392
4393        if (list.isEmpty()) {
4394            StringBundler msg = new StringBundler(8);
4395
4396            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4397
4398            msg.append("groupId=");
4399            msg.append(groupId);
4400
4401            msg.append(", displayDate=");
4402            msg.append(displayDate);
4403
4404            msg.append(", status=");
4405            msg.append(status);
4406
4407            msg.append(StringPool.CLOSE_CURLY_BRACE);
4408
4409            throw new NoSuchEntryException(msg.toString());
4410        }
4411        else {
4412            return list.get(0);
4413        }
4414    }
4415
4416    public BlogsEntry[] findByG_D_S_PrevAndNext(long entryId, long groupId,
4417        Date displayDate, int status, OrderByComparator orderByComparator)
4418        throws NoSuchEntryException, SystemException {
4419        BlogsEntry blogsEntry = findByPrimaryKey(entryId);
4420
4421        int count = countByG_D_S(groupId, displayDate, status);
4422
4423        Session session = null;
4424
4425        try {
4426            session = openSession();
4427
4428            StringBundler query = null;
4429
4430            if (orderByComparator != null) {
4431                query = new StringBundler(5 +
4432                        (orderByComparator.getOrderByFields().length * 3));
4433            }
4434            else {
4435                query = new StringBundler(5);
4436            }
4437
4438            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
4439
4440            query.append(_FINDER_COLUMN_G_D_S_GROUPID_2);
4441
4442            if (displayDate == null) {
4443                query.append(_FINDER_COLUMN_G_D_S_DISPLAYDATE_1);
4444            }
4445            else {
4446                query.append(_FINDER_COLUMN_G_D_S_DISPLAYDATE_2);
4447            }
4448
4449            query.append(_FINDER_COLUMN_G_D_S_STATUS_2);
4450
4451            if (orderByComparator != null) {
4452                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
4453                    orderByComparator);
4454            }
4455
4456            else {
4457                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
4458            }
4459
4460            String sql = query.toString();
4461
4462            Query q = session.createQuery(sql);
4463
4464            QueryPos qPos = QueryPos.getInstance(q);
4465
4466            qPos.add(groupId);
4467
4468            if (displayDate != null) {
4469                qPos.add(CalendarUtil.getTimestamp(displayDate));
4470            }
4471
4472            qPos.add(status);
4473
4474            Object[] objArray = QueryUtil.getPrevAndNext(q, count,
4475                    orderByComparator, blogsEntry);
4476
4477            BlogsEntry[] array = new BlogsEntryImpl[3];
4478
4479            array[0] = (BlogsEntry)objArray[0];
4480            array[1] = (BlogsEntry)objArray[1];
4481            array[2] = (BlogsEntry)objArray[2];
4482
4483            return array;
4484        }
4485        catch (Exception e) {
4486            throw processException(e);
4487        }
4488        finally {
4489            closeSession(session);
4490        }
4491    }
4492
4493    public List<BlogsEntry> findByG_U_D_S(long groupId, long userId,
4494        Date displayDate, int status) throws SystemException {
4495        Object[] finderArgs = new Object[] {
4496                new Long(groupId), new Long(userId),
4497                
4498                displayDate, new Integer(status)
4499            };
4500
4501        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_U_D_S,
4502                finderArgs, this);
4503
4504        if (list == null) {
4505            Session session = null;
4506
4507            try {
4508                session = openSession();
4509
4510                StringBundler query = new StringBundler(6);
4511
4512                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
4513
4514                query.append(_FINDER_COLUMN_G_U_D_S_GROUPID_2);
4515
4516                query.append(_FINDER_COLUMN_G_U_D_S_USERID_2);
4517
4518                if (displayDate == null) {
4519                    query.append(_FINDER_COLUMN_G_U_D_S_DISPLAYDATE_1);
4520                }
4521                else {
4522                    query.append(_FINDER_COLUMN_G_U_D_S_DISPLAYDATE_2);
4523                }
4524
4525                query.append(_FINDER_COLUMN_G_U_D_S_STATUS_2);
4526
4527                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
4528
4529                String sql = query.toString();
4530
4531                Query q = session.createQuery(sql);
4532
4533                QueryPos qPos = QueryPos.getInstance(q);
4534
4535                qPos.add(groupId);
4536
4537                qPos.add(userId);
4538
4539                if (displayDate != null) {
4540                    qPos.add(CalendarUtil.getTimestamp(displayDate));
4541                }
4542
4543                qPos.add(status);
4544
4545                list = q.list();
4546            }
4547            catch (Exception e) {
4548                throw processException(e);
4549            }
4550            finally {
4551                if (list == null) {
4552                    list = new ArrayList<BlogsEntry>();
4553                }
4554
4555                cacheResult(list);
4556
4557                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_U_D_S,
4558                    finderArgs, list);
4559
4560                closeSession(session);
4561            }
4562        }
4563
4564        return list;
4565    }
4566
4567    public List<BlogsEntry> findByG_U_D_S(long groupId, long userId,
4568        Date displayDate, int status, int start, int end)
4569        throws SystemException {
4570        return findByG_U_D_S(groupId, userId, displayDate, status, start, end,
4571            null);
4572    }
4573
4574    public List<BlogsEntry> findByG_U_D_S(long groupId, long userId,
4575        Date displayDate, int status, int start, int end,
4576        OrderByComparator orderByComparator) throws SystemException {
4577        Object[] finderArgs = new Object[] {
4578                new Long(groupId), new Long(userId),
4579                
4580                displayDate, new Integer(status),
4581                
4582                String.valueOf(start), String.valueOf(end),
4583                String.valueOf(orderByComparator)
4584            };
4585
4586        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_G_U_D_S,
4587                finderArgs, this);
4588
4589        if (list == null) {
4590            Session session = null;
4591
4592            try {
4593                session = openSession();
4594
4595                StringBundler query = null;
4596
4597                if (orderByComparator != null) {
4598                    query = new StringBundler(6 +
4599                            (orderByComparator.getOrderByFields().length * 3));
4600                }
4601                else {
4602                    query = new StringBundler(6);
4603                }
4604
4605                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
4606
4607                query.append(_FINDER_COLUMN_G_U_D_S_GROUPID_2);
4608
4609                query.append(_FINDER_COLUMN_G_U_D_S_USERID_2);
4610
4611                if (displayDate == null) {
4612                    query.append(_FINDER_COLUMN_G_U_D_S_DISPLAYDATE_1);
4613                }
4614                else {
4615                    query.append(_FINDER_COLUMN_G_U_D_S_DISPLAYDATE_2);
4616                }
4617
4618                query.append(_FINDER_COLUMN_G_U_D_S_STATUS_2);
4619
4620                if (orderByComparator != null) {
4621                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
4622                        orderByComparator);
4623                }
4624
4625                else {
4626                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
4627                }
4628
4629                String sql = query.toString();
4630
4631                Query q = session.createQuery(sql);
4632
4633                QueryPos qPos = QueryPos.getInstance(q);
4634
4635                qPos.add(groupId);
4636
4637                qPos.add(userId);
4638
4639                if (displayDate != null) {
4640                    qPos.add(CalendarUtil.getTimestamp(displayDate));
4641                }
4642
4643                qPos.add(status);
4644
4645                list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
4646                        end);
4647            }
4648            catch (Exception e) {
4649                throw processException(e);
4650            }
4651            finally {
4652                if (list == null) {
4653                    list = new ArrayList<BlogsEntry>();
4654                }
4655
4656                cacheResult(list);
4657
4658                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_G_U_D_S,
4659                    finderArgs, list);
4660
4661                closeSession(session);
4662            }
4663        }
4664
4665        return list;
4666    }
4667
4668    public BlogsEntry findByG_U_D_S_First(long groupId, long userId,
4669        Date displayDate, int status, OrderByComparator orderByComparator)
4670        throws NoSuchEntryException, SystemException {
4671        List<BlogsEntry> list = findByG_U_D_S(groupId, userId, displayDate,
4672                status, 0, 1, orderByComparator);
4673
4674        if (list.isEmpty()) {
4675            StringBundler msg = new StringBundler(10);
4676
4677            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4678
4679            msg.append("groupId=");
4680            msg.append(groupId);
4681
4682            msg.append(", userId=");
4683            msg.append(userId);
4684
4685            msg.append(", displayDate=");
4686            msg.append(displayDate);
4687
4688            msg.append(", status=");
4689            msg.append(status);
4690
4691            msg.append(StringPool.CLOSE_CURLY_BRACE);
4692
4693            throw new NoSuchEntryException(msg.toString());
4694        }
4695        else {
4696            return list.get(0);
4697        }
4698    }
4699
4700    public BlogsEntry findByG_U_D_S_Last(long groupId, long userId,
4701        Date displayDate, int status, OrderByComparator orderByComparator)
4702        throws NoSuchEntryException, SystemException {
4703        int count = countByG_U_D_S(groupId, userId, displayDate, status);
4704
4705        List<BlogsEntry> list = findByG_U_D_S(groupId, userId, displayDate,
4706                status, count - 1, count, orderByComparator);
4707
4708        if (list.isEmpty()) {
4709            StringBundler msg = new StringBundler(10);
4710
4711            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4712
4713            msg.append("groupId=");
4714            msg.append(groupId);
4715
4716            msg.append(", userId=");
4717            msg.append(userId);
4718
4719            msg.append(", displayDate=");
4720            msg.append(displayDate);
4721
4722            msg.append(", status=");
4723            msg.append(status);
4724
4725            msg.append(StringPool.CLOSE_CURLY_BRACE);
4726
4727            throw new NoSuchEntryException(msg.toString());
4728        }
4729        else {
4730            return list.get(0);
4731        }
4732    }
4733
4734    public BlogsEntry[] findByG_U_D_S_PrevAndNext(long entryId, long groupId,
4735        long userId, Date displayDate, int status,
4736        OrderByComparator orderByComparator)
4737        throws NoSuchEntryException, SystemException {
4738        BlogsEntry blogsEntry = findByPrimaryKey(entryId);
4739
4740        int count = countByG_U_D_S(groupId, userId, displayDate, status);
4741
4742        Session session = null;
4743
4744        try {
4745            session = openSession();
4746
4747            StringBundler query = null;
4748
4749            if (orderByComparator != null) {
4750                query = new StringBundler(6 +
4751                        (orderByComparator.getOrderByFields().length * 3));
4752            }
4753            else {
4754                query = new StringBundler(6);
4755            }
4756
4757            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
4758
4759            query.append(_FINDER_COLUMN_G_U_D_S_GROUPID_2);
4760
4761            query.append(_FINDER_COLUMN_G_U_D_S_USERID_2);
4762
4763            if (displayDate == null) {
4764                query.append(_FINDER_COLUMN_G_U_D_S_DISPLAYDATE_1);
4765            }
4766            else {
4767                query.append(_FINDER_COLUMN_G_U_D_S_DISPLAYDATE_2);
4768            }
4769
4770            query.append(_FINDER_COLUMN_G_U_D_S_STATUS_2);
4771
4772            if (orderByComparator != null) {
4773                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
4774                    orderByComparator);
4775            }
4776
4777            else {
4778                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
4779            }
4780
4781            String sql = query.toString();
4782
4783            Query q = session.createQuery(sql);
4784
4785            QueryPos qPos = QueryPos.getInstance(q);
4786
4787            qPos.add(groupId);
4788
4789            qPos.add(userId);
4790
4791            if (displayDate != null) {
4792                qPos.add(CalendarUtil.getTimestamp(displayDate));
4793            }
4794
4795            qPos.add(status);
4796
4797            Object[] objArray = QueryUtil.getPrevAndNext(q, count,
4798                    orderByComparator, blogsEntry);
4799
4800            BlogsEntry[] array = new BlogsEntryImpl[3];
4801
4802            array[0] = (BlogsEntry)objArray[0];
4803            array[1] = (BlogsEntry)objArray[1];
4804            array[2] = (BlogsEntry)objArray[2];
4805
4806            return array;
4807        }
4808        catch (Exception e) {
4809            throw processException(e);
4810        }
4811        finally {
4812            closeSession(session);
4813        }
4814    }
4815
4816    public List<BlogsEntry> findAll() throws SystemException {
4817        return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
4818    }
4819
4820    public List<BlogsEntry> findAll(int start, int end)
4821        throws SystemException {
4822        return findAll(start, end, null);
4823    }
4824
4825    public List<BlogsEntry> findAll(int start, int end,
4826        OrderByComparator orderByComparator) throws SystemException {
4827        Object[] finderArgs = new Object[] {
4828                String.valueOf(start), String.valueOf(end),
4829                String.valueOf(orderByComparator)
4830            };
4831
4832        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
4833                finderArgs, this);
4834
4835        if (list == null) {
4836            Session session = null;
4837
4838            try {
4839                session = openSession();
4840
4841                StringBundler query = null;
4842                String sql = null;
4843
4844                if (orderByComparator != null) {
4845                    query = new StringBundler(2 +
4846                            (orderByComparator.getOrderByFields().length * 3));
4847
4848                    query.append(_SQL_SELECT_BLOGSENTRY);
4849
4850                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
4851                        orderByComparator);
4852
4853                    sql = query.toString();
4854                }
4855
4856                else {
4857                    sql = _SQL_SELECT_BLOGSENTRY.concat(BlogsEntryModelImpl.ORDER_BY_JPQL);
4858                }
4859
4860                Query q = session.createQuery(sql);
4861
4862                if (orderByComparator == null) {
4863                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(),
4864                            start, end, false);
4865
4866                    Collections.sort(list);
4867                }
4868                else {
4869                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(),
4870                            start, end);
4871                }
4872            }
4873            catch (Exception e) {
4874                throw processException(e);
4875            }
4876            finally {
4877                if (list == null) {
4878                    list = new ArrayList<BlogsEntry>();
4879                }
4880
4881                cacheResult(list);
4882
4883                FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
4884
4885                closeSession(session);
4886            }
4887        }
4888
4889        return list;
4890    }
4891
4892    public void removeByUuid(String uuid) throws SystemException {
4893        for (BlogsEntry blogsEntry : findByUuid(uuid)) {
4894            remove(blogsEntry);
4895        }
4896    }
4897
4898    public void removeByUUID_G(String uuid, long groupId)
4899        throws NoSuchEntryException, SystemException {
4900        BlogsEntry blogsEntry = findByUUID_G(uuid, groupId);
4901
4902        remove(blogsEntry);
4903    }
4904
4905    public void removeByGroupId(long groupId) throws SystemException {
4906        for (BlogsEntry blogsEntry : findByGroupId(groupId)) {
4907            remove(blogsEntry);
4908        }
4909    }
4910
4911    public void removeByCompanyId(long companyId) throws SystemException {
4912        for (BlogsEntry blogsEntry : findByCompanyId(companyId)) {
4913            remove(blogsEntry);
4914        }
4915    }
4916
4917    public void removeByC_U(long companyId, long userId)
4918        throws SystemException {
4919        for (BlogsEntry blogsEntry : findByC_U(companyId, userId)) {
4920            remove(blogsEntry);
4921        }
4922    }
4923
4924    public void removeByC_D(long companyId, Date displayDate)
4925        throws SystemException {
4926        for (BlogsEntry blogsEntry : findByC_D(companyId, displayDate)) {
4927            remove(blogsEntry);
4928        }
4929    }
4930
4931    public void removeByC_S(long companyId, int status)
4932        throws SystemException {
4933        for (BlogsEntry blogsEntry : findByC_S(companyId, status)) {
4934            remove(blogsEntry);
4935        }
4936    }
4937
4938    public void removeByG_UT(long groupId, String urlTitle)
4939        throws NoSuchEntryException, SystemException {
4940        BlogsEntry blogsEntry = findByG_UT(groupId, urlTitle);
4941
4942        remove(blogsEntry);
4943    }
4944
4945    public void removeByG_D(long groupId, Date displayDate)
4946        throws SystemException {
4947        for (BlogsEntry blogsEntry : findByG_D(groupId, displayDate)) {
4948            remove(blogsEntry);
4949        }
4950    }
4951
4952    public void removeByG_S(long groupId, int status) throws SystemException {
4953        for (BlogsEntry blogsEntry : findByG_S(groupId, status)) {
4954            remove(blogsEntry);
4955        }
4956    }
4957
4958    public void removeByC_U_S(long companyId, long userId, int status)
4959        throws SystemException {
4960        for (BlogsEntry blogsEntry : findByC_U_S(companyId, userId, status)) {
4961            remove(blogsEntry);
4962        }
4963    }
4964
4965    public void removeByC_D_S(long companyId, Date displayDate, int status)
4966        throws SystemException {
4967        for (BlogsEntry blogsEntry : findByC_D_S(companyId, displayDate, status)) {
4968            remove(blogsEntry);
4969        }
4970    }
4971
4972    public void removeByG_U_D(long groupId, long userId, Date displayDate)
4973        throws SystemException {
4974        for (BlogsEntry blogsEntry : findByG_U_D(groupId, userId, displayDate)) {
4975            remove(blogsEntry);
4976        }
4977    }
4978
4979    public void removeByG_U_S(long groupId, long userId, int status)
4980        throws SystemException {
4981        for (BlogsEntry blogsEntry : findByG_U_S(groupId, userId, status)) {
4982            remove(blogsEntry);
4983        }
4984    }
4985
4986    public void removeByG_D_S(long groupId, Date displayDate, int status)
4987        throws SystemException {
4988        for (BlogsEntry blogsEntry : findByG_D_S(groupId, displayDate, status)) {
4989            remove(blogsEntry);
4990        }
4991    }
4992
4993    public void removeByG_U_D_S(long groupId, long userId, Date displayDate,
4994        int status) throws SystemException {
4995        for (BlogsEntry blogsEntry : findByG_U_D_S(groupId, userId,
4996                displayDate, status)) {
4997            remove(blogsEntry);
4998        }
4999    }
5000
5001    public void removeAll() throws SystemException {
5002        for (BlogsEntry blogsEntry : findAll()) {
5003            remove(blogsEntry);
5004        }
5005    }
5006
5007    public int countByUuid(String uuid) throws SystemException {
5008        Object[] finderArgs = new Object[] { uuid };
5009
5010        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
5011                finderArgs, this);
5012
5013        if (count == null) {
5014            Session session = null;
5015
5016            try {
5017                session = openSession();
5018
5019                StringBundler query = new StringBundler(2);
5020
5021                query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
5022
5023                if (uuid == null) {
5024                    query.append(_FINDER_COLUMN_UUID_UUID_1);
5025                }
5026                else {
5027                    if (uuid.equals(StringPool.BLANK)) {
5028                        query.append(_FINDER_COLUMN_UUID_UUID_3);
5029                    }
5030                    else {
5031                        query.append(_FINDER_COLUMN_UUID_UUID_2);
5032                    }
5033                }
5034
5035                String sql = query.toString();
5036
5037                Query q = session.createQuery(sql);
5038
5039                QueryPos qPos = QueryPos.getInstance(q);
5040
5041                if (uuid != null) {
5042                    qPos.add(uuid);
5043                }
5044
5045                count = (Long)q.uniqueResult();
5046            }
5047            catch (Exception e) {
5048                throw processException(e);
5049            }
5050            finally {
5051                if (count == null) {
5052                    count = Long.valueOf(0);
5053                }
5054
5055                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
5056                    finderArgs, count);
5057
5058                closeSession(session);
5059            }
5060        }
5061
5062        return count.intValue();
5063    }
5064
5065    public int countByUUID_G(String uuid, long groupId)
5066        throws SystemException {
5067        Object[] finderArgs = new Object[] { uuid, new Long(groupId) };
5068
5069        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
5070                finderArgs, this);
5071
5072        if (count == null) {
5073            Session session = null;
5074
5075            try {
5076                session = openSession();
5077
5078                StringBundler query = new StringBundler(3);
5079
5080                query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
5081
5082                if (uuid == null) {
5083                    query.append(_FINDER_COLUMN_UUID_G_UUID_1);
5084                }
5085                else {
5086                    if (uuid.equals(StringPool.BLANK)) {
5087                        query.append(_FINDER_COLUMN_UUID_G_UUID_3);
5088                    }
5089                    else {
5090                        query.append(_FINDER_COLUMN_UUID_G_UUID_2);
5091                    }
5092                }
5093
5094                query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
5095
5096                String sql = query.toString();
5097
5098                Query q = session.createQuery(sql);
5099
5100                QueryPos qPos = QueryPos.getInstance(q);
5101
5102                if (uuid != null) {
5103                    qPos.add(uuid);
5104                }
5105
5106                qPos.add(groupId);
5107
5108                count = (Long)q.uniqueResult();
5109            }
5110            catch (Exception e) {
5111                throw processException(e);
5112            }
5113            finally {
5114                if (count == null) {
5115                    count = Long.valueOf(0);
5116                }
5117
5118                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
5119                    finderArgs, count);
5120
5121                closeSession(session);
5122            }
5123        }
5124
5125        return count.intValue();
5126    }
5127
5128    public int countByGroupId(long groupId) throws SystemException {
5129        Object[] finderArgs = new Object[] { new Long(groupId) };
5130
5131        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
5132                finderArgs, this);
5133
5134        if (count == null) {
5135            Session session = null;
5136
5137            try {
5138                session = openSession();
5139
5140                StringBundler query = new StringBundler(2);
5141
5142                query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
5143
5144                query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
5145
5146                String sql = query.toString();
5147
5148                Query q = session.createQuery(sql);
5149
5150                QueryPos qPos = QueryPos.getInstance(q);
5151
5152                qPos.add(groupId);
5153
5154                count = (Long)q.uniqueResult();
5155            }
5156            catch (Exception e) {
5157                throw processException(e);
5158            }
5159            finally {
5160                if (count == null) {
5161                    count = Long.valueOf(0);
5162                }
5163
5164                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
5165                    finderArgs, count);
5166
5167                closeSession(session);
5168            }
5169        }
5170
5171        return count.intValue();
5172    }
5173
5174    public int countByCompanyId(long companyId) throws SystemException {
5175        Object[] finderArgs = new Object[] { new Long(companyId) };
5176
5177        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
5178                finderArgs, this);
5179
5180        if (count == null) {
5181            Session session = null;
5182
5183            try {
5184                session = openSession();
5185
5186                StringBundler query = new StringBundler(2);
5187
5188                query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
5189
5190                query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
5191
5192                String sql = query.toString();
5193
5194                Query q = session.createQuery(sql);
5195
5196                QueryPos qPos = QueryPos.getInstance(q);
5197
5198                qPos.add(companyId);
5199
5200                count = (Long)q.uniqueResult();
5201            }
5202            catch (Exception e) {
5203                throw processException(e);
5204            }
5205            finally {
5206                if (count == null) {
5207                    count = Long.valueOf(0);
5208                }
5209
5210                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
5211                    finderArgs, count);
5212
5213                closeSession(session);
5214            }
5215        }
5216
5217        return count.intValue();
5218    }
5219
5220    public int countByC_U(long companyId, long userId)
5221        throws SystemException {
5222        Object[] finderArgs = new Object[] { new Long(companyId), new Long(userId) };
5223
5224        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_U,
5225                finderArgs, this);
5226
5227        if (count == null) {
5228            Session session = null;
5229
5230            try {
5231                session = openSession();
5232
5233                StringBundler query = new StringBundler(3);
5234
5235                query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
5236
5237                query.append(_FINDER_COLUMN_C_U_COMPANYID_2);
5238
5239                query.append(_FINDER_COLUMN_C_U_USERID_2);
5240
5241                String sql = query.toString();
5242
5243                Query q = session.createQuery(sql);
5244
5245                QueryPos qPos = QueryPos.getInstance(q);
5246
5247                qPos.add(companyId);
5248
5249                qPos.add(userId);
5250
5251                count = (Long)q.uniqueResult();
5252            }
5253            catch (Exception e) {
5254                throw processException(e);
5255            }
5256            finally {
5257                if (count == null) {
5258                    count = Long.valueOf(0);
5259                }
5260
5261                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_U, finderArgs,
5262                    count);
5263
5264                closeSession(session);
5265            }
5266        }
5267
5268        return count.intValue();
5269    }
5270
5271    public int countByC_D(long companyId, Date displayDate)
5272        throws SystemException {
5273        Object[] finderArgs = new Object[] { new Long(companyId), displayDate };
5274
5275        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_D,
5276                finderArgs, this);
5277
5278        if (count == null) {
5279            Session session = null;
5280
5281            try {
5282                session = openSession();
5283
5284                StringBundler query = new StringBundler(3);
5285
5286                query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
5287
5288                query.append(_FINDER_COLUMN_C_D_COMPANYID_2);
5289
5290                if (displayDate == null) {
5291                    query.append(_FINDER_COLUMN_C_D_DISPLAYDATE_1);
5292                }
5293                else {
5294                    query.append(_FINDER_COLUMN_C_D_DISPLAYDATE_2);
5295                }
5296
5297                String sql = query.toString();
5298
5299                Query q = session.createQuery(sql);
5300
5301                QueryPos qPos = QueryPos.getInstance(q);
5302
5303                qPos.add(companyId);
5304
5305                if (displayDate != null) {
5306                    qPos.add(CalendarUtil.getTimestamp(displayDate));
5307                }
5308
5309                count = (Long)q.uniqueResult();
5310            }
5311            catch (Exception e) {
5312                throw processException(e);
5313            }
5314            finally {
5315                if (count == null) {
5316                    count = Long.valueOf(0);
5317                }
5318
5319                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_D, finderArgs,
5320                    count);
5321
5322                closeSession(session);
5323            }
5324        }
5325
5326        return count.intValue();
5327    }
5328
5329    public int countByC_S(long companyId, int status) throws SystemException {
5330        Object[] finderArgs = new Object[] {
5331                new Long(companyId), new Integer(status)
5332            };
5333
5334        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_S,
5335                finderArgs, this);
5336
5337        if (count == null) {
5338            Session session = null;
5339
5340            try {
5341                session = openSession();
5342
5343                StringBundler query = new StringBundler(3);
5344
5345                query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
5346
5347                query.append(_FINDER_COLUMN_C_S_COMPANYID_2);
5348
5349                query.append(_FINDER_COLUMN_C_S_STATUS_2);
5350
5351                String sql = query.toString();
5352
5353                Query q = session.createQuery(sql);
5354
5355                QueryPos qPos = QueryPos.getInstance(q);
5356
5357                qPos.add(companyId);
5358
5359                qPos.add(status);
5360
5361                count = (Long)q.uniqueResult();
5362            }
5363            catch (Exception e) {
5364                throw processException(e);
5365            }
5366            finally {
5367                if (count == null) {
5368                    count = Long.valueOf(0);
5369                }
5370
5371                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_S, finderArgs,
5372                    count);
5373
5374                closeSession(session);
5375            }
5376        }
5377
5378        return count.intValue();
5379    }
5380
5381    public int countByG_UT(long groupId, String urlTitle)
5382        throws SystemException {
5383        Object[] finderArgs = new Object[] { new Long(groupId), urlTitle };
5384
5385        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_UT,
5386                finderArgs, this);
5387
5388        if (count == null) {
5389            Session session = null;
5390
5391            try {
5392                session = openSession();
5393
5394                StringBundler query = new StringBundler(3);
5395
5396                query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
5397
5398                query.append(_FINDER_COLUMN_G_UT_GROUPID_2);
5399
5400                if (urlTitle == null) {
5401                    query.append(_FINDER_COLUMN_G_UT_URLTITLE_1);
5402                }
5403                else {
5404                    if (urlTitle.equals(StringPool.BLANK)) {
5405                        query.append(_FINDER_COLUMN_G_UT_URLTITLE_3);
5406                    }
5407                    else {
5408                        query.append(_FINDER_COLUMN_G_UT_URLTITLE_2);
5409                    }
5410                }
5411
5412                String sql = query.toString();
5413
5414                Query q = session.createQuery(sql);
5415
5416                QueryPos qPos = QueryPos.getInstance(q);
5417
5418                qPos.add(groupId);
5419
5420                if (urlTitle != null) {
5421                    qPos.add(urlTitle);
5422                }
5423
5424                count = (Long)q.uniqueResult();
5425            }
5426            catch (Exception e) {
5427                throw processException(e);
5428            }
5429            finally {
5430                if (count == null) {
5431                    count = Long.valueOf(0);
5432                }
5433
5434                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_UT,
5435                    finderArgs, count);
5436
5437                closeSession(session);
5438            }
5439        }
5440
5441        return count.intValue();
5442    }
5443
5444    public int countByG_D(long groupId, Date displayDate)
5445        throws SystemException {
5446        Object[] finderArgs = new Object[] { new Long(groupId), displayDate };
5447
5448        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_D,
5449                finderArgs, this);
5450
5451        if (count == null) {
5452            Session session = null;
5453
5454            try {
5455                session = openSession();
5456
5457                StringBundler query = new StringBundler(3);
5458
5459                query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
5460
5461                query.append(_FINDER_COLUMN_G_D_GROUPID_2);
5462
5463                if (displayDate == null) {
5464                    query.append(_FINDER_COLUMN_G_D_DISPLAYDATE_1);
5465                }
5466                else {
5467                    query.append(_FINDER_COLUMN_G_D_DISPLAYDATE_2);
5468                }
5469
5470                String sql = query.toString();
5471
5472                Query q = session.createQuery(sql);
5473
5474                QueryPos qPos = QueryPos.getInstance(q);
5475
5476                qPos.add(groupId);
5477
5478                if (displayDate != null) {
5479                    qPos.add(CalendarUtil.getTimestamp(displayDate));
5480                }
5481
5482                count = (Long)q.uniqueResult();
5483            }
5484            catch (Exception e) {
5485                throw processException(e);
5486            }
5487            finally {
5488                if (count == null) {
5489                    count = Long.valueOf(0);
5490                }
5491
5492                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_D, finderArgs,
5493                    count);
5494
5495                closeSession(session);
5496            }
5497        }
5498
5499        return count.intValue();
5500    }
5501
5502    public int countByG_S(long groupId, int status) throws SystemException {
5503        Object[] finderArgs = new Object[] {
5504                new Long(groupId), new Integer(status)
5505            };
5506
5507        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_S,
5508                finderArgs, this);
5509
5510        if (count == null) {
5511            Session session = null;
5512
5513            try {
5514                session = openSession();
5515
5516                StringBundler query = new StringBundler(3);
5517
5518                query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
5519
5520                query.append(_FINDER_COLUMN_G_S_GROUPID_2);
5521
5522                query.append(_FINDER_COLUMN_G_S_STATUS_2);
5523
5524                String sql = query.toString();
5525
5526                Query q = session.createQuery(sql);
5527
5528                QueryPos qPos = QueryPos.getInstance(q);
5529
5530                qPos.add(groupId);
5531
5532                qPos.add(status);
5533
5534                count = (Long)q.uniqueResult();
5535            }
5536            catch (Exception e) {
5537                throw processException(e);
5538            }
5539            finally {
5540                if (count == null) {
5541                    count = Long.valueOf(0);
5542                }
5543
5544                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_S, finderArgs,
5545                    count);
5546
5547                closeSession(session);
5548            }
5549        }
5550
5551        return count.intValue();
5552    }
5553
5554    public int countByC_U_S(long companyId, long userId, int status)
5555        throws SystemException {
5556        Object[] finderArgs = new Object[] {
5557                new Long(companyId), new Long(userId), new Integer(status)
5558            };
5559
5560        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_U_S,
5561                finderArgs, this);
5562
5563        if (count == null) {
5564            Session session = null;
5565
5566            try {
5567                session = openSession();
5568
5569                StringBundler query = new StringBundler(4);
5570
5571                query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
5572
5573                query.append(_FINDER_COLUMN_C_U_S_COMPANYID_2);
5574
5575                query.append(_FINDER_COLUMN_C_U_S_USERID_2);
5576
5577                query.append(_FINDER_COLUMN_C_U_S_STATUS_2);
5578
5579                String sql = query.toString();
5580
5581                Query q = session.createQuery(sql);
5582
5583                QueryPos qPos = QueryPos.getInstance(q);
5584
5585                qPos.add(companyId);
5586
5587                qPos.add(userId);
5588
5589                qPos.add(status);
5590
5591                count = (Long)q.uniqueResult();
5592            }
5593            catch (Exception e) {
5594                throw processException(e);
5595            }
5596            finally {
5597                if (count == null) {
5598                    count = Long.valueOf(0);
5599                }
5600
5601                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_U_S,
5602                    finderArgs, count);
5603
5604                closeSession(session);
5605            }
5606        }
5607
5608        return count.intValue();
5609    }
5610
5611    public int countByC_D_S(long companyId, Date displayDate, int status)
5612        throws SystemException {
5613        Object[] finderArgs = new Object[] {
5614                new Long(companyId),
5615                
5616                displayDate, new Integer(status)
5617            };
5618
5619        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_D_S,
5620                finderArgs, this);
5621
5622        if (count == null) {
5623            Session session = null;
5624
5625            try {
5626                session = openSession();
5627
5628                StringBundler query = new StringBundler(4);
5629
5630                query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
5631
5632                query.append(_FINDER_COLUMN_C_D_S_COMPANYID_2);
5633
5634                if (displayDate == null) {
5635                    query.append(_FINDER_COLUMN_C_D_S_DISPLAYDATE_1);
5636                }
5637                else {
5638                    query.append(_FINDER_COLUMN_C_D_S_DISPLAYDATE_2);
5639                }
5640
5641                query.append(_FINDER_COLUMN_C_D_S_STATUS_2);
5642
5643                String sql = query.toString();
5644
5645                Query q = session.createQuery(sql);
5646
5647                QueryPos qPos = QueryPos.getInstance(q);
5648
5649                qPos.add(companyId);
5650
5651                if (displayDate != null) {
5652                    qPos.add(CalendarUtil.getTimestamp(displayDate));
5653                }
5654
5655                qPos.add(status);
5656
5657                count = (Long)q.uniqueResult();
5658            }
5659            catch (Exception e) {
5660                throw processException(e);
5661            }
5662            finally {
5663                if (count == null) {
5664                    count = Long.valueOf(0);
5665                }
5666
5667                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_D_S,
5668                    finderArgs, count);
5669
5670                closeSession(session);
5671            }
5672        }
5673
5674        return count.intValue();
5675    }
5676
5677    public int countByG_U_D(long groupId, long userId, Date displayDate)
5678        throws SystemException {
5679        Object[] finderArgs = new Object[] {
5680                new Long(groupId), new Long(userId),
5681                
5682                displayDate
5683            };
5684
5685        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_U_D,
5686                finderArgs, this);
5687
5688        if (count == null) {
5689            Session session = null;
5690
5691            try {
5692                session = openSession();
5693
5694                StringBundler query = new StringBundler(4);
5695
5696                query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
5697
5698                query.append(_FINDER_COLUMN_G_U_D_GROUPID_2);
5699
5700                query.append(_FINDER_COLUMN_G_U_D_USERID_2);
5701
5702                if (displayDate == null) {
5703                    query.append(_FINDER_COLUMN_G_U_D_DISPLAYDATE_1);
5704                }
5705                else {
5706                    query.append(_FINDER_COLUMN_G_U_D_DISPLAYDATE_2);
5707                }
5708
5709                String sql = query.toString();
5710
5711                Query q = session.createQuery(sql);
5712
5713                QueryPos qPos = QueryPos.getInstance(q);
5714
5715                qPos.add(groupId);
5716
5717                qPos.add(userId);
5718
5719                if (displayDate != null) {
5720                    qPos.add(CalendarUtil.getTimestamp(displayDate));
5721                }
5722
5723                count = (Long)q.uniqueResult();
5724            }
5725            catch (Exception e) {
5726                throw processException(e);
5727            }
5728            finally {
5729                if (count == null) {
5730                    count = Long.valueOf(0);
5731                }
5732
5733                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_U_D,
5734                    finderArgs, count);
5735
5736                closeSession(session);
5737            }
5738        }
5739
5740        return count.intValue();
5741    }
5742
5743    public int countByG_U_S(long groupId, long userId, int status)
5744        throws SystemException {
5745        Object[] finderArgs = new Object[] {
5746                new Long(groupId), new Long(userId), new Integer(status)
5747            };
5748
5749        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_U_S,
5750                finderArgs, this);
5751
5752        if (count == null) {
5753            Session session = null;
5754
5755            try {
5756                session = openSession();
5757
5758                StringBundler query = new StringBundler(4);
5759
5760                query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
5761
5762                query.append(_FINDER_COLUMN_G_U_S_GROUPID_2);
5763
5764                query.append(_FINDER_COLUMN_G_U_S_USERID_2);
5765
5766                query.append(_FINDER_COLUMN_G_U_S_STATUS_2);
5767
5768                String sql = query.toString();
5769
5770                Query q = session.createQuery(sql);
5771
5772                QueryPos qPos = QueryPos.getInstance(q);
5773
5774                qPos.add(groupId);
5775
5776                qPos.add(userId);
5777
5778                qPos.add(status);
5779
5780                count = (Long)q.uniqueResult();
5781            }
5782            catch (Exception e) {
5783                throw processException(e);
5784            }
5785            finally {
5786                if (count == null) {
5787                    count = Long.valueOf(0);
5788                }
5789
5790                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_U_S,
5791                    finderArgs, count);
5792
5793                closeSession(session);
5794            }
5795        }
5796
5797        return count.intValue();
5798    }
5799
5800    public int countByG_D_S(long groupId, Date displayDate, int status)
5801        throws SystemException {
5802        Object[] finderArgs = new Object[] {
5803                new Long(groupId),
5804                
5805                displayDate, new Integer(status)
5806            };
5807
5808        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_D_S,
5809                finderArgs, this);
5810
5811        if (count == null) {
5812            Session session = null;
5813
5814            try {
5815                session = openSession();
5816
5817                StringBundler query = new StringBundler(4);
5818
5819                query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
5820
5821                query.append(_FINDER_COLUMN_G_D_S_GROUPID_2);
5822
5823                if (displayDate == null) {
5824                    query.append(_FINDER_COLUMN_G_D_S_DISPLAYDATE_1);
5825                }
5826                else {
5827                    query.append(_FINDER_COLUMN_G_D_S_DISPLAYDATE_2);
5828                }
5829
5830                query.append(_FINDER_COLUMN_G_D_S_STATUS_2);
5831
5832                String sql = query.toString();
5833
5834                Query q = session.createQuery(sql);
5835
5836                QueryPos qPos = QueryPos.getInstance(q);
5837
5838                qPos.add(groupId);
5839
5840                if (displayDate != null) {
5841                    qPos.add(CalendarUtil.getTimestamp(displayDate));
5842                }
5843
5844                qPos.add(status);
5845
5846                count = (Long)q.uniqueResult();
5847            }
5848            catch (Exception e) {
5849                throw processException(e);
5850            }
5851            finally {
5852                if (count == null) {
5853                    count = Long.valueOf(0);
5854                }
5855
5856                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_D_S,
5857                    finderArgs, count);
5858
5859                closeSession(session);
5860            }
5861        }
5862
5863        return count.intValue();
5864    }
5865
5866    public int countByG_U_D_S(long groupId, long userId, Date displayDate,
5867        int status) throws SystemException {
5868        Object[] finderArgs = new Object[] {
5869                new Long(groupId), new Long(userId),
5870                
5871                displayDate, new Integer(status)
5872            };
5873
5874        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_U_D_S,
5875                finderArgs, this);
5876
5877        if (count == null) {
5878            Session session = null;
5879
5880            try {
5881                session = openSession();
5882
5883                StringBundler query = new StringBundler(5);
5884
5885                query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
5886
5887                query.append(_FINDER_COLUMN_G_U_D_S_GROUPID_2);
5888
5889                query.append(_FINDER_COLUMN_G_U_D_S_USERID_2);
5890
5891                if (displayDate == null) {
5892                    query.append(_FINDER_COLUMN_G_U_D_S_DISPLAYDATE_1);
5893                }
5894                else {
5895                    query.append(_FINDER_COLUMN_G_U_D_S_DISPLAYDATE_2);
5896                }
5897
5898                query.append(_FINDER_COLUMN_G_U_D_S_STATUS_2);
5899
5900                String sql = query.toString();
5901
5902                Query q = session.createQuery(sql);
5903
5904                QueryPos qPos = QueryPos.getInstance(q);
5905
5906                qPos.add(groupId);
5907
5908                qPos.add(userId);
5909
5910                if (displayDate != null) {
5911                    qPos.add(CalendarUtil.getTimestamp(displayDate));
5912                }
5913
5914                qPos.add(status);
5915
5916                count = (Long)q.uniqueResult();
5917            }
5918            catch (Exception e) {
5919                throw processException(e);
5920            }
5921            finally {
5922                if (count == null) {
5923                    count = Long.valueOf(0);
5924                }
5925
5926                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_U_D_S,
5927                    finderArgs, count);
5928
5929                closeSession(session);
5930            }
5931        }
5932
5933        return count.intValue();
5934    }
5935
5936    public int countAll() throws SystemException {
5937        Object[] finderArgs = new Object[0];
5938
5939        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
5940                finderArgs, this);
5941
5942        if (count == null) {
5943            Session session = null;
5944
5945            try {
5946                session = openSession();
5947
5948                Query q = session.createQuery(_SQL_COUNT_BLOGSENTRY);
5949
5950                count = (Long)q.uniqueResult();
5951            }
5952            catch (Exception e) {
5953                throw processException(e);
5954            }
5955            finally {
5956                if (count == null) {
5957                    count = Long.valueOf(0);
5958                }
5959
5960                FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
5961                    count);
5962
5963                closeSession(session);
5964            }
5965        }
5966
5967        return count.intValue();
5968    }
5969
5970    public void afterPropertiesSet() {
5971        String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
5972                    com.liferay.portal.util.PropsUtil.get(
5973                        "value.object.listener.com.liferay.portlet.blogs.model.BlogsEntry")));
5974
5975        if (listenerClassNames.length > 0) {
5976            try {
5977                List<ModelListener<BlogsEntry>> listenersList = new ArrayList<ModelListener<BlogsEntry>>();
5978
5979                for (String listenerClassName : listenerClassNames) {
5980                    listenersList.add((ModelListener<BlogsEntry>)Class.forName(
5981                            listenerClassName).newInstance());
5982                }
5983
5984                listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
5985            }
5986            catch (Exception e) {
5987                _log.error(e);
5988            }
5989        }
5990    }
5991
5992    @BeanReference(type = BlogsEntryPersistence.class)
5993    protected BlogsEntryPersistence blogsEntryPersistence;
5994    @BeanReference(type = BlogsStatsUserPersistence.class)
5995    protected BlogsStatsUserPersistence blogsStatsUserPersistence;
5996    @BeanReference(type = CompanyPersistence.class)
5997    protected CompanyPersistence companyPersistence;
5998    @BeanReference(type = GroupPersistence.class)
5999    protected GroupPersistence groupPersistence;
6000    @BeanReference(type = OrganizationPersistence.class)
6001    protected OrganizationPersistence organizationPersistence;
6002    @BeanReference(type = PortletPreferencesPersistence.class)
6003    protected PortletPreferencesPersistence portletPreferencesPersistence;
6004    @BeanReference(type = ResourcePersistence.class)
6005    protected ResourcePersistence resourcePersistence;
6006    @BeanReference(type = UserPersistence.class)
6007    protected UserPersistence userPersistence;
6008    @BeanReference(type = AssetEntryPersistence.class)
6009    protected AssetEntryPersistence assetEntryPersistence;
6010    @BeanReference(type = AssetTagPersistence.class)
6011    protected AssetTagPersistence assetTagPersistence;
6012    @BeanReference(type = ExpandoValuePersistence.class)
6013    protected ExpandoValuePersistence expandoValuePersistence;
6014    @BeanReference(type = MBMessagePersistence.class)
6015    protected MBMessagePersistence mbMessagePersistence;
6016    @BeanReference(type = RatingsStatsPersistence.class)
6017    protected RatingsStatsPersistence ratingsStatsPersistence;
6018    @BeanReference(type = SocialActivityPersistence.class)
6019    protected SocialActivityPersistence socialActivityPersistence;
6020    private static final String _SQL_SELECT_BLOGSENTRY = "SELECT blogsEntry FROM BlogsEntry blogsEntry";
6021    private static final String _SQL_SELECT_BLOGSENTRY_WHERE = "SELECT blogsEntry FROM BlogsEntry blogsEntry WHERE ";
6022    private static final String _SQL_COUNT_BLOGSENTRY = "SELECT COUNT(blogsEntry) FROM BlogsEntry blogsEntry";
6023    private static final String _SQL_COUNT_BLOGSENTRY_WHERE = "SELECT COUNT(blogsEntry) FROM BlogsEntry blogsEntry WHERE ";
6024    private static final String _FINDER_COLUMN_UUID_UUID_1 = "blogsEntry.uuid IS NULL";
6025    private static final String _FINDER_COLUMN_UUID_UUID_2 = "blogsEntry.uuid = ?";
6026    private static final String _FINDER_COLUMN_UUID_UUID_3 = "(blogsEntry.uuid IS NULL OR blogsEntry.uuid = ?)";
6027    private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "blogsEntry.uuid IS NULL AND ";
6028    private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "blogsEntry.uuid = ? AND ";
6029    private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(blogsEntry.uuid IS NULL OR blogsEntry.uuid = ?) AND ";
6030    private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "blogsEntry.groupId = ?";
6031    private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "blogsEntry.groupId = ?";
6032    private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "blogsEntry.companyId = ?";
6033    private static final String _FINDER_COLUMN_C_U_COMPANYID_2 = "blogsEntry.companyId = ? AND ";
6034    private static final String _FINDER_COLUMN_C_U_USERID_2 = "blogsEntry.userId = ?";
6035    private static final String _FINDER_COLUMN_C_D_COMPANYID_2 = "blogsEntry.companyId = ? AND ";
6036    private static final String _FINDER_COLUMN_C_D_DISPLAYDATE_1 = "blogsEntry.displayDate < NULL";
6037    private static final String _FINDER_COLUMN_C_D_DISPLAYDATE_2 = "blogsEntry.displayDate < ?";
6038    private static final String _FINDER_COLUMN_C_S_COMPANYID_2 = "blogsEntry.companyId = ? AND ";
6039    private static final String _FINDER_COLUMN_C_S_STATUS_2 = "blogsEntry.status = ?";
6040    private static final String _FINDER_COLUMN_G_UT_GROUPID_2 = "blogsEntry.groupId = ? AND ";
6041    private static final String _FINDER_COLUMN_G_UT_URLTITLE_1 = "blogsEntry.urlTitle IS NULL";
6042    private static final String _FINDER_COLUMN_G_UT_URLTITLE_2 = "blogsEntry.urlTitle = ?";
6043    private static final String _FINDER_COLUMN_G_UT_URLTITLE_3 = "(blogsEntry.urlTitle IS NULL OR blogsEntry.urlTitle = ?)";
6044    private static final String _FINDER_COLUMN_G_D_GROUPID_2 = "blogsEntry.groupId = ? AND ";
6045    private static final String _FINDER_COLUMN_G_D_DISPLAYDATE_1 = "blogsEntry.displayDate < NULL";
6046    private static final String _FINDER_COLUMN_G_D_DISPLAYDATE_2 = "blogsEntry.displayDate < ?";
6047    private static final String _FINDER_COLUMN_G_S_GROUPID_2 = "blogsEntry.groupId = ? AND ";
6048    private static final String _FINDER_COLUMN_G_S_STATUS_2 = "blogsEntry.status = ?";
6049    private static final String _FINDER_COLUMN_C_U_S_COMPANYID_2 = "blogsEntry.companyId = ? AND ";
6050    private static final String _FINDER_COLUMN_C_U_S_USERID_2 = "blogsEntry.userId = ? AND ";
6051    private static final String _FINDER_COLUMN_C_U_S_STATUS_2 = "blogsEntry.status = ?";
6052    private static final String _FINDER_COLUMN_C_D_S_COMPANYID_2 = "blogsEntry.companyId = ? AND ";
6053    private static final String _FINDER_COLUMN_C_D_S_DISPLAYDATE_1 = "blogsEntry.displayDate < NULL AND ";
6054    private static final String _FINDER_COLUMN_C_D_S_DISPLAYDATE_2 = "blogsEntry.displayDate < ? AND ";
6055    private static final String _FINDER_COLUMN_C_D_S_STATUS_2 = "blogsEntry.status = ?";
6056    private static final String _FINDER_COLUMN_G_U_D_GROUPID_2 = "blogsEntry.groupId = ? AND ";
6057    private static final String _FINDER_COLUMN_G_U_D_USERID_2 = "blogsEntry.userId = ? AND ";
6058    private static final String _FINDER_COLUMN_G_U_D_DISPLAYDATE_1 = "blogsEntry.displayDate < NULL";
6059    private static final String _FINDER_COLUMN_G_U_D_DISPLAYDATE_2 = "blogsEntry.displayDate < ?";
6060    private static final String _FINDER_COLUMN_G_U_S_GROUPID_2 = "blogsEntry.groupId = ? AND ";
6061    private static final String _FINDER_COLUMN_G_U_S_USERID_2 = "blogsEntry.userId = ? AND ";
6062    private static final String _FINDER_COLUMN_G_U_S_STATUS_2 = "blogsEntry.status = ?";
6063    private static final String _FINDER_COLUMN_G_D_S_GROUPID_2 = "blogsEntry.groupId = ? AND ";
6064    private static final String _FINDER_COLUMN_G_D_S_DISPLAYDATE_1 = "blogsEntry.displayDate < NULL AND ";
6065    private static final String _FINDER_COLUMN_G_D_S_DISPLAYDATE_2 = "blogsEntry.displayDate < ? AND ";
6066    private static final String _FINDER_COLUMN_G_D_S_STATUS_2 = "blogsEntry.status = ?";
6067    private static final String _FINDER_COLUMN_G_U_D_S_GROUPID_2 = "blogsEntry.groupId = ? AND ";
6068    private static final String _FINDER_COLUMN_G_U_D_S_USERID_2 = "blogsEntry.userId = ? AND ";
6069    private static final String _FINDER_COLUMN_G_U_D_S_DISPLAYDATE_1 = "blogsEntry.displayDate < NULL AND ";
6070    private static final String _FINDER_COLUMN_G_U_D_S_DISPLAYDATE_2 = "blogsEntry.displayDate < ? AND ";
6071    private static final String _FINDER_COLUMN_G_U_D_S_STATUS_2 = "blogsEntry.status = ?";
6072    private static final String _ORDER_BY_ENTITY_ALIAS = "blogsEntry.";
6073    private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No BlogsEntry exists with the primary key ";
6074    private static final String _NO_SUCH_ENTITY_WITH_KEY = "No BlogsEntry exists with the key {";
6075    private static Log _log = LogFactoryUtil.getLog(BlogsEntryPersistenceImpl.class);
6076}