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.NoSuchResourcePermissionException;
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.kernel.util.Validator;
44  import com.liferay.portal.model.ModelListener;
45  import com.liferay.portal.model.ResourcePermission;
46  import com.liferay.portal.model.impl.ResourcePermissionImpl;
47  import com.liferay.portal.model.impl.ResourcePermissionModelImpl;
48  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
49  
50  import java.util.ArrayList;
51  import java.util.Collections;
52  import java.util.List;
53  
54  /**
55   * <a href="ResourcePermissionPersistenceImpl.java.html"><b><i>View Source</i></b></a>
56   *
57   * <p>
58   * ServiceBuilder generated this class. Modifications in this class will be
59   * overwritten the next time is generated.
60   * </p>
61   *
62   * @author    Brian Wing Shun Chan
63   * @see       ResourcePermissionPersistence
64   * @see       ResourcePermissionUtil
65   * @generated
66   */
67  public class ResourcePermissionPersistenceImpl extends BasePersistenceImpl
68      implements ResourcePermissionPersistence {
69      public static final String FINDER_CLASS_NAME_ENTITY = ResourcePermissionImpl.class.getName();
70      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
71          ".List";
72      public static final FinderPath FINDER_PATH_FIND_BY_ROLEID = new FinderPath(ResourcePermissionModelImpl.ENTITY_CACHE_ENABLED,
73              ResourcePermissionModelImpl.FINDER_CACHE_ENABLED,
74              FINDER_CLASS_NAME_LIST, "findByRoleId",
75              new String[] { Long.class.getName() });
76      public static final FinderPath FINDER_PATH_FIND_BY_OBC_ROLEID = new FinderPath(ResourcePermissionModelImpl.ENTITY_CACHE_ENABLED,
77              ResourcePermissionModelImpl.FINDER_CACHE_ENABLED,
78              FINDER_CLASS_NAME_LIST, "findByRoleId",
79              new String[] {
80                  Long.class.getName(),
81                  
82              "java.lang.Integer", "java.lang.Integer",
83                  "com.liferay.portal.kernel.util.OrderByComparator"
84              });
85      public static final FinderPath FINDER_PATH_COUNT_BY_ROLEID = new FinderPath(ResourcePermissionModelImpl.ENTITY_CACHE_ENABLED,
86              ResourcePermissionModelImpl.FINDER_CACHE_ENABLED,
87              FINDER_CLASS_NAME_LIST, "countByRoleId",
88              new String[] { Long.class.getName() });
89      public static final FinderPath FINDER_PATH_FIND_BY_C_N_S = new FinderPath(ResourcePermissionModelImpl.ENTITY_CACHE_ENABLED,
90              ResourcePermissionModelImpl.FINDER_CACHE_ENABLED,
91              FINDER_CLASS_NAME_LIST, "findByC_N_S",
92              new String[] {
93                  Long.class.getName(), String.class.getName(),
94                  Integer.class.getName()
95              });
96      public static final FinderPath FINDER_PATH_FIND_BY_OBC_C_N_S = new FinderPath(ResourcePermissionModelImpl.ENTITY_CACHE_ENABLED,
97              ResourcePermissionModelImpl.FINDER_CACHE_ENABLED,
98              FINDER_CLASS_NAME_LIST, "findByC_N_S",
99              new String[] {
100                 Long.class.getName(), String.class.getName(),
101                 Integer.class.getName(),
102                 
103             "java.lang.Integer", "java.lang.Integer",
104                 "com.liferay.portal.kernel.util.OrderByComparator"
105             });
106     public static final FinderPath FINDER_PATH_COUNT_BY_C_N_S = new FinderPath(ResourcePermissionModelImpl.ENTITY_CACHE_ENABLED,
107             ResourcePermissionModelImpl.FINDER_CACHE_ENABLED,
108             FINDER_CLASS_NAME_LIST, "countByC_N_S",
109             new String[] {
110                 Long.class.getName(), String.class.getName(),
111                 Integer.class.getName()
112             });
113     public static final FinderPath FINDER_PATH_FIND_BY_C_N_S_P = new FinderPath(ResourcePermissionModelImpl.ENTITY_CACHE_ENABLED,
114             ResourcePermissionModelImpl.FINDER_CACHE_ENABLED,
115             FINDER_CLASS_NAME_LIST, "findByC_N_S_P",
116             new String[] {
117                 Long.class.getName(), String.class.getName(),
118                 Integer.class.getName(), String.class.getName()
119             });
120     public static final FinderPath FINDER_PATH_FIND_BY_OBC_C_N_S_P = new FinderPath(ResourcePermissionModelImpl.ENTITY_CACHE_ENABLED,
121             ResourcePermissionModelImpl.FINDER_CACHE_ENABLED,
122             FINDER_CLASS_NAME_LIST, "findByC_N_S_P",
123             new String[] {
124                 Long.class.getName(), String.class.getName(),
125                 Integer.class.getName(), String.class.getName(),
126                 
127             "java.lang.Integer", "java.lang.Integer",
128                 "com.liferay.portal.kernel.util.OrderByComparator"
129             });
130     public static final FinderPath FINDER_PATH_COUNT_BY_C_N_S_P = new FinderPath(ResourcePermissionModelImpl.ENTITY_CACHE_ENABLED,
131             ResourcePermissionModelImpl.FINDER_CACHE_ENABLED,
132             FINDER_CLASS_NAME_LIST, "countByC_N_S_P",
133             new String[] {
134                 Long.class.getName(), String.class.getName(),
135                 Integer.class.getName(), String.class.getName()
136             });
137     public static final FinderPath FINDER_PATH_FETCH_BY_C_N_S_P_R = new FinderPath(ResourcePermissionModelImpl.ENTITY_CACHE_ENABLED,
138             ResourcePermissionModelImpl.FINDER_CACHE_ENABLED,
139             FINDER_CLASS_NAME_ENTITY, "fetchByC_N_S_P_R",
140             new String[] {
141                 Long.class.getName(), String.class.getName(),
142                 Integer.class.getName(), String.class.getName(),
143                 Long.class.getName()
144             });
145     public static final FinderPath FINDER_PATH_COUNT_BY_C_N_S_P_R = new FinderPath(ResourcePermissionModelImpl.ENTITY_CACHE_ENABLED,
146             ResourcePermissionModelImpl.FINDER_CACHE_ENABLED,
147             FINDER_CLASS_NAME_LIST, "countByC_N_S_P_R",
148             new String[] {
149                 Long.class.getName(), String.class.getName(),
150                 Integer.class.getName(), String.class.getName(),
151                 Long.class.getName()
152             });
153     public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(ResourcePermissionModelImpl.ENTITY_CACHE_ENABLED,
154             ResourcePermissionModelImpl.FINDER_CACHE_ENABLED,
155             FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
156     public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(ResourcePermissionModelImpl.ENTITY_CACHE_ENABLED,
157             ResourcePermissionModelImpl.FINDER_CACHE_ENABLED,
158             FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
159 
160     public void cacheResult(ResourcePermission resourcePermission) {
161         EntityCacheUtil.putResult(ResourcePermissionModelImpl.ENTITY_CACHE_ENABLED,
162             ResourcePermissionImpl.class, resourcePermission.getPrimaryKey(),
163             resourcePermission);
164 
165         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_N_S_P_R,
166             new Object[] {
167                 new Long(resourcePermission.getCompanyId()),
168                 
169             resourcePermission.getName(),
170                 new Integer(resourcePermission.getScope()),
171                 
172             resourcePermission.getPrimKey(),
173                 new Long(resourcePermission.getRoleId())
174             }, resourcePermission);
175     }
176 
177     public void cacheResult(List<ResourcePermission> resourcePermissions) {
178         for (ResourcePermission resourcePermission : resourcePermissions) {
179             if (EntityCacheUtil.getResult(
180                         ResourcePermissionModelImpl.ENTITY_CACHE_ENABLED,
181                         ResourcePermissionImpl.class,
182                         resourcePermission.getPrimaryKey(), this) == null) {
183                 cacheResult(resourcePermission);
184             }
185         }
186     }
187 
188     public void clearCache() {
189         CacheRegistry.clear(ResourcePermissionImpl.class.getName());
190         EntityCacheUtil.clearCache(ResourcePermissionImpl.class.getName());
191         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
192         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
193     }
194 
195     public ResourcePermission create(long resourcePermissionId) {
196         ResourcePermission resourcePermission = new ResourcePermissionImpl();
197 
198         resourcePermission.setNew(true);
199         resourcePermission.setPrimaryKey(resourcePermissionId);
200 
201         return resourcePermission;
202     }
203 
204     public ResourcePermission remove(long resourcePermissionId)
205         throws NoSuchResourcePermissionException, SystemException {
206         Session session = null;
207 
208         try {
209             session = openSession();
210 
211             ResourcePermission resourcePermission = (ResourcePermission)session.get(ResourcePermissionImpl.class,
212                     new Long(resourcePermissionId));
213 
214             if (resourcePermission == null) {
215                 if (_log.isWarnEnabled()) {
216                     _log.warn(
217                         "No ResourcePermission exists with the primary key " +
218                         resourcePermissionId);
219                 }
220 
221                 throw new NoSuchResourcePermissionException(
222                     "No ResourcePermission exists with the primary key " +
223                     resourcePermissionId);
224             }
225 
226             return remove(resourcePermission);
227         }
228         catch (NoSuchResourcePermissionException nsee) {
229             throw nsee;
230         }
231         catch (Exception e) {
232             throw processException(e);
233         }
234         finally {
235             closeSession(session);
236         }
237     }
238 
239     public ResourcePermission remove(ResourcePermission resourcePermission)
240         throws SystemException {
241         for (ModelListener<ResourcePermission> listener : listeners) {
242             listener.onBeforeRemove(resourcePermission);
243         }
244 
245         resourcePermission = removeImpl(resourcePermission);
246 
247         for (ModelListener<ResourcePermission> listener : listeners) {
248             listener.onAfterRemove(resourcePermission);
249         }
250 
251         return resourcePermission;
252     }
253 
254     protected ResourcePermission removeImpl(
255         ResourcePermission resourcePermission) throws SystemException {
256         Session session = null;
257 
258         try {
259             session = openSession();
260 
261             if (resourcePermission.isCachedModel() ||
262                     BatchSessionUtil.isEnabled()) {
263                 Object staleObject = session.get(ResourcePermissionImpl.class,
264                         resourcePermission.getPrimaryKeyObj());
265 
266                 if (staleObject != null) {
267                     session.evict(staleObject);
268                 }
269             }
270 
271             session.delete(resourcePermission);
272 
273             session.flush();
274         }
275         catch (Exception e) {
276             throw processException(e);
277         }
278         finally {
279             closeSession(session);
280         }
281 
282         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
283 
284         ResourcePermissionModelImpl resourcePermissionModelImpl = (ResourcePermissionModelImpl)resourcePermission;
285 
286         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_N_S_P_R,
287             new Object[] {
288                 new Long(resourcePermissionModelImpl.getOriginalCompanyId()),
289                 
290             resourcePermissionModelImpl.getOriginalName(),
291                 new Integer(resourcePermissionModelImpl.getOriginalScope()),
292                 
293             resourcePermissionModelImpl.getOriginalPrimKey(),
294                 new Long(resourcePermissionModelImpl.getOriginalRoleId())
295             });
296 
297         EntityCacheUtil.removeResult(ResourcePermissionModelImpl.ENTITY_CACHE_ENABLED,
298             ResourcePermissionImpl.class, resourcePermission.getPrimaryKey());
299 
300         return resourcePermission;
301     }
302 
303     /**
304      * @deprecated Use {@link #update(ResourcePermission, boolean merge)}.
305      */
306     public ResourcePermission update(ResourcePermission resourcePermission)
307         throws SystemException {
308         if (_log.isWarnEnabled()) {
309             _log.warn(
310                 "Using the deprecated update(ResourcePermission resourcePermission) method. Use update(ResourcePermission resourcePermission, boolean merge) instead.");
311         }
312 
313         return update(resourcePermission, false);
314     }
315 
316     /**
317      * Add, update, or merge, the entity. This method also calls the model
318      * listeners to trigger the proper events associated with adding, deleting,
319      * or updating an entity.
320      *
321      * @param  resourcePermission the entity to add, update, or merge
322      * @param  merge boolean value for whether to merge the entity. The default
323      *         value is false. Setting merge to true is more expensive and
324      *         should only be true when resourcePermission is transient. See
325      *         LEP-5473 for a detailed discussion of this method.
326      * @return the entity that was added, updated, or merged
327      */
328     public ResourcePermission update(ResourcePermission resourcePermission,
329         boolean merge) throws SystemException {
330         boolean isNew = resourcePermission.isNew();
331 
332         for (ModelListener<ResourcePermission> listener : listeners) {
333             if (isNew) {
334                 listener.onBeforeCreate(resourcePermission);
335             }
336             else {
337                 listener.onBeforeUpdate(resourcePermission);
338             }
339         }
340 
341         resourcePermission = updateImpl(resourcePermission, merge);
342 
343         for (ModelListener<ResourcePermission> listener : listeners) {
344             if (isNew) {
345                 listener.onAfterCreate(resourcePermission);
346             }
347             else {
348                 listener.onAfterUpdate(resourcePermission);
349             }
350         }
351 
352         return resourcePermission;
353     }
354 
355     public ResourcePermission updateImpl(
356         com.liferay.portal.model.ResourcePermission resourcePermission,
357         boolean merge) throws SystemException {
358         boolean isNew = resourcePermission.isNew();
359 
360         ResourcePermissionModelImpl resourcePermissionModelImpl = (ResourcePermissionModelImpl)resourcePermission;
361 
362         Session session = null;
363 
364         try {
365             session = openSession();
366 
367             BatchSessionUtil.update(session, resourcePermission, merge);
368 
369             resourcePermission.setNew(false);
370         }
371         catch (Exception e) {
372             throw processException(e);
373         }
374         finally {
375             closeSession(session);
376         }
377 
378         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
379 
380         EntityCacheUtil.putResult(ResourcePermissionModelImpl.ENTITY_CACHE_ENABLED,
381             ResourcePermissionImpl.class, resourcePermission.getPrimaryKey(),
382             resourcePermission);
383 
384         if (!isNew &&
385                 ((resourcePermission.getCompanyId() != resourcePermissionModelImpl.getOriginalCompanyId()) ||
386                 !Validator.equals(resourcePermission.getName(),
387                     resourcePermissionModelImpl.getOriginalName()) ||
388                 (resourcePermission.getScope() != resourcePermissionModelImpl.getOriginalScope()) ||
389                 !Validator.equals(resourcePermission.getPrimKey(),
390                     resourcePermissionModelImpl.getOriginalPrimKey()) ||
391                 (resourcePermission.getRoleId() != resourcePermissionModelImpl.getOriginalRoleId()))) {
392             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_N_S_P_R,
393                 new Object[] {
394                     new Long(resourcePermissionModelImpl.getOriginalCompanyId()),
395                     
396                 resourcePermissionModelImpl.getOriginalName(),
397                     new Integer(resourcePermissionModelImpl.getOriginalScope()),
398                     
399                 resourcePermissionModelImpl.getOriginalPrimKey(),
400                     new Long(resourcePermissionModelImpl.getOriginalRoleId())
401                 });
402         }
403 
404         if (isNew ||
405                 ((resourcePermission.getCompanyId() != resourcePermissionModelImpl.getOriginalCompanyId()) ||
406                 !Validator.equals(resourcePermission.getName(),
407                     resourcePermissionModelImpl.getOriginalName()) ||
408                 (resourcePermission.getScope() != resourcePermissionModelImpl.getOriginalScope()) ||
409                 !Validator.equals(resourcePermission.getPrimKey(),
410                     resourcePermissionModelImpl.getOriginalPrimKey()) ||
411                 (resourcePermission.getRoleId() != resourcePermissionModelImpl.getOriginalRoleId()))) {
412             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_N_S_P_R,
413                 new Object[] {
414                     new Long(resourcePermission.getCompanyId()),
415                     
416                 resourcePermission.getName(),
417                     new Integer(resourcePermission.getScope()),
418                     
419                 resourcePermission.getPrimKey(),
420                     new Long(resourcePermission.getRoleId())
421                 }, resourcePermission);
422         }
423 
424         return resourcePermission;
425     }
426 
427     public ResourcePermission findByPrimaryKey(long resourcePermissionId)
428         throws NoSuchResourcePermissionException, SystemException {
429         ResourcePermission resourcePermission = fetchByPrimaryKey(resourcePermissionId);
430 
431         if (resourcePermission == null) {
432             if (_log.isWarnEnabled()) {
433                 _log.warn("No ResourcePermission exists with the primary key " +
434                     resourcePermissionId);
435             }
436 
437             throw new NoSuchResourcePermissionException(
438                 "No ResourcePermission exists with the primary key " +
439                 resourcePermissionId);
440         }
441 
442         return resourcePermission;
443     }
444 
445     public ResourcePermission fetchByPrimaryKey(long resourcePermissionId)
446         throws SystemException {
447         ResourcePermission resourcePermission = (ResourcePermission)EntityCacheUtil.getResult(ResourcePermissionModelImpl.ENTITY_CACHE_ENABLED,
448                 ResourcePermissionImpl.class, resourcePermissionId, this);
449 
450         if (resourcePermission == null) {
451             Session session = null;
452 
453             try {
454                 session = openSession();
455 
456                 resourcePermission = (ResourcePermission)session.get(ResourcePermissionImpl.class,
457                         new Long(resourcePermissionId));
458             }
459             catch (Exception e) {
460                 throw processException(e);
461             }
462             finally {
463                 if (resourcePermission != null) {
464                     cacheResult(resourcePermission);
465                 }
466 
467                 closeSession(session);
468             }
469         }
470 
471         return resourcePermission;
472     }
473 
474     public List<ResourcePermission> findByRoleId(long roleId)
475         throws SystemException {
476         Object[] finderArgs = new Object[] { new Long(roleId) };
477 
478         List<ResourcePermission> list = (List<ResourcePermission>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_ROLEID,
479                 finderArgs, this);
480 
481         if (list == null) {
482             Session session = null;
483 
484             try {
485                 session = openSession();
486 
487                 StringBuilder query = new StringBuilder();
488 
489                 query.append(
490                     "SELECT resourcePermission FROM ResourcePermission resourcePermission WHERE ");
491 
492                 query.append("resourcePermission.roleId = ?");
493 
494                 query.append(" ");
495 
496                 Query q = session.createQuery(query.toString());
497 
498                 QueryPos qPos = QueryPos.getInstance(q);
499 
500                 qPos.add(roleId);
501 
502                 list = q.list();
503             }
504             catch (Exception e) {
505                 throw processException(e);
506             }
507             finally {
508                 if (list == null) {
509                     list = new ArrayList<ResourcePermission>();
510                 }
511 
512                 cacheResult(list);
513 
514                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_ROLEID,
515                     finderArgs, list);
516 
517                 closeSession(session);
518             }
519         }
520 
521         return list;
522     }
523 
524     public List<ResourcePermission> findByRoleId(long roleId, int start, int end)
525         throws SystemException {
526         return findByRoleId(roleId, start, end, null);
527     }
528 
529     public List<ResourcePermission> findByRoleId(long roleId, int start,
530         int end, OrderByComparator obc) throws SystemException {
531         Object[] finderArgs = new Object[] {
532                 new Long(roleId),
533                 
534                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
535             };
536 
537         List<ResourcePermission> list = (List<ResourcePermission>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_ROLEID,
538                 finderArgs, this);
539 
540         if (list == null) {
541             Session session = null;
542 
543             try {
544                 session = openSession();
545 
546                 StringBuilder query = new StringBuilder();
547 
548                 query.append(
549                     "SELECT resourcePermission FROM ResourcePermission resourcePermission WHERE ");
550 
551                 query.append("resourcePermission.roleId = ?");
552 
553                 query.append(" ");
554 
555                 if (obc != null) {
556                     query.append("ORDER BY ");
557 
558                     String[] orderByFields = obc.getOrderByFields();
559 
560                     for (int i = 0; i < orderByFields.length; i++) {
561                         query.append("resourcePermission.");
562                         query.append(orderByFields[i]);
563 
564                         if (obc.isAscending()) {
565                             query.append(" ASC");
566                         }
567                         else {
568                             query.append(" DESC");
569                         }
570 
571                         if ((i + 1) < orderByFields.length) {
572                             query.append(", ");
573                         }
574                     }
575                 }
576 
577                 Query q = session.createQuery(query.toString());
578 
579                 QueryPos qPos = QueryPos.getInstance(q);
580 
581                 qPos.add(roleId);
582 
583                 list = (List<ResourcePermission>)QueryUtil.list(q,
584                         getDialect(), start, end);
585             }
586             catch (Exception e) {
587                 throw processException(e);
588             }
589             finally {
590                 if (list == null) {
591                     list = new ArrayList<ResourcePermission>();
592                 }
593 
594                 cacheResult(list);
595 
596                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_ROLEID,
597                     finderArgs, list);
598 
599                 closeSession(session);
600             }
601         }
602 
603         return list;
604     }
605 
606     public ResourcePermission findByRoleId_First(long roleId,
607         OrderByComparator obc)
608         throws NoSuchResourcePermissionException, SystemException {
609         List<ResourcePermission> list = findByRoleId(roleId, 0, 1, obc);
610 
611         if (list.isEmpty()) {
612             StringBuilder msg = new StringBuilder();
613 
614             msg.append("No ResourcePermission exists with the key {");
615 
616             msg.append("roleId=" + roleId);
617 
618             msg.append(StringPool.CLOSE_CURLY_BRACE);
619 
620             throw new NoSuchResourcePermissionException(msg.toString());
621         }
622         else {
623             return list.get(0);
624         }
625     }
626 
627     public ResourcePermission findByRoleId_Last(long roleId,
628         OrderByComparator obc)
629         throws NoSuchResourcePermissionException, SystemException {
630         int count = countByRoleId(roleId);
631 
632         List<ResourcePermission> list = findByRoleId(roleId, count - 1, count,
633                 obc);
634 
635         if (list.isEmpty()) {
636             StringBuilder msg = new StringBuilder();
637 
638             msg.append("No ResourcePermission exists with the key {");
639 
640             msg.append("roleId=" + roleId);
641 
642             msg.append(StringPool.CLOSE_CURLY_BRACE);
643 
644             throw new NoSuchResourcePermissionException(msg.toString());
645         }
646         else {
647             return list.get(0);
648         }
649     }
650 
651     public ResourcePermission[] findByRoleId_PrevAndNext(
652         long resourcePermissionId, long roleId, OrderByComparator obc)
653         throws NoSuchResourcePermissionException, SystemException {
654         ResourcePermission resourcePermission = findByPrimaryKey(resourcePermissionId);
655 
656         int count = countByRoleId(roleId);
657 
658         Session session = null;
659 
660         try {
661             session = openSession();
662 
663             StringBuilder query = new StringBuilder();
664 
665             query.append(
666                 "SELECT resourcePermission FROM ResourcePermission resourcePermission WHERE ");
667 
668             query.append("resourcePermission.roleId = ?");
669 
670             query.append(" ");
671 
672             if (obc != null) {
673                 query.append("ORDER BY ");
674 
675                 String[] orderByFields = obc.getOrderByFields();
676 
677                 for (int i = 0; i < orderByFields.length; i++) {
678                     query.append("resourcePermission.");
679                     query.append(orderByFields[i]);
680 
681                     if (obc.isAscending()) {
682                         query.append(" ASC");
683                     }
684                     else {
685                         query.append(" DESC");
686                     }
687 
688                     if ((i + 1) < orderByFields.length) {
689                         query.append(", ");
690                     }
691                 }
692             }
693 
694             Query q = session.createQuery(query.toString());
695 
696             QueryPos qPos = QueryPos.getInstance(q);
697 
698             qPos.add(roleId);
699 
700             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
701                     resourcePermission);
702 
703             ResourcePermission[] array = new ResourcePermissionImpl[3];
704 
705             array[0] = (ResourcePermission)objArray[0];
706             array[1] = (ResourcePermission)objArray[1];
707             array[2] = (ResourcePermission)objArray[2];
708 
709             return array;
710         }
711         catch (Exception e) {
712             throw processException(e);
713         }
714         finally {
715             closeSession(session);
716         }
717     }
718 
719     public List<ResourcePermission> findByC_N_S(long companyId, String name,
720         int scope) throws SystemException {
721         Object[] finderArgs = new Object[] {
722                 new Long(companyId),
723                 
724                 name, new Integer(scope)
725             };
726 
727         List<ResourcePermission> list = (List<ResourcePermission>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_N_S,
728                 finderArgs, this);
729 
730         if (list == null) {
731             Session session = null;
732 
733             try {
734                 session = openSession();
735 
736                 StringBuilder query = new StringBuilder();
737 
738                 query.append(
739                     "SELECT resourcePermission FROM ResourcePermission resourcePermission WHERE ");
740 
741                 query.append("resourcePermission.companyId = ?");
742 
743                 query.append(" AND ");
744 
745                 if (name == null) {
746                     query.append("resourcePermission.name IS NULL");
747                 }
748                 else {
749                     query.append("resourcePermission.name = ?");
750                 }
751 
752                 query.append(" AND ");
753 
754                 query.append("resourcePermission.scope = ?");
755 
756                 query.append(" ");
757 
758                 Query q = session.createQuery(query.toString());
759 
760                 QueryPos qPos = QueryPos.getInstance(q);
761 
762                 qPos.add(companyId);
763 
764                 if (name != null) {
765                     qPos.add(name);
766                 }
767 
768                 qPos.add(scope);
769 
770                 list = q.list();
771             }
772             catch (Exception e) {
773                 throw processException(e);
774             }
775             finally {
776                 if (list == null) {
777                     list = new ArrayList<ResourcePermission>();
778                 }
779 
780                 cacheResult(list);
781 
782                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_N_S,
783                     finderArgs, list);
784 
785                 closeSession(session);
786             }
787         }
788 
789         return list;
790     }
791 
792     public List<ResourcePermission> findByC_N_S(long companyId, String name,
793         int scope, int start, int end) throws SystemException {
794         return findByC_N_S(companyId, name, scope, start, end, null);
795     }
796 
797     public List<ResourcePermission> findByC_N_S(long companyId, String name,
798         int scope, int start, int end, OrderByComparator obc)
799         throws SystemException {
800         Object[] finderArgs = new Object[] {
801                 new Long(companyId),
802                 
803                 name, new Integer(scope),
804                 
805                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
806             };
807 
808         List<ResourcePermission> list = (List<ResourcePermission>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_C_N_S,
809                 finderArgs, this);
810 
811         if (list == null) {
812             Session session = null;
813 
814             try {
815                 session = openSession();
816 
817                 StringBuilder query = new StringBuilder();
818 
819                 query.append(
820                     "SELECT resourcePermission FROM ResourcePermission resourcePermission WHERE ");
821 
822                 query.append("resourcePermission.companyId = ?");
823 
824                 query.append(" AND ");
825 
826                 if (name == null) {
827                     query.append("resourcePermission.name IS NULL");
828                 }
829                 else {
830                     query.append("resourcePermission.name = ?");
831                 }
832 
833                 query.append(" AND ");
834 
835                 query.append("resourcePermission.scope = ?");
836 
837                 query.append(" ");
838 
839                 if (obc != null) {
840                     query.append("ORDER BY ");
841 
842                     String[] orderByFields = obc.getOrderByFields();
843 
844                     for (int i = 0; i < orderByFields.length; i++) {
845                         query.append("resourcePermission.");
846                         query.append(orderByFields[i]);
847 
848                         if (obc.isAscending()) {
849                             query.append(" ASC");
850                         }
851                         else {
852                             query.append(" DESC");
853                         }
854 
855                         if ((i + 1) < orderByFields.length) {
856                             query.append(", ");
857                         }
858                     }
859                 }
860 
861                 Query q = session.createQuery(query.toString());
862 
863                 QueryPos qPos = QueryPos.getInstance(q);
864 
865                 qPos.add(companyId);
866 
867                 if (name != null) {
868                     qPos.add(name);
869                 }
870 
871                 qPos.add(scope);
872 
873                 list = (List<ResourcePermission>)QueryUtil.list(q,
874                         getDialect(), start, end);
875             }
876             catch (Exception e) {
877                 throw processException(e);
878             }
879             finally {
880                 if (list == null) {
881                     list = new ArrayList<ResourcePermission>();
882                 }
883 
884                 cacheResult(list);
885 
886                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_C_N_S,
887                     finderArgs, list);
888 
889                 closeSession(session);
890             }
891         }
892 
893         return list;
894     }
895 
896     public ResourcePermission findByC_N_S_First(long companyId, String name,
897         int scope, OrderByComparator obc)
898         throws NoSuchResourcePermissionException, SystemException {
899         List<ResourcePermission> list = findByC_N_S(companyId, name, scope, 0,
900                 1, obc);
901 
902         if (list.isEmpty()) {
903             StringBuilder msg = new StringBuilder();
904 
905             msg.append("No ResourcePermission exists with the key {");
906 
907             msg.append("companyId=" + companyId);
908 
909             msg.append(", ");
910             msg.append("name=" + name);
911 
912             msg.append(", ");
913             msg.append("scope=" + scope);
914 
915             msg.append(StringPool.CLOSE_CURLY_BRACE);
916 
917             throw new NoSuchResourcePermissionException(msg.toString());
918         }
919         else {
920             return list.get(0);
921         }
922     }
923 
924     public ResourcePermission findByC_N_S_Last(long companyId, String name,
925         int scope, OrderByComparator obc)
926         throws NoSuchResourcePermissionException, SystemException {
927         int count = countByC_N_S(companyId, name, scope);
928 
929         List<ResourcePermission> list = findByC_N_S(companyId, name, scope,
930                 count - 1, count, obc);
931 
932         if (list.isEmpty()) {
933             StringBuilder msg = new StringBuilder();
934 
935             msg.append("No ResourcePermission exists with the key {");
936 
937             msg.append("companyId=" + companyId);
938 
939             msg.append(", ");
940             msg.append("name=" + name);
941 
942             msg.append(", ");
943             msg.append("scope=" + scope);
944 
945             msg.append(StringPool.CLOSE_CURLY_BRACE);
946 
947             throw new NoSuchResourcePermissionException(msg.toString());
948         }
949         else {
950             return list.get(0);
951         }
952     }
953 
954     public ResourcePermission[] findByC_N_S_PrevAndNext(
955         long resourcePermissionId, long companyId, String name, int scope,
956         OrderByComparator obc)
957         throws NoSuchResourcePermissionException, SystemException {
958         ResourcePermission resourcePermission = findByPrimaryKey(resourcePermissionId);
959 
960         int count = countByC_N_S(companyId, name, scope);
961 
962         Session session = null;
963 
964         try {
965             session = openSession();
966 
967             StringBuilder query = new StringBuilder();
968 
969             query.append(
970                 "SELECT resourcePermission FROM ResourcePermission resourcePermission WHERE ");
971 
972             query.append("resourcePermission.companyId = ?");
973 
974             query.append(" AND ");
975 
976             if (name == null) {
977                 query.append("resourcePermission.name IS NULL");
978             }
979             else {
980                 query.append("resourcePermission.name = ?");
981             }
982 
983             query.append(" AND ");
984 
985             query.append("resourcePermission.scope = ?");
986 
987             query.append(" ");
988 
989             if (obc != null) {
990                 query.append("ORDER BY ");
991 
992                 String[] orderByFields = obc.getOrderByFields();
993 
994                 for (int i = 0; i < orderByFields.length; i++) {
995                     query.append("resourcePermission.");
996                     query.append(orderByFields[i]);
997 
998                     if (obc.isAscending()) {
999                         query.append(" ASC");
1000                    }
1001                    else {
1002                        query.append(" DESC");
1003                    }
1004
1005                    if ((i + 1) < orderByFields.length) {
1006                        query.append(", ");
1007                    }
1008                }
1009            }
1010
1011            Query q = session.createQuery(query.toString());
1012
1013            QueryPos qPos = QueryPos.getInstance(q);
1014
1015            qPos.add(companyId);
1016
1017            if (name != null) {
1018                qPos.add(name);
1019            }
1020
1021            qPos.add(scope);
1022
1023            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1024                    resourcePermission);
1025
1026            ResourcePermission[] array = new ResourcePermissionImpl[3];
1027
1028            array[0] = (ResourcePermission)objArray[0];
1029            array[1] = (ResourcePermission)objArray[1];
1030            array[2] = (ResourcePermission)objArray[2];
1031
1032            return array;
1033        }
1034        catch (Exception e) {
1035            throw processException(e);
1036        }
1037        finally {
1038            closeSession(session);
1039        }
1040    }
1041
1042    public List<ResourcePermission> findByC_N_S_P(long companyId, String name,
1043        int scope, String primKey) throws SystemException {
1044        Object[] finderArgs = new Object[] {
1045                new Long(companyId),
1046                
1047                name, new Integer(scope),
1048                
1049                primKey
1050            };
1051
1052        List<ResourcePermission> list = (List<ResourcePermission>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_N_S_P,
1053                finderArgs, this);
1054
1055        if (list == null) {
1056            Session session = null;
1057
1058            try {
1059                session = openSession();
1060
1061                StringBuilder query = new StringBuilder();
1062
1063                query.append(
1064                    "SELECT resourcePermission FROM ResourcePermission resourcePermission WHERE ");
1065
1066                query.append("resourcePermission.companyId = ?");
1067
1068                query.append(" AND ");
1069
1070                if (name == null) {
1071                    query.append("resourcePermission.name IS NULL");
1072                }
1073                else {
1074                    query.append("resourcePermission.name = ?");
1075                }
1076
1077                query.append(" AND ");
1078
1079                query.append("resourcePermission.scope = ?");
1080
1081                query.append(" AND ");
1082
1083                if (primKey == null) {
1084                    query.append("resourcePermission.primKey IS NULL");
1085                }
1086                else {
1087                    query.append("resourcePermission.primKey = ?");
1088                }
1089
1090                query.append(" ");
1091
1092                Query q = session.createQuery(query.toString());
1093
1094                QueryPos qPos = QueryPos.getInstance(q);
1095
1096                qPos.add(companyId);
1097
1098                if (name != null) {
1099                    qPos.add(name);
1100                }
1101
1102                qPos.add(scope);
1103
1104                if (primKey != null) {
1105                    qPos.add(primKey);
1106                }
1107
1108                list = q.list();
1109            }
1110            catch (Exception e) {
1111                throw processException(e);
1112            }
1113            finally {
1114                if (list == null) {
1115                    list = new ArrayList<ResourcePermission>();
1116                }
1117
1118                cacheResult(list);
1119
1120                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_N_S_P,
1121                    finderArgs, list);
1122
1123                closeSession(session);
1124            }
1125        }
1126
1127        return list;
1128    }
1129
1130    public List<ResourcePermission> findByC_N_S_P(long companyId, String name,
1131        int scope, String primKey, int start, int end)
1132        throws SystemException {
1133        return findByC_N_S_P(companyId, name, scope, primKey, start, end, null);
1134    }
1135
1136    public List<ResourcePermission> findByC_N_S_P(long companyId, String name,
1137        int scope, String primKey, int start, int end, OrderByComparator obc)
1138        throws SystemException {
1139        Object[] finderArgs = new Object[] {
1140                new Long(companyId),
1141                
1142                name, new Integer(scope),
1143                
1144                primKey,
1145                
1146                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1147            };
1148
1149        List<ResourcePermission> list = (List<ResourcePermission>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_C_N_S_P,
1150                finderArgs, this);
1151
1152        if (list == null) {
1153            Session session = null;
1154
1155            try {
1156                session = openSession();
1157
1158                StringBuilder query = new StringBuilder();
1159
1160                query.append(
1161                    "SELECT resourcePermission FROM ResourcePermission resourcePermission WHERE ");
1162
1163                query.append("resourcePermission.companyId = ?");
1164
1165                query.append(" AND ");
1166
1167                if (name == null) {
1168                    query.append("resourcePermission.name IS NULL");
1169                }
1170                else {
1171                    query.append("resourcePermission.name = ?");
1172                }
1173
1174                query.append(" AND ");
1175
1176                query.append("resourcePermission.scope = ?");
1177
1178                query.append(" AND ");
1179
1180                if (primKey == null) {
1181                    query.append("resourcePermission.primKey IS NULL");
1182                }
1183                else {
1184                    query.append("resourcePermission.primKey = ?");
1185                }
1186
1187                query.append(" ");
1188
1189                if (obc != null) {
1190                    query.append("ORDER BY ");
1191
1192                    String[] orderByFields = obc.getOrderByFields();
1193
1194                    for (int i = 0; i < orderByFields.length; i++) {
1195                        query.append("resourcePermission.");
1196                        query.append(orderByFields[i]);
1197
1198                        if (obc.isAscending()) {
1199                            query.append(" ASC");
1200                        }
1201                        else {
1202                            query.append(" DESC");
1203                        }
1204
1205                        if ((i + 1) < orderByFields.length) {
1206                            query.append(", ");
1207                        }
1208                    }
1209                }
1210
1211                Query q = session.createQuery(query.toString());
1212
1213                QueryPos qPos = QueryPos.getInstance(q);
1214
1215                qPos.add(companyId);
1216
1217                if (name != null) {
1218                    qPos.add(name);
1219                }
1220
1221                qPos.add(scope);
1222
1223                if (primKey != null) {
1224                    qPos.add(primKey);
1225                }
1226
1227                list = (List<ResourcePermission>)QueryUtil.list(q,
1228                        getDialect(), start, end);
1229            }
1230            catch (Exception e) {
1231                throw processException(e);
1232            }
1233            finally {
1234                if (list == null) {
1235                    list = new ArrayList<ResourcePermission>();
1236                }
1237
1238                cacheResult(list);
1239
1240                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_C_N_S_P,
1241                    finderArgs, list);
1242
1243                closeSession(session);
1244            }
1245        }
1246
1247        return list;
1248    }
1249
1250    public ResourcePermission findByC_N_S_P_First(long companyId, String name,
1251        int scope, String primKey, OrderByComparator obc)
1252        throws NoSuchResourcePermissionException, SystemException {
1253        List<ResourcePermission> list = findByC_N_S_P(companyId, name, scope,
1254                primKey, 0, 1, obc);
1255
1256        if (list.isEmpty()) {
1257            StringBuilder msg = new StringBuilder();
1258
1259            msg.append("No ResourcePermission exists with the key {");
1260
1261            msg.append("companyId=" + companyId);
1262
1263            msg.append(", ");
1264            msg.append("name=" + name);
1265
1266            msg.append(", ");
1267            msg.append("scope=" + scope);
1268
1269            msg.append(", ");
1270            msg.append("primKey=" + primKey);
1271
1272            msg.append(StringPool.CLOSE_CURLY_BRACE);
1273
1274            throw new NoSuchResourcePermissionException(msg.toString());
1275        }
1276        else {
1277            return list.get(0);
1278        }
1279    }
1280
1281    public ResourcePermission findByC_N_S_P_Last(long companyId, String name,
1282        int scope, String primKey, OrderByComparator obc)
1283        throws NoSuchResourcePermissionException, SystemException {
1284        int count = countByC_N_S_P(companyId, name, scope, primKey);
1285
1286        List<ResourcePermission> list = findByC_N_S_P(companyId, name, scope,
1287                primKey, count - 1, count, obc);
1288
1289        if (list.isEmpty()) {
1290            StringBuilder msg = new StringBuilder();
1291
1292            msg.append("No ResourcePermission exists with the key {");
1293
1294            msg.append("companyId=" + companyId);
1295
1296            msg.append(", ");
1297            msg.append("name=" + name);
1298
1299            msg.append(", ");
1300            msg.append("scope=" + scope);
1301
1302            msg.append(", ");
1303            msg.append("primKey=" + primKey);
1304
1305            msg.append(StringPool.CLOSE_CURLY_BRACE);
1306
1307            throw new NoSuchResourcePermissionException(msg.toString());
1308        }
1309        else {
1310            return list.get(0);
1311        }
1312    }
1313
1314    public ResourcePermission[] findByC_N_S_P_PrevAndNext(
1315        long resourcePermissionId, long companyId, String name, int scope,
1316        String primKey, OrderByComparator obc)
1317        throws NoSuchResourcePermissionException, SystemException {
1318        ResourcePermission resourcePermission = findByPrimaryKey(resourcePermissionId);
1319
1320        int count = countByC_N_S_P(companyId, name, scope, primKey);
1321
1322        Session session = null;
1323
1324        try {
1325            session = openSession();
1326
1327            StringBuilder query = new StringBuilder();
1328
1329            query.append(
1330                "SELECT resourcePermission FROM ResourcePermission resourcePermission WHERE ");
1331
1332            query.append("resourcePermission.companyId = ?");
1333
1334            query.append(" AND ");
1335
1336            if (name == null) {
1337                query.append("resourcePermission.name IS NULL");
1338            }
1339            else {
1340                query.append("resourcePermission.name = ?");
1341            }
1342
1343            query.append(" AND ");
1344
1345            query.append("resourcePermission.scope = ?");
1346
1347            query.append(" AND ");
1348
1349            if (primKey == null) {
1350                query.append("resourcePermission.primKey IS NULL");
1351            }
1352            else {
1353                query.append("resourcePermission.primKey = ?");
1354            }
1355
1356            query.append(" ");
1357
1358            if (obc != null) {
1359                query.append("ORDER BY ");
1360
1361                String[] orderByFields = obc.getOrderByFields();
1362
1363                for (int i = 0; i < orderByFields.length; i++) {
1364                    query.append("resourcePermission.");
1365                    query.append(orderByFields[i]);
1366
1367                    if (obc.isAscending()) {
1368                        query.append(" ASC");
1369                    }
1370                    else {
1371                        query.append(" DESC");
1372                    }
1373
1374                    if ((i + 1) < orderByFields.length) {
1375                        query.append(", ");
1376                    }
1377                }
1378            }
1379
1380            Query q = session.createQuery(query.toString());
1381
1382            QueryPos qPos = QueryPos.getInstance(q);
1383
1384            qPos.add(companyId);
1385
1386            if (name != null) {
1387                qPos.add(name);
1388            }
1389
1390            qPos.add(scope);
1391
1392            if (primKey != null) {
1393                qPos.add(primKey);
1394            }
1395
1396            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1397                    resourcePermission);
1398
1399            ResourcePermission[] array = new ResourcePermissionImpl[3];
1400
1401            array[0] = (ResourcePermission)objArray[0];
1402            array[1] = (ResourcePermission)objArray[1];
1403            array[2] = (ResourcePermission)objArray[2];
1404
1405            return array;
1406        }
1407        catch (Exception e) {
1408            throw processException(e);
1409        }
1410        finally {
1411            closeSession(session);
1412        }
1413    }
1414
1415    public ResourcePermission findByC_N_S_P_R(long companyId, String name,
1416        int scope, String primKey, long roleId)
1417        throws NoSuchResourcePermissionException, SystemException {
1418        ResourcePermission resourcePermission = fetchByC_N_S_P_R(companyId,
1419                name, scope, primKey, roleId);
1420
1421        if (resourcePermission == null) {
1422            StringBuilder msg = new StringBuilder();
1423
1424            msg.append("No ResourcePermission exists with the key {");
1425
1426            msg.append("companyId=" + companyId);
1427
1428            msg.append(", ");
1429            msg.append("name=" + name);
1430
1431            msg.append(", ");
1432            msg.append("scope=" + scope);
1433
1434            msg.append(", ");
1435            msg.append("primKey=" + primKey);
1436
1437            msg.append(", ");
1438            msg.append("roleId=" + roleId);
1439
1440            msg.append(StringPool.CLOSE_CURLY_BRACE);
1441
1442            if (_log.isWarnEnabled()) {
1443                _log.warn(msg.toString());
1444            }
1445
1446            throw new NoSuchResourcePermissionException(msg.toString());
1447        }
1448
1449        return resourcePermission;
1450    }
1451
1452    public ResourcePermission fetchByC_N_S_P_R(long companyId, String name,
1453        int scope, String primKey, long roleId) throws SystemException {
1454        return fetchByC_N_S_P_R(companyId, name, scope, primKey, roleId, true);
1455    }
1456
1457    public ResourcePermission fetchByC_N_S_P_R(long companyId, String name,
1458        int scope, String primKey, long roleId, boolean retrieveFromCache)
1459        throws SystemException {
1460        Object[] finderArgs = new Object[] {
1461                new Long(companyId),
1462                
1463                name, new Integer(scope),
1464                
1465                primKey, new Long(roleId)
1466            };
1467
1468        Object result = null;
1469
1470        if (retrieveFromCache) {
1471            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_N_S_P_R,
1472                    finderArgs, this);
1473        }
1474
1475        if (result == null) {
1476            Session session = null;
1477
1478            try {
1479                session = openSession();
1480
1481                StringBuilder query = new StringBuilder();
1482
1483                query.append(
1484                    "SELECT resourcePermission FROM ResourcePermission resourcePermission WHERE ");
1485
1486                query.append("resourcePermission.companyId = ?");
1487
1488                query.append(" AND ");
1489
1490                if (name == null) {
1491                    query.append("resourcePermission.name IS NULL");
1492                }
1493                else {
1494                    query.append("resourcePermission.name = ?");
1495                }
1496
1497                query.append(" AND ");
1498
1499                query.append("resourcePermission.scope = ?");
1500
1501                query.append(" AND ");
1502
1503                if (primKey == null) {
1504                    query.append("resourcePermission.primKey IS NULL");
1505                }
1506                else {
1507                    query.append("resourcePermission.primKey = ?");
1508                }
1509
1510                query.append(" AND ");
1511
1512                query.append("resourcePermission.roleId = ?");
1513
1514                query.append(" ");
1515
1516                Query q = session.createQuery(query.toString());
1517
1518                QueryPos qPos = QueryPos.getInstance(q);
1519
1520                qPos.add(companyId);
1521
1522                if (name != null) {
1523                    qPos.add(name);
1524                }
1525
1526                qPos.add(scope);
1527
1528                if (primKey != null) {
1529                    qPos.add(primKey);
1530                }
1531
1532                qPos.add(roleId);
1533
1534                List<ResourcePermission> list = q.list();
1535
1536                result = list;
1537
1538                ResourcePermission resourcePermission = null;
1539
1540                if (list.isEmpty()) {
1541                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_N_S_P_R,
1542                        finderArgs, list);
1543                }
1544                else {
1545                    resourcePermission = list.get(0);
1546
1547                    cacheResult(resourcePermission);
1548
1549                    if ((resourcePermission.getCompanyId() != companyId) ||
1550                            (resourcePermission.getName() == null) ||
1551                            !resourcePermission.getName().equals(name) ||
1552                            (resourcePermission.getScope() != scope) ||
1553                            (resourcePermission.getPrimKey() == null) ||
1554                            !resourcePermission.getPrimKey().equals(primKey) ||
1555                            (resourcePermission.getRoleId() != roleId)) {
1556                        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_N_S_P_R,
1557                            finderArgs, resourcePermission);
1558                    }
1559                }
1560
1561                return resourcePermission;
1562            }
1563            catch (Exception e) {
1564                throw processException(e);
1565            }
1566            finally {
1567                if (result == null) {
1568                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_N_S_P_R,
1569                        finderArgs, new ArrayList<ResourcePermission>());
1570                }
1571
1572                closeSession(session);
1573            }
1574        }
1575        else {
1576            if (result instanceof List<?>) {
1577                return null;
1578            }
1579            else {
1580                return (ResourcePermission)result;
1581            }
1582        }
1583    }
1584
1585    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
1586        throws SystemException {
1587        Session session = null;
1588
1589        try {
1590            session = openSession();
1591
1592            dynamicQuery.compile(session);
1593
1594            return dynamicQuery.list();
1595        }
1596        catch (Exception e) {
1597            throw processException(e);
1598        }
1599        finally {
1600            closeSession(session);
1601        }
1602    }
1603
1604    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
1605        int start, int end) throws SystemException {
1606        Session session = null;
1607
1608        try {
1609            session = openSession();
1610
1611            dynamicQuery.setLimit(start, end);
1612
1613            dynamicQuery.compile(session);
1614
1615            return dynamicQuery.list();
1616        }
1617        catch (Exception e) {
1618            throw processException(e);
1619        }
1620        finally {
1621            closeSession(session);
1622        }
1623    }
1624
1625    public List<ResourcePermission> findAll() throws SystemException {
1626        return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1627    }
1628
1629    public List<ResourcePermission> findAll(int start, int end)
1630        throws SystemException {
1631        return findAll(start, end, null);
1632    }
1633
1634    public List<ResourcePermission> findAll(int start, int end,
1635        OrderByComparator obc) throws SystemException {
1636        Object[] finderArgs = new Object[] {
1637                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1638            };
1639
1640        List<ResourcePermission> list = (List<ResourcePermission>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1641                finderArgs, this);
1642
1643        if (list == null) {
1644            Session session = null;
1645
1646            try {
1647                session = openSession();
1648
1649                StringBuilder query = new StringBuilder();
1650
1651                query.append(
1652                    "SELECT resourcePermission FROM ResourcePermission resourcePermission ");
1653
1654                if (obc != null) {
1655                    query.append("ORDER BY ");
1656
1657                    String[] orderByFields = obc.getOrderByFields();
1658
1659                    for (int i = 0; i < orderByFields.length; i++) {
1660                        query.append("resourcePermission.");
1661                        query.append(orderByFields[i]);
1662
1663                        if (obc.isAscending()) {
1664                            query.append(" ASC");
1665                        }
1666                        else {
1667                            query.append(" DESC");
1668                        }
1669
1670                        if ((i + 1) < orderByFields.length) {
1671                            query.append(", ");
1672                        }
1673                    }
1674                }
1675
1676                Query q = session.createQuery(query.toString());
1677
1678                if (obc == null) {
1679                    list = (List<ResourcePermission>)QueryUtil.list(q,
1680                            getDialect(), start, end, false);
1681
1682                    Collections.sort(list);
1683                }
1684                else {
1685                    list = (List<ResourcePermission>)QueryUtil.list(q,
1686                            getDialect(), start, end);
1687                }
1688            }
1689            catch (Exception e) {
1690                throw processException(e);
1691            }
1692            finally {
1693                if (list == null) {
1694                    list = new ArrayList<ResourcePermission>();
1695                }
1696
1697                cacheResult(list);
1698
1699                FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
1700
1701                closeSession(session);
1702            }
1703        }
1704
1705        return list;
1706    }
1707
1708    public void removeByRoleId(long roleId) throws SystemException {
1709        for (ResourcePermission resourcePermission : findByRoleId(roleId)) {
1710            remove(resourcePermission);
1711        }
1712    }
1713
1714    public void removeByC_N_S(long companyId, String name, int scope)
1715        throws SystemException {
1716        for (ResourcePermission resourcePermission : findByC_N_S(companyId,
1717                name, scope)) {
1718            remove(resourcePermission);
1719        }
1720    }
1721
1722    public void removeByC_N_S_P(long companyId, String name, int scope,
1723        String primKey) throws SystemException {
1724        for (ResourcePermission resourcePermission : findByC_N_S_P(companyId,
1725                name, scope, primKey)) {
1726            remove(resourcePermission);
1727        }
1728    }
1729
1730    public void removeByC_N_S_P_R(long companyId, String name, int scope,
1731        String primKey, long roleId)
1732        throws NoSuchResourcePermissionException, SystemException {
1733        ResourcePermission resourcePermission = findByC_N_S_P_R(companyId,
1734                name, scope, primKey, roleId);
1735
1736        remove(resourcePermission);
1737    }
1738
1739    public void removeAll() throws SystemException {
1740        for (ResourcePermission resourcePermission : findAll()) {
1741            remove(resourcePermission);
1742        }
1743    }
1744
1745    public int countByRoleId(long roleId) throws SystemException {
1746        Object[] finderArgs = new Object[] { new Long(roleId) };
1747
1748        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_ROLEID,
1749                finderArgs, this);
1750
1751        if (count == null) {
1752            Session session = null;
1753
1754            try {
1755                session = openSession();
1756
1757                StringBuilder query = new StringBuilder();
1758
1759                query.append("SELECT COUNT(resourcePermission) ");
1760                query.append(
1761                    "FROM ResourcePermission resourcePermission WHERE ");
1762
1763                query.append("resourcePermission.roleId = ?");
1764
1765                query.append(" ");
1766
1767                Query q = session.createQuery(query.toString());
1768
1769                QueryPos qPos = QueryPos.getInstance(q);
1770
1771                qPos.add(roleId);
1772
1773                count = (Long)q.uniqueResult();
1774            }
1775            catch (Exception e) {
1776                throw processException(e);
1777            }
1778            finally {
1779                if (count == null) {
1780                    count = Long.valueOf(0);
1781                }
1782
1783                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_ROLEID,
1784                    finderArgs, count);
1785
1786                closeSession(session);
1787            }
1788        }
1789
1790        return count.intValue();
1791    }
1792
1793    public int countByC_N_S(long companyId, String name, int scope)
1794        throws SystemException {
1795        Object[] finderArgs = new Object[] {
1796                new Long(companyId),
1797                
1798                name, new Integer(scope)
1799            };
1800
1801        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_N_S,
1802                finderArgs, this);
1803
1804        if (count == null) {
1805            Session session = null;
1806
1807            try {
1808                session = openSession();
1809
1810                StringBuilder query = new StringBuilder();
1811
1812                query.append("SELECT COUNT(resourcePermission) ");
1813                query.append(
1814                    "FROM ResourcePermission resourcePermission WHERE ");
1815
1816                query.append("resourcePermission.companyId = ?");
1817
1818                query.append(" AND ");
1819
1820                if (name == null) {
1821                    query.append("resourcePermission.name IS NULL");
1822                }
1823                else {
1824                    query.append("resourcePermission.name = ?");
1825                }
1826
1827                query.append(" AND ");
1828
1829                query.append("resourcePermission.scope = ?");
1830
1831                query.append(" ");
1832
1833                Query q = session.createQuery(query.toString());
1834
1835                QueryPos qPos = QueryPos.getInstance(q);
1836
1837                qPos.add(companyId);
1838
1839                if (name != null) {
1840                    qPos.add(name);
1841                }
1842
1843                qPos.add(scope);
1844
1845                count = (Long)q.uniqueResult();
1846            }
1847            catch (Exception e) {
1848                throw processException(e);
1849            }
1850            finally {
1851                if (count == null) {
1852                    count = Long.valueOf(0);
1853                }
1854
1855                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_N_S,
1856                    finderArgs, count);
1857
1858                closeSession(session);
1859            }
1860        }
1861
1862        return count.intValue();
1863    }
1864
1865    public int countByC_N_S_P(long companyId, String name, int scope,
1866        String primKey) throws SystemException {
1867        Object[] finderArgs = new Object[] {
1868                new Long(companyId),
1869                
1870                name, new Integer(scope),
1871                
1872                primKey
1873            };
1874
1875        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_N_S_P,
1876                finderArgs, this);
1877
1878        if (count == null) {
1879            Session session = null;
1880
1881            try {
1882                session = openSession();
1883
1884                StringBuilder query = new StringBuilder();
1885
1886                query.append("SELECT COUNT(resourcePermission) ");
1887                query.append(
1888                    "FROM ResourcePermission resourcePermission WHERE ");
1889
1890                query.append("resourcePermission.companyId = ?");
1891
1892                query.append(" AND ");
1893
1894                if (name == null) {
1895                    query.append("resourcePermission.name IS NULL");
1896                }
1897                else {
1898                    query.append("resourcePermission.name = ?");
1899                }
1900
1901                query.append(" AND ");
1902
1903                query.append("resourcePermission.scope = ?");
1904
1905                query.append(" AND ");
1906
1907                if (primKey == null) {
1908                    query.append("resourcePermission.primKey IS NULL");
1909                }
1910                else {
1911                    query.append("resourcePermission.primKey = ?");
1912                }
1913
1914                query.append(" ");
1915
1916                Query q = session.createQuery(query.toString());
1917
1918                QueryPos qPos = QueryPos.getInstance(q);
1919
1920                qPos.add(companyId);
1921
1922                if (name != null) {
1923                    qPos.add(name);
1924                }
1925
1926                qPos.add(scope);
1927
1928                if (primKey != null) {
1929                    qPos.add(primKey);
1930                }
1931
1932                count = (Long)q.uniqueResult();
1933            }
1934            catch (Exception e) {
1935                throw processException(e);
1936            }
1937            finally {
1938                if (count == null) {
1939                    count = Long.valueOf(0);
1940                }
1941
1942                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_N_S_P,
1943                    finderArgs, count);
1944
1945                closeSession(session);
1946            }
1947        }
1948
1949        return count.intValue();
1950    }
1951
1952    public int countByC_N_S_P_R(long companyId, String name, int scope,
1953        String primKey, long roleId) throws SystemException {
1954        Object[] finderArgs = new Object[] {
1955                new Long(companyId),
1956                
1957                name, new Integer(scope),
1958                
1959                primKey, new Long(roleId)
1960            };
1961
1962        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_N_S_P_R,
1963                finderArgs, this);
1964
1965        if (count == null) {
1966            Session session = null;
1967
1968            try {
1969                session = openSession();
1970
1971                StringBuilder query = new StringBuilder();
1972
1973                query.append("SELECT COUNT(resourcePermission) ");
1974                query.append(
1975                    "FROM ResourcePermission resourcePermission WHERE ");
1976
1977                query.append("resourcePermission.companyId = ?");
1978
1979                query.append(" AND ");
1980
1981                if (name == null) {
1982                    query.append("resourcePermission.name IS NULL");
1983                }
1984                else {
1985                    query.append("resourcePermission.name = ?");
1986                }
1987
1988                query.append(" AND ");
1989
1990                query.append("resourcePermission.scope = ?");
1991
1992                query.append(" AND ");
1993
1994                if (primKey == null) {
1995                    query.append("resourcePermission.primKey IS NULL");
1996                }
1997                else {
1998                    query.append("resourcePermission.primKey = ?");
1999                }
2000
2001                query.append(" AND ");
2002
2003                query.append("resourcePermission.roleId = ?");
2004
2005                query.append(" ");
2006
2007                Query q = session.createQuery(query.toString());
2008
2009                QueryPos qPos = QueryPos.getInstance(q);
2010
2011                qPos.add(companyId);
2012
2013                if (name != null) {
2014                    qPos.add(name);
2015                }
2016
2017                qPos.add(scope);
2018
2019                if (primKey != null) {
2020                    qPos.add(primKey);
2021                }
2022
2023                qPos.add(roleId);
2024
2025                count = (Long)q.uniqueResult();
2026            }
2027            catch (Exception e) {
2028                throw processException(e);
2029            }
2030            finally {
2031                if (count == null) {
2032                    count = Long.valueOf(0);
2033                }
2034
2035                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_N_S_P_R,
2036                    finderArgs, count);
2037
2038                closeSession(session);
2039            }
2040        }
2041
2042        return count.intValue();
2043    }
2044
2045    public int countAll() throws SystemException {
2046        Object[] finderArgs = new Object[0];
2047
2048        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2049                finderArgs, this);
2050
2051        if (count == null) {
2052            Session session = null;
2053
2054            try {
2055                session = openSession();
2056
2057                Query q = session.createQuery(
2058                        "SELECT COUNT(resourcePermission) FROM ResourcePermission resourcePermission");
2059
2060                count = (Long)q.uniqueResult();
2061            }
2062            catch (Exception e) {
2063                throw processException(e);
2064            }
2065            finally {
2066                if (count == null) {
2067                    count = Long.valueOf(0);
2068                }
2069
2070                FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
2071                    count);
2072
2073                closeSession(session);
2074            }
2075        }
2076
2077        return count.intValue();
2078    }
2079
2080    public void afterPropertiesSet() {
2081        String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2082                    com.liferay.portal.util.PropsUtil.get(
2083                        "value.object.listener.com.liferay.portal.model.ResourcePermission")));
2084
2085        if (listenerClassNames.length > 0) {
2086            try {
2087                List<ModelListener<ResourcePermission>> listenersList = new ArrayList<ModelListener<ResourcePermission>>();
2088
2089                for (String listenerClassName : listenerClassNames) {
2090                    listenersList.add((ModelListener<ResourcePermission>)Class.forName(
2091                            listenerClassName).newInstance());
2092                }
2093
2094                listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2095            }
2096            catch (Exception e) {
2097                _log.error(e);
2098            }
2099        }
2100    }
2101
2102    @BeanReference(name = "com.liferay.portal.service.persistence.AccountPersistence.impl")
2103    protected com.liferay.portal.service.persistence.AccountPersistence accountPersistence;
2104    @BeanReference(name = "com.liferay.portal.service.persistence.AddressPersistence.impl")
2105    protected com.liferay.portal.service.persistence.AddressPersistence addressPersistence;
2106    @BeanReference(name = "com.liferay.portal.service.persistence.BrowserTrackerPersistence.impl")
2107    protected com.liferay.portal.service.persistence.BrowserTrackerPersistence browserTrackerPersistence;
2108    @BeanReference(name = "com.liferay.portal.service.persistence.ClassNamePersistence.impl")
2109    protected com.liferay.portal.service.persistence.ClassNamePersistence classNamePersistence;
2110    @BeanReference(name = "com.liferay.portal.service.persistence.CompanyPersistence.impl")
2111    protected com.liferay.portal.service.persistence.CompanyPersistence companyPersistence;
2112    @BeanReference(name = "com.liferay.portal.service.persistence.ContactPersistence.impl")
2113    protected com.liferay.portal.service.persistence.ContactPersistence contactPersistence;
2114    @BeanReference(name = "com.liferay.portal.service.persistence.CountryPersistence.impl")
2115    protected com.liferay.portal.service.persistence.CountryPersistence countryPersistence;
2116    @BeanReference(name = "com.liferay.portal.service.persistence.EmailAddressPersistence.impl")
2117    protected com.liferay.portal.service.persistence.EmailAddressPersistence emailAddressPersistence;
2118    @BeanReference(name = "com.liferay.portal.service.persistence.GroupPersistence.impl")
2119    protected com.liferay.portal.service.persistence.GroupPersistence groupPersistence;
2120    @BeanReference(name = "com.liferay.portal.service.persistence.ImagePersistence.impl")
2121    protected com.liferay.portal.service.persistence.ImagePersistence imagePersistence;
2122    @BeanReference(name = "com.liferay.portal.service.persistence.LayoutPersistence.impl")
2123    protected com.liferay.portal.service.persistence.LayoutPersistence layoutPersistence;
2124    @BeanReference(name = "com.liferay.portal.service.persistence.LayoutSetPersistence.impl")
2125    protected com.liferay.portal.service.persistence.LayoutSetPersistence layoutSetPersistence;
2126    @BeanReference(name = "com.liferay.portal.service.persistence.ListTypePersistence.impl")
2127    protected com.liferay.portal.service.persistence.ListTypePersistence listTypePersistence;
2128    @BeanReference(name = "com.liferay.portal.service.persistence.LockPersistence.impl")
2129    protected com.liferay.portal.service.persistence.LockPersistence lockPersistence;
2130    @BeanReference(name = "com.liferay.portal.service.persistence.MembershipRequestPersistence.impl")
2131    protected com.liferay.portal.service.persistence.MembershipRequestPersistence membershipRequestPersistence;
2132    @BeanReference(name = "com.liferay.portal.service.persistence.OrganizationPersistence.impl")
2133    protected com.liferay.portal.service.persistence.OrganizationPersistence organizationPersistence;
2134    @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupPermissionPersistence.impl")
2135    protected com.liferay.portal.service.persistence.OrgGroupPermissionPersistence orgGroupPermissionPersistence;
2136    @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupRolePersistence.impl")
2137    protected com.liferay.portal.service.persistence.OrgGroupRolePersistence orgGroupRolePersistence;
2138    @BeanReference(name = "com.liferay.portal.service.persistence.OrgLaborPersistence.impl")
2139    protected com.liferay.portal.service.persistence.OrgLaborPersistence orgLaborPersistence;
2140    @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyPersistence.impl")
2141    protected com.liferay.portal.service.persistence.PasswordPolicyPersistence passwordPolicyPersistence;
2142    @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyRelPersistence.impl")
2143    protected com.liferay.portal.service.persistence.PasswordPolicyRelPersistence passwordPolicyRelPersistence;
2144    @BeanReference(name = "com.liferay.portal.service.persistence.PasswordTrackerPersistence.impl")
2145    protected com.liferay.portal.service.persistence.PasswordTrackerPersistence passwordTrackerPersistence;
2146    @BeanReference(name = "com.liferay.portal.service.persistence.PermissionPersistence.impl")
2147    protected com.liferay.portal.service.persistence.PermissionPersistence permissionPersistence;
2148    @BeanReference(name = "com.liferay.portal.service.persistence.PhonePersistence.impl")
2149    protected com.liferay.portal.service.persistence.PhonePersistence phonePersistence;
2150    @BeanReference(name = "com.liferay.portal.service.persistence.PluginSettingPersistence.impl")
2151    protected com.liferay.portal.service.persistence.PluginSettingPersistence pluginSettingPersistence;
2152    @BeanReference(name = "com.liferay.portal.service.persistence.PortletPersistence.impl")
2153    protected com.liferay.portal.service.persistence.PortletPersistence portletPersistence;
2154    @BeanReference(name = "com.liferay.portal.service.persistence.PortletItemPersistence.impl")
2155    protected com.liferay.portal.service.persistence.PortletItemPersistence portletItemPersistence;
2156    @BeanReference(name = "com.liferay.portal.service.persistence.PortletPreferencesPersistence.impl")
2157    protected com.liferay.portal.service.persistence.PortletPreferencesPersistence portletPreferencesPersistence;
2158    @BeanReference(name = "com.liferay.portal.service.persistence.RegionPersistence.impl")
2159    protected com.liferay.portal.service.persistence.RegionPersistence regionPersistence;
2160    @BeanReference(name = "com.liferay.portal.service.persistence.ReleasePersistence.impl")
2161    protected com.liferay.portal.service.persistence.ReleasePersistence releasePersistence;
2162    @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence.impl")
2163    protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
2164    @BeanReference(name = "com.liferay.portal.service.persistence.ResourceActionPersistence.impl")
2165    protected com.liferay.portal.service.persistence.ResourceActionPersistence resourceActionPersistence;
2166    @BeanReference(name = "com.liferay.portal.service.persistence.ResourceCodePersistence.impl")
2167    protected com.liferay.portal.service.persistence.ResourceCodePersistence resourceCodePersistence;
2168    @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePermissionPersistence.impl")
2169    protected com.liferay.portal.service.persistence.ResourcePermissionPersistence resourcePermissionPersistence;
2170    @BeanReference(name = "com.liferay.portal.service.persistence.RolePersistence.impl")
2171    protected com.liferay.portal.service.persistence.RolePersistence rolePersistence;
2172    @BeanReference(name = "com.liferay.portal.service.persistence.ServiceComponentPersistence.impl")
2173    protected com.liferay.portal.service.persistence.ServiceComponentPersistence serviceComponentPersistence;
2174    @BeanReference(name = "com.liferay.portal.service.persistence.ShardPersistence.impl")
2175    protected com.liferay.portal.service.persistence.ShardPersistence shardPersistence;
2176    @BeanReference(name = "com.liferay.portal.service.persistence.SubscriptionPersistence.impl")
2177    protected com.liferay.portal.service.persistence.SubscriptionPersistence subscriptionPersistence;
2178    @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence.impl")
2179    protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
2180    @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupPersistence.impl")
2181    protected com.liferay.portal.service.persistence.UserGroupPersistence userGroupPersistence;
2182    @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupRolePersistence.impl")
2183    protected com.liferay.portal.service.persistence.UserGroupRolePersistence userGroupRolePersistence;
2184    @BeanReference(name = "com.liferay.portal.service.persistence.UserIdMapperPersistence.impl")
2185    protected com.liferay.portal.service.persistence.UserIdMapperPersistence userIdMapperPersistence;
2186    @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPersistence.impl")
2187    protected com.liferay.portal.service.persistence.UserTrackerPersistence userTrackerPersistence;
2188    @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPathPersistence.impl")
2189    protected com.liferay.portal.service.persistence.UserTrackerPathPersistence userTrackerPathPersistence;
2190    @BeanReference(name = "com.liferay.portal.service.persistence.WebDAVPropsPersistence.impl")
2191    protected com.liferay.portal.service.persistence.WebDAVPropsPersistence webDAVPropsPersistence;
2192    @BeanReference(name = "com.liferay.portal.service.persistence.WebsitePersistence.impl")
2193    protected com.liferay.portal.service.persistence.WebsitePersistence websitePersistence;
2194    private static Log _log = LogFactoryUtil.getLog(ResourcePermissionPersistenceImpl.class);
2195}