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