001
014
015 package com.liferay.portal.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.NoSuchPhoneException;
019 import com.liferay.portal.kernel.annotation.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.ModelListener;
038 import com.liferay.portal.model.Phone;
039 import com.liferay.portal.model.impl.PhoneImpl;
040 import com.liferay.portal.model.impl.PhoneModelImpl;
041 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
042
043 import java.io.Serializable;
044
045 import java.util.ArrayList;
046 import java.util.Collections;
047 import java.util.List;
048
049
065 public class PhonePersistenceImpl extends BasePersistenceImpl<Phone>
066 implements PhonePersistence {
067 public static final String FINDER_CLASS_NAME_ENTITY = PhoneImpl.class.getName();
068 public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
069 ".List";
070 public static final FinderPath FINDER_PATH_FIND_BY_COMPANYID = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
071 PhoneModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
072 "findByCompanyId",
073 new String[] {
074 Long.class.getName(),
075
076 "java.lang.Integer", "java.lang.Integer",
077 "com.liferay.portal.kernel.util.OrderByComparator"
078 });
079 public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
080 PhoneModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
081 "countByCompanyId", new String[] { Long.class.getName() });
082 public static final FinderPath FINDER_PATH_FIND_BY_USERID = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
083 PhoneModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
084 "findByUserId",
085 new String[] {
086 Long.class.getName(),
087
088 "java.lang.Integer", "java.lang.Integer",
089 "com.liferay.portal.kernel.util.OrderByComparator"
090 });
091 public static final FinderPath FINDER_PATH_COUNT_BY_USERID = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
092 PhoneModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
093 "countByUserId", new String[] { Long.class.getName() });
094 public static final FinderPath FINDER_PATH_FIND_BY_C_C = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
095 PhoneModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
096 "findByC_C",
097 new String[] {
098 Long.class.getName(), 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_COUNT_BY_C_C = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
104 PhoneModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
105 "countByC_C",
106 new String[] { Long.class.getName(), Long.class.getName() });
107 public static final FinderPath FINDER_PATH_FIND_BY_C_C_C = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
108 PhoneModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
109 "findByC_C_C",
110 new String[] {
111 Long.class.getName(), Long.class.getName(), Long.class.getName(),
112
113 "java.lang.Integer", "java.lang.Integer",
114 "com.liferay.portal.kernel.util.OrderByComparator"
115 });
116 public static final FinderPath FINDER_PATH_COUNT_BY_C_C_C = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
117 PhoneModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
118 "countByC_C_C",
119 new String[] {
120 Long.class.getName(), Long.class.getName(), Long.class.getName()
121 });
122 public static final FinderPath FINDER_PATH_FIND_BY_C_C_C_P = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
123 PhoneModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
124 "findByC_C_C_P",
125 new String[] {
126 Long.class.getName(), Long.class.getName(), Long.class.getName(),
127 Boolean.class.getName(),
128
129 "java.lang.Integer", "java.lang.Integer",
130 "com.liferay.portal.kernel.util.OrderByComparator"
131 });
132 public static final FinderPath FINDER_PATH_COUNT_BY_C_C_C_P = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
133 PhoneModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
134 "countByC_C_C_P",
135 new String[] {
136 Long.class.getName(), Long.class.getName(), Long.class.getName(),
137 Boolean.class.getName()
138 });
139 public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
140 PhoneModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
141 "findAll", new String[0]);
142 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
143 PhoneModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
144 "countAll", new String[0]);
145
146
151 public void cacheResult(Phone phone) {
152 EntityCacheUtil.putResult(PhoneModelImpl.ENTITY_CACHE_ENABLED,
153 PhoneImpl.class, phone.getPrimaryKey(), phone);
154 }
155
156
161 public void cacheResult(List<Phone> phones) {
162 for (Phone phone : phones) {
163 if (EntityCacheUtil.getResult(PhoneModelImpl.ENTITY_CACHE_ENABLED,
164 PhoneImpl.class, phone.getPrimaryKey(), this) == null) {
165 cacheResult(phone);
166 }
167 }
168 }
169
170
177 public void clearCache() {
178 CacheRegistryUtil.clear(PhoneImpl.class.getName());
179 EntityCacheUtil.clearCache(PhoneImpl.class.getName());
180 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
181 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
182 }
183
184
191 public void clearCache(Phone phone) {
192 EntityCacheUtil.removeResult(PhoneModelImpl.ENTITY_CACHE_ENABLED,
193 PhoneImpl.class, phone.getPrimaryKey());
194 }
195
196
202 public Phone create(long phoneId) {
203 Phone phone = new PhoneImpl();
204
205 phone.setNew(true);
206 phone.setPrimaryKey(phoneId);
207
208 return phone;
209 }
210
211
219 public Phone remove(Serializable primaryKey)
220 throws NoSuchModelException, SystemException {
221 return remove(((Long)primaryKey).longValue());
222 }
223
224
232 public Phone remove(long phoneId)
233 throws NoSuchPhoneException, SystemException {
234 Session session = null;
235
236 try {
237 session = openSession();
238
239 Phone phone = (Phone)session.get(PhoneImpl.class, new Long(phoneId));
240
241 if (phone == null) {
242 if (_log.isWarnEnabled()) {
243 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + phoneId);
244 }
245
246 throw new NoSuchPhoneException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
247 phoneId);
248 }
249
250 return remove(phone);
251 }
252 catch (NoSuchPhoneException nsee) {
253 throw nsee;
254 }
255 catch (Exception e) {
256 throw processException(e);
257 }
258 finally {
259 closeSession(session);
260 }
261 }
262
263 protected Phone removeImpl(Phone phone) throws SystemException {
264 phone = toUnwrappedModel(phone);
265
266 Session session = null;
267
268 try {
269 session = openSession();
270
271 BatchSessionUtil.delete(session, phone);
272 }
273 catch (Exception e) {
274 throw processException(e);
275 }
276 finally {
277 closeSession(session);
278 }
279
280 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
281
282 EntityCacheUtil.removeResult(PhoneModelImpl.ENTITY_CACHE_ENABLED,
283 PhoneImpl.class, phone.getPrimaryKey());
284
285 return phone;
286 }
287
288 public Phone updateImpl(com.liferay.portal.model.Phone phone, boolean merge)
289 throws SystemException {
290 phone = toUnwrappedModel(phone);
291
292 Session session = null;
293
294 try {
295 session = openSession();
296
297 BatchSessionUtil.update(session, phone, merge);
298
299 phone.setNew(false);
300 }
301 catch (Exception e) {
302 throw processException(e);
303 }
304 finally {
305 closeSession(session);
306 }
307
308 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
309
310 EntityCacheUtil.putResult(PhoneModelImpl.ENTITY_CACHE_ENABLED,
311 PhoneImpl.class, phone.getPrimaryKey(), phone);
312
313 return phone;
314 }
315
316 protected Phone toUnwrappedModel(Phone phone) {
317 if (phone instanceof PhoneImpl) {
318 return phone;
319 }
320
321 PhoneImpl phoneImpl = new PhoneImpl();
322
323 phoneImpl.setNew(phone.isNew());
324 phoneImpl.setPrimaryKey(phone.getPrimaryKey());
325
326 phoneImpl.setPhoneId(phone.getPhoneId());
327 phoneImpl.setCompanyId(phone.getCompanyId());
328 phoneImpl.setUserId(phone.getUserId());
329 phoneImpl.setUserName(phone.getUserName());
330 phoneImpl.setCreateDate(phone.getCreateDate());
331 phoneImpl.setModifiedDate(phone.getModifiedDate());
332 phoneImpl.setClassNameId(phone.getClassNameId());
333 phoneImpl.setClassPK(phone.getClassPK());
334 phoneImpl.setNumber(phone.getNumber());
335 phoneImpl.setExtension(phone.getExtension());
336 phoneImpl.setTypeId(phone.getTypeId());
337 phoneImpl.setPrimary(phone.isPrimary());
338
339 return phoneImpl;
340 }
341
342
350 public Phone findByPrimaryKey(Serializable primaryKey)
351 throws NoSuchModelException, SystemException {
352 return findByPrimaryKey(((Long)primaryKey).longValue());
353 }
354
355
363 public Phone findByPrimaryKey(long phoneId)
364 throws NoSuchPhoneException, SystemException {
365 Phone phone = fetchByPrimaryKey(phoneId);
366
367 if (phone == null) {
368 if (_log.isWarnEnabled()) {
369 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + phoneId);
370 }
371
372 throw new NoSuchPhoneException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
373 phoneId);
374 }
375
376 return phone;
377 }
378
379
386 public Phone fetchByPrimaryKey(Serializable primaryKey)
387 throws SystemException {
388 return fetchByPrimaryKey(((Long)primaryKey).longValue());
389 }
390
391
398 public Phone fetchByPrimaryKey(long phoneId) throws SystemException {
399 Phone phone = (Phone)EntityCacheUtil.getResult(PhoneModelImpl.ENTITY_CACHE_ENABLED,
400 PhoneImpl.class, phoneId, this);
401
402 if (phone == null) {
403 Session session = null;
404
405 try {
406 session = openSession();
407
408 phone = (Phone)session.get(PhoneImpl.class, new Long(phoneId));
409 }
410 catch (Exception e) {
411 throw processException(e);
412 }
413 finally {
414 if (phone != null) {
415 cacheResult(phone);
416 }
417
418 closeSession(session);
419 }
420 }
421
422 return phone;
423 }
424
425
432 public List<Phone> findByCompanyId(long companyId)
433 throws SystemException {
434 return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
435 null);
436 }
437
438
451 public List<Phone> findByCompanyId(long companyId, int start, int end)
452 throws SystemException {
453 return findByCompanyId(companyId, start, end, null);
454 }
455
456
470 public List<Phone> findByCompanyId(long companyId, int start, int end,
471 OrderByComparator orderByComparator) throws SystemException {
472 Object[] finderArgs = new Object[] {
473 companyId,
474
475 String.valueOf(start), String.valueOf(end),
476 String.valueOf(orderByComparator)
477 };
478
479 List<Phone> list = (List<Phone>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
480 finderArgs, this);
481
482 if (list == null) {
483 StringBundler query = null;
484
485 if (orderByComparator != null) {
486 query = new StringBundler(3 +
487 (orderByComparator.getOrderByFields().length * 3));
488 }
489 else {
490 query = new StringBundler(3);
491 }
492
493 query.append(_SQL_SELECT_PHONE_WHERE);
494
495 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
496
497 if (orderByComparator != null) {
498 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
499 orderByComparator);
500 }
501
502 else {
503 query.append(PhoneModelImpl.ORDER_BY_JPQL);
504 }
505
506 String sql = query.toString();
507
508 Session session = null;
509
510 try {
511 session = openSession();
512
513 Query q = session.createQuery(sql);
514
515 QueryPos qPos = QueryPos.getInstance(q);
516
517 qPos.add(companyId);
518
519 list = (List<Phone>)QueryUtil.list(q, getDialect(), start, end);
520 }
521 catch (Exception e) {
522 throw processException(e);
523 }
524 finally {
525 if (list == null) {
526 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_COMPANYID,
527 finderArgs);
528 }
529 else {
530 cacheResult(list);
531
532 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
533 finderArgs, list);
534 }
535
536 closeSession(session);
537 }
538 }
539
540 return list;
541 }
542
543
556 public Phone findByCompanyId_First(long companyId,
557 OrderByComparator orderByComparator)
558 throws NoSuchPhoneException, SystemException {
559 List<Phone> list = findByCompanyId(companyId, 0, 1, orderByComparator);
560
561 if (list.isEmpty()) {
562 StringBundler msg = new StringBundler(4);
563
564 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
565
566 msg.append("companyId=");
567 msg.append(companyId);
568
569 msg.append(StringPool.CLOSE_CURLY_BRACE);
570
571 throw new NoSuchPhoneException(msg.toString());
572 }
573 else {
574 return list.get(0);
575 }
576 }
577
578
591 public Phone findByCompanyId_Last(long companyId,
592 OrderByComparator orderByComparator)
593 throws NoSuchPhoneException, SystemException {
594 int count = countByCompanyId(companyId);
595
596 List<Phone> list = findByCompanyId(companyId, count - 1, count,
597 orderByComparator);
598
599 if (list.isEmpty()) {
600 StringBundler msg = new StringBundler(4);
601
602 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
603
604 msg.append("companyId=");
605 msg.append(companyId);
606
607 msg.append(StringPool.CLOSE_CURLY_BRACE);
608
609 throw new NoSuchPhoneException(msg.toString());
610 }
611 else {
612 return list.get(0);
613 }
614 }
615
616
630 public Phone[] findByCompanyId_PrevAndNext(long phoneId, long companyId,
631 OrderByComparator orderByComparator)
632 throws NoSuchPhoneException, SystemException {
633 Phone phone = findByPrimaryKey(phoneId);
634
635 Session session = null;
636
637 try {
638 session = openSession();
639
640 Phone[] array = new PhoneImpl[3];
641
642 array[0] = getByCompanyId_PrevAndNext(session, phone, companyId,
643 orderByComparator, true);
644
645 array[1] = phone;
646
647 array[2] = getByCompanyId_PrevAndNext(session, phone, companyId,
648 orderByComparator, false);
649
650 return array;
651 }
652 catch (Exception e) {
653 throw processException(e);
654 }
655 finally {
656 closeSession(session);
657 }
658 }
659
660 protected Phone getByCompanyId_PrevAndNext(Session session, Phone phone,
661 long companyId, OrderByComparator orderByComparator, boolean previous) {
662 StringBundler query = null;
663
664 if (orderByComparator != null) {
665 query = new StringBundler(6 +
666 (orderByComparator.getOrderByFields().length * 6));
667 }
668 else {
669 query = new StringBundler(3);
670 }
671
672 query.append(_SQL_SELECT_PHONE_WHERE);
673
674 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
675
676 if (orderByComparator != null) {
677 String[] orderByFields = orderByComparator.getOrderByFields();
678
679 if (orderByFields.length > 0) {
680 query.append(WHERE_AND);
681 }
682
683 for (int i = 0; i < orderByFields.length; i++) {
684 query.append(_ORDER_BY_ENTITY_ALIAS);
685 query.append(orderByFields[i]);
686
687 if ((i + 1) < orderByFields.length) {
688 if (orderByComparator.isAscending() ^ previous) {
689 query.append(WHERE_GREATER_THAN_HAS_NEXT);
690 }
691 else {
692 query.append(WHERE_LESSER_THAN_HAS_NEXT);
693 }
694 }
695 else {
696 if (orderByComparator.isAscending() ^ previous) {
697 query.append(WHERE_GREATER_THAN);
698 }
699 else {
700 query.append(WHERE_LESSER_THAN);
701 }
702 }
703 }
704
705 query.append(ORDER_BY_CLAUSE);
706
707 for (int i = 0; i < orderByFields.length; i++) {
708 query.append(_ORDER_BY_ENTITY_ALIAS);
709 query.append(orderByFields[i]);
710
711 if ((i + 1) < orderByFields.length) {
712 if (orderByComparator.isAscending() ^ previous) {
713 query.append(ORDER_BY_ASC_HAS_NEXT);
714 }
715 else {
716 query.append(ORDER_BY_DESC_HAS_NEXT);
717 }
718 }
719 else {
720 if (orderByComparator.isAscending() ^ previous) {
721 query.append(ORDER_BY_ASC);
722 }
723 else {
724 query.append(ORDER_BY_DESC);
725 }
726 }
727 }
728 }
729
730 else {
731 query.append(PhoneModelImpl.ORDER_BY_JPQL);
732 }
733
734 String sql = query.toString();
735
736 Query q = session.createQuery(sql);
737
738 q.setFirstResult(0);
739 q.setMaxResults(2);
740
741 QueryPos qPos = QueryPos.getInstance(q);
742
743 qPos.add(companyId);
744
745 if (orderByComparator != null) {
746 Object[] values = orderByComparator.getOrderByValues(phone);
747
748 for (Object value : values) {
749 qPos.add(value);
750 }
751 }
752
753 List<Phone> list = q.list();
754
755 if (list.size() == 2) {
756 return list.get(1);
757 }
758 else {
759 return null;
760 }
761 }
762
763
770 public List<Phone> findByUserId(long userId) throws SystemException {
771 return findByUserId(userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
772 }
773
774
787 public List<Phone> findByUserId(long userId, int start, int end)
788 throws SystemException {
789 return findByUserId(userId, start, end, null);
790 }
791
792
806 public List<Phone> findByUserId(long userId, int start, int end,
807 OrderByComparator orderByComparator) throws SystemException {
808 Object[] finderArgs = new Object[] {
809 userId,
810
811 String.valueOf(start), String.valueOf(end),
812 String.valueOf(orderByComparator)
813 };
814
815 List<Phone> list = (List<Phone>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_USERID,
816 finderArgs, this);
817
818 if (list == null) {
819 StringBundler query = null;
820
821 if (orderByComparator != null) {
822 query = new StringBundler(3 +
823 (orderByComparator.getOrderByFields().length * 3));
824 }
825 else {
826 query = new StringBundler(3);
827 }
828
829 query.append(_SQL_SELECT_PHONE_WHERE);
830
831 query.append(_FINDER_COLUMN_USERID_USERID_2);
832
833 if (orderByComparator != null) {
834 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
835 orderByComparator);
836 }
837
838 else {
839 query.append(PhoneModelImpl.ORDER_BY_JPQL);
840 }
841
842 String sql = query.toString();
843
844 Session session = null;
845
846 try {
847 session = openSession();
848
849 Query q = session.createQuery(sql);
850
851 QueryPos qPos = QueryPos.getInstance(q);
852
853 qPos.add(userId);
854
855 list = (List<Phone>)QueryUtil.list(q, getDialect(), start, end);
856 }
857 catch (Exception e) {
858 throw processException(e);
859 }
860 finally {
861 if (list == null) {
862 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_USERID,
863 finderArgs);
864 }
865 else {
866 cacheResult(list);
867
868 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_USERID,
869 finderArgs, list);
870 }
871
872 closeSession(session);
873 }
874 }
875
876 return list;
877 }
878
879
892 public Phone findByUserId_First(long userId,
893 OrderByComparator orderByComparator)
894 throws NoSuchPhoneException, SystemException {
895 List<Phone> list = findByUserId(userId, 0, 1, orderByComparator);
896
897 if (list.isEmpty()) {
898 StringBundler msg = new StringBundler(4);
899
900 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
901
902 msg.append("userId=");
903 msg.append(userId);
904
905 msg.append(StringPool.CLOSE_CURLY_BRACE);
906
907 throw new NoSuchPhoneException(msg.toString());
908 }
909 else {
910 return list.get(0);
911 }
912 }
913
914
927 public Phone findByUserId_Last(long userId,
928 OrderByComparator orderByComparator)
929 throws NoSuchPhoneException, SystemException {
930 int count = countByUserId(userId);
931
932 List<Phone> list = findByUserId(userId, count - 1, count,
933 orderByComparator);
934
935 if (list.isEmpty()) {
936 StringBundler msg = new StringBundler(4);
937
938 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
939
940 msg.append("userId=");
941 msg.append(userId);
942
943 msg.append(StringPool.CLOSE_CURLY_BRACE);
944
945 throw new NoSuchPhoneException(msg.toString());
946 }
947 else {
948 return list.get(0);
949 }
950 }
951
952
966 public Phone[] findByUserId_PrevAndNext(long phoneId, long userId,
967 OrderByComparator orderByComparator)
968 throws NoSuchPhoneException, SystemException {
969 Phone phone = findByPrimaryKey(phoneId);
970
971 Session session = null;
972
973 try {
974 session = openSession();
975
976 Phone[] array = new PhoneImpl[3];
977
978 array[0] = getByUserId_PrevAndNext(session, phone, userId,
979 orderByComparator, true);
980
981 array[1] = phone;
982
983 array[2] = getByUserId_PrevAndNext(session, phone, userId,
984 orderByComparator, false);
985
986 return array;
987 }
988 catch (Exception e) {
989 throw processException(e);
990 }
991 finally {
992 closeSession(session);
993 }
994 }
995
996 protected Phone getByUserId_PrevAndNext(Session session, Phone phone,
997 long userId, OrderByComparator orderByComparator, boolean previous) {
998 StringBundler query = null;
999
1000 if (orderByComparator != null) {
1001 query = new StringBundler(6 +
1002 (orderByComparator.getOrderByFields().length * 6));
1003 }
1004 else {
1005 query = new StringBundler(3);
1006 }
1007
1008 query.append(_SQL_SELECT_PHONE_WHERE);
1009
1010 query.append(_FINDER_COLUMN_USERID_USERID_2);
1011
1012 if (orderByComparator != null) {
1013 String[] orderByFields = orderByComparator.getOrderByFields();
1014
1015 if (orderByFields.length > 0) {
1016 query.append(WHERE_AND);
1017 }
1018
1019 for (int i = 0; i < orderByFields.length; i++) {
1020 query.append(_ORDER_BY_ENTITY_ALIAS);
1021 query.append(orderByFields[i]);
1022
1023 if ((i + 1) < orderByFields.length) {
1024 if (orderByComparator.isAscending() ^ previous) {
1025 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1026 }
1027 else {
1028 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1029 }
1030 }
1031 else {
1032 if (orderByComparator.isAscending() ^ previous) {
1033 query.append(WHERE_GREATER_THAN);
1034 }
1035 else {
1036 query.append(WHERE_LESSER_THAN);
1037 }
1038 }
1039 }
1040
1041 query.append(ORDER_BY_CLAUSE);
1042
1043 for (int i = 0; i < orderByFields.length; i++) {
1044 query.append(_ORDER_BY_ENTITY_ALIAS);
1045 query.append(orderByFields[i]);
1046
1047 if ((i + 1) < orderByFields.length) {
1048 if (orderByComparator.isAscending() ^ previous) {
1049 query.append(ORDER_BY_ASC_HAS_NEXT);
1050 }
1051 else {
1052 query.append(ORDER_BY_DESC_HAS_NEXT);
1053 }
1054 }
1055 else {
1056 if (orderByComparator.isAscending() ^ previous) {
1057 query.append(ORDER_BY_ASC);
1058 }
1059 else {
1060 query.append(ORDER_BY_DESC);
1061 }
1062 }
1063 }
1064 }
1065
1066 else {
1067 query.append(PhoneModelImpl.ORDER_BY_JPQL);
1068 }
1069
1070 String sql = query.toString();
1071
1072 Query q = session.createQuery(sql);
1073
1074 q.setFirstResult(0);
1075 q.setMaxResults(2);
1076
1077 QueryPos qPos = QueryPos.getInstance(q);
1078
1079 qPos.add(userId);
1080
1081 if (orderByComparator != null) {
1082 Object[] values = orderByComparator.getOrderByValues(phone);
1083
1084 for (Object value : values) {
1085 qPos.add(value);
1086 }
1087 }
1088
1089 List<Phone> list = q.list();
1090
1091 if (list.size() == 2) {
1092 return list.get(1);
1093 }
1094 else {
1095 return null;
1096 }
1097 }
1098
1099
1107 public List<Phone> findByC_C(long companyId, long classNameId)
1108 throws SystemException {
1109 return findByC_C(companyId, classNameId, QueryUtil.ALL_POS,
1110 QueryUtil.ALL_POS, null);
1111 }
1112
1113
1127 public List<Phone> findByC_C(long companyId, long classNameId, int start,
1128 int end) throws SystemException {
1129 return findByC_C(companyId, classNameId, start, end, null);
1130 }
1131
1132
1147 public List<Phone> findByC_C(long companyId, long classNameId, int start,
1148 int end, OrderByComparator orderByComparator) throws SystemException {
1149 Object[] finderArgs = new Object[] {
1150 companyId, classNameId,
1151
1152 String.valueOf(start), String.valueOf(end),
1153 String.valueOf(orderByComparator)
1154 };
1155
1156 List<Phone> list = (List<Phone>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_C,
1157 finderArgs, this);
1158
1159 if (list == null) {
1160 StringBundler query = null;
1161
1162 if (orderByComparator != null) {
1163 query = new StringBundler(4 +
1164 (orderByComparator.getOrderByFields().length * 3));
1165 }
1166 else {
1167 query = new StringBundler(4);
1168 }
1169
1170 query.append(_SQL_SELECT_PHONE_WHERE);
1171
1172 query.append(_FINDER_COLUMN_C_C_COMPANYID_2);
1173
1174 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
1175
1176 if (orderByComparator != null) {
1177 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1178 orderByComparator);
1179 }
1180
1181 else {
1182 query.append(PhoneModelImpl.ORDER_BY_JPQL);
1183 }
1184
1185 String sql = query.toString();
1186
1187 Session session = null;
1188
1189 try {
1190 session = openSession();
1191
1192 Query q = session.createQuery(sql);
1193
1194 QueryPos qPos = QueryPos.getInstance(q);
1195
1196 qPos.add(companyId);
1197
1198 qPos.add(classNameId);
1199
1200 list = (List<Phone>)QueryUtil.list(q, getDialect(), start, end);
1201 }
1202 catch (Exception e) {
1203 throw processException(e);
1204 }
1205 finally {
1206 if (list == null) {
1207 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_C_C,
1208 finderArgs);
1209 }
1210 else {
1211 cacheResult(list);
1212
1213 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_C,
1214 finderArgs, list);
1215 }
1216
1217 closeSession(session);
1218 }
1219 }
1220
1221 return list;
1222 }
1223
1224
1238 public Phone findByC_C_First(long companyId, long classNameId,
1239 OrderByComparator orderByComparator)
1240 throws NoSuchPhoneException, SystemException {
1241 List<Phone> list = findByC_C(companyId, classNameId, 0, 1,
1242 orderByComparator);
1243
1244 if (list.isEmpty()) {
1245 StringBundler msg = new StringBundler(6);
1246
1247 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1248
1249 msg.append("companyId=");
1250 msg.append(companyId);
1251
1252 msg.append(", classNameId=");
1253 msg.append(classNameId);
1254
1255 msg.append(StringPool.CLOSE_CURLY_BRACE);
1256
1257 throw new NoSuchPhoneException(msg.toString());
1258 }
1259 else {
1260 return list.get(0);
1261 }
1262 }
1263
1264
1278 public Phone findByC_C_Last(long companyId, long classNameId,
1279 OrderByComparator orderByComparator)
1280 throws NoSuchPhoneException, SystemException {
1281 int count = countByC_C(companyId, classNameId);
1282
1283 List<Phone> list = findByC_C(companyId, classNameId, count - 1, count,
1284 orderByComparator);
1285
1286 if (list.isEmpty()) {
1287 StringBundler msg = new StringBundler(6);
1288
1289 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1290
1291 msg.append("companyId=");
1292 msg.append(companyId);
1293
1294 msg.append(", classNameId=");
1295 msg.append(classNameId);
1296
1297 msg.append(StringPool.CLOSE_CURLY_BRACE);
1298
1299 throw new NoSuchPhoneException(msg.toString());
1300 }
1301 else {
1302 return list.get(0);
1303 }
1304 }
1305
1306
1321 public Phone[] findByC_C_PrevAndNext(long phoneId, long companyId,
1322 long classNameId, OrderByComparator orderByComparator)
1323 throws NoSuchPhoneException, SystemException {
1324 Phone phone = findByPrimaryKey(phoneId);
1325
1326 Session session = null;
1327
1328 try {
1329 session = openSession();
1330
1331 Phone[] array = new PhoneImpl[3];
1332
1333 array[0] = getByC_C_PrevAndNext(session, phone, companyId,
1334 classNameId, orderByComparator, true);
1335
1336 array[1] = phone;
1337
1338 array[2] = getByC_C_PrevAndNext(session, phone, companyId,
1339 classNameId, orderByComparator, false);
1340
1341 return array;
1342 }
1343 catch (Exception e) {
1344 throw processException(e);
1345 }
1346 finally {
1347 closeSession(session);
1348 }
1349 }
1350
1351 protected Phone getByC_C_PrevAndNext(Session session, Phone phone,
1352 long companyId, long classNameId, OrderByComparator orderByComparator,
1353 boolean previous) {
1354 StringBundler query = null;
1355
1356 if (orderByComparator != null) {
1357 query = new StringBundler(6 +
1358 (orderByComparator.getOrderByFields().length * 6));
1359 }
1360 else {
1361 query = new StringBundler(3);
1362 }
1363
1364 query.append(_SQL_SELECT_PHONE_WHERE);
1365
1366 query.append(_FINDER_COLUMN_C_C_COMPANYID_2);
1367
1368 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
1369
1370 if (orderByComparator != null) {
1371 String[] orderByFields = orderByComparator.getOrderByFields();
1372
1373 if (orderByFields.length > 0) {
1374 query.append(WHERE_AND);
1375 }
1376
1377 for (int i = 0; i < orderByFields.length; i++) {
1378 query.append(_ORDER_BY_ENTITY_ALIAS);
1379 query.append(orderByFields[i]);
1380
1381 if ((i + 1) < orderByFields.length) {
1382 if (orderByComparator.isAscending() ^ previous) {
1383 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1384 }
1385 else {
1386 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1387 }
1388 }
1389 else {
1390 if (orderByComparator.isAscending() ^ previous) {
1391 query.append(WHERE_GREATER_THAN);
1392 }
1393 else {
1394 query.append(WHERE_LESSER_THAN);
1395 }
1396 }
1397 }
1398
1399 query.append(ORDER_BY_CLAUSE);
1400
1401 for (int i = 0; i < orderByFields.length; i++) {
1402 query.append(_ORDER_BY_ENTITY_ALIAS);
1403 query.append(orderByFields[i]);
1404
1405 if ((i + 1) < orderByFields.length) {
1406 if (orderByComparator.isAscending() ^ previous) {
1407 query.append(ORDER_BY_ASC_HAS_NEXT);
1408 }
1409 else {
1410 query.append(ORDER_BY_DESC_HAS_NEXT);
1411 }
1412 }
1413 else {
1414 if (orderByComparator.isAscending() ^ previous) {
1415 query.append(ORDER_BY_ASC);
1416 }
1417 else {
1418 query.append(ORDER_BY_DESC);
1419 }
1420 }
1421 }
1422 }
1423
1424 else {
1425 query.append(PhoneModelImpl.ORDER_BY_JPQL);
1426 }
1427
1428 String sql = query.toString();
1429
1430 Query q = session.createQuery(sql);
1431
1432 q.setFirstResult(0);
1433 q.setMaxResults(2);
1434
1435 QueryPos qPos = QueryPos.getInstance(q);
1436
1437 qPos.add(companyId);
1438
1439 qPos.add(classNameId);
1440
1441 if (orderByComparator != null) {
1442 Object[] values = orderByComparator.getOrderByValues(phone);
1443
1444 for (Object value : values) {
1445 qPos.add(value);
1446 }
1447 }
1448
1449 List<Phone> list = q.list();
1450
1451 if (list.size() == 2) {
1452 return list.get(1);
1453 }
1454 else {
1455 return null;
1456 }
1457 }
1458
1459
1468 public List<Phone> findByC_C_C(long companyId, long classNameId,
1469 long classPK) throws SystemException {
1470 return findByC_C_C(companyId, classNameId, classPK, QueryUtil.ALL_POS,
1471 QueryUtil.ALL_POS, null);
1472 }
1473
1474
1489 public List<Phone> findByC_C_C(long companyId, long classNameId,
1490 long classPK, int start, int end) throws SystemException {
1491 return findByC_C_C(companyId, classNameId, classPK, start, end, null);
1492 }
1493
1494
1510 public List<Phone> findByC_C_C(long companyId, long classNameId,
1511 long classPK, int start, int end, OrderByComparator orderByComparator)
1512 throws SystemException {
1513 Object[] finderArgs = new Object[] {
1514 companyId, classNameId, classPK,
1515
1516 String.valueOf(start), String.valueOf(end),
1517 String.valueOf(orderByComparator)
1518 };
1519
1520 List<Phone> list = (List<Phone>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_C_C,
1521 finderArgs, this);
1522
1523 if (list == null) {
1524 StringBundler query = null;
1525
1526 if (orderByComparator != null) {
1527 query = new StringBundler(5 +
1528 (orderByComparator.getOrderByFields().length * 3));
1529 }
1530 else {
1531 query = new StringBundler(5);
1532 }
1533
1534 query.append(_SQL_SELECT_PHONE_WHERE);
1535
1536 query.append(_FINDER_COLUMN_C_C_C_COMPANYID_2);
1537
1538 query.append(_FINDER_COLUMN_C_C_C_CLASSNAMEID_2);
1539
1540 query.append(_FINDER_COLUMN_C_C_C_CLASSPK_2);
1541
1542 if (orderByComparator != null) {
1543 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1544 orderByComparator);
1545 }
1546
1547 else {
1548 query.append(PhoneModelImpl.ORDER_BY_JPQL);
1549 }
1550
1551 String sql = query.toString();
1552
1553 Session session = null;
1554
1555 try {
1556 session = openSession();
1557
1558 Query q = session.createQuery(sql);
1559
1560 QueryPos qPos = QueryPos.getInstance(q);
1561
1562 qPos.add(companyId);
1563
1564 qPos.add(classNameId);
1565
1566 qPos.add(classPK);
1567
1568 list = (List<Phone>)QueryUtil.list(q, getDialect(), start, end);
1569 }
1570 catch (Exception e) {
1571 throw processException(e);
1572 }
1573 finally {
1574 if (list == null) {
1575 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_C_C_C,
1576 finderArgs);
1577 }
1578 else {
1579 cacheResult(list);
1580
1581 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_C_C,
1582 finderArgs, list);
1583 }
1584
1585 closeSession(session);
1586 }
1587 }
1588
1589 return list;
1590 }
1591
1592
1607 public Phone findByC_C_C_First(long companyId, long classNameId,
1608 long classPK, OrderByComparator orderByComparator)
1609 throws NoSuchPhoneException, SystemException {
1610 List<Phone> list = findByC_C_C(companyId, classNameId, classPK, 0, 1,
1611 orderByComparator);
1612
1613 if (list.isEmpty()) {
1614 StringBundler msg = new StringBundler(8);
1615
1616 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1617
1618 msg.append("companyId=");
1619 msg.append(companyId);
1620
1621 msg.append(", classNameId=");
1622 msg.append(classNameId);
1623
1624 msg.append(", classPK=");
1625 msg.append(classPK);
1626
1627 msg.append(StringPool.CLOSE_CURLY_BRACE);
1628
1629 throw new NoSuchPhoneException(msg.toString());
1630 }
1631 else {
1632 return list.get(0);
1633 }
1634 }
1635
1636
1651 public Phone findByC_C_C_Last(long companyId, long classNameId,
1652 long classPK, OrderByComparator orderByComparator)
1653 throws NoSuchPhoneException, SystemException {
1654 int count = countByC_C_C(companyId, classNameId, classPK);
1655
1656 List<Phone> list = findByC_C_C(companyId, classNameId, classPK,
1657 count - 1, count, orderByComparator);
1658
1659 if (list.isEmpty()) {
1660 StringBundler msg = new StringBundler(8);
1661
1662 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1663
1664 msg.append("companyId=");
1665 msg.append(companyId);
1666
1667 msg.append(", classNameId=");
1668 msg.append(classNameId);
1669
1670 msg.append(", classPK=");
1671 msg.append(classPK);
1672
1673 msg.append(StringPool.CLOSE_CURLY_BRACE);
1674
1675 throw new NoSuchPhoneException(msg.toString());
1676 }
1677 else {
1678 return list.get(0);
1679 }
1680 }
1681
1682
1698 public Phone[] findByC_C_C_PrevAndNext(long phoneId, long companyId,
1699 long classNameId, long classPK, OrderByComparator orderByComparator)
1700 throws NoSuchPhoneException, SystemException {
1701 Phone phone = findByPrimaryKey(phoneId);
1702
1703 Session session = null;
1704
1705 try {
1706 session = openSession();
1707
1708 Phone[] array = new PhoneImpl[3];
1709
1710 array[0] = getByC_C_C_PrevAndNext(session, phone, companyId,
1711 classNameId, classPK, orderByComparator, true);
1712
1713 array[1] = phone;
1714
1715 array[2] = getByC_C_C_PrevAndNext(session, phone, companyId,
1716 classNameId, classPK, orderByComparator, false);
1717
1718 return array;
1719 }
1720 catch (Exception e) {
1721 throw processException(e);
1722 }
1723 finally {
1724 closeSession(session);
1725 }
1726 }
1727
1728 protected Phone getByC_C_C_PrevAndNext(Session session, Phone phone,
1729 long companyId, long classNameId, long classPK,
1730 OrderByComparator orderByComparator, boolean previous) {
1731 StringBundler query = null;
1732
1733 if (orderByComparator != null) {
1734 query = new StringBundler(6 +
1735 (orderByComparator.getOrderByFields().length * 6));
1736 }
1737 else {
1738 query = new StringBundler(3);
1739 }
1740
1741 query.append(_SQL_SELECT_PHONE_WHERE);
1742
1743 query.append(_FINDER_COLUMN_C_C_C_COMPANYID_2);
1744
1745 query.append(_FINDER_COLUMN_C_C_C_CLASSNAMEID_2);
1746
1747 query.append(_FINDER_COLUMN_C_C_C_CLASSPK_2);
1748
1749 if (orderByComparator != null) {
1750 String[] orderByFields = orderByComparator.getOrderByFields();
1751
1752 if (orderByFields.length > 0) {
1753 query.append(WHERE_AND);
1754 }
1755
1756 for (int i = 0; i < orderByFields.length; i++) {
1757 query.append(_ORDER_BY_ENTITY_ALIAS);
1758 query.append(orderByFields[i]);
1759
1760 if ((i + 1) < orderByFields.length) {
1761 if (orderByComparator.isAscending() ^ previous) {
1762 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1763 }
1764 else {
1765 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1766 }
1767 }
1768 else {
1769 if (orderByComparator.isAscending() ^ previous) {
1770 query.append(WHERE_GREATER_THAN);
1771 }
1772 else {
1773 query.append(WHERE_LESSER_THAN);
1774 }
1775 }
1776 }
1777
1778 query.append(ORDER_BY_CLAUSE);
1779
1780 for (int i = 0; i < orderByFields.length; i++) {
1781 query.append(_ORDER_BY_ENTITY_ALIAS);
1782 query.append(orderByFields[i]);
1783
1784 if ((i + 1) < orderByFields.length) {
1785 if (orderByComparator.isAscending() ^ previous) {
1786 query.append(ORDER_BY_ASC_HAS_NEXT);
1787 }
1788 else {
1789 query.append(ORDER_BY_DESC_HAS_NEXT);
1790 }
1791 }
1792 else {
1793 if (orderByComparator.isAscending() ^ previous) {
1794 query.append(ORDER_BY_ASC);
1795 }
1796 else {
1797 query.append(ORDER_BY_DESC);
1798 }
1799 }
1800 }
1801 }
1802
1803 else {
1804 query.append(PhoneModelImpl.ORDER_BY_JPQL);
1805 }
1806
1807 String sql = query.toString();
1808
1809 Query q = session.createQuery(sql);
1810
1811 q.setFirstResult(0);
1812 q.setMaxResults(2);
1813
1814 QueryPos qPos = QueryPos.getInstance(q);
1815
1816 qPos.add(companyId);
1817
1818 qPos.add(classNameId);
1819
1820 qPos.add(classPK);
1821
1822 if (orderByComparator != null) {
1823 Object[] values = orderByComparator.getOrderByValues(phone);
1824
1825 for (Object value : values) {
1826 qPos.add(value);
1827 }
1828 }
1829
1830 List<Phone> list = q.list();
1831
1832 if (list.size() == 2) {
1833 return list.get(1);
1834 }
1835 else {
1836 return null;
1837 }
1838 }
1839
1840
1850 public List<Phone> findByC_C_C_P(long companyId, long classNameId,
1851 long classPK, boolean primary) throws SystemException {
1852 return findByC_C_C_P(companyId, classNameId, classPK, primary,
1853 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1854 }
1855
1856
1872 public List<Phone> findByC_C_C_P(long companyId, long classNameId,
1873 long classPK, boolean primary, int start, int end)
1874 throws SystemException {
1875 return findByC_C_C_P(companyId, classNameId, classPK, primary, start,
1876 end, null);
1877 }
1878
1879
1896 public List<Phone> findByC_C_C_P(long companyId, long classNameId,
1897 long classPK, boolean primary, int start, int end,
1898 OrderByComparator orderByComparator) throws SystemException {
1899 Object[] finderArgs = new Object[] {
1900 companyId, classNameId, classPK, primary,
1901
1902 String.valueOf(start), String.valueOf(end),
1903 String.valueOf(orderByComparator)
1904 };
1905
1906 List<Phone> list = (List<Phone>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_C_C_P,
1907 finderArgs, this);
1908
1909 if (list == null) {
1910 StringBundler query = null;
1911
1912 if (orderByComparator != null) {
1913 query = new StringBundler(6 +
1914 (orderByComparator.getOrderByFields().length * 3));
1915 }
1916 else {
1917 query = new StringBundler(6);
1918 }
1919
1920 query.append(_SQL_SELECT_PHONE_WHERE);
1921
1922 query.append(_FINDER_COLUMN_C_C_C_P_COMPANYID_2);
1923
1924 query.append(_FINDER_COLUMN_C_C_C_P_CLASSNAMEID_2);
1925
1926 query.append(_FINDER_COLUMN_C_C_C_P_CLASSPK_2);
1927
1928 query.append(_FINDER_COLUMN_C_C_C_P_PRIMARY_2);
1929
1930 if (orderByComparator != null) {
1931 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1932 orderByComparator);
1933 }
1934
1935 else {
1936 query.append(PhoneModelImpl.ORDER_BY_JPQL);
1937 }
1938
1939 String sql = query.toString();
1940
1941 Session session = null;
1942
1943 try {
1944 session = openSession();
1945
1946 Query q = session.createQuery(sql);
1947
1948 QueryPos qPos = QueryPos.getInstance(q);
1949
1950 qPos.add(companyId);
1951
1952 qPos.add(classNameId);
1953
1954 qPos.add(classPK);
1955
1956 qPos.add(primary);
1957
1958 list = (List<Phone>)QueryUtil.list(q, getDialect(), start, end);
1959 }
1960 catch (Exception e) {
1961 throw processException(e);
1962 }
1963 finally {
1964 if (list == null) {
1965 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_C_C_C_P,
1966 finderArgs);
1967 }
1968 else {
1969 cacheResult(list);
1970
1971 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_C_C_P,
1972 finderArgs, list);
1973 }
1974
1975 closeSession(session);
1976 }
1977 }
1978
1979 return list;
1980 }
1981
1982
1998 public Phone findByC_C_C_P_First(long companyId, long classNameId,
1999 long classPK, boolean primary, OrderByComparator orderByComparator)
2000 throws NoSuchPhoneException, SystemException {
2001 List<Phone> list = findByC_C_C_P(companyId, classNameId, classPK,
2002 primary, 0, 1, orderByComparator);
2003
2004 if (list.isEmpty()) {
2005 StringBundler msg = new StringBundler(10);
2006
2007 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2008
2009 msg.append("companyId=");
2010 msg.append(companyId);
2011
2012 msg.append(", classNameId=");
2013 msg.append(classNameId);
2014
2015 msg.append(", classPK=");
2016 msg.append(classPK);
2017
2018 msg.append(", primary=");
2019 msg.append(primary);
2020
2021 msg.append(StringPool.CLOSE_CURLY_BRACE);
2022
2023 throw new NoSuchPhoneException(msg.toString());
2024 }
2025 else {
2026 return list.get(0);
2027 }
2028 }
2029
2030
2046 public Phone findByC_C_C_P_Last(long companyId, long classNameId,
2047 long classPK, boolean primary, OrderByComparator orderByComparator)
2048 throws NoSuchPhoneException, SystemException {
2049 int count = countByC_C_C_P(companyId, classNameId, classPK, primary);
2050
2051 List<Phone> list = findByC_C_C_P(companyId, classNameId, classPK,
2052 primary, count - 1, count, orderByComparator);
2053
2054 if (list.isEmpty()) {
2055 StringBundler msg = new StringBundler(10);
2056
2057 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2058
2059 msg.append("companyId=");
2060 msg.append(companyId);
2061
2062 msg.append(", classNameId=");
2063 msg.append(classNameId);
2064
2065 msg.append(", classPK=");
2066 msg.append(classPK);
2067
2068 msg.append(", primary=");
2069 msg.append(primary);
2070
2071 msg.append(StringPool.CLOSE_CURLY_BRACE);
2072
2073 throw new NoSuchPhoneException(msg.toString());
2074 }
2075 else {
2076 return list.get(0);
2077 }
2078 }
2079
2080
2097 public Phone[] findByC_C_C_P_PrevAndNext(long phoneId, long companyId,
2098 long classNameId, long classPK, boolean primary,
2099 OrderByComparator orderByComparator)
2100 throws NoSuchPhoneException, SystemException {
2101 Phone phone = findByPrimaryKey(phoneId);
2102
2103 Session session = null;
2104
2105 try {
2106 session = openSession();
2107
2108 Phone[] array = new PhoneImpl[3];
2109
2110 array[0] = getByC_C_C_P_PrevAndNext(session, phone, companyId,
2111 classNameId, classPK, primary, orderByComparator, true);
2112
2113 array[1] = phone;
2114
2115 array[2] = getByC_C_C_P_PrevAndNext(session, phone, companyId,
2116 classNameId, classPK, primary, orderByComparator, false);
2117
2118 return array;
2119 }
2120 catch (Exception e) {
2121 throw processException(e);
2122 }
2123 finally {
2124 closeSession(session);
2125 }
2126 }
2127
2128 protected Phone getByC_C_C_P_PrevAndNext(Session session, Phone phone,
2129 long companyId, long classNameId, long classPK, boolean primary,
2130 OrderByComparator orderByComparator, boolean previous) {
2131 StringBundler query = null;
2132
2133 if (orderByComparator != null) {
2134 query = new StringBundler(6 +
2135 (orderByComparator.getOrderByFields().length * 6));
2136 }
2137 else {
2138 query = new StringBundler(3);
2139 }
2140
2141 query.append(_SQL_SELECT_PHONE_WHERE);
2142
2143 query.append(_FINDER_COLUMN_C_C_C_P_COMPANYID_2);
2144
2145 query.append(_FINDER_COLUMN_C_C_C_P_CLASSNAMEID_2);
2146
2147 query.append(_FINDER_COLUMN_C_C_C_P_CLASSPK_2);
2148
2149 query.append(_FINDER_COLUMN_C_C_C_P_PRIMARY_2);
2150
2151 if (orderByComparator != null) {
2152 String[] orderByFields = orderByComparator.getOrderByFields();
2153
2154 if (orderByFields.length > 0) {
2155 query.append(WHERE_AND);
2156 }
2157
2158 for (int i = 0; i < orderByFields.length; i++) {
2159 query.append(_ORDER_BY_ENTITY_ALIAS);
2160 query.append(orderByFields[i]);
2161
2162 if ((i + 1) < orderByFields.length) {
2163 if (orderByComparator.isAscending() ^ previous) {
2164 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2165 }
2166 else {
2167 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2168 }
2169 }
2170 else {
2171 if (orderByComparator.isAscending() ^ previous) {
2172 query.append(WHERE_GREATER_THAN);
2173 }
2174 else {
2175 query.append(WHERE_LESSER_THAN);
2176 }
2177 }
2178 }
2179
2180 query.append(ORDER_BY_CLAUSE);
2181
2182 for (int i = 0; i < orderByFields.length; i++) {
2183 query.append(_ORDER_BY_ENTITY_ALIAS);
2184 query.append(orderByFields[i]);
2185
2186 if ((i + 1) < orderByFields.length) {
2187 if (orderByComparator.isAscending() ^ previous) {
2188 query.append(ORDER_BY_ASC_HAS_NEXT);
2189 }
2190 else {
2191 query.append(ORDER_BY_DESC_HAS_NEXT);
2192 }
2193 }
2194 else {
2195 if (orderByComparator.isAscending() ^ previous) {
2196 query.append(ORDER_BY_ASC);
2197 }
2198 else {
2199 query.append(ORDER_BY_DESC);
2200 }
2201 }
2202 }
2203 }
2204
2205 else {
2206 query.append(PhoneModelImpl.ORDER_BY_JPQL);
2207 }
2208
2209 String sql = query.toString();
2210
2211 Query q = session.createQuery(sql);
2212
2213 q.setFirstResult(0);
2214 q.setMaxResults(2);
2215
2216 QueryPos qPos = QueryPos.getInstance(q);
2217
2218 qPos.add(companyId);
2219
2220 qPos.add(classNameId);
2221
2222 qPos.add(classPK);
2223
2224 qPos.add(primary);
2225
2226 if (orderByComparator != null) {
2227 Object[] values = orderByComparator.getOrderByValues(phone);
2228
2229 for (Object value : values) {
2230 qPos.add(value);
2231 }
2232 }
2233
2234 List<Phone> list = q.list();
2235
2236 if (list.size() == 2) {
2237 return list.get(1);
2238 }
2239 else {
2240 return null;
2241 }
2242 }
2243
2244
2250 public List<Phone> findAll() throws SystemException {
2251 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2252 }
2253
2254
2266 public List<Phone> findAll(int start, int end) throws SystemException {
2267 return findAll(start, end, null);
2268 }
2269
2270
2283 public List<Phone> findAll(int start, int end,
2284 OrderByComparator orderByComparator) throws SystemException {
2285 Object[] finderArgs = new Object[] {
2286 String.valueOf(start), String.valueOf(end),
2287 String.valueOf(orderByComparator)
2288 };
2289
2290 List<Phone> list = (List<Phone>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
2291 finderArgs, this);
2292
2293 if (list == null) {
2294 StringBundler query = null;
2295 String sql = null;
2296
2297 if (orderByComparator != null) {
2298 query = new StringBundler(2 +
2299 (orderByComparator.getOrderByFields().length * 3));
2300
2301 query.append(_SQL_SELECT_PHONE);
2302
2303 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2304 orderByComparator);
2305
2306 sql = query.toString();
2307 }
2308 else {
2309 sql = _SQL_SELECT_PHONE.concat(PhoneModelImpl.ORDER_BY_JPQL);
2310 }
2311
2312 Session session = null;
2313
2314 try {
2315 session = openSession();
2316
2317 Query q = session.createQuery(sql);
2318
2319 if (orderByComparator == null) {
2320 list = (List<Phone>)QueryUtil.list(q, getDialect(), start,
2321 end, false);
2322
2323 Collections.sort(list);
2324 }
2325 else {
2326 list = (List<Phone>)QueryUtil.list(q, getDialect(), start,
2327 end);
2328 }
2329 }
2330 catch (Exception e) {
2331 throw processException(e);
2332 }
2333 finally {
2334 if (list == null) {
2335 FinderCacheUtil.removeResult(FINDER_PATH_FIND_ALL,
2336 finderArgs);
2337 }
2338 else {
2339 cacheResult(list);
2340
2341 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs,
2342 list);
2343 }
2344
2345 closeSession(session);
2346 }
2347 }
2348
2349 return list;
2350 }
2351
2352
2358 public void removeByCompanyId(long companyId) throws SystemException {
2359 for (Phone phone : findByCompanyId(companyId)) {
2360 remove(phone);
2361 }
2362 }
2363
2364
2370 public void removeByUserId(long userId) throws SystemException {
2371 for (Phone phone : findByUserId(userId)) {
2372 remove(phone);
2373 }
2374 }
2375
2376
2383 public void removeByC_C(long companyId, long classNameId)
2384 throws SystemException {
2385 for (Phone phone : findByC_C(companyId, classNameId)) {
2386 remove(phone);
2387 }
2388 }
2389
2390
2398 public void removeByC_C_C(long companyId, long classNameId, long classPK)
2399 throws SystemException {
2400 for (Phone phone : findByC_C_C(companyId, classNameId, classPK)) {
2401 remove(phone);
2402 }
2403 }
2404
2405
2414 public void removeByC_C_C_P(long companyId, long classNameId, long classPK,
2415 boolean primary) throws SystemException {
2416 for (Phone phone : findByC_C_C_P(companyId, classNameId, classPK,
2417 primary)) {
2418 remove(phone);
2419 }
2420 }
2421
2422
2427 public void removeAll() throws SystemException {
2428 for (Phone phone : findAll()) {
2429 remove(phone);
2430 }
2431 }
2432
2433
2440 public int countByCompanyId(long companyId) throws SystemException {
2441 Object[] finderArgs = new Object[] { companyId };
2442
2443 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
2444 finderArgs, this);
2445
2446 if (count == null) {
2447 StringBundler query = new StringBundler(2);
2448
2449 query.append(_SQL_COUNT_PHONE_WHERE);
2450
2451 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
2452
2453 String sql = query.toString();
2454
2455 Session session = null;
2456
2457 try {
2458 session = openSession();
2459
2460 Query q = session.createQuery(sql);
2461
2462 QueryPos qPos = QueryPos.getInstance(q);
2463
2464 qPos.add(companyId);
2465
2466 count = (Long)q.uniqueResult();
2467 }
2468 catch (Exception e) {
2469 throw processException(e);
2470 }
2471 finally {
2472 if (count == null) {
2473 count = Long.valueOf(0);
2474 }
2475
2476 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
2477 finderArgs, count);
2478
2479 closeSession(session);
2480 }
2481 }
2482
2483 return count.intValue();
2484 }
2485
2486
2493 public int countByUserId(long userId) throws SystemException {
2494 Object[] finderArgs = new Object[] { userId };
2495
2496 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERID,
2497 finderArgs, this);
2498
2499 if (count == null) {
2500 StringBundler query = new StringBundler(2);
2501
2502 query.append(_SQL_COUNT_PHONE_WHERE);
2503
2504 query.append(_FINDER_COLUMN_USERID_USERID_2);
2505
2506 String sql = query.toString();
2507
2508 Session session = null;
2509
2510 try {
2511 session = openSession();
2512
2513 Query q = session.createQuery(sql);
2514
2515 QueryPos qPos = QueryPos.getInstance(q);
2516
2517 qPos.add(userId);
2518
2519 count = (Long)q.uniqueResult();
2520 }
2521 catch (Exception e) {
2522 throw processException(e);
2523 }
2524 finally {
2525 if (count == null) {
2526 count = Long.valueOf(0);
2527 }
2528
2529 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERID,
2530 finderArgs, count);
2531
2532 closeSession(session);
2533 }
2534 }
2535
2536 return count.intValue();
2537 }
2538
2539
2547 public int countByC_C(long companyId, long classNameId)
2548 throws SystemException {
2549 Object[] finderArgs = new Object[] { companyId, classNameId };
2550
2551 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C,
2552 finderArgs, this);
2553
2554 if (count == null) {
2555 StringBundler query = new StringBundler(3);
2556
2557 query.append(_SQL_COUNT_PHONE_WHERE);
2558
2559 query.append(_FINDER_COLUMN_C_C_COMPANYID_2);
2560
2561 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
2562
2563 String sql = query.toString();
2564
2565 Session session = null;
2566
2567 try {
2568 session = openSession();
2569
2570 Query q = session.createQuery(sql);
2571
2572 QueryPos qPos = QueryPos.getInstance(q);
2573
2574 qPos.add(companyId);
2575
2576 qPos.add(classNameId);
2577
2578 count = (Long)q.uniqueResult();
2579 }
2580 catch (Exception e) {
2581 throw processException(e);
2582 }
2583 finally {
2584 if (count == null) {
2585 count = Long.valueOf(0);
2586 }
2587
2588 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, finderArgs,
2589 count);
2590
2591 closeSession(session);
2592 }
2593 }
2594
2595 return count.intValue();
2596 }
2597
2598
2607 public int countByC_C_C(long companyId, long classNameId, long classPK)
2608 throws SystemException {
2609 Object[] finderArgs = new Object[] { companyId, classNameId, classPK };
2610
2611 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C_C,
2612 finderArgs, this);
2613
2614 if (count == null) {
2615 StringBundler query = new StringBundler(4);
2616
2617 query.append(_SQL_COUNT_PHONE_WHERE);
2618
2619 query.append(_FINDER_COLUMN_C_C_C_COMPANYID_2);
2620
2621 query.append(_FINDER_COLUMN_C_C_C_CLASSNAMEID_2);
2622
2623 query.append(_FINDER_COLUMN_C_C_C_CLASSPK_2);
2624
2625 String sql = query.toString();
2626
2627 Session session = null;
2628
2629 try {
2630 session = openSession();
2631
2632 Query q = session.createQuery(sql);
2633
2634 QueryPos qPos = QueryPos.getInstance(q);
2635
2636 qPos.add(companyId);
2637
2638 qPos.add(classNameId);
2639
2640 qPos.add(classPK);
2641
2642 count = (Long)q.uniqueResult();
2643 }
2644 catch (Exception e) {
2645 throw processException(e);
2646 }
2647 finally {
2648 if (count == null) {
2649 count = Long.valueOf(0);
2650 }
2651
2652 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C_C,
2653 finderArgs, count);
2654
2655 closeSession(session);
2656 }
2657 }
2658
2659 return count.intValue();
2660 }
2661
2662
2672 public int countByC_C_C_P(long companyId, long classNameId, long classPK,
2673 boolean primary) throws SystemException {
2674 Object[] finderArgs = new Object[] {
2675 companyId, classNameId, classPK, primary
2676 };
2677
2678 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C_C_P,
2679 finderArgs, this);
2680
2681 if (count == null) {
2682 StringBundler query = new StringBundler(5);
2683
2684 query.append(_SQL_COUNT_PHONE_WHERE);
2685
2686 query.append(_FINDER_COLUMN_C_C_C_P_COMPANYID_2);
2687
2688 query.append(_FINDER_COLUMN_C_C_C_P_CLASSNAMEID_2);
2689
2690 query.append(_FINDER_COLUMN_C_C_C_P_CLASSPK_2);
2691
2692 query.append(_FINDER_COLUMN_C_C_C_P_PRIMARY_2);
2693
2694 String sql = query.toString();
2695
2696 Session session = null;
2697
2698 try {
2699 session = openSession();
2700
2701 Query q = session.createQuery(sql);
2702
2703 QueryPos qPos = QueryPos.getInstance(q);
2704
2705 qPos.add(companyId);
2706
2707 qPos.add(classNameId);
2708
2709 qPos.add(classPK);
2710
2711 qPos.add(primary);
2712
2713 count = (Long)q.uniqueResult();
2714 }
2715 catch (Exception e) {
2716 throw processException(e);
2717 }
2718 finally {
2719 if (count == null) {
2720 count = Long.valueOf(0);
2721 }
2722
2723 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C_C_P,
2724 finderArgs, count);
2725
2726 closeSession(session);
2727 }
2728 }
2729
2730 return count.intValue();
2731 }
2732
2733
2739 public int countAll() throws SystemException {
2740 Object[] finderArgs = new Object[0];
2741
2742 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2743 finderArgs, this);
2744
2745 if (count == null) {
2746 Session session = null;
2747
2748 try {
2749 session = openSession();
2750
2751 Query q = session.createQuery(_SQL_COUNT_PHONE);
2752
2753 count = (Long)q.uniqueResult();
2754 }
2755 catch (Exception e) {
2756 throw processException(e);
2757 }
2758 finally {
2759 if (count == null) {
2760 count = Long.valueOf(0);
2761 }
2762
2763 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
2764 count);
2765
2766 closeSession(session);
2767 }
2768 }
2769
2770 return count.intValue();
2771 }
2772
2773
2776 public void afterPropertiesSet() {
2777 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2778 com.liferay.portal.util.PropsUtil.get(
2779 "value.object.listener.com.liferay.portal.model.Phone")));
2780
2781 if (listenerClassNames.length > 0) {
2782 try {
2783 List<ModelListener<Phone>> listenersList = new ArrayList<ModelListener<Phone>>();
2784
2785 for (String listenerClassName : listenerClassNames) {
2786 listenersList.add((ModelListener<Phone>)InstanceFactory.newInstance(
2787 listenerClassName));
2788 }
2789
2790 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2791 }
2792 catch (Exception e) {
2793 _log.error(e);
2794 }
2795 }
2796 }
2797
2798 public void destroy() {
2799 EntityCacheUtil.removeCache(PhoneImpl.class.getName());
2800 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
2801 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST);
2802 }
2803
2804 @BeanReference(type = AccountPersistence.class)
2805 protected AccountPersistence accountPersistence;
2806 @BeanReference(type = AddressPersistence.class)
2807 protected AddressPersistence addressPersistence;
2808 @BeanReference(type = BrowserTrackerPersistence.class)
2809 protected BrowserTrackerPersistence browserTrackerPersistence;
2810 @BeanReference(type = ClassNamePersistence.class)
2811 protected ClassNamePersistence classNamePersistence;
2812 @BeanReference(type = ClusterGroupPersistence.class)
2813 protected ClusterGroupPersistence clusterGroupPersistence;
2814 @BeanReference(type = CompanyPersistence.class)
2815 protected CompanyPersistence companyPersistence;
2816 @BeanReference(type = ContactPersistence.class)
2817 protected ContactPersistence contactPersistence;
2818 @BeanReference(type = CountryPersistence.class)
2819 protected CountryPersistence countryPersistence;
2820 @BeanReference(type = EmailAddressPersistence.class)
2821 protected EmailAddressPersistence emailAddressPersistence;
2822 @BeanReference(type = GroupPersistence.class)
2823 protected GroupPersistence groupPersistence;
2824 @BeanReference(type = ImagePersistence.class)
2825 protected ImagePersistence imagePersistence;
2826 @BeanReference(type = LayoutPersistence.class)
2827 protected LayoutPersistence layoutPersistence;
2828 @BeanReference(type = LayoutPrototypePersistence.class)
2829 protected LayoutPrototypePersistence layoutPrototypePersistence;
2830 @BeanReference(type = LayoutSetPersistence.class)
2831 protected LayoutSetPersistence layoutSetPersistence;
2832 @BeanReference(type = LayoutSetPrototypePersistence.class)
2833 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
2834 @BeanReference(type = ListTypePersistence.class)
2835 protected ListTypePersistence listTypePersistence;
2836 @BeanReference(type = LockPersistence.class)
2837 protected LockPersistence lockPersistence;
2838 @BeanReference(type = MembershipRequestPersistence.class)
2839 protected MembershipRequestPersistence membershipRequestPersistence;
2840 @BeanReference(type = OrganizationPersistence.class)
2841 protected OrganizationPersistence organizationPersistence;
2842 @BeanReference(type = OrgGroupPermissionPersistence.class)
2843 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
2844 @BeanReference(type = OrgGroupRolePersistence.class)
2845 protected OrgGroupRolePersistence orgGroupRolePersistence;
2846 @BeanReference(type = OrgLaborPersistence.class)
2847 protected OrgLaborPersistence orgLaborPersistence;
2848 @BeanReference(type = PasswordPolicyPersistence.class)
2849 protected PasswordPolicyPersistence passwordPolicyPersistence;
2850 @BeanReference(type = PasswordPolicyRelPersistence.class)
2851 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
2852 @BeanReference(type = PasswordTrackerPersistence.class)
2853 protected PasswordTrackerPersistence passwordTrackerPersistence;
2854 @BeanReference(type = PermissionPersistence.class)
2855 protected PermissionPersistence permissionPersistence;
2856 @BeanReference(type = PhonePersistence.class)
2857 protected PhonePersistence phonePersistence;
2858 @BeanReference(type = PluginSettingPersistence.class)
2859 protected PluginSettingPersistence pluginSettingPersistence;
2860 @BeanReference(type = PortletPersistence.class)
2861 protected PortletPersistence portletPersistence;
2862 @BeanReference(type = PortletItemPersistence.class)
2863 protected PortletItemPersistence portletItemPersistence;
2864 @BeanReference(type = PortletPreferencesPersistence.class)
2865 protected PortletPreferencesPersistence portletPreferencesPersistence;
2866 @BeanReference(type = RegionPersistence.class)
2867 protected RegionPersistence regionPersistence;
2868 @BeanReference(type = ReleasePersistence.class)
2869 protected ReleasePersistence releasePersistence;
2870 @BeanReference(type = ResourcePersistence.class)
2871 protected ResourcePersistence resourcePersistence;
2872 @BeanReference(type = ResourceActionPersistence.class)
2873 protected ResourceActionPersistence resourceActionPersistence;
2874 @BeanReference(type = ResourceCodePersistence.class)
2875 protected ResourceCodePersistence resourceCodePersistence;
2876 @BeanReference(type = ResourcePermissionPersistence.class)
2877 protected ResourcePermissionPersistence resourcePermissionPersistence;
2878 @BeanReference(type = RolePersistence.class)
2879 protected RolePersistence rolePersistence;
2880 @BeanReference(type = ServiceComponentPersistence.class)
2881 protected ServiceComponentPersistence serviceComponentPersistence;
2882 @BeanReference(type = ShardPersistence.class)
2883 protected ShardPersistence shardPersistence;
2884 @BeanReference(type = SubscriptionPersistence.class)
2885 protected SubscriptionPersistence subscriptionPersistence;
2886 @BeanReference(type = TicketPersistence.class)
2887 protected TicketPersistence ticketPersistence;
2888 @BeanReference(type = TeamPersistence.class)
2889 protected TeamPersistence teamPersistence;
2890 @BeanReference(type = UserPersistence.class)
2891 protected UserPersistence userPersistence;
2892 @BeanReference(type = UserGroupPersistence.class)
2893 protected UserGroupPersistence userGroupPersistence;
2894 @BeanReference(type = UserGroupGroupRolePersistence.class)
2895 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
2896 @BeanReference(type = UserGroupRolePersistence.class)
2897 protected UserGroupRolePersistence userGroupRolePersistence;
2898 @BeanReference(type = UserIdMapperPersistence.class)
2899 protected UserIdMapperPersistence userIdMapperPersistence;
2900 @BeanReference(type = UserTrackerPersistence.class)
2901 protected UserTrackerPersistence userTrackerPersistence;
2902 @BeanReference(type = UserTrackerPathPersistence.class)
2903 protected UserTrackerPathPersistence userTrackerPathPersistence;
2904 @BeanReference(type = WebDAVPropsPersistence.class)
2905 protected WebDAVPropsPersistence webDAVPropsPersistence;
2906 @BeanReference(type = WebsitePersistence.class)
2907 protected WebsitePersistence websitePersistence;
2908 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
2909 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
2910 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
2911 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
2912 private static final String _SQL_SELECT_PHONE = "SELECT phone FROM Phone phone";
2913 private static final String _SQL_SELECT_PHONE_WHERE = "SELECT phone FROM Phone phone WHERE ";
2914 private static final String _SQL_COUNT_PHONE = "SELECT COUNT(phone) FROM Phone phone";
2915 private static final String _SQL_COUNT_PHONE_WHERE = "SELECT COUNT(phone) FROM Phone phone WHERE ";
2916 private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "phone.companyId = ?";
2917 private static final String _FINDER_COLUMN_USERID_USERID_2 = "phone.userId = ?";
2918 private static final String _FINDER_COLUMN_C_C_COMPANYID_2 = "phone.companyId = ? AND ";
2919 private static final String _FINDER_COLUMN_C_C_CLASSNAMEID_2 = "phone.classNameId = ?";
2920 private static final String _FINDER_COLUMN_C_C_C_COMPANYID_2 = "phone.companyId = ? AND ";
2921 private static final String _FINDER_COLUMN_C_C_C_CLASSNAMEID_2 = "phone.classNameId = ? AND ";
2922 private static final String _FINDER_COLUMN_C_C_C_CLASSPK_2 = "phone.classPK = ?";
2923 private static final String _FINDER_COLUMN_C_C_C_P_COMPANYID_2 = "phone.companyId = ? AND ";
2924 private static final String _FINDER_COLUMN_C_C_C_P_CLASSNAMEID_2 = "phone.classNameId = ? AND ";
2925 private static final String _FINDER_COLUMN_C_C_C_P_CLASSPK_2 = "phone.classPK = ? AND ";
2926 private static final String _FINDER_COLUMN_C_C_C_P_PRIMARY_2 = "phone.primary = ?";
2927 private static final String _ORDER_BY_ENTITY_ALIAS = "phone.";
2928 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Phone exists with the primary key ";
2929 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Phone exists with the key {";
2930 private static Log _log = LogFactoryUtil.getLog(PhonePersistenceImpl.class);
2931 }