1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.service.persistence;
16  
17  import com.liferay.portal.NoSuchModelException;
18  import com.liferay.portal.NoSuchWebsiteException;
19  import com.liferay.portal.kernel.annotation.BeanReference;
20  import com.liferay.portal.kernel.cache.CacheRegistry;
21  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
22  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
23  import com.liferay.portal.kernel.dao.orm.FinderPath;
24  import com.liferay.portal.kernel.dao.orm.Query;
25  import com.liferay.portal.kernel.dao.orm.QueryPos;
26  import com.liferay.portal.kernel.dao.orm.QueryUtil;
27  import com.liferay.portal.kernel.dao.orm.Session;
28  import com.liferay.portal.kernel.exception.SystemException;
29  import com.liferay.portal.kernel.log.Log;
30  import com.liferay.portal.kernel.log.LogFactoryUtil;
31  import com.liferay.portal.kernel.util.GetterUtil;
32  import com.liferay.portal.kernel.util.InstanceFactory;
33  import com.liferay.portal.kernel.util.OrderByComparator;
34  import com.liferay.portal.kernel.util.StringBundler;
35  import com.liferay.portal.kernel.util.StringPool;
36  import com.liferay.portal.kernel.util.StringUtil;
37  import com.liferay.portal.model.ModelListener;
38  import com.liferay.portal.model.Website;
39  import com.liferay.portal.model.impl.WebsiteImpl;
40  import com.liferay.portal.model.impl.WebsiteModelImpl;
41  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
42  
43  import java.io.Serializable;
44  
45  import java.util.ArrayList;
46  import java.util.Collections;
47  import java.util.List;
48  
49  /**
50   * <a href="WebsitePersistenceImpl.java.html"><b><i>View Source</i></b></a>
51   *
52   * <p>
53   * ServiceBuilder generated this class. Modifications in this class will be
54   * overwritten the next time is generated.
55   * </p>
56   *
57   * @author    Brian Wing Shun Chan
58   * @see       WebsitePersistence
59   * @see       WebsiteUtil
60   * @generated
61   */
62  public class WebsitePersistenceImpl extends BasePersistenceImpl<Website>
63      implements WebsitePersistence {
64      public static final String FINDER_CLASS_NAME_ENTITY = WebsiteImpl.class.getName();
65      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
66          ".List";
67      public static final FinderPath FINDER_PATH_FIND_BY_COMPANYID = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
68              WebsiteModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
69              "findByCompanyId",
70              new String[] {
71                  Long.class.getName(),
72                  
73              "java.lang.Integer", "java.lang.Integer",
74                  "com.liferay.portal.kernel.util.OrderByComparator"
75              });
76      public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
77              WebsiteModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
78              "countByCompanyId", new String[] { Long.class.getName() });
79      public static final FinderPath FINDER_PATH_FIND_BY_USERID = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
80              WebsiteModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
81              "findByUserId",
82              new String[] {
83                  Long.class.getName(),
84                  
85              "java.lang.Integer", "java.lang.Integer",
86                  "com.liferay.portal.kernel.util.OrderByComparator"
87              });
88      public static final FinderPath FINDER_PATH_COUNT_BY_USERID = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
89              WebsiteModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
90              "countByUserId", new String[] { Long.class.getName() });
91      public static final FinderPath FINDER_PATH_FIND_BY_C_C = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
92              WebsiteModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
93              "findByC_C",
94              new String[] {
95                  Long.class.getName(), Long.class.getName(),
96                  
97              "java.lang.Integer", "java.lang.Integer",
98                  "com.liferay.portal.kernel.util.OrderByComparator"
99              });
100     public static final FinderPath FINDER_PATH_COUNT_BY_C_C = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
101             WebsiteModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
102             "countByC_C",
103             new String[] { Long.class.getName(), Long.class.getName() });
104     public static final FinderPath FINDER_PATH_FIND_BY_C_C_C = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
105             WebsiteModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
106             "findByC_C_C",
107             new String[] {
108                 Long.class.getName(), Long.class.getName(), Long.class.getName(),
109                 
110             "java.lang.Integer", "java.lang.Integer",
111                 "com.liferay.portal.kernel.util.OrderByComparator"
112             });
113     public static final FinderPath FINDER_PATH_COUNT_BY_C_C_C = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
114             WebsiteModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
115             "countByC_C_C",
116             new String[] {
117                 Long.class.getName(), Long.class.getName(), Long.class.getName()
118             });
119     public static final FinderPath FINDER_PATH_FIND_BY_C_C_C_P = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
120             WebsiteModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
121             "findByC_C_C_P",
122             new String[] {
123                 Long.class.getName(), Long.class.getName(), Long.class.getName(),
124                 Boolean.class.getName(),
125                 
126             "java.lang.Integer", "java.lang.Integer",
127                 "com.liferay.portal.kernel.util.OrderByComparator"
128             });
129     public static final FinderPath FINDER_PATH_COUNT_BY_C_C_C_P = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
130             WebsiteModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
131             "countByC_C_C_P",
132             new String[] {
133                 Long.class.getName(), Long.class.getName(), Long.class.getName(),
134                 Boolean.class.getName()
135             });
136     public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
137             WebsiteModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
138             "findAll", new String[0]);
139     public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
140             WebsiteModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
141             "countAll", new String[0]);
142 
143     public void cacheResult(Website website) {
144         EntityCacheUtil.putResult(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
145             WebsiteImpl.class, website.getPrimaryKey(), website);
146     }
147 
148     public void cacheResult(List<Website> websites) {
149         for (Website website : websites) {
150             if (EntityCacheUtil.getResult(
151                         WebsiteModelImpl.ENTITY_CACHE_ENABLED,
152                         WebsiteImpl.class, website.getPrimaryKey(), this) == null) {
153                 cacheResult(website);
154             }
155         }
156     }
157 
158     public void clearCache() {
159         CacheRegistry.clear(WebsiteImpl.class.getName());
160         EntityCacheUtil.clearCache(WebsiteImpl.class.getName());
161         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
162         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
163     }
164 
165     public void clearCache(Website website) {
166         EntityCacheUtil.removeResult(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
167             WebsiteImpl.class, website.getPrimaryKey());
168     }
169 
170     public Website create(long websiteId) {
171         Website website = new WebsiteImpl();
172 
173         website.setNew(true);
174         website.setPrimaryKey(websiteId);
175 
176         return website;
177     }
178 
179     public Website remove(Serializable primaryKey)
180         throws NoSuchModelException, SystemException {
181         return remove(((Long)primaryKey).longValue());
182     }
183 
184     public Website remove(long websiteId)
185         throws NoSuchWebsiteException, SystemException {
186         Session session = null;
187 
188         try {
189             session = openSession();
190 
191             Website website = (Website)session.get(WebsiteImpl.class,
192                     new Long(websiteId));
193 
194             if (website == null) {
195                 if (_log.isWarnEnabled()) {
196                     _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + websiteId);
197                 }
198 
199                 throw new NoSuchWebsiteException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
200                     websiteId);
201             }
202 
203             return remove(website);
204         }
205         catch (NoSuchWebsiteException nsee) {
206             throw nsee;
207         }
208         catch (Exception e) {
209             throw processException(e);
210         }
211         finally {
212             closeSession(session);
213         }
214     }
215 
216     public Website remove(Website website) throws SystemException {
217         for (ModelListener<Website> listener : listeners) {
218             listener.onBeforeRemove(website);
219         }
220 
221         website = removeImpl(website);
222 
223         for (ModelListener<Website> listener : listeners) {
224             listener.onAfterRemove(website);
225         }
226 
227         return website;
228     }
229 
230     protected Website removeImpl(Website website) throws SystemException {
231         website = toUnwrappedModel(website);
232 
233         Session session = null;
234 
235         try {
236             session = openSession();
237 
238             if (website.isCachedModel() || BatchSessionUtil.isEnabled()) {
239                 Object staleObject = session.get(WebsiteImpl.class,
240                         website.getPrimaryKeyObj());
241 
242                 if (staleObject != null) {
243                     session.evict(staleObject);
244                 }
245             }
246 
247             session.delete(website);
248 
249             session.flush();
250         }
251         catch (Exception e) {
252             throw processException(e);
253         }
254         finally {
255             closeSession(session);
256         }
257 
258         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
259 
260         EntityCacheUtil.removeResult(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
261             WebsiteImpl.class, website.getPrimaryKey());
262 
263         return website;
264     }
265 
266     public Website updateImpl(com.liferay.portal.model.Website website,
267         boolean merge) throws SystemException {
268         website = toUnwrappedModel(website);
269 
270         Session session = null;
271 
272         try {
273             session = openSession();
274 
275             BatchSessionUtil.update(session, website, merge);
276 
277             website.setNew(false);
278         }
279         catch (Exception e) {
280             throw processException(e);
281         }
282         finally {
283             closeSession(session);
284         }
285 
286         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
287 
288         EntityCacheUtil.putResult(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
289             WebsiteImpl.class, website.getPrimaryKey(), website);
290 
291         return website;
292     }
293 
294     protected Website toUnwrappedModel(Website website) {
295         if (website instanceof WebsiteImpl) {
296             return website;
297         }
298 
299         WebsiteImpl websiteImpl = new WebsiteImpl();
300 
301         websiteImpl.setNew(website.isNew());
302         websiteImpl.setPrimaryKey(website.getPrimaryKey());
303 
304         websiteImpl.setWebsiteId(website.getWebsiteId());
305         websiteImpl.setCompanyId(website.getCompanyId());
306         websiteImpl.setUserId(website.getUserId());
307         websiteImpl.setUserName(website.getUserName());
308         websiteImpl.setCreateDate(website.getCreateDate());
309         websiteImpl.setModifiedDate(website.getModifiedDate());
310         websiteImpl.setClassNameId(website.getClassNameId());
311         websiteImpl.setClassPK(website.getClassPK());
312         websiteImpl.setUrl(website.getUrl());
313         websiteImpl.setTypeId(website.getTypeId());
314         websiteImpl.setPrimary(website.isPrimary());
315 
316         return websiteImpl;
317     }
318 
319     public Website findByPrimaryKey(Serializable primaryKey)
320         throws NoSuchModelException, SystemException {
321         return findByPrimaryKey(((Long)primaryKey).longValue());
322     }
323 
324     public Website findByPrimaryKey(long websiteId)
325         throws NoSuchWebsiteException, SystemException {
326         Website website = fetchByPrimaryKey(websiteId);
327 
328         if (website == null) {
329             if (_log.isWarnEnabled()) {
330                 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + websiteId);
331             }
332 
333             throw new NoSuchWebsiteException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
334                 websiteId);
335         }
336 
337         return website;
338     }
339 
340     public Website fetchByPrimaryKey(Serializable primaryKey)
341         throws SystemException {
342         return fetchByPrimaryKey(((Long)primaryKey).longValue());
343     }
344 
345     public Website fetchByPrimaryKey(long websiteId) throws SystemException {
346         Website website = (Website)EntityCacheUtil.getResult(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
347                 WebsiteImpl.class, websiteId, this);
348 
349         if (website == null) {
350             Session session = null;
351 
352             try {
353                 session = openSession();
354 
355                 website = (Website)session.get(WebsiteImpl.class,
356                         new Long(websiteId));
357             }
358             catch (Exception e) {
359                 throw processException(e);
360             }
361             finally {
362                 if (website != null) {
363                     cacheResult(website);
364                 }
365 
366                 closeSession(session);
367             }
368         }
369 
370         return website;
371     }
372 
373     public List<Website> findByCompanyId(long companyId)
374         throws SystemException {
375         return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
376             null);
377     }
378 
379     public List<Website> findByCompanyId(long companyId, int start, int end)
380         throws SystemException {
381         return findByCompanyId(companyId, start, end, null);
382     }
383 
384     public List<Website> findByCompanyId(long companyId, int start, int end,
385         OrderByComparator orderByComparator) throws SystemException {
386         Object[] finderArgs = new Object[] {
387                 new Long(companyId),
388                 
389                 String.valueOf(start), String.valueOf(end),
390                 String.valueOf(orderByComparator)
391             };
392 
393         List<Website> list = (List<Website>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
394                 finderArgs, this);
395 
396         if (list == null) {
397             Session session = null;
398 
399             try {
400                 session = openSession();
401 
402                 StringBundler query = null;
403 
404                 if (orderByComparator != null) {
405                     query = new StringBundler(3 +
406                             (orderByComparator.getOrderByFields().length * 3));
407                 }
408                 else {
409                     query = new StringBundler(3);
410                 }
411 
412                 query.append(_SQL_SELECT_WEBSITE_WHERE);
413 
414                 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
415 
416                 if (orderByComparator != null) {
417                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
418                         orderByComparator);
419                 }
420 
421                 else {
422                     query.append(WebsiteModelImpl.ORDER_BY_JPQL);
423                 }
424 
425                 String sql = query.toString();
426 
427                 Query q = session.createQuery(sql);
428 
429                 QueryPos qPos = QueryPos.getInstance(q);
430 
431                 qPos.add(companyId);
432 
433                 list = (List<Website>)QueryUtil.list(q, getDialect(), start, end);
434             }
435             catch (Exception e) {
436                 throw processException(e);
437             }
438             finally {
439                 if (list == null) {
440                     list = new ArrayList<Website>();
441                 }
442 
443                 cacheResult(list);
444 
445                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
446                     finderArgs, list);
447 
448                 closeSession(session);
449             }
450         }
451 
452         return list;
453     }
454 
455     public Website findByCompanyId_First(long companyId,
456         OrderByComparator orderByComparator)
457         throws NoSuchWebsiteException, SystemException {
458         List<Website> list = findByCompanyId(companyId, 0, 1, orderByComparator);
459 
460         if (list.isEmpty()) {
461             StringBundler msg = new StringBundler(4);
462 
463             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
464 
465             msg.append("companyId=");
466             msg.append(companyId);
467 
468             msg.append(StringPool.CLOSE_CURLY_BRACE);
469 
470             throw new NoSuchWebsiteException(msg.toString());
471         }
472         else {
473             return list.get(0);
474         }
475     }
476 
477     public Website findByCompanyId_Last(long companyId,
478         OrderByComparator orderByComparator)
479         throws NoSuchWebsiteException, SystemException {
480         int count = countByCompanyId(companyId);
481 
482         List<Website> list = findByCompanyId(companyId, count - 1, count,
483                 orderByComparator);
484 
485         if (list.isEmpty()) {
486             StringBundler msg = new StringBundler(4);
487 
488             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
489 
490             msg.append("companyId=");
491             msg.append(companyId);
492 
493             msg.append(StringPool.CLOSE_CURLY_BRACE);
494 
495             throw new NoSuchWebsiteException(msg.toString());
496         }
497         else {
498             return list.get(0);
499         }
500     }
501 
502     public Website[] findByCompanyId_PrevAndNext(long websiteId,
503         long companyId, OrderByComparator orderByComparator)
504         throws NoSuchWebsiteException, SystemException {
505         Website website = findByPrimaryKey(websiteId);
506 
507         Session session = null;
508 
509         try {
510             session = openSession();
511 
512             Website[] array = new WebsiteImpl[3];
513 
514             array[0] = getByCompanyId_PrevAndNext(session, website, companyId,
515                     orderByComparator, true);
516 
517             array[1] = website;
518 
519             array[2] = getByCompanyId_PrevAndNext(session, website, companyId,
520                     orderByComparator, false);
521 
522             return array;
523         }
524         catch (Exception e) {
525             throw processException(e);
526         }
527         finally {
528             closeSession(session);
529         }
530     }
531 
532     protected Website getByCompanyId_PrevAndNext(Session session,
533         Website website, long companyId, OrderByComparator orderByComparator,
534         boolean previous) {
535         StringBundler query = null;
536 
537         if (orderByComparator != null) {
538             query = new StringBundler(6 +
539                     (orderByComparator.getOrderByFields().length * 6));
540         }
541         else {
542             query = new StringBundler(3);
543         }
544 
545         query.append(_SQL_SELECT_WEBSITE_WHERE);
546 
547         query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
548 
549         if (orderByComparator != null) {
550             String[] orderByFields = orderByComparator.getOrderByFields();
551 
552             if (orderByFields.length > 0) {
553                 query.append(WHERE_AND);
554             }
555 
556             for (int i = 0; i < orderByFields.length; i++) {
557                 query.append(_ORDER_BY_ENTITY_ALIAS);
558                 query.append(orderByFields[i]);
559 
560                 if ((i + 1) < orderByFields.length) {
561                     if (orderByComparator.isAscending() ^ previous) {
562                         query.append(WHERE_GREATER_THAN_HAS_NEXT);
563                     }
564                     else {
565                         query.append(WHERE_LESSER_THAN_HAS_NEXT);
566                     }
567                 }
568                 else {
569                     if (orderByComparator.isAscending() ^ previous) {
570                         query.append(WHERE_GREATER_THAN);
571                     }
572                     else {
573                         query.append(WHERE_LESSER_THAN);
574                     }
575                 }
576             }
577 
578             query.append(ORDER_BY_CLAUSE);
579 
580             for (int i = 0; i < orderByFields.length; i++) {
581                 query.append(_ORDER_BY_ENTITY_ALIAS);
582                 query.append(orderByFields[i]);
583 
584                 if ((i + 1) < orderByFields.length) {
585                     if (orderByComparator.isAscending() ^ previous) {
586                         query.append(ORDER_BY_ASC_HAS_NEXT);
587                     }
588                     else {
589                         query.append(ORDER_BY_DESC_HAS_NEXT);
590                     }
591                 }
592                 else {
593                     if (orderByComparator.isAscending() ^ previous) {
594                         query.append(ORDER_BY_ASC);
595                     }
596                     else {
597                         query.append(ORDER_BY_DESC);
598                     }
599                 }
600             }
601         }
602 
603         else {
604             query.append(WebsiteModelImpl.ORDER_BY_JPQL);
605         }
606 
607         String sql = query.toString();
608 
609         Query q = session.createQuery(sql);
610 
611         q.setFirstResult(0);
612         q.setMaxResults(2);
613 
614         QueryPos qPos = QueryPos.getInstance(q);
615 
616         qPos.add(companyId);
617 
618         if (orderByComparator != null) {
619             Object[] values = orderByComparator.getOrderByValues(website);
620 
621             for (Object value : values) {
622                 qPos.add(value);
623             }
624         }
625 
626         List<Website> list = q.list();
627 
628         if (list.size() == 2) {
629             return list.get(1);
630         }
631         else {
632             return null;
633         }
634     }
635 
636     public List<Website> findByUserId(long userId) throws SystemException {
637         return findByUserId(userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
638     }
639 
640     public List<Website> findByUserId(long userId, int start, int end)
641         throws SystemException {
642         return findByUserId(userId, start, end, null);
643     }
644 
645     public List<Website> findByUserId(long userId, int start, int end,
646         OrderByComparator orderByComparator) throws SystemException {
647         Object[] finderArgs = new Object[] {
648                 new Long(userId),
649                 
650                 String.valueOf(start), String.valueOf(end),
651                 String.valueOf(orderByComparator)
652             };
653 
654         List<Website> list = (List<Website>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_USERID,
655                 finderArgs, this);
656 
657         if (list == null) {
658             Session session = null;
659 
660             try {
661                 session = openSession();
662 
663                 StringBundler query = null;
664 
665                 if (orderByComparator != null) {
666                     query = new StringBundler(3 +
667                             (orderByComparator.getOrderByFields().length * 3));
668                 }
669                 else {
670                     query = new StringBundler(3);
671                 }
672 
673                 query.append(_SQL_SELECT_WEBSITE_WHERE);
674 
675                 query.append(_FINDER_COLUMN_USERID_USERID_2);
676 
677                 if (orderByComparator != null) {
678                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
679                         orderByComparator);
680                 }
681 
682                 else {
683                     query.append(WebsiteModelImpl.ORDER_BY_JPQL);
684                 }
685 
686                 String sql = query.toString();
687 
688                 Query q = session.createQuery(sql);
689 
690                 QueryPos qPos = QueryPos.getInstance(q);
691 
692                 qPos.add(userId);
693 
694                 list = (List<Website>)QueryUtil.list(q, getDialect(), start, end);
695             }
696             catch (Exception e) {
697                 throw processException(e);
698             }
699             finally {
700                 if (list == null) {
701                     list = new ArrayList<Website>();
702                 }
703 
704                 cacheResult(list);
705 
706                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_USERID,
707                     finderArgs, list);
708 
709                 closeSession(session);
710             }
711         }
712 
713         return list;
714     }
715 
716     public Website findByUserId_First(long userId,
717         OrderByComparator orderByComparator)
718         throws NoSuchWebsiteException, SystemException {
719         List<Website> list = findByUserId(userId, 0, 1, orderByComparator);
720 
721         if (list.isEmpty()) {
722             StringBundler msg = new StringBundler(4);
723 
724             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
725 
726             msg.append("userId=");
727             msg.append(userId);
728 
729             msg.append(StringPool.CLOSE_CURLY_BRACE);
730 
731             throw new NoSuchWebsiteException(msg.toString());
732         }
733         else {
734             return list.get(0);
735         }
736     }
737 
738     public Website findByUserId_Last(long userId,
739         OrderByComparator orderByComparator)
740         throws NoSuchWebsiteException, SystemException {
741         int count = countByUserId(userId);
742 
743         List<Website> list = findByUserId(userId, count - 1, count,
744                 orderByComparator);
745 
746         if (list.isEmpty()) {
747             StringBundler msg = new StringBundler(4);
748 
749             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
750 
751             msg.append("userId=");
752             msg.append(userId);
753 
754             msg.append(StringPool.CLOSE_CURLY_BRACE);
755 
756             throw new NoSuchWebsiteException(msg.toString());
757         }
758         else {
759             return list.get(0);
760         }
761     }
762 
763     public Website[] findByUserId_PrevAndNext(long websiteId, long userId,
764         OrderByComparator orderByComparator)
765         throws NoSuchWebsiteException, SystemException {
766         Website website = findByPrimaryKey(websiteId);
767 
768         Session session = null;
769 
770         try {
771             session = openSession();
772 
773             Website[] array = new WebsiteImpl[3];
774 
775             array[0] = getByUserId_PrevAndNext(session, website, userId,
776                     orderByComparator, true);
777 
778             array[1] = website;
779 
780             array[2] = getByUserId_PrevAndNext(session, website, userId,
781                     orderByComparator, false);
782 
783             return array;
784         }
785         catch (Exception e) {
786             throw processException(e);
787         }
788         finally {
789             closeSession(session);
790         }
791     }
792 
793     protected Website getByUserId_PrevAndNext(Session session, Website website,
794         long userId, OrderByComparator orderByComparator, boolean previous) {
795         StringBundler query = null;
796 
797         if (orderByComparator != null) {
798             query = new StringBundler(6 +
799                     (orderByComparator.getOrderByFields().length * 6));
800         }
801         else {
802             query = new StringBundler(3);
803         }
804 
805         query.append(_SQL_SELECT_WEBSITE_WHERE);
806 
807         query.append(_FINDER_COLUMN_USERID_USERID_2);
808 
809         if (orderByComparator != null) {
810             String[] orderByFields = orderByComparator.getOrderByFields();
811 
812             if (orderByFields.length > 0) {
813                 query.append(WHERE_AND);
814             }
815 
816             for (int i = 0; i < orderByFields.length; i++) {
817                 query.append(_ORDER_BY_ENTITY_ALIAS);
818                 query.append(orderByFields[i]);
819 
820                 if ((i + 1) < orderByFields.length) {
821                     if (orderByComparator.isAscending() ^ previous) {
822                         query.append(WHERE_GREATER_THAN_HAS_NEXT);
823                     }
824                     else {
825                         query.append(WHERE_LESSER_THAN_HAS_NEXT);
826                     }
827                 }
828                 else {
829                     if (orderByComparator.isAscending() ^ previous) {
830                         query.append(WHERE_GREATER_THAN);
831                     }
832                     else {
833                         query.append(WHERE_LESSER_THAN);
834                     }
835                 }
836             }
837 
838             query.append(ORDER_BY_CLAUSE);
839 
840             for (int i = 0; i < orderByFields.length; i++) {
841                 query.append(_ORDER_BY_ENTITY_ALIAS);
842                 query.append(orderByFields[i]);
843 
844                 if ((i + 1) < orderByFields.length) {
845                     if (orderByComparator.isAscending() ^ previous) {
846                         query.append(ORDER_BY_ASC_HAS_NEXT);
847                     }
848                     else {
849                         query.append(ORDER_BY_DESC_HAS_NEXT);
850                     }
851                 }
852                 else {
853                     if (orderByComparator.isAscending() ^ previous) {
854                         query.append(ORDER_BY_ASC);
855                     }
856                     else {
857                         query.append(ORDER_BY_DESC);
858                     }
859                 }
860             }
861         }
862 
863         else {
864             query.append(WebsiteModelImpl.ORDER_BY_JPQL);
865         }
866 
867         String sql = query.toString();
868 
869         Query q = session.createQuery(sql);
870 
871         q.setFirstResult(0);
872         q.setMaxResults(2);
873 
874         QueryPos qPos = QueryPos.getInstance(q);
875 
876         qPos.add(userId);
877 
878         if (orderByComparator != null) {
879             Object[] values = orderByComparator.getOrderByValues(website);
880 
881             for (Object value : values) {
882                 qPos.add(value);
883             }
884         }
885 
886         List<Website> list = q.list();
887 
888         if (list.size() == 2) {
889             return list.get(1);
890         }
891         else {
892             return null;
893         }
894     }
895 
896     public List<Website> findByC_C(long companyId, long classNameId)
897         throws SystemException {
898         return findByC_C(companyId, classNameId, QueryUtil.ALL_POS,
899             QueryUtil.ALL_POS, null);
900     }
901 
902     public List<Website> findByC_C(long companyId, long classNameId, int start,
903         int end) throws SystemException {
904         return findByC_C(companyId, classNameId, start, end, null);
905     }
906 
907     public List<Website> findByC_C(long companyId, long classNameId, int start,
908         int end, OrderByComparator orderByComparator) throws SystemException {
909         Object[] finderArgs = new Object[] {
910                 new Long(companyId), new Long(classNameId),
911                 
912                 String.valueOf(start), String.valueOf(end),
913                 String.valueOf(orderByComparator)
914             };
915 
916         List<Website> list = (List<Website>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_C,
917                 finderArgs, this);
918 
919         if (list == null) {
920             Session session = null;
921 
922             try {
923                 session = openSession();
924 
925                 StringBundler query = null;
926 
927                 if (orderByComparator != null) {
928                     query = new StringBundler(4 +
929                             (orderByComparator.getOrderByFields().length * 3));
930                 }
931                 else {
932                     query = new StringBundler(4);
933                 }
934 
935                 query.append(_SQL_SELECT_WEBSITE_WHERE);
936 
937                 query.append(_FINDER_COLUMN_C_C_COMPANYID_2);
938 
939                 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
940 
941                 if (orderByComparator != null) {
942                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
943                         orderByComparator);
944                 }
945 
946                 else {
947                     query.append(WebsiteModelImpl.ORDER_BY_JPQL);
948                 }
949 
950                 String sql = query.toString();
951 
952                 Query q = session.createQuery(sql);
953 
954                 QueryPos qPos = QueryPos.getInstance(q);
955 
956                 qPos.add(companyId);
957 
958                 qPos.add(classNameId);
959 
960                 list = (List<Website>)QueryUtil.list(q, getDialect(), start, end);
961             }
962             catch (Exception e) {
963                 throw processException(e);
964             }
965             finally {
966                 if (list == null) {
967                     list = new ArrayList<Website>();
968                 }
969 
970                 cacheResult(list);
971 
972                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_C, finderArgs,
973                     list);
974 
975                 closeSession(session);
976             }
977         }
978 
979         return list;
980     }
981 
982     public Website findByC_C_First(long companyId, long classNameId,
983         OrderByComparator orderByComparator)
984         throws NoSuchWebsiteException, SystemException {
985         List<Website> list = findByC_C(companyId, classNameId, 0, 1,
986                 orderByComparator);
987 
988         if (list.isEmpty()) {
989             StringBundler msg = new StringBundler(6);
990 
991             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
992 
993             msg.append("companyId=");
994             msg.append(companyId);
995 
996             msg.append(", classNameId=");
997             msg.append(classNameId);
998 
999             msg.append(StringPool.CLOSE_CURLY_BRACE);
1000
1001            throw new NoSuchWebsiteException(msg.toString());
1002        }
1003        else {
1004            return list.get(0);
1005        }
1006    }
1007
1008    public Website findByC_C_Last(long companyId, long classNameId,
1009        OrderByComparator orderByComparator)
1010        throws NoSuchWebsiteException, SystemException {
1011        int count = countByC_C(companyId, classNameId);
1012
1013        List<Website> list = findByC_C(companyId, classNameId, count - 1,
1014                count, orderByComparator);
1015
1016        if (list.isEmpty()) {
1017            StringBundler msg = new StringBundler(6);
1018
1019            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1020
1021            msg.append("companyId=");
1022            msg.append(companyId);
1023
1024            msg.append(", classNameId=");
1025            msg.append(classNameId);
1026
1027            msg.append(StringPool.CLOSE_CURLY_BRACE);
1028
1029            throw new NoSuchWebsiteException(msg.toString());
1030        }
1031        else {
1032            return list.get(0);
1033        }
1034    }
1035
1036    public Website[] findByC_C_PrevAndNext(long websiteId, long companyId,
1037        long classNameId, OrderByComparator orderByComparator)
1038        throws NoSuchWebsiteException, SystemException {
1039        Website website = findByPrimaryKey(websiteId);
1040
1041        Session session = null;
1042
1043        try {
1044            session = openSession();
1045
1046            Website[] array = new WebsiteImpl[3];
1047
1048            array[0] = getByC_C_PrevAndNext(session, website, companyId,
1049                    classNameId, orderByComparator, true);
1050
1051            array[1] = website;
1052
1053            array[2] = getByC_C_PrevAndNext(session, website, companyId,
1054                    classNameId, orderByComparator, false);
1055
1056            return array;
1057        }
1058        catch (Exception e) {
1059            throw processException(e);
1060        }
1061        finally {
1062            closeSession(session);
1063        }
1064    }
1065
1066    protected Website getByC_C_PrevAndNext(Session session, Website website,
1067        long companyId, long classNameId, OrderByComparator orderByComparator,
1068        boolean previous) {
1069        StringBundler query = null;
1070
1071        if (orderByComparator != null) {
1072            query = new StringBundler(6 +
1073                    (orderByComparator.getOrderByFields().length * 6));
1074        }
1075        else {
1076            query = new StringBundler(3);
1077        }
1078
1079        query.append(_SQL_SELECT_WEBSITE_WHERE);
1080
1081        query.append(_FINDER_COLUMN_C_C_COMPANYID_2);
1082
1083        query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
1084
1085        if (orderByComparator != null) {
1086            String[] orderByFields = orderByComparator.getOrderByFields();
1087
1088            if (orderByFields.length > 0) {
1089                query.append(WHERE_AND);
1090            }
1091
1092            for (int i = 0; i < orderByFields.length; i++) {
1093                query.append(_ORDER_BY_ENTITY_ALIAS);
1094                query.append(orderByFields[i]);
1095
1096                if ((i + 1) < orderByFields.length) {
1097                    if (orderByComparator.isAscending() ^ previous) {
1098                        query.append(WHERE_GREATER_THAN_HAS_NEXT);
1099                    }
1100                    else {
1101                        query.append(WHERE_LESSER_THAN_HAS_NEXT);
1102                    }
1103                }
1104                else {
1105                    if (orderByComparator.isAscending() ^ previous) {
1106                        query.append(WHERE_GREATER_THAN);
1107                    }
1108                    else {
1109                        query.append(WHERE_LESSER_THAN);
1110                    }
1111                }
1112            }
1113
1114            query.append(ORDER_BY_CLAUSE);
1115
1116            for (int i = 0; i < orderByFields.length; i++) {
1117                query.append(_ORDER_BY_ENTITY_ALIAS);
1118                query.append(orderByFields[i]);
1119
1120                if ((i + 1) < orderByFields.length) {
1121                    if (orderByComparator.isAscending() ^ previous) {
1122                        query.append(ORDER_BY_ASC_HAS_NEXT);
1123                    }
1124                    else {
1125                        query.append(ORDER_BY_DESC_HAS_NEXT);
1126                    }
1127                }
1128                else {
1129                    if (orderByComparator.isAscending() ^ previous) {
1130                        query.append(ORDER_BY_ASC);
1131                    }
1132                    else {
1133                        query.append(ORDER_BY_DESC);
1134                    }
1135                }
1136            }
1137        }
1138
1139        else {
1140            query.append(WebsiteModelImpl.ORDER_BY_JPQL);
1141        }
1142
1143        String sql = query.toString();
1144
1145        Query q = session.createQuery(sql);
1146
1147        q.setFirstResult(0);
1148        q.setMaxResults(2);
1149
1150        QueryPos qPos = QueryPos.getInstance(q);
1151
1152        qPos.add(companyId);
1153
1154        qPos.add(classNameId);
1155
1156        if (orderByComparator != null) {
1157            Object[] values = orderByComparator.getOrderByValues(website);
1158
1159            for (Object value : values) {
1160                qPos.add(value);
1161            }
1162        }
1163
1164        List<Website> list = q.list();
1165
1166        if (list.size() == 2) {
1167            return list.get(1);
1168        }
1169        else {
1170            return null;
1171        }
1172    }
1173
1174    public List<Website> findByC_C_C(long companyId, long classNameId,
1175        long classPK) throws SystemException {
1176        return findByC_C_C(companyId, classNameId, classPK, QueryUtil.ALL_POS,
1177            QueryUtil.ALL_POS, null);
1178    }
1179
1180    public List<Website> findByC_C_C(long companyId, long classNameId,
1181        long classPK, int start, int end) throws SystemException {
1182        return findByC_C_C(companyId, classNameId, classPK, start, end, null);
1183    }
1184
1185    public List<Website> findByC_C_C(long companyId, long classNameId,
1186        long classPK, int start, int end, OrderByComparator orderByComparator)
1187        throws SystemException {
1188        Object[] finderArgs = new Object[] {
1189                new Long(companyId), new Long(classNameId), new Long(classPK),
1190                
1191                String.valueOf(start), String.valueOf(end),
1192                String.valueOf(orderByComparator)
1193            };
1194
1195        List<Website> list = (List<Website>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_C_C,
1196                finderArgs, this);
1197
1198        if (list == null) {
1199            Session session = null;
1200
1201            try {
1202                session = openSession();
1203
1204                StringBundler query = null;
1205
1206                if (orderByComparator != null) {
1207                    query = new StringBundler(5 +
1208                            (orderByComparator.getOrderByFields().length * 3));
1209                }
1210                else {
1211                    query = new StringBundler(5);
1212                }
1213
1214                query.append(_SQL_SELECT_WEBSITE_WHERE);
1215
1216                query.append(_FINDER_COLUMN_C_C_C_COMPANYID_2);
1217
1218                query.append(_FINDER_COLUMN_C_C_C_CLASSNAMEID_2);
1219
1220                query.append(_FINDER_COLUMN_C_C_C_CLASSPK_2);
1221
1222                if (orderByComparator != null) {
1223                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1224                        orderByComparator);
1225                }
1226
1227                else {
1228                    query.append(WebsiteModelImpl.ORDER_BY_JPQL);
1229                }
1230
1231                String sql = query.toString();
1232
1233                Query q = session.createQuery(sql);
1234
1235                QueryPos qPos = QueryPos.getInstance(q);
1236
1237                qPos.add(companyId);
1238
1239                qPos.add(classNameId);
1240
1241                qPos.add(classPK);
1242
1243                list = (List<Website>)QueryUtil.list(q, getDialect(), start, end);
1244            }
1245            catch (Exception e) {
1246                throw processException(e);
1247            }
1248            finally {
1249                if (list == null) {
1250                    list = new ArrayList<Website>();
1251                }
1252
1253                cacheResult(list);
1254
1255                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_C_C,
1256                    finderArgs, list);
1257
1258                closeSession(session);
1259            }
1260        }
1261
1262        return list;
1263    }
1264
1265    public Website findByC_C_C_First(long companyId, long classNameId,
1266        long classPK, OrderByComparator orderByComparator)
1267        throws NoSuchWebsiteException, SystemException {
1268        List<Website> list = findByC_C_C(companyId, classNameId, classPK, 0, 1,
1269                orderByComparator);
1270
1271        if (list.isEmpty()) {
1272            StringBundler msg = new StringBundler(8);
1273
1274            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1275
1276            msg.append("companyId=");
1277            msg.append(companyId);
1278
1279            msg.append(", classNameId=");
1280            msg.append(classNameId);
1281
1282            msg.append(", classPK=");
1283            msg.append(classPK);
1284
1285            msg.append(StringPool.CLOSE_CURLY_BRACE);
1286
1287            throw new NoSuchWebsiteException(msg.toString());
1288        }
1289        else {
1290            return list.get(0);
1291        }
1292    }
1293
1294    public Website findByC_C_C_Last(long companyId, long classNameId,
1295        long classPK, OrderByComparator orderByComparator)
1296        throws NoSuchWebsiteException, SystemException {
1297        int count = countByC_C_C(companyId, classNameId, classPK);
1298
1299        List<Website> list = findByC_C_C(companyId, classNameId, classPK,
1300                count - 1, count, orderByComparator);
1301
1302        if (list.isEmpty()) {
1303            StringBundler msg = new StringBundler(8);
1304
1305            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1306
1307            msg.append("companyId=");
1308            msg.append(companyId);
1309
1310            msg.append(", classNameId=");
1311            msg.append(classNameId);
1312
1313            msg.append(", classPK=");
1314            msg.append(classPK);
1315
1316            msg.append(StringPool.CLOSE_CURLY_BRACE);
1317
1318            throw new NoSuchWebsiteException(msg.toString());
1319        }
1320        else {
1321            return list.get(0);
1322        }
1323    }
1324
1325    public Website[] findByC_C_C_PrevAndNext(long websiteId, long companyId,
1326        long classNameId, long classPK, OrderByComparator orderByComparator)
1327        throws NoSuchWebsiteException, SystemException {
1328        Website website = findByPrimaryKey(websiteId);
1329
1330        Session session = null;
1331
1332        try {
1333            session = openSession();
1334
1335            Website[] array = new WebsiteImpl[3];
1336
1337            array[0] = getByC_C_C_PrevAndNext(session, website, companyId,
1338                    classNameId, classPK, orderByComparator, true);
1339
1340            array[1] = website;
1341
1342            array[2] = getByC_C_C_PrevAndNext(session, website, companyId,
1343                    classNameId, classPK, orderByComparator, false);
1344
1345            return array;
1346        }
1347        catch (Exception e) {
1348            throw processException(e);
1349        }
1350        finally {
1351            closeSession(session);
1352        }
1353    }
1354
1355    protected Website getByC_C_C_PrevAndNext(Session session, Website website,
1356        long companyId, long classNameId, long classPK,
1357        OrderByComparator orderByComparator, boolean previous) {
1358        StringBundler query = null;
1359
1360        if (orderByComparator != null) {
1361            query = new StringBundler(6 +
1362                    (orderByComparator.getOrderByFields().length * 6));
1363        }
1364        else {
1365            query = new StringBundler(3);
1366        }
1367
1368        query.append(_SQL_SELECT_WEBSITE_WHERE);
1369
1370        query.append(_FINDER_COLUMN_C_C_C_COMPANYID_2);
1371
1372        query.append(_FINDER_COLUMN_C_C_C_CLASSNAMEID_2);
1373
1374        query.append(_FINDER_COLUMN_C_C_C_CLASSPK_2);
1375
1376        if (orderByComparator != null) {
1377            String[] orderByFields = orderByComparator.getOrderByFields();
1378
1379            if (orderByFields.length > 0) {
1380                query.append(WHERE_AND);
1381            }
1382
1383            for (int i = 0; i < orderByFields.length; i++) {
1384                query.append(_ORDER_BY_ENTITY_ALIAS);
1385                query.append(orderByFields[i]);
1386
1387                if ((i + 1) < orderByFields.length) {
1388                    if (orderByComparator.isAscending() ^ previous) {
1389                        query.append(WHERE_GREATER_THAN_HAS_NEXT);
1390                    }
1391                    else {
1392                        query.append(WHERE_LESSER_THAN_HAS_NEXT);
1393                    }
1394                }
1395                else {
1396                    if (orderByComparator.isAscending() ^ previous) {
1397                        query.append(WHERE_GREATER_THAN);
1398                    }
1399                    else {
1400                        query.append(WHERE_LESSER_THAN);
1401                    }
1402                }
1403            }
1404
1405            query.append(ORDER_BY_CLAUSE);
1406
1407            for (int i = 0; i < orderByFields.length; i++) {
1408                query.append(_ORDER_BY_ENTITY_ALIAS);
1409                query.append(orderByFields[i]);
1410
1411                if ((i + 1) < orderByFields.length) {
1412                    if (orderByComparator.isAscending() ^ previous) {
1413                        query.append(ORDER_BY_ASC_HAS_NEXT);
1414                    }
1415                    else {
1416                        query.append(ORDER_BY_DESC_HAS_NEXT);
1417                    }
1418                }
1419                else {
1420                    if (orderByComparator.isAscending() ^ previous) {
1421                        query.append(ORDER_BY_ASC);
1422                    }
1423                    else {
1424                        query.append(ORDER_BY_DESC);
1425                    }
1426                }
1427            }
1428        }
1429
1430        else {
1431            query.append(WebsiteModelImpl.ORDER_BY_JPQL);
1432        }
1433
1434        String sql = query.toString();
1435
1436        Query q = session.createQuery(sql);
1437
1438        q.setFirstResult(0);
1439        q.setMaxResults(2);
1440
1441        QueryPos qPos = QueryPos.getInstance(q);
1442
1443        qPos.add(companyId);
1444
1445        qPos.add(classNameId);
1446
1447        qPos.add(classPK);
1448
1449        if (orderByComparator != null) {
1450            Object[] values = orderByComparator.getOrderByValues(website);
1451
1452            for (Object value : values) {
1453                qPos.add(value);
1454            }
1455        }
1456
1457        List<Website> list = q.list();
1458
1459        if (list.size() == 2) {
1460            return list.get(1);
1461        }
1462        else {
1463            return null;
1464        }
1465    }
1466
1467    public List<Website> findByC_C_C_P(long companyId, long classNameId,
1468        long classPK, boolean primary) throws SystemException {
1469        return findByC_C_C_P(companyId, classNameId, classPK, primary,
1470            QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1471    }
1472
1473    public List<Website> findByC_C_C_P(long companyId, long classNameId,
1474        long classPK, boolean primary, int start, int end)
1475        throws SystemException {
1476        return findByC_C_C_P(companyId, classNameId, classPK, primary, start,
1477            end, null);
1478    }
1479
1480    public List<Website> findByC_C_C_P(long companyId, long classNameId,
1481        long classPK, boolean primary, int start, int end,
1482        OrderByComparator orderByComparator) throws SystemException {
1483        Object[] finderArgs = new Object[] {
1484                new Long(companyId), new Long(classNameId), new Long(classPK),
1485                Boolean.valueOf(primary),
1486                
1487                String.valueOf(start), String.valueOf(end),
1488                String.valueOf(orderByComparator)
1489            };
1490
1491        List<Website> list = (List<Website>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_C_C_P,
1492                finderArgs, this);
1493
1494        if (list == null) {
1495            Session session = null;
1496
1497            try {
1498                session = openSession();
1499
1500                StringBundler query = null;
1501
1502                if (orderByComparator != null) {
1503                    query = new StringBundler(6 +
1504                            (orderByComparator.getOrderByFields().length * 3));
1505                }
1506                else {
1507                    query = new StringBundler(6);
1508                }
1509
1510                query.append(_SQL_SELECT_WEBSITE_WHERE);
1511
1512                query.append(_FINDER_COLUMN_C_C_C_P_COMPANYID_2);
1513
1514                query.append(_FINDER_COLUMN_C_C_C_P_CLASSNAMEID_2);
1515
1516                query.append(_FINDER_COLUMN_C_C_C_P_CLASSPK_2);
1517
1518                query.append(_FINDER_COLUMN_C_C_C_P_PRIMARY_2);
1519
1520                if (orderByComparator != null) {
1521                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1522                        orderByComparator);
1523                }
1524
1525                else {
1526                    query.append(WebsiteModelImpl.ORDER_BY_JPQL);
1527                }
1528
1529                String sql = query.toString();
1530
1531                Query q = session.createQuery(sql);
1532
1533                QueryPos qPos = QueryPos.getInstance(q);
1534
1535                qPos.add(companyId);
1536
1537                qPos.add(classNameId);
1538
1539                qPos.add(classPK);
1540
1541                qPos.add(primary);
1542
1543                list = (List<Website>)QueryUtil.list(q, getDialect(), start, end);
1544            }
1545            catch (Exception e) {
1546                throw processException(e);
1547            }
1548            finally {
1549                if (list == null) {
1550                    list = new ArrayList<Website>();
1551                }
1552
1553                cacheResult(list);
1554
1555                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_C_C_P,
1556                    finderArgs, list);
1557
1558                closeSession(session);
1559            }
1560        }
1561
1562        return list;
1563    }
1564
1565    public Website findByC_C_C_P_First(long companyId, long classNameId,
1566        long classPK, boolean primary, OrderByComparator orderByComparator)
1567        throws NoSuchWebsiteException, SystemException {
1568        List<Website> list = findByC_C_C_P(companyId, classNameId, classPK,
1569                primary, 0, 1, orderByComparator);
1570
1571        if (list.isEmpty()) {
1572            StringBundler msg = new StringBundler(10);
1573
1574            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1575
1576            msg.append("companyId=");
1577            msg.append(companyId);
1578
1579            msg.append(", classNameId=");
1580            msg.append(classNameId);
1581
1582            msg.append(", classPK=");
1583            msg.append(classPK);
1584
1585            msg.append(", primary=");
1586            msg.append(primary);
1587
1588            msg.append(StringPool.CLOSE_CURLY_BRACE);
1589
1590            throw new NoSuchWebsiteException(msg.toString());
1591        }
1592        else {
1593            return list.get(0);
1594        }
1595    }
1596
1597    public Website findByC_C_C_P_Last(long companyId, long classNameId,
1598        long classPK, boolean primary, OrderByComparator orderByComparator)
1599        throws NoSuchWebsiteException, SystemException {
1600        int count = countByC_C_C_P(companyId, classNameId, classPK, primary);
1601
1602        List<Website> list = findByC_C_C_P(companyId, classNameId, classPK,
1603                primary, count - 1, count, orderByComparator);
1604
1605        if (list.isEmpty()) {
1606            StringBundler msg = new StringBundler(10);
1607
1608            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1609
1610            msg.append("companyId=");
1611            msg.append(companyId);
1612
1613            msg.append(", classNameId=");
1614            msg.append(classNameId);
1615
1616            msg.append(", classPK=");
1617            msg.append(classPK);
1618
1619            msg.append(", primary=");
1620            msg.append(primary);
1621
1622            msg.append(StringPool.CLOSE_CURLY_BRACE);
1623
1624            throw new NoSuchWebsiteException(msg.toString());
1625        }
1626        else {
1627            return list.get(0);
1628        }
1629    }
1630
1631    public Website[] findByC_C_C_P_PrevAndNext(long websiteId, long companyId,
1632        long classNameId, long classPK, boolean primary,
1633        OrderByComparator orderByComparator)
1634        throws NoSuchWebsiteException, SystemException {
1635        Website website = findByPrimaryKey(websiteId);
1636
1637        Session session = null;
1638
1639        try {
1640            session = openSession();
1641
1642            Website[] array = new WebsiteImpl[3];
1643
1644            array[0] = getByC_C_C_P_PrevAndNext(session, website, companyId,
1645                    classNameId, classPK, primary, orderByComparator, true);
1646
1647            array[1] = website;
1648
1649            array[2] = getByC_C_C_P_PrevAndNext(session, website, companyId,
1650                    classNameId, classPK, primary, orderByComparator, false);
1651
1652            return array;
1653        }
1654        catch (Exception e) {
1655            throw processException(e);
1656        }
1657        finally {
1658            closeSession(session);
1659        }
1660    }
1661
1662    protected Website getByC_C_C_P_PrevAndNext(Session session,
1663        Website website, long companyId, long classNameId, long classPK,
1664        boolean primary, OrderByComparator orderByComparator, boolean previous) {
1665        StringBundler query = null;
1666
1667        if (orderByComparator != null) {
1668            query = new StringBundler(6 +
1669                    (orderByComparator.getOrderByFields().length * 6));
1670        }
1671        else {
1672            query = new StringBundler(3);
1673        }
1674
1675        query.append(_SQL_SELECT_WEBSITE_WHERE);
1676
1677        query.append(_FINDER_COLUMN_C_C_C_P_COMPANYID_2);
1678
1679        query.append(_FINDER_COLUMN_C_C_C_P_CLASSNAMEID_2);
1680
1681        query.append(_FINDER_COLUMN_C_C_C_P_CLASSPK_2);
1682
1683        query.append(_FINDER_COLUMN_C_C_C_P_PRIMARY_2);
1684
1685        if (orderByComparator != null) {
1686            String[] orderByFields = orderByComparator.getOrderByFields();
1687
1688            if (orderByFields.length > 0) {
1689                query.append(WHERE_AND);
1690            }
1691
1692            for (int i = 0; i < orderByFields.length; i++) {
1693                query.append(_ORDER_BY_ENTITY_ALIAS);
1694                query.append(orderByFields[i]);
1695
1696                if ((i + 1) < orderByFields.length) {
1697                    if (orderByComparator.isAscending() ^ previous) {
1698                        query.append(WHERE_GREATER_THAN_HAS_NEXT);
1699                    }
1700                    else {
1701                        query.append(WHERE_LESSER_THAN_HAS_NEXT);
1702                    }
1703                }
1704                else {
1705                    if (orderByComparator.isAscending() ^ previous) {
1706                        query.append(WHERE_GREATER_THAN);
1707                    }
1708                    else {
1709                        query.append(WHERE_LESSER_THAN);
1710                    }
1711                }
1712            }
1713
1714            query.append(ORDER_BY_CLAUSE);
1715
1716            for (int i = 0; i < orderByFields.length; i++) {
1717                query.append(_ORDER_BY_ENTITY_ALIAS);
1718                query.append(orderByFields[i]);
1719
1720                if ((i + 1) < orderByFields.length) {
1721                    if (orderByComparator.isAscending() ^ previous) {
1722                        query.append(ORDER_BY_ASC_HAS_NEXT);
1723                    }
1724                    else {
1725                        query.append(ORDER_BY_DESC_HAS_NEXT);
1726                    }
1727                }
1728                else {
1729                    if (orderByComparator.isAscending() ^ previous) {
1730                        query.append(ORDER_BY_ASC);
1731                    }
1732                    else {
1733                        query.append(ORDER_BY_DESC);
1734                    }
1735                }
1736            }
1737        }
1738
1739        else {
1740            query.append(WebsiteModelImpl.ORDER_BY_JPQL);
1741        }
1742
1743        String sql = query.toString();
1744
1745        Query q = session.createQuery(sql);
1746
1747        q.setFirstResult(0);
1748        q.setMaxResults(2);
1749
1750        QueryPos qPos = QueryPos.getInstance(q);
1751
1752        qPos.add(companyId);
1753
1754        qPos.add(classNameId);
1755
1756        qPos.add(classPK);
1757
1758        qPos.add(primary);
1759
1760        if (orderByComparator != null) {
1761            Object[] values = orderByComparator.getOrderByValues(website);
1762
1763            for (Object value : values) {
1764                qPos.add(value);
1765            }
1766        }
1767
1768        List<Website> list = q.list();
1769
1770        if (list.size() == 2) {
1771            return list.get(1);
1772        }
1773        else {
1774            return null;
1775        }
1776    }
1777
1778    public List<Website> findAll() throws SystemException {
1779        return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1780    }
1781
1782    public List<Website> findAll(int start, int end) throws SystemException {
1783        return findAll(start, end, null);
1784    }
1785
1786    public List<Website> findAll(int start, int end,
1787        OrderByComparator orderByComparator) throws SystemException {
1788        Object[] finderArgs = new Object[] {
1789                String.valueOf(start), String.valueOf(end),
1790                String.valueOf(orderByComparator)
1791            };
1792
1793        List<Website> list = (List<Website>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1794                finderArgs, this);
1795
1796        if (list == null) {
1797            Session session = null;
1798
1799            try {
1800                session = openSession();
1801
1802                StringBundler query = null;
1803                String sql = null;
1804
1805                if (orderByComparator != null) {
1806                    query = new StringBundler(2 +
1807                            (orderByComparator.getOrderByFields().length * 3));
1808
1809                    query.append(_SQL_SELECT_WEBSITE);
1810
1811                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1812                        orderByComparator);
1813
1814                    sql = query.toString();
1815                }
1816
1817                else {
1818                    sql = _SQL_SELECT_WEBSITE.concat(WebsiteModelImpl.ORDER_BY_JPQL);
1819                }
1820
1821                Query q = session.createQuery(sql);
1822
1823                if (orderByComparator == null) {
1824                    list = (List<Website>)QueryUtil.list(q, getDialect(),
1825                            start, end, false);
1826
1827                    Collections.sort(list);
1828                }
1829                else {
1830                    list = (List<Website>)QueryUtil.list(q, getDialect(),
1831                            start, end);
1832                }
1833            }
1834            catch (Exception e) {
1835                throw processException(e);
1836            }
1837            finally {
1838                if (list == null) {
1839                    list = new ArrayList<Website>();
1840                }
1841
1842                cacheResult(list);
1843
1844                FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
1845
1846                closeSession(session);
1847            }
1848        }
1849
1850        return list;
1851    }
1852
1853    public void removeByCompanyId(long companyId) throws SystemException {
1854        for (Website website : findByCompanyId(companyId)) {
1855            remove(website);
1856        }
1857    }
1858
1859    public void removeByUserId(long userId) throws SystemException {
1860        for (Website website : findByUserId(userId)) {
1861            remove(website);
1862        }
1863    }
1864
1865    public void removeByC_C(long companyId, long classNameId)
1866        throws SystemException {
1867        for (Website website : findByC_C(companyId, classNameId)) {
1868            remove(website);
1869        }
1870    }
1871
1872    public void removeByC_C_C(long companyId, long classNameId, long classPK)
1873        throws SystemException {
1874        for (Website website : findByC_C_C(companyId, classNameId, classPK)) {
1875            remove(website);
1876        }
1877    }
1878
1879    public void removeByC_C_C_P(long companyId, long classNameId, long classPK,
1880        boolean primary) throws SystemException {
1881        for (Website website : findByC_C_C_P(companyId, classNameId, classPK,
1882                primary)) {
1883            remove(website);
1884        }
1885    }
1886
1887    public void removeAll() throws SystemException {
1888        for (Website website : findAll()) {
1889            remove(website);
1890        }
1891    }
1892
1893    public int countByCompanyId(long companyId) throws SystemException {
1894        Object[] finderArgs = new Object[] { new Long(companyId) };
1895
1896        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
1897                finderArgs, this);
1898
1899        if (count == null) {
1900            Session session = null;
1901
1902            try {
1903                session = openSession();
1904
1905                StringBundler query = new StringBundler(2);
1906
1907                query.append(_SQL_COUNT_WEBSITE_WHERE);
1908
1909                query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1910
1911                String sql = query.toString();
1912
1913                Query q = session.createQuery(sql);
1914
1915                QueryPos qPos = QueryPos.getInstance(q);
1916
1917                qPos.add(companyId);
1918
1919                count = (Long)q.uniqueResult();
1920            }
1921            catch (Exception e) {
1922                throw processException(e);
1923            }
1924            finally {
1925                if (count == null) {
1926                    count = Long.valueOf(0);
1927                }
1928
1929                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
1930                    finderArgs, count);
1931
1932                closeSession(session);
1933            }
1934        }
1935
1936        return count.intValue();
1937    }
1938
1939    public int countByUserId(long userId) throws SystemException {
1940        Object[] finderArgs = new Object[] { new Long(userId) };
1941
1942        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERID,
1943                finderArgs, this);
1944
1945        if (count == null) {
1946            Session session = null;
1947
1948            try {
1949                session = openSession();
1950
1951                StringBundler query = new StringBundler(2);
1952
1953                query.append(_SQL_COUNT_WEBSITE_WHERE);
1954
1955                query.append(_FINDER_COLUMN_USERID_USERID_2);
1956
1957                String sql = query.toString();
1958
1959                Query q = session.createQuery(sql);
1960
1961                QueryPos qPos = QueryPos.getInstance(q);
1962
1963                qPos.add(userId);
1964
1965                count = (Long)q.uniqueResult();
1966            }
1967            catch (Exception e) {
1968                throw processException(e);
1969            }
1970            finally {
1971                if (count == null) {
1972                    count = Long.valueOf(0);
1973                }
1974
1975                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERID,
1976                    finderArgs, count);
1977
1978                closeSession(session);
1979            }
1980        }
1981
1982        return count.intValue();
1983    }
1984
1985    public int countByC_C(long companyId, long classNameId)
1986        throws SystemException {
1987        Object[] finderArgs = new Object[] {
1988                new Long(companyId), new Long(classNameId)
1989            };
1990
1991        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C,
1992                finderArgs, this);
1993
1994        if (count == null) {
1995            Session session = null;
1996
1997            try {
1998                session = openSession();
1999
2000                StringBundler query = new StringBundler(3);
2001
2002                query.append(_SQL_COUNT_WEBSITE_WHERE);
2003
2004                query.append(_FINDER_COLUMN_C_C_COMPANYID_2);
2005
2006                query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
2007
2008                String sql = query.toString();
2009
2010                Query q = session.createQuery(sql);
2011
2012                QueryPos qPos = QueryPos.getInstance(q);
2013
2014                qPos.add(companyId);
2015
2016                qPos.add(classNameId);
2017
2018                count = (Long)q.uniqueResult();
2019            }
2020            catch (Exception e) {
2021                throw processException(e);
2022            }
2023            finally {
2024                if (count == null) {
2025                    count = Long.valueOf(0);
2026                }
2027
2028                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, finderArgs,
2029                    count);
2030
2031                closeSession(session);
2032            }
2033        }
2034
2035        return count.intValue();
2036    }
2037
2038    public int countByC_C_C(long companyId, long classNameId, long classPK)
2039        throws SystemException {
2040        Object[] finderArgs = new Object[] {
2041                new Long(companyId), new Long(classNameId), new Long(classPK)
2042            };
2043
2044        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C_C,
2045                finderArgs, this);
2046
2047        if (count == null) {
2048            Session session = null;
2049
2050            try {
2051                session = openSession();
2052
2053                StringBundler query = new StringBundler(4);
2054
2055                query.append(_SQL_COUNT_WEBSITE_WHERE);
2056
2057                query.append(_FINDER_COLUMN_C_C_C_COMPANYID_2);
2058
2059                query.append(_FINDER_COLUMN_C_C_C_CLASSNAMEID_2);
2060
2061                query.append(_FINDER_COLUMN_C_C_C_CLASSPK_2);
2062
2063                String sql = query.toString();
2064
2065                Query q = session.createQuery(sql);
2066
2067                QueryPos qPos = QueryPos.getInstance(q);
2068
2069                qPos.add(companyId);
2070
2071                qPos.add(classNameId);
2072
2073                qPos.add(classPK);
2074
2075                count = (Long)q.uniqueResult();
2076            }
2077            catch (Exception e) {
2078                throw processException(e);
2079            }
2080            finally {
2081                if (count == null) {
2082                    count = Long.valueOf(0);
2083                }
2084
2085                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C_C,
2086                    finderArgs, count);
2087
2088                closeSession(session);
2089            }
2090        }
2091
2092        return count.intValue();
2093    }
2094
2095    public int countByC_C_C_P(long companyId, long classNameId, long classPK,
2096        boolean primary) throws SystemException {
2097        Object[] finderArgs = new Object[] {
2098                new Long(companyId), new Long(classNameId), new Long(classPK),
2099                Boolean.valueOf(primary)
2100            };
2101
2102        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C_C_P,
2103                finderArgs, this);
2104
2105        if (count == null) {
2106            Session session = null;
2107
2108            try {
2109                session = openSession();
2110
2111                StringBundler query = new StringBundler(5);
2112
2113                query.append(_SQL_COUNT_WEBSITE_WHERE);
2114
2115                query.append(_FINDER_COLUMN_C_C_C_P_COMPANYID_2);
2116
2117                query.append(_FINDER_COLUMN_C_C_C_P_CLASSNAMEID_2);
2118
2119                query.append(_FINDER_COLUMN_C_C_C_P_CLASSPK_2);
2120
2121                query.append(_FINDER_COLUMN_C_C_C_P_PRIMARY_2);
2122
2123                String sql = query.toString();
2124
2125                Query q = session.createQuery(sql);
2126
2127                QueryPos qPos = QueryPos.getInstance(q);
2128
2129                qPos.add(companyId);
2130
2131                qPos.add(classNameId);
2132
2133                qPos.add(classPK);
2134
2135                qPos.add(primary);
2136
2137                count = (Long)q.uniqueResult();
2138            }
2139            catch (Exception e) {
2140                throw processException(e);
2141            }
2142            finally {
2143                if (count == null) {
2144                    count = Long.valueOf(0);
2145                }
2146
2147                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C_C_P,
2148                    finderArgs, count);
2149
2150                closeSession(session);
2151            }
2152        }
2153
2154        return count.intValue();
2155    }
2156
2157    public int countAll() throws SystemException {
2158        Object[] finderArgs = new Object[0];
2159
2160        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2161                finderArgs, this);
2162
2163        if (count == null) {
2164            Session session = null;
2165
2166            try {
2167                session = openSession();
2168
2169                Query q = session.createQuery(_SQL_COUNT_WEBSITE);
2170
2171                count = (Long)q.uniqueResult();
2172            }
2173            catch (Exception e) {
2174                throw processException(e);
2175            }
2176            finally {
2177                if (count == null) {
2178                    count = Long.valueOf(0);
2179                }
2180
2181                FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
2182                    count);
2183
2184                closeSession(session);
2185            }
2186        }
2187
2188        return count.intValue();
2189    }
2190
2191    public void afterPropertiesSet() {
2192        String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2193                    com.liferay.portal.util.PropsUtil.get(
2194                        "value.object.listener.com.liferay.portal.model.Website")));
2195
2196        if (listenerClassNames.length > 0) {
2197            try {
2198                List<ModelListener<Website>> listenersList = new ArrayList<ModelListener<Website>>();
2199
2200                for (String listenerClassName : listenerClassNames) {
2201                    listenersList.add((ModelListener<Website>)InstanceFactory.newInstance(
2202                            listenerClassName));
2203                }
2204
2205                listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2206            }
2207            catch (Exception e) {
2208                _log.error(e);
2209            }
2210        }
2211    }
2212
2213    @BeanReference(type = AccountPersistence.class)
2214    protected AccountPersistence accountPersistence;
2215    @BeanReference(type = AddressPersistence.class)
2216    protected AddressPersistence addressPersistence;
2217    @BeanReference(type = BrowserTrackerPersistence.class)
2218    protected BrowserTrackerPersistence browserTrackerPersistence;
2219    @BeanReference(type = ClassNamePersistence.class)
2220    protected ClassNamePersistence classNamePersistence;
2221    @BeanReference(type = CompanyPersistence.class)
2222    protected CompanyPersistence companyPersistence;
2223    @BeanReference(type = ContactPersistence.class)
2224    protected ContactPersistence contactPersistence;
2225    @BeanReference(type = CountryPersistence.class)
2226    protected CountryPersistence countryPersistence;
2227    @BeanReference(type = EmailAddressPersistence.class)
2228    protected EmailAddressPersistence emailAddressPersistence;
2229    @BeanReference(type = GroupPersistence.class)
2230    protected GroupPersistence groupPersistence;
2231    @BeanReference(type = ImagePersistence.class)
2232    protected ImagePersistence imagePersistence;
2233    @BeanReference(type = LayoutPersistence.class)
2234    protected LayoutPersistence layoutPersistence;
2235    @BeanReference(type = LayoutPrototypePersistence.class)
2236    protected LayoutPrototypePersistence layoutPrototypePersistence;
2237    @BeanReference(type = LayoutSetPersistence.class)
2238    protected LayoutSetPersistence layoutSetPersistence;
2239    @BeanReference(type = LayoutSetPrototypePersistence.class)
2240    protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
2241    @BeanReference(type = ListTypePersistence.class)
2242    protected ListTypePersistence listTypePersistence;
2243    @BeanReference(type = LockPersistence.class)
2244    protected LockPersistence lockPersistence;
2245    @BeanReference(type = MembershipRequestPersistence.class)
2246    protected MembershipRequestPersistence membershipRequestPersistence;
2247    @BeanReference(type = OrganizationPersistence.class)
2248    protected OrganizationPersistence organizationPersistence;
2249    @BeanReference(type = OrgGroupPermissionPersistence.class)
2250    protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
2251    @BeanReference(type = OrgGroupRolePersistence.class)
2252    protected OrgGroupRolePersistence orgGroupRolePersistence;
2253    @BeanReference(type = OrgLaborPersistence.class)
2254    protected OrgLaborPersistence orgLaborPersistence;
2255    @BeanReference(type = PasswordPolicyPersistence.class)
2256    protected PasswordPolicyPersistence passwordPolicyPersistence;
2257    @BeanReference(type = PasswordPolicyRelPersistence.class)
2258    protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
2259    @BeanReference(type = PasswordTrackerPersistence.class)
2260    protected PasswordTrackerPersistence passwordTrackerPersistence;
2261    @BeanReference(type = PermissionPersistence.class)
2262    protected PermissionPersistence permissionPersistence;
2263    @BeanReference(type = PhonePersistence.class)
2264    protected PhonePersistence phonePersistence;
2265    @BeanReference(type = PluginSettingPersistence.class)
2266    protected PluginSettingPersistence pluginSettingPersistence;
2267    @BeanReference(type = PortletPersistence.class)
2268    protected PortletPersistence portletPersistence;
2269    @BeanReference(type = PortletItemPersistence.class)
2270    protected PortletItemPersistence portletItemPersistence;
2271    @BeanReference(type = PortletPreferencesPersistence.class)
2272    protected PortletPreferencesPersistence portletPreferencesPersistence;
2273    @BeanReference(type = RegionPersistence.class)
2274    protected RegionPersistence regionPersistence;
2275    @BeanReference(type = ReleasePersistence.class)
2276    protected ReleasePersistence releasePersistence;
2277    @BeanReference(type = ResourcePersistence.class)
2278    protected ResourcePersistence resourcePersistence;
2279    @BeanReference(type = ResourceActionPersistence.class)
2280    protected ResourceActionPersistence resourceActionPersistence;
2281    @BeanReference(type = ResourceCodePersistence.class)
2282    protected ResourceCodePersistence resourceCodePersistence;
2283    @BeanReference(type = ResourcePermissionPersistence.class)
2284    protected ResourcePermissionPersistence resourcePermissionPersistence;
2285    @BeanReference(type = RolePersistence.class)
2286    protected RolePersistence rolePersistence;
2287    @BeanReference(type = ServiceComponentPersistence.class)
2288    protected ServiceComponentPersistence serviceComponentPersistence;
2289    @BeanReference(type = ShardPersistence.class)
2290    protected ShardPersistence shardPersistence;
2291    @BeanReference(type = SubscriptionPersistence.class)
2292    protected SubscriptionPersistence subscriptionPersistence;
2293    @BeanReference(type = TicketPersistence.class)
2294    protected TicketPersistence ticketPersistence;
2295    @BeanReference(type = TeamPersistence.class)
2296    protected TeamPersistence teamPersistence;
2297    @BeanReference(type = UserPersistence.class)
2298    protected UserPersistence userPersistence;
2299    @BeanReference(type = UserGroupPersistence.class)
2300    protected UserGroupPersistence userGroupPersistence;
2301    @BeanReference(type = UserGroupGroupRolePersistence.class)
2302    protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
2303    @BeanReference(type = UserGroupRolePersistence.class)
2304    protected UserGroupRolePersistence userGroupRolePersistence;
2305    @BeanReference(type = UserIdMapperPersistence.class)
2306    protected UserIdMapperPersistence userIdMapperPersistence;
2307    @BeanReference(type = UserTrackerPersistence.class)
2308    protected UserTrackerPersistence userTrackerPersistence;
2309    @BeanReference(type = UserTrackerPathPersistence.class)
2310    protected UserTrackerPathPersistence userTrackerPathPersistence;
2311    @BeanReference(type = WebDAVPropsPersistence.class)
2312    protected WebDAVPropsPersistence webDAVPropsPersistence;
2313    @BeanReference(type = WebsitePersistence.class)
2314    protected WebsitePersistence websitePersistence;
2315    @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
2316    protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
2317    @BeanReference(type = WorkflowInstanceLinkPersistence.class)
2318    protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
2319    private static final String _SQL_SELECT_WEBSITE = "SELECT website FROM Website website";
2320    private static final String _SQL_SELECT_WEBSITE_WHERE = "SELECT website FROM Website website WHERE ";
2321    private static final String _SQL_COUNT_WEBSITE = "SELECT COUNT(website) FROM Website website";
2322    private static final String _SQL_COUNT_WEBSITE_WHERE = "SELECT COUNT(website) FROM Website website WHERE ";
2323    private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "website.companyId = ?";
2324    private static final String _FINDER_COLUMN_USERID_USERID_2 = "website.userId = ?";
2325    private static final String _FINDER_COLUMN_C_C_COMPANYID_2 = "website.companyId = ? AND ";
2326    private static final String _FINDER_COLUMN_C_C_CLASSNAMEID_2 = "website.classNameId = ?";
2327    private static final String _FINDER_COLUMN_C_C_C_COMPANYID_2 = "website.companyId = ? AND ";
2328    private static final String _FINDER_COLUMN_C_C_C_CLASSNAMEID_2 = "website.classNameId = ? AND ";
2329    private static final String _FINDER_COLUMN_C_C_C_CLASSPK_2 = "website.classPK = ?";
2330    private static final String _FINDER_COLUMN_C_C_C_P_COMPANYID_2 = "website.companyId = ? AND ";
2331    private static final String _FINDER_COLUMN_C_C_C_P_CLASSNAMEID_2 = "website.classNameId = ? AND ";
2332    private static final String _FINDER_COLUMN_C_C_C_P_CLASSPK_2 = "website.classPK = ? AND ";
2333    private static final String _FINDER_COLUMN_C_C_C_P_PRIMARY_2 = "website.primary = ?";
2334    private static final String _ORDER_BY_ENTITY_ALIAS = "website.";
2335    private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Website exists with the primary key ";
2336    private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Website exists with the key {";
2337    private static Log _log = LogFactoryUtil.getLog(WebsitePersistenceImpl.class);
2338}