001    /**
002     * Copyright (c) 2000-2012 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.NoSuchModelException;
018    import com.liferay.portal.NoSuchWebsiteException;
019    import com.liferay.portal.kernel.bean.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.Session;
028    import com.liferay.portal.kernel.exception.SystemException;
029    import com.liferay.portal.kernel.log.Log;
030    import com.liferay.portal.kernel.log.LogFactoryUtil;
031    import com.liferay.portal.kernel.util.GetterUtil;
032    import com.liferay.portal.kernel.util.InstanceFactory;
033    import com.liferay.portal.kernel.util.OrderByComparator;
034    import com.liferay.portal.kernel.util.StringBundler;
035    import com.liferay.portal.kernel.util.StringPool;
036    import com.liferay.portal.kernel.util.StringUtil;
037    import com.liferay.portal.model.CacheModel;
038    import com.liferay.portal.model.ModelListener;
039    import com.liferay.portal.model.Website;
040    import com.liferay.portal.model.impl.WebsiteImpl;
041    import com.liferay.portal.model.impl.WebsiteModelImpl;
042    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
043    
044    import java.io.Serializable;
045    
046    import java.util.ArrayList;
047    import java.util.Collections;
048    import java.util.List;
049    
050    /**
051     * The persistence implementation for the website service.
052     *
053     * <p>
054     * Caching information and settings can be found in <code>portal.properties</code>
055     * </p>
056     *
057     * @author Brian Wing Shun Chan
058     * @see WebsitePersistence
059     * @see WebsiteUtil
060     * @generated
061     */
062    public class WebsitePersistenceImpl extends BasePersistenceImpl<Website>
063            implements WebsitePersistence {
064            /*
065             * NOTE FOR DEVELOPERS:
066             *
067             * Never modify or reference this class directly. Always use {@link WebsiteUtil} to access the website persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
068             */
069            public static final String FINDER_CLASS_NAME_ENTITY = WebsiteImpl.class.getName();
070            public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
071                    ".List1";
072            public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
073                    ".List2";
074            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID =
075                    new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
076                            WebsiteModelImpl.FINDER_CACHE_ENABLED, WebsiteImpl.class,
077                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByCompanyId",
078                            new String[] {
079                                    Long.class.getName(),
080                                    
081                            "java.lang.Integer", "java.lang.Integer",
082                                    "com.liferay.portal.kernel.util.OrderByComparator"
083                            });
084            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID =
085                    new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
086                            WebsiteModelImpl.FINDER_CACHE_ENABLED, WebsiteImpl.class,
087                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByCompanyId",
088                            new String[] { Long.class.getName() },
089                            WebsiteModelImpl.COMPANYID_COLUMN_BITMASK);
090            public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
091                            WebsiteModelImpl.FINDER_CACHE_ENABLED, Long.class,
092                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByCompanyId",
093                            new String[] { Long.class.getName() });
094            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_USERID = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
095                            WebsiteModelImpl.FINDER_CACHE_ENABLED, WebsiteImpl.class,
096                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByUserId",
097                            new String[] {
098                                    Long.class.getName(),
099                                    
100                            "java.lang.Integer", "java.lang.Integer",
101                                    "com.liferay.portal.kernel.util.OrderByComparator"
102                            });
103            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID =
104                    new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
105                            WebsiteModelImpl.FINDER_CACHE_ENABLED, WebsiteImpl.class,
106                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUserId",
107                            new String[] { Long.class.getName() },
108                            WebsiteModelImpl.USERID_COLUMN_BITMASK);
109            public static final FinderPath FINDER_PATH_COUNT_BY_USERID = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
110                            WebsiteModelImpl.FINDER_CACHE_ENABLED, Long.class,
111                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUserId",
112                            new String[] { Long.class.getName() });
113            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
114                            WebsiteModelImpl.FINDER_CACHE_ENABLED, WebsiteImpl.class,
115                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_C",
116                            new String[] {
117                                    Long.class.getName(), Long.class.getName(),
118                                    
119                            "java.lang.Integer", "java.lang.Integer",
120                                    "com.liferay.portal.kernel.util.OrderByComparator"
121                            });
122            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
123                            WebsiteModelImpl.FINDER_CACHE_ENABLED, WebsiteImpl.class,
124                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_C",
125                            new String[] { Long.class.getName(), Long.class.getName() },
126                            WebsiteModelImpl.COMPANYID_COLUMN_BITMASK |
127                            WebsiteModelImpl.CLASSNAMEID_COLUMN_BITMASK);
128            public static final FinderPath FINDER_PATH_COUNT_BY_C_C = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
129                            WebsiteModelImpl.FINDER_CACHE_ENABLED, Long.class,
130                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_C",
131                            new String[] { Long.class.getName(), Long.class.getName() });
132            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C_C = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
133                            WebsiteModelImpl.FINDER_CACHE_ENABLED, WebsiteImpl.class,
134                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_C_C",
135                            new String[] {
136                                    Long.class.getName(), Long.class.getName(), Long.class.getName(),
137                                    
138                            "java.lang.Integer", "java.lang.Integer",
139                                    "com.liferay.portal.kernel.util.OrderByComparator"
140                            });
141            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
142                            WebsiteModelImpl.FINDER_CACHE_ENABLED, WebsiteImpl.class,
143                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_C_C",
144                            new String[] {
145                                    Long.class.getName(), Long.class.getName(), Long.class.getName()
146                            },
147                            WebsiteModelImpl.COMPANYID_COLUMN_BITMASK |
148                            WebsiteModelImpl.CLASSNAMEID_COLUMN_BITMASK |
149                            WebsiteModelImpl.CLASSPK_COLUMN_BITMASK);
150            public static final FinderPath FINDER_PATH_COUNT_BY_C_C_C = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
151                            WebsiteModelImpl.FINDER_CACHE_ENABLED, Long.class,
152                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_C_C",
153                            new String[] {
154                                    Long.class.getName(), Long.class.getName(), Long.class.getName()
155                            });
156            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C_C_P = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
157                            WebsiteModelImpl.FINDER_CACHE_ENABLED, WebsiteImpl.class,
158                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_C_C_P",
159                            new String[] {
160                                    Long.class.getName(), Long.class.getName(), Long.class.getName(),
161                                    Boolean.class.getName(),
162                                    
163                            "java.lang.Integer", "java.lang.Integer",
164                                    "com.liferay.portal.kernel.util.OrderByComparator"
165                            });
166            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C_P =
167                    new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
168                            WebsiteModelImpl.FINDER_CACHE_ENABLED, WebsiteImpl.class,
169                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_C_C_P",
170                            new String[] {
171                                    Long.class.getName(), Long.class.getName(), Long.class.getName(),
172                                    Boolean.class.getName()
173                            },
174                            WebsiteModelImpl.COMPANYID_COLUMN_BITMASK |
175                            WebsiteModelImpl.CLASSNAMEID_COLUMN_BITMASK |
176                            WebsiteModelImpl.CLASSPK_COLUMN_BITMASK |
177                            WebsiteModelImpl.PRIMARY_COLUMN_BITMASK);
178            public static final FinderPath FINDER_PATH_COUNT_BY_C_C_C_P = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
179                            WebsiteModelImpl.FINDER_CACHE_ENABLED, Long.class,
180                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_C_C_P",
181                            new String[] {
182                                    Long.class.getName(), Long.class.getName(), Long.class.getName(),
183                                    Boolean.class.getName()
184                            });
185            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
186                            WebsiteModelImpl.FINDER_CACHE_ENABLED, WebsiteImpl.class,
187                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
188            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
189                            WebsiteModelImpl.FINDER_CACHE_ENABLED, WebsiteImpl.class,
190                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
191            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
192                            WebsiteModelImpl.FINDER_CACHE_ENABLED, Long.class,
193                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
194    
195            /**
196             * Caches the website in the entity cache if it is enabled.
197             *
198             * @param website the website
199             */
200            public void cacheResult(Website website) {
201                    EntityCacheUtil.putResult(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
202                            WebsiteImpl.class, website.getPrimaryKey(), website);
203    
204                    website.resetOriginalValues();
205            }
206    
207            /**
208             * Caches the websites in the entity cache if it is enabled.
209             *
210             * @param websites the websites
211             */
212            public void cacheResult(List<Website> websites) {
213                    for (Website website : websites) {
214                            if (EntityCacheUtil.getResult(
215                                                    WebsiteModelImpl.ENTITY_CACHE_ENABLED,
216                                                    WebsiteImpl.class, website.getPrimaryKey()) == null) {
217                                    cacheResult(website);
218                            }
219                            else {
220                                    website.resetOriginalValues();
221                            }
222                    }
223            }
224    
225            /**
226             * Clears the cache for all websites.
227             *
228             * <p>
229             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
230             * </p>
231             */
232            @Override
233            public void clearCache() {
234                    if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
235                            CacheRegistryUtil.clear(WebsiteImpl.class.getName());
236                    }
237    
238                    EntityCacheUtil.clearCache(WebsiteImpl.class.getName());
239    
240                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
241                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
242                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
243            }
244    
245            /**
246             * Clears the cache for the website.
247             *
248             * <p>
249             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
250             * </p>
251             */
252            @Override
253            public void clearCache(Website website) {
254                    EntityCacheUtil.removeResult(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
255                            WebsiteImpl.class, website.getPrimaryKey());
256    
257                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
258                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
259            }
260    
261            @Override
262            public void clearCache(List<Website> websites) {
263                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
264                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
265    
266                    for (Website website : websites) {
267                            EntityCacheUtil.removeResult(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
268                                    WebsiteImpl.class, website.getPrimaryKey());
269                    }
270            }
271    
272            /**
273             * Creates a new website with the primary key. Does not add the website to the database.
274             *
275             * @param websiteId the primary key for the new website
276             * @return the new website
277             */
278            public Website create(long websiteId) {
279                    Website website = new WebsiteImpl();
280    
281                    website.setNew(true);
282                    website.setPrimaryKey(websiteId);
283    
284                    return website;
285            }
286    
287            /**
288             * Removes the website with the primary key from the database. Also notifies the appropriate model listeners.
289             *
290             * @param websiteId the primary key of the website
291             * @return the website that was removed
292             * @throws com.liferay.portal.NoSuchWebsiteException if a website with the primary key could not be found
293             * @throws SystemException if a system exception occurred
294             */
295            public Website remove(long websiteId)
296                    throws NoSuchWebsiteException, SystemException {
297                    return remove(Long.valueOf(websiteId));
298            }
299    
300            /**
301             * Removes the website with the primary key from the database. Also notifies the appropriate model listeners.
302             *
303             * @param primaryKey the primary key of the website
304             * @return the website that was removed
305             * @throws com.liferay.portal.NoSuchWebsiteException if a website with the primary key could not be found
306             * @throws SystemException if a system exception occurred
307             */
308            @Override
309            public Website remove(Serializable primaryKey)
310                    throws NoSuchWebsiteException, SystemException {
311                    Session session = null;
312    
313                    try {
314                            session = openSession();
315    
316                            Website website = (Website)session.get(WebsiteImpl.class, primaryKey);
317    
318                            if (website == null) {
319                                    if (_log.isWarnEnabled()) {
320                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
321                                    }
322    
323                                    throw new NoSuchWebsiteException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
324                                            primaryKey);
325                            }
326    
327                            return remove(website);
328                    }
329                    catch (NoSuchWebsiteException nsee) {
330                            throw nsee;
331                    }
332                    catch (Exception e) {
333                            throw processException(e);
334                    }
335                    finally {
336                            closeSession(session);
337                    }
338            }
339    
340            @Override
341            protected Website removeImpl(Website website) throws SystemException {
342                    website = toUnwrappedModel(website);
343    
344                    Session session = null;
345    
346                    try {
347                            session = openSession();
348    
349                            BatchSessionUtil.delete(session, website);
350                    }
351                    catch (Exception e) {
352                            throw processException(e);
353                    }
354                    finally {
355                            closeSession(session);
356                    }
357    
358                    clearCache(website);
359    
360                    return website;
361            }
362    
363            @Override
364            public Website updateImpl(com.liferay.portal.model.Website website,
365                    boolean merge) throws SystemException {
366                    website = toUnwrappedModel(website);
367    
368                    boolean isNew = website.isNew();
369    
370                    WebsiteModelImpl websiteModelImpl = (WebsiteModelImpl)website;
371    
372                    Session session = null;
373    
374                    try {
375                            session = openSession();
376    
377                            BatchSessionUtil.update(session, website, merge);
378    
379                            website.setNew(false);
380                    }
381                    catch (Exception e) {
382                            throw processException(e);
383                    }
384                    finally {
385                            closeSession(session);
386                    }
387    
388                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
389    
390                    if (isNew || !WebsiteModelImpl.COLUMN_BITMASK_ENABLED) {
391                            FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
392                    }
393                    else {
394                            if ((websiteModelImpl.getColumnBitmask() &
395                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID.getColumnBitmask()) != 0) {
396                                    Object[] args = new Object[] {
397                                                    Long.valueOf(websiteModelImpl.getOriginalCompanyId())
398                                            };
399    
400                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
401                                            args);
402                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
403                                            args);
404    
405                                    args = new Object[] {
406                                                    Long.valueOf(websiteModelImpl.getCompanyId())
407                                            };
408    
409                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
410                                            args);
411                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
412                                            args);
413                            }
414    
415                            if ((websiteModelImpl.getColumnBitmask() &
416                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID.getColumnBitmask()) != 0) {
417                                    Object[] args = new Object[] {
418                                                    Long.valueOf(websiteModelImpl.getOriginalUserId())
419                                            };
420    
421                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
422                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID,
423                                            args);
424    
425                                    args = new Object[] { Long.valueOf(websiteModelImpl.getUserId()) };
426    
427                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
428                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID,
429                                            args);
430                            }
431    
432                            if ((websiteModelImpl.getColumnBitmask() &
433                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C.getColumnBitmask()) != 0) {
434                                    Object[] args = new Object[] {
435                                                    Long.valueOf(websiteModelImpl.getOriginalCompanyId()),
436                                                    Long.valueOf(websiteModelImpl.getOriginalClassNameId())
437                                            };
438    
439                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C, args);
440                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C,
441                                            args);
442    
443                                    args = new Object[] {
444                                                    Long.valueOf(websiteModelImpl.getCompanyId()),
445                                                    Long.valueOf(websiteModelImpl.getClassNameId())
446                                            };
447    
448                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C, args);
449                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C,
450                                            args);
451                            }
452    
453                            if ((websiteModelImpl.getColumnBitmask() &
454                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C.getColumnBitmask()) != 0) {
455                                    Object[] args = new Object[] {
456                                                    Long.valueOf(websiteModelImpl.getOriginalCompanyId()),
457                                                    Long.valueOf(websiteModelImpl.getOriginalClassNameId()),
458                                                    Long.valueOf(websiteModelImpl.getOriginalClassPK())
459                                            };
460    
461                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C_C, args);
462                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C,
463                                            args);
464    
465                                    args = new Object[] {
466                                                    Long.valueOf(websiteModelImpl.getCompanyId()),
467                                                    Long.valueOf(websiteModelImpl.getClassNameId()),
468                                                    Long.valueOf(websiteModelImpl.getClassPK())
469                                            };
470    
471                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C_C, args);
472                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C,
473                                            args);
474                            }
475    
476                            if ((websiteModelImpl.getColumnBitmask() &
477                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C_P.getColumnBitmask()) != 0) {
478                                    Object[] args = new Object[] {
479                                                    Long.valueOf(websiteModelImpl.getOriginalCompanyId()),
480                                                    Long.valueOf(websiteModelImpl.getOriginalClassNameId()),
481                                                    Long.valueOf(websiteModelImpl.getOriginalClassPK()),
482                                                    Boolean.valueOf(websiteModelImpl.getOriginalPrimary())
483                                            };
484    
485                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C_C_P, args);
486                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C_P,
487                                            args);
488    
489                                    args = new Object[] {
490                                                    Long.valueOf(websiteModelImpl.getCompanyId()),
491                                                    Long.valueOf(websiteModelImpl.getClassNameId()),
492                                                    Long.valueOf(websiteModelImpl.getClassPK()),
493                                                    Boolean.valueOf(websiteModelImpl.getPrimary())
494                                            };
495    
496                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C_C_P, args);
497                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C_P,
498                                            args);
499                            }
500                    }
501    
502                    EntityCacheUtil.putResult(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
503                            WebsiteImpl.class, website.getPrimaryKey(), website);
504    
505                    return website;
506            }
507    
508            protected Website toUnwrappedModel(Website website) {
509                    if (website instanceof WebsiteImpl) {
510                            return website;
511                    }
512    
513                    WebsiteImpl websiteImpl = new WebsiteImpl();
514    
515                    websiteImpl.setNew(website.isNew());
516                    websiteImpl.setPrimaryKey(website.getPrimaryKey());
517    
518                    websiteImpl.setWebsiteId(website.getWebsiteId());
519                    websiteImpl.setCompanyId(website.getCompanyId());
520                    websiteImpl.setUserId(website.getUserId());
521                    websiteImpl.setUserName(website.getUserName());
522                    websiteImpl.setCreateDate(website.getCreateDate());
523                    websiteImpl.setModifiedDate(website.getModifiedDate());
524                    websiteImpl.setClassNameId(website.getClassNameId());
525                    websiteImpl.setClassPK(website.getClassPK());
526                    websiteImpl.setUrl(website.getUrl());
527                    websiteImpl.setTypeId(website.getTypeId());
528                    websiteImpl.setPrimary(website.isPrimary());
529    
530                    return websiteImpl;
531            }
532    
533            /**
534             * Returns the website with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
535             *
536             * @param primaryKey the primary key of the website
537             * @return the website
538             * @throws com.liferay.portal.NoSuchModelException if a website with the primary key could not be found
539             * @throws SystemException if a system exception occurred
540             */
541            @Override
542            public Website findByPrimaryKey(Serializable primaryKey)
543                    throws NoSuchModelException, SystemException {
544                    return findByPrimaryKey(((Long)primaryKey).longValue());
545            }
546    
547            /**
548             * Returns the website with the primary key or throws a {@link com.liferay.portal.NoSuchWebsiteException} if it could not be found.
549             *
550             * @param websiteId the primary key of the website
551             * @return the website
552             * @throws com.liferay.portal.NoSuchWebsiteException if a website with the primary key could not be found
553             * @throws SystemException if a system exception occurred
554             */
555            public Website findByPrimaryKey(long websiteId)
556                    throws NoSuchWebsiteException, SystemException {
557                    Website website = fetchByPrimaryKey(websiteId);
558    
559                    if (website == null) {
560                            if (_log.isWarnEnabled()) {
561                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + websiteId);
562                            }
563    
564                            throw new NoSuchWebsiteException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
565                                    websiteId);
566                    }
567    
568                    return website;
569            }
570    
571            /**
572             * Returns the website with the primary key or returns <code>null</code> if it could not be found.
573             *
574             * @param primaryKey the primary key of the website
575             * @return the website, or <code>null</code> if a website with the primary key could not be found
576             * @throws SystemException if a system exception occurred
577             */
578            @Override
579            public Website fetchByPrimaryKey(Serializable primaryKey)
580                    throws SystemException {
581                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
582            }
583    
584            /**
585             * Returns the website with the primary key or returns <code>null</code> if it could not be found.
586             *
587             * @param websiteId the primary key of the website
588             * @return the website, or <code>null</code> if a website with the primary key could not be found
589             * @throws SystemException if a system exception occurred
590             */
591            public Website fetchByPrimaryKey(long websiteId) throws SystemException {
592                    Website website = (Website)EntityCacheUtil.getResult(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
593                                    WebsiteImpl.class, websiteId);
594    
595                    if (website == _nullWebsite) {
596                            return null;
597                    }
598    
599                    if (website == null) {
600                            Session session = null;
601    
602                            boolean hasException = false;
603    
604                            try {
605                                    session = openSession();
606    
607                                    website = (Website)session.get(WebsiteImpl.class,
608                                                    Long.valueOf(websiteId));
609                            }
610                            catch (Exception e) {
611                                    hasException = true;
612    
613                                    throw processException(e);
614                            }
615                            finally {
616                                    if (website != null) {
617                                            cacheResult(website);
618                                    }
619                                    else if (!hasException) {
620                                            EntityCacheUtil.putResult(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
621                                                    WebsiteImpl.class, websiteId, _nullWebsite);
622                                    }
623    
624                                    closeSession(session);
625                            }
626                    }
627    
628                    return website;
629            }
630    
631            /**
632             * Returns all the websites where companyId = &#63;.
633             *
634             * @param companyId the company ID
635             * @return the matching websites
636             * @throws SystemException if a system exception occurred
637             */
638            public List<Website> findByCompanyId(long companyId)
639                    throws SystemException {
640                    return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
641                            null);
642            }
643    
644            /**
645             * Returns a range of all the websites where companyId = &#63;.
646             *
647             * <p>
648             * 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.
649             * </p>
650             *
651             * @param companyId the company ID
652             * @param start the lower bound of the range of websites
653             * @param end the upper bound of the range of websites (not inclusive)
654             * @return the range of matching websites
655             * @throws SystemException if a system exception occurred
656             */
657            public List<Website> findByCompanyId(long companyId, int start, int end)
658                    throws SystemException {
659                    return findByCompanyId(companyId, start, end, null);
660            }
661    
662            /**
663             * Returns an ordered range of all the websites where companyId = &#63;.
664             *
665             * <p>
666             * 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.
667             * </p>
668             *
669             * @param companyId the company ID
670             * @param start the lower bound of the range of websites
671             * @param end the upper bound of the range of websites (not inclusive)
672             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
673             * @return the ordered range of matching websites
674             * @throws SystemException if a system exception occurred
675             */
676            public List<Website> findByCompanyId(long companyId, int start, int end,
677                    OrderByComparator orderByComparator) throws SystemException {
678                    FinderPath finderPath = null;
679                    Object[] finderArgs = null;
680    
681                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
682                                    (orderByComparator == null)) {
683                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID;
684                            finderArgs = new Object[] { companyId };
685                    }
686                    else {
687                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID;
688                            finderArgs = new Object[] { companyId, start, end, orderByComparator };
689                    }
690    
691                    List<Website> list = (List<Website>)FinderCacheUtil.getResult(finderPath,
692                                    finderArgs, this);
693    
694                    if ((list != null) && !list.isEmpty()) {
695                            for (Website website : list) {
696                                    if ((companyId != website.getCompanyId())) {
697                                            list = null;
698    
699                                            break;
700                                    }
701                            }
702                    }
703    
704                    if (list == null) {
705                            StringBundler query = null;
706    
707                            if (orderByComparator != null) {
708                                    query = new StringBundler(3 +
709                                                    (orderByComparator.getOrderByFields().length * 3));
710                            }
711                            else {
712                                    query = new StringBundler(3);
713                            }
714    
715                            query.append(_SQL_SELECT_WEBSITE_WHERE);
716    
717                            query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
718    
719                            if (orderByComparator != null) {
720                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
721                                            orderByComparator);
722                            }
723    
724                            else {
725                                    query.append(WebsiteModelImpl.ORDER_BY_JPQL);
726                            }
727    
728                            String sql = query.toString();
729    
730                            Session session = null;
731    
732                            try {
733                                    session = openSession();
734    
735                                    Query q = session.createQuery(sql);
736    
737                                    QueryPos qPos = QueryPos.getInstance(q);
738    
739                                    qPos.add(companyId);
740    
741                                    list = (List<Website>)QueryUtil.list(q, getDialect(), start, end);
742                            }
743                            catch (Exception e) {
744                                    throw processException(e);
745                            }
746                            finally {
747                                    if (list == null) {
748                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
749                                    }
750                                    else {
751                                            cacheResult(list);
752    
753                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
754                                    }
755    
756                                    closeSession(session);
757                            }
758                    }
759    
760                    return list;
761            }
762    
763            /**
764             * Returns the first website in the ordered set where companyId = &#63;.
765             *
766             * <p>
767             * 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.
768             * </p>
769             *
770             * @param companyId the company ID
771             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
772             * @return the first matching website
773             * @throws com.liferay.portal.NoSuchWebsiteException if a matching website could not be found
774             * @throws SystemException if a system exception occurred
775             */
776            public Website findByCompanyId_First(long companyId,
777                    OrderByComparator orderByComparator)
778                    throws NoSuchWebsiteException, SystemException {
779                    List<Website> list = findByCompanyId(companyId, 0, 1, orderByComparator);
780    
781                    if (list.isEmpty()) {
782                            StringBundler msg = new StringBundler(4);
783    
784                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
785    
786                            msg.append("companyId=");
787                            msg.append(companyId);
788    
789                            msg.append(StringPool.CLOSE_CURLY_BRACE);
790    
791                            throw new NoSuchWebsiteException(msg.toString());
792                    }
793                    else {
794                            return list.get(0);
795                    }
796            }
797    
798            /**
799             * Returns the last website in the ordered set where companyId = &#63;.
800             *
801             * <p>
802             * 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.
803             * </p>
804             *
805             * @param companyId the company ID
806             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
807             * @return the last matching website
808             * @throws com.liferay.portal.NoSuchWebsiteException if a matching website could not be found
809             * @throws SystemException if a system exception occurred
810             */
811            public Website findByCompanyId_Last(long companyId,
812                    OrderByComparator orderByComparator)
813                    throws NoSuchWebsiteException, SystemException {
814                    int count = countByCompanyId(companyId);
815    
816                    List<Website> list = findByCompanyId(companyId, count - 1, count,
817                                    orderByComparator);
818    
819                    if (list.isEmpty()) {
820                            StringBundler msg = new StringBundler(4);
821    
822                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
823    
824                            msg.append("companyId=");
825                            msg.append(companyId);
826    
827                            msg.append(StringPool.CLOSE_CURLY_BRACE);
828    
829                            throw new NoSuchWebsiteException(msg.toString());
830                    }
831                    else {
832                            return list.get(0);
833                    }
834            }
835    
836            /**
837             * Returns the websites before and after the current website in the ordered set where companyId = &#63;.
838             *
839             * <p>
840             * 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.
841             * </p>
842             *
843             * @param websiteId the primary key of the current website
844             * @param companyId the company ID
845             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
846             * @return the previous, current, and next website
847             * @throws com.liferay.portal.NoSuchWebsiteException if a website with the primary key could not be found
848             * @throws SystemException if a system exception occurred
849             */
850            public Website[] findByCompanyId_PrevAndNext(long websiteId,
851                    long companyId, OrderByComparator orderByComparator)
852                    throws NoSuchWebsiteException, SystemException {
853                    Website website = findByPrimaryKey(websiteId);
854    
855                    Session session = null;
856    
857                    try {
858                            session = openSession();
859    
860                            Website[] array = new WebsiteImpl[3];
861    
862                            array[0] = getByCompanyId_PrevAndNext(session, website, companyId,
863                                            orderByComparator, true);
864    
865                            array[1] = website;
866    
867                            array[2] = getByCompanyId_PrevAndNext(session, website, companyId,
868                                            orderByComparator, false);
869    
870                            return array;
871                    }
872                    catch (Exception e) {
873                            throw processException(e);
874                    }
875                    finally {
876                            closeSession(session);
877                    }
878            }
879    
880            protected Website getByCompanyId_PrevAndNext(Session session,
881                    Website website, long companyId, OrderByComparator orderByComparator,
882                    boolean previous) {
883                    StringBundler query = null;
884    
885                    if (orderByComparator != null) {
886                            query = new StringBundler(6 +
887                                            (orderByComparator.getOrderByFields().length * 6));
888                    }
889                    else {
890                            query = new StringBundler(3);
891                    }
892    
893                    query.append(_SQL_SELECT_WEBSITE_WHERE);
894    
895                    query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
896    
897                    if (orderByComparator != null) {
898                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
899    
900                            if (orderByConditionFields.length > 0) {
901                                    query.append(WHERE_AND);
902                            }
903    
904                            for (int i = 0; i < orderByConditionFields.length; i++) {
905                                    query.append(_ORDER_BY_ENTITY_ALIAS);
906                                    query.append(orderByConditionFields[i]);
907    
908                                    if ((i + 1) < orderByConditionFields.length) {
909                                            if (orderByComparator.isAscending() ^ previous) {
910                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
911                                            }
912                                            else {
913                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
914                                            }
915                                    }
916                                    else {
917                                            if (orderByComparator.isAscending() ^ previous) {
918                                                    query.append(WHERE_GREATER_THAN);
919                                            }
920                                            else {
921                                                    query.append(WHERE_LESSER_THAN);
922                                            }
923                                    }
924                            }
925    
926                            query.append(ORDER_BY_CLAUSE);
927    
928                            String[] orderByFields = orderByComparator.getOrderByFields();
929    
930                            for (int i = 0; i < orderByFields.length; i++) {
931                                    query.append(_ORDER_BY_ENTITY_ALIAS);
932                                    query.append(orderByFields[i]);
933    
934                                    if ((i + 1) < orderByFields.length) {
935                                            if (orderByComparator.isAscending() ^ previous) {
936                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
937                                            }
938                                            else {
939                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
940                                            }
941                                    }
942                                    else {
943                                            if (orderByComparator.isAscending() ^ previous) {
944                                                    query.append(ORDER_BY_ASC);
945                                            }
946                                            else {
947                                                    query.append(ORDER_BY_DESC);
948                                            }
949                                    }
950                            }
951                    }
952    
953                    else {
954                            query.append(WebsiteModelImpl.ORDER_BY_JPQL);
955                    }
956    
957                    String sql = query.toString();
958    
959                    Query q = session.createQuery(sql);
960    
961                    q.setFirstResult(0);
962                    q.setMaxResults(2);
963    
964                    QueryPos qPos = QueryPos.getInstance(q);
965    
966                    qPos.add(companyId);
967    
968                    if (orderByComparator != null) {
969                            Object[] values = orderByComparator.getOrderByConditionValues(website);
970    
971                            for (Object value : values) {
972                                    qPos.add(value);
973                            }
974                    }
975    
976                    List<Website> list = q.list();
977    
978                    if (list.size() == 2) {
979                            return list.get(1);
980                    }
981                    else {
982                            return null;
983                    }
984            }
985    
986            /**
987             * Returns all the websites where userId = &#63;.
988             *
989             * @param userId the user ID
990             * @return the matching websites
991             * @throws SystemException if a system exception occurred
992             */
993            public List<Website> findByUserId(long userId) throws SystemException {
994                    return findByUserId(userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
995            }
996    
997            /**
998             * Returns a range of all the websites where userId = &#63;.
999             *
1000             * <p>
1001             * 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.
1002             * </p>
1003             *
1004             * @param userId the user ID
1005             * @param start the lower bound of the range of websites
1006             * @param end the upper bound of the range of websites (not inclusive)
1007             * @return the range of matching websites
1008             * @throws SystemException if a system exception occurred
1009             */
1010            public List<Website> findByUserId(long userId, int start, int end)
1011                    throws SystemException {
1012                    return findByUserId(userId, start, end, null);
1013            }
1014    
1015            /**
1016             * Returns an ordered range of all the websites where userId = &#63;.
1017             *
1018             * <p>
1019             * 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.
1020             * </p>
1021             *
1022             * @param userId the user ID
1023             * @param start the lower bound of the range of websites
1024             * @param end the upper bound of the range of websites (not inclusive)
1025             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1026             * @return the ordered range of matching websites
1027             * @throws SystemException if a system exception occurred
1028             */
1029            public List<Website> findByUserId(long userId, int start, int end,
1030                    OrderByComparator orderByComparator) throws SystemException {
1031                    FinderPath finderPath = null;
1032                    Object[] finderArgs = null;
1033    
1034                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1035                                    (orderByComparator == null)) {
1036                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID;
1037                            finderArgs = new Object[] { userId };
1038                    }
1039                    else {
1040                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_USERID;
1041                            finderArgs = new Object[] { userId, start, end, orderByComparator };
1042                    }
1043    
1044                    List<Website> list = (List<Website>)FinderCacheUtil.getResult(finderPath,
1045                                    finderArgs, this);
1046    
1047                    if ((list != null) && !list.isEmpty()) {
1048                            for (Website website : list) {
1049                                    if ((userId != website.getUserId())) {
1050                                            list = null;
1051    
1052                                            break;
1053                                    }
1054                            }
1055                    }
1056    
1057                    if (list == null) {
1058                            StringBundler query = null;
1059    
1060                            if (orderByComparator != null) {
1061                                    query = new StringBundler(3 +
1062                                                    (orderByComparator.getOrderByFields().length * 3));
1063                            }
1064                            else {
1065                                    query = new StringBundler(3);
1066                            }
1067    
1068                            query.append(_SQL_SELECT_WEBSITE_WHERE);
1069    
1070                            query.append(_FINDER_COLUMN_USERID_USERID_2);
1071    
1072                            if (orderByComparator != null) {
1073                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1074                                            orderByComparator);
1075                            }
1076    
1077                            else {
1078                                    query.append(WebsiteModelImpl.ORDER_BY_JPQL);
1079                            }
1080    
1081                            String sql = query.toString();
1082    
1083                            Session session = null;
1084    
1085                            try {
1086                                    session = openSession();
1087    
1088                                    Query q = session.createQuery(sql);
1089    
1090                                    QueryPos qPos = QueryPos.getInstance(q);
1091    
1092                                    qPos.add(userId);
1093    
1094                                    list = (List<Website>)QueryUtil.list(q, getDialect(), start, end);
1095                            }
1096                            catch (Exception e) {
1097                                    throw processException(e);
1098                            }
1099                            finally {
1100                                    if (list == null) {
1101                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
1102                                    }
1103                                    else {
1104                                            cacheResult(list);
1105    
1106                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
1107                                    }
1108    
1109                                    closeSession(session);
1110                            }
1111                    }
1112    
1113                    return list;
1114            }
1115    
1116            /**
1117             * Returns the first website in the ordered set where userId = &#63;.
1118             *
1119             * <p>
1120             * 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.
1121             * </p>
1122             *
1123             * @param userId the user ID
1124             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1125             * @return the first matching website
1126             * @throws com.liferay.portal.NoSuchWebsiteException if a matching website could not be found
1127             * @throws SystemException if a system exception occurred
1128             */
1129            public Website findByUserId_First(long userId,
1130                    OrderByComparator orderByComparator)
1131                    throws NoSuchWebsiteException, SystemException {
1132                    List<Website> list = findByUserId(userId, 0, 1, orderByComparator);
1133    
1134                    if (list.isEmpty()) {
1135                            StringBundler msg = new StringBundler(4);
1136    
1137                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1138    
1139                            msg.append("userId=");
1140                            msg.append(userId);
1141    
1142                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1143    
1144                            throw new NoSuchWebsiteException(msg.toString());
1145                    }
1146                    else {
1147                            return list.get(0);
1148                    }
1149            }
1150    
1151            /**
1152             * Returns the last website in the ordered set where userId = &#63;.
1153             *
1154             * <p>
1155             * 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.
1156             * </p>
1157             *
1158             * @param userId the user ID
1159             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1160             * @return the last matching website
1161             * @throws com.liferay.portal.NoSuchWebsiteException if a matching website could not be found
1162             * @throws SystemException if a system exception occurred
1163             */
1164            public Website findByUserId_Last(long userId,
1165                    OrderByComparator orderByComparator)
1166                    throws NoSuchWebsiteException, SystemException {
1167                    int count = countByUserId(userId);
1168    
1169                    List<Website> list = findByUserId(userId, count - 1, count,
1170                                    orderByComparator);
1171    
1172                    if (list.isEmpty()) {
1173                            StringBundler msg = new StringBundler(4);
1174    
1175                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1176    
1177                            msg.append("userId=");
1178                            msg.append(userId);
1179    
1180                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1181    
1182                            throw new NoSuchWebsiteException(msg.toString());
1183                    }
1184                    else {
1185                            return list.get(0);
1186                    }
1187            }
1188    
1189            /**
1190             * Returns the websites before and after the current website in the ordered set where userId = &#63;.
1191             *
1192             * <p>
1193             * 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.
1194             * </p>
1195             *
1196             * @param websiteId the primary key of the current website
1197             * @param userId the user ID
1198             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1199             * @return the previous, current, and next website
1200             * @throws com.liferay.portal.NoSuchWebsiteException if a website with the primary key could not be found
1201             * @throws SystemException if a system exception occurred
1202             */
1203            public Website[] findByUserId_PrevAndNext(long websiteId, long userId,
1204                    OrderByComparator orderByComparator)
1205                    throws NoSuchWebsiteException, SystemException {
1206                    Website website = findByPrimaryKey(websiteId);
1207    
1208                    Session session = null;
1209    
1210                    try {
1211                            session = openSession();
1212    
1213                            Website[] array = new WebsiteImpl[3];
1214    
1215                            array[0] = getByUserId_PrevAndNext(session, website, userId,
1216                                            orderByComparator, true);
1217    
1218                            array[1] = website;
1219    
1220                            array[2] = getByUserId_PrevAndNext(session, website, userId,
1221                                            orderByComparator, false);
1222    
1223                            return array;
1224                    }
1225                    catch (Exception e) {
1226                            throw processException(e);
1227                    }
1228                    finally {
1229                            closeSession(session);
1230                    }
1231            }
1232    
1233            protected Website getByUserId_PrevAndNext(Session session, Website website,
1234                    long userId, OrderByComparator orderByComparator, boolean previous) {
1235                    StringBundler query = null;
1236    
1237                    if (orderByComparator != null) {
1238                            query = new StringBundler(6 +
1239                                            (orderByComparator.getOrderByFields().length * 6));
1240                    }
1241                    else {
1242                            query = new StringBundler(3);
1243                    }
1244    
1245                    query.append(_SQL_SELECT_WEBSITE_WHERE);
1246    
1247                    query.append(_FINDER_COLUMN_USERID_USERID_2);
1248    
1249                    if (orderByComparator != null) {
1250                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1251    
1252                            if (orderByConditionFields.length > 0) {
1253                                    query.append(WHERE_AND);
1254                            }
1255    
1256                            for (int i = 0; i < orderByConditionFields.length; i++) {
1257                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1258                                    query.append(orderByConditionFields[i]);
1259    
1260                                    if ((i + 1) < orderByConditionFields.length) {
1261                                            if (orderByComparator.isAscending() ^ previous) {
1262                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1263                                            }
1264                                            else {
1265                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1266                                            }
1267                                    }
1268                                    else {
1269                                            if (orderByComparator.isAscending() ^ previous) {
1270                                                    query.append(WHERE_GREATER_THAN);
1271                                            }
1272                                            else {
1273                                                    query.append(WHERE_LESSER_THAN);
1274                                            }
1275                                    }
1276                            }
1277    
1278                            query.append(ORDER_BY_CLAUSE);
1279    
1280                            String[] orderByFields = orderByComparator.getOrderByFields();
1281    
1282                            for (int i = 0; i < orderByFields.length; i++) {
1283                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1284                                    query.append(orderByFields[i]);
1285    
1286                                    if ((i + 1) < orderByFields.length) {
1287                                            if (orderByComparator.isAscending() ^ previous) {
1288                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1289                                            }
1290                                            else {
1291                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1292                                            }
1293                                    }
1294                                    else {
1295                                            if (orderByComparator.isAscending() ^ previous) {
1296                                                    query.append(ORDER_BY_ASC);
1297                                            }
1298                                            else {
1299                                                    query.append(ORDER_BY_DESC);
1300                                            }
1301                                    }
1302                            }
1303                    }
1304    
1305                    else {
1306                            query.append(WebsiteModelImpl.ORDER_BY_JPQL);
1307                    }
1308    
1309                    String sql = query.toString();
1310    
1311                    Query q = session.createQuery(sql);
1312    
1313                    q.setFirstResult(0);
1314                    q.setMaxResults(2);
1315    
1316                    QueryPos qPos = QueryPos.getInstance(q);
1317    
1318                    qPos.add(userId);
1319    
1320                    if (orderByComparator != null) {
1321                            Object[] values = orderByComparator.getOrderByConditionValues(website);
1322    
1323                            for (Object value : values) {
1324                                    qPos.add(value);
1325                            }
1326                    }
1327    
1328                    List<Website> list = q.list();
1329    
1330                    if (list.size() == 2) {
1331                            return list.get(1);
1332                    }
1333                    else {
1334                            return null;
1335                    }
1336            }
1337    
1338            /**
1339             * Returns all the websites where companyId = &#63; and classNameId = &#63;.
1340             *
1341             * @param companyId the company ID
1342             * @param classNameId the class name ID
1343             * @return the matching websites
1344             * @throws SystemException if a system exception occurred
1345             */
1346            public List<Website> findByC_C(long companyId, long classNameId)
1347                    throws SystemException {
1348                    return findByC_C(companyId, classNameId, QueryUtil.ALL_POS,
1349                            QueryUtil.ALL_POS, null);
1350            }
1351    
1352            /**
1353             * Returns a range of all the websites where companyId = &#63; and classNameId = &#63;.
1354             *
1355             * <p>
1356             * 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.
1357             * </p>
1358             *
1359             * @param companyId the company ID
1360             * @param classNameId the class name ID
1361             * @param start the lower bound of the range of websites
1362             * @param end the upper bound of the range of websites (not inclusive)
1363             * @return the range of matching websites
1364             * @throws SystemException if a system exception occurred
1365             */
1366            public List<Website> findByC_C(long companyId, long classNameId, int start,
1367                    int end) throws SystemException {
1368                    return findByC_C(companyId, classNameId, start, end, null);
1369            }
1370    
1371            /**
1372             * Returns an ordered range of all the websites where companyId = &#63; and classNameId = &#63;.
1373             *
1374             * <p>
1375             * 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.
1376             * </p>
1377             *
1378             * @param companyId the company ID
1379             * @param classNameId the class name ID
1380             * @param start the lower bound of the range of websites
1381             * @param end the upper bound of the range of websites (not inclusive)
1382             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1383             * @return the ordered range of matching websites
1384             * @throws SystemException if a system exception occurred
1385             */
1386            public List<Website> findByC_C(long companyId, long classNameId, int start,
1387                    int end, OrderByComparator orderByComparator) throws SystemException {
1388                    FinderPath finderPath = null;
1389                    Object[] finderArgs = null;
1390    
1391                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1392                                    (orderByComparator == null)) {
1393                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C;
1394                            finderArgs = new Object[] { companyId, classNameId };
1395                    }
1396                    else {
1397                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C;
1398                            finderArgs = new Object[] {
1399                                            companyId, classNameId,
1400                                            
1401                                            start, end, orderByComparator
1402                                    };
1403                    }
1404    
1405                    List<Website> list = (List<Website>)FinderCacheUtil.getResult(finderPath,
1406                                    finderArgs, this);
1407    
1408                    if ((list != null) && !list.isEmpty()) {
1409                            for (Website website : list) {
1410                                    if ((companyId != website.getCompanyId()) ||
1411                                                    (classNameId != website.getClassNameId())) {
1412                                            list = null;
1413    
1414                                            break;
1415                                    }
1416                            }
1417                    }
1418    
1419                    if (list == null) {
1420                            StringBundler query = null;
1421    
1422                            if (orderByComparator != null) {
1423                                    query = new StringBundler(4 +
1424                                                    (orderByComparator.getOrderByFields().length * 3));
1425                            }
1426                            else {
1427                                    query = new StringBundler(4);
1428                            }
1429    
1430                            query.append(_SQL_SELECT_WEBSITE_WHERE);
1431    
1432                            query.append(_FINDER_COLUMN_C_C_COMPANYID_2);
1433    
1434                            query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
1435    
1436                            if (orderByComparator != null) {
1437                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1438                                            orderByComparator);
1439                            }
1440    
1441                            else {
1442                                    query.append(WebsiteModelImpl.ORDER_BY_JPQL);
1443                            }
1444    
1445                            String sql = query.toString();
1446    
1447                            Session session = null;
1448    
1449                            try {
1450                                    session = openSession();
1451    
1452                                    Query q = session.createQuery(sql);
1453    
1454                                    QueryPos qPos = QueryPos.getInstance(q);
1455    
1456                                    qPos.add(companyId);
1457    
1458                                    qPos.add(classNameId);
1459    
1460                                    list = (List<Website>)QueryUtil.list(q, getDialect(), start, end);
1461                            }
1462                            catch (Exception e) {
1463                                    throw processException(e);
1464                            }
1465                            finally {
1466                                    if (list == null) {
1467                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
1468                                    }
1469                                    else {
1470                                            cacheResult(list);
1471    
1472                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
1473                                    }
1474    
1475                                    closeSession(session);
1476                            }
1477                    }
1478    
1479                    return list;
1480            }
1481    
1482            /**
1483             * Returns the first website in the ordered set where companyId = &#63; and classNameId = &#63;.
1484             *
1485             * <p>
1486             * 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.
1487             * </p>
1488             *
1489             * @param companyId the company ID
1490             * @param classNameId the class name ID
1491             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1492             * @return the first matching website
1493             * @throws com.liferay.portal.NoSuchWebsiteException if a matching website could not be found
1494             * @throws SystemException if a system exception occurred
1495             */
1496            public Website findByC_C_First(long companyId, long classNameId,
1497                    OrderByComparator orderByComparator)
1498                    throws NoSuchWebsiteException, SystemException {
1499                    List<Website> list = findByC_C(companyId, classNameId, 0, 1,
1500                                    orderByComparator);
1501    
1502                    if (list.isEmpty()) {
1503                            StringBundler msg = new StringBundler(6);
1504    
1505                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1506    
1507                            msg.append("companyId=");
1508                            msg.append(companyId);
1509    
1510                            msg.append(", classNameId=");
1511                            msg.append(classNameId);
1512    
1513                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1514    
1515                            throw new NoSuchWebsiteException(msg.toString());
1516                    }
1517                    else {
1518                            return list.get(0);
1519                    }
1520            }
1521    
1522            /**
1523             * Returns the last website in the ordered set where companyId = &#63; and classNameId = &#63;.
1524             *
1525             * <p>
1526             * 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.
1527             * </p>
1528             *
1529             * @param companyId the company ID
1530             * @param classNameId the class name ID
1531             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1532             * @return the last matching website
1533             * @throws com.liferay.portal.NoSuchWebsiteException if a matching website could not be found
1534             * @throws SystemException if a system exception occurred
1535             */
1536            public Website findByC_C_Last(long companyId, long classNameId,
1537                    OrderByComparator orderByComparator)
1538                    throws NoSuchWebsiteException, SystemException {
1539                    int count = countByC_C(companyId, classNameId);
1540    
1541                    List<Website> list = findByC_C(companyId, classNameId, count - 1,
1542                                    count, orderByComparator);
1543    
1544                    if (list.isEmpty()) {
1545                            StringBundler msg = new StringBundler(6);
1546    
1547                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1548    
1549                            msg.append("companyId=");
1550                            msg.append(companyId);
1551    
1552                            msg.append(", classNameId=");
1553                            msg.append(classNameId);
1554    
1555                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1556    
1557                            throw new NoSuchWebsiteException(msg.toString());
1558                    }
1559                    else {
1560                            return list.get(0);
1561                    }
1562            }
1563    
1564            /**
1565             * Returns the websites before and after the current website in the ordered set where companyId = &#63; and classNameId = &#63;.
1566             *
1567             * <p>
1568             * 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.
1569             * </p>
1570             *
1571             * @param websiteId the primary key of the current website
1572             * @param companyId the company ID
1573             * @param classNameId the class name ID
1574             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1575             * @return the previous, current, and next website
1576             * @throws com.liferay.portal.NoSuchWebsiteException if a website with the primary key could not be found
1577             * @throws SystemException if a system exception occurred
1578             */
1579            public Website[] findByC_C_PrevAndNext(long websiteId, long companyId,
1580                    long classNameId, OrderByComparator orderByComparator)
1581                    throws NoSuchWebsiteException, SystemException {
1582                    Website website = findByPrimaryKey(websiteId);
1583    
1584                    Session session = null;
1585    
1586                    try {
1587                            session = openSession();
1588    
1589                            Website[] array = new WebsiteImpl[3];
1590    
1591                            array[0] = getByC_C_PrevAndNext(session, website, companyId,
1592                                            classNameId, orderByComparator, true);
1593    
1594                            array[1] = website;
1595    
1596                            array[2] = getByC_C_PrevAndNext(session, website, companyId,
1597                                            classNameId, orderByComparator, false);
1598    
1599                            return array;
1600                    }
1601                    catch (Exception e) {
1602                            throw processException(e);
1603                    }
1604                    finally {
1605                            closeSession(session);
1606                    }
1607            }
1608    
1609            protected Website getByC_C_PrevAndNext(Session session, Website website,
1610                    long companyId, long classNameId, OrderByComparator orderByComparator,
1611                    boolean previous) {
1612                    StringBundler query = null;
1613    
1614                    if (orderByComparator != null) {
1615                            query = new StringBundler(6 +
1616                                            (orderByComparator.getOrderByFields().length * 6));
1617                    }
1618                    else {
1619                            query = new StringBundler(3);
1620                    }
1621    
1622                    query.append(_SQL_SELECT_WEBSITE_WHERE);
1623    
1624                    query.append(_FINDER_COLUMN_C_C_COMPANYID_2);
1625    
1626                    query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
1627    
1628                    if (orderByComparator != null) {
1629                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1630    
1631                            if (orderByConditionFields.length > 0) {
1632                                    query.append(WHERE_AND);
1633                            }
1634    
1635                            for (int i = 0; i < orderByConditionFields.length; i++) {
1636                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1637                                    query.append(orderByConditionFields[i]);
1638    
1639                                    if ((i + 1) < orderByConditionFields.length) {
1640                                            if (orderByComparator.isAscending() ^ previous) {
1641                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1642                                            }
1643                                            else {
1644                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1645                                            }
1646                                    }
1647                                    else {
1648                                            if (orderByComparator.isAscending() ^ previous) {
1649                                                    query.append(WHERE_GREATER_THAN);
1650                                            }
1651                                            else {
1652                                                    query.append(WHERE_LESSER_THAN);
1653                                            }
1654                                    }
1655                            }
1656    
1657                            query.append(ORDER_BY_CLAUSE);
1658    
1659                            String[] orderByFields = orderByComparator.getOrderByFields();
1660    
1661                            for (int i = 0; i < orderByFields.length; i++) {
1662                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1663                                    query.append(orderByFields[i]);
1664    
1665                                    if ((i + 1) < orderByFields.length) {
1666                                            if (orderByComparator.isAscending() ^ previous) {
1667                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1668                                            }
1669                                            else {
1670                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1671                                            }
1672                                    }
1673                                    else {
1674                                            if (orderByComparator.isAscending() ^ previous) {
1675                                                    query.append(ORDER_BY_ASC);
1676                                            }
1677                                            else {
1678                                                    query.append(ORDER_BY_DESC);
1679                                            }
1680                                    }
1681                            }
1682                    }
1683    
1684                    else {
1685                            query.append(WebsiteModelImpl.ORDER_BY_JPQL);
1686                    }
1687    
1688                    String sql = query.toString();
1689    
1690                    Query q = session.createQuery(sql);
1691    
1692                    q.setFirstResult(0);
1693                    q.setMaxResults(2);
1694    
1695                    QueryPos qPos = QueryPos.getInstance(q);
1696    
1697                    qPos.add(companyId);
1698    
1699                    qPos.add(classNameId);
1700    
1701                    if (orderByComparator != null) {
1702                            Object[] values = orderByComparator.getOrderByConditionValues(website);
1703    
1704                            for (Object value : values) {
1705                                    qPos.add(value);
1706                            }
1707                    }
1708    
1709                    List<Website> list = q.list();
1710    
1711                    if (list.size() == 2) {
1712                            return list.get(1);
1713                    }
1714                    else {
1715                            return null;
1716                    }
1717            }
1718    
1719            /**
1720             * Returns all the websites where companyId = &#63; and classNameId = &#63; and classPK = &#63;.
1721             *
1722             * @param companyId the company ID
1723             * @param classNameId the class name ID
1724             * @param classPK the class p k
1725             * @return the matching websites
1726             * @throws SystemException if a system exception occurred
1727             */
1728            public List<Website> findByC_C_C(long companyId, long classNameId,
1729                    long classPK) throws SystemException {
1730                    return findByC_C_C(companyId, classNameId, classPK, QueryUtil.ALL_POS,
1731                            QueryUtil.ALL_POS, null);
1732            }
1733    
1734            /**
1735             * Returns a range of all the websites where companyId = &#63; and classNameId = &#63; and classPK = &#63;.
1736             *
1737             * <p>
1738             * 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.
1739             * </p>
1740             *
1741             * @param companyId the company ID
1742             * @param classNameId the class name ID
1743             * @param classPK the class p k
1744             * @param start the lower bound of the range of websites
1745             * @param end the upper bound of the range of websites (not inclusive)
1746             * @return the range of matching websites
1747             * @throws SystemException if a system exception occurred
1748             */
1749            public List<Website> findByC_C_C(long companyId, long classNameId,
1750                    long classPK, int start, int end) throws SystemException {
1751                    return findByC_C_C(companyId, classNameId, classPK, start, end, null);
1752            }
1753    
1754            /**
1755             * Returns an ordered range of all the websites where companyId = &#63; and classNameId = &#63; and classPK = &#63;.
1756             *
1757             * <p>
1758             * 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.
1759             * </p>
1760             *
1761             * @param companyId the company ID
1762             * @param classNameId the class name ID
1763             * @param classPK the class p k
1764             * @param start the lower bound of the range of websites
1765             * @param end the upper bound of the range of websites (not inclusive)
1766             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1767             * @return the ordered range of matching websites
1768             * @throws SystemException if a system exception occurred
1769             */
1770            public List<Website> findByC_C_C(long companyId, long classNameId,
1771                    long classPK, int start, int end, OrderByComparator orderByComparator)
1772                    throws SystemException {
1773                    FinderPath finderPath = null;
1774                    Object[] finderArgs = null;
1775    
1776                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1777                                    (orderByComparator == null)) {
1778                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C;
1779                            finderArgs = new Object[] { companyId, classNameId, classPK };
1780                    }
1781                    else {
1782                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C_C;
1783                            finderArgs = new Object[] {
1784                                            companyId, classNameId, classPK,
1785                                            
1786                                            start, end, orderByComparator
1787                                    };
1788                    }
1789    
1790                    List<Website> list = (List<Website>)FinderCacheUtil.getResult(finderPath,
1791                                    finderArgs, this);
1792    
1793                    if ((list != null) && !list.isEmpty()) {
1794                            for (Website website : list) {
1795                                    if ((companyId != website.getCompanyId()) ||
1796                                                    (classNameId != website.getClassNameId()) ||
1797                                                    (classPK != website.getClassPK())) {
1798                                            list = null;
1799    
1800                                            break;
1801                                    }
1802                            }
1803                    }
1804    
1805                    if (list == null) {
1806                            StringBundler query = null;
1807    
1808                            if (orderByComparator != null) {
1809                                    query = new StringBundler(5 +
1810                                                    (orderByComparator.getOrderByFields().length * 3));
1811                            }
1812                            else {
1813                                    query = new StringBundler(5);
1814                            }
1815    
1816                            query.append(_SQL_SELECT_WEBSITE_WHERE);
1817    
1818                            query.append(_FINDER_COLUMN_C_C_C_COMPANYID_2);
1819    
1820                            query.append(_FINDER_COLUMN_C_C_C_CLASSNAMEID_2);
1821    
1822                            query.append(_FINDER_COLUMN_C_C_C_CLASSPK_2);
1823    
1824                            if (orderByComparator != null) {
1825                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1826                                            orderByComparator);
1827                            }
1828    
1829                            else {
1830                                    query.append(WebsiteModelImpl.ORDER_BY_JPQL);
1831                            }
1832    
1833                            String sql = query.toString();
1834    
1835                            Session session = null;
1836    
1837                            try {
1838                                    session = openSession();
1839    
1840                                    Query q = session.createQuery(sql);
1841    
1842                                    QueryPos qPos = QueryPos.getInstance(q);
1843    
1844                                    qPos.add(companyId);
1845    
1846                                    qPos.add(classNameId);
1847    
1848                                    qPos.add(classPK);
1849    
1850                                    list = (List<Website>)QueryUtil.list(q, getDialect(), start, end);
1851                            }
1852                            catch (Exception e) {
1853                                    throw processException(e);
1854                            }
1855                            finally {
1856                                    if (list == null) {
1857                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
1858                                    }
1859                                    else {
1860                                            cacheResult(list);
1861    
1862                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
1863                                    }
1864    
1865                                    closeSession(session);
1866                            }
1867                    }
1868    
1869                    return list;
1870            }
1871    
1872            /**
1873             * Returns the first website in the ordered set where companyId = &#63; and classNameId = &#63; and classPK = &#63;.
1874             *
1875             * <p>
1876             * 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.
1877             * </p>
1878             *
1879             * @param companyId the company ID
1880             * @param classNameId the class name ID
1881             * @param classPK the class p k
1882             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1883             * @return the first matching website
1884             * @throws com.liferay.portal.NoSuchWebsiteException if a matching website could not be found
1885             * @throws SystemException if a system exception occurred
1886             */
1887            public Website findByC_C_C_First(long companyId, long classNameId,
1888                    long classPK, OrderByComparator orderByComparator)
1889                    throws NoSuchWebsiteException, SystemException {
1890                    List<Website> list = findByC_C_C(companyId, classNameId, classPK, 0, 1,
1891                                    orderByComparator);
1892    
1893                    if (list.isEmpty()) {
1894                            StringBundler msg = new StringBundler(8);
1895    
1896                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1897    
1898                            msg.append("companyId=");
1899                            msg.append(companyId);
1900    
1901                            msg.append(", classNameId=");
1902                            msg.append(classNameId);
1903    
1904                            msg.append(", classPK=");
1905                            msg.append(classPK);
1906    
1907                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1908    
1909                            throw new NoSuchWebsiteException(msg.toString());
1910                    }
1911                    else {
1912                            return list.get(0);
1913                    }
1914            }
1915    
1916            /**
1917             * Returns the last website in the ordered set where companyId = &#63; and classNameId = &#63; and classPK = &#63;.
1918             *
1919             * <p>
1920             * 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.
1921             * </p>
1922             *
1923             * @param companyId the company ID
1924             * @param classNameId the class name ID
1925             * @param classPK the class p k
1926             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1927             * @return the last matching website
1928             * @throws com.liferay.portal.NoSuchWebsiteException if a matching website could not be found
1929             * @throws SystemException if a system exception occurred
1930             */
1931            public Website findByC_C_C_Last(long companyId, long classNameId,
1932                    long classPK, OrderByComparator orderByComparator)
1933                    throws NoSuchWebsiteException, SystemException {
1934                    int count = countByC_C_C(companyId, classNameId, classPK);
1935    
1936                    List<Website> list = findByC_C_C(companyId, classNameId, classPK,
1937                                    count - 1, count, orderByComparator);
1938    
1939                    if (list.isEmpty()) {
1940                            StringBundler msg = new StringBundler(8);
1941    
1942                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1943    
1944                            msg.append("companyId=");
1945                            msg.append(companyId);
1946    
1947                            msg.append(", classNameId=");
1948                            msg.append(classNameId);
1949    
1950                            msg.append(", classPK=");
1951                            msg.append(classPK);
1952    
1953                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1954    
1955                            throw new NoSuchWebsiteException(msg.toString());
1956                    }
1957                    else {
1958                            return list.get(0);
1959                    }
1960            }
1961    
1962            /**
1963             * Returns the websites before and after the current website in the ordered set where companyId = &#63; and classNameId = &#63; and classPK = &#63;.
1964             *
1965             * <p>
1966             * 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.
1967             * </p>
1968             *
1969             * @param websiteId the primary key of the current website
1970             * @param companyId the company ID
1971             * @param classNameId the class name ID
1972             * @param classPK the class p k
1973             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1974             * @return the previous, current, and next website
1975             * @throws com.liferay.portal.NoSuchWebsiteException if a website with the primary key could not be found
1976             * @throws SystemException if a system exception occurred
1977             */
1978            public Website[] findByC_C_C_PrevAndNext(long websiteId, long companyId,
1979                    long classNameId, long classPK, OrderByComparator orderByComparator)
1980                    throws NoSuchWebsiteException, SystemException {
1981                    Website website = findByPrimaryKey(websiteId);
1982    
1983                    Session session = null;
1984    
1985                    try {
1986                            session = openSession();
1987    
1988                            Website[] array = new WebsiteImpl[3];
1989    
1990                            array[0] = getByC_C_C_PrevAndNext(session, website, companyId,
1991                                            classNameId, classPK, orderByComparator, true);
1992    
1993                            array[1] = website;
1994    
1995                            array[2] = getByC_C_C_PrevAndNext(session, website, companyId,
1996                                            classNameId, classPK, orderByComparator, false);
1997    
1998                            return array;
1999                    }
2000                    catch (Exception e) {
2001                            throw processException(e);
2002                    }
2003                    finally {
2004                            closeSession(session);
2005                    }
2006            }
2007    
2008            protected Website getByC_C_C_PrevAndNext(Session session, Website website,
2009                    long companyId, long classNameId, long classPK,
2010                    OrderByComparator orderByComparator, boolean previous) {
2011                    StringBundler query = null;
2012    
2013                    if (orderByComparator != null) {
2014                            query = new StringBundler(6 +
2015                                            (orderByComparator.getOrderByFields().length * 6));
2016                    }
2017                    else {
2018                            query = new StringBundler(3);
2019                    }
2020    
2021                    query.append(_SQL_SELECT_WEBSITE_WHERE);
2022    
2023                    query.append(_FINDER_COLUMN_C_C_C_COMPANYID_2);
2024    
2025                    query.append(_FINDER_COLUMN_C_C_C_CLASSNAMEID_2);
2026    
2027                    query.append(_FINDER_COLUMN_C_C_C_CLASSPK_2);
2028    
2029                    if (orderByComparator != null) {
2030                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2031    
2032                            if (orderByConditionFields.length > 0) {
2033                                    query.append(WHERE_AND);
2034                            }
2035    
2036                            for (int i = 0; i < orderByConditionFields.length; i++) {
2037                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2038                                    query.append(orderByConditionFields[i]);
2039    
2040                                    if ((i + 1) < orderByConditionFields.length) {
2041                                            if (orderByComparator.isAscending() ^ previous) {
2042                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
2043                                            }
2044                                            else {
2045                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
2046                                            }
2047                                    }
2048                                    else {
2049                                            if (orderByComparator.isAscending() ^ previous) {
2050                                                    query.append(WHERE_GREATER_THAN);
2051                                            }
2052                                            else {
2053                                                    query.append(WHERE_LESSER_THAN);
2054                                            }
2055                                    }
2056                            }
2057    
2058                            query.append(ORDER_BY_CLAUSE);
2059    
2060                            String[] orderByFields = orderByComparator.getOrderByFields();
2061    
2062                            for (int i = 0; i < orderByFields.length; i++) {
2063                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2064                                    query.append(orderByFields[i]);
2065    
2066                                    if ((i + 1) < orderByFields.length) {
2067                                            if (orderByComparator.isAscending() ^ previous) {
2068                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
2069                                            }
2070                                            else {
2071                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
2072                                            }
2073                                    }
2074                                    else {
2075                                            if (orderByComparator.isAscending() ^ previous) {
2076                                                    query.append(ORDER_BY_ASC);
2077                                            }
2078                                            else {
2079                                                    query.append(ORDER_BY_DESC);
2080                                            }
2081                                    }
2082                            }
2083                    }
2084    
2085                    else {
2086                            query.append(WebsiteModelImpl.ORDER_BY_JPQL);
2087                    }
2088    
2089                    String sql = query.toString();
2090    
2091                    Query q = session.createQuery(sql);
2092    
2093                    q.setFirstResult(0);
2094                    q.setMaxResults(2);
2095    
2096                    QueryPos qPos = QueryPos.getInstance(q);
2097    
2098                    qPos.add(companyId);
2099    
2100                    qPos.add(classNameId);
2101    
2102                    qPos.add(classPK);
2103    
2104                    if (orderByComparator != null) {
2105                            Object[] values = orderByComparator.getOrderByConditionValues(website);
2106    
2107                            for (Object value : values) {
2108                                    qPos.add(value);
2109                            }
2110                    }
2111    
2112                    List<Website> list = q.list();
2113    
2114                    if (list.size() == 2) {
2115                            return list.get(1);
2116                    }
2117                    else {
2118                            return null;
2119                    }
2120            }
2121    
2122            /**
2123             * Returns all the websites where companyId = &#63; and classNameId = &#63; and classPK = &#63; and primary = &#63;.
2124             *
2125             * @param companyId the company ID
2126             * @param classNameId the class name ID
2127             * @param classPK the class p k
2128             * @param primary the primary
2129             * @return the matching websites
2130             * @throws SystemException if a system exception occurred
2131             */
2132            public List<Website> findByC_C_C_P(long companyId, long classNameId,
2133                    long classPK, boolean primary) throws SystemException {
2134                    return findByC_C_C_P(companyId, classNameId, classPK, primary,
2135                            QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2136            }
2137    
2138            /**
2139             * Returns a range of all the websites where companyId = &#63; and classNameId = &#63; and classPK = &#63; and primary = &#63;.
2140             *
2141             * <p>
2142             * 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.
2143             * </p>
2144             *
2145             * @param companyId the company ID
2146             * @param classNameId the class name ID
2147             * @param classPK the class p k
2148             * @param primary the primary
2149             * @param start the lower bound of the range of websites
2150             * @param end the upper bound of the range of websites (not inclusive)
2151             * @return the range of matching websites
2152             * @throws SystemException if a system exception occurred
2153             */
2154            public List<Website> findByC_C_C_P(long companyId, long classNameId,
2155                    long classPK, boolean primary, int start, int end)
2156                    throws SystemException {
2157                    return findByC_C_C_P(companyId, classNameId, classPK, primary, start,
2158                            end, null);
2159            }
2160    
2161            /**
2162             * Returns an ordered range of all the websites where companyId = &#63; and classNameId = &#63; and classPK = &#63; and primary = &#63;.
2163             *
2164             * <p>
2165             * 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.
2166             * </p>
2167             *
2168             * @param companyId the company ID
2169             * @param classNameId the class name ID
2170             * @param classPK the class p k
2171             * @param primary the primary
2172             * @param start the lower bound of the range of websites
2173             * @param end the upper bound of the range of websites (not inclusive)
2174             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
2175             * @return the ordered range of matching websites
2176             * @throws SystemException if a system exception occurred
2177             */
2178            public List<Website> findByC_C_C_P(long companyId, long classNameId,
2179                    long classPK, boolean primary, int start, int end,
2180                    OrderByComparator orderByComparator) throws SystemException {
2181                    FinderPath finderPath = null;
2182                    Object[] finderArgs = null;
2183    
2184                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2185                                    (orderByComparator == null)) {
2186                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C_P;
2187                            finderArgs = new Object[] { companyId, classNameId, classPK, primary };
2188                    }
2189                    else {
2190                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C_C_P;
2191                            finderArgs = new Object[] {
2192                                            companyId, classNameId, classPK, primary,
2193                                            
2194                                            start, end, orderByComparator
2195                                    };
2196                    }
2197    
2198                    List<Website> list = (List<Website>)FinderCacheUtil.getResult(finderPath,
2199                                    finderArgs, this);
2200    
2201                    if ((list != null) && !list.isEmpty()) {
2202                            for (Website website : list) {
2203                                    if ((companyId != website.getCompanyId()) ||
2204                                                    (classNameId != website.getClassNameId()) ||
2205                                                    (classPK != website.getClassPK()) ||
2206                                                    (primary != website.getPrimary())) {
2207                                            list = null;
2208    
2209                                            break;
2210                                    }
2211                            }
2212                    }
2213    
2214                    if (list == null) {
2215                            StringBundler query = null;
2216    
2217                            if (orderByComparator != null) {
2218                                    query = new StringBundler(6 +
2219                                                    (orderByComparator.getOrderByFields().length * 3));
2220                            }
2221                            else {
2222                                    query = new StringBundler(6);
2223                            }
2224    
2225                            query.append(_SQL_SELECT_WEBSITE_WHERE);
2226    
2227                            query.append(_FINDER_COLUMN_C_C_C_P_COMPANYID_2);
2228    
2229                            query.append(_FINDER_COLUMN_C_C_C_P_CLASSNAMEID_2);
2230    
2231                            query.append(_FINDER_COLUMN_C_C_C_P_CLASSPK_2);
2232    
2233                            query.append(_FINDER_COLUMN_C_C_C_P_PRIMARY_2);
2234    
2235                            if (orderByComparator != null) {
2236                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2237                                            orderByComparator);
2238                            }
2239    
2240                            else {
2241                                    query.append(WebsiteModelImpl.ORDER_BY_JPQL);
2242                            }
2243    
2244                            String sql = query.toString();
2245    
2246                            Session session = null;
2247    
2248                            try {
2249                                    session = openSession();
2250    
2251                                    Query q = session.createQuery(sql);
2252    
2253                                    QueryPos qPos = QueryPos.getInstance(q);
2254    
2255                                    qPos.add(companyId);
2256    
2257                                    qPos.add(classNameId);
2258    
2259                                    qPos.add(classPK);
2260    
2261                                    qPos.add(primary);
2262    
2263                                    list = (List<Website>)QueryUtil.list(q, getDialect(), start, end);
2264                            }
2265                            catch (Exception e) {
2266                                    throw processException(e);
2267                            }
2268                            finally {
2269                                    if (list == null) {
2270                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
2271                                    }
2272                                    else {
2273                                            cacheResult(list);
2274    
2275                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
2276                                    }
2277    
2278                                    closeSession(session);
2279                            }
2280                    }
2281    
2282                    return list;
2283            }
2284    
2285            /**
2286             * Returns the first website in the ordered set where companyId = &#63; and classNameId = &#63; and classPK = &#63; and primary = &#63;.
2287             *
2288             * <p>
2289             * 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.
2290             * </p>
2291             *
2292             * @param companyId the company ID
2293             * @param classNameId the class name ID
2294             * @param classPK the class p k
2295             * @param primary the primary
2296             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
2297             * @return the first matching website
2298             * @throws com.liferay.portal.NoSuchWebsiteException if a matching website could not be found
2299             * @throws SystemException if a system exception occurred
2300             */
2301            public Website findByC_C_C_P_First(long companyId, long classNameId,
2302                    long classPK, boolean primary, OrderByComparator orderByComparator)
2303                    throws NoSuchWebsiteException, SystemException {
2304                    List<Website> list = findByC_C_C_P(companyId, classNameId, classPK,
2305                                    primary, 0, 1, orderByComparator);
2306    
2307                    if (list.isEmpty()) {
2308                            StringBundler msg = new StringBundler(10);
2309    
2310                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2311    
2312                            msg.append("companyId=");
2313                            msg.append(companyId);
2314    
2315                            msg.append(", classNameId=");
2316                            msg.append(classNameId);
2317    
2318                            msg.append(", classPK=");
2319                            msg.append(classPK);
2320    
2321                            msg.append(", primary=");
2322                            msg.append(primary);
2323    
2324                            msg.append(StringPool.CLOSE_CURLY_BRACE);
2325    
2326                            throw new NoSuchWebsiteException(msg.toString());
2327                    }
2328                    else {
2329                            return list.get(0);
2330                    }
2331            }
2332    
2333            /**
2334             * Returns the last website in the ordered set where companyId = &#63; and classNameId = &#63; and classPK = &#63; and primary = &#63;.
2335             *
2336             * <p>
2337             * 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.
2338             * </p>
2339             *
2340             * @param companyId the company ID
2341             * @param classNameId the class name ID
2342             * @param classPK the class p k
2343             * @param primary the primary
2344             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
2345             * @return the last matching website
2346             * @throws com.liferay.portal.NoSuchWebsiteException if a matching website could not be found
2347             * @throws SystemException if a system exception occurred
2348             */
2349            public Website findByC_C_C_P_Last(long companyId, long classNameId,
2350                    long classPK, boolean primary, OrderByComparator orderByComparator)
2351                    throws NoSuchWebsiteException, SystemException {
2352                    int count = countByC_C_C_P(companyId, classNameId, classPK, primary);
2353    
2354                    List<Website> list = findByC_C_C_P(companyId, classNameId, classPK,
2355                                    primary, count - 1, count, orderByComparator);
2356    
2357                    if (list.isEmpty()) {
2358                            StringBundler msg = new StringBundler(10);
2359    
2360                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2361    
2362                            msg.append("companyId=");
2363                            msg.append(companyId);
2364    
2365                            msg.append(", classNameId=");
2366                            msg.append(classNameId);
2367    
2368                            msg.append(", classPK=");
2369                            msg.append(classPK);
2370    
2371                            msg.append(", primary=");
2372                            msg.append(primary);
2373    
2374                            msg.append(StringPool.CLOSE_CURLY_BRACE);
2375    
2376                            throw new NoSuchWebsiteException(msg.toString());
2377                    }
2378                    else {
2379                            return list.get(0);
2380                    }
2381            }
2382    
2383            /**
2384             * Returns the websites before and after the current website in the ordered set where companyId = &#63; and classNameId = &#63; and classPK = &#63; and primary = &#63;.
2385             *
2386             * <p>
2387             * 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.
2388             * </p>
2389             *
2390             * @param websiteId the primary key of the current website
2391             * @param companyId the company ID
2392             * @param classNameId the class name ID
2393             * @param classPK the class p k
2394             * @param primary the primary
2395             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
2396             * @return the previous, current, and next website
2397             * @throws com.liferay.portal.NoSuchWebsiteException if a website with the primary key could not be found
2398             * @throws SystemException if a system exception occurred
2399             */
2400            public Website[] findByC_C_C_P_PrevAndNext(long websiteId, long companyId,
2401                    long classNameId, long classPK, boolean primary,
2402                    OrderByComparator orderByComparator)
2403                    throws NoSuchWebsiteException, SystemException {
2404                    Website website = findByPrimaryKey(websiteId);
2405    
2406                    Session session = null;
2407    
2408                    try {
2409                            session = openSession();
2410    
2411                            Website[] array = new WebsiteImpl[3];
2412    
2413                            array[0] = getByC_C_C_P_PrevAndNext(session, website, companyId,
2414                                            classNameId, classPK, primary, orderByComparator, true);
2415    
2416                            array[1] = website;
2417    
2418                            array[2] = getByC_C_C_P_PrevAndNext(session, website, companyId,
2419                                            classNameId, classPK, primary, orderByComparator, false);
2420    
2421                            return array;
2422                    }
2423                    catch (Exception e) {
2424                            throw processException(e);
2425                    }
2426                    finally {
2427                            closeSession(session);
2428                    }
2429            }
2430    
2431            protected Website getByC_C_C_P_PrevAndNext(Session session,
2432                    Website website, long companyId, long classNameId, long classPK,
2433                    boolean primary, OrderByComparator orderByComparator, boolean previous) {
2434                    StringBundler query = null;
2435    
2436                    if (orderByComparator != null) {
2437                            query = new StringBundler(6 +
2438                                            (orderByComparator.getOrderByFields().length * 6));
2439                    }
2440                    else {
2441                            query = new StringBundler(3);
2442                    }
2443    
2444                    query.append(_SQL_SELECT_WEBSITE_WHERE);
2445    
2446                    query.append(_FINDER_COLUMN_C_C_C_P_COMPANYID_2);
2447    
2448                    query.append(_FINDER_COLUMN_C_C_C_P_CLASSNAMEID_2);
2449    
2450                    query.append(_FINDER_COLUMN_C_C_C_P_CLASSPK_2);
2451    
2452                    query.append(_FINDER_COLUMN_C_C_C_P_PRIMARY_2);
2453    
2454                    if (orderByComparator != null) {
2455                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2456    
2457                            if (orderByConditionFields.length > 0) {
2458                                    query.append(WHERE_AND);
2459                            }
2460    
2461                            for (int i = 0; i < orderByConditionFields.length; i++) {
2462                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2463                                    query.append(orderByConditionFields[i]);
2464    
2465                                    if ((i + 1) < orderByConditionFields.length) {
2466                                            if (orderByComparator.isAscending() ^ previous) {
2467                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
2468                                            }
2469                                            else {
2470                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
2471                                            }
2472                                    }
2473                                    else {
2474                                            if (orderByComparator.isAscending() ^ previous) {
2475                                                    query.append(WHERE_GREATER_THAN);
2476                                            }
2477                                            else {
2478                                                    query.append(WHERE_LESSER_THAN);
2479                                            }
2480                                    }
2481                            }
2482    
2483                            query.append(ORDER_BY_CLAUSE);
2484    
2485                            String[] orderByFields = orderByComparator.getOrderByFields();
2486    
2487                            for (int i = 0; i < orderByFields.length; i++) {
2488                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2489                                    query.append(orderByFields[i]);
2490    
2491                                    if ((i + 1) < orderByFields.length) {
2492                                            if (orderByComparator.isAscending() ^ previous) {
2493                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
2494                                            }
2495                                            else {
2496                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
2497                                            }
2498                                    }
2499                                    else {
2500                                            if (orderByComparator.isAscending() ^ previous) {
2501                                                    query.append(ORDER_BY_ASC);
2502                                            }
2503                                            else {
2504                                                    query.append(ORDER_BY_DESC);
2505                                            }
2506                                    }
2507                            }
2508                    }
2509    
2510                    else {
2511                            query.append(WebsiteModelImpl.ORDER_BY_JPQL);
2512                    }
2513    
2514                    String sql = query.toString();
2515    
2516                    Query q = session.createQuery(sql);
2517    
2518                    q.setFirstResult(0);
2519                    q.setMaxResults(2);
2520    
2521                    QueryPos qPos = QueryPos.getInstance(q);
2522    
2523                    qPos.add(companyId);
2524    
2525                    qPos.add(classNameId);
2526    
2527                    qPos.add(classPK);
2528    
2529                    qPos.add(primary);
2530    
2531                    if (orderByComparator != null) {
2532                            Object[] values = orderByComparator.getOrderByConditionValues(website);
2533    
2534                            for (Object value : values) {
2535                                    qPos.add(value);
2536                            }
2537                    }
2538    
2539                    List<Website> list = q.list();
2540    
2541                    if (list.size() == 2) {
2542                            return list.get(1);
2543                    }
2544                    else {
2545                            return null;
2546                    }
2547            }
2548    
2549            /**
2550             * Returns all the websites.
2551             *
2552             * @return the websites
2553             * @throws SystemException if a system exception occurred
2554             */
2555            public List<Website> findAll() throws SystemException {
2556                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2557            }
2558    
2559            /**
2560             * Returns a range of all the websites.
2561             *
2562             * <p>
2563             * 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.
2564             * </p>
2565             *
2566             * @param start the lower bound of the range of websites
2567             * @param end the upper bound of the range of websites (not inclusive)
2568             * @return the range of websites
2569             * @throws SystemException if a system exception occurred
2570             */
2571            public List<Website> findAll(int start, int end) throws SystemException {
2572                    return findAll(start, end, null);
2573            }
2574    
2575            /**
2576             * Returns an ordered range of all the websites.
2577             *
2578             * <p>
2579             * 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.
2580             * </p>
2581             *
2582             * @param start the lower bound of the range of websites
2583             * @param end the upper bound of the range of websites (not inclusive)
2584             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
2585             * @return the ordered range of websites
2586             * @throws SystemException if a system exception occurred
2587             */
2588            public List<Website> findAll(int start, int end,
2589                    OrderByComparator orderByComparator) throws SystemException {
2590                    FinderPath finderPath = null;
2591                    Object[] finderArgs = new Object[] { start, end, orderByComparator };
2592    
2593                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2594                                    (orderByComparator == null)) {
2595                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
2596                            finderArgs = FINDER_ARGS_EMPTY;
2597                    }
2598                    else {
2599                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
2600                            finderArgs = new Object[] { start, end, orderByComparator };
2601                    }
2602    
2603                    List<Website> list = (List<Website>)FinderCacheUtil.getResult(finderPath,
2604                                    finderArgs, this);
2605    
2606                    if (list == null) {
2607                            StringBundler query = null;
2608                            String sql = null;
2609    
2610                            if (orderByComparator != null) {
2611                                    query = new StringBundler(2 +
2612                                                    (orderByComparator.getOrderByFields().length * 3));
2613    
2614                                    query.append(_SQL_SELECT_WEBSITE);
2615    
2616                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2617                                            orderByComparator);
2618    
2619                                    sql = query.toString();
2620                            }
2621                            else {
2622                                    sql = _SQL_SELECT_WEBSITE.concat(WebsiteModelImpl.ORDER_BY_JPQL);
2623                            }
2624    
2625                            Session session = null;
2626    
2627                            try {
2628                                    session = openSession();
2629    
2630                                    Query q = session.createQuery(sql);
2631    
2632                                    if (orderByComparator == null) {
2633                                            list = (List<Website>)QueryUtil.list(q, getDialect(),
2634                                                            start, end, false);
2635    
2636                                            Collections.sort(list);
2637                                    }
2638                                    else {
2639                                            list = (List<Website>)QueryUtil.list(q, getDialect(),
2640                                                            start, end);
2641                                    }
2642                            }
2643                            catch (Exception e) {
2644                                    throw processException(e);
2645                            }
2646                            finally {
2647                                    if (list == null) {
2648                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
2649                                    }
2650                                    else {
2651                                            cacheResult(list);
2652    
2653                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
2654                                    }
2655    
2656                                    closeSession(session);
2657                            }
2658                    }
2659    
2660                    return list;
2661            }
2662    
2663            /**
2664             * Removes all the websites where companyId = &#63; from the database.
2665             *
2666             * @param companyId the company ID
2667             * @throws SystemException if a system exception occurred
2668             */
2669            public void removeByCompanyId(long companyId) throws SystemException {
2670                    for (Website website : findByCompanyId(companyId)) {
2671                            remove(website);
2672                    }
2673            }
2674    
2675            /**
2676             * Removes all the websites where userId = &#63; from the database.
2677             *
2678             * @param userId the user ID
2679             * @throws SystemException if a system exception occurred
2680             */
2681            public void removeByUserId(long userId) throws SystemException {
2682                    for (Website website : findByUserId(userId)) {
2683                            remove(website);
2684                    }
2685            }
2686    
2687            /**
2688             * Removes all the websites where companyId = &#63; and classNameId = &#63; from the database.
2689             *
2690             * @param companyId the company ID
2691             * @param classNameId the class name ID
2692             * @throws SystemException if a system exception occurred
2693             */
2694            public void removeByC_C(long companyId, long classNameId)
2695                    throws SystemException {
2696                    for (Website website : findByC_C(companyId, classNameId)) {
2697                            remove(website);
2698                    }
2699            }
2700    
2701            /**
2702             * Removes all the websites where companyId = &#63; and classNameId = &#63; and classPK = &#63; from the database.
2703             *
2704             * @param companyId the company ID
2705             * @param classNameId the class name ID
2706             * @param classPK the class p k
2707             * @throws SystemException if a system exception occurred
2708             */
2709            public void removeByC_C_C(long companyId, long classNameId, long classPK)
2710                    throws SystemException {
2711                    for (Website website : findByC_C_C(companyId, classNameId, classPK)) {
2712                            remove(website);
2713                    }
2714            }
2715    
2716            /**
2717             * Removes all the websites where companyId = &#63; and classNameId = &#63; and classPK = &#63; and primary = &#63; from the database.
2718             *
2719             * @param companyId the company ID
2720             * @param classNameId the class name ID
2721             * @param classPK the class p k
2722             * @param primary the primary
2723             * @throws SystemException if a system exception occurred
2724             */
2725            public void removeByC_C_C_P(long companyId, long classNameId, long classPK,
2726                    boolean primary) throws SystemException {
2727                    for (Website website : findByC_C_C_P(companyId, classNameId, classPK,
2728                                    primary)) {
2729                            remove(website);
2730                    }
2731            }
2732    
2733            /**
2734             * Removes all the websites from the database.
2735             *
2736             * @throws SystemException if a system exception occurred
2737             */
2738            public void removeAll() throws SystemException {
2739                    for (Website website : findAll()) {
2740                            remove(website);
2741                    }
2742            }
2743    
2744            /**
2745             * Returns the number of websites where companyId = &#63;.
2746             *
2747             * @param companyId the company ID
2748             * @return the number of matching websites
2749             * @throws SystemException if a system exception occurred
2750             */
2751            public int countByCompanyId(long companyId) throws SystemException {
2752                    Object[] finderArgs = new Object[] { companyId };
2753    
2754                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
2755                                    finderArgs, this);
2756    
2757                    if (count == null) {
2758                            StringBundler query = new StringBundler(2);
2759    
2760                            query.append(_SQL_COUNT_WEBSITE_WHERE);
2761    
2762                            query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
2763    
2764                            String sql = query.toString();
2765    
2766                            Session session = null;
2767    
2768                            try {
2769                                    session = openSession();
2770    
2771                                    Query q = session.createQuery(sql);
2772    
2773                                    QueryPos qPos = QueryPos.getInstance(q);
2774    
2775                                    qPos.add(companyId);
2776    
2777                                    count = (Long)q.uniqueResult();
2778                            }
2779                            catch (Exception e) {
2780                                    throw processException(e);
2781                            }
2782                            finally {
2783                                    if (count == null) {
2784                                            count = Long.valueOf(0);
2785                                    }
2786    
2787                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
2788                                            finderArgs, count);
2789    
2790                                    closeSession(session);
2791                            }
2792                    }
2793    
2794                    return count.intValue();
2795            }
2796    
2797            /**
2798             * Returns the number of websites where userId = &#63;.
2799             *
2800             * @param userId the user ID
2801             * @return the number of matching websites
2802             * @throws SystemException if a system exception occurred
2803             */
2804            public int countByUserId(long userId) throws SystemException {
2805                    Object[] finderArgs = new Object[] { userId };
2806    
2807                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERID,
2808                                    finderArgs, this);
2809    
2810                    if (count == null) {
2811                            StringBundler query = new StringBundler(2);
2812    
2813                            query.append(_SQL_COUNT_WEBSITE_WHERE);
2814    
2815                            query.append(_FINDER_COLUMN_USERID_USERID_2);
2816    
2817                            String sql = query.toString();
2818    
2819                            Session session = null;
2820    
2821                            try {
2822                                    session = openSession();
2823    
2824                                    Query q = session.createQuery(sql);
2825    
2826                                    QueryPos qPos = QueryPos.getInstance(q);
2827    
2828                                    qPos.add(userId);
2829    
2830                                    count = (Long)q.uniqueResult();
2831                            }
2832                            catch (Exception e) {
2833                                    throw processException(e);
2834                            }
2835                            finally {
2836                                    if (count == null) {
2837                                            count = Long.valueOf(0);
2838                                    }
2839    
2840                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERID,
2841                                            finderArgs, count);
2842    
2843                                    closeSession(session);
2844                            }
2845                    }
2846    
2847                    return count.intValue();
2848            }
2849    
2850            /**
2851             * Returns the number of websites where companyId = &#63; and classNameId = &#63;.
2852             *
2853             * @param companyId the company ID
2854             * @param classNameId the class name ID
2855             * @return the number of matching websites
2856             * @throws SystemException if a system exception occurred
2857             */
2858            public int countByC_C(long companyId, long classNameId)
2859                    throws SystemException {
2860                    Object[] finderArgs = new Object[] { companyId, classNameId };
2861    
2862                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C,
2863                                    finderArgs, this);
2864    
2865                    if (count == null) {
2866                            StringBundler query = new StringBundler(3);
2867    
2868                            query.append(_SQL_COUNT_WEBSITE_WHERE);
2869    
2870                            query.append(_FINDER_COLUMN_C_C_COMPANYID_2);
2871    
2872                            query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
2873    
2874                            String sql = query.toString();
2875    
2876                            Session session = null;
2877    
2878                            try {
2879                                    session = openSession();
2880    
2881                                    Query q = session.createQuery(sql);
2882    
2883                                    QueryPos qPos = QueryPos.getInstance(q);
2884    
2885                                    qPos.add(companyId);
2886    
2887                                    qPos.add(classNameId);
2888    
2889                                    count = (Long)q.uniqueResult();
2890                            }
2891                            catch (Exception e) {
2892                                    throw processException(e);
2893                            }
2894                            finally {
2895                                    if (count == null) {
2896                                            count = Long.valueOf(0);
2897                                    }
2898    
2899                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, finderArgs,
2900                                            count);
2901    
2902                                    closeSession(session);
2903                            }
2904                    }
2905    
2906                    return count.intValue();
2907            }
2908    
2909            /**
2910             * Returns the number of websites where companyId = &#63; and classNameId = &#63; and classPK = &#63;.
2911             *
2912             * @param companyId the company ID
2913             * @param classNameId the class name ID
2914             * @param classPK the class p k
2915             * @return the number of matching websites
2916             * @throws SystemException if a system exception occurred
2917             */
2918            public int countByC_C_C(long companyId, long classNameId, long classPK)
2919                    throws SystemException {
2920                    Object[] finderArgs = new Object[] { companyId, classNameId, classPK };
2921    
2922                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C_C,
2923                                    finderArgs, this);
2924    
2925                    if (count == null) {
2926                            StringBundler query = new StringBundler(4);
2927    
2928                            query.append(_SQL_COUNT_WEBSITE_WHERE);
2929    
2930                            query.append(_FINDER_COLUMN_C_C_C_COMPANYID_2);
2931    
2932                            query.append(_FINDER_COLUMN_C_C_C_CLASSNAMEID_2);
2933    
2934                            query.append(_FINDER_COLUMN_C_C_C_CLASSPK_2);
2935    
2936                            String sql = query.toString();
2937    
2938                            Session session = null;
2939    
2940                            try {
2941                                    session = openSession();
2942    
2943                                    Query q = session.createQuery(sql);
2944    
2945                                    QueryPos qPos = QueryPos.getInstance(q);
2946    
2947                                    qPos.add(companyId);
2948    
2949                                    qPos.add(classNameId);
2950    
2951                                    qPos.add(classPK);
2952    
2953                                    count = (Long)q.uniqueResult();
2954                            }
2955                            catch (Exception e) {
2956                                    throw processException(e);
2957                            }
2958                            finally {
2959                                    if (count == null) {
2960                                            count = Long.valueOf(0);
2961                                    }
2962    
2963                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C_C,
2964                                            finderArgs, count);
2965    
2966                                    closeSession(session);
2967                            }
2968                    }
2969    
2970                    return count.intValue();
2971            }
2972    
2973            /**
2974             * Returns the number of websites where companyId = &#63; and classNameId = &#63; and classPK = &#63; and primary = &#63;.
2975             *
2976             * @param companyId the company ID
2977             * @param classNameId the class name ID
2978             * @param classPK the class p k
2979             * @param primary the primary
2980             * @return the number of matching websites
2981             * @throws SystemException if a system exception occurred
2982             */
2983            public int countByC_C_C_P(long companyId, long classNameId, long classPK,
2984                    boolean primary) throws SystemException {
2985                    Object[] finderArgs = new Object[] {
2986                                    companyId, classNameId, classPK, primary
2987                            };
2988    
2989                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C_C_P,
2990                                    finderArgs, this);
2991    
2992                    if (count == null) {
2993                            StringBundler query = new StringBundler(5);
2994    
2995                            query.append(_SQL_COUNT_WEBSITE_WHERE);
2996    
2997                            query.append(_FINDER_COLUMN_C_C_C_P_COMPANYID_2);
2998    
2999                            query.append(_FINDER_COLUMN_C_C_C_P_CLASSNAMEID_2);
3000    
3001                            query.append(_FINDER_COLUMN_C_C_C_P_CLASSPK_2);
3002    
3003                            query.append(_FINDER_COLUMN_C_C_C_P_PRIMARY_2);
3004    
3005                            String sql = query.toString();
3006    
3007                            Session session = null;
3008    
3009                            try {
3010                                    session = openSession();
3011    
3012                                    Query q = session.createQuery(sql);
3013    
3014                                    QueryPos qPos = QueryPos.getInstance(q);
3015    
3016                                    qPos.add(companyId);
3017    
3018                                    qPos.add(classNameId);
3019    
3020                                    qPos.add(classPK);
3021    
3022                                    qPos.add(primary);
3023    
3024                                    count = (Long)q.uniqueResult();
3025                            }
3026                            catch (Exception e) {
3027                                    throw processException(e);
3028                            }
3029                            finally {
3030                                    if (count == null) {
3031                                            count = Long.valueOf(0);
3032                                    }
3033    
3034                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C_C_P,
3035                                            finderArgs, count);
3036    
3037                                    closeSession(session);
3038                            }
3039                    }
3040    
3041                    return count.intValue();
3042            }
3043    
3044            /**
3045             * Returns the number of websites.
3046             *
3047             * @return the number of websites
3048             * @throws SystemException if a system exception occurred
3049             */
3050            public int countAll() throws SystemException {
3051                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3052                                    FINDER_ARGS_EMPTY, this);
3053    
3054                    if (count == null) {
3055                            Session session = null;
3056    
3057                            try {
3058                                    session = openSession();
3059    
3060                                    Query q = session.createQuery(_SQL_COUNT_WEBSITE);
3061    
3062                                    count = (Long)q.uniqueResult();
3063                            }
3064                            catch (Exception e) {
3065                                    throw processException(e);
3066                            }
3067                            finally {
3068                                    if (count == null) {
3069                                            count = Long.valueOf(0);
3070                                    }
3071    
3072                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
3073                                            FINDER_ARGS_EMPTY, count);
3074    
3075                                    closeSession(session);
3076                            }
3077                    }
3078    
3079                    return count.intValue();
3080            }
3081    
3082            /**
3083             * Initializes the website persistence.
3084             */
3085            public void afterPropertiesSet() {
3086                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3087                                            com.liferay.portal.util.PropsUtil.get(
3088                                                    "value.object.listener.com.liferay.portal.model.Website")));
3089    
3090                    if (listenerClassNames.length > 0) {
3091                            try {
3092                                    List<ModelListener<Website>> listenersList = new ArrayList<ModelListener<Website>>();
3093    
3094                                    for (String listenerClassName : listenerClassNames) {
3095                                            listenersList.add((ModelListener<Website>)InstanceFactory.newInstance(
3096                                                            listenerClassName));
3097                                    }
3098    
3099                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3100                            }
3101                            catch (Exception e) {
3102                                    _log.error(e);
3103                            }
3104                    }
3105            }
3106    
3107            public void destroy() {
3108                    EntityCacheUtil.removeCache(WebsiteImpl.class.getName());
3109                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
3110                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
3111            }
3112    
3113            @BeanReference(type = AccountPersistence.class)
3114            protected AccountPersistence accountPersistence;
3115            @BeanReference(type = AddressPersistence.class)
3116            protected AddressPersistence addressPersistence;
3117            @BeanReference(type = BrowserTrackerPersistence.class)
3118            protected BrowserTrackerPersistence browserTrackerPersistence;
3119            @BeanReference(type = ClassNamePersistence.class)
3120            protected ClassNamePersistence classNamePersistence;
3121            @BeanReference(type = ClusterGroupPersistence.class)
3122            protected ClusterGroupPersistence clusterGroupPersistence;
3123            @BeanReference(type = CompanyPersistence.class)
3124            protected CompanyPersistence companyPersistence;
3125            @BeanReference(type = ContactPersistence.class)
3126            protected ContactPersistence contactPersistence;
3127            @BeanReference(type = CountryPersistence.class)
3128            protected CountryPersistence countryPersistence;
3129            @BeanReference(type = EmailAddressPersistence.class)
3130            protected EmailAddressPersistence emailAddressPersistence;
3131            @BeanReference(type = GroupPersistence.class)
3132            protected GroupPersistence groupPersistence;
3133            @BeanReference(type = ImagePersistence.class)
3134            protected ImagePersistence imagePersistence;
3135            @BeanReference(type = LayoutPersistence.class)
3136            protected LayoutPersistence layoutPersistence;
3137            @BeanReference(type = LayoutBranchPersistence.class)
3138            protected LayoutBranchPersistence layoutBranchPersistence;
3139            @BeanReference(type = LayoutPrototypePersistence.class)
3140            protected LayoutPrototypePersistence layoutPrototypePersistence;
3141            @BeanReference(type = LayoutRevisionPersistence.class)
3142            protected LayoutRevisionPersistence layoutRevisionPersistence;
3143            @BeanReference(type = LayoutSetPersistence.class)
3144            protected LayoutSetPersistence layoutSetPersistence;
3145            @BeanReference(type = LayoutSetBranchPersistence.class)
3146            protected LayoutSetBranchPersistence layoutSetBranchPersistence;
3147            @BeanReference(type = LayoutSetPrototypePersistence.class)
3148            protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
3149            @BeanReference(type = ListTypePersistence.class)
3150            protected ListTypePersistence listTypePersistence;
3151            @BeanReference(type = LockPersistence.class)
3152            protected LockPersistence lockPersistence;
3153            @BeanReference(type = MembershipRequestPersistence.class)
3154            protected MembershipRequestPersistence membershipRequestPersistence;
3155            @BeanReference(type = OrganizationPersistence.class)
3156            protected OrganizationPersistence organizationPersistence;
3157            @BeanReference(type = OrgGroupPermissionPersistence.class)
3158            protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
3159            @BeanReference(type = OrgGroupRolePersistence.class)
3160            protected OrgGroupRolePersistence orgGroupRolePersistence;
3161            @BeanReference(type = OrgLaborPersistence.class)
3162            protected OrgLaborPersistence orgLaborPersistence;
3163            @BeanReference(type = PasswordPolicyPersistence.class)
3164            protected PasswordPolicyPersistence passwordPolicyPersistence;
3165            @BeanReference(type = PasswordPolicyRelPersistence.class)
3166            protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
3167            @BeanReference(type = PasswordTrackerPersistence.class)
3168            protected PasswordTrackerPersistence passwordTrackerPersistence;
3169            @BeanReference(type = PermissionPersistence.class)
3170            protected PermissionPersistence permissionPersistence;
3171            @BeanReference(type = PhonePersistence.class)
3172            protected PhonePersistence phonePersistence;
3173            @BeanReference(type = PluginSettingPersistence.class)
3174            protected PluginSettingPersistence pluginSettingPersistence;
3175            @BeanReference(type = PortalPreferencesPersistence.class)
3176            protected PortalPreferencesPersistence portalPreferencesPersistence;
3177            @BeanReference(type = PortletPersistence.class)
3178            protected PortletPersistence portletPersistence;
3179            @BeanReference(type = PortletItemPersistence.class)
3180            protected PortletItemPersistence portletItemPersistence;
3181            @BeanReference(type = PortletPreferencesPersistence.class)
3182            protected PortletPreferencesPersistence portletPreferencesPersistence;
3183            @BeanReference(type = RegionPersistence.class)
3184            protected RegionPersistence regionPersistence;
3185            @BeanReference(type = ReleasePersistence.class)
3186            protected ReleasePersistence releasePersistence;
3187            @BeanReference(type = RepositoryPersistence.class)
3188            protected RepositoryPersistence repositoryPersistence;
3189            @BeanReference(type = RepositoryEntryPersistence.class)
3190            protected RepositoryEntryPersistence repositoryEntryPersistence;
3191            @BeanReference(type = ResourcePersistence.class)
3192            protected ResourcePersistence resourcePersistence;
3193            @BeanReference(type = ResourceActionPersistence.class)
3194            protected ResourceActionPersistence resourceActionPersistence;
3195            @BeanReference(type = ResourceBlockPersistence.class)
3196            protected ResourceBlockPersistence resourceBlockPersistence;
3197            @BeanReference(type = ResourceBlockPermissionPersistence.class)
3198            protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
3199            @BeanReference(type = ResourceCodePersistence.class)
3200            protected ResourceCodePersistence resourceCodePersistence;
3201            @BeanReference(type = ResourcePermissionPersistence.class)
3202            protected ResourcePermissionPersistence resourcePermissionPersistence;
3203            @BeanReference(type = ResourceTypePermissionPersistence.class)
3204            protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
3205            @BeanReference(type = RolePersistence.class)
3206            protected RolePersistence rolePersistence;
3207            @BeanReference(type = ServiceComponentPersistence.class)
3208            protected ServiceComponentPersistence serviceComponentPersistence;
3209            @BeanReference(type = ShardPersistence.class)
3210            protected ShardPersistence shardPersistence;
3211            @BeanReference(type = SubscriptionPersistence.class)
3212            protected SubscriptionPersistence subscriptionPersistence;
3213            @BeanReference(type = TeamPersistence.class)
3214            protected TeamPersistence teamPersistence;
3215            @BeanReference(type = TicketPersistence.class)
3216            protected TicketPersistence ticketPersistence;
3217            @BeanReference(type = UserPersistence.class)
3218            protected UserPersistence userPersistence;
3219            @BeanReference(type = UserGroupPersistence.class)
3220            protected UserGroupPersistence userGroupPersistence;
3221            @BeanReference(type = UserGroupGroupRolePersistence.class)
3222            protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
3223            @BeanReference(type = UserGroupRolePersistence.class)
3224            protected UserGroupRolePersistence userGroupRolePersistence;
3225            @BeanReference(type = UserIdMapperPersistence.class)
3226            protected UserIdMapperPersistence userIdMapperPersistence;
3227            @BeanReference(type = UserNotificationEventPersistence.class)
3228            protected UserNotificationEventPersistence userNotificationEventPersistence;
3229            @BeanReference(type = UserTrackerPersistence.class)
3230            protected UserTrackerPersistence userTrackerPersistence;
3231            @BeanReference(type = UserTrackerPathPersistence.class)
3232            protected UserTrackerPathPersistence userTrackerPathPersistence;
3233            @BeanReference(type = VirtualHostPersistence.class)
3234            protected VirtualHostPersistence virtualHostPersistence;
3235            @BeanReference(type = WebDAVPropsPersistence.class)
3236            protected WebDAVPropsPersistence webDAVPropsPersistence;
3237            @BeanReference(type = WebsitePersistence.class)
3238            protected WebsitePersistence websitePersistence;
3239            @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
3240            protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
3241            @BeanReference(type = WorkflowInstanceLinkPersistence.class)
3242            protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
3243            private static final String _SQL_SELECT_WEBSITE = "SELECT website FROM Website website";
3244            private static final String _SQL_SELECT_WEBSITE_WHERE = "SELECT website FROM Website website WHERE ";
3245            private static final String _SQL_COUNT_WEBSITE = "SELECT COUNT(website) FROM Website website";
3246            private static final String _SQL_COUNT_WEBSITE_WHERE = "SELECT COUNT(website) FROM Website website WHERE ";
3247            private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "website.companyId = ?";
3248            private static final String _FINDER_COLUMN_USERID_USERID_2 = "website.userId = ?";
3249            private static final String _FINDER_COLUMN_C_C_COMPANYID_2 = "website.companyId = ? AND ";
3250            private static final String _FINDER_COLUMN_C_C_CLASSNAMEID_2 = "website.classNameId = ?";
3251            private static final String _FINDER_COLUMN_C_C_C_COMPANYID_2 = "website.companyId = ? AND ";
3252            private static final String _FINDER_COLUMN_C_C_C_CLASSNAMEID_2 = "website.classNameId = ? AND ";
3253            private static final String _FINDER_COLUMN_C_C_C_CLASSPK_2 = "website.classPK = ?";
3254            private static final String _FINDER_COLUMN_C_C_C_P_COMPANYID_2 = "website.companyId = ? AND ";
3255            private static final String _FINDER_COLUMN_C_C_C_P_CLASSNAMEID_2 = "website.classNameId = ? AND ";
3256            private static final String _FINDER_COLUMN_C_C_C_P_CLASSPK_2 = "website.classPK = ? AND ";
3257            private static final String _FINDER_COLUMN_C_C_C_P_PRIMARY_2 = "website.primary = ?";
3258            private static final String _ORDER_BY_ENTITY_ALIAS = "website.";
3259            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Website exists with the primary key ";
3260            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Website exists with the key {";
3261            private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
3262            private static Log _log = LogFactoryUtil.getLog(WebsitePersistenceImpl.class);
3263            private static Website _nullWebsite = new WebsiteImpl() {
3264                            @Override
3265                            public Object clone() {
3266                                    return this;
3267                            }
3268    
3269                            @Override
3270                            public CacheModel<Website> toCacheModel() {
3271                                    return _nullWebsiteCacheModel;
3272                            }
3273                    };
3274    
3275            private static CacheModel<Website> _nullWebsiteCacheModel = new CacheModel<Website>() {
3276                            public Website toEntityModel() {
3277                                    return _nullWebsite;
3278                            }
3279                    };
3280    }