1   /**
2    * Copyright (c) 2000-2010 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   *
12   * 
13   */
14  
15  package com.liferay.portal.service.persistence;
16  
17  import com.liferay.portal.NoSuchContactException;
18  import com.liferay.portal.NoSuchModelException;
19  import com.liferay.portal.SystemException;
20  import com.liferay.portal.kernel.annotation.BeanReference;
21  import com.liferay.portal.kernel.cache.CacheRegistry;
22  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
23  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
24  import com.liferay.portal.kernel.dao.orm.FinderPath;
25  import com.liferay.portal.kernel.dao.orm.Query;
26  import com.liferay.portal.kernel.dao.orm.QueryPos;
27  import com.liferay.portal.kernel.dao.orm.QueryUtil;
28  import com.liferay.portal.kernel.dao.orm.Session;
29  import com.liferay.portal.kernel.log.Log;
30  import com.liferay.portal.kernel.log.LogFactoryUtil;
31  import com.liferay.portal.kernel.util.GetterUtil;
32  import com.liferay.portal.kernel.util.OrderByComparator;
33  import com.liferay.portal.kernel.util.StringBundler;
34  import com.liferay.portal.kernel.util.StringPool;
35  import com.liferay.portal.kernel.util.StringUtil;
36  import com.liferay.portal.model.Contact;
37  import com.liferay.portal.model.ModelListener;
38  import com.liferay.portal.model.impl.ContactImpl;
39  import com.liferay.portal.model.impl.ContactModelImpl;
40  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
41  
42  import java.io.Serializable;
43  
44  import java.util.ArrayList;
45  import java.util.Collections;
46  import java.util.List;
47  
48  /**
49   * <a href="ContactPersistenceImpl.java.html"><b><i>View Source</i></b></a>
50   *
51   * <p>
52   * ServiceBuilder generated this class. Modifications in this class will be
53   * overwritten the next time is generated.
54   * </p>
55   *
56   * @author    Brian Wing Shun Chan
57   * @see       ContactPersistence
58   * @see       ContactUtil
59   * @generated
60   */
61  public class ContactPersistenceImpl extends BasePersistenceImpl<Contact>
62      implements ContactPersistence {
63      public static final String FINDER_CLASS_NAME_ENTITY = ContactImpl.class.getName();
64      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
65          ".List";
66      public static final FinderPath FINDER_PATH_FIND_BY_COMPANYID = new FinderPath(ContactModelImpl.ENTITY_CACHE_ENABLED,
67              ContactModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
68              "findByCompanyId", new String[] { Long.class.getName() });
69      public static final FinderPath FINDER_PATH_FIND_BY_OBC_COMPANYID = new FinderPath(ContactModelImpl.ENTITY_CACHE_ENABLED,
70              ContactModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
71              "findByCompanyId",
72              new String[] {
73                  Long.class.getName(),
74                  
75              "java.lang.Integer", "java.lang.Integer",
76                  "com.liferay.portal.kernel.util.OrderByComparator"
77              });
78      public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(ContactModelImpl.ENTITY_CACHE_ENABLED,
79              ContactModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
80              "countByCompanyId", new String[] { Long.class.getName() });
81      public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(ContactModelImpl.ENTITY_CACHE_ENABLED,
82              ContactModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
83              "findAll", new String[0]);
84      public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(ContactModelImpl.ENTITY_CACHE_ENABLED,
85              ContactModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
86              "countAll", new String[0]);
87  
88      public void cacheResult(Contact contact) {
89          EntityCacheUtil.putResult(ContactModelImpl.ENTITY_CACHE_ENABLED,
90              ContactImpl.class, contact.getPrimaryKey(), contact);
91      }
92  
93      public void cacheResult(List<Contact> contacts) {
94          for (Contact contact : contacts) {
95              if (EntityCacheUtil.getResult(
96                          ContactModelImpl.ENTITY_CACHE_ENABLED,
97                          ContactImpl.class, contact.getPrimaryKey(), this) == null) {
98                  cacheResult(contact);
99              }
100         }
101     }
102 
103     public void clearCache() {
104         CacheRegistry.clear(ContactImpl.class.getName());
105         EntityCacheUtil.clearCache(ContactImpl.class.getName());
106         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
107         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
108     }
109 
110     public Contact create(long contactId) {
111         Contact contact = new ContactImpl();
112 
113         contact.setNew(true);
114         contact.setPrimaryKey(contactId);
115 
116         return contact;
117     }
118 
119     public Contact remove(Serializable primaryKey)
120         throws NoSuchModelException, SystemException {
121         return remove(((Long)primaryKey).longValue());
122     }
123 
124     public Contact remove(long contactId)
125         throws NoSuchContactException, SystemException {
126         Session session = null;
127 
128         try {
129             session = openSession();
130 
131             Contact contact = (Contact)session.get(ContactImpl.class,
132                     new Long(contactId));
133 
134             if (contact == null) {
135                 if (_log.isWarnEnabled()) {
136                     _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + contactId);
137                 }
138 
139                 throw new NoSuchContactException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
140                     contactId);
141             }
142 
143             return remove(contact);
144         }
145         catch (NoSuchContactException nsee) {
146             throw nsee;
147         }
148         catch (Exception e) {
149             throw processException(e);
150         }
151         finally {
152             closeSession(session);
153         }
154     }
155 
156     public Contact remove(Contact contact) throws SystemException {
157         for (ModelListener<Contact> listener : listeners) {
158             listener.onBeforeRemove(contact);
159         }
160 
161         contact = removeImpl(contact);
162 
163         for (ModelListener<Contact> listener : listeners) {
164             listener.onAfterRemove(contact);
165         }
166 
167         return contact;
168     }
169 
170     protected Contact removeImpl(Contact contact) throws SystemException {
171         contact = toUnwrappedModel(contact);
172 
173         Session session = null;
174 
175         try {
176             session = openSession();
177 
178             if (contact.isCachedModel() || BatchSessionUtil.isEnabled()) {
179                 Object staleObject = session.get(ContactImpl.class,
180                         contact.getPrimaryKeyObj());
181 
182                 if (staleObject != null) {
183                     session.evict(staleObject);
184                 }
185             }
186 
187             session.delete(contact);
188 
189             session.flush();
190         }
191         catch (Exception e) {
192             throw processException(e);
193         }
194         finally {
195             closeSession(session);
196         }
197 
198         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
199 
200         EntityCacheUtil.removeResult(ContactModelImpl.ENTITY_CACHE_ENABLED,
201             ContactImpl.class, contact.getPrimaryKey());
202 
203         return contact;
204     }
205 
206     /**
207      * @deprecated Use {@link BasePersistence#update(com.liferay.portal.model.BaseModel, boolean)}.
208      */
209     public Contact update(Contact contact) throws SystemException {
210         if (_log.isWarnEnabled()) {
211             _log.warn(
212                 "Using the deprecated update(Contact contact) method. Use update(Contact contact, boolean merge) instead.");
213         }
214 
215         return update(contact, false);
216     }
217 
218     public Contact updateImpl(com.liferay.portal.model.Contact contact,
219         boolean merge) throws SystemException {
220         contact = toUnwrappedModel(contact);
221 
222         Session session = null;
223 
224         try {
225             session = openSession();
226 
227             BatchSessionUtil.update(session, contact, merge);
228 
229             contact.setNew(false);
230         }
231         catch (Exception e) {
232             throw processException(e);
233         }
234         finally {
235             closeSession(session);
236         }
237 
238         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
239 
240         EntityCacheUtil.putResult(ContactModelImpl.ENTITY_CACHE_ENABLED,
241             ContactImpl.class, contact.getPrimaryKey(), contact);
242 
243         return contact;
244     }
245 
246     protected Contact toUnwrappedModel(Contact contact) {
247         if (contact instanceof ContactImpl) {
248             return contact;
249         }
250 
251         ContactImpl contactImpl = new ContactImpl();
252 
253         contactImpl.setNew(contact.isNew());
254         contactImpl.setPrimaryKey(contact.getPrimaryKey());
255 
256         contactImpl.setContactId(contact.getContactId());
257         contactImpl.setCompanyId(contact.getCompanyId());
258         contactImpl.setUserId(contact.getUserId());
259         contactImpl.setUserName(contact.getUserName());
260         contactImpl.setCreateDate(contact.getCreateDate());
261         contactImpl.setModifiedDate(contact.getModifiedDate());
262         contactImpl.setAccountId(contact.getAccountId());
263         contactImpl.setParentContactId(contact.getParentContactId());
264         contactImpl.setFirstName(contact.getFirstName());
265         contactImpl.setMiddleName(contact.getMiddleName());
266         contactImpl.setLastName(contact.getLastName());
267         contactImpl.setPrefixId(contact.getPrefixId());
268         contactImpl.setSuffixId(contact.getSuffixId());
269         contactImpl.setMale(contact.isMale());
270         contactImpl.setBirthday(contact.getBirthday());
271         contactImpl.setSmsSn(contact.getSmsSn());
272         contactImpl.setAimSn(contact.getAimSn());
273         contactImpl.setFacebookSn(contact.getFacebookSn());
274         contactImpl.setIcqSn(contact.getIcqSn());
275         contactImpl.setJabberSn(contact.getJabberSn());
276         contactImpl.setMsnSn(contact.getMsnSn());
277         contactImpl.setMySpaceSn(contact.getMySpaceSn());
278         contactImpl.setSkypeSn(contact.getSkypeSn());
279         contactImpl.setTwitterSn(contact.getTwitterSn());
280         contactImpl.setYmSn(contact.getYmSn());
281         contactImpl.setEmployeeStatusId(contact.getEmployeeStatusId());
282         contactImpl.setEmployeeNumber(contact.getEmployeeNumber());
283         contactImpl.setJobTitle(contact.getJobTitle());
284         contactImpl.setJobClass(contact.getJobClass());
285         contactImpl.setHoursOfOperation(contact.getHoursOfOperation());
286 
287         return contactImpl;
288     }
289 
290     public Contact findByPrimaryKey(Serializable primaryKey)
291         throws NoSuchModelException, SystemException {
292         return findByPrimaryKey(((Long)primaryKey).longValue());
293     }
294 
295     public Contact findByPrimaryKey(long contactId)
296         throws NoSuchContactException, SystemException {
297         Contact contact = fetchByPrimaryKey(contactId);
298 
299         if (contact == null) {
300             if (_log.isWarnEnabled()) {
301                 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + contactId);
302             }
303 
304             throw new NoSuchContactException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
305                 contactId);
306         }
307 
308         return contact;
309     }
310 
311     public Contact fetchByPrimaryKey(Serializable primaryKey)
312         throws SystemException {
313         return fetchByPrimaryKey(((Long)primaryKey).longValue());
314     }
315 
316     public Contact fetchByPrimaryKey(long contactId) throws SystemException {
317         Contact contact = (Contact)EntityCacheUtil.getResult(ContactModelImpl.ENTITY_CACHE_ENABLED,
318                 ContactImpl.class, contactId, this);
319 
320         if (contact == null) {
321             Session session = null;
322 
323             try {
324                 session = openSession();
325 
326                 contact = (Contact)session.get(ContactImpl.class,
327                         new Long(contactId));
328             }
329             catch (Exception e) {
330                 throw processException(e);
331             }
332             finally {
333                 if (contact != null) {
334                     cacheResult(contact);
335                 }
336 
337                 closeSession(session);
338             }
339         }
340 
341         return contact;
342     }
343 
344     public List<Contact> findByCompanyId(long companyId)
345         throws SystemException {
346         Object[] finderArgs = new Object[] { new Long(companyId) };
347 
348         List<Contact> list = (List<Contact>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
349                 finderArgs, this);
350 
351         if (list == null) {
352             Session session = null;
353 
354             try {
355                 session = openSession();
356 
357                 StringBundler query = new StringBundler(2);
358 
359                 query.append(_SQL_SELECT_CONTACT_WHERE);
360 
361                 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
362 
363                 String sql = query.toString();
364 
365                 Query q = session.createQuery(sql);
366 
367                 QueryPos qPos = QueryPos.getInstance(q);
368 
369                 qPos.add(companyId);
370 
371                 list = q.list();
372             }
373             catch (Exception e) {
374                 throw processException(e);
375             }
376             finally {
377                 if (list == null) {
378                     list = new ArrayList<Contact>();
379                 }
380 
381                 cacheResult(list);
382 
383                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
384                     finderArgs, list);
385 
386                 closeSession(session);
387             }
388         }
389 
390         return list;
391     }
392 
393     public List<Contact> findByCompanyId(long companyId, int start, int end)
394         throws SystemException {
395         return findByCompanyId(companyId, start, end, null);
396     }
397 
398     public List<Contact> findByCompanyId(long companyId, int start, int end,
399         OrderByComparator orderByComparator) throws SystemException {
400         Object[] finderArgs = new Object[] {
401                 new Long(companyId),
402                 
403                 String.valueOf(start), String.valueOf(end),
404                 String.valueOf(orderByComparator)
405             };
406 
407         List<Contact> list = (List<Contact>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_COMPANYID,
408                 finderArgs, this);
409 
410         if (list == null) {
411             Session session = null;
412 
413             try {
414                 session = openSession();
415 
416                 StringBundler query = null;
417 
418                 if (orderByComparator != null) {
419                     query = new StringBundler(3 +
420                             (orderByComparator.getOrderByFields().length * 3));
421                 }
422                 else {
423                     query = new StringBundler(2);
424                 }
425 
426                 query.append(_SQL_SELECT_CONTACT_WHERE);
427 
428                 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
429 
430                 if (orderByComparator != null) {
431                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
432                         orderByComparator);
433                 }
434 
435                 String sql = query.toString();
436 
437                 Query q = session.createQuery(sql);
438 
439                 QueryPos qPos = QueryPos.getInstance(q);
440 
441                 qPos.add(companyId);
442 
443                 list = (List<Contact>)QueryUtil.list(q, getDialect(), start, end);
444             }
445             catch (Exception e) {
446                 throw processException(e);
447             }
448             finally {
449                 if (list == null) {
450                     list = new ArrayList<Contact>();
451                 }
452 
453                 cacheResult(list);
454 
455                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_COMPANYID,
456                     finderArgs, list);
457 
458                 closeSession(session);
459             }
460         }
461 
462         return list;
463     }
464 
465     public Contact findByCompanyId_First(long companyId,
466         OrderByComparator orderByComparator)
467         throws NoSuchContactException, SystemException {
468         List<Contact> list = findByCompanyId(companyId, 0, 1, orderByComparator);
469 
470         if (list.isEmpty()) {
471             StringBundler msg = new StringBundler(4);
472 
473             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
474 
475             msg.append("companyId=");
476             msg.append(companyId);
477 
478             msg.append(StringPool.CLOSE_CURLY_BRACE);
479 
480             throw new NoSuchContactException(msg.toString());
481         }
482         else {
483             return list.get(0);
484         }
485     }
486 
487     public Contact findByCompanyId_Last(long companyId,
488         OrderByComparator orderByComparator)
489         throws NoSuchContactException, SystemException {
490         int count = countByCompanyId(companyId);
491 
492         List<Contact> list = findByCompanyId(companyId, count - 1, count,
493                 orderByComparator);
494 
495         if (list.isEmpty()) {
496             StringBundler msg = new StringBundler(4);
497 
498             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
499 
500             msg.append("companyId=");
501             msg.append(companyId);
502 
503             msg.append(StringPool.CLOSE_CURLY_BRACE);
504 
505             throw new NoSuchContactException(msg.toString());
506         }
507         else {
508             return list.get(0);
509         }
510     }
511 
512     public Contact[] findByCompanyId_PrevAndNext(long contactId,
513         long companyId, OrderByComparator orderByComparator)
514         throws NoSuchContactException, SystemException {
515         Contact contact = findByPrimaryKey(contactId);
516 
517         int count = countByCompanyId(companyId);
518 
519         Session session = null;
520 
521         try {
522             session = openSession();
523 
524             StringBundler query = null;
525 
526             if (orderByComparator != null) {
527                 query = new StringBundler(3 +
528                         (orderByComparator.getOrderByFields().length * 3));
529             }
530             else {
531                 query = new StringBundler(2);
532             }
533 
534             query.append(_SQL_SELECT_CONTACT_WHERE);
535 
536             query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
537 
538             if (orderByComparator != null) {
539                 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
540                     orderByComparator);
541             }
542 
543             String sql = query.toString();
544 
545             Query q = session.createQuery(sql);
546 
547             QueryPos qPos = QueryPos.getInstance(q);
548 
549             qPos.add(companyId);
550 
551             Object[] objArray = QueryUtil.getPrevAndNext(q, count,
552                     orderByComparator, contact);
553 
554             Contact[] array = new ContactImpl[3];
555 
556             array[0] = (Contact)objArray[0];
557             array[1] = (Contact)objArray[1];
558             array[2] = (Contact)objArray[2];
559 
560             return array;
561         }
562         catch (Exception e) {
563             throw processException(e);
564         }
565         finally {
566             closeSession(session);
567         }
568     }
569 
570     public List<Contact> findAll() throws SystemException {
571         return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
572     }
573 
574     public List<Contact> findAll(int start, int end) throws SystemException {
575         return findAll(start, end, null);
576     }
577 
578     public List<Contact> findAll(int start, int end,
579         OrderByComparator orderByComparator) throws SystemException {
580         Object[] finderArgs = new Object[] {
581                 String.valueOf(start), String.valueOf(end),
582                 String.valueOf(orderByComparator)
583             };
584 
585         List<Contact> list = (List<Contact>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
586                 finderArgs, this);
587 
588         if (list == null) {
589             Session session = null;
590 
591             try {
592                 session = openSession();
593 
594                 StringBundler query = null;
595                 String sql = null;
596 
597                 if (orderByComparator != null) {
598                     query = new StringBundler(2 +
599                             (orderByComparator.getOrderByFields().length * 3));
600 
601                     query.append(_SQL_SELECT_CONTACT);
602 
603                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
604                         orderByComparator);
605 
606                     sql = query.toString();
607                 }
608 
609                 sql = _SQL_SELECT_CONTACT;
610 
611                 Query q = session.createQuery(sql);
612 
613                 if (orderByComparator == null) {
614                     list = (List<Contact>)QueryUtil.list(q, getDialect(),
615                             start, end, false);
616 
617                     Collections.sort(list);
618                 }
619                 else {
620                     list = (List<Contact>)QueryUtil.list(q, getDialect(),
621                             start, end);
622                 }
623             }
624             catch (Exception e) {
625                 throw processException(e);
626             }
627             finally {
628                 if (list == null) {
629                     list = new ArrayList<Contact>();
630                 }
631 
632                 cacheResult(list);
633 
634                 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
635 
636                 closeSession(session);
637             }
638         }
639 
640         return list;
641     }
642 
643     public void removeByCompanyId(long companyId) throws SystemException {
644         for (Contact contact : findByCompanyId(companyId)) {
645             remove(contact);
646         }
647     }
648 
649     public void removeAll() throws SystemException {
650         for (Contact contact : findAll()) {
651             remove(contact);
652         }
653     }
654 
655     public int countByCompanyId(long companyId) throws SystemException {
656         Object[] finderArgs = new Object[] { new Long(companyId) };
657 
658         Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
659                 finderArgs, this);
660 
661         if (count == null) {
662             Session session = null;
663 
664             try {
665                 session = openSession();
666 
667                 StringBundler query = new StringBundler(2);
668 
669                 query.append(_SQL_COUNT_CONTACT_WHERE);
670 
671                 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
672 
673                 String sql = query.toString();
674 
675                 Query q = session.createQuery(sql);
676 
677                 QueryPos qPos = QueryPos.getInstance(q);
678 
679                 qPos.add(companyId);
680 
681                 count = (Long)q.uniqueResult();
682             }
683             catch (Exception e) {
684                 throw processException(e);
685             }
686             finally {
687                 if (count == null) {
688                     count = Long.valueOf(0);
689                 }
690 
691                 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
692                     finderArgs, count);
693 
694                 closeSession(session);
695             }
696         }
697 
698         return count.intValue();
699     }
700 
701     public int countAll() throws SystemException {
702         Object[] finderArgs = new Object[0];
703 
704         Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
705                 finderArgs, this);
706 
707         if (count == null) {
708             Session session = null;
709 
710             try {
711                 session = openSession();
712 
713                 Query q = session.createQuery(_SQL_COUNT_CONTACT);
714 
715                 count = (Long)q.uniqueResult();
716             }
717             catch (Exception e) {
718                 throw processException(e);
719             }
720             finally {
721                 if (count == null) {
722                     count = Long.valueOf(0);
723                 }
724 
725                 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
726                     count);
727 
728                 closeSession(session);
729             }
730         }
731 
732         return count.intValue();
733     }
734 
735     public void afterPropertiesSet() {
736         String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
737                     com.liferay.portal.util.PropsUtil.get(
738                         "value.object.listener.com.liferay.portal.model.Contact")));
739 
740         if (listenerClassNames.length > 0) {
741             try {
742                 List<ModelListener<Contact>> listenersList = new ArrayList<ModelListener<Contact>>();
743 
744                 for (String listenerClassName : listenerClassNames) {
745                     listenersList.add((ModelListener<Contact>)Class.forName(
746                             listenerClassName).newInstance());
747                 }
748 
749                 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
750             }
751             catch (Exception e) {
752                 _log.error(e);
753             }
754         }
755     }
756 
757     @BeanReference(type = AccountPersistence.class)
758     protected AccountPersistence accountPersistence;
759     @BeanReference(type = AddressPersistence.class)
760     protected AddressPersistence addressPersistence;
761     @BeanReference(type = BrowserTrackerPersistence.class)
762     protected BrowserTrackerPersistence browserTrackerPersistence;
763     @BeanReference(type = ClassNamePersistence.class)
764     protected ClassNamePersistence classNamePersistence;
765     @BeanReference(type = CompanyPersistence.class)
766     protected CompanyPersistence companyPersistence;
767     @BeanReference(type = ContactPersistence.class)
768     protected ContactPersistence contactPersistence;
769     @BeanReference(type = CountryPersistence.class)
770     protected CountryPersistence countryPersistence;
771     @BeanReference(type = EmailAddressPersistence.class)
772     protected EmailAddressPersistence emailAddressPersistence;
773     @BeanReference(type = GroupPersistence.class)
774     protected GroupPersistence groupPersistence;
775     @BeanReference(type = ImagePersistence.class)
776     protected ImagePersistence imagePersistence;
777     @BeanReference(type = LayoutPersistence.class)
778     protected LayoutPersistence layoutPersistence;
779     @BeanReference(type = LayoutSetPersistence.class)
780     protected LayoutSetPersistence layoutSetPersistence;
781     @BeanReference(type = ListTypePersistence.class)
782     protected ListTypePersistence listTypePersistence;
783     @BeanReference(type = LockPersistence.class)
784     protected LockPersistence lockPersistence;
785     @BeanReference(type = MembershipRequestPersistence.class)
786     protected MembershipRequestPersistence membershipRequestPersistence;
787     @BeanReference(type = OrganizationPersistence.class)
788     protected OrganizationPersistence organizationPersistence;
789     @BeanReference(type = OrgGroupPermissionPersistence.class)
790     protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
791     @BeanReference(type = OrgGroupRolePersistence.class)
792     protected OrgGroupRolePersistence orgGroupRolePersistence;
793     @BeanReference(type = OrgLaborPersistence.class)
794     protected OrgLaborPersistence orgLaborPersistence;
795     @BeanReference(type = PasswordPolicyPersistence.class)
796     protected PasswordPolicyPersistence passwordPolicyPersistence;
797     @BeanReference(type = PasswordPolicyRelPersistence.class)
798     protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
799     @BeanReference(type = PasswordTrackerPersistence.class)
800     protected PasswordTrackerPersistence passwordTrackerPersistence;
801     @BeanReference(type = PermissionPersistence.class)
802     protected PermissionPersistence permissionPersistence;
803     @BeanReference(type = PhonePersistence.class)
804     protected PhonePersistence phonePersistence;
805     @BeanReference(type = PluginSettingPersistence.class)
806     protected PluginSettingPersistence pluginSettingPersistence;
807     @BeanReference(type = PortletPersistence.class)
808     protected PortletPersistence portletPersistence;
809     @BeanReference(type = PortletItemPersistence.class)
810     protected PortletItemPersistence portletItemPersistence;
811     @BeanReference(type = PortletPreferencesPersistence.class)
812     protected PortletPreferencesPersistence portletPreferencesPersistence;
813     @BeanReference(type = RegionPersistence.class)
814     protected RegionPersistence regionPersistence;
815     @BeanReference(type = ReleasePersistence.class)
816     protected ReleasePersistence releasePersistence;
817     @BeanReference(type = ResourcePersistence.class)
818     protected ResourcePersistence resourcePersistence;
819     @BeanReference(type = ResourceActionPersistence.class)
820     protected ResourceActionPersistence resourceActionPersistence;
821     @BeanReference(type = ResourceCodePersistence.class)
822     protected ResourceCodePersistence resourceCodePersistence;
823     @BeanReference(type = ResourcePermissionPersistence.class)
824     protected ResourcePermissionPersistence resourcePermissionPersistence;
825     @BeanReference(type = RolePersistence.class)
826     protected RolePersistence rolePersistence;
827     @BeanReference(type = ServiceComponentPersistence.class)
828     protected ServiceComponentPersistence serviceComponentPersistence;
829     @BeanReference(type = ShardPersistence.class)
830     protected ShardPersistence shardPersistence;
831     @BeanReference(type = SubscriptionPersistence.class)
832     protected SubscriptionPersistence subscriptionPersistence;
833     @BeanReference(type = UserPersistence.class)
834     protected UserPersistence userPersistence;
835     @BeanReference(type = UserGroupPersistence.class)
836     protected UserGroupPersistence userGroupPersistence;
837     @BeanReference(type = UserGroupGroupRolePersistence.class)
838     protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
839     @BeanReference(type = UserGroupRolePersistence.class)
840     protected UserGroupRolePersistence userGroupRolePersistence;
841     @BeanReference(type = UserIdMapperPersistence.class)
842     protected UserIdMapperPersistence userIdMapperPersistence;
843     @BeanReference(type = UserTrackerPersistence.class)
844     protected UserTrackerPersistence userTrackerPersistence;
845     @BeanReference(type = UserTrackerPathPersistence.class)
846     protected UserTrackerPathPersistence userTrackerPathPersistence;
847     @BeanReference(type = WebDAVPropsPersistence.class)
848     protected WebDAVPropsPersistence webDAVPropsPersistence;
849     @BeanReference(type = WebsitePersistence.class)
850     protected WebsitePersistence websitePersistence;
851     private static final String _SQL_SELECT_CONTACT = "SELECT contact FROM Contact contact";
852     private static final String _SQL_SELECT_CONTACT_WHERE = "SELECT contact FROM Contact contact WHERE ";
853     private static final String _SQL_COUNT_CONTACT = "SELECT COUNT(contact) FROM Contact contact";
854     private static final String _SQL_COUNT_CONTACT_WHERE = "SELECT COUNT(contact) FROM Contact contact WHERE ";
855     private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "contact.companyId = ?";
856     private static final String _ORDER_BY_ENTITY_ALIAS = "contact.";
857     private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Contact exists with the primary key ";
858     private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Contact exists with the key {";
859     private static Log _log = LogFactoryUtil.getLog(ContactPersistenceImpl.class);
860 }