1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.service.persistence;
24  
25  import com.liferay.portal.NoSuchCompanyException;
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.kernel.util.Validator;
44  import com.liferay.portal.model.Company;
45  import com.liferay.portal.model.ModelListener;
46  import com.liferay.portal.model.impl.CompanyImpl;
47  import com.liferay.portal.model.impl.CompanyModelImpl;
48  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
49  
50  import java.util.ArrayList;
51  import java.util.Collections;
52  import java.util.List;
53  
54  /**
55   * <a href="CompanyPersistenceImpl.java.html"><b><i>View Source</i></b></a>
56   *
57   * @author Brian Wing Shun Chan
58   *
59   */
60  public class CompanyPersistenceImpl extends BasePersistenceImpl
61      implements CompanyPersistence {
62      public static final String FINDER_CLASS_NAME_ENTITY = CompanyImpl.class.getName();
63      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
64          ".List";
65      public static final FinderPath FINDER_PATH_FETCH_BY_WEBID = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
66              CompanyModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
67              "fetchByWebId", new String[] { String.class.getName() });
68      public static final FinderPath FINDER_PATH_COUNT_BY_WEBID = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
69              CompanyModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
70              "countByWebId", new String[] { String.class.getName() });
71      public static final FinderPath FINDER_PATH_FETCH_BY_VIRTUALHOST = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
72              CompanyModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
73              "fetchByVirtualHost", new String[] { String.class.getName() });
74      public static final FinderPath FINDER_PATH_COUNT_BY_VIRTUALHOST = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
75              CompanyModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
76              "countByVirtualHost", new String[] { String.class.getName() });
77      public static final FinderPath FINDER_PATH_FETCH_BY_MX = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
78              CompanyModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
79              "fetchByMx", new String[] { String.class.getName() });
80      public static final FinderPath FINDER_PATH_COUNT_BY_MX = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
81              CompanyModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
82              "countByMx", new String[] { String.class.getName() });
83      public static final FinderPath FINDER_PATH_FETCH_BY_LOGOID = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
84              CompanyModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
85              "fetchByLogoId", new String[] { Long.class.getName() });
86      public static final FinderPath FINDER_PATH_COUNT_BY_LOGOID = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
87              CompanyModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
88              "countByLogoId", new String[] { Long.class.getName() });
89      public static final FinderPath FINDER_PATH_FIND_BY_SYSTEM = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
90              CompanyModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
91              "findBySystem", new String[] { Boolean.class.getName() });
92      public static final FinderPath FINDER_PATH_FIND_BY_OBC_SYSTEM = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
93              CompanyModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
94              "findBySystem",
95              new String[] {
96                  Boolean.class.getName(),
97                  
98              "java.lang.Integer", "java.lang.Integer",
99                  "com.liferay.portal.kernel.util.OrderByComparator"
100             });
101     public static final FinderPath FINDER_PATH_COUNT_BY_SYSTEM = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
102             CompanyModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
103             "countBySystem", new String[] { Boolean.class.getName() });
104     public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
105             CompanyModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
106             "findAll", new String[0]);
107     public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
108             CompanyModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
109             "countAll", new String[0]);
110 
111     public void cacheResult(Company company) {
112         EntityCacheUtil.putResult(CompanyModelImpl.ENTITY_CACHE_ENABLED,
113             CompanyImpl.class, company.getPrimaryKey(), company);
114 
115         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_WEBID,
116             new Object[] { company.getWebId() }, company);
117 
118         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_VIRTUALHOST,
119             new Object[] { company.getVirtualHost() }, company);
120 
121         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_MX,
122             new Object[] { company.getMx() }, company);
123 
124         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LOGOID,
125             new Object[] { new Long(company.getLogoId()) }, company);
126     }
127 
128     public void cacheResult(List<Company> companies) {
129         for (Company company : companies) {
130             if (EntityCacheUtil.getResult(
131                         CompanyModelImpl.ENTITY_CACHE_ENABLED,
132                         CompanyImpl.class, company.getPrimaryKey(), this) == null) {
133                 cacheResult(company);
134             }
135         }
136     }
137 
138     public void clearCache() {
139         CacheRegistry.clear(CompanyImpl.class.getName());
140         EntityCacheUtil.clearCache(CompanyImpl.class.getName());
141         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
142         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
143     }
144 
145     public Company create(long companyId) {
146         Company company = new CompanyImpl();
147 
148         company.setNew(true);
149         company.setPrimaryKey(companyId);
150 
151         return company;
152     }
153 
154     public Company remove(long companyId)
155         throws NoSuchCompanyException, SystemException {
156         Session session = null;
157 
158         try {
159             session = openSession();
160 
161             Company company = (Company)session.get(CompanyImpl.class,
162                     new Long(companyId));
163 
164             if (company == null) {
165                 if (_log.isWarnEnabled()) {
166                     _log.warn("No Company exists with the primary key " +
167                         companyId);
168                 }
169 
170                 throw new NoSuchCompanyException(
171                     "No Company exists with the primary key " + companyId);
172             }
173 
174             return remove(company);
175         }
176         catch (NoSuchCompanyException nsee) {
177             throw nsee;
178         }
179         catch (Exception e) {
180             throw processException(e);
181         }
182         finally {
183             closeSession(session);
184         }
185     }
186 
187     public Company remove(Company company) throws SystemException {
188         for (ModelListener<Company> listener : listeners) {
189             listener.onBeforeRemove(company);
190         }
191 
192         company = removeImpl(company);
193 
194         for (ModelListener<Company> listener : listeners) {
195             listener.onAfterRemove(company);
196         }
197 
198         return company;
199     }
200 
201     protected Company removeImpl(Company company) throws SystemException {
202         Session session = null;
203 
204         try {
205             session = openSession();
206 
207             if (company.isCachedModel() || BatchSessionUtil.isEnabled()) {
208                 Object staleObject = session.get(CompanyImpl.class,
209                         company.getPrimaryKeyObj());
210 
211                 if (staleObject != null) {
212                     session.evict(staleObject);
213                 }
214             }
215 
216             session.delete(company);
217 
218             session.flush();
219         }
220         catch (Exception e) {
221             throw processException(e);
222         }
223         finally {
224             closeSession(session);
225         }
226 
227         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
228 
229         CompanyModelImpl companyModelImpl = (CompanyModelImpl)company;
230 
231         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_WEBID,
232             new Object[] { companyModelImpl.getOriginalWebId() });
233 
234         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_VIRTUALHOST,
235             new Object[] { companyModelImpl.getOriginalVirtualHost() });
236 
237         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_MX,
238             new Object[] { companyModelImpl.getOriginalMx() });
239 
240         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_LOGOID,
241             new Object[] { new Long(companyModelImpl.getOriginalLogoId()) });
242 
243         EntityCacheUtil.removeResult(CompanyModelImpl.ENTITY_CACHE_ENABLED,
244             CompanyImpl.class, company.getPrimaryKey());
245 
246         return company;
247     }
248 
249     /**
250      * @deprecated Use <code>update(Company company, boolean merge)</code>.
251      */
252     public Company update(Company company) throws SystemException {
253         if (_log.isWarnEnabled()) {
254             _log.warn(
255                 "Using the deprecated update(Company company) method. Use update(Company company, boolean merge) instead.");
256         }
257 
258         return update(company, false);
259     }
260 
261     /**
262      * Add, update, or merge, the entity. This method also calls the model
263      * listeners to trigger the proper events associated with adding, deleting,
264      * or updating an entity.
265      *
266      * @param        company the entity to add, update, or merge
267      * @param        merge boolean value for whether to merge the entity. The
268      *                default value is false. Setting merge to true is more
269      *                expensive and should only be true when company is
270      *                transient. See LEP-5473 for a detailed discussion of this
271      *                method.
272      * @return        true if the portlet can be displayed via Ajax
273      */
274     public Company update(Company company, boolean merge)
275         throws SystemException {
276         boolean isNew = company.isNew();
277 
278         for (ModelListener<Company> listener : listeners) {
279             if (isNew) {
280                 listener.onBeforeCreate(company);
281             }
282             else {
283                 listener.onBeforeUpdate(company);
284             }
285         }
286 
287         company = updateImpl(company, merge);
288 
289         for (ModelListener<Company> listener : listeners) {
290             if (isNew) {
291                 listener.onAfterCreate(company);
292             }
293             else {
294                 listener.onAfterUpdate(company);
295             }
296         }
297 
298         return company;
299     }
300 
301     public Company updateImpl(com.liferay.portal.model.Company company,
302         boolean merge) throws SystemException {
303         boolean isNew = company.isNew();
304 
305         CompanyModelImpl companyModelImpl = (CompanyModelImpl)company;
306 
307         Session session = null;
308 
309         try {
310             session = openSession();
311 
312             BatchSessionUtil.update(session, company, merge);
313 
314             company.setNew(false);
315         }
316         catch (Exception e) {
317             throw processException(e);
318         }
319         finally {
320             closeSession(session);
321         }
322 
323         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
324 
325         EntityCacheUtil.putResult(CompanyModelImpl.ENTITY_CACHE_ENABLED,
326             CompanyImpl.class, company.getPrimaryKey(), company);
327 
328         if (!isNew &&
329                 (!Validator.equals(company.getWebId(),
330                     companyModelImpl.getOriginalWebId()))) {
331             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_WEBID,
332                 new Object[] { companyModelImpl.getOriginalWebId() });
333         }
334 
335         if (isNew ||
336                 (!Validator.equals(company.getWebId(),
337                     companyModelImpl.getOriginalWebId()))) {
338             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_WEBID,
339                 new Object[] { company.getWebId() }, company);
340         }
341 
342         if (!isNew &&
343                 (!Validator.equals(company.getVirtualHost(),
344                     companyModelImpl.getOriginalVirtualHost()))) {
345             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_VIRTUALHOST,
346                 new Object[] { companyModelImpl.getOriginalVirtualHost() });
347         }
348 
349         if (isNew ||
350                 (!Validator.equals(company.getVirtualHost(),
351                     companyModelImpl.getOriginalVirtualHost()))) {
352             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_VIRTUALHOST,
353                 new Object[] { company.getVirtualHost() }, company);
354         }
355 
356         if (!isNew &&
357                 (!Validator.equals(company.getMx(),
358                     companyModelImpl.getOriginalMx()))) {
359             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_MX,
360                 new Object[] { companyModelImpl.getOriginalMx() });
361         }
362 
363         if (isNew ||
364                 (!Validator.equals(company.getMx(),
365                     companyModelImpl.getOriginalMx()))) {
366             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_MX,
367                 new Object[] { company.getMx() }, company);
368         }
369 
370         if (!isNew &&
371                 (company.getLogoId() != companyModelImpl.getOriginalLogoId())) {
372             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_LOGOID,
373                 new Object[] { new Long(companyModelImpl.getOriginalLogoId()) });
374         }
375 
376         if (isNew ||
377                 (company.getLogoId() != companyModelImpl.getOriginalLogoId())) {
378             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LOGOID,
379                 new Object[] { new Long(company.getLogoId()) }, company);
380         }
381 
382         return company;
383     }
384 
385     public Company findByPrimaryKey(long companyId)
386         throws NoSuchCompanyException, SystemException {
387         Company company = fetchByPrimaryKey(companyId);
388 
389         if (company == null) {
390             if (_log.isWarnEnabled()) {
391                 _log.warn("No Company exists with the primary key " +
392                     companyId);
393             }
394 
395             throw new NoSuchCompanyException(
396                 "No Company exists with the primary key " + companyId);
397         }
398 
399         return company;
400     }
401 
402     public Company fetchByPrimaryKey(long companyId) throws SystemException {
403         Company company = (Company)EntityCacheUtil.getResult(CompanyModelImpl.ENTITY_CACHE_ENABLED,
404                 CompanyImpl.class, companyId, this);
405 
406         if (company == null) {
407             Session session = null;
408 
409             try {
410                 session = openSession();
411 
412                 company = (Company)session.get(CompanyImpl.class,
413                         new Long(companyId));
414             }
415             catch (Exception e) {
416                 throw processException(e);
417             }
418             finally {
419                 if (company != null) {
420                     cacheResult(company);
421                 }
422 
423                 closeSession(session);
424             }
425         }
426 
427         return company;
428     }
429 
430     public Company findByWebId(String webId)
431         throws NoSuchCompanyException, SystemException {
432         Company company = fetchByWebId(webId);
433 
434         if (company == null) {
435             StringBuilder msg = new StringBuilder();
436 
437             msg.append("No Company exists with the key {");
438 
439             msg.append("webId=" + webId);
440 
441             msg.append(StringPool.CLOSE_CURLY_BRACE);
442 
443             if (_log.isWarnEnabled()) {
444                 _log.warn(msg.toString());
445             }
446 
447             throw new NoSuchCompanyException(msg.toString());
448         }
449 
450         return company;
451     }
452 
453     public Company fetchByWebId(String webId) throws SystemException {
454         return fetchByWebId(webId, true);
455     }
456 
457     public Company fetchByWebId(String webId, boolean retrieveFromCache)
458         throws SystemException {
459         Object[] finderArgs = new Object[] { webId };
460 
461         Object result = null;
462 
463         if (retrieveFromCache) {
464             result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_WEBID,
465                     finderArgs, this);
466         }
467 
468         if (result == null) {
469             Session session = null;
470 
471             try {
472                 session = openSession();
473 
474                 StringBuilder query = new StringBuilder();
475 
476                 query.append("SELECT company FROM Company company WHERE ");
477 
478                 if (webId == null) {
479                     query.append("company.webId IS NULL");
480                 }
481                 else {
482                     query.append("company.webId = ?");
483                 }
484 
485                 query.append(" ");
486 
487                 Query q = session.createQuery(query.toString());
488 
489                 QueryPos qPos = QueryPos.getInstance(q);
490 
491                 if (webId != null) {
492                     qPos.add(webId);
493                 }
494 
495                 List<Company> list = q.list();
496 
497                 result = list;
498 
499                 Company company = null;
500 
501                 if (list.isEmpty()) {
502                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_WEBID,
503                         finderArgs, list);
504                 }
505                 else {
506                     company = list.get(0);
507 
508                     cacheResult(company);
509 
510                     if ((company.getWebId() == null) ||
511                             !company.getWebId().equals(webId)) {
512                         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_WEBID,
513                             finderArgs, company);
514                     }
515                 }
516 
517                 return company;
518             }
519             catch (Exception e) {
520                 throw processException(e);
521             }
522             finally {
523                 if (result == null) {
524                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_WEBID,
525                         finderArgs, new ArrayList<Company>());
526                 }
527 
528                 closeSession(session);
529             }
530         }
531         else {
532             if (result instanceof List) {
533                 return null;
534             }
535             else {
536                 return (Company)result;
537             }
538         }
539     }
540 
541     public Company findByVirtualHost(String virtualHost)
542         throws NoSuchCompanyException, SystemException {
543         Company company = fetchByVirtualHost(virtualHost);
544 
545         if (company == null) {
546             StringBuilder msg = new StringBuilder();
547 
548             msg.append("No Company exists with the key {");
549 
550             msg.append("virtualHost=" + virtualHost);
551 
552             msg.append(StringPool.CLOSE_CURLY_BRACE);
553 
554             if (_log.isWarnEnabled()) {
555                 _log.warn(msg.toString());
556             }
557 
558             throw new NoSuchCompanyException(msg.toString());
559         }
560 
561         return company;
562     }
563 
564     public Company fetchByVirtualHost(String virtualHost)
565         throws SystemException {
566         return fetchByVirtualHost(virtualHost, true);
567     }
568 
569     public Company fetchByVirtualHost(String virtualHost,
570         boolean retrieveFromCache) throws SystemException {
571         Object[] finderArgs = new Object[] { virtualHost };
572 
573         Object result = null;
574 
575         if (retrieveFromCache) {
576             result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_VIRTUALHOST,
577                     finderArgs, this);
578         }
579 
580         if (result == null) {
581             Session session = null;
582 
583             try {
584                 session = openSession();
585 
586                 StringBuilder query = new StringBuilder();
587 
588                 query.append("SELECT company FROM Company company WHERE ");
589 
590                 if (virtualHost == null) {
591                     query.append("company.virtualHost IS NULL");
592                 }
593                 else {
594                     query.append("company.virtualHost = ?");
595                 }
596 
597                 query.append(" ");
598 
599                 Query q = session.createQuery(query.toString());
600 
601                 QueryPos qPos = QueryPos.getInstance(q);
602 
603                 if (virtualHost != null) {
604                     qPos.add(virtualHost);
605                 }
606 
607                 List<Company> list = q.list();
608 
609                 result = list;
610 
611                 Company company = null;
612 
613                 if (list.isEmpty()) {
614                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_VIRTUALHOST,
615                         finderArgs, list);
616                 }
617                 else {
618                     company = list.get(0);
619 
620                     cacheResult(company);
621 
622                     if ((company.getVirtualHost() == null) ||
623                             !company.getVirtualHost().equals(virtualHost)) {
624                         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_VIRTUALHOST,
625                             finderArgs, company);
626                     }
627                 }
628 
629                 return company;
630             }
631             catch (Exception e) {
632                 throw processException(e);
633             }
634             finally {
635                 if (result == null) {
636                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_VIRTUALHOST,
637                         finderArgs, new ArrayList<Company>());
638                 }
639 
640                 closeSession(session);
641             }
642         }
643         else {
644             if (result instanceof List) {
645                 return null;
646             }
647             else {
648                 return (Company)result;
649             }
650         }
651     }
652 
653     public Company findByMx(String mx)
654         throws NoSuchCompanyException, SystemException {
655         Company company = fetchByMx(mx);
656 
657         if (company == null) {
658             StringBuilder msg = new StringBuilder();
659 
660             msg.append("No Company exists with the key {");
661 
662             msg.append("mx=" + mx);
663 
664             msg.append(StringPool.CLOSE_CURLY_BRACE);
665 
666             if (_log.isWarnEnabled()) {
667                 _log.warn(msg.toString());
668             }
669 
670             throw new NoSuchCompanyException(msg.toString());
671         }
672 
673         return company;
674     }
675 
676     public Company fetchByMx(String mx) throws SystemException {
677         return fetchByMx(mx, true);
678     }
679 
680     public Company fetchByMx(String mx, boolean retrieveFromCache)
681         throws SystemException {
682         Object[] finderArgs = new Object[] { mx };
683 
684         Object result = null;
685 
686         if (retrieveFromCache) {
687             result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_MX,
688                     finderArgs, this);
689         }
690 
691         if (result == null) {
692             Session session = null;
693 
694             try {
695                 session = openSession();
696 
697                 StringBuilder query = new StringBuilder();
698 
699                 query.append("SELECT company FROM Company company WHERE ");
700 
701                 if (mx == null) {
702                     query.append("company.mx IS NULL");
703                 }
704                 else {
705                     query.append("company.mx = ?");
706                 }
707 
708                 query.append(" ");
709 
710                 Query q = session.createQuery(query.toString());
711 
712                 QueryPos qPos = QueryPos.getInstance(q);
713 
714                 if (mx != null) {
715                     qPos.add(mx);
716                 }
717 
718                 List<Company> list = q.list();
719 
720                 result = list;
721 
722                 Company company = null;
723 
724                 if (list.isEmpty()) {
725                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_MX,
726                         finderArgs, list);
727                 }
728                 else {
729                     company = list.get(0);
730 
731                     cacheResult(company);
732 
733                     if ((company.getMx() == null) ||
734                             !company.getMx().equals(mx)) {
735                         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_MX,
736                             finderArgs, company);
737                     }
738                 }
739 
740                 return company;
741             }
742             catch (Exception e) {
743                 throw processException(e);
744             }
745             finally {
746                 if (result == null) {
747                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_MX,
748                         finderArgs, new ArrayList<Company>());
749                 }
750 
751                 closeSession(session);
752             }
753         }
754         else {
755             if (result instanceof List) {
756                 return null;
757             }
758             else {
759                 return (Company)result;
760             }
761         }
762     }
763 
764     public Company findByLogoId(long logoId)
765         throws NoSuchCompanyException, SystemException {
766         Company company = fetchByLogoId(logoId);
767 
768         if (company == null) {
769             StringBuilder msg = new StringBuilder();
770 
771             msg.append("No Company exists with the key {");
772 
773             msg.append("logoId=" + logoId);
774 
775             msg.append(StringPool.CLOSE_CURLY_BRACE);
776 
777             if (_log.isWarnEnabled()) {
778                 _log.warn(msg.toString());
779             }
780 
781             throw new NoSuchCompanyException(msg.toString());
782         }
783 
784         return company;
785     }
786 
787     public Company fetchByLogoId(long logoId) throws SystemException {
788         return fetchByLogoId(logoId, true);
789     }
790 
791     public Company fetchByLogoId(long logoId, boolean retrieveFromCache)
792         throws SystemException {
793         Object[] finderArgs = new Object[] { new Long(logoId) };
794 
795         Object result = null;
796 
797         if (retrieveFromCache) {
798             result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_LOGOID,
799                     finderArgs, this);
800         }
801 
802         if (result == null) {
803             Session session = null;
804 
805             try {
806                 session = openSession();
807 
808                 StringBuilder query = new StringBuilder();
809 
810                 query.append("SELECT company FROM Company company WHERE ");
811 
812                 query.append("company.logoId = ?");
813 
814                 query.append(" ");
815 
816                 Query q = session.createQuery(query.toString());
817 
818                 QueryPos qPos = QueryPos.getInstance(q);
819 
820                 qPos.add(logoId);
821 
822                 List<Company> list = q.list();
823 
824                 result = list;
825 
826                 Company company = null;
827 
828                 if (list.isEmpty()) {
829                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LOGOID,
830                         finderArgs, list);
831                 }
832                 else {
833                     company = list.get(0);
834 
835                     cacheResult(company);
836 
837                     if ((company.getLogoId() != logoId)) {
838                         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LOGOID,
839                             finderArgs, company);
840                     }
841                 }
842 
843                 return company;
844             }
845             catch (Exception e) {
846                 throw processException(e);
847             }
848             finally {
849                 if (result == null) {
850                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LOGOID,
851                         finderArgs, new ArrayList<Company>());
852                 }
853 
854                 closeSession(session);
855             }
856         }
857         else {
858             if (result instanceof List) {
859                 return null;
860             }
861             else {
862                 return (Company)result;
863             }
864         }
865     }
866 
867     public List<Company> findBySystem(boolean system) throws SystemException {
868         Object[] finderArgs = new Object[] { Boolean.valueOf(system) };
869 
870         List<Company> list = (List<Company>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_SYSTEM,
871                 finderArgs, this);
872 
873         if (list == null) {
874             Session session = null;
875 
876             try {
877                 session = openSession();
878 
879                 StringBuilder query = new StringBuilder();
880 
881                 query.append("SELECT company FROM Company company WHERE ");
882 
883                 query.append("company.system = ?");
884 
885                 query.append(" ");
886 
887                 Query q = session.createQuery(query.toString());
888 
889                 QueryPos qPos = QueryPos.getInstance(q);
890 
891                 qPos.add(system);
892 
893                 list = q.list();
894             }
895             catch (Exception e) {
896                 throw processException(e);
897             }
898             finally {
899                 if (list == null) {
900                     list = new ArrayList<Company>();
901                 }
902 
903                 cacheResult(list);
904 
905                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_SYSTEM,
906                     finderArgs, list);
907 
908                 closeSession(session);
909             }
910         }
911 
912         return list;
913     }
914 
915     public List<Company> findBySystem(boolean system, int start, int end)
916         throws SystemException {
917         return findBySystem(system, start, end, null);
918     }
919 
920     public List<Company> findBySystem(boolean system, int start, int end,
921         OrderByComparator obc) throws SystemException {
922         Object[] finderArgs = new Object[] {
923                 Boolean.valueOf(system),
924                 
925                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
926             };
927 
928         List<Company> list = (List<Company>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_SYSTEM,
929                 finderArgs, this);
930 
931         if (list == null) {
932             Session session = null;
933 
934             try {
935                 session = openSession();
936 
937                 StringBuilder query = new StringBuilder();
938 
939                 query.append("SELECT company FROM Company company WHERE ");
940 
941                 query.append("company.system = ?");
942 
943                 query.append(" ");
944 
945                 if (obc != null) {
946                     query.append("ORDER BY ");
947 
948                     String[] orderByFields = obc.getOrderByFields();
949 
950                     for (int i = 0; i < orderByFields.length; i++) {
951                         query.append("company.");
952                         query.append(orderByFields[i]);
953 
954                         if (obc.isAscending()) {
955                             query.append(" ASC");
956                         }
957                         else {
958                             query.append(" DESC");
959                         }
960 
961                         if ((i + 1) < orderByFields.length) {
962                             query.append(", ");
963                         }
964                     }
965                 }
966 
967                 Query q = session.createQuery(query.toString());
968 
969                 QueryPos qPos = QueryPos.getInstance(q);
970 
971                 qPos.add(system);
972 
973                 list = (List<Company>)QueryUtil.list(q, getDialect(), start, end);
974             }
975             catch (Exception e) {
976                 throw processException(e);
977             }
978             finally {
979                 if (list == null) {
980                     list = new ArrayList<Company>();
981                 }
982 
983                 cacheResult(list);
984 
985                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_SYSTEM,
986                     finderArgs, list);
987 
988                 closeSession(session);
989             }
990         }
991 
992         return list;
993     }
994 
995     public Company findBySystem_First(boolean system, OrderByComparator obc)
996         throws NoSuchCompanyException, SystemException {
997         List<Company> list = findBySystem(system, 0, 1, obc);
998 
999         if (list.isEmpty()) {
1000            StringBuilder msg = new StringBuilder();
1001
1002            msg.append("No Company exists with the key {");
1003
1004            msg.append("system=" + system);
1005
1006            msg.append(StringPool.CLOSE_CURLY_BRACE);
1007
1008            throw new NoSuchCompanyException(msg.toString());
1009        }
1010        else {
1011            return list.get(0);
1012        }
1013    }
1014
1015    public Company findBySystem_Last(boolean system, OrderByComparator obc)
1016        throws NoSuchCompanyException, SystemException {
1017        int count = countBySystem(system);
1018
1019        List<Company> list = findBySystem(system, count - 1, count, obc);
1020
1021        if (list.isEmpty()) {
1022            StringBuilder msg = new StringBuilder();
1023
1024            msg.append("No Company exists with the key {");
1025
1026            msg.append("system=" + system);
1027
1028            msg.append(StringPool.CLOSE_CURLY_BRACE);
1029
1030            throw new NoSuchCompanyException(msg.toString());
1031        }
1032        else {
1033            return list.get(0);
1034        }
1035    }
1036
1037    public Company[] findBySystem_PrevAndNext(long companyId, boolean system,
1038        OrderByComparator obc) throws NoSuchCompanyException, SystemException {
1039        Company company = findByPrimaryKey(companyId);
1040
1041        int count = countBySystem(system);
1042
1043        Session session = null;
1044
1045        try {
1046            session = openSession();
1047
1048            StringBuilder query = new StringBuilder();
1049
1050            query.append("SELECT company FROM Company company WHERE ");
1051
1052            query.append("company.system = ?");
1053
1054            query.append(" ");
1055
1056            if (obc != null) {
1057                query.append("ORDER BY ");
1058
1059                String[] orderByFields = obc.getOrderByFields();
1060
1061                for (int i = 0; i < orderByFields.length; i++) {
1062                    query.append("company.");
1063                    query.append(orderByFields[i]);
1064
1065                    if (obc.isAscending()) {
1066                        query.append(" ASC");
1067                    }
1068                    else {
1069                        query.append(" DESC");
1070                    }
1071
1072                    if ((i + 1) < orderByFields.length) {
1073                        query.append(", ");
1074                    }
1075                }
1076            }
1077
1078            Query q = session.createQuery(query.toString());
1079
1080            QueryPos qPos = QueryPos.getInstance(q);
1081
1082            qPos.add(system);
1083
1084            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, company);
1085
1086            Company[] array = new CompanyImpl[3];
1087
1088            array[0] = (Company)objArray[0];
1089            array[1] = (Company)objArray[1];
1090            array[2] = (Company)objArray[2];
1091
1092            return array;
1093        }
1094        catch (Exception e) {
1095            throw processException(e);
1096        }
1097        finally {
1098            closeSession(session);
1099        }
1100    }
1101
1102    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
1103        throws SystemException {
1104        Session session = null;
1105
1106        try {
1107            session = openSession();
1108
1109            dynamicQuery.compile(session);
1110
1111            return dynamicQuery.list();
1112        }
1113        catch (Exception e) {
1114            throw processException(e);
1115        }
1116        finally {
1117            closeSession(session);
1118        }
1119    }
1120
1121    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
1122        int start, int end) throws SystemException {
1123        Session session = null;
1124
1125        try {
1126            session = openSession();
1127
1128            dynamicQuery.setLimit(start, end);
1129
1130            dynamicQuery.compile(session);
1131
1132            return dynamicQuery.list();
1133        }
1134        catch (Exception e) {
1135            throw processException(e);
1136        }
1137        finally {
1138            closeSession(session);
1139        }
1140    }
1141
1142    public List<Company> findAll() throws SystemException {
1143        return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1144    }
1145
1146    public List<Company> findAll(int start, int end) throws SystemException {
1147        return findAll(start, end, null);
1148    }
1149
1150    public List<Company> findAll(int start, int end, OrderByComparator obc)
1151        throws SystemException {
1152        Object[] finderArgs = new Object[] {
1153                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1154            };
1155
1156        List<Company> list = (List<Company>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1157                finderArgs, this);
1158
1159        if (list == null) {
1160            Session session = null;
1161
1162            try {
1163                session = openSession();
1164
1165                StringBuilder query = new StringBuilder();
1166
1167                query.append("SELECT company FROM Company company ");
1168
1169                if (obc != null) {
1170                    query.append("ORDER BY ");
1171
1172                    String[] orderByFields = obc.getOrderByFields();
1173
1174                    for (int i = 0; i < orderByFields.length; i++) {
1175                        query.append("company.");
1176                        query.append(orderByFields[i]);
1177
1178                        if (obc.isAscending()) {
1179                            query.append(" ASC");
1180                        }
1181                        else {
1182                            query.append(" DESC");
1183                        }
1184
1185                        if ((i + 1) < orderByFields.length) {
1186                            query.append(", ");
1187                        }
1188                    }
1189                }
1190
1191                Query q = session.createQuery(query.toString());
1192
1193                if (obc == null) {
1194                    list = (List<Company>)QueryUtil.list(q, getDialect(),
1195                            start, end, false);
1196
1197                    Collections.sort(list);
1198                }
1199                else {
1200                    list = (List<Company>)QueryUtil.list(q, getDialect(),
1201                            start, end);
1202                }
1203            }
1204            catch (Exception e) {
1205                throw processException(e);
1206            }
1207            finally {
1208                if (list == null) {
1209                    list = new ArrayList<Company>();
1210                }
1211
1212                cacheResult(list);
1213
1214                FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
1215
1216                closeSession(session);
1217            }
1218        }
1219
1220        return list;
1221    }
1222
1223    public void removeByWebId(String webId)
1224        throws NoSuchCompanyException, SystemException {
1225        Company company = findByWebId(webId);
1226
1227        remove(company);
1228    }
1229
1230    public void removeByVirtualHost(String virtualHost)
1231        throws NoSuchCompanyException, SystemException {
1232        Company company = findByVirtualHost(virtualHost);
1233
1234        remove(company);
1235    }
1236
1237    public void removeByMx(String mx)
1238        throws NoSuchCompanyException, SystemException {
1239        Company company = findByMx(mx);
1240
1241        remove(company);
1242    }
1243
1244    public void removeByLogoId(long logoId)
1245        throws NoSuchCompanyException, SystemException {
1246        Company company = findByLogoId(logoId);
1247
1248        remove(company);
1249    }
1250
1251    public void removeBySystem(boolean system) throws SystemException {
1252        for (Company company : findBySystem(system)) {
1253            remove(company);
1254        }
1255    }
1256
1257    public void removeAll() throws SystemException {
1258        for (Company company : findAll()) {
1259            remove(company);
1260        }
1261    }
1262
1263    public int countByWebId(String webId) throws SystemException {
1264        Object[] finderArgs = new Object[] { webId };
1265
1266        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_WEBID,
1267                finderArgs, this);
1268
1269        if (count == null) {
1270            Session session = null;
1271
1272            try {
1273                session = openSession();
1274
1275                StringBuilder query = new StringBuilder();
1276
1277                query.append("SELECT COUNT(company) ");
1278                query.append("FROM Company company WHERE ");
1279
1280                if (webId == null) {
1281                    query.append("company.webId IS NULL");
1282                }
1283                else {
1284                    query.append("company.webId = ?");
1285                }
1286
1287                query.append(" ");
1288
1289                Query q = session.createQuery(query.toString());
1290
1291                QueryPos qPos = QueryPos.getInstance(q);
1292
1293                if (webId != null) {
1294                    qPos.add(webId);
1295                }
1296
1297                count = (Long)q.uniqueResult();
1298            }
1299            catch (Exception e) {
1300                throw processException(e);
1301            }
1302            finally {
1303                if (count == null) {
1304                    count = Long.valueOf(0);
1305                }
1306
1307                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_WEBID,
1308                    finderArgs, count);
1309
1310                closeSession(session);
1311            }
1312        }
1313
1314        return count.intValue();
1315    }
1316
1317    public int countByVirtualHost(String virtualHost) throws SystemException {
1318        Object[] finderArgs = new Object[] { virtualHost };
1319
1320        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_VIRTUALHOST,
1321                finderArgs, this);
1322
1323        if (count == null) {
1324            Session session = null;
1325
1326            try {
1327                session = openSession();
1328
1329                StringBuilder query = new StringBuilder();
1330
1331                query.append("SELECT COUNT(company) ");
1332                query.append("FROM Company company WHERE ");
1333
1334                if (virtualHost == null) {
1335                    query.append("company.virtualHost IS NULL");
1336                }
1337                else {
1338                    query.append("company.virtualHost = ?");
1339                }
1340
1341                query.append(" ");
1342
1343                Query q = session.createQuery(query.toString());
1344
1345                QueryPos qPos = QueryPos.getInstance(q);
1346
1347                if (virtualHost != null) {
1348                    qPos.add(virtualHost);
1349                }
1350
1351                count = (Long)q.uniqueResult();
1352            }
1353            catch (Exception e) {
1354                throw processException(e);
1355            }
1356            finally {
1357                if (count == null) {
1358                    count = Long.valueOf(0);
1359                }
1360
1361                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_VIRTUALHOST,
1362                    finderArgs, count);
1363
1364                closeSession(session);
1365            }
1366        }
1367
1368        return count.intValue();
1369    }
1370
1371    public int countByMx(String mx) throws SystemException {
1372        Object[] finderArgs = new Object[] { mx };
1373
1374        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_MX,
1375                finderArgs, this);
1376
1377        if (count == null) {
1378            Session session = null;
1379
1380            try {
1381                session = openSession();
1382
1383                StringBuilder query = new StringBuilder();
1384
1385                query.append("SELECT COUNT(company) ");
1386                query.append("FROM Company company WHERE ");
1387
1388                if (mx == null) {
1389                    query.append("company.mx IS NULL");
1390                }
1391                else {
1392                    query.append("company.mx = ?");
1393                }
1394
1395                query.append(" ");
1396
1397                Query q = session.createQuery(query.toString());
1398
1399                QueryPos qPos = QueryPos.getInstance(q);
1400
1401                if (mx != null) {
1402                    qPos.add(mx);
1403                }
1404
1405                count = (Long)q.uniqueResult();
1406            }
1407            catch (Exception e) {
1408                throw processException(e);
1409            }
1410            finally {
1411                if (count == null) {
1412                    count = Long.valueOf(0);
1413                }
1414
1415                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_MX, finderArgs,
1416                    count);
1417
1418                closeSession(session);
1419            }
1420        }
1421
1422        return count.intValue();
1423    }
1424
1425    public int countByLogoId(long logoId) throws SystemException {
1426        Object[] finderArgs = new Object[] { new Long(logoId) };
1427
1428        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_LOGOID,
1429                finderArgs, this);
1430
1431        if (count == null) {
1432            Session session = null;
1433
1434            try {
1435                session = openSession();
1436
1437                StringBuilder query = new StringBuilder();
1438
1439                query.append("SELECT COUNT(company) ");
1440                query.append("FROM Company company WHERE ");
1441
1442                query.append("company.logoId = ?");
1443
1444                query.append(" ");
1445
1446                Query q = session.createQuery(query.toString());
1447
1448                QueryPos qPos = QueryPos.getInstance(q);
1449
1450                qPos.add(logoId);
1451
1452                count = (Long)q.uniqueResult();
1453            }
1454            catch (Exception e) {
1455                throw processException(e);
1456            }
1457            finally {
1458                if (count == null) {
1459                    count = Long.valueOf(0);
1460                }
1461
1462                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_LOGOID,
1463                    finderArgs, count);
1464
1465                closeSession(session);
1466            }
1467        }
1468
1469        return count.intValue();
1470    }
1471
1472    public int countBySystem(boolean system) throws SystemException {
1473        Object[] finderArgs = new Object[] { Boolean.valueOf(system) };
1474
1475        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_SYSTEM,
1476                finderArgs, this);
1477
1478        if (count == null) {
1479            Session session = null;
1480
1481            try {
1482                session = openSession();
1483
1484                StringBuilder query = new StringBuilder();
1485
1486                query.append("SELECT COUNT(company) ");
1487                query.append("FROM Company company WHERE ");
1488
1489                query.append("company.system = ?");
1490
1491                query.append(" ");
1492
1493                Query q = session.createQuery(query.toString());
1494
1495                QueryPos qPos = QueryPos.getInstance(q);
1496
1497                qPos.add(system);
1498
1499                count = (Long)q.uniqueResult();
1500            }
1501            catch (Exception e) {
1502                throw processException(e);
1503            }
1504            finally {
1505                if (count == null) {
1506                    count = Long.valueOf(0);
1507                }
1508
1509                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_SYSTEM,
1510                    finderArgs, count);
1511
1512                closeSession(session);
1513            }
1514        }
1515
1516        return count.intValue();
1517    }
1518
1519    public int countAll() throws SystemException {
1520        Object[] finderArgs = new Object[0];
1521
1522        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1523                finderArgs, this);
1524
1525        if (count == null) {
1526            Session session = null;
1527
1528            try {
1529                session = openSession();
1530
1531                Query q = session.createQuery(
1532                        "SELECT COUNT(company) FROM Company company");
1533
1534                count = (Long)q.uniqueResult();
1535            }
1536            catch (Exception e) {
1537                throw processException(e);
1538            }
1539            finally {
1540                if (count == null) {
1541                    count = Long.valueOf(0);
1542                }
1543
1544                FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
1545                    count);
1546
1547                closeSession(session);
1548            }
1549        }
1550
1551        return count.intValue();
1552    }
1553
1554    public void afterPropertiesSet() {
1555        String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1556                    com.liferay.portal.util.PropsUtil.get(
1557                        "value.object.listener.com.liferay.portal.model.Company")));
1558
1559        if (listenerClassNames.length > 0) {
1560            try {
1561                List<ModelListener<Company>> listenersList = new ArrayList<ModelListener<Company>>();
1562
1563                for (String listenerClassName : listenerClassNames) {
1564                    listenersList.add((ModelListener<Company>)Class.forName(
1565                            listenerClassName).newInstance());
1566                }
1567
1568                listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1569            }
1570            catch (Exception e) {
1571                _log.error(e);
1572            }
1573        }
1574    }
1575
1576    @BeanReference(name = "com.liferay.portal.service.persistence.AccountPersistence.impl")
1577    protected com.liferay.portal.service.persistence.AccountPersistence accountPersistence;
1578    @BeanReference(name = "com.liferay.portal.service.persistence.AddressPersistence.impl")
1579    protected com.liferay.portal.service.persistence.AddressPersistence addressPersistence;
1580    @BeanReference(name = "com.liferay.portal.service.persistence.BrowserTrackerPersistence.impl")
1581    protected com.liferay.portal.service.persistence.BrowserTrackerPersistence browserTrackerPersistence;
1582    @BeanReference(name = "com.liferay.portal.service.persistence.ClassNamePersistence.impl")
1583    protected com.liferay.portal.service.persistence.ClassNamePersistence classNamePersistence;
1584    @BeanReference(name = "com.liferay.portal.service.persistence.CompanyPersistence.impl")
1585    protected com.liferay.portal.service.persistence.CompanyPersistence companyPersistence;
1586    @BeanReference(name = "com.liferay.portal.service.persistence.ContactPersistence.impl")
1587    protected com.liferay.portal.service.persistence.ContactPersistence contactPersistence;
1588    @BeanReference(name = "com.liferay.portal.service.persistence.CountryPersistence.impl")
1589    protected com.liferay.portal.service.persistence.CountryPersistence countryPersistence;
1590    @BeanReference(name = "com.liferay.portal.service.persistence.EmailAddressPersistence.impl")
1591    protected com.liferay.portal.service.persistence.EmailAddressPersistence emailAddressPersistence;
1592    @BeanReference(name = "com.liferay.portal.service.persistence.GroupPersistence.impl")
1593    protected com.liferay.portal.service.persistence.GroupPersistence groupPersistence;
1594    @BeanReference(name = "com.liferay.portal.service.persistence.ImagePersistence.impl")
1595    protected com.liferay.portal.service.persistence.ImagePersistence imagePersistence;
1596    @BeanReference(name = "com.liferay.portal.service.persistence.LayoutPersistence.impl")
1597    protected com.liferay.portal.service.persistence.LayoutPersistence layoutPersistence;
1598    @BeanReference(name = "com.liferay.portal.service.persistence.LayoutSetPersistence.impl")
1599    protected com.liferay.portal.service.persistence.LayoutSetPersistence layoutSetPersistence;
1600    @BeanReference(name = "com.liferay.portal.service.persistence.ListTypePersistence.impl")
1601    protected com.liferay.portal.service.persistence.ListTypePersistence listTypePersistence;
1602    @BeanReference(name = "com.liferay.portal.service.persistence.MembershipRequestPersistence.impl")
1603    protected com.liferay.portal.service.persistence.MembershipRequestPersistence membershipRequestPersistence;
1604    @BeanReference(name = "com.liferay.portal.service.persistence.OrganizationPersistence.impl")
1605    protected com.liferay.portal.service.persistence.OrganizationPersistence organizationPersistence;
1606    @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupPermissionPersistence.impl")
1607    protected com.liferay.portal.service.persistence.OrgGroupPermissionPersistence orgGroupPermissionPersistence;
1608    @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupRolePersistence.impl")
1609    protected com.liferay.portal.service.persistence.OrgGroupRolePersistence orgGroupRolePersistence;
1610    @BeanReference(name = "com.liferay.portal.service.persistence.OrgLaborPersistence.impl")
1611    protected com.liferay.portal.service.persistence.OrgLaborPersistence orgLaborPersistence;
1612    @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyPersistence.impl")
1613    protected com.liferay.portal.service.persistence.PasswordPolicyPersistence passwordPolicyPersistence;
1614    @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyRelPersistence.impl")
1615    protected com.liferay.portal.service.persistence.PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1616    @BeanReference(name = "com.liferay.portal.service.persistence.PasswordTrackerPersistence.impl")
1617    protected com.liferay.portal.service.persistence.PasswordTrackerPersistence passwordTrackerPersistence;
1618    @BeanReference(name = "com.liferay.portal.service.persistence.PermissionPersistence.impl")
1619    protected com.liferay.portal.service.persistence.PermissionPersistence permissionPersistence;
1620    @BeanReference(name = "com.liferay.portal.service.persistence.PhonePersistence.impl")
1621    protected com.liferay.portal.service.persistence.PhonePersistence phonePersistence;
1622    @BeanReference(name = "com.liferay.portal.service.persistence.PluginSettingPersistence.impl")
1623    protected com.liferay.portal.service.persistence.PluginSettingPersistence pluginSettingPersistence;
1624    @BeanReference(name = "com.liferay.portal.service.persistence.PortletPersistence.impl")
1625    protected com.liferay.portal.service.persistence.PortletPersistence portletPersistence;
1626    @BeanReference(name = "com.liferay.portal.service.persistence.PortletItemPersistence.impl")
1627    protected com.liferay.portal.service.persistence.PortletItemPersistence portletItemPersistence;
1628    @BeanReference(name = "com.liferay.portal.service.persistence.PortletPreferencesPersistence.impl")
1629    protected com.liferay.portal.service.persistence.PortletPreferencesPersistence portletPreferencesPersistence;
1630    @BeanReference(name = "com.liferay.portal.service.persistence.RegionPersistence.impl")
1631    protected com.liferay.portal.service.persistence.RegionPersistence regionPersistence;
1632    @BeanReference(name = "com.liferay.portal.service.persistence.ReleasePersistence.impl")
1633    protected com.liferay.portal.service.persistence.ReleasePersistence releasePersistence;
1634    @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence.impl")
1635    protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
1636    @BeanReference(name = "com.liferay.portal.service.persistence.ResourceActionPersistence.impl")
1637    protected com.liferay.portal.service.persistence.ResourceActionPersistence resourceActionPersistence;
1638    @BeanReference(name = "com.liferay.portal.service.persistence.ResourceCodePersistence.impl")
1639    protected com.liferay.portal.service.persistence.ResourceCodePersistence resourceCodePersistence;
1640    @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePermissionPersistence.impl")
1641    protected com.liferay.portal.service.persistence.ResourcePermissionPersistence resourcePermissionPersistence;
1642    @BeanReference(name = "com.liferay.portal.service.persistence.RolePersistence.impl")
1643    protected com.liferay.portal.service.persistence.RolePersistence rolePersistence;
1644    @BeanReference(name = "com.liferay.portal.service.persistence.ServiceComponentPersistence.impl")
1645    protected com.liferay.portal.service.persistence.ServiceComponentPersistence serviceComponentPersistence;
1646    @BeanReference(name = "com.liferay.portal.service.persistence.ShardPersistence.impl")
1647    protected com.liferay.portal.service.persistence.ShardPersistence shardPersistence;
1648    @BeanReference(name = "com.liferay.portal.service.persistence.SubscriptionPersistence.impl")
1649    protected com.liferay.portal.service.persistence.SubscriptionPersistence subscriptionPersistence;
1650    @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence.impl")
1651    protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
1652    @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupPersistence.impl")
1653    protected com.liferay.portal.service.persistence.UserGroupPersistence userGroupPersistence;
1654    @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupRolePersistence.impl")
1655    protected com.liferay.portal.service.persistence.UserGroupRolePersistence userGroupRolePersistence;
1656    @BeanReference(name = "com.liferay.portal.service.persistence.UserIdMapperPersistence.impl")
1657    protected com.liferay.portal.service.persistence.UserIdMapperPersistence userIdMapperPersistence;
1658    @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPersistence.impl")
1659    protected com.liferay.portal.service.persistence.UserTrackerPersistence userTrackerPersistence;
1660    @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPathPersistence.impl")
1661    protected com.liferay.portal.service.persistence.UserTrackerPathPersistence userTrackerPathPersistence;
1662    @BeanReference(name = "com.liferay.portal.service.persistence.WebDAVPropsPersistence.impl")
1663    protected com.liferay.portal.service.persistence.WebDAVPropsPersistence webDAVPropsPersistence;
1664    @BeanReference(name = "com.liferay.portal.service.persistence.WebsitePersistence.impl")
1665    protected com.liferay.portal.service.persistence.WebsitePersistence websitePersistence;
1666    private static Log _log = LogFactoryUtil.getLog(CompanyPersistenceImpl.class);
1667}