001
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
062 public class WebsitePersistenceImpl extends BasePersistenceImpl<Website>
063 implements WebsitePersistence {
064
069 public static final String FINDER_CLASS_NAME_ENTITY = WebsiteImpl.class.getName();
070 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
071 ".List1";
072 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
073 ".List2";
074 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID =
075 new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
076 WebsiteModelImpl.FINDER_CACHE_ENABLED, WebsiteImpl.class,
077 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByCompanyId",
078 new String[] {
079 Long.class.getName(),
080
081 "java.lang.Integer", "java.lang.Integer",
082 "com.liferay.portal.kernel.util.OrderByComparator"
083 });
084 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID =
085 new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
086 WebsiteModelImpl.FINDER_CACHE_ENABLED, WebsiteImpl.class,
087 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByCompanyId",
088 new String[] { Long.class.getName() },
089 WebsiteModelImpl.COMPANYID_COLUMN_BITMASK);
090 public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
091 WebsiteModelImpl.FINDER_CACHE_ENABLED, Long.class,
092 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByCompanyId",
093 new String[] { Long.class.getName() });
094 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_USERID = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
095 WebsiteModelImpl.FINDER_CACHE_ENABLED, WebsiteImpl.class,
096 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByUserId",
097 new String[] {
098 Long.class.getName(),
099
100 "java.lang.Integer", "java.lang.Integer",
101 "com.liferay.portal.kernel.util.OrderByComparator"
102 });
103 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID =
104 new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
105 WebsiteModelImpl.FINDER_CACHE_ENABLED, WebsiteImpl.class,
106 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUserId",
107 new String[] { Long.class.getName() },
108 WebsiteModelImpl.USERID_COLUMN_BITMASK);
109 public static final FinderPath FINDER_PATH_COUNT_BY_USERID = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
110 WebsiteModelImpl.FINDER_CACHE_ENABLED, Long.class,
111 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUserId",
112 new String[] { Long.class.getName() });
113 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
114 WebsiteModelImpl.FINDER_CACHE_ENABLED, WebsiteImpl.class,
115 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_C",
116 new String[] {
117 Long.class.getName(), Long.class.getName(),
118
119 "java.lang.Integer", "java.lang.Integer",
120 "com.liferay.portal.kernel.util.OrderByComparator"
121 });
122 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
123 WebsiteModelImpl.FINDER_CACHE_ENABLED, WebsiteImpl.class,
124 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_C",
125 new String[] { Long.class.getName(), Long.class.getName() },
126 WebsiteModelImpl.COMPANYID_COLUMN_BITMASK |
127 WebsiteModelImpl.CLASSNAMEID_COLUMN_BITMASK);
128 public static final FinderPath FINDER_PATH_COUNT_BY_C_C = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
129 WebsiteModelImpl.FINDER_CACHE_ENABLED, Long.class,
130 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_C",
131 new String[] { Long.class.getName(), Long.class.getName() });
132 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C_C = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
133 WebsiteModelImpl.FINDER_CACHE_ENABLED, WebsiteImpl.class,
134 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_C_C",
135 new String[] {
136 Long.class.getName(), Long.class.getName(), Long.class.getName(),
137
138 "java.lang.Integer", "java.lang.Integer",
139 "com.liferay.portal.kernel.util.OrderByComparator"
140 });
141 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
142 WebsiteModelImpl.FINDER_CACHE_ENABLED, WebsiteImpl.class,
143 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_C_C",
144 new String[] {
145 Long.class.getName(), Long.class.getName(), Long.class.getName()
146 },
147 WebsiteModelImpl.COMPANYID_COLUMN_BITMASK |
148 WebsiteModelImpl.CLASSNAMEID_COLUMN_BITMASK |
149 WebsiteModelImpl.CLASSPK_COLUMN_BITMASK);
150 public static final FinderPath FINDER_PATH_COUNT_BY_C_C_C = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
151 WebsiteModelImpl.FINDER_CACHE_ENABLED, Long.class,
152 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_C_C",
153 new String[] {
154 Long.class.getName(), Long.class.getName(), Long.class.getName()
155 });
156 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C_C_P = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
157 WebsiteModelImpl.FINDER_CACHE_ENABLED, WebsiteImpl.class,
158 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_C_C_P",
159 new String[] {
160 Long.class.getName(), Long.class.getName(), Long.class.getName(),
161 Boolean.class.getName(),
162
163 "java.lang.Integer", "java.lang.Integer",
164 "com.liferay.portal.kernel.util.OrderByComparator"
165 });
166 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C_P =
167 new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
168 WebsiteModelImpl.FINDER_CACHE_ENABLED, WebsiteImpl.class,
169 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_C_C_P",
170 new String[] {
171 Long.class.getName(), Long.class.getName(), Long.class.getName(),
172 Boolean.class.getName()
173 },
174 WebsiteModelImpl.COMPANYID_COLUMN_BITMASK |
175 WebsiteModelImpl.CLASSNAMEID_COLUMN_BITMASK |
176 WebsiteModelImpl.CLASSPK_COLUMN_BITMASK |
177 WebsiteModelImpl.PRIMARY_COLUMN_BITMASK);
178 public static final FinderPath FINDER_PATH_COUNT_BY_C_C_C_P = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
179 WebsiteModelImpl.FINDER_CACHE_ENABLED, Long.class,
180 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_C_C_P",
181 new String[] {
182 Long.class.getName(), Long.class.getName(), Long.class.getName(),
183 Boolean.class.getName()
184 });
185 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
186 WebsiteModelImpl.FINDER_CACHE_ENABLED, WebsiteImpl.class,
187 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
188 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
189 WebsiteModelImpl.FINDER_CACHE_ENABLED, WebsiteImpl.class,
190 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
191 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
192 WebsiteModelImpl.FINDER_CACHE_ENABLED, Long.class,
193 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
194
195
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
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
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
252 @Override
253 public void clearCache(Website website) {
254 EntityCacheUtil.removeResult(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
255 WebsiteImpl.class, website.getPrimaryKey());
256
257 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
258 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
259 }
260
261 @Override
262 public void clearCache(List<Website> websites) {
263 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
264 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
265
266 for (Website website : websites) {
267 EntityCacheUtil.removeResult(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
268 WebsiteImpl.class, website.getPrimaryKey());
269 }
270 }
271
272
278 public Website create(long websiteId) {
279 Website website = new WebsiteImpl();
280
281 website.setNew(true);
282 website.setPrimaryKey(websiteId);
283
284 return website;
285 }
286
287
295 public Website remove(long websiteId)
296 throws NoSuchWebsiteException, SystemException {
297 return remove(Long.valueOf(websiteId));
298 }
299
300
308 @Override
309 public Website remove(Serializable primaryKey)
310 throws NoSuchWebsiteException, SystemException {
311 Session session = null;
312
313 try {
314 session = openSession();
315
316 Website website = (Website)session.get(WebsiteImpl.class, primaryKey);
317
318 if (website == null) {
319 if (_log.isWarnEnabled()) {
320 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
321 }
322
323 throw new NoSuchWebsiteException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
324 primaryKey);
325 }
326
327 return remove(website);
328 }
329 catch (NoSuchWebsiteException nsee) {
330 throw nsee;
331 }
332 catch (Exception e) {
333 throw processException(e);
334 }
335 finally {
336 closeSession(session);
337 }
338 }
339
340 @Override
341 protected Website removeImpl(Website website) throws SystemException {
342 website = toUnwrappedModel(website);
343
344 Session session = null;
345
346 try {
347 session = openSession();
348
349 if (website.isCachedModel()) {
350 website = (Website)session.get(WebsiteImpl.class,
351 website.getPrimaryKeyObj());
352 }
353
354 session.delete(website);
355 }
356 catch (Exception e) {
357 throw processException(e);
358 }
359 finally {
360 closeSession(session);
361 }
362
363 clearCache(website);
364
365 return website;
366 }
367
368 @Override
369 public Website updateImpl(com.liferay.portal.model.Website website)
370 throws SystemException {
371 website = toUnwrappedModel(website);
372
373 boolean isNew = website.isNew();
374
375 WebsiteModelImpl websiteModelImpl = (WebsiteModelImpl)website;
376
377 Session session = null;
378
379 try {
380 session = openSession();
381
382 if (website.isNew()) {
383 session.save(website);
384
385 website.setNew(false);
386 }
387 else {
388 session.merge(website);
389 }
390 }
391 catch (Exception e) {
392 throw processException(e);
393 }
394 finally {
395 closeSession(session);
396 }
397
398 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
399
400 if (isNew || !WebsiteModelImpl.COLUMN_BITMASK_ENABLED) {
401 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
402 }
403
404 else {
405 if ((websiteModelImpl.getColumnBitmask() &
406 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID.getColumnBitmask()) != 0) {
407 Object[] args = new Object[] {
408 Long.valueOf(websiteModelImpl.getOriginalCompanyId())
409 };
410
411 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
412 args);
413 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
414 args);
415
416 args = new Object[] {
417 Long.valueOf(websiteModelImpl.getCompanyId())
418 };
419
420 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
421 args);
422 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
423 args);
424 }
425
426 if ((websiteModelImpl.getColumnBitmask() &
427 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID.getColumnBitmask()) != 0) {
428 Object[] args = new Object[] {
429 Long.valueOf(websiteModelImpl.getOriginalUserId())
430 };
431
432 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
433 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID,
434 args);
435
436 args = new Object[] { Long.valueOf(websiteModelImpl.getUserId()) };
437
438 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
439 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID,
440 args);
441 }
442
443 if ((websiteModelImpl.getColumnBitmask() &
444 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C.getColumnBitmask()) != 0) {
445 Object[] args = new Object[] {
446 Long.valueOf(websiteModelImpl.getOriginalCompanyId()),
447 Long.valueOf(websiteModelImpl.getOriginalClassNameId())
448 };
449
450 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C, args);
451 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C,
452 args);
453
454 args = new Object[] {
455 Long.valueOf(websiteModelImpl.getCompanyId()),
456 Long.valueOf(websiteModelImpl.getClassNameId())
457 };
458
459 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C, args);
460 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C,
461 args);
462 }
463
464 if ((websiteModelImpl.getColumnBitmask() &
465 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C.getColumnBitmask()) != 0) {
466 Object[] args = new Object[] {
467 Long.valueOf(websiteModelImpl.getOriginalCompanyId()),
468 Long.valueOf(websiteModelImpl.getOriginalClassNameId()),
469 Long.valueOf(websiteModelImpl.getOriginalClassPK())
470 };
471
472 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C_C, args);
473 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C,
474 args);
475
476 args = new Object[] {
477 Long.valueOf(websiteModelImpl.getCompanyId()),
478 Long.valueOf(websiteModelImpl.getClassNameId()),
479 Long.valueOf(websiteModelImpl.getClassPK())
480 };
481
482 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C_C, args);
483 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C,
484 args);
485 }
486
487 if ((websiteModelImpl.getColumnBitmask() &
488 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C_P.getColumnBitmask()) != 0) {
489 Object[] args = new Object[] {
490 Long.valueOf(websiteModelImpl.getOriginalCompanyId()),
491 Long.valueOf(websiteModelImpl.getOriginalClassNameId()),
492 Long.valueOf(websiteModelImpl.getOriginalClassPK()),
493 Boolean.valueOf(websiteModelImpl.getOriginalPrimary())
494 };
495
496 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C_C_P, args);
497 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C_P,
498 args);
499
500 args = new Object[] {
501 Long.valueOf(websiteModelImpl.getCompanyId()),
502 Long.valueOf(websiteModelImpl.getClassNameId()),
503 Long.valueOf(websiteModelImpl.getClassPK()),
504 Boolean.valueOf(websiteModelImpl.getPrimary())
505 };
506
507 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C_C_P, args);
508 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C_P,
509 args);
510 }
511 }
512
513 EntityCacheUtil.putResult(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
514 WebsiteImpl.class, website.getPrimaryKey(), website);
515
516 return website;
517 }
518
519 protected Website toUnwrappedModel(Website website) {
520 if (website instanceof WebsiteImpl) {
521 return website;
522 }
523
524 WebsiteImpl websiteImpl = new WebsiteImpl();
525
526 websiteImpl.setNew(website.isNew());
527 websiteImpl.setPrimaryKey(website.getPrimaryKey());
528
529 websiteImpl.setWebsiteId(website.getWebsiteId());
530 websiteImpl.setCompanyId(website.getCompanyId());
531 websiteImpl.setUserId(website.getUserId());
532 websiteImpl.setUserName(website.getUserName());
533 websiteImpl.setCreateDate(website.getCreateDate());
534 websiteImpl.setModifiedDate(website.getModifiedDate());
535 websiteImpl.setClassNameId(website.getClassNameId());
536 websiteImpl.setClassPK(website.getClassPK());
537 websiteImpl.setUrl(website.getUrl());
538 websiteImpl.setTypeId(website.getTypeId());
539 websiteImpl.setPrimary(website.isPrimary());
540
541 return websiteImpl;
542 }
543
544
552 @Override
553 public Website findByPrimaryKey(Serializable primaryKey)
554 throws NoSuchModelException, SystemException {
555 return findByPrimaryKey(((Long)primaryKey).longValue());
556 }
557
558
566 public Website findByPrimaryKey(long websiteId)
567 throws NoSuchWebsiteException, SystemException {
568 Website website = fetchByPrimaryKey(websiteId);
569
570 if (website == null) {
571 if (_log.isWarnEnabled()) {
572 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + websiteId);
573 }
574
575 throw new NoSuchWebsiteException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
576 websiteId);
577 }
578
579 return website;
580 }
581
582
589 @Override
590 public Website fetchByPrimaryKey(Serializable primaryKey)
591 throws SystemException {
592 return fetchByPrimaryKey(((Long)primaryKey).longValue());
593 }
594
595
602 public Website fetchByPrimaryKey(long websiteId) throws SystemException {
603 Website website = (Website)EntityCacheUtil.getResult(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
604 WebsiteImpl.class, websiteId);
605
606 if (website == _nullWebsite) {
607 return null;
608 }
609
610 if (website == null) {
611 Session session = null;
612
613 boolean hasException = false;
614
615 try {
616 session = openSession();
617
618 website = (Website)session.get(WebsiteImpl.class,
619 Long.valueOf(websiteId));
620 }
621 catch (Exception e) {
622 hasException = true;
623
624 throw processException(e);
625 }
626 finally {
627 if (website != null) {
628 cacheResult(website);
629 }
630 else if (!hasException) {
631 EntityCacheUtil.putResult(WebsiteModelImpl.ENTITY_CACHE_ENABLED,
632 WebsiteImpl.class, websiteId, _nullWebsite);
633 }
634
635 closeSession(session);
636 }
637 }
638
639 return website;
640 }
641
642
649 public List<Website> findByCompanyId(long companyId)
650 throws SystemException {
651 return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
652 null);
653 }
654
655
668 public List<Website> findByCompanyId(long companyId, int start, int end)
669 throws SystemException {
670 return findByCompanyId(companyId, start, end, null);
671 }
672
673
687 public List<Website> findByCompanyId(long companyId, int start, int end,
688 OrderByComparator orderByComparator) throws SystemException {
689 FinderPath finderPath = null;
690 Object[] finderArgs = null;
691
692 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
693 (orderByComparator == null)) {
694 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID;
695 finderArgs = new Object[] { companyId };
696 }
697 else {
698 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID;
699 finderArgs = new Object[] { companyId, start, end, orderByComparator };
700 }
701
702 List<Website> list = (List<Website>)FinderCacheUtil.getResult(finderPath,
703 finderArgs, this);
704
705 if ((list != null) && !list.isEmpty()) {
706 for (Website website : list) {
707 if ((companyId != website.getCompanyId())) {
708 list = null;
709
710 break;
711 }
712 }
713 }
714
715 if (list == null) {
716 StringBundler query = null;
717
718 if (orderByComparator != null) {
719 query = new StringBundler(3 +
720 (orderByComparator.getOrderByFields().length * 3));
721 }
722 else {
723 query = new StringBundler(3);
724 }
725
726 query.append(_SQL_SELECT_WEBSITE_WHERE);
727
728 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
729
730 if (orderByComparator != null) {
731 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
732 orderByComparator);
733 }
734
735 else {
736 query.append(WebsiteModelImpl.ORDER_BY_JPQL);
737 }
738
739 String sql = query.toString();
740
741 Session session = null;
742
743 try {
744 session = openSession();
745
746 Query q = session.createQuery(sql);
747
748 QueryPos qPos = QueryPos.getInstance(q);
749
750 qPos.add(companyId);
751
752 list = (List<Website>)QueryUtil.list(q, getDialect(), start, end);
753 }
754 catch (Exception e) {
755 throw processException(e);
756 }
757 finally {
758 if (list == null) {
759 FinderCacheUtil.removeResult(finderPath, finderArgs);
760 }
761 else {
762 cacheResult(list);
763
764 FinderCacheUtil.putResult(finderPath, finderArgs, list);
765 }
766
767 closeSession(session);
768 }
769 }
770
771 return list;
772 }
773
774
783 public Website findByCompanyId_First(long companyId,
784 OrderByComparator orderByComparator)
785 throws NoSuchWebsiteException, SystemException {
786 Website website = fetchByCompanyId_First(companyId, orderByComparator);
787
788 if (website != null) {
789 return website;
790 }
791
792 StringBundler msg = new StringBundler(4);
793
794 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
795
796 msg.append("companyId=");
797 msg.append(companyId);
798
799 msg.append(StringPool.CLOSE_CURLY_BRACE);
800
801 throw new NoSuchWebsiteException(msg.toString());
802 }
803
804
812 public Website fetchByCompanyId_First(long companyId,
813 OrderByComparator orderByComparator) throws SystemException {
814 List<Website> list = findByCompanyId(companyId, 0, 1, orderByComparator);
815
816 if (!list.isEmpty()) {
817 return list.get(0);
818 }
819
820 return null;
821 }
822
823
832 public Website findByCompanyId_Last(long companyId,
833 OrderByComparator orderByComparator)
834 throws NoSuchWebsiteException, SystemException {
835 Website website = fetchByCompanyId_Last(companyId, orderByComparator);
836
837 if (website != null) {
838 return website;
839 }
840
841 StringBundler msg = new StringBundler(4);
842
843 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
844
845 msg.append("companyId=");
846 msg.append(companyId);
847
848 msg.append(StringPool.CLOSE_CURLY_BRACE);
849
850 throw new NoSuchWebsiteException(msg.toString());
851 }
852
853
861 public Website fetchByCompanyId_Last(long companyId,
862 OrderByComparator orderByComparator) throws SystemException {
863 int count = countByCompanyId(companyId);
864
865 List<Website> list = findByCompanyId(companyId, count - 1, count,
866 orderByComparator);
867
868 if (!list.isEmpty()) {
869 return list.get(0);
870 }
871
872 return null;
873 }
874
875
885 public Website[] findByCompanyId_PrevAndNext(long websiteId,
886 long companyId, OrderByComparator orderByComparator)
887 throws NoSuchWebsiteException, SystemException {
888 Website website = findByPrimaryKey(websiteId);
889
890 Session session = null;
891
892 try {
893 session = openSession();
894
895 Website[] array = new WebsiteImpl[3];
896
897 array[0] = getByCompanyId_PrevAndNext(session, website, companyId,
898 orderByComparator, true);
899
900 array[1] = website;
901
902 array[2] = getByCompanyId_PrevAndNext(session, website, companyId,
903 orderByComparator, false);
904
905 return array;
906 }
907 catch (Exception e) {
908 throw processException(e);
909 }
910 finally {
911 closeSession(session);
912 }
913 }
914
915 protected Website getByCompanyId_PrevAndNext(Session session,
916 Website website, long companyId, OrderByComparator orderByComparator,
917 boolean previous) {
918 StringBundler query = null;
919
920 if (orderByComparator != null) {
921 query = new StringBundler(6 +
922 (orderByComparator.getOrderByFields().length * 6));
923 }
924 else {
925 query = new StringBundler(3);
926 }
927
928 query.append(_SQL_SELECT_WEBSITE_WHERE);
929
930 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
931
932 if (orderByComparator != null) {
933 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
934
935 if (orderByConditionFields.length > 0) {
936 query.append(WHERE_AND);
937 }
938
939 for (int i = 0; i < orderByConditionFields.length; i++) {
940 query.append(_ORDER_BY_ENTITY_ALIAS);
941 query.append(orderByConditionFields[i]);
942
943 if ((i + 1) < orderByConditionFields.length) {
944 if (orderByComparator.isAscending() ^ previous) {
945 query.append(WHERE_GREATER_THAN_HAS_NEXT);
946 }
947 else {
948 query.append(WHERE_LESSER_THAN_HAS_NEXT);
949 }
950 }
951 else {
952 if (orderByComparator.isAscending() ^ previous) {
953 query.append(WHERE_GREATER_THAN);
954 }
955 else {
956 query.append(WHERE_LESSER_THAN);
957 }
958 }
959 }
960
961 query.append(ORDER_BY_CLAUSE);
962
963 String[] orderByFields = orderByComparator.getOrderByFields();
964
965 for (int i = 0; i < orderByFields.length; i++) {
966 query.append(_ORDER_BY_ENTITY_ALIAS);
967 query.append(orderByFields[i]);
968
969 if ((i + 1) < orderByFields.length) {
970 if (orderByComparator.isAscending() ^ previous) {
971 query.append(ORDER_BY_ASC_HAS_NEXT);
972 }
973 else {
974 query.append(ORDER_BY_DESC_HAS_NEXT);
975 }
976 }
977 else {
978 if (orderByComparator.isAscending() ^ previous) {
979 query.append(ORDER_BY_ASC);
980 }
981 else {
982 query.append(ORDER_BY_DESC);
983 }
984 }
985 }
986 }
987
988 else {
989 query.append(WebsiteModelImpl.ORDER_BY_JPQL);
990 }
991
992 String sql = query.toString();
993
994 Query q = session.createQuery(sql);
995
996 q.setFirstResult(0);
997 q.setMaxResults(2);
998
999 QueryPos qPos = QueryPos.getInstance(q);
1000
1001 qPos.add(companyId);
1002
1003 if (orderByComparator != null) {
1004 Object[] values = orderByComparator.getOrderByConditionValues(website);
1005
1006 for (Object value : values) {
1007 qPos.add(value);
1008 }
1009 }
1010
1011 List<Website> list = q.list();
1012
1013 if (list.size() == 2) {
1014 return list.get(1);
1015 }
1016 else {
1017 return null;
1018 }
1019 }
1020
1021
1028 public List<Website> findByUserId(long userId) throws SystemException {
1029 return findByUserId(userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1030 }
1031
1032
1045 public List<Website> findByUserId(long userId, int start, int end)
1046 throws SystemException {
1047 return findByUserId(userId, start, end, null);
1048 }
1049
1050
1064 public List<Website> findByUserId(long userId, int start, int end,
1065 OrderByComparator orderByComparator) throws SystemException {
1066 FinderPath finderPath = null;
1067 Object[] finderArgs = null;
1068
1069 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1070 (orderByComparator == null)) {
1071 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID;
1072 finderArgs = new Object[] { userId };
1073 }
1074 else {
1075 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_USERID;
1076 finderArgs = new Object[] { userId, start, end, orderByComparator };
1077 }
1078
1079 List<Website> list = (List<Website>)FinderCacheUtil.getResult(finderPath,
1080 finderArgs, this);
1081
1082 if ((list != null) && !list.isEmpty()) {
1083 for (Website website : list) {
1084 if ((userId != website.getUserId())) {
1085 list = null;
1086
1087 break;
1088 }
1089 }
1090 }
1091
1092 if (list == null) {
1093 StringBundler query = null;
1094
1095 if (orderByComparator != null) {
1096 query = new StringBundler(3 +
1097 (orderByComparator.getOrderByFields().length * 3));
1098 }
1099 else {
1100 query = new StringBundler(3);
1101 }
1102
1103 query.append(_SQL_SELECT_WEBSITE_WHERE);
1104
1105 query.append(_FINDER_COLUMN_USERID_USERID_2);
1106
1107 if (orderByComparator != null) {
1108 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1109 orderByComparator);
1110 }
1111
1112 else {
1113 query.append(WebsiteModelImpl.ORDER_BY_JPQL);
1114 }
1115
1116 String sql = query.toString();
1117
1118 Session session = null;
1119
1120 try {
1121 session = openSession();
1122
1123 Query q = session.createQuery(sql);
1124
1125 QueryPos qPos = QueryPos.getInstance(q);
1126
1127 qPos.add(userId);
1128
1129 list = (List<Website>)QueryUtil.list(q, getDialect(), start, end);
1130 }
1131 catch (Exception e) {
1132 throw processException(e);
1133 }
1134 finally {
1135 if (list == null) {
1136 FinderCacheUtil.removeResult(finderPath, finderArgs);
1137 }
1138 else {
1139 cacheResult(list);
1140
1141 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1142 }
1143
1144 closeSession(session);
1145 }
1146 }
1147
1148 return list;
1149 }
1150
1151
1160 public Website findByUserId_First(long userId,
1161 OrderByComparator orderByComparator)
1162 throws NoSuchWebsiteException, SystemException {
1163 Website website = fetchByUserId_First(userId, orderByComparator);
1164
1165 if (website != null) {
1166 return website;
1167 }
1168
1169 StringBundler msg = new StringBundler(4);
1170
1171 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1172
1173 msg.append("userId=");
1174 msg.append(userId);
1175
1176 msg.append(StringPool.CLOSE_CURLY_BRACE);
1177
1178 throw new NoSuchWebsiteException(msg.toString());
1179 }
1180
1181
1189 public Website fetchByUserId_First(long userId,
1190 OrderByComparator orderByComparator) throws SystemException {
1191 List<Website> list = findByUserId(userId, 0, 1, orderByComparator);
1192
1193 if (!list.isEmpty()) {
1194 return list.get(0);
1195 }
1196
1197 return null;
1198 }
1199
1200
1209 public Website findByUserId_Last(long userId,
1210 OrderByComparator orderByComparator)
1211 throws NoSuchWebsiteException, SystemException {
1212 Website website = fetchByUserId_Last(userId, orderByComparator);
1213
1214 if (website != null) {
1215 return website;
1216 }
1217
1218 StringBundler msg = new StringBundler(4);
1219
1220 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1221
1222 msg.append("userId=");
1223 msg.append(userId);
1224
1225 msg.append(StringPool.CLOSE_CURLY_BRACE);
1226
1227 throw new NoSuchWebsiteException(msg.toString());
1228 }
1229
1230
1238 public Website fetchByUserId_Last(long userId,
1239 OrderByComparator orderByComparator) throws SystemException {
1240 int count = countByUserId(userId);
1241
1242 List<Website> list = findByUserId(userId, count - 1, count,
1243 orderByComparator);
1244
1245 if (!list.isEmpty()) {
1246 return list.get(0);
1247 }
1248
1249 return null;
1250 }
1251
1252
1262 public Website[] findByUserId_PrevAndNext(long websiteId, long userId,
1263 OrderByComparator orderByComparator)
1264 throws NoSuchWebsiteException, SystemException {
1265 Website website = findByPrimaryKey(websiteId);
1266
1267 Session session = null;
1268
1269 try {
1270 session = openSession();
1271
1272 Website[] array = new WebsiteImpl[3];
1273
1274 array[0] = getByUserId_PrevAndNext(session, website, userId,
1275 orderByComparator, true);
1276
1277 array[1] = website;
1278
1279 array[2] = getByUserId_PrevAndNext(session, website, userId,
1280 orderByComparator, false);
1281
1282 return array;
1283 }
1284 catch (Exception e) {
1285 throw processException(e);
1286 }
1287 finally {
1288 closeSession(session);
1289 }
1290 }
1291
1292 protected Website getByUserId_PrevAndNext(Session session, Website website,
1293 long userId, OrderByComparator orderByComparator, boolean previous) {
1294 StringBundler query = null;
1295
1296 if (orderByComparator != null) {
1297 query = new StringBundler(6 +
1298 (orderByComparator.getOrderByFields().length * 6));
1299 }
1300 else {
1301 query = new StringBundler(3);
1302 }
1303
1304 query.append(_SQL_SELECT_WEBSITE_WHERE);
1305
1306 query.append(_FINDER_COLUMN_USERID_USERID_2);
1307
1308 if (orderByComparator != null) {
1309 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1310
1311 if (orderByConditionFields.length > 0) {
1312 query.append(WHERE_AND);
1313 }
1314
1315 for (int i = 0; i < orderByConditionFields.length; i++) {
1316 query.append(_ORDER_BY_ENTITY_ALIAS);
1317 query.append(orderByConditionFields[i]);
1318
1319 if ((i + 1) < orderByConditionFields.length) {
1320 if (orderByComparator.isAscending() ^ previous) {
1321 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1322 }
1323 else {
1324 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1325 }
1326 }
1327 else {
1328 if (orderByComparator.isAscending() ^ previous) {
1329 query.append(WHERE_GREATER_THAN);
1330 }
1331 else {
1332 query.append(WHERE_LESSER_THAN);
1333 }
1334 }
1335 }
1336
1337 query.append(ORDER_BY_CLAUSE);
1338
1339 String[] orderByFields = orderByComparator.getOrderByFields();
1340
1341 for (int i = 0; i < orderByFields.length; i++) {
1342 query.append(_ORDER_BY_ENTITY_ALIAS);
1343 query.append(orderByFields[i]);
1344
1345 if ((i + 1) < orderByFields.length) {
1346 if (orderByComparator.isAscending() ^ previous) {
1347 query.append(ORDER_BY_ASC_HAS_NEXT);
1348 }
1349 else {
1350 query.append(ORDER_BY_DESC_HAS_NEXT);
1351 }
1352 }
1353 else {
1354 if (orderByComparator.isAscending() ^ previous) {
1355 query.append(ORDER_BY_ASC);
1356 }
1357 else {
1358 query.append(ORDER_BY_DESC);
1359 }
1360 }
1361 }
1362 }
1363
1364 else {
1365 query.append(WebsiteModelImpl.ORDER_BY_JPQL);
1366 }
1367
1368 String sql = query.toString();
1369
1370 Query q = session.createQuery(sql);
1371
1372 q.setFirstResult(0);
1373 q.setMaxResults(2);
1374
1375 QueryPos qPos = QueryPos.getInstance(q);
1376
1377 qPos.add(userId);
1378
1379 if (orderByComparator != null) {
1380 Object[] values = orderByComparator.getOrderByConditionValues(website);
1381
1382 for (Object value : values) {
1383 qPos.add(value);
1384 }
1385 }
1386
1387 List<Website> list = q.list();
1388
1389 if (list.size() == 2) {
1390 return list.get(1);
1391 }
1392 else {
1393 return null;
1394 }
1395 }
1396
1397
1405 public List<Website> findByC_C(long companyId, long classNameId)
1406 throws SystemException {
1407 return findByC_C(companyId, classNameId, QueryUtil.ALL_POS,
1408 QueryUtil.ALL_POS, null);
1409 }
1410
1411
1425 public List<Website> findByC_C(long companyId, long classNameId, int start,
1426 int end) throws SystemException {
1427 return findByC_C(companyId, classNameId, start, end, null);
1428 }
1429
1430
1445 public List<Website> findByC_C(long companyId, long classNameId, int start,
1446 int end, OrderByComparator orderByComparator) throws SystemException {
1447 FinderPath finderPath = null;
1448 Object[] finderArgs = null;
1449
1450 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1451 (orderByComparator == null)) {
1452 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C;
1453 finderArgs = new Object[] { companyId, classNameId };
1454 }
1455 else {
1456 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C;
1457 finderArgs = new Object[] {
1458 companyId, classNameId,
1459
1460 start, end, orderByComparator
1461 };
1462 }
1463
1464 List<Website> list = (List<Website>)FinderCacheUtil.getResult(finderPath,
1465 finderArgs, this);
1466
1467 if ((list != null) && !list.isEmpty()) {
1468 for (Website website : list) {
1469 if ((companyId != website.getCompanyId()) ||
1470 (classNameId != website.getClassNameId())) {
1471 list = null;
1472
1473 break;
1474 }
1475 }
1476 }
1477
1478 if (list == null) {
1479 StringBundler query = null;
1480
1481 if (orderByComparator != null) {
1482 query = new StringBundler(4 +
1483 (orderByComparator.getOrderByFields().length * 3));
1484 }
1485 else {
1486 query = new StringBundler(4);
1487 }
1488
1489 query.append(_SQL_SELECT_WEBSITE_WHERE);
1490
1491 query.append(_FINDER_COLUMN_C_C_COMPANYID_2);
1492
1493 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
1494
1495 if (orderByComparator != null) {
1496 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1497 orderByComparator);
1498 }
1499
1500 else {
1501 query.append(WebsiteModelImpl.ORDER_BY_JPQL);
1502 }
1503
1504 String sql = query.toString();
1505
1506 Session session = null;
1507
1508 try {
1509 session = openSession();
1510
1511 Query q = session.createQuery(sql);
1512
1513 QueryPos qPos = QueryPos.getInstance(q);
1514
1515 qPos.add(companyId);
1516
1517 qPos.add(classNameId);
1518
1519 list = (List<Website>)QueryUtil.list(q, getDialect(), start, end);
1520 }
1521 catch (Exception e) {
1522 throw processException(e);
1523 }
1524 finally {
1525 if (list == null) {
1526 FinderCacheUtil.removeResult(finderPath, finderArgs);
1527 }
1528 else {
1529 cacheResult(list);
1530
1531 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1532 }
1533
1534 closeSession(session);
1535 }
1536 }
1537
1538 return list;
1539 }
1540
1541
1551 public Website findByC_C_First(long companyId, long classNameId,
1552 OrderByComparator orderByComparator)
1553 throws NoSuchWebsiteException, SystemException {
1554 Website website = fetchByC_C_First(companyId, classNameId,
1555 orderByComparator);
1556
1557 if (website != null) {
1558 return website;
1559 }
1560
1561 StringBundler msg = new StringBundler(6);
1562
1563 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1564
1565 msg.append("companyId=");
1566 msg.append(companyId);
1567
1568 msg.append(", classNameId=");
1569 msg.append(classNameId);
1570
1571 msg.append(StringPool.CLOSE_CURLY_BRACE);
1572
1573 throw new NoSuchWebsiteException(msg.toString());
1574 }
1575
1576
1585 public Website fetchByC_C_First(long companyId, long classNameId,
1586 OrderByComparator orderByComparator) throws SystemException {
1587 List<Website> list = findByC_C(companyId, classNameId, 0, 1,
1588 orderByComparator);
1589
1590 if (!list.isEmpty()) {
1591 return list.get(0);
1592 }
1593
1594 return null;
1595 }
1596
1597
1607 public Website findByC_C_Last(long companyId, long classNameId,
1608 OrderByComparator orderByComparator)
1609 throws NoSuchWebsiteException, SystemException {
1610 Website website = fetchByC_C_Last(companyId, classNameId,
1611 orderByComparator);
1612
1613 if (website != null) {
1614 return website;
1615 }
1616
1617 StringBundler msg = new StringBundler(6);
1618
1619 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1620
1621 msg.append("companyId=");
1622 msg.append(companyId);
1623
1624 msg.append(", classNameId=");
1625 msg.append(classNameId);
1626
1627 msg.append(StringPool.CLOSE_CURLY_BRACE);
1628
1629 throw new NoSuchWebsiteException(msg.toString());
1630 }
1631
1632
1641 public Website fetchByC_C_Last(long companyId, long classNameId,
1642 OrderByComparator orderByComparator) throws SystemException {
1643 int count = countByC_C(companyId, classNameId);
1644
1645 List<Website> list = findByC_C(companyId, classNameId, count - 1,
1646 count, orderByComparator);
1647
1648 if (!list.isEmpty()) {
1649 return list.get(0);
1650 }
1651
1652 return null;
1653 }
1654
1655
1666 public Website[] findByC_C_PrevAndNext(long websiteId, long companyId,
1667 long classNameId, OrderByComparator orderByComparator)
1668 throws NoSuchWebsiteException, SystemException {
1669 Website website = findByPrimaryKey(websiteId);
1670
1671 Session session = null;
1672
1673 try {
1674 session = openSession();
1675
1676 Website[] array = new WebsiteImpl[3];
1677
1678 array[0] = getByC_C_PrevAndNext(session, website, companyId,
1679 classNameId, orderByComparator, true);
1680
1681 array[1] = website;
1682
1683 array[2] = getByC_C_PrevAndNext(session, website, companyId,
1684 classNameId, orderByComparator, false);
1685
1686 return array;
1687 }
1688 catch (Exception e) {
1689 throw processException(e);
1690 }
1691 finally {
1692 closeSession(session);
1693 }
1694 }
1695
1696 protected Website getByC_C_PrevAndNext(Session session, Website website,
1697 long companyId, long classNameId, OrderByComparator orderByComparator,
1698 boolean previous) {
1699 StringBundler query = null;
1700
1701 if (orderByComparator != null) {
1702 query = new StringBundler(6 +
1703 (orderByComparator.getOrderByFields().length * 6));
1704 }
1705 else {
1706 query = new StringBundler(3);
1707 }
1708
1709 query.append(_SQL_SELECT_WEBSITE_WHERE);
1710
1711 query.append(_FINDER_COLUMN_C_C_COMPANYID_2);
1712
1713 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
1714
1715 if (orderByComparator != null) {
1716 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1717
1718 if (orderByConditionFields.length > 0) {
1719 query.append(WHERE_AND);
1720 }
1721
1722 for (int i = 0; i < orderByConditionFields.length; i++) {
1723 query.append(_ORDER_BY_ENTITY_ALIAS);
1724 query.append(orderByConditionFields[i]);
1725
1726 if ((i + 1) < orderByConditionFields.length) {
1727 if (orderByComparator.isAscending() ^ previous) {
1728 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1729 }
1730 else {
1731 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1732 }
1733 }
1734 else {
1735 if (orderByComparator.isAscending() ^ previous) {
1736 query.append(WHERE_GREATER_THAN);
1737 }
1738 else {
1739 query.append(WHERE_LESSER_THAN);
1740 }
1741 }
1742 }
1743
1744 query.append(ORDER_BY_CLAUSE);
1745
1746 String[] orderByFields = orderByComparator.getOrderByFields();
1747
1748 for (int i = 0; i < orderByFields.length; i++) {
1749 query.append(_ORDER_BY_ENTITY_ALIAS);
1750 query.append(orderByFields[i]);
1751
1752 if ((i + 1) < orderByFields.length) {
1753 if (orderByComparator.isAscending() ^ previous) {
1754 query.append(ORDER_BY_ASC_HAS_NEXT);
1755 }
1756 else {
1757 query.append(ORDER_BY_DESC_HAS_NEXT);
1758 }
1759 }
1760 else {
1761 if (orderByComparator.isAscending() ^ previous) {
1762 query.append(ORDER_BY_ASC);
1763 }
1764 else {
1765 query.append(ORDER_BY_DESC);
1766 }
1767 }
1768 }
1769 }
1770
1771 else {
1772 query.append(WebsiteModelImpl.ORDER_BY_JPQL);
1773 }
1774
1775 String sql = query.toString();
1776
1777 Query q = session.createQuery(sql);
1778
1779 q.setFirstResult(0);
1780 q.setMaxResults(2);
1781
1782 QueryPos qPos = QueryPos.getInstance(q);
1783
1784 qPos.add(companyId);
1785
1786 qPos.add(classNameId);
1787
1788 if (orderByComparator != null) {
1789 Object[] values = orderByComparator.getOrderByConditionValues(website);
1790
1791 for (Object value : values) {
1792 qPos.add(value);
1793 }
1794 }
1795
1796 List<Website> list = q.list();
1797
1798 if (list.size() == 2) {
1799 return list.get(1);
1800 }
1801 else {
1802 return null;
1803 }
1804 }
1805
1806
1815 public List<Website> findByC_C_C(long companyId, long classNameId,
1816 long classPK) throws SystemException {
1817 return findByC_C_C(companyId, classNameId, classPK, QueryUtil.ALL_POS,
1818 QueryUtil.ALL_POS, null);
1819 }
1820
1821
1836 public List<Website> findByC_C_C(long companyId, long classNameId,
1837 long classPK, int start, int end) throws SystemException {
1838 return findByC_C_C(companyId, classNameId, classPK, start, end, null);
1839 }
1840
1841
1857 public List<Website> findByC_C_C(long companyId, long classNameId,
1858 long classPK, int start, int end, OrderByComparator orderByComparator)
1859 throws SystemException {
1860 FinderPath finderPath = null;
1861 Object[] finderArgs = null;
1862
1863 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1864 (orderByComparator == null)) {
1865 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C;
1866 finderArgs = new Object[] { companyId, classNameId, classPK };
1867 }
1868 else {
1869 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C_C;
1870 finderArgs = new Object[] {
1871 companyId, classNameId, classPK,
1872
1873 start, end, orderByComparator
1874 };
1875 }
1876
1877 List<Website> list = (List<Website>)FinderCacheUtil.getResult(finderPath,
1878 finderArgs, this);
1879
1880 if ((list != null) && !list.isEmpty()) {
1881 for (Website website : list) {
1882 if ((companyId != website.getCompanyId()) ||
1883 (classNameId != website.getClassNameId()) ||
1884 (classPK != website.getClassPK())) {
1885 list = null;
1886
1887 break;
1888 }
1889 }
1890 }
1891
1892 if (list == null) {
1893 StringBundler query = null;
1894
1895 if (orderByComparator != null) {
1896 query = new StringBundler(5 +
1897 (orderByComparator.getOrderByFields().length * 3));
1898 }
1899 else {
1900 query = new StringBundler(5);
1901 }
1902
1903 query.append(_SQL_SELECT_WEBSITE_WHERE);
1904
1905 query.append(_FINDER_COLUMN_C_C_C_COMPANYID_2);
1906
1907 query.append(_FINDER_COLUMN_C_C_C_CLASSNAMEID_2);
1908
1909 query.append(_FINDER_COLUMN_C_C_C_CLASSPK_2);
1910
1911 if (orderByComparator != null) {
1912 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1913 orderByComparator);
1914 }
1915
1916 else {
1917 query.append(WebsiteModelImpl.ORDER_BY_JPQL);
1918 }
1919
1920 String sql = query.toString();
1921
1922 Session session = null;
1923
1924 try {
1925 session = openSession();
1926
1927 Query q = session.createQuery(sql);
1928
1929 QueryPos qPos = QueryPos.getInstance(q);
1930
1931 qPos.add(companyId);
1932
1933 qPos.add(classNameId);
1934
1935 qPos.add(classPK);
1936
1937 list = (List<Website>)QueryUtil.list(q, getDialect(), start, end);
1938 }
1939 catch (Exception e) {
1940 throw processException(e);
1941 }
1942 finally {
1943 if (list == null) {
1944 FinderCacheUtil.removeResult(finderPath, finderArgs);
1945 }
1946 else {
1947 cacheResult(list);
1948
1949 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1950 }
1951
1952 closeSession(session);
1953 }
1954 }
1955
1956 return list;
1957 }
1958
1959
1970 public Website findByC_C_C_First(long companyId, long classNameId,
1971 long classPK, OrderByComparator orderByComparator)
1972 throws NoSuchWebsiteException, SystemException {
1973 Website website = fetchByC_C_C_First(companyId, classNameId, classPK,
1974 orderByComparator);
1975
1976 if (website != null) {
1977 return website;
1978 }
1979
1980 StringBundler msg = new StringBundler(8);
1981
1982 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1983
1984 msg.append("companyId=");
1985 msg.append(companyId);
1986
1987 msg.append(", classNameId=");
1988 msg.append(classNameId);
1989
1990 msg.append(", classPK=");
1991 msg.append(classPK);
1992
1993 msg.append(StringPool.CLOSE_CURLY_BRACE);
1994
1995 throw new NoSuchWebsiteException(msg.toString());
1996 }
1997
1998
2008 public Website fetchByC_C_C_First(long companyId, long classNameId,
2009 long classPK, OrderByComparator orderByComparator)
2010 throws SystemException {
2011 List<Website> list = findByC_C_C(companyId, classNameId, classPK, 0, 1,
2012 orderByComparator);
2013
2014 if (!list.isEmpty()) {
2015 return list.get(0);
2016 }
2017
2018 return null;
2019 }
2020
2021
2032 public Website findByC_C_C_Last(long companyId, long classNameId,
2033 long classPK, OrderByComparator orderByComparator)
2034 throws NoSuchWebsiteException, SystemException {
2035 Website website = fetchByC_C_C_Last(companyId, classNameId, classPK,
2036 orderByComparator);
2037
2038 if (website != null) {
2039 return website;
2040 }
2041
2042 StringBundler msg = new StringBundler(8);
2043
2044 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2045
2046 msg.append("companyId=");
2047 msg.append(companyId);
2048
2049 msg.append(", classNameId=");
2050 msg.append(classNameId);
2051
2052 msg.append(", classPK=");
2053 msg.append(classPK);
2054
2055 msg.append(StringPool.CLOSE_CURLY_BRACE);
2056
2057 throw new NoSuchWebsiteException(msg.toString());
2058 }
2059
2060
2070 public Website fetchByC_C_C_Last(long companyId, long classNameId,
2071 long classPK, OrderByComparator orderByComparator)
2072 throws SystemException {
2073 int count = countByC_C_C(companyId, classNameId, classPK);
2074
2075 List<Website> list = findByC_C_C(companyId, classNameId, classPK,
2076 count - 1, count, orderByComparator);
2077
2078 if (!list.isEmpty()) {
2079 return list.get(0);
2080 }
2081
2082 return null;
2083 }
2084
2085
2097 public Website[] findByC_C_C_PrevAndNext(long websiteId, long companyId,
2098 long classNameId, long classPK, OrderByComparator orderByComparator)
2099 throws NoSuchWebsiteException, SystemException {
2100 Website website = findByPrimaryKey(websiteId);
2101
2102 Session session = null;
2103
2104 try {
2105 session = openSession();
2106
2107 Website[] array = new WebsiteImpl[3];
2108
2109 array[0] = getByC_C_C_PrevAndNext(session, website, companyId,
2110 classNameId, classPK, orderByComparator, true);
2111
2112 array[1] = website;
2113
2114 array[2] = getByC_C_C_PrevAndNext(session, website, companyId,
2115 classNameId, classPK, orderByComparator, false);
2116
2117 return array;
2118 }
2119 catch (Exception e) {
2120 throw processException(e);
2121 }
2122 finally {
2123 closeSession(session);
2124 }
2125 }
2126
2127 protected Website getByC_C_C_PrevAndNext(Session session, Website website,
2128 long companyId, long classNameId, long classPK,
2129 OrderByComparator orderByComparator, boolean previous) {
2130 StringBundler query = null;
2131
2132 if (orderByComparator != null) {
2133 query = new StringBundler(6 +
2134 (orderByComparator.getOrderByFields().length * 6));
2135 }
2136 else {
2137 query = new StringBundler(3);
2138 }
2139
2140 query.append(_SQL_SELECT_WEBSITE_WHERE);
2141
2142 query.append(_FINDER_COLUMN_C_C_C_COMPANYID_2);
2143
2144 query.append(_FINDER_COLUMN_C_C_C_CLASSNAMEID_2);
2145
2146 query.append(_FINDER_COLUMN_C_C_C_CLASSPK_2);
2147
2148 if (orderByComparator != null) {
2149 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2150
2151 if (orderByConditionFields.length > 0) {
2152 query.append(WHERE_AND);
2153 }
2154
2155 for (int i = 0; i < orderByConditionFields.length; i++) {
2156 query.append(_ORDER_BY_ENTITY_ALIAS);
2157 query.append(orderByConditionFields[i]);
2158
2159 if ((i + 1) < orderByConditionFields.length) {
2160 if (orderByComparator.isAscending() ^ previous) {
2161 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2162 }
2163 else {
2164 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2165 }
2166 }
2167 else {
2168 if (orderByComparator.isAscending() ^ previous) {
2169 query.append(WHERE_GREATER_THAN);
2170 }
2171 else {
2172 query.append(WHERE_LESSER_THAN);
2173 }
2174 }
2175 }
2176
2177 query.append(ORDER_BY_CLAUSE);
2178
2179 String[] orderByFields = orderByComparator.getOrderByFields();
2180
2181 for (int i = 0; i < orderByFields.length; i++) {
2182 query.append(_ORDER_BY_ENTITY_ALIAS);
2183 query.append(orderByFields[i]);
2184
2185 if ((i + 1) < orderByFields.length) {
2186 if (orderByComparator.isAscending() ^ previous) {
2187 query.append(ORDER_BY_ASC_HAS_NEXT);
2188 }
2189 else {
2190 query.append(ORDER_BY_DESC_HAS_NEXT);
2191 }
2192 }
2193 else {
2194 if (orderByComparator.isAscending() ^ previous) {
2195 query.append(ORDER_BY_ASC);
2196 }
2197 else {
2198 query.append(ORDER_BY_DESC);
2199 }
2200 }
2201 }
2202 }
2203
2204 else {
2205 query.append(WebsiteModelImpl.ORDER_BY_JPQL);
2206 }
2207
2208 String sql = query.toString();
2209
2210 Query q = session.createQuery(sql);
2211
2212 q.setFirstResult(0);
2213 q.setMaxResults(2);
2214
2215 QueryPos qPos = QueryPos.getInstance(q);
2216
2217 qPos.add(companyId);
2218
2219 qPos.add(classNameId);
2220
2221 qPos.add(classPK);
2222
2223 if (orderByComparator != null) {
2224 Object[] values = orderByComparator.getOrderByConditionValues(website);
2225
2226 for (Object value : values) {
2227 qPos.add(value);
2228 }
2229 }
2230
2231 List<Website> list = q.list();
2232
2233 if (list.size() == 2) {
2234 return list.get(1);
2235 }
2236 else {
2237 return null;
2238 }
2239 }
2240
2241
2251 public List<Website> findByC_C_C_P(long companyId, long classNameId,
2252 long classPK, boolean primary) throws SystemException {
2253 return findByC_C_C_P(companyId, classNameId, classPK, primary,
2254 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2255 }
2256
2257
2273 public List<Website> findByC_C_C_P(long companyId, long classNameId,
2274 long classPK, boolean primary, int start, int end)
2275 throws SystemException {
2276 return findByC_C_C_P(companyId, classNameId, classPK, primary, start,
2277 end, null);
2278 }
2279
2280
2297 public List<Website> findByC_C_C_P(long companyId, long classNameId,
2298 long classPK, boolean primary, int start, int end,
2299 OrderByComparator orderByComparator) throws SystemException {
2300 FinderPath finderPath = null;
2301 Object[] finderArgs = null;
2302
2303 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2304 (orderByComparator == null)) {
2305 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C_P;
2306 finderArgs = new Object[] { companyId, classNameId, classPK, primary };
2307 }
2308 else {
2309 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C_C_P;
2310 finderArgs = new Object[] {
2311 companyId, classNameId, classPK, primary,
2312
2313 start, end, orderByComparator
2314 };
2315 }
2316
2317 List<Website> list = (List<Website>)FinderCacheUtil.getResult(finderPath,
2318 finderArgs, this);
2319
2320 if ((list != null) && !list.isEmpty()) {
2321 for (Website website : list) {
2322 if ((companyId != website.getCompanyId()) ||
2323 (classNameId != website.getClassNameId()) ||
2324 (classPK != website.getClassPK()) ||
2325 (primary != website.getPrimary())) {
2326 list = null;
2327
2328 break;
2329 }
2330 }
2331 }
2332
2333 if (list == null) {
2334 StringBundler query = null;
2335
2336 if (orderByComparator != null) {
2337 query = new StringBundler(6 +
2338 (orderByComparator.getOrderByFields().length * 3));
2339 }
2340 else {
2341 query = new StringBundler(6);
2342 }
2343
2344 query.append(_SQL_SELECT_WEBSITE_WHERE);
2345
2346 query.append(_FINDER_COLUMN_C_C_C_P_COMPANYID_2);
2347
2348 query.append(_FINDER_COLUMN_C_C_C_P_CLASSNAMEID_2);
2349
2350 query.append(_FINDER_COLUMN_C_C_C_P_CLASSPK_2);
2351
2352 query.append(_FINDER_COLUMN_C_C_C_P_PRIMARY_2);
2353
2354 if (orderByComparator != null) {
2355 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2356 orderByComparator);
2357 }
2358
2359 else {
2360 query.append(WebsiteModelImpl.ORDER_BY_JPQL);
2361 }
2362
2363 String sql = query.toString();
2364
2365 Session session = null;
2366
2367 try {
2368 session = openSession();
2369
2370 Query q = session.createQuery(sql);
2371
2372 QueryPos qPos = QueryPos.getInstance(q);
2373
2374 qPos.add(companyId);
2375
2376 qPos.add(classNameId);
2377
2378 qPos.add(classPK);
2379
2380 qPos.add(primary);
2381
2382 list = (List<Website>)QueryUtil.list(q, getDialect(), start, end);
2383 }
2384 catch (Exception e) {
2385 throw processException(e);
2386 }
2387 finally {
2388 if (list == null) {
2389 FinderCacheUtil.removeResult(finderPath, finderArgs);
2390 }
2391 else {
2392 cacheResult(list);
2393
2394 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2395 }
2396
2397 closeSession(session);
2398 }
2399 }
2400
2401 return list;
2402 }
2403
2404
2416 public Website findByC_C_C_P_First(long companyId, long classNameId,
2417 long classPK, boolean primary, OrderByComparator orderByComparator)
2418 throws NoSuchWebsiteException, SystemException {
2419 Website website = fetchByC_C_C_P_First(companyId, classNameId, classPK,
2420 primary, orderByComparator);
2421
2422 if (website != null) {
2423 return website;
2424 }
2425
2426 StringBundler msg = new StringBundler(10);
2427
2428 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2429
2430 msg.append("companyId=");
2431 msg.append(companyId);
2432
2433 msg.append(", classNameId=");
2434 msg.append(classNameId);
2435
2436 msg.append(", classPK=");
2437 msg.append(classPK);
2438
2439 msg.append(", primary=");
2440 msg.append(primary);
2441
2442 msg.append(StringPool.CLOSE_CURLY_BRACE);
2443
2444 throw new NoSuchWebsiteException(msg.toString());
2445 }
2446
2447
2458 public Website fetchByC_C_C_P_First(long companyId, long classNameId,
2459 long classPK, boolean primary, OrderByComparator orderByComparator)
2460 throws SystemException {
2461 List<Website> list = findByC_C_C_P(companyId, classNameId, classPK,
2462 primary, 0, 1, orderByComparator);
2463
2464 if (!list.isEmpty()) {
2465 return list.get(0);
2466 }
2467
2468 return null;
2469 }
2470
2471
2483 public Website findByC_C_C_P_Last(long companyId, long classNameId,
2484 long classPK, boolean primary, OrderByComparator orderByComparator)
2485 throws NoSuchWebsiteException, SystemException {
2486 Website website = fetchByC_C_C_P_Last(companyId, classNameId, classPK,
2487 primary, orderByComparator);
2488
2489 if (website != null) {
2490 return website;
2491 }
2492
2493 StringBundler msg = new StringBundler(10);
2494
2495 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2496
2497 msg.append("companyId=");
2498 msg.append(companyId);
2499
2500 msg.append(", classNameId=");
2501 msg.append(classNameId);
2502
2503 msg.append(", classPK=");
2504 msg.append(classPK);
2505
2506 msg.append(", primary=");
2507 msg.append(primary);
2508
2509 msg.append(StringPool.CLOSE_CURLY_BRACE);
2510
2511 throw new NoSuchWebsiteException(msg.toString());
2512 }
2513
2514
2525 public Website fetchByC_C_C_P_Last(long companyId, long classNameId,
2526 long classPK, boolean primary, OrderByComparator orderByComparator)
2527 throws SystemException {
2528 int count = countByC_C_C_P(companyId, classNameId, classPK, primary);
2529
2530 List<Website> list = findByC_C_C_P(companyId, classNameId, classPK,
2531 primary, count - 1, count, orderByComparator);
2532
2533 if (!list.isEmpty()) {
2534 return list.get(0);
2535 }
2536
2537 return null;
2538 }
2539
2540
2553 public Website[] findByC_C_C_P_PrevAndNext(long websiteId, long companyId,
2554 long classNameId, long classPK, boolean primary,
2555 OrderByComparator orderByComparator)
2556 throws NoSuchWebsiteException, SystemException {
2557 Website website = findByPrimaryKey(websiteId);
2558
2559 Session session = null;
2560
2561 try {
2562 session = openSession();
2563
2564 Website[] array = new WebsiteImpl[3];
2565
2566 array[0] = getByC_C_C_P_PrevAndNext(session, website, companyId,
2567 classNameId, classPK, primary, orderByComparator, true);
2568
2569 array[1] = website;
2570
2571 array[2] = getByC_C_C_P_PrevAndNext(session, website, companyId,
2572 classNameId, classPK, primary, orderByComparator, false);
2573
2574 return array;
2575 }
2576 catch (Exception e) {
2577 throw processException(e);
2578 }
2579 finally {
2580 closeSession(session);
2581 }
2582 }
2583
2584 protected Website getByC_C_C_P_PrevAndNext(Session session,
2585 Website website, long companyId, long classNameId, long classPK,
2586 boolean primary, OrderByComparator orderByComparator, boolean previous) {
2587 StringBundler query = null;
2588
2589 if (orderByComparator != null) {
2590 query = new StringBundler(6 +
2591 (orderByComparator.getOrderByFields().length * 6));
2592 }
2593 else {
2594 query = new StringBundler(3);
2595 }
2596
2597 query.append(_SQL_SELECT_WEBSITE_WHERE);
2598
2599 query.append(_FINDER_COLUMN_C_C_C_P_COMPANYID_2);
2600
2601 query.append(_FINDER_COLUMN_C_C_C_P_CLASSNAMEID_2);
2602
2603 query.append(_FINDER_COLUMN_C_C_C_P_CLASSPK_2);
2604
2605 query.append(_FINDER_COLUMN_C_C_C_P_PRIMARY_2);
2606
2607 if (orderByComparator != null) {
2608 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2609
2610 if (orderByConditionFields.length > 0) {
2611 query.append(WHERE_AND);
2612 }
2613
2614 for (int i = 0; i < orderByConditionFields.length; i++) {
2615 query.append(_ORDER_BY_ENTITY_ALIAS);
2616 query.append(orderByConditionFields[i]);
2617
2618 if ((i + 1) < orderByConditionFields.length) {
2619 if (orderByComparator.isAscending() ^ previous) {
2620 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2621 }
2622 else {
2623 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2624 }
2625 }
2626 else {
2627 if (orderByComparator.isAscending() ^ previous) {
2628 query.append(WHERE_GREATER_THAN);
2629 }
2630 else {
2631 query.append(WHERE_LESSER_THAN);
2632 }
2633 }
2634 }
2635
2636 query.append(ORDER_BY_CLAUSE);
2637
2638 String[] orderByFields = orderByComparator.getOrderByFields();
2639
2640 for (int i = 0; i < orderByFields.length; i++) {
2641 query.append(_ORDER_BY_ENTITY_ALIAS);
2642 query.append(orderByFields[i]);
2643
2644 if ((i + 1) < orderByFields.length) {
2645 if (orderByComparator.isAscending() ^ previous) {
2646 query.append(ORDER_BY_ASC_HAS_NEXT);
2647 }
2648 else {
2649 query.append(ORDER_BY_DESC_HAS_NEXT);
2650 }
2651 }
2652 else {
2653 if (orderByComparator.isAscending() ^ previous) {
2654 query.append(ORDER_BY_ASC);
2655 }
2656 else {
2657 query.append(ORDER_BY_DESC);
2658 }
2659 }
2660 }
2661 }
2662
2663 else {
2664 query.append(WebsiteModelImpl.ORDER_BY_JPQL);
2665 }
2666
2667 String sql = query.toString();
2668
2669 Query q = session.createQuery(sql);
2670
2671 q.setFirstResult(0);
2672 q.setMaxResults(2);
2673
2674 QueryPos qPos = QueryPos.getInstance(q);
2675
2676 qPos.add(companyId);
2677
2678 qPos.add(classNameId);
2679
2680 qPos.add(classPK);
2681
2682 qPos.add(primary);
2683
2684 if (orderByComparator != null) {
2685 Object[] values = orderByComparator.getOrderByConditionValues(website);
2686
2687 for (Object value : values) {
2688 qPos.add(value);
2689 }
2690 }
2691
2692 List<Website> list = q.list();
2693
2694 if (list.size() == 2) {
2695 return list.get(1);
2696 }
2697 else {
2698 return null;
2699 }
2700 }
2701
2702
2708 public List<Website> findAll() throws SystemException {
2709 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2710 }
2711
2712
2724 public List<Website> findAll(int start, int end) throws SystemException {
2725 return findAll(start, end, null);
2726 }
2727
2728
2741 public List<Website> findAll(int start, int end,
2742 OrderByComparator orderByComparator) throws SystemException {
2743 FinderPath finderPath = null;
2744 Object[] finderArgs = new Object[] { start, end, orderByComparator };
2745
2746 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2747 (orderByComparator == null)) {
2748 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
2749 finderArgs = FINDER_ARGS_EMPTY;
2750 }
2751 else {
2752 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
2753 finderArgs = new Object[] { start, end, orderByComparator };
2754 }
2755
2756 List<Website> list = (List<Website>)FinderCacheUtil.getResult(finderPath,
2757 finderArgs, this);
2758
2759 if (list == null) {
2760 StringBundler query = null;
2761 String sql = null;
2762
2763 if (orderByComparator != null) {
2764 query = new StringBundler(2 +
2765 (orderByComparator.getOrderByFields().length * 3));
2766
2767 query.append(_SQL_SELECT_WEBSITE);
2768
2769 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2770 orderByComparator);
2771
2772 sql = query.toString();
2773 }
2774 else {
2775 sql = _SQL_SELECT_WEBSITE.concat(WebsiteModelImpl.ORDER_BY_JPQL);
2776 }
2777
2778 Session session = null;
2779
2780 try {
2781 session = openSession();
2782
2783 Query q = session.createQuery(sql);
2784
2785 if (orderByComparator == null) {
2786 list = (List<Website>)QueryUtil.list(q, getDialect(),
2787 start, end, false);
2788
2789 Collections.sort(list);
2790 }
2791 else {
2792 list = (List<Website>)QueryUtil.list(q, getDialect(),
2793 start, end);
2794 }
2795 }
2796 catch (Exception e) {
2797 throw processException(e);
2798 }
2799 finally {
2800 if (list == null) {
2801 FinderCacheUtil.removeResult(finderPath, finderArgs);
2802 }
2803 else {
2804 cacheResult(list);
2805
2806 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2807 }
2808
2809 closeSession(session);
2810 }
2811 }
2812
2813 return list;
2814 }
2815
2816
2822 public void removeByCompanyId(long companyId) throws SystemException {
2823 for (Website website : findByCompanyId(companyId)) {
2824 remove(website);
2825 }
2826 }
2827
2828
2834 public void removeByUserId(long userId) throws SystemException {
2835 for (Website website : findByUserId(userId)) {
2836 remove(website);
2837 }
2838 }
2839
2840
2847 public void removeByC_C(long companyId, long classNameId)
2848 throws SystemException {
2849 for (Website website : findByC_C(companyId, classNameId)) {
2850 remove(website);
2851 }
2852 }
2853
2854
2862 public void removeByC_C_C(long companyId, long classNameId, long classPK)
2863 throws SystemException {
2864 for (Website website : findByC_C_C(companyId, classNameId, classPK)) {
2865 remove(website);
2866 }
2867 }
2868
2869
2878 public void removeByC_C_C_P(long companyId, long classNameId, long classPK,
2879 boolean primary) throws SystemException {
2880 for (Website website : findByC_C_C_P(companyId, classNameId, classPK,
2881 primary)) {
2882 remove(website);
2883 }
2884 }
2885
2886
2891 public void removeAll() throws SystemException {
2892 for (Website website : findAll()) {
2893 remove(website);
2894 }
2895 }
2896
2897
2904 public int countByCompanyId(long companyId) throws SystemException {
2905 Object[] finderArgs = new Object[] { companyId };
2906
2907 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
2908 finderArgs, this);
2909
2910 if (count == null) {
2911 StringBundler query = new StringBundler(2);
2912
2913 query.append(_SQL_COUNT_WEBSITE_WHERE);
2914
2915 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
2916
2917 String sql = query.toString();
2918
2919 Session session = null;
2920
2921 try {
2922 session = openSession();
2923
2924 Query q = session.createQuery(sql);
2925
2926 QueryPos qPos = QueryPos.getInstance(q);
2927
2928 qPos.add(companyId);
2929
2930 count = (Long)q.uniqueResult();
2931 }
2932 catch (Exception e) {
2933 throw processException(e);
2934 }
2935 finally {
2936 if (count == null) {
2937 count = Long.valueOf(0);
2938 }
2939
2940 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
2941 finderArgs, count);
2942
2943 closeSession(session);
2944 }
2945 }
2946
2947 return count.intValue();
2948 }
2949
2950
2957 public int countByUserId(long userId) throws SystemException {
2958 Object[] finderArgs = new Object[] { userId };
2959
2960 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERID,
2961 finderArgs, this);
2962
2963 if (count == null) {
2964 StringBundler query = new StringBundler(2);
2965
2966 query.append(_SQL_COUNT_WEBSITE_WHERE);
2967
2968 query.append(_FINDER_COLUMN_USERID_USERID_2);
2969
2970 String sql = query.toString();
2971
2972 Session session = null;
2973
2974 try {
2975 session = openSession();
2976
2977 Query q = session.createQuery(sql);
2978
2979 QueryPos qPos = QueryPos.getInstance(q);
2980
2981 qPos.add(userId);
2982
2983 count = (Long)q.uniqueResult();
2984 }
2985 catch (Exception e) {
2986 throw processException(e);
2987 }
2988 finally {
2989 if (count == null) {
2990 count = Long.valueOf(0);
2991 }
2992
2993 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERID,
2994 finderArgs, count);
2995
2996 closeSession(session);
2997 }
2998 }
2999
3000 return count.intValue();
3001 }
3002
3003
3011 public int countByC_C(long companyId, long classNameId)
3012 throws SystemException {
3013 Object[] finderArgs = new Object[] { companyId, classNameId };
3014
3015 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C,
3016 finderArgs, this);
3017
3018 if (count == null) {
3019 StringBundler query = new StringBundler(3);
3020
3021 query.append(_SQL_COUNT_WEBSITE_WHERE);
3022
3023 query.append(_FINDER_COLUMN_C_C_COMPANYID_2);
3024
3025 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
3026
3027 String sql = query.toString();
3028
3029 Session session = null;
3030
3031 try {
3032 session = openSession();
3033
3034 Query q = session.createQuery(sql);
3035
3036 QueryPos qPos = QueryPos.getInstance(q);
3037
3038 qPos.add(companyId);
3039
3040 qPos.add(classNameId);
3041
3042 count = (Long)q.uniqueResult();
3043 }
3044 catch (Exception e) {
3045 throw processException(e);
3046 }
3047 finally {
3048 if (count == null) {
3049 count = Long.valueOf(0);
3050 }
3051
3052 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, finderArgs,
3053 count);
3054
3055 closeSession(session);
3056 }
3057 }
3058
3059 return count.intValue();
3060 }
3061
3062
3071 public int countByC_C_C(long companyId, long classNameId, long classPK)
3072 throws SystemException {
3073 Object[] finderArgs = new Object[] { companyId, classNameId, classPK };
3074
3075 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C_C,
3076 finderArgs, this);
3077
3078 if (count == null) {
3079 StringBundler query = new StringBundler(4);
3080
3081 query.append(_SQL_COUNT_WEBSITE_WHERE);
3082
3083 query.append(_FINDER_COLUMN_C_C_C_COMPANYID_2);
3084
3085 query.append(_FINDER_COLUMN_C_C_C_CLASSNAMEID_2);
3086
3087 query.append(_FINDER_COLUMN_C_C_C_CLASSPK_2);
3088
3089 String sql = query.toString();
3090
3091 Session session = null;
3092
3093 try {
3094 session = openSession();
3095
3096 Query q = session.createQuery(sql);
3097
3098 QueryPos qPos = QueryPos.getInstance(q);
3099
3100 qPos.add(companyId);
3101
3102 qPos.add(classNameId);
3103
3104 qPos.add(classPK);
3105
3106 count = (Long)q.uniqueResult();
3107 }
3108 catch (Exception e) {
3109 throw processException(e);
3110 }
3111 finally {
3112 if (count == null) {
3113 count = Long.valueOf(0);
3114 }
3115
3116 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C_C,
3117 finderArgs, count);
3118
3119 closeSession(session);
3120 }
3121 }
3122
3123 return count.intValue();
3124 }
3125
3126
3136 public int countByC_C_C_P(long companyId, long classNameId, long classPK,
3137 boolean primary) throws SystemException {
3138 Object[] finderArgs = new Object[] {
3139 companyId, classNameId, classPK, primary
3140 };
3141
3142 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C_C_P,
3143 finderArgs, this);
3144
3145 if (count == null) {
3146 StringBundler query = new StringBundler(5);
3147
3148 query.append(_SQL_COUNT_WEBSITE_WHERE);
3149
3150 query.append(_FINDER_COLUMN_C_C_C_P_COMPANYID_2);
3151
3152 query.append(_FINDER_COLUMN_C_C_C_P_CLASSNAMEID_2);
3153
3154 query.append(_FINDER_COLUMN_C_C_C_P_CLASSPK_2);
3155
3156 query.append(_FINDER_COLUMN_C_C_C_P_PRIMARY_2);
3157
3158 String sql = query.toString();
3159
3160 Session session = null;
3161
3162 try {
3163 session = openSession();
3164
3165 Query q = session.createQuery(sql);
3166
3167 QueryPos qPos = QueryPos.getInstance(q);
3168
3169 qPos.add(companyId);
3170
3171 qPos.add(classNameId);
3172
3173 qPos.add(classPK);
3174
3175 qPos.add(primary);
3176
3177 count = (Long)q.uniqueResult();
3178 }
3179 catch (Exception e) {
3180 throw processException(e);
3181 }
3182 finally {
3183 if (count == null) {
3184 count = Long.valueOf(0);
3185 }
3186
3187 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C_C_P,
3188 finderArgs, count);
3189
3190 closeSession(session);
3191 }
3192 }
3193
3194 return count.intValue();
3195 }
3196
3197
3203 public int countAll() throws SystemException {
3204 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3205 FINDER_ARGS_EMPTY, this);
3206
3207 if (count == null) {
3208 Session session = null;
3209
3210 try {
3211 session = openSession();
3212
3213 Query q = session.createQuery(_SQL_COUNT_WEBSITE);
3214
3215 count = (Long)q.uniqueResult();
3216 }
3217 catch (Exception e) {
3218 throw processException(e);
3219 }
3220 finally {
3221 if (count == null) {
3222 count = Long.valueOf(0);
3223 }
3224
3225 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
3226 FINDER_ARGS_EMPTY, count);
3227
3228 closeSession(session);
3229 }
3230 }
3231
3232 return count.intValue();
3233 }
3234
3235
3238 public void afterPropertiesSet() {
3239 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3240 com.liferay.portal.util.PropsUtil.get(
3241 "value.object.listener.com.liferay.portal.model.Website")));
3242
3243 if (listenerClassNames.length > 0) {
3244 try {
3245 List<ModelListener<Website>> listenersList = new ArrayList<ModelListener<Website>>();
3246
3247 for (String listenerClassName : listenerClassNames) {
3248 listenersList.add((ModelListener<Website>)InstanceFactory.newInstance(
3249 listenerClassName));
3250 }
3251
3252 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3253 }
3254 catch (Exception e) {
3255 _log.error(e);
3256 }
3257 }
3258 }
3259
3260 public void destroy() {
3261 EntityCacheUtil.removeCache(WebsiteImpl.class.getName());
3262 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
3263 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
3264 }
3265
3266 @BeanReference(type = AccountPersistence.class)
3267 protected AccountPersistence accountPersistence;
3268 @BeanReference(type = AddressPersistence.class)
3269 protected AddressPersistence addressPersistence;
3270 @BeanReference(type = BrowserTrackerPersistence.class)
3271 protected BrowserTrackerPersistence browserTrackerPersistence;
3272 @BeanReference(type = ClassNamePersistence.class)
3273 protected ClassNamePersistence classNamePersistence;
3274 @BeanReference(type = ClusterGroupPersistence.class)
3275 protected ClusterGroupPersistence clusterGroupPersistence;
3276 @BeanReference(type = CompanyPersistence.class)
3277 protected CompanyPersistence companyPersistence;
3278 @BeanReference(type = ContactPersistence.class)
3279 protected ContactPersistence contactPersistence;
3280 @BeanReference(type = CountryPersistence.class)
3281 protected CountryPersistence countryPersistence;
3282 @BeanReference(type = EmailAddressPersistence.class)
3283 protected EmailAddressPersistence emailAddressPersistence;
3284 @BeanReference(type = GroupPersistence.class)
3285 protected GroupPersistence groupPersistence;
3286 @BeanReference(type = ImagePersistence.class)
3287 protected ImagePersistence imagePersistence;
3288 @BeanReference(type = LayoutPersistence.class)
3289 protected LayoutPersistence layoutPersistence;
3290 @BeanReference(type = LayoutBranchPersistence.class)
3291 protected LayoutBranchPersistence layoutBranchPersistence;
3292 @BeanReference(type = LayoutPrototypePersistence.class)
3293 protected LayoutPrototypePersistence layoutPrototypePersistence;
3294 @BeanReference(type = LayoutRevisionPersistence.class)
3295 protected LayoutRevisionPersistence layoutRevisionPersistence;
3296 @BeanReference(type = LayoutSetPersistence.class)
3297 protected LayoutSetPersistence layoutSetPersistence;
3298 @BeanReference(type = LayoutSetBranchPersistence.class)
3299 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
3300 @BeanReference(type = LayoutSetPrototypePersistence.class)
3301 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
3302 @BeanReference(type = ListTypePersistence.class)
3303 protected ListTypePersistence listTypePersistence;
3304 @BeanReference(type = LockPersistence.class)
3305 protected LockPersistence lockPersistence;
3306 @BeanReference(type = MembershipRequestPersistence.class)
3307 protected MembershipRequestPersistence membershipRequestPersistence;
3308 @BeanReference(type = OrganizationPersistence.class)
3309 protected OrganizationPersistence organizationPersistence;
3310 @BeanReference(type = OrgGroupRolePersistence.class)
3311 protected OrgGroupRolePersistence orgGroupRolePersistence;
3312 @BeanReference(type = OrgLaborPersistence.class)
3313 protected OrgLaborPersistence orgLaborPersistence;
3314 @BeanReference(type = PasswordPolicyPersistence.class)
3315 protected PasswordPolicyPersistence passwordPolicyPersistence;
3316 @BeanReference(type = PasswordPolicyRelPersistence.class)
3317 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
3318 @BeanReference(type = PasswordTrackerPersistence.class)
3319 protected PasswordTrackerPersistence passwordTrackerPersistence;
3320 @BeanReference(type = PhonePersistence.class)
3321 protected PhonePersistence phonePersistence;
3322 @BeanReference(type = PluginSettingPersistence.class)
3323 protected PluginSettingPersistence pluginSettingPersistence;
3324 @BeanReference(type = PortalPreferencesPersistence.class)
3325 protected PortalPreferencesPersistence portalPreferencesPersistence;
3326 @BeanReference(type = PortletPersistence.class)
3327 protected PortletPersistence portletPersistence;
3328 @BeanReference(type = PortletItemPersistence.class)
3329 protected PortletItemPersistence portletItemPersistence;
3330 @BeanReference(type = PortletPreferencesPersistence.class)
3331 protected PortletPreferencesPersistence portletPreferencesPersistence;
3332 @BeanReference(type = RegionPersistence.class)
3333 protected RegionPersistence regionPersistence;
3334 @BeanReference(type = ReleasePersistence.class)
3335 protected ReleasePersistence releasePersistence;
3336 @BeanReference(type = RepositoryPersistence.class)
3337 protected RepositoryPersistence repositoryPersistence;
3338 @BeanReference(type = RepositoryEntryPersistence.class)
3339 protected RepositoryEntryPersistence repositoryEntryPersistence;
3340 @BeanReference(type = ResourceActionPersistence.class)
3341 protected ResourceActionPersistence resourceActionPersistence;
3342 @BeanReference(type = ResourceBlockPersistence.class)
3343 protected ResourceBlockPersistence resourceBlockPersistence;
3344 @BeanReference(type = ResourceBlockPermissionPersistence.class)
3345 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
3346 @BeanReference(type = ResourcePermissionPersistence.class)
3347 protected ResourcePermissionPersistence resourcePermissionPersistence;
3348 @BeanReference(type = ResourceTypePermissionPersistence.class)
3349 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
3350 @BeanReference(type = RolePersistence.class)
3351 protected RolePersistence rolePersistence;
3352 @BeanReference(type = ServiceComponentPersistence.class)
3353 protected ServiceComponentPersistence serviceComponentPersistence;
3354 @BeanReference(type = ShardPersistence.class)
3355 protected ShardPersistence shardPersistence;
3356 @BeanReference(type = SubscriptionPersistence.class)
3357 protected SubscriptionPersistence subscriptionPersistence;
3358 @BeanReference(type = TeamPersistence.class)
3359 protected TeamPersistence teamPersistence;
3360 @BeanReference(type = TicketPersistence.class)
3361 protected TicketPersistence ticketPersistence;
3362 @BeanReference(type = UserPersistence.class)
3363 protected UserPersistence userPersistence;
3364 @BeanReference(type = UserGroupPersistence.class)
3365 protected UserGroupPersistence userGroupPersistence;
3366 @BeanReference(type = UserGroupGroupRolePersistence.class)
3367 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
3368 @BeanReference(type = UserGroupRolePersistence.class)
3369 protected UserGroupRolePersistence userGroupRolePersistence;
3370 @BeanReference(type = UserIdMapperPersistence.class)
3371 protected UserIdMapperPersistence userIdMapperPersistence;
3372 @BeanReference(type = UserNotificationEventPersistence.class)
3373 protected UserNotificationEventPersistence userNotificationEventPersistence;
3374 @BeanReference(type = UserTrackerPersistence.class)
3375 protected UserTrackerPersistence userTrackerPersistence;
3376 @BeanReference(type = UserTrackerPathPersistence.class)
3377 protected UserTrackerPathPersistence userTrackerPathPersistence;
3378 @BeanReference(type = VirtualHostPersistence.class)
3379 protected VirtualHostPersistence virtualHostPersistence;
3380 @BeanReference(type = WebDAVPropsPersistence.class)
3381 protected WebDAVPropsPersistence webDAVPropsPersistence;
3382 @BeanReference(type = WebsitePersistence.class)
3383 protected WebsitePersistence websitePersistence;
3384 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
3385 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
3386 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
3387 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
3388 private static final String _SQL_SELECT_WEBSITE = "SELECT website FROM Website website";
3389 private static final String _SQL_SELECT_WEBSITE_WHERE = "SELECT website FROM Website website WHERE ";
3390 private static final String _SQL_COUNT_WEBSITE = "SELECT COUNT(website) FROM Website website";
3391 private static final String _SQL_COUNT_WEBSITE_WHERE = "SELECT COUNT(website) FROM Website website WHERE ";
3392 private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "website.companyId = ?";
3393 private static final String _FINDER_COLUMN_USERID_USERID_2 = "website.userId = ?";
3394 private static final String _FINDER_COLUMN_C_C_COMPANYID_2 = "website.companyId = ? AND ";
3395 private static final String _FINDER_COLUMN_C_C_CLASSNAMEID_2 = "website.classNameId = ?";
3396 private static final String _FINDER_COLUMN_C_C_C_COMPANYID_2 = "website.companyId = ? AND ";
3397 private static final String _FINDER_COLUMN_C_C_C_CLASSNAMEID_2 = "website.classNameId = ? AND ";
3398 private static final String _FINDER_COLUMN_C_C_C_CLASSPK_2 = "website.classPK = ?";
3399 private static final String _FINDER_COLUMN_C_C_C_P_COMPANYID_2 = "website.companyId = ? AND ";
3400 private static final String _FINDER_COLUMN_C_C_C_P_CLASSNAMEID_2 = "website.classNameId = ? AND ";
3401 private static final String _FINDER_COLUMN_C_C_C_P_CLASSPK_2 = "website.classPK = ? AND ";
3402 private static final String _FINDER_COLUMN_C_C_C_P_PRIMARY_2 = "website.primary = ?";
3403 private static final String _ORDER_BY_ENTITY_ALIAS = "website.";
3404 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Website exists with the primary key ";
3405 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Website exists with the key {";
3406 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
3407 private static Log _log = LogFactoryUtil.getLog(WebsitePersistenceImpl.class);
3408 private static Website _nullWebsite = new WebsiteImpl() {
3409 @Override
3410 public Object clone() {
3411 return this;
3412 }
3413
3414 @Override
3415 public CacheModel<Website> toCacheModel() {
3416 return _nullWebsiteCacheModel;
3417 }
3418 };
3419
3420 private static CacheModel<Website> _nullWebsiteCacheModel = new CacheModel<Website>() {
3421 public Website toEntityModel() {
3422 return _nullWebsite;
3423 }
3424 };
3425 }