001
014
015 package com.liferay.portal.service.persistence;
016
017 import com.liferay.portal.NoSuchCountryException;
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.Country;
040 import com.liferay.portal.model.ModelListener;
041 import com.liferay.portal.model.impl.CountryImpl;
042 import com.liferay.portal.model.impl.CountryModelImpl;
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 CountryPersistenceImpl extends BasePersistenceImpl<Country>
064 implements CountryPersistence {
065
070 public static final String FINDER_CLASS_NAME_ENTITY = CountryImpl.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_NAME = new FinderPath(CountryModelImpl.ENTITY_CACHE_ENABLED,
076 CountryModelImpl.FINDER_CACHE_ENABLED, CountryImpl.class,
077 FINDER_CLASS_NAME_ENTITY, "fetchByName",
078 new String[] { String.class.getName() },
079 CountryModelImpl.NAME_COLUMN_BITMASK);
080 public static final FinderPath FINDER_PATH_COUNT_BY_NAME = new FinderPath(CountryModelImpl.ENTITY_CACHE_ENABLED,
081 CountryModelImpl.FINDER_CACHE_ENABLED, Long.class,
082 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByName",
083 new String[] { String.class.getName() });
084 public static final FinderPath FINDER_PATH_FETCH_BY_A2 = new FinderPath(CountryModelImpl.ENTITY_CACHE_ENABLED,
085 CountryModelImpl.FINDER_CACHE_ENABLED, CountryImpl.class,
086 FINDER_CLASS_NAME_ENTITY, "fetchByA2",
087 new String[] { String.class.getName() },
088 CountryModelImpl.A2_COLUMN_BITMASK);
089 public static final FinderPath FINDER_PATH_COUNT_BY_A2 = new FinderPath(CountryModelImpl.ENTITY_CACHE_ENABLED,
090 CountryModelImpl.FINDER_CACHE_ENABLED, Long.class,
091 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByA2",
092 new String[] { String.class.getName() });
093 public static final FinderPath FINDER_PATH_FETCH_BY_A3 = new FinderPath(CountryModelImpl.ENTITY_CACHE_ENABLED,
094 CountryModelImpl.FINDER_CACHE_ENABLED, CountryImpl.class,
095 FINDER_CLASS_NAME_ENTITY, "fetchByA3",
096 new String[] { String.class.getName() },
097 CountryModelImpl.A3_COLUMN_BITMASK);
098 public static final FinderPath FINDER_PATH_COUNT_BY_A3 = new FinderPath(CountryModelImpl.ENTITY_CACHE_ENABLED,
099 CountryModelImpl.FINDER_CACHE_ENABLED, Long.class,
100 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByA3",
101 new String[] { String.class.getName() });
102 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_ACTIVE = new FinderPath(CountryModelImpl.ENTITY_CACHE_ENABLED,
103 CountryModelImpl.FINDER_CACHE_ENABLED, CountryImpl.class,
104 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByActive",
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_ACTIVE =
112 new FinderPath(CountryModelImpl.ENTITY_CACHE_ENABLED,
113 CountryModelImpl.FINDER_CACHE_ENABLED, CountryImpl.class,
114 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByActive",
115 new String[] { Boolean.class.getName() },
116 CountryModelImpl.ACTIVE_COLUMN_BITMASK);
117 public static final FinderPath FINDER_PATH_COUNT_BY_ACTIVE = new FinderPath(CountryModelImpl.ENTITY_CACHE_ENABLED,
118 CountryModelImpl.FINDER_CACHE_ENABLED, Long.class,
119 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByActive",
120 new String[] { Boolean.class.getName() });
121 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(CountryModelImpl.ENTITY_CACHE_ENABLED,
122 CountryModelImpl.FINDER_CACHE_ENABLED, CountryImpl.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(CountryModelImpl.ENTITY_CACHE_ENABLED,
125 CountryModelImpl.FINDER_CACHE_ENABLED, CountryImpl.class,
126 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
127 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(CountryModelImpl.ENTITY_CACHE_ENABLED,
128 CountryModelImpl.FINDER_CACHE_ENABLED, Long.class,
129 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
130
131
136 public void cacheResult(Country country) {
137 EntityCacheUtil.putResult(CountryModelImpl.ENTITY_CACHE_ENABLED,
138 CountryImpl.class, country.getPrimaryKey(), country);
139
140 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_NAME,
141 new Object[] { country.getName() }, country);
142
143 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A2,
144 new Object[] { country.getA2() }, country);
145
146 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A3,
147 new Object[] { country.getA3() }, country);
148
149 country.resetOriginalValues();
150 }
151
152
157 public void cacheResult(List<Country> countries) {
158 for (Country country : countries) {
159 if (EntityCacheUtil.getResult(
160 CountryModelImpl.ENTITY_CACHE_ENABLED,
161 CountryImpl.class, country.getPrimaryKey()) == null) {
162 cacheResult(country);
163 }
164 else {
165 country.resetOriginalValues();
166 }
167 }
168 }
169
170
177 @Override
178 public void clearCache() {
179 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
180 CacheRegistryUtil.clear(CountryImpl.class.getName());
181 }
182
183 EntityCacheUtil.clearCache(CountryImpl.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(Country country) {
199 EntityCacheUtil.removeResult(CountryModelImpl.ENTITY_CACHE_ENABLED,
200 CountryImpl.class, country.getPrimaryKey());
201
202 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
203 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
204
205 clearUniqueFindersCache(country);
206 }
207
208 @Override
209 public void clearCache(List<Country> countries) {
210 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
211 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
212
213 for (Country country : countries) {
214 EntityCacheUtil.removeResult(CountryModelImpl.ENTITY_CACHE_ENABLED,
215 CountryImpl.class, country.getPrimaryKey());
216
217 clearUniqueFindersCache(country);
218 }
219 }
220
221 protected void clearUniqueFindersCache(Country country) {
222 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_NAME,
223 new Object[] { country.getName() });
224
225 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_A2,
226 new Object[] { country.getA2() });
227
228 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_A3,
229 new Object[] { country.getA3() });
230 }
231
232
238 public Country create(long countryId) {
239 Country country = new CountryImpl();
240
241 country.setNew(true);
242 country.setPrimaryKey(countryId);
243
244 return country;
245 }
246
247
255 public Country remove(long countryId)
256 throws NoSuchCountryException, SystemException {
257 return remove(Long.valueOf(countryId));
258 }
259
260
268 @Override
269 public Country remove(Serializable primaryKey)
270 throws NoSuchCountryException, SystemException {
271 Session session = null;
272
273 try {
274 session = openSession();
275
276 Country country = (Country)session.get(CountryImpl.class, primaryKey);
277
278 if (country == null) {
279 if (_log.isWarnEnabled()) {
280 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
281 }
282
283 throw new NoSuchCountryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
284 primaryKey);
285 }
286
287 return remove(country);
288 }
289 catch (NoSuchCountryException 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 Country removeImpl(Country country) throws SystemException {
302 country = toUnwrappedModel(country);
303
304 Session session = null;
305
306 try {
307 session = openSession();
308
309 BatchSessionUtil.delete(session, country);
310 }
311 catch (Exception e) {
312 throw processException(e);
313 }
314 finally {
315 closeSession(session);
316 }
317
318 clearCache(country);
319
320 return country;
321 }
322
323 @Override
324 public Country updateImpl(com.liferay.portal.model.Country country,
325 boolean merge) throws SystemException {
326 country = toUnwrappedModel(country);
327
328 boolean isNew = country.isNew();
329
330 CountryModelImpl countryModelImpl = (CountryModelImpl)country;
331
332 Session session = null;
333
334 try {
335 session = openSession();
336
337 BatchSessionUtil.update(session, country, merge);
338
339 country.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 || !CountryModelImpl.COLUMN_BITMASK_ENABLED) {
351 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
352 }
353 else {
354 if ((countryModelImpl.getColumnBitmask() &
355 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ACTIVE.getColumnBitmask()) != 0) {
356 Object[] args = new Object[] {
357 Boolean.valueOf(countryModelImpl.getOriginalActive())
358 };
359
360 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ACTIVE, args);
361 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ACTIVE,
362 args);
363
364 args = new Object[] {
365 Boolean.valueOf(countryModelImpl.getActive())
366 };
367
368 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ACTIVE, args);
369 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ACTIVE,
370 args);
371 }
372 }
373
374 EntityCacheUtil.putResult(CountryModelImpl.ENTITY_CACHE_ENABLED,
375 CountryImpl.class, country.getPrimaryKey(), country);
376
377 if (isNew) {
378 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_NAME,
379 new Object[] { country.getName() }, country);
380
381 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A2,
382 new Object[] { country.getA2() }, country);
383
384 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A3,
385 new Object[] { country.getA3() }, country);
386 }
387 else {
388 if ((countryModelImpl.getColumnBitmask() &
389 FINDER_PATH_FETCH_BY_NAME.getColumnBitmask()) != 0) {
390 Object[] args = new Object[] { countryModelImpl.getOriginalName() };
391
392 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_NAME, args);
393 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_NAME, args);
394
395 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_NAME,
396 new Object[] { country.getName() }, country);
397 }
398
399 if ((countryModelImpl.getColumnBitmask() &
400 FINDER_PATH_FETCH_BY_A2.getColumnBitmask()) != 0) {
401 Object[] args = new Object[] { countryModelImpl.getOriginalA2() };
402
403 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_A2, args);
404 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_A2, args);
405
406 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A2,
407 new Object[] { country.getA2() }, country);
408 }
409
410 if ((countryModelImpl.getColumnBitmask() &
411 FINDER_PATH_FETCH_BY_A3.getColumnBitmask()) != 0) {
412 Object[] args = new Object[] { countryModelImpl.getOriginalA3() };
413
414 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_A3, args);
415 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_A3, args);
416
417 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A3,
418 new Object[] { country.getA3() }, country);
419 }
420 }
421
422 return country;
423 }
424
425 protected Country toUnwrappedModel(Country country) {
426 if (country instanceof CountryImpl) {
427 return country;
428 }
429
430 CountryImpl countryImpl = new CountryImpl();
431
432 countryImpl.setNew(country.isNew());
433 countryImpl.setPrimaryKey(country.getPrimaryKey());
434
435 countryImpl.setCountryId(country.getCountryId());
436 countryImpl.setName(country.getName());
437 countryImpl.setA2(country.getA2());
438 countryImpl.setA3(country.getA3());
439 countryImpl.setNumber(country.getNumber());
440 countryImpl.setIdd(country.getIdd());
441 countryImpl.setZipRequired(country.isZipRequired());
442 countryImpl.setActive(country.isActive());
443
444 return countryImpl;
445 }
446
447
455 @Override
456 public Country findByPrimaryKey(Serializable primaryKey)
457 throws NoSuchModelException, SystemException {
458 return findByPrimaryKey(((Long)primaryKey).longValue());
459 }
460
461
469 public Country findByPrimaryKey(long countryId)
470 throws NoSuchCountryException, SystemException {
471 Country country = fetchByPrimaryKey(countryId);
472
473 if (country == null) {
474 if (_log.isWarnEnabled()) {
475 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + countryId);
476 }
477
478 throw new NoSuchCountryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
479 countryId);
480 }
481
482 return country;
483 }
484
485
492 @Override
493 public Country fetchByPrimaryKey(Serializable primaryKey)
494 throws SystemException {
495 return fetchByPrimaryKey(((Long)primaryKey).longValue());
496 }
497
498
505 public Country fetchByPrimaryKey(long countryId) throws SystemException {
506 Country country = (Country)EntityCacheUtil.getResult(CountryModelImpl.ENTITY_CACHE_ENABLED,
507 CountryImpl.class, countryId);
508
509 if (country == _nullCountry) {
510 return null;
511 }
512
513 if (country == null) {
514 Session session = null;
515
516 boolean hasException = false;
517
518 try {
519 session = openSession();
520
521 country = (Country)session.get(CountryImpl.class,
522 Long.valueOf(countryId));
523 }
524 catch (Exception e) {
525 hasException = true;
526
527 throw processException(e);
528 }
529 finally {
530 if (country != null) {
531 cacheResult(country);
532 }
533 else if (!hasException) {
534 EntityCacheUtil.putResult(CountryModelImpl.ENTITY_CACHE_ENABLED,
535 CountryImpl.class, countryId, _nullCountry);
536 }
537
538 closeSession(session);
539 }
540 }
541
542 return country;
543 }
544
545
553 public Country findByName(String name)
554 throws NoSuchCountryException, SystemException {
555 Country country = fetchByName(name);
556
557 if (country == null) {
558 StringBundler msg = new StringBundler(4);
559
560 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
561
562 msg.append("name=");
563 msg.append(name);
564
565 msg.append(StringPool.CLOSE_CURLY_BRACE);
566
567 if (_log.isWarnEnabled()) {
568 _log.warn(msg.toString());
569 }
570
571 throw new NoSuchCountryException(msg.toString());
572 }
573
574 return country;
575 }
576
577
584 public Country fetchByName(String name) throws SystemException {
585 return fetchByName(name, true);
586 }
587
588
596 public Country fetchByName(String name, boolean retrieveFromCache)
597 throws SystemException {
598 Object[] finderArgs = new Object[] { name };
599
600 Object result = null;
601
602 if (retrieveFromCache) {
603 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_NAME,
604 finderArgs, this);
605 }
606
607 if (result instanceof Country) {
608 Country country = (Country)result;
609
610 if (!Validator.equals(name, country.getName())) {
611 result = null;
612 }
613 }
614
615 if (result == null) {
616 StringBundler query = new StringBundler(3);
617
618 query.append(_SQL_SELECT_COUNTRY_WHERE);
619
620 if (name == null) {
621 query.append(_FINDER_COLUMN_NAME_NAME_1);
622 }
623 else {
624 if (name.equals(StringPool.BLANK)) {
625 query.append(_FINDER_COLUMN_NAME_NAME_3);
626 }
627 else {
628 query.append(_FINDER_COLUMN_NAME_NAME_2);
629 }
630 }
631
632 query.append(CountryModelImpl.ORDER_BY_JPQL);
633
634 String sql = query.toString();
635
636 Session session = null;
637
638 try {
639 session = openSession();
640
641 Query q = session.createQuery(sql);
642
643 QueryPos qPos = QueryPos.getInstance(q);
644
645 if (name != null) {
646 qPos.add(name);
647 }
648
649 List<Country> list = q.list();
650
651 result = list;
652
653 Country country = null;
654
655 if (list.isEmpty()) {
656 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_NAME,
657 finderArgs, list);
658 }
659 else {
660 country = list.get(0);
661
662 cacheResult(country);
663
664 if ((country.getName() == null) ||
665 !country.getName().equals(name)) {
666 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_NAME,
667 finderArgs, country);
668 }
669 }
670
671 return country;
672 }
673 catch (Exception e) {
674 throw processException(e);
675 }
676 finally {
677 if (result == null) {
678 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_NAME,
679 finderArgs);
680 }
681
682 closeSession(session);
683 }
684 }
685 else {
686 if (result instanceof List<?>) {
687 return null;
688 }
689 else {
690 return (Country)result;
691 }
692 }
693 }
694
695
703 public Country findByA2(String a2)
704 throws NoSuchCountryException, SystemException {
705 Country country = fetchByA2(a2);
706
707 if (country == null) {
708 StringBundler msg = new StringBundler(4);
709
710 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
711
712 msg.append("a2=");
713 msg.append(a2);
714
715 msg.append(StringPool.CLOSE_CURLY_BRACE);
716
717 if (_log.isWarnEnabled()) {
718 _log.warn(msg.toString());
719 }
720
721 throw new NoSuchCountryException(msg.toString());
722 }
723
724 return country;
725 }
726
727
734 public Country fetchByA2(String a2) throws SystemException {
735 return fetchByA2(a2, true);
736 }
737
738
746 public Country fetchByA2(String a2, boolean retrieveFromCache)
747 throws SystemException {
748 Object[] finderArgs = new Object[] { a2 };
749
750 Object result = null;
751
752 if (retrieveFromCache) {
753 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_A2,
754 finderArgs, this);
755 }
756
757 if (result instanceof Country) {
758 Country country = (Country)result;
759
760 if (!Validator.equals(a2, country.getA2())) {
761 result = null;
762 }
763 }
764
765 if (result == null) {
766 StringBundler query = new StringBundler(3);
767
768 query.append(_SQL_SELECT_COUNTRY_WHERE);
769
770 if (a2 == null) {
771 query.append(_FINDER_COLUMN_A2_A2_1);
772 }
773 else {
774 if (a2.equals(StringPool.BLANK)) {
775 query.append(_FINDER_COLUMN_A2_A2_3);
776 }
777 else {
778 query.append(_FINDER_COLUMN_A2_A2_2);
779 }
780 }
781
782 query.append(CountryModelImpl.ORDER_BY_JPQL);
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 (a2 != null) {
796 qPos.add(a2);
797 }
798
799 List<Country> list = q.list();
800
801 result = list;
802
803 Country country = null;
804
805 if (list.isEmpty()) {
806 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A2,
807 finderArgs, list);
808 }
809 else {
810 country = list.get(0);
811
812 cacheResult(country);
813
814 if ((country.getA2() == null) ||
815 !country.getA2().equals(a2)) {
816 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A2,
817 finderArgs, country);
818 }
819 }
820
821 return country;
822 }
823 catch (Exception e) {
824 throw processException(e);
825 }
826 finally {
827 if (result == null) {
828 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_A2,
829 finderArgs);
830 }
831
832 closeSession(session);
833 }
834 }
835 else {
836 if (result instanceof List<?>) {
837 return null;
838 }
839 else {
840 return (Country)result;
841 }
842 }
843 }
844
845
853 public Country findByA3(String a3)
854 throws NoSuchCountryException, SystemException {
855 Country country = fetchByA3(a3);
856
857 if (country == null) {
858 StringBundler msg = new StringBundler(4);
859
860 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
861
862 msg.append("a3=");
863 msg.append(a3);
864
865 msg.append(StringPool.CLOSE_CURLY_BRACE);
866
867 if (_log.isWarnEnabled()) {
868 _log.warn(msg.toString());
869 }
870
871 throw new NoSuchCountryException(msg.toString());
872 }
873
874 return country;
875 }
876
877
884 public Country fetchByA3(String a3) throws SystemException {
885 return fetchByA3(a3, true);
886 }
887
888
896 public Country fetchByA3(String a3, boolean retrieveFromCache)
897 throws SystemException {
898 Object[] finderArgs = new Object[] { a3 };
899
900 Object result = null;
901
902 if (retrieveFromCache) {
903 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_A3,
904 finderArgs, this);
905 }
906
907 if (result instanceof Country) {
908 Country country = (Country)result;
909
910 if (!Validator.equals(a3, country.getA3())) {
911 result = null;
912 }
913 }
914
915 if (result == null) {
916 StringBundler query = new StringBundler(3);
917
918 query.append(_SQL_SELECT_COUNTRY_WHERE);
919
920 if (a3 == null) {
921 query.append(_FINDER_COLUMN_A3_A3_1);
922 }
923 else {
924 if (a3.equals(StringPool.BLANK)) {
925 query.append(_FINDER_COLUMN_A3_A3_3);
926 }
927 else {
928 query.append(_FINDER_COLUMN_A3_A3_2);
929 }
930 }
931
932 query.append(CountryModelImpl.ORDER_BY_JPQL);
933
934 String sql = query.toString();
935
936 Session session = null;
937
938 try {
939 session = openSession();
940
941 Query q = session.createQuery(sql);
942
943 QueryPos qPos = QueryPos.getInstance(q);
944
945 if (a3 != null) {
946 qPos.add(a3);
947 }
948
949 List<Country> list = q.list();
950
951 result = list;
952
953 Country country = null;
954
955 if (list.isEmpty()) {
956 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A3,
957 finderArgs, list);
958 }
959 else {
960 country = list.get(0);
961
962 cacheResult(country);
963
964 if ((country.getA3() == null) ||
965 !country.getA3().equals(a3)) {
966 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A3,
967 finderArgs, country);
968 }
969 }
970
971 return country;
972 }
973 catch (Exception e) {
974 throw processException(e);
975 }
976 finally {
977 if (result == null) {
978 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_A3,
979 finderArgs);
980 }
981
982 closeSession(session);
983 }
984 }
985 else {
986 if (result instanceof List<?>) {
987 return null;
988 }
989 else {
990 return (Country)result;
991 }
992 }
993 }
994
995
1002 public List<Country> findByActive(boolean active) throws SystemException {
1003 return findByActive(active, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1004 }
1005
1006
1019 public List<Country> findByActive(boolean active, int start, int end)
1020 throws SystemException {
1021 return findByActive(active, start, end, null);
1022 }
1023
1024
1038 public List<Country> findByActive(boolean active, int start, int end,
1039 OrderByComparator orderByComparator) throws SystemException {
1040 FinderPath finderPath = null;
1041 Object[] finderArgs = null;
1042
1043 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1044 (orderByComparator == null)) {
1045 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ACTIVE;
1046 finderArgs = new Object[] { active };
1047 }
1048 else {
1049 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_ACTIVE;
1050 finderArgs = new Object[] { active, start, end, orderByComparator };
1051 }
1052
1053 List<Country> list = (List<Country>)FinderCacheUtil.getResult(finderPath,
1054 finderArgs, this);
1055
1056 if ((list != null) && !list.isEmpty()) {
1057 for (Country country : list) {
1058 if ((active != country.getActive())) {
1059 list = null;
1060
1061 break;
1062 }
1063 }
1064 }
1065
1066 if (list == null) {
1067 StringBundler query = null;
1068
1069 if (orderByComparator != null) {
1070 query = new StringBundler(3 +
1071 (orderByComparator.getOrderByFields().length * 3));
1072 }
1073 else {
1074 query = new StringBundler(3);
1075 }
1076
1077 query.append(_SQL_SELECT_COUNTRY_WHERE);
1078
1079 query.append(_FINDER_COLUMN_ACTIVE_ACTIVE_2);
1080
1081 if (orderByComparator != null) {
1082 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1083 orderByComparator);
1084 }
1085
1086 else {
1087 query.append(CountryModelImpl.ORDER_BY_JPQL);
1088 }
1089
1090 String sql = query.toString();
1091
1092 Session session = null;
1093
1094 try {
1095 session = openSession();
1096
1097 Query q = session.createQuery(sql);
1098
1099 QueryPos qPos = QueryPos.getInstance(q);
1100
1101 qPos.add(active);
1102
1103 list = (List<Country>)QueryUtil.list(q, getDialect(), start, end);
1104 }
1105 catch (Exception e) {
1106 throw processException(e);
1107 }
1108 finally {
1109 if (list == null) {
1110 FinderCacheUtil.removeResult(finderPath, finderArgs);
1111 }
1112 else {
1113 cacheResult(list);
1114
1115 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1116 }
1117
1118 closeSession(session);
1119 }
1120 }
1121
1122 return list;
1123 }
1124
1125
1138 public Country findByActive_First(boolean active,
1139 OrderByComparator orderByComparator)
1140 throws NoSuchCountryException, SystemException {
1141 List<Country> list = findByActive(active, 0, 1, orderByComparator);
1142
1143 if (list.isEmpty()) {
1144 StringBundler msg = new StringBundler(4);
1145
1146 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1147
1148 msg.append("active=");
1149 msg.append(active);
1150
1151 msg.append(StringPool.CLOSE_CURLY_BRACE);
1152
1153 throw new NoSuchCountryException(msg.toString());
1154 }
1155 else {
1156 return list.get(0);
1157 }
1158 }
1159
1160
1173 public Country findByActive_Last(boolean active,
1174 OrderByComparator orderByComparator)
1175 throws NoSuchCountryException, SystemException {
1176 int count = countByActive(active);
1177
1178 List<Country> list = findByActive(active, count - 1, count,
1179 orderByComparator);
1180
1181 if (list.isEmpty()) {
1182 StringBundler msg = new StringBundler(4);
1183
1184 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1185
1186 msg.append("active=");
1187 msg.append(active);
1188
1189 msg.append(StringPool.CLOSE_CURLY_BRACE);
1190
1191 throw new NoSuchCountryException(msg.toString());
1192 }
1193 else {
1194 return list.get(0);
1195 }
1196 }
1197
1198
1212 public Country[] findByActive_PrevAndNext(long countryId, boolean active,
1213 OrderByComparator orderByComparator)
1214 throws NoSuchCountryException, SystemException {
1215 Country country = findByPrimaryKey(countryId);
1216
1217 Session session = null;
1218
1219 try {
1220 session = openSession();
1221
1222 Country[] array = new CountryImpl[3];
1223
1224 array[0] = getByActive_PrevAndNext(session, country, active,
1225 orderByComparator, true);
1226
1227 array[1] = country;
1228
1229 array[2] = getByActive_PrevAndNext(session, country, active,
1230 orderByComparator, false);
1231
1232 return array;
1233 }
1234 catch (Exception e) {
1235 throw processException(e);
1236 }
1237 finally {
1238 closeSession(session);
1239 }
1240 }
1241
1242 protected Country getByActive_PrevAndNext(Session session, Country country,
1243 boolean active, OrderByComparator orderByComparator, boolean previous) {
1244 StringBundler query = null;
1245
1246 if (orderByComparator != null) {
1247 query = new StringBundler(6 +
1248 (orderByComparator.getOrderByFields().length * 6));
1249 }
1250 else {
1251 query = new StringBundler(3);
1252 }
1253
1254 query.append(_SQL_SELECT_COUNTRY_WHERE);
1255
1256 query.append(_FINDER_COLUMN_ACTIVE_ACTIVE_2);
1257
1258 if (orderByComparator != null) {
1259 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1260
1261 if (orderByConditionFields.length > 0) {
1262 query.append(WHERE_AND);
1263 }
1264
1265 for (int i = 0; i < orderByConditionFields.length; i++) {
1266 query.append(_ORDER_BY_ENTITY_ALIAS);
1267 query.append(orderByConditionFields[i]);
1268
1269 if ((i + 1) < orderByConditionFields.length) {
1270 if (orderByComparator.isAscending() ^ previous) {
1271 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1272 }
1273 else {
1274 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1275 }
1276 }
1277 else {
1278 if (orderByComparator.isAscending() ^ previous) {
1279 query.append(WHERE_GREATER_THAN);
1280 }
1281 else {
1282 query.append(WHERE_LESSER_THAN);
1283 }
1284 }
1285 }
1286
1287 query.append(ORDER_BY_CLAUSE);
1288
1289 String[] orderByFields = orderByComparator.getOrderByFields();
1290
1291 for (int i = 0; i < orderByFields.length; i++) {
1292 query.append(_ORDER_BY_ENTITY_ALIAS);
1293 query.append(orderByFields[i]);
1294
1295 if ((i + 1) < orderByFields.length) {
1296 if (orderByComparator.isAscending() ^ previous) {
1297 query.append(ORDER_BY_ASC_HAS_NEXT);
1298 }
1299 else {
1300 query.append(ORDER_BY_DESC_HAS_NEXT);
1301 }
1302 }
1303 else {
1304 if (orderByComparator.isAscending() ^ previous) {
1305 query.append(ORDER_BY_ASC);
1306 }
1307 else {
1308 query.append(ORDER_BY_DESC);
1309 }
1310 }
1311 }
1312 }
1313
1314 else {
1315 query.append(CountryModelImpl.ORDER_BY_JPQL);
1316 }
1317
1318 String sql = query.toString();
1319
1320 Query q = session.createQuery(sql);
1321
1322 q.setFirstResult(0);
1323 q.setMaxResults(2);
1324
1325 QueryPos qPos = QueryPos.getInstance(q);
1326
1327 qPos.add(active);
1328
1329 if (orderByComparator != null) {
1330 Object[] values = orderByComparator.getOrderByConditionValues(country);
1331
1332 for (Object value : values) {
1333 qPos.add(value);
1334 }
1335 }
1336
1337 List<Country> list = q.list();
1338
1339 if (list.size() == 2) {
1340 return list.get(1);
1341 }
1342 else {
1343 return null;
1344 }
1345 }
1346
1347
1353 public List<Country> findAll() throws SystemException {
1354 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1355 }
1356
1357
1369 public List<Country> findAll(int start, int end) throws SystemException {
1370 return findAll(start, end, null);
1371 }
1372
1373
1386 public List<Country> findAll(int start, int end,
1387 OrderByComparator orderByComparator) throws SystemException {
1388 FinderPath finderPath = null;
1389 Object[] finderArgs = new Object[] { start, end, orderByComparator };
1390
1391 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1392 (orderByComparator == null)) {
1393 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1394 finderArgs = FINDER_ARGS_EMPTY;
1395 }
1396 else {
1397 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1398 finderArgs = new Object[] { start, end, orderByComparator };
1399 }
1400
1401 List<Country> list = (List<Country>)FinderCacheUtil.getResult(finderPath,
1402 finderArgs, this);
1403
1404 if (list == null) {
1405 StringBundler query = null;
1406 String sql = null;
1407
1408 if (orderByComparator != null) {
1409 query = new StringBundler(2 +
1410 (orderByComparator.getOrderByFields().length * 3));
1411
1412 query.append(_SQL_SELECT_COUNTRY);
1413
1414 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1415 orderByComparator);
1416
1417 sql = query.toString();
1418 }
1419 else {
1420 sql = _SQL_SELECT_COUNTRY.concat(CountryModelImpl.ORDER_BY_JPQL);
1421 }
1422
1423 Session session = null;
1424
1425 try {
1426 session = openSession();
1427
1428 Query q = session.createQuery(sql);
1429
1430 if (orderByComparator == null) {
1431 list = (List<Country>)QueryUtil.list(q, getDialect(),
1432 start, end, false);
1433
1434 Collections.sort(list);
1435 }
1436 else {
1437 list = (List<Country>)QueryUtil.list(q, getDialect(),
1438 start, end);
1439 }
1440 }
1441 catch (Exception e) {
1442 throw processException(e);
1443 }
1444 finally {
1445 if (list == null) {
1446 FinderCacheUtil.removeResult(finderPath, finderArgs);
1447 }
1448 else {
1449 cacheResult(list);
1450
1451 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1452 }
1453
1454 closeSession(session);
1455 }
1456 }
1457
1458 return list;
1459 }
1460
1461
1467 public void removeByName(String name)
1468 throws NoSuchCountryException, SystemException {
1469 Country country = findByName(name);
1470
1471 remove(country);
1472 }
1473
1474
1480 public void removeByA2(String a2)
1481 throws NoSuchCountryException, SystemException {
1482 Country country = findByA2(a2);
1483
1484 remove(country);
1485 }
1486
1487
1493 public void removeByA3(String a3)
1494 throws NoSuchCountryException, SystemException {
1495 Country country = findByA3(a3);
1496
1497 remove(country);
1498 }
1499
1500
1506 public void removeByActive(boolean active) throws SystemException {
1507 for (Country country : findByActive(active)) {
1508 remove(country);
1509 }
1510 }
1511
1512
1517 public void removeAll() throws SystemException {
1518 for (Country country : findAll()) {
1519 remove(country);
1520 }
1521 }
1522
1523
1530 public int countByName(String name) throws SystemException {
1531 Object[] finderArgs = new Object[] { name };
1532
1533 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_NAME,
1534 finderArgs, this);
1535
1536 if (count == null) {
1537 StringBundler query = new StringBundler(2);
1538
1539 query.append(_SQL_COUNT_COUNTRY_WHERE);
1540
1541 if (name == null) {
1542 query.append(_FINDER_COLUMN_NAME_NAME_1);
1543 }
1544 else {
1545 if (name.equals(StringPool.BLANK)) {
1546 query.append(_FINDER_COLUMN_NAME_NAME_3);
1547 }
1548 else {
1549 query.append(_FINDER_COLUMN_NAME_NAME_2);
1550 }
1551 }
1552
1553 String sql = query.toString();
1554
1555 Session session = null;
1556
1557 try {
1558 session = openSession();
1559
1560 Query q = session.createQuery(sql);
1561
1562 QueryPos qPos = QueryPos.getInstance(q);
1563
1564 if (name != null) {
1565 qPos.add(name);
1566 }
1567
1568 count = (Long)q.uniqueResult();
1569 }
1570 catch (Exception e) {
1571 throw processException(e);
1572 }
1573 finally {
1574 if (count == null) {
1575 count = Long.valueOf(0);
1576 }
1577
1578 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_NAME,
1579 finderArgs, count);
1580
1581 closeSession(session);
1582 }
1583 }
1584
1585 return count.intValue();
1586 }
1587
1588
1595 public int countByA2(String a2) throws SystemException {
1596 Object[] finderArgs = new Object[] { a2 };
1597
1598 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_A2,
1599 finderArgs, this);
1600
1601 if (count == null) {
1602 StringBundler query = new StringBundler(2);
1603
1604 query.append(_SQL_COUNT_COUNTRY_WHERE);
1605
1606 if (a2 == null) {
1607 query.append(_FINDER_COLUMN_A2_A2_1);
1608 }
1609 else {
1610 if (a2.equals(StringPool.BLANK)) {
1611 query.append(_FINDER_COLUMN_A2_A2_3);
1612 }
1613 else {
1614 query.append(_FINDER_COLUMN_A2_A2_2);
1615 }
1616 }
1617
1618 String sql = query.toString();
1619
1620 Session session = null;
1621
1622 try {
1623 session = openSession();
1624
1625 Query q = session.createQuery(sql);
1626
1627 QueryPos qPos = QueryPos.getInstance(q);
1628
1629 if (a2 != null) {
1630 qPos.add(a2);
1631 }
1632
1633 count = (Long)q.uniqueResult();
1634 }
1635 catch (Exception e) {
1636 throw processException(e);
1637 }
1638 finally {
1639 if (count == null) {
1640 count = Long.valueOf(0);
1641 }
1642
1643 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_A2, finderArgs,
1644 count);
1645
1646 closeSession(session);
1647 }
1648 }
1649
1650 return count.intValue();
1651 }
1652
1653
1660 public int countByA3(String a3) throws SystemException {
1661 Object[] finderArgs = new Object[] { a3 };
1662
1663 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_A3,
1664 finderArgs, this);
1665
1666 if (count == null) {
1667 StringBundler query = new StringBundler(2);
1668
1669 query.append(_SQL_COUNT_COUNTRY_WHERE);
1670
1671 if (a3 == null) {
1672 query.append(_FINDER_COLUMN_A3_A3_1);
1673 }
1674 else {
1675 if (a3.equals(StringPool.BLANK)) {
1676 query.append(_FINDER_COLUMN_A3_A3_3);
1677 }
1678 else {
1679 query.append(_FINDER_COLUMN_A3_A3_2);
1680 }
1681 }
1682
1683 String sql = query.toString();
1684
1685 Session session = null;
1686
1687 try {
1688 session = openSession();
1689
1690 Query q = session.createQuery(sql);
1691
1692 QueryPos qPos = QueryPos.getInstance(q);
1693
1694 if (a3 != null) {
1695 qPos.add(a3);
1696 }
1697
1698 count = (Long)q.uniqueResult();
1699 }
1700 catch (Exception e) {
1701 throw processException(e);
1702 }
1703 finally {
1704 if (count == null) {
1705 count = Long.valueOf(0);
1706 }
1707
1708 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_A3, finderArgs,
1709 count);
1710
1711 closeSession(session);
1712 }
1713 }
1714
1715 return count.intValue();
1716 }
1717
1718
1725 public int countByActive(boolean active) throws SystemException {
1726 Object[] finderArgs = new Object[] { active };
1727
1728 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_ACTIVE,
1729 finderArgs, this);
1730
1731 if (count == null) {
1732 StringBundler query = new StringBundler(2);
1733
1734 query.append(_SQL_COUNT_COUNTRY_WHERE);
1735
1736 query.append(_FINDER_COLUMN_ACTIVE_ACTIVE_2);
1737
1738 String sql = query.toString();
1739
1740 Session session = null;
1741
1742 try {
1743 session = openSession();
1744
1745 Query q = session.createQuery(sql);
1746
1747 QueryPos qPos = QueryPos.getInstance(q);
1748
1749 qPos.add(active);
1750
1751 count = (Long)q.uniqueResult();
1752 }
1753 catch (Exception e) {
1754 throw processException(e);
1755 }
1756 finally {
1757 if (count == null) {
1758 count = Long.valueOf(0);
1759 }
1760
1761 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_ACTIVE,
1762 finderArgs, count);
1763
1764 closeSession(session);
1765 }
1766 }
1767
1768 return count.intValue();
1769 }
1770
1771
1777 public int countAll() throws SystemException {
1778 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1779 FINDER_ARGS_EMPTY, this);
1780
1781 if (count == null) {
1782 Session session = null;
1783
1784 try {
1785 session = openSession();
1786
1787 Query q = session.createQuery(_SQL_COUNT_COUNTRY);
1788
1789 count = (Long)q.uniqueResult();
1790 }
1791 catch (Exception e) {
1792 throw processException(e);
1793 }
1794 finally {
1795 if (count == null) {
1796 count = Long.valueOf(0);
1797 }
1798
1799 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1800 FINDER_ARGS_EMPTY, count);
1801
1802 closeSession(session);
1803 }
1804 }
1805
1806 return count.intValue();
1807 }
1808
1809
1812 public void afterPropertiesSet() {
1813 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1814 com.liferay.portal.util.PropsUtil.get(
1815 "value.object.listener.com.liferay.portal.model.Country")));
1816
1817 if (listenerClassNames.length > 0) {
1818 try {
1819 List<ModelListener<Country>> listenersList = new ArrayList<ModelListener<Country>>();
1820
1821 for (String listenerClassName : listenerClassNames) {
1822 listenersList.add((ModelListener<Country>)InstanceFactory.newInstance(
1823 listenerClassName));
1824 }
1825
1826 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1827 }
1828 catch (Exception e) {
1829 _log.error(e);
1830 }
1831 }
1832 }
1833
1834 public void destroy() {
1835 EntityCacheUtil.removeCache(CountryImpl.class.getName());
1836 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1837 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1838 }
1839
1840 @BeanReference(type = AccountPersistence.class)
1841 protected AccountPersistence accountPersistence;
1842 @BeanReference(type = AddressPersistence.class)
1843 protected AddressPersistence addressPersistence;
1844 @BeanReference(type = BrowserTrackerPersistence.class)
1845 protected BrowserTrackerPersistence browserTrackerPersistence;
1846 @BeanReference(type = ClassNamePersistence.class)
1847 protected ClassNamePersistence classNamePersistence;
1848 @BeanReference(type = ClusterGroupPersistence.class)
1849 protected ClusterGroupPersistence clusterGroupPersistence;
1850 @BeanReference(type = CompanyPersistence.class)
1851 protected CompanyPersistence companyPersistence;
1852 @BeanReference(type = ContactPersistence.class)
1853 protected ContactPersistence contactPersistence;
1854 @BeanReference(type = CountryPersistence.class)
1855 protected CountryPersistence countryPersistence;
1856 @BeanReference(type = EmailAddressPersistence.class)
1857 protected EmailAddressPersistence emailAddressPersistence;
1858 @BeanReference(type = GroupPersistence.class)
1859 protected GroupPersistence groupPersistence;
1860 @BeanReference(type = ImagePersistence.class)
1861 protected ImagePersistence imagePersistence;
1862 @BeanReference(type = LayoutPersistence.class)
1863 protected LayoutPersistence layoutPersistence;
1864 @BeanReference(type = LayoutBranchPersistence.class)
1865 protected LayoutBranchPersistence layoutBranchPersistence;
1866 @BeanReference(type = LayoutPrototypePersistence.class)
1867 protected LayoutPrototypePersistence layoutPrototypePersistence;
1868 @BeanReference(type = LayoutRevisionPersistence.class)
1869 protected LayoutRevisionPersistence layoutRevisionPersistence;
1870 @BeanReference(type = LayoutSetPersistence.class)
1871 protected LayoutSetPersistence layoutSetPersistence;
1872 @BeanReference(type = LayoutSetBranchPersistence.class)
1873 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
1874 @BeanReference(type = LayoutSetPrototypePersistence.class)
1875 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
1876 @BeanReference(type = ListTypePersistence.class)
1877 protected ListTypePersistence listTypePersistence;
1878 @BeanReference(type = LockPersistence.class)
1879 protected LockPersistence lockPersistence;
1880 @BeanReference(type = MembershipRequestPersistence.class)
1881 protected MembershipRequestPersistence membershipRequestPersistence;
1882 @BeanReference(type = OrganizationPersistence.class)
1883 protected OrganizationPersistence organizationPersistence;
1884 @BeanReference(type = OrgGroupPermissionPersistence.class)
1885 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
1886 @BeanReference(type = OrgGroupRolePersistence.class)
1887 protected OrgGroupRolePersistence orgGroupRolePersistence;
1888 @BeanReference(type = OrgLaborPersistence.class)
1889 protected OrgLaborPersistence orgLaborPersistence;
1890 @BeanReference(type = PasswordPolicyPersistence.class)
1891 protected PasswordPolicyPersistence passwordPolicyPersistence;
1892 @BeanReference(type = PasswordPolicyRelPersistence.class)
1893 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1894 @BeanReference(type = PasswordTrackerPersistence.class)
1895 protected PasswordTrackerPersistence passwordTrackerPersistence;
1896 @BeanReference(type = PermissionPersistence.class)
1897 protected PermissionPersistence permissionPersistence;
1898 @BeanReference(type = PhonePersistence.class)
1899 protected PhonePersistence phonePersistence;
1900 @BeanReference(type = PluginSettingPersistence.class)
1901 protected PluginSettingPersistence pluginSettingPersistence;
1902 @BeanReference(type = PortalPreferencesPersistence.class)
1903 protected PortalPreferencesPersistence portalPreferencesPersistence;
1904 @BeanReference(type = PortletPersistence.class)
1905 protected PortletPersistence portletPersistence;
1906 @BeanReference(type = PortletItemPersistence.class)
1907 protected PortletItemPersistence portletItemPersistence;
1908 @BeanReference(type = PortletPreferencesPersistence.class)
1909 protected PortletPreferencesPersistence portletPreferencesPersistence;
1910 @BeanReference(type = RegionPersistence.class)
1911 protected RegionPersistence regionPersistence;
1912 @BeanReference(type = ReleasePersistence.class)
1913 protected ReleasePersistence releasePersistence;
1914 @BeanReference(type = RepositoryPersistence.class)
1915 protected RepositoryPersistence repositoryPersistence;
1916 @BeanReference(type = RepositoryEntryPersistence.class)
1917 protected RepositoryEntryPersistence repositoryEntryPersistence;
1918 @BeanReference(type = ResourcePersistence.class)
1919 protected ResourcePersistence resourcePersistence;
1920 @BeanReference(type = ResourceActionPersistence.class)
1921 protected ResourceActionPersistence resourceActionPersistence;
1922 @BeanReference(type = ResourceBlockPersistence.class)
1923 protected ResourceBlockPersistence resourceBlockPersistence;
1924 @BeanReference(type = ResourceBlockPermissionPersistence.class)
1925 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
1926 @BeanReference(type = ResourceCodePersistence.class)
1927 protected ResourceCodePersistence resourceCodePersistence;
1928 @BeanReference(type = ResourcePermissionPersistence.class)
1929 protected ResourcePermissionPersistence resourcePermissionPersistence;
1930 @BeanReference(type = ResourceTypePermissionPersistence.class)
1931 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
1932 @BeanReference(type = RolePersistence.class)
1933 protected RolePersistence rolePersistence;
1934 @BeanReference(type = ServiceComponentPersistence.class)
1935 protected ServiceComponentPersistence serviceComponentPersistence;
1936 @BeanReference(type = ShardPersistence.class)
1937 protected ShardPersistence shardPersistence;
1938 @BeanReference(type = SubscriptionPersistence.class)
1939 protected SubscriptionPersistence subscriptionPersistence;
1940 @BeanReference(type = TeamPersistence.class)
1941 protected TeamPersistence teamPersistence;
1942 @BeanReference(type = TicketPersistence.class)
1943 protected TicketPersistence ticketPersistence;
1944 @BeanReference(type = UserPersistence.class)
1945 protected UserPersistence userPersistence;
1946 @BeanReference(type = UserGroupPersistence.class)
1947 protected UserGroupPersistence userGroupPersistence;
1948 @BeanReference(type = UserGroupGroupRolePersistence.class)
1949 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
1950 @BeanReference(type = UserGroupRolePersistence.class)
1951 protected UserGroupRolePersistence userGroupRolePersistence;
1952 @BeanReference(type = UserIdMapperPersistence.class)
1953 protected UserIdMapperPersistence userIdMapperPersistence;
1954 @BeanReference(type = UserNotificationEventPersistence.class)
1955 protected UserNotificationEventPersistence userNotificationEventPersistence;
1956 @BeanReference(type = UserTrackerPersistence.class)
1957 protected UserTrackerPersistence userTrackerPersistence;
1958 @BeanReference(type = UserTrackerPathPersistence.class)
1959 protected UserTrackerPathPersistence userTrackerPathPersistence;
1960 @BeanReference(type = VirtualHostPersistence.class)
1961 protected VirtualHostPersistence virtualHostPersistence;
1962 @BeanReference(type = WebDAVPropsPersistence.class)
1963 protected WebDAVPropsPersistence webDAVPropsPersistence;
1964 @BeanReference(type = WebsitePersistence.class)
1965 protected WebsitePersistence websitePersistence;
1966 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
1967 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
1968 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
1969 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
1970 private static final String _SQL_SELECT_COUNTRY = "SELECT country FROM Country country";
1971 private static final String _SQL_SELECT_COUNTRY_WHERE = "SELECT country FROM Country country WHERE ";
1972 private static final String _SQL_COUNT_COUNTRY = "SELECT COUNT(country) FROM Country country";
1973 private static final String _SQL_COUNT_COUNTRY_WHERE = "SELECT COUNT(country) FROM Country country WHERE ";
1974 private static final String _FINDER_COLUMN_NAME_NAME_1 = "country.name IS NULL";
1975 private static final String _FINDER_COLUMN_NAME_NAME_2 = "country.name = ?";
1976 private static final String _FINDER_COLUMN_NAME_NAME_3 = "(country.name IS NULL OR country.name = ?)";
1977 private static final String _FINDER_COLUMN_A2_A2_1 = "country.a2 IS NULL";
1978 private static final String _FINDER_COLUMN_A2_A2_2 = "country.a2 = ?";
1979 private static final String _FINDER_COLUMN_A2_A2_3 = "(country.a2 IS NULL OR country.a2 = ?)";
1980 private static final String _FINDER_COLUMN_A3_A3_1 = "country.a3 IS NULL";
1981 private static final String _FINDER_COLUMN_A3_A3_2 = "country.a3 = ?";
1982 private static final String _FINDER_COLUMN_A3_A3_3 = "(country.a3 IS NULL OR country.a3 = ?)";
1983 private static final String _FINDER_COLUMN_ACTIVE_ACTIVE_2 = "country.active = ?";
1984 private static final String _ORDER_BY_ENTITY_ALIAS = "country.";
1985 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Country exists with the primary key ";
1986 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Country exists with the key {";
1987 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1988 private static Log _log = LogFactoryUtil.getLog(CountryPersistenceImpl.class);
1989 private static Country _nullCountry = new CountryImpl() {
1990 @Override
1991 public Object clone() {
1992 return this;
1993 }
1994
1995 @Override
1996 public CacheModel<Country> toCacheModel() {
1997 return _nullCountryCacheModel;
1998 }
1999 };
2000
2001 private static CacheModel<Country> _nullCountryCacheModel = new CacheModel<Country>() {
2002 public Country toEntityModel() {
2003 return _nullCountry;
2004 }
2005 };
2006 }