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