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 if (country.isCachedModel()) {
310 country = (Country)session.get(CountryImpl.class,
311 country.getPrimaryKeyObj());
312 }
313
314 session.delete(country);
315 }
316 catch (Exception e) {
317 throw processException(e);
318 }
319 finally {
320 closeSession(session);
321 }
322
323 clearCache(country);
324
325 return country;
326 }
327
328 @Override
329 public Country updateImpl(com.liferay.portal.model.Country country)
330 throws SystemException {
331 country = toUnwrappedModel(country);
332
333 boolean isNew = country.isNew();
334
335 CountryModelImpl countryModelImpl = (CountryModelImpl)country;
336
337 Session session = null;
338
339 try {
340 session = openSession();
341
342 if (country.isNew()) {
343 session.save(country);
344
345 country.setNew(false);
346 }
347 else {
348 session.merge(country);
349 }
350 }
351 catch (Exception e) {
352 throw processException(e);
353 }
354 finally {
355 closeSession(session);
356 }
357
358 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
359
360 if (isNew || !CountryModelImpl.COLUMN_BITMASK_ENABLED) {
361 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
362 }
363
364 else {
365 if ((countryModelImpl.getColumnBitmask() &
366 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ACTIVE.getColumnBitmask()) != 0) {
367 Object[] args = new Object[] {
368 Boolean.valueOf(countryModelImpl.getOriginalActive())
369 };
370
371 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ACTIVE, args);
372 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ACTIVE,
373 args);
374
375 args = new Object[] {
376 Boolean.valueOf(countryModelImpl.getActive())
377 };
378
379 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ACTIVE, args);
380 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ACTIVE,
381 args);
382 }
383 }
384
385 EntityCacheUtil.putResult(CountryModelImpl.ENTITY_CACHE_ENABLED,
386 CountryImpl.class, country.getPrimaryKey(), country);
387
388 if (isNew) {
389 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_NAME,
390 new Object[] { country.getName() }, country);
391
392 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A2,
393 new Object[] { country.getA2() }, country);
394
395 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A3,
396 new Object[] { country.getA3() }, country);
397 }
398 else {
399 if ((countryModelImpl.getColumnBitmask() &
400 FINDER_PATH_FETCH_BY_NAME.getColumnBitmask()) != 0) {
401 Object[] args = new Object[] { countryModelImpl.getOriginalName() };
402
403 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_NAME, args);
404
405 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_NAME, args);
406
407 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_NAME,
408 new Object[] { country.getName() }, country);
409 }
410
411 if ((countryModelImpl.getColumnBitmask() &
412 FINDER_PATH_FETCH_BY_A2.getColumnBitmask()) != 0) {
413 Object[] args = new Object[] { countryModelImpl.getOriginalA2() };
414
415 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_A2, args);
416
417 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_A2, args);
418
419 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A2,
420 new Object[] { country.getA2() }, country);
421 }
422
423 if ((countryModelImpl.getColumnBitmask() &
424 FINDER_PATH_FETCH_BY_A3.getColumnBitmask()) != 0) {
425 Object[] args = new Object[] { countryModelImpl.getOriginalA3() };
426
427 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_A3, args);
428
429 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_A3, args);
430
431 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A3,
432 new Object[] { country.getA3() }, country);
433 }
434 }
435
436 return country;
437 }
438
439 protected Country toUnwrappedModel(Country country) {
440 if (country instanceof CountryImpl) {
441 return country;
442 }
443
444 CountryImpl countryImpl = new CountryImpl();
445
446 countryImpl.setNew(country.isNew());
447 countryImpl.setPrimaryKey(country.getPrimaryKey());
448
449 countryImpl.setCountryId(country.getCountryId());
450 countryImpl.setName(country.getName());
451 countryImpl.setA2(country.getA2());
452 countryImpl.setA3(country.getA3());
453 countryImpl.setNumber(country.getNumber());
454 countryImpl.setIdd(country.getIdd());
455 countryImpl.setZipRequired(country.isZipRequired());
456 countryImpl.setActive(country.isActive());
457
458 return countryImpl;
459 }
460
461
469 @Override
470 public Country findByPrimaryKey(Serializable primaryKey)
471 throws NoSuchModelException, SystemException {
472 return findByPrimaryKey(((Long)primaryKey).longValue());
473 }
474
475
483 public Country findByPrimaryKey(long countryId)
484 throws NoSuchCountryException, SystemException {
485 Country country = fetchByPrimaryKey(countryId);
486
487 if (country == null) {
488 if (_log.isWarnEnabled()) {
489 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + countryId);
490 }
491
492 throw new NoSuchCountryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
493 countryId);
494 }
495
496 return country;
497 }
498
499
506 @Override
507 public Country fetchByPrimaryKey(Serializable primaryKey)
508 throws SystemException {
509 return fetchByPrimaryKey(((Long)primaryKey).longValue());
510 }
511
512
519 public Country fetchByPrimaryKey(long countryId) throws SystemException {
520 Country country = (Country)EntityCacheUtil.getResult(CountryModelImpl.ENTITY_CACHE_ENABLED,
521 CountryImpl.class, countryId);
522
523 if (country == _nullCountry) {
524 return null;
525 }
526
527 if (country == null) {
528 Session session = null;
529
530 boolean hasException = false;
531
532 try {
533 session = openSession();
534
535 country = (Country)session.get(CountryImpl.class,
536 Long.valueOf(countryId));
537 }
538 catch (Exception e) {
539 hasException = true;
540
541 throw processException(e);
542 }
543 finally {
544 if (country != null) {
545 cacheResult(country);
546 }
547 else if (!hasException) {
548 EntityCacheUtil.putResult(CountryModelImpl.ENTITY_CACHE_ENABLED,
549 CountryImpl.class, countryId, _nullCountry);
550 }
551
552 closeSession(session);
553 }
554 }
555
556 return country;
557 }
558
559
567 public Country findByName(String name)
568 throws NoSuchCountryException, SystemException {
569 Country country = fetchByName(name);
570
571 if (country == null) {
572 StringBundler msg = new StringBundler(4);
573
574 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
575
576 msg.append("name=");
577 msg.append(name);
578
579 msg.append(StringPool.CLOSE_CURLY_BRACE);
580
581 if (_log.isWarnEnabled()) {
582 _log.warn(msg.toString());
583 }
584
585 throw new NoSuchCountryException(msg.toString());
586 }
587
588 return country;
589 }
590
591
598 public Country fetchByName(String name) throws SystemException {
599 return fetchByName(name, true);
600 }
601
602
610 public Country fetchByName(String name, boolean retrieveFromCache)
611 throws SystemException {
612 Object[] finderArgs = new Object[] { name };
613
614 Object result = null;
615
616 if (retrieveFromCache) {
617 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_NAME,
618 finderArgs, this);
619 }
620
621 if (result instanceof Country) {
622 Country country = (Country)result;
623
624 if (!Validator.equals(name, country.getName())) {
625 result = null;
626 }
627 }
628
629 if (result == null) {
630 StringBundler query = new StringBundler(3);
631
632 query.append(_SQL_SELECT_COUNTRY_WHERE);
633
634 if (name == null) {
635 query.append(_FINDER_COLUMN_NAME_NAME_1);
636 }
637 else {
638 if (name.equals(StringPool.BLANK)) {
639 query.append(_FINDER_COLUMN_NAME_NAME_3);
640 }
641 else {
642 query.append(_FINDER_COLUMN_NAME_NAME_2);
643 }
644 }
645
646 query.append(CountryModelImpl.ORDER_BY_JPQL);
647
648 String sql = query.toString();
649
650 Session session = null;
651
652 try {
653 session = openSession();
654
655 Query q = session.createQuery(sql);
656
657 QueryPos qPos = QueryPos.getInstance(q);
658
659 if (name != null) {
660 qPos.add(name);
661 }
662
663 List<Country> list = q.list();
664
665 result = list;
666
667 Country country = null;
668
669 if (list.isEmpty()) {
670 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_NAME,
671 finderArgs, list);
672 }
673 else {
674 country = list.get(0);
675
676 cacheResult(country);
677
678 if ((country.getName() == null) ||
679 !country.getName().equals(name)) {
680 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_NAME,
681 finderArgs, country);
682 }
683 }
684
685 return country;
686 }
687 catch (Exception e) {
688 throw processException(e);
689 }
690 finally {
691 if (result == null) {
692 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_NAME,
693 finderArgs);
694 }
695
696 closeSession(session);
697 }
698 }
699 else {
700 if (result instanceof List<?>) {
701 return null;
702 }
703 else {
704 return (Country)result;
705 }
706 }
707 }
708
709
717 public Country findByA2(String a2)
718 throws NoSuchCountryException, SystemException {
719 Country country = fetchByA2(a2);
720
721 if (country == null) {
722 StringBundler msg = new StringBundler(4);
723
724 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
725
726 msg.append("a2=");
727 msg.append(a2);
728
729 msg.append(StringPool.CLOSE_CURLY_BRACE);
730
731 if (_log.isWarnEnabled()) {
732 _log.warn(msg.toString());
733 }
734
735 throw new NoSuchCountryException(msg.toString());
736 }
737
738 return country;
739 }
740
741
748 public Country fetchByA2(String a2) throws SystemException {
749 return fetchByA2(a2, true);
750 }
751
752
760 public Country fetchByA2(String a2, boolean retrieveFromCache)
761 throws SystemException {
762 Object[] finderArgs = new Object[] { a2 };
763
764 Object result = null;
765
766 if (retrieveFromCache) {
767 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_A2,
768 finderArgs, this);
769 }
770
771 if (result instanceof Country) {
772 Country country = (Country)result;
773
774 if (!Validator.equals(a2, country.getA2())) {
775 result = null;
776 }
777 }
778
779 if (result == null) {
780 StringBundler query = new StringBundler(3);
781
782 query.append(_SQL_SELECT_COUNTRY_WHERE);
783
784 if (a2 == null) {
785 query.append(_FINDER_COLUMN_A2_A2_1);
786 }
787 else {
788 if (a2.equals(StringPool.BLANK)) {
789 query.append(_FINDER_COLUMN_A2_A2_3);
790 }
791 else {
792 query.append(_FINDER_COLUMN_A2_A2_2);
793 }
794 }
795
796 query.append(CountryModelImpl.ORDER_BY_JPQL);
797
798 String sql = query.toString();
799
800 Session session = null;
801
802 try {
803 session = openSession();
804
805 Query q = session.createQuery(sql);
806
807 QueryPos qPos = QueryPos.getInstance(q);
808
809 if (a2 != null) {
810 qPos.add(a2);
811 }
812
813 List<Country> list = q.list();
814
815 result = list;
816
817 Country country = null;
818
819 if (list.isEmpty()) {
820 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A2,
821 finderArgs, list);
822 }
823 else {
824 country = list.get(0);
825
826 cacheResult(country);
827
828 if ((country.getA2() == null) ||
829 !country.getA2().equals(a2)) {
830 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A2,
831 finderArgs, country);
832 }
833 }
834
835 return country;
836 }
837 catch (Exception e) {
838 throw processException(e);
839 }
840 finally {
841 if (result == null) {
842 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_A2,
843 finderArgs);
844 }
845
846 closeSession(session);
847 }
848 }
849 else {
850 if (result instanceof List<?>) {
851 return null;
852 }
853 else {
854 return (Country)result;
855 }
856 }
857 }
858
859
867 public Country findByA3(String a3)
868 throws NoSuchCountryException, SystemException {
869 Country country = fetchByA3(a3);
870
871 if (country == null) {
872 StringBundler msg = new StringBundler(4);
873
874 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
875
876 msg.append("a3=");
877 msg.append(a3);
878
879 msg.append(StringPool.CLOSE_CURLY_BRACE);
880
881 if (_log.isWarnEnabled()) {
882 _log.warn(msg.toString());
883 }
884
885 throw new NoSuchCountryException(msg.toString());
886 }
887
888 return country;
889 }
890
891
898 public Country fetchByA3(String a3) throws SystemException {
899 return fetchByA3(a3, true);
900 }
901
902
910 public Country fetchByA3(String a3, boolean retrieveFromCache)
911 throws SystemException {
912 Object[] finderArgs = new Object[] { a3 };
913
914 Object result = null;
915
916 if (retrieveFromCache) {
917 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_A3,
918 finderArgs, this);
919 }
920
921 if (result instanceof Country) {
922 Country country = (Country)result;
923
924 if (!Validator.equals(a3, country.getA3())) {
925 result = null;
926 }
927 }
928
929 if (result == null) {
930 StringBundler query = new StringBundler(3);
931
932 query.append(_SQL_SELECT_COUNTRY_WHERE);
933
934 if (a3 == null) {
935 query.append(_FINDER_COLUMN_A3_A3_1);
936 }
937 else {
938 if (a3.equals(StringPool.BLANK)) {
939 query.append(_FINDER_COLUMN_A3_A3_3);
940 }
941 else {
942 query.append(_FINDER_COLUMN_A3_A3_2);
943 }
944 }
945
946 query.append(CountryModelImpl.ORDER_BY_JPQL);
947
948 String sql = query.toString();
949
950 Session session = null;
951
952 try {
953 session = openSession();
954
955 Query q = session.createQuery(sql);
956
957 QueryPos qPos = QueryPos.getInstance(q);
958
959 if (a3 != null) {
960 qPos.add(a3);
961 }
962
963 List<Country> list = q.list();
964
965 result = list;
966
967 Country country = null;
968
969 if (list.isEmpty()) {
970 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A3,
971 finderArgs, list);
972 }
973 else {
974 country = list.get(0);
975
976 cacheResult(country);
977
978 if ((country.getA3() == null) ||
979 !country.getA3().equals(a3)) {
980 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A3,
981 finderArgs, country);
982 }
983 }
984
985 return country;
986 }
987 catch (Exception e) {
988 throw processException(e);
989 }
990 finally {
991 if (result == null) {
992 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_A3,
993 finderArgs);
994 }
995
996 closeSession(session);
997 }
998 }
999 else {
1000 if (result instanceof List<?>) {
1001 return null;
1002 }
1003 else {
1004 return (Country)result;
1005 }
1006 }
1007 }
1008
1009
1016 public List<Country> findByActive(boolean active) throws SystemException {
1017 return findByActive(active, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1018 }
1019
1020
1033 public List<Country> findByActive(boolean active, int start, int end)
1034 throws SystemException {
1035 return findByActive(active, start, end, null);
1036 }
1037
1038
1052 public List<Country> findByActive(boolean active, int start, int end,
1053 OrderByComparator orderByComparator) throws SystemException {
1054 FinderPath finderPath = null;
1055 Object[] finderArgs = null;
1056
1057 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1058 (orderByComparator == null)) {
1059 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ACTIVE;
1060 finderArgs = new Object[] { active };
1061 }
1062 else {
1063 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_ACTIVE;
1064 finderArgs = new Object[] { active, start, end, orderByComparator };
1065 }
1066
1067 List<Country> list = (List<Country>)FinderCacheUtil.getResult(finderPath,
1068 finderArgs, this);
1069
1070 if ((list != null) && !list.isEmpty()) {
1071 for (Country country : list) {
1072 if ((active != country.getActive())) {
1073 list = null;
1074
1075 break;
1076 }
1077 }
1078 }
1079
1080 if (list == null) {
1081 StringBundler query = null;
1082
1083 if (orderByComparator != null) {
1084 query = new StringBundler(3 +
1085 (orderByComparator.getOrderByFields().length * 3));
1086 }
1087 else {
1088 query = new StringBundler(3);
1089 }
1090
1091 query.append(_SQL_SELECT_COUNTRY_WHERE);
1092
1093 query.append(_FINDER_COLUMN_ACTIVE_ACTIVE_2);
1094
1095 if (orderByComparator != null) {
1096 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1097 orderByComparator);
1098 }
1099
1100 else {
1101 query.append(CountryModelImpl.ORDER_BY_JPQL);
1102 }
1103
1104 String sql = query.toString();
1105
1106 Session session = null;
1107
1108 try {
1109 session = openSession();
1110
1111 Query q = session.createQuery(sql);
1112
1113 QueryPos qPos = QueryPos.getInstance(q);
1114
1115 qPos.add(active);
1116
1117 list = (List<Country>)QueryUtil.list(q, getDialect(), start, end);
1118 }
1119 catch (Exception e) {
1120 throw processException(e);
1121 }
1122 finally {
1123 if (list == null) {
1124 FinderCacheUtil.removeResult(finderPath, finderArgs);
1125 }
1126 else {
1127 cacheResult(list);
1128
1129 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1130 }
1131
1132 closeSession(session);
1133 }
1134 }
1135
1136 return list;
1137 }
1138
1139
1148 public Country findByActive_First(boolean active,
1149 OrderByComparator orderByComparator)
1150 throws NoSuchCountryException, SystemException {
1151 Country country = fetchByActive_First(active, orderByComparator);
1152
1153 if (country != null) {
1154 return country;
1155 }
1156
1157 StringBundler msg = new StringBundler(4);
1158
1159 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1160
1161 msg.append("active=");
1162 msg.append(active);
1163
1164 msg.append(StringPool.CLOSE_CURLY_BRACE);
1165
1166 throw new NoSuchCountryException(msg.toString());
1167 }
1168
1169
1177 public Country fetchByActive_First(boolean active,
1178 OrderByComparator orderByComparator) throws SystemException {
1179 List<Country> list = findByActive(active, 0, 1, orderByComparator);
1180
1181 if (!list.isEmpty()) {
1182 return list.get(0);
1183 }
1184
1185 return null;
1186 }
1187
1188
1197 public Country findByActive_Last(boolean active,
1198 OrderByComparator orderByComparator)
1199 throws NoSuchCountryException, SystemException {
1200 Country country = fetchByActive_Last(active, orderByComparator);
1201
1202 if (country != null) {
1203 return country;
1204 }
1205
1206 StringBundler msg = new StringBundler(4);
1207
1208 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1209
1210 msg.append("active=");
1211 msg.append(active);
1212
1213 msg.append(StringPool.CLOSE_CURLY_BRACE);
1214
1215 throw new NoSuchCountryException(msg.toString());
1216 }
1217
1218
1226 public Country fetchByActive_Last(boolean active,
1227 OrderByComparator orderByComparator) throws SystemException {
1228 int count = countByActive(active);
1229
1230 List<Country> list = findByActive(active, count - 1, count,
1231 orderByComparator);
1232
1233 if (!list.isEmpty()) {
1234 return list.get(0);
1235 }
1236
1237 return null;
1238 }
1239
1240
1250 public Country[] findByActive_PrevAndNext(long countryId, boolean active,
1251 OrderByComparator orderByComparator)
1252 throws NoSuchCountryException, SystemException {
1253 Country country = findByPrimaryKey(countryId);
1254
1255 Session session = null;
1256
1257 try {
1258 session = openSession();
1259
1260 Country[] array = new CountryImpl[3];
1261
1262 array[0] = getByActive_PrevAndNext(session, country, active,
1263 orderByComparator, true);
1264
1265 array[1] = country;
1266
1267 array[2] = getByActive_PrevAndNext(session, country, active,
1268 orderByComparator, false);
1269
1270 return array;
1271 }
1272 catch (Exception e) {
1273 throw processException(e);
1274 }
1275 finally {
1276 closeSession(session);
1277 }
1278 }
1279
1280 protected Country getByActive_PrevAndNext(Session session, Country country,
1281 boolean active, OrderByComparator orderByComparator, boolean previous) {
1282 StringBundler query = null;
1283
1284 if (orderByComparator != null) {
1285 query = new StringBundler(6 +
1286 (orderByComparator.getOrderByFields().length * 6));
1287 }
1288 else {
1289 query = new StringBundler(3);
1290 }
1291
1292 query.append(_SQL_SELECT_COUNTRY_WHERE);
1293
1294 query.append(_FINDER_COLUMN_ACTIVE_ACTIVE_2);
1295
1296 if (orderByComparator != null) {
1297 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1298
1299 if (orderByConditionFields.length > 0) {
1300 query.append(WHERE_AND);
1301 }
1302
1303 for (int i = 0; i < orderByConditionFields.length; i++) {
1304 query.append(_ORDER_BY_ENTITY_ALIAS);
1305 query.append(orderByConditionFields[i]);
1306
1307 if ((i + 1) < orderByConditionFields.length) {
1308 if (orderByComparator.isAscending() ^ previous) {
1309 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1310 }
1311 else {
1312 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1313 }
1314 }
1315 else {
1316 if (orderByComparator.isAscending() ^ previous) {
1317 query.append(WHERE_GREATER_THAN);
1318 }
1319 else {
1320 query.append(WHERE_LESSER_THAN);
1321 }
1322 }
1323 }
1324
1325 query.append(ORDER_BY_CLAUSE);
1326
1327 String[] orderByFields = orderByComparator.getOrderByFields();
1328
1329 for (int i = 0; i < orderByFields.length; i++) {
1330 query.append(_ORDER_BY_ENTITY_ALIAS);
1331 query.append(orderByFields[i]);
1332
1333 if ((i + 1) < orderByFields.length) {
1334 if (orderByComparator.isAscending() ^ previous) {
1335 query.append(ORDER_BY_ASC_HAS_NEXT);
1336 }
1337 else {
1338 query.append(ORDER_BY_DESC_HAS_NEXT);
1339 }
1340 }
1341 else {
1342 if (orderByComparator.isAscending() ^ previous) {
1343 query.append(ORDER_BY_ASC);
1344 }
1345 else {
1346 query.append(ORDER_BY_DESC);
1347 }
1348 }
1349 }
1350 }
1351
1352 else {
1353 query.append(CountryModelImpl.ORDER_BY_JPQL);
1354 }
1355
1356 String sql = query.toString();
1357
1358 Query q = session.createQuery(sql);
1359
1360 q.setFirstResult(0);
1361 q.setMaxResults(2);
1362
1363 QueryPos qPos = QueryPos.getInstance(q);
1364
1365 qPos.add(active);
1366
1367 if (orderByComparator != null) {
1368 Object[] values = orderByComparator.getOrderByConditionValues(country);
1369
1370 for (Object value : values) {
1371 qPos.add(value);
1372 }
1373 }
1374
1375 List<Country> list = q.list();
1376
1377 if (list.size() == 2) {
1378 return list.get(1);
1379 }
1380 else {
1381 return null;
1382 }
1383 }
1384
1385
1391 public List<Country> findAll() throws SystemException {
1392 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1393 }
1394
1395
1407 public List<Country> findAll(int start, int end) throws SystemException {
1408 return findAll(start, end, null);
1409 }
1410
1411
1424 public List<Country> findAll(int start, int end,
1425 OrderByComparator orderByComparator) throws SystemException {
1426 FinderPath finderPath = null;
1427 Object[] finderArgs = new Object[] { start, end, orderByComparator };
1428
1429 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1430 (orderByComparator == null)) {
1431 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1432 finderArgs = FINDER_ARGS_EMPTY;
1433 }
1434 else {
1435 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1436 finderArgs = new Object[] { start, end, orderByComparator };
1437 }
1438
1439 List<Country> list = (List<Country>)FinderCacheUtil.getResult(finderPath,
1440 finderArgs, this);
1441
1442 if (list == null) {
1443 StringBundler query = null;
1444 String sql = null;
1445
1446 if (orderByComparator != null) {
1447 query = new StringBundler(2 +
1448 (orderByComparator.getOrderByFields().length * 3));
1449
1450 query.append(_SQL_SELECT_COUNTRY);
1451
1452 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1453 orderByComparator);
1454
1455 sql = query.toString();
1456 }
1457 else {
1458 sql = _SQL_SELECT_COUNTRY.concat(CountryModelImpl.ORDER_BY_JPQL);
1459 }
1460
1461 Session session = null;
1462
1463 try {
1464 session = openSession();
1465
1466 Query q = session.createQuery(sql);
1467
1468 if (orderByComparator == null) {
1469 list = (List<Country>)QueryUtil.list(q, getDialect(),
1470 start, end, false);
1471
1472 Collections.sort(list);
1473 }
1474 else {
1475 list = (List<Country>)QueryUtil.list(q, getDialect(),
1476 start, end);
1477 }
1478 }
1479 catch (Exception e) {
1480 throw processException(e);
1481 }
1482 finally {
1483 if (list == null) {
1484 FinderCacheUtil.removeResult(finderPath, finderArgs);
1485 }
1486 else {
1487 cacheResult(list);
1488
1489 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1490 }
1491
1492 closeSession(session);
1493 }
1494 }
1495
1496 return list;
1497 }
1498
1499
1506 public Country removeByName(String name)
1507 throws NoSuchCountryException, SystemException {
1508 Country country = findByName(name);
1509
1510 return remove(country);
1511 }
1512
1513
1520 public Country removeByA2(String a2)
1521 throws NoSuchCountryException, SystemException {
1522 Country country = findByA2(a2);
1523
1524 return remove(country);
1525 }
1526
1527
1534 public Country removeByA3(String a3)
1535 throws NoSuchCountryException, SystemException {
1536 Country country = findByA3(a3);
1537
1538 return remove(country);
1539 }
1540
1541
1547 public void removeByActive(boolean active) throws SystemException {
1548 for (Country country : findByActive(active)) {
1549 remove(country);
1550 }
1551 }
1552
1553
1558 public void removeAll() throws SystemException {
1559 for (Country country : findAll()) {
1560 remove(country);
1561 }
1562 }
1563
1564
1571 public int countByName(String name) throws SystemException {
1572 Object[] finderArgs = new Object[] { name };
1573
1574 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_NAME,
1575 finderArgs, this);
1576
1577 if (count == null) {
1578 StringBundler query = new StringBundler(2);
1579
1580 query.append(_SQL_COUNT_COUNTRY_WHERE);
1581
1582 if (name == null) {
1583 query.append(_FINDER_COLUMN_NAME_NAME_1);
1584 }
1585 else {
1586 if (name.equals(StringPool.BLANK)) {
1587 query.append(_FINDER_COLUMN_NAME_NAME_3);
1588 }
1589 else {
1590 query.append(_FINDER_COLUMN_NAME_NAME_2);
1591 }
1592 }
1593
1594 String sql = query.toString();
1595
1596 Session session = null;
1597
1598 try {
1599 session = openSession();
1600
1601 Query q = session.createQuery(sql);
1602
1603 QueryPos qPos = QueryPos.getInstance(q);
1604
1605 if (name != null) {
1606 qPos.add(name);
1607 }
1608
1609 count = (Long)q.uniqueResult();
1610 }
1611 catch (Exception e) {
1612 throw processException(e);
1613 }
1614 finally {
1615 if (count == null) {
1616 count = Long.valueOf(0);
1617 }
1618
1619 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_NAME,
1620 finderArgs, count);
1621
1622 closeSession(session);
1623 }
1624 }
1625
1626 return count.intValue();
1627 }
1628
1629
1636 public int countByA2(String a2) throws SystemException {
1637 Object[] finderArgs = new Object[] { a2 };
1638
1639 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_A2,
1640 finderArgs, this);
1641
1642 if (count == null) {
1643 StringBundler query = new StringBundler(2);
1644
1645 query.append(_SQL_COUNT_COUNTRY_WHERE);
1646
1647 if (a2 == null) {
1648 query.append(_FINDER_COLUMN_A2_A2_1);
1649 }
1650 else {
1651 if (a2.equals(StringPool.BLANK)) {
1652 query.append(_FINDER_COLUMN_A2_A2_3);
1653 }
1654 else {
1655 query.append(_FINDER_COLUMN_A2_A2_2);
1656 }
1657 }
1658
1659 String sql = query.toString();
1660
1661 Session session = null;
1662
1663 try {
1664 session = openSession();
1665
1666 Query q = session.createQuery(sql);
1667
1668 QueryPos qPos = QueryPos.getInstance(q);
1669
1670 if (a2 != null) {
1671 qPos.add(a2);
1672 }
1673
1674 count = (Long)q.uniqueResult();
1675 }
1676 catch (Exception e) {
1677 throw processException(e);
1678 }
1679 finally {
1680 if (count == null) {
1681 count = Long.valueOf(0);
1682 }
1683
1684 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_A2, finderArgs,
1685 count);
1686
1687 closeSession(session);
1688 }
1689 }
1690
1691 return count.intValue();
1692 }
1693
1694
1701 public int countByA3(String a3) throws SystemException {
1702 Object[] finderArgs = new Object[] { a3 };
1703
1704 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_A3,
1705 finderArgs, this);
1706
1707 if (count == null) {
1708 StringBundler query = new StringBundler(2);
1709
1710 query.append(_SQL_COUNT_COUNTRY_WHERE);
1711
1712 if (a3 == null) {
1713 query.append(_FINDER_COLUMN_A3_A3_1);
1714 }
1715 else {
1716 if (a3.equals(StringPool.BLANK)) {
1717 query.append(_FINDER_COLUMN_A3_A3_3);
1718 }
1719 else {
1720 query.append(_FINDER_COLUMN_A3_A3_2);
1721 }
1722 }
1723
1724 String sql = query.toString();
1725
1726 Session session = null;
1727
1728 try {
1729 session = openSession();
1730
1731 Query q = session.createQuery(sql);
1732
1733 QueryPos qPos = QueryPos.getInstance(q);
1734
1735 if (a3 != null) {
1736 qPos.add(a3);
1737 }
1738
1739 count = (Long)q.uniqueResult();
1740 }
1741 catch (Exception e) {
1742 throw processException(e);
1743 }
1744 finally {
1745 if (count == null) {
1746 count = Long.valueOf(0);
1747 }
1748
1749 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_A3, finderArgs,
1750 count);
1751
1752 closeSession(session);
1753 }
1754 }
1755
1756 return count.intValue();
1757 }
1758
1759
1766 public int countByActive(boolean active) throws SystemException {
1767 Object[] finderArgs = new Object[] { active };
1768
1769 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_ACTIVE,
1770 finderArgs, this);
1771
1772 if (count == null) {
1773 StringBundler query = new StringBundler(2);
1774
1775 query.append(_SQL_COUNT_COUNTRY_WHERE);
1776
1777 query.append(_FINDER_COLUMN_ACTIVE_ACTIVE_2);
1778
1779 String sql = query.toString();
1780
1781 Session session = null;
1782
1783 try {
1784 session = openSession();
1785
1786 Query q = session.createQuery(sql);
1787
1788 QueryPos qPos = QueryPos.getInstance(q);
1789
1790 qPos.add(active);
1791
1792 count = (Long)q.uniqueResult();
1793 }
1794 catch (Exception e) {
1795 throw processException(e);
1796 }
1797 finally {
1798 if (count == null) {
1799 count = Long.valueOf(0);
1800 }
1801
1802 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_ACTIVE,
1803 finderArgs, count);
1804
1805 closeSession(session);
1806 }
1807 }
1808
1809 return count.intValue();
1810 }
1811
1812
1818 public int countAll() throws SystemException {
1819 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1820 FINDER_ARGS_EMPTY, this);
1821
1822 if (count == null) {
1823 Session session = null;
1824
1825 try {
1826 session = openSession();
1827
1828 Query q = session.createQuery(_SQL_COUNT_COUNTRY);
1829
1830 count = (Long)q.uniqueResult();
1831 }
1832 catch (Exception e) {
1833 throw processException(e);
1834 }
1835 finally {
1836 if (count == null) {
1837 count = Long.valueOf(0);
1838 }
1839
1840 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1841 FINDER_ARGS_EMPTY, count);
1842
1843 closeSession(session);
1844 }
1845 }
1846
1847 return count.intValue();
1848 }
1849
1850
1853 public void afterPropertiesSet() {
1854 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1855 com.liferay.portal.util.PropsUtil.get(
1856 "value.object.listener.com.liferay.portal.model.Country")));
1857
1858 if (listenerClassNames.length > 0) {
1859 try {
1860 List<ModelListener<Country>> listenersList = new ArrayList<ModelListener<Country>>();
1861
1862 for (String listenerClassName : listenerClassNames) {
1863 listenersList.add((ModelListener<Country>)InstanceFactory.newInstance(
1864 listenerClassName));
1865 }
1866
1867 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1868 }
1869 catch (Exception e) {
1870 _log.error(e);
1871 }
1872 }
1873 }
1874
1875 public void destroy() {
1876 EntityCacheUtil.removeCache(CountryImpl.class.getName());
1877 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1878 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1879 }
1880
1881 @BeanReference(type = AccountPersistence.class)
1882 protected AccountPersistence accountPersistence;
1883 @BeanReference(type = AddressPersistence.class)
1884 protected AddressPersistence addressPersistence;
1885 @BeanReference(type = BrowserTrackerPersistence.class)
1886 protected BrowserTrackerPersistence browserTrackerPersistence;
1887 @BeanReference(type = ClassNamePersistence.class)
1888 protected ClassNamePersistence classNamePersistence;
1889 @BeanReference(type = ClusterGroupPersistence.class)
1890 protected ClusterGroupPersistence clusterGroupPersistence;
1891 @BeanReference(type = CompanyPersistence.class)
1892 protected CompanyPersistence companyPersistence;
1893 @BeanReference(type = ContactPersistence.class)
1894 protected ContactPersistence contactPersistence;
1895 @BeanReference(type = CountryPersistence.class)
1896 protected CountryPersistence countryPersistence;
1897 @BeanReference(type = EmailAddressPersistence.class)
1898 protected EmailAddressPersistence emailAddressPersistence;
1899 @BeanReference(type = GroupPersistence.class)
1900 protected GroupPersistence groupPersistence;
1901 @BeanReference(type = ImagePersistence.class)
1902 protected ImagePersistence imagePersistence;
1903 @BeanReference(type = LayoutPersistence.class)
1904 protected LayoutPersistence layoutPersistence;
1905 @BeanReference(type = LayoutBranchPersistence.class)
1906 protected LayoutBranchPersistence layoutBranchPersistence;
1907 @BeanReference(type = LayoutPrototypePersistence.class)
1908 protected LayoutPrototypePersistence layoutPrototypePersistence;
1909 @BeanReference(type = LayoutRevisionPersistence.class)
1910 protected LayoutRevisionPersistence layoutRevisionPersistence;
1911 @BeanReference(type = LayoutSetPersistence.class)
1912 protected LayoutSetPersistence layoutSetPersistence;
1913 @BeanReference(type = LayoutSetBranchPersistence.class)
1914 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
1915 @BeanReference(type = LayoutSetPrototypePersistence.class)
1916 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
1917 @BeanReference(type = ListTypePersistence.class)
1918 protected ListTypePersistence listTypePersistence;
1919 @BeanReference(type = LockPersistence.class)
1920 protected LockPersistence lockPersistence;
1921 @BeanReference(type = MembershipRequestPersistence.class)
1922 protected MembershipRequestPersistence membershipRequestPersistence;
1923 @BeanReference(type = OrganizationPersistence.class)
1924 protected OrganizationPersistence organizationPersistence;
1925 @BeanReference(type = OrgGroupRolePersistence.class)
1926 protected OrgGroupRolePersistence orgGroupRolePersistence;
1927 @BeanReference(type = OrgLaborPersistence.class)
1928 protected OrgLaborPersistence orgLaborPersistence;
1929 @BeanReference(type = PasswordPolicyPersistence.class)
1930 protected PasswordPolicyPersistence passwordPolicyPersistence;
1931 @BeanReference(type = PasswordPolicyRelPersistence.class)
1932 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1933 @BeanReference(type = PasswordTrackerPersistence.class)
1934 protected PasswordTrackerPersistence passwordTrackerPersistence;
1935 @BeanReference(type = PhonePersistence.class)
1936 protected PhonePersistence phonePersistence;
1937 @BeanReference(type = PluginSettingPersistence.class)
1938 protected PluginSettingPersistence pluginSettingPersistence;
1939 @BeanReference(type = PortalPreferencesPersistence.class)
1940 protected PortalPreferencesPersistence portalPreferencesPersistence;
1941 @BeanReference(type = PortletPersistence.class)
1942 protected PortletPersistence portletPersistence;
1943 @BeanReference(type = PortletItemPersistence.class)
1944 protected PortletItemPersistence portletItemPersistence;
1945 @BeanReference(type = PortletPreferencesPersistence.class)
1946 protected PortletPreferencesPersistence portletPreferencesPersistence;
1947 @BeanReference(type = RegionPersistence.class)
1948 protected RegionPersistence regionPersistence;
1949 @BeanReference(type = ReleasePersistence.class)
1950 protected ReleasePersistence releasePersistence;
1951 @BeanReference(type = RepositoryPersistence.class)
1952 protected RepositoryPersistence repositoryPersistence;
1953 @BeanReference(type = RepositoryEntryPersistence.class)
1954 protected RepositoryEntryPersistence repositoryEntryPersistence;
1955 @BeanReference(type = ResourceActionPersistence.class)
1956 protected ResourceActionPersistence resourceActionPersistence;
1957 @BeanReference(type = ResourceBlockPersistence.class)
1958 protected ResourceBlockPersistence resourceBlockPersistence;
1959 @BeanReference(type = ResourceBlockPermissionPersistence.class)
1960 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
1961 @BeanReference(type = ResourcePermissionPersistence.class)
1962 protected ResourcePermissionPersistence resourcePermissionPersistence;
1963 @BeanReference(type = ResourceTypePermissionPersistence.class)
1964 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
1965 @BeanReference(type = RolePersistence.class)
1966 protected RolePersistence rolePersistence;
1967 @BeanReference(type = ServiceComponentPersistence.class)
1968 protected ServiceComponentPersistence serviceComponentPersistence;
1969 @BeanReference(type = ShardPersistence.class)
1970 protected ShardPersistence shardPersistence;
1971 @BeanReference(type = SubscriptionPersistence.class)
1972 protected SubscriptionPersistence subscriptionPersistence;
1973 @BeanReference(type = TeamPersistence.class)
1974 protected TeamPersistence teamPersistence;
1975 @BeanReference(type = TicketPersistence.class)
1976 protected TicketPersistence ticketPersistence;
1977 @BeanReference(type = UserPersistence.class)
1978 protected UserPersistence userPersistence;
1979 @BeanReference(type = UserGroupPersistence.class)
1980 protected UserGroupPersistence userGroupPersistence;
1981 @BeanReference(type = UserGroupGroupRolePersistence.class)
1982 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
1983 @BeanReference(type = UserGroupRolePersistence.class)
1984 protected UserGroupRolePersistence userGroupRolePersistence;
1985 @BeanReference(type = UserIdMapperPersistence.class)
1986 protected UserIdMapperPersistence userIdMapperPersistence;
1987 @BeanReference(type = UserNotificationEventPersistence.class)
1988 protected UserNotificationEventPersistence userNotificationEventPersistence;
1989 @BeanReference(type = UserTrackerPersistence.class)
1990 protected UserTrackerPersistence userTrackerPersistence;
1991 @BeanReference(type = UserTrackerPathPersistence.class)
1992 protected UserTrackerPathPersistence userTrackerPathPersistence;
1993 @BeanReference(type = VirtualHostPersistence.class)
1994 protected VirtualHostPersistence virtualHostPersistence;
1995 @BeanReference(type = WebDAVPropsPersistence.class)
1996 protected WebDAVPropsPersistence webDAVPropsPersistence;
1997 @BeanReference(type = WebsitePersistence.class)
1998 protected WebsitePersistence websitePersistence;
1999 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
2000 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
2001 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
2002 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
2003 private static final String _SQL_SELECT_COUNTRY = "SELECT country FROM Country country";
2004 private static final String _SQL_SELECT_COUNTRY_WHERE = "SELECT country FROM Country country WHERE ";
2005 private static final String _SQL_COUNT_COUNTRY = "SELECT COUNT(country) FROM Country country";
2006 private static final String _SQL_COUNT_COUNTRY_WHERE = "SELECT COUNT(country) FROM Country country WHERE ";
2007 private static final String _FINDER_COLUMN_NAME_NAME_1 = "country.name IS NULL";
2008 private static final String _FINDER_COLUMN_NAME_NAME_2 = "country.name = ?";
2009 private static final String _FINDER_COLUMN_NAME_NAME_3 = "(country.name IS NULL OR country.name = ?)";
2010 private static final String _FINDER_COLUMN_A2_A2_1 = "country.a2 IS NULL";
2011 private static final String _FINDER_COLUMN_A2_A2_2 = "country.a2 = ?";
2012 private static final String _FINDER_COLUMN_A2_A2_3 = "(country.a2 IS NULL OR country.a2 = ?)";
2013 private static final String _FINDER_COLUMN_A3_A3_1 = "country.a3 IS NULL";
2014 private static final String _FINDER_COLUMN_A3_A3_2 = "country.a3 = ?";
2015 private static final String _FINDER_COLUMN_A3_A3_3 = "(country.a3 IS NULL OR country.a3 = ?)";
2016 private static final String _FINDER_COLUMN_ACTIVE_ACTIVE_2 = "country.active = ?";
2017 private static final String _ORDER_BY_ENTITY_ALIAS = "country.";
2018 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Country exists with the primary key ";
2019 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Country exists with the key {";
2020 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
2021 private static Log _log = LogFactoryUtil.getLog(CountryPersistenceImpl.class);
2022 private static Country _nullCountry = new CountryImpl() {
2023 @Override
2024 public Object clone() {
2025 return this;
2026 }
2027
2028 @Override
2029 public CacheModel<Country> toCacheModel() {
2030 return _nullCountryCacheModel;
2031 }
2032 };
2033
2034 private static CacheModel<Country> _nullCountryCacheModel = new CacheModel<Country>() {
2035 public Country toEntityModel() {
2036 return _nullCountry;
2037 }
2038 };
2039 }