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