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