1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.service.persistence;
16  
17  import com.liferay.portal.NoSuchLayoutSetException;
18  import com.liferay.portal.NoSuchModelException;
19  import com.liferay.portal.kernel.annotation.BeanReference;
20  import com.liferay.portal.kernel.cache.CacheRegistry;
21  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
22  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
23  import com.liferay.portal.kernel.dao.orm.FinderPath;
24  import com.liferay.portal.kernel.dao.orm.Query;
25  import com.liferay.portal.kernel.dao.orm.QueryPos;
26  import com.liferay.portal.kernel.dao.orm.QueryUtil;
27  import com.liferay.portal.kernel.dao.orm.Session;
28  import com.liferay.portal.kernel.exception.SystemException;
29  import com.liferay.portal.kernel.log.Log;
30  import com.liferay.portal.kernel.log.LogFactoryUtil;
31  import com.liferay.portal.kernel.util.GetterUtil;
32  import com.liferay.portal.kernel.util.InstanceFactory;
33  import com.liferay.portal.kernel.util.OrderByComparator;
34  import com.liferay.portal.kernel.util.StringBundler;
35  import com.liferay.portal.kernel.util.StringPool;
36  import com.liferay.portal.kernel.util.StringUtil;
37  import com.liferay.portal.kernel.util.Validator;
38  import com.liferay.portal.model.LayoutSet;
39  import com.liferay.portal.model.ModelListener;
40  import com.liferay.portal.model.impl.LayoutSetImpl;
41  import com.liferay.portal.model.impl.LayoutSetModelImpl;
42  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
43  
44  import java.io.Serializable;
45  
46  import java.util.ArrayList;
47  import java.util.Collections;
48  import java.util.List;
49  
50  /**
51   * <a href="LayoutSetPersistenceImpl.java.html"><b><i>View Source</i></b></a>
52   *
53   * <p>
54   * ServiceBuilder generated this class. Modifications in this class will be
55   * overwritten the next time is generated.
56   * </p>
57   *
58   * @author    Brian Wing Shun Chan
59   * @see       LayoutSetPersistence
60   * @see       LayoutSetUtil
61   * @generated
62   */
63  public class LayoutSetPersistenceImpl extends BasePersistenceImpl<LayoutSet>
64      implements LayoutSetPersistence {
65      public static final String FINDER_CLASS_NAME_ENTITY = LayoutSetImpl.class.getName();
66      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
67          ".List";
68      public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(LayoutSetModelImpl.ENTITY_CACHE_ENABLED,
69              LayoutSetModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
70              "findByGroupId",
71              new String[] {
72                  Long.class.getName(),
73                  
74              "java.lang.Integer", "java.lang.Integer",
75                  "com.liferay.portal.kernel.util.OrderByComparator"
76              });
77      public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(LayoutSetModelImpl.ENTITY_CACHE_ENABLED,
78              LayoutSetModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
79              "countByGroupId", new String[] { Long.class.getName() });
80      public static final FinderPath FINDER_PATH_FETCH_BY_VIRTUALHOST = new FinderPath(LayoutSetModelImpl.ENTITY_CACHE_ENABLED,
81              LayoutSetModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
82              "fetchByVirtualHost", new String[] { String.class.getName() });
83      public static final FinderPath FINDER_PATH_COUNT_BY_VIRTUALHOST = new FinderPath(LayoutSetModelImpl.ENTITY_CACHE_ENABLED,
84              LayoutSetModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
85              "countByVirtualHost", new String[] { String.class.getName() });
86      public static final FinderPath FINDER_PATH_FETCH_BY_G_P = new FinderPath(LayoutSetModelImpl.ENTITY_CACHE_ENABLED,
87              LayoutSetModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
88              "fetchByG_P",
89              new String[] { Long.class.getName(), Boolean.class.getName() });
90      public static final FinderPath FINDER_PATH_COUNT_BY_G_P = new FinderPath(LayoutSetModelImpl.ENTITY_CACHE_ENABLED,
91              LayoutSetModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
92              "countByG_P",
93              new String[] { Long.class.getName(), Boolean.class.getName() });
94      public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(LayoutSetModelImpl.ENTITY_CACHE_ENABLED,
95              LayoutSetModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
96              "findAll", new String[0]);
97      public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(LayoutSetModelImpl.ENTITY_CACHE_ENABLED,
98              LayoutSetModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
99              "countAll", new String[0]);
100 
101     public void cacheResult(LayoutSet layoutSet) {
102         EntityCacheUtil.putResult(LayoutSetModelImpl.ENTITY_CACHE_ENABLED,
103             LayoutSetImpl.class, layoutSet.getPrimaryKey(), layoutSet);
104 
105         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_VIRTUALHOST,
106             new Object[] { layoutSet.getVirtualHost() }, layoutSet);
107 
108         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P,
109             new Object[] {
110                 new Long(layoutSet.getGroupId()),
111                 Boolean.valueOf(layoutSet.getPrivateLayout())
112             }, layoutSet);
113     }
114 
115     public void cacheResult(List<LayoutSet> layoutSets) {
116         for (LayoutSet layoutSet : layoutSets) {
117             if (EntityCacheUtil.getResult(
118                         LayoutSetModelImpl.ENTITY_CACHE_ENABLED,
119                         LayoutSetImpl.class, layoutSet.getPrimaryKey(), this) == null) {
120                 cacheResult(layoutSet);
121             }
122         }
123     }
124 
125     public void clearCache() {
126         CacheRegistry.clear(LayoutSetImpl.class.getName());
127         EntityCacheUtil.clearCache(LayoutSetImpl.class.getName());
128         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
129         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
130     }
131 
132     public void clearCache(LayoutSet layoutSet) {
133         EntityCacheUtil.removeResult(LayoutSetModelImpl.ENTITY_CACHE_ENABLED,
134             LayoutSetImpl.class, layoutSet.getPrimaryKey());
135 
136         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_VIRTUALHOST,
137             new Object[] { layoutSet.getVirtualHost() });
138 
139         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_P,
140             new Object[] {
141                 new Long(layoutSet.getGroupId()),
142                 Boolean.valueOf(layoutSet.getPrivateLayout())
143             });
144     }
145 
146     public LayoutSet create(long layoutSetId) {
147         LayoutSet layoutSet = new LayoutSetImpl();
148 
149         layoutSet.setNew(true);
150         layoutSet.setPrimaryKey(layoutSetId);
151 
152         return layoutSet;
153     }
154 
155     public LayoutSet remove(Serializable primaryKey)
156         throws NoSuchModelException, SystemException {
157         return remove(((Long)primaryKey).longValue());
158     }
159 
160     public LayoutSet remove(long layoutSetId)
161         throws NoSuchLayoutSetException, SystemException {
162         Session session = null;
163 
164         try {
165             session = openSession();
166 
167             LayoutSet layoutSet = (LayoutSet)session.get(LayoutSetImpl.class,
168                     new Long(layoutSetId));
169 
170             if (layoutSet == null) {
171                 if (_log.isWarnEnabled()) {
172                     _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + layoutSetId);
173                 }
174 
175                 throw new NoSuchLayoutSetException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
176                     layoutSetId);
177             }
178 
179             return remove(layoutSet);
180         }
181         catch (NoSuchLayoutSetException nsee) {
182             throw nsee;
183         }
184         catch (Exception e) {
185             throw processException(e);
186         }
187         finally {
188             closeSession(session);
189         }
190     }
191 
192     public LayoutSet remove(LayoutSet layoutSet) throws SystemException {
193         for (ModelListener<LayoutSet> listener : listeners) {
194             listener.onBeforeRemove(layoutSet);
195         }
196 
197         layoutSet = removeImpl(layoutSet);
198 
199         for (ModelListener<LayoutSet> listener : listeners) {
200             listener.onAfterRemove(layoutSet);
201         }
202 
203         return layoutSet;
204     }
205 
206     protected LayoutSet removeImpl(LayoutSet layoutSet)
207         throws SystemException {
208         layoutSet = toUnwrappedModel(layoutSet);
209 
210         Session session = null;
211 
212         try {
213             session = openSession();
214 
215             if (layoutSet.isCachedModel() || BatchSessionUtil.isEnabled()) {
216                 Object staleObject = session.get(LayoutSetImpl.class,
217                         layoutSet.getPrimaryKeyObj());
218 
219                 if (staleObject != null) {
220                     session.evict(staleObject);
221                 }
222             }
223 
224             session.delete(layoutSet);
225 
226             session.flush();
227         }
228         catch (Exception e) {
229             throw processException(e);
230         }
231         finally {
232             closeSession(session);
233         }
234 
235         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
236 
237         LayoutSetModelImpl layoutSetModelImpl = (LayoutSetModelImpl)layoutSet;
238 
239         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_VIRTUALHOST,
240             new Object[] { layoutSetModelImpl.getOriginalVirtualHost() });
241 
242         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_P,
243             new Object[] {
244                 new Long(layoutSetModelImpl.getOriginalGroupId()),
245                 Boolean.valueOf(layoutSetModelImpl.getOriginalPrivateLayout())
246             });
247 
248         EntityCacheUtil.removeResult(LayoutSetModelImpl.ENTITY_CACHE_ENABLED,
249             LayoutSetImpl.class, layoutSet.getPrimaryKey());
250 
251         return layoutSet;
252     }
253 
254     public LayoutSet updateImpl(com.liferay.portal.model.LayoutSet layoutSet,
255         boolean merge) throws SystemException {
256         layoutSet = toUnwrappedModel(layoutSet);
257 
258         boolean isNew = layoutSet.isNew();
259 
260         LayoutSetModelImpl layoutSetModelImpl = (LayoutSetModelImpl)layoutSet;
261 
262         Session session = null;
263 
264         try {
265             session = openSession();
266 
267             BatchSessionUtil.update(session, layoutSet, merge);
268 
269             layoutSet.setNew(false);
270         }
271         catch (Exception e) {
272             throw processException(e);
273         }
274         finally {
275             closeSession(session);
276         }
277 
278         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
279 
280         EntityCacheUtil.putResult(LayoutSetModelImpl.ENTITY_CACHE_ENABLED,
281             LayoutSetImpl.class, layoutSet.getPrimaryKey(), layoutSet);
282 
283         if (!isNew &&
284                 (!Validator.equals(layoutSet.getVirtualHost(),
285                     layoutSetModelImpl.getOriginalVirtualHost()))) {
286             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_VIRTUALHOST,
287                 new Object[] { layoutSetModelImpl.getOriginalVirtualHost() });
288         }
289 
290         if (isNew ||
291                 (!Validator.equals(layoutSet.getVirtualHost(),
292                     layoutSetModelImpl.getOriginalVirtualHost()))) {
293             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_VIRTUALHOST,
294                 new Object[] { layoutSet.getVirtualHost() }, layoutSet);
295         }
296 
297         if (!isNew &&
298                 ((layoutSet.getGroupId() != layoutSetModelImpl.getOriginalGroupId()) ||
299                 (layoutSet.getPrivateLayout() != layoutSetModelImpl.getOriginalPrivateLayout()))) {
300             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_P,
301                 new Object[] {
302                     new Long(layoutSetModelImpl.getOriginalGroupId()),
303                     Boolean.valueOf(
304                         layoutSetModelImpl.getOriginalPrivateLayout())
305                 });
306         }
307 
308         if (isNew ||
309                 ((layoutSet.getGroupId() != layoutSetModelImpl.getOriginalGroupId()) ||
310                 (layoutSet.getPrivateLayout() != layoutSetModelImpl.getOriginalPrivateLayout()))) {
311             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P,
312                 new Object[] {
313                     new Long(layoutSet.getGroupId()),
314                     Boolean.valueOf(layoutSet.getPrivateLayout())
315                 }, layoutSet);
316         }
317 
318         return layoutSet;
319     }
320 
321     protected LayoutSet toUnwrappedModel(LayoutSet layoutSet) {
322         if (layoutSet instanceof LayoutSetImpl) {
323             return layoutSet;
324         }
325 
326         LayoutSetImpl layoutSetImpl = new LayoutSetImpl();
327 
328         layoutSetImpl.setNew(layoutSet.isNew());
329         layoutSetImpl.setPrimaryKey(layoutSet.getPrimaryKey());
330 
331         layoutSetImpl.setLayoutSetId(layoutSet.getLayoutSetId());
332         layoutSetImpl.setGroupId(layoutSet.getGroupId());
333         layoutSetImpl.setCompanyId(layoutSet.getCompanyId());
334         layoutSetImpl.setPrivateLayout(layoutSet.isPrivateLayout());
335         layoutSetImpl.setLogo(layoutSet.isLogo());
336         layoutSetImpl.setLogoId(layoutSet.getLogoId());
337         layoutSetImpl.setThemeId(layoutSet.getThemeId());
338         layoutSetImpl.setColorSchemeId(layoutSet.getColorSchemeId());
339         layoutSetImpl.setWapThemeId(layoutSet.getWapThemeId());
340         layoutSetImpl.setWapColorSchemeId(layoutSet.getWapColorSchemeId());
341         layoutSetImpl.setCss(layoutSet.getCss());
342         layoutSetImpl.setPageCount(layoutSet.getPageCount());
343         layoutSetImpl.setVirtualHost(layoutSet.getVirtualHost());
344         layoutSetImpl.setSettings(layoutSet.getSettings());
345         layoutSetImpl.setLayoutSetPrototypeId(layoutSet.getLayoutSetPrototypeId());
346 
347         return layoutSetImpl;
348     }
349 
350     public LayoutSet findByPrimaryKey(Serializable primaryKey)
351         throws NoSuchModelException, SystemException {
352         return findByPrimaryKey(((Long)primaryKey).longValue());
353     }
354 
355     public LayoutSet findByPrimaryKey(long layoutSetId)
356         throws NoSuchLayoutSetException, SystemException {
357         LayoutSet layoutSet = fetchByPrimaryKey(layoutSetId);
358 
359         if (layoutSet == null) {
360             if (_log.isWarnEnabled()) {
361                 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + layoutSetId);
362             }
363 
364             throw new NoSuchLayoutSetException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
365                 layoutSetId);
366         }
367 
368         return layoutSet;
369     }
370 
371     public LayoutSet fetchByPrimaryKey(Serializable primaryKey)
372         throws SystemException {
373         return fetchByPrimaryKey(((Long)primaryKey).longValue());
374     }
375 
376     public LayoutSet fetchByPrimaryKey(long layoutSetId)
377         throws SystemException {
378         LayoutSet layoutSet = (LayoutSet)EntityCacheUtil.getResult(LayoutSetModelImpl.ENTITY_CACHE_ENABLED,
379                 LayoutSetImpl.class, layoutSetId, this);
380 
381         if (layoutSet == null) {
382             Session session = null;
383 
384             try {
385                 session = openSession();
386 
387                 layoutSet = (LayoutSet)session.get(LayoutSetImpl.class,
388                         new Long(layoutSetId));
389             }
390             catch (Exception e) {
391                 throw processException(e);
392             }
393             finally {
394                 if (layoutSet != null) {
395                     cacheResult(layoutSet);
396                 }
397 
398                 closeSession(session);
399             }
400         }
401 
402         return layoutSet;
403     }
404 
405     public List<LayoutSet> findByGroupId(long groupId)
406         throws SystemException {
407         return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
408     }
409 
410     public List<LayoutSet> findByGroupId(long groupId, int start, int end)
411         throws SystemException {
412         return findByGroupId(groupId, start, end, null);
413     }
414 
415     public List<LayoutSet> findByGroupId(long groupId, int start, int end,
416         OrderByComparator orderByComparator) throws SystemException {
417         Object[] finderArgs = new Object[] {
418                 new Long(groupId),
419                 
420                 String.valueOf(start), String.valueOf(end),
421                 String.valueOf(orderByComparator)
422             };
423 
424         List<LayoutSet> list = (List<LayoutSet>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
425                 finderArgs, this);
426 
427         if (list == null) {
428             Session session = null;
429 
430             try {
431                 session = openSession();
432 
433                 StringBundler query = null;
434 
435                 if (orderByComparator != null) {
436                     query = new StringBundler(3 +
437                             (orderByComparator.getOrderByFields().length * 3));
438                 }
439                 else {
440                     query = new StringBundler(2);
441                 }
442 
443                 query.append(_SQL_SELECT_LAYOUTSET_WHERE);
444 
445                 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
446 
447                 if (orderByComparator != null) {
448                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
449                         orderByComparator);
450                 }
451 
452                 String sql = query.toString();
453 
454                 Query q = session.createQuery(sql);
455 
456                 QueryPos qPos = QueryPos.getInstance(q);
457 
458                 qPos.add(groupId);
459 
460                 list = (List<LayoutSet>)QueryUtil.list(q, getDialect(), start,
461                         end);
462             }
463             catch (Exception e) {
464                 throw processException(e);
465             }
466             finally {
467                 if (list == null) {
468                     list = new ArrayList<LayoutSet>();
469                 }
470 
471                 cacheResult(list);
472 
473                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
474                     finderArgs, list);
475 
476                 closeSession(session);
477             }
478         }
479 
480         return list;
481     }
482 
483     public LayoutSet findByGroupId_First(long groupId,
484         OrderByComparator orderByComparator)
485         throws NoSuchLayoutSetException, SystemException {
486         List<LayoutSet> list = findByGroupId(groupId, 0, 1, orderByComparator);
487 
488         if (list.isEmpty()) {
489             StringBundler msg = new StringBundler(4);
490 
491             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
492 
493             msg.append("groupId=");
494             msg.append(groupId);
495 
496             msg.append(StringPool.CLOSE_CURLY_BRACE);
497 
498             throw new NoSuchLayoutSetException(msg.toString());
499         }
500         else {
501             return list.get(0);
502         }
503     }
504 
505     public LayoutSet findByGroupId_Last(long groupId,
506         OrderByComparator orderByComparator)
507         throws NoSuchLayoutSetException, SystemException {
508         int count = countByGroupId(groupId);
509 
510         List<LayoutSet> list = findByGroupId(groupId, count - 1, count,
511                 orderByComparator);
512 
513         if (list.isEmpty()) {
514             StringBundler msg = new StringBundler(4);
515 
516             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
517 
518             msg.append("groupId=");
519             msg.append(groupId);
520 
521             msg.append(StringPool.CLOSE_CURLY_BRACE);
522 
523             throw new NoSuchLayoutSetException(msg.toString());
524         }
525         else {
526             return list.get(0);
527         }
528     }
529 
530     public LayoutSet[] findByGroupId_PrevAndNext(long layoutSetId,
531         long groupId, OrderByComparator orderByComparator)
532         throws NoSuchLayoutSetException, SystemException {
533         LayoutSet layoutSet = findByPrimaryKey(layoutSetId);
534 
535         Session session = null;
536 
537         try {
538             session = openSession();
539 
540             LayoutSet[] array = new LayoutSetImpl[3];
541 
542             array[0] = getByGroupId_PrevAndNext(session, layoutSet, groupId,
543                     orderByComparator, true);
544 
545             array[1] = layoutSet;
546 
547             array[2] = getByGroupId_PrevAndNext(session, layoutSet, groupId,
548                     orderByComparator, false);
549 
550             return array;
551         }
552         catch (Exception e) {
553             throw processException(e);
554         }
555         finally {
556             closeSession(session);
557         }
558     }
559 
560     protected LayoutSet getByGroupId_PrevAndNext(Session session,
561         LayoutSet layoutSet, long groupId, OrderByComparator orderByComparator,
562         boolean previous) {
563         StringBundler query = null;
564 
565         if (orderByComparator != null) {
566             query = new StringBundler(6 +
567                     (orderByComparator.getOrderByFields().length * 6));
568         }
569         else {
570             query = new StringBundler(3);
571         }
572 
573         query.append(_SQL_SELECT_LAYOUTSET_WHERE);
574 
575         query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
576 
577         if (orderByComparator != null) {
578             String[] orderByFields = orderByComparator.getOrderByFields();
579 
580             if (orderByFields.length > 0) {
581                 query.append(WHERE_AND);
582             }
583 
584             for (int i = 0; i < orderByFields.length; i++) {
585                 query.append(_ORDER_BY_ENTITY_ALIAS);
586                 query.append(orderByFields[i]);
587 
588                 if ((i + 1) < orderByFields.length) {
589                     if (orderByComparator.isAscending() ^ previous) {
590                         query.append(WHERE_GREATER_THAN_HAS_NEXT);
591                     }
592                     else {
593                         query.append(WHERE_LESSER_THAN_HAS_NEXT);
594                     }
595                 }
596                 else {
597                     if (orderByComparator.isAscending() ^ previous) {
598                         query.append(WHERE_GREATER_THAN);
599                     }
600                     else {
601                         query.append(WHERE_LESSER_THAN);
602                     }
603                 }
604             }
605 
606             query.append(ORDER_BY_CLAUSE);
607 
608             for (int i = 0; i < orderByFields.length; i++) {
609                 query.append(_ORDER_BY_ENTITY_ALIAS);
610                 query.append(orderByFields[i]);
611 
612                 if ((i + 1) < orderByFields.length) {
613                     if (orderByComparator.isAscending() ^ previous) {
614                         query.append(ORDER_BY_ASC_HAS_NEXT);
615                     }
616                     else {
617                         query.append(ORDER_BY_DESC_HAS_NEXT);
618                     }
619                 }
620                 else {
621                     if (orderByComparator.isAscending() ^ previous) {
622                         query.append(ORDER_BY_ASC);
623                     }
624                     else {
625                         query.append(ORDER_BY_DESC);
626                     }
627                 }
628             }
629         }
630 
631         String sql = query.toString();
632 
633         Query q = session.createQuery(sql);
634 
635         q.setFirstResult(0);
636         q.setMaxResults(2);
637 
638         QueryPos qPos = QueryPos.getInstance(q);
639 
640         qPos.add(groupId);
641 
642         if (orderByComparator != null) {
643             Object[] values = orderByComparator.getOrderByValues(layoutSet);
644 
645             for (Object value : values) {
646                 qPos.add(value);
647             }
648         }
649 
650         List<LayoutSet> list = q.list();
651 
652         if (list.size() == 2) {
653             return list.get(1);
654         }
655         else {
656             return null;
657         }
658     }
659 
660     public LayoutSet findByVirtualHost(String virtualHost)
661         throws NoSuchLayoutSetException, SystemException {
662         LayoutSet layoutSet = fetchByVirtualHost(virtualHost);
663 
664         if (layoutSet == null) {
665             StringBundler msg = new StringBundler(4);
666 
667             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
668 
669             msg.append("virtualHost=");
670             msg.append(virtualHost);
671 
672             msg.append(StringPool.CLOSE_CURLY_BRACE);
673 
674             if (_log.isWarnEnabled()) {
675                 _log.warn(msg.toString());
676             }
677 
678             throw new NoSuchLayoutSetException(msg.toString());
679         }
680 
681         return layoutSet;
682     }
683 
684     public LayoutSet fetchByVirtualHost(String virtualHost)
685         throws SystemException {
686         return fetchByVirtualHost(virtualHost, true);
687     }
688 
689     public LayoutSet fetchByVirtualHost(String virtualHost,
690         boolean retrieveFromCache) throws SystemException {
691         Object[] finderArgs = new Object[] { virtualHost };
692 
693         Object result = null;
694 
695         if (retrieveFromCache) {
696             result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_VIRTUALHOST,
697                     finderArgs, this);
698         }
699 
700         if (result == null) {
701             Session session = null;
702 
703             try {
704                 session = openSession();
705 
706                 StringBundler query = new StringBundler(2);
707 
708                 query.append(_SQL_SELECT_LAYOUTSET_WHERE);
709 
710                 if (virtualHost == null) {
711                     query.append(_FINDER_COLUMN_VIRTUALHOST_VIRTUALHOST_1);
712                 }
713                 else {
714                     if (virtualHost.equals(StringPool.BLANK)) {
715                         query.append(_FINDER_COLUMN_VIRTUALHOST_VIRTUALHOST_3);
716                     }
717                     else {
718                         query.append(_FINDER_COLUMN_VIRTUALHOST_VIRTUALHOST_2);
719                     }
720                 }
721 
722                 String sql = query.toString();
723 
724                 Query q = session.createQuery(sql);
725 
726                 QueryPos qPos = QueryPos.getInstance(q);
727 
728                 if (virtualHost != null) {
729                     qPos.add(virtualHost);
730                 }
731 
732                 List<LayoutSet> list = q.list();
733 
734                 result = list;
735 
736                 LayoutSet layoutSet = null;
737 
738                 if (list.isEmpty()) {
739                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_VIRTUALHOST,
740                         finderArgs, list);
741                 }
742                 else {
743                     layoutSet = list.get(0);
744 
745                     cacheResult(layoutSet);
746 
747                     if ((layoutSet.getVirtualHost() == null) ||
748                             !layoutSet.getVirtualHost().equals(virtualHost)) {
749                         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_VIRTUALHOST,
750                             finderArgs, layoutSet);
751                     }
752                 }
753 
754                 return layoutSet;
755             }
756             catch (Exception e) {
757                 throw processException(e);
758             }
759             finally {
760                 if (result == null) {
761                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_VIRTUALHOST,
762                         finderArgs, new ArrayList<LayoutSet>());
763                 }
764 
765                 closeSession(session);
766             }
767         }
768         else {
769             if (result instanceof List<?>) {
770                 return null;
771             }
772             else {
773                 return (LayoutSet)result;
774             }
775         }
776     }
777 
778     public LayoutSet findByG_P(long groupId, boolean privateLayout)
779         throws NoSuchLayoutSetException, SystemException {
780         LayoutSet layoutSet = fetchByG_P(groupId, privateLayout);
781 
782         if (layoutSet == null) {
783             StringBundler msg = new StringBundler(6);
784 
785             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
786 
787             msg.append("groupId=");
788             msg.append(groupId);
789 
790             msg.append(", privateLayout=");
791             msg.append(privateLayout);
792 
793             msg.append(StringPool.CLOSE_CURLY_BRACE);
794 
795             if (_log.isWarnEnabled()) {
796                 _log.warn(msg.toString());
797             }
798 
799             throw new NoSuchLayoutSetException(msg.toString());
800         }
801 
802         return layoutSet;
803     }
804 
805     public LayoutSet fetchByG_P(long groupId, boolean privateLayout)
806         throws SystemException {
807         return fetchByG_P(groupId, privateLayout, true);
808     }
809 
810     public LayoutSet fetchByG_P(long groupId, boolean privateLayout,
811         boolean retrieveFromCache) throws SystemException {
812         Object[] finderArgs = new Object[] {
813                 new Long(groupId), Boolean.valueOf(privateLayout)
814             };
815 
816         Object result = null;
817 
818         if (retrieveFromCache) {
819             result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_P,
820                     finderArgs, this);
821         }
822 
823         if (result == null) {
824             Session session = null;
825 
826             try {
827                 session = openSession();
828 
829                 StringBundler query = new StringBundler(3);
830 
831                 query.append(_SQL_SELECT_LAYOUTSET_WHERE);
832 
833                 query.append(_FINDER_COLUMN_G_P_GROUPID_2);
834 
835                 query.append(_FINDER_COLUMN_G_P_PRIVATELAYOUT_2);
836 
837                 String sql = query.toString();
838 
839                 Query q = session.createQuery(sql);
840 
841                 QueryPos qPos = QueryPos.getInstance(q);
842 
843                 qPos.add(groupId);
844 
845                 qPos.add(privateLayout);
846 
847                 List<LayoutSet> list = q.list();
848 
849                 result = list;
850 
851                 LayoutSet layoutSet = null;
852 
853                 if (list.isEmpty()) {
854                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P,
855                         finderArgs, list);
856                 }
857                 else {
858                     layoutSet = list.get(0);
859 
860                     cacheResult(layoutSet);
861 
862                     if ((layoutSet.getGroupId() != groupId) ||
863                             (layoutSet.getPrivateLayout() != privateLayout)) {
864                         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P,
865                             finderArgs, layoutSet);
866                     }
867                 }
868 
869                 return layoutSet;
870             }
871             catch (Exception e) {
872                 throw processException(e);
873             }
874             finally {
875                 if (result == null) {
876                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_P,
877                         finderArgs, new ArrayList<LayoutSet>());
878                 }
879 
880                 closeSession(session);
881             }
882         }
883         else {
884             if (result instanceof List<?>) {
885                 return null;
886             }
887             else {
888                 return (LayoutSet)result;
889             }
890         }
891     }
892 
893     public List<LayoutSet> findAll() throws SystemException {
894         return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
895     }
896 
897     public List<LayoutSet> findAll(int start, int end)
898         throws SystemException {
899         return findAll(start, end, null);
900     }
901 
902     public List<LayoutSet> findAll(int start, int end,
903         OrderByComparator orderByComparator) throws SystemException {
904         Object[] finderArgs = new Object[] {
905                 String.valueOf(start), String.valueOf(end),
906                 String.valueOf(orderByComparator)
907             };
908 
909         List<LayoutSet> list = (List<LayoutSet>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
910                 finderArgs, this);
911 
912         if (list == null) {
913             Session session = null;
914 
915             try {
916                 session = openSession();
917 
918                 StringBundler query = null;
919                 String sql = null;
920 
921                 if (orderByComparator != null) {
922                     query = new StringBundler(2 +
923                             (orderByComparator.getOrderByFields().length * 3));
924 
925                     query.append(_SQL_SELECT_LAYOUTSET);
926 
927                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
928                         orderByComparator);
929 
930                     sql = query.toString();
931                 }
932 
933                 sql = _SQL_SELECT_LAYOUTSET;
934 
935                 Query q = session.createQuery(sql);
936 
937                 if (orderByComparator == null) {
938                     list = (List<LayoutSet>)QueryUtil.list(q, getDialect(),
939                             start, end, false);
940 
941                     Collections.sort(list);
942                 }
943                 else {
944                     list = (List<LayoutSet>)QueryUtil.list(q, getDialect(),
945                             start, end);
946                 }
947             }
948             catch (Exception e) {
949                 throw processException(e);
950             }
951             finally {
952                 if (list == null) {
953                     list = new ArrayList<LayoutSet>();
954                 }
955 
956                 cacheResult(list);
957 
958                 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
959 
960                 closeSession(session);
961             }
962         }
963 
964         return list;
965     }
966 
967     public void removeByGroupId(long groupId) throws SystemException {
968         for (LayoutSet layoutSet : findByGroupId(groupId)) {
969             remove(layoutSet);
970         }
971     }
972 
973     public void removeByVirtualHost(String virtualHost)
974         throws NoSuchLayoutSetException, SystemException {
975         LayoutSet layoutSet = findByVirtualHost(virtualHost);
976 
977         remove(layoutSet);
978     }
979 
980     public void removeByG_P(long groupId, boolean privateLayout)
981         throws NoSuchLayoutSetException, SystemException {
982         LayoutSet layoutSet = findByG_P(groupId, privateLayout);
983 
984         remove(layoutSet);
985     }
986 
987     public void removeAll() throws SystemException {
988         for (LayoutSet layoutSet : findAll()) {
989             remove(layoutSet);
990         }
991     }
992 
993     public int countByGroupId(long groupId) throws SystemException {
994         Object[] finderArgs = new Object[] { new Long(groupId) };
995 
996         Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
997                 finderArgs, this);
998 
999         if (count == null) {
1000            Session session = null;
1001
1002            try {
1003                session = openSession();
1004
1005                StringBundler query = new StringBundler(2);
1006
1007                query.append(_SQL_COUNT_LAYOUTSET_WHERE);
1008
1009                query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1010
1011                String sql = query.toString();
1012
1013                Query q = session.createQuery(sql);
1014
1015                QueryPos qPos = QueryPos.getInstance(q);
1016
1017                qPos.add(groupId);
1018
1019                count = (Long)q.uniqueResult();
1020            }
1021            catch (Exception e) {
1022                throw processException(e);
1023            }
1024            finally {
1025                if (count == null) {
1026                    count = Long.valueOf(0);
1027                }
1028
1029                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
1030                    finderArgs, count);
1031
1032                closeSession(session);
1033            }
1034        }
1035
1036        return count.intValue();
1037    }
1038
1039    public int countByVirtualHost(String virtualHost) throws SystemException {
1040        Object[] finderArgs = new Object[] { virtualHost };
1041
1042        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_VIRTUALHOST,
1043                finderArgs, this);
1044
1045        if (count == null) {
1046            Session session = null;
1047
1048            try {
1049                session = openSession();
1050
1051                StringBundler query = new StringBundler(2);
1052
1053                query.append(_SQL_COUNT_LAYOUTSET_WHERE);
1054
1055                if (virtualHost == null) {
1056                    query.append(_FINDER_COLUMN_VIRTUALHOST_VIRTUALHOST_1);
1057                }
1058                else {
1059                    if (virtualHost.equals(StringPool.BLANK)) {
1060                        query.append(_FINDER_COLUMN_VIRTUALHOST_VIRTUALHOST_3);
1061                    }
1062                    else {
1063                        query.append(_FINDER_COLUMN_VIRTUALHOST_VIRTUALHOST_2);
1064                    }
1065                }
1066
1067                String sql = query.toString();
1068
1069                Query q = session.createQuery(sql);
1070
1071                QueryPos qPos = QueryPos.getInstance(q);
1072
1073                if (virtualHost != null) {
1074                    qPos.add(virtualHost);
1075                }
1076
1077                count = (Long)q.uniqueResult();
1078            }
1079            catch (Exception e) {
1080                throw processException(e);
1081            }
1082            finally {
1083                if (count == null) {
1084                    count = Long.valueOf(0);
1085                }
1086
1087                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_VIRTUALHOST,
1088                    finderArgs, count);
1089
1090                closeSession(session);
1091            }
1092        }
1093
1094        return count.intValue();
1095    }
1096
1097    public int countByG_P(long groupId, boolean privateLayout)
1098        throws SystemException {
1099        Object[] finderArgs = new Object[] {
1100                new Long(groupId), Boolean.valueOf(privateLayout)
1101            };
1102
1103        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_P,
1104                finderArgs, this);
1105
1106        if (count == null) {
1107            Session session = null;
1108
1109            try {
1110                session = openSession();
1111
1112                StringBundler query = new StringBundler(3);
1113
1114                query.append(_SQL_COUNT_LAYOUTSET_WHERE);
1115
1116                query.append(_FINDER_COLUMN_G_P_GROUPID_2);
1117
1118                query.append(_FINDER_COLUMN_G_P_PRIVATELAYOUT_2);
1119
1120                String sql = query.toString();
1121
1122                Query q = session.createQuery(sql);
1123
1124                QueryPos qPos = QueryPos.getInstance(q);
1125
1126                qPos.add(groupId);
1127
1128                qPos.add(privateLayout);
1129
1130                count = (Long)q.uniqueResult();
1131            }
1132            catch (Exception e) {
1133                throw processException(e);
1134            }
1135            finally {
1136                if (count == null) {
1137                    count = Long.valueOf(0);
1138                }
1139
1140                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_P, finderArgs,
1141                    count);
1142
1143                closeSession(session);
1144            }
1145        }
1146
1147        return count.intValue();
1148    }
1149
1150    public int countAll() throws SystemException {
1151        Object[] finderArgs = new Object[0];
1152
1153        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1154                finderArgs, this);
1155
1156        if (count == null) {
1157            Session session = null;
1158
1159            try {
1160                session = openSession();
1161
1162                Query q = session.createQuery(_SQL_COUNT_LAYOUTSET);
1163
1164                count = (Long)q.uniqueResult();
1165            }
1166            catch (Exception e) {
1167                throw processException(e);
1168            }
1169            finally {
1170                if (count == null) {
1171                    count = Long.valueOf(0);
1172                }
1173
1174                FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
1175                    count);
1176
1177                closeSession(session);
1178            }
1179        }
1180
1181        return count.intValue();
1182    }
1183
1184    public void afterPropertiesSet() {
1185        String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1186                    com.liferay.portal.util.PropsUtil.get(
1187                        "value.object.listener.com.liferay.portal.model.LayoutSet")));
1188
1189        if (listenerClassNames.length > 0) {
1190            try {
1191                List<ModelListener<LayoutSet>> listenersList = new ArrayList<ModelListener<LayoutSet>>();
1192
1193                for (String listenerClassName : listenerClassNames) {
1194                    listenersList.add((ModelListener<LayoutSet>)InstanceFactory.newInstance(
1195                            listenerClassName));
1196                }
1197
1198                listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1199            }
1200            catch (Exception e) {
1201                _log.error(e);
1202            }
1203        }
1204    }
1205
1206    @BeanReference(type = AccountPersistence.class)
1207    protected AccountPersistence accountPersistence;
1208    @BeanReference(type = AddressPersistence.class)
1209    protected AddressPersistence addressPersistence;
1210    @BeanReference(type = BrowserTrackerPersistence.class)
1211    protected BrowserTrackerPersistence browserTrackerPersistence;
1212    @BeanReference(type = ClassNamePersistence.class)
1213    protected ClassNamePersistence classNamePersistence;
1214    @BeanReference(type = CompanyPersistence.class)
1215    protected CompanyPersistence companyPersistence;
1216    @BeanReference(type = ContactPersistence.class)
1217    protected ContactPersistence contactPersistence;
1218    @BeanReference(type = CountryPersistence.class)
1219    protected CountryPersistence countryPersistence;
1220    @BeanReference(type = EmailAddressPersistence.class)
1221    protected EmailAddressPersistence emailAddressPersistence;
1222    @BeanReference(type = GroupPersistence.class)
1223    protected GroupPersistence groupPersistence;
1224    @BeanReference(type = ImagePersistence.class)
1225    protected ImagePersistence imagePersistence;
1226    @BeanReference(type = LayoutPersistence.class)
1227    protected LayoutPersistence layoutPersistence;
1228    @BeanReference(type = LayoutPrototypePersistence.class)
1229    protected LayoutPrototypePersistence layoutPrototypePersistence;
1230    @BeanReference(type = LayoutSetPersistence.class)
1231    protected LayoutSetPersistence layoutSetPersistence;
1232    @BeanReference(type = LayoutSetPrototypePersistence.class)
1233    protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
1234    @BeanReference(type = ListTypePersistence.class)
1235    protected ListTypePersistence listTypePersistence;
1236    @BeanReference(type = LockPersistence.class)
1237    protected LockPersistence lockPersistence;
1238    @BeanReference(type = MembershipRequestPersistence.class)
1239    protected MembershipRequestPersistence membershipRequestPersistence;
1240    @BeanReference(type = OrganizationPersistence.class)
1241    protected OrganizationPersistence organizationPersistence;
1242    @BeanReference(type = OrgGroupPermissionPersistence.class)
1243    protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
1244    @BeanReference(type = OrgGroupRolePersistence.class)
1245    protected OrgGroupRolePersistence orgGroupRolePersistence;
1246    @BeanReference(type = OrgLaborPersistence.class)
1247    protected OrgLaborPersistence orgLaborPersistence;
1248    @BeanReference(type = PasswordPolicyPersistence.class)
1249    protected PasswordPolicyPersistence passwordPolicyPersistence;
1250    @BeanReference(type = PasswordPolicyRelPersistence.class)
1251    protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1252    @BeanReference(type = PasswordTrackerPersistence.class)
1253    protected PasswordTrackerPersistence passwordTrackerPersistence;
1254    @BeanReference(type = PermissionPersistence.class)
1255    protected PermissionPersistence permissionPersistence;
1256    @BeanReference(type = PhonePersistence.class)
1257    protected PhonePersistence phonePersistence;
1258    @BeanReference(type = PluginSettingPersistence.class)
1259    protected PluginSettingPersistence pluginSettingPersistence;
1260    @BeanReference(type = PortletPersistence.class)
1261    protected PortletPersistence portletPersistence;
1262    @BeanReference(type = PortletItemPersistence.class)
1263    protected PortletItemPersistence portletItemPersistence;
1264    @BeanReference(type = PortletPreferencesPersistence.class)
1265    protected PortletPreferencesPersistence portletPreferencesPersistence;
1266    @BeanReference(type = RegionPersistence.class)
1267    protected RegionPersistence regionPersistence;
1268    @BeanReference(type = ReleasePersistence.class)
1269    protected ReleasePersistence releasePersistence;
1270    @BeanReference(type = ResourcePersistence.class)
1271    protected ResourcePersistence resourcePersistence;
1272    @BeanReference(type = ResourceActionPersistence.class)
1273    protected ResourceActionPersistence resourceActionPersistence;
1274    @BeanReference(type = ResourceCodePersistence.class)
1275    protected ResourceCodePersistence resourceCodePersistence;
1276    @BeanReference(type = ResourcePermissionPersistence.class)
1277    protected ResourcePermissionPersistence resourcePermissionPersistence;
1278    @BeanReference(type = RolePersistence.class)
1279    protected RolePersistence rolePersistence;
1280    @BeanReference(type = ServiceComponentPersistence.class)
1281    protected ServiceComponentPersistence serviceComponentPersistence;
1282    @BeanReference(type = ShardPersistence.class)
1283    protected ShardPersistence shardPersistence;
1284    @BeanReference(type = SubscriptionPersistence.class)
1285    protected SubscriptionPersistence subscriptionPersistence;
1286    @BeanReference(type = TicketPersistence.class)
1287    protected TicketPersistence ticketPersistence;
1288    @BeanReference(type = TeamPersistence.class)
1289    protected TeamPersistence teamPersistence;
1290    @BeanReference(type = UserPersistence.class)
1291    protected UserPersistence userPersistence;
1292    @BeanReference(type = UserGroupPersistence.class)
1293    protected UserGroupPersistence userGroupPersistence;
1294    @BeanReference(type = UserGroupGroupRolePersistence.class)
1295    protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
1296    @BeanReference(type = UserGroupRolePersistence.class)
1297    protected UserGroupRolePersistence userGroupRolePersistence;
1298    @BeanReference(type = UserIdMapperPersistence.class)
1299    protected UserIdMapperPersistence userIdMapperPersistence;
1300    @BeanReference(type = UserTrackerPersistence.class)
1301    protected UserTrackerPersistence userTrackerPersistence;
1302    @BeanReference(type = UserTrackerPathPersistence.class)
1303    protected UserTrackerPathPersistence userTrackerPathPersistence;
1304    @BeanReference(type = WebDAVPropsPersistence.class)
1305    protected WebDAVPropsPersistence webDAVPropsPersistence;
1306    @BeanReference(type = WebsitePersistence.class)
1307    protected WebsitePersistence websitePersistence;
1308    @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
1309    protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
1310    @BeanReference(type = WorkflowInstanceLinkPersistence.class)
1311    protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
1312    private static final String _SQL_SELECT_LAYOUTSET = "SELECT layoutSet FROM LayoutSet layoutSet";
1313    private static final String _SQL_SELECT_LAYOUTSET_WHERE = "SELECT layoutSet FROM LayoutSet layoutSet WHERE ";
1314    private static final String _SQL_COUNT_LAYOUTSET = "SELECT COUNT(layoutSet) FROM LayoutSet layoutSet";
1315    private static final String _SQL_COUNT_LAYOUTSET_WHERE = "SELECT COUNT(layoutSet) FROM LayoutSet layoutSet WHERE ";
1316    private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "layoutSet.groupId = ?";
1317    private static final String _FINDER_COLUMN_VIRTUALHOST_VIRTUALHOST_1 = "layoutSet.virtualHost IS NULL";
1318    private static final String _FINDER_COLUMN_VIRTUALHOST_VIRTUALHOST_2 = "layoutSet.virtualHost = ?";
1319    private static final String _FINDER_COLUMN_VIRTUALHOST_VIRTUALHOST_3 = "(layoutSet.virtualHost IS NULL OR layoutSet.virtualHost = ?)";
1320    private static final String _FINDER_COLUMN_G_P_GROUPID_2 = "layoutSet.groupId = ? AND ";
1321    private static final String _FINDER_COLUMN_G_P_PRIVATELAYOUT_2 = "layoutSet.privateLayout = ?";
1322    private static final String _ORDER_BY_ENTITY_ALIAS = "layoutSet.";
1323    private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No LayoutSet exists with the primary key ";
1324    private static final String _NO_SUCH_ENTITY_WITH_KEY = "No LayoutSet exists with the key {";
1325    private static Log _log = LogFactoryUtil.getLog(LayoutSetPersistenceImpl.class);
1326}