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