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