1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.service.persistence;
24  
25  import com.liferay.portal.NoSuchRegionException;
26  import com.liferay.portal.SystemException;
27  import com.liferay.portal.kernel.annotation.BeanReference;
28  import com.liferay.portal.kernel.cache.CacheRegistry;
29  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
30  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
31  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
32  import com.liferay.portal.kernel.dao.orm.FinderPath;
33  import com.liferay.portal.kernel.dao.orm.Query;
34  import com.liferay.portal.kernel.dao.orm.QueryPos;
35  import com.liferay.portal.kernel.dao.orm.QueryUtil;
36  import com.liferay.portal.kernel.dao.orm.Session;
37  import com.liferay.portal.kernel.log.Log;
38  import com.liferay.portal.kernel.log.LogFactoryUtil;
39  import com.liferay.portal.kernel.util.GetterUtil;
40  import com.liferay.portal.kernel.util.OrderByComparator;
41  import com.liferay.portal.kernel.util.StringPool;
42  import com.liferay.portal.kernel.util.StringUtil;
43  import com.liferay.portal.model.ModelListener;
44  import com.liferay.portal.model.Region;
45  import com.liferay.portal.model.impl.RegionImpl;
46  import com.liferay.portal.model.impl.RegionModelImpl;
47  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
48  
49  import java.util.ArrayList;
50  import java.util.Collections;
51  import java.util.List;
52  
53  /**
54   * <a href="RegionPersistenceImpl.java.html"><b><i>View Source</i></b></a>
55   *
56   * @author Brian Wing Shun Chan
57   *
58   */
59  public class RegionPersistenceImpl extends BasePersistenceImpl
60      implements RegionPersistence {
61      public static final String FINDER_CLASS_NAME_ENTITY = RegionImpl.class.getName();
62      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
63          ".List";
64      public static final FinderPath FINDER_PATH_FIND_BY_COUNTRYID = new FinderPath(RegionModelImpl.ENTITY_CACHE_ENABLED,
65              RegionModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
66              "findByCountryId", new String[] { Long.class.getName() });
67      public static final FinderPath FINDER_PATH_FIND_BY_OBC_COUNTRYID = new FinderPath(RegionModelImpl.ENTITY_CACHE_ENABLED,
68              RegionModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
69              "findByCountryId",
70              new String[] {
71                  Long.class.getName(),
72                  
73              "java.lang.Integer", "java.lang.Integer",
74                  "com.liferay.portal.kernel.util.OrderByComparator"
75              });
76      public static final FinderPath FINDER_PATH_COUNT_BY_COUNTRYID = new FinderPath(RegionModelImpl.ENTITY_CACHE_ENABLED,
77              RegionModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
78              "countByCountryId", new String[] { Long.class.getName() });
79      public static final FinderPath FINDER_PATH_FIND_BY_ACTIVE = new FinderPath(RegionModelImpl.ENTITY_CACHE_ENABLED,
80              RegionModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
81              "findByActive", new String[] { Boolean.class.getName() });
82      public static final FinderPath FINDER_PATH_FIND_BY_OBC_ACTIVE = new FinderPath(RegionModelImpl.ENTITY_CACHE_ENABLED,
83              RegionModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
84              "findByActive",
85              new String[] {
86                  Boolean.class.getName(),
87                  
88              "java.lang.Integer", "java.lang.Integer",
89                  "com.liferay.portal.kernel.util.OrderByComparator"
90              });
91      public static final FinderPath FINDER_PATH_COUNT_BY_ACTIVE = new FinderPath(RegionModelImpl.ENTITY_CACHE_ENABLED,
92              RegionModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
93              "countByActive", new String[] { Boolean.class.getName() });
94      public static final FinderPath FINDER_PATH_FIND_BY_C_A = new FinderPath(RegionModelImpl.ENTITY_CACHE_ENABLED,
95              RegionModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
96              "findByC_A",
97              new String[] { Long.class.getName(), Boolean.class.getName() });
98      public static final FinderPath FINDER_PATH_FIND_BY_OBC_C_A = new FinderPath(RegionModelImpl.ENTITY_CACHE_ENABLED,
99              RegionModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
100             "findByC_A",
101             new String[] {
102                 Long.class.getName(), Boolean.class.getName(),
103                 
104             "java.lang.Integer", "java.lang.Integer",
105                 "com.liferay.portal.kernel.util.OrderByComparator"
106             });
107     public static final FinderPath FINDER_PATH_COUNT_BY_C_A = new FinderPath(RegionModelImpl.ENTITY_CACHE_ENABLED,
108             RegionModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
109             "countByC_A",
110             new String[] { Long.class.getName(), Boolean.class.getName() });
111     public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(RegionModelImpl.ENTITY_CACHE_ENABLED,
112             RegionModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
113             "findAll", new String[0]);
114     public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(RegionModelImpl.ENTITY_CACHE_ENABLED,
115             RegionModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
116             "countAll", new String[0]);
117 
118     public void cacheResult(Region region) {
119         EntityCacheUtil.putResult(RegionModelImpl.ENTITY_CACHE_ENABLED,
120             RegionImpl.class, region.getPrimaryKey(), region);
121     }
122 
123     public void cacheResult(List<Region> regions) {
124         for (Region region : regions) {
125             if (EntityCacheUtil.getResult(
126                         RegionModelImpl.ENTITY_CACHE_ENABLED, RegionImpl.class,
127                         region.getPrimaryKey(), this) == null) {
128                 cacheResult(region);
129             }
130         }
131     }
132 
133     public void clearCache() {
134         CacheRegistry.clear(RegionImpl.class.getName());
135         EntityCacheUtil.clearCache(RegionImpl.class.getName());
136         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
137         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
138     }
139 
140     public Region create(long regionId) {
141         Region region = new RegionImpl();
142 
143         region.setNew(true);
144         region.setPrimaryKey(regionId);
145 
146         return region;
147     }
148 
149     public Region remove(long regionId)
150         throws NoSuchRegionException, SystemException {
151         Session session = null;
152 
153         try {
154             session = openSession();
155 
156             Region region = (Region)session.get(RegionImpl.class,
157                     new Long(regionId));
158 
159             if (region == null) {
160                 if (_log.isWarnEnabled()) {
161                     _log.warn("No Region exists with the primary key " +
162                         regionId);
163                 }
164 
165                 throw new NoSuchRegionException(
166                     "No Region exists with the primary key " + regionId);
167             }
168 
169             return remove(region);
170         }
171         catch (NoSuchRegionException nsee) {
172             throw nsee;
173         }
174         catch (Exception e) {
175             throw processException(e);
176         }
177         finally {
178             closeSession(session);
179         }
180     }
181 
182     public Region remove(Region region) throws SystemException {
183         for (ModelListener<Region> listener : listeners) {
184             listener.onBeforeRemove(region);
185         }
186 
187         region = removeImpl(region);
188 
189         for (ModelListener<Region> listener : listeners) {
190             listener.onAfterRemove(region);
191         }
192 
193         return region;
194     }
195 
196     protected Region removeImpl(Region region) throws SystemException {
197         Session session = null;
198 
199         try {
200             session = openSession();
201 
202             if (region.isCachedModel() || BatchSessionUtil.isEnabled()) {
203                 Object staleObject = session.get(RegionImpl.class,
204                         region.getPrimaryKeyObj());
205 
206                 if (staleObject != null) {
207                     session.evict(staleObject);
208                 }
209             }
210 
211             session.delete(region);
212 
213             session.flush();
214         }
215         catch (Exception e) {
216             throw processException(e);
217         }
218         finally {
219             closeSession(session);
220         }
221 
222         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
223 
224         EntityCacheUtil.removeResult(RegionModelImpl.ENTITY_CACHE_ENABLED,
225             RegionImpl.class, region.getPrimaryKey());
226 
227         return region;
228     }
229 
230     /**
231      * @deprecated Use <code>update(Region region, boolean merge)</code>.
232      */
233     public Region update(Region region) throws SystemException {
234         if (_log.isWarnEnabled()) {
235             _log.warn(
236                 "Using the deprecated update(Region region) method. Use update(Region region, boolean merge) instead.");
237         }
238 
239         return update(region, false);
240     }
241 
242     /**
243      * Add, update, or merge, the entity. This method also calls the model
244      * listeners to trigger the proper events associated with adding, deleting,
245      * or updating an entity.
246      *
247      * @param        region the entity to add, update, or merge
248      * @param        merge boolean value for whether to merge the entity. The
249      *                default value is false. Setting merge to true is more
250      *                expensive and should only be true when region is
251      *                transient. See LEP-5473 for a detailed discussion of this
252      *                method.
253      * @return        true if the portlet can be displayed via Ajax
254      */
255     public Region update(Region region, boolean merge)
256         throws SystemException {
257         boolean isNew = region.isNew();
258 
259         for (ModelListener<Region> listener : listeners) {
260             if (isNew) {
261                 listener.onBeforeCreate(region);
262             }
263             else {
264                 listener.onBeforeUpdate(region);
265             }
266         }
267 
268         region = updateImpl(region, merge);
269 
270         for (ModelListener<Region> listener : listeners) {
271             if (isNew) {
272                 listener.onAfterCreate(region);
273             }
274             else {
275                 listener.onAfterUpdate(region);
276             }
277         }
278 
279         return region;
280     }
281 
282     public Region updateImpl(com.liferay.portal.model.Region region,
283         boolean merge) throws SystemException {
284         Session session = null;
285 
286         try {
287             session = openSession();
288 
289             BatchSessionUtil.update(session, region, merge);
290 
291             region.setNew(false);
292         }
293         catch (Exception e) {
294             throw processException(e);
295         }
296         finally {
297             closeSession(session);
298         }
299 
300         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
301 
302         EntityCacheUtil.putResult(RegionModelImpl.ENTITY_CACHE_ENABLED,
303             RegionImpl.class, region.getPrimaryKey(), region);
304 
305         return region;
306     }
307 
308     public Region findByPrimaryKey(long regionId)
309         throws NoSuchRegionException, SystemException {
310         Region region = fetchByPrimaryKey(regionId);
311 
312         if (region == null) {
313             if (_log.isWarnEnabled()) {
314                 _log.warn("No Region exists with the primary key " + regionId);
315             }
316 
317             throw new NoSuchRegionException(
318                 "No Region exists with the primary key " + regionId);
319         }
320 
321         return region;
322     }
323 
324     public Region fetchByPrimaryKey(long regionId) throws SystemException {
325         Region region = (Region)EntityCacheUtil.getResult(RegionModelImpl.ENTITY_CACHE_ENABLED,
326                 RegionImpl.class, regionId, this);
327 
328         if (region == null) {
329             Session session = null;
330 
331             try {
332                 session = openSession();
333 
334                 region = (Region)session.get(RegionImpl.class,
335                         new Long(regionId));
336             }
337             catch (Exception e) {
338                 throw processException(e);
339             }
340             finally {
341                 if (region != null) {
342                     cacheResult(region);
343                 }
344 
345                 closeSession(session);
346             }
347         }
348 
349         return region;
350     }
351 
352     public List<Region> findByCountryId(long countryId)
353         throws SystemException {
354         Object[] finderArgs = new Object[] { new Long(countryId) };
355 
356         List<Region> list = (List<Region>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COUNTRYID,
357                 finderArgs, this);
358 
359         if (list == null) {
360             Session session = null;
361 
362             try {
363                 session = openSession();
364 
365                 StringBuilder query = new StringBuilder();
366 
367                 query.append("SELECT region FROM Region region WHERE ");
368 
369                 query.append("region.countryId = ?");
370 
371                 query.append(" ");
372 
373                 query.append("ORDER BY ");
374 
375                 query.append("region.name ASC");
376 
377                 Query q = session.createQuery(query.toString());
378 
379                 QueryPos qPos = QueryPos.getInstance(q);
380 
381                 qPos.add(countryId);
382 
383                 list = q.list();
384             }
385             catch (Exception e) {
386                 throw processException(e);
387             }
388             finally {
389                 if (list == null) {
390                     list = new ArrayList<Region>();
391                 }
392 
393                 cacheResult(list);
394 
395                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COUNTRYID,
396                     finderArgs, list);
397 
398                 closeSession(session);
399             }
400         }
401 
402         return list;
403     }
404 
405     public List<Region> findByCountryId(long countryId, int start, int end)
406         throws SystemException {
407         return findByCountryId(countryId, start, end, null);
408     }
409 
410     public List<Region> findByCountryId(long countryId, int start, int end,
411         OrderByComparator obc) throws SystemException {
412         Object[] finderArgs = new Object[] {
413                 new Long(countryId),
414                 
415                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
416             };
417 
418         List<Region> list = (List<Region>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_COUNTRYID,
419                 finderArgs, this);
420 
421         if (list == null) {
422             Session session = null;
423 
424             try {
425                 session = openSession();
426 
427                 StringBuilder query = new StringBuilder();
428 
429                 query.append("SELECT region FROM Region region WHERE ");
430 
431                 query.append("region.countryId = ?");
432 
433                 query.append(" ");
434 
435                 if (obc != null) {
436                     query.append("ORDER BY ");
437 
438                     String[] orderByFields = obc.getOrderByFields();
439 
440                     for (int i = 0; i < orderByFields.length; i++) {
441                         query.append("region.");
442                         query.append(orderByFields[i]);
443 
444                         if (obc.isAscending()) {
445                             query.append(" ASC");
446                         }
447                         else {
448                             query.append(" DESC");
449                         }
450 
451                         if ((i + 1) < orderByFields.length) {
452                             query.append(", ");
453                         }
454                     }
455                 }
456 
457                 else {
458                     query.append("ORDER BY ");
459 
460                     query.append("region.name ASC");
461                 }
462 
463                 Query q = session.createQuery(query.toString());
464 
465                 QueryPos qPos = QueryPos.getInstance(q);
466 
467                 qPos.add(countryId);
468 
469                 list = (List<Region>)QueryUtil.list(q, getDialect(), start, end);
470             }
471             catch (Exception e) {
472                 throw processException(e);
473             }
474             finally {
475                 if (list == null) {
476                     list = new ArrayList<Region>();
477                 }
478 
479                 cacheResult(list);
480 
481                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_COUNTRYID,
482                     finderArgs, list);
483 
484                 closeSession(session);
485             }
486         }
487 
488         return list;
489     }
490 
491     public Region findByCountryId_First(long countryId, OrderByComparator obc)
492         throws NoSuchRegionException, SystemException {
493         List<Region> list = findByCountryId(countryId, 0, 1, obc);
494 
495         if (list.isEmpty()) {
496             StringBuilder msg = new StringBuilder();
497 
498             msg.append("No Region exists with the key {");
499 
500             msg.append("countryId=" + countryId);
501 
502             msg.append(StringPool.CLOSE_CURLY_BRACE);
503 
504             throw new NoSuchRegionException(msg.toString());
505         }
506         else {
507             return list.get(0);
508         }
509     }
510 
511     public Region findByCountryId_Last(long countryId, OrderByComparator obc)
512         throws NoSuchRegionException, SystemException {
513         int count = countByCountryId(countryId);
514 
515         List<Region> list = findByCountryId(countryId, count - 1, count, obc);
516 
517         if (list.isEmpty()) {
518             StringBuilder msg = new StringBuilder();
519 
520             msg.append("No Region exists with the key {");
521 
522             msg.append("countryId=" + countryId);
523 
524             msg.append(StringPool.CLOSE_CURLY_BRACE);
525 
526             throw new NoSuchRegionException(msg.toString());
527         }
528         else {
529             return list.get(0);
530         }
531     }
532 
533     public Region[] findByCountryId_PrevAndNext(long regionId, long countryId,
534         OrderByComparator obc) throws NoSuchRegionException, SystemException {
535         Region region = findByPrimaryKey(regionId);
536 
537         int count = countByCountryId(countryId);
538 
539         Session session = null;
540 
541         try {
542             session = openSession();
543 
544             StringBuilder query = new StringBuilder();
545 
546             query.append("SELECT region FROM Region region WHERE ");
547 
548             query.append("region.countryId = ?");
549 
550             query.append(" ");
551 
552             if (obc != null) {
553                 query.append("ORDER BY ");
554 
555                 String[] orderByFields = obc.getOrderByFields();
556 
557                 for (int i = 0; i < orderByFields.length; i++) {
558                     query.append("region.");
559                     query.append(orderByFields[i]);
560 
561                     if (obc.isAscending()) {
562                         query.append(" ASC");
563                     }
564                     else {
565                         query.append(" DESC");
566                     }
567 
568                     if ((i + 1) < orderByFields.length) {
569                         query.append(", ");
570                     }
571                 }
572             }
573 
574             else {
575                 query.append("ORDER BY ");
576 
577                 query.append("region.name ASC");
578             }
579 
580             Query q = session.createQuery(query.toString());
581 
582             QueryPos qPos = QueryPos.getInstance(q);
583 
584             qPos.add(countryId);
585 
586             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, region);
587 
588             Region[] array = new RegionImpl[3];
589 
590             array[0] = (Region)objArray[0];
591             array[1] = (Region)objArray[1];
592             array[2] = (Region)objArray[2];
593 
594             return array;
595         }
596         catch (Exception e) {
597             throw processException(e);
598         }
599         finally {
600             closeSession(session);
601         }
602     }
603 
604     public List<Region> findByActive(boolean active) throws SystemException {
605         Object[] finderArgs = new Object[] { Boolean.valueOf(active) };
606 
607         List<Region> list = (List<Region>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_ACTIVE,
608                 finderArgs, this);
609 
610         if (list == null) {
611             Session session = null;
612 
613             try {
614                 session = openSession();
615 
616                 StringBuilder query = new StringBuilder();
617 
618                 query.append("SELECT region FROM Region region WHERE ");
619 
620                 query.append("region.active = ?");
621 
622                 query.append(" ");
623 
624                 query.append("ORDER BY ");
625 
626                 query.append("region.name ASC");
627 
628                 Query q = session.createQuery(query.toString());
629 
630                 QueryPos qPos = QueryPos.getInstance(q);
631 
632                 qPos.add(active);
633 
634                 list = q.list();
635             }
636             catch (Exception e) {
637                 throw processException(e);
638             }
639             finally {
640                 if (list == null) {
641                     list = new ArrayList<Region>();
642                 }
643 
644                 cacheResult(list);
645 
646                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_ACTIVE,
647                     finderArgs, list);
648 
649                 closeSession(session);
650             }
651         }
652 
653         return list;
654     }
655 
656     public List<Region> findByActive(boolean active, int start, int end)
657         throws SystemException {
658         return findByActive(active, start, end, null);
659     }
660 
661     public List<Region> findByActive(boolean active, int start, int end,
662         OrderByComparator obc) throws SystemException {
663         Object[] finderArgs = new Object[] {
664                 Boolean.valueOf(active),
665                 
666                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
667             };
668 
669         List<Region> list = (List<Region>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_ACTIVE,
670                 finderArgs, this);
671 
672         if (list == null) {
673             Session session = null;
674 
675             try {
676                 session = openSession();
677 
678                 StringBuilder query = new StringBuilder();
679 
680                 query.append("SELECT region FROM Region region WHERE ");
681 
682                 query.append("region.active = ?");
683 
684                 query.append(" ");
685 
686                 if (obc != null) {
687                     query.append("ORDER BY ");
688 
689                     String[] orderByFields = obc.getOrderByFields();
690 
691                     for (int i = 0; i < orderByFields.length; i++) {
692                         query.append("region.");
693                         query.append(orderByFields[i]);
694 
695                         if (obc.isAscending()) {
696                             query.append(" ASC");
697                         }
698                         else {
699                             query.append(" DESC");
700                         }
701 
702                         if ((i + 1) < orderByFields.length) {
703                             query.append(", ");
704                         }
705                     }
706                 }
707 
708                 else {
709                     query.append("ORDER BY ");
710 
711                     query.append("region.name ASC");
712                 }
713 
714                 Query q = session.createQuery(query.toString());
715 
716                 QueryPos qPos = QueryPos.getInstance(q);
717 
718                 qPos.add(active);
719 
720                 list = (List<Region>)QueryUtil.list(q, getDialect(), start, end);
721             }
722             catch (Exception e) {
723                 throw processException(e);
724             }
725             finally {
726                 if (list == null) {
727                     list = new ArrayList<Region>();
728                 }
729 
730                 cacheResult(list);
731 
732                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_ACTIVE,
733                     finderArgs, list);
734 
735                 closeSession(session);
736             }
737         }
738 
739         return list;
740     }
741 
742     public Region findByActive_First(boolean active, OrderByComparator obc)
743         throws NoSuchRegionException, SystemException {
744         List<Region> list = findByActive(active, 0, 1, obc);
745 
746         if (list.isEmpty()) {
747             StringBuilder msg = new StringBuilder();
748 
749             msg.append("No Region exists with the key {");
750 
751             msg.append("active=" + active);
752 
753             msg.append(StringPool.CLOSE_CURLY_BRACE);
754 
755             throw new NoSuchRegionException(msg.toString());
756         }
757         else {
758             return list.get(0);
759         }
760     }
761 
762     public Region findByActive_Last(boolean active, OrderByComparator obc)
763         throws NoSuchRegionException, SystemException {
764         int count = countByActive(active);
765 
766         List<Region> list = findByActive(active, count - 1, count, obc);
767 
768         if (list.isEmpty()) {
769             StringBuilder msg = new StringBuilder();
770 
771             msg.append("No Region exists with the key {");
772 
773             msg.append("active=" + active);
774 
775             msg.append(StringPool.CLOSE_CURLY_BRACE);
776 
777             throw new NoSuchRegionException(msg.toString());
778         }
779         else {
780             return list.get(0);
781         }
782     }
783 
784     public Region[] findByActive_PrevAndNext(long regionId, boolean active,
785         OrderByComparator obc) throws NoSuchRegionException, SystemException {
786         Region region = findByPrimaryKey(regionId);
787 
788         int count = countByActive(active);
789 
790         Session session = null;
791 
792         try {
793             session = openSession();
794 
795             StringBuilder query = new StringBuilder();
796 
797             query.append("SELECT region FROM Region region WHERE ");
798 
799             query.append("region.active = ?");
800 
801             query.append(" ");
802 
803             if (obc != null) {
804                 query.append("ORDER BY ");
805 
806                 String[] orderByFields = obc.getOrderByFields();
807 
808                 for (int i = 0; i < orderByFields.length; i++) {
809                     query.append("region.");
810                     query.append(orderByFields[i]);
811 
812                     if (obc.isAscending()) {
813                         query.append(" ASC");
814                     }
815                     else {
816                         query.append(" DESC");
817                     }
818 
819                     if ((i + 1) < orderByFields.length) {
820                         query.append(", ");
821                     }
822                 }
823             }
824 
825             else {
826                 query.append("ORDER BY ");
827 
828                 query.append("region.name ASC");
829             }
830 
831             Query q = session.createQuery(query.toString());
832 
833             QueryPos qPos = QueryPos.getInstance(q);
834 
835             qPos.add(active);
836 
837             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, region);
838 
839             Region[] array = new RegionImpl[3];
840 
841             array[0] = (Region)objArray[0];
842             array[1] = (Region)objArray[1];
843             array[2] = (Region)objArray[2];
844 
845             return array;
846         }
847         catch (Exception e) {
848             throw processException(e);
849         }
850         finally {
851             closeSession(session);
852         }
853     }
854 
855     public List<Region> findByC_A(long countryId, boolean active)
856         throws SystemException {
857         Object[] finderArgs = new Object[] {
858                 new Long(countryId), Boolean.valueOf(active)
859             };
860 
861         List<Region> list = (List<Region>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_A,
862                 finderArgs, this);
863 
864         if (list == null) {
865             Session session = null;
866 
867             try {
868                 session = openSession();
869 
870                 StringBuilder query = new StringBuilder();
871 
872                 query.append("SELECT region FROM Region region WHERE ");
873 
874                 query.append("region.countryId = ?");
875 
876                 query.append(" AND ");
877 
878                 query.append("region.active = ?");
879 
880                 query.append(" ");
881 
882                 query.append("ORDER BY ");
883 
884                 query.append("region.name ASC");
885 
886                 Query q = session.createQuery(query.toString());
887 
888                 QueryPos qPos = QueryPos.getInstance(q);
889 
890                 qPos.add(countryId);
891 
892                 qPos.add(active);
893 
894                 list = q.list();
895             }
896             catch (Exception e) {
897                 throw processException(e);
898             }
899             finally {
900                 if (list == null) {
901                     list = new ArrayList<Region>();
902                 }
903 
904                 cacheResult(list);
905 
906                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_A, finderArgs,
907                     list);
908 
909                 closeSession(session);
910             }
911         }
912 
913         return list;
914     }
915 
916     public List<Region> findByC_A(long countryId, boolean active, int start,
917         int end) throws SystemException {
918         return findByC_A(countryId, active, start, end, null);
919     }
920 
921     public List<Region> findByC_A(long countryId, boolean active, int start,
922         int end, OrderByComparator obc) throws SystemException {
923         Object[] finderArgs = new Object[] {
924                 new Long(countryId), Boolean.valueOf(active),
925                 
926                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
927             };
928 
929         List<Region> list = (List<Region>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_C_A,
930                 finderArgs, this);
931 
932         if (list == null) {
933             Session session = null;
934 
935             try {
936                 session = openSession();
937 
938                 StringBuilder query = new StringBuilder();
939 
940                 query.append("SELECT region FROM Region region WHERE ");
941 
942                 query.append("region.countryId = ?");
943 
944                 query.append(" AND ");
945 
946                 query.append("region.active = ?");
947 
948                 query.append(" ");
949 
950                 if (obc != null) {
951                     query.append("ORDER BY ");
952 
953                     String[] orderByFields = obc.getOrderByFields();
954 
955                     for (int i = 0; i < orderByFields.length; i++) {
956                         query.append("region.");
957                         query.append(orderByFields[i]);
958 
959                         if (obc.isAscending()) {
960                             query.append(" ASC");
961                         }
962                         else {
963                             query.append(" DESC");
964                         }
965 
966                         if ((i + 1) < orderByFields.length) {
967                             query.append(", ");
968                         }
969                     }
970                 }
971 
972                 else {
973                     query.append("ORDER BY ");
974 
975                     query.append("region.name ASC");
976                 }
977 
978                 Query q = session.createQuery(query.toString());
979 
980                 QueryPos qPos = QueryPos.getInstance(q);
981 
982                 qPos.add(countryId);
983 
984                 qPos.add(active);
985 
986                 list = (List<Region>)QueryUtil.list(q, getDialect(), start, end);
987             }
988             catch (Exception e) {
989                 throw processException(e);
990             }
991             finally {
992                 if (list == null) {
993                     list = new ArrayList<Region>();
994                 }
995 
996                 cacheResult(list);
997 
998                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_C_A,
999                     finderArgs, list);
1000
1001                closeSession(session);
1002            }
1003        }
1004
1005        return list;
1006    }
1007
1008    public Region findByC_A_First(long countryId, boolean active,
1009        OrderByComparator obc) throws NoSuchRegionException, SystemException {
1010        List<Region> list = findByC_A(countryId, active, 0, 1, obc);
1011
1012        if (list.isEmpty()) {
1013            StringBuilder msg = new StringBuilder();
1014
1015            msg.append("No Region exists with the key {");
1016
1017            msg.append("countryId=" + countryId);
1018
1019            msg.append(", ");
1020            msg.append("active=" + active);
1021
1022            msg.append(StringPool.CLOSE_CURLY_BRACE);
1023
1024            throw new NoSuchRegionException(msg.toString());
1025        }
1026        else {
1027            return list.get(0);
1028        }
1029    }
1030
1031    public Region findByC_A_Last(long countryId, boolean active,
1032        OrderByComparator obc) throws NoSuchRegionException, SystemException {
1033        int count = countByC_A(countryId, active);
1034
1035        List<Region> list = findByC_A(countryId, active, count - 1, count, obc);
1036
1037        if (list.isEmpty()) {
1038            StringBuilder msg = new StringBuilder();
1039
1040            msg.append("No Region exists with the key {");
1041
1042            msg.append("countryId=" + countryId);
1043
1044            msg.append(", ");
1045            msg.append("active=" + active);
1046
1047            msg.append(StringPool.CLOSE_CURLY_BRACE);
1048
1049            throw new NoSuchRegionException(msg.toString());
1050        }
1051        else {
1052            return list.get(0);
1053        }
1054    }
1055
1056    public Region[] findByC_A_PrevAndNext(long regionId, long countryId,
1057        boolean active, OrderByComparator obc)
1058        throws NoSuchRegionException, SystemException {
1059        Region region = findByPrimaryKey(regionId);
1060
1061        int count = countByC_A(countryId, active);
1062
1063        Session session = null;
1064
1065        try {
1066            session = openSession();
1067
1068            StringBuilder query = new StringBuilder();
1069
1070            query.append("SELECT region FROM Region region WHERE ");
1071
1072            query.append("region.countryId = ?");
1073
1074            query.append(" AND ");
1075
1076            query.append("region.active = ?");
1077
1078            query.append(" ");
1079
1080            if (obc != null) {
1081                query.append("ORDER BY ");
1082
1083                String[] orderByFields = obc.getOrderByFields();
1084
1085                for (int i = 0; i < orderByFields.length; i++) {
1086                    query.append("region.");
1087                    query.append(orderByFields[i]);
1088
1089                    if (obc.isAscending()) {
1090                        query.append(" ASC");
1091                    }
1092                    else {
1093                        query.append(" DESC");
1094                    }
1095
1096                    if ((i + 1) < orderByFields.length) {
1097                        query.append(", ");
1098                    }
1099                }
1100            }
1101
1102            else {
1103                query.append("ORDER BY ");
1104
1105                query.append("region.name ASC");
1106            }
1107
1108            Query q = session.createQuery(query.toString());
1109
1110            QueryPos qPos = QueryPos.getInstance(q);
1111
1112            qPos.add(countryId);
1113
1114            qPos.add(active);
1115
1116            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, region);
1117
1118            Region[] array = new RegionImpl[3];
1119
1120            array[0] = (Region)objArray[0];
1121            array[1] = (Region)objArray[1];
1122            array[2] = (Region)objArray[2];
1123
1124            return array;
1125        }
1126        catch (Exception e) {
1127            throw processException(e);
1128        }
1129        finally {
1130            closeSession(session);
1131        }
1132    }
1133
1134    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
1135        throws SystemException {
1136        Session session = null;
1137
1138        try {
1139            session = openSession();
1140
1141            dynamicQuery.compile(session);
1142
1143            return dynamicQuery.list();
1144        }
1145        catch (Exception e) {
1146            throw processException(e);
1147        }
1148        finally {
1149            closeSession(session);
1150        }
1151    }
1152
1153    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
1154        int start, int end) throws SystemException {
1155        Session session = null;
1156
1157        try {
1158            session = openSession();
1159
1160            dynamicQuery.setLimit(start, end);
1161
1162            dynamicQuery.compile(session);
1163
1164            return dynamicQuery.list();
1165        }
1166        catch (Exception e) {
1167            throw processException(e);
1168        }
1169        finally {
1170            closeSession(session);
1171        }
1172    }
1173
1174    public List<Region> findAll() throws SystemException {
1175        return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1176    }
1177
1178    public List<Region> findAll(int start, int end) throws SystemException {
1179        return findAll(start, end, null);
1180    }
1181
1182    public List<Region> findAll(int start, int end, OrderByComparator obc)
1183        throws SystemException {
1184        Object[] finderArgs = new Object[] {
1185                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1186            };
1187
1188        List<Region> list = (List<Region>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1189                finderArgs, this);
1190
1191        if (list == null) {
1192            Session session = null;
1193
1194            try {
1195                session = openSession();
1196
1197                StringBuilder query = new StringBuilder();
1198
1199                query.append("SELECT region FROM Region region ");
1200
1201                if (obc != null) {
1202                    query.append("ORDER BY ");
1203
1204                    String[] orderByFields = obc.getOrderByFields();
1205
1206                    for (int i = 0; i < orderByFields.length; i++) {
1207                        query.append("region.");
1208                        query.append(orderByFields[i]);
1209
1210                        if (obc.isAscending()) {
1211                            query.append(" ASC");
1212                        }
1213                        else {
1214                            query.append(" DESC");
1215                        }
1216
1217                        if ((i + 1) < orderByFields.length) {
1218                            query.append(", ");
1219                        }
1220                    }
1221                }
1222
1223                else {
1224                    query.append("ORDER BY ");
1225
1226                    query.append("region.name ASC");
1227                }
1228
1229                Query q = session.createQuery(query.toString());
1230
1231                if (obc == null) {
1232                    list = (List<Region>)QueryUtil.list(q, getDialect(), start,
1233                            end, false);
1234
1235                    Collections.sort(list);
1236                }
1237                else {
1238                    list = (List<Region>)QueryUtil.list(q, getDialect(), start,
1239                            end);
1240                }
1241            }
1242            catch (Exception e) {
1243                throw processException(e);
1244            }
1245            finally {
1246                if (list == null) {
1247                    list = new ArrayList<Region>();
1248                }
1249
1250                cacheResult(list);
1251
1252                FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
1253
1254                closeSession(session);
1255            }
1256        }
1257
1258        return list;
1259    }
1260
1261    public void removeByCountryId(long countryId) throws SystemException {
1262        for (Region region : findByCountryId(countryId)) {
1263            remove(region);
1264        }
1265    }
1266
1267    public void removeByActive(boolean active) throws SystemException {
1268        for (Region region : findByActive(active)) {
1269            remove(region);
1270        }
1271    }
1272
1273    public void removeByC_A(long countryId, boolean active)
1274        throws SystemException {
1275        for (Region region : findByC_A(countryId, active)) {
1276            remove(region);
1277        }
1278    }
1279
1280    public void removeAll() throws SystemException {
1281        for (Region region : findAll()) {
1282            remove(region);
1283        }
1284    }
1285
1286    public int countByCountryId(long countryId) throws SystemException {
1287        Object[] finderArgs = new Object[] { new Long(countryId) };
1288
1289        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COUNTRYID,
1290                finderArgs, this);
1291
1292        if (count == null) {
1293            Session session = null;
1294
1295            try {
1296                session = openSession();
1297
1298                StringBuilder query = new StringBuilder();
1299
1300                query.append("SELECT COUNT(region) ");
1301                query.append("FROM Region region WHERE ");
1302
1303                query.append("region.countryId = ?");
1304
1305                query.append(" ");
1306
1307                Query q = session.createQuery(query.toString());
1308
1309                QueryPos qPos = QueryPos.getInstance(q);
1310
1311                qPos.add(countryId);
1312
1313                count = (Long)q.uniqueResult();
1314            }
1315            catch (Exception e) {
1316                throw processException(e);
1317            }
1318            finally {
1319                if (count == null) {
1320                    count = Long.valueOf(0);
1321                }
1322
1323                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COUNTRYID,
1324                    finderArgs, count);
1325
1326                closeSession(session);
1327            }
1328        }
1329
1330        return count.intValue();
1331    }
1332
1333    public int countByActive(boolean active) throws SystemException {
1334        Object[] finderArgs = new Object[] { Boolean.valueOf(active) };
1335
1336        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_ACTIVE,
1337                finderArgs, this);
1338
1339        if (count == null) {
1340            Session session = null;
1341
1342            try {
1343                session = openSession();
1344
1345                StringBuilder query = new StringBuilder();
1346
1347                query.append("SELECT COUNT(region) ");
1348                query.append("FROM Region region WHERE ");
1349
1350                query.append("region.active = ?");
1351
1352                query.append(" ");
1353
1354                Query q = session.createQuery(query.toString());
1355
1356                QueryPos qPos = QueryPos.getInstance(q);
1357
1358                qPos.add(active);
1359
1360                count = (Long)q.uniqueResult();
1361            }
1362            catch (Exception e) {
1363                throw processException(e);
1364            }
1365            finally {
1366                if (count == null) {
1367                    count = Long.valueOf(0);
1368                }
1369
1370                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_ACTIVE,
1371                    finderArgs, count);
1372
1373                closeSession(session);
1374            }
1375        }
1376
1377        return count.intValue();
1378    }
1379
1380    public int countByC_A(long countryId, boolean active)
1381        throws SystemException {
1382        Object[] finderArgs = new Object[] {
1383                new Long(countryId), Boolean.valueOf(active)
1384            };
1385
1386        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_A,
1387                finderArgs, this);
1388
1389        if (count == null) {
1390            Session session = null;
1391
1392            try {
1393                session = openSession();
1394
1395                StringBuilder query = new StringBuilder();
1396
1397                query.append("SELECT COUNT(region) ");
1398                query.append("FROM Region region WHERE ");
1399
1400                query.append("region.countryId = ?");
1401
1402                query.append(" AND ");
1403
1404                query.append("region.active = ?");
1405
1406                query.append(" ");
1407
1408                Query q = session.createQuery(query.toString());
1409
1410                QueryPos qPos = QueryPos.getInstance(q);
1411
1412                qPos.add(countryId);
1413
1414                qPos.add(active);
1415
1416                count = (Long)q.uniqueResult();
1417            }
1418            catch (Exception e) {
1419                throw processException(e);
1420            }
1421            finally {
1422                if (count == null) {
1423                    count = Long.valueOf(0);
1424                }
1425
1426                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_A, finderArgs,
1427                    count);
1428
1429                closeSession(session);
1430            }
1431        }
1432
1433        return count.intValue();
1434    }
1435
1436    public int countAll() throws SystemException {
1437        Object[] finderArgs = new Object[0];
1438
1439        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1440                finderArgs, this);
1441
1442        if (count == null) {
1443            Session session = null;
1444
1445            try {
1446                session = openSession();
1447
1448                Query q = session.createQuery(
1449                        "SELECT COUNT(region) FROM Region region");
1450
1451                count = (Long)q.uniqueResult();
1452            }
1453            catch (Exception e) {
1454                throw processException(e);
1455            }
1456            finally {
1457                if (count == null) {
1458                    count = Long.valueOf(0);
1459                }
1460
1461                FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
1462                    count);
1463
1464                closeSession(session);
1465            }
1466        }
1467
1468        return count.intValue();
1469    }
1470
1471    public void afterPropertiesSet() {
1472        String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1473                    com.liferay.portal.util.PropsUtil.get(
1474                        "value.object.listener.com.liferay.portal.model.Region")));
1475
1476        if (listenerClassNames.length > 0) {
1477            try {
1478                List<ModelListener<Region>> listenersList = new ArrayList<ModelListener<Region>>();
1479
1480                for (String listenerClassName : listenerClassNames) {
1481                    listenersList.add((ModelListener<Region>)Class.forName(
1482                            listenerClassName).newInstance());
1483                }
1484
1485                listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1486            }
1487            catch (Exception e) {
1488                _log.error(e);
1489            }
1490        }
1491    }
1492
1493    @BeanReference(name = "com.liferay.portal.service.persistence.AccountPersistence.impl")
1494    protected com.liferay.portal.service.persistence.AccountPersistence accountPersistence;
1495    @BeanReference(name = "com.liferay.portal.service.persistence.AddressPersistence.impl")
1496    protected com.liferay.portal.service.persistence.AddressPersistence addressPersistence;
1497    @BeanReference(name = "com.liferay.portal.service.persistence.BrowserTrackerPersistence.impl")
1498    protected com.liferay.portal.service.persistence.BrowserTrackerPersistence browserTrackerPersistence;
1499    @BeanReference(name = "com.liferay.portal.service.persistence.ClassNamePersistence.impl")
1500    protected com.liferay.portal.service.persistence.ClassNamePersistence classNamePersistence;
1501    @BeanReference(name = "com.liferay.portal.service.persistence.CompanyPersistence.impl")
1502    protected com.liferay.portal.service.persistence.CompanyPersistence companyPersistence;
1503    @BeanReference(name = "com.liferay.portal.service.persistence.ContactPersistence.impl")
1504    protected com.liferay.portal.service.persistence.ContactPersistence contactPersistence;
1505    @BeanReference(name = "com.liferay.portal.service.persistence.CountryPersistence.impl")
1506    protected com.liferay.portal.service.persistence.CountryPersistence countryPersistence;
1507    @BeanReference(name = "com.liferay.portal.service.persistence.EmailAddressPersistence.impl")
1508    protected com.liferay.portal.service.persistence.EmailAddressPersistence emailAddressPersistence;
1509    @BeanReference(name = "com.liferay.portal.service.persistence.GroupPersistence.impl")
1510    protected com.liferay.portal.service.persistence.GroupPersistence groupPersistence;
1511    @BeanReference(name = "com.liferay.portal.service.persistence.ImagePersistence.impl")
1512    protected com.liferay.portal.service.persistence.ImagePersistence imagePersistence;
1513    @BeanReference(name = "com.liferay.portal.service.persistence.LayoutPersistence.impl")
1514    protected com.liferay.portal.service.persistence.LayoutPersistence layoutPersistence;
1515    @BeanReference(name = "com.liferay.portal.service.persistence.LayoutSetPersistence.impl")
1516    protected com.liferay.portal.service.persistence.LayoutSetPersistence layoutSetPersistence;
1517    @BeanReference(name = "com.liferay.portal.service.persistence.ListTypePersistence.impl")
1518    protected com.liferay.portal.service.persistence.ListTypePersistence listTypePersistence;
1519    @BeanReference(name = "com.liferay.portal.service.persistence.MembershipRequestPersistence.impl")
1520    protected com.liferay.portal.service.persistence.MembershipRequestPersistence membershipRequestPersistence;
1521    @BeanReference(name = "com.liferay.portal.service.persistence.OrganizationPersistence.impl")
1522    protected com.liferay.portal.service.persistence.OrganizationPersistence organizationPersistence;
1523    @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupPermissionPersistence.impl")
1524    protected com.liferay.portal.service.persistence.OrgGroupPermissionPersistence orgGroupPermissionPersistence;
1525    @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupRolePersistence.impl")
1526    protected com.liferay.portal.service.persistence.OrgGroupRolePersistence orgGroupRolePersistence;
1527    @BeanReference(name = "com.liferay.portal.service.persistence.OrgLaborPersistence.impl")
1528    protected com.liferay.portal.service.persistence.OrgLaborPersistence orgLaborPersistence;
1529    @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyPersistence.impl")
1530    protected com.liferay.portal.service.persistence.PasswordPolicyPersistence passwordPolicyPersistence;
1531    @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyRelPersistence.impl")
1532    protected com.liferay.portal.service.persistence.PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1533    @BeanReference(name = "com.liferay.portal.service.persistence.PasswordTrackerPersistence.impl")
1534    protected com.liferay.portal.service.persistence.PasswordTrackerPersistence passwordTrackerPersistence;
1535    @BeanReference(name = "com.liferay.portal.service.persistence.PermissionPersistence.impl")
1536    protected com.liferay.portal.service.persistence.PermissionPersistence permissionPersistence;
1537    @BeanReference(name = "com.liferay.portal.service.persistence.PhonePersistence.impl")
1538    protected com.liferay.portal.service.persistence.PhonePersistence phonePersistence;
1539    @BeanReference(name = "com.liferay.portal.service.persistence.PluginSettingPersistence.impl")
1540    protected com.liferay.portal.service.persistence.PluginSettingPersistence pluginSettingPersistence;
1541    @BeanReference(name = "com.liferay.portal.service.persistence.PortletPersistence.impl")
1542    protected com.liferay.portal.service.persistence.PortletPersistence portletPersistence;
1543    @BeanReference(name = "com.liferay.portal.service.persistence.PortletItemPersistence.impl")
1544    protected com.liferay.portal.service.persistence.PortletItemPersistence portletItemPersistence;
1545    @BeanReference(name = "com.liferay.portal.service.persistence.PortletPreferencesPersistence.impl")
1546    protected com.liferay.portal.service.persistence.PortletPreferencesPersistence portletPreferencesPersistence;
1547    @BeanReference(name = "com.liferay.portal.service.persistence.RegionPersistence.impl")
1548    protected com.liferay.portal.service.persistence.RegionPersistence regionPersistence;
1549    @BeanReference(name = "com.liferay.portal.service.persistence.ReleasePersistence.impl")
1550    protected com.liferay.portal.service.persistence.ReleasePersistence releasePersistence;
1551    @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence.impl")
1552    protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
1553    @BeanReference(name = "com.liferay.portal.service.persistence.ResourceActionPersistence.impl")
1554    protected com.liferay.portal.service.persistence.ResourceActionPersistence resourceActionPersistence;
1555    @BeanReference(name = "com.liferay.portal.service.persistence.ResourceCodePersistence.impl")
1556    protected com.liferay.portal.service.persistence.ResourceCodePersistence resourceCodePersistence;
1557    @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePermissionPersistence.impl")
1558    protected com.liferay.portal.service.persistence.ResourcePermissionPersistence resourcePermissionPersistence;
1559    @BeanReference(name = "com.liferay.portal.service.persistence.RolePersistence.impl")
1560    protected com.liferay.portal.service.persistence.RolePersistence rolePersistence;
1561    @BeanReference(name = "com.liferay.portal.service.persistence.ServiceComponentPersistence.impl")
1562    protected com.liferay.portal.service.persistence.ServiceComponentPersistence serviceComponentPersistence;
1563    @BeanReference(name = "com.liferay.portal.service.persistence.ShardPersistence.impl")
1564    protected com.liferay.portal.service.persistence.ShardPersistence shardPersistence;
1565    @BeanReference(name = "com.liferay.portal.service.persistence.SubscriptionPersistence.impl")
1566    protected com.liferay.portal.service.persistence.SubscriptionPersistence subscriptionPersistence;
1567    @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence.impl")
1568    protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
1569    @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupPersistence.impl")
1570    protected com.liferay.portal.service.persistence.UserGroupPersistence userGroupPersistence;
1571    @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupRolePersistence.impl")
1572    protected com.liferay.portal.service.persistence.UserGroupRolePersistence userGroupRolePersistence;
1573    @BeanReference(name = "com.liferay.portal.service.persistence.UserIdMapperPersistence.impl")
1574    protected com.liferay.portal.service.persistence.UserIdMapperPersistence userIdMapperPersistence;
1575    @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPersistence.impl")
1576    protected com.liferay.portal.service.persistence.UserTrackerPersistence userTrackerPersistence;
1577    @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPathPersistence.impl")
1578    protected com.liferay.portal.service.persistence.UserTrackerPathPersistence userTrackerPathPersistence;
1579    @BeanReference(name = "com.liferay.portal.service.persistence.WebDAVPropsPersistence.impl")
1580    protected com.liferay.portal.service.persistence.WebDAVPropsPersistence webDAVPropsPersistence;
1581    @BeanReference(name = "com.liferay.portal.service.persistence.WebsitePersistence.impl")
1582    protected com.liferay.portal.service.persistence.WebsitePersistence websitePersistence;
1583    private static Log _log = LogFactoryUtil.getLog(RegionPersistenceImpl.class);
1584}