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
354 else {
355 if ((countryModelImpl.getColumnBitmask() &
356 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ACTIVE.getColumnBitmask()) != 0) {
357 Object[] args = new Object[] {
358 Boolean.valueOf(countryModelImpl.getOriginalActive())
359 };
360
361 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ACTIVE, args);
362 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ACTIVE,
363 args);
364
365 args = new Object[] {
366 Boolean.valueOf(countryModelImpl.getActive())
367 };
368
369 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ACTIVE, args);
370 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ACTIVE,
371 args);
372 }
373 }
374
375 EntityCacheUtil.putResult(CountryModelImpl.ENTITY_CACHE_ENABLED,
376 CountryImpl.class, country.getPrimaryKey(), country);
377
378 if (isNew) {
379 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_NAME,
380 new Object[] { country.getName() }, country);
381
382 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A2,
383 new Object[] { country.getA2() }, country);
384
385 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A3,
386 new Object[] { country.getA3() }, country);
387 }
388 else {
389 if ((countryModelImpl.getColumnBitmask() &
390 FINDER_PATH_FETCH_BY_NAME.getColumnBitmask()) != 0) {
391 Object[] args = new Object[] { countryModelImpl.getOriginalName() };
392
393 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_NAME, args);
394
395 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_NAME, args);
396
397 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_NAME,
398 new Object[] { country.getName() }, country);
399 }
400
401 if ((countryModelImpl.getColumnBitmask() &
402 FINDER_PATH_FETCH_BY_A2.getColumnBitmask()) != 0) {
403 Object[] args = new Object[] { countryModelImpl.getOriginalA2() };
404
405 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_A2, args);
406
407 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_A2, args);
408
409 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A2,
410 new Object[] { country.getA2() }, country);
411 }
412
413 if ((countryModelImpl.getColumnBitmask() &
414 FINDER_PATH_FETCH_BY_A3.getColumnBitmask()) != 0) {
415 Object[] args = new Object[] { countryModelImpl.getOriginalA3() };
416
417 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_A3, args);
418
419 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_A3, args);
420
421 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A3,
422 new Object[] { country.getA3() }, country);
423 }
424 }
425
426 return country;
427 }
428
429 protected Country toUnwrappedModel(Country country) {
430 if (country instanceof CountryImpl) {
431 return country;
432 }
433
434 CountryImpl countryImpl = new CountryImpl();
435
436 countryImpl.setNew(country.isNew());
437 countryImpl.setPrimaryKey(country.getPrimaryKey());
438
439 countryImpl.setCountryId(country.getCountryId());
440 countryImpl.setName(country.getName());
441 countryImpl.setA2(country.getA2());
442 countryImpl.setA3(country.getA3());
443 countryImpl.setNumber(country.getNumber());
444 countryImpl.setIdd(country.getIdd());
445 countryImpl.setZipRequired(country.isZipRequired());
446 countryImpl.setActive(country.isActive());
447
448 return countryImpl;
449 }
450
451
459 @Override
460 public Country findByPrimaryKey(Serializable primaryKey)
461 throws NoSuchModelException, SystemException {
462 return findByPrimaryKey(((Long)primaryKey).longValue());
463 }
464
465
473 public Country findByPrimaryKey(long countryId)
474 throws NoSuchCountryException, SystemException {
475 Country country = fetchByPrimaryKey(countryId);
476
477 if (country == null) {
478 if (_log.isWarnEnabled()) {
479 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + countryId);
480 }
481
482 throw new NoSuchCountryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
483 countryId);
484 }
485
486 return country;
487 }
488
489
496 @Override
497 public Country fetchByPrimaryKey(Serializable primaryKey)
498 throws SystemException {
499 return fetchByPrimaryKey(((Long)primaryKey).longValue());
500 }
501
502
509 public Country fetchByPrimaryKey(long countryId) throws SystemException {
510 Country country = (Country)EntityCacheUtil.getResult(CountryModelImpl.ENTITY_CACHE_ENABLED,
511 CountryImpl.class, countryId);
512
513 if (country == _nullCountry) {
514 return null;
515 }
516
517 if (country == null) {
518 Session session = null;
519
520 boolean hasException = false;
521
522 try {
523 session = openSession();
524
525 country = (Country)session.get(CountryImpl.class,
526 Long.valueOf(countryId));
527 }
528 catch (Exception e) {
529 hasException = true;
530
531 throw processException(e);
532 }
533 finally {
534 if (country != null) {
535 cacheResult(country);
536 }
537 else if (!hasException) {
538 EntityCacheUtil.putResult(CountryModelImpl.ENTITY_CACHE_ENABLED,
539 CountryImpl.class, countryId, _nullCountry);
540 }
541
542 closeSession(session);
543 }
544 }
545
546 return country;
547 }
548
549
557 public Country findByName(String name)
558 throws NoSuchCountryException, SystemException {
559 Country country = fetchByName(name);
560
561 if (country == null) {
562 StringBundler msg = new StringBundler(4);
563
564 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
565
566 msg.append("name=");
567 msg.append(name);
568
569 msg.append(StringPool.CLOSE_CURLY_BRACE);
570
571 if (_log.isWarnEnabled()) {
572 _log.warn(msg.toString());
573 }
574
575 throw new NoSuchCountryException(msg.toString());
576 }
577
578 return country;
579 }
580
581
588 public Country fetchByName(String name) throws SystemException {
589 return fetchByName(name, true);
590 }
591
592
600 public Country fetchByName(String name, boolean retrieveFromCache)
601 throws SystemException {
602 Object[] finderArgs = new Object[] { name };
603
604 Object result = null;
605
606 if (retrieveFromCache) {
607 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_NAME,
608 finderArgs, this);
609 }
610
611 if (result instanceof Country) {
612 Country country = (Country)result;
613
614 if (!Validator.equals(name, country.getName())) {
615 result = null;
616 }
617 }
618
619 if (result == null) {
620 StringBundler query = new StringBundler(3);
621
622 query.append(_SQL_SELECT_COUNTRY_WHERE);
623
624 if (name == null) {
625 query.append(_FINDER_COLUMN_NAME_NAME_1);
626 }
627 else {
628 if (name.equals(StringPool.BLANK)) {
629 query.append(_FINDER_COLUMN_NAME_NAME_3);
630 }
631 else {
632 query.append(_FINDER_COLUMN_NAME_NAME_2);
633 }
634 }
635
636 query.append(CountryModelImpl.ORDER_BY_JPQL);
637
638 String sql = query.toString();
639
640 Session session = null;
641
642 try {
643 session = openSession();
644
645 Query q = session.createQuery(sql);
646
647 QueryPos qPos = QueryPos.getInstance(q);
648
649 if (name != null) {
650 qPos.add(name);
651 }
652
653 List<Country> list = q.list();
654
655 result = list;
656
657 Country country = null;
658
659 if (list.isEmpty()) {
660 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_NAME,
661 finderArgs, list);
662 }
663 else {
664 country = list.get(0);
665
666 cacheResult(country);
667
668 if ((country.getName() == null) ||
669 !country.getName().equals(name)) {
670 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_NAME,
671 finderArgs, country);
672 }
673 }
674
675 return country;
676 }
677 catch (Exception e) {
678 throw processException(e);
679 }
680 finally {
681 if (result == null) {
682 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_NAME,
683 finderArgs);
684 }
685
686 closeSession(session);
687 }
688 }
689 else {
690 if (result instanceof List<?>) {
691 return null;
692 }
693 else {
694 return (Country)result;
695 }
696 }
697 }
698
699
707 public Country findByA2(String a2)
708 throws NoSuchCountryException, SystemException {
709 Country country = fetchByA2(a2);
710
711 if (country == null) {
712 StringBundler msg = new StringBundler(4);
713
714 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
715
716 msg.append("a2=");
717 msg.append(a2);
718
719 msg.append(StringPool.CLOSE_CURLY_BRACE);
720
721 if (_log.isWarnEnabled()) {
722 _log.warn(msg.toString());
723 }
724
725 throw new NoSuchCountryException(msg.toString());
726 }
727
728 return country;
729 }
730
731
738 public Country fetchByA2(String a2) throws SystemException {
739 return fetchByA2(a2, true);
740 }
741
742
750 public Country fetchByA2(String a2, boolean retrieveFromCache)
751 throws SystemException {
752 Object[] finderArgs = new Object[] { a2 };
753
754 Object result = null;
755
756 if (retrieveFromCache) {
757 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_A2,
758 finderArgs, this);
759 }
760
761 if (result instanceof Country) {
762 Country country = (Country)result;
763
764 if (!Validator.equals(a2, country.getA2())) {
765 result = null;
766 }
767 }
768
769 if (result == null) {
770 StringBundler query = new StringBundler(3);
771
772 query.append(_SQL_SELECT_COUNTRY_WHERE);
773
774 if (a2 == null) {
775 query.append(_FINDER_COLUMN_A2_A2_1);
776 }
777 else {
778 if (a2.equals(StringPool.BLANK)) {
779 query.append(_FINDER_COLUMN_A2_A2_3);
780 }
781 else {
782 query.append(_FINDER_COLUMN_A2_A2_2);
783 }
784 }
785
786 query.append(CountryModelImpl.ORDER_BY_JPQL);
787
788 String sql = query.toString();
789
790 Session session = null;
791
792 try {
793 session = openSession();
794
795 Query q = session.createQuery(sql);
796
797 QueryPos qPos = QueryPos.getInstance(q);
798
799 if (a2 != null) {
800 qPos.add(a2);
801 }
802
803 List<Country> list = q.list();
804
805 result = list;
806
807 Country country = null;
808
809 if (list.isEmpty()) {
810 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A2,
811 finderArgs, list);
812 }
813 else {
814 country = list.get(0);
815
816 cacheResult(country);
817
818 if ((country.getA2() == null) ||
819 !country.getA2().equals(a2)) {
820 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A2,
821 finderArgs, country);
822 }
823 }
824
825 return country;
826 }
827 catch (Exception e) {
828 throw processException(e);
829 }
830 finally {
831 if (result == null) {
832 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_A2,
833 finderArgs);
834 }
835
836 closeSession(session);
837 }
838 }
839 else {
840 if (result instanceof List<?>) {
841 return null;
842 }
843 else {
844 return (Country)result;
845 }
846 }
847 }
848
849
857 public Country findByA3(String a3)
858 throws NoSuchCountryException, SystemException {
859 Country country = fetchByA3(a3);
860
861 if (country == null) {
862 StringBundler msg = new StringBundler(4);
863
864 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
865
866 msg.append("a3=");
867 msg.append(a3);
868
869 msg.append(StringPool.CLOSE_CURLY_BRACE);
870
871 if (_log.isWarnEnabled()) {
872 _log.warn(msg.toString());
873 }
874
875 throw new NoSuchCountryException(msg.toString());
876 }
877
878 return country;
879 }
880
881
888 public Country fetchByA3(String a3) throws SystemException {
889 return fetchByA3(a3, true);
890 }
891
892
900 public Country fetchByA3(String a3, boolean retrieveFromCache)
901 throws SystemException {
902 Object[] finderArgs = new Object[] { a3 };
903
904 Object result = null;
905
906 if (retrieveFromCache) {
907 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_A3,
908 finderArgs, this);
909 }
910
911 if (result instanceof Country) {
912 Country country = (Country)result;
913
914 if (!Validator.equals(a3, country.getA3())) {
915 result = null;
916 }
917 }
918
919 if (result == null) {
920 StringBundler query = new StringBundler(3);
921
922 query.append(_SQL_SELECT_COUNTRY_WHERE);
923
924 if (a3 == null) {
925 query.append(_FINDER_COLUMN_A3_A3_1);
926 }
927 else {
928 if (a3.equals(StringPool.BLANK)) {
929 query.append(_FINDER_COLUMN_A3_A3_3);
930 }
931 else {
932 query.append(_FINDER_COLUMN_A3_A3_2);
933 }
934 }
935
936 query.append(CountryModelImpl.ORDER_BY_JPQL);
937
938 String sql = query.toString();
939
940 Session session = null;
941
942 try {
943 session = openSession();
944
945 Query q = session.createQuery(sql);
946
947 QueryPos qPos = QueryPos.getInstance(q);
948
949 if (a3 != null) {
950 qPos.add(a3);
951 }
952
953 List<Country> list = q.list();
954
955 result = list;
956
957 Country country = null;
958
959 if (list.isEmpty()) {
960 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A3,
961 finderArgs, list);
962 }
963 else {
964 country = list.get(0);
965
966 cacheResult(country);
967
968 if ((country.getA3() == null) ||
969 !country.getA3().equals(a3)) {
970 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A3,
971 finderArgs, country);
972 }
973 }
974
975 return country;
976 }
977 catch (Exception e) {
978 throw processException(e);
979 }
980 finally {
981 if (result == null) {
982 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_A3,
983 finderArgs);
984 }
985
986 closeSession(session);
987 }
988 }
989 else {
990 if (result instanceof List<?>) {
991 return null;
992 }
993 else {
994 return (Country)result;
995 }
996 }
997 }
998
999
1006 public List<Country> findByActive(boolean active) throws SystemException {
1007 return findByActive(active, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1008 }
1009
1010
1023 public List<Country> findByActive(boolean active, int start, int end)
1024 throws SystemException {
1025 return findByActive(active, start, end, null);
1026 }
1027
1028
1042 public List<Country> findByActive(boolean active, int start, int end,
1043 OrderByComparator orderByComparator) throws SystemException {
1044 FinderPath finderPath = null;
1045 Object[] finderArgs = null;
1046
1047 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1048 (orderByComparator == null)) {
1049 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ACTIVE;
1050 finderArgs = new Object[] { active };
1051 }
1052 else {
1053 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_ACTIVE;
1054 finderArgs = new Object[] { active, start, end, orderByComparator };
1055 }
1056
1057 List<Country> list = (List<Country>)FinderCacheUtil.getResult(finderPath,
1058 finderArgs, this);
1059
1060 if ((list != null) && !list.isEmpty()) {
1061 for (Country country : list) {
1062 if ((active != country.getActive())) {
1063 list = null;
1064
1065 break;
1066 }
1067 }
1068 }
1069
1070 if (list == null) {
1071 StringBundler query = null;
1072
1073 if (orderByComparator != null) {
1074 query = new StringBundler(3 +
1075 (orderByComparator.getOrderByFields().length * 3));
1076 }
1077 else {
1078 query = new StringBundler(3);
1079 }
1080
1081 query.append(_SQL_SELECT_COUNTRY_WHERE);
1082
1083 query.append(_FINDER_COLUMN_ACTIVE_ACTIVE_2);
1084
1085 if (orderByComparator != null) {
1086 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1087 orderByComparator);
1088 }
1089
1090 else {
1091 query.append(CountryModelImpl.ORDER_BY_JPQL);
1092 }
1093
1094 String sql = query.toString();
1095
1096 Session session = null;
1097
1098 try {
1099 session = openSession();
1100
1101 Query q = session.createQuery(sql);
1102
1103 QueryPos qPos = QueryPos.getInstance(q);
1104
1105 qPos.add(active);
1106
1107 list = (List<Country>)QueryUtil.list(q, getDialect(), start, end);
1108 }
1109 catch (Exception e) {
1110 throw processException(e);
1111 }
1112 finally {
1113 if (list == null) {
1114 FinderCacheUtil.removeResult(finderPath, finderArgs);
1115 }
1116 else {
1117 cacheResult(list);
1118
1119 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1120 }
1121
1122 closeSession(session);
1123 }
1124 }
1125
1126 return list;
1127 }
1128
1129
1138 public Country findByActive_First(boolean active,
1139 OrderByComparator orderByComparator)
1140 throws NoSuchCountryException, SystemException {
1141 Country country = fetchByActive_First(active, orderByComparator);
1142
1143 if (country != null) {
1144 return country;
1145 }
1146
1147 StringBundler msg = new StringBundler(4);
1148
1149 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1150
1151 msg.append("active=");
1152 msg.append(active);
1153
1154 msg.append(StringPool.CLOSE_CURLY_BRACE);
1155
1156 throw new NoSuchCountryException(msg.toString());
1157 }
1158
1159
1167 public Country fetchByActive_First(boolean active,
1168 OrderByComparator orderByComparator) throws SystemException {
1169 List<Country> list = findByActive(active, 0, 1, orderByComparator);
1170
1171 if (!list.isEmpty()) {
1172 return list.get(0);
1173 }
1174
1175 return null;
1176 }
1177
1178
1187 public Country findByActive_Last(boolean active,
1188 OrderByComparator orderByComparator)
1189 throws NoSuchCountryException, SystemException {
1190 Country country = fetchByActive_Last(active, orderByComparator);
1191
1192 if (country != null) {
1193 return country;
1194 }
1195
1196 StringBundler msg = new StringBundler(4);
1197
1198 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1199
1200 msg.append("active=");
1201 msg.append(active);
1202
1203 msg.append(StringPool.CLOSE_CURLY_BRACE);
1204
1205 throw new NoSuchCountryException(msg.toString());
1206 }
1207
1208
1216 public Country fetchByActive_Last(boolean active,
1217 OrderByComparator orderByComparator) throws SystemException {
1218 int count = countByActive(active);
1219
1220 List<Country> list = findByActive(active, count - 1, count,
1221 orderByComparator);
1222
1223 if (!list.isEmpty()) {
1224 return list.get(0);
1225 }
1226
1227 return null;
1228 }
1229
1230
1240 public Country[] findByActive_PrevAndNext(long countryId, boolean active,
1241 OrderByComparator orderByComparator)
1242 throws NoSuchCountryException, SystemException {
1243 Country country = findByPrimaryKey(countryId);
1244
1245 Session session = null;
1246
1247 try {
1248 session = openSession();
1249
1250 Country[] array = new CountryImpl[3];
1251
1252 array[0] = getByActive_PrevAndNext(session, country, active,
1253 orderByComparator, true);
1254
1255 array[1] = country;
1256
1257 array[2] = getByActive_PrevAndNext(session, country, active,
1258 orderByComparator, false);
1259
1260 return array;
1261 }
1262 catch (Exception e) {
1263 throw processException(e);
1264 }
1265 finally {
1266 closeSession(session);
1267 }
1268 }
1269
1270 protected Country getByActive_PrevAndNext(Session session, Country country,
1271 boolean active, OrderByComparator orderByComparator, boolean previous) {
1272 StringBundler query = null;
1273
1274 if (orderByComparator != null) {
1275 query = new StringBundler(6 +
1276 (orderByComparator.getOrderByFields().length * 6));
1277 }
1278 else {
1279 query = new StringBundler(3);
1280 }
1281
1282 query.append(_SQL_SELECT_COUNTRY_WHERE);
1283
1284 query.append(_FINDER_COLUMN_ACTIVE_ACTIVE_2);
1285
1286 if (orderByComparator != null) {
1287 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1288
1289 if (orderByConditionFields.length > 0) {
1290 query.append(WHERE_AND);
1291 }
1292
1293 for (int i = 0; i < orderByConditionFields.length; i++) {
1294 query.append(_ORDER_BY_ENTITY_ALIAS);
1295 query.append(orderByConditionFields[i]);
1296
1297 if ((i + 1) < orderByConditionFields.length) {
1298 if (orderByComparator.isAscending() ^ previous) {
1299 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1300 }
1301 else {
1302 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1303 }
1304 }
1305 else {
1306 if (orderByComparator.isAscending() ^ previous) {
1307 query.append(WHERE_GREATER_THAN);
1308 }
1309 else {
1310 query.append(WHERE_LESSER_THAN);
1311 }
1312 }
1313 }
1314
1315 query.append(ORDER_BY_CLAUSE);
1316
1317 String[] orderByFields = orderByComparator.getOrderByFields();
1318
1319 for (int i = 0; i < orderByFields.length; i++) {
1320 query.append(_ORDER_BY_ENTITY_ALIAS);
1321 query.append(orderByFields[i]);
1322
1323 if ((i + 1) < orderByFields.length) {
1324 if (orderByComparator.isAscending() ^ previous) {
1325 query.append(ORDER_BY_ASC_HAS_NEXT);
1326 }
1327 else {
1328 query.append(ORDER_BY_DESC_HAS_NEXT);
1329 }
1330 }
1331 else {
1332 if (orderByComparator.isAscending() ^ previous) {
1333 query.append(ORDER_BY_ASC);
1334 }
1335 else {
1336 query.append(ORDER_BY_DESC);
1337 }
1338 }
1339 }
1340 }
1341
1342 else {
1343 query.append(CountryModelImpl.ORDER_BY_JPQL);
1344 }
1345
1346 String sql = query.toString();
1347
1348 Query q = session.createQuery(sql);
1349
1350 q.setFirstResult(0);
1351 q.setMaxResults(2);
1352
1353 QueryPos qPos = QueryPos.getInstance(q);
1354
1355 qPos.add(active);
1356
1357 if (orderByComparator != null) {
1358 Object[] values = orderByComparator.getOrderByConditionValues(country);
1359
1360 for (Object value : values) {
1361 qPos.add(value);
1362 }
1363 }
1364
1365 List<Country> list = q.list();
1366
1367 if (list.size() == 2) {
1368 return list.get(1);
1369 }
1370 else {
1371 return null;
1372 }
1373 }
1374
1375
1381 public List<Country> findAll() throws SystemException {
1382 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1383 }
1384
1385
1397 public List<Country> findAll(int start, int end) throws SystemException {
1398 return findAll(start, end, null);
1399 }
1400
1401
1414 public List<Country> findAll(int start, int end,
1415 OrderByComparator orderByComparator) throws SystemException {
1416 FinderPath finderPath = null;
1417 Object[] finderArgs = new Object[] { start, end, orderByComparator };
1418
1419 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1420 (orderByComparator == null)) {
1421 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1422 finderArgs = FINDER_ARGS_EMPTY;
1423 }
1424 else {
1425 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1426 finderArgs = new Object[] { start, end, orderByComparator };
1427 }
1428
1429 List<Country> list = (List<Country>)FinderCacheUtil.getResult(finderPath,
1430 finderArgs, this);
1431
1432 if (list == null) {
1433 StringBundler query = null;
1434 String sql = null;
1435
1436 if (orderByComparator != null) {
1437 query = new StringBundler(2 +
1438 (orderByComparator.getOrderByFields().length * 3));
1439
1440 query.append(_SQL_SELECT_COUNTRY);
1441
1442 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1443 orderByComparator);
1444
1445 sql = query.toString();
1446 }
1447 else {
1448 sql = _SQL_SELECT_COUNTRY.concat(CountryModelImpl.ORDER_BY_JPQL);
1449 }
1450
1451 Session session = null;
1452
1453 try {
1454 session = openSession();
1455
1456 Query q = session.createQuery(sql);
1457
1458 if (orderByComparator == null) {
1459 list = (List<Country>)QueryUtil.list(q, getDialect(),
1460 start, end, false);
1461
1462 Collections.sort(list);
1463 }
1464 else {
1465 list = (List<Country>)QueryUtil.list(q, getDialect(),
1466 start, end);
1467 }
1468 }
1469 catch (Exception e) {
1470 throw processException(e);
1471 }
1472 finally {
1473 if (list == null) {
1474 FinderCacheUtil.removeResult(finderPath, finderArgs);
1475 }
1476 else {
1477 cacheResult(list);
1478
1479 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1480 }
1481
1482 closeSession(session);
1483 }
1484 }
1485
1486 return list;
1487 }
1488
1489
1496 public Country removeByName(String name)
1497 throws NoSuchCountryException, SystemException {
1498 Country country = findByName(name);
1499
1500 return remove(country);
1501 }
1502
1503
1510 public Country removeByA2(String a2)
1511 throws NoSuchCountryException, SystemException {
1512 Country country = findByA2(a2);
1513
1514 return remove(country);
1515 }
1516
1517
1524 public Country removeByA3(String a3)
1525 throws NoSuchCountryException, SystemException {
1526 Country country = findByA3(a3);
1527
1528 return remove(country);
1529 }
1530
1531
1537 public void removeByActive(boolean active) throws SystemException {
1538 for (Country country : findByActive(active)) {
1539 remove(country);
1540 }
1541 }
1542
1543
1548 public void removeAll() throws SystemException {
1549 for (Country country : findAll()) {
1550 remove(country);
1551 }
1552 }
1553
1554
1561 public int countByName(String name) throws SystemException {
1562 Object[] finderArgs = new Object[] { name };
1563
1564 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_NAME,
1565 finderArgs, this);
1566
1567 if (count == null) {
1568 StringBundler query = new StringBundler(2);
1569
1570 query.append(_SQL_COUNT_COUNTRY_WHERE);
1571
1572 if (name == null) {
1573 query.append(_FINDER_COLUMN_NAME_NAME_1);
1574 }
1575 else {
1576 if (name.equals(StringPool.BLANK)) {
1577 query.append(_FINDER_COLUMN_NAME_NAME_3);
1578 }
1579 else {
1580 query.append(_FINDER_COLUMN_NAME_NAME_2);
1581 }
1582 }
1583
1584 String sql = query.toString();
1585
1586 Session session = null;
1587
1588 try {
1589 session = openSession();
1590
1591 Query q = session.createQuery(sql);
1592
1593 QueryPos qPos = QueryPos.getInstance(q);
1594
1595 if (name != null) {
1596 qPos.add(name);
1597 }
1598
1599 count = (Long)q.uniqueResult();
1600 }
1601 catch (Exception e) {
1602 throw processException(e);
1603 }
1604 finally {
1605 if (count == null) {
1606 count = Long.valueOf(0);
1607 }
1608
1609 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_NAME,
1610 finderArgs, count);
1611
1612 closeSession(session);
1613 }
1614 }
1615
1616 return count.intValue();
1617 }
1618
1619
1626 public int countByA2(String a2) throws SystemException {
1627 Object[] finderArgs = new Object[] { a2 };
1628
1629 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_A2,
1630 finderArgs, this);
1631
1632 if (count == null) {
1633 StringBundler query = new StringBundler(2);
1634
1635 query.append(_SQL_COUNT_COUNTRY_WHERE);
1636
1637 if (a2 == null) {
1638 query.append(_FINDER_COLUMN_A2_A2_1);
1639 }
1640 else {
1641 if (a2.equals(StringPool.BLANK)) {
1642 query.append(_FINDER_COLUMN_A2_A2_3);
1643 }
1644 else {
1645 query.append(_FINDER_COLUMN_A2_A2_2);
1646 }
1647 }
1648
1649 String sql = query.toString();
1650
1651 Session session = null;
1652
1653 try {
1654 session = openSession();
1655
1656 Query q = session.createQuery(sql);
1657
1658 QueryPos qPos = QueryPos.getInstance(q);
1659
1660 if (a2 != null) {
1661 qPos.add(a2);
1662 }
1663
1664 count = (Long)q.uniqueResult();
1665 }
1666 catch (Exception e) {
1667 throw processException(e);
1668 }
1669 finally {
1670 if (count == null) {
1671 count = Long.valueOf(0);
1672 }
1673
1674 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_A2, finderArgs,
1675 count);
1676
1677 closeSession(session);
1678 }
1679 }
1680
1681 return count.intValue();
1682 }
1683
1684
1691 public int countByA3(String a3) throws SystemException {
1692 Object[] finderArgs = new Object[] { a3 };
1693
1694 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_A3,
1695 finderArgs, this);
1696
1697 if (count == null) {
1698 StringBundler query = new StringBundler(2);
1699
1700 query.append(_SQL_COUNT_COUNTRY_WHERE);
1701
1702 if (a3 == null) {
1703 query.append(_FINDER_COLUMN_A3_A3_1);
1704 }
1705 else {
1706 if (a3.equals(StringPool.BLANK)) {
1707 query.append(_FINDER_COLUMN_A3_A3_3);
1708 }
1709 else {
1710 query.append(_FINDER_COLUMN_A3_A3_2);
1711 }
1712 }
1713
1714 String sql = query.toString();
1715
1716 Session session = null;
1717
1718 try {
1719 session = openSession();
1720
1721 Query q = session.createQuery(sql);
1722
1723 QueryPos qPos = QueryPos.getInstance(q);
1724
1725 if (a3 != null) {
1726 qPos.add(a3);
1727 }
1728
1729 count = (Long)q.uniqueResult();
1730 }
1731 catch (Exception e) {
1732 throw processException(e);
1733 }
1734 finally {
1735 if (count == null) {
1736 count = Long.valueOf(0);
1737 }
1738
1739 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_A3, finderArgs,
1740 count);
1741
1742 closeSession(session);
1743 }
1744 }
1745
1746 return count.intValue();
1747 }
1748
1749
1756 public int countByActive(boolean active) throws SystemException {
1757 Object[] finderArgs = new Object[] { active };
1758
1759 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_ACTIVE,
1760 finderArgs, this);
1761
1762 if (count == null) {
1763 StringBundler query = new StringBundler(2);
1764
1765 query.append(_SQL_COUNT_COUNTRY_WHERE);
1766
1767 query.append(_FINDER_COLUMN_ACTIVE_ACTIVE_2);
1768
1769 String sql = query.toString();
1770
1771 Session session = null;
1772
1773 try {
1774 session = openSession();
1775
1776 Query q = session.createQuery(sql);
1777
1778 QueryPos qPos = QueryPos.getInstance(q);
1779
1780 qPos.add(active);
1781
1782 count = (Long)q.uniqueResult();
1783 }
1784 catch (Exception e) {
1785 throw processException(e);
1786 }
1787 finally {
1788 if (count == null) {
1789 count = Long.valueOf(0);
1790 }
1791
1792 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_ACTIVE,
1793 finderArgs, count);
1794
1795 closeSession(session);
1796 }
1797 }
1798
1799 return count.intValue();
1800 }
1801
1802
1808 public int countAll() throws SystemException {
1809 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1810 FINDER_ARGS_EMPTY, this);
1811
1812 if (count == null) {
1813 Session session = null;
1814
1815 try {
1816 session = openSession();
1817
1818 Query q = session.createQuery(_SQL_COUNT_COUNTRY);
1819
1820 count = (Long)q.uniqueResult();
1821 }
1822 catch (Exception e) {
1823 throw processException(e);
1824 }
1825 finally {
1826 if (count == null) {
1827 count = Long.valueOf(0);
1828 }
1829
1830 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1831 FINDER_ARGS_EMPTY, count);
1832
1833 closeSession(session);
1834 }
1835 }
1836
1837 return count.intValue();
1838 }
1839
1840
1843 public void afterPropertiesSet() {
1844 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1845 com.liferay.portal.util.PropsUtil.get(
1846 "value.object.listener.com.liferay.portal.model.Country")));
1847
1848 if (listenerClassNames.length > 0) {
1849 try {
1850 List<ModelListener<Country>> listenersList = new ArrayList<ModelListener<Country>>();
1851
1852 for (String listenerClassName : listenerClassNames) {
1853 listenersList.add((ModelListener<Country>)InstanceFactory.newInstance(
1854 listenerClassName));
1855 }
1856
1857 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1858 }
1859 catch (Exception e) {
1860 _log.error(e);
1861 }
1862 }
1863 }
1864
1865 public void destroy() {
1866 EntityCacheUtil.removeCache(CountryImpl.class.getName());
1867 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1868 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1869 }
1870
1871 @BeanReference(type = AccountPersistence.class)
1872 protected AccountPersistence accountPersistence;
1873 @BeanReference(type = AddressPersistence.class)
1874 protected AddressPersistence addressPersistence;
1875 @BeanReference(type = BrowserTrackerPersistence.class)
1876 protected BrowserTrackerPersistence browserTrackerPersistence;
1877 @BeanReference(type = ClassNamePersistence.class)
1878 protected ClassNamePersistence classNamePersistence;
1879 @BeanReference(type = ClusterGroupPersistence.class)
1880 protected ClusterGroupPersistence clusterGroupPersistence;
1881 @BeanReference(type = CompanyPersistence.class)
1882 protected CompanyPersistence companyPersistence;
1883 @BeanReference(type = ContactPersistence.class)
1884 protected ContactPersistence contactPersistence;
1885 @BeanReference(type = CountryPersistence.class)
1886 protected CountryPersistence countryPersistence;
1887 @BeanReference(type = EmailAddressPersistence.class)
1888 protected EmailAddressPersistence emailAddressPersistence;
1889 @BeanReference(type = GroupPersistence.class)
1890 protected GroupPersistence groupPersistence;
1891 @BeanReference(type = ImagePersistence.class)
1892 protected ImagePersistence imagePersistence;
1893 @BeanReference(type = LayoutPersistence.class)
1894 protected LayoutPersistence layoutPersistence;
1895 @BeanReference(type = LayoutBranchPersistence.class)
1896 protected LayoutBranchPersistence layoutBranchPersistence;
1897 @BeanReference(type = LayoutPrototypePersistence.class)
1898 protected LayoutPrototypePersistence layoutPrototypePersistence;
1899 @BeanReference(type = LayoutRevisionPersistence.class)
1900 protected LayoutRevisionPersistence layoutRevisionPersistence;
1901 @BeanReference(type = LayoutSetPersistence.class)
1902 protected LayoutSetPersistence layoutSetPersistence;
1903 @BeanReference(type = LayoutSetBranchPersistence.class)
1904 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
1905 @BeanReference(type = LayoutSetPrototypePersistence.class)
1906 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
1907 @BeanReference(type = ListTypePersistence.class)
1908 protected ListTypePersistence listTypePersistence;
1909 @BeanReference(type = LockPersistence.class)
1910 protected LockPersistence lockPersistence;
1911 @BeanReference(type = MembershipRequestPersistence.class)
1912 protected MembershipRequestPersistence membershipRequestPersistence;
1913 @BeanReference(type = OrganizationPersistence.class)
1914 protected OrganizationPersistence organizationPersistence;
1915 @BeanReference(type = OrgGroupPermissionPersistence.class)
1916 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
1917 @BeanReference(type = OrgGroupRolePersistence.class)
1918 protected OrgGroupRolePersistence orgGroupRolePersistence;
1919 @BeanReference(type = OrgLaborPersistence.class)
1920 protected OrgLaborPersistence orgLaborPersistence;
1921 @BeanReference(type = PasswordPolicyPersistence.class)
1922 protected PasswordPolicyPersistence passwordPolicyPersistence;
1923 @BeanReference(type = PasswordPolicyRelPersistence.class)
1924 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1925 @BeanReference(type = PasswordTrackerPersistence.class)
1926 protected PasswordTrackerPersistence passwordTrackerPersistence;
1927 @BeanReference(type = PermissionPersistence.class)
1928 protected PermissionPersistence permissionPersistence;
1929 @BeanReference(type = PhonePersistence.class)
1930 protected PhonePersistence phonePersistence;
1931 @BeanReference(type = PluginSettingPersistence.class)
1932 protected PluginSettingPersistence pluginSettingPersistence;
1933 @BeanReference(type = PortalPreferencesPersistence.class)
1934 protected PortalPreferencesPersistence portalPreferencesPersistence;
1935 @BeanReference(type = PortletPersistence.class)
1936 protected PortletPersistence portletPersistence;
1937 @BeanReference(type = PortletItemPersistence.class)
1938 protected PortletItemPersistence portletItemPersistence;
1939 @BeanReference(type = PortletPreferencesPersistence.class)
1940 protected PortletPreferencesPersistence portletPreferencesPersistence;
1941 @BeanReference(type = RegionPersistence.class)
1942 protected RegionPersistence regionPersistence;
1943 @BeanReference(type = ReleasePersistence.class)
1944 protected ReleasePersistence releasePersistence;
1945 @BeanReference(type = RepositoryPersistence.class)
1946 protected RepositoryPersistence repositoryPersistence;
1947 @BeanReference(type = RepositoryEntryPersistence.class)
1948 protected RepositoryEntryPersistence repositoryEntryPersistence;
1949 @BeanReference(type = ResourcePersistence.class)
1950 protected ResourcePersistence resourcePersistence;
1951 @BeanReference(type = ResourceActionPersistence.class)
1952 protected ResourceActionPersistence resourceActionPersistence;
1953 @BeanReference(type = ResourceBlockPersistence.class)
1954 protected ResourceBlockPersistence resourceBlockPersistence;
1955 @BeanReference(type = ResourceBlockPermissionPersistence.class)
1956 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
1957 @BeanReference(type = ResourceCodePersistence.class)
1958 protected ResourceCodePersistence resourceCodePersistence;
1959 @BeanReference(type = ResourcePermissionPersistence.class)
1960 protected ResourcePermissionPersistence resourcePermissionPersistence;
1961 @BeanReference(type = ResourceTypePermissionPersistence.class)
1962 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
1963 @BeanReference(type = RolePersistence.class)
1964 protected RolePersistence rolePersistence;
1965 @BeanReference(type = ServiceComponentPersistence.class)
1966 protected ServiceComponentPersistence serviceComponentPersistence;
1967 @BeanReference(type = ShardPersistence.class)
1968 protected ShardPersistence shardPersistence;
1969 @BeanReference(type = SubscriptionPersistence.class)
1970 protected SubscriptionPersistence subscriptionPersistence;
1971 @BeanReference(type = TeamPersistence.class)
1972 protected TeamPersistence teamPersistence;
1973 @BeanReference(type = TicketPersistence.class)
1974 protected TicketPersistence ticketPersistence;
1975 @BeanReference(type = UserPersistence.class)
1976 protected UserPersistence userPersistence;
1977 @BeanReference(type = UserGroupPersistence.class)
1978 protected UserGroupPersistence userGroupPersistence;
1979 @BeanReference(type = UserGroupGroupRolePersistence.class)
1980 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
1981 @BeanReference(type = UserGroupRolePersistence.class)
1982 protected UserGroupRolePersistence userGroupRolePersistence;
1983 @BeanReference(type = UserIdMapperPersistence.class)
1984 protected UserIdMapperPersistence userIdMapperPersistence;
1985 @BeanReference(type = UserNotificationEventPersistence.class)
1986 protected UserNotificationEventPersistence userNotificationEventPersistence;
1987 @BeanReference(type = UserTrackerPersistence.class)
1988 protected UserTrackerPersistence userTrackerPersistence;
1989 @BeanReference(type = UserTrackerPathPersistence.class)
1990 protected UserTrackerPathPersistence userTrackerPathPersistence;
1991 @BeanReference(type = VirtualHostPersistence.class)
1992 protected VirtualHostPersistence virtualHostPersistence;
1993 @BeanReference(type = WebDAVPropsPersistence.class)
1994 protected WebDAVPropsPersistence webDAVPropsPersistence;
1995 @BeanReference(type = WebsitePersistence.class)
1996 protected WebsitePersistence websitePersistence;
1997 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
1998 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
1999 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
2000 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
2001 private static final String _SQL_SELECT_COUNTRY = "SELECT country FROM Country country";
2002 private static final String _SQL_SELECT_COUNTRY_WHERE = "SELECT country FROM Country country WHERE ";
2003 private static final String _SQL_COUNT_COUNTRY = "SELECT COUNT(country) FROM Country country";
2004 private static final String _SQL_COUNT_COUNTRY_WHERE = "SELECT COUNT(country) FROM Country country WHERE ";
2005 private static final String _FINDER_COLUMN_NAME_NAME_1 = "country.name IS NULL";
2006 private static final String _FINDER_COLUMN_NAME_NAME_2 = "country.name = ?";
2007 private static final String _FINDER_COLUMN_NAME_NAME_3 = "(country.name IS NULL OR country.name = ?)";
2008 private static final String _FINDER_COLUMN_A2_A2_1 = "country.a2 IS NULL";
2009 private static final String _FINDER_COLUMN_A2_A2_2 = "country.a2 = ?";
2010 private static final String _FINDER_COLUMN_A2_A2_3 = "(country.a2 IS NULL OR country.a2 = ?)";
2011 private static final String _FINDER_COLUMN_A3_A3_1 = "country.a3 IS NULL";
2012 private static final String _FINDER_COLUMN_A3_A3_2 = "country.a3 = ?";
2013 private static final String _FINDER_COLUMN_A3_A3_3 = "(country.a3 IS NULL OR country.a3 = ?)";
2014 private static final String _FINDER_COLUMN_ACTIVE_ACTIVE_2 = "country.active = ?";
2015 private static final String _ORDER_BY_ENTITY_ALIAS = "country.";
2016 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Country exists with the primary key ";
2017 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Country exists with the key {";
2018 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
2019 private static Log _log = LogFactoryUtil.getLog(CountryPersistenceImpl.class);
2020 private static Country _nullCountry = new CountryImpl() {
2021 @Override
2022 public Object clone() {
2023 return this;
2024 }
2025
2026 @Override
2027 public CacheModel<Country> toCacheModel() {
2028 return _nullCountryCacheModel;
2029 }
2030 };
2031
2032 private static CacheModel<Country> _nullCountryCacheModel = new CacheModel<Country>() {
2033 public Country toEntityModel() {
2034 return _nullCountry;
2035 }
2036 };
2037 }