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