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