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