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