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