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