001
014
015 package com.liferay.portal.service.persistence;
016
017 import com.liferay.portal.NoSuchCompanyException;
018 import com.liferay.portal.NoSuchModelException;
019 import com.liferay.portal.kernel.bean.BeanReference;
020 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
021 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
022 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
023 import com.liferay.portal.kernel.dao.orm.FinderPath;
024 import com.liferay.portal.kernel.dao.orm.Query;
025 import com.liferay.portal.kernel.dao.orm.QueryPos;
026 import com.liferay.portal.kernel.dao.orm.QueryUtil;
027 import com.liferay.portal.kernel.dao.orm.Session;
028 import com.liferay.portal.kernel.exception.SystemException;
029 import com.liferay.portal.kernel.log.Log;
030 import com.liferay.portal.kernel.log.LogFactoryUtil;
031 import com.liferay.portal.kernel.util.GetterUtil;
032 import com.liferay.portal.kernel.util.InstanceFactory;
033 import com.liferay.portal.kernel.util.OrderByComparator;
034 import com.liferay.portal.kernel.util.StringBundler;
035 import com.liferay.portal.kernel.util.StringPool;
036 import com.liferay.portal.kernel.util.StringUtil;
037 import com.liferay.portal.model.CacheModel;
038 import com.liferay.portal.model.Company;
039 import com.liferay.portal.model.ModelListener;
040 import com.liferay.portal.model.impl.CompanyImpl;
041 import com.liferay.portal.model.impl.CompanyModelImpl;
042 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
043
044 import java.io.Serializable;
045
046 import java.util.ArrayList;
047 import java.util.Collections;
048 import java.util.List;
049
050
062 public class CompanyPersistenceImpl extends BasePersistenceImpl<Company>
063 implements CompanyPersistence {
064
069 public static final String FINDER_CLASS_NAME_ENTITY = CompanyImpl.class.getName();
070 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
071 ".List1";
072 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
073 ".List2";
074 public static final FinderPath FINDER_PATH_FETCH_BY_WEBID = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
075 CompanyModelImpl.FINDER_CACHE_ENABLED, CompanyImpl.class,
076 FINDER_CLASS_NAME_ENTITY, "fetchByWebId",
077 new String[] { String.class.getName() },
078 CompanyModelImpl.WEBID_COLUMN_BITMASK);
079 public static final FinderPath FINDER_PATH_COUNT_BY_WEBID = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
080 CompanyModelImpl.FINDER_CACHE_ENABLED, Long.class,
081 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByWebId",
082 new String[] { String.class.getName() });
083 public static final FinderPath FINDER_PATH_FETCH_BY_MX = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
084 CompanyModelImpl.FINDER_CACHE_ENABLED, CompanyImpl.class,
085 FINDER_CLASS_NAME_ENTITY, "fetchByMx",
086 new String[] { String.class.getName() },
087 CompanyModelImpl.MX_COLUMN_BITMASK);
088 public static final FinderPath FINDER_PATH_COUNT_BY_MX = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
089 CompanyModelImpl.FINDER_CACHE_ENABLED, Long.class,
090 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByMx",
091 new String[] { String.class.getName() });
092 public static final FinderPath FINDER_PATH_FETCH_BY_LOGOID = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
093 CompanyModelImpl.FINDER_CACHE_ENABLED, CompanyImpl.class,
094 FINDER_CLASS_NAME_ENTITY, "fetchByLogoId",
095 new String[] { Long.class.getName() },
096 CompanyModelImpl.LOGOID_COLUMN_BITMASK);
097 public static final FinderPath FINDER_PATH_COUNT_BY_LOGOID = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
098 CompanyModelImpl.FINDER_CACHE_ENABLED, Long.class,
099 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByLogoId",
100 new String[] { Long.class.getName() });
101 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_SYSTEM = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
102 CompanyModelImpl.FINDER_CACHE_ENABLED, CompanyImpl.class,
103 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findBySystem",
104 new String[] {
105 Boolean.class.getName(),
106
107 "java.lang.Integer", "java.lang.Integer",
108 "com.liferay.portal.kernel.util.OrderByComparator"
109 });
110 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SYSTEM =
111 new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
112 CompanyModelImpl.FINDER_CACHE_ENABLED, CompanyImpl.class,
113 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findBySystem",
114 new String[] { Boolean.class.getName() },
115 CompanyModelImpl.SYSTEM_COLUMN_BITMASK);
116 public static final FinderPath FINDER_PATH_COUNT_BY_SYSTEM = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
117 CompanyModelImpl.FINDER_CACHE_ENABLED, Long.class,
118 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countBySystem",
119 new String[] { Boolean.class.getName() });
120 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
121 CompanyModelImpl.FINDER_CACHE_ENABLED, CompanyImpl.class,
122 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
123 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
124 CompanyModelImpl.FINDER_CACHE_ENABLED, CompanyImpl.class,
125 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
126 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
127 CompanyModelImpl.FINDER_CACHE_ENABLED, Long.class,
128 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
129
130
135 public void cacheResult(Company company) {
136 EntityCacheUtil.putResult(CompanyModelImpl.ENTITY_CACHE_ENABLED,
137 CompanyImpl.class, company.getPrimaryKey(), company);
138
139 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_WEBID,
140 new Object[] { company.getWebId() }, company);
141
142 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_MX,
143 new Object[] { company.getMx() }, company);
144
145 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LOGOID,
146 new Object[] { Long.valueOf(company.getLogoId()) }, company);
147
148 company.resetOriginalValues();
149 }
150
151
156 public void cacheResult(List<Company> companies) {
157 for (Company company : companies) {
158 if (EntityCacheUtil.getResult(
159 CompanyModelImpl.ENTITY_CACHE_ENABLED,
160 CompanyImpl.class, company.getPrimaryKey()) == null) {
161 cacheResult(company);
162 }
163 else {
164 company.resetOriginalValues();
165 }
166 }
167 }
168
169
176 @Override
177 public void clearCache() {
178 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
179 CacheRegistryUtil.clear(CompanyImpl.class.getName());
180 }
181
182 EntityCacheUtil.clearCache(CompanyImpl.class.getName());
183
184 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
185 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
186 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
187 }
188
189
196 @Override
197 public void clearCache(Company company) {
198 EntityCacheUtil.removeResult(CompanyModelImpl.ENTITY_CACHE_ENABLED,
199 CompanyImpl.class, company.getPrimaryKey());
200
201 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
202 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
203
204 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_WEBID,
205 new Object[] { company.getWebId() });
206
207 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_MX,
208 new Object[] { company.getMx() });
209
210 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_LOGOID,
211 new Object[] { Long.valueOf(company.getLogoId()) });
212 }
213
214
220 public Company create(long companyId) {
221 Company company = new CompanyImpl();
222
223 company.setNew(true);
224 company.setPrimaryKey(companyId);
225
226 return company;
227 }
228
229
237 @Override
238 public Company remove(Serializable primaryKey)
239 throws NoSuchModelException, SystemException {
240 return remove(((Long)primaryKey).longValue());
241 }
242
243
251 public Company remove(long companyId)
252 throws NoSuchCompanyException, SystemException {
253 Session session = null;
254
255 try {
256 session = openSession();
257
258 Company company = (Company)session.get(CompanyImpl.class,
259 Long.valueOf(companyId));
260
261 if (company == null) {
262 if (_log.isWarnEnabled()) {
263 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + companyId);
264 }
265
266 throw new NoSuchCompanyException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
267 companyId);
268 }
269
270 return companyPersistence.remove(company);
271 }
272 catch (NoSuchCompanyException nsee) {
273 throw nsee;
274 }
275 catch (Exception e) {
276 throw processException(e);
277 }
278 finally {
279 closeSession(session);
280 }
281 }
282
283
290 @Override
291 public Company remove(Company company) throws SystemException {
292 return super.remove(company);
293 }
294
295 @Override
296 protected Company removeImpl(Company company) throws SystemException {
297 company = toUnwrappedModel(company);
298
299 Session session = null;
300
301 try {
302 session = openSession();
303
304 BatchSessionUtil.delete(session, company);
305 }
306 catch (Exception e) {
307 throw processException(e);
308 }
309 finally {
310 closeSession(session);
311 }
312
313 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
314 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
315
316 CompanyModelImpl companyModelImpl = (CompanyModelImpl)company;
317
318 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_WEBID,
319 new Object[] { companyModelImpl.getWebId() });
320
321 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_MX,
322 new Object[] { companyModelImpl.getMx() });
323
324 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_LOGOID,
325 new Object[] { Long.valueOf(companyModelImpl.getLogoId()) });
326
327 EntityCacheUtil.removeResult(CompanyModelImpl.ENTITY_CACHE_ENABLED,
328 CompanyImpl.class, company.getPrimaryKey());
329
330 return company;
331 }
332
333 @Override
334 public Company updateImpl(com.liferay.portal.model.Company company,
335 boolean merge) throws SystemException {
336 company = toUnwrappedModel(company);
337
338 boolean isNew = company.isNew();
339
340 CompanyModelImpl companyModelImpl = (CompanyModelImpl)company;
341
342 Session session = null;
343
344 try {
345 session = openSession();
346
347 BatchSessionUtil.update(session, company, merge);
348
349 company.setNew(false);
350 }
351 catch (Exception e) {
352 throw processException(e);
353 }
354 finally {
355 closeSession(session);
356 }
357
358 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
359
360 if (isNew || !CompanyModelImpl.COLUMN_BITMASK_ENABLED) {
361 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
362 }
363
364 else {
365 if ((companyModelImpl.getColumnBitmask() &
366 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SYSTEM.getColumnBitmask()) != 0) {
367 Object[] args = new Object[] {
368 Boolean.valueOf(companyModelImpl.getOriginalSystem())
369 };
370
371 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_SYSTEM, args);
372 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SYSTEM,
373 args);
374
375 args = new Object[] {
376 Boolean.valueOf(companyModelImpl.getSystem())
377 };
378
379 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_SYSTEM, args);
380 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SYSTEM,
381 args);
382 }
383 }
384
385 EntityCacheUtil.putResult(CompanyModelImpl.ENTITY_CACHE_ENABLED,
386 CompanyImpl.class, company.getPrimaryKey(), company);
387
388 if (isNew) {
389 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_WEBID,
390 new Object[] { company.getWebId() }, company);
391
392 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_MX,
393 new Object[] { company.getMx() }, company);
394
395 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LOGOID,
396 new Object[] { Long.valueOf(company.getLogoId()) }, company);
397 }
398 else {
399 if ((companyModelImpl.getColumnBitmask() &
400 FINDER_PATH_FETCH_BY_WEBID.getColumnBitmask()) != 0) {
401 Object[] args = new Object[] { companyModelImpl.getOriginalWebId() };
402
403 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_WEBID, args);
404 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_WEBID, args);
405
406 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_WEBID,
407 new Object[] { company.getWebId() }, company);
408 }
409
410 if ((companyModelImpl.getColumnBitmask() &
411 FINDER_PATH_FETCH_BY_MX.getColumnBitmask()) != 0) {
412 Object[] args = new Object[] { companyModelImpl.getOriginalMx() };
413
414 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_MX, args);
415 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_MX, args);
416
417 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_MX,
418 new Object[] { company.getMx() }, company);
419 }
420
421 if ((companyModelImpl.getColumnBitmask() &
422 FINDER_PATH_FETCH_BY_LOGOID.getColumnBitmask()) != 0) {
423 Object[] args = new Object[] {
424 Long.valueOf(companyModelImpl.getOriginalLogoId())
425 };
426
427 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_LOGOID, args);
428 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_LOGOID, args);
429
430 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LOGOID,
431 new Object[] { Long.valueOf(company.getLogoId()) }, company);
432 }
433 }
434
435 return company;
436 }
437
438 protected Company toUnwrappedModel(Company company) {
439 if (company instanceof CompanyImpl) {
440 return company;
441 }
442
443 CompanyImpl companyImpl = new CompanyImpl();
444
445 companyImpl.setNew(company.isNew());
446 companyImpl.setPrimaryKey(company.getPrimaryKey());
447
448 companyImpl.setCompanyId(company.getCompanyId());
449 companyImpl.setAccountId(company.getAccountId());
450 companyImpl.setWebId(company.getWebId());
451 companyImpl.setKey(company.getKey());
452 companyImpl.setMx(company.getMx());
453 companyImpl.setHomeURL(company.getHomeURL());
454 companyImpl.setLogoId(company.getLogoId());
455 companyImpl.setSystem(company.isSystem());
456 companyImpl.setMaxUsers(company.getMaxUsers());
457 companyImpl.setActive(company.isActive());
458
459 return companyImpl;
460 }
461
462
470 @Override
471 public Company findByPrimaryKey(Serializable primaryKey)
472 throws NoSuchModelException, SystemException {
473 return findByPrimaryKey(((Long)primaryKey).longValue());
474 }
475
476
484 public Company findByPrimaryKey(long companyId)
485 throws NoSuchCompanyException, SystemException {
486 Company company = fetchByPrimaryKey(companyId);
487
488 if (company == null) {
489 if (_log.isWarnEnabled()) {
490 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + companyId);
491 }
492
493 throw new NoSuchCompanyException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
494 companyId);
495 }
496
497 return company;
498 }
499
500
507 @Override
508 public Company fetchByPrimaryKey(Serializable primaryKey)
509 throws SystemException {
510 return fetchByPrimaryKey(((Long)primaryKey).longValue());
511 }
512
513
520 public Company fetchByPrimaryKey(long companyId) throws SystemException {
521 Company company = (Company)EntityCacheUtil.getResult(CompanyModelImpl.ENTITY_CACHE_ENABLED,
522 CompanyImpl.class, companyId);
523
524 if (company == _nullCompany) {
525 return null;
526 }
527
528 if (company == null) {
529 Session session = null;
530
531 boolean hasException = false;
532
533 try {
534 session = openSession();
535
536 company = (Company)session.get(CompanyImpl.class,
537 Long.valueOf(companyId));
538 }
539 catch (Exception e) {
540 hasException = true;
541
542 throw processException(e);
543 }
544 finally {
545 if (company != null) {
546 cacheResult(company);
547 }
548 else if (!hasException) {
549 EntityCacheUtil.putResult(CompanyModelImpl.ENTITY_CACHE_ENABLED,
550 CompanyImpl.class, companyId, _nullCompany);
551 }
552
553 closeSession(session);
554 }
555 }
556
557 return company;
558 }
559
560
568 public Company findByWebId(String webId)
569 throws NoSuchCompanyException, SystemException {
570 Company company = fetchByWebId(webId);
571
572 if (company == null) {
573 StringBundler msg = new StringBundler(4);
574
575 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
576
577 msg.append("webId=");
578 msg.append(webId);
579
580 msg.append(StringPool.CLOSE_CURLY_BRACE);
581
582 if (_log.isWarnEnabled()) {
583 _log.warn(msg.toString());
584 }
585
586 throw new NoSuchCompanyException(msg.toString());
587 }
588
589 return company;
590 }
591
592
599 public Company fetchByWebId(String webId) throws SystemException {
600 return fetchByWebId(webId, true);
601 }
602
603
611 public Company fetchByWebId(String webId, boolean retrieveFromCache)
612 throws SystemException {
613 Object[] finderArgs = new Object[] { webId };
614
615 Object result = null;
616
617 if (retrieveFromCache) {
618 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_WEBID,
619 finderArgs, this);
620 }
621
622 if (result == null) {
623 StringBundler query = new StringBundler(2);
624
625 query.append(_SQL_SELECT_COMPANY_WHERE);
626
627 if (webId == null) {
628 query.append(_FINDER_COLUMN_WEBID_WEBID_1);
629 }
630 else {
631 if (webId.equals(StringPool.BLANK)) {
632 query.append(_FINDER_COLUMN_WEBID_WEBID_3);
633 }
634 else {
635 query.append(_FINDER_COLUMN_WEBID_WEBID_2);
636 }
637 }
638
639 String sql = query.toString();
640
641 Session session = null;
642
643 try {
644 session = openSession();
645
646 Query q = session.createQuery(sql);
647
648 QueryPos qPos = QueryPos.getInstance(q);
649
650 if (webId != null) {
651 qPos.add(webId);
652 }
653
654 List<Company> list = q.list();
655
656 result = list;
657
658 Company company = null;
659
660 if (list.isEmpty()) {
661 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_WEBID,
662 finderArgs, list);
663 }
664 else {
665 company = list.get(0);
666
667 cacheResult(company);
668
669 if ((company.getWebId() == null) ||
670 !company.getWebId().equals(webId)) {
671 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_WEBID,
672 finderArgs, company);
673 }
674 }
675
676 return company;
677 }
678 catch (Exception e) {
679 throw processException(e);
680 }
681 finally {
682 if (result == null) {
683 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_WEBID,
684 finderArgs);
685 }
686
687 closeSession(session);
688 }
689 }
690 else {
691 if (result instanceof List<?>) {
692 return null;
693 }
694 else {
695 return (Company)result;
696 }
697 }
698 }
699
700
708 public Company findByMx(String mx)
709 throws NoSuchCompanyException, SystemException {
710 Company company = fetchByMx(mx);
711
712 if (company == null) {
713 StringBundler msg = new StringBundler(4);
714
715 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
716
717 msg.append("mx=");
718 msg.append(mx);
719
720 msg.append(StringPool.CLOSE_CURLY_BRACE);
721
722 if (_log.isWarnEnabled()) {
723 _log.warn(msg.toString());
724 }
725
726 throw new NoSuchCompanyException(msg.toString());
727 }
728
729 return company;
730 }
731
732
739 public Company fetchByMx(String mx) throws SystemException {
740 return fetchByMx(mx, true);
741 }
742
743
751 public Company fetchByMx(String mx, boolean retrieveFromCache)
752 throws SystemException {
753 Object[] finderArgs = new Object[] { mx };
754
755 Object result = null;
756
757 if (retrieveFromCache) {
758 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_MX,
759 finderArgs, this);
760 }
761
762 if (result == null) {
763 StringBundler query = new StringBundler(2);
764
765 query.append(_SQL_SELECT_COMPANY_WHERE);
766
767 if (mx == null) {
768 query.append(_FINDER_COLUMN_MX_MX_1);
769 }
770 else {
771 if (mx.equals(StringPool.BLANK)) {
772 query.append(_FINDER_COLUMN_MX_MX_3);
773 }
774 else {
775 query.append(_FINDER_COLUMN_MX_MX_2);
776 }
777 }
778
779 String sql = query.toString();
780
781 Session session = null;
782
783 try {
784 session = openSession();
785
786 Query q = session.createQuery(sql);
787
788 QueryPos qPos = QueryPos.getInstance(q);
789
790 if (mx != null) {
791 qPos.add(mx);
792 }
793
794 List<Company> list = q.list();
795
796 result = list;
797
798 Company company = null;
799
800 if (list.isEmpty()) {
801 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_MX,
802 finderArgs, list);
803 }
804 else {
805 company = list.get(0);
806
807 cacheResult(company);
808
809 if ((company.getMx() == null) ||
810 !company.getMx().equals(mx)) {
811 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_MX,
812 finderArgs, company);
813 }
814 }
815
816 return company;
817 }
818 catch (Exception e) {
819 throw processException(e);
820 }
821 finally {
822 if (result == null) {
823 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_MX,
824 finderArgs);
825 }
826
827 closeSession(session);
828 }
829 }
830 else {
831 if (result instanceof List<?>) {
832 return null;
833 }
834 else {
835 return (Company)result;
836 }
837 }
838 }
839
840
848 public Company findByLogoId(long logoId)
849 throws NoSuchCompanyException, SystemException {
850 Company company = fetchByLogoId(logoId);
851
852 if (company == null) {
853 StringBundler msg = new StringBundler(4);
854
855 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
856
857 msg.append("logoId=");
858 msg.append(logoId);
859
860 msg.append(StringPool.CLOSE_CURLY_BRACE);
861
862 if (_log.isWarnEnabled()) {
863 _log.warn(msg.toString());
864 }
865
866 throw new NoSuchCompanyException(msg.toString());
867 }
868
869 return company;
870 }
871
872
879 public Company fetchByLogoId(long logoId) throws SystemException {
880 return fetchByLogoId(logoId, true);
881 }
882
883
891 public Company fetchByLogoId(long logoId, boolean retrieveFromCache)
892 throws SystemException {
893 Object[] finderArgs = new Object[] { logoId };
894
895 Object result = null;
896
897 if (retrieveFromCache) {
898 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_LOGOID,
899 finderArgs, this);
900 }
901
902 if (result == null) {
903 StringBundler query = new StringBundler(2);
904
905 query.append(_SQL_SELECT_COMPANY_WHERE);
906
907 query.append(_FINDER_COLUMN_LOGOID_LOGOID_2);
908
909 String sql = query.toString();
910
911 Session session = null;
912
913 try {
914 session = openSession();
915
916 Query q = session.createQuery(sql);
917
918 QueryPos qPos = QueryPos.getInstance(q);
919
920 qPos.add(logoId);
921
922 List<Company> list = q.list();
923
924 result = list;
925
926 Company company = null;
927
928 if (list.isEmpty()) {
929 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LOGOID,
930 finderArgs, list);
931 }
932 else {
933 company = list.get(0);
934
935 cacheResult(company);
936
937 if ((company.getLogoId() != logoId)) {
938 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LOGOID,
939 finderArgs, company);
940 }
941 }
942
943 return company;
944 }
945 catch (Exception e) {
946 throw processException(e);
947 }
948 finally {
949 if (result == null) {
950 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_LOGOID,
951 finderArgs);
952 }
953
954 closeSession(session);
955 }
956 }
957 else {
958 if (result instanceof List<?>) {
959 return null;
960 }
961 else {
962 return (Company)result;
963 }
964 }
965 }
966
967
974 public List<Company> findBySystem(boolean system) throws SystemException {
975 return findBySystem(system, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
976 }
977
978
991 public List<Company> findBySystem(boolean system, int start, int end)
992 throws SystemException {
993 return findBySystem(system, start, end, null);
994 }
995
996
1010 public List<Company> findBySystem(boolean system, int start, int end,
1011 OrderByComparator orderByComparator) throws SystemException {
1012 FinderPath finderPath = null;
1013 Object[] finderArgs = null;
1014
1015 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1016 (orderByComparator == null)) {
1017 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SYSTEM;
1018 finderArgs = new Object[] { system };
1019 }
1020 else {
1021 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_SYSTEM;
1022 finderArgs = new Object[] { system, start, end, orderByComparator };
1023 }
1024
1025 List<Company> list = (List<Company>)FinderCacheUtil.getResult(finderPath,
1026 finderArgs, this);
1027
1028 if (list == null) {
1029 StringBundler query = null;
1030
1031 if (orderByComparator != null) {
1032 query = new StringBundler(3 +
1033 (orderByComparator.getOrderByFields().length * 3));
1034 }
1035 else {
1036 query = new StringBundler(2);
1037 }
1038
1039 query.append(_SQL_SELECT_COMPANY_WHERE);
1040
1041 query.append(_FINDER_COLUMN_SYSTEM_SYSTEM_2);
1042
1043 if (orderByComparator != null) {
1044 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1045 orderByComparator);
1046 }
1047
1048 String sql = query.toString();
1049
1050 Session session = null;
1051
1052 try {
1053 session = openSession();
1054
1055 Query q = session.createQuery(sql);
1056
1057 QueryPos qPos = QueryPos.getInstance(q);
1058
1059 qPos.add(system);
1060
1061 list = (List<Company>)QueryUtil.list(q, getDialect(), start, end);
1062 }
1063 catch (Exception e) {
1064 throw processException(e);
1065 }
1066 finally {
1067 if (list == null) {
1068 FinderCacheUtil.removeResult(finderPath, finderArgs);
1069 }
1070 else {
1071 cacheResult(list);
1072
1073 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1074 }
1075
1076 closeSession(session);
1077 }
1078 }
1079
1080 return list;
1081 }
1082
1083
1096 public Company findBySystem_First(boolean system,
1097 OrderByComparator orderByComparator)
1098 throws NoSuchCompanyException, SystemException {
1099 List<Company> list = findBySystem(system, 0, 1, orderByComparator);
1100
1101 if (list.isEmpty()) {
1102 StringBundler msg = new StringBundler(4);
1103
1104 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1105
1106 msg.append("system=");
1107 msg.append(system);
1108
1109 msg.append(StringPool.CLOSE_CURLY_BRACE);
1110
1111 throw new NoSuchCompanyException(msg.toString());
1112 }
1113 else {
1114 return list.get(0);
1115 }
1116 }
1117
1118
1131 public Company findBySystem_Last(boolean system,
1132 OrderByComparator orderByComparator)
1133 throws NoSuchCompanyException, SystemException {
1134 int count = countBySystem(system);
1135
1136 List<Company> list = findBySystem(system, count - 1, count,
1137 orderByComparator);
1138
1139 if (list.isEmpty()) {
1140 StringBundler msg = new StringBundler(4);
1141
1142 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1143
1144 msg.append("system=");
1145 msg.append(system);
1146
1147 msg.append(StringPool.CLOSE_CURLY_BRACE);
1148
1149 throw new NoSuchCompanyException(msg.toString());
1150 }
1151 else {
1152 return list.get(0);
1153 }
1154 }
1155
1156
1170 public Company[] findBySystem_PrevAndNext(long companyId, boolean system,
1171 OrderByComparator orderByComparator)
1172 throws NoSuchCompanyException, SystemException {
1173 Company company = findByPrimaryKey(companyId);
1174
1175 Session session = null;
1176
1177 try {
1178 session = openSession();
1179
1180 Company[] array = new CompanyImpl[3];
1181
1182 array[0] = getBySystem_PrevAndNext(session, company, system,
1183 orderByComparator, true);
1184
1185 array[1] = company;
1186
1187 array[2] = getBySystem_PrevAndNext(session, company, system,
1188 orderByComparator, false);
1189
1190 return array;
1191 }
1192 catch (Exception e) {
1193 throw processException(e);
1194 }
1195 finally {
1196 closeSession(session);
1197 }
1198 }
1199
1200 protected Company getBySystem_PrevAndNext(Session session, Company company,
1201 boolean system, OrderByComparator orderByComparator, boolean previous) {
1202 StringBundler query = null;
1203
1204 if (orderByComparator != null) {
1205 query = new StringBundler(6 +
1206 (orderByComparator.getOrderByFields().length * 6));
1207 }
1208 else {
1209 query = new StringBundler(3);
1210 }
1211
1212 query.append(_SQL_SELECT_COMPANY_WHERE);
1213
1214 query.append(_FINDER_COLUMN_SYSTEM_SYSTEM_2);
1215
1216 if (orderByComparator != null) {
1217 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1218
1219 if (orderByConditionFields.length > 0) {
1220 query.append(WHERE_AND);
1221 }
1222
1223 for (int i = 0; i < orderByConditionFields.length; i++) {
1224 query.append(_ORDER_BY_ENTITY_ALIAS);
1225 query.append(orderByConditionFields[i]);
1226
1227 if ((i + 1) < orderByConditionFields.length) {
1228 if (orderByComparator.isAscending() ^ previous) {
1229 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1230 }
1231 else {
1232 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1233 }
1234 }
1235 else {
1236 if (orderByComparator.isAscending() ^ previous) {
1237 query.append(WHERE_GREATER_THAN);
1238 }
1239 else {
1240 query.append(WHERE_LESSER_THAN);
1241 }
1242 }
1243 }
1244
1245 query.append(ORDER_BY_CLAUSE);
1246
1247 String[] orderByFields = orderByComparator.getOrderByFields();
1248
1249 for (int i = 0; i < orderByFields.length; i++) {
1250 query.append(_ORDER_BY_ENTITY_ALIAS);
1251 query.append(orderByFields[i]);
1252
1253 if ((i + 1) < orderByFields.length) {
1254 if (orderByComparator.isAscending() ^ previous) {
1255 query.append(ORDER_BY_ASC_HAS_NEXT);
1256 }
1257 else {
1258 query.append(ORDER_BY_DESC_HAS_NEXT);
1259 }
1260 }
1261 else {
1262 if (orderByComparator.isAscending() ^ previous) {
1263 query.append(ORDER_BY_ASC);
1264 }
1265 else {
1266 query.append(ORDER_BY_DESC);
1267 }
1268 }
1269 }
1270 }
1271
1272 String sql = query.toString();
1273
1274 Query q = session.createQuery(sql);
1275
1276 q.setFirstResult(0);
1277 q.setMaxResults(2);
1278
1279 QueryPos qPos = QueryPos.getInstance(q);
1280
1281 qPos.add(system);
1282
1283 if (orderByComparator != null) {
1284 Object[] values = orderByComparator.getOrderByConditionValues(company);
1285
1286 for (Object value : values) {
1287 qPos.add(value);
1288 }
1289 }
1290
1291 List<Company> list = q.list();
1292
1293 if (list.size() == 2) {
1294 return list.get(1);
1295 }
1296 else {
1297 return null;
1298 }
1299 }
1300
1301
1307 public List<Company> findAll() throws SystemException {
1308 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1309 }
1310
1311
1323 public List<Company> findAll(int start, int end) throws SystemException {
1324 return findAll(start, end, null);
1325 }
1326
1327
1340 public List<Company> findAll(int start, int end,
1341 OrderByComparator orderByComparator) throws SystemException {
1342 FinderPath finderPath = null;
1343 Object[] finderArgs = new Object[] { start, end, orderByComparator };
1344
1345 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1346 (orderByComparator == null)) {
1347 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1348 finderArgs = FINDER_ARGS_EMPTY;
1349 }
1350 else {
1351 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1352 finderArgs = new Object[] { start, end, orderByComparator };
1353 }
1354
1355 List<Company> list = (List<Company>)FinderCacheUtil.getResult(finderPath,
1356 finderArgs, this);
1357
1358 if (list == null) {
1359 StringBundler query = null;
1360 String sql = null;
1361
1362 if (orderByComparator != null) {
1363 query = new StringBundler(2 +
1364 (orderByComparator.getOrderByFields().length * 3));
1365
1366 query.append(_SQL_SELECT_COMPANY);
1367
1368 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1369 orderByComparator);
1370
1371 sql = query.toString();
1372 }
1373 else {
1374 sql = _SQL_SELECT_COMPANY;
1375 }
1376
1377 Session session = null;
1378
1379 try {
1380 session = openSession();
1381
1382 Query q = session.createQuery(sql);
1383
1384 if (orderByComparator == null) {
1385 list = (List<Company>)QueryUtil.list(q, getDialect(),
1386 start, end, false);
1387
1388 Collections.sort(list);
1389 }
1390 else {
1391 list = (List<Company>)QueryUtil.list(q, getDialect(),
1392 start, end);
1393 }
1394 }
1395 catch (Exception e) {
1396 throw processException(e);
1397 }
1398 finally {
1399 if (list == null) {
1400 FinderCacheUtil.removeResult(finderPath, finderArgs);
1401 }
1402 else {
1403 cacheResult(list);
1404
1405 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1406 }
1407
1408 closeSession(session);
1409 }
1410 }
1411
1412 return list;
1413 }
1414
1415
1421 public void removeByWebId(String webId)
1422 throws NoSuchCompanyException, SystemException {
1423 Company company = findByWebId(webId);
1424
1425 companyPersistence.remove(company);
1426 }
1427
1428
1434 public void removeByMx(String mx)
1435 throws NoSuchCompanyException, SystemException {
1436 Company company = findByMx(mx);
1437
1438 companyPersistence.remove(company);
1439 }
1440
1441
1447 public void removeByLogoId(long logoId)
1448 throws NoSuchCompanyException, SystemException {
1449 Company company = findByLogoId(logoId);
1450
1451 companyPersistence.remove(company);
1452 }
1453
1454
1460 public void removeBySystem(boolean system) throws SystemException {
1461 for (Company company : findBySystem(system)) {
1462 companyPersistence.remove(company);
1463 }
1464 }
1465
1466
1471 public void removeAll() throws SystemException {
1472 for (Company company : findAll()) {
1473 companyPersistence.remove(company);
1474 }
1475 }
1476
1477
1484 public int countByWebId(String webId) throws SystemException {
1485 Object[] finderArgs = new Object[] { webId };
1486
1487 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_WEBID,
1488 finderArgs, this);
1489
1490 if (count == null) {
1491 StringBundler query = new StringBundler(2);
1492
1493 query.append(_SQL_COUNT_COMPANY_WHERE);
1494
1495 if (webId == null) {
1496 query.append(_FINDER_COLUMN_WEBID_WEBID_1);
1497 }
1498 else {
1499 if (webId.equals(StringPool.BLANK)) {
1500 query.append(_FINDER_COLUMN_WEBID_WEBID_3);
1501 }
1502 else {
1503 query.append(_FINDER_COLUMN_WEBID_WEBID_2);
1504 }
1505 }
1506
1507 String sql = query.toString();
1508
1509 Session session = null;
1510
1511 try {
1512 session = openSession();
1513
1514 Query q = session.createQuery(sql);
1515
1516 QueryPos qPos = QueryPos.getInstance(q);
1517
1518 if (webId != null) {
1519 qPos.add(webId);
1520 }
1521
1522 count = (Long)q.uniqueResult();
1523 }
1524 catch (Exception e) {
1525 throw processException(e);
1526 }
1527 finally {
1528 if (count == null) {
1529 count = Long.valueOf(0);
1530 }
1531
1532 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_WEBID,
1533 finderArgs, count);
1534
1535 closeSession(session);
1536 }
1537 }
1538
1539 return count.intValue();
1540 }
1541
1542
1549 public int countByMx(String mx) throws SystemException {
1550 Object[] finderArgs = new Object[] { mx };
1551
1552 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_MX,
1553 finderArgs, this);
1554
1555 if (count == null) {
1556 StringBundler query = new StringBundler(2);
1557
1558 query.append(_SQL_COUNT_COMPANY_WHERE);
1559
1560 if (mx == null) {
1561 query.append(_FINDER_COLUMN_MX_MX_1);
1562 }
1563 else {
1564 if (mx.equals(StringPool.BLANK)) {
1565 query.append(_FINDER_COLUMN_MX_MX_3);
1566 }
1567 else {
1568 query.append(_FINDER_COLUMN_MX_MX_2);
1569 }
1570 }
1571
1572 String sql = query.toString();
1573
1574 Session session = null;
1575
1576 try {
1577 session = openSession();
1578
1579 Query q = session.createQuery(sql);
1580
1581 QueryPos qPos = QueryPos.getInstance(q);
1582
1583 if (mx != null) {
1584 qPos.add(mx);
1585 }
1586
1587 count = (Long)q.uniqueResult();
1588 }
1589 catch (Exception e) {
1590 throw processException(e);
1591 }
1592 finally {
1593 if (count == null) {
1594 count = Long.valueOf(0);
1595 }
1596
1597 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_MX, finderArgs,
1598 count);
1599
1600 closeSession(session);
1601 }
1602 }
1603
1604 return count.intValue();
1605 }
1606
1607
1614 public int countByLogoId(long logoId) throws SystemException {
1615 Object[] finderArgs = new Object[] { logoId };
1616
1617 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_LOGOID,
1618 finderArgs, this);
1619
1620 if (count == null) {
1621 StringBundler query = new StringBundler(2);
1622
1623 query.append(_SQL_COUNT_COMPANY_WHERE);
1624
1625 query.append(_FINDER_COLUMN_LOGOID_LOGOID_2);
1626
1627 String sql = query.toString();
1628
1629 Session session = null;
1630
1631 try {
1632 session = openSession();
1633
1634 Query q = session.createQuery(sql);
1635
1636 QueryPos qPos = QueryPos.getInstance(q);
1637
1638 qPos.add(logoId);
1639
1640 count = (Long)q.uniqueResult();
1641 }
1642 catch (Exception e) {
1643 throw processException(e);
1644 }
1645 finally {
1646 if (count == null) {
1647 count = Long.valueOf(0);
1648 }
1649
1650 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_LOGOID,
1651 finderArgs, count);
1652
1653 closeSession(session);
1654 }
1655 }
1656
1657 return count.intValue();
1658 }
1659
1660
1667 public int countBySystem(boolean system) throws SystemException {
1668 Object[] finderArgs = new Object[] { system };
1669
1670 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_SYSTEM,
1671 finderArgs, this);
1672
1673 if (count == null) {
1674 StringBundler query = new StringBundler(2);
1675
1676 query.append(_SQL_COUNT_COMPANY_WHERE);
1677
1678 query.append(_FINDER_COLUMN_SYSTEM_SYSTEM_2);
1679
1680 String sql = query.toString();
1681
1682 Session session = null;
1683
1684 try {
1685 session = openSession();
1686
1687 Query q = session.createQuery(sql);
1688
1689 QueryPos qPos = QueryPos.getInstance(q);
1690
1691 qPos.add(system);
1692
1693 count = (Long)q.uniqueResult();
1694 }
1695 catch (Exception e) {
1696 throw processException(e);
1697 }
1698 finally {
1699 if (count == null) {
1700 count = Long.valueOf(0);
1701 }
1702
1703 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_SYSTEM,
1704 finderArgs, count);
1705
1706 closeSession(session);
1707 }
1708 }
1709
1710 return count.intValue();
1711 }
1712
1713
1719 public int countAll() throws SystemException {
1720 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1721 FINDER_ARGS_EMPTY, this);
1722
1723 if (count == null) {
1724 Session session = null;
1725
1726 try {
1727 session = openSession();
1728
1729 Query q = session.createQuery(_SQL_COUNT_COMPANY);
1730
1731 count = (Long)q.uniqueResult();
1732 }
1733 catch (Exception e) {
1734 throw processException(e);
1735 }
1736 finally {
1737 if (count == null) {
1738 count = Long.valueOf(0);
1739 }
1740
1741 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1742 FINDER_ARGS_EMPTY, count);
1743
1744 closeSession(session);
1745 }
1746 }
1747
1748 return count.intValue();
1749 }
1750
1751
1754 public void afterPropertiesSet() {
1755 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1756 com.liferay.portal.util.PropsUtil.get(
1757 "value.object.listener.com.liferay.portal.model.Company")));
1758
1759 if (listenerClassNames.length > 0) {
1760 try {
1761 List<ModelListener<Company>> listenersList = new ArrayList<ModelListener<Company>>();
1762
1763 for (String listenerClassName : listenerClassNames) {
1764 listenersList.add((ModelListener<Company>)InstanceFactory.newInstance(
1765 listenerClassName));
1766 }
1767
1768 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1769 }
1770 catch (Exception e) {
1771 _log.error(e);
1772 }
1773 }
1774 }
1775
1776 public void destroy() {
1777 EntityCacheUtil.removeCache(CompanyImpl.class.getName());
1778 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1779 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1780 }
1781
1782 @BeanReference(type = AccountPersistence.class)
1783 protected AccountPersistence accountPersistence;
1784 @BeanReference(type = AddressPersistence.class)
1785 protected AddressPersistence addressPersistence;
1786 @BeanReference(type = BrowserTrackerPersistence.class)
1787 protected BrowserTrackerPersistence browserTrackerPersistence;
1788 @BeanReference(type = ClassNamePersistence.class)
1789 protected ClassNamePersistence classNamePersistence;
1790 @BeanReference(type = ClusterGroupPersistence.class)
1791 protected ClusterGroupPersistence clusterGroupPersistence;
1792 @BeanReference(type = CompanyPersistence.class)
1793 protected CompanyPersistence companyPersistence;
1794 @BeanReference(type = ContactPersistence.class)
1795 protected ContactPersistence contactPersistence;
1796 @BeanReference(type = CountryPersistence.class)
1797 protected CountryPersistence countryPersistence;
1798 @BeanReference(type = EmailAddressPersistence.class)
1799 protected EmailAddressPersistence emailAddressPersistence;
1800 @BeanReference(type = GroupPersistence.class)
1801 protected GroupPersistence groupPersistence;
1802 @BeanReference(type = ImagePersistence.class)
1803 protected ImagePersistence imagePersistence;
1804 @BeanReference(type = LayoutPersistence.class)
1805 protected LayoutPersistence layoutPersistence;
1806 @BeanReference(type = LayoutBranchPersistence.class)
1807 protected LayoutBranchPersistence layoutBranchPersistence;
1808 @BeanReference(type = LayoutPrototypePersistence.class)
1809 protected LayoutPrototypePersistence layoutPrototypePersistence;
1810 @BeanReference(type = LayoutRevisionPersistence.class)
1811 protected LayoutRevisionPersistence layoutRevisionPersistence;
1812 @BeanReference(type = LayoutSetPersistence.class)
1813 protected LayoutSetPersistence layoutSetPersistence;
1814 @BeanReference(type = LayoutSetBranchPersistence.class)
1815 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
1816 @BeanReference(type = LayoutSetPrototypePersistence.class)
1817 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
1818 @BeanReference(type = ListTypePersistence.class)
1819 protected ListTypePersistence listTypePersistence;
1820 @BeanReference(type = LockPersistence.class)
1821 protected LockPersistence lockPersistence;
1822 @BeanReference(type = MembershipRequestPersistence.class)
1823 protected MembershipRequestPersistence membershipRequestPersistence;
1824 @BeanReference(type = OrganizationPersistence.class)
1825 protected OrganizationPersistence organizationPersistence;
1826 @BeanReference(type = OrgGroupPermissionPersistence.class)
1827 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
1828 @BeanReference(type = OrgGroupRolePersistence.class)
1829 protected OrgGroupRolePersistence orgGroupRolePersistence;
1830 @BeanReference(type = OrgLaborPersistence.class)
1831 protected OrgLaborPersistence orgLaborPersistence;
1832 @BeanReference(type = PasswordPolicyPersistence.class)
1833 protected PasswordPolicyPersistence passwordPolicyPersistence;
1834 @BeanReference(type = PasswordPolicyRelPersistence.class)
1835 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1836 @BeanReference(type = PasswordTrackerPersistence.class)
1837 protected PasswordTrackerPersistence passwordTrackerPersistence;
1838 @BeanReference(type = PermissionPersistence.class)
1839 protected PermissionPersistence permissionPersistence;
1840 @BeanReference(type = PhonePersistence.class)
1841 protected PhonePersistence phonePersistence;
1842 @BeanReference(type = PluginSettingPersistence.class)
1843 protected PluginSettingPersistence pluginSettingPersistence;
1844 @BeanReference(type = PortalPreferencesPersistence.class)
1845 protected PortalPreferencesPersistence portalPreferencesPersistence;
1846 @BeanReference(type = PortletPersistence.class)
1847 protected PortletPersistence portletPersistence;
1848 @BeanReference(type = PortletItemPersistence.class)
1849 protected PortletItemPersistence portletItemPersistence;
1850 @BeanReference(type = PortletPreferencesPersistence.class)
1851 protected PortletPreferencesPersistence portletPreferencesPersistence;
1852 @BeanReference(type = RegionPersistence.class)
1853 protected RegionPersistence regionPersistence;
1854 @BeanReference(type = ReleasePersistence.class)
1855 protected ReleasePersistence releasePersistence;
1856 @BeanReference(type = RepositoryPersistence.class)
1857 protected RepositoryPersistence repositoryPersistence;
1858 @BeanReference(type = RepositoryEntryPersistence.class)
1859 protected RepositoryEntryPersistence repositoryEntryPersistence;
1860 @BeanReference(type = ResourcePersistence.class)
1861 protected ResourcePersistence resourcePersistence;
1862 @BeanReference(type = ResourceActionPersistence.class)
1863 protected ResourceActionPersistence resourceActionPersistence;
1864 @BeanReference(type = ResourceBlockPersistence.class)
1865 protected ResourceBlockPersistence resourceBlockPersistence;
1866 @BeanReference(type = ResourceBlockPermissionPersistence.class)
1867 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
1868 @BeanReference(type = ResourceCodePersistence.class)
1869 protected ResourceCodePersistence resourceCodePersistence;
1870 @BeanReference(type = ResourcePermissionPersistence.class)
1871 protected ResourcePermissionPersistence resourcePermissionPersistence;
1872 @BeanReference(type = ResourceTypePermissionPersistence.class)
1873 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
1874 @BeanReference(type = RolePersistence.class)
1875 protected RolePersistence rolePersistence;
1876 @BeanReference(type = ServiceComponentPersistence.class)
1877 protected ServiceComponentPersistence serviceComponentPersistence;
1878 @BeanReference(type = ShardPersistence.class)
1879 protected ShardPersistence shardPersistence;
1880 @BeanReference(type = SubscriptionPersistence.class)
1881 protected SubscriptionPersistence subscriptionPersistence;
1882 @BeanReference(type = TeamPersistence.class)
1883 protected TeamPersistence teamPersistence;
1884 @BeanReference(type = TicketPersistence.class)
1885 protected TicketPersistence ticketPersistence;
1886 @BeanReference(type = UserPersistence.class)
1887 protected UserPersistence userPersistence;
1888 @BeanReference(type = UserGroupPersistence.class)
1889 protected UserGroupPersistence userGroupPersistence;
1890 @BeanReference(type = UserGroupGroupRolePersistence.class)
1891 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
1892 @BeanReference(type = UserGroupRolePersistence.class)
1893 protected UserGroupRolePersistence userGroupRolePersistence;
1894 @BeanReference(type = UserIdMapperPersistence.class)
1895 protected UserIdMapperPersistence userIdMapperPersistence;
1896 @BeanReference(type = UserNotificationEventPersistence.class)
1897 protected UserNotificationEventPersistence userNotificationEventPersistence;
1898 @BeanReference(type = UserTrackerPersistence.class)
1899 protected UserTrackerPersistence userTrackerPersistence;
1900 @BeanReference(type = UserTrackerPathPersistence.class)
1901 protected UserTrackerPathPersistence userTrackerPathPersistence;
1902 @BeanReference(type = VirtualHostPersistence.class)
1903 protected VirtualHostPersistence virtualHostPersistence;
1904 @BeanReference(type = WebDAVPropsPersistence.class)
1905 protected WebDAVPropsPersistence webDAVPropsPersistence;
1906 @BeanReference(type = WebsitePersistence.class)
1907 protected WebsitePersistence websitePersistence;
1908 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
1909 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
1910 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
1911 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
1912 private static final String _SQL_SELECT_COMPANY = "SELECT company FROM Company company";
1913 private static final String _SQL_SELECT_COMPANY_WHERE = "SELECT company FROM Company company WHERE ";
1914 private static final String _SQL_COUNT_COMPANY = "SELECT COUNT(company) FROM Company company";
1915 private static final String _SQL_COUNT_COMPANY_WHERE = "SELECT COUNT(company) FROM Company company WHERE ";
1916 private static final String _FINDER_COLUMN_WEBID_WEBID_1 = "company.webId IS NULL";
1917 private static final String _FINDER_COLUMN_WEBID_WEBID_2 = "company.webId = ?";
1918 private static final String _FINDER_COLUMN_WEBID_WEBID_3 = "(company.webId IS NULL OR company.webId = ?)";
1919 private static final String _FINDER_COLUMN_MX_MX_1 = "company.mx IS NULL";
1920 private static final String _FINDER_COLUMN_MX_MX_2 = "company.mx = ?";
1921 private static final String _FINDER_COLUMN_MX_MX_3 = "(company.mx IS NULL OR company.mx = ?)";
1922 private static final String _FINDER_COLUMN_LOGOID_LOGOID_2 = "company.logoId = ?";
1923 private static final String _FINDER_COLUMN_SYSTEM_SYSTEM_2 = "company.system = ?";
1924 private static final String _ORDER_BY_ENTITY_ALIAS = "company.";
1925 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Company exists with the primary key ";
1926 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Company exists with the key {";
1927 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1928 private static Log _log = LogFactoryUtil.getLog(CompanyPersistenceImpl.class);
1929 private static Company _nullCompany = new CompanyImpl() {
1930 @Override
1931 public Object clone() {
1932 return this;
1933 }
1934
1935 @Override
1936 public CacheModel<Company> toCacheModel() {
1937 return _nullCompanyCacheModel;
1938 }
1939 };
1940
1941 private static CacheModel<Company> _nullCompanyCacheModel = new CacheModel<Company>() {
1942 public Company toEntityModel() {
1943 return _nullCompany;
1944 }
1945 };
1946 }