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