001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.service.persistence;
016    
017    import com.liferay.portal.NoSuchLayoutSetPrototypeException;
018    import com.liferay.portal.NoSuchModelException;
019    import com.liferay.portal.kernel.annotation.BeanReference;
020    import com.liferay.portal.kernel.cache.CacheRegistryUtil;
021    import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
022    import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
023    import com.liferay.portal.kernel.dao.orm.FinderPath;
024    import com.liferay.portal.kernel.dao.orm.Query;
025    import com.liferay.portal.kernel.dao.orm.QueryPos;
026    import com.liferay.portal.kernel.dao.orm.QueryUtil;
027    import com.liferay.portal.kernel.dao.orm.SQLQuery;
028    import com.liferay.portal.kernel.dao.orm.Session;
029    import com.liferay.portal.kernel.exception.SystemException;
030    import com.liferay.portal.kernel.log.Log;
031    import com.liferay.portal.kernel.log.LogFactoryUtil;
032    import com.liferay.portal.kernel.util.GetterUtil;
033    import com.liferay.portal.kernel.util.InstanceFactory;
034    import com.liferay.portal.kernel.util.OrderByComparator;
035    import com.liferay.portal.kernel.util.StringBundler;
036    import com.liferay.portal.kernel.util.StringPool;
037    import com.liferay.portal.kernel.util.StringUtil;
038    import com.liferay.portal.model.LayoutSetPrototype;
039    import com.liferay.portal.model.ModelListener;
040    import com.liferay.portal.model.impl.LayoutSetPrototypeImpl;
041    import com.liferay.portal.model.impl.LayoutSetPrototypeModelImpl;
042    import com.liferay.portal.security.permission.InlineSQLHelperUtil;
043    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
044    
045    import java.io.Serializable;
046    
047    import java.util.ArrayList;
048    import java.util.Collections;
049    import java.util.List;
050    
051    /**
052     * The persistence implementation for the layout set prototype service.
053     *
054     * <p>
055     * Never modify or reference this class directly. Always use {@link LayoutSetPrototypeUtil} to access the layout set prototype persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
056     * </p>
057     *
058     * <p>
059     * Caching information and settings can be found in <code>portal.properties</code>
060     * </p>
061     *
062     * @author Brian Wing Shun Chan
063     * @see LayoutSetPrototypePersistence
064     * @see LayoutSetPrototypeUtil
065     * @generated
066     */
067    public class LayoutSetPrototypePersistenceImpl extends BasePersistenceImpl<LayoutSetPrototype>
068            implements LayoutSetPrototypePersistence {
069            public static final String FINDER_CLASS_NAME_ENTITY = LayoutSetPrototypeImpl.class.getName();
070            public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
071                    ".List";
072            public static final FinderPath FINDER_PATH_FIND_BY_COMPANYID = new FinderPath(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
073                            LayoutSetPrototypeModelImpl.FINDER_CACHE_ENABLED,
074                            FINDER_CLASS_NAME_LIST, "findByCompanyId",
075                            new String[] {
076                                    Long.class.getName(),
077                                    
078                            "java.lang.Integer", "java.lang.Integer",
079                                    "com.liferay.portal.kernel.util.OrderByComparator"
080                            });
081            public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
082                            LayoutSetPrototypeModelImpl.FINDER_CACHE_ENABLED,
083                            FINDER_CLASS_NAME_LIST, "countByCompanyId",
084                            new String[] { Long.class.getName() });
085            public static final FinderPath FINDER_PATH_FIND_BY_C_A = new FinderPath(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
086                            LayoutSetPrototypeModelImpl.FINDER_CACHE_ENABLED,
087                            FINDER_CLASS_NAME_LIST, "findByC_A",
088                            new String[] {
089                                    Long.class.getName(), Boolean.class.getName(),
090                                    
091                            "java.lang.Integer", "java.lang.Integer",
092                                    "com.liferay.portal.kernel.util.OrderByComparator"
093                            });
094            public static final FinderPath FINDER_PATH_COUNT_BY_C_A = new FinderPath(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
095                            LayoutSetPrototypeModelImpl.FINDER_CACHE_ENABLED,
096                            FINDER_CLASS_NAME_LIST, "countByC_A",
097                            new String[] { Long.class.getName(), Boolean.class.getName() });
098            public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
099                            LayoutSetPrototypeModelImpl.FINDER_CACHE_ENABLED,
100                            FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
101            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
102                            LayoutSetPrototypeModelImpl.FINDER_CACHE_ENABLED,
103                            FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
104    
105            /**
106             * Caches the layout set prototype in the entity cache if it is enabled.
107             *
108             * @param layoutSetPrototype the layout set prototype to cache
109             */
110            public void cacheResult(LayoutSetPrototype layoutSetPrototype) {
111                    EntityCacheUtil.putResult(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
112                            LayoutSetPrototypeImpl.class, layoutSetPrototype.getPrimaryKey(),
113                            layoutSetPrototype);
114            }
115    
116            /**
117             * Caches the layout set prototypes in the entity cache if it is enabled.
118             *
119             * @param layoutSetPrototypes the layout set prototypes to cache
120             */
121            public void cacheResult(List<LayoutSetPrototype> layoutSetPrototypes) {
122                    for (LayoutSetPrototype layoutSetPrototype : layoutSetPrototypes) {
123                            if (EntityCacheUtil.getResult(
124                                                    LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
125                                                    LayoutSetPrototypeImpl.class,
126                                                    layoutSetPrototype.getPrimaryKey(), this) == null) {
127                                    cacheResult(layoutSetPrototype);
128                            }
129                    }
130            }
131    
132            /**
133             * Clears the cache for all layout set prototypes.
134             *
135             * <p>
136             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
137             * </p>
138             */
139            public void clearCache() {
140                    CacheRegistryUtil.clear(LayoutSetPrototypeImpl.class.getName());
141                    EntityCacheUtil.clearCache(LayoutSetPrototypeImpl.class.getName());
142                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
143                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
144            }
145    
146            /**
147             * Clears the cache for the layout set prototype.
148             *
149             * <p>
150             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
151             * </p>
152             */
153            public void clearCache(LayoutSetPrototype layoutSetPrototype) {
154                    EntityCacheUtil.removeResult(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
155                            LayoutSetPrototypeImpl.class, layoutSetPrototype.getPrimaryKey());
156            }
157    
158            /**
159             * Creates a new layout set prototype with the primary key. Does not add the layout set prototype to the database.
160             *
161             * @param layoutSetPrototypeId the primary key for the new layout set prototype
162             * @return the new layout set prototype
163             */
164            public LayoutSetPrototype create(long layoutSetPrototypeId) {
165                    LayoutSetPrototype layoutSetPrototype = new LayoutSetPrototypeImpl();
166    
167                    layoutSetPrototype.setNew(true);
168                    layoutSetPrototype.setPrimaryKey(layoutSetPrototypeId);
169    
170                    return layoutSetPrototype;
171            }
172    
173            /**
174             * Removes the layout set prototype with the primary key from the database. Also notifies the appropriate model listeners.
175             *
176             * @param primaryKey the primary key of the layout set prototype to remove
177             * @return the layout set prototype that was removed
178             * @throws com.liferay.portal.NoSuchModelException if a layout set prototype with the primary key could not be found
179             * @throws SystemException if a system exception occurred
180             */
181            public LayoutSetPrototype remove(Serializable primaryKey)
182                    throws NoSuchModelException, SystemException {
183                    return remove(((Long)primaryKey).longValue());
184            }
185    
186            /**
187             * Removes the layout set prototype with the primary key from the database. Also notifies the appropriate model listeners.
188             *
189             * @param layoutSetPrototypeId the primary key of the layout set prototype to remove
190             * @return the layout set prototype that was removed
191             * @throws com.liferay.portal.NoSuchLayoutSetPrototypeException if a layout set prototype with the primary key could not be found
192             * @throws SystemException if a system exception occurred
193             */
194            public LayoutSetPrototype remove(long layoutSetPrototypeId)
195                    throws NoSuchLayoutSetPrototypeException, SystemException {
196                    Session session = null;
197    
198                    try {
199                            session = openSession();
200    
201                            LayoutSetPrototype layoutSetPrototype = (LayoutSetPrototype)session.get(LayoutSetPrototypeImpl.class,
202                                            new Long(layoutSetPrototypeId));
203    
204                            if (layoutSetPrototype == null) {
205                                    if (_log.isWarnEnabled()) {
206                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
207                                                    layoutSetPrototypeId);
208                                    }
209    
210                                    throw new NoSuchLayoutSetPrototypeException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
211                                            layoutSetPrototypeId);
212                            }
213    
214                            return remove(layoutSetPrototype);
215                    }
216                    catch (NoSuchLayoutSetPrototypeException nsee) {
217                            throw nsee;
218                    }
219                    catch (Exception e) {
220                            throw processException(e);
221                    }
222                    finally {
223                            closeSession(session);
224                    }
225            }
226    
227            protected LayoutSetPrototype removeImpl(
228                    LayoutSetPrototype layoutSetPrototype) throws SystemException {
229                    layoutSetPrototype = toUnwrappedModel(layoutSetPrototype);
230    
231                    Session session = null;
232    
233                    try {
234                            session = openSession();
235    
236                            BatchSessionUtil.delete(session, layoutSetPrototype);
237                    }
238                    catch (Exception e) {
239                            throw processException(e);
240                    }
241                    finally {
242                            closeSession(session);
243                    }
244    
245                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
246    
247                    EntityCacheUtil.removeResult(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
248                            LayoutSetPrototypeImpl.class, layoutSetPrototype.getPrimaryKey());
249    
250                    return layoutSetPrototype;
251            }
252    
253            public LayoutSetPrototype updateImpl(
254                    com.liferay.portal.model.LayoutSetPrototype layoutSetPrototype,
255                    boolean merge) throws SystemException {
256                    layoutSetPrototype = toUnwrappedModel(layoutSetPrototype);
257    
258                    Session session = null;
259    
260                    try {
261                            session = openSession();
262    
263                            BatchSessionUtil.update(session, layoutSetPrototype, merge);
264    
265                            layoutSetPrototype.setNew(false);
266                    }
267                    catch (Exception e) {
268                            throw processException(e);
269                    }
270                    finally {
271                            closeSession(session);
272                    }
273    
274                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
275    
276                    EntityCacheUtil.putResult(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
277                            LayoutSetPrototypeImpl.class, layoutSetPrototype.getPrimaryKey(),
278                            layoutSetPrototype);
279    
280                    return layoutSetPrototype;
281            }
282    
283            protected LayoutSetPrototype toUnwrappedModel(
284                    LayoutSetPrototype layoutSetPrototype) {
285                    if (layoutSetPrototype instanceof LayoutSetPrototypeImpl) {
286                            return layoutSetPrototype;
287                    }
288    
289                    LayoutSetPrototypeImpl layoutSetPrototypeImpl = new LayoutSetPrototypeImpl();
290    
291                    layoutSetPrototypeImpl.setNew(layoutSetPrototype.isNew());
292                    layoutSetPrototypeImpl.setPrimaryKey(layoutSetPrototype.getPrimaryKey());
293    
294                    layoutSetPrototypeImpl.setLayoutSetPrototypeId(layoutSetPrototype.getLayoutSetPrototypeId());
295                    layoutSetPrototypeImpl.setCompanyId(layoutSetPrototype.getCompanyId());
296                    layoutSetPrototypeImpl.setName(layoutSetPrototype.getName());
297                    layoutSetPrototypeImpl.setDescription(layoutSetPrototype.getDescription());
298                    layoutSetPrototypeImpl.setSettings(layoutSetPrototype.getSettings());
299                    layoutSetPrototypeImpl.setActive(layoutSetPrototype.isActive());
300    
301                    return layoutSetPrototypeImpl;
302            }
303    
304            /**
305             * Finds the layout set prototype with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
306             *
307             * @param primaryKey the primary key of the layout set prototype to find
308             * @return the layout set prototype
309             * @throws com.liferay.portal.NoSuchModelException if a layout set prototype with the primary key could not be found
310             * @throws SystemException if a system exception occurred
311             */
312            public LayoutSetPrototype findByPrimaryKey(Serializable primaryKey)
313                    throws NoSuchModelException, SystemException {
314                    return findByPrimaryKey(((Long)primaryKey).longValue());
315            }
316    
317            /**
318             * Finds the layout set prototype with the primary key or throws a {@link com.liferay.portal.NoSuchLayoutSetPrototypeException} if it could not be found.
319             *
320             * @param layoutSetPrototypeId the primary key of the layout set prototype to find
321             * @return the layout set prototype
322             * @throws com.liferay.portal.NoSuchLayoutSetPrototypeException if a layout set prototype with the primary key could not be found
323             * @throws SystemException if a system exception occurred
324             */
325            public LayoutSetPrototype findByPrimaryKey(long layoutSetPrototypeId)
326                    throws NoSuchLayoutSetPrototypeException, SystemException {
327                    LayoutSetPrototype layoutSetPrototype = fetchByPrimaryKey(layoutSetPrototypeId);
328    
329                    if (layoutSetPrototype == null) {
330                            if (_log.isWarnEnabled()) {
331                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
332                                            layoutSetPrototypeId);
333                            }
334    
335                            throw new NoSuchLayoutSetPrototypeException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
336                                    layoutSetPrototypeId);
337                    }
338    
339                    return layoutSetPrototype;
340            }
341    
342            /**
343             * Finds the layout set prototype with the primary key or returns <code>null</code> if it could not be found.
344             *
345             * @param primaryKey the primary key of the layout set prototype to find
346             * @return the layout set prototype, or <code>null</code> if a layout set prototype with the primary key could not be found
347             * @throws SystemException if a system exception occurred
348             */
349            public LayoutSetPrototype fetchByPrimaryKey(Serializable primaryKey)
350                    throws SystemException {
351                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
352            }
353    
354            /**
355             * Finds the layout set prototype with the primary key or returns <code>null</code> if it could not be found.
356             *
357             * @param layoutSetPrototypeId the primary key of the layout set prototype to find
358             * @return the layout set prototype, or <code>null</code> if a layout set prototype with the primary key could not be found
359             * @throws SystemException if a system exception occurred
360             */
361            public LayoutSetPrototype fetchByPrimaryKey(long layoutSetPrototypeId)
362                    throws SystemException {
363                    LayoutSetPrototype layoutSetPrototype = (LayoutSetPrototype)EntityCacheUtil.getResult(LayoutSetPrototypeModelImpl.ENTITY_CACHE_ENABLED,
364                                    LayoutSetPrototypeImpl.class, layoutSetPrototypeId, this);
365    
366                    if (layoutSetPrototype == null) {
367                            Session session = null;
368    
369                            try {
370                                    session = openSession();
371    
372                                    layoutSetPrototype = (LayoutSetPrototype)session.get(LayoutSetPrototypeImpl.class,
373                                                    new Long(layoutSetPrototypeId));
374                            }
375                            catch (Exception e) {
376                                    throw processException(e);
377                            }
378                            finally {
379                                    if (layoutSetPrototype != null) {
380                                            cacheResult(layoutSetPrototype);
381                                    }
382    
383                                    closeSession(session);
384                            }
385                    }
386    
387                    return layoutSetPrototype;
388            }
389    
390            /**
391             * Finds all the layout set prototypes where companyId = &#63;.
392             *
393             * @param companyId the company id to search with
394             * @return the matching layout set prototypes
395             * @throws SystemException if a system exception occurred
396             */
397            public List<LayoutSetPrototype> findByCompanyId(long companyId)
398                    throws SystemException {
399                    return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
400                            null);
401            }
402    
403            /**
404             * Finds a range of all the layout set prototypes where companyId = &#63;.
405             *
406             * <p>
407             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
408             * </p>
409             *
410             * @param companyId the company id to search with
411             * @param start the lower bound of the range of layout set prototypes to return
412             * @param end the upper bound of the range of layout set prototypes to return (not inclusive)
413             * @return the range of matching layout set prototypes
414             * @throws SystemException if a system exception occurred
415             */
416            public List<LayoutSetPrototype> findByCompanyId(long companyId, int start,
417                    int end) throws SystemException {
418                    return findByCompanyId(companyId, start, end, null);
419            }
420    
421            /**
422             * Finds an ordered range of all the layout set prototypes where companyId = &#63;.
423             *
424             * <p>
425             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
426             * </p>
427             *
428             * @param companyId the company id to search with
429             * @param start the lower bound of the range of layout set prototypes to return
430             * @param end the upper bound of the range of layout set prototypes to return (not inclusive)
431             * @param orderByComparator the comparator to order the results by
432             * @return the ordered range of matching layout set prototypes
433             * @throws SystemException if a system exception occurred
434             */
435            public List<LayoutSetPrototype> findByCompanyId(long companyId, int start,
436                    int end, OrderByComparator orderByComparator) throws SystemException {
437                    Object[] finderArgs = new Object[] {
438                                    companyId,
439                                    
440                                    String.valueOf(start), String.valueOf(end),
441                                    String.valueOf(orderByComparator)
442                            };
443    
444                    List<LayoutSetPrototype> list = (List<LayoutSetPrototype>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
445                                    finderArgs, this);
446    
447                    if (list == null) {
448                            StringBundler query = null;
449    
450                            if (orderByComparator != null) {
451                                    query = new StringBundler(3 +
452                                                    (orderByComparator.getOrderByFields().length * 3));
453                            }
454                            else {
455                                    query = new StringBundler(2);
456                            }
457    
458                            query.append(_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
459    
460                            query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
461    
462                            if (orderByComparator != null) {
463                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
464                                            orderByComparator);
465                            }
466    
467                            String sql = query.toString();
468    
469                            Session session = null;
470    
471                            try {
472                                    session = openSession();
473    
474                                    Query q = session.createQuery(sql);
475    
476                                    QueryPos qPos = QueryPos.getInstance(q);
477    
478                                    qPos.add(companyId);
479    
480                                    list = (List<LayoutSetPrototype>)QueryUtil.list(q,
481                                                    getDialect(), start, end);
482                            }
483                            catch (Exception e) {
484                                    throw processException(e);
485                            }
486                            finally {
487                                    if (list == null) {
488                                            FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_COMPANYID,
489                                                    finderArgs);
490                                    }
491                                    else {
492                                            cacheResult(list);
493    
494                                            FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
495                                                    finderArgs, list);
496                                    }
497    
498                                    closeSession(session);
499                            }
500                    }
501    
502                    return list;
503            }
504    
505            /**
506             * Finds the first layout set prototype in the ordered set where companyId = &#63;.
507             *
508             * <p>
509             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
510             * </p>
511             *
512             * @param companyId the company id to search with
513             * @param orderByComparator the comparator to order the set by
514             * @return the first matching layout set prototype
515             * @throws com.liferay.portal.NoSuchLayoutSetPrototypeException if a matching layout set prototype could not be found
516             * @throws SystemException if a system exception occurred
517             */
518            public LayoutSetPrototype findByCompanyId_First(long companyId,
519                    OrderByComparator orderByComparator)
520                    throws NoSuchLayoutSetPrototypeException, SystemException {
521                    List<LayoutSetPrototype> list = findByCompanyId(companyId, 0, 1,
522                                    orderByComparator);
523    
524                    if (list.isEmpty()) {
525                            StringBundler msg = new StringBundler(4);
526    
527                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
528    
529                            msg.append("companyId=");
530                            msg.append(companyId);
531    
532                            msg.append(StringPool.CLOSE_CURLY_BRACE);
533    
534                            throw new NoSuchLayoutSetPrototypeException(msg.toString());
535                    }
536                    else {
537                            return list.get(0);
538                    }
539            }
540    
541            /**
542             * Finds the last layout set prototype in the ordered set where companyId = &#63;.
543             *
544             * <p>
545             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
546             * </p>
547             *
548             * @param companyId the company id to search with
549             * @param orderByComparator the comparator to order the set by
550             * @return the last matching layout set prototype
551             * @throws com.liferay.portal.NoSuchLayoutSetPrototypeException if a matching layout set prototype could not be found
552             * @throws SystemException if a system exception occurred
553             */
554            public LayoutSetPrototype findByCompanyId_Last(long companyId,
555                    OrderByComparator orderByComparator)
556                    throws NoSuchLayoutSetPrototypeException, SystemException {
557                    int count = countByCompanyId(companyId);
558    
559                    List<LayoutSetPrototype> list = findByCompanyId(companyId, count - 1,
560                                    count, orderByComparator);
561    
562                    if (list.isEmpty()) {
563                            StringBundler msg = new StringBundler(4);
564    
565                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
566    
567                            msg.append("companyId=");
568                            msg.append(companyId);
569    
570                            msg.append(StringPool.CLOSE_CURLY_BRACE);
571    
572                            throw new NoSuchLayoutSetPrototypeException(msg.toString());
573                    }
574                    else {
575                            return list.get(0);
576                    }
577            }
578    
579            /**
580             * Finds the layout set prototypes before and after the current layout set prototype in the ordered set where companyId = &#63;.
581             *
582             * <p>
583             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
584             * </p>
585             *
586             * @param layoutSetPrototypeId the primary key of the current layout set prototype
587             * @param companyId the company id to search with
588             * @param orderByComparator the comparator to order the set by
589             * @return the previous, current, and next layout set prototype
590             * @throws com.liferay.portal.NoSuchLayoutSetPrototypeException if a layout set prototype with the primary key could not be found
591             * @throws SystemException if a system exception occurred
592             */
593            public LayoutSetPrototype[] findByCompanyId_PrevAndNext(
594                    long layoutSetPrototypeId, long companyId,
595                    OrderByComparator orderByComparator)
596                    throws NoSuchLayoutSetPrototypeException, SystemException {
597                    LayoutSetPrototype layoutSetPrototype = findByPrimaryKey(layoutSetPrototypeId);
598    
599                    Session session = null;
600    
601                    try {
602                            session = openSession();
603    
604                            LayoutSetPrototype[] array = new LayoutSetPrototypeImpl[3];
605    
606                            array[0] = getByCompanyId_PrevAndNext(session, layoutSetPrototype,
607                                            companyId, orderByComparator, true);
608    
609                            array[1] = layoutSetPrototype;
610    
611                            array[2] = getByCompanyId_PrevAndNext(session, layoutSetPrototype,
612                                            companyId, orderByComparator, false);
613    
614                            return array;
615                    }
616                    catch (Exception e) {
617                            throw processException(e);
618                    }
619                    finally {
620                            closeSession(session);
621                    }
622            }
623    
624            protected LayoutSetPrototype getByCompanyId_PrevAndNext(Session session,
625                    LayoutSetPrototype layoutSetPrototype, long companyId,
626                    OrderByComparator orderByComparator, boolean previous) {
627                    StringBundler query = null;
628    
629                    if (orderByComparator != null) {
630                            query = new StringBundler(6 +
631                                            (orderByComparator.getOrderByFields().length * 6));
632                    }
633                    else {
634                            query = new StringBundler(3);
635                    }
636    
637                    query.append(_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
638    
639                    query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
640    
641                    if (orderByComparator != null) {
642                            String[] orderByFields = orderByComparator.getOrderByFields();
643    
644                            if (orderByFields.length > 0) {
645                                    query.append(WHERE_AND);
646                            }
647    
648                            for (int i = 0; i < orderByFields.length; i++) {
649                                    query.append(_ORDER_BY_ENTITY_ALIAS);
650                                    query.append(orderByFields[i]);
651    
652                                    if ((i + 1) < orderByFields.length) {
653                                            if (orderByComparator.isAscending() ^ previous) {
654                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
655                                            }
656                                            else {
657                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
658                                            }
659                                    }
660                                    else {
661                                            if (orderByComparator.isAscending() ^ previous) {
662                                                    query.append(WHERE_GREATER_THAN);
663                                            }
664                                            else {
665                                                    query.append(WHERE_LESSER_THAN);
666                                            }
667                                    }
668                            }
669    
670                            query.append(ORDER_BY_CLAUSE);
671    
672                            for (int i = 0; i < orderByFields.length; i++) {
673                                    query.append(_ORDER_BY_ENTITY_ALIAS);
674                                    query.append(orderByFields[i]);
675    
676                                    if ((i + 1) < orderByFields.length) {
677                                            if (orderByComparator.isAscending() ^ previous) {
678                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
679                                            }
680                                            else {
681                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
682                                            }
683                                    }
684                                    else {
685                                            if (orderByComparator.isAscending() ^ previous) {
686                                                    query.append(ORDER_BY_ASC);
687                                            }
688                                            else {
689                                                    query.append(ORDER_BY_DESC);
690                                            }
691                                    }
692                            }
693                    }
694    
695                    String sql = query.toString();
696    
697                    Query q = session.createQuery(sql);
698    
699                    q.setFirstResult(0);
700                    q.setMaxResults(2);
701    
702                    QueryPos qPos = QueryPos.getInstance(q);
703    
704                    qPos.add(companyId);
705    
706                    if (orderByComparator != null) {
707                            Object[] values = orderByComparator.getOrderByValues(layoutSetPrototype);
708    
709                            for (Object value : values) {
710                                    qPos.add(value);
711                            }
712                    }
713    
714                    List<LayoutSetPrototype> list = q.list();
715    
716                    if (list.size() == 2) {
717                            return list.get(1);
718                    }
719                    else {
720                            return null;
721                    }
722            }
723    
724            /**
725             * Filters by the user's permissions and finds all the layout set prototypes where companyId = &#63;.
726             *
727             * @param companyId the company id to search with
728             * @return the matching layout set prototypes that the user has permission to view
729             * @throws SystemException if a system exception occurred
730             */
731            public List<LayoutSetPrototype> filterFindByCompanyId(long companyId)
732                    throws SystemException {
733                    return filterFindByCompanyId(companyId, QueryUtil.ALL_POS,
734                            QueryUtil.ALL_POS, null);
735            }
736    
737            /**
738             * Filters by the user's permissions and finds a range of all the layout set prototypes where companyId = &#63;.
739             *
740             * <p>
741             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
742             * </p>
743             *
744             * @param companyId the company id to search with
745             * @param start the lower bound of the range of layout set prototypes to return
746             * @param end the upper bound of the range of layout set prototypes to return (not inclusive)
747             * @return the range of matching layout set prototypes that the user has permission to view
748             * @throws SystemException if a system exception occurred
749             */
750            public List<LayoutSetPrototype> filterFindByCompanyId(long companyId,
751                    int start, int end) throws SystemException {
752                    return filterFindByCompanyId(companyId, start, end, null);
753            }
754    
755            /**
756             * Filters by the user's permissions and finds an ordered range of all the layout set prototypes where companyId = &#63;.
757             *
758             * <p>
759             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
760             * </p>
761             *
762             * @param companyId the company id to search with
763             * @param start the lower bound of the range of layout set prototypes to return
764             * @param end the upper bound of the range of layout set prototypes to return (not inclusive)
765             * @param orderByComparator the comparator to order the results by
766             * @return the ordered range of matching layout set prototypes that the user has permission to view
767             * @throws SystemException if a system exception occurred
768             */
769            public List<LayoutSetPrototype> filterFindByCompanyId(long companyId,
770                    int start, int end, OrderByComparator orderByComparator)
771                    throws SystemException {
772                    if (!InlineSQLHelperUtil.isEnabled()) {
773                            return findByCompanyId(companyId, start, end, orderByComparator);
774                    }
775    
776                    StringBundler query = null;
777    
778                    if (orderByComparator != null) {
779                            query = new StringBundler(3 +
780                                            (orderByComparator.getOrderByFields().length * 3));
781                    }
782                    else {
783                            query = new StringBundler(2);
784                    }
785    
786                    if (getDB().isSupportsInlineDistinct()) {
787                            query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
788                    }
789                    else {
790                            query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1);
791                    }
792    
793                    query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
794    
795                    if (!getDB().isSupportsInlineDistinct()) {
796                            query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2);
797                    }
798    
799                    if (orderByComparator != null) {
800                            if (getDB().isSupportsInlineDistinct()) {
801                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
802                                            orderByComparator);
803                            }
804                            else {
805                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
806                                            orderByComparator);
807                            }
808                    }
809    
810                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
811                                    LayoutSetPrototype.class.getName(), _FILTER_COLUMN_PK,
812                                    _FILTER_COLUMN_USERID);
813    
814                    Session session = null;
815    
816                    try {
817                            session = openSession();
818    
819                            SQLQuery q = session.createSQLQuery(sql);
820    
821                            if (getDB().isSupportsInlineDistinct()) {
822                                    q.addEntity(_FILTER_ENTITY_ALIAS, LayoutSetPrototypeImpl.class);
823                            }
824                            else {
825                                    q.addEntity(_FILTER_ENTITY_TABLE, LayoutSetPrototypeImpl.class);
826                            }
827    
828                            QueryPos qPos = QueryPos.getInstance(q);
829    
830                            qPos.add(companyId);
831    
832                            return (List<LayoutSetPrototype>)QueryUtil.list(q, getDialect(),
833                                    start, end);
834                    }
835                    catch (Exception e) {
836                            throw processException(e);
837                    }
838                    finally {
839                            closeSession(session);
840                    }
841            }
842    
843            /**
844             * Finds all the layout set prototypes where companyId = &#63; and active = &#63;.
845             *
846             * @param companyId the company id to search with
847             * @param active the active to search with
848             * @return the matching layout set prototypes
849             * @throws SystemException if a system exception occurred
850             */
851            public List<LayoutSetPrototype> findByC_A(long companyId, boolean active)
852                    throws SystemException {
853                    return findByC_A(companyId, active, QueryUtil.ALL_POS,
854                            QueryUtil.ALL_POS, null);
855            }
856    
857            /**
858             * Finds a range of all the layout set prototypes where companyId = &#63; and active = &#63;.
859             *
860             * <p>
861             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
862             * </p>
863             *
864             * @param companyId the company id to search with
865             * @param active the active to search with
866             * @param start the lower bound of the range of layout set prototypes to return
867             * @param end the upper bound of the range of layout set prototypes to return (not inclusive)
868             * @return the range of matching layout set prototypes
869             * @throws SystemException if a system exception occurred
870             */
871            public List<LayoutSetPrototype> findByC_A(long companyId, boolean active,
872                    int start, int end) throws SystemException {
873                    return findByC_A(companyId, active, start, end, null);
874            }
875    
876            /**
877             * Finds an ordered range of all the layout set prototypes where companyId = &#63; and active = &#63;.
878             *
879             * <p>
880             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
881             * </p>
882             *
883             * @param companyId the company id to search with
884             * @param active the active to search with
885             * @param start the lower bound of the range of layout set prototypes to return
886             * @param end the upper bound of the range of layout set prototypes to return (not inclusive)
887             * @param orderByComparator the comparator to order the results by
888             * @return the ordered range of matching layout set prototypes
889             * @throws SystemException if a system exception occurred
890             */
891            public List<LayoutSetPrototype> findByC_A(long companyId, boolean active,
892                    int start, int end, OrderByComparator orderByComparator)
893                    throws SystemException {
894                    Object[] finderArgs = new Object[] {
895                                    companyId, active,
896                                    
897                                    String.valueOf(start), String.valueOf(end),
898                                    String.valueOf(orderByComparator)
899                            };
900    
901                    List<LayoutSetPrototype> list = (List<LayoutSetPrototype>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_A,
902                                    finderArgs, this);
903    
904                    if (list == null) {
905                            StringBundler query = null;
906    
907                            if (orderByComparator != null) {
908                                    query = new StringBundler(4 +
909                                                    (orderByComparator.getOrderByFields().length * 3));
910                            }
911                            else {
912                                    query = new StringBundler(3);
913                            }
914    
915                            query.append(_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
916    
917                            query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
918    
919                            query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
920    
921                            if (orderByComparator != null) {
922                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
923                                            orderByComparator);
924                            }
925    
926                            String sql = query.toString();
927    
928                            Session session = null;
929    
930                            try {
931                                    session = openSession();
932    
933                                    Query q = session.createQuery(sql);
934    
935                                    QueryPos qPos = QueryPos.getInstance(q);
936    
937                                    qPos.add(companyId);
938    
939                                    qPos.add(active);
940    
941                                    list = (List<LayoutSetPrototype>)QueryUtil.list(q,
942                                                    getDialect(), start, end);
943                            }
944                            catch (Exception e) {
945                                    throw processException(e);
946                            }
947                            finally {
948                                    if (list == null) {
949                                            FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_C_A,
950                                                    finderArgs);
951                                    }
952                                    else {
953                                            cacheResult(list);
954    
955                                            FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_A,
956                                                    finderArgs, list);
957                                    }
958    
959                                    closeSession(session);
960                            }
961                    }
962    
963                    return list;
964            }
965    
966            /**
967             * Finds the first layout set prototype in the ordered set where companyId = &#63; and active = &#63;.
968             *
969             * <p>
970             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
971             * </p>
972             *
973             * @param companyId the company id to search with
974             * @param active the active to search with
975             * @param orderByComparator the comparator to order the set by
976             * @return the first matching layout set prototype
977             * @throws com.liferay.portal.NoSuchLayoutSetPrototypeException if a matching layout set prototype could not be found
978             * @throws SystemException if a system exception occurred
979             */
980            public LayoutSetPrototype findByC_A_First(long companyId, boolean active,
981                    OrderByComparator orderByComparator)
982                    throws NoSuchLayoutSetPrototypeException, SystemException {
983                    List<LayoutSetPrototype> list = findByC_A(companyId, active, 0, 1,
984                                    orderByComparator);
985    
986                    if (list.isEmpty()) {
987                            StringBundler msg = new StringBundler(6);
988    
989                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
990    
991                            msg.append("companyId=");
992                            msg.append(companyId);
993    
994                            msg.append(", active=");
995                            msg.append(active);
996    
997                            msg.append(StringPool.CLOSE_CURLY_BRACE);
998    
999                            throw new NoSuchLayoutSetPrototypeException(msg.toString());
1000                    }
1001                    else {
1002                            return list.get(0);
1003                    }
1004            }
1005    
1006            /**
1007             * Finds the last layout set prototype in the ordered set where companyId = &#63; and active = &#63;.
1008             *
1009             * <p>
1010             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1011             * </p>
1012             *
1013             * @param companyId the company id to search with
1014             * @param active the active to search with
1015             * @param orderByComparator the comparator to order the set by
1016             * @return the last matching layout set prototype
1017             * @throws com.liferay.portal.NoSuchLayoutSetPrototypeException if a matching layout set prototype could not be found
1018             * @throws SystemException if a system exception occurred
1019             */
1020            public LayoutSetPrototype findByC_A_Last(long companyId, boolean active,
1021                    OrderByComparator orderByComparator)
1022                    throws NoSuchLayoutSetPrototypeException, SystemException {
1023                    int count = countByC_A(companyId, active);
1024    
1025                    List<LayoutSetPrototype> list = findByC_A(companyId, active, count - 1,
1026                                    count, orderByComparator);
1027    
1028                    if (list.isEmpty()) {
1029                            StringBundler msg = new StringBundler(6);
1030    
1031                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1032    
1033                            msg.append("companyId=");
1034                            msg.append(companyId);
1035    
1036                            msg.append(", active=");
1037                            msg.append(active);
1038    
1039                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1040    
1041                            throw new NoSuchLayoutSetPrototypeException(msg.toString());
1042                    }
1043                    else {
1044                            return list.get(0);
1045                    }
1046            }
1047    
1048            /**
1049             * Finds the layout set prototypes before and after the current layout set prototype in the ordered set where companyId = &#63; and active = &#63;.
1050             *
1051             * <p>
1052             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1053             * </p>
1054             *
1055             * @param layoutSetPrototypeId the primary key of the current layout set prototype
1056             * @param companyId the company id to search with
1057             * @param active the active to search with
1058             * @param orderByComparator the comparator to order the set by
1059             * @return the previous, current, and next layout set prototype
1060             * @throws com.liferay.portal.NoSuchLayoutSetPrototypeException if a layout set prototype with the primary key could not be found
1061             * @throws SystemException if a system exception occurred
1062             */
1063            public LayoutSetPrototype[] findByC_A_PrevAndNext(
1064                    long layoutSetPrototypeId, long companyId, boolean active,
1065                    OrderByComparator orderByComparator)
1066                    throws NoSuchLayoutSetPrototypeException, SystemException {
1067                    LayoutSetPrototype layoutSetPrototype = findByPrimaryKey(layoutSetPrototypeId);
1068    
1069                    Session session = null;
1070    
1071                    try {
1072                            session = openSession();
1073    
1074                            LayoutSetPrototype[] array = new LayoutSetPrototypeImpl[3];
1075    
1076                            array[0] = getByC_A_PrevAndNext(session, layoutSetPrototype,
1077                                            companyId, active, orderByComparator, true);
1078    
1079                            array[1] = layoutSetPrototype;
1080    
1081                            array[2] = getByC_A_PrevAndNext(session, layoutSetPrototype,
1082                                            companyId, active, orderByComparator, false);
1083    
1084                            return array;
1085                    }
1086                    catch (Exception e) {
1087                            throw processException(e);
1088                    }
1089                    finally {
1090                            closeSession(session);
1091                    }
1092            }
1093    
1094            protected LayoutSetPrototype getByC_A_PrevAndNext(Session session,
1095                    LayoutSetPrototype layoutSetPrototype, long companyId, boolean active,
1096                    OrderByComparator orderByComparator, boolean previous) {
1097                    StringBundler query = null;
1098    
1099                    if (orderByComparator != null) {
1100                            query = new StringBundler(6 +
1101                                            (orderByComparator.getOrderByFields().length * 6));
1102                    }
1103                    else {
1104                            query = new StringBundler(3);
1105                    }
1106    
1107                    query.append(_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
1108    
1109                    query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
1110    
1111                    query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
1112    
1113                    if (orderByComparator != null) {
1114                            String[] orderByFields = orderByComparator.getOrderByFields();
1115    
1116                            if (orderByFields.length > 0) {
1117                                    query.append(WHERE_AND);
1118                            }
1119    
1120                            for (int i = 0; i < orderByFields.length; i++) {
1121                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1122                                    query.append(orderByFields[i]);
1123    
1124                                    if ((i + 1) < orderByFields.length) {
1125                                            if (orderByComparator.isAscending() ^ previous) {
1126                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1127                                            }
1128                                            else {
1129                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1130                                            }
1131                                    }
1132                                    else {
1133                                            if (orderByComparator.isAscending() ^ previous) {
1134                                                    query.append(WHERE_GREATER_THAN);
1135                                            }
1136                                            else {
1137                                                    query.append(WHERE_LESSER_THAN);
1138                                            }
1139                                    }
1140                            }
1141    
1142                            query.append(ORDER_BY_CLAUSE);
1143    
1144                            for (int i = 0; i < orderByFields.length; i++) {
1145                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1146                                    query.append(orderByFields[i]);
1147    
1148                                    if ((i + 1) < orderByFields.length) {
1149                                            if (orderByComparator.isAscending() ^ previous) {
1150                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1151                                            }
1152                                            else {
1153                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1154                                            }
1155                                    }
1156                                    else {
1157                                            if (orderByComparator.isAscending() ^ previous) {
1158                                                    query.append(ORDER_BY_ASC);
1159                                            }
1160                                            else {
1161                                                    query.append(ORDER_BY_DESC);
1162                                            }
1163                                    }
1164                            }
1165                    }
1166    
1167                    String sql = query.toString();
1168    
1169                    Query q = session.createQuery(sql);
1170    
1171                    q.setFirstResult(0);
1172                    q.setMaxResults(2);
1173    
1174                    QueryPos qPos = QueryPos.getInstance(q);
1175    
1176                    qPos.add(companyId);
1177    
1178                    qPos.add(active);
1179    
1180                    if (orderByComparator != null) {
1181                            Object[] values = orderByComparator.getOrderByValues(layoutSetPrototype);
1182    
1183                            for (Object value : values) {
1184                                    qPos.add(value);
1185                            }
1186                    }
1187    
1188                    List<LayoutSetPrototype> list = q.list();
1189    
1190                    if (list.size() == 2) {
1191                            return list.get(1);
1192                    }
1193                    else {
1194                            return null;
1195                    }
1196            }
1197    
1198            /**
1199             * Filters by the user's permissions and finds all the layout set prototypes where companyId = &#63; and active = &#63;.
1200             *
1201             * @param companyId the company id to search with
1202             * @param active the active to search with
1203             * @return the matching layout set prototypes that the user has permission to view
1204             * @throws SystemException if a system exception occurred
1205             */
1206            public List<LayoutSetPrototype> filterFindByC_A(long companyId,
1207                    boolean active) throws SystemException {
1208                    return filterFindByC_A(companyId, active, QueryUtil.ALL_POS,
1209                            QueryUtil.ALL_POS, null);
1210            }
1211    
1212            /**
1213             * Filters by the user's permissions and finds a range of all the layout set prototypes where companyId = &#63; and active = &#63;.
1214             *
1215             * <p>
1216             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1217             * </p>
1218             *
1219             * @param companyId the company id to search with
1220             * @param active the active to search with
1221             * @param start the lower bound of the range of layout set prototypes to return
1222             * @param end the upper bound of the range of layout set prototypes to return (not inclusive)
1223             * @return the range of matching layout set prototypes that the user has permission to view
1224             * @throws SystemException if a system exception occurred
1225             */
1226            public List<LayoutSetPrototype> filterFindByC_A(long companyId,
1227                    boolean active, int start, int end) throws SystemException {
1228                    return filterFindByC_A(companyId, active, start, end, null);
1229            }
1230    
1231            /**
1232             * Filters by the user's permissions and finds an ordered range of all the layout set prototypes where companyId = &#63; and active = &#63;.
1233             *
1234             * <p>
1235             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1236             * </p>
1237             *
1238             * @param companyId the company id to search with
1239             * @param active the active to search with
1240             * @param start the lower bound of the range of layout set prototypes to return
1241             * @param end the upper bound of the range of layout set prototypes to return (not inclusive)
1242             * @param orderByComparator the comparator to order the results by
1243             * @return the ordered range of matching layout set prototypes that the user has permission to view
1244             * @throws SystemException if a system exception occurred
1245             */
1246            public List<LayoutSetPrototype> filterFindByC_A(long companyId,
1247                    boolean active, int start, int end, OrderByComparator orderByComparator)
1248                    throws SystemException {
1249                    if (!InlineSQLHelperUtil.isEnabled()) {
1250                            return findByC_A(companyId, active, start, end, orderByComparator);
1251                    }
1252    
1253                    StringBundler query = null;
1254    
1255                    if (orderByComparator != null) {
1256                            query = new StringBundler(4 +
1257                                            (orderByComparator.getOrderByFields().length * 3));
1258                    }
1259                    else {
1260                            query = new StringBundler(3);
1261                    }
1262    
1263                    if (getDB().isSupportsInlineDistinct()) {
1264                            query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE);
1265                    }
1266                    else {
1267                            query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1);
1268                    }
1269    
1270                    query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
1271    
1272                    query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
1273    
1274                    if (!getDB().isSupportsInlineDistinct()) {
1275                            query.append(_FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2);
1276                    }
1277    
1278                    if (orderByComparator != null) {
1279                            if (getDB().isSupportsInlineDistinct()) {
1280                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1281                                            orderByComparator);
1282                            }
1283                            else {
1284                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1285                                            orderByComparator);
1286                            }
1287                    }
1288    
1289                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1290                                    LayoutSetPrototype.class.getName(), _FILTER_COLUMN_PK,
1291                                    _FILTER_COLUMN_USERID);
1292    
1293                    Session session = null;
1294    
1295                    try {
1296                            session = openSession();
1297    
1298                            SQLQuery q = session.createSQLQuery(sql);
1299    
1300                            if (getDB().isSupportsInlineDistinct()) {
1301                                    q.addEntity(_FILTER_ENTITY_ALIAS, LayoutSetPrototypeImpl.class);
1302                            }
1303                            else {
1304                                    q.addEntity(_FILTER_ENTITY_TABLE, LayoutSetPrototypeImpl.class);
1305                            }
1306    
1307                            QueryPos qPos = QueryPos.getInstance(q);
1308    
1309                            qPos.add(companyId);
1310    
1311                            qPos.add(active);
1312    
1313                            return (List<LayoutSetPrototype>)QueryUtil.list(q, getDialect(),
1314                                    start, end);
1315                    }
1316                    catch (Exception e) {
1317                            throw processException(e);
1318                    }
1319                    finally {
1320                            closeSession(session);
1321                    }
1322            }
1323    
1324            /**
1325             * Finds all the layout set prototypes.
1326             *
1327             * @return the layout set prototypes
1328             * @throws SystemException if a system exception occurred
1329             */
1330            public List<LayoutSetPrototype> findAll() throws SystemException {
1331                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1332            }
1333    
1334            /**
1335             * Finds a range of all the layout set prototypes.
1336             *
1337             * <p>
1338             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1339             * </p>
1340             *
1341             * @param start the lower bound of the range of layout set prototypes to return
1342             * @param end the upper bound of the range of layout set prototypes to return (not inclusive)
1343             * @return the range of layout set prototypes
1344             * @throws SystemException if a system exception occurred
1345             */
1346            public List<LayoutSetPrototype> findAll(int start, int end)
1347                    throws SystemException {
1348                    return findAll(start, end, null);
1349            }
1350    
1351            /**
1352             * Finds an ordered range of all the layout set prototypes.
1353             *
1354             * <p>
1355             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1356             * </p>
1357             *
1358             * @param start the lower bound of the range of layout set prototypes to return
1359             * @param end the upper bound of the range of layout set prototypes to return (not inclusive)
1360             * @param orderByComparator the comparator to order the results by
1361             * @return the ordered range of layout set prototypes
1362             * @throws SystemException if a system exception occurred
1363             */
1364            public List<LayoutSetPrototype> findAll(int start, int end,
1365                    OrderByComparator orderByComparator) throws SystemException {
1366                    Object[] finderArgs = new Object[] {
1367                                    String.valueOf(start), String.valueOf(end),
1368                                    String.valueOf(orderByComparator)
1369                            };
1370    
1371                    List<LayoutSetPrototype> list = (List<LayoutSetPrototype>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1372                                    finderArgs, this);
1373    
1374                    if (list == null) {
1375                            StringBundler query = null;
1376                            String sql = null;
1377    
1378                            if (orderByComparator != null) {
1379                                    query = new StringBundler(2 +
1380                                                    (orderByComparator.getOrderByFields().length * 3));
1381    
1382                                    query.append(_SQL_SELECT_LAYOUTSETPROTOTYPE);
1383    
1384                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1385                                            orderByComparator);
1386    
1387                                    sql = query.toString();
1388                            }
1389                            else {
1390                                    sql = _SQL_SELECT_LAYOUTSETPROTOTYPE;
1391                            }
1392    
1393                            Session session = null;
1394    
1395                            try {
1396                                    session = openSession();
1397    
1398                                    Query q = session.createQuery(sql);
1399    
1400                                    if (orderByComparator == null) {
1401                                            list = (List<LayoutSetPrototype>)QueryUtil.list(q,
1402                                                            getDialect(), start, end, false);
1403    
1404                                            Collections.sort(list);
1405                                    }
1406                                    else {
1407                                            list = (List<LayoutSetPrototype>)QueryUtil.list(q,
1408                                                            getDialect(), start, end);
1409                                    }
1410                            }
1411                            catch (Exception e) {
1412                                    throw processException(e);
1413                            }
1414                            finally {
1415                                    if (list == null) {
1416                                            FinderCacheUtil.removeResult(FINDER_PATH_FIND_ALL,
1417                                                    finderArgs);
1418                                    }
1419                                    else {
1420                                            cacheResult(list);
1421    
1422                                            FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs,
1423                                                    list);
1424                                    }
1425    
1426                                    closeSession(session);
1427                            }
1428                    }
1429    
1430                    return list;
1431            }
1432    
1433            /**
1434             * Removes all the layout set prototypes where companyId = &#63; from the database.
1435             *
1436             * @param companyId the company id to search with
1437             * @throws SystemException if a system exception occurred
1438             */
1439            public void removeByCompanyId(long companyId) throws SystemException {
1440                    for (LayoutSetPrototype layoutSetPrototype : findByCompanyId(companyId)) {
1441                            remove(layoutSetPrototype);
1442                    }
1443            }
1444    
1445            /**
1446             * Removes all the layout set prototypes where companyId = &#63; and active = &#63; from the database.
1447             *
1448             * @param companyId the company id to search with
1449             * @param active the active to search with
1450             * @throws SystemException if a system exception occurred
1451             */
1452            public void removeByC_A(long companyId, boolean active)
1453                    throws SystemException {
1454                    for (LayoutSetPrototype layoutSetPrototype : findByC_A(companyId, active)) {
1455                            remove(layoutSetPrototype);
1456                    }
1457            }
1458    
1459            /**
1460             * Removes all the layout set prototypes from the database.
1461             *
1462             * @throws SystemException if a system exception occurred
1463             */
1464            public void removeAll() throws SystemException {
1465                    for (LayoutSetPrototype layoutSetPrototype : findAll()) {
1466                            remove(layoutSetPrototype);
1467                    }
1468            }
1469    
1470            /**
1471             * Counts all the layout set prototypes where companyId = &#63;.
1472             *
1473             * @param companyId the company id to search with
1474             * @return the number of matching layout set prototypes
1475             * @throws SystemException if a system exception occurred
1476             */
1477            public int countByCompanyId(long companyId) throws SystemException {
1478                    Object[] finderArgs = new Object[] { companyId };
1479    
1480                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
1481                                    finderArgs, this);
1482    
1483                    if (count == null) {
1484                            StringBundler query = new StringBundler(2);
1485    
1486                            query.append(_SQL_COUNT_LAYOUTSETPROTOTYPE_WHERE);
1487    
1488                            query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1489    
1490                            String sql = query.toString();
1491    
1492                            Session session = null;
1493    
1494                            try {
1495                                    session = openSession();
1496    
1497                                    Query q = session.createQuery(sql);
1498    
1499                                    QueryPos qPos = QueryPos.getInstance(q);
1500    
1501                                    qPos.add(companyId);
1502    
1503                                    count = (Long)q.uniqueResult();
1504                            }
1505                            catch (Exception e) {
1506                                    throw processException(e);
1507                            }
1508                            finally {
1509                                    if (count == null) {
1510                                            count = Long.valueOf(0);
1511                                    }
1512    
1513                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
1514                                            finderArgs, count);
1515    
1516                                    closeSession(session);
1517                            }
1518                    }
1519    
1520                    return count.intValue();
1521            }
1522    
1523            /**
1524             * Filters by the user's permissions and counts all the layout set prototypes where companyId = &#63;.
1525             *
1526             * @param companyId the company id to search with
1527             * @return the number of matching layout set prototypes that the user has permission to view
1528             * @throws SystemException if a system exception occurred
1529             */
1530            public int filterCountByCompanyId(long companyId) throws SystemException {
1531                    if (!InlineSQLHelperUtil.isEnabled()) {
1532                            return countByCompanyId(companyId);
1533                    }
1534    
1535                    StringBundler query = new StringBundler(2);
1536    
1537                    query.append(_FILTER_SQL_COUNT_LAYOUTSETPROTOTYPE_WHERE);
1538    
1539                    query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1540    
1541                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1542                                    LayoutSetPrototype.class.getName(), _FILTER_COLUMN_PK,
1543                                    _FILTER_COLUMN_USERID);
1544    
1545                    Session session = null;
1546    
1547                    try {
1548                            session = openSession();
1549    
1550                            SQLQuery q = session.createSQLQuery(sql);
1551    
1552                            q.addScalar(COUNT_COLUMN_NAME,
1553                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
1554    
1555                            QueryPos qPos = QueryPos.getInstance(q);
1556    
1557                            qPos.add(companyId);
1558    
1559                            Long count = (Long)q.uniqueResult();
1560    
1561                            return count.intValue();
1562                    }
1563                    catch (Exception e) {
1564                            throw processException(e);
1565                    }
1566                    finally {
1567                            closeSession(session);
1568                    }
1569            }
1570    
1571            /**
1572             * Counts all the layout set prototypes where companyId = &#63; and active = &#63;.
1573             *
1574             * @param companyId the company id to search with
1575             * @param active the active to search with
1576             * @return the number of matching layout set prototypes
1577             * @throws SystemException if a system exception occurred
1578             */
1579            public int countByC_A(long companyId, boolean active)
1580                    throws SystemException {
1581                    Object[] finderArgs = new Object[] { companyId, active };
1582    
1583                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_A,
1584                                    finderArgs, this);
1585    
1586                    if (count == null) {
1587                            StringBundler query = new StringBundler(3);
1588    
1589                            query.append(_SQL_COUNT_LAYOUTSETPROTOTYPE_WHERE);
1590    
1591                            query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
1592    
1593                            query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
1594    
1595                            String sql = query.toString();
1596    
1597                            Session session = null;
1598    
1599                            try {
1600                                    session = openSession();
1601    
1602                                    Query q = session.createQuery(sql);
1603    
1604                                    QueryPos qPos = QueryPos.getInstance(q);
1605    
1606                                    qPos.add(companyId);
1607    
1608                                    qPos.add(active);
1609    
1610                                    count = (Long)q.uniqueResult();
1611                            }
1612                            catch (Exception e) {
1613                                    throw processException(e);
1614                            }
1615                            finally {
1616                                    if (count == null) {
1617                                            count = Long.valueOf(0);
1618                                    }
1619    
1620                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_A, finderArgs,
1621                                            count);
1622    
1623                                    closeSession(session);
1624                            }
1625                    }
1626    
1627                    return count.intValue();
1628            }
1629    
1630            /**
1631             * Filters by the user's permissions and counts all the layout set prototypes where companyId = &#63; and active = &#63;.
1632             *
1633             * @param companyId the company id to search with
1634             * @param active the active to search with
1635             * @return the number of matching layout set prototypes that the user has permission to view
1636             * @throws SystemException if a system exception occurred
1637             */
1638            public int filterCountByC_A(long companyId, boolean active)
1639                    throws SystemException {
1640                    if (!InlineSQLHelperUtil.isEnabled()) {
1641                            return countByC_A(companyId, active);
1642                    }
1643    
1644                    StringBundler query = new StringBundler(3);
1645    
1646                    query.append(_FILTER_SQL_COUNT_LAYOUTSETPROTOTYPE_WHERE);
1647    
1648                    query.append(_FINDER_COLUMN_C_A_COMPANYID_2);
1649    
1650                    query.append(_FINDER_COLUMN_C_A_ACTIVE_2);
1651    
1652                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1653                                    LayoutSetPrototype.class.getName(), _FILTER_COLUMN_PK,
1654                                    _FILTER_COLUMN_USERID);
1655    
1656                    Session session = null;
1657    
1658                    try {
1659                            session = openSession();
1660    
1661                            SQLQuery q = session.createSQLQuery(sql);
1662    
1663                            q.addScalar(COUNT_COLUMN_NAME,
1664                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
1665    
1666                            QueryPos qPos = QueryPos.getInstance(q);
1667    
1668                            qPos.add(companyId);
1669    
1670                            qPos.add(active);
1671    
1672                            Long count = (Long)q.uniqueResult();
1673    
1674                            return count.intValue();
1675                    }
1676                    catch (Exception e) {
1677                            throw processException(e);
1678                    }
1679                    finally {
1680                            closeSession(session);
1681                    }
1682            }
1683    
1684            /**
1685             * Counts all the layout set prototypes.
1686             *
1687             * @return the number of layout set prototypes
1688             * @throws SystemException if a system exception occurred
1689             */
1690            public int countAll() throws SystemException {
1691                    Object[] finderArgs = new Object[0];
1692    
1693                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1694                                    finderArgs, this);
1695    
1696                    if (count == null) {
1697                            Session session = null;
1698    
1699                            try {
1700                                    session = openSession();
1701    
1702                                    Query q = session.createQuery(_SQL_COUNT_LAYOUTSETPROTOTYPE);
1703    
1704                                    count = (Long)q.uniqueResult();
1705                            }
1706                            catch (Exception e) {
1707                                    throw processException(e);
1708                            }
1709                            finally {
1710                                    if (count == null) {
1711                                            count = Long.valueOf(0);
1712                                    }
1713    
1714                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
1715                                            count);
1716    
1717                                    closeSession(session);
1718                            }
1719                    }
1720    
1721                    return count.intValue();
1722            }
1723    
1724            /**
1725             * Initializes the layout set prototype persistence.
1726             */
1727            public void afterPropertiesSet() {
1728                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1729                                            com.liferay.portal.util.PropsUtil.get(
1730                                                    "value.object.listener.com.liferay.portal.model.LayoutSetPrototype")));
1731    
1732                    if (listenerClassNames.length > 0) {
1733                            try {
1734                                    List<ModelListener<LayoutSetPrototype>> listenersList = new ArrayList<ModelListener<LayoutSetPrototype>>();
1735    
1736                                    for (String listenerClassName : listenerClassNames) {
1737                                            listenersList.add((ModelListener<LayoutSetPrototype>)InstanceFactory.newInstance(
1738                                                            listenerClassName));
1739                                    }
1740    
1741                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1742                            }
1743                            catch (Exception e) {
1744                                    _log.error(e);
1745                            }
1746                    }
1747            }
1748    
1749            public void destroy() {
1750                    EntityCacheUtil.removeCache(LayoutSetPrototypeImpl.class.getName());
1751                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1752                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST);
1753            }
1754    
1755            @BeanReference(type = AccountPersistence.class)
1756            protected AccountPersistence accountPersistence;
1757            @BeanReference(type = AddressPersistence.class)
1758            protected AddressPersistence addressPersistence;
1759            @BeanReference(type = BrowserTrackerPersistence.class)
1760            protected BrowserTrackerPersistence browserTrackerPersistence;
1761            @BeanReference(type = ClassNamePersistence.class)
1762            protected ClassNamePersistence classNamePersistence;
1763            @BeanReference(type = ClusterGroupPersistence.class)
1764            protected ClusterGroupPersistence clusterGroupPersistence;
1765            @BeanReference(type = CompanyPersistence.class)
1766            protected CompanyPersistence companyPersistence;
1767            @BeanReference(type = ContactPersistence.class)
1768            protected ContactPersistence contactPersistence;
1769            @BeanReference(type = CountryPersistence.class)
1770            protected CountryPersistence countryPersistence;
1771            @BeanReference(type = EmailAddressPersistence.class)
1772            protected EmailAddressPersistence emailAddressPersistence;
1773            @BeanReference(type = GroupPersistence.class)
1774            protected GroupPersistence groupPersistence;
1775            @BeanReference(type = ImagePersistence.class)
1776            protected ImagePersistence imagePersistence;
1777            @BeanReference(type = LayoutPersistence.class)
1778            protected LayoutPersistence layoutPersistence;
1779            @BeanReference(type = LayoutPrototypePersistence.class)
1780            protected LayoutPrototypePersistence layoutPrototypePersistence;
1781            @BeanReference(type = LayoutSetPersistence.class)
1782            protected LayoutSetPersistence layoutSetPersistence;
1783            @BeanReference(type = LayoutSetPrototypePersistence.class)
1784            protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
1785            @BeanReference(type = ListTypePersistence.class)
1786            protected ListTypePersistence listTypePersistence;
1787            @BeanReference(type = LockPersistence.class)
1788            protected LockPersistence lockPersistence;
1789            @BeanReference(type = MembershipRequestPersistence.class)
1790            protected MembershipRequestPersistence membershipRequestPersistence;
1791            @BeanReference(type = OrganizationPersistence.class)
1792            protected OrganizationPersistence organizationPersistence;
1793            @BeanReference(type = OrgGroupPermissionPersistence.class)
1794            protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
1795            @BeanReference(type = OrgGroupRolePersistence.class)
1796            protected OrgGroupRolePersistence orgGroupRolePersistence;
1797            @BeanReference(type = OrgLaborPersistence.class)
1798            protected OrgLaborPersistence orgLaborPersistence;
1799            @BeanReference(type = PasswordPolicyPersistence.class)
1800            protected PasswordPolicyPersistence passwordPolicyPersistence;
1801            @BeanReference(type = PasswordPolicyRelPersistence.class)
1802            protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1803            @BeanReference(type = PasswordTrackerPersistence.class)
1804            protected PasswordTrackerPersistence passwordTrackerPersistence;
1805            @BeanReference(type = PermissionPersistence.class)
1806            protected PermissionPersistence permissionPersistence;
1807            @BeanReference(type = PhonePersistence.class)
1808            protected PhonePersistence phonePersistence;
1809            @BeanReference(type = PluginSettingPersistence.class)
1810            protected PluginSettingPersistence pluginSettingPersistence;
1811            @BeanReference(type = PortletPersistence.class)
1812            protected PortletPersistence portletPersistence;
1813            @BeanReference(type = PortletItemPersistence.class)
1814            protected PortletItemPersistence portletItemPersistence;
1815            @BeanReference(type = PortletPreferencesPersistence.class)
1816            protected PortletPreferencesPersistence portletPreferencesPersistence;
1817            @BeanReference(type = RegionPersistence.class)
1818            protected RegionPersistence regionPersistence;
1819            @BeanReference(type = ReleasePersistence.class)
1820            protected ReleasePersistence releasePersistence;
1821            @BeanReference(type = ResourcePersistence.class)
1822            protected ResourcePersistence resourcePersistence;
1823            @BeanReference(type = ResourceActionPersistence.class)
1824            protected ResourceActionPersistence resourceActionPersistence;
1825            @BeanReference(type = ResourceCodePersistence.class)
1826            protected ResourceCodePersistence resourceCodePersistence;
1827            @BeanReference(type = ResourcePermissionPersistence.class)
1828            protected ResourcePermissionPersistence resourcePermissionPersistence;
1829            @BeanReference(type = RolePersistence.class)
1830            protected RolePersistence rolePersistence;
1831            @BeanReference(type = ServiceComponentPersistence.class)
1832            protected ServiceComponentPersistence serviceComponentPersistence;
1833            @BeanReference(type = ShardPersistence.class)
1834            protected ShardPersistence shardPersistence;
1835            @BeanReference(type = SubscriptionPersistence.class)
1836            protected SubscriptionPersistence subscriptionPersistence;
1837            @BeanReference(type = TicketPersistence.class)
1838            protected TicketPersistence ticketPersistence;
1839            @BeanReference(type = TeamPersistence.class)
1840            protected TeamPersistence teamPersistence;
1841            @BeanReference(type = UserPersistence.class)
1842            protected UserPersistence userPersistence;
1843            @BeanReference(type = UserGroupPersistence.class)
1844            protected UserGroupPersistence userGroupPersistence;
1845            @BeanReference(type = UserGroupGroupRolePersistence.class)
1846            protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
1847            @BeanReference(type = UserGroupRolePersistence.class)
1848            protected UserGroupRolePersistence userGroupRolePersistence;
1849            @BeanReference(type = UserIdMapperPersistence.class)
1850            protected UserIdMapperPersistence userIdMapperPersistence;
1851            @BeanReference(type = UserTrackerPersistence.class)
1852            protected UserTrackerPersistence userTrackerPersistence;
1853            @BeanReference(type = UserTrackerPathPersistence.class)
1854            protected UserTrackerPathPersistence userTrackerPathPersistence;
1855            @BeanReference(type = WebDAVPropsPersistence.class)
1856            protected WebDAVPropsPersistence webDAVPropsPersistence;
1857            @BeanReference(type = WebsitePersistence.class)
1858            protected WebsitePersistence websitePersistence;
1859            @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
1860            protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
1861            @BeanReference(type = WorkflowInstanceLinkPersistence.class)
1862            protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
1863            private static final String _SQL_SELECT_LAYOUTSETPROTOTYPE = "SELECT layoutSetPrototype FROM LayoutSetPrototype layoutSetPrototype";
1864            private static final String _SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE = "SELECT layoutSetPrototype FROM LayoutSetPrototype layoutSetPrototype WHERE ";
1865            private static final String _SQL_COUNT_LAYOUTSETPROTOTYPE = "SELECT COUNT(layoutSetPrototype) FROM LayoutSetPrototype layoutSetPrototype";
1866            private static final String _SQL_COUNT_LAYOUTSETPROTOTYPE_WHERE = "SELECT COUNT(layoutSetPrototype) FROM LayoutSetPrototype layoutSetPrototype WHERE ";
1867            private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "layoutSetPrototype.companyId = ?";
1868            private static final String _FINDER_COLUMN_C_A_COMPANYID_2 = "layoutSetPrototype.companyId = ? AND ";
1869            private static final String _FINDER_COLUMN_C_A_ACTIVE_2 = "layoutSetPrototype.active = ?";
1870            private static final String _FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_WHERE = "SELECT DISTINCT {layoutSetPrototype.*} FROM LayoutSetPrototype layoutSetPrototype WHERE ";
1871            private static final String _FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_1 =
1872                    "SELECT {LayoutSetPrototype.*} FROM (SELECT DISTINCT layoutSetPrototype.layoutSetPrototypeId FROM LayoutSetPrototype layoutSetPrototype WHERE ";
1873            private static final String _FILTER_SQL_SELECT_LAYOUTSETPROTOTYPE_NO_INLINE_DISTINCT_WHERE_2 =
1874                    ") TEMP_TABLE INNER JOIN LayoutSetPrototype ON TEMP_TABLE.layoutSetPrototypeId = LayoutSetPrototype.layoutSetPrototypeId";
1875            private static final String _FILTER_SQL_COUNT_LAYOUTSETPROTOTYPE_WHERE = "SELECT COUNT(DISTINCT layoutSetPrototype.layoutSetPrototypeId) AS COUNT_VALUE FROM LayoutSetPrototype layoutSetPrototype WHERE ";
1876            private static final String _FILTER_COLUMN_PK = "layoutSetPrototype.layoutSetPrototypeId";
1877            private static final String _FILTER_COLUMN_USERID = null;
1878            private static final String _FILTER_ENTITY_ALIAS = "layoutSetPrototype";
1879            private static final String _FILTER_ENTITY_TABLE = "LayoutSetPrototype";
1880            private static final String _ORDER_BY_ENTITY_ALIAS = "layoutSetPrototype.";
1881            private static final String _ORDER_BY_ENTITY_TABLE = "LayoutSetPrototype.";
1882            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No LayoutSetPrototype exists with the primary key ";
1883            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No LayoutSetPrototype exists with the key {";
1884            private static Log _log = LogFactoryUtil.getLog(LayoutSetPrototypePersistenceImpl.class);
1885    }