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