1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.blogs.service.persistence;
24  
25  import com.liferay.portal.NoSuchModelException;
26  import com.liferay.portal.SystemException;
27  import com.liferay.portal.kernel.annotation.BeanReference;
28  import com.liferay.portal.kernel.cache.CacheRegistry;
29  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
30  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
31  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
32  import com.liferay.portal.kernel.dao.orm.FinderPath;
33  import com.liferay.portal.kernel.dao.orm.Query;
34  import com.liferay.portal.kernel.dao.orm.QueryPos;
35  import com.liferay.portal.kernel.dao.orm.QueryUtil;
36  import com.liferay.portal.kernel.dao.orm.Session;
37  import com.liferay.portal.kernel.log.Log;
38  import com.liferay.portal.kernel.log.LogFactoryUtil;
39  import com.liferay.portal.kernel.util.CalendarUtil;
40  import com.liferay.portal.kernel.util.GetterUtil;
41  import com.liferay.portal.kernel.util.OrderByComparator;
42  import com.liferay.portal.kernel.util.StringBundler;
43  import com.liferay.portal.kernel.util.StringPool;
44  import com.liferay.portal.kernel.util.StringUtil;
45  import com.liferay.portal.kernel.util.Validator;
46  import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
47  import com.liferay.portal.model.ModelListener;
48  import com.liferay.portal.service.persistence.BatchSessionUtil;
49  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
50  
51  import com.liferay.portlet.blogs.NoSuchEntryException;
52  import com.liferay.portlet.blogs.model.BlogsEntry;
53  import com.liferay.portlet.blogs.model.impl.BlogsEntryImpl;
54  import com.liferay.portlet.blogs.model.impl.BlogsEntryModelImpl;
55  
56  import java.io.Serializable;
57  
58  import java.util.ArrayList;
59  import java.util.Collections;
60  import java.util.Date;
61  import java.util.List;
62  
63  /**
64   * <a href="BlogsEntryPersistenceImpl.java.html"><b><i>View Source</i></b></a>
65   *
66   * <p>
67   * ServiceBuilder generated this class. Modifications in this class will be
68   * overwritten the next time is generated.
69   * </p>
70   *
71   * @author    Brian Wing Shun Chan
72   * @see       BlogsEntryPersistence
73   * @see       BlogsEntryUtil
74   * @generated
75   */
76  public class BlogsEntryPersistenceImpl extends BasePersistenceImpl<BlogsEntry>
77      implements BlogsEntryPersistence {
78      public static final String FINDER_CLASS_NAME_ENTITY = BlogsEntryImpl.class.getName();
79      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
80          ".List";
81      public static final FinderPath FINDER_PATH_FIND_BY_UUID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
82              BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
83              "findByUuid", new String[] { String.class.getName() });
84      public static final FinderPath FINDER_PATH_FIND_BY_OBC_UUID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
85              BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
86              "findByUuid",
87              new String[] {
88                  String.class.getName(),
89                  
90              "java.lang.Integer", "java.lang.Integer",
91                  "com.liferay.portal.kernel.util.OrderByComparator"
92              });
93      public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
94              BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
95              "countByUuid", new String[] { String.class.getName() });
96      public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
97              BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
98              "fetchByUUID_G",
99              new String[] { String.class.getName(), Long.class.getName() });
100     public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
101             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
102             "countByUUID_G",
103             new String[] { String.class.getName(), Long.class.getName() });
104     public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
105             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
106             "findByGroupId", new String[] { Long.class.getName() });
107     public static final FinderPath FINDER_PATH_FIND_BY_OBC_GROUPID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
108             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
109             "findByGroupId",
110             new String[] {
111                 Long.class.getName(),
112                 
113             "java.lang.Integer", "java.lang.Integer",
114                 "com.liferay.portal.kernel.util.OrderByComparator"
115             });
116     public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
117             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
118             "countByGroupId", new String[] { Long.class.getName() });
119     public static final FinderPath FINDER_PATH_FIND_BY_COMPANYID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
120             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
121             "findByCompanyId", new String[] { Long.class.getName() });
122     public static final FinderPath FINDER_PATH_FIND_BY_OBC_COMPANYID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
123             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
124             "findByCompanyId",
125             new String[] {
126                 Long.class.getName(),
127                 
128             "java.lang.Integer", "java.lang.Integer",
129                 "com.liferay.portal.kernel.util.OrderByComparator"
130             });
131     public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
132             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
133             "countByCompanyId", new String[] { Long.class.getName() });
134     public static final FinderPath FINDER_PATH_FIND_BY_G_U = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
135             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
136             "findByG_U",
137             new String[] { Long.class.getName(), Long.class.getName() });
138     public static final FinderPath FINDER_PATH_FIND_BY_OBC_G_U = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
139             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
140             "findByG_U",
141             new String[] {
142                 Long.class.getName(), Long.class.getName(),
143                 
144             "java.lang.Integer", "java.lang.Integer",
145                 "com.liferay.portal.kernel.util.OrderByComparator"
146             });
147     public static final FinderPath FINDER_PATH_COUNT_BY_G_U = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
148             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
149             "countByG_U",
150             new String[] { Long.class.getName(), Long.class.getName() });
151     public static final FinderPath FINDER_PATH_FETCH_BY_G_UT = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
152             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
153             "fetchByG_UT",
154             new String[] { Long.class.getName(), String.class.getName() });
155     public static final FinderPath FINDER_PATH_COUNT_BY_G_UT = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
156             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
157             "countByG_UT",
158             new String[] { Long.class.getName(), String.class.getName() });
159     public static final FinderPath FINDER_PATH_FIND_BY_G_D_D = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
160             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
161             "findByG_D_D",
162             new String[] {
163                 Long.class.getName(), Date.class.getName(),
164                 Boolean.class.getName()
165             });
166     public static final FinderPath FINDER_PATH_FIND_BY_OBC_G_D_D = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
167             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
168             "findByG_D_D",
169             new String[] {
170                 Long.class.getName(), Date.class.getName(),
171                 Boolean.class.getName(),
172                 
173             "java.lang.Integer", "java.lang.Integer",
174                 "com.liferay.portal.kernel.util.OrderByComparator"
175             });
176     public static final FinderPath FINDER_PATH_COUNT_BY_G_D_D = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
177             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
178             "countByG_D_D",
179             new String[] {
180                 Long.class.getName(), Date.class.getName(),
181                 Boolean.class.getName()
182             });
183     public static final FinderPath FINDER_PATH_FIND_BY_C_D_D = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
184             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
185             "findByC_D_D",
186             new String[] {
187                 Long.class.getName(), Date.class.getName(),
188                 Boolean.class.getName()
189             });
190     public static final FinderPath FINDER_PATH_FIND_BY_OBC_C_D_D = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
191             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
192             "findByC_D_D",
193             new String[] {
194                 Long.class.getName(), Date.class.getName(),
195                 Boolean.class.getName(),
196                 
197             "java.lang.Integer", "java.lang.Integer",
198                 "com.liferay.portal.kernel.util.OrderByComparator"
199             });
200     public static final FinderPath FINDER_PATH_COUNT_BY_C_D_D = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
201             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
202             "countByC_D_D",
203             new String[] {
204                 Long.class.getName(), Date.class.getName(),
205                 Boolean.class.getName()
206             });
207     public static final FinderPath FINDER_PATH_FIND_BY_G_U_D_D = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
208             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
209             "findByG_U_D_D",
210             new String[] {
211                 Long.class.getName(), Long.class.getName(), Date.class.getName(),
212                 Boolean.class.getName()
213             });
214     public static final FinderPath FINDER_PATH_FIND_BY_OBC_G_U_D_D = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
215             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
216             "findByG_U_D_D",
217             new String[] {
218                 Long.class.getName(), Long.class.getName(), Date.class.getName(),
219                 Boolean.class.getName(),
220                 
221             "java.lang.Integer", "java.lang.Integer",
222                 "com.liferay.portal.kernel.util.OrderByComparator"
223             });
224     public static final FinderPath FINDER_PATH_COUNT_BY_G_U_D_D = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
225             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
226             "countByG_U_D_D",
227             new String[] {
228                 Long.class.getName(), Long.class.getName(), Date.class.getName(),
229                 Boolean.class.getName()
230             });
231     public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
232             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
233             "findAll", new String[0]);
234     public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
235             BlogsEntryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
236             "countAll", new String[0]);
237 
238     public void cacheResult(BlogsEntry blogsEntry) {
239         EntityCacheUtil.putResult(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
240             BlogsEntryImpl.class, blogsEntry.getPrimaryKey(), blogsEntry);
241 
242         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
243             new Object[] { blogsEntry.getUuid(), new Long(
244                     blogsEntry.getGroupId()) }, blogsEntry);
245 
246         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_UT,
247             new Object[] {
248                 new Long(blogsEntry.getGroupId()),
249                 
250             blogsEntry.getUrlTitle()
251             }, blogsEntry);
252     }
253 
254     public void cacheResult(List<BlogsEntry> blogsEntries) {
255         for (BlogsEntry blogsEntry : blogsEntries) {
256             if (EntityCacheUtil.getResult(
257                         BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
258                         BlogsEntryImpl.class, blogsEntry.getPrimaryKey(), this) == null) {
259                 cacheResult(blogsEntry);
260             }
261         }
262     }
263 
264     public void clearCache() {
265         CacheRegistry.clear(BlogsEntryImpl.class.getName());
266         EntityCacheUtil.clearCache(BlogsEntryImpl.class.getName());
267         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
268         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
269     }
270 
271     public BlogsEntry create(long entryId) {
272         BlogsEntry blogsEntry = new BlogsEntryImpl();
273 
274         blogsEntry.setNew(true);
275         blogsEntry.setPrimaryKey(entryId);
276 
277         String uuid = PortalUUIDUtil.generate();
278 
279         blogsEntry.setUuid(uuid);
280 
281         return blogsEntry;
282     }
283 
284     public BlogsEntry remove(Serializable primaryKey)
285         throws NoSuchModelException, SystemException {
286         return remove(((Long)primaryKey).longValue());
287     }
288 
289     public BlogsEntry remove(long entryId)
290         throws NoSuchEntryException, SystemException {
291         Session session = null;
292 
293         try {
294             session = openSession();
295 
296             BlogsEntry blogsEntry = (BlogsEntry)session.get(BlogsEntryImpl.class,
297                     new Long(entryId));
298 
299             if (blogsEntry == null) {
300                 if (_log.isWarnEnabled()) {
301                     _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + entryId);
302                 }
303 
304                 throw new NoSuchEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
305                     entryId);
306             }
307 
308             return remove(blogsEntry);
309         }
310         catch (NoSuchEntryException nsee) {
311             throw nsee;
312         }
313         catch (Exception e) {
314             throw processException(e);
315         }
316         finally {
317             closeSession(session);
318         }
319     }
320 
321     public BlogsEntry remove(BlogsEntry blogsEntry) throws SystemException {
322         for (ModelListener<BlogsEntry> listener : listeners) {
323             listener.onBeforeRemove(blogsEntry);
324         }
325 
326         blogsEntry = removeImpl(blogsEntry);
327 
328         for (ModelListener<BlogsEntry> listener : listeners) {
329             listener.onAfterRemove(blogsEntry);
330         }
331 
332         return blogsEntry;
333     }
334 
335     protected BlogsEntry removeImpl(BlogsEntry blogsEntry)
336         throws SystemException {
337         blogsEntry = toUnwrappedModel(blogsEntry);
338 
339         Session session = null;
340 
341         try {
342             session = openSession();
343 
344             if (blogsEntry.isCachedModel() || BatchSessionUtil.isEnabled()) {
345                 Object staleObject = session.get(BlogsEntryImpl.class,
346                         blogsEntry.getPrimaryKeyObj());
347 
348                 if (staleObject != null) {
349                     session.evict(staleObject);
350                 }
351             }
352 
353             session.delete(blogsEntry);
354 
355             session.flush();
356         }
357         catch (Exception e) {
358             throw processException(e);
359         }
360         finally {
361             closeSession(session);
362         }
363 
364         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
365 
366         BlogsEntryModelImpl blogsEntryModelImpl = (BlogsEntryModelImpl)blogsEntry;
367 
368         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
369             new Object[] {
370                 blogsEntryModelImpl.getOriginalUuid(),
371                 new Long(blogsEntryModelImpl.getOriginalGroupId())
372             });
373 
374         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_UT,
375             new Object[] {
376                 new Long(blogsEntryModelImpl.getOriginalGroupId()),
377                 
378             blogsEntryModelImpl.getOriginalUrlTitle()
379             });
380 
381         EntityCacheUtil.removeResult(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
382             BlogsEntryImpl.class, blogsEntry.getPrimaryKey());
383 
384         return blogsEntry;
385     }
386 
387     /**
388      * @deprecated Use {@link BasePersistence#update(com.liferay.portal.model.BaseModel, boolean)}.
389      */
390     public BlogsEntry update(BlogsEntry blogsEntry) throws SystemException {
391         if (_log.isWarnEnabled()) {
392             _log.warn(
393                 "Using the deprecated update(BlogsEntry blogsEntry) method. Use update(BlogsEntry blogsEntry, boolean merge) instead.");
394         }
395 
396         return update(blogsEntry, false);
397     }
398 
399     public BlogsEntry updateImpl(
400         com.liferay.portlet.blogs.model.BlogsEntry blogsEntry, boolean merge)
401         throws SystemException {
402         blogsEntry = toUnwrappedModel(blogsEntry);
403 
404         boolean isNew = blogsEntry.isNew();
405 
406         BlogsEntryModelImpl blogsEntryModelImpl = (BlogsEntryModelImpl)blogsEntry;
407 
408         if (Validator.isNull(blogsEntry.getUuid())) {
409             String uuid = PortalUUIDUtil.generate();
410 
411             blogsEntry.setUuid(uuid);
412         }
413 
414         Session session = null;
415 
416         try {
417             session = openSession();
418 
419             BatchSessionUtil.update(session, blogsEntry, merge);
420 
421             blogsEntry.setNew(false);
422         }
423         catch (Exception e) {
424             throw processException(e);
425         }
426         finally {
427             closeSession(session);
428         }
429 
430         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
431 
432         EntityCacheUtil.putResult(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
433             BlogsEntryImpl.class, blogsEntry.getPrimaryKey(), blogsEntry);
434 
435         if (!isNew &&
436                 (!Validator.equals(blogsEntry.getUuid(),
437                     blogsEntryModelImpl.getOriginalUuid()) ||
438                 (blogsEntry.getGroupId() != blogsEntryModelImpl.getOriginalGroupId()))) {
439             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
440                 new Object[] {
441                     blogsEntryModelImpl.getOriginalUuid(),
442                     new Long(blogsEntryModelImpl.getOriginalGroupId())
443                 });
444         }
445 
446         if (isNew ||
447                 (!Validator.equals(blogsEntry.getUuid(),
448                     blogsEntryModelImpl.getOriginalUuid()) ||
449                 (blogsEntry.getGroupId() != blogsEntryModelImpl.getOriginalGroupId()))) {
450             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
451                 new Object[] {
452                     blogsEntry.getUuid(), new Long(blogsEntry.getGroupId())
453                 }, blogsEntry);
454         }
455 
456         if (!isNew &&
457                 ((blogsEntry.getGroupId() != blogsEntryModelImpl.getOriginalGroupId()) ||
458                 !Validator.equals(blogsEntry.getUrlTitle(),
459                     blogsEntryModelImpl.getOriginalUrlTitle()))) {
460             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_UT,
461                 new Object[] {
462                     new Long(blogsEntryModelImpl.getOriginalGroupId()),
463                     
464                 blogsEntryModelImpl.getOriginalUrlTitle()
465                 });
466         }
467 
468         if (isNew ||
469                 ((blogsEntry.getGroupId() != blogsEntryModelImpl.getOriginalGroupId()) ||
470                 !Validator.equals(blogsEntry.getUrlTitle(),
471                     blogsEntryModelImpl.getOriginalUrlTitle()))) {
472             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_UT,
473                 new Object[] {
474                     new Long(blogsEntry.getGroupId()),
475                     
476                 blogsEntry.getUrlTitle()
477                 }, blogsEntry);
478         }
479 
480         return blogsEntry;
481     }
482 
483     protected BlogsEntry toUnwrappedModel(BlogsEntry blogsEntry) {
484         if (blogsEntry instanceof BlogsEntryImpl) {
485             return blogsEntry;
486         }
487 
488         BlogsEntryImpl blogsEntryImpl = new BlogsEntryImpl();
489 
490         blogsEntryImpl.setNew(blogsEntry.isNew());
491         blogsEntryImpl.setPrimaryKey(blogsEntry.getPrimaryKey());
492 
493         blogsEntryImpl.setUuid(blogsEntry.getUuid());
494         blogsEntryImpl.setEntryId(blogsEntry.getEntryId());
495         blogsEntryImpl.setGroupId(blogsEntry.getGroupId());
496         blogsEntryImpl.setCompanyId(blogsEntry.getCompanyId());
497         blogsEntryImpl.setUserId(blogsEntry.getUserId());
498         blogsEntryImpl.setUserName(blogsEntry.getUserName());
499         blogsEntryImpl.setCreateDate(blogsEntry.getCreateDate());
500         blogsEntryImpl.setModifiedDate(blogsEntry.getModifiedDate());
501         blogsEntryImpl.setTitle(blogsEntry.getTitle());
502         blogsEntryImpl.setUrlTitle(blogsEntry.getUrlTitle());
503         blogsEntryImpl.setContent(blogsEntry.getContent());
504         blogsEntryImpl.setDisplayDate(blogsEntry.getDisplayDate());
505         blogsEntryImpl.setDraft(blogsEntry.isDraft());
506         blogsEntryImpl.setAllowTrackbacks(blogsEntry.isAllowTrackbacks());
507         blogsEntryImpl.setTrackbacks(blogsEntry.getTrackbacks());
508 
509         return blogsEntryImpl;
510     }
511 
512     public BlogsEntry findByPrimaryKey(Serializable primaryKey)
513         throws NoSuchModelException, SystemException {
514         return findByPrimaryKey(((Long)primaryKey).longValue());
515     }
516 
517     public BlogsEntry findByPrimaryKey(long entryId)
518         throws NoSuchEntryException, SystemException {
519         BlogsEntry blogsEntry = fetchByPrimaryKey(entryId);
520 
521         if (blogsEntry == null) {
522             if (_log.isWarnEnabled()) {
523                 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + entryId);
524             }
525 
526             throw new NoSuchEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
527                 entryId);
528         }
529 
530         return blogsEntry;
531     }
532 
533     public BlogsEntry fetchByPrimaryKey(Serializable primaryKey)
534         throws SystemException {
535         return fetchByPrimaryKey(((Long)primaryKey).longValue());
536     }
537 
538     public BlogsEntry fetchByPrimaryKey(long entryId) throws SystemException {
539         BlogsEntry blogsEntry = (BlogsEntry)EntityCacheUtil.getResult(BlogsEntryModelImpl.ENTITY_CACHE_ENABLED,
540                 BlogsEntryImpl.class, entryId, this);
541 
542         if (blogsEntry == null) {
543             Session session = null;
544 
545             try {
546                 session = openSession();
547 
548                 blogsEntry = (BlogsEntry)session.get(BlogsEntryImpl.class,
549                         new Long(entryId));
550             }
551             catch (Exception e) {
552                 throw processException(e);
553             }
554             finally {
555                 if (blogsEntry != null) {
556                     cacheResult(blogsEntry);
557                 }
558 
559                 closeSession(session);
560             }
561         }
562 
563         return blogsEntry;
564     }
565 
566     public List<BlogsEntry> findByUuid(String uuid) throws SystemException {
567         Object[] finderArgs = new Object[] { uuid };
568 
569         List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_UUID,
570                 finderArgs, this);
571 
572         if (list == null) {
573             Session session = null;
574 
575             try {
576                 session = openSession();
577 
578                 StringBundler query = new StringBundler(3);
579 
580                 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
581 
582                 if (uuid == null) {
583                     query.append(_FINDER_COLUMN_UUID_UUID_1);
584                 }
585                 else {
586                     if (uuid.equals(StringPool.BLANK)) {
587                         query.append(_FINDER_COLUMN_UUID_UUID_3);
588                     }
589                     else {
590                         query.append(_FINDER_COLUMN_UUID_UUID_2);
591                     }
592                 }
593 
594                 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
595 
596                 String sql = query.toString();
597 
598                 Query q = session.createQuery(sql);
599 
600                 QueryPos qPos = QueryPos.getInstance(q);
601 
602                 if (uuid != null) {
603                     qPos.add(uuid);
604                 }
605 
606                 list = q.list();
607             }
608             catch (Exception e) {
609                 throw processException(e);
610             }
611             finally {
612                 if (list == null) {
613                     list = new ArrayList<BlogsEntry>();
614                 }
615 
616                 cacheResult(list);
617 
618                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_UUID, finderArgs,
619                     list);
620 
621                 closeSession(session);
622             }
623         }
624 
625         return list;
626     }
627 
628     public List<BlogsEntry> findByUuid(String uuid, int start, int end)
629         throws SystemException {
630         return findByUuid(uuid, start, end, null);
631     }
632 
633     public List<BlogsEntry> findByUuid(String uuid, int start, int end,
634         OrderByComparator obc) throws SystemException {
635         Object[] finderArgs = new Object[] {
636                 uuid,
637                 
638                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
639             };
640 
641         List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_UUID,
642                 finderArgs, this);
643 
644         if (list == null) {
645             Session session = null;
646 
647             try {
648                 session = openSession();
649 
650                 StringBundler query = null;
651 
652                 if (obc != null) {
653                     query = new StringBundler(3 +
654                             (obc.getOrderByFields().length * 3));
655                 }
656                 else {
657                     query = new StringBundler(3);
658                 }
659 
660                 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
661 
662                 if (uuid == null) {
663                     query.append(_FINDER_COLUMN_UUID_UUID_1);
664                 }
665                 else {
666                     if (uuid.equals(StringPool.BLANK)) {
667                         query.append(_FINDER_COLUMN_UUID_UUID_3);
668                     }
669                     else {
670                         query.append(_FINDER_COLUMN_UUID_UUID_2);
671                     }
672                 }
673 
674                 if (obc != null) {
675                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
676                 }
677 
678                 else {
679                     query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
680                 }
681 
682                 String sql = query.toString();
683 
684                 Query q = session.createQuery(sql);
685 
686                 QueryPos qPos = QueryPos.getInstance(q);
687 
688                 if (uuid != null) {
689                     qPos.add(uuid);
690                 }
691 
692                 list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
693                         end);
694             }
695             catch (Exception e) {
696                 throw processException(e);
697             }
698             finally {
699                 if (list == null) {
700                     list = new ArrayList<BlogsEntry>();
701                 }
702 
703                 cacheResult(list);
704 
705                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_UUID,
706                     finderArgs, list);
707 
708                 closeSession(session);
709             }
710         }
711 
712         return list;
713     }
714 
715     public BlogsEntry findByUuid_First(String uuid, OrderByComparator obc)
716         throws NoSuchEntryException, SystemException {
717         List<BlogsEntry> list = findByUuid(uuid, 0, 1, obc);
718 
719         if (list.isEmpty()) {
720             StringBundler msg = new StringBundler(4);
721 
722             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
723 
724             msg.append("uuid=");
725             msg.append(uuid);
726 
727             msg.append(StringPool.CLOSE_CURLY_BRACE);
728 
729             throw new NoSuchEntryException(msg.toString());
730         }
731         else {
732             return list.get(0);
733         }
734     }
735 
736     public BlogsEntry findByUuid_Last(String uuid, OrderByComparator obc)
737         throws NoSuchEntryException, SystemException {
738         int count = countByUuid(uuid);
739 
740         List<BlogsEntry> list = findByUuid(uuid, count - 1, count, obc);
741 
742         if (list.isEmpty()) {
743             StringBundler msg = new StringBundler(4);
744 
745             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
746 
747             msg.append("uuid=");
748             msg.append(uuid);
749 
750             msg.append(StringPool.CLOSE_CURLY_BRACE);
751 
752             throw new NoSuchEntryException(msg.toString());
753         }
754         else {
755             return list.get(0);
756         }
757     }
758 
759     public BlogsEntry[] findByUuid_PrevAndNext(long entryId, String uuid,
760         OrderByComparator obc) throws NoSuchEntryException, SystemException {
761         BlogsEntry blogsEntry = findByPrimaryKey(entryId);
762 
763         int count = countByUuid(uuid);
764 
765         Session session = null;
766 
767         try {
768             session = openSession();
769 
770             StringBundler query = null;
771 
772             if (obc != null) {
773                 query = new StringBundler(3 +
774                         (obc.getOrderByFields().length * 3));
775             }
776             else {
777                 query = new StringBundler(3);
778             }
779 
780             query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
781 
782             if (uuid == null) {
783                 query.append(_FINDER_COLUMN_UUID_UUID_1);
784             }
785             else {
786                 if (uuid.equals(StringPool.BLANK)) {
787                     query.append(_FINDER_COLUMN_UUID_UUID_3);
788                 }
789                 else {
790                     query.append(_FINDER_COLUMN_UUID_UUID_2);
791                 }
792             }
793 
794             if (obc != null) {
795                 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
796             }
797 
798             else {
799                 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
800             }
801 
802             String sql = query.toString();
803 
804             Query q = session.createQuery(sql);
805 
806             QueryPos qPos = QueryPos.getInstance(q);
807 
808             if (uuid != null) {
809                 qPos.add(uuid);
810             }
811 
812             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
813                     blogsEntry);
814 
815             BlogsEntry[] array = new BlogsEntryImpl[3];
816 
817             array[0] = (BlogsEntry)objArray[0];
818             array[1] = (BlogsEntry)objArray[1];
819             array[2] = (BlogsEntry)objArray[2];
820 
821             return array;
822         }
823         catch (Exception e) {
824             throw processException(e);
825         }
826         finally {
827             closeSession(session);
828         }
829     }
830 
831     public BlogsEntry findByUUID_G(String uuid, long groupId)
832         throws NoSuchEntryException, SystemException {
833         BlogsEntry blogsEntry = fetchByUUID_G(uuid, groupId);
834 
835         if (blogsEntry == null) {
836             StringBundler msg = new StringBundler(6);
837 
838             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
839 
840             msg.append("uuid=");
841             msg.append(uuid);
842 
843             msg.append(", groupId=");
844             msg.append(groupId);
845 
846             msg.append(StringPool.CLOSE_CURLY_BRACE);
847 
848             if (_log.isWarnEnabled()) {
849                 _log.warn(msg.toString());
850             }
851 
852             throw new NoSuchEntryException(msg.toString());
853         }
854 
855         return blogsEntry;
856     }
857 
858     public BlogsEntry fetchByUUID_G(String uuid, long groupId)
859         throws SystemException {
860         return fetchByUUID_G(uuid, groupId, true);
861     }
862 
863     public BlogsEntry fetchByUUID_G(String uuid, long groupId,
864         boolean retrieveFromCache) throws SystemException {
865         Object[] finderArgs = new Object[] { uuid, new Long(groupId) };
866 
867         Object result = null;
868 
869         if (retrieveFromCache) {
870             result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
871                     finderArgs, this);
872         }
873 
874         if (result == null) {
875             Session session = null;
876 
877             try {
878                 session = openSession();
879 
880                 StringBundler query = new StringBundler(4);
881 
882                 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
883 
884                 if (uuid == null) {
885                     query.append(_FINDER_COLUMN_UUID_G_UUID_1);
886                 }
887                 else {
888                     if (uuid.equals(StringPool.BLANK)) {
889                         query.append(_FINDER_COLUMN_UUID_G_UUID_3);
890                     }
891                     else {
892                         query.append(_FINDER_COLUMN_UUID_G_UUID_2);
893                     }
894                 }
895 
896                 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
897 
898                 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
899 
900                 String sql = query.toString();
901 
902                 Query q = session.createQuery(sql);
903 
904                 QueryPos qPos = QueryPos.getInstance(q);
905 
906                 if (uuid != null) {
907                     qPos.add(uuid);
908                 }
909 
910                 qPos.add(groupId);
911 
912                 List<BlogsEntry> list = q.list();
913 
914                 result = list;
915 
916                 BlogsEntry blogsEntry = null;
917 
918                 if (list.isEmpty()) {
919                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
920                         finderArgs, list);
921                 }
922                 else {
923                     blogsEntry = list.get(0);
924 
925                     cacheResult(blogsEntry);
926 
927                     if ((blogsEntry.getUuid() == null) ||
928                             !blogsEntry.getUuid().equals(uuid) ||
929                             (blogsEntry.getGroupId() != groupId)) {
930                         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
931                             finderArgs, blogsEntry);
932                     }
933                 }
934 
935                 return blogsEntry;
936             }
937             catch (Exception e) {
938                 throw processException(e);
939             }
940             finally {
941                 if (result == null) {
942                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
943                         finderArgs, new ArrayList<BlogsEntry>());
944                 }
945 
946                 closeSession(session);
947             }
948         }
949         else {
950             if (result instanceof List<?>) {
951                 return null;
952             }
953             else {
954                 return (BlogsEntry)result;
955             }
956         }
957     }
958 
959     public List<BlogsEntry> findByGroupId(long groupId)
960         throws SystemException {
961         Object[] finderArgs = new Object[] { new Long(groupId) };
962 
963         List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
964                 finderArgs, this);
965 
966         if (list == null) {
967             Session session = null;
968 
969             try {
970                 session = openSession();
971 
972                 StringBundler query = new StringBundler(3);
973 
974                 query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
975 
976                 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
977 
978                 query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
979 
980                 String sql = query.toString();
981 
982                 Query q = session.createQuery(sql);
983 
984                 QueryPos qPos = QueryPos.getInstance(q);
985 
986                 qPos.add(groupId);
987 
988                 list = q.list();
989             }
990             catch (Exception e) {
991                 throw processException(e);
992             }
993             finally {
994                 if (list == null) {
995                     list = new ArrayList<BlogsEntry>();
996                 }
997 
998                 cacheResult(list);
999 
1000                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
1001                    finderArgs, list);
1002
1003                closeSession(session);
1004            }
1005        }
1006
1007        return list;
1008    }
1009
1010    public List<BlogsEntry> findByGroupId(long groupId, int start, int end)
1011        throws SystemException {
1012        return findByGroupId(groupId, start, end, null);
1013    }
1014
1015    public List<BlogsEntry> findByGroupId(long groupId, int start, int end,
1016        OrderByComparator obc) throws SystemException {
1017        Object[] finderArgs = new Object[] {
1018                new Long(groupId),
1019                
1020                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1021            };
1022
1023        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_GROUPID,
1024                finderArgs, this);
1025
1026        if (list == null) {
1027            Session session = null;
1028
1029            try {
1030                session = openSession();
1031
1032                StringBundler query = null;
1033
1034                if (obc != null) {
1035                    query = new StringBundler(3 +
1036                            (obc.getOrderByFields().length * 3));
1037                }
1038                else {
1039                    query = new StringBundler(3);
1040                }
1041
1042                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1043
1044                query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1045
1046                if (obc != null) {
1047                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1048                }
1049
1050                else {
1051                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1052                }
1053
1054                String sql = query.toString();
1055
1056                Query q = session.createQuery(sql);
1057
1058                QueryPos qPos = QueryPos.getInstance(q);
1059
1060                qPos.add(groupId);
1061
1062                list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
1063                        end);
1064            }
1065            catch (Exception e) {
1066                throw processException(e);
1067            }
1068            finally {
1069                if (list == null) {
1070                    list = new ArrayList<BlogsEntry>();
1071                }
1072
1073                cacheResult(list);
1074
1075                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_GROUPID,
1076                    finderArgs, list);
1077
1078                closeSession(session);
1079            }
1080        }
1081
1082        return list;
1083    }
1084
1085    public BlogsEntry findByGroupId_First(long groupId, OrderByComparator obc)
1086        throws NoSuchEntryException, SystemException {
1087        List<BlogsEntry> list = findByGroupId(groupId, 0, 1, obc);
1088
1089        if (list.isEmpty()) {
1090            StringBundler msg = new StringBundler(4);
1091
1092            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1093
1094            msg.append("groupId=");
1095            msg.append(groupId);
1096
1097            msg.append(StringPool.CLOSE_CURLY_BRACE);
1098
1099            throw new NoSuchEntryException(msg.toString());
1100        }
1101        else {
1102            return list.get(0);
1103        }
1104    }
1105
1106    public BlogsEntry findByGroupId_Last(long groupId, OrderByComparator obc)
1107        throws NoSuchEntryException, SystemException {
1108        int count = countByGroupId(groupId);
1109
1110        List<BlogsEntry> list = findByGroupId(groupId, count - 1, count, obc);
1111
1112        if (list.isEmpty()) {
1113            StringBundler msg = new StringBundler(4);
1114
1115            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1116
1117            msg.append("groupId=");
1118            msg.append(groupId);
1119
1120            msg.append(StringPool.CLOSE_CURLY_BRACE);
1121
1122            throw new NoSuchEntryException(msg.toString());
1123        }
1124        else {
1125            return list.get(0);
1126        }
1127    }
1128
1129    public BlogsEntry[] findByGroupId_PrevAndNext(long entryId, long groupId,
1130        OrderByComparator obc) throws NoSuchEntryException, SystemException {
1131        BlogsEntry blogsEntry = findByPrimaryKey(entryId);
1132
1133        int count = countByGroupId(groupId);
1134
1135        Session session = null;
1136
1137        try {
1138            session = openSession();
1139
1140            StringBundler query = null;
1141
1142            if (obc != null) {
1143                query = new StringBundler(3 +
1144                        (obc.getOrderByFields().length * 3));
1145            }
1146            else {
1147                query = new StringBundler(3);
1148            }
1149
1150            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1151
1152            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1153
1154            if (obc != null) {
1155                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1156            }
1157
1158            else {
1159                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1160            }
1161
1162            String sql = query.toString();
1163
1164            Query q = session.createQuery(sql);
1165
1166            QueryPos qPos = QueryPos.getInstance(q);
1167
1168            qPos.add(groupId);
1169
1170            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1171                    blogsEntry);
1172
1173            BlogsEntry[] array = new BlogsEntryImpl[3];
1174
1175            array[0] = (BlogsEntry)objArray[0];
1176            array[1] = (BlogsEntry)objArray[1];
1177            array[2] = (BlogsEntry)objArray[2];
1178
1179            return array;
1180        }
1181        catch (Exception e) {
1182            throw processException(e);
1183        }
1184        finally {
1185            closeSession(session);
1186        }
1187    }
1188
1189    public List<BlogsEntry> findByCompanyId(long companyId)
1190        throws SystemException {
1191        Object[] finderArgs = new Object[] { new Long(companyId) };
1192
1193        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
1194                finderArgs, this);
1195
1196        if (list == null) {
1197            Session session = null;
1198
1199            try {
1200                session = openSession();
1201
1202                StringBundler query = new StringBundler(3);
1203
1204                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1205
1206                query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1207
1208                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1209
1210                String sql = query.toString();
1211
1212                Query q = session.createQuery(sql);
1213
1214                QueryPos qPos = QueryPos.getInstance(q);
1215
1216                qPos.add(companyId);
1217
1218                list = q.list();
1219            }
1220            catch (Exception e) {
1221                throw processException(e);
1222            }
1223            finally {
1224                if (list == null) {
1225                    list = new ArrayList<BlogsEntry>();
1226                }
1227
1228                cacheResult(list);
1229
1230                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
1231                    finderArgs, list);
1232
1233                closeSession(session);
1234            }
1235        }
1236
1237        return list;
1238    }
1239
1240    public List<BlogsEntry> findByCompanyId(long companyId, int start, int end)
1241        throws SystemException {
1242        return findByCompanyId(companyId, start, end, null);
1243    }
1244
1245    public List<BlogsEntry> findByCompanyId(long companyId, int start, int end,
1246        OrderByComparator obc) throws SystemException {
1247        Object[] finderArgs = new Object[] {
1248                new Long(companyId),
1249                
1250                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1251            };
1252
1253        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_COMPANYID,
1254                finderArgs, this);
1255
1256        if (list == null) {
1257            Session session = null;
1258
1259            try {
1260                session = openSession();
1261
1262                StringBundler query = null;
1263
1264                if (obc != null) {
1265                    query = new StringBundler(3 +
1266                            (obc.getOrderByFields().length * 3));
1267                }
1268                else {
1269                    query = new StringBundler(3);
1270                }
1271
1272                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1273
1274                query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1275
1276                if (obc != null) {
1277                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1278                }
1279
1280                else {
1281                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1282                }
1283
1284                String sql = query.toString();
1285
1286                Query q = session.createQuery(sql);
1287
1288                QueryPos qPos = QueryPos.getInstance(q);
1289
1290                qPos.add(companyId);
1291
1292                list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
1293                        end);
1294            }
1295            catch (Exception e) {
1296                throw processException(e);
1297            }
1298            finally {
1299                if (list == null) {
1300                    list = new ArrayList<BlogsEntry>();
1301                }
1302
1303                cacheResult(list);
1304
1305                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_COMPANYID,
1306                    finderArgs, list);
1307
1308                closeSession(session);
1309            }
1310        }
1311
1312        return list;
1313    }
1314
1315    public BlogsEntry findByCompanyId_First(long companyId,
1316        OrderByComparator obc) throws NoSuchEntryException, SystemException {
1317        List<BlogsEntry> list = findByCompanyId(companyId, 0, 1, obc);
1318
1319        if (list.isEmpty()) {
1320            StringBundler msg = new StringBundler(4);
1321
1322            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1323
1324            msg.append("companyId=");
1325            msg.append(companyId);
1326
1327            msg.append(StringPool.CLOSE_CURLY_BRACE);
1328
1329            throw new NoSuchEntryException(msg.toString());
1330        }
1331        else {
1332            return list.get(0);
1333        }
1334    }
1335
1336    public BlogsEntry findByCompanyId_Last(long companyId, OrderByComparator obc)
1337        throws NoSuchEntryException, SystemException {
1338        int count = countByCompanyId(companyId);
1339
1340        List<BlogsEntry> list = findByCompanyId(companyId, count - 1, count, obc);
1341
1342        if (list.isEmpty()) {
1343            StringBundler msg = new StringBundler(4);
1344
1345            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1346
1347            msg.append("companyId=");
1348            msg.append(companyId);
1349
1350            msg.append(StringPool.CLOSE_CURLY_BRACE);
1351
1352            throw new NoSuchEntryException(msg.toString());
1353        }
1354        else {
1355            return list.get(0);
1356        }
1357    }
1358
1359    public BlogsEntry[] findByCompanyId_PrevAndNext(long entryId,
1360        long companyId, OrderByComparator obc)
1361        throws NoSuchEntryException, SystemException {
1362        BlogsEntry blogsEntry = findByPrimaryKey(entryId);
1363
1364        int count = countByCompanyId(companyId);
1365
1366        Session session = null;
1367
1368        try {
1369            session = openSession();
1370
1371            StringBundler query = null;
1372
1373            if (obc != null) {
1374                query = new StringBundler(3 +
1375                        (obc.getOrderByFields().length * 3));
1376            }
1377            else {
1378                query = new StringBundler(3);
1379            }
1380
1381            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1382
1383            query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1384
1385            if (obc != null) {
1386                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1387            }
1388
1389            else {
1390                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1391            }
1392
1393            String sql = query.toString();
1394
1395            Query q = session.createQuery(sql);
1396
1397            QueryPos qPos = QueryPos.getInstance(q);
1398
1399            qPos.add(companyId);
1400
1401            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1402                    blogsEntry);
1403
1404            BlogsEntry[] array = new BlogsEntryImpl[3];
1405
1406            array[0] = (BlogsEntry)objArray[0];
1407            array[1] = (BlogsEntry)objArray[1];
1408            array[2] = (BlogsEntry)objArray[2];
1409
1410            return array;
1411        }
1412        catch (Exception e) {
1413            throw processException(e);
1414        }
1415        finally {
1416            closeSession(session);
1417        }
1418    }
1419
1420    public List<BlogsEntry> findByG_U(long groupId, long userId)
1421        throws SystemException {
1422        Object[] finderArgs = new Object[] { new Long(groupId), new Long(userId) };
1423
1424        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_U,
1425                finderArgs, this);
1426
1427        if (list == null) {
1428            Session session = null;
1429
1430            try {
1431                session = openSession();
1432
1433                StringBundler query = new StringBundler(4);
1434
1435                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1436
1437                query.append(_FINDER_COLUMN_G_U_GROUPID_2);
1438
1439                query.append(_FINDER_COLUMN_G_U_USERID_2);
1440
1441                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1442
1443                String sql = query.toString();
1444
1445                Query q = session.createQuery(sql);
1446
1447                QueryPos qPos = QueryPos.getInstance(q);
1448
1449                qPos.add(groupId);
1450
1451                qPos.add(userId);
1452
1453                list = q.list();
1454            }
1455            catch (Exception e) {
1456                throw processException(e);
1457            }
1458            finally {
1459                if (list == null) {
1460                    list = new ArrayList<BlogsEntry>();
1461                }
1462
1463                cacheResult(list);
1464
1465                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_U, finderArgs,
1466                    list);
1467
1468                closeSession(session);
1469            }
1470        }
1471
1472        return list;
1473    }
1474
1475    public List<BlogsEntry> findByG_U(long groupId, long userId, int start,
1476        int end) throws SystemException {
1477        return findByG_U(groupId, userId, start, end, null);
1478    }
1479
1480    public List<BlogsEntry> findByG_U(long groupId, long userId, int start,
1481        int end, OrderByComparator obc) throws SystemException {
1482        Object[] finderArgs = new Object[] {
1483                new Long(groupId), new Long(userId),
1484                
1485                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1486            };
1487
1488        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_G_U,
1489                finderArgs, this);
1490
1491        if (list == null) {
1492            Session session = null;
1493
1494            try {
1495                session = openSession();
1496
1497                StringBundler query = null;
1498
1499                if (obc != null) {
1500                    query = new StringBundler(4 +
1501                            (obc.getOrderByFields().length * 3));
1502                }
1503                else {
1504                    query = new StringBundler(4);
1505                }
1506
1507                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1508
1509                query.append(_FINDER_COLUMN_G_U_GROUPID_2);
1510
1511                query.append(_FINDER_COLUMN_G_U_USERID_2);
1512
1513                if (obc != null) {
1514                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1515                }
1516
1517                else {
1518                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1519                }
1520
1521                String sql = query.toString();
1522
1523                Query q = session.createQuery(sql);
1524
1525                QueryPos qPos = QueryPos.getInstance(q);
1526
1527                qPos.add(groupId);
1528
1529                qPos.add(userId);
1530
1531                list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
1532                        end);
1533            }
1534            catch (Exception e) {
1535                throw processException(e);
1536            }
1537            finally {
1538                if (list == null) {
1539                    list = new ArrayList<BlogsEntry>();
1540                }
1541
1542                cacheResult(list);
1543
1544                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_G_U,
1545                    finderArgs, list);
1546
1547                closeSession(session);
1548            }
1549        }
1550
1551        return list;
1552    }
1553
1554    public BlogsEntry findByG_U_First(long groupId, long userId,
1555        OrderByComparator obc) throws NoSuchEntryException, SystemException {
1556        List<BlogsEntry> list = findByG_U(groupId, userId, 0, 1, obc);
1557
1558        if (list.isEmpty()) {
1559            StringBundler msg = new StringBundler(6);
1560
1561            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1562
1563            msg.append("groupId=");
1564            msg.append(groupId);
1565
1566            msg.append(", userId=");
1567            msg.append(userId);
1568
1569            msg.append(StringPool.CLOSE_CURLY_BRACE);
1570
1571            throw new NoSuchEntryException(msg.toString());
1572        }
1573        else {
1574            return list.get(0);
1575        }
1576    }
1577
1578    public BlogsEntry findByG_U_Last(long groupId, long userId,
1579        OrderByComparator obc) throws NoSuchEntryException, SystemException {
1580        int count = countByG_U(groupId, userId);
1581
1582        List<BlogsEntry> list = findByG_U(groupId, userId, count - 1, count, obc);
1583
1584        if (list.isEmpty()) {
1585            StringBundler msg = new StringBundler(6);
1586
1587            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1588
1589            msg.append("groupId=");
1590            msg.append(groupId);
1591
1592            msg.append(", userId=");
1593            msg.append(userId);
1594
1595            msg.append(StringPool.CLOSE_CURLY_BRACE);
1596
1597            throw new NoSuchEntryException(msg.toString());
1598        }
1599        else {
1600            return list.get(0);
1601        }
1602    }
1603
1604    public BlogsEntry[] findByG_U_PrevAndNext(long entryId, long groupId,
1605        long userId, OrderByComparator obc)
1606        throws NoSuchEntryException, SystemException {
1607        BlogsEntry blogsEntry = findByPrimaryKey(entryId);
1608
1609        int count = countByG_U(groupId, userId);
1610
1611        Session session = null;
1612
1613        try {
1614            session = openSession();
1615
1616            StringBundler query = null;
1617
1618            if (obc != null) {
1619                query = new StringBundler(4 +
1620                        (obc.getOrderByFields().length * 3));
1621            }
1622            else {
1623                query = new StringBundler(4);
1624            }
1625
1626            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1627
1628            query.append(_FINDER_COLUMN_G_U_GROUPID_2);
1629
1630            query.append(_FINDER_COLUMN_G_U_USERID_2);
1631
1632            if (obc != null) {
1633                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1634            }
1635
1636            else {
1637                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1638            }
1639
1640            String sql = query.toString();
1641
1642            Query q = session.createQuery(sql);
1643
1644            QueryPos qPos = QueryPos.getInstance(q);
1645
1646            qPos.add(groupId);
1647
1648            qPos.add(userId);
1649
1650            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1651                    blogsEntry);
1652
1653            BlogsEntry[] array = new BlogsEntryImpl[3];
1654
1655            array[0] = (BlogsEntry)objArray[0];
1656            array[1] = (BlogsEntry)objArray[1];
1657            array[2] = (BlogsEntry)objArray[2];
1658
1659            return array;
1660        }
1661        catch (Exception e) {
1662            throw processException(e);
1663        }
1664        finally {
1665            closeSession(session);
1666        }
1667    }
1668
1669    public BlogsEntry findByG_UT(long groupId, String urlTitle)
1670        throws NoSuchEntryException, SystemException {
1671        BlogsEntry blogsEntry = fetchByG_UT(groupId, urlTitle);
1672
1673        if (blogsEntry == null) {
1674            StringBundler msg = new StringBundler(6);
1675
1676            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1677
1678            msg.append("groupId=");
1679            msg.append(groupId);
1680
1681            msg.append(", urlTitle=");
1682            msg.append(urlTitle);
1683
1684            msg.append(StringPool.CLOSE_CURLY_BRACE);
1685
1686            if (_log.isWarnEnabled()) {
1687                _log.warn(msg.toString());
1688            }
1689
1690            throw new NoSuchEntryException(msg.toString());
1691        }
1692
1693        return blogsEntry;
1694    }
1695
1696    public BlogsEntry fetchByG_UT(long groupId, String urlTitle)
1697        throws SystemException {
1698        return fetchByG_UT(groupId, urlTitle, true);
1699    }
1700
1701    public BlogsEntry fetchByG_UT(long groupId, String urlTitle,
1702        boolean retrieveFromCache) throws SystemException {
1703        Object[] finderArgs = new Object[] { new Long(groupId), urlTitle };
1704
1705        Object result = null;
1706
1707        if (retrieveFromCache) {
1708            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_UT,
1709                    finderArgs, this);
1710        }
1711
1712        if (result == null) {
1713            Session session = null;
1714
1715            try {
1716                session = openSession();
1717
1718                StringBundler query = new StringBundler(4);
1719
1720                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1721
1722                query.append(_FINDER_COLUMN_G_UT_GROUPID_2);
1723
1724                if (urlTitle == null) {
1725                    query.append(_FINDER_COLUMN_G_UT_URLTITLE_1);
1726                }
1727                else {
1728                    if (urlTitle.equals(StringPool.BLANK)) {
1729                        query.append(_FINDER_COLUMN_G_UT_URLTITLE_3);
1730                    }
1731                    else {
1732                        query.append(_FINDER_COLUMN_G_UT_URLTITLE_2);
1733                    }
1734                }
1735
1736                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1737
1738                String sql = query.toString();
1739
1740                Query q = session.createQuery(sql);
1741
1742                QueryPos qPos = QueryPos.getInstance(q);
1743
1744                qPos.add(groupId);
1745
1746                if (urlTitle != null) {
1747                    qPos.add(urlTitle);
1748                }
1749
1750                List<BlogsEntry> list = q.list();
1751
1752                result = list;
1753
1754                BlogsEntry blogsEntry = null;
1755
1756                if (list.isEmpty()) {
1757                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_UT,
1758                        finderArgs, list);
1759                }
1760                else {
1761                    blogsEntry = list.get(0);
1762
1763                    cacheResult(blogsEntry);
1764
1765                    if ((blogsEntry.getGroupId() != groupId) ||
1766                            (blogsEntry.getUrlTitle() == null) ||
1767                            !blogsEntry.getUrlTitle().equals(urlTitle)) {
1768                        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_UT,
1769                            finderArgs, blogsEntry);
1770                    }
1771                }
1772
1773                return blogsEntry;
1774            }
1775            catch (Exception e) {
1776                throw processException(e);
1777            }
1778            finally {
1779                if (result == null) {
1780                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_UT,
1781                        finderArgs, new ArrayList<BlogsEntry>());
1782                }
1783
1784                closeSession(session);
1785            }
1786        }
1787        else {
1788            if (result instanceof List<?>) {
1789                return null;
1790            }
1791            else {
1792                return (BlogsEntry)result;
1793            }
1794        }
1795    }
1796
1797    public List<BlogsEntry> findByG_D_D(long groupId, Date displayDate,
1798        boolean draft) throws SystemException {
1799        Object[] finderArgs = new Object[] {
1800                new Long(groupId),
1801                
1802                displayDate, Boolean.valueOf(draft)
1803            };
1804
1805        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_D_D,
1806                finderArgs, this);
1807
1808        if (list == null) {
1809            Session session = null;
1810
1811            try {
1812                session = openSession();
1813
1814                StringBundler query = new StringBundler(5);
1815
1816                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1817
1818                query.append(_FINDER_COLUMN_G_D_D_GROUPID_2);
1819
1820                if (displayDate == null) {
1821                    query.append(_FINDER_COLUMN_G_D_D_DISPLAYDATE_1);
1822                }
1823                else {
1824                    query.append(_FINDER_COLUMN_G_D_D_DISPLAYDATE_2);
1825                }
1826
1827                query.append(_FINDER_COLUMN_G_D_D_DRAFT_2);
1828
1829                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1830
1831                String sql = query.toString();
1832
1833                Query q = session.createQuery(sql);
1834
1835                QueryPos qPos = QueryPos.getInstance(q);
1836
1837                qPos.add(groupId);
1838
1839                if (displayDate != null) {
1840                    qPos.add(CalendarUtil.getTimestamp(displayDate));
1841                }
1842
1843                qPos.add(draft);
1844
1845                list = q.list();
1846            }
1847            catch (Exception e) {
1848                throw processException(e);
1849            }
1850            finally {
1851                if (list == null) {
1852                    list = new ArrayList<BlogsEntry>();
1853                }
1854
1855                cacheResult(list);
1856
1857                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_D_D,
1858                    finderArgs, list);
1859
1860                closeSession(session);
1861            }
1862        }
1863
1864        return list;
1865    }
1866
1867    public List<BlogsEntry> findByG_D_D(long groupId, Date displayDate,
1868        boolean draft, int start, int end) throws SystemException {
1869        return findByG_D_D(groupId, displayDate, draft, start, end, null);
1870    }
1871
1872    public List<BlogsEntry> findByG_D_D(long groupId, Date displayDate,
1873        boolean draft, int start, int end, OrderByComparator obc)
1874        throws SystemException {
1875        Object[] finderArgs = new Object[] {
1876                new Long(groupId),
1877                
1878                displayDate, Boolean.valueOf(draft),
1879                
1880                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1881            };
1882
1883        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_G_D_D,
1884                finderArgs, this);
1885
1886        if (list == null) {
1887            Session session = null;
1888
1889            try {
1890                session = openSession();
1891
1892                StringBundler query = null;
1893
1894                if (obc != null) {
1895                    query = new StringBundler(5 +
1896                            (obc.getOrderByFields().length * 3));
1897                }
1898                else {
1899                    query = new StringBundler(5);
1900                }
1901
1902                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
1903
1904                query.append(_FINDER_COLUMN_G_D_D_GROUPID_2);
1905
1906                if (displayDate == null) {
1907                    query.append(_FINDER_COLUMN_G_D_D_DISPLAYDATE_1);
1908                }
1909                else {
1910                    query.append(_FINDER_COLUMN_G_D_D_DISPLAYDATE_2);
1911                }
1912
1913                query.append(_FINDER_COLUMN_G_D_D_DRAFT_2);
1914
1915                if (obc != null) {
1916                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1917                }
1918
1919                else {
1920                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
1921                }
1922
1923                String sql = query.toString();
1924
1925                Query q = session.createQuery(sql);
1926
1927                QueryPos qPos = QueryPos.getInstance(q);
1928
1929                qPos.add(groupId);
1930
1931                if (displayDate != null) {
1932                    qPos.add(CalendarUtil.getTimestamp(displayDate));
1933                }
1934
1935                qPos.add(draft);
1936
1937                list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
1938                        end);
1939            }
1940            catch (Exception e) {
1941                throw processException(e);
1942            }
1943            finally {
1944                if (list == null) {
1945                    list = new ArrayList<BlogsEntry>();
1946                }
1947
1948                cacheResult(list);
1949
1950                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_G_D_D,
1951                    finderArgs, list);
1952
1953                closeSession(session);
1954            }
1955        }
1956
1957        return list;
1958    }
1959
1960    public BlogsEntry findByG_D_D_First(long groupId, Date displayDate,
1961        boolean draft, OrderByComparator obc)
1962        throws NoSuchEntryException, SystemException {
1963        List<BlogsEntry> list = findByG_D_D(groupId, displayDate, draft, 0, 1,
1964                obc);
1965
1966        if (list.isEmpty()) {
1967            StringBundler msg = new StringBundler(8);
1968
1969            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1970
1971            msg.append("groupId=");
1972            msg.append(groupId);
1973
1974            msg.append(", displayDate=");
1975            msg.append(displayDate);
1976
1977            msg.append(", draft=");
1978            msg.append(draft);
1979
1980            msg.append(StringPool.CLOSE_CURLY_BRACE);
1981
1982            throw new NoSuchEntryException(msg.toString());
1983        }
1984        else {
1985            return list.get(0);
1986        }
1987    }
1988
1989    public BlogsEntry findByG_D_D_Last(long groupId, Date displayDate,
1990        boolean draft, OrderByComparator obc)
1991        throws NoSuchEntryException, SystemException {
1992        int count = countByG_D_D(groupId, displayDate, draft);
1993
1994        List<BlogsEntry> list = findByG_D_D(groupId, displayDate, draft,
1995                count - 1, count, obc);
1996
1997        if (list.isEmpty()) {
1998            StringBundler msg = new StringBundler(8);
1999
2000            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2001
2002            msg.append("groupId=");
2003            msg.append(groupId);
2004
2005            msg.append(", displayDate=");
2006            msg.append(displayDate);
2007
2008            msg.append(", draft=");
2009            msg.append(draft);
2010
2011            msg.append(StringPool.CLOSE_CURLY_BRACE);
2012
2013            throw new NoSuchEntryException(msg.toString());
2014        }
2015        else {
2016            return list.get(0);
2017        }
2018    }
2019
2020    public BlogsEntry[] findByG_D_D_PrevAndNext(long entryId, long groupId,
2021        Date displayDate, boolean draft, OrderByComparator obc)
2022        throws NoSuchEntryException, SystemException {
2023        BlogsEntry blogsEntry = findByPrimaryKey(entryId);
2024
2025        int count = countByG_D_D(groupId, displayDate, draft);
2026
2027        Session session = null;
2028
2029        try {
2030            session = openSession();
2031
2032            StringBundler query = null;
2033
2034            if (obc != null) {
2035                query = new StringBundler(5 +
2036                        (obc.getOrderByFields().length * 3));
2037            }
2038            else {
2039                query = new StringBundler(5);
2040            }
2041
2042            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2043
2044            query.append(_FINDER_COLUMN_G_D_D_GROUPID_2);
2045
2046            if (displayDate == null) {
2047                query.append(_FINDER_COLUMN_G_D_D_DISPLAYDATE_1);
2048            }
2049            else {
2050                query.append(_FINDER_COLUMN_G_D_D_DISPLAYDATE_2);
2051            }
2052
2053            query.append(_FINDER_COLUMN_G_D_D_DRAFT_2);
2054
2055            if (obc != null) {
2056                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
2057            }
2058
2059            else {
2060                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2061            }
2062
2063            String sql = query.toString();
2064
2065            Query q = session.createQuery(sql);
2066
2067            QueryPos qPos = QueryPos.getInstance(q);
2068
2069            qPos.add(groupId);
2070
2071            if (displayDate != null) {
2072                qPos.add(CalendarUtil.getTimestamp(displayDate));
2073            }
2074
2075            qPos.add(draft);
2076
2077            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
2078                    blogsEntry);
2079
2080            BlogsEntry[] array = new BlogsEntryImpl[3];
2081
2082            array[0] = (BlogsEntry)objArray[0];
2083            array[1] = (BlogsEntry)objArray[1];
2084            array[2] = (BlogsEntry)objArray[2];
2085
2086            return array;
2087        }
2088        catch (Exception e) {
2089            throw processException(e);
2090        }
2091        finally {
2092            closeSession(session);
2093        }
2094    }
2095
2096    public List<BlogsEntry> findByC_D_D(long companyId, Date displayDate,
2097        boolean draft) throws SystemException {
2098        Object[] finderArgs = new Object[] {
2099                new Long(companyId),
2100                
2101                displayDate, Boolean.valueOf(draft)
2102            };
2103
2104        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_D_D,
2105                finderArgs, this);
2106
2107        if (list == null) {
2108            Session session = null;
2109
2110            try {
2111                session = openSession();
2112
2113                StringBundler query = new StringBundler(5);
2114
2115                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2116
2117                query.append(_FINDER_COLUMN_C_D_D_COMPANYID_2);
2118
2119                if (displayDate == null) {
2120                    query.append(_FINDER_COLUMN_C_D_D_DISPLAYDATE_1);
2121                }
2122                else {
2123                    query.append(_FINDER_COLUMN_C_D_D_DISPLAYDATE_2);
2124                }
2125
2126                query.append(_FINDER_COLUMN_C_D_D_DRAFT_2);
2127
2128                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2129
2130                String sql = query.toString();
2131
2132                Query q = session.createQuery(sql);
2133
2134                QueryPos qPos = QueryPos.getInstance(q);
2135
2136                qPos.add(companyId);
2137
2138                if (displayDate != null) {
2139                    qPos.add(CalendarUtil.getTimestamp(displayDate));
2140                }
2141
2142                qPos.add(draft);
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_D_D,
2157                    finderArgs, list);
2158
2159                closeSession(session);
2160            }
2161        }
2162
2163        return list;
2164    }
2165
2166    public List<BlogsEntry> findByC_D_D(long companyId, Date displayDate,
2167        boolean draft, int start, int end) throws SystemException {
2168        return findByC_D_D(companyId, displayDate, draft, start, end, null);
2169    }
2170
2171    public List<BlogsEntry> findByC_D_D(long companyId, Date displayDate,
2172        boolean draft, int start, int end, OrderByComparator obc)
2173        throws SystemException {
2174        Object[] finderArgs = new Object[] {
2175                new Long(companyId),
2176                
2177                displayDate, Boolean.valueOf(draft),
2178                
2179                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
2180            };
2181
2182        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_C_D_D,
2183                finderArgs, this);
2184
2185        if (list == null) {
2186            Session session = null;
2187
2188            try {
2189                session = openSession();
2190
2191                StringBundler query = null;
2192
2193                if (obc != null) {
2194                    query = new StringBundler(5 +
2195                            (obc.getOrderByFields().length * 3));
2196                }
2197                else {
2198                    query = new StringBundler(5);
2199                }
2200
2201                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2202
2203                query.append(_FINDER_COLUMN_C_D_D_COMPANYID_2);
2204
2205                if (displayDate == null) {
2206                    query.append(_FINDER_COLUMN_C_D_D_DISPLAYDATE_1);
2207                }
2208                else {
2209                    query.append(_FINDER_COLUMN_C_D_D_DISPLAYDATE_2);
2210                }
2211
2212                query.append(_FINDER_COLUMN_C_D_D_DRAFT_2);
2213
2214                if (obc != null) {
2215                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
2216                }
2217
2218                else {
2219                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2220                }
2221
2222                String sql = query.toString();
2223
2224                Query q = session.createQuery(sql);
2225
2226                QueryPos qPos = QueryPos.getInstance(q);
2227
2228                qPos.add(companyId);
2229
2230                if (displayDate != null) {
2231                    qPos.add(CalendarUtil.getTimestamp(displayDate));
2232                }
2233
2234                qPos.add(draft);
2235
2236                list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
2237                        end);
2238            }
2239            catch (Exception e) {
2240                throw processException(e);
2241            }
2242            finally {
2243                if (list == null) {
2244                    list = new ArrayList<BlogsEntry>();
2245                }
2246
2247                cacheResult(list);
2248
2249                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_C_D_D,
2250                    finderArgs, list);
2251
2252                closeSession(session);
2253            }
2254        }
2255
2256        return list;
2257    }
2258
2259    public BlogsEntry findByC_D_D_First(long companyId, Date displayDate,
2260        boolean draft, OrderByComparator obc)
2261        throws NoSuchEntryException, SystemException {
2262        List<BlogsEntry> list = findByC_D_D(companyId, displayDate, draft, 0,
2263                1, obc);
2264
2265        if (list.isEmpty()) {
2266            StringBundler msg = new StringBundler(8);
2267
2268            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2269
2270            msg.append("companyId=");
2271            msg.append(companyId);
2272
2273            msg.append(", displayDate=");
2274            msg.append(displayDate);
2275
2276            msg.append(", draft=");
2277            msg.append(draft);
2278
2279            msg.append(StringPool.CLOSE_CURLY_BRACE);
2280
2281            throw new NoSuchEntryException(msg.toString());
2282        }
2283        else {
2284            return list.get(0);
2285        }
2286    }
2287
2288    public BlogsEntry findByC_D_D_Last(long companyId, Date displayDate,
2289        boolean draft, OrderByComparator obc)
2290        throws NoSuchEntryException, SystemException {
2291        int count = countByC_D_D(companyId, displayDate, draft);
2292
2293        List<BlogsEntry> list = findByC_D_D(companyId, displayDate, draft,
2294                count - 1, count, obc);
2295
2296        if (list.isEmpty()) {
2297            StringBundler msg = new StringBundler(8);
2298
2299            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2300
2301            msg.append("companyId=");
2302            msg.append(companyId);
2303
2304            msg.append(", displayDate=");
2305            msg.append(displayDate);
2306
2307            msg.append(", draft=");
2308            msg.append(draft);
2309
2310            msg.append(StringPool.CLOSE_CURLY_BRACE);
2311
2312            throw new NoSuchEntryException(msg.toString());
2313        }
2314        else {
2315            return list.get(0);
2316        }
2317    }
2318
2319    public BlogsEntry[] findByC_D_D_PrevAndNext(long entryId, long companyId,
2320        Date displayDate, boolean draft, OrderByComparator obc)
2321        throws NoSuchEntryException, SystemException {
2322        BlogsEntry blogsEntry = findByPrimaryKey(entryId);
2323
2324        int count = countByC_D_D(companyId, displayDate, draft);
2325
2326        Session session = null;
2327
2328        try {
2329            session = openSession();
2330
2331            StringBundler query = null;
2332
2333            if (obc != null) {
2334                query = new StringBundler(5 +
2335                        (obc.getOrderByFields().length * 3));
2336            }
2337            else {
2338                query = new StringBundler(5);
2339            }
2340
2341            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2342
2343            query.append(_FINDER_COLUMN_C_D_D_COMPANYID_2);
2344
2345            if (displayDate == null) {
2346                query.append(_FINDER_COLUMN_C_D_D_DISPLAYDATE_1);
2347            }
2348            else {
2349                query.append(_FINDER_COLUMN_C_D_D_DISPLAYDATE_2);
2350            }
2351
2352            query.append(_FINDER_COLUMN_C_D_D_DRAFT_2);
2353
2354            if (obc != null) {
2355                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
2356            }
2357
2358            else {
2359                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2360            }
2361
2362            String sql = query.toString();
2363
2364            Query q = session.createQuery(sql);
2365
2366            QueryPos qPos = QueryPos.getInstance(q);
2367
2368            qPos.add(companyId);
2369
2370            if (displayDate != null) {
2371                qPos.add(CalendarUtil.getTimestamp(displayDate));
2372            }
2373
2374            qPos.add(draft);
2375
2376            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
2377                    blogsEntry);
2378
2379            BlogsEntry[] array = new BlogsEntryImpl[3];
2380
2381            array[0] = (BlogsEntry)objArray[0];
2382            array[1] = (BlogsEntry)objArray[1];
2383            array[2] = (BlogsEntry)objArray[2];
2384
2385            return array;
2386        }
2387        catch (Exception e) {
2388            throw processException(e);
2389        }
2390        finally {
2391            closeSession(session);
2392        }
2393    }
2394
2395    public List<BlogsEntry> findByG_U_D_D(long groupId, long userId,
2396        Date displayDate, boolean draft) throws SystemException {
2397        Object[] finderArgs = new Object[] {
2398                new Long(groupId), new Long(userId),
2399                
2400                displayDate, Boolean.valueOf(draft)
2401            };
2402
2403        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_U_D_D,
2404                finderArgs, this);
2405
2406        if (list == null) {
2407            Session session = null;
2408
2409            try {
2410                session = openSession();
2411
2412                StringBundler query = new StringBundler(6);
2413
2414                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2415
2416                query.append(_FINDER_COLUMN_G_U_D_D_GROUPID_2);
2417
2418                query.append(_FINDER_COLUMN_G_U_D_D_USERID_2);
2419
2420                if (displayDate == null) {
2421                    query.append(_FINDER_COLUMN_G_U_D_D_DISPLAYDATE_1);
2422                }
2423                else {
2424                    query.append(_FINDER_COLUMN_G_U_D_D_DISPLAYDATE_2);
2425                }
2426
2427                query.append(_FINDER_COLUMN_G_U_D_D_DRAFT_2);
2428
2429                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2430
2431                String sql = query.toString();
2432
2433                Query q = session.createQuery(sql);
2434
2435                QueryPos qPos = QueryPos.getInstance(q);
2436
2437                qPos.add(groupId);
2438
2439                qPos.add(userId);
2440
2441                if (displayDate != null) {
2442                    qPos.add(CalendarUtil.getTimestamp(displayDate));
2443                }
2444
2445                qPos.add(draft);
2446
2447                list = q.list();
2448            }
2449            catch (Exception e) {
2450                throw processException(e);
2451            }
2452            finally {
2453                if (list == null) {
2454                    list = new ArrayList<BlogsEntry>();
2455                }
2456
2457                cacheResult(list);
2458
2459                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_U_D_D,
2460                    finderArgs, list);
2461
2462                closeSession(session);
2463            }
2464        }
2465
2466        return list;
2467    }
2468
2469    public List<BlogsEntry> findByG_U_D_D(long groupId, long userId,
2470        Date displayDate, boolean draft, int start, int end)
2471        throws SystemException {
2472        return findByG_U_D_D(groupId, userId, displayDate, draft, start, end,
2473            null);
2474    }
2475
2476    public List<BlogsEntry> findByG_U_D_D(long groupId, long userId,
2477        Date displayDate, boolean draft, int start, int end,
2478        OrderByComparator obc) throws SystemException {
2479        Object[] finderArgs = new Object[] {
2480                new Long(groupId), new Long(userId),
2481                
2482                displayDate, Boolean.valueOf(draft),
2483                
2484                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
2485            };
2486
2487        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_G_U_D_D,
2488                finderArgs, this);
2489
2490        if (list == null) {
2491            Session session = null;
2492
2493            try {
2494                session = openSession();
2495
2496                StringBundler query = null;
2497
2498                if (obc != null) {
2499                    query = new StringBundler(6 +
2500                            (obc.getOrderByFields().length * 3));
2501                }
2502                else {
2503                    query = new StringBundler(6);
2504                }
2505
2506                query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2507
2508                query.append(_FINDER_COLUMN_G_U_D_D_GROUPID_2);
2509
2510                query.append(_FINDER_COLUMN_G_U_D_D_USERID_2);
2511
2512                if (displayDate == null) {
2513                    query.append(_FINDER_COLUMN_G_U_D_D_DISPLAYDATE_1);
2514                }
2515                else {
2516                    query.append(_FINDER_COLUMN_G_U_D_D_DISPLAYDATE_2);
2517                }
2518
2519                query.append(_FINDER_COLUMN_G_U_D_D_DRAFT_2);
2520
2521                if (obc != null) {
2522                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
2523                }
2524
2525                else {
2526                    query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2527                }
2528
2529                String sql = query.toString();
2530
2531                Query q = session.createQuery(sql);
2532
2533                QueryPos qPos = QueryPos.getInstance(q);
2534
2535                qPos.add(groupId);
2536
2537                qPos.add(userId);
2538
2539                if (displayDate != null) {
2540                    qPos.add(CalendarUtil.getTimestamp(displayDate));
2541                }
2542
2543                qPos.add(draft);
2544
2545                list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(), start,
2546                        end);
2547            }
2548            catch (Exception e) {
2549                throw processException(e);
2550            }
2551            finally {
2552                if (list == null) {
2553                    list = new ArrayList<BlogsEntry>();
2554                }
2555
2556                cacheResult(list);
2557
2558                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_G_U_D_D,
2559                    finderArgs, list);
2560
2561                closeSession(session);
2562            }
2563        }
2564
2565        return list;
2566    }
2567
2568    public BlogsEntry findByG_U_D_D_First(long groupId, long userId,
2569        Date displayDate, boolean draft, OrderByComparator obc)
2570        throws NoSuchEntryException, SystemException {
2571        List<BlogsEntry> list = findByG_U_D_D(groupId, userId, displayDate,
2572                draft, 0, 1, obc);
2573
2574        if (list.isEmpty()) {
2575            StringBundler msg = new StringBundler(10);
2576
2577            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2578
2579            msg.append("groupId=");
2580            msg.append(groupId);
2581
2582            msg.append(", userId=");
2583            msg.append(userId);
2584
2585            msg.append(", displayDate=");
2586            msg.append(displayDate);
2587
2588            msg.append(", draft=");
2589            msg.append(draft);
2590
2591            msg.append(StringPool.CLOSE_CURLY_BRACE);
2592
2593            throw new NoSuchEntryException(msg.toString());
2594        }
2595        else {
2596            return list.get(0);
2597        }
2598    }
2599
2600    public BlogsEntry findByG_U_D_D_Last(long groupId, long userId,
2601        Date displayDate, boolean draft, OrderByComparator obc)
2602        throws NoSuchEntryException, SystemException {
2603        int count = countByG_U_D_D(groupId, userId, displayDate, draft);
2604
2605        List<BlogsEntry> list = findByG_U_D_D(groupId, userId, displayDate,
2606                draft, count - 1, count, obc);
2607
2608        if (list.isEmpty()) {
2609            StringBundler msg = new StringBundler(10);
2610
2611            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2612
2613            msg.append("groupId=");
2614            msg.append(groupId);
2615
2616            msg.append(", userId=");
2617            msg.append(userId);
2618
2619            msg.append(", displayDate=");
2620            msg.append(displayDate);
2621
2622            msg.append(", draft=");
2623            msg.append(draft);
2624
2625            msg.append(StringPool.CLOSE_CURLY_BRACE);
2626
2627            throw new NoSuchEntryException(msg.toString());
2628        }
2629        else {
2630            return list.get(0);
2631        }
2632    }
2633
2634    public BlogsEntry[] findByG_U_D_D_PrevAndNext(long entryId, long groupId,
2635        long userId, Date displayDate, boolean draft, OrderByComparator obc)
2636        throws NoSuchEntryException, SystemException {
2637        BlogsEntry blogsEntry = findByPrimaryKey(entryId);
2638
2639        int count = countByG_U_D_D(groupId, userId, displayDate, draft);
2640
2641        Session session = null;
2642
2643        try {
2644            session = openSession();
2645
2646            StringBundler query = null;
2647
2648            if (obc != null) {
2649                query = new StringBundler(6 +
2650                        (obc.getOrderByFields().length * 3));
2651            }
2652            else {
2653                query = new StringBundler(6);
2654            }
2655
2656            query.append(_SQL_SELECT_BLOGSENTRY_WHERE);
2657
2658            query.append(_FINDER_COLUMN_G_U_D_D_GROUPID_2);
2659
2660            query.append(_FINDER_COLUMN_G_U_D_D_USERID_2);
2661
2662            if (displayDate == null) {
2663                query.append(_FINDER_COLUMN_G_U_D_D_DISPLAYDATE_1);
2664            }
2665            else {
2666                query.append(_FINDER_COLUMN_G_U_D_D_DISPLAYDATE_2);
2667            }
2668
2669            query.append(_FINDER_COLUMN_G_U_D_D_DRAFT_2);
2670
2671            if (obc != null) {
2672                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
2673            }
2674
2675            else {
2676                query.append(BlogsEntryModelImpl.ORDER_BY_JPQL);
2677            }
2678
2679            String sql = query.toString();
2680
2681            Query q = session.createQuery(sql);
2682
2683            QueryPos qPos = QueryPos.getInstance(q);
2684
2685            qPos.add(groupId);
2686
2687            qPos.add(userId);
2688
2689            if (displayDate != null) {
2690                qPos.add(CalendarUtil.getTimestamp(displayDate));
2691            }
2692
2693            qPos.add(draft);
2694
2695            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
2696                    blogsEntry);
2697
2698            BlogsEntry[] array = new BlogsEntryImpl[3];
2699
2700            array[0] = (BlogsEntry)objArray[0];
2701            array[1] = (BlogsEntry)objArray[1];
2702            array[2] = (BlogsEntry)objArray[2];
2703
2704            return array;
2705        }
2706        catch (Exception e) {
2707            throw processException(e);
2708        }
2709        finally {
2710            closeSession(session);
2711        }
2712    }
2713
2714    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
2715        throws SystemException {
2716        Session session = null;
2717
2718        try {
2719            session = openSession();
2720
2721            dynamicQuery.compile(session);
2722
2723            return dynamicQuery.list();
2724        }
2725        catch (Exception e) {
2726            throw processException(e);
2727        }
2728        finally {
2729            closeSession(session);
2730        }
2731    }
2732
2733    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
2734        int start, int end) throws SystemException {
2735        Session session = null;
2736
2737        try {
2738            session = openSession();
2739
2740            dynamicQuery.setLimit(start, end);
2741
2742            dynamicQuery.compile(session);
2743
2744            return dynamicQuery.list();
2745        }
2746        catch (Exception e) {
2747            throw processException(e);
2748        }
2749        finally {
2750            closeSession(session);
2751        }
2752    }
2753
2754    public List<BlogsEntry> findAll() throws SystemException {
2755        return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2756    }
2757
2758    public List<BlogsEntry> findAll(int start, int end)
2759        throws SystemException {
2760        return findAll(start, end, null);
2761    }
2762
2763    public List<BlogsEntry> findAll(int start, int end, OrderByComparator obc)
2764        throws SystemException {
2765        Object[] finderArgs = new Object[] {
2766                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
2767            };
2768
2769        List<BlogsEntry> list = (List<BlogsEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
2770                finderArgs, this);
2771
2772        if (list == null) {
2773            Session session = null;
2774
2775            try {
2776                session = openSession();
2777
2778                StringBundler query = null;
2779                String sql = null;
2780
2781                if (obc != null) {
2782                    query = new StringBundler(2 +
2783                            (obc.getOrderByFields().length * 3));
2784
2785                    query.append(_SQL_SELECT_BLOGSENTRY);
2786
2787                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
2788
2789                    sql = query.toString();
2790                }
2791
2792                else {
2793                    sql = _SQL_SELECT_BLOGSENTRY.concat(BlogsEntryModelImpl.ORDER_BY_JPQL);
2794                }
2795
2796                Query q = session.createQuery(sql);
2797
2798                if (obc == null) {
2799                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(),
2800                            start, end, false);
2801
2802                    Collections.sort(list);
2803                }
2804                else {
2805                    list = (List<BlogsEntry>)QueryUtil.list(q, getDialect(),
2806                            start, end);
2807                }
2808            }
2809            catch (Exception e) {
2810                throw processException(e);
2811            }
2812            finally {
2813                if (list == null) {
2814                    list = new ArrayList<BlogsEntry>();
2815                }
2816
2817                cacheResult(list);
2818
2819                FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
2820
2821                closeSession(session);
2822            }
2823        }
2824
2825        return list;
2826    }
2827
2828    public void removeByUuid(String uuid) throws SystemException {
2829        for (BlogsEntry blogsEntry : findByUuid(uuid)) {
2830            remove(blogsEntry);
2831        }
2832    }
2833
2834    public void removeByUUID_G(String uuid, long groupId)
2835        throws NoSuchEntryException, SystemException {
2836        BlogsEntry blogsEntry = findByUUID_G(uuid, groupId);
2837
2838        remove(blogsEntry);
2839    }
2840
2841    public void removeByGroupId(long groupId) throws SystemException {
2842        for (BlogsEntry blogsEntry : findByGroupId(groupId)) {
2843            remove(blogsEntry);
2844        }
2845    }
2846
2847    public void removeByCompanyId(long companyId) throws SystemException {
2848        for (BlogsEntry blogsEntry : findByCompanyId(companyId)) {
2849            remove(blogsEntry);
2850        }
2851    }
2852
2853    public void removeByG_U(long groupId, long userId)
2854        throws SystemException {
2855        for (BlogsEntry blogsEntry : findByG_U(groupId, userId)) {
2856            remove(blogsEntry);
2857        }
2858    }
2859
2860    public void removeByG_UT(long groupId, String urlTitle)
2861        throws NoSuchEntryException, SystemException {
2862        BlogsEntry blogsEntry = findByG_UT(groupId, urlTitle);
2863
2864        remove(blogsEntry);
2865    }
2866
2867    public void removeByG_D_D(long groupId, Date displayDate, boolean draft)
2868        throws SystemException {
2869        for (BlogsEntry blogsEntry : findByG_D_D(groupId, displayDate, draft)) {
2870            remove(blogsEntry);
2871        }
2872    }
2873
2874    public void removeByC_D_D(long companyId, Date displayDate, boolean draft)
2875        throws SystemException {
2876        for (BlogsEntry blogsEntry : findByC_D_D(companyId, displayDate, draft)) {
2877            remove(blogsEntry);
2878        }
2879    }
2880
2881    public void removeByG_U_D_D(long groupId, long userId, Date displayDate,
2882        boolean draft) throws SystemException {
2883        for (BlogsEntry blogsEntry : findByG_U_D_D(groupId, userId,
2884                displayDate, draft)) {
2885            remove(blogsEntry);
2886        }
2887    }
2888
2889    public void removeAll() throws SystemException {
2890        for (BlogsEntry blogsEntry : findAll()) {
2891            remove(blogsEntry);
2892        }
2893    }
2894
2895    public int countByUuid(String uuid) throws SystemException {
2896        Object[] finderArgs = new Object[] { uuid };
2897
2898        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
2899                finderArgs, this);
2900
2901        if (count == null) {
2902            Session session = null;
2903
2904            try {
2905                session = openSession();
2906
2907                StringBundler query = new StringBundler(2);
2908
2909                query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
2910
2911                if (uuid == null) {
2912                    query.append(_FINDER_COLUMN_UUID_UUID_1);
2913                }
2914                else {
2915                    if (uuid.equals(StringPool.BLANK)) {
2916                        query.append(_FINDER_COLUMN_UUID_UUID_3);
2917                    }
2918                    else {
2919                        query.append(_FINDER_COLUMN_UUID_UUID_2);
2920                    }
2921                }
2922
2923                String sql = query.toString();
2924
2925                Query q = session.createQuery(sql);
2926
2927                QueryPos qPos = QueryPos.getInstance(q);
2928
2929                if (uuid != null) {
2930                    qPos.add(uuid);
2931                }
2932
2933                count = (Long)q.uniqueResult();
2934            }
2935            catch (Exception e) {
2936                throw processException(e);
2937            }
2938            finally {
2939                if (count == null) {
2940                    count = Long.valueOf(0);
2941                }
2942
2943                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
2944                    finderArgs, count);
2945
2946                closeSession(session);
2947            }
2948        }
2949
2950        return count.intValue();
2951    }
2952
2953    public int countByUUID_G(String uuid, long groupId)
2954        throws SystemException {
2955        Object[] finderArgs = new Object[] { uuid, new Long(groupId) };
2956
2957        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
2958                finderArgs, this);
2959
2960        if (count == null) {
2961            Session session = null;
2962
2963            try {
2964                session = openSession();
2965
2966                StringBundler query = new StringBundler(3);
2967
2968                query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
2969
2970                if (uuid == null) {
2971                    query.append(_FINDER_COLUMN_UUID_G_UUID_1);
2972                }
2973                else {
2974                    if (uuid.equals(StringPool.BLANK)) {
2975                        query.append(_FINDER_COLUMN_UUID_G_UUID_3);
2976                    }
2977                    else {
2978                        query.append(_FINDER_COLUMN_UUID_G_UUID_2);
2979                    }
2980                }
2981
2982                query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
2983
2984                String sql = query.toString();
2985
2986                Query q = session.createQuery(sql);
2987
2988                QueryPos qPos = QueryPos.getInstance(q);
2989
2990                if (uuid != null) {
2991                    qPos.add(uuid);
2992                }
2993
2994                qPos.add(groupId);
2995
2996                count = (Long)q.uniqueResult();
2997            }
2998            catch (Exception e) {
2999                throw processException(e);
3000            }
3001            finally {
3002                if (count == null) {
3003                    count = Long.valueOf(0);
3004                }
3005
3006                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
3007                    finderArgs, count);
3008
3009                closeSession(session);
3010            }
3011        }
3012
3013        return count.intValue();
3014    }
3015
3016    public int countByGroupId(long groupId) throws SystemException {
3017        Object[] finderArgs = new Object[] { new Long(groupId) };
3018
3019        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
3020                finderArgs, this);
3021
3022        if (count == null) {
3023            Session session = null;
3024
3025            try {
3026                session = openSession();
3027
3028                StringBundler query = new StringBundler(2);
3029
3030                query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
3031
3032                query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
3033
3034                String sql = query.toString();
3035
3036                Query q = session.createQuery(sql);
3037
3038                QueryPos qPos = QueryPos.getInstance(q);
3039
3040                qPos.add(groupId);
3041
3042                count = (Long)q.uniqueResult();
3043            }
3044            catch (Exception e) {
3045                throw processException(e);
3046            }
3047            finally {
3048                if (count == null) {
3049                    count = Long.valueOf(0);
3050                }
3051
3052                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
3053                    finderArgs, count);
3054
3055                closeSession(session);
3056            }
3057        }
3058
3059        return count.intValue();
3060    }
3061
3062    public int countByCompanyId(long companyId) throws SystemException {
3063        Object[] finderArgs = new Object[] { new Long(companyId) };
3064
3065        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
3066                finderArgs, this);
3067
3068        if (count == null) {
3069            Session session = null;
3070
3071            try {
3072                session = openSession();
3073
3074                StringBundler query = new StringBundler(2);
3075
3076                query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
3077
3078                query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
3079
3080                String sql = query.toString();
3081
3082                Query q = session.createQuery(sql);
3083
3084                QueryPos qPos = QueryPos.getInstance(q);
3085
3086                qPos.add(companyId);
3087
3088                count = (Long)q.uniqueResult();
3089            }
3090            catch (Exception e) {
3091                throw processException(e);
3092            }
3093            finally {
3094                if (count == null) {
3095                    count = Long.valueOf(0);
3096                }
3097
3098                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
3099                    finderArgs, count);
3100
3101                closeSession(session);
3102            }
3103        }
3104
3105        return count.intValue();
3106    }
3107
3108    public int countByG_U(long groupId, long userId) throws SystemException {
3109        Object[] finderArgs = new Object[] { new Long(groupId), new Long(userId) };
3110
3111        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_U,
3112                finderArgs, this);
3113
3114        if (count == null) {
3115            Session session = null;
3116
3117            try {
3118                session = openSession();
3119
3120                StringBundler query = new StringBundler(3);
3121
3122                query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
3123
3124                query.append(_FINDER_COLUMN_G_U_GROUPID_2);
3125
3126                query.append(_FINDER_COLUMN_G_U_USERID_2);
3127
3128                String sql = query.toString();
3129
3130                Query q = session.createQuery(sql);
3131
3132                QueryPos qPos = QueryPos.getInstance(q);
3133
3134                qPos.add(groupId);
3135
3136                qPos.add(userId);
3137
3138                count = (Long)q.uniqueResult();
3139            }
3140            catch (Exception e) {
3141                throw processException(e);
3142            }
3143            finally {
3144                if (count == null) {
3145                    count = Long.valueOf(0);
3146                }
3147
3148                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_U, finderArgs,
3149                    count);
3150
3151                closeSession(session);
3152            }
3153        }
3154
3155        return count.intValue();
3156    }
3157
3158    public int countByG_UT(long groupId, String urlTitle)
3159        throws SystemException {
3160        Object[] finderArgs = new Object[] { new Long(groupId), urlTitle };
3161
3162        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_UT,
3163                finderArgs, this);
3164
3165        if (count == null) {
3166            Session session = null;
3167
3168            try {
3169                session = openSession();
3170
3171                StringBundler query = new StringBundler(3);
3172
3173                query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
3174
3175                query.append(_FINDER_COLUMN_G_UT_GROUPID_2);
3176
3177                if (urlTitle == null) {
3178                    query.append(_FINDER_COLUMN_G_UT_URLTITLE_1);
3179                }
3180                else {
3181                    if (urlTitle.equals(StringPool.BLANK)) {
3182                        query.append(_FINDER_COLUMN_G_UT_URLTITLE_3);
3183                    }
3184                    else {
3185                        query.append(_FINDER_COLUMN_G_UT_URLTITLE_2);
3186                    }
3187                }
3188
3189                String sql = query.toString();
3190
3191                Query q = session.createQuery(sql);
3192
3193                QueryPos qPos = QueryPos.getInstance(q);
3194
3195                qPos.add(groupId);
3196
3197                if (urlTitle != null) {
3198                    qPos.add(urlTitle);
3199                }
3200
3201                count = (Long)q.uniqueResult();
3202            }
3203            catch (Exception e) {
3204                throw processException(e);
3205            }
3206            finally {
3207                if (count == null) {
3208                    count = Long.valueOf(0);
3209                }
3210
3211                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_UT,
3212                    finderArgs, count);
3213
3214                closeSession(session);
3215            }
3216        }
3217
3218        return count.intValue();
3219    }
3220
3221    public int countByG_D_D(long groupId, Date displayDate, boolean draft)
3222        throws SystemException {
3223        Object[] finderArgs = new Object[] {
3224                new Long(groupId),
3225                
3226                displayDate, Boolean.valueOf(draft)
3227            };
3228
3229        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_D_D,
3230                finderArgs, this);
3231
3232        if (count == null) {
3233            Session session = null;
3234
3235            try {
3236                session = openSession();
3237
3238                StringBundler query = new StringBundler(4);
3239
3240                query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
3241
3242                query.append(_FINDER_COLUMN_G_D_D_GROUPID_2);
3243
3244                if (displayDate == null) {
3245                    query.append(_FINDER_COLUMN_G_D_D_DISPLAYDATE_1);
3246                }
3247                else {
3248                    query.append(_FINDER_COLUMN_G_D_D_DISPLAYDATE_2);
3249                }
3250
3251                query.append(_FINDER_COLUMN_G_D_D_DRAFT_2);
3252
3253                String sql = query.toString();
3254
3255                Query q = session.createQuery(sql);
3256
3257                QueryPos qPos = QueryPos.getInstance(q);
3258
3259                qPos.add(groupId);
3260
3261                if (displayDate != null) {
3262                    qPos.add(CalendarUtil.getTimestamp(displayDate));
3263                }
3264
3265                qPos.add(draft);
3266
3267                count = (Long)q.uniqueResult();
3268            }
3269            catch (Exception e) {
3270                throw processException(e);
3271            }
3272            finally {
3273                if (count == null) {
3274                    count = Long.valueOf(0);
3275                }
3276
3277                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_D_D,
3278                    finderArgs, count);
3279
3280                closeSession(session);
3281            }
3282        }
3283
3284        return count.intValue();
3285    }
3286
3287    public int countByC_D_D(long companyId, Date displayDate, boolean draft)
3288        throws SystemException {
3289        Object[] finderArgs = new Object[] {
3290                new Long(companyId),
3291                
3292                displayDate, Boolean.valueOf(draft)
3293            };
3294
3295        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_D_D,
3296                finderArgs, this);
3297
3298        if (count == null) {
3299            Session session = null;
3300
3301            try {
3302                session = openSession();
3303
3304                StringBundler query = new StringBundler(4);
3305
3306                query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
3307
3308                query.append(_FINDER_COLUMN_C_D_D_COMPANYID_2);
3309
3310                if (displayDate == null) {
3311                    query.append(_FINDER_COLUMN_C_D_D_DISPLAYDATE_1);
3312                }
3313                else {
3314                    query.append(_FINDER_COLUMN_C_D_D_DISPLAYDATE_2);
3315                }
3316
3317                query.append(_FINDER_COLUMN_C_D_D_DRAFT_2);
3318
3319                String sql = query.toString();
3320
3321                Query q = session.createQuery(sql);
3322
3323                QueryPos qPos = QueryPos.getInstance(q);
3324
3325                qPos.add(companyId);
3326
3327                if (displayDate != null) {
3328                    qPos.add(CalendarUtil.getTimestamp(displayDate));
3329                }
3330
3331                qPos.add(draft);
3332
3333                count = (Long)q.uniqueResult();
3334            }
3335            catch (Exception e) {
3336                throw processException(e);
3337            }
3338            finally {
3339                if (count == null) {
3340                    count = Long.valueOf(0);
3341                }
3342
3343                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_D_D,
3344                    finderArgs, count);
3345
3346                closeSession(session);
3347            }
3348        }
3349
3350        return count.intValue();
3351    }
3352
3353    public int countByG_U_D_D(long groupId, long userId, Date displayDate,
3354        boolean draft) throws SystemException {
3355        Object[] finderArgs = new Object[] {
3356                new Long(groupId), new Long(userId),
3357                
3358                displayDate, Boolean.valueOf(draft)
3359            };
3360
3361        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_U_D_D,
3362                finderArgs, this);
3363
3364        if (count == null) {
3365            Session session = null;
3366
3367            try {
3368                session = openSession();
3369
3370                StringBundler query = new StringBundler(5);
3371
3372                query.append(_SQL_COUNT_BLOGSENTRY_WHERE);
3373
3374                query.append(_FINDER_COLUMN_G_U_D_D_GROUPID_2);
3375
3376                query.append(_FINDER_COLUMN_G_U_D_D_USERID_2);
3377
3378                if (displayDate == null) {
3379                    query.append(_FINDER_COLUMN_G_U_D_D_DISPLAYDATE_1);
3380                }
3381                else {
3382                    query.append(_FINDER_COLUMN_G_U_D_D_DISPLAYDATE_2);
3383                }
3384
3385                query.append(_FINDER_COLUMN_G_U_D_D_DRAFT_2);
3386
3387                String sql = query.toString();
3388
3389                Query q = session.createQuery(sql);
3390
3391                QueryPos qPos = QueryPos.getInstance(q);
3392
3393                qPos.add(groupId);
3394
3395                qPos.add(userId);
3396
3397                if (displayDate != null) {
3398                    qPos.add(CalendarUtil.getTimestamp(displayDate));
3399                }
3400
3401                qPos.add(draft);
3402
3403                count = (Long)q.uniqueResult();
3404            }
3405            catch (Exception e) {
3406                throw processException(e);
3407            }
3408            finally {
3409                if (count == null) {
3410                    count = Long.valueOf(0);
3411                }
3412
3413                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_U_D_D,
3414                    finderArgs, count);
3415
3416                closeSession(session);
3417            }
3418        }
3419
3420        return count.intValue();
3421    }
3422
3423    public int countAll() throws SystemException {
3424        Object[] finderArgs = new Object[0];
3425
3426        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3427                finderArgs, this);
3428
3429        if (count == null) {
3430            Session session = null;
3431
3432            try {
3433                session = openSession();
3434
3435                Query q = session.createQuery(_SQL_COUNT_BLOGSENTRY);
3436
3437                count = (Long)q.uniqueResult();
3438            }
3439            catch (Exception e) {
3440                throw processException(e);
3441            }
3442            finally {
3443                if (count == null) {
3444                    count = Long.valueOf(0);
3445                }
3446
3447                FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
3448                    count);
3449
3450                closeSession(session);
3451            }
3452        }
3453
3454        return count.intValue();
3455    }
3456
3457    public void afterPropertiesSet() {
3458        String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3459                    com.liferay.portal.util.PropsUtil.get(
3460                        "value.object.listener.com.liferay.portlet.blogs.model.BlogsEntry")));
3461
3462        if (listenerClassNames.length > 0) {
3463            try {
3464                List<ModelListener<BlogsEntry>> listenersList = new ArrayList<ModelListener<BlogsEntry>>();
3465
3466                for (String listenerClassName : listenerClassNames) {
3467                    listenersList.add((ModelListener<BlogsEntry>)Class.forName(
3468                            listenerClassName).newInstance());
3469                }
3470
3471                listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3472            }
3473            catch (Exception e) {
3474                _log.error(e);
3475            }
3476        }
3477    }
3478
3479    @BeanReference(name = "com.liferay.portlet.blogs.service.persistence.BlogsEntryPersistence")
3480    protected com.liferay.portlet.blogs.service.persistence.BlogsEntryPersistence blogsEntryPersistence;
3481    @BeanReference(name = "com.liferay.portlet.blogs.service.persistence.BlogsStatsUserPersistence")
3482    protected com.liferay.portlet.blogs.service.persistence.BlogsStatsUserPersistence blogsStatsUserPersistence;
3483    @BeanReference(name = "com.liferay.portal.service.persistence.CompanyPersistence")
3484    protected com.liferay.portal.service.persistence.CompanyPersistence companyPersistence;
3485    @BeanReference(name = "com.liferay.portal.service.persistence.GroupPersistence")
3486    protected com.liferay.portal.service.persistence.GroupPersistence groupPersistence;
3487    @BeanReference(name = "com.liferay.portal.service.persistence.OrganizationPersistence")
3488    protected com.liferay.portal.service.persistence.OrganizationPersistence organizationPersistence;
3489    @BeanReference(name = "com.liferay.portal.service.persistence.PortletPreferencesPersistence")
3490    protected com.liferay.portal.service.persistence.PortletPreferencesPersistence portletPreferencesPersistence;
3491    @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence")
3492    protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
3493    @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence")
3494    protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
3495    @BeanReference(name = "com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence")
3496    protected com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence expandoValuePersistence;
3497    @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBMessagePersistence")
3498    protected com.liferay.portlet.messageboards.service.persistence.MBMessagePersistence mbMessagePersistence;
3499    @BeanReference(name = "com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence")
3500    protected com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence ratingsStatsPersistence;
3501    @BeanReference(name = "com.liferay.portlet.social.service.persistence.SocialActivityPersistence")
3502    protected com.liferay.portlet.social.service.persistence.SocialActivityPersistence socialActivityPersistence;
3503    @BeanReference(name = "com.liferay.portlet.tags.service.persistence.TagsAssetPersistence")
3504    protected com.liferay.portlet.tags.service.persistence.TagsAssetPersistence tagsAssetPersistence;
3505    @BeanReference(name = "com.liferay.portlet.tags.service.persistence.TagsEntryPersistence")
3506    protected com.liferay.portlet.tags.service.persistence.TagsEntryPersistence tagsEntryPersistence;
3507    private static final String _SQL_SELECT_BLOGSENTRY = "SELECT blogsEntry FROM BlogsEntry blogsEntry";
3508    private static final String _SQL_SELECT_BLOGSENTRY_WHERE = "SELECT blogsEntry FROM BlogsEntry blogsEntry WHERE ";
3509    private static final String _SQL_COUNT_BLOGSENTRY = "SELECT COUNT(blogsEntry) FROM BlogsEntry blogsEntry";
3510    private static final String _SQL_COUNT_BLOGSENTRY_WHERE = "SELECT COUNT(blogsEntry) FROM BlogsEntry blogsEntry WHERE ";
3511    private static final String _FINDER_COLUMN_UUID_UUID_1 = "blogsEntry.uuid IS NULL";
3512    private static final String _FINDER_COLUMN_UUID_UUID_2 = "blogsEntry.uuid = ?";
3513    private static final String _FINDER_COLUMN_UUID_UUID_3 = "(blogsEntry.uuid IS NULL OR blogsEntry.uuid = ?)";
3514    private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "blogsEntry.uuid IS NULL AND ";
3515    private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "blogsEntry.uuid = ? AND ";
3516    private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(blogsEntry.uuid IS NULL OR blogsEntry.uuid = ?) AND ";
3517    private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "blogsEntry.groupId = ?";
3518    private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "blogsEntry.groupId = ?";
3519    private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "blogsEntry.companyId = ?";
3520    private static final String _FINDER_COLUMN_G_U_GROUPID_2 = "blogsEntry.groupId = ? AND ";
3521    private static final String _FINDER_COLUMN_G_U_USERID_2 = "blogsEntry.userId = ?";
3522    private static final String _FINDER_COLUMN_G_UT_GROUPID_2 = "blogsEntry.groupId = ? AND ";
3523    private static final String _FINDER_COLUMN_G_UT_URLTITLE_1 = "blogsEntry.urlTitle IS NULL";
3524    private static final String _FINDER_COLUMN_G_UT_URLTITLE_2 = "blogsEntry.urlTitle = ?";
3525    private static final String _FINDER_COLUMN_G_UT_URLTITLE_3 = "(blogsEntry.urlTitle IS NULL OR blogsEntry.urlTitle = ?)";
3526    private static final String _FINDER_COLUMN_G_D_D_GROUPID_2 = "blogsEntry.groupId = ? AND ";
3527    private static final String _FINDER_COLUMN_G_D_D_DISPLAYDATE_1 = "blogsEntry.displayDate < NULL AND ";
3528    private static final String _FINDER_COLUMN_G_D_D_DISPLAYDATE_2 = "blogsEntry.displayDate < ? AND ";
3529    private static final String _FINDER_COLUMN_G_D_D_DRAFT_2 = "blogsEntry.draft = ?";
3530    private static final String _FINDER_COLUMN_C_D_D_COMPANYID_2 = "blogsEntry.companyId = ? AND ";
3531    private static final String _FINDER_COLUMN_C_D_D_DISPLAYDATE_1 = "blogsEntry.displayDate < NULL AND ";
3532    private static final String _FINDER_COLUMN_C_D_D_DISPLAYDATE_2 = "blogsEntry.displayDate < ? AND ";
3533    private static final String _FINDER_COLUMN_C_D_D_DRAFT_2 = "blogsEntry.draft = ?";
3534    private static final String _FINDER_COLUMN_G_U_D_D_GROUPID_2 = "blogsEntry.groupId = ? AND ";
3535    private static final String _FINDER_COLUMN_G_U_D_D_USERID_2 = "blogsEntry.userId = ? AND ";
3536    private static final String _FINDER_COLUMN_G_U_D_D_DISPLAYDATE_1 = "blogsEntry.displayDate < NULL AND ";
3537    private static final String _FINDER_COLUMN_G_U_D_D_DISPLAYDATE_2 = "blogsEntry.displayDate < ? AND ";
3538    private static final String _FINDER_COLUMN_G_U_D_D_DRAFT_2 = "blogsEntry.draft = ?";
3539    private static final String _ORDER_BY_ENTITY_ALIAS = "blogsEntry.";
3540    private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No BlogsEntry exists with the primary key ";
3541    private static final String _NO_SUCH_ENTITY_WITH_KEY = "No BlogsEntry exists with the key {";
3542    private static Log _log = LogFactoryUtil.getLog(BlogsEntryPersistenceImpl.class);
3543}